Loading lib_com/cnst.h +1 −0 Original line number Diff line number Diff line Loading @@ -718,6 +718,7 @@ enum #define CLDFB_NO_COL_MAX_SWITCH_BFI 10 /* CLDFB resampling - max number of CLDFB col. for switching, BFI */ #define CLDFB_OVRLP_MIN_SLOTS 3 /* CLDFB resampling - minimize processing to minimum required for transition frame ACELP->TCX/HQ */ #define INV_CLDFB_BANDWIDTH ( 1.f / 800.f ) #define INV_CLDFB_BANDWIDTH_Q31 ( 2684355l ) #define L_FILT_2OVER3 12 #define L_FILT_2OVER3_LP 3 Loading lib_com/ivas_cnst.h +7 −0 Original line number Diff line number Diff line Loading @@ -1291,6 +1291,13 @@ typedef enum #define MCMASA_LFE_THETA 1.3f #define MCMASA_LFE_SYNTH_ALPHA 0.95f /* Smoothing coefficient for LFE synthesis */ #define MCMASA_LFE_ALPHA_Q15 (21954) #define MCMASA_LFE_BETA_Q15 (2949) #define MCMASA_LFE_BETA_Q14 (1474) #define MCMASA_LFE_THETA_Q14 (21299) #define MCMASA_LFE_QLOW_Q12 (-26624) #define MCMASA_LFE_DELTA_Q11 (2048) #define NUM_ELEVATED_SPEAKERS 4 #define MCMASA_MIN_SPEAKERS_SEPARATE_CENTER 4 Loading lib_com/ivas_masa_com.c +267 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,9 @@ #include "ivas_rom_com.h" #include "ivas_stat_dec.h" #include "wmc_auto.h" #include "ivas_rom_com_fx.h" #include "prot_fx2.h" /*--------------------------------------------------------------- * Local constants Loading Loading @@ -155,6 +158,123 @@ void ivas_masa_set_elements( return; } void ivas_masa_set_elements_fx( const Word32 ivas_total_brate, /* i : IVAS total bitrate */ const Word16 mc_mode, /* i : MC format mode */ const Word16 nchan_transport, /* i : number of MASA input/transport channels */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ Word16 *element_mode, /* o : element mode */ Word16 *nSCE, /* o : number of SCEs */ Word16 *nCPE, /* o : number of CPEs */ const Word16 ivas_format, /* i : IVAS format */ const ISM_MODE ism_mode, /* i : ISM mode */ const Word32 ism_total_brate /* i : initial ISM total bitrate */ ) { Word16 tmp, tmp_e; IF ( EQ_16( nchan_transport, 2 ) ) { test(); test(); IF ( GE_32( ivas_total_brate, MCMASA_SEPARATE_BRATE ) && EQ_16( mc_mode, MC_MODE_MCMASA ) ) { *nCPE = 1; move16(); *nSCE = 1; move16(); *element_mode = IVAS_SCE; /* This is needed for the initialization phase to initialize codec mode to SCE, since it is written first to the file*/ move16(); } ELSE IF ( EQ_16( ivas_format, MASA_ISM_FORMAT ) && NE_16( ism_mode, ISM_MODE_NONE ) ) { *nCPE = 1; move16(); IF ( EQ_16( *element_mode, -1 ) ) { *element_mode = IVAS_CPE_DFT; /* To have it initialized in case it was not already. */ move16(); } IF ( GT_32( ivas_total_brate, MIN_BRATE_MDCT_STEREO ) ) { *element_mode = IVAS_CPE_MDCT; move16(); test(); test(); test(); IF ( ( EQ_16( ism_mode, ISM_MASA_MODE_DISC ) || EQ_16( ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) || EQ_16( ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) ) && LT_32( L_sub( ivas_total_brate, ism_total_brate ), MIN_BRATE_MDCT_STEREO ) ) { *element_mode = IVAS_CPE_DFT; move16(); } } } ELSE { *nCPE = 1; move16(); *nSCE = 0; move16(); IF ( GT_32( ivas_total_brate, MIN_BRATE_MDCT_STEREO ) ) { *element_mode = IVAS_CPE_MDCT; move16(); } } tmp = BASOP_Util_Divide3216_Scale(ivas_total_brate, FRAMES_PER_SEC, &tmp_e); hQMetaData->bits_frame_nominal = shr(tmp, negate(add(1, tmp_e))); // Q0 IF ( EQ_16(ivas_format, MASA_ISM_FORMAT) && ( EQ_16(ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ) || EQ_16(ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ) || EQ_16(ism_mode,ISM_MASA_MODE_DISC) ) ) { tmp = BASOP_Util_Divide3216_Scale(ism_total_brate, FRAMES_PER_SEC, &tmp_e); tmp = shr(tmp, negate(add(1, tmp_e))); // Q0 hQMetaData->bits_frame_nominal = sub(hQMetaData->bits_frame_nominal, tmp); } } ELSE IF ( GE_16( nchan_transport, 1 ) ) { *nCPE = 0; move16(); *nSCE = 1; move16(); IF ( EQ_32( ivas_total_brate, IVAS_13k2 ) ) { hQMetaData->bits_frame_nominal = ACELP_9k60 / FRAMES_PER_SEC; move16(); } ELSE IF ( LE_32( ivas_total_brate, IVAS_16k4 ) ) { hQMetaData->bits_frame_nominal = ACELP_13k20 / FRAMES_PER_SEC; move16(); } ELSE IF ( LE_32( ivas_total_brate, IVAS_24k4 ) ) { hQMetaData->bits_frame_nominal = ACELP_16k40 / FRAMES_PER_SEC; move16(); } ELSE IF ( LE_32( ivas_total_brate, IVAS_32k ) ) { hQMetaData->bits_frame_nominal = ACELP_24k40 / FRAMES_PER_SEC; move16(); } ELSE { hQMetaData->bits_frame_nominal = (Word16) ( ivas_total_brate / FRAMES_PER_SEC ); move16(); } *element_mode = IVAS_SCE; move16(); } ELSE { assert( !"MASA number of transport channels must be 1, or 2" ); } return; } /*--------------------------------------------------------------- * generate_gridEq() Loading Loading @@ -196,6 +316,30 @@ void generate_gridEq( return; } #ifdef IVAS_FLOAT_FIXED void generate_gridEq_fx( SPHERICAL_GRID_DATA *data /* o : data structure for grid */ ) { /***************************************************************/ /* NOTE: created LUT from float code. The lookup table depends */ /* on the following macros: */ /* - MASA_NO_CIRCLES */ /* - MASA_NO_POINTS_EQUATOR */ /* - MASA_ANGLE_AT_EQUATOR */ /* - MASA_NTOT2_FAC */ /* - MASA_ASIN_OFFSET */ /***************************************************************/ Copy( gridEq_Table, data->no_phi, NO_THETA16_MAX ); data->no_theta = NO_THETA16_MAX; move16(); return; } #endif /*--------------------------------------------------------------- * ivas_masa_set_coding_config() Loading Loading @@ -462,6 +606,129 @@ void masa_sample_rate_band_correction( return; } #ifdef IVAS_FLOAT_FIXED void masa_sample_rate_band_correction_fx( MASA_CODEC_CONFIG *config, /* i/o: MASA codec config */ Word16 *band_mapping, /* i/o: Band mapping used and modified */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: QMetadata structure for modification */ const UWord8 maxBand, /* i : max band */ UWord8 is_encoder, /* i : signals if called at encoder */ MASA_DECODER_EXT_OUT_META_HANDLE hExtOutMeta /* i/o: MASA decoder metadata ext out buffer */ ) { UWord8 band, sf; Word16 highBand; UWord8 numBands48k; numBands48k = config->numCodingBands; FOR ( band = 1; band < config->numCodingBands + 1; band++ ) { highBand = band_mapping[band]; IF ( GE_16( highBand, (Word16)maxBand ) ) { config->numCodingBands = band; hQMetaData->numCodingBands = band; IF ( is_encoder ) { test(); IF ( GT_16( hQMetaData->q_direction->cfg.nbands, (Word16)band ) ) { hQMetaData->q_direction->cfg.nbands = band; } IF ( EQ_16( (Word16) hQMetaData->no_directions, 2 ) && GT_16( hQMetaData->q_direction[1].cfg.nbands, (Word16)band ) ) { hQMetaData->q_direction[1].cfg.nbands = band; } } band_mapping[band] = maxBand; BREAK; } } /* Set rest of the bands to zero in qmetadata. */ FOR ( ; band < numBands48k; band++ ) { FOR ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { #if 1 /* TODO: remove float code */ hQMetaData->q_direction[0].band_data[band].azimuth[sf] = 0.0f; hQMetaData->q_direction[0].band_data[band].elevation[sf] = 0.0f; hQMetaData->q_direction[0].band_data[band].energy_ratio[sf] = 0.0f; #endif hQMetaData->q_direction[0].band_data[band].azimuth_fx[sf] = 0; move32(); hQMetaData->q_direction[0].band_data[band].elevation_fx[sf] = 0; move32(); hQMetaData->q_direction[0].band_data[band].energy_ratio_fx[sf] = 0; move32(); IF ( hQMetaData->coherence_flag && hQMetaData->q_direction[0].coherence_band_data != NULL ) { hQMetaData->q_direction[0].coherence_band_data[band].spread_coherence[sf] = 0u; } IF ( EQ_16( (Word16) hQMetaData->no_directions, 2 ) ) { #if 1 /* TODO: remove float code */ hQMetaData->q_direction[1].band_data[band].azimuth[sf] = 0.0f; hQMetaData->q_direction[1].band_data[band].elevation[sf] = 0.0f; hQMetaData->q_direction[1].band_data[band].energy_ratio[sf] = 0.0f; #endif hQMetaData->q_direction[1].band_data[band].azimuth_fx[sf] = 0; move32(); hQMetaData->q_direction[1].band_data[band].elevation_fx[sf] = 0; move32(); hQMetaData->q_direction[1].band_data[band].energy_ratio_fx[sf] = 0; move32(); IF ( hQMetaData->coherence_flag && hQMetaData->q_direction[1].coherence_band_data != NULL ) { hQMetaData->q_direction[1].coherence_band_data[band].spread_coherence[sf] = 0u; } } IF ( hQMetaData->coherence_flag && hQMetaData->surcoh_band_data != NULL ) { hQMetaData->surcoh_band_data[band].surround_coherence[sf] = 0u; } } IF ( EQ_16( (Word16) hQMetaData->no_directions, 2 ) ) { hQMetaData->twoDirBands[band] = 0; } } IF ( hExtOutMeta != NULL ) { /* in decoder, zero the EXT out MASA meta buffer */ FOR ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { FOR ( band = hQMetaData->numCodingBands; band < MASA_FREQUENCY_BANDS; band++ ) { hExtOutMeta->directionIndex[0][sf][band] = SPH_IDX_FRONT; hExtOutMeta->directToTotalRatio[0][sf][band] = 0u; hExtOutMeta->spreadCoherence[0][sf][band] = 0u; hExtOutMeta->directionIndex[1][sf][band] = SPH_IDX_FRONT; hExtOutMeta->directToTotalRatio[1][sf][band] = 0u; hExtOutMeta->spreadCoherence[1][sf][band] = 0u; hExtOutMeta->surroundCoherence[sf][band] = 0u; hExtOutMeta->diffuseToTotalRatio[sf][band] = UINT8_MAX; } } } return; } #endif /*------------------------------------------------------------------------- * index_theta_phi_16() Loading lib_com/ivas_prot_fx.h +47 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,53 @@ #include "ivas_stat_com.h" #include "ivas_error_utils.h" ivas_error ivas_masa_dec_open_fx( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ); void ivas_masa_dec_close_fx( MASA_DECODER_HANDLE *hMasa /* i/o: MASA metadata structure */ ); void generate_gridEq_fx( SPHERICAL_GRID_DATA *data /* o : data structure for grid */ ); void masa_sample_rate_band_correction_fx( MASA_CODEC_CONFIG *config, /* i/o: MASA codec config */ Word16 *band_mapping, /* i/o: Band mapping used and modified */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: QMetadata structure for modification */ const UWord8 maxBand, /* i : max band */ UWord8 is_encoder, /* i : signals if called at encoder */ MASA_DECODER_EXT_OUT_META_HANDLE hExtOutMeta /* i/o: MASA decoder metadata ext out buffer */ ); void ivas_masa_set_elements_fx( const Word32 ivas_total_brate, /* i : codec total bitrate */ const Word16 mc_mode, /* i : MC format mode */ const Word16 nchan_transport, /* i : number of MASA input/transport channels */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ Word16 *element_mode, /* o : element mode */ Word16 *nSCE, /* o : number of SCEs */ Word16 *nCPE, /* o : number of CPEs */ const Word16 ivas_format, /* i : IVAS format */ const ISM_MODE ism_mode, /* i : ISM mode */ const Word32 ism_total_brate /* i : initial ISM total bitrate */ ); Word16 ivas_jbm_dec_get_num_tc_channels_fx( Decoder_Struct *st_ivas /* i : IVAS decoder handle */ ); ivas_error ivas_jbm_dec_tc_buffer_open_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const TC_BUFFER_MODE tc_buffer_mode, /* i : buffer mode */ const Word16 nchan_transport_jbm, /* i : number of real transport channels */ const Word16 nchan_transport_internal, /* i : number of totally buffered channels */ const Word16 nchan_full, /* i : number of channels to fully store */ const Word16 n_samples_granularity /* i : granularity of the renderer/buffer */ ); void ivas_dct_windowing_fx( const Word16 fade_len, const Word16 full_len, Loading lib_com/ivas_rom_com_fx.c +24 −1 Original line number Diff line number Diff line Loading @@ -292,4 +292,27 @@ const Word32 ism_elevation_borders_fx[4] = { -377487360, -293601280, 272639760, 377487360 }; const Word16 gridEq_Table[NO_THETA16_MAX] = { 430, 423, 422, 422, 422, 422, 421, 421, 420, 420, 419, 418, 417, 417, 416, 414, 414, 412, 412, 409, 409, 407, 406, 404, 402, 401, 399, 397, 395, 394, 391, 389, 387, 385, 383, 380, 378, 375, 373, 370, 368, 365, 362, 359, 356, 354, 350, 347, 344, 341, 338, 334, 331, 328, 324, 321, 317, 313, 310, 306, 302, 299, 294, 291, 287, 282, 279, 274, 270, 266, 262, 258, 253, 249, 244, 240, 235, 231, 226, 222, 217, 212, 208, 202, 198, 194, 188, 183, 179, 173, 169, 163, 159, 153, 148, 144, 138, 133, 127, 123, 117, 112, 107, 102, 96, 91, 85, 81, 75, 69, 64, 59, 53, 48, 43, 37, 32, 26, 21, 15, 10, 1 }; const Word16 McMASA_LFEGain_vectors_fx_q13[64] = { 3112, 2703, 1556, 1638, -1310, -1802, -2867, -2785, 4096, 4096, 4096, 4096, -6553, -3276, 8355, 819, -4096, -4096, -4096, -4096, -4587, -983, -6389, 11141, -8355, 9666, -4669, 2703, 5898, -9256, 7946, -5079, -7454, 7618, 8192, -9011, 14172, -1884, -6389, -6881, 7782, -13107, -2785, 7618, 7127, 3850, -15564, 4259, 5488, 11632, -7946, -10158, 6799, 4751, 4997, -16711, -6553, -12943, 6717, 11632, -17530, 2129, 6881, 8355 }; /* clang-format on */ Loading
lib_com/cnst.h +1 −0 Original line number Diff line number Diff line Loading @@ -718,6 +718,7 @@ enum #define CLDFB_NO_COL_MAX_SWITCH_BFI 10 /* CLDFB resampling - max number of CLDFB col. for switching, BFI */ #define CLDFB_OVRLP_MIN_SLOTS 3 /* CLDFB resampling - minimize processing to minimum required for transition frame ACELP->TCX/HQ */ #define INV_CLDFB_BANDWIDTH ( 1.f / 800.f ) #define INV_CLDFB_BANDWIDTH_Q31 ( 2684355l ) #define L_FILT_2OVER3 12 #define L_FILT_2OVER3_LP 3 Loading
lib_com/ivas_cnst.h +7 −0 Original line number Diff line number Diff line Loading @@ -1291,6 +1291,13 @@ typedef enum #define MCMASA_LFE_THETA 1.3f #define MCMASA_LFE_SYNTH_ALPHA 0.95f /* Smoothing coefficient for LFE synthesis */ #define MCMASA_LFE_ALPHA_Q15 (21954) #define MCMASA_LFE_BETA_Q15 (2949) #define MCMASA_LFE_BETA_Q14 (1474) #define MCMASA_LFE_THETA_Q14 (21299) #define MCMASA_LFE_QLOW_Q12 (-26624) #define MCMASA_LFE_DELTA_Q11 (2048) #define NUM_ELEVATED_SPEAKERS 4 #define MCMASA_MIN_SPEAKERS_SEPARATE_CENTER 4 Loading
lib_com/ivas_masa_com.c +267 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,9 @@ #include "ivas_rom_com.h" #include "ivas_stat_dec.h" #include "wmc_auto.h" #include "ivas_rom_com_fx.h" #include "prot_fx2.h" /*--------------------------------------------------------------- * Local constants Loading Loading @@ -155,6 +158,123 @@ void ivas_masa_set_elements( return; } void ivas_masa_set_elements_fx( const Word32 ivas_total_brate, /* i : IVAS total bitrate */ const Word16 mc_mode, /* i : MC format mode */ const Word16 nchan_transport, /* i : number of MASA input/transport channels */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ Word16 *element_mode, /* o : element mode */ Word16 *nSCE, /* o : number of SCEs */ Word16 *nCPE, /* o : number of CPEs */ const Word16 ivas_format, /* i : IVAS format */ const ISM_MODE ism_mode, /* i : ISM mode */ const Word32 ism_total_brate /* i : initial ISM total bitrate */ ) { Word16 tmp, tmp_e; IF ( EQ_16( nchan_transport, 2 ) ) { test(); test(); IF ( GE_32( ivas_total_brate, MCMASA_SEPARATE_BRATE ) && EQ_16( mc_mode, MC_MODE_MCMASA ) ) { *nCPE = 1; move16(); *nSCE = 1; move16(); *element_mode = IVAS_SCE; /* This is needed for the initialization phase to initialize codec mode to SCE, since it is written first to the file*/ move16(); } ELSE IF ( EQ_16( ivas_format, MASA_ISM_FORMAT ) && NE_16( ism_mode, ISM_MODE_NONE ) ) { *nCPE = 1; move16(); IF ( EQ_16( *element_mode, -1 ) ) { *element_mode = IVAS_CPE_DFT; /* To have it initialized in case it was not already. */ move16(); } IF ( GT_32( ivas_total_brate, MIN_BRATE_MDCT_STEREO ) ) { *element_mode = IVAS_CPE_MDCT; move16(); test(); test(); test(); IF ( ( EQ_16( ism_mode, ISM_MASA_MODE_DISC ) || EQ_16( ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) || EQ_16( ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) ) && LT_32( L_sub( ivas_total_brate, ism_total_brate ), MIN_BRATE_MDCT_STEREO ) ) { *element_mode = IVAS_CPE_DFT; move16(); } } } ELSE { *nCPE = 1; move16(); *nSCE = 0; move16(); IF ( GT_32( ivas_total_brate, MIN_BRATE_MDCT_STEREO ) ) { *element_mode = IVAS_CPE_MDCT; move16(); } } tmp = BASOP_Util_Divide3216_Scale(ivas_total_brate, FRAMES_PER_SEC, &tmp_e); hQMetaData->bits_frame_nominal = shr(tmp, negate(add(1, tmp_e))); // Q0 IF ( EQ_16(ivas_format, MASA_ISM_FORMAT) && ( EQ_16(ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ) || EQ_16(ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ) || EQ_16(ism_mode,ISM_MASA_MODE_DISC) ) ) { tmp = BASOP_Util_Divide3216_Scale(ism_total_brate, FRAMES_PER_SEC, &tmp_e); tmp = shr(tmp, negate(add(1, tmp_e))); // Q0 hQMetaData->bits_frame_nominal = sub(hQMetaData->bits_frame_nominal, tmp); } } ELSE IF ( GE_16( nchan_transport, 1 ) ) { *nCPE = 0; move16(); *nSCE = 1; move16(); IF ( EQ_32( ivas_total_brate, IVAS_13k2 ) ) { hQMetaData->bits_frame_nominal = ACELP_9k60 / FRAMES_PER_SEC; move16(); } ELSE IF ( LE_32( ivas_total_brate, IVAS_16k4 ) ) { hQMetaData->bits_frame_nominal = ACELP_13k20 / FRAMES_PER_SEC; move16(); } ELSE IF ( LE_32( ivas_total_brate, IVAS_24k4 ) ) { hQMetaData->bits_frame_nominal = ACELP_16k40 / FRAMES_PER_SEC; move16(); } ELSE IF ( LE_32( ivas_total_brate, IVAS_32k ) ) { hQMetaData->bits_frame_nominal = ACELP_24k40 / FRAMES_PER_SEC; move16(); } ELSE { hQMetaData->bits_frame_nominal = (Word16) ( ivas_total_brate / FRAMES_PER_SEC ); move16(); } *element_mode = IVAS_SCE; move16(); } ELSE { assert( !"MASA number of transport channels must be 1, or 2" ); } return; } /*--------------------------------------------------------------- * generate_gridEq() Loading Loading @@ -196,6 +316,30 @@ void generate_gridEq( return; } #ifdef IVAS_FLOAT_FIXED void generate_gridEq_fx( SPHERICAL_GRID_DATA *data /* o : data structure for grid */ ) { /***************************************************************/ /* NOTE: created LUT from float code. The lookup table depends */ /* on the following macros: */ /* - MASA_NO_CIRCLES */ /* - MASA_NO_POINTS_EQUATOR */ /* - MASA_ANGLE_AT_EQUATOR */ /* - MASA_NTOT2_FAC */ /* - MASA_ASIN_OFFSET */ /***************************************************************/ Copy( gridEq_Table, data->no_phi, NO_THETA16_MAX ); data->no_theta = NO_THETA16_MAX; move16(); return; } #endif /*--------------------------------------------------------------- * ivas_masa_set_coding_config() Loading Loading @@ -462,6 +606,129 @@ void masa_sample_rate_band_correction( return; } #ifdef IVAS_FLOAT_FIXED void masa_sample_rate_band_correction_fx( MASA_CODEC_CONFIG *config, /* i/o: MASA codec config */ Word16 *band_mapping, /* i/o: Band mapping used and modified */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: QMetadata structure for modification */ const UWord8 maxBand, /* i : max band */ UWord8 is_encoder, /* i : signals if called at encoder */ MASA_DECODER_EXT_OUT_META_HANDLE hExtOutMeta /* i/o: MASA decoder metadata ext out buffer */ ) { UWord8 band, sf; Word16 highBand; UWord8 numBands48k; numBands48k = config->numCodingBands; FOR ( band = 1; band < config->numCodingBands + 1; band++ ) { highBand = band_mapping[band]; IF ( GE_16( highBand, (Word16)maxBand ) ) { config->numCodingBands = band; hQMetaData->numCodingBands = band; IF ( is_encoder ) { test(); IF ( GT_16( hQMetaData->q_direction->cfg.nbands, (Word16)band ) ) { hQMetaData->q_direction->cfg.nbands = band; } IF ( EQ_16( (Word16) hQMetaData->no_directions, 2 ) && GT_16( hQMetaData->q_direction[1].cfg.nbands, (Word16)band ) ) { hQMetaData->q_direction[1].cfg.nbands = band; } } band_mapping[band] = maxBand; BREAK; } } /* Set rest of the bands to zero in qmetadata. */ FOR ( ; band < numBands48k; band++ ) { FOR ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { #if 1 /* TODO: remove float code */ hQMetaData->q_direction[0].band_data[band].azimuth[sf] = 0.0f; hQMetaData->q_direction[0].band_data[band].elevation[sf] = 0.0f; hQMetaData->q_direction[0].band_data[band].energy_ratio[sf] = 0.0f; #endif hQMetaData->q_direction[0].band_data[band].azimuth_fx[sf] = 0; move32(); hQMetaData->q_direction[0].band_data[band].elevation_fx[sf] = 0; move32(); hQMetaData->q_direction[0].band_data[band].energy_ratio_fx[sf] = 0; move32(); IF ( hQMetaData->coherence_flag && hQMetaData->q_direction[0].coherence_band_data != NULL ) { hQMetaData->q_direction[0].coherence_band_data[band].spread_coherence[sf] = 0u; } IF ( EQ_16( (Word16) hQMetaData->no_directions, 2 ) ) { #if 1 /* TODO: remove float code */ hQMetaData->q_direction[1].band_data[band].azimuth[sf] = 0.0f; hQMetaData->q_direction[1].band_data[band].elevation[sf] = 0.0f; hQMetaData->q_direction[1].band_data[band].energy_ratio[sf] = 0.0f; #endif hQMetaData->q_direction[1].band_data[band].azimuth_fx[sf] = 0; move32(); hQMetaData->q_direction[1].band_data[band].elevation_fx[sf] = 0; move32(); hQMetaData->q_direction[1].band_data[band].energy_ratio_fx[sf] = 0; move32(); IF ( hQMetaData->coherence_flag && hQMetaData->q_direction[1].coherence_band_data != NULL ) { hQMetaData->q_direction[1].coherence_band_data[band].spread_coherence[sf] = 0u; } } IF ( hQMetaData->coherence_flag && hQMetaData->surcoh_band_data != NULL ) { hQMetaData->surcoh_band_data[band].surround_coherence[sf] = 0u; } } IF ( EQ_16( (Word16) hQMetaData->no_directions, 2 ) ) { hQMetaData->twoDirBands[band] = 0; } } IF ( hExtOutMeta != NULL ) { /* in decoder, zero the EXT out MASA meta buffer */ FOR ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { FOR ( band = hQMetaData->numCodingBands; band < MASA_FREQUENCY_BANDS; band++ ) { hExtOutMeta->directionIndex[0][sf][band] = SPH_IDX_FRONT; hExtOutMeta->directToTotalRatio[0][sf][band] = 0u; hExtOutMeta->spreadCoherence[0][sf][band] = 0u; hExtOutMeta->directionIndex[1][sf][band] = SPH_IDX_FRONT; hExtOutMeta->directToTotalRatio[1][sf][band] = 0u; hExtOutMeta->spreadCoherence[1][sf][band] = 0u; hExtOutMeta->surroundCoherence[sf][band] = 0u; hExtOutMeta->diffuseToTotalRatio[sf][band] = UINT8_MAX; } } } return; } #endif /*------------------------------------------------------------------------- * index_theta_phi_16() Loading
lib_com/ivas_prot_fx.h +47 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,53 @@ #include "ivas_stat_com.h" #include "ivas_error_utils.h" ivas_error ivas_masa_dec_open_fx( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ); void ivas_masa_dec_close_fx( MASA_DECODER_HANDLE *hMasa /* i/o: MASA metadata structure */ ); void generate_gridEq_fx( SPHERICAL_GRID_DATA *data /* o : data structure for grid */ ); void masa_sample_rate_band_correction_fx( MASA_CODEC_CONFIG *config, /* i/o: MASA codec config */ Word16 *band_mapping, /* i/o: Band mapping used and modified */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: QMetadata structure for modification */ const UWord8 maxBand, /* i : max band */ UWord8 is_encoder, /* i : signals if called at encoder */ MASA_DECODER_EXT_OUT_META_HANDLE hExtOutMeta /* i/o: MASA decoder metadata ext out buffer */ ); void ivas_masa_set_elements_fx( const Word32 ivas_total_brate, /* i : codec total bitrate */ const Word16 mc_mode, /* i : MC format mode */ const Word16 nchan_transport, /* i : number of MASA input/transport channels */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ Word16 *element_mode, /* o : element mode */ Word16 *nSCE, /* o : number of SCEs */ Word16 *nCPE, /* o : number of CPEs */ const Word16 ivas_format, /* i : IVAS format */ const ISM_MODE ism_mode, /* i : ISM mode */ const Word32 ism_total_brate /* i : initial ISM total bitrate */ ); Word16 ivas_jbm_dec_get_num_tc_channels_fx( Decoder_Struct *st_ivas /* i : IVAS decoder handle */ ); ivas_error ivas_jbm_dec_tc_buffer_open_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const TC_BUFFER_MODE tc_buffer_mode, /* i : buffer mode */ const Word16 nchan_transport_jbm, /* i : number of real transport channels */ const Word16 nchan_transport_internal, /* i : number of totally buffered channels */ const Word16 nchan_full, /* i : number of channels to fully store */ const Word16 n_samples_granularity /* i : granularity of the renderer/buffer */ ); void ivas_dct_windowing_fx( const Word16 fade_len, const Word16 full_len, Loading
lib_com/ivas_rom_com_fx.c +24 −1 Original line number Diff line number Diff line Loading @@ -292,4 +292,27 @@ const Word32 ism_elevation_borders_fx[4] = { -377487360, -293601280, 272639760, 377487360 }; const Word16 gridEq_Table[NO_THETA16_MAX] = { 430, 423, 422, 422, 422, 422, 421, 421, 420, 420, 419, 418, 417, 417, 416, 414, 414, 412, 412, 409, 409, 407, 406, 404, 402, 401, 399, 397, 395, 394, 391, 389, 387, 385, 383, 380, 378, 375, 373, 370, 368, 365, 362, 359, 356, 354, 350, 347, 344, 341, 338, 334, 331, 328, 324, 321, 317, 313, 310, 306, 302, 299, 294, 291, 287, 282, 279, 274, 270, 266, 262, 258, 253, 249, 244, 240, 235, 231, 226, 222, 217, 212, 208, 202, 198, 194, 188, 183, 179, 173, 169, 163, 159, 153, 148, 144, 138, 133, 127, 123, 117, 112, 107, 102, 96, 91, 85, 81, 75, 69, 64, 59, 53, 48, 43, 37, 32, 26, 21, 15, 10, 1 }; const Word16 McMASA_LFEGain_vectors_fx_q13[64] = { 3112, 2703, 1556, 1638, -1310, -1802, -2867, -2785, 4096, 4096, 4096, 4096, -6553, -3276, 8355, 819, -4096, -4096, -4096, -4096, -4587, -983, -6389, 11141, -8355, 9666, -4669, 2703, 5898, -9256, 7946, -5079, -7454, 7618, 8192, -9011, 14172, -1884, -6389, -6881, 7782, -13107, -2785, 7618, 7127, 3850, -15564, 4259, 5488, 11632, -7946, -10158, 6799, 4751, 4997, -16711, -6553, -12943, 6717, 11632, -17530, 2129, 6881, 8355 }; /* clang-format on */