From 3b46b48fec0b3e5116f05606d3e640e26c580f1b Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 16 Oct 2023 12:47:30 +0200 Subject: [PATCH 1/5] wrap set_f() into DEBUG_MODE_INFO --- lib_debug/snr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib_debug/snr.c b/lib_debug/snr.c index 5efefe8737..3e817287c7 100644 --- a/lib_debug/snr.c +++ b/lib_debug/snr.c @@ -84,6 +84,7 @@ static float mem_synth_snr[MAX_INPUT_CHANNELS][M]; here we do not want to include prot.h due to its dependencies *--------------------------------------------------------------------*/ +#ifdef DEBUG_MODE_INFO static void set_f( float y[], /* i/o: Vector to set */ const float a, /* i : Value to set the vector to */ @@ -99,7 +100,7 @@ static void set_f( return; } - +#endif static float sum2_f( const float *vec, /* i : input vector */ -- GitLab From 737b471a8215a6bbc0cbce97ad912d413e961cb9 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 16 Oct 2023 12:54:05 +0200 Subject: [PATCH 2/5] remove unused function IVAS_DEC_VoIP_GetRenderGranularity() and defaultCrendWrapper() --- lib_dec/lib_dec.c | 14 -------------- lib_rend/lib_rend.c | 23 +---------------------- 2 files changed, 1 insertion(+), 36 deletions(-) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 9c5f8b2d78..69b1414cf1 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -106,7 +106,6 @@ static void store_JbmData( IVAS_DEC_VOIP *hVoIP, JB4_DATAUNIT_HANDLE dataUnit, c static ivas_error evs_dec_main( Decoder_Struct *st_ivas, const int16_t nOutSamples, float *floatBuf, int16_t *pcmBuf ); 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 ); -static int16_t IVAS_DEC_VoIP_GetRenderGranularity( Decoder_Struct *st_ivas ); static ivas_error IVAS_DEC_VoIP_reconfigure( IVAS_DEC_HANDLE hIvasDec, const uint16_t nTransportChannels, const uint16_t l_ts ); #ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error IVAS_DEC_Setup( IVAS_DEC_HANDLE hIvasDec, uint16_t *nTcBufferGranularity, uint8_t *nTransportChannels, uint8_t *nOutChannels, uint16_t *nSamplesRendered, const IVAS_DEC_PCM_TYPE pcmType, void *data ); @@ -3611,19 +3610,6 @@ static ivas_error input_format_API_to_internal( } -/*---------------------------------------------------------------------* - * IVAS_DEC_VoIP_GetRenderGranularity() - * - * - *---------------------------------------------------------------------*/ - -static int16_t IVAS_DEC_VoIP_GetRenderGranularity( - Decoder_Struct *st_ivas ) -{ - return st_ivas->hTcBuffer->n_samples_granularity; -} - - /*---------------------------------------------------------------------* * IVAS_DEC_VoIP_reconfigure() * diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index fdc88ddb4a..e347f41096 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -1278,27 +1278,6 @@ static TDREND_WRAPPER defaultTdRendWrapper( } -static CREND_WRAPPER defaultCrendWrapper( - void ) -{ - 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; - - return w; -} - - static bool isIoConfigPairSupported( const AUDIO_CONFIG inConfig, const AUDIO_CONFIG outConfig ) @@ -8851,7 +8830,7 @@ static ivas_error getSamplesInternal( convertBitsBufferToInternalBitsBuff( *hBits, &bits ); if ( ( error = ivas_renderMultiBinToSplitBinaural( &hIvasRend->splitRendWrapper, hIvasRend->headRotData.headPositions[0], hIvasRend->hRendererConfig->split_rend_config.splitRendBitRate, hIvasRend->hRendererConfig->split_rend_config.codec, hIvasRend->hRendererConfig->split_rend_config.codec_frame_size_ms, - &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ) ) != IVAS_ERR_OK ) + &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, (const int16_t) ( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ) ) != IVAS_ERR_OK ) { return error; } -- GitLab From 74ca4fbe393e6bcc7be14026d4798667dd093775 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 16 Oct 2023 13:05:04 +0200 Subject: [PATCH 3/5] remove unused function ivas_qmetadata_entropy_encode_diffuseness_hr() --- lib_enc/ivas_qmetadata_enc.c | 101 +---------------------------------- 1 file changed, 1 insertion(+), 100 deletions(-) diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index 63ad2bb680..0be2dc62d8 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -49,8 +49,8 @@ #ifdef DEBUG_MODE_QMETADATA static float direction_distance( float elevation[DIRAC_MAX_NBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], float azimuth[DIRAC_MAX_NBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], IVAS_QDIRECTION *q_direction, const int16_t dim1, const int16_t dim2, float mat_dist[DIRAC_MAX_NBANDS][MAX_PARAM_SPATIAL_SUBFRAMES] ); -#endif +#endif static void ivas_qmetadata_quantize_diffuseness_nrg_ratios( IVAS_QMETADATA_HANDLE hQMetaData, int16_t *needed_bits, int16_t *nbits_diff, int16_t *dfRatioBits, const int16_t hodirac_flag ); static int16_t ivas_qmetadata_entropy_encode_diffuseness( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, uint16_t *diffuseness_index_max_ec_frame ); @@ -115,8 +115,6 @@ 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 ); -static int16_t ivas_qmetadata_entropy_encode_diffuseness_hr( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, uint16_t *diffuseness_index_max_ec_frame ); - static void ivas_qmetadata_quantize_diffuseness_nrg_ratios_hr_512( IVAS_QMETADATA_HANDLE hQMetaData, int16_t *needed_bits, const int16_t bits_dir_hr, BSTR_ENC_HANDLE hMetaData ); static int16_t encode_surround_coherence_hr( IVAS_QMETADATA *hQMetaData, BSTR_ENC_HANDLE hMetaData ); @@ -1454,103 +1452,6 @@ static void ivas_qmetadata_quantize_diffuseness_nrg_ratios_hr_512( } -/*------------------------------------------------------------------------- - * ivas_qmetadata_entropy_encode_diffuseness() - * - * encode diffuseness - *------------------------------------------------------------------------*/ - -static int16_t ivas_qmetadata_entropy_encode_diffuseness_hr( - BSTR_ENC_HANDLE hMetaData, - IVAS_QDIRECTION *q_direction, - uint16_t *diffuseness_index_max_ec_frame ) -{ - int16_t start_bit_pos; - int16_t diffuseness_bits_raw; - int16_t b; - int16_t min_diffuseness_m_index, max_diffuseness_m_index; - int16_t nbands; - int16_t start_band; - - nbands = q_direction->cfg.nbands; - start_band = q_direction->cfg.start_band; - - start_bit_pos = hMetaData->nb_bits_tot; - - if ( nbands == 1 ) - { - /* If there is only one band, diffuseness should be coded directly as raw with no signaling. */ - push_next_indice( hMetaData, q_direction->band_data[0].energy_ratio_index[0], MASA_BITS_ER_HR ); - *diffuseness_index_max_ec_frame = 10; - return ( hMetaData->nb_bits_tot - start_bit_pos ); - } - - /* compute the number of raw coding bits */ - diffuseness_bits_raw = 0; - for ( b = start_band; b < nbands; b++ ) - { - diffuseness_bits_raw += ivas_qmetadata_encode_quasi_uniform_length( q_direction->band_data[b].energy_ratio_index[0], HR_MASA_ER_LEVELS ); - } - - min_diffuseness_m_index = q_direction->band_data[start_band].energy_ratio_index[0]; - max_diffuseness_m_index = q_direction->band_data[start_band].energy_ratio_index[0]; - - for ( b = start_band; b < nbands; b++ ) - { - if ( q_direction->band_data[b].energy_ratio_index[0] < min_diffuseness_m_index ) - { - min_diffuseness_m_index = q_direction->band_data[b].energy_ratio_index[0]; - } - - if ( q_direction->band_data[b].energy_ratio_index[0] > max_diffuseness_m_index ) - { - max_diffuseness_m_index = q_direction->band_data[b].energy_ratio_index[0]; - } - } - - /* Use similarity coding approach or raw coding when there is a low number of bands. */ - /* one bit is used to indicate whether diffuseness values are entropy coded or coded raw */ - if ( min_diffuseness_m_index == max_diffuseness_m_index ) /* all values are equal */ - { - push_next_indice( hMetaData, 0, 1 ); /* dif_use_raw_coding */ - push_next_indice( hMetaData, 1, 1 ); /* dif_have_unique_value */ - ivas_qmetadata_encode_quasi_uniform( hMetaData, min_diffuseness_m_index, HR_MASA_ER_LEVELS ); /* dif_unique_value */ - } - else if ( min_diffuseness_m_index + 1 == max_diffuseness_m_index ) /* only two consecutive values are present */ - { - push_next_indice( hMetaData, 0, 1 ); /* dif_use_raw_coding */ - push_next_indice( hMetaData, 0, 1 ); /* dif_have_unique_value */ - ivas_qmetadata_encode_quasi_uniform( hMetaData, min_diffuseness_m_index, HR_MASA_ER_LEVELS - 1 ); /* dif_min_value */ - - for ( b = start_band; b < nbands; b++ ) - { - push_next_indice( hMetaData, q_direction->band_data[b].energy_ratio_index[0] - min_diffuseness_m_index, 1 ); /* dif_bit_offset_values */ - } - } - else /* raw coding */ - { - push_next_indice( hMetaData, 1, 1 ); /* dif_use_raw_coding */ - - for ( b = start_band; b < nbands; b++ ) - { - ivas_qmetadata_encode_quasi_uniform( hMetaData, q_direction->band_data[b].energy_ratio_index[0], HR_MASA_ER_LEVELS ); /* dif_values */ - } - } - - *diffuseness_index_max_ec_frame = 10; - /* adaptively select the diffuseness_index_max_ec threshold */ - if ( min_diffuseness_m_index > 10 ) - { - *diffuseness_index_max_ec_frame = HR_MASA_ER_LEVELS - 1; - } - -#ifdef DEBUGGING - assert( ( hMetaData->nb_bits_tot - start_bit_pos ) <= 1 + diffuseness_bits_raw ); -#endif - return ( hMetaData->nb_bits_tot - start_bit_pos ); -} - - /*------------------------------------------------------------------------- * ivas_qmetadata_quantize_diffuseness_nrg_ratios() * -- GitLab From 483a96a73d4ad35817dea90de6c1dc5db4bf95f9 Mon Sep 17 00:00:00 2001 From: knj Date: Mon, 16 Oct 2023 14:20:01 +0200 Subject: [PATCH 4/5] make unused static functions a warning again --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ce3d0a4a5e..a8ed6662a9 100644 --- a/Makefile +++ b/Makefile @@ -58,7 +58,7 @@ endif CFLAGS += -std=c99 -pedantic -Wcast-qual -Wall -W -Wextra -Wno-long-long \ -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \ -Werror-implicit-function-declaration \ - -Wno-unused-function -Wno-implicit-fallthrough + -Wno-implicit-fallthrough # libs to link LDLIBS += -lm -- GitLab From bc7a4650f9e64277aa174d1a36c30235b3e9d2a7 Mon Sep 17 00:00:00 2001 From: knj Date: Mon, 16 Oct 2023 14:23:10 +0200 Subject: [PATCH 5/5] apply clang-format --- 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 e347f41096..63977917e2 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8830,7 +8830,7 @@ static ivas_error getSamplesInternal( convertBitsBufferToInternalBitsBuff( *hBits, &bits ); if ( ( error = ivas_renderMultiBinToSplitBinaural( &hIvasRend->splitRendWrapper, hIvasRend->headRotData.headPositions[0], hIvasRend->hRendererConfig->split_rend_config.splitRendBitRate, hIvasRend->hRendererConfig->split_rend_config.codec, hIvasRend->hRendererConfig->split_rend_config.codec_frame_size_ms, - &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, (const int16_t) ( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ) ) != IVAS_ERR_OK ) + &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ) ) != IVAS_ERR_OK ) { return error; } -- GitLab