Loading .gitlab-ci.yml +4 −2 Original line number Diff line number Diff line Loading @@ -86,6 +86,7 @@ stages: - make -j - mv ./IVAS_cod ./IVAS_cod_ref - mv ./IVAS_dec ./IVAS_dec_ref - mv ./IVAS_rend ./IVAS_rend_ref ### build test binaries - git checkout $current_commit_sha Loading @@ -100,8 +101,9 @@ stages: # create short test vectors - python3 tests/create_short_testvectors.py # create references - python3 -m pytest $TEST_SUITE -v --update_ref 1 -m create_ref --create_ref -n auto - python3 -m pytest $TEST_SUITE -v --update_ref 1 -m create_ref_part2 -n auto - exit_code=0 - python3 -m pytest $TEST_SUITE -v --update_ref 1 -m create_ref --create_ref -n auto || exit_code=$? - python3 -m pytest $TEST_SUITE -v --update_ref 1 -m create_ref_part2 -n auto || exit_code=$? # Catch exit code to prevent halt in case this step produces zero tests .update-scripts-repo: &update-scripts-repo Loading lib_com/cldfb.c +79 −0 Original line number Diff line number Diff line Loading @@ -2295,6 +2295,45 @@ static void cldfb_init_proto_and_twiddles( * * Save the memory of filter; to be restored with cldfb_restore_memory_ivas() *--------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED ivas_error cldfb_save_memory_ivas_fx( HANDLE_CLDFB_FILTER_BANK hs /* i/o: filter bank handle */ ) { UWord16 offset = sub(hs->p_filter_length , hs->no_channels); IF ( hs->memory_flt != NULL || NE_16(hs->memory_length , 0) ) { /* memory already stored; Free memory first */ return IVAS_ERR_OK; } IF ( EQ_16(hs->type , CLDFB_ANALYSIS) ) { hs->memory_length = offset; move16(); } ELSE { hs->memory_length = hs->p_filter_length; move16(); } #if 1/*Floating point memory allocation: To be removed later*/ IF ( ( hs->memory_flt = (float *) malloc( hs->memory_length * sizeof( float ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CLDFB\n" ); } #endif IF ( ( hs->memory32 = (Word32 *) malloc( hs->memory_length * sizeof(Word32) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CLDFB\n" ); } /* save the memory */ Copy32( hs->cldfb_state_fx, hs->memory32, hs->memory_length ); return IVAS_ERR_OK; } #endif // IVAS_FLOAT_FIXED ivas_error cldfb_save_memory_ivas( HANDLE_CLDFB_FILTER_BANK hs /* i/o: filter bank handle */ Loading Loading @@ -2334,6 +2373,46 @@ ivas_error cldfb_save_memory_ivas( * * Restores the memory of filter; memory to be save by cldfb_save_memory_ivas() *--------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED void cldfb_restore_memory_ivas_fx( HANDLE_CLDFB_FILTER_BANK hs /* i/o: filter bank handle */ ) { UWord16 offset = sub(hs->p_filter_length , hs->no_channels); UWord16 size; IF ( hs->memory_flt == NULL || EQ_16(hs->memory_length , 0) ) { /* memory not allocated */ return; } IF ( EQ_16(hs->type , CLDFB_ANALYSIS) ) { size = offset; move16(); } ELSE { size = hs->p_filter_length; move16(); } /* read the memory */ Copy32( hs->memory32, hs->cldfb_state_fx, hs->memory_length ); /* adjust sample rate if it was changed in the meanwhile */ IF ( NE_16(hs->memory_length , size) ) { L_lerp_fx_q11( hs->cldfb_state_fx, hs->cldfb_state_fx, size, hs->memory_length); } hs->cldfb_state_length = size; hs->memory_length = 0; free( hs->memory32 ); hs->memory32 = NULL; return; } #endif // IVAS_FLOAT_FIXED void cldfb_restore_memory_ivas( HANDLE_CLDFB_FILTER_BANK hs /* i/o: filter bank handle */ Loading lib_com/cnst.h +5 −0 Original line number Diff line number Diff line Loading @@ -2081,6 +2081,11 @@ typedef enum _DCTTYPE #define ENV_STAB_EST1 2.93f /* env_stab estimation coefficient 1 */ #define ENV_STAB_EST2 (-2.20f) /* env_stab estimation coefficient 2 */ #define ENV_STAB_EST3 0.741f /* env_stab estimation coefficient 3 */ #ifdef IVAS_FLOAT_FIXED #define ENV_STAB_EST1_FX 12001 /* env_stab estimation coefficient 1 *//*Q-12*/ #define ENV_STAB_EST2_FX (-9011) /* env_stab estimation coefficient 2 *//*Q-12*/ #define ENV_STAB_EST3_FX 3035 /* env_stab estimation coefficient 3 *//*Q-12*/ #endif // IVAS_FLOAT_FIXED #define STAB_FAC_EST1 1.093f /* stab_fac HQ estimation coefficient 1 */ #define STAB_FAC_EST2 (-5.84e-05f) /* stab_fac HQ estimation coefficient 2, including Q12 scaling */ #define STAB_FAC_EST3 0.125f /* stab_fac HQ estimation coefficient 3 */ Loading lib_com/float_to_fix_ops.c +38 −5 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ #include <stdint.h> #include "options.h" #include "prot.h" #include "prot_fx2.h" Word32 floatToFixed(float f, Word16 Q) { if (f == 1.0f && Q == Q15) Loading @@ -12,7 +13,15 @@ Word32 floatToFixed(float f, Word16 Q) if (Q < 0) return (Word32)((float)(f) / (float)(((unsigned)1) << (-Q)) + (f >= 0 ? 0.5 : -0.5)); else return (Word32)(f * (float)((unsigned int)1 << Q) + (f >= 0 ? 0.5 : -0.5)); { Word64 result_32; result_32=(Word64)(f * (float)((unsigned int)1 << Q) + (f >= 0 ? 0.5 : -0.5)); if (result_32 > MAX_32) return MAX_32; if (result_32 < MIN_32) return MIN_32; return (Word32)result_32; } } float fixedToFloat(Word32 i, Word16 Q) Loading Loading @@ -42,6 +51,30 @@ void floatToFixed_arrL(float *f, Word32 *i, Word16 Q, Word16 l) #endif } } void floatToFixed_arr16( float *f, Word16 *i, Word16 Q, Word16 l ) { if ( Q <= 0 ) { floatToFixed_arr( f, i, Q, l ); return; } for ( int j = 0; j < l; j++ ) { i[j] = float_to_fix16( f[j], Q ); } } void floatToFixed_arr32( float *f, Word32 *i, Word16 Q, Word16 l ) { if ( Q <= 0 ) { floatToFixed_arrL( f, i, Q, l ); return; } for ( int j = 0; j < l; j++ ) { i[j] = float_to_fix( f[j], Q ); } } void floatToFixed_arr(float *f, Word16 *i, Word16 Q, Word16 l) { for (int j = 0; j < l; j++) Loading Loading @@ -80,14 +113,14 @@ Word16 Q_factor(float x) { Word16 Q = 15; if ( x >= 1 || x <= -1 ) Q = norm_s((Word16)x); Q = norm_s((Word16)abs(x)); return Q; } Word16 Q_factor_L(float x) { Word16 Q = 31; if ( x >= 1 || x <= -1 ) Q = norm_l((Word32)x); Q = norm_l((Word32)abs(x)); return Q; } Word16 Q_factor_arr(float *x, Word16 l) Loading @@ -96,7 +129,7 @@ Word16 Q_factor_arr(float *x, Word16 l) for (int i = 0; i < l; i++) { if (x[i] >= 1 || x[i] <= -1) Q = s_min(Q, norm_s((Word16)x[i])); Q = s_min(Q, norm_s((Word16)abs(x[i]))); } return Q; } Loading @@ -106,7 +139,7 @@ Word16 Q_factor_arrL(float *x, Word16 l) for (int i = 0; i < l; i++) { if (x[i] >= 1 || x[i] <= -1) Q = s_min(Q, norm_l((Word32)x[i])); Q = s_min(Q, norm_l((Word32)abs(x[i]))); } return Q; } lib_com/frame_ener.c +1 −1 Original line number Diff line number Diff line Loading @@ -134,7 +134,7 @@ void fer_energy_fx( *enr = W_extract_h( W_tmp ); // Q = q_synth * 2 + shift - 32 enr_tmp = BASOP_Util_Divide3216_Scale( *enr, shr( L_frame, 1 ) /*Q0*/, &exp ); *enr = L_shl( L_deposit_l( enr_tmp ), 5 ); *enr = L_shr( L_deposit_l( enr_tmp ), (shift-32-exp-1)); } return; } Loading Loading
.gitlab-ci.yml +4 −2 Original line number Diff line number Diff line Loading @@ -86,6 +86,7 @@ stages: - make -j - mv ./IVAS_cod ./IVAS_cod_ref - mv ./IVAS_dec ./IVAS_dec_ref - mv ./IVAS_rend ./IVAS_rend_ref ### build test binaries - git checkout $current_commit_sha Loading @@ -100,8 +101,9 @@ stages: # create short test vectors - python3 tests/create_short_testvectors.py # create references - python3 -m pytest $TEST_SUITE -v --update_ref 1 -m create_ref --create_ref -n auto - python3 -m pytest $TEST_SUITE -v --update_ref 1 -m create_ref_part2 -n auto - exit_code=0 - python3 -m pytest $TEST_SUITE -v --update_ref 1 -m create_ref --create_ref -n auto || exit_code=$? - python3 -m pytest $TEST_SUITE -v --update_ref 1 -m create_ref_part2 -n auto || exit_code=$? # Catch exit code to prevent halt in case this step produces zero tests .update-scripts-repo: &update-scripts-repo Loading
lib_com/cldfb.c +79 −0 Original line number Diff line number Diff line Loading @@ -2295,6 +2295,45 @@ static void cldfb_init_proto_and_twiddles( * * Save the memory of filter; to be restored with cldfb_restore_memory_ivas() *--------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED ivas_error cldfb_save_memory_ivas_fx( HANDLE_CLDFB_FILTER_BANK hs /* i/o: filter bank handle */ ) { UWord16 offset = sub(hs->p_filter_length , hs->no_channels); IF ( hs->memory_flt != NULL || NE_16(hs->memory_length , 0) ) { /* memory already stored; Free memory first */ return IVAS_ERR_OK; } IF ( EQ_16(hs->type , CLDFB_ANALYSIS) ) { hs->memory_length = offset; move16(); } ELSE { hs->memory_length = hs->p_filter_length; move16(); } #if 1/*Floating point memory allocation: To be removed later*/ IF ( ( hs->memory_flt = (float *) malloc( hs->memory_length * sizeof( float ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CLDFB\n" ); } #endif IF ( ( hs->memory32 = (Word32 *) malloc( hs->memory_length * sizeof(Word32) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CLDFB\n" ); } /* save the memory */ Copy32( hs->cldfb_state_fx, hs->memory32, hs->memory_length ); return IVAS_ERR_OK; } #endif // IVAS_FLOAT_FIXED ivas_error cldfb_save_memory_ivas( HANDLE_CLDFB_FILTER_BANK hs /* i/o: filter bank handle */ Loading Loading @@ -2334,6 +2373,46 @@ ivas_error cldfb_save_memory_ivas( * * Restores the memory of filter; memory to be save by cldfb_save_memory_ivas() *--------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED void cldfb_restore_memory_ivas_fx( HANDLE_CLDFB_FILTER_BANK hs /* i/o: filter bank handle */ ) { UWord16 offset = sub(hs->p_filter_length , hs->no_channels); UWord16 size; IF ( hs->memory_flt == NULL || EQ_16(hs->memory_length , 0) ) { /* memory not allocated */ return; } IF ( EQ_16(hs->type , CLDFB_ANALYSIS) ) { size = offset; move16(); } ELSE { size = hs->p_filter_length; move16(); } /* read the memory */ Copy32( hs->memory32, hs->cldfb_state_fx, hs->memory_length ); /* adjust sample rate if it was changed in the meanwhile */ IF ( NE_16(hs->memory_length , size) ) { L_lerp_fx_q11( hs->cldfb_state_fx, hs->cldfb_state_fx, size, hs->memory_length); } hs->cldfb_state_length = size; hs->memory_length = 0; free( hs->memory32 ); hs->memory32 = NULL; return; } #endif // IVAS_FLOAT_FIXED void cldfb_restore_memory_ivas( HANDLE_CLDFB_FILTER_BANK hs /* i/o: filter bank handle */ Loading
lib_com/cnst.h +5 −0 Original line number Diff line number Diff line Loading @@ -2081,6 +2081,11 @@ typedef enum _DCTTYPE #define ENV_STAB_EST1 2.93f /* env_stab estimation coefficient 1 */ #define ENV_STAB_EST2 (-2.20f) /* env_stab estimation coefficient 2 */ #define ENV_STAB_EST3 0.741f /* env_stab estimation coefficient 3 */ #ifdef IVAS_FLOAT_FIXED #define ENV_STAB_EST1_FX 12001 /* env_stab estimation coefficient 1 *//*Q-12*/ #define ENV_STAB_EST2_FX (-9011) /* env_stab estimation coefficient 2 *//*Q-12*/ #define ENV_STAB_EST3_FX 3035 /* env_stab estimation coefficient 3 *//*Q-12*/ #endif // IVAS_FLOAT_FIXED #define STAB_FAC_EST1 1.093f /* stab_fac HQ estimation coefficient 1 */ #define STAB_FAC_EST2 (-5.84e-05f) /* stab_fac HQ estimation coefficient 2, including Q12 scaling */ #define STAB_FAC_EST3 0.125f /* stab_fac HQ estimation coefficient 3 */ Loading
lib_com/float_to_fix_ops.c +38 −5 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ #include <stdint.h> #include "options.h" #include "prot.h" #include "prot_fx2.h" Word32 floatToFixed(float f, Word16 Q) { if (f == 1.0f && Q == Q15) Loading @@ -12,7 +13,15 @@ Word32 floatToFixed(float f, Word16 Q) if (Q < 0) return (Word32)((float)(f) / (float)(((unsigned)1) << (-Q)) + (f >= 0 ? 0.5 : -0.5)); else return (Word32)(f * (float)((unsigned int)1 << Q) + (f >= 0 ? 0.5 : -0.5)); { Word64 result_32; result_32=(Word64)(f * (float)((unsigned int)1 << Q) + (f >= 0 ? 0.5 : -0.5)); if (result_32 > MAX_32) return MAX_32; if (result_32 < MIN_32) return MIN_32; return (Word32)result_32; } } float fixedToFloat(Word32 i, Word16 Q) Loading Loading @@ -42,6 +51,30 @@ void floatToFixed_arrL(float *f, Word32 *i, Word16 Q, Word16 l) #endif } } void floatToFixed_arr16( float *f, Word16 *i, Word16 Q, Word16 l ) { if ( Q <= 0 ) { floatToFixed_arr( f, i, Q, l ); return; } for ( int j = 0; j < l; j++ ) { i[j] = float_to_fix16( f[j], Q ); } } void floatToFixed_arr32( float *f, Word32 *i, Word16 Q, Word16 l ) { if ( Q <= 0 ) { floatToFixed_arrL( f, i, Q, l ); return; } for ( int j = 0; j < l; j++ ) { i[j] = float_to_fix( f[j], Q ); } } void floatToFixed_arr(float *f, Word16 *i, Word16 Q, Word16 l) { for (int j = 0; j < l; j++) Loading Loading @@ -80,14 +113,14 @@ Word16 Q_factor(float x) { Word16 Q = 15; if ( x >= 1 || x <= -1 ) Q = norm_s((Word16)x); Q = norm_s((Word16)abs(x)); return Q; } Word16 Q_factor_L(float x) { Word16 Q = 31; if ( x >= 1 || x <= -1 ) Q = norm_l((Word32)x); Q = norm_l((Word32)abs(x)); return Q; } Word16 Q_factor_arr(float *x, Word16 l) Loading @@ -96,7 +129,7 @@ Word16 Q_factor_arr(float *x, Word16 l) for (int i = 0; i < l; i++) { if (x[i] >= 1 || x[i] <= -1) Q = s_min(Q, norm_s((Word16)x[i])); Q = s_min(Q, norm_s((Word16)abs(x[i]))); } return Q; } Loading @@ -106,7 +139,7 @@ Word16 Q_factor_arrL(float *x, Word16 l) for (int i = 0; i < l; i++) { if (x[i] >= 1 || x[i] <= -1) Q = s_min(Q, norm_l((Word32)x[i])); Q = s_min(Q, norm_l((Word32)abs(x[i]))); } return Q; }
lib_com/frame_ener.c +1 −1 Original line number Diff line number Diff line Loading @@ -134,7 +134,7 @@ void fer_energy_fx( *enr = W_extract_h( W_tmp ); // Q = q_synth * 2 + shift - 32 enr_tmp = BASOP_Util_Divide3216_Scale( *enr, shr( L_frame, 1 ) /*Q0*/, &exp ); *enr = L_shl( L_deposit_l( enr_tmp ), 5 ); *enr = L_shr( L_deposit_l( enr_tmp ), (shift-32-exp-1)); } return; } Loading