Loading lib_com/ivas_cnst.h +6 −0 Original line number Diff line number Diff line Loading @@ -313,6 +313,8 @@ typedef enum #define ISM_AZIMUTH_NBITS 7 #define ISM_AZIMUTH_MIN -180.0f #define ISM_AZIMUTH_MAX 180.0f #define ISM_AZIMUTH_MIN_FX -754974720 #define ISM_AZIMUTH_MAX_FX 754974720 #define ISM_AZIMUTH_LOW_BORDER -140.0f #define ISM_AZIMUTH_HIGH_BORDER 135.0f Loading Loading @@ -351,10 +353,14 @@ typedef enum #define ISM_DTX_ELE_BITS_HIGH 7 #define ISM_Q_STEP_HIGH (ISM_Q_STEP / 2) #define ISM_Q_STEP_BORDER_HIGH (ISM_Q_STEP_BORDER / 2) #define ISM_Q_STEP_HIGH_FX 5 * (1 << (22-2)) #define ISM_Q_STEP_BORDER_HIGH_FX 5 * (1 << (22-1)) #define ISM_DTX_AZI_BITS_LOW 6 #define ISM_DTX_ELE_BITS_LOW 5 #define ISM_Q_STEP_LOW (ISM_Q_STEP * 2) #define ISM_Q_STEP_BORDER_LOW (ISM_Q_STEP_BORDER * 2) #define ISM_Q_STEP_LOW_FX 5 * (1 << 22) #define ISM_Q_STEP_BORDER_LOW_FX 10 * (1 << 22) /* ISM modes */ typedef enum Loading lib_com/ivas_ism_com.c +81 −0 Original line number Diff line number Diff line Loading @@ -390,11 +390,20 @@ void ivas_ism_reset_metadata( ISM_METADATA_HANDLE hIsmMeta /* i/o: ISM metadata handle */ ) { #ifdef IVAS_FLOAT_FIXED hIsmMeta->azimuth_fx = 0; hIsmMeta->elevation_fx = 0; hIsmMeta->yaw_fx = 0; hIsmMeta->pitch_fx = 0; hIsmMeta->radius_fx = 1 << 9; #endif // To be removed later ///////////////////// hIsmMeta->azimuth = 0.0f; hIsmMeta->elevation = 0.0f; hIsmMeta->yaw = 0.0f; hIsmMeta->pitch = 0.0f; hIsmMeta->radius = 1.0f; //////////////////////////////////////////// hIsmMeta->ism_metadata_flag = 0; hIsmMeta->non_diegetic_flag = 0; Loading Loading @@ -470,6 +479,43 @@ int16_t ism_quant_meta( *-------------------------------------------------------------------*/ /*! r: dequantized value */ #ifdef IVAS_FLOAT_FIXED Word32 ism_dequant_meta_fx( const Word16 idx, /* i : quantizer index */ const Word32 borders_fx[], /* i : level borders */ const Word32 q_step_fx, /* i : quantization step */ const Word32 q_step_border_fx, /* i : quantization step at the border */ const Word16 cbsize /* i : codebook size */ ) { Word16 idx_start; Word32 qlow_fx, step_fx, valQ_fx; IF ( idx <= L_shr(L_sub( borders_fx[1], borders_fx[0] ), 21) / L_shr(q_step_border_fx, 21) ) { qlow_fx = borders_fx[0]; idx_start = 0; step_fx = q_step_border_fx; } ELSE IF ( idx <= cbsize - 1 - L_shr( L_sub( borders_fx[3], borders_fx[2] ), 21) / L_shr(q_step_border_fx, 21) ) { qlow_fx = borders_fx[1]; idx_start = (Word16) ( L_shr( L_sub( borders_fx[1], borders_fx[0] ), 21) / L_shr(q_step_border_fx , 21)); step_fx = q_step_fx; } ELSE { qlow_fx = borders_fx[2]; idx_start = (Word16) ( cbsize - 1 - L_shr(L_sub( borders_fx[3], borders_fx[2] ), 21) / L_shr(q_step_border_fx, 21) ); step_fx = q_step_border_fx; } valQ_fx = sub( idx, idx_start ) * step_fx + qlow_fx; return valQ_fx; } #endif float ism_dequant_meta( const int16_t idx, /* i : quantizer index */ const float borders[], /* i : level borders */ Loading Loading @@ -618,6 +664,10 @@ void update_last_metadata( { if ( updt_flag[ch] == 1 ) { #ifdef IVAS_FLOAT_FIXED hIsmMeta[ch]->last_azimuth_fx = hIsmMeta[ch]->azimuth_fx; hIsmMeta[ch]->last_elevation_fx = hIsmMeta[ch]->elevation_fx; #endif hIsmMeta[ch]->last_azimuth = hIsmMeta[ch]->azimuth; hIsmMeta[ch]->last_elevation = hIsmMeta[ch]->elevation; } Loading @@ -633,6 +683,37 @@ void update_last_metadata( * Set quantization bits based on the number of coded objects *----------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED void ivas_get_ism_sid_quan_bitbudget_fx( const Word16 nchan_ism, /* i : number of objects */ Word16 *nBits_azimuth, /* o : number of Q bits for azimuth */ Word16 *nBits_elevation, /* o : number of Q bits for elevation */ Word32 *q_step_fx, /* o : quantization step */ Word32 *q_step_border_fx, /* o : quantization step at the border */ Word16 *nBits_coh, /* o : number of Q bits for coherence */ Word16 *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ ) { *nBits_azimuth = ISM_DTX_AZI_BITS_HIGH; *nBits_elevation = ISM_DTX_ELE_BITS_HIGH; *q_step_fx = ISM_Q_STEP_HIGH_FX; *q_step_border_fx = ISM_Q_STEP_BORDER_HIGH_FX; *nBits_coh = ISM_DTX_COH_SCA_BITS; *nBits_sce_id = 1; IF ( nchan_ism >= 3 ) { *nBits_azimuth = ISM_DTX_AZI_BITS_LOW; *nBits_elevation = ISM_DTX_ELE_BITS_LOW; *q_step_fx = ISM_Q_STEP_LOW_FX; *q_step_border_fx = ISM_Q_STEP_BORDER_LOW_FX; *nBits_sce_id = 2; } return; } #endif void ivas_get_ism_sid_quan_bitbudget( const int16_t nchan_ism, /* i : number of objects */ int16_t *nBits_azimuth, /* o : number of Q bits for azimuth */ Loading lib_com/ivas_prot_fx.h +38 −0 Original line number Diff line number Diff line Loading @@ -373,4 +373,42 @@ Word16 masa_sq_fx( const Word16 cb_sz /* i : codebook size */ ); ivas_error ivas_ism_metadata_dec_fx( const Word32 ism_total_brate, /* i : ISM total bitrate */ const Word16 nchan_ism, /* i : number of ISM channels */ Word16 *nchan_transport, /* o : number of transport channels */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder handles */ const Word16 bfi, /* i : bfi flag */ Word16 nb_bits_metadata[], /* o : number of metadata bits */ ISM_MODE ism_mode, /* i : ISM mode */ ISM_DTX_DATA_DEC hISMDTX, /* i/o: ISM DTX structure */ const PARAM_ISM_CONFIG_HANDLE hParamIsm, /* i : Param ISM Config Handle */ Word16 *ism_extmeta_active, /* i/o: Extended metadata active in renderer */ Word16 *ism_extmeta_cnt, /* i/o: Number of change frames observed */ DEC_CORE_HANDLE st0 /* i : core-coder handle */ ); void ivas_get_ism_sid_quan_bitbudget_fx( const Word16 nchan_ism, /* i : number of objects */ Word16 *nBits_azimuth, /* o : number of Q bits for azimuth */ Word16 *nBits_elevation, /* o : number of Q bits for elevation */ Word32 *q_step_fx, /* o : quantization step */ Word32 *q_step_border_fx, /* o : quantization step at the border */ Word16 *nBits_coh, /* o : number of Q bits for coherence */ Word16 *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ ); void ivas_ism_metadata_sid_dec_fx( SCE_DEC_HANDLE hSCE[MAX_SCE], /* i/o: SCE decoder structure */ const Word32 ism_total_brate, /* i : ISM total bitrate */ const Word16 bfi, /* i : bfi flag */ const Word16 nchan_ism, /* i : number of objects */ const Word16 nchan_transport, /* i : number of transport channels*/ const ISM_MODE ism_mode, /* i : ISM mode */ Word16 *flag_noisy_speech, /* o : noisy speech flag */ Word16 *sce_id_dtx, /* o : SCE DTX ID */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ Word16 nb_bits_metadata[] /* o : number of metadata bits */ ); #endif No newline at end of file lib_com/ivas_rom_com_fx.c +10 −0 Original line number Diff line number Diff line Loading @@ -282,4 +282,14 @@ const Word16 ivas_divde_255[256] = { 30968, 31097, 31225, 31354, 31482, 31611, 31739, 31868, 31996, 32125, 32253, 32382, 32510, 32639, 32767 }; const Word32 ism_azimuth_borders_fx[4] = { -754974720, -587202560, 566231040, 754974720 }; const Word32 ism_elevation_borders_fx[4] = { -377487360, -293601280, 272639760, 377487360 }; /* clang-format on */ lib_com/ivas_rom_com_fx.h +3 −0 Original line number Diff line number Diff line Loading @@ -54,4 +54,7 @@ extern const Word16 dft_trigo_48k_fx[STEREO_DFT_N_MAX_ENC / 4 + 1]; extern const Word16 ivas_divde_255[256]; extern const Word32 ism_azimuth_borders_fx[4]; extern const Word32 ism_elevation_borders_fx[4]; #endif No newline at end of file Loading
lib_com/ivas_cnst.h +6 −0 Original line number Diff line number Diff line Loading @@ -313,6 +313,8 @@ typedef enum #define ISM_AZIMUTH_NBITS 7 #define ISM_AZIMUTH_MIN -180.0f #define ISM_AZIMUTH_MAX 180.0f #define ISM_AZIMUTH_MIN_FX -754974720 #define ISM_AZIMUTH_MAX_FX 754974720 #define ISM_AZIMUTH_LOW_BORDER -140.0f #define ISM_AZIMUTH_HIGH_BORDER 135.0f Loading Loading @@ -351,10 +353,14 @@ typedef enum #define ISM_DTX_ELE_BITS_HIGH 7 #define ISM_Q_STEP_HIGH (ISM_Q_STEP / 2) #define ISM_Q_STEP_BORDER_HIGH (ISM_Q_STEP_BORDER / 2) #define ISM_Q_STEP_HIGH_FX 5 * (1 << (22-2)) #define ISM_Q_STEP_BORDER_HIGH_FX 5 * (1 << (22-1)) #define ISM_DTX_AZI_BITS_LOW 6 #define ISM_DTX_ELE_BITS_LOW 5 #define ISM_Q_STEP_LOW (ISM_Q_STEP * 2) #define ISM_Q_STEP_BORDER_LOW (ISM_Q_STEP_BORDER * 2) #define ISM_Q_STEP_LOW_FX 5 * (1 << 22) #define ISM_Q_STEP_BORDER_LOW_FX 10 * (1 << 22) /* ISM modes */ typedef enum Loading
lib_com/ivas_ism_com.c +81 −0 Original line number Diff line number Diff line Loading @@ -390,11 +390,20 @@ void ivas_ism_reset_metadata( ISM_METADATA_HANDLE hIsmMeta /* i/o: ISM metadata handle */ ) { #ifdef IVAS_FLOAT_FIXED hIsmMeta->azimuth_fx = 0; hIsmMeta->elevation_fx = 0; hIsmMeta->yaw_fx = 0; hIsmMeta->pitch_fx = 0; hIsmMeta->radius_fx = 1 << 9; #endif // To be removed later ///////////////////// hIsmMeta->azimuth = 0.0f; hIsmMeta->elevation = 0.0f; hIsmMeta->yaw = 0.0f; hIsmMeta->pitch = 0.0f; hIsmMeta->radius = 1.0f; //////////////////////////////////////////// hIsmMeta->ism_metadata_flag = 0; hIsmMeta->non_diegetic_flag = 0; Loading Loading @@ -470,6 +479,43 @@ int16_t ism_quant_meta( *-------------------------------------------------------------------*/ /*! r: dequantized value */ #ifdef IVAS_FLOAT_FIXED Word32 ism_dequant_meta_fx( const Word16 idx, /* i : quantizer index */ const Word32 borders_fx[], /* i : level borders */ const Word32 q_step_fx, /* i : quantization step */ const Word32 q_step_border_fx, /* i : quantization step at the border */ const Word16 cbsize /* i : codebook size */ ) { Word16 idx_start; Word32 qlow_fx, step_fx, valQ_fx; IF ( idx <= L_shr(L_sub( borders_fx[1], borders_fx[0] ), 21) / L_shr(q_step_border_fx, 21) ) { qlow_fx = borders_fx[0]; idx_start = 0; step_fx = q_step_border_fx; } ELSE IF ( idx <= cbsize - 1 - L_shr( L_sub( borders_fx[3], borders_fx[2] ), 21) / L_shr(q_step_border_fx, 21) ) { qlow_fx = borders_fx[1]; idx_start = (Word16) ( L_shr( L_sub( borders_fx[1], borders_fx[0] ), 21) / L_shr(q_step_border_fx , 21)); step_fx = q_step_fx; } ELSE { qlow_fx = borders_fx[2]; idx_start = (Word16) ( cbsize - 1 - L_shr(L_sub( borders_fx[3], borders_fx[2] ), 21) / L_shr(q_step_border_fx, 21) ); step_fx = q_step_border_fx; } valQ_fx = sub( idx, idx_start ) * step_fx + qlow_fx; return valQ_fx; } #endif float ism_dequant_meta( const int16_t idx, /* i : quantizer index */ const float borders[], /* i : level borders */ Loading Loading @@ -618,6 +664,10 @@ void update_last_metadata( { if ( updt_flag[ch] == 1 ) { #ifdef IVAS_FLOAT_FIXED hIsmMeta[ch]->last_azimuth_fx = hIsmMeta[ch]->azimuth_fx; hIsmMeta[ch]->last_elevation_fx = hIsmMeta[ch]->elevation_fx; #endif hIsmMeta[ch]->last_azimuth = hIsmMeta[ch]->azimuth; hIsmMeta[ch]->last_elevation = hIsmMeta[ch]->elevation; } Loading @@ -633,6 +683,37 @@ void update_last_metadata( * Set quantization bits based on the number of coded objects *----------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED void ivas_get_ism_sid_quan_bitbudget_fx( const Word16 nchan_ism, /* i : number of objects */ Word16 *nBits_azimuth, /* o : number of Q bits for azimuth */ Word16 *nBits_elevation, /* o : number of Q bits for elevation */ Word32 *q_step_fx, /* o : quantization step */ Word32 *q_step_border_fx, /* o : quantization step at the border */ Word16 *nBits_coh, /* o : number of Q bits for coherence */ Word16 *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ ) { *nBits_azimuth = ISM_DTX_AZI_BITS_HIGH; *nBits_elevation = ISM_DTX_ELE_BITS_HIGH; *q_step_fx = ISM_Q_STEP_HIGH_FX; *q_step_border_fx = ISM_Q_STEP_BORDER_HIGH_FX; *nBits_coh = ISM_DTX_COH_SCA_BITS; *nBits_sce_id = 1; IF ( nchan_ism >= 3 ) { *nBits_azimuth = ISM_DTX_AZI_BITS_LOW; *nBits_elevation = ISM_DTX_ELE_BITS_LOW; *q_step_fx = ISM_Q_STEP_LOW_FX; *q_step_border_fx = ISM_Q_STEP_BORDER_LOW_FX; *nBits_sce_id = 2; } return; } #endif void ivas_get_ism_sid_quan_bitbudget( const int16_t nchan_ism, /* i : number of objects */ int16_t *nBits_azimuth, /* o : number of Q bits for azimuth */ Loading
lib_com/ivas_prot_fx.h +38 −0 Original line number Diff line number Diff line Loading @@ -373,4 +373,42 @@ Word16 masa_sq_fx( const Word16 cb_sz /* i : codebook size */ ); ivas_error ivas_ism_metadata_dec_fx( const Word32 ism_total_brate, /* i : ISM total bitrate */ const Word16 nchan_ism, /* i : number of ISM channels */ Word16 *nchan_transport, /* o : number of transport channels */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder handles */ const Word16 bfi, /* i : bfi flag */ Word16 nb_bits_metadata[], /* o : number of metadata bits */ ISM_MODE ism_mode, /* i : ISM mode */ ISM_DTX_DATA_DEC hISMDTX, /* i/o: ISM DTX structure */ const PARAM_ISM_CONFIG_HANDLE hParamIsm, /* i : Param ISM Config Handle */ Word16 *ism_extmeta_active, /* i/o: Extended metadata active in renderer */ Word16 *ism_extmeta_cnt, /* i/o: Number of change frames observed */ DEC_CORE_HANDLE st0 /* i : core-coder handle */ ); void ivas_get_ism_sid_quan_bitbudget_fx( const Word16 nchan_ism, /* i : number of objects */ Word16 *nBits_azimuth, /* o : number of Q bits for azimuth */ Word16 *nBits_elevation, /* o : number of Q bits for elevation */ Word32 *q_step_fx, /* o : quantization step */ Word32 *q_step_border_fx, /* o : quantization step at the border */ Word16 *nBits_coh, /* o : number of Q bits for coherence */ Word16 *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ ); void ivas_ism_metadata_sid_dec_fx( SCE_DEC_HANDLE hSCE[MAX_SCE], /* i/o: SCE decoder structure */ const Word32 ism_total_brate, /* i : ISM total bitrate */ const Word16 bfi, /* i : bfi flag */ const Word16 nchan_ism, /* i : number of objects */ const Word16 nchan_transport, /* i : number of transport channels*/ const ISM_MODE ism_mode, /* i : ISM mode */ Word16 *flag_noisy_speech, /* o : noisy speech flag */ Word16 *sce_id_dtx, /* o : SCE DTX ID */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ Word16 nb_bits_metadata[] /* o : number of metadata bits */ ); #endif No newline at end of file
lib_com/ivas_rom_com_fx.c +10 −0 Original line number Diff line number Diff line Loading @@ -282,4 +282,14 @@ const Word16 ivas_divde_255[256] = { 30968, 31097, 31225, 31354, 31482, 31611, 31739, 31868, 31996, 32125, 32253, 32382, 32510, 32639, 32767 }; const Word32 ism_azimuth_borders_fx[4] = { -754974720, -587202560, 566231040, 754974720 }; const Word32 ism_elevation_borders_fx[4] = { -377487360, -293601280, 272639760, 377487360 }; /* clang-format on */
lib_com/ivas_rom_com_fx.h +3 −0 Original line number Diff line number Diff line Loading @@ -54,4 +54,7 @@ extern const Word16 dft_trigo_48k_fx[STEREO_DFT_N_MAX_ENC / 4 + 1]; extern const Word16 ivas_divde_255[256]; extern const Word32 ism_azimuth_borders_fx[4]; extern const Word32 ism_elevation_borders_fx[4]; #endif No newline at end of file