From 0e066547bb64617d22fa547871a7b7116f641e9b Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 22 Jan 2025 09:01:03 +0530 Subject: [PATCH] Fix for LTV assert issues - Bitrate switching cases --- lib_enc/speech_music_classif_fx.c | 18 +++++----- lib_enc/stat_enc.h | 1 + ltv.patch | 60 +++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 8 deletions(-) create mode 100644 ltv.patch diff --git a/lib_enc/speech_music_classif_fx.c b/lib_enc/speech_music_classif_fx.c index 8d6abfddd..8ef4e7f43 100644 --- a/lib_enc/speech_music_classif_fx.c +++ b/lib_enc/speech_music_classif_fx.c @@ -268,8 +268,8 @@ void speech_music_clas_init_ivas_fx( hSpMusClas->sp_mus_state = -8; move16(); - hSpMusClas->wdrop_fx = 0; - move16(); + hSpMusClas->wdrop_32fx = 0; + move32(); hSpMusClas->wrise_fx = 0; move16(); hSpMusClas->wdlp_0_95_sp_fx = 0; @@ -2390,19 +2390,21 @@ Word16 ivas_smc_gmm_fx( { IF( hSpMusClas->dlp_mean_ST_fx > 0 ) { - hSpMusClas->wdrop_fx = -extract_l( L_shr( dlp_fx, 10 ) ); // Q9 + hSpMusClas->wdrop_32fx = L_negate( dlp_fx ); // Q19 + move32(); } - ELSE IF( hSpMusClas->wdrop_fx > 0 ) + ELSE IF( hSpMusClas->wdrop_32fx > 0 ) { - hSpMusClas->wdrop_fx = add( hSpMusClas->wdrop_fx, extract_l( L_shr( L_sub( hSpMusClas->dlp_mean_ST_fx, dlp_fx ), 10 ) ) ); + hSpMusClas->wdrop_32fx = L_add( hSpMusClas->wdrop_32fx, L_sub( hSpMusClas->dlp_mean_ST_fx, dlp_fx ) ); + move32(); } } ELSE { - hSpMusClas->wdrop_fx = 0; - move16(); + hSpMusClas->wdrop_32fx = 0; + move32(); } - wdrop_fx = lin_interp32_fx( L_deposit_h( hSpMusClas->wdrop_fx ), 503316480, 1503238554 /* 0.7 in Q31 */, 0, ONE_IN_Q31 /* 1.0f in Q31 */, 1 ); /* Q31 */ + wdrop_fx = lin_interp32_fx( hSpMusClas->wdrop_32fx, 7864320, 1503238554 /* 0.7 in Q31 */, 0, ONE_IN_Q31 /* 1.0f in Q31 */, 1 ); /* Q31 */ test(); test(); /* calculate weight based on rises of dlp (close to 1 during sudden rise of dlp, close to 0 otherwise) */ diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index 24c8b9fce..6c4020e27 100644 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -585,6 +585,7 @@ typedef struct sp_mus_clas_structure Word16 past_epsP2_fx; /* Q10 */ Word16 inact_cnt; Word16 wdrop_fx; /* Q9 */ + Word32 wdrop_32fx; /* Q19 */ Word16 wrise_fx; /* Q9 */ Word16 wdlp_0_95_sp_fx; /* EVS - Q8 */ Word32 wdlp_0_95_sp_32fx; /* IVAS - Q24 */ diff --git a/ltv.patch b/ltv.patch new file mode 100644 index 000000000..4ed1035fc --- /dev/null +++ b/ltv.patch @@ -0,0 +1,60 @@ +commit ae0e51b3af04edf07e5b2beaa7734ae9b7d26d79 +Author: Shreyas Talwekar <100898@ittiam.com> +Date: Tue Jan 21 21:17:01 2025 +0530 + + Fix + +diff --git a/ivas_codec/c-code/lib_enc/speech_music_classif_fx.c b/ivas_codec/c-code/lib_enc/speech_music_classif_fx.c +index b088e6efd..3983acaca 100644 +--- a/ivas_codec/c-code/lib_enc/speech_music_classif_fx.c ++++ b/ivas_codec/c-code/lib_enc/speech_music_classif_fx.c +@@ -268,8 +268,8 @@ void speech_music_clas_init_ivas_fx( + + hSpMusClas->sp_mus_state = -8; + move16(); +- hSpMusClas->wdrop_fx = 0; +- move16(); ++ hSpMusClas->wdrop_32fx = 0; ++ move32(); + hSpMusClas->wrise_fx = 0; + move16(); + hSpMusClas->wdlp_0_95_sp_fx = 0; +@@ -2390,19 +2390,21 @@ Word16 ivas_smc_gmm_fx( + { + IF( hSpMusClas->dlp_mean_ST_fx > 0 ) + { +- hSpMusClas->wdrop_fx = -extract_l( L_shr( dlp_fx, 10 ) ); // Q9 ++ hSpMusClas->wdrop_32fx = L_negate( dlp_fx ); // Q19 ++ move32(); + } +- ELSE IF( hSpMusClas->wdrop_fx > 0 ) ++ ELSE IF( hSpMusClas->wdrop_32fx > 0 ) + { +- hSpMusClas->wdrop_fx = extract_l( L_shr( L_sub( hSpMusClas->dlp_mean_ST_fx, dlp_fx ), 10 ) ); ++ hSpMusClas->wdrop_32fx = L_add( hSpMusClas->wdrop_32fx, L_sub( hSpMusClas->dlp_mean_ST_fx, dlp_fx ) ); ++ move32(); + } + } + ELSE + { +- hSpMusClas->wdrop_fx = 0; ++ hSpMusClas->wdrop_32fx = 0; + move16(); + } +- wdrop_fx = lin_interp32_fx( L_deposit_h( hSpMusClas->wdrop_fx ), 503316480, 1503238554 /* 0.7 in Q31 */, 0, ONE_IN_Q31 /* 1.0f in Q31 */, 1 ); /* Q31 */ ++ wdrop_fx = lin_interp32_fx( hSpMusClas->wdrop_32fx, 7864320, 1503238554 /* 0.7 in Q31 */, 0, ONE_IN_Q31 /* 1.0f in Q31 */, 1 ); /* Q31 */ + test(); + test(); + /* calculate weight based on rises of dlp (close to 1 during sudden rise of dlp, close to 0 otherwise) */ +diff --git a/ivas_codec/c-code/lib_enc/stat_enc.h b/ivas_codec/c-code/lib_enc/stat_enc.h +index 24c8b9fce..6c4020e27 100644 +--- a/ivas_codec/c-code/lib_enc/stat_enc.h ++++ b/ivas_codec/c-code/lib_enc/stat_enc.h +@@ -585,6 +585,7 @@ typedef struct sp_mus_clas_structure + Word16 past_epsP2_fx; /* Q10 */ + Word16 inact_cnt; + Word16 wdrop_fx; /* Q9 */ ++ Word32 wdrop_32fx; /* Q19 */ + Word16 wrise_fx; /* Q9 */ + Word16 wdlp_0_95_sp_fx; /* EVS - Q8 */ + Word32 wdlp_0_95_sp_32fx; /* IVAS - Q24 */ -- GitLab