From d6711912313f292bb513370393bfead636e7f8b4 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 8 May 2024 14:08:54 +0200 Subject: [PATCH 1/3] Added LC3PLUS_LEA_COMPAT_BITRATES_48_6 flag to treat split-rendering 256kbps lc3plus 10ms 0dof bitrate as sentinel value for LEA compatible 48_6 bitrate (124 kbps per channel) --- lib_com/bitstream.c | 16 +++++++++++++ lib_com/options.h | 4 +++- lib_isar/isar_prot.h | 8 +++++++ lib_isar/isar_splitRendererPre.c | 15 ++++++++++++ lib_isar/isar_splitRenderer_utils.c | 24 +++++++++++++++++++ lib_isar/lib_isar_pre_rend.c | 11 +++++++++ pytest.ini | 1 + .../lc3plus/ivas_lc3plus_unit_test.c | 8 +++++++ 8 files changed, 86 insertions(+), 1 deletion(-) diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index cff1f5b5e0..32e368e75c 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -884,7 +884,11 @@ ivas_error check_ind_list_limits( } else { +#ifdef IVAS_ERRORS_FIX_GLOBAL_FRAME + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Buffer of indices corrupted! Attempt to overwrite indice ID = %d (value: %d, bits: %d)!\n", hBstr->ind_list[hBstr->nb_ind_tot].id, hBstr->ind_list[hBstr->nb_ind_tot].value, hBstr->ind_list[hBstr->nb_ind_tot].nb_bits ); +#else return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Buffer of indices corrupted in frame %d! Attempt to overwrite indice ID = %d (value: %d, bits: %d)!\n", frame, hBstr->ind_list[hBstr->nb_ind_tot].id, hBstr->ind_list[hBstr->nb_ind_tot].value, hBstr->ind_list[hBstr->nb_ind_tot].nb_bits ); +#endif } } @@ -939,7 +943,11 @@ ivas_error push_indice( /* check the limits of the list of indices */ if ( ( error = check_ind_list_limits( hBstr ) ) != IVAS_ERR_OK ) { +#ifdef IVAS_ERRORS_FIX_GLOBAL_FRAME + return IVAS_ERROR( error, "Error occured in push_indice() while re-allocating the list of indices!\n" ); +#else return IVAS_ERROR( error, "Error occured in push_indice() while re-allocating the list of indices (frame %d) !\n", frame ); +#endif } /* find the location in the list of indices based on ID */ @@ -1095,7 +1103,11 @@ ivas_error push_next_bits( /* check the limits of the list of indices */ if ( ( error = check_ind_list_limits( hBstr ) ) != IVAS_ERR_OK ) { +#ifdef IVAS_ERRORS_FIX_GLOBAL_FRAME + return IVAS_ERROR( error, "Error occured in push_next_bits() while re-allocating the list of indices!\n" ); +#else return IVAS_ERROR( error, "Error occured in push_next_bits() while re-allocating the list of indices (frame %d) !\n", frame ); +#endif } ptr = &hBstr->ind_list[hBstr->nb_ind_tot]; @@ -1114,7 +1126,11 @@ ivas_error push_next_bits( /* check the limits of the list of indices */ if ( ( error = check_ind_list_limits( hBstr ) ) != IVAS_ERR_OK ) { +#ifdef IVAS_ERRORS_FIX_GLOBAL_FRAME + return IVAS_ERROR( error, "Error occured in push_next_bits() while re-allocating the list of indices!\n" ); +#else return IVAS_ERROR( error, "Error occured in push_next_bits() while re-allocating the list of indices (frame %d) !\n", frame ); +#endif } ptr = &hBstr->ind_list[hBstr->nb_ind_tot]; diff --git a/lib_com/options.h b/lib_com/options.h index dd37e87f03..13e698cbe4 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -157,7 +157,9 @@ #define SPLIT_REND_WITH_HEAD_ROT /* Dlb,FhG: Split Rendering contributions 21 and 35 */ #define ISAR_BITSTREAM_UPDATE_LC3PLUS /* FhG: Multiple improvements to the ISAR bitstream when LC3plus is used. See MR 1456 for details. */ #define SPLIT_REND_POSE_CORRECTION_UNUSED_BITS - +#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS +#define LC3PLUS_LEA_COMPAT_BITRATES_48_6 /* FhG: treat split-rendering 256kbps lc3plus 10ms 0dof bitrate as sentinel value for LEA compatible 48_6 bitrate (124 kbps per channel) */ +#endif #define FIX_NUM_SUBFRAME_UPDATE #define FIX_1053_REVERB_RECONFIGURATION /* Philips: issue 1053: fix for dynamic switching of acoustic environment */ diff --git a/lib_isar/isar_prot.h b/lib_isar/isar_prot.h index ffc42b2283..7431b7bc95 100644 --- a/lib_isar/isar_prot.h +++ b/lib_isar/isar_prot.h @@ -317,6 +317,14 @@ int32_t isar_get_lc3plus_bitrate( const int16_t split_prerender_frame_size_ms ); #endif +#ifdef LC3PLUS_LEA_COMPAT_BITRATES_48_6 +int32_t isar_get_lc3plus_bitrate( + const int32_t SplitRendBitRate, + const ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode, + const int32_t nChannels, + const int32_t codecFrameDurationUs ); +#endif + ivas_error isar_split_rend_validate_config( const ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, const int16_t pcm_out_flag ); diff --git a/lib_isar/isar_splitRendererPre.c b/lib_isar/isar_splitRendererPre.c index ef1072f5c9..3db6abf319 100644 --- a/lib_isar/isar_splitRendererPre.c +++ b/lib_isar/isar_splitRendererPre.c @@ -1969,7 +1969,11 @@ ivas_error split_renderer_open_lc3plus( if ( ( error = ISAR_LC3PLUS_ENC_Open( config, #ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS +#ifdef LC3PLUS_LEA_COMPAT_BITRATES_48_6 + isar_get_lc3plus_bitrate( pSplitRendConfig->splitRendBitRate, pSplitRendConfig->poseCorrectionMode, config.channels, config.lc3plus_frame_duration_us ), +#else isar_get_lcld_bitrate( pSplitRendConfig->splitRendBitRate, pSplitRendConfig->poseCorrectionMode ), +#endif #else isar_get_lc3plus_bitrate( pSplitRendConfig->splitRendBitRate, pSplitRendConfig->poseCorrectionMode, (int16_t) ( config.isar_frame_duration_us / 1000 ) ), #endif @@ -2229,7 +2233,18 @@ ivas_error isar_renderMultiTDBinToSplitBinaural( { #ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS #ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS +#ifdef LC3PLUS_LEA_COMPAT_BITRATES_48_6 + if ( pBits->pose_correction == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) + { + available_bits = isar_get_lc3plus_bitrate( SplitRendBitRate, hSplitBin->multiBinPoseData.poseCorrectionMode, hSplitBin->hLc3plusEnc->config.channels, hSplitBin->hLc3plusEnc->config.lc3plus_frame_duration_us ) / FRAMES_PER_SEC; + } + else + { + available_bits = ( SplitRendBitRate / FRAMES_PER_SEC ) - pBits->bits_written; + } +#else available_bits = ( SplitRendBitRate / FRAMES_PER_SEC ) - pBits->bits_written; +#endif if ( ( error = splitRendLc3plusEncodeAndWrite( hSplitBin, pBits, available_bits, in ) ) != IVAS_ERR_OK ) #else available_bits = ( SplitRendBitRate / FRAMES_PER_SEC ) - pBits->bits_written; diff --git a/lib_isar/isar_splitRenderer_utils.c b/lib_isar/isar_splitRenderer_utils.c index f6933796df..81961fd949 100644 --- a/lib_isar/isar_splitRenderer_utils.c +++ b/lib_isar/isar_splitRenderer_utils.c @@ -563,6 +563,30 @@ int32_t isar_get_lcld_bitrate( return -1; } +#ifdef LC3PLUS_LEA_COMPAT_BITRATES_48_6 +/*------------------------------------------------------------------------- + * Function isar_get_lc3plus_bitrate() + * + * + *------------------------------------------------------------------------*/ + +int32_t isar_get_lc3plus_bitrate( + const int32_t SplitRendBitRate, + const ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode, + const int32_t nChannels, + const int32_t codecFrameDurationUs ) +{ + int32_t bitrate; + bitrate = isar_get_lcld_bitrate( SplitRendBitRate, poseCorrectionMode ); + /* Check for LC3plus LEA 48_6 LC3 compatibility mode signalling */ + if ( ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE == poseCorrectionMode && bitrate == 256000 && nChannels == 2 && codecFrameDurationUs == 10000 ) + { + bitrate = 2 * 126000; + } + return bitrate; +} +#endif + #ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS /*------------------------------------------------------------------------- diff --git a/lib_isar/lib_isar_pre_rend.c b/lib_isar/lib_isar_pre_rend.c index c7d66e1263..15e08660e5 100644 --- a/lib_isar/lib_isar_pre_rend.c +++ b/lib_isar/lib_isar_pre_rend.c @@ -434,7 +434,18 @@ ivas_error ISAR_PRE_REND_MultiBinToSplitBinaural( } #ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS +#ifdef LC3PLUS_LEA_COMPAT_BITRATES_48_6 + if ( pBits->pose_correction == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) + { + available_bits = isar_get_lc3plus_bitrate( SplitRendBitRate, hSplitBin->multiBinPoseData.poseCorrectionMode, hSplitBin->hLc3plusEnc->config.channels, hSplitBin->hLc3plusEnc->config.lc3plus_frame_duration_us ) / FRAMES_PER_SEC; + } + else + { + available_bits = ( SplitRendBitRate / FRAMES_PER_SEC ) - pBits->bits_written; + } +#else available_bits = ( SplitRendBitRate / FRAMES_PER_SEC ) - pBits->bits_written; +#endif if ( ( error = splitRendLc3plusEncodeAndWrite( hSplitBin, pBits, available_bits, output ) ) != IVAS_ERR_OK ) #else if ( ( error = splitRendLc3plusEncodeAndWrite( hSplitBin, pBits, SplitRendBitRate, output ) ) != IVAS_ERR_OK ) diff --git a/pytest.ini b/pytest.ini index 14538fd90d..45c5e2b325 100644 --- a/pytest.ini +++ b/pytest.ini @@ -14,3 +14,4 @@ log_format = %(asctime)s %(levelname)s %(message)s log_date_format = %Y-%m-%d %H:%M:%S # for pytest-html report: do not log environment variables from the runners environment_table_redact_list = .* +; xfail_strict = true diff --git a/scripts/split_rendering/lc3plus/ivas_lc3plus_unit_test.c b/scripts/split_rendering/lc3plus/ivas_lc3plus_unit_test.c index 53c7c45165..e57db546ba 100644 --- a/scripts/split_rendering/lc3plus/ivas_lc3plus_unit_test.c +++ b/scripts/split_rendering/lc3plus/ivas_lc3plus_unit_test.c @@ -684,7 +684,11 @@ static int encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_96kbpsPerChannel( return encodeAndDecodeOneStereoFrame( config, config.channels * 98*1000 ); } +#ifdef LC3PLUS_LEA_COMPAT_BITRATES_48_6 +static int encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_126kbpsPerChannel( void ) +#else static int encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_124kbpsPerChannel( void ) +#endif { #ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 10 * 1000, .channels = 2, .samplerate = 48000, .high_res_mode_enabled = 0 }; @@ -823,7 +827,11 @@ int main( ret = encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_96kbpsPerChannel(); if ( ret != 0 ) return 1; +#ifdef LC3PLUS_LEA_COMPAT_BITRATES_48_6 + ret = encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_126kbpsPerChannel(); +#else ret = encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_124kbpsPerChannel(); +#endif if ( ret != 0 ) return 1; #ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS -- GitLab From 07dad6372025955da1de9f139e2cb4009a2bc136 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Tue, 14 May 2024 08:40:07 +0200 Subject: [PATCH 2/3] remove IVAS_ERRORS_FIX_GLOBAL_FRAME --- lib_com/bitstream.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index 32e368e75c..cff1f5b5e0 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -884,11 +884,7 @@ ivas_error check_ind_list_limits( } else { -#ifdef IVAS_ERRORS_FIX_GLOBAL_FRAME - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Buffer of indices corrupted! Attempt to overwrite indice ID = %d (value: %d, bits: %d)!\n", hBstr->ind_list[hBstr->nb_ind_tot].id, hBstr->ind_list[hBstr->nb_ind_tot].value, hBstr->ind_list[hBstr->nb_ind_tot].nb_bits ); -#else return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Buffer of indices corrupted in frame %d! Attempt to overwrite indice ID = %d (value: %d, bits: %d)!\n", frame, hBstr->ind_list[hBstr->nb_ind_tot].id, hBstr->ind_list[hBstr->nb_ind_tot].value, hBstr->ind_list[hBstr->nb_ind_tot].nb_bits ); -#endif } } @@ -943,11 +939,7 @@ ivas_error push_indice( /* check the limits of the list of indices */ if ( ( error = check_ind_list_limits( hBstr ) ) != IVAS_ERR_OK ) { -#ifdef IVAS_ERRORS_FIX_GLOBAL_FRAME - return IVAS_ERROR( error, "Error occured in push_indice() while re-allocating the list of indices!\n" ); -#else return IVAS_ERROR( error, "Error occured in push_indice() while re-allocating the list of indices (frame %d) !\n", frame ); -#endif } /* find the location in the list of indices based on ID */ @@ -1103,11 +1095,7 @@ ivas_error push_next_bits( /* check the limits of the list of indices */ if ( ( error = check_ind_list_limits( hBstr ) ) != IVAS_ERR_OK ) { -#ifdef IVAS_ERRORS_FIX_GLOBAL_FRAME - return IVAS_ERROR( error, "Error occured in push_next_bits() while re-allocating the list of indices!\n" ); -#else return IVAS_ERROR( error, "Error occured in push_next_bits() while re-allocating the list of indices (frame %d) !\n", frame ); -#endif } ptr = &hBstr->ind_list[hBstr->nb_ind_tot]; @@ -1126,11 +1114,7 @@ ivas_error push_next_bits( /* check the limits of the list of indices */ if ( ( error = check_ind_list_limits( hBstr ) ) != IVAS_ERR_OK ) { -#ifdef IVAS_ERRORS_FIX_GLOBAL_FRAME - return IVAS_ERROR( error, "Error occured in push_next_bits() while re-allocating the list of indices!\n" ); -#else return IVAS_ERROR( error, "Error occured in push_next_bits() while re-allocating the list of indices (frame %d) !\n", frame ); -#endif } ptr = &hBstr->ind_list[hBstr->nb_ind_tot]; -- GitLab From 149079a69b8a002c3e453e646f0a0a1e2a2987ab Mon Sep 17 00:00:00 2001 From: hsd Date: Tue, 14 May 2024 18:01:32 +0200 Subject: [PATCH 3/3] cleanup of merge artifacts --- lib_com/options.h | 2 +- pytest.ini | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index a9fb77d912..56cd069b7a 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -156,7 +156,7 @@ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ #define SPLIT_REND_WITH_HEAD_ROT /* Dlb,FhG: Split Rendering contributions 21 and 35 */ #ifdef SPLIT_REND_WITH_HEAD_ROT -#define ISAR_BITSTREAM_UPDATE_LC3PLUS /* FhG: Multiple improvements to the ISAR bitstream when LC3plus is used. See MR 1456 for details. */ +#define ISAR_BITSTREAM_UPDATE_LC3PLUS /* FhG: Multiple improvements to the ISAR bitstream when LC3plus is used. See MR 1456 for details. */ #ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS #define LC3PLUS_LEA_COMPAT_BITRATES_48_6 /* FhG: treat split-rendering 256kbps lc3plus 10ms 0dof bitrate as sentinel value for LEA compatible 48_6 bitrate (124 kbps per channel) */ #endif diff --git a/pytest.ini b/pytest.ini index 45c5e2b325..14538fd90d 100644 --- a/pytest.ini +++ b/pytest.ini @@ -14,4 +14,3 @@ log_format = %(asctime)s %(levelname)s %(message)s log_date_format = %Y-%m-%d %H:%M:%S # for pytest-html report: do not log environment variables from the runners environment_table_redact_list = .* -; xfail_strict = true -- GitLab