From 6ef013be0392dc3537cf182d1351a1b44ddba56a Mon Sep 17 00:00:00 2001 From: Sumeyra Kanik Date: Fri, 5 May 2023 16:06:02 +0200 Subject: [PATCH 1/2] Changes in ISM Encoder related to NULL metadata, tcx_only and radius difference --- lib_com/ivas_stat_com.h | 4 +++- lib_com/options.h | 2 ++ lib_enc/ivas_ism_metadata_enc.c | 27 ++++++++++++++++++++++++--- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index 950e43a88e..dafb38ecbc 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -75,7 +75,9 @@ typedef struct int16_t ism_md_fec_cnt_enc; /* counter of continuous frames where MD are not transmitted */ int16_t ism_md_inc_diff_cnt; /* counter of continuous frames where MD are transmitted in inactive segments when MD significantly changes */ #endif - +#ifdef FIX_435_ISM_MERGE_BUG + float last_true_radius; /* last true Q radius value */ +#endif } ISM_METADATA_FRAME, *ISM_METADATA_HANDLE; diff --git a/lib_com/options.h b/lib_com/options.h index d841a798e2..c13b959e5f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -172,6 +172,8 @@ #define EUALER2QUAT_FIX /*Dlb :fix for issue 430 issue in euler2quat, sign of quat y is inverted*/ #define HR_METADATA /* Nok: encode directional MASA metadata with more bits at 384k and 512k */ + +#define FIX_435_ISM_MERGE_BUG /* Eri: Merge bug fix for ISM NULL metadata and tcx_only cases */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index e9e40a574c..250da4003b 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -61,7 +61,9 @@ #define ISM_MD_INC_DIFF_CNT_MAX 6 #define ISM_MD_FEC_CNT_MAX 25 #endif - +#ifdef FIX_435_ISM_MERGE_BUG +#define ISM_MD_RAD_FEC_DIFF 1 +#endif #define INTER_OBJECT_PARAM_CHECK ( ( ISM_FEC_MAX / 2 ) - 2 ) /* note: constant must be less than (ISM_FEC_MAX / number of coded parameters) */ @@ -221,14 +223,24 @@ ivas_error ivas_ism_metadata_enc( } else if ( ism_mode == ISM_MODE_DISC ) { +#ifdef FIX_435_ISM_MERGE_BUG + if ( hIsmMeta[ch]->ism_metadata_flag == 1 ) + { + /* In case of low level noise for low bitrate inactive frames, do not sent metadata */ + hIsmMeta[ch]->ism_metadata_flag = localVAD[ch] || hSCE[ch]->hCoreCoder[0]->lp_noise > 10 || hSCE[ch]->hCoreCoder[0]->tcxonly; +#else hIsmMeta[ch]->ism_metadata_flag = localVAD[ch] || hSCE[ch]->hCoreCoder[0]->lp_noise > 10; - +#endif #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 ) ) + ( fabsf( hIsmMeta[ch]->elevation - hIsmMeta[ch]->last_true_elevation ) > ISM_MD_FEC_DIFF ) +#ifdef FIX_435_ISM_MERGE_BUG + || ( fabsf( hIsmMeta[ch]->radius - hIsmMeta[ch]->last_true_radius ) > ISM_MD_RAD_FEC_DIFF ) +#endif + ) { hIsmMeta[ch]->ism_metadata_flag = 1; hIsmMeta[ch]->ism_md_inc_diff_cnt = 0; @@ -252,6 +264,9 @@ ivas_error ivas_ism_metadata_enc( hIsmMeta[ch]->position_angle.angle1_diff_cnt = ISM_FEC_MAX; } } +#endif +#ifdef FIX_435_ISM_MERGE_BUG + } #endif } } @@ -369,6 +384,9 @@ ivas_error ivas_ism_metadata_enc( /* Updates */ hIsmMeta[ch]->last_true_azimuth = hIsmMeta[ch]->azimuth; hIsmMeta[ch]->last_true_elevation = hIsmMeta[ch]->elevation; +#endif +#ifdef FIX_435_ISM_MERGE_BUG + hIsmMeta[ch]->last_true_radius = hIsmMeta[ch]->radius; #endif } } @@ -610,6 +628,9 @@ ivas_error ivas_ism_metadata_enc_create( st_ivas->hIsmMetaData[ch]->last_true_elevation = 0.0f; st_ivas->hIsmMetaData[ch]->ism_md_fec_cnt_enc = 0; st_ivas->hIsmMetaData[ch]->ism_md_inc_diff_cnt = ISM_MD_INC_DIFF_CNT_MAX; +#endif +#ifdef FIX_435_ISM_MERGE_BUG + st_ivas->hIsmMetaData[ch]->last_true_radius = 1.0f; #endif } -- GitLab From b79279e688f9bff75ac5a3046f43d6944722e326 Mon Sep 17 00:00:00 2001 From: Sumeyra Kanik Date: Sun, 7 May 2023 23:48:28 +0200 Subject: [PATCH 2/2] Format fix --- lib_com/ivas_stat_com.h | 2 +- lib_enc/ivas_ism_metadata_enc.c | 50 ++++++++++++++++----------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index dafb38ecbc..c1e35d822c 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -76,7 +76,7 @@ typedef struct int16_t ism_md_inc_diff_cnt; /* counter of continuous frames where MD are transmitted in inactive segments when MD significantly changes */ #endif #ifdef FIX_435_ISM_MERGE_BUG - float last_true_radius; /* last true Q radius value */ + float last_true_radius; /* last true Q radius value */ #endif } ISM_METADATA_FRAME, *ISM_METADATA_HANDLE; diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 250da4003b..a4678d6bbb 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -62,7 +62,7 @@ #define ISM_MD_FEC_CNT_MAX 25 #endif #ifdef FIX_435_ISM_MERGE_BUG -#define ISM_MD_RAD_FEC_DIFF 1 +#define ISM_MD_RAD_FEC_DIFF 1 #endif #define INTER_OBJECT_PARAM_CHECK ( ( ISM_FEC_MAX / 2 ) - 2 ) /* note: constant must be less than (ISM_FEC_MAX / number of coded parameters) */ @@ -232,38 +232,38 @@ ivas_error ivas_ism_metadata_enc( hIsmMeta[ch]->ism_metadata_flag = localVAD[ch] || hSCE[ch]->hCoreCoder[0]->lp_noise > 10; #endif #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 ) + { + 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 ) #ifdef FIX_435_ISM_MERGE_BUG - || ( fabsf( hIsmMeta[ch]->radius - hIsmMeta[ch]->last_true_radius ) > ISM_MD_RAD_FEC_DIFF ) + || ( fabsf( hIsmMeta[ch]->radius - hIsmMeta[ch]->last_true_radius ) > ISM_MD_RAD_FEC_DIFF ) #endif ) - { - 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 ) { - 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 #ifdef FIX_435_ISM_MERGE_BUG } -- GitLab