diff --git a/Workspace_msvc/lib_enc.vcxproj.filters b/Workspace_msvc/lib_enc.vcxproj.filters index 4194dbc5a1b9602c6f126b86d3a64735badd9a31..0165869a652b48c1578988cf4406ed6a159bce20 100644 --- a/Workspace_msvc/lib_enc.vcxproj.filters +++ b/Workspace_msvc/lib_enc.vcxproj.filters @@ -46,9 +46,6 @@ encoder_evs_c - - encoder_evs_c - encoder_evs_c @@ -596,6 +593,9 @@ encoder_all_c + + encoder_all_c + diff --git a/apps/decoder.c b/apps/decoder.c index 535c4a84a9992946537d9f97a6e02c5f27bd85d0..163661f195be4fe69ece86a507908978fec0efac 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -90,8 +90,8 @@ typedef struct uint16_t count; uint16_t selected; uint16_t frameCounter; -} AcousticEnvironmentSequence; +} AcousticEnvironmentSequence; typedef struct { @@ -504,6 +504,7 @@ int main( fprintf( stderr, "Failed to get Distance Attenuation \n\n" ); goto cleanup; } + if ( ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { if ( asked_frame_size != IVAS_RENDER_FRAMESIZE_20MS && @@ -2486,7 +2487,6 @@ static ivas_error decodeG192( cleanup: RenderConfigReader_close( &renderConfigReader ); - split_rend_reader_writer_close( &splitRendWriter ); AudioFileWriter_close( &afWriter ); MasaFileWriter_close( &masaWriter ); @@ -2861,15 +2861,15 @@ static ivas_error decodeVoIP( { #ifdef SUPPORT_JBM_TRACEFILE #ifdef OBJ_EDITING_API - if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, (void *) pcmBuf, systemTime_ms, writeJbmTraceFileFrameWrapper, jbmTraceWriter, &bitstreamReadDone, &nSamplesRendered, ¶metersAvailableForEditing ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, (void *) pcmBuf, writeJbmTraceFileFrameWrapper, jbmTraceWriter, &bitstreamReadDone, &nSamplesRendered, ¶metersAvailableForEditing, systemTime_ms ) ) != IVAS_ERR_OK ) #else - if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, (void *) pcmBuf, systemTime_ms, writeJbmTraceFileFrameWrapper, jbmTraceWriter, &bitstreamReadDone, &nSamplesRendered ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, (void *) pcmBuf, writeJbmTraceFileFrameWrapper, jbmTraceWriter, &bitstreamReadDone, &nSamplesRendered, systemTime_ms ) ) != IVAS_ERR_OK ) #endif #else #ifdef OBJ_EDITING_API - if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, (void *) pcmBuf, systemTime_ms, &bitstreamReadDone, ¶metersAvailableForEditing ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, (void *) pcmBuf, &bitstreamReadDone, ¶metersAvailableForEditing, systemTime_ms ) ) != IVAS_ERR_OK ) #else - if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, (void *) pcmBuf, systemTime_ms, &bitstreamReadDone ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, (void *) pcmBuf, &bitstreamReadDone, systemTime_ms ) ) != IVAS_ERR_OK ) #endif #endif { diff --git a/lib_com/bitalloc_fx.c b/lib_com/bitalloc_fx.c index f993b5501c62a599a94591aa4f614b4ed335cdda..4d9c587994ed297a34d8b739e1658dca1805e154 100644 --- a/lib_com/bitalloc_fx.c +++ b/lib_com/bitalloc_fx.c @@ -220,13 +220,12 @@ void bitalloc_fx( *-------------------------------------------------------------------*/ Word16 BitAllocF_fx( - Word16 *y, /* i : norm of sub-vectors :Q0 */ - Word32 bit_rate, /* i : bitrate :Q0 */ - Word16 B, /* i : number of available bits :Q0 */ - Word16 N, /* i : number of sub-vectors :Q0 */ - Word16 *R, /* o : bit-allocation indicator :Q0 */ - Word16 *Rsubband_fx /* o : sub-band bit-allocation vector :Q3 */ - , + Word16 *y, /* i : norm of sub-vectors :Q0 */ + Word32 bit_rate, /* i : bitrate :Q0 */ + Word16 B, /* i : number of available bits :Q0 */ + Word16 N, /* i : number of sub-vectors :Q0 */ + Word16 *R, /* o : bit-allocation indicator :Q0 */ + Word16 *Rsubband_fx, /* o : sub-band bit-allocation vector :Q3 */ const Word16 hqswb_clas, /* i : hq swb class :Q0 */ const Word16 num_env_bands /* i : Number sub bands to be encoded for HF GNERIC :Q0 */ ) diff --git a/lib_com/cldfb_fx.c b/lib_com/cldfb_fx.c index e22205261149dbb8bfeaf1d65a1302de08433445..2ef540fe398c4983a22694bd310117c13c5b4319 100644 --- a/lib_com/cldfb_fx.c +++ b/lib_com/cldfb_fx.c @@ -558,14 +558,11 @@ void cldfbAnalysis_ts_fx( } void cldfbAnalysis_ts_fx_var_q( - const Word32 *timeIn_fx, - /* i : time buffer */ // q - Word32 realBuffer_fx[CLDFB_NO_CHANNELS_MAX], - /* o : real value buffer */ // q_cldfb - 5 - Word32 imagBuffer_fx[CLDFB_NO_CHANNELS_MAX], - /* o : imag value buffer */ // q_cldfb - 5 - const Word16 samplesToProcess, /* i : samples to process */ - HANDLE_CLDFB_FILTER_BANK h_cldfb, /* i : filterbank state */ + const Word32 *timeIn_fx, /* i : time buffer q */ + Word32 realBuffer_fx[CLDFB_NO_CHANNELS_MAX], /* o : real value buffer q_cldfb - 5 */ + Word32 imagBuffer_fx[CLDFB_NO_CHANNELS_MAX], /* o : imag value buffer q_cldfb - 5 */ + const Word16 samplesToProcess, /* i : samples to process */ + HANDLE_CLDFB_FILTER_BANK h_cldfb, /* i : filterbank state */ Word16 *q_cldfb ) { @@ -819,14 +816,11 @@ void cldfbAnalysis_ts_fx_var_q( void cldfbAnalysis_ts_fx_fixed_q( - const Word32 *timeIn_fx, - /* i : time buffer */ // q - Word32 realBuffer_fx[CLDFB_NO_CHANNELS_MAX], - /* o : real value buffer */ // q - 5 - Word32 imagBuffer_fx[CLDFB_NO_CHANNELS_MAX], - /* o : imag value buffer */ // q - 5 - const Word16 samplesToProcess, /* i : samples to process */ - HANDLE_CLDFB_FILTER_BANK h_cldfb, /* i : filterbank state */ + const Word32 *timeIn_fx, /* i : time buffer q */ + Word32 realBuffer_fx[CLDFB_NO_CHANNELS_MAX], /* o : real value buffer q - 5 */ + Word32 imagBuffer_fx[CLDFB_NO_CHANNELS_MAX], /* o : imag value buffer q - 5 */ + const Word16 samplesToProcess, /* i : samples to process */ + HANDLE_CLDFB_FILTER_BANK h_cldfb, /* i : filterbank state */ Word16 *q_cldfb ) { Word16 i, k; @@ -1088,13 +1082,13 @@ void cldfbAnalysis_ts_fx_fixed_q( * Conduct inverse multple overlap cmplex low delay MDCT *--------------------------------------------------------------------*/ void cldfbSynthesis_ivas_fx( - Word32 **realBuffer_fx, /* i : real values Qx*/ - Word32 **imagBuffer_fx, /* i : imag values Qx*/ - Word32 *timeOut_fx, /* o : output time domain samples Qx - 1*/ - const Word16 samplesToProcess, /* i : number of processed samples */ - const Word16 shift, /* i : scale for state buffer */ - const Word16 out_shift, /* i : scale for output buffer */ - HANDLE_CLDFB_FILTER_BANK h_cldfb /* i : filter bank state */ + Word32 **realBuffer_fx, /* i : real values Qx*/ + Word32 **imagBuffer_fx, /* i : imag values Qx*/ + Word32 *timeOut_fx, /* o : output time domain samples Qx - 1*/ + const Word16 samplesToProcess, /* i : number of processed samples */ + const Word16 shift, /* i : scale for state buffer */ + const Word16 out_shift, /* i : scale for output buffer */ + HANDLE_CLDFB_FILTER_BANK h_cldfb /* i : filter bank state */ ) { Word16 i; diff --git a/lib_com/cng_exc_fx.c b/lib_com/cng_exc_fx.c index 63aa77686d3f5539e05a0f254687d0dce8d01b02..f23ef505c946ff2e687a3c0243b48488754f0e7e 100644 --- a/lib_com/cng_exc_fx.c +++ b/lib_com/cng_exc_fx.c @@ -999,24 +999,23 @@ void cng_params_upd_fx( } void cng_params_upd_ivas_fx( - const Word16 lsp_new[], /* i : LSP aprameters Q15 */ - const Word16 exc2[], /* i : current enhanced excitation Q_exc */ - const Word16 L_frame, /* i : frame length Q0 */ - Word16 *ho_circ_ptr, /* i/o: pointer for CNG averaging buffers Q0 */ - Word32 ho_ener_circ[], /* o : energy buffer for CNG averaging Q6 */ - Word16 *ho_circ_size, /* i/o: size of DTX hangover history buffer for averaging Q0 */ - Word16 ho_lsp_circ[], /* o : old LSP buffer for CNG averaging Q15 */ - const Word16 Q_exc, /* i : Q value of excitation */ - const Word16 enc_dec_flag, /* i : Flag indicating encoder or decoder (ENC,DEC) */ - Word32 ho_env_circ[], /* i/o: Envelope buffer Q(6+shift) */ - Word16 *cng_buf_cnt, /* i/o: Counter of postponed FFT-processing instances */ - Word16 cng_exc2_buf[], /* i/o: Excitation buffer Q_exc */ - Word16 cng_Qexc_buf[], /* i/o: Q_exc buffer Q0 */ - Word32 cng_brate_buf[], /* i/o: last_active_brate buffer Q0 */ - const Word32 last_active_brate /* i : Last active bit rate Q0 */ - , - const Word16 element_mode, /* i : Element mode */ - const Word16 bwidth /* i : Audio bandwidth */ + const Word16 lsp_new[], /* i : LSP aprameters Q15 */ + const Word16 exc2[], /* i : current enhanced excitation Q_exc */ + const Word16 L_frame, /* i : frame length Q0 */ + Word16 *ho_circ_ptr, /* i/o: pointer for CNG averaging buffers Q0 */ + Word32 ho_ener_circ[], /* o : energy buffer for CNG averaging Q6 */ + Word16 *ho_circ_size, /* i/o: size of DTX hangover history buffer for averaging Q0 */ + Word16 ho_lsp_circ[], /* o : old LSP buffer for CNG averaging Q15 */ + const Word16 Q_exc, /* i : Q value of excitation */ + const Word16 enc_dec_flag, /* i : Flag indicating encoder or decoder (ENC,DEC) */ + Word32 ho_env_circ[], /* i/o: Envelope buffer Q(6+shift) */ + Word16 *cng_buf_cnt, /* i/o: Counter of postponed FFT-processing instances */ + Word16 cng_exc2_buf[], /* i/o: Excitation buffer Q_exc */ + Word16 cng_Qexc_buf[], /* i/o: Q_exc buffer Q0 */ + Word32 cng_brate_buf[], /* i/o: last_active_brate buffer Q0 */ + const Word32 last_active_brate, /* i : Last active bit rate Q0 */ + const Word16 element_mode, /* i : Element mode */ + const Word16 bwidth /* i : Audio bandwidth */ ) { Word32 L_ener, L_tmp; diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index de6c2a29ed9a8a7c1b66e2496f3207d8cdcd7d9b..8ef02aeed50d3694dd2967ace1af31f503084dcd 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -244,7 +244,7 @@ typedef enum _ivas_binaural_renderer_type *----------------------------------------------------------------------------------*/ #define ISAR_MAX_SPLIT_REND_BITRATE 768000 -#define ISAR_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES ( ( ( (int32_t) ISAR_MAX_SPLIT_REND_BITRATE / IVAS_NUM_FRAMES_PER_SEC ) + 7 ) >> 3 ) +#define ISAR_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES ( ( ( (Word32) ISAR_MAX_SPLIT_REND_BITRATE / IVAS_NUM_FRAMES_PER_SEC ) + 7 ) >> 3 ) #define ISAR_SPLIT_REND_ADDITIONAL_BYTES_TO_READ 1 #define SPLIT_REND_BITS_BUFF_SIZE ( ISAR_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES + ISAR_SPLIT_REND_ADDITIONAL_BYTES_TO_READ ) @@ -278,36 +278,36 @@ typedef enum typedef struct _ISAR_SPLIT_REND_BITS_DATA { - uint8_t *bits_buf; - int32_t buf_len; /*size of bits_buf in bytes. This field should be set by allocator of bits_buf*/ - int32_t bits_written; - int32_t bits_read; - int16_t codec_frame_size_ms; + UWord8 *bits_buf; + Word32 buf_len; /*size of bits_buf in bytes. This field should be set by allocator of bits_buf*/ + Word32 bits_written; + Word32 bits_read; + Word16 codec_frame_size_ms; ISAR_SPLIT_REND_CODEC codec; ISAR_SPLIT_REND_POSE_CORRECTION_MODE pose_correction; - int16_t isar_frame_size_ms; - int16_t lc3plus_highres; + Word16 isar_frame_size_ms; + Word16 lc3plus_highres; } ISAR_SPLIT_REND_BITS_DATA, *ISAR_SPLIT_REND_BITS_HANDLE; typedef struct _ISAR_SPLIT_REND_CONFIG { - int32_t splitRendBitRate; /*Bit rate for split rendering mode, if "pcm_out" is set then "splitRendBitRate" is used as a limit for MD bitrate */ - int16_t hq_mode; /*High quality 3DOF mode with additional side information. Requires more pre-renditions. */ - int16_t dof; /*flag to specify if pose correction is needed for 1, 2 or 3 degree of freedoms*/ - /*The axis can be set dynamically per frame based on a file input */ - /*possible values: + Word32 splitRendBitRate; /*Bit rate for split rendering mode, if "pcm_out" is set then "splitRendBitRate" is used as a limit for MD bitrate */ + Word16 hq_mode; /*High quality 3DOF mode with additional side information. Requires more pre-renditions. */ + Word16 dof; /*flag to specify if pose correction is needed for 1, 2 or 3 degree of freedoms*/ + /*The axis can be set dynamically per frame based on a file input */ + /*possible values: 1 - (1dof correction. By default YAW correction) 2 - (2dof correction. By default YAW and PITCH correction) 3 - (3dof correction. By default YAW, PITCH and ROLL correction) */ - int16_t codec_delay_ms; /* look ahead delay of the codec that is used to code BIN signal output of pre-renderer*/ - int16_t isar_frame_size_ms; /* ISAR bit stream frame size in milliseconds */ - int16_t codec_frame_size_ms; /* Codec frame size in milliseconds, only relevant with LC3plus */ + Word16 codec_delay_ms; /* look ahead delay of the codec that is used to code BIN signal output of pre-renderer*/ + Word16 isar_frame_size_ms; /* ISAR bit stream frame size in milliseconds */ + Word16 codec_frame_size_ms; /* Codec frame size in milliseconds, only relevant with LC3plus */ ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode; ISAR_SPLIT_REND_CODEC codec; IVAS_BIN_RENDERER_TYPE rendererSelection; - int16_t lc3plus_highres; + Word16 lc3plus_highres; } ISAR_SPLIT_REND_CONFIG_DATA, *ISAR_SPLIT_REND_CONFIG_HANDLE; @@ -359,9 +359,9 @@ typedef struct _IVAS_RENDER_CONFIG typedef struct { - int16_t numSamplesPerChannel; - int16_t numChannels; - int16_t is_cldfb; + Word16 numSamplesPerChannel; + Word16 numChannels; + Word16 is_cldfb; } IVAS_REND_AudioBufferConfig; diff --git a/lib_com/disclaimer.c b/lib_com/disclaimer.c index f98245cda6a3dbada76013f29d1e72bc76db25d0..53210b9fe68764e1432438f2781ee4ccad778dbd 100644 --- a/lib_com/disclaimer.c +++ b/lib_com/disclaimer.c @@ -40,7 +40,7 @@ #define WMC_TOOL_SKIP -int16_t print_disclaimer( FILE *fPtr ) +Word16 print_disclaimer( FILE *fPtr ) { fprintf( fPtr, "\n==================================================================================================\n" ); diff --git a/lib_com/edct_fx.c b/lib_com/edct_fx.c index fdf34b4555acd2c377f727737a8d9f22d8117f07..86a8ad268b57c74982476ea5ab364fa2a7df9cc5 100644 --- a/lib_com/edct_fx.c +++ b/lib_com/edct_fx.c @@ -9,8 +9,6 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" /* Function prototypes */ #include "stl.h" - - #include "math_32.h" static Word16 get_edxt_factor( Word16 length ) /* Returns value of sqrtf(2.f/length) in Q15 */ @@ -569,7 +567,7 @@ void iedct_short_fx( return; } -#define FAST_EDXT /* optimized FFT-based DCT/DST algorithm */ + /*-------------------------------------------------------------------------* * edxt_fx() * @@ -705,7 +703,6 @@ void edxt_fx( move16(); } -#ifdef FAST_EDXT test(); IF( EQ_16( kernelType, MDST_II ) || EQ_16( kernelType, MDCT_II ) ) { @@ -879,47 +876,11 @@ void edxt_fx( } } } -#endif -#ifdef IVAS_FLOAT_FIXED_TO_BE_DONE - ELSE - /* TODO: below IF and ELSE blocks are unreachable, verified on code coverage report */ - IF( s_and( kernelType, 1 ) ) /* DST */ + else { - const float offK = ( kernelType == MDST_II && synthesis ? 0.5f : 1.0f - 0.5f * ( kernelType >> 1 ) ); - const float offM = ( kernelType == MDST_II && synthesis ? 1.0f : 0.5f ); - - FOR( k = 0; k < length; k++ ) - { - y[k] = 0.f; - FOR( m = 0; m < length; m++ ) - { - y[k] += x[m] * sinf( pi_len * ( m + offM ) * ( k + offK ) ); - } - } - IF( offK == 1.f ) - { - y[length - 1] *= 0.5f; /* scale Nyquist sample */ - } + assert( !"Unsupported Kernel type in edxt_fx()" ); } - ELSE /* kernelType 0, 2: DCT */ - { - const float offK = ( EQ_16( kernelType, MDCT_II ) && synthesis ? 0.5f : 0.5f - shr( shr( kernelType, 1 ), 1 ) ); - const float offM = ( EQ_16( kernelType, MDCT_II ) && synthesis ? 0.0f : 0.5f ); - FOR( k = 0; k < length; k++ ) - { - y[k] = 0.f; - FOR( m = 0; m < length; m++ ) - { - y[k] += x[m] * cosf( pi_len * ( m + offM ) * ( k + offK ) ); - } - } - IF( offK == 0.f ) - { - y[0] *= 0.5f; /* scale lowest (i.e. DC) sample */ - } - } -#endif // IVAS_FLOAT_FIXED_TO_BE_DONE /*v_multc(y, (kernelType == MDCT_II ? -1.f : 1.f) * sqrtf(2.f / length), y, length);*/ fac = get_edxt_factor( length ); /* Q15 */ if ( EQ_16( kernelType, MDCT_II ) ) diff --git a/lib_com/fd_cng_com_fx.c b/lib_com/fd_cng_com_fx.c index 6796c7535a45088331bce7e15521ec2332beb6f2..47e3df91ea423c8419b251649ef145603c7f901a 100644 --- a/lib_com/fd_cng_com_fx.c +++ b/lib_com/fd_cng_com_fx.c @@ -3306,8 +3306,8 @@ void SynthesisSTFT_fx( } /* Get time-domain signal */ // v_multc(olapBuffer + hFdCngCom->frameSize / 4, (float)(hFdCngCom->fftlen / 2), timeDomainOutput, hFdCngCom->frameSize); - v_multc_fixed( olapBuffer + hFdCngCom->frameSize / 4, fftScale, timeDomainOutput, hFdCngCom->frameSize ); // Q_in - 9 - /* Get excitation */ + v_multc_fx( olapBuffer + hFdCngCom->frameSize / 4, fftScale, timeDomainOutput, hFdCngCom->frameSize ); // Q_in - 9 + /* Get excitation */ test(); test(); IF( ( EQ_16( element_mode, IVAS_CPE_TD ) || EQ_16( element_mode, IVAS_CPE_DFT ) ) && EQ_16( nchan_out, 2 ) ) @@ -3318,12 +3318,12 @@ void SynthesisSTFT_fx( move32(); } // v_multc(buf, (float)(hFdCngCom->fftlen / 2), buf, M + 1 + hFdCngCom->frameSize); - v_multc_fixed( buf_fx, fftScale, buf_fx, add( M + 1, hFdCngCom->frameSize ) ); + v_multc_fx( buf_fx, fftScale, buf_fx, add( M + 1, hFdCngCom->frameSize ) ); } ELSE { // v_multc(olapBuffer + hFdCngCom->frameSize / 4 - (M + 1), (float)(hFdCngCom->fftlen / 2), buf, M + 1 + hFdCngCom->frameSize); - v_multc_fixed( olapBuffer + sub( shr( hFdCngCom->frameSize, 2 ), ( M + 1 ) ), fftScale, buf_fx, add( M + 1, hFdCngCom->frameSize ) ); + v_multc_fx( olapBuffer + sub( shr( hFdCngCom->frameSize, 2 ), ( M + 1 ) ), fftScale, buf_fx, add( M + 1, hFdCngCom->frameSize ) ); } tmp_fx = buf_fx[0]; @@ -3398,10 +3398,10 @@ void SynthesisSTFT_dirac_fx( } /* Get time-domain signal */ - v_multc_fixed( olapBuffer + shr( hFdCngCom->frameSize, 2 ), fftScale, timeDomainOutput, samples_out ); // Q_in - 9 + v_multc_fx( olapBuffer + shr( hFdCngCom->frameSize, 2 ), fftScale, timeDomainOutput, samples_out ); // Q_in - 9 /* Get excitation */ - v_multc_fixed( olapBuffer + sub( shr( hFdCngCom->frameSize, 2 ), ( M + 1 ) ), fftScale, buf, add( M + 1, hFdCngCom->frameSize ) ); + v_multc_fx( olapBuffer + sub( shr( hFdCngCom->frameSize, 2 ), ( M + 1 ) ), fftScale, buf, add( M + 1, hFdCngCom->frameSize ) ); tmp = buf[0]; move32(); preemph_ivas_fx( buf + 1, PREEMPH_FAC, M + hFdCngCom->frameSize, &tmp ); diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index a91333686d727019b5f65b7e5c85febcbee450d3..321745b9a6c2620cc295225aa6b36cefc3e3fc55 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -44,46 +44,33 @@ * mathematical constants *----------------------------------------------------------------------------------*/ -#define PI_OVER_2 ( EVS_PI / 2.0f ) -#define PI_OVER_180 ( EVS_PI / 180.0f ) #define ONE_BY_PI_OVER_180_Q25 ( 1922527360 ) // Q25 -#define PI_OVER_180_Q22 ( 73204 ) // Q22 -#define _180_OVER_PI ( 180.0f / EVS_PI ) -#define _180_OVER_PI_Q25 ( 1922527338 ) // Q25 -#define PI_OVER_180_Q25 ( 585635 ) // Q25 +#define PI_OVER_180_Q22 ( 73204 ) // ( EVS_PI / 180.0f ) in Q22 +#define _180_OVER_PI_Q25 ( 1922527338 ) // ( 180.0f / EVS_PI ) in Q25 +#define PI_OVER_180_Q25 ( 585635 ) // ( EVS_PI / 180.0f ) in Q25 #define _180_IN_Q22 ( 754974720 ) // Q22 #define _360_IN_Q22 ( 1509949440 ) // Q22 -#define _180_OVER_PI_FX ( 58670 ) // Q10 -#define PI_OVER_180_Q15 ( 572 ) // Q15 -#define _180_OVER_PI_Q9 ( 29335 ) // Q9 +#define _180_OVER_PI_FX ( 58670 ) // ( 180.0f / EVS_PI ) in Q10 +#define PI_OVER_180_Q15 ( 572 ) // ( EVS_PI / 180.0f ) in Q15 +#define _180_OVER_PI_Q9 ( 29335 ) // ( 180.0f / EVS_PI ) in Q9 #define PI_OVER_4_Q29 ( 421657440 ) // Q29 -#define _180_OVER_PI_Q9 ( 29335 ) // Q9 #define PI_OVER_Q29 ( 1686629760 ) // Q29 #define Q31_0_99 ( 2126008811 ) // Q31 #define Q31_0_01 ( 21474836 ) // Q31 #define PI_OVER_180_FX ( 37480660 ) // Q31 #define PI_OVER_4_Q29 ( 421657440 ) // Q29 -#define PI_OVER_Q29 ( 1686629760 ) // Q29 #define PI2_C_ADP_RATE_Q31 ( 449767936 ) // Q31 (2.0f * EVS_PI * pOTR->centerAdaptationRate) #define PI2_C_Q28 ( 1686629760 ) // Q28 #define OFF_C_ADP_RATE_Q31 ( 268435456 ) // Q31 #define C_ADP_RATE_Q31 ( 71582792 ) // Q31 +#define SQRT2_FX 1518500250 /* 1.414213562373095f in Q30 */ +#define SQRT2_OVER_2_FX 1518500250 /* (SQRT2 / 2.0f) in Q31 */ +#define INV_SQRT2_FX 1518500224 /* 1/sqrt(2) in Q31 */ +#define INV_SQRT2_FX_Q15 23170 /* 1/sqrt(2) Q15 */ +#define INV_SQRT3_FX 18918 /* 1/sqrt(3) Q15 */ -#define SQRT2 1.414213562373095f -#define SQRT2_FIXED 1518500250 // Q30 -#define SQRT2_OVER_2 (SQRT2 / 2.0f) -#define SQRT2_OVER_2_FIXED 1518500250 // Q31 - -#define INV_SQRT2 7.071067811865475e-1f /* 1/sqrt(2) */ -#define INV_SQRT3 0.577350269189626f /* 1/sqrt(3) */ -#define INV_SQRT2_FX ( 1518500224 ) /* 1/sqrt(2) in Q31 */ - -#define INV_SQRT2_FX_Q15 ( 23170 ) /* 1/sqrt(2) Q15 */ -#define INV_SQRT3_FX ( 18918 ) /* 1/sqrt(3) Q15 */ - -#define LOG_10 2.30258509299f - +#define INV_1000_Q31 2147484 /*1/1000 IN Q31*/ /*----------------------------------------------------------------------------------* * IVAS formats @@ -341,36 +328,24 @@ typedef enum #define ADJUST_ISM_BRATE_POS 8000 #define ISM_AZIMUTH_NBITS 7 -#define ISM_AZIMUTH_MIN -180.0f -#define ISM_AZIMUTH_MAX 180.0f -#define ISM_AZIMUTH_MIN_FX ( -754974720 ) // Q22 -#define ISM_AZIMUTH_MAX_FX ( 754974720 ) // Q22 -#define ISM_AZIMUTH_LOW_BORDER -140.0f -#define ISM_AZIMUTH_HIGH_BORDER 135.0f -#define ISM_AZIMUTH_LOW_BORDER_FX ( -587202560 ) // Q22 -#define ISM_AZIMUTH_HIGH_BORDER_FX ( 566231040 ) // Q22 +#define ISM_AZIMUTH_MIN_FX -754974720 /* -180.0f in Q22 */ +#define ISM_AZIMUTH_MAX_FX 754974720 /* 180.0f in Q22 */ +#define ISM_AZIMUTH_LOW_BORDER_FX -587202560 /* -140.0f in Q22 */ +#define ISM_AZIMUTH_HIGH_BORDER_FX 566231040 /* 135.0f in Q22 */ #define ISM_ELEVATION_NBITS 6 -#define ISM_ELEVATION_MIN -90.0f -#define ISM_ELEVATION_MAX 90.0f -#define ISM_ELEVATION_MIN_FX ( -377487360 ) // Q22 -#define ISM_ELEVATION_MAX_FX ( 377487360 ) // Q22 -#define ISM_ELEVATION_LOW_BORDER -70.0f -#define ISM_ELEVATION_HIGH_BORDER 65.0f -#define ISM_ELEVATION_LOW_BORDER_FX ( -293601280 ) // Q22 -#define ISM_ELEVATION_HIGH_BORDER_FX ( 272629760 ) // Q22 -#define ISM_Q_STEP 2.5f -#define ISM_Q_STEP_FX ( 10485760 ) // Q22 -#define ISM_Q_STEP_BORDER 5.0f -#define ISM_Q_STEP_BORDER_FX ( 20971520 ) // Q22 +#define ISM_ELEVATION_MIN_FX -377487360 /* -90.0f in Q22 */ +#define ISM_ELEVATION_MAX_FX 377487360 /* 90.0f in Q22 */ +#define ISM_ELEVATION_LOW_BORDER_FX -293601280 /* -70.0f in Q22 */ +#define ISM_ELEVATION_HIGH_BORDER_FX 272629760 /* 65.0f in Q22 */ +#define ISM_Q_STEP_FX 10485760 /* 2.5f in Q22 */ +#define ISM_Q_STEP_BORDER_FX 20971520 /* 5.0f in Q22 */ #define ISM_FEC_MAX 10 #define ISM_RADIUS_NBITS 6 -#define ISM_RADIUS_MIN 0.0f -#define ISM_RADIUS_MIN_Q9 0 -#define ISM_RADIUS_DELTA 0.25f /* Max radius = (2^ISM_RADIUS_NBITS-1)*0.25 = 15.75 */ -#define ISM_RADIUS_DELTA_Q8 64 // Q8 +#define ISM_RADIUS_MIN_Q9 0 /* 0.0f in Q9 */ +#define ISM_RADIUS_DELTA_Q8 64 /* 0.25f in Q8 */ #define ISM_EXTENDED_METADATA_BRATE IVAS_64k #define ISM_METADATA_IS_NDP_BITS 1 #define ISM_EXTENDED_METADATA_BITS 1 @@ -389,24 +364,24 @@ typedef enum #define PARAM_ISM_MAX_CHAN 16 #define PARAM_ISM_HYS_BUF_SIZE 10 -#define STEP_PARAM_ISM_POW_RATIO_NBITS_Q31 (306783378) /* 1.0f / (float)((1 << PARAM_ISM_POW_RATIO_NBITS) - 1) */ +#define STEP_PARAM_ISM_POW_RATIO_NBITS_Q31 306783378 /* 1.0f / (float)((1 << PARAM_ISM_POW_RATIO_NBITS) - 1) */ /* ISM DTX */ -#define ISM_Q_STEP_FX ( 10485760 ) // Q22 -#define ISM_Q_STEP_BORDER_FX ( 20971520 ) // Q22 +#define ISM_Q_STEP_FX 10485760 /* Q22 */ +#define ISM_Q_STEP_BORDER_FX 20971520 /* Q22 */ #define ISM_DTX_COH_SCA_BITS 4 #define ISM_DTX_AZI_BITS_HIGH 8 #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 ) ) ) // Q22 -#define ISM_Q_STEP_BORDER_HIGH_FX ( 5 * ( 1 << ( 22 - 1 ) ) ) // Q22 +#define ISM_Q_STEP_HIGH_FX ( 5 * ( 1 << ( 22 - 2 ) ) ) /* Q22 */ +#define ISM_Q_STEP_BORDER_HIGH_FX ( 5 * ( 1 << ( 22 - 1 ) ) ) /* Q22 */ #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) ) // Q22 -#define ISM_Q_STEP_BORDER_LOW_FX ( 10 * (1 << 22) ) // Q22 +#define ISM_Q_STEP_LOW_FX ( 5 * (1 << 22) ) /* Q22 */ +#define ISM_Q_STEP_BORDER_LOW_FX ( 10 * (1 << 22) ) /* Q22 */ /* ISM modes */ typedef enum @@ -555,9 +530,6 @@ enum #define STEREO_DFT_ENC_DFT_NB ( STEREO_DFT_OFFSET + 1 ) /*frame + lookahead*/ #define STEREO_DFT_DEC_DFT_NB ( STEREO_DFT_NBDIV + STEREO_DFT_OFFSET ) /*frame + lookahead*/ -#define STEREO_CNA_LR_CORR_LT_FILT 0.95f /* long-term averaging factor for L/R correlation estimation */ -#define STEREO_CNA_ILD_LT_FILT 0.9f /* long-term averaging factor for ILD estimation */ - typedef enum { DFT_STEREO_DEC_ANA_NOCORE = -1, /*-1: signal read from file (DEBUG mode)*/ @@ -570,17 +542,15 @@ typedef enum } DFT_STEREO_DEC_ANA_TYPE; /*Stereo parameters*/ - #define STEREO_DFT_ERB4_BANDS 14 #define STEREO_DFT_ERB8_BANDS 8 #define STEREO_DFT_BAND_MAX ( STEREO_DFT_ERB4_BANDS - 1 ) /*Maximum number of parameter bands*/ #define STEREO_DFT_BUF_MAX STEREO_DFT32MS_N_MAX * STEREO_DFT_NBDIV - #define STEREO_DFT_NRG_PAST_LEN 3 /*ITD*/ #define STEREO_DFT_ITD_FS 32000 -#define STEREO_DFT_ITD_MAX 160 /*samples @ 32000*/ +#define STEREO_DFT_ITD_MAX 160 /*samples @ 32000*/ #define STEREO_DFT_ITD_MAX_ANA 200 #define STEREO_DFT_ITD_MIN max( STEREO_DFT_ITD_MAX - 256 + 1, 1 ) /*STEREO_DFT_ITD_MAX-pow(2,STEREO_DFT_ITD_NBITS-1)+1*/ #define STEREO_DFT_ITD_NBITS 9 /* 1 bit for sign, the rest for the absolute value*/ @@ -592,11 +562,10 @@ typedef enum #define STEREO_DFT_FLAG_BITS 1 #define STEREO_DFT_SIDEGAIN_NBITS 5 #define STEREO_DFT_FEC_THRESHOLD 10 -#define STEREO_DFT_FEC_THRESHOLD_PLUS_1_INV_Q31 ( 195225786 ) // Q31 -#define STEREO_DFT_BITDIFF_LP_FAC_Q31 ( 128849019 ) // Q31 /* Low-pass filter coefficient for filtering bit difference between absolute and differential coding */ -#define STEREO_DFT_BITDIFF_ABS_SELECT_Q31 ( 1717986918 ) // Q31 /* Constant to set tendency for selecting absolute coding mode */ -#define STEREO_DFT_BITDIFF_INIT (12.0f) /* Init value for low-pass bit difference */ -#define STEREO_DFT_BITDIFF_INIT_FX (12288) // Q10 /* Init value for low-pass bit difference in Q10*/ +#define STEREO_DFT_FEC_THRESHOLD_PLUS_1_INV_Q31 ( 195225786 ) /* Q31 */ +#define STEREO_DFT_BITDIFF_LP_FAC_Q31 ( 128849019 ) /* Low-pass filter coefficient for filtering bit difference between absolute and differential coding, Q31 */ +#define STEREO_DFT_BITDIFF_ABS_SELECT_Q31 ( 1717986918 ) /* Constant to set tendency for selecting absolute coding mode, Q31 */ +#define STEREO_DFT_BITDIFF_INIT_FX ( 12288 ) /* Init value for low-pass bit difference, 12.0f in Q10*/ #define STEREO_DFT_SIDE_GAIN_NBITS 5 #define STEREO_DFT_IPD_NBITS 3 @@ -617,9 +586,8 @@ typedef enum #define STEREO_DFT_SG_ACT_CNT_MAX 1500 #define STEREO_DFT_COH_MAXBAND 6 #define STEREO_DFT_SID_GIPD_NBITS 2 -#define STEREO_DFT_FD_FILT 0.9f -#define STEREO_DFT_FD_FILT_Q31 1932735283 // Q31 -#define STEREO_DFT_FD_FILT_COMP_Q31 214748364 // Q31 /* 1.0 - STEREO_DFT_FD_FILT */ +#define STEREO_DFT_FD_FILT_Q31 1932735283 /* 0.9f in Q31 */ +#define STEREO_DFT_FD_FILT_COMP_Q31 214748364 /* 1.0 - STEREO_DFT_FD_FILT in Q31 */ #define STEREO_DFT_CNG_ITD_CNT 8 @@ -645,17 +613,15 @@ typedef enum #define STEREO_DFT_RES_GAINS_BITS 3 #define STEREO_DFT_RES_COD_SNR_MIN 10 -#define STEREO_DFT_RES_COD_SNR_MIN_Q25 335544320 // Q25 +#define STEREO_DFT_RES_COD_SNR_MIN_Q25 335544320 /* Q25 */ #define STEREO_DFT_RES_COD_SNR_MAX 40 -#define STEREO_DFT_RES_COD_SNR_MAX_Q25 1342177280 // Q25 +#define STEREO_DFT_RES_COD_SNR_MAX_Q25 1342177280 /* Q25 */ #define STEREO_DFT_L_SUBFR_8k 32 #define STEREO_DFT_NBPSF_PIT_MAX_8k NBPSF_PIT_MAX / 2 /* Residual coding BPF */ -#define STEREO_DFT_BPF_ADAPT_ALPHA (0.61f) -#define STEREO_DFT_BPF_ADAPT_BETA (0.68f) -#define STEREO_DFT_BPF_ADAPT_ALPHA_FX (19988) /* STEREO_DFT_BPF_ADAPT_ALPHA in Q15 */ -#define STEREO_DFT_BPF_ADAPT_BETA_FX (22281) /* STEREO_DFT_BPF_ADAPT_BETA in Q15 */ +#define STEREO_DFT_BPF_ADAPT_ALPHA_FX 19988 /* 0.61f in Q15 */ +#define STEREO_DFT_BPF_ADAPT_BETA_FX 22281 /* 0.68f in Q15 */ /* Golomb-Rice encoding */ #define NO_SYMB_GR_SIDE_G 31 @@ -729,10 +695,8 @@ enum #define ECSQ_VECTOR_SIZE_MAX 256 #define ECSQ_GLOBAL_GAIN_INDEX_ALL_ZERO 127 /* indicates that all values in the vector are zero */ -#define ECLVQ_GLOBAL_GAIN_FACTOR ( 20.0f * 127.0f / 90.0f ) -#define ECLVQ_GLOBAL_GAIN_FACTOR_Q26 1893961218 // Q26 -#define ECLVQ_INV_GLOBAL_GAIN_FACTOR ( 1.0f / ( 20.0f * 127.0f / 90.0f ) ) -#define ECLVQ_INV_GLOBAL_GAIN_FACTOR_Q24 594468 // Q24 +#define ECLVQ_GLOBAL_GAIN_FACTOR_Q26 1893961218 /* ( 20.0f * 127.0f / 90.0f ) in Q26 */ +#define ECLVQ_INV_GLOBAL_GAIN_FACTOR_Q24 594468 /* ( 1.0f / ( 20.0f * 127.0f / 90.0f ) ) in Q24 */ /* the currently defined configuration indexes are: 0: un-optimized using uniform 4 bit parameters (reserved) @@ -825,12 +789,10 @@ enum fea_names #define STEREO_BITS_TCA_CHAN 1 /* ref/target channel index */ #define STEREO_BITS_TCA_CORRSTATS 5 /* target corrStats */ #define STEREO_BITS_TCA_GD 5 /* target gain */ -#define STEREO_TCA_GDMIN -1.0f -#define STEREO_TCA_GDMIN_FX -32768 // Q15 -#define STEREO_TCA_GDSTEP 0.05f -#define STEREO_TCA_GDSTEP_FX 819 // Q14 -#define STEREO_TCA_GDMIN_FX_Q14 (-16384) // Q14 -#define STEREO_TCA_GDSTEP_FX_Q13 (410) // Q13 +#define STEREO_TCA_GDMIN_FX -32768 /* -1.0f in Q15 */ +#define STEREO_TCA_GDSTEP_FX 819 /* 0.05f in Q14 */ +#define STEREO_TCA_GDMIN_FX_Q14 -16384 /* -1.0fin Q14 */ +#define STEREO_TCA_GDSTEP_FX_Q13 410 /* 0.05f in Q13 */ #define STEREO_BITS_TCA ( STEREO_BITS_TCA_CHAN + STEREO_BITS_TCA_CORRSTATS + STEREO_BITS_TCA_GD ) #define STEREO_ICBWE_MSFLAG_BITS 1 /* BWE Multi Source flag */ @@ -846,14 +808,14 @@ enum fea_names #define MAX_DELAYREGLEN 12 /* max regression length */ #define INV_MAX_DELAYREGLEN 0.083333333333333f /* (1/MAX_DELAYREGLEN) */ -#define INV_MAX_DELAYREGLEN_FX_Q15 2731 // Q15 /* (1/MAX_DELAYREGLEN) */ +#define INV_MAX_DELAYREGLEN_FX_Q15 2731 /* (1/MAX_DELAYREGLEN) in Q15 */ #define MAX_INTERPOLATE 11 #define ADDED_MEM_DS 40 #define STEREO_L_TCA_OVLP_NS 5000000L /* overlap length of the ICA gain scaling */ +#define STEREO_DMX_GAIN_Q13 29066 /* Q13, calculated this -->"powf( 10, ( ( 1 << STEREO_BITS_TCA_GD ) - 1 ) * STEREO_TCA_GDSTEP + STEREO_TCA_GDMIN )"*/ -#define STEREO_DMX_GAIN_Q13 29066 // Q13 /* calculated this -->"powf( 10, ( ( 1 << STEREO_BITS_TCA_GD ) - 1 ) * STEREO_TCA_GDSTEP + STEREO_TCA_GDMIN )"*/ /*----------------------------------------------------------------------------------* * TD Stereo Constants *----------------------------------------------------------------------------------*/ @@ -914,8 +876,7 @@ enum fea_names #define SNS_CDBKS_BITS_4_FRAC 12 #define SNS_MEANS_BITS_4_FRAC 14 -#define MDCT_ST_PLC_FADEOUT_MIN_NOISE_NRG 0.001f -#define MDCT_ST_PLC_FADEOUT_MIN_NOISE_NRG_Q31 2147483 // Q31 +#define MDCT_ST_PLC_FADEOUT_MIN_NOISE_NRG_Q31 2147483 /* 0.001f in Q31 */ #define MDCT_ST_PLC_FADEOUT_MAX_CONC_FRAME 2 * FRAMES_PER_SEC #define MDCT_ST_PLC_FADEOUT_TO_ZERO_LEN 20 #define MDCT_ST_PLC_FADEOUT_DELAY_4_LSP_FADE 3 @@ -1013,47 +974,36 @@ typedef enum #define DIRAC_DIFF_NUM_AMBI_COMP 4 #define DIRAC_HOA_RENDERING_NUM_VIRT_DECORR_LS 8 -#define DIRAC_GAIN_LIMIT 31.622776601683793f /* 30db gain limitiation */ -#define DIRAC_GAIN_LIMIT_Q26 ( 2122168614 ) // Q26 /* 30db gain limitiation */ +#define DIRAC_GAIN_LIMIT_Q26 2122168614 /* 30db gain limitiation, 31.622776601683793f in Q26 */ #define DIRAC_MAX_NUM_DECORR_FILTERS 22 #define DIRAC_MAX_DECORR_FILTER_LEN 20 #define DIRAC_DECORR_NUM_SPLIT_BANDS 3 #define DIRAC_DECORR_FILTER_LEN_1 15 #define DIRAC_DECORR_FILTER_LEN_2 6 #define DIRAC_DECORR_FILTER_LEN_3 3 -#define DIRAC_ONSET_ALPHA 0.95f -#define DIRAC_ONSET_BETA 0.995f -#define DIRAC_ONSET_GAIN 4.0f -#define DIRAC_ONSET_ALPHA_FX 31129 // Q15 -#define DIRAC_ONSET_BETA_FX 32604 // Q15 -#define ONE_DIRAC_ONSET_BETA_FX 163 // Q15 -#define DIRAC_ONSET_GAIN_FX 16384 // Q12 +#define DIRAC_ONSET_ALPHA_FX 31129 /* 0.95f in Q15 */ +#define DIRAC_ONSET_BETA_FX 32604 /* 0.995f in Q15 */ +#define ONE_DIRAC_ONSET_BETA_FX 163 /* Q15 */ +#define DIRAC_ONSET_GAIN_FX 16384 /* 0.995f in Q12 */ #define DELAY_DIRAC_ENC_CMP_NS 9500000L /* Delay to be compensated on DirAC encoder */ -#define DELAY_DIRAC_SPAR_ENC_CMP_NS 500000L /* here we may set the 24 samples (at 48 kHz) additional delay to something else, leave as is for now*/ +#define DELAY_DIRAC_SPAR_ENC_CMP_NS 500000L /* here we may set the 24 samples (at 48 kHz) additional delay to something else, leave as is for now*/ #define DELAY_DIRAC_PARAM_DEC_SFR 2 /* Delay to be compensation for DirAC parameters in the decoder (subframes) */ #define DELAY_MASA_PARAM_DEC_SFR 2 /* Delay to be compensation for MASA parameters in the decoder (subframes) */ -#define SPH_IDX_FRONT ( MASA_NO_POINTS_EQUATOR / 2 ) /* Spherical index corresponding to front direction for setting as default value */ +#define SPH_IDX_FRONT ( MASA_NO_POINTS_EQUATOR / 2 ) /* Spherical index corresponding to front direction for setting as default value */ #define DIRAC_SLOT_NS 1250000L /* time duration of a time slot, 1.25ms (==DELAY_RENERER_NS/MAX_PARAM_SPATIAL_SUBFRAMES) */ #define DIRAC_SLOT_ENC_NS 5000000L -#define DIRAC_MONO_THRESH_SILENCE 3e4f -#define DIRAC_MONO_NORM_FACTOR 1e13f -#define DIRAC_MONO_ONE_ON_NORM_FACTOR (1.f / 1e13f) -#define DIRAC_MONO_MAX_THRESH 1e6f -#define DIRAC_MONO_MIN_THRESH 1e2f -#define DIRAC_MONO_FRAME_THRESH 15 /* 30ms */ - - -#define DIRAC_MONO_THRESH_SILENCE_FX (Word32)3e4 -#define DIRAC_MONO_NORM_FACTOR_FX (Word64)1e13 -#define DIRAC_MONO_ONE_ON_NORM_FACTOR_FX (Word64)1/1e13 -#define DIRAC_MONO_MAX_THRESH_FX (Word32)1e6 -#define DIRAC_MONO_MIN_THRESH_FX (Word32)1e2 -#define DIRAC_MONO_NORM_FACTOR_M 1220703104 -#define DIRAC_MONO_NORM_FACTOR_E 44 +#define DIRAC_MONO_FRAME_THRESH 15 /* 30ms */ +#define DIRAC_MONO_THRESH_SILENCE_FX (Word32)3e4 +#define DIRAC_MONO_NORM_FACTOR_FX (Word64)1e13 +#define DIRAC_MONO_ONE_ON_NORM_FACTOR_FX (Word64)1/1e13 +#define DIRAC_MONO_MAX_THRESH_FX (Word32)1e6 +#define DIRAC_MONO_MIN_THRESH_FX (Word32)1e2 +#define DIRAC_MONO_NORM_FACTOR_M 1220703104 +#define DIRAC_MONO_NORM_FACTOR_E 44 typedef enum { @@ -1088,18 +1038,13 @@ typedef enum #define IVAS_SPAR_ARITH_OVERSHOOT_BITS 16 /* Common SPAR metadata constants */ -#define IVAS_ACTIVEW_DM_F_SCALE 0.5f -#define IVAS_ACTIVEW_DM_F_SCALE_FX (1073741824) /* 0.5f in Q31 */ -#define IVAS_ACTIVEW_DM_F_SCALE_DTX 0.25f -#define IVAS_ACTIVEW_DM_F_SCALE_DTX_FX (536870912) /* 0.25f in Q31 */ -#define IVAS_ACTIVEW_DM_F_SCALE_VLBR 0.25f -#define IVAS_ACTIVEW_DM_F_SCALE_VLBR_FX (536870912) /* 0.25f in Q31 */ +#define IVAS_ACTIVEW_DM_F_SCALE_FX 1073741824 /* 0.5f in Q31 */ +#define IVAS_ACTIVEW_DM_F_SCALE_DTX_FX 536870912 /* 0.25f in Q31 */ +#define IVAS_ACTIVEW_DM_F_SCALE_VLBR_FX 536870912 /* 0.25f in Q31 */ #define IVAS_SPAR_FOA_DFLT_FREQ_PER_CHAN 24000 -#define IVAS_SPAR_DYN_ACTIVEW_THRESH (0.0039f) -#define IVAS_SPAR_DYN_ACTIVEW_THRESH_FX (8375186) /* 0.0039f in Q31 */ -#define IVAS_SPAR_SIDE_CH_DYN_ACTIVEW_THRESH (32.0f) -#define IVAS_SPAR_SIDE_CH_DYN_ACTIVEW_THRESH_Q0 (32) +#define IVAS_SPAR_DYN_ACTIVEW_THRESH_FX 8375186 /* 0.0039f in Q31 */ +#define IVAS_SPAR_SIDE_CH_DYN_ACTIVEW_THRESH_Q0 32 #define MAX_QUANT_STRATS 3 #define MAX_CODING_STRATS 3 @@ -1154,13 +1099,10 @@ enum #define IVAS_APD_8_SECT 8 #define IVAS_APD_16_SECT 16 -#define IVAS_DECORR_PARM_LOOKAHEAD_TAU 2e-3f -#define IVAS_DECORR_PARM_APD_TAU 42949673 // Q31 +#define IVAS_DECORR_PARM_APD_TAU 42949673 /* Q31 */ /* IVAS SBA PCA */ -#define IVAS_PCA_NB_SUBR 20 /* 80 -> 0.25 ms, 40 -> 0.5 ms... */ -#define IVAS_PCA_COV_THRES 3e-5f -#define IVAS_PCA_QUAT_EPS 1e-7f +#define IVAS_PCA_NB_SUBR 20 /* 80 -> 0.25 ms, 40 -> 0.5 ms... */ #define IVAS_PCA_QBITS 19 #define IVAS_PCA_N1 91 #define IVAS_PCA_N1_EQ ( (IVAS_PCA_N1-1)/2 ) @@ -1170,15 +1112,10 @@ enum #define IVAS_PCA_LEN_INTERP_Q ( IVAS_PCA_INTERP * IVAS_PCA_N_SLOTS ) #define IVAS_PCA_DELAY_CMP 24 #define IVAS_PCA_LEN_INTERP_EIG_DEC ( (IVAS_PCA_N_SLOTS+IVAS_PCA_DELAY_CMP)*16) -#define IVAS_PCA_THRES_MIN_DOT 0.8f -#define IVAS_PCA_THRES_MIN_DOT2 0.0f -#define IVAS_PCA_THRES_DIST_ALT 6.0f - -#define IVAS_PCA_QUAT_EPS_FX 215 // Q31 -#define IVAS_PCA_THRES_MIN_DOT_FX 1717986918 // 0.8 in Q31 +#define IVAS_PCA_QUAT_EPS_FX 215 /* 1e-7f in Q31 */ +#define IVAS_PCA_THRES_MIN_DOT_FX 1717986918 /* 0.8 in Q31 */ #define IVAS_PCA_THRES_MIN_DOT2_FX 0 -#define IVAS_PCA_THRES_DIST_ALT_FX 1610612736 // 6 in Q28 - +#define IVAS_PCA_THRES_DIST_ALT_FX 1610612736 /* 6 in Q28 */ typedef enum { @@ -1220,6 +1157,7 @@ enum TOTAL_DECD_QUANT_STRATS }; + /*----------------------------------------------------------------------------------* * MASA constants *----------------------------------------------------------------------------------*/ @@ -1240,13 +1178,12 @@ enum #define MASA_TRANSP_BITS 1 #define NO_BITS_MASA_ISM_NO_OBJ 2 -#define MASA2TOTAL_THR_Q30 1052266987 // 0.98f in Q30 +#define MASA2TOTAL_THR_Q30 1052266987 /* 0.98f in Q30 */ //Maximum error in float to fixed conversion : 0.005% //Assuming the accuracy of 99.995% //New value = 99.995 / 100 * 0.98 = 0.979951 #define BITS_MASA2TOTTAL_DCT0 6 -#define STEP_M2T 0.1f -#define STEP_M2T_FX 214748365 // Q31 +#define STEP_M2T_FX 214748365 /* 0.1f in Q31 */ #define MASA_HEADER_BITS 2 #define MASA_SUBFRAME_BITS 1 #define MASA_LOWBITRATE_MODE_BITS 1 @@ -1286,16 +1223,11 @@ enum #define LIMIT_ER_SIMPLE_ENC 6 #define LIMIT_USE_COMMON 3 -#define MASA_COHERENCE_TOLERANCE 0.1f -#define MASA_COHERENCE_THRESHOLD 0.1f -#define MASA_COHERENCE_TOLERANCE_FX 3277/*0.1 Q15*/ -#define MASA_COHERENCE_THRESHOLD_FX 214748365 // 0.1 in Q31 -#define MASA_RATIO_TOLERANCE 0.1f -#define MASA_RATIO_THRESHOLD 0.1f -#define MASA_ANGLE_TOLERANCE 0.5f -#define MASA_RATIO_THRESHOLD_FX 32212255 // 0.015 in Q31 -#define MASA_RATIO_TOLERANCE_FX 107374182 // 0.1 in Q30 -#define MASA_ANGLE_TOLERANCE_FX ONE_IN_Q21 // 0.5 in Q22 +#define MASA_COHERENCE_TOLERANCE_FX 3277 /* 0.1 Q15 */ +#define MASA_COHERENCE_THRESHOLD_FX 214748365 /* 0.1 in Q31 */ +#define MASA_RATIO_THRESHOLD_FX 32212255 /* 0.015 in Q31 */ +#define MASA_RATIO_TOLERANCE_FX 107374182 /* 0.1 in Q30 */ +#define MASA_ANGLE_TOLERANCE_FX ONE_IN_Q21 /* 0.5 in Q22 */ #define MASA_LIMIT_NO_BANDS_SUR_COH 8 #define MINIMUM_BIT_BUDGET_NORMAL_META 100 #define DIFF_DFRATIO_2BIT_LIMIT_IDX_HODIRAC 4 @@ -1309,16 +1241,11 @@ enum #define MASA_NO_POINTS_EQUATOR 430 #define MASA_NO_CIRCLES 121 -#define MASA_NO_CIRCLES_Q23 ( 1015021568 ) // Q23 -#define MASA_ASIN_OFFSET 0.0064471690266724975f -#define MASA_ASIN_OFFSET_Q15 ( 211 ) // Q15 -#define MASA_NTOT2_FAC 32768.00566947353f -#define MASA_NTOT2_FAC_Q15 ( 1073741952 ) // Q15 -#define MASA_ANGLE_AT_EQUATOR 0.012894427382667f -#define MASA_ANGLE_AT_EQUATOR_Q31 ( 27690572 ) // Q31 -#define MASA_ANGLE_AT_EQUATOR_DEG 0.738796268264740f -#define MASA_ANGLE_AT_EQUATOR_DEG_Q31 ( 1586552905l ) // Q31 -#define MASA_INV_ANGLE_AT_EQUATOR_DEG 1.353553128183453f +#define MASA_NO_CIRCLES_Q23 1015021568 /* Q23 */ +#define MASA_ASIN_OFFSET_Q15 211 /* 0.0064471690266724975f in Q15 */ +#define MASA_NTOT2_FAC_Q15 1073741952 /* 32768.00566947353f in Q15 */ +#define MASA_ANGLE_AT_EQUATOR_Q31 27690572 /* 0.012894427382667f in Q31 */ +#define MASA_ANGLE_AT_EQUATOR_DEG_Q31 1586552905l /* 0.738796268264740f in Q31 */ #define MASA_STEREO_MIN_BITRATE IVAS_24k4 #define MAXIMUM_OMASA_FREQ_BANDS 8 /* Corresponds to maximum number of coding bands at 32 kbps */ #define OMASA_STEREO_SW_CNT_MAX 100 @@ -1327,12 +1254,12 @@ enum #define NBITS_HR_COH 4 #define OMASA_TDREND_MATCHING_GAIN_FX 26026 -#define MASA_INV_ANGLE_AT_EQUATOR_DEG_Q30 (1453366656l) +#define MASA_INV_ANGLE_AT_EQUATOR_DEG_Q30 1453366656l /* 1.353553128183453f in Q30 */ #define MASA_JBM_RINGBUFFER_FRAMES 3 -#define TOLERANCE_360_Q22 1510033326 /* 360 in Q22 + 0.02 in Q22*/ -#define MINUS_TOLERANCE_360_Q22 -1510033326 /* - (360 in Q22 + 0.02 in Q22) */ +#define TOLERANCE_360_Q22 1510033326 /* 360 in Q22 + 0.02 in Q22*/ +#define MINUS_TOLERANCE_360_Q22 -1510033326 /* - (360 in Q22 + 0.02 in Q22) */ typedef enum { MASA_STEREO_NOT_DEFINED, @@ -1381,40 +1308,33 @@ typedef enum #define MCMASA_SEPARATE_BRATE IVAS_64k /* minimum bitrate from which separated channel coding is supported */ #define MCMASA_MAX_ANA_CHANS 11 /* Maximum number of channels currently used in analysis of multichannel formats */ -#define MCMASA_MONOBITRATIO_64k_Q31 ( 536870912 ) // Q31 -#define MCMASA_MONOBITRATIO_Q31 ( 644245095 ) // Q31 +#define MCMASA_MONOBITRATIO_64k_Q31 536870912 /* Q31 */ +#define MCMASA_MONOBITRATIO_Q31 644245095 /* Q31 */ #define MC_MASA_THR_ELEVATION 40 -#define MCMASA_LFE_QLOW -6.5f -#define MCMASA_LFE_DELTA 1.0f -#define MCMASA_LFE_1BIT_THRES 0.03f -#define MCMASA_LFE_ALPHA 0.67f -#define MCMASA_LFE_BETA 0.09f -#define MCMASA_LFE_1BIT_THRES_Q30 32212255 /* 0.03f in Q30 */ -#define MCMASA_LFE_ALPHA_Q30 719407022 /* 0.67f in Q30 */ -#define MCMASA_LFE_BETA_Q30 96636764 /* 0.09f in Q30 */ -#define MCMASA_LFE_THETA 1.3f -#define MCMASA_LFE_SYNTH_ALPHA 0.95f /* Smoothing coefficient for LFE synthesis */ -#define MCMASA_LFE_SYNTH_ALPHA_Q15 (31129) // Q15 -#define MCMASA_LFE_ALPHA_Q15 (21954) // Q15 -#define MCMASA_LFE_BETA_Q15 (2949) // Q15 -#define MCMASA_LFE_BETA_Q14 (1474) // Q14 -#define MCMASA_LFE_THETA_Q14 (21299) // Q14 -#define MCMASA_LFE_QLOW_Q12 (-26624) // Q12 -#define MCMASA_LFE_DELTA_Q11 (2048) // Q11 -#define MCMASA_LFE_QLOW_Q11 (-13312) // Q11 -#define MCMASA_LFE_DELTA_Q10 (1024) // Q10 +#define MCMASA_LFE_1BIT_THRES_Q30 32212255 /* 0.03f in Q30 */ +#define MCMASA_LFE_ALPHA_Q30 719407022 /* 0.67f in Q30 */ +#define MCMASA_LFE_BETA_Q30 96636764 /* 0.09f in Q30 */ +#define MCMASA_LFE_SYNTH_ALPHA_Q15 31129 /* 0.95f in Q15 */ +#define MCMASA_LFE_ALPHA_Q15 21954 /* 0.67f in Q15 */ +#define MCMASA_LFE_BETA_Q15 2949 /* 0.09f in Q15 */ +#define MCMASA_LFE_BETA_Q14 1474 /* 0.09f in Q14 */ +#define MCMASA_LFE_THETA_Q14 21299 /* 1.3f in Q14 */ +#define MCMASA_LFE_QLOW_Q12 -26624 /* -6.5f in Q12 */ +#define MCMASA_LFE_DELTA_Q11 2048 /* 1.0f in Q11 */ +#define MCMASA_LFE_QLOW_Q11 -13312 /* -6.5f in Q11 */ +#define MCMASA_LFE_DELTA_Q10 1024 /* 1.0f in Q10 */ #define NUM_ELEVATED_SPEAKERS 4 #define MCMASA_MIN_SPEAKERS_SEPARATE_CENTER 4 + /*----------------------------------------------------------------------------------* * MCT constants *----------------------------------------------------------------------------------*/ #define LFE_CHANNEL 3 -#define MIN_LFE_NRG 0.5f #define MCT_MAX_CHANNELS 11 /* == 7.1.4 LS channels without the LFE channel */ #define MCT_MAX_BLOCKS ( ( MCT_MAX_CHANNELS + 1 ) / CPE_CHANNELS ) /* max. number of channel pairs (MCT_MAX_CHANNELS/2) within MCT*/ #define NBBITS_MCT_RATIO 4 @@ -1422,23 +1342,17 @@ typedef enum #define MCT_NUM_BLOCK_DATA_BITS 4 -/*typedef enum -{ - MCT_CHAN_MODE_REGULAR, - MCT_CHAN_MODE_IGNORE -} MCT_CHAN_MODE;*/ - /*----------------------------------------------------------------------------------* * MC Param-Upmix Mode Constants *----------------------------------------------------------------------------------*/ -#define MC_PARAMUPMIX_MAX_TRANSPORT_CHANS 8 -#define MC_PARAMUPMIX_MAX_INPUT_CHANS 12 -#define MC_PARAMUPMIX_MAX_BITS 1024 /* Maximum number of bits for the MC Param-Upmix metadata */ -#define MC_PARAMUPMIX_COMBINATIONS 4 /* number of sets of 2 channels combined */ -#define MC_PARAMUPMIX_NCH 2 /* number of channels to combine into 1 */ -#define MC_PARAMUPMIX_MIN_CLDFB 8 +#define MC_PARAMUPMIX_MAX_TRANSPORT_CHANS 8 +#define MC_PARAMUPMIX_MAX_INPUT_CHANS 12 +#define MC_PARAMUPMIX_MAX_BITS 1024 /* Maximum number of bits for the MC Param-Upmix metadata */ +#define MC_PARAMUPMIX_COMBINATIONS 4 /* number of sets of 2 channels combined */ +#define MC_PARAMUPMIX_NCH 2 /* number of channels to combine into 1 */ +#define MC_PARAMUPMIX_MIN_CLDFB 8 typedef enum _COV_SMOOTHING_TYPE { @@ -1490,11 +1404,8 @@ typedef enum PARAM_MC_SYNTH_MONO_STEREO /* synthesis to mono or stereo */ } PARAM_MC_SYNTHESIS_CONF; -#define PARAM_MC_REG_SX_FX (429496729) // Q31 /* Regularization factor for mixing matrix calculation */ -#define PARAM_MC_REG_GHAT_FX (2147483) // Q31 /* Regularization factor for mixing matrix calculation */ - -#define PARAM_MC_REG_SX (0.2f) /* Regularization factor for mixing matrix calculation */ -#define PARAM_MC_REG_GHAT (0.001f) /* Regularization factor for mixing matrix calculation */ +#define PARAM_MC_REG_SX_FX 429496729 /* Regularization factor for mixing matrix calculation, (0.2f) in Q31 */ +#define PARAM_MC_REG_GHAT_FX 2147483 /* Regularization factor for mixing matrix calculation, (0.001f) in Q31 */ #define PARAM_MC_MAX_PARAMETER_BANDS 20 /* Maximum number of parameter bands */ #define PARAM_MC_MAX_PARAMETER_BANDS_RES 14 /* Maximum number of parameter bands with decorrelation */ #define PARAM_MC_MAX_NSLOTS MAX_JBM_CLDFB_TIMESLOTS /* Maximum number of CLDFB slots in a frame */ @@ -1502,7 +1413,6 @@ typedef enum #define PARAM_MC_NSUBFRAMES_DEC 4 /* Number of subframes for the synthesis in the decoder */ #define PARAM_MC_MAX_BANDS_IN_PARAMETER_BAND 30 /* Maximum number of CLDFB frequency bands within a parameter band */ #define PARAM_MC_PARAMETER_FRAMES 2 /* Number of frames a parameter set for a parameter band is used*/ -#define PARAM_MC_ICC_ERROR_BIAS_FAC (1.15f) /* factor for favouring past ICC maps in the adaptive ICC map decision */ #define PARAM_MC_TRANSIENT_BAND_STEP 2 /* Number of parameter bands combined in case of a transient frame*/ #define PARAM_MC_MAX_DECORR_CLDFB_BANDS 20 /* Maximum number of CLDFB bands with decorrelation */ #define PARAM_MC_MAX_TRANSPORT_CHANS 3 /* Number of down mix channels */ @@ -1517,27 +1427,23 @@ typedef enum #define PARAM_MC_NUM_BITS_ICC_SCALAR_QUANT 3 /* Number of bits for ICC uniform coding */ #define PARAM_MC_SZ_ILD_QUANTIZER_4BITS 16 /* Length of the ILD quantizer for Parametric MC */ #define PARAM_MC_NUM_BITS_ILD_SCALAR_QUANT 4 /* Number of bits for ILD uniform coding */ -#define PARAM_MC_DEFAULT_MIN_ILD (-92.0f) /* Default relative channel level for untransmitted channel energies */ -#define PARAM_MC_DEFAULT_MIN_ILD_FX (-23552) // Q8 /* Default relative channel level for untransmitted channel energies */ +#define PARAM_MC_DEFAULT_MIN_ILD_FX (-23552) /* Default relative channel level for untransmitted channel energies, (-92.0f) in Q8 */ #define PARAM_MC_MAX_BITS 1024 /* Maximum number of bits for the Parametric MC metadata */ #define PARAM_MC_MAX_BAND_ABS_COV_ENC 10 #define PARAM_MC_MAX_PARAM_BAND_ABS_COV_ENC 10 #define PARAM_MC_MAX_BAND_ABS_COV_DEC 10 -#define PARAM_MC_ENER_LIMIT_INTRAFRAME (1.5f) -#define PARAM_MC_ENER_LIMIT_INTRAFRAME_FX_Q21 3145728 -#define PARAM_MC_ENER_LIMIT_INTERFRAME (2.0f) -#define PARAM_MC_ENER_LIMIT_INTERFRAME_FX_Q21 4194304 -#define PARAM_MC_ENER_LIMIT_MAX_DELTA_FAC (15.0f) -#define PARAM_MC_ENER_LIMIT_MAX_DELTA_FAC_FX_Q21 31457280 -#define PARAM_MC_NUM_ATTACK_ILD_THRESH (3) -#define PARAM_MC_LFE_ON_THRESH (8000.0f) -#define PARAM_MC_LFE_ON_THRESH_FX 8000 // Q0 +#define PARAM_MC_ENER_LIMIT_INTRAFRAME_FX_Q21 3145728 /* (1.5f) in Q21 */ +#define PARAM_MC_ENER_LIMIT_INTERFRAME_FX_Q21 4194304 /* (2.0f) in Q21 */ +#define PARAM_MC_ENER_LIMIT_MAX_DELTA_FAC_FX_Q21 31457280 /* (15.0f) in Q21 */ +#define PARAM_MC_NUM_ATTACK_ILD_THRESH 3 +#define PARAM_MC_LFE_ON_THRESH_FX 8000 /* Q0 */ #define PARAM_MC_BAND_TO_MDCT_BAND_RATIO 16 /* Ratio of resolution of CLDFB Bands to MDCT Bands */ #define PARAM_MC_SLOT_ENC_NS 2500000L #define PARAM_MC_MDFT_NO_SLOTS 8 -#define INV_PARAM_MC_MDFT_NO_SLOTS_FX 4096 // Q15 +#define INV_PARAM_MC_MDFT_NO_SLOTS_FX 4096 /* Q15 */ #define PARAM_MC_CLDFB_TO_MDFT_FAC 2 + /*----------------------------------------------------------------------------------* * LFE Coding Constants *----------------------------------------------------------------------------------*/ @@ -1567,20 +1473,14 @@ typedef enum #define IVAS_LFE_NUM_COEFFS_IN_SUBGRP 2 #define IVAS_LFE_MAX_NUM_DCT_PASS_BINS 8 #define IVAS_LFE_MAX_NUM_DCT_COEFFS (IVAS_LFE_MAX_NUM_DCT_PASS_BINS * IVAS_LFE_NUM_COEFFS_IN_SUBGRP) -#define IVAS_LFE_FADE_NS 8000000L /* 8.0 ms */ -#define IVAS_LFE_FADE_S_Q15 263 /* 8.0 ms in Q15 */ +#define IVAS_LFE_FADE_NS 8000000L /* 8.0 ms */ +#define IVAS_LFE_FADE_S_Q15 263 /* 8.0 ms in Q15 */ #define IVAS_MAX_NUM_QUANT_STRATS 2 #define IVAS_MAX_NUM_DCT_COEF_GROUPS 4 #define IVAS_LFE_SHIFT_BITS 5 #define IVAS_LFE_BITRATE_5000 5000 -#define IVAS_LFE_ABS_SUM_FLT_THR (0.000001f) - -#define IVAS_LFE_ABS_SUM_FLT_THR_Q42 4398047 - - -#define IVAS_ZERO_PAD_LEN_MULT_FAC (0.5f) - -#define IVAS_ZERO_PAD_LEN_MULT_FAC_fx 16384 // 0.5 in Q15 +#define IVAS_LFE_ABS_SUM_FLT_THR_Q42 4398047 /* 0.000001f in Q42 */ +#define IVAS_ZERO_PAD_LEN_MULT_FAC_fx 16384 /* 0.5 in Q15 */ /* LFE PLC */ #define LFE_PLC_BUFLEN 240 @@ -1589,13 +1489,16 @@ typedef enum #define LFE_PLC_LENANA LFE_PLC_BUFLEN #define LFE_PLC_FDEL 300 + /*----------------------------------------------------------------------------------* * HO Dirac Constants *----------------------------------------------------------------------------------*/ -#define HODIRAC_BETA (214748368) /* 0.2f in Q30 */ -#define HODIRAC_FAC1 (951579008) /* 1.772454f in Q29 */ -#define HODIRAC_FAC2 (549393984) /* 1.023326f in Q29 */ -#define HODIRAC_FAC3 (317192992) /* 0.590818f in Q29 */ + +#define HODIRAC_BETA 214748368 /* 0.2f in Q30 */ +#define HODIRAC_FAC1 951579008 /* 1.772454f in Q29 */ +#define HODIRAC_FAC2 549393984 /* 1.023326f in Q29 */ +#define HODIRAC_FAC3 317192992 /* 0.590818f in Q29 */ + /*----------------------------------------------------------------------------------* * Amplitude Panning (EFAP, VBAP) constants @@ -1614,7 +1517,6 @@ typedef enum EFAP_DMX_INTENSITY } EFAP_VTX_DMX_TYPE; - #define VBAP_NUM_SEARCH_SECTORS 4 @@ -1626,8 +1528,8 @@ typedef enum #define BINAURAL_MAXBANDS_Q25 2013265920 /* Max number of bands in Q25 */ #define ONE_BY_48000_Q31 44740 #define BINAURAL_CONVBANDS 50 /* Bands upto which convolution is performed */ -#define BINAURAL_NTAPS 3 -#define BINAURAL_NTAPS_SBA BINAURAL_NTAPS +#define BINAURAL_NTAPS 3 +#define BINAURAL_NTAPS_SBA BINAURAL_NTAPS #define BINAURAL_NTAPS_MAX 96 @@ -1636,9 +1538,8 @@ typedef enum #define HRTF_LS_CHANNELS 15 #define HRTF_NUM_BINS 60 #define REVERB_PREDELAY_MAX 20 /* Max input delay for reverb module */ -#define GAIN_LFE 1.88364911f /* Gain applied to LFE during renderering */ -#define GAIN_LFE_WORD32 2022552831 // Q30 /* Gain applied to LFE during renderering */ -#define GAIN_LFE_FX 30862 // Q14 /* Gain applied to LFE during renderering */ +#define GAIN_LFE_WORD32 2022552831 /* Gain applied to LFE during renderering, 1.88364911f in Q30 */ +#define GAIN_LFE_FX 30862 /* Gain applied to LFE during renderering, 1.88364911f in Q14 */ #define LOW_BIT_RATE_BINAURAL_EQ_BINS 17 /* Number of bins in an EQ applied at low bit rates in binauralization */ #define LOW_BIT_RATE_BINAURAL_EQ_OFFSET 14 /* Offset of bins where the low-bit-rate EQ starts*/ @@ -1667,16 +1568,14 @@ typedef enum #define SFX_SPAT_BIN_NUM_SUBSAMPLES 64 #define ITD_MEM_LEN (MAX_ITD + SFX_SPAT_BIN_SINC_M) #define L_SUBFRAME5MS_48k (L_FRAME48k/4) -#define MAX_ANGULAR_STEP (0.01f) -#define MAX_ANGULAR_STEP_INV ( 1.0f / MAX_ANGULAR_STEP ) #define MAX_INTERPOLATION_STEPS 12 -#define DEG_360_IN_Q22 ( 360 << Q22 ) // Q22 -#define DEG_180_IN_Q22 ( 180 << Q22 ) // Q22 -#define DEG_90_IN_Q22 ( 90 << Q22 ) // Q22 -#define ONE_BY_360_Q31 ( 5965232 ) // Q31 -#define ONE_BY_360_Q15 ( 91 ) // Q15 -#define ONE_BY_180_Q31 ( 11930465 ) // Q31 +#define DEG_360_IN_Q22 ( 360 << Q22 ) /* Q22 */ +#define DEG_180_IN_Q22 ( 180 << Q22 ) /* Q22 */ +#define DEG_90_IN_Q22 ( 90 << Q22 ) /* Q22 */ +#define ONE_BY_360_Q31 ( 5965232 ) /* Q31 */ +#define ONE_BY_360_Q15 ( 91 ) /* Q15 */ +#define ONE_BY_180_Q31 ( 11930465 ) /* Q31 */ #define RESAMPLE_FACTOR_16_48_FX ( 5461 ) // Q14 #define RESAMPLE_FACTOR_32_48_FX ( 10922 ) // Q14 @@ -1722,7 +1621,6 @@ typedef enum } SFX_OpMode_t; - /*----------------------------------------------------------------------------------* * Reverberator constants *----------------------------------------------------------------------------------*/ @@ -1740,6 +1638,7 @@ typedef enum #define LR_IAC_LENGTH_NR_FC ( RV_LENGTH_NR_FC ) #define LR_IAC_LENGTH_NR_FC_16KHZ ( RV_LENGTH_NR_FC_16KHZ ) + /*----------------------------------------------------------------------------------* * FB mixer constants *----------------------------------------------------------------------------------*/ @@ -1854,7 +1753,7 @@ typedef enum #define IVAS_16K_12BANDS_ACTIVE_BANDS 10 #define SPAR_DIRAC_SPLIT_START_BAND 8 -#define DIRAC_TO_SPAR_HBR_PRED_CHS (FOA_CHANNELS - 1) +#define DIRAC_TO_SPAR_HBR_PRED_CHS (FOA_CHANNELS - 1) #define SPAR_DTX_BANDS 2 #define SPAR_DTX_BANDS_LOG2 1 /* To be used for shift operation instead of division */ #define DIRAC_DTX_BANDS 2 @@ -1870,22 +1769,19 @@ typedef enum *----------------------------------------------------------------------------------*/ #define IVAS_LIMITER_THRESHOLD 32729 /* -0.01 dBFS */ -#define IVAS_LIMITER_ATTACK_SECONDS 0.005f /*----------------------------------------------------------------------------------* * Early Reflection constants *----------------------------------------------------------------------------------*/ -#define ER_RADIUS (1.0f) -#define ER_LIST_ORIGIN_X (0.0f) -#define ER_LIST_ORIGIN_Y (0.0f) -#define ER_LIST_HEIGHT (1.6f) -#define ER_RADIUS_FX (1* ONE_IN_Q30) //Q2.30 -#define ER_LIST_ORIGIN_X_FX (0) -#define ER_LIST_ORIGIN_Y_FX (0) -#define ER_LIST_HEIGHT_FX (6710886) /* 1.6 in Q.22 */ - +#define ER_LIST_ORIGIN_X 0.0f +#define ER_LIST_ORIGIN_Y 0.0f +#define ER_LIST_HEIGHT 1.6f +#define ER_RADIUS_FX (1* ONE_IN_Q30) /*Q2.30 */ +#define ER_LIST_ORIGIN_X_FX 0 +#define ER_LIST_ORIGIN_Y_FX 0 +#define ER_LIST_HEIGHT_FX 6710886 /* 1.6f in Q.22 */ /*----------------------------------------------------------------------------------* @@ -1902,8 +1798,8 @@ typedef enum #define STEREO_DMX_EVS_SUBBAND_SIZE 2 #define STEREO_DMX_EVS_NB_SUBBAND_MAX (L_FRAME48k / (2 * STEREO_DMX_EVS_SUBBAND_SIZE)) -#define STEREO_DMX_EVS_PHA_LEN_MAX 96 /* Max of PHA_LEN */ -#define STEREO_DMX_EVS_FAD_LEN_MAX 480 /* Max of FAD_LEN */ +#define STEREO_DMX_EVS_PHA_LEN_MAX 96 /* Max of PHA_LEN */ +#define STEREO_DMX_EVS_FAD_LEN_MAX 480 /* Max of FAD_LEN */ #define STEREO_DMX_EVS_DATA_LEN_MAX (STEREO_DMX_EVS_PHA_LEN_MAX + L_FRAME48k) diff --git a/lib_com/ivas_dirac_com_fx.c b/lib_com/ivas_dirac_com_fx.c index 5f6c1135fc3f9babaab6aea80853bfe9eda2bbc2..cba992070911995e986aa23a6637d2802d189c5f 100644 --- a/lib_com/ivas_dirac_com_fx.c +++ b/lib_com/ivas_dirac_com_fx.c @@ -498,18 +498,19 @@ void ivas_get_dirac_sba_max_md_bits_fx( return; } + /*------------------------------------------------------------------------- * ivas_dirac_sba_config() * * DirAC Configuration function for SBA *------------------------------------------------------------------------*/ + ivas_error ivas_dirac_sba_config_fx( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ Word16 *element_mode, /* i/o: element mode of the core coder */ Word32 sba_total_brate, /* i : SBA total bitrate */ const Word16 sba_order, /* i : Ambisonic (SBA) order */ - const Word16 nbands /* i : number of frequency bands */ - , + const Word16 nbands, /* i : number of frequency bands */ IVAS_FORMAT ivas_format ) { Word16 nbands_coded; @@ -594,14 +595,19 @@ ivas_error ivas_dirac_sba_config_fx( } } - ivas_get_dirac_sba_max_md_bits_fx( sba_total_brate, &hQMetaData->bits_frame_nominal, &hQMetaData->metadata_max_bits, &hQMetaData->qmetadata_max_bit_req, hQMetaData->q_direction[0].cfg.nbands, - ivas_format ); + ivas_get_dirac_sba_max_md_bits_fx( sba_total_brate, &hQMetaData->bits_frame_nominal, &hQMetaData->metadata_max_bits, &hQMetaData->qmetadata_max_bit_req, hQMetaData->q_direction[0].cfg.nbands, ivas_format ); return error; } -void computeDirectionVectors_fixed( +/*------------------------------------------------------------------------- + * computeDirectionVectors() + * + * + *------------------------------------------------------------------------*/ + +void computeDirectionVectors_fx2( Word32 *intensity_real_x, /* i: exp = i_e */ Word32 *intensity_real_y, /* i: exp = i_e */ Word32 *intensity_real_z, /* i: exp = i_e */ @@ -621,6 +627,7 @@ void computeDirectionVectors_fixed( Word16 norm_x, norm_y, norm_z; Word32 scaled_x, scaled_y, scaled_z; Word16 e_x, e_y, e_z; + FOR( i = enc_param_start_band; i < enc_param_start_band + num_frequency_bands; ++i ) { norm_x = norm_l( *intensity_real_x ); @@ -676,11 +683,7 @@ void computeDirectionVectors_fixed( return; } -/*------------------------------------------------------------------------- - * computeDirectionVectors() - * - * - *------------------------------------------------------------------------*/ + void computeDirectionVectors_fx( Word32 *intensity_real_x, // i: Q( i_q ) @@ -710,6 +713,7 @@ void computeDirectionVectors_fx( Word32 *init_x = intensity_real_x; Word32 *init_y = intensity_real_y; Word32 *init_z = intensity_real_z; + // First loop to determine the Q for the direction vector FOR( i = enc_param_start_band; i < enc_param_start_band + num_frequency_bands; ++i ) { @@ -737,6 +741,7 @@ void computeDirectionVectors_fx( intensity_real_x = init_x; intensity_real_y = init_y; intensity_real_z = init_z; + // Actual processing loop for the direction vector FOR( i = enc_param_start_band; i < enc_param_start_band + num_frequency_bands; ++i ) { @@ -776,15 +781,18 @@ void computeDirectionVectors_fx( } *i_q = min_factor; move16(); + return; } + /*------------------------------------------------------------------------- * computeDiffuseness() * * *------------------------------------------------------------------------*/ -void computeDiffuseness_fixed( + +void computeDiffuseness_fx( Word32 *buffer_intensity[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF], // i: Q(q_factor_intensity) const Word32 *buffer_energy, // i: Q(q_factor_energy) const Word16 num_freq_bands, @@ -808,7 +816,6 @@ void computeDiffuseness_fixed( Word16 q_ene, q_intensity; /* Compute Intensity slow and energy slow buffer_intensity and buffer_energy */ - set_zero_fx( intensity_slow, i_mult( DIRAC_NUM_DIMS, CLDFB_NO_CHANNELS_MAX ) ); set_zero_fx( intensity_slow_abs, CLDFB_NO_CHANNELS_MAX ); set_zero_fx( energy_slow, CLDFB_NO_CHANNELS_MAX ); @@ -967,17 +974,20 @@ void computeDiffuseness_fixed( return; } -Word32 deindex_azimuth_fx( /* o : output Q22 */ - Word16 id_phi, /* i : index */ - const Word16 no_bits, /* i : number of bits for the spherical grid */ - const Word16 id_th, /* i : elevation index */ - const Word16 remap, /* i : remapping flag */ - const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ + +/* o : output Q22 */ +Word32 deindex_azimuth_fx( + Word16 id_phi, /* i : index */ + const Word16 no_bits, /* i : number of bits for the spherical grid */ + const Word16 id_th, /* i : elevation index */ + const Word16 remap, /* i : remapping flag */ + const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ ) { Word16 flag_delta; Word32 dd_fx, delta_phi_fx; Word32 phi_hat_fx; + test(); IF( NE_32( mc_format, MC_LS_SETUP_INVALID ) && EQ_16( no_bits, 2 ) ) { @@ -1027,6 +1037,7 @@ Word32 deindex_azimuth_fx( /* o : output Q22 } phi_hat_fx = companding_azimuth_fx( phi_hat_fx, mc_format, flag, -1 ); } + return phi_hat_fx; } @@ -1088,6 +1099,7 @@ void deindex_spherical_component_fx( return; } + /*---------------------------------------------------------------- * calculate_hodirac_sector_parameters() * diff --git a/lib_com/ivas_filters_fx.c b/lib_com/ivas_filters_fx.c index eca54cc55e99e883982da5403341ac6e7f511c67..02e7b272a4beb7759335c88421067918f710763f 100644 --- a/lib_com/ivas_filters_fx.c +++ b/lib_com/ivas_filters_fx.c @@ -41,28 +41,27 @@ /*------------------------------------------------------------------------------------------* * Local functions declaration *------------------------------------------------------------------------------------------*/ -static void ivas_iir_2_filter_fx( - ivas_filters_process_state_t *filter_state, - Word32 *pIn_Out_fx, // Q(31-*pIn_Out_e) - const Word16 length, - const Word16 stage, - Word16 *pIn_Out_e ); + +static void ivas_iir_2_filter_fx( ivas_filters_process_state_t *filter_state, Word32 *pIn_Out_fx, const Word16 length, const Word16 stage, Word16 *pIn_Out_e ); + + /*-----------------------------------------------------------------------------------------* * Function ivas_filters_init() * * Initialisation call for filtering a signal *-----------------------------------------------------------------------------------------*/ + void ivas_filters_init_fx( - ivas_filters_process_state_t *filter_state, /* i/o: filter state handle */ - const Word32 *filt_coeff_fx, /* i : filter coefficients Q31- *filt_coeff_e */ - const Word16 *filt_coeff_e, /* i : exponents of filter coefficients */ - const Word16 order ) /* i : filter order */ + ivas_filters_process_state_t *filter_state, /* i/o: filter state handle */ + const Word32 *filt_coeff_fx, /* i : filter coefficients Q31- *filt_coeff_e */ + const Word16 *filt_coeff_e, /* i : exponents of filter coefficients */ + const Word16 order ) /* i : filter order */ { Word16 i; + filter_state->order = order; move16(); - test(); IF( EQ_16( order, IVAS_FILTER_ORDER_1 ) ) { @@ -155,6 +154,7 @@ void ivas_filters_init_fx( * * Process call for selecting the type filter *-----------------------------------------------------------------------------------------*/ + void ivas_filter_process_fx( ivas_filters_process_state_t *filter_state, /* i/o: filter state handle */ Word32 *pIn_Out_fx, /* i/o: signal subject to filtering Q(q_factor) */ @@ -163,6 +163,7 @@ void ivas_filter_process_fx( { Word16 pIn_Out_e[L_FRAME_MAX]; Word16 i; + SWITCH( filter_state->order ) { case IVAS_FILTER_ORDER_1: @@ -195,6 +196,7 @@ void ivas_filter_process_fx( return; } + void ivas_filter_process_exp_fx( ivas_filters_process_state_t *filter_state, /* i/o: filter state handle */ Word32 *pIn_Out_fx, /* i/o: signal subject to filtering (exp[i] : pIn_out_e[i]) */ @@ -227,6 +229,7 @@ void ivas_filter_process_exp_fx( * * Process call for filtering a signal *-----------------------------------------------------------------------------------------*/ + static void ivas_iir_2_filter_fx( ivas_filters_process_state_t *filter_state, Word32 *pIn_Out_fx, // Q(31-*pIn_Out_e) @@ -279,4 +282,6 @@ static void ivas_iir_2_filter_fx( } } } + + return; } diff --git a/lib_com/ivas_pca_tools_fx.c b/lib_com/ivas_pca_tools_fx.c index c84078a7d4291080687cfe2597eafe8af3aba784..e0d42e4040cd90a6dc4f59c0d193d7c2d6d1022a 100644 --- a/lib_com/ivas_pca_tools_fx.c +++ b/lib_com/ivas_pca_tools_fx.c @@ -195,7 +195,7 @@ static void house_refl_fx( IF( ( *normu_fx ) == 0 ) { - pu_fx[0] = SQRT2_FIXED; // same q as other elements -> Q30 + pu_fx[0] = SQRT2_FX; // same q as other elements -> Q30 pu_e[0] = 1; move32(); move16(); @@ -387,8 +387,7 @@ static void house_qr_fx( move32(); } - - pv_fx[s - k] = dotp_fixed( &pu_fx[k], &pa_fx[k], sub( n_rows, k ) ); // exp: tmp_pu_e[k] + pv_fx[s - k] = dotp_fx32( &pu_fx[k], &pa_fx[k], sub( n_rows, k ) ); // exp: tmp_pu_e[k] pv_exp[s - k] = tmp_pu_e[k]; move32(); move16(); @@ -444,7 +443,7 @@ void eig_qr_fx( move16(); /* check zero matrix */ - d_fx = dotp_fixed( A_fx, A_fx, n * n ); // A_q + A_q - Q31 -> d_q + d_fx = dotp_fx32( A_fx, A_fx, n * n ); // A_q + A_q - Q31 -> d_q d_q = sub( add( A_q, A_q ), 31 ); if ( d_fx != 0 ) @@ -480,7 +479,7 @@ void eig_qr_fx( } /* stop condition */ - d_fx = dotp_fixed_guarded( D_fx, D_fx, n * n ); // ( A_q + A_q - 31 ) - find_guarded_bits_fx( n * n ) + d_fx = dotp_fx_guarded( D_fx, D_fx, n * n ); // ( A_q + A_q - 31 ) - find_guarded_bits_fx( n * n ) d_q = sub( sub( add( A_q, A_q ), 31 ), find_guarded_bits_fx( n * n ) ); exp = sub( 31, d_q ); d_fx = Sqrt32( d_fx, &exp ); diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 2dec8bb12ac57a15fdde1f4eac9cf8b9dd397278..3f4da4484417cd078ce823528d30fe4593519739 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -53,132 +53,131 @@ *----------------------------------------------------------------------------------*/ ivas_error ivas_masa_dec_open_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ); void ivas_masa_dec_close_fx( - MASA_DECODER_HANDLE *hMasa /* i/o: MASA metadata structure */ + MASA_DECODER_HANDLE *hMasa /* i/o: MASA metadata structure */ ); ivas_error create_evs_sce_enc_fx( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ - const Word16 sce_id, /* i : SCE # identifier */ - const Word32 element_brate /* i : element bitrate */ + Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ + const Word16 sce_id, /* i : SCE # identifier */ + const Word32 element_brate /* i : element bitrate */ ); void destroy_sce_enc_fx( - SCE_ENC_HANDLE hSCE, /* i/o: SCE encoder structure */ - Flag is_evs /* i : Flag to indicate EVS encoder */ + SCE_ENC_HANDLE hSCE, /* i/o: SCE encoder structure */ + Flag is_evs /* i : Flag to indicate EVS encoder */ ); void generate_gridEq_fx( - SPHERICAL_GRID_DATA *data /* o : data structure for grid */ + 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 */ + 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 */ + 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 */ ); void ivas_masa_set_coding_config_fx( - MASA_CODEC_CONFIG *config, /* i/o: MASA coding config structure */ - Word16 *band_mapping, /* o : Band mapping used */ - const Word32 ivas_total_brate, /* i : IVAS total bitrate */ - const Word16 nchan_transport, /* i : number of transport channels (mono/stereo) */ - const UWord8 isMcMasa /* i : toggle for selecting mcMASA specific config */ + MASA_CODEC_CONFIG *config, /* i/o: MASA coding config structure */ + Word16 *band_mapping, /* o : Band mapping used */ + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + const Word16 nchan_transport, /* i : number of transport channels (mono/stereo) */ + const UWord8 isMcMasa /* i : toggle for selecting mcMASA specific config */ ); void ivas_masa_prerender_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - Word32 *output_fx[], /* i/o: synthesized core-coder transport channels */ - Word16 *q_shift, /* o : specifies how much the Q-factor of output has changed by. */ - const Word16 output_frame, /* i : output frame length per channel */ - const Word16 nchan_remapped /* i : number of transports used in core */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + Word32 *output_fx[], /* i/o: synthesized core-coder transport channels */ + Word16 *q_shift, /* o : specifies how much the Q-factor of output has changed by. */ + const Word16 output_frame, /* i : output frame length per channel */ + const Word16 nchan_remapped /* i : number of transports used in core */ ); ivas_error ivas_masa_dec_reconfigure_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); void reconstruct_ism_ratios_fx( - Word16 *ratio_ism_idx, /* i : index vector Q0 */ - const Word16 nchan_ism, /* i : number of components/objects Q0 */ - const Word32 step, /* i : quantization step Q31 */ - Word32 *q_energy_ratio_ism /* o : reconstructed ISM values Q30 */ + Word16 *ratio_ism_idx, /* i : index vector Q0 */ + const Word16 nchan_ism, /* i : number of components/objects Q0 */ + const Word32 step, /* i : quantization step Q31 */ + Word32 *q_energy_ratio_ism /* o : reconstructed ISM values Q30 */ ); void distribute_evenly_ism_fx( - Word16 *idx, /* o : index values */ - const Word16 K, /* i : sum of indexes */ - const Word16 nchan_ism /* i : number of objects */ + Word16 *idx, /* o : index values */ + const Word16 K, /* i : sum of indexes */ + const Word16 nchan_ism /* i : number of objects */ ); Word16 valid_ratio_index_fx( - Word16 index, /* i : index to be checked */ - const Word16 K, /* i : L1 norm to check against */ - const Word16 len /* i : vector length */ + Word16 index, /* i : index to be checked */ + const Word16 K, /* i : L1 norm to check against */ + const Word16 len /* i : vector length */ ); UWord16 index_theta_phi_16_fx( - Word32 *p_theta, /* i/o: input elevation to be indexed Q22 */ - Word32 *p_phi, /* i/o: input azimuth to be indexed Q22 */ - const SPHERICAL_GRID_DATA *gridData /* i : generated grid data */ + Word32 *p_theta, /* i/o: input elevation to be indexed Q22 */ + Word32 *p_phi, /* i/o: input azimuth to be indexed Q22 */ + const SPHERICAL_GRID_DATA *gridData /* i : generated grid data */ ); ivas_error ivas_masa_decode_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ - Decoder_State *st, /* i/o: decoder state structure */ - Word16 *nb_bits_read /* o : number of bits read */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ + Decoder_State *st, /* i/o: decoder state structure */ + Word16 *nb_bits_read /* o : number of bits read */ ); void ivas_omasa_rearrange_channels_fx( - Word32 *output[], /* o : output synthesis signal */ - const Word16 nchan_transport_ism, /* o : number of ISM TCs */ - const Word16 output_frame /* i : output frame length per channel */ + Word32 *output[], /* o : output synthesis signal */ + const Word16 nchan_transport_ism, /* o : number of ISM TCs */ + const Word16 output_frame /* i : output frame length per channel */ ); ivas_error ivas_omasa_combine_separate_ism_with_masa_open_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); void ivas_omasa_combine_separate_ism_with_masa_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - Word32 *output[], /* o : output synthesis signal */ - Word16 *output_q, /* i/o: output Q value */ - const Word16 nchan_ism, /* i : number of ISMs */ - const Word16 output_frame /* i : output frame length per channel */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + Word32 *output[], /* o : output synthesis signal */ + Word16 *output_q, /* i/o: output Q value */ + const Word16 nchan_ism, /* i : number of ISMs */ + const Word16 output_frame /* i : output frame length per channel */ ); ivas_error ivas_omasa_objects_delay_open_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); void ivas_omasa_render_objects_from_mix_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - Word32 *output[], /* o : output synthesis signal */ - const Word16 nchan_ism, /* i : number of ISMs */ - const Word16 output_frame, /* i : output frame length per channel */ - Word16 *output_q /* i/o: output Q value */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + Word32 *output[], /* o : output synthesis signal */ + const Word16 nchan_ism, /* i : number of ISMs */ + const Word16 output_frame, /* i : output frame length per channel */ + Word16 *output_q /* i/o: output Q value */ ); - ivas_error ivas_omasa_ism_metadata_dec_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const Word32 ism_total_brate, /* i : ISM total bitrate */ @@ -189,13 +188,13 @@ ivas_error ivas_omasa_ism_metadata_dec_fx( ); ivas_error ivas_omasa_dec_config_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ Word16 *num_src, Word16 SrcInd[MAX_NUM_TDREND_CHANNELS] ); void ivas_omasa_modify_masa_energy_ratios_fx( - IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ + IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ Word32 masa_to_total_energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_MAXIMUM_CODING_SUBBANDS] // Q30 ); @@ -206,16 +205,16 @@ Word32 calculate_cpe_brate_MASA_ISM_fx( ); Word16 ivas_jbm_dec_get_num_tc_channels_fx( - Decoder_Struct *st_ivas /* i : IVAS decoder handle */ + 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 */ + 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( @@ -227,152 +226,160 @@ void ivas_dct_windowing_fx( const Word16 frame_len, /*Q0*/ Word32 *pOut_buf, // Q10 Word32 *pBuffer_prev, // Q10 - Word32 *pTemp_lfe ); + Word32 *pTemp_lfe +); void ivas_get_twid_factors_fx1( const Word16 length, // Q0 const Word16 **pTwid_re, // Q15 - const Word16 **pTwid_im ); + const Word16 **pTwid_im +); Word32 ivas_get_mdct_scaling_gain_fx( - const Word16 dct_len_by_2 ); + const Word16 dct_len_by_2 +); void ivas_imdct_fx( const Word32 *pIn, // Q24 Word32 *pOut, // q_out Q9 const Word16 length /*Q0*/, - Word16 *q_out ); + Word16 *q_out +); void ivas_mdct_fx( const Word32 *pIn, // q_out Word32 *pOut, // q_out const Word16 length, // Q0 - Word16 *q_out ); + Word16 *q_out +); void ivas_itda_fx( - const Word32 *re, /* i : time alised signal after IDCT Q24 */ - Word32 *pOut, /* o : time domain buffer of size 2*length */ - const Word16 length /* i : length of time alised signal buffer Q0 */ + const Word32 *re, /* i : time alised signal after IDCT Q24 */ + Word32 *pOut, /* o : time domain buffer of size 2*length */ + const Word16 length /* i : length of time alised signal buffer Q0 */ ); void ivas_tda_fx( - const Word32 *pIn, /* i : time domain buffer of size 2*length Q10*/ - Word32 *pOut, /* o : time domain buffer of size length Q10 */ - const Word16 length /* i : length of time alised signal buffer Q0*/ + const Word32 *pIn, /* i : time domain buffer of size 2*length Q10*/ + Word32 *pOut, /* o : time domain buffer of size length Q10 */ + const Word16 length /* i : length of time alised signal buffer Q0*/ ); -// ivas_agc_dec_fx.c ivas_error ivas_spar_agc_dec_open_fx( - ivas_agc_dec_state_t **hAgcDec, /* i/o: SPAR AGC decoder handle */ - const Word32 output_Fs /* i : output sampling rate */ + ivas_agc_dec_state_t **hAgcDec, /* i/o: SPAR AGC decoder handle */ + const Word32 output_Fs /* i : output sampling rate */ ); void ivas_spar_agc_dec_close_fx( - ivas_agc_dec_state_t **hAgcDec /* i/o: SPAR AGC decoder handle */ + ivas_agc_dec_state_t **hAgcDec /* i/o: SPAR AGC decoder handle */ ); void ivas_agc_dec_process_fx( - ivas_agc_dec_state_t *hAgcDec, /* i/o: AGC decoder handle */ - Word32 *pcm_in[], /* i : input audio channels */ - Word32 *pcm_out[], /* o : output audio channels */ - const Word16 n_channels, /* i : number of channels */ - const Word16 output_frame /* i : output frame length */ + ivas_agc_dec_state_t *hAgcDec, /* i/o: AGC decoder handle */ + Word32 *pcm_in[], /* i : input audio channels */ + Word32 *pcm_out[], /* o : output audio channels */ + const Word16 n_channels, /* i : number of channels */ + const Word16 output_frame /* i : output frame length */ ); void ivas_agc_read_bits_fx( - ivas_agc_dec_state_t *hAgcDec, /* i/o: AGC decoder handle */ - Decoder_State *st0, /* i/o: decoder state structure - for bitstream handling */ - const Word16 n_channels, /* i : number of channels */ - const Word16 AGC_flag /* i : AGC on/off flag */ + ivas_agc_dec_state_t *hAgcDec, /* i/o: AGC decoder handle */ + Decoder_State *st0, /* i/o: decoder state structure - for bitstream handling */ + const Word16 n_channels, /* i : number of channels */ + const Word16 AGC_flag /* i : AGC on/off flag */ ); -// ivas_agc_com_fx.c void ivas_agc_initWindowFunc_fx( Word16 *pWinFunc, // o: Q15 - const Word16 length ); + const Word16 length +); void ivas_agc_calcGainParams_fx( UWord16 *absEmin, // o: Q0 UWord16 *betaE, // o: Q0 UWord16 *maxAttExp, // o: Q0 - const Word16 numCoeffs ); + const Word16 numCoeffs +); void ivas_transient_det_process_fx( - ivas_trans_det_state_t *hTranDet, /* i/o: SPAR TD handle */ - Word32 *pIn_pcm, /* i : input audio channels */ - const Word16 frame_len, /* i : frame length in samples */ - Word16 transient_det[2] /* o : transient det outputs */ + ivas_trans_det_state_t *hTranDet, /* i/o: SPAR TD handle */ + Word32 *pIn_pcm, /* i : input audio channels */ + const Word16 frame_len, /* i : frame length in samples */ + Word16 transient_det[2] /* o : transient det outputs */ ); void ivas_td_decorr_get_ducking_gains_fx( - ivas_trans_det_state_t *hTranDet, /* i/o: Transient detector handle */ + ivas_trans_det_state_t *hTranDet, /* i/o: Transient detector handle */ Word32 *pIn_pcm, Word32 *pIn_duck_gains, Word32 *pOut_duck_gains, const Word16 frame_len, - const Word16 tdet_flag ); + const Word16 tdet_flag +); -// ivas_stereo_eclvq_dec.c -void ECSQ_decode( +void ECSQ_decode_fx( ECSQ_instance *ecsq_inst, const Word16 N, - Word16 *output ); + Word16 *output +); -// bass_psfilter.c Word16 res_bpf_adapt_fx( - STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: DFT stereo decoder handle */ - const Word32 *bpf_error_signal_8k, /* i : BPF modification signal */ - Word32 res_buf[STEREO_DFT_N_8k] /* i : residual buffer */ + STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: DFT stereo decoder handle */ + const Word32 *bpf_error_signal_8k, /* i : BPF modification signal */ + Word32 res_buf[STEREO_DFT_N_8k] /* i : residual buffer */ ); -// ivas_sns_com_fx.c void sns_compute_scf_fx( Word32 spectrum[], /* i : Spectrum (Q_in) */ const PsychoacousticParameters *pPsychParams, const Word16 L_frame, Word32 *scf, /* o : Scalefactors (Q16)*/ - Word16 q ); + Word16 q +); void sns_interpolate_scalefactors_fx( - Word32 *scf_int, /* o : interpolated scalefactors for spectrum shaping q16*/ - const Word32 *scf, /* i : sns scalefactors as derived from the signal or read from the bitstream Q16*/ - Word16 encoder_side /* i : flag, if scalefactors have to be inverted */ + Word32 *scf_int, /* o : interpolated scalefactors for spectrum shaping q16*/ + const Word32 *scf, /* i : sns scalefactors as derived from the signal or read from the bitstream Q16*/ + Word16 encoder_side /* i : flag, if scalefactors have to be inverted */ ); void sns_shape_spectrum_fx( - Word32 spectrum[], /* i/o: spectrum to be shaped Input Q is q_spectrum and ouput Q is (q_spectrum-1)*/ - Word16 *q_spectrum, /* i/o: Q of spectrum */ - const PsychoacousticParameters *pPsychParams, /* i : psychoacoustic parameters used to get the frequency bands */ - const Word32 *scf_int, /* i : already interpolated SNS scalefactors */ - const Word16 q_scf_int, /* i : Q of interpolated SNS scalefactors q_scf_int*/ - const Word16 L_frame, /* i : frame length */ - Word16 *length ); - -// ivas_stereo_eclvq_com_fx.c + Word32 spectrum[], /* i/o: spectrum to be shaped Input Q is q_spectrum and ouput Q is (q_spectrum-1)*/ + Word16 *q_spectrum, /* i/o: Q of spectrum */ + const PsychoacousticParameters *pPsychParams, /* i : psychoacoustic parameters used to get the frequency bands */ + const Word32 *scf_int, /* i : already interpolated SNS scalefactors */ + const Word16 q_scf_int, /* i : Q of interpolated SNS scalefactors q_scf_int*/ + const Word16 L_frame, /* i : frame length */ + Word16 *length +); + Word32 ECSQ_dequantize_gain_fx( - const Word16 index ); + const Word16 index +); void stereo_tca_enc_fx( - CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ - const Word16 input_frame /* i : length of a frame per channel */ + CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ + const Word16 input_frame /* i : length of a frame per channel */ ); void ECSQ_dequantize_vector_fx( const Word16 *input, /*qx*/ const Word32 global_gain, /*q15*/ const Word16 N, - Word32 *output /*qx*/ ); + Word32 *output /*qx*/ +); void ECSQ_init_instance_fx( ECSQ_instance *ecsq_inst, const Word16 config_index, - void *ac_handle ); + void *ac_handle +); void decoder_tcx_invQ_fx( - Decoder_State *st, /* i/o: coder memory state */ - Word16 prm[], /* i : parameters */ - Word16 A[], /* i : coefficients NxAz[M+1] */ - Word16 Aind[], /* i : frame-independent coefficients Az[M+1] */ + Decoder_State *st, /* i/o: coder memory state */ + Word16 prm[], /* i : parameters */ + Word16 A[], /* i : coefficients NxAz[M+1] */ + Word16 Aind[], /* i : frame-independent coefficients Az[M+1] */ const Word16 L_spec, const Word16 L_frame, const Word16 L_frameTCX, @@ -380,22 +387,22 @@ void decoder_tcx_invQ_fx( Word16 *x_e, Word16 gainlpc2[], Word16 gainlpc2_e[], - Word16 xn_buf[], /* Q14 */ - Word16 *fUseTns, /* o : flag that is set if TNS data is present */ + Word16 xn_buf[], /* Q14 */ + Word16 *fUseTns, /* o : flag that is set if TNS data is present */ STnsData *tnsData, Word16 *gain_tcx, Word16 *gain_tcx_e, const Word16 **prm_sqQ1, Word16 *nf_seed, - const Word16 bfi, /* i : Bad frame indicator */ - const Word16 frame_cnt /* i : frame counter in the super frame */ + const Word16 bfi, /* i : Bad frame indicator */ + const Word16 frame_cnt /* i : frame counter in the super frame */ ); void decoder_tcx_noisefilling_fx( - Decoder_State *st, /* i/o: coder memory state */ + Decoder_State *st, /* i/o: coder memory state */ const Word32 concealment_noise[L_FRAME48k], const Word16 concealment_noise_exp, - const Word16 A[], /* i : coefficients NxAz[M+1] */ + const Word16 A[], /* i : coefficients NxAz[M+1] */ const Word16 L_frameTCX_glob, const Word16 L_spec, const Word16 L_frame, @@ -409,13 +416,13 @@ void decoder_tcx_noisefilling_fx( const Word16 gain_tcx_e, const Word16 *prm_sqQ, Word16 nf_seed, - const Word16 bfi, /* i : Bad frame indicator */ + const Word16 bfi, /* i : Bad frame indicator */ const Word16 MCT_flag, - const Word16 frame_cnt /* i : frame counter in the super frame*/ + const Word16 frame_cnt /* i : frame counter in the super frame */ ); void decoder_tcx_noiseshaping_igf_fx( - Decoder_State *st, /* i/o: coder memory state */ + Decoder_State *st, /* i/o: coder memory state */ const Word16 L_spec, const Word16 L_frame, const Word16 L_frameTCX, @@ -426,283 +433,292 @@ void decoder_tcx_noiseshaping_igf_fx( const Word16 gainlpc2_fx[], const Word16 gainlpc2_e[], Word16 *temp_concealment_method, - const Word16 bfi /* i : Bad frame indicator */ + const Word16 bfi /* i : Bad frame indicator */ ); void init_tcx_info_fx( - Decoder_State *st, /* i/o: coder memory state */ - const Word16 L_frame_glob, /* i : global frame length */ - const Word16 L_frameTCX_glob, /* i : FB global frame length */ - const Word16 frame_cnt, /* i : frame counter in the super_frame */ - const Word16 bfi, /* i : bad frame indicator */ - Word16 *tcx_offset, /* o : folding point offset relative to the end of the previous frame */ - Word16 *tcx_offsetFB, /* o : FB folding point offset relative to the end of the previous frame*/ - Word16 *L_frame, /* o : frame length */ - Word16 *L_frameTCX, /* o : TCX frame length */ - Word16 *left_rect, /* o : left part is rectangular */ - Word16 *L_spec /* o : spectrum length */ + Decoder_State *st, /* i/o: coder memory state */ + const Word16 L_frame_glob, /* i : global frame length */ + const Word16 L_frameTCX_glob, /* i : FB global frame length */ + const Word16 frame_cnt, /* i : frame counter in the super_frame */ + const Word16 bfi, /* i : bad frame indicator */ + Word16 *tcx_offset, /* o : folding point offset relative to the end of the previous frame */ + Word16 *tcx_offsetFB, /* o : FB folding point offset relative to the end of the previous frame*/ + Word16 *L_frame, /* o : frame length */ + Word16 *L_frameTCX, /* o : TCX frame length */ + Word16 *left_rect, /* o : left part is rectangular */ + Word16 *L_spec /* o : spectrum length */ ); void decoder_tcx_IGF_mono_fx( - Decoder_State *st, /* i/o: coder memory state */ - Word32 x_fx[], /* o : de-quatized coefficients */ - Word16 *x_e, /* o : de-quatized coefficients exponent */ - Word16 *x_len, /* o : de-quatized coefficients length */ - const Word16 L_frame, /* i : frame length */ - const Word16 left_rect, /* i : left part is rectangular */ - const Word16 bfi, /* i : bad frame indicator */ - const Word16 frame_cnt /* i : frame counter in the super_frame */ + Decoder_State *st, /* i/o: coder memory state */ + Word32 x_fx[], /* o : de-quatized coefficients */ + Word16 *x_e, /* o : de-quatized coefficients exponent */ + Word16 *x_len, /* o : de-quatized coefficients length */ + const Word16 L_frame, /* i : frame length */ + const Word16 left_rect, /* i : left part is rectangular */ + const Word16 bfi, /* i : bad frame indicator */ + const Word16 frame_cnt /* i : frame counter in the super_frame */ ); void decoder_tcx_IGF_stereo_fx( - Decoder_State **sts, /* i/o: coder memory states */ - STEREO_MDCT_DEC_DATA_HANDLE hStereoMdct, /* i/o: MDCT stereo structure */ - Word16 ms_mask[NB_DIV][MAX_SFB], /* i : bandwise MS mask */ - Word32 *x_fx[CPE_CHANNELS][NB_DIV], /* i/o: de-quatized coefficients */ - Word16 x_e[CPE_CHANNELS][NB_DIV], /* i/o: de-quatized coefficients exponents */ - Word16 x_len[CPE_CHANNELS][NB_DIV], /* o : length of de-quantized coefficients */ - const Word16 L_frame, /* i : frame length */ - const Word16 left_rect, /* i : left part is rectangular */ - const Word16 k, /* i : Subframe index */ - const Word16 bfi, /* i : bad frame indicator */ - const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ + Decoder_State **sts, /* i/o: coder memory states */ + STEREO_MDCT_DEC_DATA_HANDLE hStereoMdct, /* i/o: MDCT stereo structure */ + Word16 ms_mask[NB_DIV][MAX_SFB], /* i : bandwise MS mask */ + Word32 *x_fx[CPE_CHANNELS][NB_DIV], /* i/o: de-quatized coefficients */ + Word16 x_e[CPE_CHANNELS][NB_DIV], /* i/o: de-quatized coefficients exponents */ + Word16 x_len[CPE_CHANNELS][NB_DIV], /* o : length of de-quantized coefficients */ + const Word16 L_frame, /* i : frame length */ + const Word16 left_rect, /* i : left part is rectangular */ + const Word16 k, /* i : Subframe index */ + const Word16 bfi, /* i : bad frame indicator */ + const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ); void IGFDecReplicateTCX10State_fx( - IGF_DEC_INSTANCE_HANDLE hIGFDec /* i/o: instance handle of IGF Decoder */ + IGF_DEC_INSTANCE_HANDLE hIGFDec /* i/o: instance handle of IGF Decoder */ ); -Word16 get_igf_startline( - Decoder_State *st, /* i : decoder state */ - const Word16 L_frame, /* i : length of the frame */ - const Word16 L_frameTCX /* i : full band frame length */ +Word16 get_igf_startline_fx( + Decoder_State *st, /* i : decoder state */ + const Word16 L_frame, /* i : length of the frame */ + const Word16 L_frameTCX /* i : full band frame length */ ); void stereo_dft_dec_reset_fx( - STEREO_DFT_DEC_DATA_HANDLE hStereoDft /* i/o: decoder DFT stereo handle */ + STEREO_DFT_DEC_DATA_HANDLE hStereoDft /* i/o: decoder DFT stereo handle */ ); void stereo_dft_dec_update_fx( - STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ - const Word16 output_frame, /* i : output frame length */ - const Word16 sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ + STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ + const Word16 output_frame, /* i : output frame length */ + const Word16 sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ ); + void stereo_dft_res_ecu_fx( - STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: Decoder DFT stereo handle */ - Word32 *pDFT_RES, /* i/o: residual signal */ - Word32 *const DFT_PRED_RES, /* i/o: residual prediction signal */ - const Word16 k, /* i : Subframe index */ - const Word16 output_frame, /* i : Output frame length */ - const Word16 prev_bfi, /* i : Previous BFI */ - const Word32 dmx_nrg, /* i : Down-mix energy */ - Word16 *num_plocs, /* i/o: Number of peak locations */ - Word16 *plocs, /* i/o: Peak locations (bin) */ - Word32 *plocsi, /* i/o: Peak locations (fractional) */ - Word32 *input_mem /* o : Residual DFT buffer input mem */ + STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: Decoder DFT stereo handle */ + Word32 *pDFT_RES, /* i/o: residual signal */ + Word32 *const DFT_PRED_RES, /* i/o: residual prediction signal */ + const Word16 k, /* i : Subframe index */ + const Word16 output_frame, /* i : Output frame length */ + const Word16 prev_bfi, /* i : Previous BFI */ + const Word32 dmx_nrg, /* i : Down-mix energy */ + Word16 *num_plocs, /* i/o: Number of peak locations */ + Word16 *plocs, /* i/o: Peak locations (bin) */ + Word32 *plocsi, /* i/o: Peak locations (fractional) */ + Word32 *input_mem /* o : Residual DFT buffer input mem */ ); + void stereo_dft_res_subst_spec_fx( - STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: Decoder DFT stereo handle */ - Word32 *pDFT_RES, /* i/o: residual signal */ - const Word32 *const DFT_PRED_RES, /* i : residual prediction signal */ - const Word16 time_offs, /* i : Time offset for phase adjustment*/ - const Word16 L_res, /* i : bandwidth of residual signal */ - const Word16 L_ana, /* i : Length of FFT analysis */ - const Word16 k, /* i : Subframe index */ - Word16 *num_plocs, /* i/o: Number of peak locations */ - Word16 *plocs, /* i/o: Peak locations (bin) */ - Word32 *plocsi, /* i/o: Peak locations (fractional) */ - const Word16 analysis_flag /* i : Flag for running peak analysis */ + STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: Decoder DFT stereo handle */ + Word32 *pDFT_RES, /* i/o: residual signal */ + const Word32 *const DFT_PRED_RES, /* i : residual prediction signal */ + const Word16 time_offs, /* i : Time offset for phase adjustment */ + const Word16 L_res, /* i : bandwidth of residual signal */ + const Word16 L_ana, /* i : Length of FFT analysis */ + const Word16 k, /* i : Subframe index */ + Word16 *num_plocs, /* i/o: Number of peak locations */ + Word16 *plocs, /* i/o: Peak locations (bin) */ + Word32 *plocsi, /* i/o: Peak locations (fractional) */ + const Word16 analysis_flag /* i : Flag for running peak analysis */ ); + void stereo_dft_res_ecu_burst_att_fx( - STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: Decoder DFT stereo handle */ - Word32 *pDFT_RES, /* i/o: residual signal /att. residual */ - const Word32 dmx_nrg, /* i : dmx energy of current frame */ - const Word16 L_res, /* i : Bandwidth of residual */ - const Word16 L_ana /* i : Length of FFT analysis */ + STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: Decoder DFT stereo handle */ + Word32 *pDFT_RES, /* i/o: residual signal /att. residual */ + const Word32 dmx_nrg, /* i : dmx energy of current frame */ + const Word16 L_res, /* i : Bandwidth of residual */ + const Word16 L_ana /* i : Length of FFT analysis */ ); void stereo_dft_generate_res_pred_fx( - STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ - const Word16 samp_ratio, /* i : sampling ratio */ - Word32 *pDFT_DMX, /* i : downmix signal */ - Word32 *DFT_PRED_RES, /* o : residual prediction signal */ - Word32 *pPredGain, /* i : residual prediction gains */ - const Word16 k, /* i : subframe index */ - Word32 *ap_filt_DMX, /* i : enhanced stereo filling signal */ - Word16 *stop, /* o : last FD stereo filling bin */ - const Word16 bfi /* i : BFI flag */ + STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ + const Word16 samp_ratio, /* i : sampling ratio */ + Word32 *pDFT_DMX, /* i : downmix signal */ + Word32 *DFT_PRED_RES, /* o : residual prediction signal */ + Word32 *pPredGain, /* i : residual prediction gains */ + const Word16 k, /* i : subframe index */ + Word32 *ap_filt_DMX, /* i : enhanced stereo filling signal */ + Word16 *stop, /* o : last FD stereo filling bin */ + const Word16 bfi /* i : BFI flag */ ); void stereo_dft_dec_analyze_fx( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - const Word32 *input_fx, /* i : input signal */ - Word32 out_DFT_fx[CPE_CHANNELS][STEREO_DFT_BUF_MAX], /* o : DFT buffers */ - const Word16 chan, /* i : channel number */ - const Word16 input_frame, /* i : input frame size */ - const Word16 output_frame, /* i : output frame size */ - const DFT_STEREO_DEC_ANA_TYPE ana_type, /* i : signal type to analyze */ - const Word16 k_offset, /* i : offset of DFT */ - const Word16 delay, /* i : delay in samples for input signal */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + const Word32 *input_fx, /* i : input signal */ + Word32 out_DFT_fx[CPE_CHANNELS][STEREO_DFT_BUF_MAX], /* o : DFT buffers */ + const Word16 chan, /* i : channel number */ + const Word16 input_frame, /* i : input frame size */ + const Word16 output_frame, /* i : output frame size */ + const DFT_STEREO_DEC_ANA_TYPE ana_type, /* i : signal type to analyze */ + const Word16 k_offset, /* i : offset of DFT */ + const Word16 delay, /* i : delay in samples for input signal */ Word16 *q, - Word16 *q_out_DFT ); + Word16 *q_out_DFT +); void init_basic_allpass_fx( basic_allpass_t *ap, const Word32 *gains_fx, - const Word16 *delays ); + const Word16 *delays +); void filter_with_allpass_fx( - const Word32 *sig, /* i : allpass input signal */ - Word32 *out, /* o : filtered output */ - const Word16 len, /* i : length of input */ - basic_allpass_t *ap, /* i/o: basic allpass structure */ - Word16 q_shift ); + const Word32 *sig, /* i : allpass input signal */ + Word32 *out, /* o : filtered output */ + const Word16 len, /* i : length of input */ + basic_allpass_t *ap, /* i/o: basic allpass structure */ + Word16 q_shift +); Word32 stereo_dft_dmx_swb_nrg_fx( - const Word32 *dmx_k0, /* i : first subframe spectrum */ - const Word32 *dmx_k1, /* i : second subframe spectrum */ - const Word16 frame_length, /* i : frame lanegth */ + const Word32 *dmx_k0, /* i : first subframe spectrum */ + const Word32 *dmx_k1, /* i : second subframe spectrum */ + const Word16 frame_length, /* i : frame lanegth */ const Word16 q0, - const Word16 q1 ); + const Word16 q1 +); void stereo_dft_dec_core_switching_fx( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - Word32 output_fx[], /* i/o: synthesis @internal Fs */ - Word32 synth_fx[], /* i/o: synthesis @output Fs */ - Word32 hb_synth_fx[], /* i/o: hb synthesis */ - Word32 DFT_fx[CPE_CHANNELS][STEREO_DFT_BUF_MAX], /* o : DFT buffers */ - const Word16 output_frame, /* i : output frame length */ - const Word16 use_cldfb_for_dft, /* i : flag to use of CLDFB FOR DFT Stereo */ - const Word16 sba_dirac_stereo_dtx_flag, /* i : DTX indicator FOR SBA DirAC stereo */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + Word32 output_fx[], /* i/o: synthesis @internal Fs */ + Word32 synth_fx[], /* i/o: synthesis @output Fs */ + Word32 hb_synth_fx[], /* i/o: hb synthesis */ + Word32 DFT_fx[CPE_CHANNELS][STEREO_DFT_BUF_MAX], /* o : DFT buffers */ + const Word16 output_frame, /* i : output frame length */ + const Word16 use_cldfb_for_dft, /* i : flag to use of CLDFB FOR DFT Stereo */ + const Word16 sba_dirac_stereo_dtx_flag, /* i : DTX indicator FOR SBA DirAC stereo */ Word16 *q, - Word16 *q_DFT ); + Word16 *q_DFT +); Word16 ivas_get_hodirac_flag_fx( - const Word32 ivas_total_brate, /* i : IVAS total bitrate */ - const Word16 sba_order /* i : Ambisonic (SBA) order */ + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + const Word16 sba_order /* i : Ambisonic (SBA) order */ ); void ivas_sba_config_fx( - const Word32 sba_total_brate, /* i : SBA total bitrate */ - Word16 sba_order, /* i : Ambisonic (SBA) order */ - Word16 nb_channels, /* i : Number of ambisonic channels */ - Word16 *nchan_transport, /* o : number of transport channels */ - const Word16 sba_planar, /* i : SBA Planar flag */ - Word16 *nSCE, /* o : number of SCEs */ - Word16 *nCPE, /* o : number of CPEs */ - Word16 *element_mode /* o : element mode of the core coder */ + const Word32 sba_total_brate, /* i : SBA total bitrate */ + Word16 sba_order, /* i : Ambisonic (SBA) order */ + Word16 nb_channels, /* i : Number of ambisonic channels */ + Word16 *nchan_transport, /* o : number of transport channels */ + const Word16 sba_planar, /* i : SBA Planar flag */ + Word16 *nSCE, /* o : number of SCEs */ + Word16 *nCPE, /* o : number of CPEs */ + Word16 *element_mode /* o : element mode of the core coder */ ); Word16 ivas_get_bits_to_encode( - Word32 val ); + Word32 val +); Word16 ivas_get_spar_table_idx_fx( - const Word32 ivas_total_brate, /* i : IVAS total bitrate */ - const Word16 sba_order, /* i : Ambisonic (SBA) order */ - const Word16 bwidth, /* i : audio bandwidth */ - Word16 *bitlen, /* o : number of bits */ - Word16 *ind /* o : indice */ + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + const Word16 sba_order, /* i : Ambisonic (SBA) order */ + const Word16 bwidth, /* i : audio bandwidth */ + Word16 *bitlen, /* o : number of bits */ + Word16 *ind /* o : indice */ ); Word16 ivas_get_sba_num_TCs_fx( - const Word32 ivas_total_brate, /* i : IVAS total bitrate */ - const Word16 sba_order /* i : Ambisonic (SBA) order */ + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + const Word16 sba_order /* i : Ambisonic (SBA) order */ ); Word16 ivas_sba_get_nchan_fx( - const Word16 sba_order, /* i : Ambisonic (SBA) order */ - const Word16 sba_planar /* i : SBA planar flag */ + const Word16 sba_order, /* i : Ambisonic (SBA) order */ + const Word16 sba_planar /* i : SBA planar flag */ ); void ivas_dirac_dec_set_md_map_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const Word16 nCldfbTs /* i : number of CLDFB time slots */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const Word16 nCldfbTs /* i : number of CLDFB time slots */ ); void ivas_jbm_dec_get_adapted_subframes_fx( - const Word16 nCldfbTs, /* i : number of time slots in the current frame */ - Word16 *subframe_nbslots, /* i/o: subframe grid */ - Word16 *nb_subframes /* i/o: number of subframes in the frame */ + const Word16 nCldfbTs, /* i : number of time slots in the current frame */ + Word16 *subframe_nbslots, /* i/o: subframe grid */ + Word16 *nb_subframes /* i/o: number of subframes in the frame */ ); void ivas_jbm_dec_copy_tc_no_tsm_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle Q0 */ - Word32 *tc_fx[], /* i : transport channels Q11 */ - const Word16 output_frame /* i : output frame size Q0 */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle Q0 */ + Word32 *tc_fx[], /* i : transport channels Q11 */ + const Word16 output_frame /* i : output frame size Q0 */ ); void ivas_ism_param_dec_tc_gain_ajust_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const UWord16 nSamples, /* i : number of samples to be compensate */ - const UWord16 nFadeLength, /* i : length of the crossfade in samples */ - Word32 *transport_channels_f[], /* i : synthesized core-coder transport channels/DirAC output Q_tc*/ - Word16 *Q_tc /* i/o : Q of input tc buffer */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const UWord16 nSamples, /* i : number of samples to be compensate */ + const UWord16 nFadeLength, /* i : length of the crossfade in samples */ + Word32 *transport_channels_f[], /* i : synthesized core-coder transport channels/DirAC output Q_tc*/ + Word16 *Q_tc /* i/o : Q of input tc buffer */ ); /*! r: number of bits read */ Word16 read_GR0( - const UWord16 *bit_stream, /* i : bitstream to be read */ - Word16 *ind, /* o : parameters read */ - const Word16 len /* i : number of params to be read */ + const UWord16 *bit_stream, /* i : bitstream to be read */ + Word16 *ind, /* o : parameters read */ + const Word16 len /* i : number of params to be read */ ); /*! r: read value */ Word16 get_value( - const UWord16 *bit_stream, /* i : bitstream */ - const Word16 nbits /* i : number of bits to be read */ + const UWord16 *bit_stream, /* i : bitstream */ + const Word16 nbits /* i : number of bits to be read */ ); /*! r: number of bits read */ Word16 read_BS_GR( - const UWord16 *bit_stream, /* i : bitstream to be read */ - const Word16 nb, /* i : starting point in bitstream */ - Word16 *ind1, /* o : data array read */ - const Word16 len, /* i : number of params to be read */ - Word16 *GR_ord /* o : GR order to be used */ + const UWord16 *bit_stream, /* i : bitstream to be read */ + const Word16 nb, /* i : starting point in bitstream */ + Word16 *ind1, /* o : data array read */ + const Word16 len, /* i : number of params to be read */ + Word16 *GR_ord /* o : GR order to be used */ ); /*! r: number of bits read */ Word16 read_BS_adapt_GR_sg( - const UWord16 *bit_stream, /* i : bitstream to be read */ - const Word16 nb, /* i : starting position in bitstream */ - Word16 *ind1, /* o : decoded side gain values */ - const Word16 len, /* i : number of params to be read */ - Word16 *GR_ord, /* o : GR order used (read from bitstream)*/ - const Word16 *map0 /* i : initial map */ + const UWord16 *bit_stream, /* i : bitstream to be read */ + const Word16 nb, /* i : starting position in bitstream */ + Word16 *ind1, /* o : decoded side gain values */ + const Word16 len, /* i : number of params to be read */ + Word16 *GR_ord, /* o : GR order used (read from bitstream) */ + const Word16 *map0 /* i : initial map */ ); /*! r: number of bits read */ Word16 read_itd( - Decoder_State *st, /* i : Decoder state */ - Word16 *pI /* o : ITD value */ + Decoder_State *st, /* i : Decoder state */ + Word16 *pI /* o : ITD value */ ); /*! r: number of bits read */ Word16 read_BS_adapt_GR_rpg( - const UWord16 *bit_stream, /* i : bitstream to be read */ - const Word16 nb, /* i : starting point in bitstream */ - Word16 *ind1_pred, /* o : decoded res pred gains */ - const Word16 start, /* i : starting subband */ - const Word16 total_no, /* i : number of params to be read */ - Word16 *GR_ord /* o : GR order - read */ + const UWord16 *bit_stream, /* i : bitstream to be read */ + const Word16 nb, /* i : starting point in bitstream */ + Word16 *ind1_pred, /* o : decoded res pred gains */ + const Word16 start, /* i : starting subband */ + const Word16 total_no, /* i : number of params to be read */ + Word16 *GR_ord /* o : GR order - read */ ); /*! r: number of bits read */ Word16 read_flag_EC_DFT( - const UWord16 *bit_stream, /* i : bitstream */ - Word16 *flag /* o : flag value */ + const UWord16 *bit_stream, /* i : bitstream */ + Word16 *flag /* o : flag value */ ); void ivas_init_dec_get_num_cldfb_instances_fx( - Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ - Word16 *numCldfbAnalyses, /* o : number of CLDFB analysis instances */ - Word16 *numCldfbSyntheses /* o : number of CLDFB synthesis instances */ + Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ + Word16 *numCldfbAnalyses, /* o : number of CLDFB analysis instances */ + Word16 *numCldfbSyntheses /* o : number of CLDFB synthesis instances */ ); Word16 masa_sq_fx( - const Word32 in, /* i : input value */ - const Word32 *threshold, /* i : partition */ - const Word16 cb_sz /* i : codebook size */ + const Word32 in, /* i : input value */ + const Word32 *threshold, /* i : partition */ + const Word16 cb_sz /* i : codebook size */ ); void ivas_compute_spar_params_enc_fx( @@ -725,7 +741,8 @@ void ivas_compute_spar_params_enc_fx( Word32 *pWscale, /*q_Wscale*/ Word16 *q_Wscale, const Word16 from_dirac, - const Word16 dyn_active_w_flag ); + const Word16 dyn_active_w_flag +); void ivas_compute_spar_params_fx( Word32 *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], /*q_cov_real*/ @@ -747,22 +764,23 @@ void ivas_compute_spar_params_fx( Word32 *pWscale_fx, /*q_pWscale*/ Word16 *q_pWscale, const Word16 from_dirac, - const Word16 dyn_active_w_flag ); + const Word16 dyn_active_w_flag +); 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 */ + 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 */ ); #ifdef OBJ_EDITING_API @@ -772,109 +790,102 @@ void ivas_ism_renderer_update_md( #endif 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 Q22*/ - Word32 *q_step_border_fx, /* o : quantization step at the border Q22*/ - Word16 *nBits_coh, /* o : number of Q bits for coherence */ - Word16 *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ + 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 Q22*/ + Word32 *q_step_border_fx, /* o : quantization step at the border Q22*/ + 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 */ -); - -// ivas_sce_dec_fx.c + 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 */ +); + ivas_error create_sce_dec( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const Word16 cpe_id, /* i : SCE # identifier */ - const Word32 element_brate /* i : element bitrate */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const Word16 cpe_id, /* i : SCE # identifier */ + const Word32 element_brate /* i : element bitrate */ ); void destroy_sce_dec( - SCE_DEC_HANDLE hSCE /* i/o: SCE decoder structure */ + SCE_DEC_HANDLE hSCE /* i/o: SCE decoder structure */ ); void destroy_core_enc_fx( - ENC_CORE_HANDLE hCoreCoder /* i/o: core encoder structure */ + ENC_CORE_HANDLE hCoreCoder /* i/o: core encoder structure */ ); void destroy_evs_core_enc_fx( - ENC_CORE_HANDLE hCoreCoder /* i/o: core encoder structure */ + ENC_CORE_HANDLE hCoreCoder /* i/o: core encoder structure */ ); ivas_error ivas_sce_dec_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const Word16 sce_id, /* i : SCE # identifier */ - Word32 *output[1], /* o : output synthesis signal */ - const Word16 output_frame, /* i : output frame length per channel */ - const Word16 nb_bits_metadata /* i : number of metadata bits */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const Word16 sce_id, /* i : SCE # identifier */ + Word32 *output[1], /* o : output synthesis signal */ + const Word16 output_frame, /* i : output frame length per channel */ + const Word16 nb_bits_metadata /* i : number of metadata bits */ ); -// ivas_cpe_dec_fx.c ivas_error create_cpe_dec( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const Word16 cpe_id, /* i : CPE # identifier */ - const Word32 element_brate /* i : element bitrate */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const Word16 cpe_id, /* i : CPE # identifier */ + const Word32 element_brate /* i : element bitrate */ ); void destroy_cpe_dec( - CPE_DEC_HANDLE hCPE /* i/o: CPE decoder structure */ + CPE_DEC_HANDLE hCPE /* i/o: CPE decoder structure */ ); ivas_error ivas_cpe_dec_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const Word16 cpe_id, /* i : CPE # identifier */ - Word32 *output[CPE_CHANNELS], /* o : output synthesis signal */ - const Word16 output_frame, /* i : output frame length per channel */ - const Word16 nb_bits_metadata /* i : number of metadata bits */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const Word16 cpe_id, /* i : CPE # identifier */ + Word32 *output[CPE_CHANNELS], /* o : output synthesis signal */ + const Word16 output_frame, /* i : output frame length per channel */ + const Word16 nb_bits_metadata /* i : number of metadata bits */ ); void ivas_post_proc_fx( - SCE_DEC_HANDLE hSCE, /* i/o: SCE decoder structure */ - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - const Word16 n, /* i : channel number */ - Word32 synth[], /* i/o: output synthesis signal */ - Word32 *output[CPE_CHANNELS], /* i/o: output synthesis signal */ - const Word16 output_frame, /* i : output frame length */ - const Word16 sba_dirac_stereo_flag, /* i : signal stereo output for SBA DirAC */ - Word16 output_q ); - -// ivas_lfe_dec_fx.c - -void ivas_lfe_dec_close_fx( - LFE_DEC_HANDLE *hLFE /* i/o: LFE encoder handle */ + SCE_DEC_HANDLE hSCE, /* i/o: SCE decoder structure */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + const Word16 n, /* i : channel number */ + Word32 synth[], /* i/o: output synthesis signal */ + Word32 *output[CPE_CHANNELS], /* i/o: output synthesis signal */ + const Word16 output_frame, /* i : output frame length */ + const Word16 sba_dirac_stereo_flag, /* i : signal stereo output for SBA DirAC */ + Word16 output_q ); ivas_error ivas_create_lfe_dec_fx( - LFE_DEC_HANDLE *hLFE_out, /* o : IVAS LFE decoder structure */ - const Word32 output_Fs, /* i : output sampling rate */ - const Word32 delay_ns /* i : additional LFE delay to sync other channel outputs */ + LFE_DEC_HANDLE *hLFE_out, /* o : IVAS LFE decoder structure */ + const Word32 output_Fs, /* i : output sampling rate */ + const Word32 delay_ns /* i : additional LFE delay to sync other channel outputs */ ); void ivas_lfe_dec_fx( - LFE_DEC_HANDLE hLFE, /* i/o: LFE decoder handle */ - Decoder_State *st0, /* i/o: decoder state structure - for bitstream handling*/ - const Word16 output_frame, /* i : output frame length per channel */ - const Word16 bfi, /* i : BFI flag */ - Word32 output_lfe_ch[] /* o : output LFE synthesis */ + LFE_DEC_HANDLE hLFE, /* i/o: LFE decoder handle */ + Decoder_State *st0, /* i/o: decoder state structure - for bitstream handling*/ + const Word16 output_frame, /* i : output frame length per channel */ + const Word16 bfi, /* i : BFI flag */ + Word32 output_lfe_ch[] /* o : output LFE synthesis */ ); void ivas_lfe_tdplc_fx( - LFE_DEC_HANDLE hLFE, /* i/o: LFE decoder handle */ - const Word32 *prevsynth, /* i : previous frame synthesis */ - Word32 *ytda, /* o : output time-domain buffer */ - const Word16 output_frame /* i : output frame length */ + LFE_DEC_HANDLE hLFE, /* i/o: LFE decoder handle */ + const Word32 *prevsynth, /* i : previous frame synthesis */ + Word32 *ytda, /* o : output time-domain buffer */ + const Word16 output_frame /* i : output frame length */ ); void ivas_lfe_dec_close_fx( @@ -882,115 +893,115 @@ void ivas_lfe_dec_close_fx( ); void td_stereo_param_updt_fx( - const Word16 lsp_old_PCh_fx[], /* i : primary channel old LSPs Q15 */ - const Word16 lsf_old_PCh_fx[], /* i : primary channel old LSFs Qlog2(2.56) */ - const Word16 pitch_buf_PCh_fx[], /* i : primary channel pitch buffer Q6 */ - Word16 tdm_lsfQ_PCh_fx[], /* o : Q LSFs for primary channel Qlog2(2.56) */ - Word16 tdm_Pri_pitch_buf_fx[], /* o : pitch values for primary channel Q6 */ - const Word16 flag_ACELP16k, /* i : ACELP@16kHz flag */ - const Word16 tdm_use_IAWB_Ave_lpc /* i : flag to indicate the usage of mean inactive LP coefficients */ + const Word16 lsp_old_PCh_fx[], /* i : primary channel old LSPs Q15 */ + const Word16 lsf_old_PCh_fx[], /* i : primary channel old LSFs Qlog2(2.56) */ + const Word16 pitch_buf_PCh_fx[], /* i : primary channel pitch buffer Q6 */ + Word16 tdm_lsfQ_PCh_fx[], /* o : Q LSFs for primary channel Qlog2(2.56) */ + Word16 tdm_Pri_pitch_buf_fx[], /* o : pitch values for primary channel Q6 */ + const Word16 flag_ACELP16k, /* i : ACELP@16kHz flag */ + const Word16 tdm_use_IAWB_Ave_lpc /* i : flag to indicate the usage of mean inactive LP coefficients */ ); void updt_enc_common_ivas_fx( - Encoder_State *st, /* i/o: encoder state structure */ - const Word16 Q_new /* i : CUrrent frame scaling */ + Encoder_State *st, /* i/o: encoder state structure */ + const Word16 Q_new /* i : CUrrent frame scaling */ ); - void updateBuffersForDmxMdctStereo_fx( - CPE_DEC_HANDLE hCPE, /* i/o: CPE handle */ - const Word16 output_frame, /* i : output frame length */ - Word32 output0_fx[], /* i/o: decoder output */ - Word32 output1_fx[], /* i/o: decoder output */ - Word16 synth_fx[CPE_CHANNELS][L_FRAME48k] /* i/o: decoder synthesis */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE handle */ + const Word16 output_frame, /* i : output frame length */ + Word32 output0_fx[], /* i/o: decoder output */ + Word32 output1_fx[], /* i/o: decoder output */ + Word16 synth_fx[CPE_CHANNELS][L_FRAME48k] /* i/o: decoder synthesis */ ); void stereo_cng_compute_PScorr_fx( - Word32 output_fx0[], /* i : Output signal */ - Word32 output_fx1[], /* i : Output signal */ + Word32 output_fx0[], /* i : Output signal */ + Word32 output_fx1[], /* i : Output signal */ Word16 *output_Q, - Word32 *c_PS_LT_fx, /* i/o: Correlation */ + Word32 *c_PS_LT_fx, /* i/o: Correlation */ Word16 Q_c_PS_LT_fx, - const Word16 L_frame_0, /* i : L_frame channel 0 */ - const Word16 L_frame_1 /* i : L_frame channel 1 */ + const Word16 L_frame_0, /* i : L_frame channel 0 */ + const Word16 L_frame_1 /* i : L_frame channel 1 */ ); void ivas_mcmasa_setNumTransportChannels_fx( - Word16 *nchan_transport, /* o : Pointer to number of transport channels to be set */ - Word16 *element_mode, /* o : Pointer to element mode to be set */ - const Word32 ivas_total_brate /* i : Total bitrate of IVAS */ + Word16 *nchan_transport, /* o : Pointer to number of transport channels to be set */ + Word16 *element_mode, /* o : Pointer to element mode to be set */ + const Word32 ivas_total_brate /* i : Total bitrate of IVAS */ ); void ivas_mcmasa_set_separate_channel_mode_fx( - UWord8 *separateChannelEnabled, /* o : Pointer to separate channel toggle */ - Word16 *separateChannelIndex, /* o : Pointer to separate channel index */ - const Word32 ivas_total_brate /* i : Total bitrate of IVAS */ + UWord8 *separateChannelEnabled, /* o : Pointer to separate channel toggle */ + Word16 *separateChannelIndex, /* o : Pointer to separate channel index */ + const Word32 ivas_total_brate /* i : Total bitrate of IVAS */ ); void ivas_mcmasa_split_brate_fx( - const UWord8 separateChannelEnabled, /* i : Transport running in "separate channel" mode */ - const Word32 ivas_total_brate, /* i : IVAS total bitrate available to be split */ - const Word16 nSCE, /* i : Number of SCEs in use (0 or 1) */ - const Word16 nCPE, /* i : Number of CPEs in use (0 or 1) */ - Word32 *brate_sce, /* o : Pointer to SCE element bitrate */ - Word32 *brate_cpe /* o : Pointer to CPE element bitrate */ + const UWord8 separateChannelEnabled, /* i : Transport running in "separate channel" mode */ + const Word32 ivas_total_brate, /* i : IVAS total bitrate available to be split */ + const Word16 nSCE, /* i : Number of SCEs in use (0 or 1) */ + const Word16 nCPE, /* i : Number of CPEs in use (0 or 1) */ + Word32 *brate_sce, /* o : Pointer to SCE element bitrate */ + Word32 *brate_cpe /* o : Pointer to CPE element bitrate */ ); void update_last_metadata_fx( - const Word16 nchan_ism, /* i : number of objects */ - ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ - const Word16 updt_flag[] /* i : last metadata update flag */ + const Word16 nchan_ism, /* i : number of objects */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + const Word16 updt_flag[] /* i : last metadata update flag */ ); ivas_error ivas_jbm_dec_tc_buffer_reconfigure_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const TC_BUFFER_MODE tc_buffer_mode, /* i : new buffer mode */ - const Word16 nchan_transport_jbm, /* i : new number of real transport channels */ - const Word16 nchan_transport_internal, /* i : new number of totally buffered channels */ - const Word16 nchan_full, /* i : new number of channels to fully store */ - const Word16 n_samples_granularity /* i : new granularity of the renderer/buffer */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const TC_BUFFER_MODE tc_buffer_mode, /* i : new buffer mode */ + const Word16 nchan_transport_jbm, /* i : new number of real transport channels */ + const Word16 nchan_transport_internal, /* i : new number of totally buffered channels */ + const Word16 nchan_full, /* i : new number of channels to fully store */ + const Word16 n_samples_granularity /* i : new granularity of the renderer/buffer */ ); ivas_error ivas_dirac_allocate_parameters_fx( - SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common data for spatial parametric rendering */ - const Word16 params_flag /* i : set of parameters flag */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common data for spatial parametric rendering*/ + const Word16 params_flag /* i : set of parameters flag */ ); Word16 configure_reqularization_factor_fx( - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const Word32 ivas_total_brate /* i : IVAS total bitrate */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const Word32 ivas_total_brate /* i : IVAS total bitrate */ ); ivas_error ivas_ism_config_fx( - const Word32 ism_total_brate, /* i : ISM total bitrate */ - const Word16 nchan_transport, /* i : number of transport channels */ - const Word16 nchan_ism, /* i : number of objects */ - ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ - const Word16 ism_extended_metadata_flag, /* i : extended metadata flag */ - const Word16 null_metadata_flag[MAX_NUM_OBJECTS], /* i : NULL MD flag */ - const Word16 ism_imp[], /* i : ISM importance flags */ - Word32 element_brate[], /* o : element bitrate per object */ - Word32 total_brate[], /* o : total bitrate per object */ - Word16 nb_bits_metadata[], /* i/o: number of metadata bits */ - const Word16 combined_format_flag /* i : flag indicating combined format */ + const Word32 ism_total_brate, /* i : ISM total bitrate */ + const Word16 nchan_transport, /* i : number of transport channels */ + const Word16 nchan_ism, /* i : number of objects */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + const Word16 ism_extended_metadata_flag, /* i : extended metadata flag */ + const Word16 null_metadata_flag[MAX_NUM_OBJECTS], /* i : NULL MD flag */ + const Word16 ism_imp[], /* i : ISM importance flags */ + Word32 element_brate[], /* o : element bitrate per object */ + Word32 total_brate[], /* o : total bitrate per object */ + Word16 nb_bits_metadata[], /* i/o: number of metadata bits */ + const Word16 combined_format_flag /* i : flag indicating combined format */ ); void stereo_dft_enc_analyze_fx( - Encoder_State **sts, /* i/o: encoder state structure */ - const Word16 n_channels, /* i : number of input channels */ - const Word16 input_frame, /* i : input frame length */ - STEREO_DFT_ENC_DATA_HANDLE hStereoDft, /* i/o: encoder stereo handle */ - STEREO_MDCT_ENC_DATA_HANDLE hStereoMdct, /* i/o: encoder MDCT stereo handle */ - Word32 DFT[CPE_CHANNELS][STEREO_DFT_N_MAX_ENC], /* o : DFT buffers */ - Word16 DFT_e[CPE_CHANNELS], /* o : DFT buffers */ - Word16 *input_mem[CPE_CHANNELS], /* i/o: input buffer memory */ - Word16 *q_input_mem ); + Encoder_State **sts, /* i/o: encoder state structure */ + const Word16 n_channels, /* i : number of input channels */ + const Word16 input_frame, /* i : input frame length */ + STEREO_DFT_ENC_DATA_HANDLE hStereoDft, /* i/o: encoder stereo handle */ + STEREO_MDCT_ENC_DATA_HANDLE hStereoMdct, /* i/o: encoder MDCT stereo handle */ + Word32 DFT[CPE_CHANNELS][STEREO_DFT_N_MAX_ENC], /* o : DFT buffers */ + Word16 DFT_e[CPE_CHANNELS], /* o : DFT buffers */ + Word16 *input_mem[CPE_CHANNELS], /* i/o: input buffer memory */ + Word16 *q_input_mem +); Word16 IGF_MapBitRateToIndex( - const Word32 brate, /* i : bitrate */ - const Word16 bwidth, /* i : audio bandwidth */ - const Word16 element_mode, /* i : element mode */ - const Word16 rf_mode /* i : flag to signal the RF mode */ + const Word32 brate, /* i : bitrate */ + const Word16 bwidth, /* i : audio bandwidth */ + const Word16 element_mode, /* i : element mode */ + const Word16 rf_mode /* i : flag to signal the RF mode */ ); #ifdef NONBE_1303_REND_GRANULARITY @@ -1001,49 +1012,49 @@ Word16 ivas_jbm_dec_get_render_granularity_fx( ); #else Word16 ivas_jbm_dec_get_render_granularity( - const RENDERER_TYPE rendererType, /* i : renderer type */ - const IVAS_FORMAT ivas_format, /* i : ivas format */ - const MC_MODE mc_mode, /* i : MC mode */ - const Word32 output_Fs /* i : sampling rate */ + const RENDERER_TYPE rendererType, /* i : renderer type */ + const IVAS_FORMAT ivas_format, /* i : ivas format */ + const MC_MODE mc_mode, /* i : MC mode */ + const Word32 output_Fs /* i : sampling rate */ ); #endif -// ivas_stereo_dft_com.c void stereo_dft_config_fx( - STEREO_DFT_CONFIG_DATA_HANDLE hConfig, /* o : DFT stereo configuration */ - const Word32 brate, /* i : IVAS/CPE/nominal total bitrate */ - Word16 *bits_frame_nominal, /* o : primary channel nominal bits per frame */ - Word16 *bits_frame_nominal_2 /* o : secondary channel nominal bits per frame*/ + STEREO_DFT_CONFIG_DATA_HANDLE hConfig, /* o : DFT stereo configuration */ + const Word32 brate, /* i : IVAS/CPE/nominal total bitrate */ + Word16 *bits_frame_nominal, /* o : primary channel nominal bits per frame */ + Word16 *bits_frame_nominal_2 /* o : secondary channel nominal bits per frame */ ); void stereo_td_itd_mdct_stereo_fx( - CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder handle */ - const Word16 vad_flag_dtx[], /* i : VAD dtx flags */ - const Word16 vad_hover_flag[], /* i : VAD hangover flags */ - const Word16 input_frame /* i : frame length */ + CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder handle */ + const Word16 vad_flag_dtx[], /* i : VAD dtx flags */ + const Word16 vad_hover_flag[], /* i : VAD hangover flags */ + const Word16 input_frame /* i : frame length */ ); void stereo_td_itd_fx( - ITD_DATA *hITD, /* i/o: ITD data structure */ - Word16 input_mem_itd_fx[CPE_CHANNELS][STEREO_DFT_OVL_MAX], /* o : ITD memory (only used in DFT Stereo) */ + ITD_DATA *hITD, /* i/o: ITD data structure */ + Word16 input_mem_itd_fx[CPE_CHANNELS][STEREO_DFT_OVL_MAX], /* o : ITD memory (only used in DFT Stereo) */ Word16 *q_input_mem_itd, - const Word16 hybrid_itd_flag, /* i : flag for hybrid TD/FD ITD processing */ - const Word16 dft_ovl, /* i : size of DFT overlap */ - Encoder_State **sts, /* i/o: Encoder state structure */ - const Word16 input_frame, /* i : input frame length */ - Word16 *input_mem[CPE_CHANNELS], /* i/o: input buffer memory */ - Word16 *q_input_mem ); + const Word16 hybrid_itd_flag, /* i : flag for hybrid TD/FD ITD processing */ + const Word16 dft_ovl, /* i : size of DFT overlap */ + Encoder_State **sts, /* i/o: Encoder state structure */ + const Word16 input_frame, /* i : input frame length */ + Word16 *input_mem[CPE_CHANNELS], /* i/o: input buffer memory */ + Word16 *q_input_mem +); void stereo_dft_unify_dmx_fx( - STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder stereo handle */ - Decoder_State *st0, /* i/o: decoder state structure */ - Word32 DFT[CPE_CHANNELS][STEREO_DFT_BUF_MAX], /* i/o: DFT buffers */ - Word32 *input_mem, /* i/o: mem of buffer DFT analysis */ - const Word16 prev_sid_nodata /* i : Previous SID/No data indicator */ + STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder stereo handle */ + Decoder_State *st0, /* i/o: decoder state structure */ + Word32 DFT[CPE_CHANNELS][STEREO_DFT_BUF_MAX], /* i/o: DFT buffers */ + Word32 *input_mem, /* i/o: mem of buffer DFT analysis */ + const Word16 prev_sid_nodata /* i : Previous SID/No data indicator */ ); void stereo_dft_enc_compute_itd_fx( - CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ + CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ Word32 *DFT_L, Word16 *DFT_L_e, Word32 *DFT_R, @@ -1055,225 +1066,226 @@ void stereo_dft_enc_compute_itd_fx( Word32 *bin_nrgL, Word16 *bin_nrgL_e, Word32 *bin_nrgR, - Word16 *bin_nrgR_e ); + Word16 *bin_nrgR_e +); Word16 stereo_dft_band_config_fx( - Word16 *band_limits, /* o : DFT band limits */ - const Word16 band_res, /* i : DFT band resolution */ - const Word16 NFFT, /* i : analysis/synthesis window length */ - const Word16 enc_dec /* i : flag to indicate enc vs dec */ + Word16 *band_limits, /* o : DFT band limits */ + const Word16 band_res, /* i : DFT band resolution */ + const Word16 NFFT, /* i : analysis/synthesis window length */ + const Word16 enc_dec /* i : flag to indicate enc vs dec */ ); -// ivas_ls_custom_dec.c void ivas_ls_custom_setup_fx( - IVAS_OUTPUT_SETUP_HANDLE hOutSetup, /* o : IVAS output setup handle */ - const LSSETUP_CUSTOM_STRUCT *hLsSetupCustom /* i : Custom loudspeaker setup handle */ + IVAS_OUTPUT_SETUP_HANDLE hOutSetup, /* o : IVAS output setup handle */ + const LSSETUP_CUSTOM_STRUCT *hLsSetupCustom /* i : Custom loudspeaker setup handle */ ); ivas_error ivas_ls_custom_output_init_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ); ivas_error ivas_ls_custom_open_fx( - LSSETUP_CUSTOM_HANDLE *hLsSetupCustom /* o : Custom loudspeaker setup handle */ + LSSETUP_CUSTOM_HANDLE *hLsSetupCustom /* o : Custom loudspeaker setup handle */ ); ivas_error ivas_ism_renderer_open_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); void ivas_ism_render_sf_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const RENDERER_TYPE renderer_type, /* i : active renderer type */ - Word32 *output_fx[], /* i/o: core-coder transport channels/object output */ - const Word16 n_samples_to_render /* i : output frame length per channel */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const RENDERER_TYPE renderer_type, /* i : active renderer type */ + Word32 *output_fx[], /* i/o: core-coder transport channels/object output */ + const Word16 n_samples_to_render /* i : output frame length per channel */ ); void ivas_jbm_dec_get_adapted_linear_interpolator_fx( - const Word16 default_interp_length, /* i : default length of the (full-frame) interpolator */ - const Word16 interp_length, /* i : length of the interpolator to be created */ - Word16 *interpolator_fx /* o : the interpolator */ + const Word16 default_interp_length, /* i : default length of the (full-frame) interpolator */ + const Word16 interp_length, /* i : length of the interpolator to be created */ + Word16 *interpolator_fx /* o : the interpolator */ ); void ivas_omasa_separate_object_render_jbm_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const UWord16 nSamplesRendered, /* i : number of samples rendered */ - Word32 input_fx_in[][L_FRAME48k], /* i : separated object signal */ - Word32 *output_fx[], /* o : rendered time signal */ - const Word16 subframes_rendered, /* i : number of subframes rendered */ - const Word16 slots_rendered /* i : number of CLDFB slots rendered */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const UWord16 nSamplesRendered, /* i : number of samples rendered */ + Word32 input_fx_in[][L_FRAME48k], /* i : separated object signal */ + Word32 *output_fx[], /* o : rendered time signal */ + const Word16 subframes_rendered, /* i : number of subframes rendered */ + const Word16 slots_rendered /* i : number of CLDFB slots rendered */ ); void get_panning_gain_fx( const Word16 sinAngleMapped, - Word16 *panningGains ); + Word16 *panningGains +); void ivas_ism_get_stereo_gains_fx( - const Word16 aziDeg, /* i : object azimuth */ - const Word16 eleDeg, /* i : object elevation */ - Word16 *left_gain_fx, /* o : left channel gain */ - Word16 *right_gain_fx /* o : right channel gain */ + const Word16 aziDeg, /* i : object azimuth */ + const Word16 eleDeg, /* i : object elevation */ + Word16 *left_gain_fx, /* o : left channel gain */ + Word16 *right_gain_fx /* o : right channel gain */ ); -// ivas_mct_dec_mct_fx.c void ivas_mct_dec_mct_fx( - MCT_DEC_HANDLE hMCT, /* i/o: MCT decoder structure */ - Decoder_State **sts, /* i/o: decoder state structure */ - const Word16 nchan /* i : number of channels */ + MCT_DEC_HANDLE hMCT, /* i/o: MCT decoder structure */ + Decoder_State **sts, /* i/o: decoder state structure */ + const Word16 nchan /* i : number of channels */ ); void apply_MCT_dec_fx( - MCT_DEC_HANDLE hMCT, /* i/o: MCT decoder structure */ - Decoder_State **sts, /* i/o: decoder state structure */ - Word32 *x[MCT_MAX_CHANNELS][NB_DIV] /* i/o: decoded and dequan. spect. input to MCT */ + MCT_DEC_HANDLE hMCT, /* i/o: MCT decoder structure */ + Decoder_State **sts, /* i/o: decoder state structure */ + Word32 *x[MCT_MAX_CHANNELS][NB_DIV] /* i/o: decoded and dequan. spect. input to MCT */ ); void mctStereoIGF_dec_fx( - MCT_DEC_HANDLE hMCT, /* i/o: MCT decoder structure */ - Decoder_State **stm, /* i/o: decoder state structure */ - Word32 *x[MCT_MAX_CHANNELS][NB_DIV], /* i/o: decoded and dequantized spectrum*/ - const Word16 bfi /* i : bad frame flag */ + MCT_DEC_HANDLE hMCT, /* i/o: MCT decoder structure */ + Decoder_State **stm, /* i/o: decoder state structure */ + Word32 *x[MCT_MAX_CHANNELS][NB_DIV], /* i/o: decoded and dequantized spectrum */ + const Word16 bfi /* i : bad frame flag */ ); -// ivas_stereo_mdct_stereo_dec.c void parse_stereo_from_bitstream( - STEREO_MDCT_DEC_DATA_HANDLE hStereoMdct, /* i/o: MDCT stereo decoder structure */ - Decoder_State **sts, /* i/o: decoder state structure */ - const Word16 mct_on, /* i : flag mct block (1) or stereo (0)*/ - const Word16 isSBAStereoMode, /* i : flag core coding for SBA */ - Decoder_State *st0, /* i/o: decoder state structure for Bstr*/ - Word16 ms_mask[NB_DIV][MAX_SFB] /* o : bandwise MS mask */ + STEREO_MDCT_DEC_DATA_HANDLE hStereoMdct, /* i/o: MDCT stereo decoder structure */ + Decoder_State **sts, /* i/o: decoder state structure */ + const Word16 mct_on, /* i : flag mct block (1) or stereo (0) */ + const Word16 isSBAStereoMode, /* i : flag core coding for SBA */ + Decoder_State *st0, /* i/o: decoder state structure for Bstr */ + Word16 ms_mask[NB_DIV][MAX_SFB] /* o : bandwise MS mask */ ); void stereo_decoder_tcx_fx( - STEREO_MDCT_DEC_DATA *hStereoMdct, /* i/o: MDCT stereo decoder structure */ - Word16 ms_mask[NB_DIV][MAX_SFB], /* i : bandwise MS mask */ - Word32 *spec_r_0[NB_DIV], /* i/o: spectrum right channel */ - Word32 *spec_l[], /* i/o: spectrum left channel [NB_DIV][N] */ - Word32 *spec_r[], /* i/o: spectrum right channel [NB_DIV][N] */ - const Word16 mdct_stereo_mode[], /* i : stereo mode (FB/band wise MS, dual mono */ - const Word16 core_l, /* i : core for left channel (TCX20/TCX10) */ - const Word16 core_r, /* i : core for right channel (TCX20/TCX10) */ - const Word16 igf, /* i : flag for IGF activity */ - const Word16 L_frameTCX_l, /* i : TCX frame length of left channel */ - const Word16 L_frameTCX_r, /* i : TCX frame length of right channel */ - const Word16 mct_on, /* i : flag mct block (1) or stereo (0) */ - const Word16 last_core_l, /* i : last core for left channel */ - const Word16 last_core_r, /* i : last core for right channel */ - const Word16 tmp_plc_upmix /* i : indicates temp upmix for PLC decision */ + STEREO_MDCT_DEC_DATA *hStereoMdct, /* i/o: MDCT stereo decoder structure */ + Word16 ms_mask[NB_DIV][MAX_SFB], /* i : bandwise MS mask */ + Word32 *spec_r_0[NB_DIV], /* i/o: spectrum right channel */ + Word32 *spec_l[], /* i/o: spectrum left channel [NB_DIV][N] */ + Word32 *spec_r[], /* i/o: spectrum right channel [NB_DIV][N] */ + const Word16 mdct_stereo_mode[], /* i : stereo mode (FB/band wise MS, dual mono */ + const Word16 core_l, /* i : core for left channel (TCX20/TCX10) */ + const Word16 core_r, /* i : core for right channel (TCX20/TCX10) */ + const Word16 igf, /* i : flag for IGF activity */ + const Word16 L_frameTCX_l, /* i : TCX frame length of left channel */ + const Word16 L_frameTCX_r, /* i : TCX frame length of right channel */ + const Word16 mct_on, /* i : flag mct block (1) or stereo (0) */ + const Word16 last_core_l, /* i : last core for left channel */ + const Word16 last_core_r, /* i : last core for right channel */ + const Word16 tmp_plc_upmix /* i : indicates temp upmix for PLC decision */ ); void v_multc_acc_32_16( - const Word32 x[], /* i : Input vector */ - const Word16 c, /* i : Constant */ - Word32 y[], /* o : Output vector that contains y + c*x */ - const Word16 N /* i : Vector length */ + const Word32 x[], /* i : Input vector */ + const Word16 c, /* i : Constant */ + Word32 y[], /* o : Output vector that contains y + c*x */ + const Word16 N /* i : Vector length */ ); + void v_multc_acc_32_32( - const Word32 x[], /* i : Input vector */ - const Word32 c, /* i : Constant */ - Word32 y[], /* o : Output vector that contains y + c*x */ - const Word16 N /* i : Vector length */ + const Word32 x[], /* i : Input vector */ + const Word32 c, /* i : Constant */ + Word32 y[], /* o : Output vector that contains y + c*x */ + const Word16 N /* i : Vector length */ ); void ivas_mono_stereo_downmix_mcmasa_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - Word32 *output_f_fx[], /* i/o: synthesized core-coder transport channels/mono or stereo output */ - Word16 output_frame /* i : output frame length per channel */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Word32 *output_f_fx[], /* i/o: synthesized core-coder transport channels/mono or stereo output */ + Word16 output_frame /* i : output frame length per channel */ ); void ivas_apply_non_diegetic_panning_fx( - Word32 *input_f_fx, /* i : non-diegetic object */ - Word32 *output_f_fx[], /* i/o: core-coder transport mono channel/stereo output */ - const Word16 non_diegetic_pan_gain_fx, /* i : non-diegetic panning gain */ - const Word16 output_frame /* i : output frame length per channel */ + Word32 *input_f_fx, /* i : non-diegetic object */ + Word32 *output_f_fx[], /* i/o: core-coder transport mono channel/stereo output */ + const Word16 non_diegetic_pan_gain_fx, /* i : non-diegetic panning gain */ + const Word16 output_frame /* i : output frame length per channel */ ); void ivas_ism_mono_dmx_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - Word32 *output_f_fx[], /* i/o: synthesized core-coder transport channels/mono output */ - const Word16 output_frame /* i : output frame length */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Word32 *output_f_fx[], /* i/o: synthesized core-coder transport channels/mono output */ + const Word16 output_frame /* i : output frame length */ ); + void ivas_sba_dirac_stereo_smooth_parameters_fx( - STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ - ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD handle for upmixing */ - const Word16 cross_fade_start_offset, /* i : SPAR mixer delay compensation */ - const Word32 output_Fs, /* i : Fs for delay calculation */ - const Word16 num_md_sub_frames /* i : number of subframes in mixing matrix */ + STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ + ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD handle for upmixing */ + const Word16 cross_fade_start_offset, /* i : SPAR mixer delay compensation */ + const Word32 output_Fs, /* i : Fs for delay calculation */ + const Word16 num_md_sub_frames /* i : number of subframes in mixing matrix */ ); void stereo_dft_dec_synthesize_fx( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - Word32 DFT[CPE_CHANNELS][STEREO_DFT_BUF_MAX], /* i : DFT buffers */ - const Word16 chan, /* i : channel number */ - Word32 output[L_FRAME48k], /* o : output synthesis signal */ - const Word16 output_frame /* i : output frame length */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + Word32 DFT[CPE_CHANNELS][STEREO_DFT_BUF_MAX], /* i : DFT buffers */ + const Word16 chan, /* i : channel number */ + Word32 output[L_FRAME48k], /* o : output synthesis signal */ + const Word16 output_frame /* i : output frame length */ ); void stereo_dft_dec_smooth_parameters_fx( - STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ - const Word16 prev_sid_nodata, /* i : Previous SID/No data indicator */ - const Word16 active_frame_counter, /* i : Active frame counter */ - const Word32 element_brate /* i : Element bitrate */ + STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ + const Word16 prev_sid_nodata, /* i : Previous SID/No data indicator */ + const Word16 active_frame_counter, /* i : Active frame counter */ + const Word32 element_brate /* i : Element bitrate */ ); void stereo_dft_dec_res_fx( - CPE_DEC_HANDLE hCPE, /* i/o: decoder CPE handle */ - Word32 res_buf[STEREO_DFT_N_8k], /* i : residual buffer */ - Word16 q_res, /* i : q fact of residural buffer */ - Word32 *output /* o : output */ + CPE_DEC_HANDLE hCPE, /* i/o: decoder CPE handle */ + Word32 res_buf[STEREO_DFT_N_8k], /* i : residual buffer */ + Word16 q_res, /* i : q fact of residural buffer */ + Word32 *output /* o : output */ ); void stereo_dft_dec_fx( - STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ - Decoder_State *st0, /* i/o: decoder state structure */ - Word32 DFT[CPE_CHANNELS][STEREO_DFT_BUF_MAX], /* i/o: DFT buffers */ - Word32 *input_mem, /* i/o: mem of buffer DFT analysis */ - STEREO_CNG_DEC_HANDLE hStereoCng, /* i/o: Stereo CNG data structure */ - const Word16 sba_dirac_stereo_flag, /* i : signal stereo output for SBA DirAC */ - const Word16 sba_mono_flag, /* i : signal mono output for SBA DirAC */ - ivas_spar_md_dec_state_t *hMdDec, /* i : SPAR MD handle for upmixing */ - const Word16 cross_fade_start_offset, /* i : SPAR mixer delay compensation */ - const Word32 output_Fs, /* i : Fs for delay calculation */ - const Word16 nchan_transport, /* i : number of transpor channels */ - const Word16 num_md_sub_frames /* i : number of MD subframes */ -); - -// ivas_stereo_dft_enc.c + STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ + Decoder_State *st0, /* i/o: decoder state structure */ + Word32 DFT[CPE_CHANNELS][STEREO_DFT_BUF_MAX], /* i/o: DFT buffers */ + Word32 *input_mem, /* i/o: mem of buffer DFT analysis */ + STEREO_CNG_DEC_HANDLE hStereoCng, /* i/o: Stereo CNG data structure */ + const Word16 sba_dirac_stereo_flag, /* i : signal stereo output for SBA DirAC */ + const Word16 sba_mono_flag, /* i : signal mono output for SBA DirAC */ + ivas_spar_md_dec_state_t *hMdDec, /* i : SPAR MD handle for upmixing */ + const Word16 cross_fade_start_offset, /* i : SPAR mixer delay compensation */ + const Word32 output_Fs, /* i : Fs for delay calculation */ + const Word16 nchan_transport, /* i : number of transpor channels */ + const Word16 num_md_sub_frames /* i : number of MD subframes */ +); + Word32 stereo_dft_enc_synthesize_fx( - STEREO_DFT_ENC_DATA_HANDLE hStereoDft, /* i/o: encoder stereo handle */ - Word32 *output_fx, /* o : output synthesis Q16 */ + STEREO_DFT_ENC_DATA_HANDLE hStereoDft, /* i/o: encoder stereo handle */ + Word32 *output_fx, /* o : output synthesis Q16 */ Word16 *output_start_index, Word16 *output_end_index, - const Word16 chan, /* i : channel number */ - const Word32 input_Fs, /* i : input sampling rate */ - const Word32 output_sampling_rate, /* i : output sampling rate */ - const Word16 L_frame, /* i : frame length at internal Fs */ - Word16 *nrg_out_fx_e ); + const Word16 chan, /* i : channel number */ + const Word32 input_Fs, /* i : input sampling rate */ + const Word32 output_sampling_rate, /* i : output sampling rate */ + const Word16 L_frame, /* i : frame length at internal Fs */ + Word16 *nrg_out_fx_e +); void ivas_ls_setup_conversion_fx( - Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ - const Word16 input_chans, /* i : number of input channels to the renderer */ - const Word16 output_frame, /* i : frame length */ - Word32 *input[], /* i : LS input/output synthesis signal */ - Word32 *output[] /* i/o: LS input/output synthesis signal */ + Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ + const Word16 input_chans, /* i : number of input channels to the renderer */ + const Word16 output_frame, /* i : frame length */ + Word32 *input[], /* i : LS input/output synthesis signal */ + Word32 *output[] /* i/o: LS input/output synthesis signal */ ); ivas_error ivas_ls_setup_conversion_open_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); void ivas_ls_setup_conversion_close_fx( - LSSETUP_CONVERSION_HANDLE *hLsSetUpConversion /* i/o: LS converter handle */ + LSSETUP_CONVERSION_HANDLE *hLsSetUpConversion /* i/o: LS converter handle */ ); void ivas_ls_setup_conversion_process_mdct_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - Word32 *output[] /* i/o: output synthesis signal */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Word32 *output[] /* i/o: output synthesis signal */ ); void ivas_lssetupconversion_process_param_mc_fx( - Decoder_Struct *st_ivas, /* i/o: LS setup conversion renderer handle */ + Decoder_Struct *st_ivas, /* i/o: LS setup conversion renderer handle */ const Word16 num_timeslots, Word32 Cldfb_RealBuffer_InOut[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i/o: LS signals */ Word32 Cldfb_ImagBuffer_InOut[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i/o: LS signals */ @@ -1281,241 +1293,247 @@ void ivas_lssetupconversion_process_param_mc_fx( ); void convert_coeffs_to_higher_res_fx( - const Word32 *in1, /* i : first subframe input */ - const Word32 *in2, /* i : second subframe input */ - Word32 *out, /* o : converted output */ - const Word16 len /* i : length of subframes */ + const Word32 *in1, /* i : first subframe input */ + const Word32 *in2, /* i : second subframe input */ + Word32 *out, /* o : converted output */ + const Word16 len /* i : length of subframes */ ); void create_IDCT_N_Matrix_fx( - Word32 *inv_matrixFloatQ, /* i/o: RAM buffer */ - const Word16 N, /* i : DCT length, number of time samples */ - const Word16 n_cols, /* i : number of dct coeffs (as DCT may be truncated) */ - const Word16 alloc_size /* i : RAM buffer size in elements */ + Word32 *inv_matrixFloatQ, /* i/o: RAM buffer */ + const Word16 N, /* i : DCT length, number of time samples */ + const Word16 n_cols, /* i : number of dct coeffs (as DCT may be truncated) */ + const Word16 alloc_size /* i : RAM buffer size in elements */ ); void extend_dctN_input_fx( - const Word32 *input, /* i : input in fdcng domain */ - const Word32 *dct_input, /* i : input in dctN(fdcng) domain */ - const Word16 in_dim, /* i : in_dim == N */ - Word32 *ext_sig, /* o : extended output in fdcng domain */ - const Word16 out_dim, /* i : output total dim */ - Word32 *matrix, /* i : idct synthesis matrix N rows, n_cols columns */ - const Word16 n_cols, /* i : number of columns == DCT truncation length */ - const DCTTYPE dcttype /* i : matrix operation type */ + const Word32 *input, /* i : input in fdcng domain */ + const Word32 *dct_input, /* i : input in dctN(fdcng) domain */ + const Word16 in_dim, /* i : in_dim == N */ + Word32 *ext_sig, /* o : extended output in fdcng domain */ + const Word16 out_dim, /* i : output total dim */ + Word32 *matrix, /* i : idct synthesis matrix N rows, n_cols columns */ + const Word16 n_cols, /* i : number of columns == DCT truncation length */ + const DCTTYPE dcttype /* i : matrix operation type */ ); void ivas_dirac_dec_get_frequency_axis_fx( Word16 *frequency_axis, /* Q0 */ const Word32 output_Fs, - const Word16 num_freq_bands ); + const Word16 num_freq_bands +); void ivas_decision_matrix_dec_fx( - Decoder_State *st, /* i/o: decoder state structure */ - Word16 *sharpFlag, /* o : formant sharpening flag */ - Word16 *core_switching_flag, /* o : ACELP->HQ switching frame flag */ - const Word32 element_brate, /* i : element bitrate */ - const Word16 nchan_out /* i : Number of output channels */ + Decoder_State *st, /* i/o: decoder state structure */ + Word16 *sharpFlag, /* o : formant sharpening flag */ + Word16 *core_switching_flag, /* o : ACELP->HQ switching frame flag */ + const Word32 element_brate, /* i : element bitrate */ + const Word16 nchan_out /* i : Number of output channels */ ); void cmplx_matrix_square_fx( - const Word32 *realX, /* i : real part of the matrix */ - const Word32 *imagX, /* i : imaginary part of the matrix */ - const Word16 mRows, /* i : number of rows of the matrix */ - const Word16 nCols, /* i : number of columns of the matrix */ - Word32 *realZ, /* o : real part of the resulting matrix */ - Word32 *imagZ, /* o : imaginary part of the resulting matrix */ + const Word32 *realX, /* i : real part of the matrix */ + const Word32 *imagX, /* i : imaginary part of the matrix */ + const Word16 mRows, /* i : number of rows of the matrix */ + const Word16 nCols, /* i : number of columns of the matrix */ + Word32 *realZ, /* o : real part of the resulting matrix */ + Word32 *imagZ, /* o : imaginary part of the resulting matrix */ Word16 input_exp, - Word16 *output_exp ); + Word16 *output_exp +); Word16 matrix_diag_product_fx( - const Word32 *X, /* i : left hand matrix */ + const Word32 *X, /* i : left hand matrix */ Word16 X_e, - const Word16 rowsX, /* i : number of rows of the left hand matrix */ - const Word16 colsX, /* i : number of columns of the left hand matrix */ - const Word16 transpX, /* i : flag indicating the transposition of the left hand matrix prior to the multiplication */ - const Word32 *Y, /* i : right hand diagonal matrix as vector containing the diagonal elements */ + const Word16 rowsX, /* i : number of rows of the left hand matrix */ + const Word16 colsX, /* i : number of columns of the left hand matrix */ + const Word16 transpX, /* i : flag indicating the transposition of the left hand matrix prior to the multiplication */ + const Word32 *Y, /* i : right hand diagonal matrix as vector containing the diagonal elements */ Word16 Y_e, - const Word16 entriesY, /* i : number of entries in the diagonal */ - Word32 *Z, /* o : resulting matrix after the matrix multiplication */ - Word16 *Z_e ); + const Word16 entriesY, /* i : number of entries in the diagonal */ + Word32 *Z, /* o : resulting matrix after the matrix multiplication */ + Word16 *Z_e +); Word16 matrix_diag_product_fx_2( - const Word32 *X, /* i : left hand matrix Q31 - X_e*/ + const Word32 *X, /* i : left hand matrix Q31 - X_e*/ const Word16 X_e, - const Word16 rowsX, /* i : number of rows of the left hand matrix Q0*/ - const Word16 colsX, /* i : number of columns of the left hand matrix Q0*/ - const Word16 transpX, /* i : flag indicating the transposition of the left hand matrix prior to the multiplication Q0*/ - const Word32 *Y, /* i : right hand diagonal matrix as vector containing the diagonal elements Q31 - Y_e*/ + const Word16 rowsX, /* i : number of rows of the left hand matrix Q0*/ + const Word16 colsX, /* i : number of columns of the left hand matrix Q0*/ + const Word16 transpX, /* i : flag indicating the transposition of the left hand matrix prior to the multiplication Q0*/ + const Word32 *Y, /* i : right hand diagonal matrix as vector containing the diagonal elements Q31 - Y_e*/ const Word16 *Y_e, - const Word16 entriesY, /* i : number of entries in the diagonal Q0*/ - Word32 *Z, /* o : resulting matrix after the matrix multiplication Q31 - Z_e*/ - Word16 *Z_e ); + const Word16 entriesY, /* i : number of entries in the diagonal Q0*/ + Word32 *Z, /* o : resulting matrix after the matrix multiplication Q31 - Z_e*/ + Word16 *Z_e +); Word16 matrix_diag_product_fx_1( - const Word32 *X, /* i : left hand matrix */ + const Word32 *X, /* i : left hand matrix */ const Word16 *X_e, - const Word16 rowsX, /* i : number of rows of the left hand matrix */ - const Word16 colsX, /* i : number of columns of the left hand matrix */ - const Word16 transpX, /* i : flag indicating the transposition of the left hand matrix prior to the multiplication */ - const Word32 *Y, /* i : right hand diagonal matrix as vector containing the diagonal elements */ + const Word16 rowsX, /* i : number of rows of the left hand matrix */ + const Word16 colsX, /* i : number of columns of the left hand matrix */ + const Word16 transpX, /* i : flag indicating the transposition of the left hand matrix prior to the multiplication */ + const Word32 *Y, /* i : right hand diagonal matrix as vector containing the diagonal elements */ const Word16 *Y_e, - const Word16 entriesY, /* i : number of entries in the diagonal */ - Word32 *Z, /* o : resulting matrix after the matrix multiplication */ - Word16 *Z_e ); + const Word16 entriesY, /* i : number of entries in the diagonal */ + Word32 *Z, /* o : resulting matrix after the matrix multiplication */ + Word16 *Z_e +); Word16 diag_matrix_product_fx( - const Word32 *Y, /* i : left hand diagonal matrix as vector containing the diagonal elements */ + const Word32 *Y, /* i : left hand diagonal matrix as vector containing the diagonal elements */ Word16 Y_e, - const Word16 entriesY, /* i : length of the diagonal of the left hand matrix */ - const Word32 *X, /* i : right hand matrix */ + const Word16 entriesY, /* i : length of the diagonal of the left hand matrix */ + const Word32 *X, /* i : right hand matrix */ Word16 X_e, - const Word16 rowsX, /* i : number of rows of the right hand matrix */ - const Word16 colsX, /* i : number of columns of the right hand matrix */ - const Word16 transpX, /* i : flag indicating the transposition of the right hand matrix prior to the multiplication */ - Word32 *Z, /* o : resulting matrix after the matrix multiplication */ - Word16 *Z_e ); + const Word16 rowsX, /* i : number of rows of the right hand matrix */ + const Word16 colsX, /* i : number of columns of the right hand matrix */ + const Word16 transpX, /* i : flag indicating the transposition of the right hand matrix prior to the multiplication */ + Word32 *Z, /* o : resulting matrix after the matrix multiplication */ + Word16 *Z_e +); Word16 matrix_product_diag_fx( - const Word32 *X, /* i : left hand matrix */ + const Word32 *X, /* i : left hand matrix */ Word16 X_e, - const Word16 rowsX, /* i : number of rows of the left hand matrix */ - const Word16 colsX, /* i : number of columns of the left hand matrix */ - const Word16 transpX, /* i : flag indicating the transposition of the left hand matrix prior to the multiplication */ - const Word32 *Y, /* i : right hand matrix */ + const Word16 rowsX, /* i : number of rows of the left hand matrix */ + const Word16 colsX, /* i : number of columns of the left hand matrix */ + const Word16 transpX, /* i : flag indicating the transposition of the left hand matrix prior to the multiplication */ + const Word32 *Y, /* i : right hand matrix */ Word16 Y_e, - const Word16 rowsY, /* i : number of rows of the right hand matrix */ - const Word16 colsY, /* i : number of columns of the right hand matrix */ - const Word16 transpY, /* i : flag indicating the transposition of the right hand matrix prior to the multiplication */ - Word32 *Z, /* o : resulting matrix after the matrix multiplication */ - Word16 *Z_e ); + const Word16 rowsY, /* i : number of rows of the right hand matrix */ + const Word16 colsY, /* i : number of columns of the right hand matrix */ + const Word16 transpY, /* i : flag indicating the transposition of the right hand matrix prior to the multiplication */ + Word32 *Z, /* o : resulting matrix after the matrix multiplication */ + Word16 *Z_e +); -// ivas_stereo_mdct_core_dec_fx.c void stereo_mdct_core_dec_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - Word32 *signal_out[CPE_CHANNELS], /* o : synthesis @internal_FS */ - Word16 signal_outFB[CPE_CHANNELS][L_FRAME48k], /* o : synthesis @output_FS */ - Word16 e_sigFB[CPE_CHANNELS] /* o : exponent of synthesis @output_FS */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + Word32 *signal_out[CPE_CHANNELS], /* o : synthesis @internal_FS */ + Word16 signal_outFB[CPE_CHANNELS][L_FRAME48k], /* o : synthesis @output_FS */ + Word16 e_sigFB[CPE_CHANNELS] /* o : exponent of synthesis @output_FS */ ); -// ivas_stereo_mdct_stereo_com.c void splitAvailableBits_fx( - const Word16 total_bits, /* i : total available bits for TCX coding */ - const Word16 split_ratio, /* i : split ratio */ - const Word16 isSBAStereoMode, /* i : signal core coding for SBA */ - Word16 *bits_ch0, /* o : bits for channel 0 */ - Word16 *bits_ch1 /* o : bits for channel 1 */ + const Word16 total_bits, /* i : total available bits for TCX coding */ + const Word16 split_ratio, /* i : split ratio */ + const Word16 isSBAStereoMode, /* i : signal core coding for SBA */ + Word16 *bits_ch0, /* o : bits for channel 0 */ + Word16 *bits_ch1 /* o : bits for channel 1 */ ); void stereo_tcx_init_dec_fx( - Decoder_State *st, /* i/o: decoder state structure */ - const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/ - const Word16 last_element_mode /* i : element mode of previous frame */ + Decoder_State *st, /* i/o: decoder state structure */ + const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/ + const Word16 last_element_mode /* i : element mode of previous frame */ ); void stereo_icBWE_enc_ivas_fx( - CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ - const Word32 shb_speech_ref_fx[], /* i : SHB speech ref channel */ - const Word16 shb_speech_ref_e, /* i : SHB speech ref channel */ - Word32 shb_speech_nonref_fx[], /* i/o: SHB speech non-ref channel */ - Word16 shb_speech_nonref_e, /* i/o: SHB speech non-ref channel */ - const Word32 *voice_factors_fx /* i : voicing factors Q31 */ + CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ + const Word32 shb_speech_ref_fx[], /* i : SHB speech ref channel */ + const Word16 shb_speech_ref_e, /* i : SHB speech ref channel */ + Word32 shb_speech_nonref_fx[], /* i/o: SHB speech non-ref channel */ + Word16 shb_speech_nonref_e, /* i/o: SHB speech non-ref channel */ + const Word32 *voice_factors_fx /* i : voicing factors Q31 */ ); void initMdctStereoDecData_fx( - STEREO_MDCT_DEC_DATA *hStereoMdct, /* i/o: mdct stereo parameters structure */ - const Word16 igf, /* i : flag indicating IGF activity */ - const H_IGF_GRID igfGrid, /* i : IGF grid configuration */ - const Word32 element_brate, /* i : element bitrate */ - const Word16 bwidth /* i : audio bandwidth */ + STEREO_MDCT_DEC_DATA *hStereoMdct, /* i/o: mdct stereo parameters structure */ + const Word16 igf, /* i : flag indicating IGF activity */ + const H_IGF_GRID igfGrid, /* i : IGF grid configuration */ + const Word32 element_brate, /* i : element bitrate */ + const Word16 bwidth /* i : audio bandwidth */ ); void stereo_tdm_downmix_ivas_fx( - STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i : TD stereo IVAS encoder structure */ - Word16 *Left_in_fx, /* Qx */ - Word16 *Right_in_fx, /* Qx */ - const Word16 input_frame, /* i : Number of samples */ - const Word16 tdm_ratio_idx, /* i : TDM ratio index */ - const Word16 tdm_SM_flag, /* i : channel combination scheme flag */ - const Word16 tdm_ratio_idx_SM /* i : TDM ratio index for SM mode */ + STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i : TD stereo IVAS encoder structure */ + Word16 *Left_in_fx, /* Qx */ + Word16 *Right_in_fx, /* Qx */ + const Word16 input_frame, /* i : Number of samples */ + const Word16 tdm_ratio_idx, /* i : TDM ratio index */ + const Word16 tdm_SM_flag, /* i : channel combination scheme flag */ + const Word16 tdm_ratio_idx_SM /* i : TDM ratio index for SM mode */ ); ivas_error initMdctItdHandling_fx( - STEREO_MDCT_ENC_DATA *hStereoMdct, /* i/o: mdct stereo parameters structure */ - const Word32 input_Fs /* i : input sampling rate */ + STEREO_MDCT_ENC_DATA *hStereoMdct, /* i/o: mdct stereo parameters structure */ + const Word32 input_Fs /* i : input sampling rate */ ); void stereo_mdct_enc_destroy_fx( - STEREO_MDCT_ENC_DATA_HANDLE *hStereoMdct /* i/o: encoder MDCT stereo handle */ + STEREO_MDCT_ENC_DATA_HANDLE *hStereoMdct /* i/o: encoder MDCT stereo handle */ ); void stereo_mdct_init_bands_fx( - const Word16 L_frame, /* i : frame length */ - const Word16 tmp_tcx_mode, /* i : tcx mode (TCX10, TCX 20), -1 if transition frame */ - const Word32 element_brate, /* i : element bitrate */ - const Word16 igf, /* i : flag indicating if IGF is used */ - const H_IGF_GRID hIgfGrid, /* i : IGF grid setup */ - Word16 *sfbOffset, /* o : sfb offset table */ - Word16 *sfbCnt /* o : number of sfbs */ + const Word16 L_frame, /* i : frame length */ + const Word16 tmp_tcx_mode, /* i : tcx mode (TCX10, TCX 20), -1 if transition frame */ + const Word32 element_brate, /* i : element bitrate */ + const Word16 igf, /* i : flag indicating if IGF is used */ + const H_IGF_GRID hIgfGrid, /* i : IGF grid setup */ + Word16 *sfbOffset, /* o : sfb offset table */ + Word16 *sfbCnt /* o : number of sfbs */ ); void stereo_mdct_init_igf_start_band_fx( - STEREO_MDCT_BAND_PARAMETERS *stbParams, /* i/o: stereo frequency band parameters */ - const Word16 transFac, /* i : transform factor */ - const Word16 bwidth, /* i : audio bandwidth */ - const Word32 element_brate /* i : element bitrate */ + STEREO_MDCT_BAND_PARAMETERS *stbParams, /* i/o: stereo frequency band parameters */ + const Word16 transFac, /* i : transform factor */ + const Word16 bwidth, /* i : audio bandwidth */ + const Word32 element_brate /* i : element bitrate */ ); void ivas_mdct_dec_side_bits_frame_channel_fx( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - Word16 param_lpc[CPE_CHANNELS][NPRM_LPC_NEW], /* o : lpc_parameters */ - Word16 p_param[CPE_CHANNELS][NB_DIV], /* o : pointer to param buffer */ - Decoder_State *st0, /* i : pointer to bitstream handle */ - Word16 nTnsBitsTCX10[CPE_CHANNELS][NB_DIV], /* o : number of bits for TNS */ - Word16 param[CPE_CHANNELS][DEC_NPRM_DIV * NB_DIV], /* i/o: parameters buffer */ - const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/ - const Word16 odd_channel_cpe /* i : flag cpe with odd nb of tc channels */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + Word16 param_lpc[CPE_CHANNELS][NPRM_LPC_NEW], /* o : lpc_parameters */ + Word16 p_param[CPE_CHANNELS][NB_DIV], /* o : pointer to param buffer */ + Decoder_State *st0, /* i : pointer to bitstream handle */ + Word16 nTnsBitsTCX10[CPE_CHANNELS][NB_DIV], /* o : number of bits for TNS */ + Word16 param[CPE_CHANNELS][DEC_NPRM_DIV * NB_DIV], /* i/o: parameters buffer */ + const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ + const Word16 odd_channel_cpe /* i : flag cpe with odd nb of tc channels */ ); void mdct_read_IGF_bits_fx( - Decoder_State *st, /* i/o: Decoder state handle */ - Decoder_State *st0 /* i : pointer to handle where bitstream is read */ + Decoder_State *st, /* i/o: Decoder state handle */ + Decoder_State *st0 /* i : pointer to handle where bitstream is read */ ); -void IGFDecReadData_ivas_fx( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Deccoder */ - Decoder_State *st, /**< in: | decoder state */ - const Word16 igfGridIdx, /**< in: Q0 | in case of CELP->TCX switching, use 1.25 framelength */ - const Word16 isIndepFrame /**< in: Q0 | if 1: arith dec force reset, if 0: no reset */ +void IGFDecReadData_ivas_fx( + const IGF_DEC_INSTANCE_HANDLE hInstance, /* i : instance handle of IGF Deccoder */ + Decoder_State *st, /* i : decoder state */ + const Word16 igfGridIdx, /* i : in case of CELP->TCX switching, use 1.25 framelength */ + const Word16 isIndepFrame /* i : if 1: arith dec force reset, if 0: no reset */ ); void stereo_tca_init_dec_fx( - STEREO_TCA_DEC_HANDLE hStereoTCA /* i/o: Stereo TCA handle for Fixed */ + STEREO_TCA_DEC_HANDLE hStereoTCA /* i/o: Stereo TCA handle for Fixed */ ); void stereo_icBWE_init_dec_fx( - STEREO_ICBWE_DEC_HANDLE hStereoICBWE /* i/o: Stereo inter-channel BWE handle */ + STEREO_ICBWE_DEC_HANDLE hStereoICBWE /* i/o: Stereo inter-channel BWE handle */ ); void stereo_icBWE_decproc_fx( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - Word32 *output[CPE_CHANNELS], /* i/o: output synthesis */ - Word32 outputHB[CPE_CHANNELS][L_FRAME48k], /* i : HB synthesis */ - const Word16 last_core, /* i : last core, primary channel */ - const Word16 last_bwidth, /* i : last bandwidth */ - const Word16 output_frame /* i : frame length */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + Word32 *output[CPE_CHANNELS], /* i/o: output synthesis */ + Word32 outputHB[CPE_CHANNELS][L_FRAME48k], /* i : HB synthesis */ + const Word16 last_core, /* i : last core, primary channel */ + const Word16 last_bwidth, /* i : last bandwidth */ + const Word16 output_frame /* i : frame length */ ); void add_HB_to_mono_dmx_fx( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - Word32 output[L_FRAME48k], /* i/o: output synthesis */ - Word32 outputHB[L_FRAME48k], /* i : HB synthesis */ - const Word16 last_core, /* i : last core, primary channel */ - const Word16 output_frame /* i : frame length */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + Word32 output[L_FRAME48k], /* i/o: output synthesis */ + Word32 outputHB[L_FRAME48k], /* i : HB synthesis */ + const Word16 last_core, /* i : last core, primary channel */ + const Word16 output_frame /* i : frame length */ ); void stereo_dft_dmx_out_reset_fx( - STEREO_DFT_DMX_DATA_HANDLE hStereoDftDmx /* i/o: DFT stereo DMX decoder */ + STEREO_DFT_DMX_DATA_HANDLE hStereoDftDmx /* i/o: DFT stereo DMX decoder */ ); void ivas_get_dirac_sba_max_md_bits_fx( @@ -1524,86 +1542,89 @@ void ivas_get_dirac_sba_max_md_bits_fx( Word16 *metadata_max_bits, Word16 *qmetadata_max_bit_req, const Word16 nbands, - IVAS_FORMAT ivas_format ); + IVAS_FORMAT ivas_format +); ivas_error ivas_dirac_sba_config_fx( - IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ - Word16 *element_mode, /* i/o: element mode of the core coder */ - Word32 sba_total_brate, /* i : SBA total bitrate */ - const Word16 sba_order, /* i : Ambisonic (SBA) order */ - const Word16 nbands /* i : number of frequency bands */ - , - IVAS_FORMAT ivas_format ); + IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ + Word16 *element_mode, /* i/o: element mode of the core coder */ + Word32 sba_total_brate, /* i : SBA total bitrate */ + const Word16 sba_order, /* i : Ambisonic (SBA) order */ + const Word16 nbands, /* i : number of frequency bands */ + IVAS_FORMAT ivas_format +); ivas_error ivas_dirac_config_fx( - void *st_ivas, /* i/o: IVAS encoder/decoder state structure */ - const Word16 enc_dec /* i : encoder or decoder flag */ + void *st_ivas, /* i/o: IVAS encoder/decoder state structure */ + const Word16 enc_dec /* i : encoder or decoder flag */ ); void dtx_read_padding_bits_fx( DEC_CORE_HANDLE st, - const Word16 num_bits ); + const Word16 num_bits +); void FdCngEncodeMDCTStereoSID_fx( - CPE_ENC_HANDLE hCPE /* i/o: CPE encoder state structure */ + CPE_ENC_HANDLE hCPE /* i/o: CPE encoder state structure */ ); void FdCngDecodeMDCTStereoSID_fx( - CPE_DEC_HANDLE hCPE /* i/o: CPE decoder state structure */ + CPE_DEC_HANDLE hCPE /* i/o: CPE decoder state structure */ ); void FdCngEncodeDiracMDCTStereoSID_fx( - CPE_ENC_HANDLE hCPE /* i/o: CPE encoder state structure */ + CPE_ENC_HANDLE hCPE /* i/o: CPE encoder state structure */ ); void FdCngDecodeDiracMDCTStereoSID_fx( - CPE_DEC_HANDLE hCPE /* i/o: CPE decoder state structure */ + CPE_DEC_HANDLE hCPE /* i/o: CPE decoder state structure */ ); -// tonalMDCTconcealment.c void TonalMdctConceal_whiten_noise_shape_ivas_fx( Decoder_State *st, const Word16 L_frame, - const TONALMDCTCONC_NOISE_SHAPE_WHITENING_MODE whitening_mode ); + const TONALMDCTCONC_NOISE_SHAPE_WHITENING_MODE whitening_mode +); void stereo_icBWE_dec_fx( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - Word32 *synthRef_fx, /* i/o: Reference channel HB synthesis at output Fs */ - Word32 *synth_fx, /* o : Non reference channel HB synthesis at output Fs */ - const Word16 *fb_synth_ref_fx, /* i : ref. high-band synthesis 16-20 kHz */ - const Word16 *voice_factors_fx, /* i : voicing factors */ - const Word16 output_frame, /* i : frame length */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + Word32 *synthRef_fx, /* i/o: Reference channel HB synthesis at output Fs */ + Word32 *synth_fx, /* o : Non reference channel HB synthesis at output Fs */ + const Word16 *fb_synth_ref_fx, /* i : ref. high-band synthesis 16-20 kHz */ + const Word16 *voice_factors_fx, /* i : voicing factors */ + const Word16 output_frame, /* i : frame length */ Word16 *Q_syn, - const Word16 Q_white_exc /* i : Q of fb_synth_ref_fx */ + const Word16 Q_white_exc /* i : Q of fb_synth_ref_fx */ ); void decoder_tcx_tns_fx( - Decoder_State *st, /* i/o: coder memory state */ - const Word16 L_frame_glob, /* i : frame length */ + Decoder_State *st, /* i/o: coder memory state */ + const Word16 L_frame_glob, /* i : frame length */ const Word16 L_spec, const Word16 L_frame, const Word16 L_frameTCX, Word32 x_fx[N_MAX], - const Word16 fUseTns, /* i : flag that is set if TNS data is present */ + const Word16 fUseTns, /* i : flag that is set if TNS data is present */ STnsData *tnsData, - const Word16 bfi, /* i : Bad frame indicator */ - const Word16 frame_cnt, /* i : frame counter in the super frame */ + const Word16 bfi, /* i : Bad frame indicator */ + const Word16 frame_cnt, /* i : frame counter in the super frame */ const Word16 whitenedDomain, - Word16 *length ); + Word16 *length +); void ivas_mdct_core_tns_ns_fx( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - Word16 fUseTns[CPE_CHANNELS][NB_DIV], /* i : two entries for each channel in TCX10 */ - STnsData tnsData[CPE_CHANNELS][NB_DIV], /* o : TNS parameter */ - Word32 *x_fx[CPE_CHANNELS][NB_DIV], /* o : synthesis @internal_FS */ - Word32 Aq_fx[CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )], /* o : LP coefficients */ - const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + Word16 fUseTns[CPE_CHANNELS][NB_DIV], /* i : two entries for each channel in TCX10 */ + STnsData tnsData[CPE_CHANNELS][NB_DIV], /* o : TNS parameter */ + Word32 *x_fx[CPE_CHANNELS][NB_DIV], /* o : synthesis @internal_FS */ + Word32 Aq_fx[CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )],/* o : LP coefficients */ + const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ Word16 x_e ); void decoder_tcx_imdct_fx( - Decoder_State *st, /* i/o: coder memory state */ - const Word16 L_frame_glob, /* i : frame length */ + Decoder_State *st, /* i/o: coder memory state */ + const Word16 L_frame_glob, /* i : frame length */ const Word16 L_frameTCX_glob, const Word16 L_spec, const Word16 tcx_offset, @@ -1616,44 +1637,45 @@ void decoder_tcx_imdct_fx( Word16 xn_buf_fx[], Word16 *q_win, Word16 *q_winFB, - const UWord16 kernelType, /* i : TCX transform kernel type */ - const Word16 fUseTns, /* i : flag that is set if TNS data is present */ - Word16 synth_fx[], /* i/o: synth[-M..L_frame] */ + const UWord16 kernelType, /* i : TCX transform kernel type */ + const Word16 fUseTns, /* i : flag that is set if TNS data is present */ + Word16 synth_fx[], /* i/o: synth[-M..L_frame] */ Word16 synthFB_fx[], - const Word16 bfi, /* i : Bad frame indicator */ - const Word16 frame_cnt, /* i : frame counter in the super frame */ - const Word16 sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ + const Word16 bfi, /* i : Bad frame indicator */ + const Word16 frame_cnt, /* i : frame counter in the super frame */ + const Word16 sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ ); void ivas_sba_dirac_stereo_dec_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - Word32 *output[CPE_CHANNELS], /* i/o: output synthesis signal */ - const Word16 output_frame, /* i : output frame length per channel */ - const Word16 mcmasa /* i : McMASA flag */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Word32 *output[CPE_CHANNELS], /* i/o: output synthesis signal */ + const Word16 output_frame, /* i : output frame length per channel */ + const Word16 mcmasa /* i : McMASA flag */ ); ivas_error ivas_osba_render_sf_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ - UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ - UWord16 *nSamplesAvailableNext, /* o : number of CLDFB slots still to render */ - Word32 *p_output[] /* o : rendered time signal */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ + UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ + UWord16 *nSamplesAvailableNext, /* o : number of CLDFB slots still to render */ + Word32 *p_output[] /* o : rendered time signal */ ); void ivas_hq_core_dec_fx( - Decoder_State *st_fx, /* i/o: decoder state structure fx */ - Word16 synth[], /* o : output synthesis */ - Word16 *Q_synth, /* o : Q value of synth */ - const Word16 output_frame, /* i : output frame length */ - const Word16 hq_core_type, /* i : HQ core type */ - const Word16 core_switching_flag, /* i : ACELP->HQ switching frame flag */ + Decoder_State *st_fx, /* i/o: decoder state structure fx */ + Word16 synth[], /* o : output synthesis */ + Word16 *Q_synth, /* o : Q value of synth */ + const Word16 output_frame, /* i : output frame length */ + const Word16 hq_core_type, /* i : HQ core type */ + const Word16 core_switching_flag, /* i : ACELP->HQ switching frame flag */ Word16 output[], - Word16 *Q_output ); + Word16 *Q_output +); void ivas_HQ_FEC_Mem_update_fx( - Decoder_State *st_fx, /* i/o: decoder state structure */ - Word32 *t_audio_q_fx, /*Q12*/ - Word32 *normq_fx, /*Q14*/ + Decoder_State *st_fx, /* i/o: decoder state structure */ + Word32 *t_audio_q_fx, /*Q12*/ + Word32 *normq_fx, /*Q14*/ Word16 *ynrm, Word16 *Num_bands_p, Word16 is_transient, @@ -1661,83 +1683,86 @@ void ivas_HQ_FEC_Mem_update_fx( Word16 c_switching_flag, Word16 nb_sfm, Word16 num_Sb, - Word16 *mean_en_high_fx, /*Q5*/ - Word16 hq_core_type, /* i : normal or low-rate MDCT(HQ) core */ - Word16 output_frame ); + Word16 *mean_en_high_fx, /*Q5*/ + Word16 hq_core_type, /* i : normal or low-rate MDCT(HQ) core */ + Word16 output_frame +); -Word16 ivas_hq_classifier_dec_fx( /* o : Consumed bits Q0 */ - Decoder_State *st_fx, /* i/o: decoder state structure */ - const Word32 core_brate, /* i : Core bit rate Q0 */ - const Word16 length, /* i : Frame length Q0 */ - Word16 *is_transient, /* o : Transient flag Q0 */ - Word16 *hqswb_clas /* o : HQ class Q0 */ +/* o : Consumed bits Q0 */ +Word16 ivas_hq_classifier_dec_fx( + Decoder_State *st_fx, /* i/o: decoder state structure */ + const Word32 core_brate, /* i : Core bit rate Q0 */ + const Word16 length, /* i : Frame length Q0 */ + Word16 *is_transient, /* o : Transient flag Q0 */ + Word16 *hqswb_clas /* o : HQ class Q0 */ ); void ivas_hq_hr_dec_fx( - Decoder_State *st_fx, /* i/o: decoder state structure fx */ - Word32 *t_audio_q, /* o : transform-domain coefficients Q12 */ - const Word16 length, /* i : frame length Q0 */ - Word16 num_bits, /* i : number of available bits Q0 */ - Word16 *ynrm, /* o : norm quantization index vector Q0 */ - Word16 *is_transient, /* o : transient flag Q0 */ - Word16 *hqswb_clas, /* o : HQ SWB class Q0 */ - Word16 *SWB_fenv, /* o : SWB frequency envelopes Q1 */ - const Word16 core_switching_flag /* i : Core switching flag */ + Decoder_State *st_fx, /* i/o: decoder state structure fx */ + Word32 *t_audio_q, /* o : transform-domain coefficients Q12 */ + const Word16 length, /* i : frame length Q0 */ + Word16 num_bits, /* i : number of available bits Q0 */ + Word16 *ynrm, /* o : norm quantization index vector Q0 */ + Word16 *is_transient, /* o : transient flag Q0 */ + Word16 *hqswb_clas, /* o : HQ SWB class Q0 */ + Word16 *SWB_fenv, /* o : SWB frequency envelopes Q1 */ + const Word16 core_switching_flag /* i : Core switching flag */ ); void ivas_hq_configure_fx( - const Word16 length, /* i : Frame length Q0 */ - const Word16 hqswb_clas, /* i : HQ SWB class Q0 */ - const Word32 core_brate, /* i : Codec bitrate Q0 */ - Word16 *num_sfm, /* o : Total number of subbands Q0 */ - Word16 *nb_sfm, /* o : Total number of coded bands Q0 */ - Word16 *start_norm, /* o : First norm to be SDE encoded Q0 */ - Word16 *num_env_bands, /* o : Number coded envelope bands Q0 */ - Word16 *numnrmibits, /* o : Number of bits in fall-back norm encoding Q0 */ - Word16 *hq_generic_offset, /* o : Freq offset for HQ GENERIC Q0 */ - Word16 *sfmsize, /* o : Subband bandwidths Q0 */ - Word16 *sfm_start, /* o : Subband start coefficients Q0 */ - Word16 *sfm_end /* o : Subband end coefficients Q0 */ + const Word16 length, /* i : Frame length Q0 */ + const Word16 hqswb_clas, /* i : HQ SWB class Q0 */ + const Word32 core_brate, /* i : Codec bitrate Q0 */ + Word16 *num_sfm, /* o : Total number of subbands Q0 */ + Word16 *nb_sfm, /* o : Total number of coded bands Q0 */ + Word16 *start_norm, /* o : First norm to be SDE encoded Q0 */ + Word16 *num_env_bands, /* o : Number coded envelope bands Q0 */ + Word16 *numnrmibits, /* o : Number of bits in fall-back norm encoding Q0 */ + Word16 *hq_generic_offset, /* o : Freq offset for HQ GENERIC Q0 */ + Word16 *sfmsize, /* o : Subband bandwidths Q0 */ + Word16 *sfm_start, /* o : Subband start coefficients Q0 */ + Word16 *sfm_end /* o : Subband end coefficients Q0 */ ); void ivas_hq_bit_allocation_fx( - const Word32 core_brate, /* i : Core bit-rate Q0 */ - const Word16 length, /* i : Frame length Q0 */ - const Word16 hqswb_clas, /* i : HQ class Q0 */ - Word16 *num_bits, /* i/o: Remaining bit budget Q0 */ - const Word16 *normqlg2, /* i : Quantized norms Q0 */ - const Word16 nb_sfm, /* i : Number sub bands to be encoded Q0 */ - const Word16 *sfmsize, /* i : Sub band bandwidths Q0 */ - Word16 *noise_level, /* o : HVQ noise level Q15 */ - Word16 *R, /* o : Bit allocation per sub band Q0 */ - Word16 *Rsubband, /* o : Fractional bit allocation Q3 */ - Word16 *sum, /* o : Sum of allocated shape bits Q0 */ - Word16 *core_sfm, /* o : Last coded band in core Q0 */ - const Word16 num_env_bands /* i : Number sub bands to be encoded for HQ_GEN Q0 */ -); - -Word16 ivas_assign_gain_bits_fx( /* o : Number of assigned gain bits */ - const Word16 core, /* i : HQ core */ - const Word16 BANDS, /* i : Number of bands */ - const Word16 *band_width, /* i : Sub band bandwidth */ - Word16 *Rk, /* i/o: Bit allocation/Adjusted bit alloc. Q3 */ - Word16 *gain_bits_array, /* o : Assigned gain bits */ - Word16 *Rcalc /* o : Bit budget for shape quantizer Q3 */ + const Word32 core_brate, /* i : Core bit-rate Q0 */ + const Word16 length, /* i : Frame length Q0 */ + const Word16 hqswb_clas, /* i : HQ class Q0 */ + Word16 *num_bits, /* i/o: Remaining bit budget Q0 */ + const Word16 *normqlg2, /* i : Quantized norms Q0 */ + const Word16 nb_sfm, /* i : Number sub bands to be encoded Q0 */ + const Word16 *sfmsize, /* i : Sub band bandwidths Q0 */ + Word16 *noise_level, /* o : HVQ noise level Q15 */ + Word16 *R, /* o : Bit allocation per sub band Q0 */ + Word16 *Rsubband, /* o : Fractional bit allocation Q3 */ + Word16 *sum, /* o : Sum of allocated shape bits Q0 */ + Word16 *core_sfm, /* o : Last coded band in core Q0 */ + const Word16 num_env_bands /* i : Number sub bands to be encoded for HQ_GEN Q0 */ +); + +/* o : Number of assigned gain bits */ +Word16 ivas_assign_gain_bits_fx( + const Word16 core, /* i : HQ core */ + const Word16 BANDS, /* i : Number of bands */ + const Word16 *band_width, /* i : Sub band bandwidth */ + Word16 *Rk, /* i/o: Bit allocation/Adjusted bit alloc. Q3 */ + Word16 *gain_bits_array, /* o : Assigned gain bits */ + Word16 *Rcalc /* o : Bit budget for shape quantizer Q3 */ ); void ivas_fine_gain_pred_fx( - const Word16 *sfm_start, /* i : Sub band start indices */ - const Word16 *sfm_end, /* i : Sub band end indices */ - const Word16 *sfm_size, /* i : Sub band bandwidths */ - const Word16 *i_sort, /* i : Energy sorting indices */ - const Word16 *K, /* i : Number of pulses per band */ - const Word16 *maxpulse, /* i : Maximum pulse per band */ - const Word16 *R, /* i : Bits per sub band Q3 */ - const Word16 num_sfm, /* i : Number of sub bands */ - Word16 *xq, /* i/o: Quantized vector /quantized vector with finegain adj Q15*/ - Word16 *y, /* i/o: Quantized vector (int) Q0*/ - Word16 *fg_pred, /* o : Predicted fine gains Q12 */ - const Word16 core /* i : Core */ + const Word16 *sfm_start, /* i : Sub band start indices */ + const Word16 *sfm_end, /* i : Sub band end indices */ + const Word16 *sfm_size, /* i : Sub band bandwidths */ + const Word16 *i_sort, /* i : Energy sorting indices */ + const Word16 *K, /* i : Number of pulses per band */ + const Word16 *maxpulse, /* i : Maximum pulse per band */ + const Word16 *R, /* i : Bits per sub band Q3 */ + const Word16 num_sfm, /* i : Number of sub bands */ + Word16 *xq, /* i/o: Quantized vector /quantized vector with finegain adj Q15*/ + Word16 *y, /* i/o: Quantized vector (int) Q0*/ + Word16 *fg_pred, /* o : Predicted fine gains Q12 */ + const Word16 core /* i : Core */ ); Word16 ivas_pvq_core_dec_fx( @@ -1745,117 +1770,119 @@ Word16 ivas_pvq_core_dec_fx( const Word16 *sfm_start, const Word16 *sfm_end, const Word16 *sfmsize, - Word16 coefs_quant[], /* o : output MDCT */ + Word16 coefs_quant[], /* o : output MDCT */ Word16 *Q_coefs, Word16 bits_tot, Word16 nb_sfm, - Word16 *R, /* Q3 */ + Word16 *R, /* Q3 */ Word16 *Rs, Word16 *npulses, Word16 *maxpulse, - const Word16 core ); + const Word16 core +); void ivas_hq_ecu_fx( - const Word16 *prevsynth, /* i : buffer of previously synthesized signal */ - Word32 *ecu_rec, /* o : reconstructed frame in tda domain */ - Word16 *time_offs, /* i/o: Sample offset for consecutive frame losses */ - Word16 *X_sav, /* i/o: Stored spectrum of prototype frame */ - Word16 *Q_spec, /* i/o: Q value of stored spectrum */ - Word16 *num_p, /* i/o: Number of identified peaks */ - Word16 *plocs, /* i/o: Peak locations */ - Word32 *plocsi, /* i/o: Interpolated peak locations Q16 */ - const Word16 env_stab, /* i : Envelope stability parameter */ - Word16 *last_fec, /* i/o: Flag for usage of pitch dependent ECU */ - const Word16 ph_ecu_HqVoicing, /* i : HQ Voicing flag */ - Word16 *ph_ecu_active, /* i : Phase ECU active flag */ - Word16 *gapsynth, /* o : Gap synthesis */ - const Word16 prev_bfi, /* i : indicating burst frame error */ - const Word16 old_is_transient[2], /* i : flags indicating previous transient frames */ - Word16 *mag_chg_1st, /* i/o: per band magnitude modifier for transients */ - Word16 *Xavg, /* i/o: Frequency group average gain to fade to */ - Word16 *beta_mute, /* o : Factor for long-term mute */ - const Word16 output_frame, /* i : frame length */ - Decoder_State *st_fx /* i/o: decoder state structure */ + const Word16 *prevsynth, /* i : buffer of previously synthesized signal */ + Word32 *ecu_rec, /* o : reconstructed frame in tda domain */ + Word16 *time_offs, /* i/o: Sample offset for consecutive frame losses */ + Word16 *X_sav, /* i/o: Stored spectrum of prototype frame */ + Word16 *Q_spec, /* i/o: Q value of stored spectrum */ + Word16 *num_p, /* i/o: Number of identified peaks */ + Word16 *plocs, /* i/o: Peak locations */ + Word32 *plocsi, /* i/o: Interpolated peak locations Q16 */ + const Word16 env_stab, /* i : Envelope stability parameter */ + Word16 *last_fec, /* i/o: Flag for usage of pitch dependent ECU */ + const Word16 ph_ecu_HqVoicing, /* i : HQ Voicing flag */ + Word16 *ph_ecu_active, /* i : Phase ECU active flag */ + Word16 *gapsynth, /* o : Gap synthesis */ + const Word16 prev_bfi, /* i : indicating burst frame error */ + const Word16 old_is_transient[2], /* i : flags indicating previous transient frames */ + Word16 *mag_chg_1st, /* i/o: per band magnitude modifier for transients */ + Word16 *Xavg, /* i/o: Frequency group average gain to fade to */ + Word16 *beta_mute, /* o : Factor for long-term mute */ + const Word16 output_frame, /* i : frame length */ + Decoder_State *st_fx /* i/o: decoder state structure */ ); void ivas_fill_spectrum_fx( - Word16 *coeff, /* i/o: normalized MLT spectrum / nf spectrum Q12 */ - Word32 *L_coeff_out, /* i/o: Noisefilled MLT spectrum Q12 */ - const Word16 *R, /* i : number of pulses per band Q0 */ - const Word16 is_transient, /* i : transient flag Q0 */ - Word16 norm[], /* i : quantization indices for norms Q0 */ - const Word16 *hq_generic_fenv, /* i : HQ GENERIC envelope Q1 */ - const Word16 hq_generic_offset, /* i : HQ GENERIC offset Q0 */ - const Word16 nf_idx, /* i : noise fill index Q0 */ - const Word16 length, /* i : Length of spectrum (32 or 48 kHz) Q0 */ - const Word16 env_stab, /* i : Envelope stability measure [0..1] Q15 */ - Word16 *no_att_hangover, /* i/o: Frame counter for attenuation hangover Q0 */ - Word32 *L_energy_lt, /* i/o: Long-term energy measure for transient detection Q13 */ - Word16 *bwe_seed, /* i/o: random seed for generating BWE i Q0 */ - const Word16 hq_generic_exc_clas, /* i : BWE excitation class Q0 */ - const Word16 core_sfm, /* i : index of the end band for core Q0 */ - const Word16 HQ_mode, /* i : HQ mode Q0 */ - Word16 noise_level[], /* i : noise levels for harmonic modes Q15 */ - const Word32 L_core_brate, /* i : target bit-rate Q0 */ - Word16 prev_noise_level[], /* i/o: noise factor in previous frame Q15 */ - Word16 *prev_R, /* i/o: bit allocation info. in previous frame Q0 */ - Word32 *prev_coeff_out, /* i/o: decoded spectrum in previous frame Q12 */ - const Word16 *peak_idx, /* i : peak indices for hvq Q0 */ - const Word16 Npeaks, /* i : number of peaks in hvq Q0 */ - const Word16 *npulses, /* i : number of pulses per band Q0 */ - const Word16 prev_is_transient, /* i : previous transient flag Q0 */ - Word32 *prev_normq, /* i/o: previous norms Q14 */ - Word32 *prev_env, /* i/o: previous noise envelopes Q(prev_env_Q) */ - const Word16 prev_bfi, /* i : previous bad frame indicator Q0 */ - const Word16 *sfmsize, /* i : Length of bands Q0 */ - const Word16 *sfm_start, /* i : Start of bands Q0 */ - const Word16 *sfm_end, /* i : End of bands Q0 */ - Word16 *prev_L_swb_norm, /* i/o: HVQ/Harmonic mode normalization length Q0 */ - const Word16 prev_hq_mode, /* i : Previous HQ mode Q0 */ - const Word16 num_sfm, /* i : Total number of bands Q0 */ + Word16 *coeff, /* i/o: normalized MLT spectrum / nf spectrum Q12 */ + Word32 *L_coeff_out, /* i/o: Noisefilled MLT spectrum Q12 */ + const Word16 *R, /* i : number of pulses per band Q0 */ + const Word16 is_transient, /* i : transient flag Q0 */ + Word16 norm[], /* i : quantization indices for norms Q0 */ + const Word16 *hq_generic_fenv, /* i : HQ GENERIC envelope Q1 */ + const Word16 hq_generic_offset, /* i : HQ GENERIC offset Q0 */ + const Word16 nf_idx, /* i : noise fill index Q0 */ + const Word16 length, /* i : Length of spectrum (32 or 48 kHz) Q0 */ + const Word16 env_stab, /* i : Envelope stability measure [0..1] Q15 */ + Word16 *no_att_hangover, /* i/o: Frame counter for attenuation hangover Q0 */ + Word32 *L_energy_lt, /* i/o: Long-term energy measure for transient detection Q13 */ + Word16 *bwe_seed, /* i/o: random seed for generating BWE i Q0 */ + const Word16 hq_generic_exc_clas, /* i : BWE excitation class Q0 */ + const Word16 core_sfm, /* i : index of the end band for core Q0 */ + const Word16 HQ_mode, /* i : HQ mode Q0 */ + Word16 noise_level[], /* i : noise levels for harmonic modes Q15 */ + const Word32 L_core_brate, /* i : target bit-rate Q0 */ + Word16 prev_noise_level[], /* i/o: noise factor in previous frame Q15 */ + Word16 *prev_R, /* i/o: bit allocation info. in previous frame Q0 */ + Word32 *prev_coeff_out, /* i/o: decoded spectrum in previous frame Q12 */ + const Word16 *peak_idx, /* i : peak indices for hvq Q0 */ + const Word16 Npeaks, /* i : number of peaks in hvq Q0 */ + const Word16 *npulses, /* i : number of pulses per band Q0 */ + const Word16 prev_is_transient, /* i : previous transient flag Q0 */ + Word32 *prev_normq, /* i/o: previous norms Q14 */ + Word32 *prev_env, /* i/o: previous noise envelopes Q(prev_env_Q) */ + const Word16 prev_bfi, /* i : previous bad frame indicator Q0 */ + const Word16 *sfmsize, /* i : Length of bands Q0 */ + const Word16 *sfm_start, /* i : Start of bands Q0 */ + const Word16 *sfm_end, /* i : End of bands Q0 */ + Word16 *prev_L_swb_norm, /* i/o: HVQ/Harmonic mode normalization length Q0 */ + const Word16 prev_hq_mode, /* i : Previous HQ mode Q0 */ + const Word16 num_sfm, /* i : Total number of bands Q0 */ Word16 *prev_env_Q, const Word16 num_env_bands, - const Word16 element_mode ); + const Word16 element_mode +); void ivas_de_interleave_spectrum_fx( - Word32 *coefs, /* i/o: input and output coefficients Q12 */ - const Word16 length /* i : length of spectrum Q0 */ + Word32 *coefs, /* i/o: input and output coefficients Q12 */ + const Word16 length /* i : length of spectrum Q0 */ ); void ivas_harm_bwe_fx( - const Word16 *coeff_fine, /* i : fine structure for BWE */ - const Word16 *coeff, /* i : coded/noisefilled normalized spectrum */ - const Word16 num_sfm, /* i : Number of subbands */ - const Word16 *sfm_start, /* i : Subband start coefficient */ - const Word16 *sfm_end, /* i : Subband end coefficient */ - const Word16 last_sfm, /* i : last coded subband */ - const Word16 *R, /* i : bit allocation */ - const Word16 prev_hq_mode, /* i : previous hq mode */ - Word16 *norm, /* i/o: quantization indices for norms */ - Word16 *noise_level, /* i/o: noise levels for harmonic modes */ - Word16 *prev_noise_level, /* i/o: noise factor in previous frame */ - Word16 *bwe_seed, /* i/o: random seed for generating BWE input */ - Word32 *coeff_out, /* o : coded/noisefilled spectrum */ - const Word16 element_mode /* i : IVAS element mode */ + const Word16 *coeff_fine, /* i : fine structure for BWE */ + const Word16 *coeff, /* i : coded/noisefilled normalized spectrum */ + const Word16 num_sfm, /* i : Number of subbands */ + const Word16 *sfm_start, /* i : Subband start coefficient */ + const Word16 *sfm_end, /* i : Subband end coefficient */ + const Word16 last_sfm, /* i : last coded subband */ + const Word16 *R, /* i : bit allocation */ + const Word16 prev_hq_mode, /* i : previous hq mode */ + Word16 *norm, /* i/o: quantization indices for norms */ + Word16 *noise_level, /* i/o: noise levels for harmonic modes */ + Word16 *prev_noise_level, /* i/o: noise factor in previous frame */ + Word16 *bwe_seed, /* i/o: random seed for generating BWE input */ + Word32 *coeff_out, /* o : coded/noisefilled spectrum */ + const Word16 element_mode /* i : IVAS element mode */ ); void ivas_hq_pred_hb_bws_fx( - Decoder_State *st_fx, /* i/o: decoder state structure */ - const Word16 *ynrm, /* i : norm quantization index vector */ - const Word16 length, /* i : frame length */ - const Word16 hqswb_clas, /* i : HQ SWB class */ - const Word16 *SWB_fenv /* i : SWB frequency envelopes Q1 */ + Decoder_State *st_fx, /* i/o: decoder state structure */ + const Word16 *ynrm, /* i : norm quantization index vector */ + const Word16 length, /* i : frame length */ + const Word16 hqswb_clas, /* i : HQ SWB class */ + const Word16 *SWB_fenv /* i : SWB frequency envelopes Q1 */ ); void synchro_synthesis_fx( - const Word32 ivas_total_brate, /* i : IVAS total bitrate */ - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - Word32 *output_fx[CPE_CHANNELS], /* i/o: output synthesis signal */ - const Word16 output_frame, /* i : Number of samples */ - const Word16 sba_dirac_stereo_flag, /* i : signal stereo output for SBA DirAC */ - Word16 output_fx_q ); - -// ivas_dirac_output_synthesis_cov + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + Word32 *output_fx[CPE_CHANNELS], /* i/o: output synthesis signal */ + const Word16 output_frame, /* i : Number of samples */ + const Word16 sba_dirac_stereo_flag, /* i : signal stereo output for SBA DirAC */ + Word16 output_fx_q +); + void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot_fx( Word32 *RealBuffer_fx, /* i : input channel filter bank samples (real part) */ Word16 RealBuffer_e, /* i : exponent input channel filter bank samples (real part)*/ @@ -1871,109 +1898,113 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot_fx( ); void configureFdCngDec_ivas_fx( - HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: Contains the variables related to the FD-based CNG process */ + HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: Contains the variables related to the FD-based CNG process */ const Word16 bwidth, const Word32 total_brate, const Word16 L_frame, const Word16 last_L_frame, - const Word16 element_mode ); + const Word16 element_mode +); void synchonize_channels_mdct_sid_fx( - Decoder_State *sts[CPE_CHANNELS], /* i/o: decoder state structure */ - const Word16 n /* i : channel number */ + Decoder_State *sts[CPE_CHANNELS], /* i/o: decoder state structure */ + const Word16 n /* i : channel number */ ); void ivas_interpolate_3_over_1_allpass_fx( - const Word16 *input_fx, - /* i : input signal */ /* Q_input */ - const Word16 len, /* i : number of input samples */ - Word16 *out_fx, - /* o : output signal */ /* Q_input */ - Word16 *mem_fx /* i/o: memory */ /* Q_input */ + const Word16 *input_fx, /* i : input signal Q_input */ + const Word16 len, /* i : number of input samples */ + Word16 *out_fx, /* o : output signal Q_input */ + Word16 *mem_fx /* i/o: memory Q_input */ ); void tdm_configure_enc_fx( - const Word16 ivas_format, /* i : IVAS format */ - const Word16 ism_mode, /* i : ISM mode in combined format */ - CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ - const Word16 Etot_last_fx[CPE_CHANNELS], /* i/o: Energy of last frame Q8*/ - const Word16 tdm_SM_or_LRTD_Pri, /* i : channel combination scheme flag in TD stereo OR LRTD primary channel */ - const Word16 tdm_ratio_idx, /* i : ratio index */ - const Word16 tdm_ratio_idx_SM, /* i : ratio index in SM mode */ - const Word16 attack_flag, /* i : Primary channel attack flag */ - const Word16 nb_bits_metadata /* i : number of metadata bits */ + const Word16 ivas_format, /* i : IVAS format */ + const Word16 ism_mode, /* i : ISM mode in combined format */ + CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ + const Word16 Etot_last_fx[CPE_CHANNELS], /* i/o: Energy of last frame Q8*/ + const Word16 tdm_SM_or_LRTD_Pri, /* i : channel combination scheme flag in TD stereo OR LRTD primary channel */ + const Word16 tdm_ratio_idx, /* i : ratio index */ + const Word16 tdm_ratio_idx_SM, /* i : ratio index in SM mode */ + const Word16 attack_flag, /* i : Primary channel attack flag */ + const Word16 nb_bits_metadata /* i : number of metadata bits */ ); void stereoFdCngCoherence_fx( - Encoder_State **sts, /* i/o: core encoder structures */ - const Word16 last_element_mode, /* i : last element mode */ - Word16 fft_buff[CPE_CHANNELS][2 * L_FFT], /* i : fft buffers for L and R channels fft_exp*/ - Word16 fft_exp ); + Encoder_State **sts, /* i/o: core encoder structures */ + const Word16 last_element_mode, /* i : last element mode */ + Word16 fft_buff[CPE_CHANNELS][2 * L_FFT], /* i : fft buffers for L and R channels fft_exp*/ + Word16 fft_exp +); void ivas_wb_tbe_dec_fx( - Decoder_State *st_fx, /* i/o: decoder state structure */ - const Word16 coder_type, /* i : coding type */ - Word32 *bwe_exc_extended, /* i : bandwidth extended exciatation 2*Q_exc*/ + Decoder_State *st_fx, /* i/o: decoder state structure */ + const Word16 coder_type, /* i : coding type */ + Word32 *bwe_exc_extended, /* i : bandwidth extended exciatation 2*Q_exc*/ const Word16 Q_exc, - const Word16 voice_factors[], /* i : voicing factors */ - Word16 *synth, /* o : WB synthesis/final synthesis */ - Word16 *Q_synth ); + const Word16 voice_factors[], /* i : voicing factors */ + Word16 *synth, /* o : WB synthesis/final synthesis */ + Word16 *Q_synth +); void GenShapedWBExcitation_ivas_fx( - Word16 *excSHB, /* o : synthesized shaped shb exctiation Q_bwe_exc*/ - const Word16 *lpc_shb, /* i : lpc coefficients Q12*/ - Word16 *exc4kWhtnd, /* o : whitened synthesized shb excitation Q_bwe_exc*/ - Word32 *mem_csfilt, /* i/o : memory Q_bwe_exc+16*/ - Word16 *mem_genSHBexc_filt_down1, /* i/o : memory Q_bwe_exc*/ - Word16 *mem_genSHBexc_filt_down2, /* i/o : memory Q_bwe_exc*/ - Word16 *mem_genSHBexc_filt_down3, /* i/o : memory Q_bwe_exc*/ - Word16 *state_lpc_syn, /* i/o : memory Q_bwe_exc*/ - const Word16 coder_type, /* i : coding type */ - const Word16 *bwe_exc_extended, /* i : bwidth extended exciatation Q_bwe_exc*/ + Word16 *excSHB, /* o : synthesized shaped shb exctiation Q_bwe_exc*/ + const Word16 *lpc_shb, /* i : lpc coefficients Q12 */ + Word16 *exc4kWhtnd, /* o : whitened synthesized shb excitation Q_bwe_exc*/ + Word32 *mem_csfilt, /* i/o : memory Q_bwe_exc+16*/ + Word16 *mem_genSHBexc_filt_down1, /* i/o : memory Q_bwe_exc*/ + Word16 *mem_genSHBexc_filt_down2, /* i/o : memory Q_bwe_exc*/ + Word16 *mem_genSHBexc_filt_down3, /* i/o : memory Q_bwe_exc*/ + Word16 *state_lpc_syn, /* i/o : memory Q_bwe_exc*/ + const Word16 coder_type, /* i : coding type */ + const Word16 *bwe_exc_extended, /* i : bwidth extended exciatation Q_bwe_exc*/ const Word16 Q_bwe_exc, - Word16 bwe_seed[], /* i/o : random number generator seed */ - const Word16 voice_factors[], /* i : voicing factor Q15*/ - const Word16 uv_flag, /* i : unvoiced flag */ - const Word16 igf_flag ); - -Word16 ivas_wb_bwe_dec_fx( /* o : Q_syn_hb*/ - Decoder_State *st_fx, /* i/o: decoder state structure */ - const Word16 output[], /* i : suntehsis @ internal Fs Q_input */ - Word16 *synth_fx, /* i/o: ACELP core synthesis/final synthesis Q0/Qpost */ - Word16 *hb_synth_fx, /* o : SHB synthesis/final synthesis Q_syn_hb */ - const Word16 use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ - const Word16 output_frame, /* i : frame length */ - Word16 *voice_factors_fx, /* i : voicing factors Q15 */ - const Word16 pitch_buf_fx[], /* i : pitch buffer Q6 */ - Word16 *Qpost ); + Word16 bwe_seed[], /* i/o : random number generator seed */ + const Word16 voice_factors[], /* i : voicing factor Q15*/ + const Word16 uv_flag, /* i : unvoiced flag */ + const Word16 igf_flag +); + +/* o : Q_syn_hb*/ +Word16 ivas_wb_bwe_dec_fx( + Decoder_State *st_fx, /* i/o: decoder state structure */ + const Word16 output[], /* i : suntehsis @ internal Fs Q_input */ + Word16 *synth_fx, /* i/o: ACELP core synthesis/final synthesis Q0/Qpost */ + Word16 *hb_synth_fx, /* o : SHB synthesis/final synthesis Q_syn_hb */ + const Word16 use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ + const Word16 output_frame, /* i : frame length */ + Word16 *voice_factors_fx, /* i : voicing factors Q15 */ + const Word16 pitch_buf_fx[], /* i : pitch buffer Q6 */ + Word16 *Qpost +); void ivas_param_ism_config_fx( - PARAM_ISM_CONFIG_HANDLE hParamIsm, /* i/o: IVAS Param ISM Config Structure */ - const Word16 nchan_obj /* i : number of ISM channels */ + PARAM_ISM_CONFIG_HANDLE hParamIsm, /* i/o: IVAS Param ISM Config Structure */ + const Word16 nchan_obj /* i : number of ISM channels */ ); void ivas_mdct_core_invQ_fx( - CPE_DEC_HANDLE hCPE, /* i/o: CPE handle */ - Word16 nTnsBitsTCX10[CPE_CHANNELS][NB_DIV], /* i : number of TNS bits */ - Word16 p_param[CPE_CHANNELS][NB_DIV], /* i : pointer to param buffer */ - Word16 param_lpc[CPE_CHANNELS][NPRM_LPC_NEW], /* i : lpc parameters */ - Word16 param[CPE_CHANNELS][DEC_NPRM_DIV * NB_DIV], /* i : param buffer */ - Word16 fUseTns[CPE_CHANNELS][NB_DIV], /* i : flag TNS enabled */ - STnsData tnsData[CPE_CHANNELS][NB_DIV], /* i : TNS parameter */ - Word32 *x_0[CPE_CHANNELS][NB_DIV], /* i/o: signal buffer */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE handle */ + Word16 nTnsBitsTCX10[CPE_CHANNELS][NB_DIV], /* i : number of TNS bits */ + Word16 p_param[CPE_CHANNELS][NB_DIV], /* i : pointer to param buffer */ + Word16 param_lpc[CPE_CHANNELS][NPRM_LPC_NEW], /* i : lpc parameters */ + Word16 param[CPE_CHANNELS][DEC_NPRM_DIV * NB_DIV], /* i : param buffer */ + Word16 fUseTns[CPE_CHANNELS][NB_DIV], /* i : flag TNS enabled */ + STnsData tnsData[CPE_CHANNELS][NB_DIV], /* i : TNS parameter */ + Word32 *x_0[CPE_CHANNELS][NB_DIV], /* i/o: signal buffer */ Word16 x_0_e, - Word32 *x[CPE_CHANNELS][NB_DIV], /* i/o: signal buffer */ + Word32 *x[CPE_CHANNELS][NB_DIV], /* i/o: signal buffer */ Word16 x_e, Word16 x_len[CPE_CHANNELS][NB_DIV], - Word16 Aq[CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )], /* i : LP coefficients */ - Word16 ms_mask[NB_DIV][MAX_SFB], /* i : M/S mask */ - const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ + Word16 Aq[CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )], /* i : LP coefficients */ + Word16 ms_mask[NB_DIV][MAX_SFB], /* i : M/S mask */ + const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ); void ivas_mdct_tcx10_bit_distribution_fx( - Word16 target_bitsTCX10[NB_DIV], /* o : target bit distribution */ - const Word16 nbits_tcx, /* i : TCX bits */ - const Word16 nTnsBitsTCX10[NB_DIV] /* i : TNS bits */ + Word16 target_bitsTCX10[NB_DIV], /* o : target bit distribution */ + const Word16 nbits_tcx, /* i : TCX bits */ + const Word16 nTnsBitsTCX10[NB_DIV] /* i : TNS bits */ ); void TonalMDCTConceal_Detect_ivas_fx( @@ -1981,10 +2012,11 @@ void TonalMDCTConceal_Detect_ivas_fx( const Word32 pitchLag, Word16 *numIndices, const PsychoacousticParameters *psychParamsCurrent, - Word16 element_mode ); + Word16 element_mode +); Word16 GetPLCModeDecision_ivas_fx( - Decoder_State *st /* i/o: decoder memory state pointer */ + Decoder_State *st /* i/o: decoder memory state pointer */ ); void ivas_DetectTonalComponents_fx( @@ -2003,47 +2035,51 @@ void ivas_DetectTonalComponents_fx( const Word16 secondLastPowerSpectrum_e, const Word16 nSamples, const Word16 nSamplesCore, - Word16 floorPowerSpectrum, /* i: lower limit for power spectrum bins */ + Word16 floorPowerSpectrum, /* i : lower limit for power spectrum bins */ const PsychoacousticParameters *psychParamsCurrent, - Word16 element_mode ); + Word16 element_mode +); ivas_error stereo_dft_dec_create_fx( - STEREO_DFT_DEC_DATA_HANDLE *hStereoDft, /* i/o: decoder DFT stereo handle */ - const Word32 element_brate, /* i : element bitrate */ - const Word32 output_Fs, /* i : output sampling rate */ - const Word16 sba_dirac_stereo_flag, /* i : signal stereo output for SBA DirAC */ - const Word16 nchan_transport /* i : number of transport channels */ + STEREO_DFT_DEC_DATA_HANDLE *hStereoDft, /* i/o: decoder DFT stereo handle */ + const Word32 element_brate, /* i : element bitrate */ + const Word32 output_Fs, /* i : output sampling rate */ + const Word16 sba_dirac_stereo_flag, /* i : signal stereo output for SBA DirAC */ + const Word16 nchan_transport /* i : number of transport channels */ ); void stereo_cng_init_dec_fx( - STEREO_CNG_DEC_HANDLE hStereoCng, /* i/o: stereo CNG decoder structure */ - const Word16 *frameSize /* i : pointer to frameSize of channel 0 to be used for channel 1 */ + STEREO_CNG_DEC_HANDLE hStereoCng, /* i/o: stereo CNG decoder structure */ + const Word16 *frameSize /* i : pointer to frameSize of channel 0 to be used for channel 1 */ ); ivas_error stereo_memory_dec_fx( - const Word32 ivas_total_brate, /* i : IVAS total bitrate */ - CPE_DEC_HANDLE hCPE, /* i : CPE decoder structure */ - const Word16 nb_bits_metadata, /* i : number of metadata bits */ - const Word32 output_Fs, /* i : output sampling rate */ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const MC_MODE mc_mode, /* i : MC mode */ - const Word16 nchan_transport /* i : number of transport channels*/ + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + CPE_DEC_HANDLE hCPE, /* i : CPE decoder structure */ + const Word16 nb_bits_metadata, /* i : number of metadata bits */ + const Word32 output_Fs, /* i : output sampling rate */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const MC_MODE mc_mode, /* i : MC mode */ + const Word16 nchan_transport /* i : number of transport channels */ ); void initFdCngDec_ivas_fx( - DEC_CORE_HANDLE st, /* i/o: decoder state structure */ - Word16 scale ); + DEC_CORE_HANDLE st, /* i/o: decoder state structure */ + Word16 scale +); -void ivas_initFdCngCom_fx( HANDLE_FD_CNG_COM hFdCngCom, Word16 scale ); +void ivas_initFdCngCom_fx( + HANDLE_FD_CNG_COM hFdCngCom, Word16 scale +); Word16 set_ACELP_flag_IVAS( - const Word16 element_mode, /* i : element mode */ - const Word32 element_brate, /* i : element bitrate */ - const Word32 total_brate, /* i : total bitrate per channel */ - const Word16 idchan, /* i : Channel id */ - const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */ - const Word16 bwidth, /* i : audio bandwidth */ - const Word16 cng_type /* i : CNG type */ + const Word16 element_mode, /* i : element mode */ + const Word32 element_brate, /* i : element bitrate */ + const Word32 total_brate, /* i : total bitrate per channel */ + const Word16 idchan, /* i : Channel id */ + const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */ + const Word16 bwidth, /* i : audio bandwidth */ + const Word16 cng_type /* i : CNG type */ ); void ivas_calc_c_p_coeffs_enc_fx( @@ -2058,7 +2094,8 @@ void ivas_calc_c_p_coeffs_enc_fx( const Word16 band_idx, const Word16 dtx_vad, const Word16 compute_p_flag, - const Word16 dyn_active_w_flag ); + const Word16 dyn_active_w_flag +); void ivas_calc_c_p_coeffs_fx( ivas_spar_md_t *pSparMd, @@ -2072,103 +2109,105 @@ void ivas_calc_c_p_coeffs_fx( const Word16 band_idx, const Word16 dtx_vad, const Word16 compute_p_flag, - const Word16 dyn_active_w_flag ); + const Word16 dyn_active_w_flag +); Word16 is_SIDrate( - const Word32 ivas_total_brate /* i : IVAS total bitrate */ + const Word32 ivas_total_brate /* i : IVAS total bitrate */ ); Word16 is_DTXrate( - const Word32 ivas_total_brate /* i : IVAS total bitrate */ + const Word32 ivas_total_brate /* i : IVAS total bitrate */ ); Word16 ivas_qmetadata_dereorder_generic_fx( - const UWord16 uns_value /* i : unsigned value result of ReorderGeneric */ + const UWord16 uns_value /* i : unsigned value result of ReorderGeneric */ ); void update_bits_next_block_fx( - IVAS_QDIRECTION *q_direction, /* i/o: qdirection */ - Word16 *p_diff, /* i/o: bits to be transferred */ - const Word16 j, /* i : subband to update bit alloc to*/ - const Word16 max_i, /* i : number of subbands */ - const Word16 max_k /* i : n umber of subframes */ + IVAS_QDIRECTION *q_direction, /* i/o: qdirection */ + Word16 *p_diff, /* i/o: bits to be transferred */ + const Word16 j, /* i : subband to update bit alloc to */ + const Word16 max_i, /* i : number of subbands */ + const Word16 max_k /* i : number of subframes */ ); UWord32 ivas_syn_output_fx( - Word32 *synth[], /* i/o: Word32 synthesis signal */ + Word32 *synth[], /* i/o: Word32 synthesis signal */ const Word16 q_synth, - const Word16 output_frame, /* i : output frame length (one channel) */ - const Word16 n_channels, /* i : number of output channels */ - Word16 *synth_out /* o : integer 16 bits synthesis signal */ + const Word16 output_frame, /* i : output frame length (one channel) */ + const Word16 n_channels, /* i : number of output channels */ + Word16 *synth_out /* o : integer 16 bits synthesis signal */ ); void stereo_tcx_core_dec_fx( - Decoder_State *st, /* i/o: decoder state structure */ - const FRAME_MODE frameMode, /* i : Decoder frame mode */ - Word16 *signal_out, /* o : synthesis @internal_Fs, Q0 */ - Word16 *signal_outFB, /* o : synthesis @output_Fs, Q0 */ - Word16 pitch_buf[], /* o : floating pitch for each subframe, Q6 */ - const Word16 sba_dirac_stereo_flag, /* i : signal stereo output for SBA DirAC */ - STEREO_TD_DEC_DATA_HANDLE hStereoTD, /* i/o: TD stereo decoder handle */ - const Word16 last_element_mode, /* i : last element mode */ - const Word16 flag_sec_CNA, /* i : CNA flag for secondary channel */ - STEREO_CNG_DEC_HANDLE hStereoCng, /* i : Stereo CNG handle */ - const Word16 nchan_out, /* i : number of output channels */ - const IVAS_FORMAT ivas_format /* i : IVAS format */ + Decoder_State *st, /* i/o: decoder state structure */ + const FRAME_MODE frameMode, /* i : Decoder frame mode */ + Word16 *signal_out, /* o : synthesis @internal_Fs, Q0 */ + Word16 *signal_outFB, /* o : synthesis @output_Fs, Q0 */ + Word16 pitch_buf[], /* o : floating pitch for each subframe, Q6 */ + const Word16 sba_dirac_stereo_flag, /* i : signal stereo output for SBA DirAC */ + STEREO_TD_DEC_DATA_HANDLE hStereoTD, /* i/o: TD stereo decoder handle */ + const Word16 last_element_mode, /* i : last element mode */ + const Word16 flag_sec_CNA, /* i : CNA flag for secondary channel */ + STEREO_CNG_DEC_HANDLE hStereoCng, /* i : Stereo CNG handle */ + const Word16 nchan_out, /* i : number of output channels */ + const IVAS_FORMAT ivas_format /* i : IVAS format */ ); void masa_compensate_two_dir_energy_ratio_index_fx( - const Word16 ratio_index_1, /* i : Input ratio for direction 1 */ - const Word16 ratio_index_2, /* i : Input ratio for direction 2 */ - Word16 *ratio_index_mod1, /* o : Output modified ratio for direction 1 */ - Word16 *ratio_index_mod2, /* o : Output modified ratio for direction 2 */ - const Word16 hodirac_flag /* i : flag to indicate HO-DirAC mode */ + const Word16 ratio_index_1, /* i : Input ratio for direction 1 */ + const Word16 ratio_index_2, /* i : Input ratio for direction 2 */ + Word16 *ratio_index_mod1, /* o : Output modified ratio for direction 1 */ + Word16 *ratio_index_mod2, /* o : Output modified ratio for direction 2 */ + const Word16 hodirac_flag /* i : flag to indicate HO-DirAC mode */ ); Word16 stereo_tdm_ener_analysis_fx( - const Word16 ivas_format, /* i : IVAS format */ - CPE_ENC_HANDLE hCPE, /* i : CPE structure */ - const Word16 input_frame, /* i : Number of samples */ - Word16 *tdm_SM_or_LRTD_Pri, /* o : channel combination scheme flag in TD stereo OR LRTD primary channel */ - Word16 *tdm_ratio_idx_SM /* o : TDM ratio index for SM mode */ + const Word16 ivas_format, /* i : IVAS format */ + CPE_ENC_HANDLE hCPE, /* i : CPE structure */ + const Word16 input_frame, /* i : Number of samples */ + Word16 *tdm_SM_or_LRTD_Pri, /* o : channel combination scheme flag in TD stereo OR LRTD primary channel */ + Word16 *tdm_ratio_idx_SM /* o : TDM ratio index for SM mode */ ); /*! r: projected azimuth index */ Word16 ivas_dirac_project_azimuth_index_fx( - const Word16 az_idx, /* i : azimuth index */ - const Word16 az_alph, /* i : number of azimuth symbols */ - const Word16 az_alph_proj /* i : size of projected alphabet */ + const Word16 az_idx, /* i : azimuth index */ + const Word16 az_alph, /* i : number of azimuth symbols */ + const Word16 az_alph_proj /* i : size of projected alphabet */ ); /*! r: projected elevation index */ Word16 ivas_dirac_project_elevation_index_fx( - const Word16 el_idx, /* i : elevation index */ - const Word16 el_alph, /* i : number of elevation symbols */ - const Word16 el_alph_proj /* i : size of projected alphabet */ + const Word16 el_idx, /* i : elevation index */ + const Word16 el_alph, /* i : number of elevation symbols */ + const Word16 el_alph_proj /* i : size of projected alphabet */ ); /*! r: projected index in channel mode */ Word16 ivas_chan_project_elevation_index_fx( - const Word16 el_idx, /* i : elevation index */ - const Word16 el_alph, /* i : number of elevation symbols */ - const Word16 el_alph_proj /* i : size of projected alphabet */ + const Word16 el_idx, /* i : elevation index */ + const Word16 el_alph, /* i : number of elevation symbols */ + const Word16 el_alph_proj /* i : size of projected alphabet */ ); void small_reduction_direction_fx( - IVAS_QDIRECTION *q_direction, /* i/o: quantized direction structure */ + IVAS_QDIRECTION *q_direction, /* i/o: quantized direction structure */ UWord16 bits_dir[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], const Word16 raw_flag[MASA_MAXIMUM_CODING_SUBBANDS], - Word16 *diff ); + Word16 *diff +); void sort_desc_ind_32_fx( - Word32 *s, /* i/o: vector to be sorted Qx*/ - const Word16 len, /* i : vector length */ - Word16 *ind /* o : array of indices */ + Word32 *s, /* i/o: vector to be sorted Qx*/ + const Word16 len, /* i : vector length */ + Word16 *ind /* o : array of indices */ ); ivas_error only_reduce_bits_direction_fx( Word16 *reduce_bits_out, - IVAS_QDIRECTION *q_direction, /* i/o: quantized direction structure */ + IVAS_QDIRECTION *q_direction, /* i/o: quantized direction structure */ Word16 reduce_bits, const Word16 coding_subbands, const Word16 no_subframes, @@ -2176,89 +2215,90 @@ ivas_error only_reduce_bits_direction_fx( ); void ivas_qmetadata_azimuth_elevation_to_direction_vector_fx( - const Word32 az, /* i : azimuth Q22 */ - const Word32 el, /* i : elevation Q22 */ - Word32 *dv /* o : direction vector Q30 */ + const Word32 az, /* i : azimuth Q22 */ + const Word32 el, /* i : elevation Q22 */ + Word32 *dv /* o : direction vector Q30 */ ); void ivas_qmetadata_direction_vector_to_azimuth_elevation_fx( - const Word32 *dv, /* i : direction vector */ + const Word32 *dv, /* i : direction vector */ const Word16 div_q, - Word32 *az, /* o : azimuth */ - Word32 *el /* o : elevation */ + Word32 *az, /* o : azimuth */ + Word32 *el /* o : elevation */ ); ivas_error ivas_qmetadata_open_fx( - IVAS_QMETADATA_HANDLE *hQMetaData /* i/o: q_metadata handle */ + IVAS_QMETADATA_HANDLE *hQMetaData /* i/o: q_metadata handle */ ); ivas_error ivas_qmetadata_allocate_memory_fx( - IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ - const Word16 nbands, /* i : new number of frequency bands */ - const Word16 ndirs, /* i : new number of directions */ - const Word16 coherence_flag /* i : new coherence coding status */ + IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ + const Word16 nbands, /* i : new number of frequency bands */ + const Word16 ndirs, /* i : new number of directions */ + const Word16 coherence_flag /* i : new coherence coding status */ ); void ivas_qmetadata_close_fx( - IVAS_QMETADATA_HANDLE *hQMetaData /* i/o: q_metadata handle */ + IVAS_QMETADATA_HANDLE *hQMetaData /* i/o: q_metadata handle */ ); ivas_error ivas_spar_dec_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ - Word16 *nb_bits_read /* o : number of MD bits read */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ + Word16 *nb_bits_read /* o : number of MD bits read */ ); void ivas_spar_md_dec_process_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - Decoder_State *st0, /* i/o: decoder state structure - for bitstream handling */ - const Word16 num_bands_out, /* i : number of output bands */ - const Word16 sba_order /* i : Ambisonic (SBA) order */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + Decoder_State *st0, /* i/o: decoder state structure - for bitstream handling */ + const Word16 num_bands_out, /* i : number of output bands */ + const Word16 sba_order /* i : Ambisonic (SBA) order */ ); ivas_error TDREND_Update_object_positions_fx( - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD Renderer handle */ - const Word16 num_src, /* i : number of sources to render */ - const IVAS_FORMAT in_format, /* i : Format of input sources */ - const ISM_METADATA_HANDLE *hIsmMetaData /* i : Input metadata for ISM objects */ + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD Renderer handle */ + const Word16 num_src, /* i : number of sources to render */ + const IVAS_FORMAT in_format, /* i : Format of input sources */ + const ISM_METADATA_HANDLE *hIsmMetaData /* i : Input metadata for ISM objects */ ); ivas_error TDREND_MIX_LIST_SetOrient_fx( - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ - const Word32 *FrontVec_p_fx, /* i : Listener's orientation front vector */ - const Word32 *UpVec_p_fx, /* i : Listener's orientation up vector */ - const Word16 orient_q ); + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ + const Word32 *FrontVec_p_fx, /* i : Listener's orientation front vector */ + const Word32 *UpVec_p_fx, /* i : Listener's orientation up vector */ + const Word16 orient_q +); void TDREND_MIX_LIST_SetPos_fx( - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ - const Word32 *Pos_p /* i : Listener's position */ + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ + const Word32 *Pos_p /* i : Listener's position */ ); ivas_error TDREND_Update_listener_orientation_fx( - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD Renderer handle */ - const Word16 headRotEnabled, /* i : Headrotation flag */ - const IVAS_QUATERNION *headPosition_fx, /* i : Listener orientation */ - const IVAS_VECTOR3 *Pos_fx /* i : Listener Position */ + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD Renderer handle */ + const Word16 headRotEnabled, /* i : Headrotation flag */ + const IVAS_QUATERNION *headPosition_fx, /* i : Listener orientation */ + const IVAS_VECTOR3 *Pos_fx /* i : Listener Position */ ); void QuatToRotMat_fx( - const IVAS_QUATERNION quat, /* i : quaternion describing the rotation Qx */ - Word32 Rmat[3][3] /* o : real-space rotation matrix for this rotation 2*Qx-32 */ + const IVAS_QUATERNION quat, /* i : quaternion describing the rotation Qx */ + Word32 Rmat[3][3] /* o : real-space rotation matrix for this rotation 2*Qx-32 */ ); Word32 TDREND_SPATIAL_VecNorm_fx( - const Word32 *Vec_p, /* i : Vector for norm calculation */ - const Word16 in_exp, /* i : Input exp */ - Word16 *out_exp /* o : Output exp */ + const Word32 *Vec_p, /* i : Vector for norm calculation */ + const Word16 in_exp, /* i : Input exp */ + Word16 *out_exp /* o : Output exp */ ); void TDREND_SPATIAL_VecMapToNewCoordSystem_fx( - const Word32 *Vec_p, /* i : Input vector */ - const Word32 *TranslVec_p, /* i : Translation vector */ - const Word32 *DirVec_p, /* i : Direction vector */ - const Word32 *UpVec_p, /* i : Up vector */ - const Word32 *RightVec_p, /* i : Right vector */ - Word32 *MappedVec_p, /* o : Transformed vector */ - Word32 *LisRelPosAbs /* o : Transformed vector ignoring orientation */ + const Word32 *Vec_p, /* i : Input vector */ + const Word32 *TranslVec_p, /* i : Translation vector */ + const Word32 *DirVec_p, /* i : Direction vector */ + const Word32 *UpVec_p, /* i : Up vector */ + const Word32 *RightVec_p, /* i : Right vector */ + Word32 *MappedVec_p, /* o : Transformed vector */ + Word32 *LisRelPosAbs /* o : Transformed vector ignoring orientation */ ); void ivas_mct_side_bits_fx( @@ -2342,7 +2382,7 @@ void ivas_dirac_dec_read_BS_fx( const Word16 last_bit_pos, /* i : last read bitstream position */ const Word16 hodirac_flag, /* i : flag to indicate HO-DirAC mode */ const Word16 nchan_transport, /* i : number of transport channels */ - Word16 *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ + Word16 *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ ); ivas_error ivas_dirac_dec_config_fx( @@ -2479,177 +2519,184 @@ void ivas_fb_mixer_cross_fading_fx( const Word16 cf_offset ); -// ivas_omasa_dec.c ivas_error ivas_omasa_dirac_td_binaural_jbm_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const UWord16 nSamplesAsked, /* i : number of samples requested */ - UWord16 *nSamplesRendered, /* o : number of samples rendered */ - UWord16 *nSamplesAvailable, /* o : number of samples still to render */ - const Word16 nchan_transport, /* i : number of transport channels */ - Word32 *output_fx[] /* o : rendered time signal */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const UWord16 nSamplesAsked, /* i : number of samples requested */ + UWord16 *nSamplesRendered, /* o : number of samples rendered */ + UWord16 *nSamplesAvailable, /* o : number of samples still to render */ + const Word16 nchan_transport, /* i : number of transport channels */ + Word32 *output_fx[] /* o : rendered time signal */ ); Word16 ivas_sba_get_analysis_order_fx( - const Word32 ivas_total_brate, /* i : IVAS total bitrate */ - const Word16 sba_order /* i : Ambisonic (SBA) order */ + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + const Word16 sba_order /* i : Ambisonic (SBA) order */ ); Word16 ivas_sba_get_nchan_metadata_fx( - const Word16 sba_order, /* i : Ambisonic (SBA) order */ - const Word32 ivas_total_brate /* i : IVAS total bitrate */ + const Word16 sba_order, /* i : Ambisonic (SBA) order */ + const Word32 ivas_total_brate /* i : IVAS total bitrate */ ); /*! r: number of bits in SBQ SID frame */ Word16 ivas_sba_spar_sid_bitlen_fx( - const Word16 nchan_transport /* i : number of transport channels */ + const Word16 nchan_transport /* i : number of transport channels */ ); void ivas_sba_get_spar_hoa_ch_ind_fx( - const Word16 num_md_chs, /* i : number of MD channels */ - const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + const Word16 num_md_chs, /* i : number of MD channels */ + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ Word16 HOA_md_ind[IVAS_SPAR_MAX_CH] ); void ivas_sba_get_spar_hoa_md_flag_fx( - const Word16 sba_order, /* i : Ambisonic (SBA) order */ - const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + const Word16 sba_order, /* i : Ambisonic (SBA) order */ + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ Word16 *spar_hoa_md_flag, Word16 *spar_hoa_dirac2spar_md_flag ); void ivas_omasa_dirac_rend_jbm_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const UWord16 nSamplesAsked, /* i : number of samples requested */ - UWord16 *nSamplesRendered, /* o : number of samples rendered */ - UWord16 *nSamplesAvailable, /* o : number of samples still to render */ - const Word16 nchan_transport, /* i : number of transport channels */ - Word32 *output_f[] /* o : rendered time signal */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const UWord16 nSamplesAsked, /* i : number of samples requested */ + UWord16 *nSamplesRendered, /* o : number of samples rendered */ + UWord16 *nSamplesAvailable, /* o : number of samples still to render */ + const Word16 nchan_transport, /* i : number of transport channels */ + Word32 *output_f[] /* o : rendered time signal */ ); ivas_error ivas_jbm_dec_render_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const UWord16 nSamplesAsked, /* i : number of samples wanted */ - UWord16 *nSamplesRendered, /* o : number of samples rendered */ - UWord16 *nSamplesAvailableNext, /* o : number of samples still available in the rendering pipeline */ - Word16 *data /* o : output synthesis signal */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const UWord16 nSamplesAsked, /* i : number of samples wanted */ + UWord16 *nSamplesRendered, /* o : number of samples rendered */ + UWord16 *nSamplesAvailableNext, /* o : number of samples still available in the rendering pipeline */ + Word16 *data /* o : output synthesis signal */ ); void ivas_sba_zero_vert_comp_fx( - Word32 *sba_data[], /* i : SBA signals */ - const Word16 sba_order, /* i : SBA order */ - const Word16 sba_planar, /* i : SBA planar flag */ - const Word16 input_frame /* i : frame length */ + Word32 *sba_data[], /* i : SBA signals */ + const Word16 sba_order, /* i : SBA order */ + const Word16 sba_planar, /* i : SBA planar flag */ + const Word16 input_frame /* i : frame length */ ); /*! r: MC format mode (MCT, McMASA, ParamMC) */ MC_MODE ivas_mc_mode_select_fx( - const MC_LS_SETUP mc_ls_setup, /* i : MC loudspeaker setup */ - const Word32 total_brate /* i : IVAS total bitrate */ + const MC_LS_SETUP mc_ls_setup, /* i : MC loudspeaker setup */ + const Word32 total_brate /* i : IVAS total bitrate */ ); /*! r: number of loudspeaker channels */ Word16 ivas_mc_ls_setup_get_num_channels_fx( - const MC_LS_SETUP mc_ls_setup /* i : loudspeaker setup (CICP) */ + const MC_LS_SETUP mc_ls_setup /* i : loudspeaker setup (CICP) */ ); /*! r: multi channel loudspeaker setup */ MC_LS_SETUP ivas_mc_map_output_config_to_mc_ls_setup_fx( - const AUDIO_CONFIG output_config /* i : output audio configuration */ + const AUDIO_CONFIG output_config /* i : output audio configuration */ ); /*! r: output configuration */ AUDIO_CONFIG ivas_mc_map_ls_setup_to_output_config_fx( - const MC_LS_SETUP mc_ls_setup /* i : multi channel loudspeaker setup*/ + const MC_LS_SETUP mc_ls_setup /* i : multi channel loudspeaker setup */ ); void ivas_wrap_arround_fx( Word16 *pArr, const Word16 min_val, const Word16 max_val, - const Word16 length ); + const Word16 length +); void ivas_get_cum_freq_model_fx( const Word16 *pFreq_model, const Word16 length, - Word16 *pCum_freq_model ); + Word16 *pCum_freq_model +); Word16 ivas_map_num_pred_r_to_idx_fx( const Word16 num_quant_points_pred_r, - const Word16 active_w_flag ); + const Word16 active_w_flag +); Word16 ivas_map_num_drct_r_to_idx_fx( - const Word16 num_quant_points_drct_r ); + const Word16 num_quant_points_drct_r +); Word16 ivas_map_num_decd_r_to_idx_fx( - const Word16 num_quant_points_decd_r ); + const Word16 num_quant_points_decd_r +); void ivas_spar_arith_coeffs_com_init_fx( ivas_arith_coeffs_t *pArith_coeffs, ivas_spar_md_com_cfg *pSpar_cfg, const Word16 table_idx, - const Word16 enc_dec ); + const Word16 enc_dec +); void ivas_spar_huff_coeffs_com_init_fx( ivas_huff_coeffs_t *pHuff_coeffs, ivas_spar_md_com_cfg *pSpar_cfg, const Word16 table_idx, - const Word16 enc_dec ); + const Word16 enc_dec +); ISM_MODE ivas_omasa_ism_mode_select_fx( - const Word32 ivas_total_brate, /* i : IVAS total bitrate */ - const Word16 nchan_ism /* i : number of input ISM's */ + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + const Word16 nchan_ism /* i : number of input ISM's */ ); void ivas_set_omasa_TC_fx( - const ISM_MODE ism_mode, /* i : ISM mode */ - const Word16 nchan_ism, /* i : number of input ISMs */ - Word16 *nSCE, /* o : number of SCEs */ - Word16 *nCPE /* o : number of CPEs */ + const ISM_MODE ism_mode, /* i : ISM mode */ + const Word16 nchan_ism, /* i : number of input ISMs */ + Word16 *nSCE, /* o : number of SCEs */ + Word16 *nCPE /* o : number of CPEs */ ); Word32 ivas_interformat_brate_fx( - const ISM_MODE ism_mode, /* i : ISM mode */ - const Word16 nchan_ism, /* i : number of ISM channels */ - const Word32 element_brate, /* i : element bitrate */ - const Word16 ism_imp, /* i : ISM importance flag */ - const Word16 limit_flag /* i : flag to limit the bitrate increase */ + const ISM_MODE ism_mode, /* i : ISM mode */ + const Word16 nchan_ism, /* i : number of ISM channels */ + const Word32 element_brate, /* i : element bitrate */ + const Word16 ism_imp, /* i : ISM importance flag */ + const Word16 limit_flag /* i : flag to limit the bitrate increase */ ); Word16 check_bounds_s_fx( - const Word16 value, /* i : Input value */ - const Word16 low, /* i : Low limit */ - const Word16 high /* i : High limit */ + const Word16 value, /* i : Input value */ + const Word16 low, /* i : Low limit */ + const Word16 high /* i : High limit */ ); void ivas_combined_format_brate_sanity_fx( - const Word32 element_brate, /* i : element bitrate */ - const Word16 core, /* i : core */ - const Word32 total_brate, /* i : total bitrate */ - Word32 *core_brate, /* i/o: core bitrate */ - Word16 *inactive_coder_type_flag, /* o : inactive coder_type flag */ - Word16 *diff_nBits /* o : number of differential bits */ + const Word32 element_brate, /* i : element bitrate */ + const Word16 core, /* i : core */ + const Word32 total_brate, /* i : total bitrate */ + Word32 *core_brate, /* i/o: core bitrate */ + Word16 *inactive_coder_type_flag, /* o : inactive coder_type flag */ + Word16 *diff_nBits /* o : number of differential bits */ ); Word16 bits_index_ism_ratio_fx( - const Word16 nchan_ism /* i : number of objects */ + const Word16 nchan_ism /* i : number of objects */ ); Word16 calculate_brate_limit_flag_fx( - const Word16 ism_imp[], /* i : ISM importance flags */ - const Word16 nchan_ism /* i : number of objects */ + const Word16 ism_imp[], /* i : ISM importance flags */ + const Word16 nchan_ism /* i : number of objects */ ); + Word16 ism_quant_meta_fx( - const Word32 val, /* i : scalar value to quantize Q22 */ - Word32 *valQ, /* o : quantized value Q22 */ - const Word32 borders_fx[], /* i : level borders Q22 */ - const Word32 q_step_fx, /* i : quantization step Q22 */ - const Word32 q_step_border_fx, /* i : quantization step at the border Q22 */ - const Word16 cbsize /* i : codebook size */ + const Word32 val, /* i : scalar value to quantize Q22 */ + Word32 *valQ, /* o : quantized value Q22 */ + const Word32 borders_fx[], /* i : level borders Q22 */ + const Word32 q_step_fx, /* i : quantization step Q22 */ + const Word32 q_step_border_fx, /* i : quantization step at the border Q22 */ + const Word16 cbsize /* i : codebook size */ ); /*! r: number of channels to be analysed */ Word16 getNumChanAnalysis_fx( - Encoder_Struct *st_ivas /* i : IVAS encoder structure */ + Encoder_Struct *st_ivas /* i : IVAS encoder structure */ ); @@ -2657,65 +2704,39 @@ Word16 getNumChanAnalysis_fx( * Limiter prototypes *----------------------------------------------------------------------------------*/ -void ivas_limiter_close( - IVAS_LIMITER_HANDLE *phLimiter /* i/o: pointer to limiter handle, can be NULL */ -); - void ivas_limiter_dec_fx( - IVAS_LIMITER_HANDLE hLimiter, /* i/o: limiter struct handle */ - Word32 *output[MAX_OUTPUT_CHANNELS], /* i/o: input/output buffer */ - const Word16 num_channels, /* i : number of channels to be processed */ - const Word16 output_frame, /* i : number of samples per channel in the buffer */ - const Word16 BER_detect, /* i : BER detect flag */ - Word16 q_factor /* i : Q factor of the output samples */ + IVAS_LIMITER_HANDLE hLimiter, /* i/o: limiter struct handle */ + Word32 *output[MAX_OUTPUT_CHANNELS], /* i/o: input/output buffer */ + const Word16 num_channels, /* i : number of channels to be processed */ + const Word16 output_frame, /* i : number of samples per channel in the buffer */ + const Word16 BER_detect, /* i : BER detect flag */ + Word16 q_factor /* i : Q factor of the output samples */ ); void limiter_process_fx( - IVAS_LIMITER_HANDLE hLimiter, /* i/o: limiter struct handle */ - const Word16 output_frame, /* i : number of samples to be processed per channel in the I/O buffer */ - const Word32 threshold, /* i : signal amplitude above which limiting starts to be applied */ - const Word16 BER_detect, /* i : BER detect flag */ - Word16 *strong_saturation_cnt, /* i/o: counter of strong saturations (can be NULL) */ - Word16 q_factor /* i : Q factor of output samples */ + IVAS_LIMITER_HANDLE hLimiter, /* i/o: limiter struct handle */ + const Word16 output_frame, /* i : number of samples to be processed per channel in the I/O buffer */ + const Word32 threshold, /* i : signal amplitude above which limiting starts to be applied */ + const Word16 BER_detect, /* i : BER detect flag */ + Word16 *strong_saturation_cnt, /* i/o: counter of strong saturations (can be NULL) */ + Word16 q_factor /* i : Q factor of output samples */ ); ivas_error ivas_limiter_open_fx( - IVAS_LIMITER_HANDLE *hLimiter_out, /* o : limiter struct handle */ - const Word16 max_num_channels, /* i : maximum number of I/O channels to be processed */ - const Word32 sampling_rate /* i : sampling rate for processing */ + IVAS_LIMITER_HANDLE *hLimiter_out, /* o : limiter struct handle */ + const Word16 max_num_channels, /* i : maximum number of I/O channels to be processed */ + const Word32 sampling_rate /* i : sampling rate for processing */ ); void ivas_limiter_close_fx( - IVAS_LIMITER_HANDLE *phLimiter /* i/o: pointer to limiter handle, can be NULL */ + IVAS_LIMITER_HANDLE *phLimiter /* i/o: pointer to limiter handle, can be NULL */ ); void copy_masa_descriptive_meta_fx( - MASA_DECRIPTIVE_META *outMeta, /* o : metadata to be written */ - MASA_DECRIPTIVE_META *inMeta /* i : input metadata */ + MASA_DECRIPTIVE_META *outMeta, /* o : metadata to be written */ + MASA_DECRIPTIVE_META *inMeta /* i : input metadata */ ); -void efap_free_data_fx( - EFAP_HANDLE *hEFAPdata /* i/o: EFAP handle to be freed */ -); - -void tdm_SCh_LSF_intra_pred_fx( - const Word32 element_brate, /* i : element bitrate */ - const Word16 *tdm_lsfQ_PCh_fx, /* i : primary channel LSFs */ - Word16 *pred_lsf_SCh_fx /* o : predicted secondary channel LSFs */ -); - -ivas_error ivas_create_lfe_lpf_enc_fx( - ivas_filters_process_state_t **hLfeLpf, /* o : LFE LPF handle */ - const Word32 input_Fs /* i : input sampling rate */ -); - -void ivas_lfe_lpf_enc_apply_fx( - ivas_filters_process_state_t *hLfeLpf, /* i/o: LFE LPF handle */ - Word32 data_lfe_ch[], /* i/o: LFE signal */ - const Word16 input_frame /* i : input frame length per channel */ -); - -// ivas_arith.c void ivas_ari_done_encoding_14bits_fx( BSTR_ENC_HANDLE hBstr, Tastat *s @@ -2729,152 +2750,150 @@ void ivas_ari_encode_14bits_ext_fx( ); void ms_inv_mask_processing_fx( - STEREO_MDCT_ENC_DATA_HANDLE hStereoMdct, /* i/o: MDCT encoder structure */ - Encoder_State **sts, /* i/o: Encoder state structure */ - Word16 ms_mask[NB_DIV][MAX_SFB], /* i : bandwise MS mask */ - const Word16 iSubframe, /* i : subframe number */ - const Word32 x_0_fx[], /* i : spectrum 1 */ - const Word32 x_1_fx[], /* i : spectrum 2 */ - Word32 x_inv_0_fx[], /* o : inverse spectrum 1 */ - Word32 x_inv_1_fx[], /* o : inverse spectrum 2 */ - Word16 maxSfb /* i : number of stereo frequency bands */ + STEREO_MDCT_ENC_DATA_HANDLE hStereoMdct, /* i/o: MDCT encoder structure */ + Encoder_State **sts, /* i/o: Encoder state structure */ + Word16 ms_mask[NB_DIV][MAX_SFB], /* i : bandwise MS mask */ + const Word16 iSubframe, /* i : subframe number */ + const Word32 x_0_fx[], /* i : spectrum 1 */ + const Word32 x_1_fx[], /* i : spectrum 2 */ + Word32 x_inv_0_fx[], /* o : inverse spectrum 1 */ + Word32 x_inv_1_fx[], /* o : inverse spectrum 2 */ + Word16 maxSfb /* i : number of stereo frequency bands */ ); void ms_processing_fx( - STEREO_MDCT_ENC_DATA_HANDLE hStereoMdct, /* i/o: Stereo MDCT encoder structure */ - Encoder_State **sts, /* i/o: Encoder state structure */ - Word16 ms_mask[NB_DIV][MAX_SFB], /* i : bandwise MS mask */ - const Word16 iSubframe, /* i : subframe number */ - Word32 x_0_fx[], /* i/o: spectrum 1 */ - Word32 x_1_fx[], /* i/o: spectrum 1 */ - Word16 maxSfb /* i : number of stereo frequency bands*/ + STEREO_MDCT_ENC_DATA_HANDLE hStereoMdct, /* i/o: Stereo MDCT encoder structure */ + Encoder_State **sts, /* i/o: Encoder state structure */ + Word16 ms_mask[NB_DIV][MAX_SFB], /* i : bandwise MS mask */ + const Word16 iSubframe, /* i : subframe number */ + Word32 x_0_fx[], /* i/o: spectrum 1 */ + Word32 x_1_fx[], /* i/o: spectrum 1 */ + Word16 maxSfb /* i : number of stereo frequency bands */ ); void convertToMS_fx( - const Word16 L_frame, /* i : frame length */ - Word32 x0[], /* i/o: mid/left channel coefficients */ - Word32 x1[], /* i/o: side/right channel coefficients */ - const Word32 norm_fac /* i : normalization factor */ + const Word16 L_frame, /* i : frame length */ + Word32 x0[], /* i/o: mid/left channel coefficients */ + Word32 x1[], /* i/o: side/right channel coefficients */ + const Word32 norm_fac /* i : normalization factor */ ); void FindSplitRatio_fx( - CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ - Encoder_State **sts /* i/o: Encoder state structure */ + CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ + Encoder_State **sts /* i/o: Encoder state structure */ ); void IGFEncStereoEncoder_fx( - STEREO_MDCT_BAND_PARAMETERS *sfbParam, /* i/o: sfb parameters for the right channel */ - const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i : IGF handle */ - const Word32 *mdctSpectrumL_fx, /* i : left spectrum */ - const Word32 *mdctSpectrumR_fx, /* i : right spectrum */ + STEREO_MDCT_BAND_PARAMETERS *sfbParam, /* i/o: sfb parameters for the right channel */ + const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i : IGF handle */ + const Word32 *mdctSpectrumL_fx, /* i : left spectrum */ + const Word32 *mdctSpectrumR_fx, /* i : right spectrum */ Word16 q_mdctSpectrum, - Word16 *msMask, /* i/o: MS mask */ - Word16 *igfStereoMode, /* o : IGF stereo mode */ - const Word16 mdct_stereo_mode, /* i : MDCT stereo mode */ - const Word16 isTCX20, /* i : flag for indicating TCX20 */ - const Word16 isTransition /* i : flag for transtition */ + Word16 *msMask, /* i/o: MS mask */ + Word16 *igfStereoMode, /* o : IGF stereo mode */ + const Word16 mdct_stereo_mode, /* i : MDCT stereo mode */ + const Word16 isTCX20, /* i : flag for indicating TCX20 */ + const Word16 isTransition /* i : flag for transtition */ ); void stereo_coder_tcx_fx( - STEREO_MDCT_ENC_DATA_HANDLE hStereoMdct, /* i/o: Stereo MDCT encoder structure */ - Encoder_State **sts, /* i/o: encoder state structure */ - Word16 ms_mask[NB_DIV][MAX_SFB], /* i : bandwise MS mask */ - Word32 *mdst_spectrum_fx[CPE_CHANNELS][NB_DIV], /* i/o: MDST spectrum */ - Word32 *inv_spectrum_fx[CPE_CHANNELS][NB_DIV], /* i/o: inverse spectrum */ - Word32 *inv_mdst_spectrum_fx[CPE_CHANNELS][NB_DIV], /* i/o: inverse MDST spectrum */ - const Word16 mct_on, /* i : flag mct block (1) or stereo (0) */ + STEREO_MDCT_ENC_DATA_HANDLE hStereoMdct, /* i/o: Stereo MDCT encoder structure */ + Encoder_State **sts, /* i/o: encoder state structure */ + Word16 ms_mask[NB_DIV][MAX_SFB], /* i : bandwise MS mask */ + Word32 *mdst_spectrum_fx[CPE_CHANNELS][NB_DIV], /* i/o: MDST spectrum */ + Word32 *inv_spectrum_fx[CPE_CHANNELS][NB_DIV], /* i/o: inverse spectrum */ + Word32 *inv_mdst_spectrum_fx[CPE_CHANNELS][NB_DIV], /* i/o: inverse MDST spectrum */ + const Word16 mct_on, /* i : flag mct block (1) or stereo (0) */ Word16 exp_spec, - Word16 exp_mdst_spec ); + Word16 exp_mdst_spec +); -// bw_detect_fx.c Word16 set_bw_mct_fx( - CPE_ENC_HANDLE hCPE[MCT_MAX_BLOCKS], /* i/o: CPE encoder structures */ - const Word16 nCPE /* i : number of CPEs */ + CPE_ENC_HANDLE hCPE[MCT_MAX_BLOCKS], /* i/o: CPE encoder structures */ + const Word16 nCPE /* i : number of CPEs */ ); - -// ivas_mct_enc_mct.c void write_mct_bitstream_fx( - Encoder_State **sts, /* i/o: encoder state structure */ - MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ - const Word16 nchan /* i : number of channels */ + Encoder_State **sts, /* i/o: encoder state structure */ + MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ + const Word16 nchan /* i : number of channels */ ); void getChannelEnergies_fx( - Encoder_State **sts, /* i/o: Encoder state structure */ - Word32 nrg[MCT_MAX_CHANNELS], /* o : buffer with energies for each channel */ - Word16 nrg_e[MCT_MAX_CHANNELS], /* o : exponents of energies for each channel */ - const Word16 nchan /* i : number of channels */ + Encoder_State **sts, /* i/o: Encoder state structure */ + Word32 nrg[MCT_MAX_CHANNELS], /* o : buffer with energies for each channel */ + Word16 nrg_e[MCT_MAX_CHANNELS], /* o : exponents of energies for each channel */ + const Word16 nchan /* i : number of channels */ ); void apply_MCT_enc_fx( - MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ - Encoder_State **sts, /* i/o: encoder state structure */ - Word32 *mdst_spectrum[MCT_MAX_CHANNELS][NB_DIV], /* i/o: MDST spectrum */ - Word32 *inv_spectrum[MCT_MAX_CHANNELS][NB_DIV], /* i/o: inverse spectrum */ - Word32 *inv_mdst_spectrum[MCT_MAX_CHANNELS][NB_DIV], /* i/o: inverse MDST spectrum */ - const Word16 nchan /* i : number of channels */ + MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ + Encoder_State **sts, /* i/o: encoder state structure */ + Word32 *mdst_spectrum[MCT_MAX_CHANNELS][NB_DIV], /* i/o: MDST spectrum */ + Word32 *inv_spectrum[MCT_MAX_CHANNELS][NB_DIV], /* i/o: inverse spectrum */ + Word32 *inv_mdst_spectrum[MCT_MAX_CHANNELS][NB_DIV], /* i/o: inverse MDST spectrum */ + const Word16 nchan /* i : number of channels */ ); void ivas_spar_config_fx( - Word32 ivas_total_brate, /* i : codec total bitrate */ - const Word16 sba_order, /* i : Ambisonic (SBA) order */ - Word16 *nchan_transport, /* o : number of transport channels */ - Word16 *nSCE, /* o : number of SCEs */ - Word16 *nCPE, /* o : number of CPEs */ - Word32 *core_nominal_brate, /* o : core-coding nominal bitrate */ - const Word16 sid_format /* i : IVAS format indicator from SID frame */ + Word32 ivas_total_brate, /* i : codec total bitrate */ + const Word16 sba_order, /* i : Ambisonic (SBA) order */ + Word16 *nchan_transport, /* o : number of transport channels */ + Word16 *nSCE, /* o : number of SCEs */ + Word16 *nCPE, /* o : number of CPEs */ + Word32 *core_nominal_brate, /* o : core-coding nominal bitrate */ + const Word16 sid_format /* i : IVAS format indicator from SID frame */ ); Word16 ivas_get_bw_idx_from_sample_rate_fx( - const Word32 sampling_rate /* i : sampling rate */ + const Word32 sampling_rate /* i : sampling rate */ ); void ivas_spar_bitrate_dist_fx( - Word32 core_brates_act[], /* o : bitrates per core-coder */ - const Word16 nAvailBits, /* i : number of available bits */ - const Word32 ivas_total_brate, /* i : IVAS total bitrate */ - const Word16 sba_order, /* i : Ambisonic (SBA) order */ - const Word16 bwidth /* i : audio bandwidth */ + Word32 core_brates_act[], /* o : bitrates per core-coder */ + const Word16 nAvailBits, /* i : number of available bits */ + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + const Word16 sba_order, /* i : Ambisonic (SBA) order */ + const Word16 bwidth /* i : audio bandwidth */ ); ivas_error ivas_corecoder_enc_reconfig_fx( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ - const Word16 nSCE_old, /* i : number of SCEs in previous frame */ - const Word16 nCPE_old, /* i : number of CPEs in previous frame */ - const Word16 nchan_transport_old, /* i : number of TCs in previous frame */ - const Word32 brate_SCE, /* i : bitrate to be set for the SCEs */ - const Word32 brate_CPE, /* i : bitrate to be set for the CPEs */ - const MC_MODE last_mc_mode /* i : switching between MC modes: last mode */ + Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ + const Word16 nSCE_old, /* i : number of SCEs in previous frame */ + const Word16 nCPE_old, /* i : number of CPEs in previous frame */ + const Word16 nchan_transport_old, /* i : number of TCs in previous frame */ + const Word32 brate_SCE, /* i : bitrate to be set for the SCEs */ + const Word32 brate_CPE, /* i : bitrate to be set for the CPEs */ + const MC_MODE last_mc_mode /* i : switching between MC modes: last mode */ ); void ivas_sba_zero_vert_comp_fx( - Word32 *sba_data[], /* i : SBA signals */ - const Word16 sba_order, /* i : SBA order */ - const Word16 sba_planar, /* i : SBA planar flag */ - const Word16 input_frame /* i : frame length */ + Word32 *sba_data[], /* i : SBA signals */ + const Word16 sba_order, /* i : SBA order */ + const Word16 sba_planar, /* i : SBA planar flag */ + const Word16 input_frame /* i : frame length */ ); void tdm_configure_dec_fx( - const Word16 ivas_format, /* i : IVAS format */ - const Word16 ism_mode, /* i : ISM mode in combined format */ - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - Word16 *tdm_ratio_idx, /* o : ratio index */ - const Word16 nb_bits_metadata /* i : number of metadata bits */ + const Word16 ivas_format, /* i : IVAS format */ + const Word16 ism_mode, /* i : ISM mode in combined format */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + Word16 *tdm_ratio_idx, /* o : ratio index */ + const Word16 nb_bits_metadata /* i : number of metadata bits */ ); void ivas_param_mc_metadata_open_fx( - const MC_LS_SETUP mc_ls_setup, /* i : MC ls setup */ - const Word32 ivas_total_brate, /* i : IVAS total bitrate */ - HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC /* o : handle for the Parametric MC parameter coding state */ + const MC_LS_SETUP mc_ls_setup, /* i : MC ls setup */ + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC /* o : handle for the Parametric MC parameter coding state */ ); Word16 mdct_classifier_ivas_fx( - Encoder_State *st, /* i/o: Encoder state variable */ - const Word16 *fft_buff, /* i : FFT spectrum from fft_rel */ - const Word32 enerBuffer[], /* i : energy buffer */ - Word16 enerBuffer_exp, /* i: enenrgy buffer exponent */ - const Word32 brate /* i : current brate, IVAS: nominal bitrate, EVS: st->total_brate */ + Encoder_State *st, /* i/o: Encoder state variable */ + const Word16 *fft_buff, /* i : FFT spectrum from fft_rel */ + const Word32 enerBuffer[], /* i : energy buffer */ + Word16 enerBuffer_exp, /* i: enenrgy buffer exponent */ + const Word32 brate /* i : current brate, IVAS: nominal bitrate, EVS: st->total_brate */ ); @@ -2883,105 +2902,106 @@ Word16 mdct_classifier_ivas_fx( *----------------------------------------------------------------------------------*/ void rc_uni_enc_init_fx( - RangeUniEncState *rc_st_enc /* i/o: RC state handle */ + RangeUniEncState *rc_st_enc /* i/o: RC state handle */ ); void rc_uni_enc_encode_fast_fx( - RangeUniEncState *rc_st_enc, /* i/o: RC state handle */ - const UWord16 cum_freq, /* i : Cumulative frequency up to symbol */ - const UWord16 sym_freq, /* i : Symbol frequency */ - const UWord16 tot_shift /* i : Total frequency as a power of 2 */ + RangeUniEncState *rc_st_enc, /* i/o: RC state handle */ + const UWord16 cum_freq, /* i : Cumulative frequency up to symbol */ + const UWord16 sym_freq, /* i : Symbol frequency */ + const UWord16 tot_shift /* i : Total frequency as a power of 2 */ ); void rc_uni_enc_encode_symbol_fastS_fx( - RangeUniEncState *rc_st_enc, /* i/o: Encoder state */ - const UWord16 symbol, /* i : Symbol to encode */ - const UWord16 cum_freq[], /* i : Cumulative frequency up to symbol */ - const UWord16 sym_freq[], /* i : Symbol frequency */ - const UWord16 tot_shift /* i : Total frequency as a power of 2 */ + RangeUniEncState *rc_st_enc, /* i/o: Encoder state */ + const UWord16 symbol, /* i : Symbol to encode */ + const UWord16 cum_freq[], /* i : Cumulative frequency up to symbol */ + const UWord16 sym_freq[], /* i : Symbol frequency */ + const UWord16 tot_shift /* i : Total frequency as a power of 2 */ ); /*! r: Total number of bits produced */ Word16 rc_uni_enc_finish_fx( - RangeUniEncState *rc_st_enc /* i/o: RC state handle */ + RangeUniEncState *rc_st_enc /* i/o: RC state handle */ ); /*! r: Total number of bits produced */ Word16 rc_uni_enc_virtual_finish_fx( - RangeUniEncState *rc_st_enc /* i : RC state handle */ + RangeUniEncState *rc_st_enc /* i : RC state handle */ ); void rc_uni_enc_encode_bits_fx( - RangeUniEncState *rc_st_enc, /* i/o: RC state handle */ - const UWord16 value, /* i : Value to encode */ - const Word16 bits /* i : Number of bits */ + RangeUniEncState *rc_st_enc, /* i/o: RC state handle */ + const UWord16 value, /* i : Value to encode */ + const Word16 bits /* i : Number of bits */ ); void stereo_dft_enc_process_fx( - CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ - const Word16 vad_flag_dtx[], /* i : VAD dtx flags */ - const Word16 vad_hover_flag[], /* i : VAD hangover flags */ - const Word16 input_frame /* i : input frame length */ + CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ + const Word16 vad_flag_dtx[], /* i : VAD dtx flags */ + const Word16 vad_hover_flag[], /* i : VAD hangover flags */ + const Word16 input_frame /* i : input frame length */ ); void stereo_dft_cng_side_gain_fx( - STEREO_DFT_ENC_DATA_HANDLE hStereoDft, /* i/o: DFT stereo handle */ - STEREO_CNG_ENC_HANDLE hStereoCng, /* i/o: Stereo CNG data structure */ - const Word32 core_brate, /* i : core bitrate */ - const Word32 last_core_brate, /* i : last core bitrate */ - const Word16 bwidth /* i : audio band-width */ + STEREO_DFT_ENC_DATA_HANDLE hStereoDft, /* i/o: DFT stereo handle */ + STEREO_CNG_ENC_HANDLE hStereoCng, /* i/o: Stereo CNG data structure */ + const Word32 core_brate, /* i : core bitrate */ + const Word32 last_core_brate, /* i : last core bitrate */ + const Word16 bwidth /* i : audio band-width */ ); Word16 quantize_sns_fx( - Word32 sns_in_fx[CPE_CHANNELS][NB_DIV][M], /* sns_e */ - Word32 snsQ_out_fx[CPE_CHANNELS][NB_DIV][M], /* sns_e */ + Word32 sns_in_fx[CPE_CHANNELS][NB_DIV][M], /* sns_e */ + Word32 snsQ_out_fx[CPE_CHANNELS][NB_DIV][M], /* sns_e */ Word16 sns_e, Encoder_State **sts, - Word16 *indices, /* Q0 */ - Word16 *zero_side_flag, /* Q0 */ - Word16 *sns_stereo_mode ); /* Q0 */ + Word16 *indices, /* Q0 */ + Word16 *zero_side_flag, /* Q0 */ + Word16 *sns_stereo_mode /* Q0 */ +); void stereo_enc_cng_init_fx( - STEREO_CNG_ENC_HANDLE hStereoCng /* i/o: stereo CNG encoder structure */ + STEREO_CNG_ENC_HANDLE hStereoCng /* i/o: stereo CNG encoder structure */ ); void stereo_cng_upd_counters_fx( - STEREO_CNG_ENC_HANDLE hStereoCng, /* i/o: Stereo CNG data structure */ - const Word32 element_mode, /* i : element mode */ - const Word16 nbands, /* i : Number of bands in active */ - const Word32 sidSideGain[], /* i : SID side gains */ - const Word16 burst_ho_count, /* i : Hang-over count */ - Word16 *coh_fade_counter /* i : Coherence fade counter */ + STEREO_CNG_ENC_HANDLE hStereoCng, /* i/o: Stereo CNG data structure */ + const Word32 element_mode, /* i : element mode */ + const Word16 nbands, /* i : Number of bands in active */ + const Word32 sidSideGain[], /* i : SID side gains */ + const Word16 burst_ho_count, /* i : Hang-over count */ + Word16 *coh_fade_counter /* i : Coherence fade counter */ ); - void stereo_dft_enc_sid_calc_coh_fx( - STEREO_DFT_ENC_DATA_HANDLE hStereoDft, /* i/o: DFT stereo handle */ - Word32 prev_cohBand[2 * ( STEREO_DFT_BAND_MAX / 2 )], /* i/o: Previous coherence Q31 */ - Word16 *td_active, /* i/o: TD stereo mode indicator */ - Word16 *first_SID, /* i/o: First SID indicator */ - Word32 *cohBand /* i/o: Coherence per band Q31 */ + STEREO_DFT_ENC_DATA_HANDLE hStereoDft, /* i/o: DFT stereo handle */ + Word32 prev_cohBand[2 * ( STEREO_DFT_BAND_MAX / 2 )], /* i/o: Previous coherence Q31 */ + Word16 *td_active, /* i/o: TD stereo mode indicator */ + Word16 *first_SID, /* i/o: First SID indicator */ + Word32 *cohBand /* i/o: Coherence per band Q31 */ ); void stereo_dft_enc_sid_coh_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ - Word32 *mem_cohBand, /* i/o: Coherence memory */ - const Word16 nbands, /* i : number of DFT stereo bands */ - Word16 *nb_bits, /* i/o: number of bits written */ - Word32 *cohBand /* i/o: Coherence per band */ + BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ + Word32 *mem_cohBand, /* i/o: Coherence memory */ + const Word16 nbands, /* i : number of DFT stereo bands */ + Word16 *nb_bits, /* i/o: number of bits written */ + Word32 *cohBand /* i/o: Coherence per band */ ); void stereo_dft_enc_write_BS_fx( - CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ - Word16 *nb_bits /* o : number of bits written */ + CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ + Word16 *nb_bits /* o : number of bits written */ ); void stereo_dft_enc_res_fx( - STEREO_DFT_ENC_DATA_HANDLE hStereoDft, /* i/o: encoder stereo handle */ - const Word32 *input_8k, /* i : input buffer sampled at 8kHz Q15 */ - BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ - Word16 *nb_bits, /* o : number of bits written */ - const Word16 max_bits ); + STEREO_DFT_ENC_DATA_HANDLE hStereoDft, /* i/o: encoder stereo handle */ + const Word32 *input_8k, /* i : input buffer sampled at 8kHz Q15 */ + BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ + Word16 *nb_bits, /* o : number of bits written */ + const Word16 max_bits +); Word32 ECSQ_encode_target_SNR_fx( ECSQ_instance *ecsq_inst, @@ -2991,309 +3011,312 @@ Word32 ECSQ_encode_target_SNR_fx( const Word32 target_SNR, // Q25 const Word16 max_bits, Word32 *output, - Word16 *global_gain_index_output ); + Word16 *global_gain_index_output +); void ECSQ_quantize_vector_fx( const Word32 *input, const Word16 input_e, const Word32 global_gain, // Q15 const Word16 N, - Word16 *output ); + Word16 *output +); Word32 ECSQ_compute_optimal_gain_fx( // Q15 const Word32 *input, const Word16 input_e, const Word16 N, - const Word16 *output ); + const Word16 *output +); void spectral_balancer_fx16( - Word16 *signal, /* i/o : signal Qx */ - Word16 *mem, /* i/o : mem Qx */ - const Word16 lg, /* i : input signal length */ - const Word16 coeff_set /* i : coefficient set */ + Word16 *signal, /* i/o : signal Qx */ + Word16 *mem, /* i/o : mem Qx */ + const Word16 lg, /* i : input signal length */ + const Word16 coeff_set /* i : coefficient set */ ); void spectral_balancer_fx( - Word32 *signal, /* i/o : signal Qx */ - Word32 *mem, /* i/o : mem Qx */ - const Word16 lg, /* i : input signal length */ - const Word16 coeff_set /* i : coefficient set */ + Word32 *signal, /* i/o : signal Qx */ + Word32 *mem, /* i/o : mem Qx */ + const Word16 lg, /* i : input signal length */ + const Word16 coeff_set /* i : coefficient set */ ); void stereo_icBWE_preproc_fx( - CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ - const Word16 input_frame, /* i : input frame length */ - Word16 shb_speech_nonref[], /* o : SHB speech non-ref channel */ - Word16 q_shb_speech_nonref /* i : Q SHB speech non-ref channel */ + CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ + const Word16 input_frame, /* i : input frame length */ + Word16 shb_speech_nonref[], /* o : SHB speech non-ref channel */ + Word16 q_shb_speech_nonref /* i : Q SHB speech non-ref channel */ ); void core_switching_pre_enc_ivas_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ - const Word16 *old_inp_12k8, /* i : old input signal @12.8kHz */ - const Word16 q_old_inp_12k8, /* i : Q old input signal @12.8kHz */ - const Word16 *old_inp_16k, /* i : old input signal @16kHz */ - const Word16 q_old_inp_16k, /* i : Q old input signal @16kHz */ - const Word16 active_cnt, /* i : active frame counter */ - const Word16 last_element_mode /* i : last_element_mode */ + Encoder_State *st_fx, /* i/o: encoder state structure */ + const Word16 *old_inp_12k8, /* i : old input signal @12.8kHz */ + const Word16 q_old_inp_12k8, /* i : Q old input signal @12.8kHz */ + const Word16 *old_inp_16k, /* i : old input signal @16kHz */ + const Word16 q_old_inp_16k, /* i : Q old input signal @16kHz */ + const Word16 active_cnt, /* i : active frame counter */ + const Word16 last_element_mode /* i : last_element_mode */ ); Word16 ivas_acelp_tcx20_switching_fx( - Encoder_State *st, /* i/o: encoder state structure */ - Word16 *inp_fx, /* i : new input signal */ - Word16 q_inp, /* i : i/p Q */ - Word16 *wsp, /* i : input weighted signal */ - Word32 non_staX, /* i : unbound non-stationarity for sp/mu clas */ - Word16 *pitch_fr, /* i : fraction pitch values */ - Word16 *voicing_fr, /* i : fractional voicing values */ - Word32 currFlatness, /* i : flatness */ - Word16 lsp_mid[M], /* i : LSPs at the middle of the frame */ - Word16 stab_fac, /* i : LP filter stability */ + Encoder_State *st, /* i/o: encoder state structure */ + Word16 *inp_fx, /* i : new input signal */ + Word16 q_inp, /* i : i/p Q */ + Word16 *wsp, /* i : input weighted signal */ + Word32 non_staX, /* i : unbound non-stationarity for sp/mu clas */ + Word16 *pitch_fr, /* i : fraction pitch values */ + Word16 *voicing_fr, /* i : fractional voicing values */ + Word32 currFlatness, /* i : flatness */ + Word16 lsp_mid[M], /* i : LSPs at the middle of the frame */ + Word16 stab_fac, /* i : LP filter stability */ Word32 *res_cod_SNR_M, Word16 *res_cod_SNR_M_e, - const Word16 flag_16k_smc /* i : flag to indicate if the OL SMC is run at 16 kHz */ + const Word16 flag_16k_smc /* i : flag to indicate if the OL SMC is run at 16 kHz */ ); void encod_gen_2sbfr( - Encoder_State *st, /* i/o: state structure */ - const Word16 speech[], /* i : input speech */ - const Word16 Aw[], /* i : weighted A(z) unquantized for subframes */ - const Word16 Aq[], /* i : LP coefficients */ - const Word16 *res, /* i : residual signal */ - Word16 *syn, /* i/o: core synthesis */ - Word16 *exc, /* i/o: current non-enhanced excitation */ - Word16 *exc2, /* i/o: current enhanced excitation */ - Word16 *pitch_buf, /* i/o: floating pitch values for each subframe */ - Word16 *voice_factors, /* o : voicing factors */ - Word16 *bwe_exc, /* o : excitation for SWB TBE */ - const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */ - const Word16 tdm_Pri_pitch_buf[], /* i : pitch values for primary channel */ + Encoder_State *st, /* i/o: state structure */ + const Word16 speech[], /* i : input speech */ + const Word16 Aw[], /* i : weighted A(z) unquantized for subframes */ + const Word16 Aq[], /* i : LP coefficients */ + const Word16 *res, /* i : residual signal */ + Word16 *syn, /* i/o: core synthesis */ + Word16 *exc, /* i/o: current non-enhanced excitation */ + Word16 *exc2, /* i/o: current enhanced excitation */ + Word16 *pitch_buf, /* i/o: floating pitch values for each subframe */ + Word16 *voice_factors, /* o : voicing factors */ + Word16 *bwe_exc, /* o : excitation for SWB TBE */ + const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */ + const Word16 tdm_Pri_pitch_buf[], /* i : pitch values for primary channel */ Word16 Q_new, - Word16 shift ); + Word16 shift +); void acelp_fast_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 cdk_index, /* i : codebook index */ - const Word16 dn_orig[L_SUBFR], - /* i : corr. between target and h[]. */ // Q_dn + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + const Word16 cdk_index, /* i : codebook index */ + const Word16 dn_orig[L_SUBFR], /* i : corr. between target and h[]. Q_dn */ Word16 Q_dn, - const Word16 cn[L_SUBFR], - /* i : residual after long term prediction */ // q_cn + const Word16 cn[L_SUBFR], /* i : residual after long term prediction q_cn*/ const Word16 q_cn, - const Word16 H[L_SUBFR], - /* i : impulse response of weighted synthesis filter */ // e(norm_s(H[0])+1) - Word16 code[L_SUBFR], /* o : algebraic (fixed) codebook excitation */ - Word16 y[], /* o : filtered fixed codebook excitation */ - const Word16 L_subfr /* i : subframe length */ + const Word16 H[L_SUBFR], /* i : impulse response of weighted synthesis filter e(norm_s(H[0])+1) */ + Word16 code[L_SUBFR], /* o : algebraic (fixed) codebook excitation */ + Word16 y[], /* o : filtered fixed codebook excitation */ + const Word16 L_subfr /* i : subframe length */ ); void ivas_mdct_quant_coder_fx( - CPE_ENC_HANDLE hCPE, /* i/o: Encoder CPE handle */ - Word16 tnsBits[CPE_CHANNELS][NB_DIV], /* i : bits needed for TNS parameters */ - Word16 tnsSize[CPE_CHANNELS][NB_DIV], /* i : size of TNS */ - Word16 p_param[CPE_CHANNELS][NB_DIV], /* i : pointer to parameter array */ - const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ + CPE_ENC_HANDLE hCPE, /* i/o: Encoder CPE handle */ + Word16 tnsBits[CPE_CHANNELS][NB_DIV], /* i : bits needed for TNS parameters */ + Word16 tnsSize[CPE_CHANNELS][NB_DIV], /* i : size of TNS */ + Word16 p_param[CPE_CHANNELS][NB_DIV], /* i : pointer to parameter array */ + const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ); void ivas_mdct_tcx10_bit_distribution_fx( - Word16 target_bitsTCX10[NB_DIV], /* o : target bit distribution */ - const Word16 nbits_tcx, /* i : TCX bits */ - const Word16 nTnsBitsTCX10[NB_DIV] /* i : TNS bits */ + Word16 target_bitsTCX10[NB_DIV], /* o : target bit distribution */ + const Word16 nbits_tcx, /* i : TCX bits */ + const Word16 nTnsBitsTCX10[NB_DIV] /* i : TNS bits */ ); void QuantizeSpectrum_ivas_fx( - Encoder_State *st, /* i/o: encoder state structure */ - const Word16 A_fx[], /* i : quantized coefficients NxAz_q[M+1] */ - const Word16 Aqind[], /* i : frame-independent quantized coefficients (M+1) */ - Word16 gainlpc_fx[], /* i : MDCT gains of the previous frame */ - Word16 gainlpc_e[], /* i : exponents of MDCT gains of the previous frame */ - Word16 synth[], /* o : synthesis buffer, Q0 */ - const Word16 nb_bits, /* i : bit budget */ - const Word16 tnsSize, /* i : number of tns parameters put into prm */ - Word16 prm[], /* o : tcx parameters */ - const Word16 frame_cnt, /* i : frame counter in the super_frame */ - CONTEXT_HM_CONFIG *hm_cfg, /* i : HM configuration */ - const Word16 vad_hover_flag /* i : VAD hangover flag */ + Encoder_State *st, /* i/o: encoder state structure */ + const Word16 A_fx[], /* i : quantized coefficients NxAz_q[M+1] */ + const Word16 Aqind[], /* i : frame-independent quantized coefficients (M+1) */ + Word16 gainlpc_fx[], /* i : MDCT gains of the previous frame */ + Word16 gainlpc_e[], /* i : exponents of MDCT gains of the previous frame */ + Word16 synth[], /* o : synthesis buffer, Q0 */ + const Word16 nb_bits, /* i : bit budget */ + const Word16 tnsSize, /* i : number of tns parameters put into prm */ + Word16 prm[], /* o : tcx parameters */ + const Word16 frame_cnt, /* i : frame counter in the super_frame */ + CONTEXT_HM_CONFIG *hm_cfg, /* i : HM configuration */ + const Word16 vad_hover_flag /* i : VAD hangover flag */ ); void InternalTCXDecoder_fx( - Encoder_State *st, /* i/o: state handle */ - const Word16 frame_cnt, /* i : frame counter in the super_frame */ - const Word16 L_frameTCX, /* i : full frame length */ - const Word16 L_frame, /* i : frame length */ - const Word16 L_spec, /* i : length of the coded spectrum */ - const Word16 tcx_offset, /* i : folding point offset relative to the end of the previous frame */ - const Word16 noiseFillingBorder, /* i : noise filling border */ - const Word32 *x_quant_fx, /* i : quantized spectrum */ - const Word32 ener_fx, /* i : energy of the quantized spectrum */ - const Word16 ener_e, /* i : energy of the quantized spectrum exponent */ - Word16 lf_deemph_fact_fx[], /* i/o: low frequency deemphasis factors */ - const Word16 fac_ns_fx, /* i : noise filling level, Q15 */ - const Word16 nf_seed, /* i : noise filling random seed, Q0 */ - const Word16 *A_fx, /* i : LPC representation of the FDNS gains */ - Word16 gainlpc_fx[], /* i/o: FDNS gains */ - Word16 gainlpc_e[], /* i/o: FDNS gains exponent */ - const Word16 hm_active, /* i : flag indicating if the harmonic model is active */ - Word16 gain_tcx_fx, /* i/o: global gain / quantized global gain */ - Word16 *gain_tcx_e, /* i/o: global gain / quantized global gain exponent */ - Word32 spectrum_fx[], /* o : dequantized spectrum */ - Word16 *spectrum_e, /* o : dequantized spectrum */ - Word16 synth[], /* o : time domain signal */ - Word16 *gain_tcx_q /* o : quantized global gain (at low bitrates) */ + Encoder_State *st, /* i/o: state handle */ + const Word16 frame_cnt, /* i : frame counter in the super_frame */ + const Word16 L_frameTCX, /* i : full frame length */ + const Word16 L_frame, /* i : frame length */ + const Word16 L_spec, /* i : length of the coded spectrum */ + const Word16 tcx_offset, /* i : folding point offset relative to the end of the previous frame */ + const Word16 noiseFillingBorder, /* i : noise filling border */ + const Word32 *x_quant_fx, /* i : quantized spectrum */ + const Word32 ener_fx, /* i : energy of the quantized spectrum */ + const Word16 ener_e, /* i : energy of the quantized spectrum exponent */ + Word16 lf_deemph_fact_fx[], /* i/o: low frequency deemphasis factors */ + const Word16 fac_ns_fx, /* i : noise filling level, Q15 */ + const Word16 nf_seed, /* i : noise filling random seed, Q0 */ + const Word16 *A_fx, /* i : LPC representation of the FDNS gains */ + Word16 gainlpc_fx[], /* i/o: FDNS gains */ + Word16 gainlpc_e[], /* i/o: FDNS gains exponent */ + const Word16 hm_active, /* i : flag indicating if the harmonic model is active */ + Word16 gain_tcx_fx, /* i/o: global gain / quantized global gain */ + Word16 *gain_tcx_e, /* i/o: global gain / quantized global gain exponent */ + Word32 spectrum_fx[], /* o : dequantized spectrum */ + Word16 *spectrum_e, /* o : dequantized spectrum */ + Word16 synth[], /* o : time domain signal */ + Word16 *gain_tcx_q /* o : quantized global gain (at low bitrates) */ ); void stereo_tcx_core_enc( - Encoder_State *st, /* i/o: encoder state structure */ - const Word16 new_samples_12k8[], /* i : buffer of input signal @12.8 kHz */ - const Word16 new_samples_16k[], /* i : buffer of input signal @16 kHz */ - const Word16 Aw_fx[], /* i : weighted A(z) unquant. for subframes, Q12 */ - Word16 lsp_new_fx[], /* i : LSPs at the end of the frame, Q15 */ - Word16 lsp_mid_fx[], /* i : LSPs in the middle of the frame, Q15 */ - Word16 pitch_buf_fx[NB_SUBFR16k], /* o : pitch for each subframe, Q6 */ - const Word16 last_element_mode, /* i : last element mode, Q0 */ - const Word16 vad_hover_flag, /* i : VAD hangover flag, Q0 */ + Encoder_State *st, /* i/o: encoder state structure */ + const Word16 new_samples_12k8[], /* i : buffer of input signal @12.8 kHz */ + const Word16 new_samples_16k[], /* i : buffer of input signal @16 kHz */ + const Word16 Aw_fx[], /* i : weighted A(z) unquant. for subframes,Q12*/ + Word16 lsp_new_fx[], /* i : LSPs at the end of the frame, Q15 */ + Word16 lsp_mid_fx[], /* i : LSPs in the middle of the frame, Q15 */ + Word16 pitch_buf_fx[NB_SUBFR16k], /* o : pitch for each subframe, Q6 */ + const Word16 last_element_mode, /* i : last element mode, Q0 */ + const Word16 vad_hover_flag, /* i : VAD hangover flag, Q0 */ Word16 Q_new ); Word16 transient_analysis_ivas_fx( - TRAN_DET_HANDLE hTranDet, /* i : handle transient detection */ - const Word16 cor_map_LT[], /* i : LT correlation map Q_cor_map = Qx */ + TRAN_DET_HANDLE hTranDet, /* i : handle transient detection */ + const Word16 cor_map_LT[], /* i : LT correlation map Q_cor_map = Qx */ const Word16 Q_cor_map, - const Word16 multi_harm_limit, /* i : multi harmonic threshold Q_multi_harm_limit = Qx */ - const Word16 Q_multi_harm_limit ); + const Word16 multi_harm_limit, /* i : multi harmonic threshold Q_multi_harm_limit = Qx */ + const Word16 Q_multi_harm_limit +); void set_transient_stereo_fx( - CPE_ENC_HANDLE hCPE, /* i : CPE structure */ - Word32 currFlatness[] /* i/o: current flatness Q21*/ + CPE_ENC_HANDLE hCPE, /* i : CPE structure */ + Word32 currFlatness[] /* i/o: current flatness Q21*/ ); void ivas_smc_mode_selection_fx( - Encoder_State *st, /* i/o: encoder state structure */ - const Word32 element_brate, /* i : element bitrate */ - Word16 smc_dec, /* i : raw decision of the 1st stage classifier*/ - const Word16 relE, /* i : relative frame energy, Q8 */ - const Word16 Etot, /* i : total frame energy, Q8 */ - Word16 *attack_flag, /* i/o: attack flag (GSC or TC) */ - const Word16 *inp, /* i : input signal */ - const Word16 Q_new, /* i : Q of input signal */ - const Word16 S_map[], /* i : short-term correlation map, Q7 */ - const Word16 flag_spitch /* i : flag to indicate very short stable pitch*/ + Encoder_State *st, /* i/o: encoder state structure */ + const Word32 element_brate, /* i : element bitrate */ + Word16 smc_dec, /* i : raw decision of the 1st stage classifier*/ + const Word16 relE, /* i : relative frame energy, Q8 */ + const Word16 Etot, /* i : total frame energy, Q8 */ + Word16 *attack_flag, /* i/o: attack flag (GSC or TC) */ + const Word16 *inp, /* i : input signal */ + const Word16 Q_new, /* i : Q of input signal */ + const Word16 S_map[], /* i : short-term correlation map, Q7 */ + const Word16 flag_spitch /* i : flag to indicate very short stable pitch*/ ); /*! r: element mode */ Word16 select_stereo_mode_fx( - CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ - const IVAS_FORMAT ivas_format /* i : IVAS format */ + CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ + const IVAS_FORMAT ivas_format /* i : IVAS format */ ); void stereo_classifier_features_ivas_fx( - STEREO_CLASSIF_HANDLE hStereoClassif, /* i/o: stereo classifier structure */ - const Word16 idchan, /* i : channel ID */ - const Word16 element_mode, /* i : element mode */ - const Word16 vad_flag, /* i : VAD flag */ - Word16 lsf_new_fx[], /* i : LSFs at the end of the frame Q1*1.28 */ - Word32 epsP_fx[], /* i : LP analysis residual energies for each iteration*/ - Word16 pitch[], /* i : open-loop pitch values for quantiz. Q0 */ - Word16 voicing_fx[], /* i : OL maximum normalized correlation Q15 */ - Word32 cor_map_sum_fx, /* i : speech/music clasif. parameter */ - Word32 non_staX_fx, /* i : unbound non-stationarity for sp/mu clas. */ - Word16 sp_div_fx, /* i : spectral diversity feature */ - const Word16 clas, /* i : signal class */ - Word16 epsP_e, /*exponent for epsP_fx */ - Word16 cor_map_sum_e, /*exponent for cor_map_sum_fx */ - Word16 non_staX_e, /*exponent for non_staX_fx */ - Word16 sp_div_e /*exponent for sp_div_fx */ + STEREO_CLASSIF_HANDLE hStereoClassif, /* i/o: stereo classifier structure */ + const Word16 idchan, /* i : channel ID */ + const Word16 element_mode, /* i : element mode */ + const Word16 vad_flag, /* i : VAD flag */ + Word16 lsf_new_fx[], /* i : LSFs at the end of the frame Q1*1.28 */ + Word32 epsP_fx[], /* i : LP analysis residual energies for each iteration*/ + Word16 pitch[], /* i : open-loop pitch values for quantiz. Q0 */ + Word16 voicing_fx[], /* i : OL maximum normalized correlation Q15 */ + Word32 cor_map_sum_fx, /* i : speech/music clasif. parameter */ + Word32 non_staX_fx, /* i : unbound non-stationarity for sp/mu clas. */ + Word16 sp_div_fx, /* i : spectral diversity feature */ + const Word16 clas, /* i : signal class */ + Word16 epsP_e, /*exponent for epsP_fx */ + Word16 cor_map_sum_e, /*exponent for cor_map_sum_fx */ + Word16 non_staX_e, /*exponent for non_staX_fx */ + Word16 sp_div_e /*exponent for sp_div_fx */ ); void tdm_ol_pitch_comparison_fx( - CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ - Word16 pitch_fr[CPE_CHANNELS][NB_SUBFR], /* i/o: fractional pitch values, Q6 */ - Word16 voicing_fr[CPE_CHANNELS][NB_SUBFR] /* i/o: fractional pitch gains, Q15 */ + CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ + Word16 pitch_fr[CPE_CHANNELS][NB_SUBFR], /* i/o: fractional pitch values, Q6 */ + Word16 voicing_fr[CPE_CHANNELS][NB_SUBFR] /* i/o: fractional pitch gains, Q15 */ ); void xtalk_classifier_td_fx( - CPE_ENC_HANDLE hCPE /* i/o: CPE encoder structure */ + CPE_ENC_HANDLE hCPE /* i/o: CPE encoder structure */ ); void unclr_classifier_td_fx( - CPE_ENC_HANDLE hCPE /* i/o: CPE encoder structure */ + CPE_ENC_HANDLE hCPE /* i/o: CPE encoder structure */ ); void quantize_direction_frame2D_fx( - IVAS_QDIRECTION *q_direction, /* i/o: quantized direction structure */ + IVAS_QDIRECTION *q_direction, /* i/o: quantized direction structure */ Word32 azimuth_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], // Q22 Word32 elevation_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES] // Q22 ); Word16 quantize_direction2D_fx( - Word32 phi, /* i : input azimuth value Q22 */ - const Word16 no_cw, /* i : number of bits */ - Word32 *phi_q, /* o : quantized azimuth value Q22 */ - UWord16 *index_phi, /* o : quantized azimuth index */ - const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ + Word32 phi, /* i : input azimuth value Q22 */ + const Word16 no_cw, /* i : number of bits */ + Word32 *phi_q, /* o : quantized azimuth value Q22 */ + UWord16 *index_phi, /* o : quantized azimuth index */ + const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ ); void restore_metadata_buffer_fx( BSTR_ENC_HANDLE hMetaData, const Word16 next_ind_start, - const Word16 bit_pos_start ); - + const Word16 bit_pos_start +); void small_requantize_direction_frame_fx( - IVAS_QDIRECTION *q_direction, /* i/o: quantized direction structure */ + IVAS_QDIRECTION *q_direction, /* i/o: quantized direction structure */ Word32 azimuth_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], // Q22 Word32 elevation_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], // Q22 const Word16 raw_flag[MASA_MAXIMUM_CODING_SUBBANDS], Word16 bits_dir_bands[MASA_MAXIMUM_CODING_SUBBANDS], - Word16 *diff ); + Word16 *diff +); void ivas_param_ism_stereo_dmx_fx( - Encoder_Struct *st_ivas, /* i : IVAS encoder structure */ - Word32 *data[MAX_NUM_OBJECTS], /* i/o: input signal/stereo dmx Qx */ - const Word16 input_frame /* i : Length of input frame */ + Encoder_Struct *st_ivas, /* i : IVAS encoder structure */ + Word32 *data[MAX_NUM_OBJECTS], /* i/o: input signal/stereo dmx Qx */ + const Word16 input_frame /* i : Length of input frame */ ); void ivas_param_ism_enc_fx( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ - Word32 *data[MAX_NUM_OBJECTS], /* i : input signal q_pcm_in */ - const Word16 input_frame /* i : input frame length per channel */ + Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ + Word32 *data[MAX_NUM_OBJECTS], /* i : input signal q_pcm_in */ + const Word16 input_frame /* i : input frame length per channel */ ); ISM_MODE ivas_ism_mode_select( - const Word16 nchan_inp, /* i : number of input objects */ - const Word32 ivas_total_brate /* i : IVAS total bitrate */ + const Word16 nchan_inp, /* i : number of input objects */ + const Word32 ivas_total_brate /* i : IVAS total bitrate */ ); void ivas_fb_mixer_update_prior_input_fx( - IVAS_FB_MIXER_HANDLE hFbMixer, /* i/o: FB mixer handle */ - Word32 *pcm_in_fx[], /* i : input audio channels */ - const Word16 length, /* i : length of time slot */ - const Word16 nchan_fb_in /* i : number of analysis channels */ + IVAS_FB_MIXER_HANDLE hFbMixer, /* i/o: FB mixer handle */ + Word32 *pcm_in_fx[], /* i : input audio channels */ + const Word16 length, /* i : length of time slot */ + const Word16 nchan_fb_in /* i : number of analysis channels */ ); void ivas_fb_mixer_get_windowed_fr_fx( - IVAS_FB_MIXER_HANDLE hFbMixer, /* i/o: FB mixer handle */ + IVAS_FB_MIXER_HANDLE hFbMixer, /* i/o: FB mixer handle */ Word32 *pcm_in_fx[], Word32 *frame_f_real_fx[], Word32 *frame_f_imag_fx[], - const Word16 length, /* i : number of new samples in time slot */ - const Word16 mdft_len, /* i : MDFT frame length */ - const Word16 nchan_fb_in, /* i : number of analysis channels */ + const Word16 length, /* i : number of new samples in time slot */ + const Word16 mdft_len, /* i : MDFT frame length */ + const Word16 nchan_fb_in, /* i : number of analysis channels */ Word16 gb ); void ivas_omasa_set_config_fx( - OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ - MASA_ENCODER_HANDLE hMasa, /* i : MASA encoder handle */ - const Word32 input_Fs, /* i : Input sample rate */ - const ISM_MODE ism_mode /* i : ISM mode */ + OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ + MASA_ENCODER_HANDLE hMasa, /* i : MASA encoder handle */ + const Word32 input_Fs, /* i : Input sample rate */ + const ISM_MODE ism_mode /* i : ISM mode */ ); Word16 ivas_omasa_ener_brate_fx( - const Word16 nchan_ism, /* i : number of ISMs */ - const Word32 ivas_total_brate, /* i : IVAS total bitrate */ - Word32 *data_f[], /* i : Input / transport audio signals */ - const Word16 input_frame, /* i : Input frame size */ - const Word16 data_e /* i : exponent for data_f */ + const Word16 nchan_ism, /* i : number of ISMs */ + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + Word32 *data_f[], /* i : Input / transport audio signals */ + const Word16 input_frame, /* i : Input frame size */ + const Word16 data_e /* i : exponent for data_f */ ); void computeDiffuseness_mdft_fx( @@ -3307,7 +3330,7 @@ void computeDiffuseness_mdft_fx( Word16 *q_diffuseness /*Ouput Q*/ ); -void computeDirectionVectors_fixed( +void computeDirectionVectors_fx2( Word32 *intensity_real_x, Word32 *intensity_real_y, Word32 *intensity_real_z, @@ -3317,8 +3340,8 @@ void computeDirectionVectors_fixed( Word32 *direction_vector_y, /*Q30*/ Word32 *direction_vector_z, /*Q30*/ Word16 i_e, /*Exponent of all the intensity buffers*/ - Word16 *i_e_band ); - + Word16 *i_e_band +); UWord8 ivas_masa_surrcoh_signicant_fx( Word32 surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Surround coherence Q31 */ @@ -3327,33 +3350,35 @@ UWord8 ivas_masa_surrcoh_signicant_fx( const Word16 nBands /* i : Number of frequency bands */ ); + /*----------------------------------------------------------------------------------* * McMASA prototypes *----------------------------------------------------------------------------------*/ ivas_error ivas_mcmasa_enc_open_fx( - Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ + Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ ); void ivas_mcmasa_enc_close_fx( - MCMASA_ENC_HANDLE *hMcMasa, /* i/o: encoder McMASA handle */ - const Word32 input_Fs /* i : input sampling rate */ + MCMASA_ENC_HANDLE *hMcMasa, /* i/o: encoder McMASA handle */ + const Word32 input_Fs /* i : input sampling rate */ ); ivas_error ivas_mcmasa_enc_reconfig_fx( - Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ + Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ ); void ivas_mcmasa_enc_fx( - MCMASA_ENC_HANDLE hMcMasa, /* i/o: Encoder McMASA handle */ - IVAS_QMETADATA_HANDLE hQMeta, /* o : Qmetadata handle */ - MASA_ENCODER_HANDLE hMasa, /* i/o: Encoder MASA handle */ - Word32 *data_f[], /* i : Input frame of audio */ - const Word16 input_frame, /* i : Input frame size */ - const Word16 nchan_transport, /* i : Number of transport channels */ - const Word16 nchan_inp, /* i : Number of input channels */ - const Word16 q_inp /* i : Input data q-format */ + MCMASA_ENC_HANDLE hMcMasa, /* i/o: Encoder McMASA handle */ + IVAS_QMETADATA_HANDLE hQMeta, /* o : Qmetadata handle */ + MASA_ENCODER_HANDLE hMasa, /* i/o: Encoder MASA handle */ + Word32 *data_f[], /* i : Input frame of audio */ + const Word16 input_frame, /* i : Input frame size */ + const Word16 nchan_transport, /* i : Number of transport channels */ + const Word16 nchan_inp, /* i : Number of input channels */ + const Word16 q_inp /* i : Input data q-format */ ); + void ivas_mcmasa_param_est_enc_fx( MCMASA_ENC_HANDLE hMcMasa, /* i : McMASA encoder structure */ MASA_ENCODER_HANDLE hMasa, /* i : MASA encoder structure */ @@ -3369,110 +3394,111 @@ void ivas_mcmasa_param_est_enc_fx( ); void computeReferencePower_enc_fx( - const Word16 *band_grouping, /* i : Band grouping for estimation */ - Word32 Cldfb_RealBuffer[][DIRAC_NO_FB_BANDS_MAX], /* i : Real part of input signal */ - Word32 Cldfb_ImagBuffer[][DIRAC_NO_FB_BANDS_MAX], /* i : Imag part of input signal */ - Word32 *reference_power, /* o : Estimated power */ - const Word16 enc_param_start_band, /* i : first band to process */ - const Word16 num_freq_bands, /* i : Number of frequency bands */ - const IVAS_FORMAT ivas_format, /* i : ivas_format */ - Word16 ref_power_w, /* i : use 0 if hodirac is enabled */ - const Word16 nchan_ana, /* i : number of analysis channels */ - Word16 inp_q, /* i : q of cld buffers */ - Word16 q_reference_power[DIRAC_NO_FB_BANDS_MAX] ); + const Word16 *band_grouping, /* i : Band grouping for estimation */ + Word32 Cldfb_RealBuffer[][DIRAC_NO_FB_BANDS_MAX], /* i : Real part of input signal */ + Word32 Cldfb_ImagBuffer[][DIRAC_NO_FB_BANDS_MAX], /* i : Imag part of input signal */ + Word32 *reference_power, /* o : Estimated power */ + const Word16 enc_param_start_band, /* i : first band to process */ + const Word16 num_freq_bands, /* i : Number of frequency bands */ + const IVAS_FORMAT ivas_format, /* i : ivas_format */ + Word16 ref_power_w, /* i : use 0 if hodirac is enabled */ + const Word16 nchan_ana, /* i : number of analysis channels */ + Word16 inp_q, /* i : q of cld buffers */ + Word16 q_reference_power[DIRAC_NO_FB_BANDS_MAX] +); void computeReferencePower_enc_fx_dirac( - const Word16 *band_grouping, /* i : Band grouping for estimation */ - Word32 Cldfb_RealBuffer[][DIRAC_NO_FB_BANDS_MAX], /* i : Real part of input signal */ - Word32 Cldfb_ImagBuffer[][DIRAC_NO_FB_BANDS_MAX], /* i : Imag part of input signal */ - Word16 e_Cldfb, /* i : exponent of Cldfb buffer */ - Word32 *reference_power, /* o : Estimated power */ - Word16 *e_reference, /* o : exponent of reference_power */ - const Word16 enc_param_start_band, /* i : first band to process */ - const Word16 num_freq_bands, /* i : Number of frequency bands */ - const IVAS_FORMAT ivas_format, /* i : ivas_format */ - Word16 ref_power_w, /* i : use 0 if hodirac is enabled */ - const Word16 nchan_ana, /* i : number of analysis channels */ - Word16 *mono_frame_count, /* i/o: Mono Frame Count */ - Word16 *dirac_mono_flag /* i/o: Mono Flag */ + const Word16 *band_grouping, /* i : Band grouping for estimation */ + Word32 Cldfb_RealBuffer[][DIRAC_NO_FB_BANDS_MAX], /* i : Real part of input signal */ + Word32 Cldfb_ImagBuffer[][DIRAC_NO_FB_BANDS_MAX], /* i : Imag part of input signal */ + Word16 e_Cldfb, /* i : exponent of Cldfb buffer */ + Word32 *reference_power, /* o : Estimated power */ + Word16 *e_reference, /* o : exponent of reference_power */ + const Word16 enc_param_start_band, /* i : first band to process */ + const Word16 num_freq_bands, /* i : Number of frequency bands */ + const IVAS_FORMAT ivas_format, /* i : ivas_format */ + Word16 ref_power_w, /* i : use 0 if hodirac is enabled */ + const Word16 nchan_ana, /* i : number of analysis channels */ + Word16 *mono_frame_count, /* i/o: Mono Frame Count */ + Word16 *dirac_mono_flag /* i/o: Mono Flag */ ); void ivas_omasa_enc_fx( - OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ - MASA_ENCODER_HANDLE hMasa, /* i/o: MASA encoder handle */ - ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handle */ - Word32 *data_in[], /* i/o: Input / transport audio signals */ - Word16 q_data, /* i:Q0 Stores the q for data_in_f */ - const Word16 input_frame, /* i : Input frame size */ - const Word16 nchan_transport, /* i : Number of transport channels */ - const Word16 nchan_ism, /* i : Number of objects for parameter analysis */ - const ISM_MODE ism_mode, /* i : ISM mode */ - Word32 *data_separated_object_fx, /* o : Separated object audio signal */ - Word16 *idx_separated_object /* o : Index of the separated object */ + OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ + MASA_ENCODER_HANDLE hMasa, /* i/o: MASA encoder handle */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handle */ + Word32 *data_in[], /* i/o: Input / transport audio signals */ + Word16 q_data, /* i :Q0 Stores the q for data_in_f */ + const Word16 input_frame, /* i : Input frame size */ + const Word16 nchan_transport, /* i : Number of transport channels */ + const Word16 nchan_ism, /* i : Number of objects for parameter analysis*/ + const ISM_MODE ism_mode, /* i : ISM mode */ + Word32 *data_separated_object_fx, /* o : Separated object audio signal */ + Word16 *idx_separated_object /* o : Index of the separated object */ ); void mctStereoIGF_enc_fx( - MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ - Encoder_State **sts, /* i/o: encoder state structure */ - Word32 *orig_spectrum_fx[MCT_MAX_CHANNELS][2], /* i : MDCT spectrum for ITF */ - Word16 q_origSpec, /* i : Q for MDCT spectrum */ - Word32 *powerSpec[MCT_MAX_CHANNELS], /* i/o: MDCT^2 + MDST^2 spectrum,or estimate */ - Word16 q_powerSpec[MCT_MAX_CHANNELS], /* i : Q for powSpec_fx */ - Word32 *powerSpecMsInv_fx[MCT_MAX_CHANNELS][NB_DIV], /* i : same as powerSpec_fx but for inverse spect.*/ - Word16 *q_powerSpecMsInv[MCT_MAX_CHANNELS][NB_DIV], /* i : Q for powSpecMsInv_fx */ - Word32 *inv_spectrum_fx[MCT_MAX_CHANNELS][NB_DIV], /* i : inverse spectrum */ - const Word16 sp_aud_decision0[MCT_MAX_CHANNELS] /* i : speech audio decision */ + MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ + Encoder_State **sts, /* i/o: encoder state structure */ + Word32 *orig_spectrum_fx[MCT_MAX_CHANNELS][2], /* i : MDCT spectrum for ITF */ + Word16 q_origSpec, /* i : Q for MDCT spectrum */ + Word32 *powerSpec[MCT_MAX_CHANNELS], /* i/o: MDCT^2 + MDST^2 spectrum,or estimate */ + Word16 q_powerSpec[MCT_MAX_CHANNELS], /* i : Q for powSpec_fx */ + Word32 *powerSpecMsInv_fx[MCT_MAX_CHANNELS][NB_DIV], /* i : same as powerSpec_fx but for inverse spect.*/ + Word16 *q_powerSpecMsInv[MCT_MAX_CHANNELS][NB_DIV], /* i : Q for powSpecMsInv_fx */ + Word32 *inv_spectrum_fx[MCT_MAX_CHANNELS][NB_DIV], /* i : inverse spectrum */ + const Word16 sp_aud_decision0[MCT_MAX_CHANNELS] /* i : speech audio decision */ ); void ivas_mct_core_enc_fx( - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ - CPE_ENC_HANDLE hCPE[MCT_MAX_BLOCKS], /* i/o: CPE encoder structures */ - const Word16 nChannels, /* i : number of channels to be coded */ - const Word32 ivas_total_brate, /* i : IVAS total bitrate */ - const Word16 switch_bw, /* i : flag bandwidth switch occurance */ - const Word16 lfe_bits, /* i : bits spent for LFE */ - const Word16 sba_order /* i : Ambisonic (SBA) order */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ + CPE_ENC_HANDLE hCPE[MCT_MAX_BLOCKS], /* i/o: CPE encoder structures */ + const Word16 nChannels, /* i : number of channels to be coded */ + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + const Word16 switch_bw, /* i : flag bandwidth switch occurance */ + const Word16 lfe_bits, /* i : bits spent for LFE */ + const Word16 sba_order /* i : Ambisonic (SBA) order */ ); - ivas_error mct_enc_reconfigure_fx( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ - const UWord16 b_nchan_change /* i : flag indicating different channel count */ + Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ + const UWord16 b_nchan_change /* i : flag indicating different channel count */ ); Word16 quantize_phi_chan_compand_fx( - Word32 phi, /* i : azimuth value Q22 */ - Word32 *phi_hat, /* o : quantized azimuth Q22 */ - const Word16 n, /* i : azimuth codebook size */ - const Word16 theta_flag, /* i : flag signaling high elevation */ - const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ + Word32 phi, /* i : azimuth value Q22 */ + Word32 *phi_hat, /* o : quantized azimuth Q22 */ + const Word16 n, /* i : azimuth codebook size */ + const Word16 theta_flag, /* i : flag signaling high elevation */ + const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ ); Word16 quantize_phi_chan_lbr_fx( - const Word32 phi, /* i : azimuth value, Q22 */ - Word32 *phi_hat, /* o : quantized azimuth, Q22 */ - const Word16 n /* i : azimuth codebook size */ + const Word32 phi, /* i : azimuth value, Q22 */ + Word32 *phi_hat, /* o : quantized azimuth, Q22 */ + const Word16 n /* i : azimuth codebook size */ ); UWord16 quantize_direction_fx( - const Word32 theta, /* i : input elevation value, Q22 */ - Word32 phi, /* i : input azimuth value, Q22 */ - const Word16 no_bits, /* i : number of bits */ - Word32 *theta_q, /* o : quantized elevation, Q22 */ - Word32 *phi_q, /* o : quantized azimuth, Q22 */ - UWord16 *index_theta, /* o : quantized elevation index */ - UWord16 *index_phi, /* o : quantized azimuth index */ - const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ + const Word32 theta, /* i : input elevation value, Q22 */ + Word32 phi, /* i : input azimuth value, Q22 */ + const Word16 no_bits, /* i : number of bits */ + Word32 *theta_q, /* o : quantized elevation, Q22 */ + Word32 *phi_q, /* o : quantized azimuth, Q22 */ + UWord16 *index_theta, /* o : quantized elevation index */ + UWord16 *index_phi, /* o : quantized azimuth index */ + const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ ); Word16 quantize_direction2D_fx( - Word32 phi, /* i : input azimuth value Q22 */ - const Word16 no_cw, /* i : number of bits */ - Word32 *phi_q, /* o : quantized azimuth value Q22 */ - UWord16 *index_phi, /* o : quantized azimuth index */ - const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ + Word32 phi, /* i : input azimuth value Q22 */ + const Word16 no_cw, /* i : number of bits */ + Word32 *phi_q, /* o : quantized azimuth value Q22 */ + UWord16 *index_phi, /* o : quantized azimuth index */ + const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ ); + void quantize_direction_frame_fx( IVAS_QDIRECTION *q_direction, /* i/o: quantized direction structure */ Word32 azimuth_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], /* o : Q22 */ @@ -3481,36 +3507,37 @@ void quantize_direction_frame_fx( ); ivas_error ivas_qmetadata_enc_encode_fx( - BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream handle */ - IVAS_QMETADATA *hQMetaData, /* i/o: metadata handle */ - const Word16 hodirac_flag /* i : flag to indicate HO-DirAC mode */ + BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream handle */ + IVAS_QMETADATA *hQMetaData, /* i/o: metadata handle */ + const Word16 hodirac_flag /* i : flag to indicate HO-DirAC mode */ ); ivas_error ivas_qmetadata_enc_encode_hr_384_512_fx( - BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream handle */ - IVAS_QMETADATA *hQMetaData, /* i/o: metadata handle */ + BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream handle */ + IVAS_QMETADATA *hQMetaData, /* i/o: metadata handle */ const Word16 bits_sph_idx, const Word16 bits_sp_coh ); void ivas_merge_masa_metadata_fx( - MASA_ENCODER_HANDLE hMasa, /* i/o: MASA enc handle. source for MASA metadata and combined metadata will be here */ - OMASA_SPATIAL_META_HANDLE hOMasaMeta /* i : ISM-object metadata to be merged with the MASA metadata */ + MASA_ENCODER_HANDLE hMasa, /* i/o: MASA enc handle. source for MASA metadata and combined metadata will be here */ + OMASA_SPATIAL_META_HANDLE hOMasaMeta /* i : ISM-object metadata to be merged with the MASA metadata */ ); /*! r: number of bits written */ void ivas_qmetadata_enc_sid_encode_fx( - BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream handle */ - IVAS_QMETADATA *q_metadata, /* i/o: metadata handle */ - const Word16 masa_sid_descriptor, /* i : description of MASA SID coding structure*/ - const Word16 nchan_transport, /* i : number of transport channels */ - const Word16 ivas_format /* i : ivas format */ + BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream handle */ + IVAS_QMETADATA *q_metadata, /* i/o: metadata handle */ + const Word16 masa_sid_descriptor, /* i : description of MASA SID coding structure*/ + const Word16 nchan_transport, /* i : number of transport channels */ + const Word16 ivas_format /* i : ivas format */ ); + void ivas_param_mc_enc_fx( - Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ - BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle */ - Word32 *data_f_fx[], /* i/o: input/transport MC data Q11 */ - const Word16 input_frame /* i : input frame length */ + Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ + BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle */ + Word32 *data_f_fx[], /* i/o: input/transport MC data Q11 */ + const Word16 input_frame /* i : input frame length */ ); void ivas_merge_masa_transports_fx( @@ -3522,16 +3549,16 @@ void ivas_merge_masa_transports_fx( ); void ivas_param_mc_enc_close_fx( - PARAM_MC_ENC_HANDLE *hParamMC, /* i/o: Parametric MC encoder handle */ - const Word32 input_Fs /* i : input sampling rate */ + PARAM_MC_ENC_HANDLE *hParamMC, /* i/o: Parametric MC encoder handle */ + const Word32 input_Fs /* i : input sampling rate */ ); ivas_error ivas_param_mc_enc_open_fx( - Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ + Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ ); ivas_error ivas_param_mc_enc_reconfig_fx( - Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ + Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ ); Word16 ivas_arith_encode_cmplx_cell_array_fx( @@ -3548,20 +3575,20 @@ Word16 ivas_arith_encode_cmplx_cell_array_fx( ); ivas_error stereo_dmx_evs_init_encoder_fx( - STEREO_DMX_EVS_ENC_HANDLE *hStereoDmxEVS_out, /* o : Stereo downmix for EVS encoder handle */ - const Word32 input_Fs /* i : input sampling rate */ + STEREO_DMX_EVS_ENC_HANDLE *hStereoDmxEVS_out, /* o : Stereo downmix for EVS encoder handle */ + const Word32 input_Fs /* i : input sampling rate */ ); void stereo_dmx_evs_enc_fx( - STEREO_DMX_EVS_ENC_HANDLE hStereoDmxEVS, /* i/o: Stereo downmix for EVS encoder handle */ - const Word32 input_Fs, /* i : input sampling rate */ - Word16 data[CPE_CHANNELS * L_FRAME48k], /* i/o: input signal Q0 */ - const Word16 n_samples, /* i : number of input samples */ - const bool is_binaural /* i : indication that input is binaural audio */ + STEREO_DMX_EVS_ENC_HANDLE hStereoDmxEVS, /* i/o: Stereo downmix for EVS encoder handle */ + const Word32 input_Fs, /* i : input sampling rate */ + Word16 data[CPE_CHANNELS * L_FRAME48k], /* i/o: input signal Q0 */ + const Word16 n_samples, /* i : number of input samples */ + const bool is_binaural /* i : indication that input is binaural audio */ ); void stereo_dmx_evs_close_encoder_fx( - STEREO_DMX_EVS_ENC_HANDLE *hStereoDmxEVS /* i/o: Stereo downmix for EVS encoder handle */ + STEREO_DMX_EVS_ENC_HANDLE *hStereoDmxEVS /* i/o: Stereo downmix for EVS encoder handle */ ); void ivas_omasa_encode_masa_to_total_fx( @@ -3569,74 +3596,78 @@ void ivas_omasa_encode_masa_to_total_fx( BSTR_ENC_HANDLE hMetaData, const Word16 low_bitrate_mode, const Word16 nbands, - const Word16 nblocks ); + const Word16 nblocks +); + ivas_error ivas_masa_enc_config_fx( - Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); + ivas_error ivas_omasa_enc_config_fx( - Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); void ivas_omasa_enc_close_fx( - OMASA_ENC_HANDLE *hOMasa /* i/o: encoder OMASA handle */ + OMASA_ENC_HANDLE *hOMasa /* i/o: encoder OMASA handle */ ); + ivas_error ivas_omasa_enc_open_fx( - Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ + Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ ); void ivas_masa_estimate_energy_fx( - MASA_ENCODER_HANDLE hMasa, /* i/o: MASA encoder structure */ - Word32 *data_fx[], /* i : Input audio channels Q(q_data) */ - const Word16 input_frame, /* i : frame length */ - const Word16 nchan_transport, /* i : number of MASA input/transport channels */ - Word16 q_data /* i : q for data_fx */ + MASA_ENCODER_HANDLE hMasa, /* i/o: MASA encoder structure */ + Word32 *data_fx[], /* i : Input audio channels Q(q_data) */ + const Word16 input_frame, /* i : frame length */ + const Word16 nchan_transport, /* i : number of MASA input/transport channels */ + Word16 q_data /* i : q for data_fx */ ); void ivas_masa_enc_reconfigure_fx( - Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); ivas_error ivas_masa_encode_fx( - MASA_ENCODER_HANDLE hMasa, /* i/o: MASA encoder structure */ - IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ - BSTR_ENC_HANDLE hMetaData, /* i/o: Metadata bitstream handle */ - Word16 *nb_bits_metadata, /* o : number of metadata bits written */ - const Word16 nchan_transport, /* i : number of MASA input/transport channels */ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const Word32 ivas_total_brate, /* i : IVAS total bitrate */ - const Word16 Opt_DTX_ON, /* i : DTX on flag */ - const Word16 element_mode, /* i : element mode */ - const ISM_MODE ism_mode, /* i : ISM format mode */ - const Word16 nchan_ism, /* i : number of ISM channels */ - ISM_METADATA_HANDLE hIsmMetaData[MAX_NUM_OBJECTS], /* i : ISM metadata handle */ - const Word16 idx_separated_object, /* i : index of the separated object */ - OMASA_ENC_HANDLE hOMasa, /* i : OMASA encoder handle */ - const Word16 ism_imp, /* i : importance of separated object */ - const Word16 flag_omasa_ener_brate /* i : less bitrate for objects in OMASA flag */ + MASA_ENCODER_HANDLE hMasa, /* i/o: MASA encoder structure */ + IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ + BSTR_ENC_HANDLE hMetaData, /* i/o: Metadata bitstream handle */ + Word16 *nb_bits_metadata, /* o : number of metadata bits written */ + const Word16 nchan_transport, /* i : number of MASA input/transport channels */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + const Word16 Opt_DTX_ON, /* i : DTX on flag */ + const Word16 element_mode, /* i : element mode */ + const ISM_MODE ism_mode, /* i : ISM format mode */ + const Word16 nchan_ism, /* i : number of ISM channels */ + ISM_METADATA_HANDLE hIsmMetaData[MAX_NUM_OBJECTS], /* i : ISM metadata handle */ + const Word16 idx_separated_object, /* i : index of the separated object */ + OMASA_ENC_HANDLE hOMasa, /* i : OMASA encoder handle */ + const Word16 ism_imp, /* i : importance of separated object */ + const Word16 flag_omasa_ener_brate /* i : less bitrate for objects in OMASA flag */ ); void ivas_write_format_sid_fx( - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const Word16 element_mode, /* i : element bitrate */ - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 sba_order, /* i : Ambisonic (SBA) order */ - const Word16 sba_planar /* i : SBA planar flag */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const Word16 element_mode, /* i : element bitrate */ + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + const Word16 sba_order, /* i : Ambisonic (SBA) order */ + const Word16 sba_planar /* i : SBA planar flag */ ); void ivas_write_format_fx( - Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); ivas_error create_sce_enc_fx( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ - const Word16 sce_id, /* i : SCE # identifier */ - const Word32 element_brate /* i : element bitrate */ + Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ + const Word16 sce_id, /* i : SCE # identifier */ + const Word32 element_brate /* i : element bitrate */ ); ivas_error create_cpe_enc_fx( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ - const Word16 cpe_id, /* i : CPE # identifier */ - const Word32 element_brate /* i : element bitrate */ + Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ + const Word16 cpe_id, /* i : CPE # identifier */ + const Word32 element_brate /* i : element bitrate */ ); void ivas_quantise_real_values_fx( @@ -3646,7 +3677,8 @@ void ivas_quantise_real_values_fx( const Word32 max_value_fx, Word16 *index, Word32 *quant_fx, - const Word16 dim ); + const Word16 dim +); void ivas_quantise_real_values_enc_fx( const Word32 *values_fx, // Q28 @@ -3655,7 +3687,8 @@ void ivas_quantise_real_values_enc_fx( const Word32 max_value_fx, // Q28 Word16 *index, Word32 *quant_fx, // Q28 - const Word16 dim ); + const Word16 dim +); void ivas_quantise_real_values_enc_fx_varq( const Word32 *values_fx, @@ -3665,70 +3698,77 @@ void ivas_quantise_real_values_enc_fx_varq( Word16 *index, Word32 *quant_fx, const Word16 dim, - Word16 inp_q ); + Word16 inp_q +); void ivas_spar_quant_dtx_init_fx( ivas_spar_md_t *spar_md, - Word32 *min_max ); + Word32 *min_max +); void ivas_spar_quant_dtx_init_fx( ivas_spar_md_t *spar_md, - Word32 *min_max ); + Word32 *min_max +); void ivas_copy_band_coeffs_idx_to_arr( ivas_band_coeffs_ind_t *pBands_idx, const Word16 nB, Word16 *pSymbol_re, ivas_cell_dim_t *pCell_dims, - const ivas_coeffs_type_t coeff_type ); + const ivas_coeffs_type_t coeff_type +); void ivas_clear_band_coeffs_fx( ivas_band_coeffs_t *pband_coeffs, - const UWord16 num_bands ); + const UWord16 num_bands +); Word16 ivas_qmetadata_DecodeExtendedGR( UWord16 *bitstream, Word16 *index, const Word16 alph_size, - const Word16 gr_param ); + const Word16 gr_param +); void ivas_masa_combine_directions_fx( - MASA_ENCODER_HANDLE hMasa /* i/o: MASA encoder handle */ + MASA_ENCODER_HANDLE hMasa /* i/o: MASA encoder handle */ ); /*! r: Bits to be used for quantizing distribution ratio of direct-to-total ratios */ Word16 ivas_get_df_ratio_bits_hodirac_fx( - const Word16 index_diff /* i : index of quantized diffuse-to-total ratio */ + const Word16 index_diff /* i : index of quantized diffuse-to-total ratio */ ); /*! r: Bits to be used for quantizing distribution ratio of direct-to-total ratios */ Word16 ivas_get_df_ratio_bits_fx( - const Word16 index_diff /* i : index of quantized diffuse-to-total ratio */ + const Word16 index_diff /* i : index of quantized diffuse-to-total ratio */ ); void invdct4_transform_fx( - Word32 *v_fx, /* i : input vector */ - UWord8 *invdct_v, /* o : transformed vector */ - Word16 q ); + Word32 *v_fx, /* i : input vector */ + UWord8 *invdct_v, /* o : transformed vector */ + Word16 q +); void ivas_spar_param_to_masa_param_mapping_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ Word32 inRe_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, real */ Word32 inIm_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, imag */ Word16 q_cldfb[6][CLDFB_SLOTS_PER_SUBFRAME], - const Word16 subframe /* i : Subframe to map */ + const Word16 subframe /* i : Subframe to map */ ); ivas_error ivas_binRenderer_open_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); void ivas_binRenderer_close_fx( - BINAURAL_RENDERER_HANDLE *hBinRenderer /* i/o: decoder binaural renderer handle */ + BINAURAL_RENDERER_HANDLE *hBinRenderer /* i/o: decoder binaural renderer handle */ ); void ivas_init_binaural_hrtf_fx( - HRTFS_FASTCONV *HrtfFastConv /* i/o: FASTCONV HRTF structure */ + HRTFS_FASTCONV *HrtfFastConv /* i/o: FASTCONV HRTF structure */ ); ivas_error ivas_allocate_binaural_hrtf_fx( @@ -3738,31 +3778,31 @@ ivas_error ivas_allocate_binaural_hrtf_fx( ); void ivas_binRenderer_fx( - BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ - const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, /* i/o: pose correction data handle */ - COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined head and external orientation handle*/ - const Word16 numTimeSlots, /* i : number of time slots to render */ + BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ + const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, /* i/o: pose correction data handle */ + COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined head and external orientation handle*/ + const Word16 numTimeSlots, /* i : number of time slots to render */ Word32 Cldfb_RealBuffer_Binaural_fx[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Rotated Binaural signals */ Word32 Cldfb_ImagBuffer_Binaural_fx[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Rotated Binaural signals */ - Word32 RealBuffer_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ - Word32 ImagBuffer_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ - Word16 *Q_in /* i : LS signals exp */ + Word32 RealBuffer_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ + Word32 ImagBuffer_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ + Word16 *Q_in /* i : LS signals exp */ ); void ivas_binaural_add_LFE_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - Word16 output_frame, /* i : length of input frame */ - Word32 *input_fx[], /* i : transport channels */ - Word32 *output_fx[] /* o : synthesized core-coder transport channels/DirAC output */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Word16 output_frame, /* i : length of input frame */ + Word32 *input_fx[], /* i : transport channels */ + Word32 *output_fx[] /* o : synthesized core-coder transport channels/DirAC output */ ); void ivas_mc2sba_fx( - IVAS_OUTPUT_SETUP hIntSetup, /* i : Format of decoder output */ - Word32 *in_buffer_td[], /* i : MC signals (on input) and the HOA3 (on output) */ - Word32 *buffer_td[], /* i/o: MC signals (on input) and the HOA3 (on output) */ - const Word16 output_frame, /* i : output frame length per channel */ - const Word16 sba_order, /* i : Ambisonic (SBA) order */ - const Word16 gain_lfe /* i : gain for LFE, 0 = ignore LFE */ + IVAS_OUTPUT_SETUP hIntSetup, /* i : Format of decoder output */ + Word32 *in_buffer_td[], /* i : MC signals (on input) and the HOA3 (on output) */ + Word32 *buffer_td[], /* i/o: MC signals (on input) and the HOA3 (on output) */ + const Word16 output_frame, /* i : output frame length per channel */ + const Word16 sba_order, /* i : Ambisonic (SBA) order */ + const Word16 gain_lfe /* i : gain for LFE, 0 = ignore LFE */ ); void ivas_param_mc_mc2sba_cldfb_fx( @@ -3776,141 +3816,145 @@ void ivas_param_mc_mc2sba_cldfb_fx( ); void ivas_ism2sba_sf_fx( - Word32 *buffer_in_fx[], /* i : TC buffer */ - Word32 *buffer_out_fx[], /* o : TD signal buffers */ - ISM_RENDERER_HANDLE hIsmRendererData, /* i/o: renderer data */ - const Word16 num_objects, /* i : number of objects */ - const Word16 n_samples_to_render, /* i : output frame length per channel */ - const Word16 offset, /* i : offset for the interpolatr */ - const Word16 sba_order /* i : Ambisonic (SBA) order */ + Word32 *buffer_in_fx[], /* i : TC buffer */ + Word32 *buffer_out_fx[], /* o : TD signal buffers */ + ISM_RENDERER_HANDLE hIsmRendererData, /* i/o: renderer data */ + const Word16 num_objects, /* i : number of objects */ + const Word16 n_samples_to_render, /* i : output frame length per channel */ + const Word16 offset, /* i : offset for the interpolatr */ + const Word16 sba_order /* i : Ambisonic (SBA) order */ ); void panning_wrap_angles_fx( - const Word32 azi_deg, /* i : azimuth in degrees for panning direction (positive left) Q22 */ - const Word32 ele_deg, /* i : elevation in degrees for panning direction (positive up) Q22 */ - Word32 *azi_wrapped, /* o : wrapped azimuth component Q22 */ - Word32 *ele_wrapped /* o : wrapped elevation component Q22 */ + const Word32 azi_deg, /* i : azimuth in degrees for panning direction (positive left) Q22 */ + const Word32 ele_deg, /* i : elevation in degrees for panning direction (positive up) Q22 */ + Word32 *azi_wrapped, /* o : wrapped azimuth component Q22 */ + Word32 *ele_wrapped /* o : wrapped elevation component Q22 */ ); -void v_sort_ind_fixed( - Word32 *x, /* i/o: Vector to be sorted */ - Word16 *idx, /* o : Original index positions */ - const Word16 len /* i : vector length */ +void v_sort_ind_fx( + Word32 *x, /* i/o: Vector to be sorted */ + Word16 *idx, /* o : Original index positions */ + const Word16 len /* i : vector length */ ); void ivas_ls_setup_conversion_process_mdct_param_mc_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - Word32 *x_fx[][NB_DIV], /* i/o: Fixed output synthesis signal */ - Word16 x_e[CPE_CHANNELS][NB_DIV] /* i/o: Exponent for output synthesis signal */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Word32 *x_fx[][NB_DIV], /* i/o: Fixed output synthesis signal */ + Word16 x_e[CPE_CHANNELS][NB_DIV] /* i/o: Exponent for output synthesis signal */ ); void lls_interp_n_fx( - Word16 x_fx[], /* i/o: input/output vector */ - const Word16 N, /* i : length of the input vector */ - Word16 *a_fx, /* o : calculated slope */ - Word16 *b_fx, /* o : calculated offset */ - const Word16 upd /* i : use 1 to update x[] with the interpolated output */ + Word16 x_fx[], /* i/o: input/output vector */ + const Word16 N, /* i : length of the input vector */ + Word16 *a_fx, /* o : calculated slope */ + Word16 *b_fx, /* o : calculated offset */ + const Word16 upd /* i : use 1 to update x[] with the interpolated output*/ ); void ivas_lfe_synth_with_filters_fx( - MCMASA_LFE_SYNTH_DATA_HANDLE hMasaLfeSynth, /* i/o: LFE synthesis structure for McMASA */ - Word32 *data_f[], /* o : output signals */ - const Word16 output_frame, /* i : output frame length per channel */ - const Word16 separateChannelIndex, /* i : separate channel index */ - const Word16 lfeChannelIndex /* i : LFE channel index */ + MCMASA_LFE_SYNTH_DATA_HANDLE hMasaLfeSynth, /* i/o: LFE synthesis structure for McMASA */ + Word32 *data_f[], /* o : output signals */ + const Word16 output_frame, /* i : output frame length per channel */ + const Word16 separateChannelIndex, /* i : separate channel index */ + const Word16 lfeChannelIndex /* i : LFE channel index */ ); void ivas_lfe_enc_fx( - LFE_ENC_HANDLE hLFE, /* i/o: LFE encoder handle */ - Word32 data_lfe_ch[], /* i : input LFE signal */ - Word16 q_data_lfe_ch, /* i : Q of input LFE signal */ - const Word16 input_frame, /* i : input frame length per channel */ - BSTR_ENC_HANDLE hBstr /* i/o: bitstream handle */ + LFE_ENC_HANDLE hLFE, /* i/o: LFE encoder handle */ + Word32 data_lfe_ch[], /* i : input LFE signal */ + Word16 q_data_lfe_ch, /* i : Q of input LFE signal */ + const Word16 input_frame, /* i : input frame length per channel */ + BSTR_ENC_HANDLE hBstr /* i/o: bitstream handle */ ); void ivas_filter_process_fx( - ivas_filters_process_state_t *filter_state, /* i/o: filter state handle */ - Word32 *pIn_Out_fx, /* i : signal subject to filtering */ - const Word16 length, /* i : filter order */ - Word16 q_factor ); + ivas_filters_process_state_t *filter_state, /* i/o: filter state handle */ + Word32 *pIn_Out_fx, /* i : signal subject to filtering */ + const Word16 length, /* i : filter order */ + Word16 q_factor +); void ivas_filter_process_exp_fx( - ivas_filters_process_state_t *filter_state, /* i/o: filter state handle */ - Word32 *pIn_Out_fx, /* i/o: signal subject to filtering (exp[i] : pIn_out_e[i]) */ - const Word16 length, /* i : filter order */ - Word16 *pIn_Out_e ); + ivas_filters_process_state_t *filter_state, /* i/o: filter state handle */ + Word32 *pIn_Out_fx, /* i/o: signal subject to filtering (exp[i] : pIn_out_e[i]) */ + const Word16 length, /* i : filter order */ + Word16 *pIn_Out_e +); ivas_error ivas_osba_enc_open_fx( - Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ + Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ ); void ivas_osba_enc_close_fx( - OSBA_ENC_HANDLE *hOSba /* i/o: encoder OSBA handle */ + OSBA_ENC_HANDLE *hOSba /* i/o: encoder OSBA handle */ ); void ivas_osba_enc_fx( - OSBA_ENC_HANDLE hOSba, /* i/o: OSBA encoder handle */ - ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handle */ - Word32 *data_in_fx[], /* i/o: Input / transport audio signals */ - const Word16 input_frame, /* i : Input frame size */ - const Word16 nchan_ism, /* i : Number of objects for parameter analysis */ - const ISM_MODE ism_mode, /* i : ISM mode */ - const Word16 sba_analysis_order, /* i : SBA order evaluated in DirAC/SPAR encoder */ - const Word32 input_Fs, /* i : input sampling rate */ - const Word16 sba_planar, /* i : planar SBA flag */ - Word16 *q_data ); + OSBA_ENC_HANDLE hOSba, /* i/o: OSBA encoder handle */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handle */ + Word32 *data_in_fx[], /* i/o: Input / transport audio signals */ + const Word16 input_frame, /* i : Input frame size */ + const Word16 nchan_ism, /* i : Number of objects for parameter analysis */ + const ISM_MODE ism_mode, /* i : ISM mode */ + const Word16 sba_analysis_order, /* i : SBA order evaluated in DirAC/SPAR encoder */ + const Word32 input_Fs, /* i : input sampling rate */ + const Word16 sba_planar, /* i : planar SBA flag */ + Word16 *q_data +); ivas_error ivas_osba_data_open_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ); + ivas_error ivas_osba_dirac_td_binaural_jbm_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ - UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ - UWord16 *nSamplesAvailable, /* o : number of CLDFB slots still to render */ - Word32 *output_fx[] /* o : rendered time signal */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ + UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ + UWord16 *nSamplesAvailable, /* o : number of CLDFB slots still to render */ + Word32 *output_fx[] /* o : rendered time signal */ ); ivas_error ivas_osba_ism_metadata_dec_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const Word32 ism_total_brate, /* i : ISM total bitrate */ - Word16 *nchan_ism, /* o : number of ISM separated channels */ - Word16 nb_bits_metadata[] /* o : number of ISM metadata bits */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const Word32 ism_total_brate, /* i : ISM total bitrate */ + Word16 *nchan_ism, /* o : number of ISM separated channels */ + Word16 nb_bits_metadata[] /* o : number of ISM metadata bits */ ); ivas_error ivas_osba_render_sf_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ - UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ - UWord16 *nSamplesAvailableNext, /* o : number of CLDFB slots still to render */ - Word32 *p_output[] /* o : rendered time signal */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ + UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ + UWord16 *nSamplesAvailableNext, /* o : number of CLDFB slots still to render */ + Word32 *p_output[] /* o : rendered time signal */ ); void ivas_osba_stereo_add_channels_fx( - Word32 *tc_fx[], /* i : transport channels */ - Word32 *output_fx[], /* i/o: output channels */ - const Word16 gain, /* i : gain bed value Q11 */ - const Word16 nchan_out, /* i : number of output channels */ - const Word16 nchan_ism, /* i : number of ISM channels */ - const UWord16 n_samples_to_render /* i : output frame length per channel */ + Word32 *tc_fx[], /* i : transport channels */ + Word32 *output_fx[], /* i/o: output channels */ + const Word16 gain, /* i : gain bed value Q11 */ + const Word16 nchan_out, /* i : number of output channels */ + const Word16 nchan_ism, /* i : number of ISM channels */ + const UWord16 n_samples_to_render /* i : output frame length per channel */ ); void ivas_osba_data_close_fx( - SBA_ISM_DATA_HANDLE *hSbaIsmData /* i/o: OSBA rendering handle */ + SBA_ISM_DATA_HANDLE *hSbaIsmData /* i/o: OSBA rendering handle */ ); ISM_MODE ivas_osba_ism_mode_select( - const Word32 ivas_total_brate, /* i : IVAS total bitrate */ - const Word16 nchan_ism /* i : number of input ISM's */ + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + const Word16 nchan_ism /* i : number of input ISM's */ ); void ivas_set_ism_importance_interformat_fx( - const Word32 ism_total_brate, /* i/o: ISms total bitrate */ - const Word16 nchan_transport, /* i : number of transported channels */ - ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ - SCE_ENC_HANDLE hSCE[], /* i/o: SCE encoder handles */ - const Word16 lp_noise_CPE_fx, /* i : LP filtered total noise estimation */ - Word16 ism_imp[] /* o : ISM importance flags */ + const Word32 ism_total_brate, /* i/o: ISms total bitrate */ + const Word16 nchan_transport, /* i : number of transported channels */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + SCE_ENC_HANDLE hSCE[], /* i/o: SCE encoder handles */ + const Word16 lp_noise_CPE_fx, /* i : LP filtered total noise estimation */ + Word16 ism_imp[] /* o : ISM importance flags */ ); void ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( @@ -3919,15 +3963,16 @@ void ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( Word32 inIm_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /*cldfb_buf_q*/ Word16 *cldfb_buf_q, const Word16 nBins, - const Word16 subframe ); - + const Word16 subframe +); void ivas_omasa_decode_masa_to_total_fx( UWord16 *bit_stream, Word16 *index, Word32 masa_to_total_energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], const Word16 nbands, - const Word16 nblocks ); + const Word16 nblocks +); /*----------------------------------------------------------------------------------* @@ -3935,15 +3980,15 @@ void ivas_omasa_decode_masa_to_total_fx( *----------------------------------------------------------------------------------*/ ivas_error ivas_td_binaural_open_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ Word16 *SrcInd, /*Temporarily used to store the updated value of SrcInd*/ Word16 *num_src ); ivas_error ivas_td_binaural_renderer_sf_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - Word32 *output_fx[], /* i/o: SCE channels / Binaural synthesis */ - const Word16 n_samples_granularity /* i : granularity of the renderer/buffer */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Word32 *output_fx[], /* i/o: SCE channels / Binaural synthesis */ + const Word16 n_samples_granularity /* i : granularity of the renderer/buffer */ ); @@ -3952,49 +3997,50 @@ ivas_error ivas_td_binaural_renderer_sf_fx( *----------------------------------------------------------------------------------*/ void ivas_FB_mixer_close_fx( - IVAS_FB_MIXER_HANDLE *hFbMixer, /* i/o: FB mixer handle */ - const Word32 sampling_rate, /* i : sampling rate in Hz */ - const Word16 spar_reconfig_flag /* i : SPAR reconfiguration flag */ + IVAS_FB_MIXER_HANDLE *hFbMixer, /* i/o: FB mixer handle */ + const Word32 sampling_rate, /* i : sampling rate in Hz */ + const Word16 spar_reconfig_flag /* i : SPAR reconfiguration flag */ ); void ivas_fb_mixer_pcm_ingest_fx( - IVAS_FB_MIXER_HANDLE hFbMixer, /* i/o: FB mixer handle */ - Word32 *pcm_in[], /* i : input audio channels Qq_data_fix[] */ - Word32 **ppOut_pcm, /* o : output audio channels Qq_ppOut_pcm[] */ - const Word16 frame_len, /* i : frame length */ + IVAS_FB_MIXER_HANDLE hFbMixer, /* i/o: FB mixer handle */ + Word32 *pcm_in[], /* i : input audio channels Qq_data_fix[] */ + Word32 **ppOut_pcm, /* o : output audio channels Qq_ppOut_pcm[] */ + const Word16 frame_len, /* i : frame length */ const Word16 HOA_md_ind[IVAS_SPAR_MAX_CH], Word16 q_data_fix, - Word16 *q_ppOut_pcm ); + Word16 *q_ppOut_pcm +); void ivas_fb_mixer_process_fx( - IVAS_FB_MIXER_HANDLE hFbMixer, /* i/o: FB mixer handle */ - Word32 ***mixer_mat_fx, /* i : mixer matrix */ - Word16 *q_mixer_mat_fx, /* i : mixer matrix Q-factor */ - Word32 **ppOut_pcm_fx, /* o : output audio channels */ - Word16 *q_ppOut_pcm_fx, /* o : output audio channels Q-factor */ - const Word16 frame_len, /* i : frame length in samples */ + IVAS_FB_MIXER_HANDLE hFbMixer, /* i/o: FB mixer handle */ + Word32 ***mixer_mat_fx, /* i : mixer matrix */ + Word16 *q_mixer_mat_fx, /* i : mixer matrix Q-factor */ + Word32 **ppOut_pcm_fx, /* o : output audio channels */ + Word16 *q_ppOut_pcm_fx, /* o : output audio channels Q-factor */ + const Word16 frame_len, /* i : frame length in samples */ Word16 in_out_mixer_map[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH] /* i/o: mixing mapping */ ); Word16 ivas_get_num_bands_from_bw_idx( - const Word16 bwidth /* i : audio bandwidth */ + const Word16 bwidth /* i : audio bandwidth */ ); void sns_avq_dec_fx( - Word16 *index, /* i : Quantization indices */ - Word32 SNS_Q[NB_DIV][M], /* o : Quantized SNS vectors */ + Word16 *index, /* i : Quantization indices */ + Word32 SNS_Q[NB_DIV][M], /* o : Quantized SNS vectors */ Word16 *q_snsq, - const Word16 L_frame, /* i : frame length */ - const Word16 numlpc /* i : Number of sets of lpc */ + const Word16 L_frame, /* i : frame length */ + const Word16 numlpc /* i : Number of sets of lpc */ ); void sns_avq_dec_stereo_fx( - Word16 *indexl, /* i : Quantization indices (left channel) */ - Word16 *indexr, /* i : Quantization indices (right channe) */ - const Word16 L_frame, /* i : frame length */ - Word32 *SNS_Ql, /* o : Quantized SNS vectors (left channel) */ + Word16 *indexl, /* i : Quantization indices (left channel) */ + Word16 *indexr, /* i : Quantization indices (right channe) */ + const Word16 L_frame, /* i : frame length */ + Word32 *SNS_Ql, /* o : Quantized SNS vectors (left channel) */ Word16 *q_l, - Word32 *SNS_Qr, /* o : Quantized SNS vectors (right channe) */ + Word32 *SNS_Qr, /* o : Quantized SNS vectors (right channe) */ Word16 *q_r ); @@ -4005,31 +4051,31 @@ void dequantize_sns_fx( ); void inverseMS_fx( - const Word16 L_frame, /* i : frame length Q0*/ - Word32 x0[], /* i/o: mid/left channel coefficients Qx*/ - Word32 x1[], /* i/o: side/right channel coefficients Qx*/ - const Word32 norm_fac /* i : normalization factor Q31*/ + const Word16 L_frame, /* i : frame length Q0*/ + Word32 x0[], /* i/o: mid/left channel coefficients Qx*/ + Word32 x1[], /* i/o: side/right channel coefficients Qx*/ + const Word32 norm_fac /* i : normalization factor Q31*/ ); void ivas_syn_output_f_fx( - Word32 *synth[], /* i/o: Word32 synthesis signal */ - const Word16 output_frame, /* i : output frame length (one channel) */ - const Word16 n_channels, /* i : number of output channels */ - Word32 *synth_out /* o : integer 16 bits synthesis signal */ + Word32 *synth[], /* i/o: Word32 synthesis signal */ + const Word16 output_frame, /* i : output frame length (one channel) */ + const Word16 n_channels, /* i : number of output channels */ + Word32 *synth_out /* o : integer 16 bits synthesis signal */ ); ivas_error ivas_init_encoder_fx( - Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); ivas_error ivas_output_buff_dec_fx( - Word32 *p_output_f[], /* i/o: output audio buffers */ - const Word16 nchan_out_buff_old, /* i : previous frame number of output channels */ - const Word16 nchan_out_buff /* i : number of output channels */ + Word32 *p_output_f[], /* i/o: output audio buffers */ + const Word16 nchan_out_buff_old, /* i : previous frame number of output channels */ + const Word16 nchan_out_buff /* i : number of output channels */ ); ivas_error ivas_dec_get_format_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); ivas_error ivas_dec_setup( @@ -4037,113 +4083,112 @@ ivas_error ivas_dec_setup( ); ivas_error create_mct_dec_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); ivas_error mct_dec_reconfigure_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const UWord16 b_nchan_change /* i : flag indicating different channel count */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const UWord16 b_nchan_change /* i : flag indicating different channel count */ ); ivas_error ivas_corecoder_dec_reconfig_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const Word16 nSCE_old, /* i : number of SCEs in previous frame */ - Word16 nCPE_old, /* i : number of CPEs in previous frame */ - const Word16 nchan_transport_old, /* i : number of TCs in previous frame */ - const Word16 sba_dirac_stereo_flag_old, /* i : signal stereo rendering using DFT upmix in previous frame */ - const Word32 brate_SCE, /* i : bitrate to be set for the SCEs */ - const Word32 brate_CPE /* i : bitrate to be set for the CPEs */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const Word16 nSCE_old, /* i : number of SCEs in previous frame */ + Word16 nCPE_old, /* i : number of CPEs in previous frame */ + const Word16 nchan_transport_old, /* i : number of TCs in previous frame */ + const Word16 sba_dirac_stereo_flag_old, /* i : signal stereo rendering using DFT upmix in previous frame */ + const Word32 brate_SCE, /* i : bitrate to be set for the SCEs */ + const Word32 brate_CPE /* i : bitrate to be set for the CPEs */ ); ivas_error ivas_hp20_dec_reconfig_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const Word16 nchan_hp20_old /* i : number of HP20 filters in previous frame*/ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const Word16 nchan_hp20_old /* i : number of HP20 filters in previous frame */ ); Word16 getNumChanSynthesis( - Decoder_Struct *st_ivas /* i : IVAS decoder structure */ + Decoder_Struct *st_ivas /* i : IVAS decoder structure */ ); void ivas_destroy_dec_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); ivas_error ivas_core_dec_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - SCE_DEC_HANDLE hSCE, /* i/o: SCE decoder structure */ - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - MCT_DEC_HANDLE hMCT, /* i/o: MCT decoder structure */ - const Word16 n_channels, /* i : number of channels to be decoded */ - Word32 *output_fx[], /* o : output synthesis signal */ - Word32 outputHB[][L_FRAME48k], /* o : output HB synthesis signal */ - Word32 DFT_fx[CPE_CHANNELS][STEREO_DFT_BUF_MAX], /* o : DFT buffers */ - const Word16 sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + SCE_DEC_HANDLE hSCE, /* i/o: SCE decoder structure */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + MCT_DEC_HANDLE hMCT, /* i/o: MCT decoder structure */ + const Word16 n_channels, /* i : number of channels to be decoded */ + Word32 *output_fx[], /* o : output synthesis signal */ + Word32 outputHB[][L_FRAME48k], /* o : output HB synthesis signal */ + Word32 DFT_fx[CPE_CHANNELS][STEREO_DFT_BUF_MAX], /* o : DFT buffers */ + const Word16 sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ ); void decod_gen_2sbfr_fx( - Decoder_State *st, /* i/o: decoder static memory */ - const Word16 sharpFlag, /* i : formant sharpening flag `Q0*/ - const Word16 *Aq, /* i : LP filter coefficient Q12*/ - Word16 *pitch_buf, /* o : Word16 pitch values for each subframe Q6*/ - Word16 *voice_factors, /* o : voicing factors Q15*/ - Word16 *exc, /* i/o: adapt. excitation exc Q_exc*/ - Word16 *exc2, /* i/o: adapt. excitation/total exc Q_exc*/ - Word16 *bwe_exc, /* o : excitation for SWB TBE Q_exc*/ - Word16 *gain_buf, /* o : Word16 pitch gain for each subframe Q14*/ - const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag Q0*/ - const Word16 tdm_Pri_pitch_buf[] /* i : pitch values for primary channel Q6*/ + Decoder_State *st, /* i/o: decoder static memory */ + const Word16 sharpFlag, /* i : formant sharpening flag Q0*/ + const Word16 *Aq, /* i : LP filter coefficient Q12*/ + Word16 *pitch_buf, /* o : Word16 pitch values for each subframe Q6*/ + Word16 *voice_factors, /* o : voicing factors Q15*/ + Word16 *exc, /* i/o: adapt. excitation exc Q_exc*/ + Word16 *exc2, /* i/o: adapt. excitation/total exc Q_exc*/ + Word16 *bwe_exc, /* o : excitation for SWB TBE Q_exc*/ + Word16 *gain_buf, /* o : Word16 pitch gain for each subframe Q14*/ + const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag Q0*/ + const Word16 tdm_Pri_pitch_buf[] /* i : pitch values for primary channe Q6*/ ); Word16 ivas_smc_gmm_fx( - Encoder_State *st, /* i/o: state structure */ - STEREO_CLASSIF_HANDLE hStereoClassif, /* i/o: stereo classifier structure */ - const Word16 localVAD_HE_SAD, /* i : HE-SAD flag without hangover */ - const Word16 Etot_fx, /* i : total frame energy */ - const Word16 lsp_new_fx[M], /* i : LSPs in current frame Q15 */ - const Word16 cor_map_sum_fx, /* i : correlation map sum (from multi-harmonic anal.) Q8 */ - const Word32 epsP_fx[M + 1], /* i : LP prediciton error */ - const Word32 PS_fx[], /* i : energy spectrum */ - const Word32 non_sta_fx, /* i : unbound non-stationarity Q20 */ - const Word16 relE_fx, /* i : relative frame energy Q8 */ - Word16 *high_lpn_flag, /* i/o: sp/mus LPN flag */ - const Word16 flag_spitch, /* i : flag to indicate very short stable pitch */ + Encoder_State *st, /* i/o: state structure */ + STEREO_CLASSIF_HANDLE hStereoClassif, /* i/o: stereo classifier structure */ + const Word16 localVAD_HE_SAD, /* i : HE-SAD flag without hangover */ + const Word16 Etot_fx, /* i : total frame energy */ + const Word16 lsp_new_fx[M], /* i : LSPs in current frame Q15 */ + const Word16 cor_map_sum_fx, /* i : correlation map sum (from multi-harmonic anal.) Q8 */ + const Word32 epsP_fx[M + 1], /* i : LP prediciton error */ + const Word32 PS_fx[], /* i : energy spectrum */ + const Word32 non_sta_fx, /* i : unbound non-stationarity Q20 */ + const Word16 relE_fx, /* i : relative frame energy Q8 */ + Word16 *high_lpn_flag, /* i/o: sp/mus LPN flag */ + const Word16 flag_spitch, /* i : flag to indicate very short stable pitch */ Word16 Qfact_PS, Word16 Q_esp, Word16 Qfact_PS_past ); void ivas_signaling_enc_fx( - Encoder_State *st, /* i/o: encoder state structure */ - const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ - const Word32 element_brate, /* i : element bitrate */ - const Word16 tdm_SM_or_LRTD_Pri, /* i : channel combination scheme flag in TD stereo OR LRTD primary channel */ - const Word16 tdm_Pitch_reuse_flag /* i : primary channel pitch reuse flag in TD stereo */ + Encoder_State *st, /* i/o: encoder state structure */ + const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ + const Word32 element_brate, /* i : element bitrate */ + const Word16 tdm_SM_or_LRTD_Pri, /* i : channel combination scheme flag in TD stereo OR LRTD primary channel */ + const Word16 tdm_Pitch_reuse_flag /* i : primary channel pitch reuse flag in TD stereo */ ); void smooth_dft2td_transition_fx( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - Word32 *output_fx[CPE_CHANNELS], /* i/o: synthesis @external Fs Q11*/ - const Word16 output_frame /* i : output frame lenght Q0*/ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + Word32 *output_fx[CPE_CHANNELS], /* i/o: synthesis @external Fs Q11*/ + const Word16 output_frame /* i : output frame lenght Q0*/ ); - Word16 is_IVAS_bitrate_fx( - const Word32 ivas_total_brate /* i : IVAS total bitrate */ + const Word32 ivas_total_brate /* i : IVAS total bitrate */ ); void ivas_mdft_fx( - const Word32 *pIn, /* i : input time-domain signal Qin */ - Word32 *pOut_re, /* o : Real part of MDFT signal Qin */ - Word32 *pOut_im, /* o : Imag. part of MDFT signal Qin */ - const Word16 length, /* i : signal length */ - const Word16 mdft_length /* i : MDFT length */ + const Word32 *pIn, /* i : input time-domain signal Qin */ + Word32 *pOut_re, /* o : Real part of MDFT signal Qin */ + Word32 *pOut_im, /* o : Imag. part of MDFT signal Qin */ + const Word16 length, /* i : signal length */ + const Word16 mdft_length /* i : MDFT length */ ); void ivas_imdft_fx( - const Word32 *pRe, /* i : Real part of MDFT signal Qin */ - const Word32 *pIm, /* i : Imag. part of MDFT signal Qin */ - Word32 *pOut, /* o : output time-domain signal Qin */ - const Word16 length /* i : signal length */ + const Word32 *pRe, /* i : Real part of MDFT signal Qin */ + const Word32 *pIm, /* i : Imag. part of MDFT signal Qin */ + Word32 *pOut, /* o : output time-domain signal Qin */ + const Word16 length /* i : signal length */ ); void TonalMdctConceal_create_concealment_noise_ivas_fx( @@ -4165,40 +4210,40 @@ Word16 rand_triangular_signed_fx( ); Word64 var_32_fx( - const Word32 *x, /* i : input vector */ - const Word16 len, /* i : length of inputvector */ - Word16 q /* q : q-factor for the array */ + const Word32 *x, /* i : input vector */ + const Word16 len, /* i : length of inputvector */ + Word16 q /* q : q-factor for the array */ ); ivas_error ivas_jbm_dec_tc_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ Word32 *data_fx ); ivas_error ivas_jbm_dec_flush_renderer_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const Word16 tc_granularity_new, /* i : new renderer granularity */ - const RENDERER_TYPE renderer_type_old, /* i : old renderer type */ - const AUDIO_CONFIG intern_config_old, /* i : old internal config */ - const IVAS_OUTPUT_SETUP_HANDLE hIntSetupOld, /* i : old internal output setup */ - const MC_MODE mc_mode_old, /* i : old MC mode */ - const ISM_MODE ism_mode_old, /* i : old ISM mode */ - UWord16 *nSamplesRendered, /* o : number of samples flushed */ - Word16 *data /* o : output synthesis signal */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const Word16 tc_granularity_new, /* i : new renderer granularity */ + const RENDERER_TYPE renderer_type_old, /* i : old renderer type */ + const AUDIO_CONFIG intern_config_old, /* i : old internal config */ + const IVAS_OUTPUT_SETUP_HANDLE hIntSetupOld, /* i : old internal output setup */ + const MC_MODE mc_mode_old, /* i : old MC mode */ + const ISM_MODE ism_mode_old, /* i : old ISM mode */ + UWord16 *nSamplesRendered, /* o : number of samples flushed */ + Word16 *data /* o : output synthesis signal */ ); void ivas_jbm_dec_feed_tc_to_renderer_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const Word16 nSamplesForRendering, /* i : number of TC samples available for rendering */ - Word16 *nSamplesResidual, /* o : number of samples not fitting into the renderer grid and buffer for the next call*/ - Word32 *data /* i/o: transport channels/output synthesis signal */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const Word16 nSamplesForRendering, /* i : number of TC samples available for rendering */ + Word16 *nSamplesResidual, /* o : number of samples not fitting into the renderer grid and buffer for the next call*/ + Word32 *data /* i/o: transport channels/output synthesis signal */ ); void ivas_jbm_dec_feed_tc_to_renderer_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const Word16 nSamplesForRendering, /* i : number of TC samples available for rendering */ - Word16 *nSamplesResidual, /* o : number of samples not fitting into the renderer grid and buffer for the next call*/ - Word32 *data /* i/o: transport channels/output synthesis signal */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const Word16 nSamplesForRendering, /* i : number of TC samples available for rendering */ + Word16 *nSamplesResidual, /* o : number of samples not fitting into the renderer grid and buffer for the next call*/ + Word32 *data /* i/o: transport channels/output synthesis signal */ ); #ifdef OBJ_EDITING_API @@ -4208,69 +4253,70 @@ void ivas_jbm_dec_prepare_renderer( #endif void ivas_jbm_dec_get_adapted_subframes( - const Word16 nCldfbTs, /* i : number of time slots in the current frame */ - Word16 *subframe_nbslots, /* i/o: subframe grid */ - Word16 *nb_subframes /* i/o: number of subframes in the frame */ + const Word16 nCldfbTs, /* i : number of time slots in the current frame */ + Word16 *subframe_nbslots, /* i/o: subframe grid */ + Word16 *nb_subframes /* i/o: number of subframes in the frame */ ); void ivas_jbm_dec_get_md_map( - const Word16 default_len, /* i : default frame length in metadata slots */ - const Word16 len, /* i : length of the modfied frames in metadata slots */ - const Word16 subframe_len, /* i : default length of a subframe */ - const Word16 offset, /* i : current read offset into the md buffer */ - const Word16 buf_len, /* i : length of the metadata buffer */ - Word16 *map /* o : metadata index map */ + const Word16 default_len, /* i : default frame length in metadata slots */ + const Word16 len, /* i : length of the modfied frames in metadata slots */ + const Word16 subframe_len, /* i : default length of a subframe */ + const Word16 offset, /* i : current read offset into the md buffer */ + const Word16 buf_len, /* i : length of the metadata buffer */ + Word16 *map /* o : metadata index map */ ); void ivas_jbm_dec_get_md_map_even_spacing( - const Word16 len, /* i : length of the modfied frames in metadata slots */ - const Word16 subframe_len, /* i : default length of a subframe */ - const Word16 offset, /* i : current read offset into the md buffer */ - const Word16 buf_len, /* i : length of the metadata buffer */ - Word16 *map /* o : metadata index map */ + const Word16 len, /* i : length of the modfied frames in metadata slots */ + const Word16 subframe_len, /* i : default length of a subframe */ + const Word16 offset, /* i : current read offset into the md buffer */ + const Word16 buf_len, /* i : length of the metadata buffer */ + Word16 *map /* o : metadata index map */ ); void bitbudget_to_brate( - const Word16 x[], /* i : bitbudgets */ - Word32 y[], /* o : bitrates */ - const Word16 N /* i : number of entries to be converted */ + const Word16 x[], /* i : bitbudgets */ + Word32 y[], /* o : bitrates */ + const Word16 N /* i : number of entries to be converted */ ); Word16 ism_quant_meta_fx( - const Word32 val, /* i : scalar value to quantize */ - Word32 *valQ, /* o : quantized value */ - 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 */ + const Word32 val, /* i : scalar value to quantize */ + Word32 *valQ, /* o : quantized value */ + 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 */ ); ivas_error ivas_set_ism_metadata_fx( - ISM_METADATA_HANDLE hIsmMeta, /* o : ISM metadata handle */ - const Word32 azimuth, /* i : azimuth value */ - const Word32 elevation, /* i : elevation value */ - const Word16 radius_meta, /* i : radius */ - const Word32 yaw, /* i : yaw */ - const Word32 pitch, /* i : pitch */ - const Word16 non_diegetic_flag /* i : non-diegetic object flag */ + ISM_METADATA_HANDLE hIsmMeta, /* o : ISM metadata handle */ + const Word32 azimuth, /* i : azimuth value */ + const Word32 elevation, /* i : elevation value */ + const Word16 radius_meta, /* i : radius */ + const Word32 yaw, /* i : yaw */ + const Word32 pitch, /* i : pitch */ + const Word16 non_diegetic_flag /* i : non-diegetic object flag */ ); ivas_error ivas_ism_metadata_enc_fx( - Word32 *ism_total_brate, /* i/o: ISM total bitrate */ - const Word16 nchan_ism, /* i : number of ISM channels */ - const Word16 nchan_transport, /* i : number of transport channels */ - ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ - SCE_ENC_HANDLE hSCE[], /* i/o: SCE encoder handles */ - BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ - Word16 nb_bits_metadata[], /* o : number of metadata bits */ - const Word16 localVAD[], /* i : VAD flag */ - const Word16 ism_mode, /* i : ISM mode */ - const PARAM_ISM_CONFIG_HANDLE hParamIsm, /* i : Param ISM Config Handle */ - const Word16 ism_extended_metadata_flag, /* i : Extended metadata flag */ - const Word16 lp_noise_CPE, /* i : LP filtered total noise estimation */ - const Word16 flag_omasa_ener_brate, /* i : less bitrate for objects in OMASA flag */ + Word32 *ism_total_brate, /* i/o: ISM total bitrate */ + const Word16 nchan_ism, /* i : number of ISM channels */ + const Word16 nchan_transport, /* i : number of transport channels */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + SCE_ENC_HANDLE hSCE[], /* i/o: SCE encoder handles */ + BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ + Word16 nb_bits_metadata[], /* o : number of metadata bits */ + const Word16 localVAD[], /* i : VAD flag */ + const Word16 ism_mode, /* i : ISM mode */ + const PARAM_ISM_CONFIG_HANDLE hParamIsm, /* i : Param ISM Config Handle */ + const Word16 ism_extended_metadata_flag, /* i : Extended metadata flag */ + const Word16 lp_noise_CPE, /* i : LP filtered total noise estimation */ + const Word16 flag_omasa_ener_brate, /* i : less bitrate for objects in OMASA flag */ Word16 *omasa_stereo_sw_cnt, - const Word16 ini_frame ); + const Word16 ini_frame +); ivas_error ivas_ism_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ @@ -4278,24 +4324,25 @@ ivas_error ivas_ism_dec_config( ); ivas_error ivas_param_ism_dec_open_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); void ivas_param_ism_dec_close_fx( - PARAM_ISM_DEC_HANDLE *hParamIsmDec, /* i/o: decoder ParamISM handle */ - SPAT_PARAM_REND_COMMON_DATA_HANDLE *hSpatParamRendCom_out, /* i/o: common spatial renderer data */ - const AUDIO_CONFIG output_config /* i : output audio configuration */ + PARAM_ISM_DEC_HANDLE *hParamIsmDec, /* i/o: decoder ParamISM handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE *hSpatParamRendCom_out, /* i/o: common spatial renderer data */ + const AUDIO_CONFIG output_config /* i : output audio configuration */ ); void ivas_ism_dec_digest_tc_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); void ivas_param_ism_dec_digest_tc_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const UWord16 nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ - Word32 *transport_channels[], /* i : synthesized core-coder transport channels/DirAC output */ - Word16 q_tc_in ); + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const UWord16 nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ + Word32 *transport_channels[], /* i : synthesized core-coder transport channels/DirAC output */ + Word16 q_tc_in +); #ifdef OBJ_EDITING_API @@ -4310,75 +4357,76 @@ void ivas_param_ism_dec_prepare_renderer_fx( #endif void ivas_param_ism_dec_render_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ - UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ - UWord16 *nSamplesAvailable, /* o : number of CLDFB slots still to render */ - Word32 *output_f_fx[] ); + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ + UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ + UWord16 *nSamplesAvailable, /* o : number of CLDFB slots still to render */ + Word32 *output_f_fx[] +); void ivas_param_ism_params_to_masa_param_mapping_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); Word16 ivas_ism_dtx_enc_fx( - ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ - SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ - const Word32 ivas_total_brate, /* i : IVAS total bitrate */ - const Word16 nchan_ism, /* i : number of objects */ - const Word16 nchan_transport, /* i : number of transport channels */ - Word16 vad_flag[MAX_NUM_OBJECTS], /* i : VAD flag */ - ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ - Word16 md_diff_flag[], /* o : metadata differential flag */ - Word16 *sid_flag /* o : indication of SID frame */ + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + const Word16 nchan_ism, /* i : number of objects */ + const Word16 nchan_transport, /* i : number of transport channels */ + Word16 vad_flag[MAX_NUM_OBJECTS], /* i : VAD flag */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + Word16 md_diff_flag[], /* o : metadata differential flag */ + Word16 *sid_flag /* o : indication of SID frame */ ); void ivas_ism_dtx_dec_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - Word16 *nb_bits_metadata /* o : number of metadata bits */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Word16 *nb_bits_metadata /* o : number of metadata bits */ ); void ivas_ism_get_sce_id_dtx_fx( - ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ - SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ - const Word16 nchan_transport, /* i : number of transport channels */ - const Word16 input_frame /* i : input frame length per channel */ + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ + const Word16 nchan_transport, /* i : number of transport channels */ + const Word16 input_frame /* i : input frame length per channel */ ); void ivas_ism_coh_estim_dtx_enc_fx( - ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ - SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ - const Word16 nchan_transport, /* i : number of transport channels */ - const Word16 input_frame /* i : input frame length */ + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ + const Word16 nchan_transport, /* i : number of transport channels */ + const Word16 input_frame /* i : input frame length */ ); void ivas_ism_dtx_limit_noise_energy_for_near_silence_fx( - SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder structures */ - const Word16 sce_id_dtx, /* i : SCE DTX ID */ - const Word16 nchan_transport, /* i : number of transport channels */ - Word16 *Q_cngNoiseLevel ); - + SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder structures */ + const Word16 sce_id_dtx, /* i : SCE DTX ID */ + const Word16 nchan_transport, /* i : number of transport channels */ + Word16 *Q_cngNoiseLevel +); ivas_error stereo_dft_enc_create_fx( - STEREO_DFT_ENC_DATA_HANDLE *hStereoDft, /* o : encoder DFT stereo handle */ - const Word32 input_Fs, /* i : input sampling rate */ - const Word16 max_bwidth /* i : maximum encoded bandwidth */ + STEREO_DFT_ENC_DATA_HANDLE *hStereoDft, /* o : encoder DFT stereo handle */ + const Word32 input_Fs, /* i : input sampling rate */ + const Word16 max_bwidth /* i : maximum encoded bandwidth */ ); void stereo_dft_enc_reset_fx( - STEREO_DFT_ENC_DATA_HANDLE hStereoDft /* i/o: encoder stereo handle */ + STEREO_DFT_ENC_DATA_HANDLE hStereoDft /* i/o: encoder stereo handle */ ); void stereo_enc_itd_init_fx( - ITD_DATA_HANDLE hItd /* i/o: encoder ITD handle */ + ITD_DATA_HANDLE hItd /* i/o: encoder ITD handle */ ); void stereo_dft_enc_update_fx( - STEREO_DFT_ENC_DATA_HANDLE hStereoDft, /* i/o: encoder stereo handle */ - const Word16 max_bwidth /* i : maximum encoded bandwidth */ + STEREO_DFT_ENC_DATA_HANDLE hStereoDft, /* i/o: encoder stereo handle */ + const Word16 max_bwidth /* i : maximum encoded bandwidth */ ); void stereo_dft_enc_destroy_fx( - STEREO_DFT_ENC_DATA_HANDLE *hStereoDft /* i/o: encoder DFT stereo handle */ + STEREO_DFT_ENC_DATA_HANDLE *hStereoDft /* i/o: encoder DFT stereo handle */ ); void stereo_dft_quantize_res_gains_fx( @@ -4387,7 +4435,8 @@ void stereo_dft_quantize_res_gains_fx( Word32 *gq, // Q31 Word32 *rq, // Q31 Word16 *ig, - Word16 *ir ); + Word16 *ir +); void stereo_dft_dequantize_itd_fx( Word16 *ind, /* Q0 */ @@ -4396,283 +4445,287 @@ void stereo_dft_dequantize_itd_fx( ); Word16 stereo_dft_sg_recovery_fx( - STEREO_DFT_DEC_DATA_HANDLE hStereoDft /* i/o: Decoder DFT stereo handle */ + STEREO_DFT_DEC_DATA_HANDLE hStereoDft /* i/o: Decoder DFT stereo handle */ ); Word16 res_bpf_adapt_ivas_fx( - STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: DFT stereo decoder handle */ - const Word32 *bpf_error_signal_8k, /* i : BPF modification signal */ - Word32 res_buf[STEREO_DFT_N_8k], /* i : residual buffer Q_res */ - Word16 q_res ); + STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: DFT stereo decoder handle */ + const Word32 *bpf_error_signal_8k, /* i : BPF modification signal */ + Word32 res_buf[STEREO_DFT_N_8k], /* i : residual buffer Q_res */ + Word16 q_res +); void stereo_dft_dec_read_BS_fx( - const Word32 ivas_total_brate, /* i : IVAS total bitrate Q0*/ - const Word32 element_brate, /* i : element bitrate Q0*/ - Word32 *total_brate, /* o : total bitrate Q0*/ - Decoder_State *st, /* i/o: decoder state structure */ - STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder stereo handle */ - const Word16 bwidth, /* i : bandwidth Q0*/ - const Word16 output_frame, /* i : output frame length Q0*/ - Word32 res_buf_fx[STEREO_DFT_N_8k], /* o : residual buffer Q0*/ - Word16 *nb_bits, /* o : number of bits read Q0*/ - Word16 *coh_fx, /* i/o: Coherence Q15*/ - const Word16 ivas_format /* i : ivas format Q0*/ + const Word32 ivas_total_brate, /* i : IVAS total bitrate Q0*/ + const Word32 element_brate, /* i : element bitrate Q0*/ + Word32 *total_brate, /* o : total bitrate Q0*/ + Decoder_State *st, /* i/o: decoder state structure */ + STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder stereo handle */ + const Word16 bwidth, /* i : bandwidth Q0*/ + const Word16 output_frame, /* i : output frame length Q0*/ + Word32 res_buf_fx[STEREO_DFT_N_8k], /* o : residual buffer Q0*/ + Word16 *nb_bits, /* o : number of bits read Q0*/ + Word16 *coh_fx, /* i/o: Coherence Q15*/ + const Word16 ivas_format /* i : ivas format Q0*/ ); Word16 write_bitstream_adapt_GR_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: Encoder bitstream handle */ - const Word16 ind, /* i : bitstream index */ - const Word16 *in, /* i : values to be written in bitstream */ - const Word16 len, /* i : values vector length */ - const Word16 GR_ord, /* i : GR order to be used */ - const Word16 no_GR_ord /* i : speech/music 0/1 */ + BSTR_ENC_HANDLE hBstr, /* i/o: Encoder bitstream handle */ + const Word16 ind, /* i : bitstream index */ + const Word16 *in, /* i : values to be written in bitstream */ + const Word16 len, /* i : values vector length */ + const Word16 GR_ord, /* i : GR order to be used */ + const Word16 no_GR_ord /* i : speech/music 0/1 */ ); Word16 adapt_GR_ief_fx( - const Word16 *in, /* i : vector to encode */ - Word16 *in_diff, /* o : encoded symbols in case of differential encoding */ - const Word16 *prev, /* i : previous frame data */ - const Word16 len, /* i : input vector length */ - const Word16 no_symb, /* i : number of symbols */ - Word16 *nbits, /* o : number of used bits */ - Word16 *in_enc, /* o : symbold actually encoded after adapt_GR */ - const Word16 *map0, /* i : mapping array */ - const Word16 no_GR_ord, /* i : number of GR order to try 2: 0,1; 3:0,1,2 */ - Word16 *nbits_diff, /* o : number bits in diff encoding */ - const Word16 side_gain_counter, /* i : number of frames since last abs coding */ - Word16 *side_gain_bitdiff_lp, /* i/o: LP-filtered bit difference between abs/diff */ - Word16 *q_side_gain_bitdiff_lp, /* i/o: Q of LP-filtered bit difference between abs/diff */ - const Word16 try_diff /* i : diff coding allowed 1/0 */ + const Word16 *in, /* i : vector to encode */ + Word16 *in_diff, /* o : encoded symbols in case of differential encoding */ + const Word16 *prev, /* i : previous frame data */ + const Word16 len, /* i : input vector length */ + const Word16 no_symb, /* i : number of symbols */ + Word16 *nbits, /* o : number of used bits */ + Word16 *in_enc, /* o : symbold actually encoded after adapt_GR */ + const Word16 *map0, /* i : mapping array */ + const Word16 no_GR_ord, /* i : number of GR order to try 2: 0,1; 3:0,1,2 */ + Word16 *nbits_diff, /* o : number bits in diff encoding */ + const Word16 side_gain_counter, /* i : number of frames since last abs coding */ + Word16 *side_gain_bitdiff_lp, /* i/o: LP-filtered bit difference between abs/diff */ + Word16 *q_side_gain_bitdiff_lp, /* i/o: Q of LP-filtered bit difference between abs/diff */ + const Word16 try_diff /* i : diff coding allowed 1/0 */ ); Word16 adapt_GR_rpg1_ief_fx( - const Word16 *in, /* i : res pred gains input vector */ - Word16 *in_diff, /* o : encoded symbols in case of differential encoding */ - const Word16 *prev, /* i : previous frame data */ - const Word16 len, /* i : input vector length */ - const Word16 no_symb, /* i : number of symbols */ - Word16 *nbits, /* o : number of used bits */ - Word16 *in_enc, /* o : symbold actually encoded after adapt_GR */ - const Word16 *maps, /* i : mapping array */ - Word16 *nbits_diff, /* o : estimated no of bits for differential encoding */ - const Word16 no_GR_ord, /* i : number of GR order to try 2: 0,1; 3:0,1,2 */ - const Word16 try_diff /* i : diff coding allowed 1/0 */ + const Word16 *in, /* i : res pred gains input vector */ + Word16 *in_diff, /* o : encoded symbols in case of differential encoding */ + const Word16 *prev, /* i : previous frame data */ + const Word16 len, /* i : input vector length */ + const Word16 no_symb, /* i : number of symbols */ + Word16 *nbits, /* o : number of used bits */ + Word16 *in_enc, /* o : symbold actually encoded after adapt_GR */ + const Word16 *maps, /* i : mapping array */ + Word16 *nbits_diff, /* o : estimated no of bits for differential encoding */ + const Word16 no_GR_ord, /* i : number of GR order to try 2: 0,1; 3:0,1,2 */ + const Word16 try_diff /* i : diff coding allowed 1/0 */ ); Word16 write_GR1_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: Encoder bitstream handle */ - const Word16 ind, /* i : bitstream index */ - const Word16 *in, /* i : data to be encoded */ - const Word16 len /* i : input data length */ + BSTR_ENC_HANDLE hBstr, /* i/o: Encoder bitstream handle */ + const Word16 ind, /* i : bitstream index */ + const Word16 *in, /* i : data to be encoded */ + const Word16 len /* i : input data length */ ); Word16 write_bitstream_GR_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: Encoder bitstream handle */ - const Word16 ind, /* i : bitstream index */ - const Word16 *in, /* i : input vector */ - const Word16 len, /* i : input vector length */ - const Word16 GR_ord /* i : GR order */ + BSTR_ENC_HANDLE hBstr, /* i/o: Encoder bitstream handle */ + const Word16 ind, /* i : bitstream index */ + const Word16 *in, /* i : input vector */ + const Word16 len, /* i : input vector length */ + const Word16 GR_ord /* i : GR order */ ); void stereo_dft_hybrid_ITD_flag_fx( - STEREO_DFT_CONFIG_DATA_HANDLE hConfig, /* o : DFT stereo configuration */ - const Word32 input_Fs, /* i : CPE element sampling rate */ - const Word16 hybrid_itd_max /* i : flag for hybrid ITD for very large ITDs */ + STEREO_DFT_CONFIG_DATA_HANDLE hConfig, /* o : DFT stereo configuration */ + const Word32 input_Fs, /* i : CPE element sampling rate */ + const Word16 hybrid_itd_max /* i : flag for hybrid ITD for very large ITDs */ ); void rc_uni_dec_init_fx( - RangeUniDecState *rc_st_dec, /* i/o: RC state handle */ - UWord16 *bit_buffer, /* i : Bit buffer */ - const Word16 max_available_bits /* i : Total maximum bits available */ + RangeUniDecState *rc_st_dec, /* i/o: RC state handle */ + UWord16 *bit_buffer, /* i : Bit buffer */ + const Word16 max_available_bits /* i : Total maximum bits available */ ); UWord16 rc_uni_dec_read_symbol_fastS_fx( - RangeUniDecState *rc_st_dec, /* i/o: Decoder State */ - const UWord16 cum_freq_table[], /* i : Cumulative frequency up to symbol */ - const UWord16 sym_freq_table[], /* i : Symbol frequency */ - const UWord16 alphabet_size, /* i : Number of symbols in the alphabet */ - const UWord16 tot_shift /* i : Total frequency as a power of 2 */ + RangeUniDecState *rc_st_dec, /* i/o: Decoder State */ + const UWord16 cum_freq_table[], /* i : Cumulative frequency up to symbol */ + const UWord16 sym_freq_table[], /* i : Symbol frequency */ + const UWord16 alphabet_size, /* i : Number of symbols in the alphabet */ + const UWord16 tot_shift /* i : Total frequency as a power of 2 */ ); Word16 rc_uni_dec_virtual_finish_fx( - RangeUniDecState *rc_st_dec /* i/o: RC state handle */ + RangeUniDecState *rc_st_dec /* i/o: RC state handle */ ); void unclr_classifier_dft_fx( - CPE_ENC_HANDLE hCPE /* i/o: CPE encoder structure */ + CPE_ENC_HANDLE hCPE /* i/o: CPE encoder structure */ ); void xtalk_classifier_dft_fx( - CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ - const Word16 itd, /* i : ITD from DFT stereo - used as a feature */ - const Word32 gcc_phat[] /* i : GPHAT cross-channel correlation function Q31*/ + CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ + const Word16 itd, /* i : ITD from DFT stereo - used as a feature */ + const Word32 gcc_phat[] /* i : GPHAT cross-channel correlation function Q31*/ ); void stereo_td_init_enc_fx( - STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i/o: TD stereo encoder handle */ - const Word16 last_element_mode /* i : last element mode */ + STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i/o: TD stereo encoder handle */ + const Word16 last_element_mode /* i : last element mode */ ); ivas_error stereo_set_tdm_fx( - CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ - const Word16 input_frame, /* i : input frame length per channel */ - Word16 input_q ); + CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ + const Word16 input_frame, /* i : input frame length per channel */ + Word16 input_q +); void stereo_tdm_prep_dwnmx_fx( - CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ - const Word32 *input1, /* i : right channel input */ - const Word16 input_frame, /* i : frame lenght */ - const Word16 input_q /* i : frame lenght */ + CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ + const Word32 *input1, /* i : right channel input */ + const Word16 input_frame, /* i : frame lenght */ + const Word16 input_q /* i : frame lenght */ ); void tdm_upmix_plain_fx( - Word32 Left_fx[], /* o : left channel Qx*/ - Word32 Right_fx[], /* o : right channel Qx*/ - const Word32 PCh_2_L_fx[], /* i : primary channel Qx*/ - const Word32 SCh_2_R_fx[], /* i : secondary channel Qx*/ - const Word32 LR_ratio_fx, /* i : mixing ratio Q31*/ - const Word32 inv_den_LR_ratio_fx, /* i : inverse mixing ration Q31*/ - const Word16 start_index, /* i : start index Q0*/ - const Word16 end_index, /* i : end index Q0*/ - const Word16 plus_minus_flag /* i : plus/minus flag Q0*/ + Word32 Left_fx[], /* o : left channel Qx*/ + Word32 Right_fx[], /* o : right channel Qx*/ + const Word32 PCh_2_L_fx[], /* i : primary channel Qx*/ + const Word32 SCh_2_R_fx[], /* i : secondary channel Qx*/ + const Word32 LR_ratio_fx, /* i : mixing ratio Q31*/ + const Word32 inv_den_LR_ratio_fx, /* i : inverse mixing ration Q31*/ + const Word16 start_index, /* i : start index Q0*/ + const Word16 end_index, /* i : end index Q0*/ + const Word16 plus_minus_flag /* i : plus/minus flag Q0*/ ); void stereo_tdm_combine_fx( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - Word32 *PCh_2_L_fx, /* i/o: Primary channel -> output as left channel Qx*/ - Word32 *SCh_2_R_fx, /* i/o: Secondary channel -> output as right channel Qx*/ - const Word16 output_frame, /* i : Number of samples Q0*/ - const Word16 flag_HB, /* i : flag to distinguish between core (0) and HB (1) synthesis Q0*/ - const Word16 tdm_ratio_idx /* i : TDM ratio index Q0*/ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + Word32 *PCh_2_L_fx, /* i/o: Primary channel -> output as left channel Qx*/ + Word32 *SCh_2_R_fx, /* i/o: Secondary channel -> output as right channel Qx*/ + const Word16 output_frame, /* i : Number of samples Q0*/ + const Word16 flag_HB, /* i : flag to distinguish between core (0) and HB (1) synthesis Q0*/ + const Word16 tdm_ratio_idx /* i : TDM ratio index Q0*/ ); Word16 tdm_lp_comparison_fx( - STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i/o: TD stereo encoder handle */ - STEREO_CLASSIF_HANDLE hStereoClassif, /* i/o: stereo classifier structure */ - Encoder_State *st, /* i/o: Encoder structure */ - Word32 *speech_buff, /* i : Current speech frame Q_speech */ - const Word16 *A_PCh_fx, /* i : primary channel LP coefficients Q12*/ - const Word16 *A_SCh_fx, /* i : secondary channel LP coeff. Q12*/ - const Word16 m, /* i : filter length */ - const Word16 *isp_PCh_fx, /* i : primary channel LSPs Q15 */ - const Word16 *isp_SCh_fx, /* i : secondary channel LSPs Q15 */ - const Word16 L_frame, /* i : frame length */ - const Word32 element_brate_wo_meta, /* i : element bitrate without metadata*/ - Word16 Q_speech ); + STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i/o: TD stereo encoder handle */ + STEREO_CLASSIF_HANDLE hStereoClassif, /* i/o: stereo classifier structure */ + Encoder_State *st, /* i/o: Encoder structure */ + Word32 *speech_buff, /* i : Current speech frame Q_speech */ + const Word16 *A_PCh_fx, /* i : primary channel LP coefficients Q12*/ + const Word16 *A_SCh_fx, /* i : secondary channel LP coeff. Q12*/ + const Word16 m, /* i : filter length */ + const Word16 *isp_PCh_fx, /* i : primary channel LSPs Q15 */ + const Word16 *isp_SCh_fx, /* i : secondary channel LSPs Q15 */ + const Word16 L_frame, /* i : frame length */ + const Word32 element_brate_wo_meta, /* i : element bitrate without metadata */ + Word16 Q_speech +); ivas_error signaling_enc_secondary_fx( - Encoder_State *st, /* i/o: Encoder structure */ - const Word16 tdm_SM_or_LRTD_Pri, /* i : channel combination scheme flag OR LRTD primary channel */ - const Word16 tdm_Pitch_reuse_flag /* i : primary channel pitch reuse flag*/ + Encoder_State *st, /* i/o: Encoder structure */ + const Word16 tdm_SM_or_LRTD_Pri, /* i : channel combination scheme flag OR LRTD primary channel */ + const Word16 tdm_Pitch_reuse_flag /* i : primary channel pitch reuse flag */ ); void tdm_low_rate_enc( - Encoder_State *st, /* i/o: State structure */ - const Word16 Aq[], /* i : 12k8 Lp coefficient */ - const Word16 *res, - /* i : residual signal */ // Q_new - Word16 *synth, - /* i/o: core synthesis */ // Q_new - Word16 *exc_fx, - /* i/o: current non-enhanced excitation */ // Q_new - Word16 *pitch_buf, - /* i/o: floating pitch values for each subframe */ // Q6 - Word16 *voice_factors, - /* o : voicing factors */ // Q15 - Word16 *bwe_exc_fx, - /* o : excitation for SWB TBE */ // Q_new - const Word16 attack_flag, /* i : attck flag */ - const Word16 *lsf_new, - /* i : current frame ISF vector */ // x2.56 - Word16 *tmp_noise, - /* o : long-term noise energy */ // Q8 - Word16 Q_new ); + Encoder_State *st, /* i/o: State structure */ + const Word16 Aq[], /* i : 12k8 Lp coefficient */ + const Word16 *res, /* i : residual signal Q_new*/ + Word16 *synth, /* i/o: core synthesis Q_new*/ + Word16 *exc_fx, /* i/o: current non-enhanced excitation Q_new*/ + Word16 *pitch_buf, /* i/o: floating pitch values for each subframe Q6*/ + Word16 *voice_factors, /* o : voicing factors Q15*/ + Word16 *bwe_exc_fx, /* o : excitation for SWB TBE Q_new*/ + const Word16 attack_flag, /* i : attack flag */ + const Word16 *lsf_new, /* i : current frame ISF vector x2.56 */ + Word16 *tmp_noise, /* o : long-term noise energy Q8 */ + Word16 Q_new +); void tdm_low_rate_dec_fx( - Decoder_State *st, /* i/o: decoder static memory */ - Word16 dct_epit[], /* o : GSC excitation in DCT domain Q_exc*/ - Word16 *pitch_buf, /* o : Word16 pitch values for each subframe Q6*/ - Word16 *voice_factors, /* o : voicing factors Q15*/ - Word16 *exc, /* i/o: adapt. excitation exc Q_exc*/ - Word16 *exc2, /* i/o: adapt. excitation/total exc Q_exc*/ - Word16 *bwe_exc, /* o : excitation for SWB TBE Q_exc*/ - const Word16 *lsf_new /* i : ISFs at the end of the frame Q8/100 (2.56x)*/ + Decoder_State *st, /* i/o: decoder static memory */ + Word16 dct_epit[], /* o : GSC excitation in DCT domain Q_exc*/ + Word16 *pitch_buf, /* o : Word16 pitch values for each subframe Q6*/ + Word16 *voice_factors, /* o : voicing factors Q15*/ + Word16 *exc, /* i/o: adapt. excitation exc Q_exc*/ + Word16 *exc2, /* i/o: adapt. excitation/total exc Q_exc*/ + Word16 *bwe_exc, /* o : excitation for SWB TBE Q_exc*/ + const Word16 *lsf_new /* i : ISFs at the end of the frame Q8/100 (2.56x)*/ ); void tdm_SCh_LSF_intra_pred_fx( - const Word32 element_brate, /* i : element bitrate */ - const Word16 *tdm_lsfQ_PCh_fx, /* i : primary channel LSFs */ - Word16 *pred_lsf_SCh_fx /* o : predicted secondary channel LSFs */ + const Word32 element_brate, /* i : element bitrate */ + const Word16 *tdm_lsfQ_PCh_fx, /* i : primary channel LSFs */ + Word16 *pred_lsf_SCh_fx /* o : predicted secondary channel LSFs */ +); + +void tdm_SCh_LSF_intra_pred_fx( + const Word32 element_brate, /* i : element bitrate */ + const Word16 *tdm_lsfQ_PCh_fx, /* i : primary channel LSFs */ + Word16 *pred_lsf_SCh_fx /* o : predicted secondary channel LSFs */ ); void tdm_SCh_lsf_reuse_fx( - const Word16 enc_dec, /* i : encoder/decoder flag */ - const Word32 element_brate, /* i : element bitrate */ - Word16 lsf_new_fx[M], /* i/o: LSFs at the end of the frame */ - Word16 lsp_new_fx[M], /* i/o: LSPs at the end of the frame */ - const Word16 tdm_lsfQ_PCh_fx[M], /* i : primary channel LSFs */ - const Word16 lsf_wgts_fx[M], /* i : LSF weights */ - Word16 *beta_index /* i/o: quantization index */ + const Word16 enc_dec, /* i : encoder/decoder flag */ + const Word32 element_brate, /* i : element bitrate */ + Word16 lsf_new_fx[M], /* i/o: LSFs at the end of the frame */ + Word16 lsp_new_fx[M], /* i/o: LSPs at the end of the frame */ + const Word16 tdm_lsfQ_PCh_fx[M], /* i : primary channel LSFs */ + const Word16 lsf_wgts_fx[M], /* i : LSF weights */ + Word16 *beta_index /* i/o: quantization index */ ); void EstimateStereoTCXNoiseLevel_fx( - Encoder_State **sts, /* i : state handle */ - Word32 *q_spectrum[CPE_CHANNELS][NB_DIV], /* i : quantized MDCT spectrum */ - Word16 gain_tcx[][NB_DIV], /* i : global gain */ - Word16 gain_tcx_e[][NB_DIV], /* i : global gain exponent */ - Word16 L_frame[][NB_DIV], /* i : frame length */ - Word16 noiseFillingBorder[][NB_DIV], /* i : noise filling border */ - Word16 hm_active[][NB_DIV], /* i : flag indicating if the harmonic model is active */ - const Word16 ignore_chan[], /* i : flag indicating whether the channel should be ignored */ - Word16 fac_ns[][NB_DIV], /* o : noise filling level */ - Word16 param_core[][NB_DIV * NPRM_DIV], /* o : quantized noise filling level */ - const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ + Encoder_State **sts, /* i : state handle */ + Word32 *q_spectrum[CPE_CHANNELS][NB_DIV], /* i : quantized MDCT spectrum */ + Word16 gain_tcx[][NB_DIV], /* i : global gain */ + Word16 gain_tcx_e[][NB_DIV], /* i : global gain exponent */ + Word16 L_frame[][NB_DIV], /* i : frame length */ + Word16 noiseFillingBorder[][NB_DIV], /* i : noise filling border */ + Word16 hm_active[][NB_DIV], /* i : flag indicating if the harmonic model is active */ + const Word16 ignore_chan[], /* i : flag indicating whether the channel should be ignored */ + Word16 fac_ns[][NB_DIV], /* o : noise filling level */ + Word16 param_core[][NB_DIV * NPRM_DIV], /* o : quantized noise filling level */ + const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ); void TNSAnalysisStereo_fx( - Encoder_State **sts, /* i : encoder state handle */ - Word32 *mdst_spectrum_fx[CPE_CHANNELS][NB_DIV], /* o : MDST spectrum Qx*/ - const Word16 bWhitenedDomain, /* i : whitened domain flag Q0*/ - Word16 tnsSize[CPE_CHANNELS][NB_DIV], /* i : number of tns parameters put into prm Q0*/ - Word16 tnsBits[CPE_CHANNELS][NB_DIV], /* i : number of tns bits in the frame Q0*/ - Word16 param_core[][NB_DIV * NPRM_DIV], /* o : TNS parameters Q0*/ - const Word16 mct_on /* i : flag mct block (1) or stereo (0) Q0*/ + Encoder_State **sts, /* i : encoder state handle */ + Word32 *mdst_spectrum_fx[CPE_CHANNELS][NB_DIV], /* o : MDST spectrum Qx*/ + const Word16 bWhitenedDomain, /* i : whitened domain flag Q0*/ + Word16 tnsSize[CPE_CHANNELS][NB_DIV], /* i : number of tns parameters put into prm Q0*/ + Word16 tnsBits[CPE_CHANNELS][NB_DIV], /* i : number of tns bits in the frame Q0*/ + Word16 param_core[][NB_DIV * NPRM_DIV], /* o : TNS parameters Q0*/ + const Word16 mct_on /* i : flag mct block (1) or stereo (0) Q0*/ ); void init_tcx_enc_info_fx( - Encoder_State *st, /* i/o: coder memory state */ + Encoder_State *st, /* i/o: coder memory state */ Word16 *L_frame, Word16 *L_frameTCX, - Word16 *L_spec ); + Word16 *L_spec +); void SetCurrentPsychParams( const Word16 core, const Word16 last_frame_was_concealed_cng, - TCX_CONFIG_HANDLE hTcxCfg ); + TCX_CONFIG_HANDLE hTcxCfg +); void sns_avq_cod_fx( - const Word32 *sns_fx, /* i : Input sns vectors */ + const Word32 *sns_fx, /* i : Input sns vectors */ Word16 exp_sns, - const Word32 *snsmid_fx, /* i : Input mid-sns vectors */ + const Word32 *snsmid_fx, /* i : Input mid-sns vectors */ Word16 exp_snsmid, - Word32 *sns_q_fx, /* o : Quantized LFS vectors Q16 */ - Word32 *snsmid_q_fx, /* o : Quantized mid-LFS vectors Q16 */ - Word16 *index, /* o : Quantization indices */ - const Word16 core, /* i : core */ + Word32 *sns_q_fx, /* o : Quantized LFS vectors Q16 */ + Word32 *snsmid_q_fx, /* o : Quantized mid-LFS vectors Q16 */ + Word16 *index, /* o : Quantization indices */ + const Word16 core, /* i : core */ const Word16 L_frame, - const Word16 low_brate_mode /* i : flag low bit operating mode */ + const Word16 low_brate_mode /* i : flag low bit operating mode */ ); void sns_avq_cod_stereo_fx( - const Word32 *snsl_fx, /* i : Input sns vector (left channel) */ + const Word32 *snsl_fx, /* i : Input sns vector (left channel) */ Word16 exp_snl, - const Word32 *snsr_fx, /* i : Input sns vector (right channel) */ + const Word32 *snsr_fx, /* i : Input sns vector (right channel) */ Word16 exp_snr, const Word16 L_frame, - Word32 *snsl_q_fx, /* o : Quantized sns vector (left channel) Q16 */ - Word32 *snsr_q_fx, /* o : Quantized sns vector (right channel) Q16 */ - Word16 *indexl, /* o : Quantization indices (left channel) */ - Word16 *indexr /* o : Quantization indices (right channel) */ + Word32 *snsl_q_fx, /* o : Quantized sns vector (left channel) Q16 */ + Word32 *snsr_q_fx, /* o : Quantized sns vector (right channel) Q16 */ + Word16 *indexl, /* o : Quantization indices (left channel) */ + Word16 *indexr /* o : Quantization indices (right channel) */ ); ivas_error initMdctStereoDtxData_fx( @@ -4680,297 +4733,259 @@ ivas_error initMdctStereoDtxData_fx( ); void applyDmxMdctStereo_fx( - const CPE_DEC_HANDLE hCPE, /* i : CPE handle */ - Word32 *output_fx[CPE_CHANNELS], /* o : output from core decoder q_out*/ - const Word16 output_frame /* i : output frame length Q0*/ + const CPE_DEC_HANDLE hCPE, /* i : CPE handle */ + Word32 *output_fx[CPE_CHANNELS], /* o : output from core decoder q_out*/ + const Word16 output_frame /* i : output frame length Q0*/ ); ivas_error front_vad_create_fx( - FRONT_VAD_ENC_HANDLE *hFrontVad, /* i/o: front-VAD handle */ - const ENCODER_CONFIG_HANDLE hEncoderConfig /* i : configuration structure */ + FRONT_VAD_ENC_HANDLE *hFrontVad, /* i/o: front-VAD handle */ + const ENCODER_CONFIG_HANDLE hEncoderConfig /* i : configuration structure */ ); void front_vad_destroy_fx( - FRONT_VAD_ENC_HANDLE *hFrontVad /* i/o: front-VAD handle */ + FRONT_VAD_ENC_HANDLE *hFrontVad /* i/o: front-VAD handle */ ); ivas_error front_vad_fx( - CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure, nullable */ - Encoder_State *st, /* i/o: encoder state structure */ - const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ - FRONT_VAD_ENC_HANDLE *hFrontVads, /* i/o: FrontVad handles */ - const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ - const Word16 input_frame, /* i : frame length */ - Word16 vad_flag_dtx[], /* o : HE-SAD flag with additional DTX HO */ - Word32 fr_bands_fx[][2 * NB_BANDS], /* o : energy in frequency bands q_fr_bands_fx */ - Word16 q_fr_bands[], /* o : Q of fr_bands_fx Q0 */ - Word16 Etot_LR_fx[], /* o : total energy Left & Right channel Q8 */ - Word32 lf_E_fx[][2 * VOIC_BINS], /* i : per bin spectrum energy in lf, LR channels q_lf_E */ - Word16 q_lf_E[], /* o : Q of lf_E_fx */ - Word16 localVAD_HE_SAD[], /* o : HE-SAD flag without hangover, LR channels */ - Word16 vad_hover_flag[], /* o : VAD hangover flag */ - Word32 band_energies_LR_fx[2 * NB_BANDS], /* o : energy in critical bands without minimum noise floor E_MIN q_band_energies_LR */ - Word16 *q_band_energies_LR, /* o : Q of band_energies_LR_fx */ - Word32 *PS_out_fx, /* o : energy spectrum q_PS_out */ - Word16 *q_PS_out, /* o : Q of PS_out_fx Q0 */ - Word16 *Bin_E_out_fx, /* o : log-energy spectrum of the current frame Q7 */ + CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure, nullable */ + Encoder_State *st, /* i/o: encoder state structure */ + const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ + FRONT_VAD_ENC_HANDLE *hFrontVads, /* i/o: FrontVad handles */ + const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ + const Word16 input_frame, /* i : frame length */ + Word16 vad_flag_dtx[], /* o : HE-SAD flag with additional DTX HO */ + Word32 fr_bands_fx[][2 * NB_BANDS], /* o : energy in frequency bands q_fr_bands_fx */ + Word16 q_fr_bands[], /* o : Q of fr_bands_fx Q0 */ + Word16 Etot_LR_fx[], /* o : total energy Left & Right channel Q8 */ + Word32 lf_E_fx[][2 * VOIC_BINS], /* i : per bin spectrum energy in lf, LR channels q_lf_E */ + Word16 q_lf_E[], /* o : Q of lf_E_fx */ + Word16 localVAD_HE_SAD[], /* o : HE-SAD flag without hangover, LR channels */ + Word16 vad_hover_flag[], /* o : VAD hangover flag */ + Word32 band_energies_LR_fx[2 * NB_BANDS], /* o : energy in critical bands without minimum noise floor E_MIN q_band_energies_LR */ + Word16 *q_band_energies_LR, /* o : Q of band_energies_LR_fx */ + Word32 *PS_out_fx, /* o : energy spectrum q_PS_out */ + Word16 *q_PS_out, /* o : Q of PS_out_fx Q0 */ + Word16 *Bin_E_out_fx, /* o : log-energy spectrum of the current frame Q7 */ Word16 Q_inp, Word16 *Q_buffer, Word16 Q_add, - Word16 *front_create_flag ); - -void stereo_cna_update_params_fx( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - Word32 *output_fx[CPE_CHANNELS], /* i : Output signal OUTPUT_Q*/ - const Word16 output_frame, /* i : Output frame length Q0*/ - const Word16 tdm_ratio_idx /* i : TDM ratio index Q0*/ -); - -void mvr2r_inc_fixed_one( - const Word32 x_fx[], /* i : input vector */ - const Word16 x_inc, /* i : increment for vector x[] */ - Word32 y_fx[], /* o : output vector */ - const Word16 y_inc, /* i : increment for vector y[] */ - const Word16 n /* i : vector size */ + Word16 *front_create_flag ); -void mvr2r_inc_fixed( - const Word32 x_fx[], /* i : input vector */ - const Word16 x_inc, /* i : increment for vector x[] */ - Word32 y_fx[], /* o : output vector */ - const Word16 y_inc, /* i : increment for vector y[] */ - const Word16 n /* i : vector size */ +void stereo_cna_update_params_fx( + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + Word32 *output_fx[CPE_CHANNELS], /* i : Output signal OUTPUT_Q*/ + const Word16 output_frame, /* i : Output frame length Q0*/ + const Word16 tdm_ratio_idx /* i : TDM ratio index Q0*/ ); -void v_mult_inc_fx( - const Word32 x1_fx[], /* i : Input vector 1 */ - Word16 *x1_q_fx, - const Word16 x1_inc, /* i : Increment for input vector 1 */ - const Word32 x2_fx[], /* i : Input vector 2 */ - Word16 *x2_q_fx, - const Word16 x2_inc, /* i : Increment for input vector 1 */ - Word32 y_fx[], /* o : Output vector that contains vector 1 .* vector 2 */ - Word16 *y_q_fx, - const Word16 y_inc, /* i : increment for vector y[i] */ - const Word16 N /* i : Vector length */ +void mvr2r_inc_fx( + const Word32 x_fx[], /* i : input vector */ + const Word16 x_inc, /* i : increment for vector x[] */ + Word32 y_fx[], /* o : output vector */ + const Word16 y_inc, /* i : increment for vector y[] */ + const Word16 n /* i : vector size */ ); void v_add_inc_fx( - const Word32 x1[], /* i : Input vector 1 */ - const Word16 x_inc, /* i : Increment for input vector 1 */ - const Word32 x2[], /* i : Input vector 2 */ - const Word16 x2_inc, /* i : Increment for input vector 2 */ - Word32 y[], /* o : Output vector that contains vector 1 + vector 2 */ - const Word16 y_inc, /* i : increment for vector y[] */ - const Word16 N /* i : Vector length */ + const Word32 x1[], /* i : Input vector 1 */ + const Word16 x_inc, /* i : Increment for input vector 1 */ + const Word32 x2[], /* i : Input vector 2 */ + const Word16 x2_inc, /* i : Increment for input vector 2 */ + Word32 y[], /* o : Output vector containing vector 1 + vector 2*/ + const Word16 y_inc, /* i : increment for vector y[] */ + const Word16 N /* i : Vector length */ ); + Word32 logsumexp_fx( - const Word32 x[], /* i : input array x */ + const Word32 x[], /* i : input array x */ const Word16 x_e, - const Word16 N /* i : number of elements in array x */ + const Word16 N /* i : number of elements in array x */ ); + Word32 lin_interp32_fx( - const Word32 x, /* i : the value to be mapped */ - const Word32 x1, /* i : source range interval: low end */ - const Word32 y1, /* i : source range interval: high end */ - const Word32 x2, /* i : target range interval: low */ - const Word32 y2, /* i : target range interval: high */ - const Word16 flag_sat /* i : flag to indicate whether to apply saturation */ + const Word32 x, /* i : the value to be mapped */ + const Word32 x1, /* i : source range interval: low end */ + const Word32 y1, /* i : source range interval: high end */ + const Word32 x2, /* i : target range interval: low */ + const Word32 y2, /* i : target range interval: high */ + const Word16 flag_sat /* i : flag to indicate whether to apply saturation */ ); void v_addc_fx( - const Word32 x_fx[], /* i : Input vector */ - const Word32 c_fx, /* i : Constant */ - Word32 y_fx[], /* o : Output vector that contains c*x */ - const Word16 N /* i : Vector length */ -); - -void v_addc_fixed( - const Word32 x[], /* i : Input vector */ - const Word32 c, /* i : Constant */ - Word32 y[], /* o : Output vector that contains c*x */ - const Word16 N /* i : Vector length */ + const Word32 x_fx[], /* i : Input vector */ + const Word32 c_fx, /* i : Constant */ + Word32 y_fx[], /* o : Output vector that contains c*x */ + const Word16 N /* i : Vector length */ ); void v_min_fx( - const Word32 x1_fx[], /* i : Input vector 1 */ + const Word32 x1_fx[], /* i : Input vector 1 */ Word16 *x1_q_fx, - const Word32 x2_fx[], /* i : Input vector 2 */ + const Word32 x2_fx[], /* i : Input vector 2 */ Word16 *x2_q_fx, - Word32 y_fx[], /* o : Output vector that contains vector 1 .* vector 2 */ + Word32 y_fx[], /* o : Output vector that contains vector 1 .* vector 2 */ Word16 *y_q_fx, - const Word16 N /* i : Vector length */ + const Word16 N /* i : Vector length */ ); -void v_mult_inc_fixed( - const Word32 x1_fx[], /* i : Input vector 1 */ - const Word16 x1_inc, /* i : Increment for input vector 1 */ - const Word32 x2_fx[], /* i : Input vector 2 */ - const Word16 x2_inc, /* i : Increment for input vector 1 */ - Word32 y_fx[], /* o : Output vector that contains vector 1 .* vector 2 */ - const Word16 y_inc, /* i : increment for vector y[i] */ - const Word16 N /* i : Vector length */ +void v_mult_inc_fx( + const Word32 x1_fx[], /* i : Input vector 1 */ + const Word16 x1_inc, /* i : Increment for input vector 1 */ + const Word32 x2_fx[], /* i : Input vector 2 */ + const Word16 x2_inc, /* i : Increment for input vector 1 */ + Word32 y_fx[], /* o : Output vector that contains vector 1 .* vector 2 */ + const Word16 y_inc, /* i : increment for vector y[i] */ + const Word16 N /* i : Vector length */ ); void v_sqrt_fx( - const Word32 x[], /* i : Input vector */ + const Word32 x[], /* i : Input vector */ Word16 exp[], - Word32 y[], /* o : Output vector that contains sqrt(x) */ - const Word16 N /* i : Vector length */ + Word32 y[], /* o : Output vector that contains sqrt(x) */ + const Word16 N /* i : Vector length */ ); Word32 sumAbs_fx( - const Word32 *vec, /* i : input vector */ - const Word16 lvec /* i : length of input vector */ + const Word32 *vec, /* i : input vector */ + const Word16 lvec /* i : length of input vector */ ); -Word32 dot_product_cholesky_fx( - const Word32 *x, /* i : vector x */ - const Word32 *A, /* i : Cholesky matrix A */ - const Word16 N /* i : vector & matrix size */ -); - -Word64 dot_product_cholesky_fixed( - const Word32 *x, /* i : vector x */ - const Word32 *A, /* i : Cholesky matrix A */ - const Word16 N /* i : vector & matrix size */ +Word64 dot_product_cholesky_fx( + const Word32 *x, /* i : vector x */ + const Word32 *A, /* i : Cholesky matrix A */ + const Word16 N /* i : vector & matrix size */ ); void v_mult_mat_fx( - Word32 *y_fx, /* o : the product x*A */ - Word16 *y_q_fx, - const Word32 *x_fx, /* i : vector x */ - Word16 *x_q_fx, - const Word32 *A_fx, /* i : matrix A */ - Word16 *A_q_fx, - const Word16 N, /* i : number of rows */ - const Word16 C /* i : number of columns */ -); -void v_mult_mat_fixed( - Word32 *y, /* o : the product x*A */ - const Word32 *x, /* i : vector x */ - const Word32 *A, /* i : matrix A */ - const Word16 Nr, /* i : number of rows */ - const Word16 Nc, /* i : number of columns */ - Word16 guardbits ); + Word32 *y, /* o : the product x*A */ + const Word32 *x, /* i : vector x */ + const Word32 *A, /* i : matrix A */ + const Word16 Nr, /* i : number of rows */ + const Word16 Nc, /* i : number of columns */ + Word16 guardbits +); Word32 check_bounds_l( - const Word32 value, /* i : Input value */ - const Word32 low, /* i : Low limit */ - const Word32 high /* i : High limit */ + const Word32 value, /* i : Input value */ + const Word32 low, /* i : Low limit */ + const Word32 high /* i : High limit */ ); Word16 check_bounds_s_fx( - const Word16 value, /* i : Input value */ - const Word16 low, /* i : Low limit */ - const Word16 high /* i : High limit */ + const Word16 value, /* i : Input value */ + const Word16 low, /* i : Low limit */ + const Word16 high /* i : High limit */ ); ivas_error stereo_memory_enc_fx( - CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ - const Word32 input_Fs, /* i : input sampling rate */ - const Word16 max_bwidth, /* i : maximum audio bandwidth */ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const Word16 nchan_transport /* i : number transport chans */ + CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ + const Word32 input_Fs, /* i : input sampling rate */ + const Word16 max_bwidth, /* i : maximum audio bandwidth */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const Word16 nchan_transport /* i : number transport chans */ ); void stereo_switching_enc_fx( - CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ - Word32 old_input_signal_pri[], /* i : old input signal of primary channel */ - const Word16 input_frame, /* i : input frame length */ - const Word16 q_inp ); - + CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ + Word32 old_input_signal_pri[], /* i : old input signal of primary channel */ + const Word16 input_frame, /* i : input frame length */ + const Word16 q_inp +); void stereo_td2dft_update_fx( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - const Word16 n, /* i : channel number Q0*/ - Word32 output_fx[], /* i/o: synthesis @internal Fs Q11*/ - Word32 synth_fx[], /* i/o: synthesis @output Fs Q11*/ - Word32 hb_synth_fx[], /* i/o: hb synthesis Q11*/ - const Word16 output_frame /* i : frame length Q0*/ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + const Word16 n, /* i : channel number Q0*/ + Word32 output_fx[], /* i/o: synthesis @internal Fs Q11*/ + Word32 synth_fx[], /* i/o: synthesis @output Fs Q11*/ + Word32 hb_synth_fx[], /* i/o: hb synthesis Q11*/ + const Word16 output_frame /* i : frame length Q0*/ ); void stereo_mdct2dft_update_fx( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - Word32 output0_fx[], /* i/o: synthesis @internal Fs, ch0 Q11*/ - Word32 synth0_fx[] /* i/o: synthesis @output Fs, ch0 Q11*/ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + Word32 output0_fx[], /* i/o: synthesis @internal Fs, ch0 Q11*/ + Word32 synth0_fx[] /* i/o: synthesis @output Fs, ch0 Q11*/ ); Word16 write_GR0_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: Encoder bitstream handle */ - const Word16 ind, /* i : bitstream index */ - const Word16 *in, /* i : data to be encoded */ - const Word16 len /* i : input data length */ + BSTR_ENC_HANDLE hBstr, /* i/o: Encoder bitstream handle */ + const Word16 ind, /* i : bitstream index */ + const Word16 *in, /* i : data to be encoded */ + const Word16 len /* i : input data length */ ); void ivas_mct_core_dec( - MCT_DEC_HANDLE hMCT, /* i/o: MCT decoder structure */ - CPE_DEC_HANDLE hCPE[MCT_MAX_BLOCKS], /* i/o: CPE decoder structure */ - const Word16 nCPE, /* i : number of CPEs */ + MCT_DEC_HANDLE hMCT, /* i/o: MCT decoder structure */ + CPE_DEC_HANDLE hCPE[MCT_MAX_BLOCKS], /* i/o: CPE decoder structure */ + const Word16 nCPE, /* i : number of CPEs */ Word32 *signal_out_fx[], - Word16 q_x[MCT_MAX_CHANNELS] ); + Word16 q_x[MCT_MAX_CHANNELS] +); void ivas_qmetadata_to_dirac_fx( - const IVAS_QMETADATA_HANDLE hQMetaData, /* i : frame of MASA q_metadata */ - DIRAC_DEC_HANDLE hDirAC, /* i : DirAC decoder structure */ - MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ - SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ - const Word32 ivas_total_brate, /* i : IVAS total bitrate */ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const Word16 hodirac_flag, /* i : flag to indicate HO-DirAC mode */ - Word16 *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ + const IVAS_QMETADATA_HANDLE hQMetaData, /* i : frame of MASA q_metadata */ + DIRAC_DEC_HANDLE hDirAC, /* i : DirAC decoder structure */ + MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const Word16 hodirac_flag, /* i : flag to indicate HO-DirAC mode */ + Word16 *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ ); Word16 masa_sq_fx( - const Word32 in, /* i : input value */ - const Word32 *threshold, /* i : partition */ - const Word16 cb_sz /* i : codebook size */ + const Word32 in, /* i : input value */ + const Word32 *threshold, /* i : partition */ + const Word16 cb_sz /* i : codebook size */ ); Word16 quantize_direction2D_fx( - Word32 phi, /* i : input azimuth value Q22 */ - const Word16 no_cw, /* i : number of bits */ - Word32 *phi_q, /* o : quantized azimuth value Q22 */ - UWord16 *index_phi, /* o : quantized azimuth index */ - const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ + Word32 phi, /* i : input azimuth value Q22 */ + const Word16 no_cw, /* i : number of bits */ + Word32 *phi_q, /* o : quantized azimuth value Q22 */ + UWord16 *index_phi, /* o : quantized azimuth index */ + const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ ); Word32 companding_azimuth_fx( - const Word32 azi_fx, /* i : input azimuth value */ - const MC_LS_SETUP mc_format, /* i : input channel format */ - const Word16 theta_flag, /* i : zero/non zero elevation flag */ - const Word16 direction /* i : direction of companding (direct or inverse)*/ + const Word32 azi_fx, /* i : input azimuth value */ + const MC_LS_SETUP mc_format, /* i : input channel format */ + const Word16 theta_flag, /* i : zero/non zero elevation flag */ + const Word16 direction /* i : direction of companding (direct or inverse) */ ); Word16 quantize_phi_fx( - Word32 phi, /* i : azimuth value */ - const Word16 flag_delta, /* i : flag indicating if the azimuth codebook is translated or not */ - Word32 *phi_hat, /* o : quantized azimuth */ - const Word16 n /* i : azimuth codebook size */ + Word32 phi, /* i : azimuth value */ + const Word16 flag_delta, /* i : flag indicating if the azimuth codebook is translated or not */ + Word32 *phi_hat, /* o : quantized azimuth */ + const Word16 n /* i : azimuth codebook size */ ); Word32 deindex_elevation_fx( - UWord16 *id_th, /* i : input index */ - const Word16 no_bits, /* i : number of bits for the spherical grid */ - const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ + UWord16 *id_th, /* i : input index */ + const Word16 no_bits, /* i : number of bits for the spherical grid */ + const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ ); Word32 deindex_azimuth_fx( - Word16 id_phi, /* i : index */ - const Word16 no_bits, /* i : number of bits for the spherical grid */ - const Word16 id_th, /* i : elevation index */ - const Word16 remap, /* i : remapping flag */ - const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ + Word16 id_phi, /* i : index */ + const Word16 no_bits, /* i : number of bits for the spherical grid */ + const Word16 id_th, /* i : elevation index */ + const Word16 remap, /* i : remapping flag */ + const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ ); + void deindex_spherical_component_fx( - const UWord16 sph_idx, /* i : spherical index */ - Word32 *az_fx, /* o : decoded azimuth value */ - Word32 *el_fx, /* o : decoded elevation value */ - UWord16 *az_idx, /* o : azimuth index */ - UWord16 *el_idx, /* o : elevation index */ - const UWord16 no_bits, /* i : number of bits for the spherical grid */ - const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ + const UWord16 sph_idx, /* i : spherical index */ + Word32 *az_fx, /* o : decoded azimuth value */ + Word32 *el_fx, /* o : decoded elevation value */ + UWord16 *az_idx, /* o : azimuth index */ + UWord16 *el_idx, /* o : elevation index */ + const UWord16 no_bits, /* i : number of bits for the spherical grid */ + const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ ); void ivas_dirac_param_est_enc_fx( @@ -4987,79 +5002,61 @@ void ivas_dirac_param_est_enc_fx( const Word16 nchan_fb_in, Word16 *mono_frame_count, Word16 *dirac_mono_flag, - const Word16 shift ); + const Word16 shift +); ivas_error ivas_cldfb_dec_reconfig_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const Word16 nchan_transport_old, /* i : number of TCs in previous frame */ - Word16 numCldfbAnalyses_old, /* i : number of CLDFB analysis instances in previous frame */ - const Word16 numCldfbSyntheses_old /* i : number of CLDFB synthesis instances in previous frame */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const Word16 nchan_transport_old, /* i : number of TCs in previous frame */ + Word16 numCldfbAnalyses_old, /* i : number of CLDFB analysis instances in previous frame */ + const Word16 numCldfbSyntheses_old /* i : number of CLDFB synthesis instances in previous frame */ ); ivas_error ivas_sba_enc_reconfigure_fx( - Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ -); -/*! r: Ambisonic (SBA) order used for analysis and coding */ -Word16 ivas_sba_get_analysis_order( - const Word32 ivas_total_brate, /* i : IVAS total bitrate */ - const Word16 sba_order /* i : Ambisonic (SBA) order */ -); - -Word16 ivas_sba_get_nchan_metadata( - const Word16 sba_order, /* i : Ambisonic (SBA) order */ - const Word32 ivas_total_brate /* i : IVAS total bitrate */ + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); -/*! r: flag indicating to code SPAR HOA MD for all bands */ -void ivas_sba_get_spar_hoa_md_flag( - const Word16 sba_order, /* i : Ambisonic (SBA) order */ - const Word32 ivas_total_brate, /* i : IVAS total bitrate */ - Word16 *spar_hoa_md_flag, - Word16 *spar_hoa_dirac2spar_md_flag ); - Word16 ivas_sba_remapTCs_fx( - Word32 *sba_data[], /* i/o: SBA signals */ - Decoder_Struct *st_ivas, /* i/o: decoder struct */ - const Word16 output_frame /* i : frame length */ + Word32 *sba_data[], /* i/o: SBA signals */ + Decoder_Struct *st_ivas, /* i/o: decoder struct */ + const Word16 output_frame /* i : frame length */ ); -void ivas_sba2mc_cldfb_fixed( - IVAS_OUTPUT_SETUP hInSetup, /* i : Format of input layout */ - Word32 RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: cldfb real part (Q_real) */ - Word32 ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: cldfb imag part (Q_imag) */ - const Word16 nb_channels_out, /* i : nb of output channels */ - const Word16 nb_bands, /* i : nb of CLDFB bands to process */ - const Word16 nb_timeslots, /* i : number of time slots to process */ - const Word32 *hoa_dec_mtx /* i : HOA decoding mtx */ +void ivas_sba2mc_cldfb_fx( + IVAS_OUTPUT_SETUP hInSetup, /* i : Format of input layout */ + Word32 RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: cldfb real part (Q_real) */ + Word32 ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: cldfb imag part (Q_imag) */ + const Word16 nb_channels_out, /* i : nb of output channels */ + const Word16 nb_bands, /* i : nb of CLDFB bands to process */ + const Word16 nb_timeslots, /* i : number of time slots to process */ + const Word32 *hoa_dec_mtx /* i : HOA decoding mtx */ ); void ivas_dirac_config_bands_fx( - Word16 *band_grouping, /* o : band grouping */ - const Word16 nbands, /* i : number of bands */ - const Word16 max_band, /* i : maximal band index +1 */ - Word16 *dirac_to_spar_md_bands, /* o : mapping of DirAC parameter band index to SPAR FB band index */ - const Word8 useLowerBandRes, /* i : flag indicating lower band resolution for DirAC */ - const Word16 enc_param_start_band, /* i : band index of first DirAC parameter band */ + Word16 *band_grouping, /* o : band grouping */ + const Word16 nbands, /* i : number of bands */ + const Word16 max_band, /* i : maximal band index +1 */ + Word16 *dirac_to_spar_md_bands, /* o : mapping of DirAC parameter band index to SPAR FB band index */ + const Word8 useLowerBandRes, /* i : flag indicating lower band resolution for DirAC */ + const Word16 enc_param_start_band, /* i : band index of first DirAC parameter band */ IVAS_FB_MIXER_HANDLE hFbMdft, - const Word8 BandGroupLowRes ); + const Word8 BandGroupLowRes +); void ivas_dirac_dec_close_fx( - DIRAC_DEC_HANDLE *hDirAC_out ); + DIRAC_DEC_HANDLE *hDirAC_out +); void generate_masking_noise_lb_dirac_fx( - HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ - Word32 *tdBuffer, /* i/o: time-domain signal, if NULL no LB-CNA */ - const Word16 nCldfbTs, /* i : number of CLDFB slots that will be rendered */ + HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ + Word32 *tdBuffer, /* i/o: time-domain signal, if NULL no LB-CNA */ + const Word16 nCldfbTs, /* i : number of CLDFB slots that will be rendered */ SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i : common spatial rendering parameters handle */ - const Word16 cna_flag /* i : CNA flag for LB and HB */ + const Word16 cna_flag /* i : CNA flag for LB and HB */ ); void ivas_dirac_dec_close_fx( - DIRAC_DEC_HANDLE *hDirAC_out ); - -void ivas_dirac_dec_set_md_map( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const Word16 nCldfbTs /* i : number of CLDFB time slots */ + DIRAC_DEC_HANDLE *hDirAC_out ); void computeDirectionVectors_fx( @@ -5071,86 +5068,91 @@ void computeDirectionVectors_fx( Word32 *direction_vector_x, Word32 *direction_vector_y, Word32 *direction_vector_z, - Word16 *q_factor ); + Word16 *q_factor +); -void computeDiffuseness_fixed( +void computeDiffuseness_fx( Word32 *buffer_intensity[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF], const Word32 *buffer_energy, const Word16 num_freq_bands, Word32 *diffuseness, Word16 *q_factor_intensity, Word16 *q_factor_energy, - Word16 *q_diffuseness ); + Word16 *q_diffuseness +); void ivas_dirac_dec_get_response_fx( const Word16 azimuth, const Word16 elevation, Word32 *response_fx, /*Q_out*/ const Word16 ambisonics_order, - Word16 Q_out ); + Word16 Q_out +); /*This is a derivate to ivas_dirac_dec_get_response_fx with fixed Q_out=29*/ void ivas_dirac_dec_get_response_fx_29( const Word16 azimuth, const Word16 elevation, Word32 *response_fx, /*Q_out=29*/ - const Word16 ambisonics_order ); + const Word16 ambisonics_order +); void calculate_hodirac_sector_parameters_fx( - DIRAC_ENC_HANDLE hDirAC, /* i : DirAC handle */ - Word32 RealBuffer_fx[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i : signal vector (L+1)^2 x N_bins, real part */ - Word32 ImagBuffer_fx[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i : signal vector, imaginary part */ - Word16 Qfac, /* i : Q-factor of signal vector */ - const Word32 beta_fx, /* i : forgetting factor for average filtering, Q30 */ - const Word16 *band_grouping, /* i : indices of band groups */ - const Word16 N_bands, /* i : number of bands (groups) */ - const Word16 enc_param_start_band, /* i : first band to process */ - Word32 *azi_fx, /* o : array of sector azimuth angles, flat Q23 */ - Word32 *ele_fx, /* o : array of sector elevation angles, flat Q23 */ - Word32 *diff_fx, /* o : array of sector diffuseness values, flat */ - Word16 *diff_exp, /* o : array of sector diffuseness exponents, flat */ - Word32 *ene_fx, /* o : array of sector energy values, flat */ - Word16 *ene_exp /* o : array of sector energy exponents, flat */ + DIRAC_ENC_HANDLE hDirAC, /* i : DirAC handle */ + Word32 RealBuffer_fx[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i : signal vector (L+1)^2 x N_bins,real part*/ + Word32 ImagBuffer_fx[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i : signal vector, imaginary part */ + Word16 Qfac, /* i : Q-factor of signal vector */ + const Word32 beta_fx, /* i : forgetting factor for average filtering, Q30 */ + const Word16 *band_grouping, /* i : indices of band groups */ + const Word16 N_bands, /* i : number of bands (groups) */ + const Word16 enc_param_start_band, /* i : first band to process */ + Word32 *azi_fx, /* o : array of sector azimuth angles, flat Q23 */ + Word32 *ele_fx, /* o : array of sector elevation angles, flat Q23 */ + Word32 *diff_fx, /* o : array of sector diffuseness values, flat */ + Word16 *diff_exp, /* o : array of sector diffuseness exponents, flat */ + Word32 *ene_fx, /* o : array of sector energy values, flat */ + Word16 *ene_exp /* o : array of sector energy exponents, flat */ ); void ivas_mc_paramupmix_enc_fx( - Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ - BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle */ + Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ + BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle */ Word32 *data_fx[], - const Word16 input_frame /* i : input frame length */ + const Word16 input_frame /* i : input frame length */ ); -void ivas_mc_paramupmix_dec_render( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ - UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ - UWord16 *nSamplesAvailable, /* o : number of CLDFB slots still to render */ - Word32 *input_fx[], /* i : core-coder transport channels */ - Word32 *output_fx[] /* i/o: synthesized core-coder transport channels */ +void ivas_mc_paramupmix_dec_render_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ + UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ + UWord16 *nSamplesAvailable, /* o : number of CLDFB slots still to render */ + Word32 *input_fx[], /* i : core-coder transport channels */ + Word32 *output_fx[] /* i/o: synthesized core-coder transport channels */ ); Word16 ivas_param_mc_getNumTransportChannels_fx( - const Word32 ivas_total_bitrate, /* i : IVAS total bitrate */ - const MC_LS_SETUP mc_ls_setup /* i : MC ls setup */ + const Word32 ivas_total_bitrate, /* i : IVAS total bitrate */ + const MC_LS_SETUP mc_ls_setup /* i : MC ls setup */ ); ivas_error ivas_param_mc_dec_open_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); ivas_error ivas_param_mc_dec_reconfig_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); void ivas_param_mc_dec_close_fx( - PARAM_MC_DEC_HANDLE *hParamMC_out /* i/o: Parametric MC decoder handle */ + PARAM_MC_DEC_HANDLE *hParamMC_out /* i/o: Parametric MC decoder handle */ ); void ivas_param_mc_dec_digest_tc_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const UWord8 nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const UWord8 nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ Word32 *transport_channels_f_fx[], - Word16 transport_f_e ); + Word16 transport_f_e +); #ifdef OBJ_EDITING_API void ivas_param_mc_dec_prepare_renderer( @@ -5160,164 +5162,167 @@ void ivas_param_mc_dec_prepare_renderer( #endif void ivas_param_mc_dec_render_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ - UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ - UWord16 *nSamplesAvailable, /* o : number of CLDFB slots still to render */ - Word32 *output_f_fx[], /* o : rendered time signal */ - Word16 channel_active_fx[MAX_OUTPUT_CHANNELS] ); + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ + UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ + UWord16 *nSamplesAvailable, /* o : number of CLDFB slots still to render */ + Word32 *output_f_fx[], /* o : rendered time signal */ + Word16 channel_active_fx[MAX_OUTPUT_CHANNELS] +); Word16 matrix_product_mant_exp_fx( - const Word32 *X_fx, /* i : left hand matrix */ - const Word16 X_fx_e, /* i : left hand matrix */ - const Word16 rowsX, /* i : number of rows of the left hand matrix */ - const Word16 colsX, /* i : number of columns of the left hand matrix */ - const Word16 transpX, /* i : flag indicating the transposition of the left hand matrix prior to the multiplication */ - const Word32 *Y_fx, /* i : right hand matrix */ - const Word16 Y_fx_e, /* i : right hand matrix */ - const Word16 rowsY, /* i : number of rows of the right hand matrix */ - const Word16 colsY, /* i : number of columns of the right hand matrix */ - const Word16 transpY, /* i : flag indicating the transposition of the right hand matrix prior to the multiplication */ - Word32 *Z_fx, /* o : resulting matrix after the matrix multiplication */ - Word16 *Z_fx_e /* o : resulting matrix after the matrix multiplication */ + const Word32 *X_fx, /* i : left hand matrix */ + const Word16 X_fx_e, /* i : left hand matrix */ + const Word16 rowsX, /* i : number of rows of the left hand matrix */ + const Word16 colsX, /* i : number of columns of the left hand matrix */ + const Word16 transpX, /* i : flag indicating the transposition of the left hand matrix prior to the multiplication */ + const Word32 *Y_fx, /* i : right hand matrix */ + const Word16 Y_fx_e, /* i : right hand matrix */ + const Word16 rowsY, /* i : number of rows of the right hand matrix */ + const Word16 colsY, /* i : number of columns of the right hand matrix */ + const Word16 transpY, /* i : flag indicating the transposition of the right hand matrix prior to the multiplication */ + Word32 *Z_fx, /* o : resulting matrix after the matrix multiplication */ + Word16 *Z_fx_e /* o : resulting matrix after the matrix multiplication */ ); Word16 matrix_product_fx( - const Word32 *X_fx, /* i : left hand matrix */ - const Word16 rowsX, /* i : number of rows of the left hand matrix */ - const Word16 colsX, /* i : number of columns of the left hand matrix */ - const Word16 transpX, /* i : flag indicating the transposition of the left hand matrix prior to the multiplication */ - const Word32 *Y_fx, /* i : right hand matrix */ - const Word16 rowsY, /* i : number of rows of the right hand matrix */ - const Word16 colsY, /* i : number of columns of the right hand matrix */ - const Word16 transpY, /* i : flag indicating the transposition of the right hand matrix prior to the multiplication */ - Word32 *Z_fx /* o : resulting matrix after the matrix multiplication */ + const Word32 *X_fx, /* i : left hand matrix */ + const Word16 rowsX, /* i : number of rows of the left hand matrix */ + const Word16 colsX, /* i : number of columns of the left hand matrix */ + const Word16 transpX, /* i : flag indicating the transposition of the left hand matrix prior to the multiplication */ + const Word32 *Y_fx, /* i : right hand matrix */ + const Word16 rowsY, /* i : number of rows of the right hand matrix */ + const Word16 colsY, /* i : number of columns of the right hand matrix */ + const Word16 transpY, /* i : flag indicating the transposition of the right hand matrix prior to the multiplication */ + Word32 *Z_fx /* o : resulting matrix after the matrix multiplication */ ); Word16 matrix_product_q30_fx( - const Word32 *X_fx, /* i : left hand matrix */ - const Word16 rowsX, /* i : number of rows of the left hand matrix */ - const Word16 colsX, /* i : number of columns of the left hand matrix */ - const Word16 transpX, /* i : flag indicating the transposition of the left hand matrix prior to the multiplication */ - const Word32 *Y_fx, /* i : right hand matrix */ - const Word16 rowsY, /* i : number of rows of the right hand matrix */ - const Word16 colsY, /* i : number of columns of the right hand matrix */ - const Word16 transpY, /* i : flag indicating the transposition of the right hand matrix prior to the multiplication */ - Word32 *Z_fx /* o : resulting matrix after the matrix multiplication */ + const Word32 *X_fx, /* i : left hand matrix */ + const Word16 rowsX, /* i : number of rows of the left hand matrix */ + const Word16 colsX, /* i : number of columns of the left hand matrix */ + const Word16 transpX, /* i : flag indicating the transposition of the left hand matrix prior to the multiplication */ + const Word32 *Y_fx, /* i : right hand matrix */ + const Word16 rowsY, /* i : number of rows of the right hand matrix */ + const Word16 colsY, /* i : number of columns of the right hand matrix */ + const Word16 transpY, /* i : flag indicating the transposition of the right hand matrix prior to the multiplication */ + Word32 *Z_fx /* o : resulting matrix after the matrix multiplication */ ); Word16 matrix_product_mant_exp( - const Word32 *X_fx, /* i : left hand matrix */ - const Word16 *X_e, /* i : left hand matrix */ - const Word16 rowsX, /* i : number of rows of the left hand matrix */ - const Word16 colsX, /* i : number of columns of the left hand matrix */ - const Word16 transpX, /* i : flag indicating the transposition of the left hand matrix prior to the multiplication */ - const Word32 *Y_fx, /* i : right hand matrix */ - const Word16 *Y_e, /* i : right hand matrix */ - const Word16 rowsY, /* i : number of rows of the right hand matrix */ - const Word16 colsY, /* i : number of columns of the right hand matrix */ - const Word16 transpY, /* i : flag indicating the transposition of the right hand matrix prior to the multiplication */ - Word32 *Z_fx, /* o : resulting matrix after the matrix multiplication */ - Word16 *Z_e /* o : resulting matrix after the matrix multiplication */ + const Word32 *X_fx, /* i : left hand matrix */ + const Word16 *X_e, /* i : left hand matrix */ + const Word16 rowsX, /* i : number of rows of the left hand matrix */ + const Word16 colsX, /* i : number of columns of the left hand matrix */ + const Word16 transpX, /* i : flag indicating the transposition of the left hand matrix prior to the multiplication */ + const Word32 *Y_fx, /* i : right hand matrix */ + const Word16 *Y_e, /* i : right hand matrix */ + const Word16 rowsY, /* i : number of rows of the right hand matrix */ + const Word16 colsY, /* i : number of columns of the right hand matrix */ + const Word16 transpY, /* i : flag indicating the transposition of the right hand matrix prior to the multiplication */ + Word32 *Z_fx, /* o : resulting matrix after the matrix multiplication */ + Word16 *Z_e /* o : resulting matrix after the matrix multiplication */ ); void mat2svdMat_fx( - const Word32 *mat, /* i : matrix as column ordered vector Qx*/ - Word32 svdMat[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS], /* o : matrix as two-dimensional arry Qx*/ - const Word16 nRows, /* i : number of rows of the matrix Q0*/ - const Word16 mCols, /* i : number of columns of the matrix Q0*/ - const Word16 transpose /* i : flag indication transposition Q0*/ + const Word32 *mat, /* i : matrix as column ordered vector Qx*/ + Word32 svdMat[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS], /* o : matrix as two-dimensional arry Qx*/ + const Word16 nRows, /* i : number of rows of the matrix Q0*/ + const Word16 mCols, /* i : number of columns of the matrix Q0*/ + const Word16 transpose /* i : flag indication transposition Q0*/ ); void svdMat2mat_fx( - Word32 svdMat[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS], /* i : matrix as two-dimensional arry Qx*/ - Word32 *mat, /* o : matrix as column ordered vector Qx*/ - const Word16 nRows, /* i : number of rows of the matrix Q0*/ - const Word16 mCols /* i : number of columns of the matrix Q0*/ + Word32 svdMat[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS], /* i : matrix as two-dimensional arry Qx*/ + Word32 *mat, /* o : matrix as column ordered vector Qx*/ + const Word16 nRows, /* i : number of rows of the matrix Q0*/ + const Word16 mCols /* i : number of columns of the matrix Q0*/ ); Word16 computeMixingMatrices_fx( - const Word16 num_inputs, /* i : number of input channels */ - const Word16 num_outputs, /* i : number of output channels */ - const Word32 *Cx, /* i : input channel covariance matrix */ + const Word16 num_inputs, /* i : number of input channels */ + const Word16 num_outputs, /* i : number of output channels */ + const Word32 *Cx, /* i : input channel covariance matrix */ Word16 Cx_e, - const Word32 *Cy, /* i : target covariance matrix */ + const Word32 *Cy, /* i : target covariance matrix */ Word16 Cy_e, - const Word32 *Q, /* i : prototype matrix (usually a upmix matrix) */ + const Word32 *Q, /* i : prototype matrix (usually a upmix matrix) */ Word16 Q_fx_e, - const Word16 energy_compensation_flag, /* i : flag indicating that the energy compensation should be performed (i.e. no residual mixing matrix will follow) */ - const Word32 reg_Sx_fx, /* i : regularization factor for the input channel singular values */ + const Word16 energy_compensation_flag, /* i : flag indicating that the energy compensation should be performed (i.e. no residual mixing matrix will follow) */ + const Word32 reg_Sx_fx, /* i : regularization factor for the input channel singular values */ Word16 reg_Sx_e, - const Word32 reg_ghat_fx, /* i : regularization factor for the normalization matrix */ + const Word32 reg_ghat_fx, /* i : regularization factor for the normalization matrix */ Word16 reg_ghat_e, - Word32 *mixing_matrix_fx, /* o : resulting mixing matrix */ + Word32 *mixing_matrix_fx, /* o : resulting mixing matrix */ Word16 *mixing_matrix_out_e, - Word32 *Cr_fx, /* o : residual covariance matrix */ - Word16 *Cr_e ); + Word32 *Cr_fx, /* o : residual covariance matrix */ + Word16 *Cr_e +); Word16 computeMixingMatricesResidual_fx( - const Word32 num_outputs, /* i : number of output channels */ - const Word32 *Cx_fx, /* i : vector containing the diagonal diffuse prototype covariance */ + const Word32 num_outputs, /* i : number of output channels */ + const Word32 *Cx_fx, /* i : vector containing the diagonal diffuse prototype covariance */ const Word16 Cx_e, - const Word32 *Cy_fx, /* i : matrix containing the missing cov (Cr from computeMixingMatrices()) */ + const Word32 *Cy_fx, /* i : matrix containing the missing cov (Cr from computeMixingMatrices()) */ const Word16 Cy_fx_e, - const Word32 reg_Sx_fx, /* i : regularization factor for the input channel singular values */ + const Word32 reg_Sx_fx, /* i : regularization factor for the input channel singular values */ const Word16 reg_Sx_e, - const Word32 reg_ghat_fx, /* i : regularization factor for the normalization matrix */ + const Word32 reg_ghat_fx, /* i : regularization factor for the normalization matrix */ const Word16 reg_ghat_e, - Word32 *mixing_matrix_fx, /* o : resulting residual mixing matrix */ - Word16 *mixing_matrix_ret_e ); + Word32 *mixing_matrix_fx, /* o : resulting residual mixing matrix */ + Word16 *mixing_matrix_ret_e +); Word16 svd_fx( - Word32 InputMatrix[][MAX_OUTPUT_CHANNELS], /* i : matrix to be decomposed (M) InputMatrix_e*/ + Word32 InputMatrix[][MAX_OUTPUT_CHANNELS], /* i : matrix to be decomposed (M) InputMatrix_e*/ Word16 InputMatrix_e, - Word32 singularVectors_Left_fx[][MAX_OUTPUT_CHANNELS], /* o : left singular vectors (U) Q31*/ - Word32 singularValues_fx[MAX_OUTPUT_CHANNELS], /* o : singular values vector (S) singularValues_fx_e*/ - Word32 singularVectors_Right_fx[][MAX_OUTPUT_CHANNELS], /* o : right singular vectors (V) Q31*/ + Word32 singularVectors_Left_fx[][MAX_OUTPUT_CHANNELS], /* o : left singular vectors (U) Q31*/ + Word32 singularValues_fx[MAX_OUTPUT_CHANNELS], /* o : singular values vector (S) singularValues_fx_e*/ + Word32 singularVectors_Right_fx[][MAX_OUTPUT_CHANNELS], /* o : right singular vectors (V) Q31*/ Word16 singularValues_fx_e[MAX_OUTPUT_CHANNELS], - const Word16 nChannelsL, /* i : number of rows in the matrix to be decomposed Q0*/ - const Word16 nChannelsC /* i : number of columns in the matrix to be decomposed Q0*/ + const Word16 nChannelsL, /* i : number of rows in the matrix to be decomposed Q0*/ + const Word16 nChannelsC /* i : number of columns in the matrix to be decomposed Q0*/ ); ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx( DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params, /* i/o: handle for the covariance synthesis parameters */ - DIRAC_OUTPUT_SYNTHESIS_COV_STATE *h_dirac_output_synthesis_state, /* i/o: hanlde for the covariance synthesis state */ - const Word16 max_band_decorr, /* i : uppermost frequency band where decorrelation is applied */ - const Word16 interp_length, /* i : length for interpolating the mixing matrices in time slots */ - const Word16 num_param_bands, /* i : number of parameter bands */ - const Word16 num_param_bands_residual, /* i : number of parameter bands with a residual mixing matrix (i.e. decorrelation */ - const Word16 nchan_in, /* i : number of input (transport) channels */ - const Word16 nchan_out, /* i : number of output channels */ - const Word32 *proto_matrix /* i : the prototype (upmix) matrix (only used if mode == 1) */ + DIRAC_OUTPUT_SYNTHESIS_COV_STATE *h_dirac_output_synthesis_state, /* i/o: hanlde for the covariance synthesis state */ + const Word16 max_band_decorr, /* i : uppermost frequency band where decorrelation is applied */ + const Word16 interp_length, /* i : length for interpolating the mixing matrices in time slots */ + const Word16 num_param_bands, /* i : number of parameter bands */ + const Word16 num_param_bands_residual, /* i : number of parameter bands with a residual mixing matrix (i.e. decorrelation */ + const Word16 nchan_in, /* i : number of input (transport) channels */ + const Word16 nchan_out, /* i : number of output channels */ + const Word32 *proto_matrix /* i : the prototype (upmix) matrix (only used if mode == 1) */ ); void ivas_dirac_dec_output_synthesis_get_interpolator_fx( DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params, /* i/o: handle for the covariance synthesis parameters */ - const UWord16 interp_length /* i : interpolator length */ + const UWord16 interp_length /* i : interpolator length */ ); void ivas_dirac_dec_output_synthesis_cov_init_fx( - DIRAC_OUTPUT_SYNTHESIS_COV_STATE *h_dirac_output_synthesis_state, /* i/o: pointer to the state of the covariance synthesis */ - const Word16 nchan_in, /* i : number of input (tranport) channels */ - const Word16 nchan_out, /* i : number of output channels */ - const Word16 n_param_bands, /* i : number of total parameter bands */ - const Word16 n_param_bands_res /* i : number of parameter bands with a residual mixing matrix (i.e. decorrelation */ + DIRAC_OUTPUT_SYNTHESIS_COV_STATE *h_dirac_output_synthesis_state, /* i/o: pointer to the state of the covariance synthesis */ + const Word16 nchan_in, /* i : number of input (tranport) channels */ + const Word16 nchan_out, /* i : number of output channels */ + const Word16 n_param_bands, /* i : number of total parameter bands */ + const Word16 n_param_bands_res /* i : number of parameter bands with a residual mixing matrix (i.e. decorrelation */ ); void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot_fx( Word32 *Cldfb_RealBuffer_in_fx, Word32 *Cldfb_ImagBuffer_in_fx, - Word32 Cldfb_RealBuffer_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (real part) */ - Word32 Cldfb_ImagBuffer_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (imaginary part) */ - Word32 *mixing_matrix_fx[], /* i : parameter band wise mixing matrices (direct part) */ - Word16 *mixing_matrix_e, /* i : parameter band wise mixing matrices (direct part) */ - Word32 *mixing_matrix_res_fx[], /* i : parameter band wise mixing matrices (residual part) */ - Word16 *mixing_matrix_res_e, /* i : parameter band wise mixing matrices (residual part) */ - const UWord16 slot_idx_sfr, /* i : time slot index for the current slot within the current subframe */ - const UWord16 slot_idx_tot, /* i : time slot index for the current slot within the frame */ - const Word16 nX, /* i : number of input channels */ - const Word16 nY, /* i : number of output channels */ - PARAM_MC_DEC_HANDLE hParamMC /* i : handle to the Parametric MC decoder state */ + Word32 Cldfb_RealBuffer_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (real part) */ + Word32 Cldfb_ImagBuffer_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (imaginary part) */ + Word32 *mixing_matrix_fx[], /* i : parameter band wise mixing matrices (direct part) */ + Word16 *mixing_matrix_e, /* i : parameter band wise mixing matrices (direct part) */ + Word32 *mixing_matrix_res_fx[], /* i : parameter band wise mixing matrices (residual part) */ + Word16 *mixing_matrix_res_e, /* i : parameter band wise mixing matrices (residual part) */ + const UWord16 slot_idx_sfr, /* i : time slot index for the current slot within the current subframe */ + const UWord16 slot_idx_tot, /* i : time slot index for the current slot within the frame */ + const Word16 nX, /* i : number of input channels */ + const Word16 nY, /* i : number of output channels */ + PARAM_MC_DEC_HANDLE hParamMC /* i : handle to the Parametric MC decoder state */ ); Word16 computeMixingMatricesISM_fx( @@ -5337,132 +5342,136 @@ Word16 computeMixingMatricesISM_fx( const Word32 reg_Sx_fx, const Word32 reg_ghat_fx, Word32 *mixing_matrix_fx, - Word16 *mixing_matrix_e ); + Word16 *mixing_matrix_e +); ivas_error ivas_spar_enc_open_fx( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder handle */ - const Word16 spar_reconfig_flag /* i : SPAR reconfiguration flag */ + Encoder_Struct *st_ivas, /* i/o: IVAS encoder handle */ + const Word16 spar_reconfig_flag /* i : SPAR reconfiguration flag */ ); void ivas_spar_enc_close_fx( - SPAR_ENC_HANDLE *hSpar, /* i/o: SPAR encoder handle */ - const Word32 input_Fs, /* i : input sampling rate */ - const Word16 nchan_inp, /* i : number of input channels */ - const Word16 spar_reconfig_flag /* i : SPAR reconfiguration flag */ + SPAR_ENC_HANDLE *hSpar, /* i/o: SPAR encoder handle */ + const Word32 input_Fs, /* i : input sampling rate */ + const Word16 nchan_inp, /* i : number of input channels */ + const Word16 spar_reconfig_flag /* i : SPAR reconfiguration flag */ ); void ivas_spar_dec_close_fx( - SPAR_DEC_HANDLE *hSpar, /* i/o: SPAR decoder handle */ - const Word32 output_Fs, /* i : output sampling rate */ - const Word16 spar_reconfig_flag /* i : SPAR reconfiguration flag */ + SPAR_DEC_HANDLE *hSpar, /* i/o: SPAR decoder handle */ + const Word32 output_Fs, /* i : output sampling rate */ + const Word16 spar_reconfig_flag /* i : SPAR reconfiguration flag */ ); ivas_error ivas_sba_linear_renderer_fx( - Word32 *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ - const Word16 output_frame, /* i : output frame length per channel */ - const Word16 nchan_in, /* i : number of input ambisonics channels */ - const Word16 nchan_ism, /* i : number of objects */ - const AUDIO_CONFIG output_config, /* i : output audio configuration */ - const IVAS_OUTPUT_SETUP output_setup /* i : output format setup */ + Word32 *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ + const Word16 output_frame, /* i : output frame length per channel */ + const Word16 nchan_in, /* i : number of input ambisonics channels */ + const Word16 nchan_ism, /* i : number of objects */ + const AUDIO_CONFIG output_config, /* i : output audio configuration */ + const IVAS_OUTPUT_SETUP output_setup /* i : output format setup */ ); void ivas_sba_mix_matrix_determiner_fx( - SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ - Word32 *output_fx[], /* i/o: transport/output audio channels */ - const Word16 bfi, /* i : BFI flag */ - const Word16 nchan_remapped, /* i : num channels after remapping of TCs */ - const Word16 output_frame, /* i : output frame length */ - const Word16 num_md_sub_frames, /* i : number of subframes in mixing matrix*/ - const Word16 Q_output /* i : Q of transport/output audio channels */ + SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ + Word32 *output_fx[], /* i/o: transport/output audio channels */ + const Word16 bfi, /* i : BFI flag */ + const Word16 nchan_remapped, /* i : num channels after remapping of TCs */ + const Word16 output_frame, /* i : output frame length */ + const Word16 num_md_sub_frames, /* i : number of subframes in mixing matrix */ + const Word16 Q_output /* i : Q of transport/output audio channels */ ); Word16 ivas_agc_enc_get_flag( - const Word16 nchan_transport /* i : number of transport channels */ + const Word16 nchan_transport /* i : number of transport channels */ ); ivas_error ivas_spar_agc_enc_open_fx( - ivas_agc_enc_state_t **hAgcEnc, /* i/o: SPAR AGC encoder handle */ - const Word32 input_Fs, /* i : input sampling rate */ - const Word16 nchan_inp /* i : number of input channels */ + ivas_agc_enc_state_t **hAgcEnc, /* i/o: SPAR AGC encoder handle */ + const Word32 input_Fs, /* i : input sampling rate */ + const Word16 nchan_inp /* i : number of input channels */ ); void ivas_spar_agc_enc_close_fx( - ivas_agc_enc_state_t **hAgcEnc /* i/o: SPAR AGC encoder handle */ + ivas_agc_enc_state_t **hAgcEnc /* i/o: SPAR AGC encoder handle */ ); void ivas_agc_enc_process_fx( - ivas_agc_enc_state_t *hAgcEnc, /* i/o: AGC encoder handle */ - BSTR_ENC_HANDLE hMetaData, /* i/o: MetaData handle */ - Word32 **ppPcm_in, /* i : input audio channels */ - Word32 **ppPcm_out, /* o : output audio channels */ - const Word16 n_channels, /* i : number of channels */ - const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ - Word16 *q_ppPcm ); + ivas_agc_enc_state_t *hAgcEnc, /* i/o: AGC encoder handle */ + BSTR_ENC_HANDLE hMetaData, /* i/o: MetaData handle */ + Word32 **ppPcm_in, /* i : input audio channels */ + Word32 **ppPcm_out, /* o : output audio channels */ + const Word16 n_channels, /* i : number of channels */ + const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ + Word16 *q_ppPcm +); void ivas_spar_set_bitrate_config_fx( - ivas_spar_md_com_cfg *pSpar_md_cfg, /* i/o: SPAR MD config. handle */ - const Word16 table_idx, /* i : config. table index */ - const Word16 num_bands, /* i : number of bands */ + ivas_spar_md_com_cfg *pSpar_md_cfg, /* i/o: SPAR MD config. handle */ + const Word16 table_idx, /* i : config. table index */ + const Word16 num_bands, /* i : number of bands */ const Word16 dirac2spar_md_flag, const Word16 enc_flag, const Word16 pca_flag, - const Word16 agc_flag ); + const Word16 agc_flag +); Word16 ivas_is_res_channel( - const Word16 ch, /* i : ch index in WYZX ordering */ - const Word16 nchan_transport /* i : number of transport channels (1-4) */ + const Word16 ch, /* i : ch index in WYZX ordering */ + const Word16 nchan_transport /* i : number of transport channels (1-4) */ ); void ivas_spar_dec_agc_pca_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - Word32 *output[], /* i/o: input/output audio channels */ - const Word16 output_frame /* i : output frame length */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + Word32 *output[], /* i/o: input/output audio channels */ + const Word16 output_frame /* i : output frame length */ ); void ivas_spar_dec_set_render_map_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const Word16 nCldfbTs /* i : number of CLDFB time slots */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const Word16 nCldfbTs /* i : number of CLDFB time slots */ ); void ivas_spar_dec_set_render_params_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const Word16 n_cldfb_slots /* i : number of cldfb slots in this frame */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const Word16 n_cldfb_slots /* i : number of cldfb slots in this frame */ ); void ivas_spar_dec_digest_tc_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const Word16 nchan_transport, /* i : number of transport channels */ - const Word16 nCldfbSlots, /* i : number of CLDFB slots */ - const Word16 nSamplesForRendering /* i : number of samples provided */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const Word16 nchan_transport, /* i : number of transport channels */ + const Word16 nCldfbSlots, /* i : number of CLDFB slots */ + const Word16 nSamplesForRendering /* i : number of samples provided */ ); void ivas_sba_dec_digest_tc_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const Word16 nCldfbSlots, /* i : number of CLDFB slots */ - const Word16 nSamplesForRendering /* i : number of samples provided */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const Word16 nCldfbSlots, /* i : number of CLDFB slots */ + const Word16 nSamplesForRendering /* i : number of samples provided */ ); + ivas_error ivas_sba_dec_render_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ - UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ - UWord16 *nSamplesAvailableNext, /* o : number of CLDFB slots still to render */ - Word32 *output_fx[] /* o : rendered time signal Q11*/ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ + UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ + UWord16 *nSamplesAvailableNext, /* o : number of CLDFB slots still to render */ + Word32 *output_fx[] /* o : rendered time signal Q11*/ ); void ivas_spar_dec_upmixer_sf_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - Word32 *output_fx[], /* o : output audio channels */ - const Word16 nchan_internal /* i : number of internal channels */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + Word32 *output_fx[], /* o : output audio channels */ + const Word16 nchan_internal /* i : number of internal channels */ ); ivas_error ivas_spar_md_enc_open_fx( - ivas_spar_md_enc_state_t **hMdEnc_in, /* i/o: SPAR MD encoder handle */ - const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ - const Word16 sba_order /* i : Ambisonic (SBA) order */ + ivas_spar_md_enc_state_t **hMdEnc_in, /* i/o: SPAR MD encoder handle */ + const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ + const Word16 sba_order /* i : Ambisonic (SBA) order */ ); void ivas_spar_md_enc_close_fx( - ivas_spar_md_enc_state_t **hMdEnc /* i/o: SPAR MD encoder handle */ + ivas_spar_md_enc_state_t **hMdEnc /* i/o: SPAR MD encoder handle */ ); void ivas_create_fullr_dmx_mat_fx( @@ -5476,7 +5485,8 @@ void ivas_create_fullr_dmx_mat_fx( const Word16 start_band, const Word16 end_band, const Word16 active_w, - ivas_spar_md_com_cfg *hMdCfg ); + ivas_spar_md_com_cfg *hMdCfg +); void ivas_get_spar_md_from_dirac_enc_fx( Word32 azi_dirac_fx[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES], // Q22 @@ -5494,7 +5504,8 @@ void ivas_get_spar_md_from_dirac_enc_fx( Word32 Wscale_d[IVAS_MAX_NUM_BANDS], // Q29 const UWord8 useLowerRes, const Word16 active_w_vlbr, - const Word16 dyn_active_w_flag ); + const Word16 dyn_active_w_flag +); void ivas_get_spar_md_from_dirac_fx( Word32 azi_dirac_fx[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES], // Q22 @@ -5512,73 +5523,76 @@ void ivas_get_spar_md_from_dirac_fx( Word32 Wscale_d[IVAS_MAX_NUM_BANDS], // Q29 const UWord8 useLowerRes, const Word16 active_w_vlbr, - const Word16 dyn_active_w_flag ); + const Word16 dyn_active_w_flag +); ivas_error ivas_spar_md_enc_process_fx( - ivas_spar_md_enc_state_t *hMdEnc, /* i/o: SPAR MD encoder handle */ - const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ + ivas_spar_md_enc_state_t *hMdEnc, /* i/o: SPAR MD encoder handle */ + const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ Word32 *cov_real_fx[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], Word16 *cov_real_q[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], Word32 *cov_dtx_real_fx[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], Word16 *cov_dtx_real_q[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], - BSTR_ENC_HANDLE hMetaData, /* i/o: MetaData handle */ + BSTR_ENC_HANDLE hMetaData, /* i/o: MetaData handle */ const Word16 dtx_vad, const Word16 nchan_inp, - const Word16 sba_order, /* i : Ambisonic (SBA) order */ - Word32 *prior_mixer[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH], /* i : prior mixer_matrix */ - Word16 *q_prior_mixer, /* i/o : q for prior mixer_matrix */ - const Word16 dyn_active_w_flag, /* i : flag to indicate dynamic active W */ - const Word16 dirac_mono_flag, /* i : flag to indicate mono only mode in SBA */ - const Word16 nchan_out ); + const Word16 sba_order, /* i : Ambisonic (SBA) order */ + Word32 *prior_mixer[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH], /* i : prior mixer_matrix */ + Word16 *q_prior_mixer, /* i/o : q for prior mixer_matrix */ + const Word16 dyn_active_w_flag, /* i : flag to indicate dynamic active W */ + const Word16 dirac_mono_flag, /* i : flag to indicate mono only mode in SBA */ + const Word16 nchan_out +); Word16 ivas_get_spar_dec_md_num_subframes( - const Word16 sba_order, /* i : Ambisonic (SBA) order */ - const Word32 ivas_total_brate, /* i : IVAS total bitrate */ - const Word32 ivas_last_active_brate /* i : IVAS last active bitrate */ + const Word16 sba_order, /* i : Ambisonic (SBA) order */ + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + const Word32 ivas_last_active_brate /* i : IVAS last active bitrate */ ); void ivas_spar_get_parameters_fx( - SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ - const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ - const Word16 ts, /* i : time slot index */ - const Word16 num_ch_out, /* i : number of channels out */ - const Word16 num_ch_in, /* i : number of channels in */ - const Word16 num_spar_bands, /* i : number of SPAR bands */ - Word32 par_mat_fx[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS] /* o : mixing matrix */ + SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ + const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ + const Word16 ts, /* i : time slot index */ + const Word16 num_ch_out, /* i : number of channels out */ + const Word16 num_ch_in, /* i : number of channels in */ + const Word16 num_spar_bands, /* i : number of SPAR bands */ + Word32 par_mat_fx[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS] /* o : mixing matrix */ ); void ivas_spar_to_dirac_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ - const Word16 dtx_vad, /* i : DTX frame flag */ - const Word16 num_bands_out, /* i : number of output bands */ - const Word16 bw, /* i : band joining factor */ - const Word16 dyn_active_w_flag /* i : dynamic active W flag */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ + const Word16 dtx_vad, /* i : DTX frame flag */ + const Word16 num_bands_out, /* i : number of output bands */ + const Word16 bw, /* i : band joining factor */ + const Word16 dyn_active_w_flag /* i : dynamic active W flag */ ); void ivas_spar_dec_gen_umx_mat_fx( - ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ - const Word16 nchan_transport, /* i : number of transport channels */ - const Word16 num_bands_out, /* i : number of output bands */ - const Word16 bfi, /* i : bad frame indicator */ - const Word16 num_md_sub_frames ); + ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ + const Word16 nchan_transport, /* i : number of transport channels */ + const Word16 num_bands_out, /* i : number of output bands */ + const Word16 bfi, /* i : bad frame indicator */ + const Word16 num_md_sub_frames +); ivas_error ivas_spar_covar_enc_open_fx( - ivas_enc_cov_handler_state_t **hCovEnc, /* i/o: SPAR Covar. encoder handle */ - ivas_filterbank_t *pFb, /* i/o: FB handle */ - const Word32 input_Fs, /* i : input sampling rate */ - const Word16 nchan_inp, /* i : number of input channels */ - const COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC*/ - const Word32 ivas_total_brate /* i : IVAS total bitrate */ + ivas_enc_cov_handler_state_t **hCovEnc, /* i/o: SPAR Covar. encoder handle */ + ivas_filterbank_t *pFb, /* i/o: FB handle */ + const Word32 input_Fs, /* i : input sampling rate */ + const Word16 nchan_inp, /* i : number of input channels */ + const COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC */ + const Word32 ivas_total_brate /* i : IVAS total bitrate */ ); void ivas_spar_covar_enc_close_fx( - ivas_enc_cov_handler_state_t **hCovEnc, /* i/o: SPAR Covar. encoder handle */ - const Word16 nchan_inp /* i : number of input channels */ + ivas_enc_cov_handler_state_t **hCovEnc, /* i/o: SPAR Covar. encoder handle */ + const Word16 nchan_inp /* i : number of input channels */ ); void ivas_enc_cov_handler_process_fx( - ivas_enc_cov_handler_state_t *hCovEnc, /* i/o: SPAR Covar. encoder handle */ + ivas_enc_cov_handler_state_t *hCovEnc, /* i/o: SPAR Covar. encoder handle */ Word32 **ppIn_FR_real, Word32 **ppIn_FR_imag, Word16 q_ppIn_FR, @@ -5586,7 +5600,7 @@ void ivas_enc_cov_handler_process_fx( Word16 *q_cov_real[IVAS_SPAR_MAX_CH], Word32 *cov_dtx_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], Word16 *q_cov_dtx_real[IVAS_SPAR_MAX_CH], - ivas_filterbank_t *pFb, /* i/o: FB handle */ + ivas_filterbank_t *pFb, /* i/o: FB handle */ const Word16 start_band, const Word16 end_band, const Word16 num_ch, @@ -5597,79 +5611,84 @@ void ivas_enc_cov_handler_process_fx( const Word16 *remix_order, Word16 *dyn_active_w_flag, const Word16 nchan_transport, - const Word16 is_sba ); + const Word16 is_sba +); ivas_error ivas_spar_covar_smooth_enc_open_fx( - ivas_cov_smooth_state_t **hCovState, /* i/o: SPAR Covar. smoothing handle */ - const ivas_cov_smooth_cfg_t *cov_smooth_cfg, /* i : SPAR config. handle */ - ivas_filterbank_t *pFb, /* i/o: FB handle */ - const Word16 nchan_inp, /* i : number of input channels */ - const COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC */ - const Word32 ivas_total_brate /* i : IVAS total bitrate */ + ivas_cov_smooth_state_t **hCovState, /* i/o: SPAR Covar. smoothing handle */ + const ivas_cov_smooth_cfg_t *cov_smooth_cfg, /* i : SPAR config. handle */ + ivas_filterbank_t *pFb, /* i/o: FB handle */ + const Word16 nchan_inp, /* i : number of input channels */ + const COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC */ + const Word32 ivas_total_brate /* i : IVAS total bitrate */ ); void ivas_spar_covar_smooth_enc_close_fx( - ivas_cov_smooth_state_t **hCovState, /* i/o: SPAR Covar. encoder handle */ - const Word16 nchan_inp /* i : number of input channels */ + ivas_cov_smooth_state_t **hCovState, /* i/o: SPAR Covar. encoder handle */ + const Word16 nchan_inp /* i : number of input channels */ ); void ivas_cov_smooth_process_fx( - ivas_cov_smooth_state_t *hCovState, /* i/o: Covariance state handle */ + ivas_cov_smooth_state_t *hCovState, /* i/o: Covariance state handle */ Word32 *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], - ivas_filterbank_t *pFb, /* i/o: FB handle */ + ivas_filterbank_t *pFb, /* i/o: FB handle */ const Word16 start_band, const Word16 end_band, const Word16 num_ch, const Word16 transient_det[2], - Word16 *q_cov[IVAS_SPAR_MAX_CH] ); + Word16 *q_cov[IVAS_SPAR_MAX_CH] +); void ivas_pca_enc_init_fx( - PCA_ENC_STATE *hPCA /* i/o: PCA encoder structure */ + PCA_ENC_STATE *hPCA /* i/o: PCA encoder structure */ ); void ivas_pca_enc_fx( - const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ - PCA_ENC_STATE *hPCA, /* i : PCA encoder structure */ - BSTR_ENC_HANDLE hMetaData, /* i/o: MetaData handle */ - Word32 *data_f[8], /* i : input/transformed audio channels Q11 */ - const Word16 input_frame, /* i : input frame length */ - const Word16 n_channels /* i : number of channels */ + const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ + PCA_ENC_STATE *hPCA, /* i : PCA encoder structure */ + BSTR_ENC_HANDLE hMetaData, /* i/o: MetaData handle */ + Word32 *data_f[8], /* i : input/transformed audio channels Q11 */ + const Word16 input_frame, /* i : input frame length */ + const Word16 n_channels /* i : number of channels */ ); void cov_subfr_fx( Word32 **ptr_sig_fx, // Q11 Word64 *r_fx_64, // Q11 const Word16 n_channels, - const Word16 len ); + const Word16 len +); void ivas_pca_read_bits_fx( - Decoder_State *st0, /* i/o: decoder state structure - for bitstream handling*/ - PCA_DEC_STATE *hPCA /* i/o: PCA encoder structure */ + Decoder_State *st0, /* i/o: decoder state structure - for bitstream handling*/ + PCA_DEC_STATE *hPCA /* i/o: PCA encoder structure */ ); void ivas_pca_dec_init_fx( - PCA_DEC_STATE *hPCA /* i/o: PCA decoder structure */ + PCA_DEC_STATE *hPCA /* i/o: PCA decoder structure */ ); void ivas_pca_dec_fx( - PCA_DEC_STATE *hPCA, /* i/o: PCA decoder structure */ - const Word16 output_frame, /* i : output frame length */ - const Word16 n_channels, /* i : number of channels */ - const Word32 ivas_total_brate, /* i : IVAS total bitrate */ - const Word32 last_ivas_total_brate, /* i : last IVAS total bitrate */ - const Word16 bfi, /* i : bad frame indicator */ - Word32 *pcm_out[] /* o : output audio channels */ + PCA_DEC_STATE *hPCA, /* i/o: PCA decoder structure */ + const Word16 output_frame, /* i : output frame length */ + const Word16 n_channels, /* i : number of channels */ + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + const Word32 last_ivas_total_brate, /* i : last IVAS total bitrate */ + const Word16 bfi, /* i : bad frame indicator */ + Word32 *pcm_out[] /* o : output audio channels */ ); void eye_matrix_fx( Word16 *mat, const Word16 n, - const Word16 d ); + const Word16 d +); void eye_matrix_fx32( Word32 *mat, // Q const Word16 n, - const Word32 d ); // Q + const Word32 d // Q +); void eig_qr_fx( const Word32 *A_fx, // A_q @@ -5677,12 +5696,14 @@ void eig_qr_fx( const Word16 num_iter, Word32 *EV_fx, // Q31 Word32 *Vals_fx, // A_q - const Word16 n ); + const Word16 n +); void exhst_4x4_fx( Word16 *cost_mtx, // Q Word16 *path, - const Word16 maximize ); + const Word16 maximize +); Word16 mat_det4_fx( const Word16 *m // Q15 @@ -5697,13 +5718,15 @@ void mat2dquat_fx( void dquat2mat_fx( const Word16 *ql, const Word16 *qr, - Word16 *m ); + Word16 *m +); void quat_shortestpath_fx( const Word16 *q00, Word16 *q01, const Word16 *q10, - Word16 *q11 ); + Word16 *q11 +); void pca_interp_preproc_fx( const Word16 *prev_ql, @@ -5712,110 +5735,119 @@ void pca_interp_preproc_fx( const Word16 *qr, const Word16 len, Word16 *ql_interp, - Word16 *qr_interp ); + Word16 *qr_interp +); void pca_dec_s3_fx( const Word32 index, - Word16 *q ); + Word16 *q +); void ivas_spar_huff_coeffs_com_init( ivas_huff_coeffs_t *pHuff_coeffs, ivas_spar_md_com_cfg *pSpar_cfg, const Word16 table_idx, - const Word16 enc_dec ); + const Word16 enc_dec +); void ivas_spar_arith_coeffs_com_init( ivas_arith_coeffs_t *pArith_coeffs, ivas_spar_md_com_cfg *pSpar_cfg, const Word16 table_idx, - const Word16 enc_dec ); + const Word16 enc_dec +); void ivas_ari_start_decoding_14bits_ext_1_lfe( Decoder_State *st, Tastat *s, - Word16 *extra_bits_read ); + Word16 *extra_bits_read +); UWord16 ivas_ari_decode_14bits_bit_ext_1_lfe( Decoder_State *st, Tastat *s, const UWord16 *cum_freq, - Word16 *extra_bits_read ); + Word16 *extra_bits_read +); void ivas_ari_done_decoding_14bits_ext_1_lfe( Decoder_State *st, - const Word16 extra_bits_read ); + const Word16 extra_bits_read +); Word16 quantize_phi_fx( - Word32 phi, /* i : azimuth value */ - const Word16 flag_delta, /* i : flag indicating if the azimuth codebook is translated or not */ - Word32 *phi_hat, /* o : quantized azimuth */ - const Word16 n /* i : azimuth codebook size */ + Word32 phi, /* i : azimuth value */ + const Word16 flag_delta, /* i : flag indicating if the azimuth codebook is translated or not */ + Word32 *phi_hat, /* o : quantized azimuth */ + const Word16 n /* i : azimuth codebook size */ ); Word16 quantize_phi_enc_fx( - Word32 phi, /* i : azimuth value */ - const Word16 flag_delta, /* i : flag indicating if the azimuth codebook is translated or not */ - Word32 *phi_hat, /* o : quantized azimuth */ - const Word16 n /* i : azimuth codebook size */ + Word32 phi, /* i : azimuth value */ + const Word16 flag_delta, /* i : flag indicating if the azimuth codebook is translated or not */ + Word32 *phi_hat, /* o : quantized azimuth */ + const Word16 n /* i : azimuth codebook size */ ); Word16 ivas_spar_chk_zero_coefs_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ); void pca_enc_s3_fx( Word16 *q, // Q15 - Word32 *index ); + Word32 *index +); void ivas_spar_get_uniform_quant_strat_fx( ivas_spar_md_com_cfg *pSpar_md_com_cfg, - const Word16 table_idx ); + const Word16 table_idx +); void ivas_lfe_lpf_select_filt_coeff_fx( - const Word32 sampling_rate, /* i : sampling rate */ - const Word16 order, /* i : filter order */ - const Word32 **ppFilt_coeff_fx, /* o : filter coefficients */ - const Word16 **ppFilt_coeff_e /* o : exponents of filter coefficients */ + const Word32 sampling_rate, /* i : sampling rate */ + const Word16 order, /* i : filter order */ + const Word32 **ppFilt_coeff_fx, /* o : filter coefficients */ + const Word16 **ppFilt_coeff_e /* o : exponents of filter coefficients */ ); void ivas_filters_init_fx( - ivas_filters_process_state_t *filter_state, /* i/o: filter state handle */ - const Word32 *filt_coeff, /* i : filter coefficients */ - const Word16 *filt_coeff_e, /* i : exponents of filter coefficients */ - const Word16 order /* i : filter order */ + ivas_filters_process_state_t *filter_state, /* i/o: filter state handle */ + const Word32 *filt_coeff, /* i : filter coefficients */ + const Word16 *filt_coeff_e, /* i : exponents of filter coefficients */ + const Word16 order /* i : filter order */ ); void ivas_decision_matrix_enc_fx( - Encoder_State *st, /* i : encoder state structure */ - const Word32 element_brate, /* i : element bitrate */ - const Word16 fft_buff[], /* i : FFT buffer */ - const Word32 enerBuffer[], /* i : energy buffer */ + Encoder_State *st, /* i : encoder state structure */ + const Word32 element_brate, /* i : element bitrate */ + const Word16 fft_buff[], /* i : FFT buffer */ + const Word32 enerBuffer[], /* i : energy buffer */ Word16 enerBuffer_exp, - const Word16 last_element_mode /* i : last element mode */ + const Word16 last_element_mode /* i : last element mode */ ); void stereo_dft_dec_sid_coh_fx( - Decoder_State *st, /* i/o: decoder state structure */ - const Word16 nbands, /* i : number of DFT stereo bands Q0*/ - Word16 *coh, /* i/o: coherence Q15*/ - Word16 *nb_bits /* i/o: number of bits read Q0*/ + Decoder_State *st, /* i/o: decoder state structure */ + const Word16 nbands, /* i : number of DFT stereo bands Q0*/ + Word16 *coh, /* i/o: coherence Q15*/ + Word16 *nb_bits /* i/o: number of bits read Q0*/ ); void stereo_tca_init_enc_fx( - STEREO_TCA_ENC_HANDLE hStereoTCA, /* i/o: Stereo ICA handle */ - const Word32 input_Fs /* i : input sampling frequency */ + STEREO_TCA_ENC_HANDLE hStereoTCA, /* i/o: Stereo ICA handle */ + const Word32 input_Fs /* i : input sampling frequency */ ); void stereo_tca_dec_fx( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - Word32 *synth[CPE_CHANNELS], /* i/o: output synth qsynth*/ - const Word16 output_frame /* i : length of a frame per channel Q0*/ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + Word32 *synth[CPE_CHANNELS], /* i/o: output synth qsynth*/ + const Word16 output_frame /* i : length of a frame per channel Q0*/ ); void stereo_tca_scale_R_channel_fx( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - Word32 *output_fx, /* i/o: output synthesis, R channel q_out*/ - const Word16 output_frame /* i : frame length Q0*/ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + Word32 *output_fx, /* i/o: output synthesis, R channel q_out*/ + const Word16 output_frame /* i : frame length Q0*/ ); void adjustTargetSignal_fx( @@ -5823,215 +5855,215 @@ void adjustTargetSignal_fx( const Word16 prevShift, const Word16 currShift, const Word16 L_shift_adapt, - const Word16 method ); + const Word16 method +); void stereo_icBWE_init_enc_fx( - STEREO_ICBWE_ENC_HANDLE hStereoICBWE /* i/o: Stereo inter-channel BWE handle */ + STEREO_ICBWE_ENC_HANDLE hStereoICBWE /* i/o: Stereo inter-channel BWE handle */ ); void stereo_classifier_init_fx( - STEREO_CLASSIF_HANDLE hStereoClassif /* i/o: stereo classifier structure */ + STEREO_CLASSIF_HANDLE hStereoClassif /* i/o: stereo classifier structure */ ); void stereo_td_init_dec_fx( - STEREO_TD_DEC_DATA_HANDLE hStereoTD, /* i/o: TD stereo decoder handle */ - const Word16 last_element_mode /* i : last element mode Q0*/ + STEREO_TD_DEC_DATA_HANDLE hStereoTD, /* i/o: TD stereo decoder handle */ + const Word16 last_element_mode /* i : last element mode Q0*/ ); void initMdctStereoEncData_fx( - STEREO_MDCT_ENC_DATA *hStereoMdct, /* i/o: mdct stereo parameters structure */ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const Word16 element_mode, /* i : element mode */ - const Word32 element_brate, /* i : element bitrate */ - const Word16 bwidth, /* i : bandwidth */ - const Word16 igf, /* i : flag indicating IGF activity */ - const H_IGF_GRID hIgfGrid, /* i : IGF grid setup */ - const Word16 mem_init /* i : initialize memory after malloc */ + STEREO_MDCT_ENC_DATA *hStereoMdct, /* i/o: mdct stereo parameters structure */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const Word16 element_mode, /* i : element mode */ + const Word32 element_brate, /* i : element bitrate */ + const Word16 bwidth, /* i : bandwidth */ + const Word16 igf, /* i : flag indicating IGF activity */ + const H_IGF_GRID hIgfGrid, /* i : IGF grid setup */ + const Word16 mem_init /* i : initialize memory after malloc */ ); void deindex_sph_idx_fx( - const UWord16 sphIndex, /* i : Spherical index */ - const SPHERICAL_GRID_DATA *gridData, /* i : Prepared spherical grid */ - Word32 *theta_fx, /* o : Elevation */ - Word32 *phi_fx /* o : Azimuth */ + const UWord16 sphIndex, /* i : Spherical index */ + const SPHERICAL_GRID_DATA *gridData, /* i : Prepared spherical grid */ + Word32 *theta_fx, /* o : Elevation */ + Word32 *phi_fx /* o : Azimuth */ ); ivas_error ivas_dirac_enc_open_fx( - Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ + Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ ); void ivas_dirac_enc_close_fx( - DIRAC_ENC_HANDLE *hDirAC, /* i/o: encoder DirAC handle */ - const Word32 input_Fs /* i : input sampling_rate */ + DIRAC_ENC_HANDLE *hDirAC, /* i/o: encoder DirAC handle */ + const Word32 input_Fs /* i : input sampling_rate */ ); ivas_error ivas_dirac_enc_fx( - DIRAC_ENC_HANDLE hDirAC, /* i/o: encoder DirAC handle */ - IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ - BSTR_ENC_HANDLE hMetaData, /* i/o: Metadata bitstream handle */ - Word32 *data_f[], /* i/o: SBA channels */ - Word32 **ppIn_FR_real, /* o : real freq domain values */ - Word32 **ppIn_FR_imag, /* o : imag freq domain values */ + DIRAC_ENC_HANDLE hDirAC, /* i/o: encoder DirAC handle */ + IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ + BSTR_ENC_HANDLE hMetaData, /* i/o: Metadata bitstream handle */ + Word32 *data_f[], /* i/o: SBA channels */ + Word32 **ppIn_FR_real, /* o : real freq domain values */ + Word32 **ppIn_FR_imag, /* o : imag freq domain values */ Word16 pp_fr_q, - const Word16 input_frame, /* i : input frame length */ - const Word16 dtx_vad, /* i : DTX vad flag */ - const IVAS_FORMAT ivas_format, /* i : ivas format */ - const Word16 nchan_transport, /* i : number of transport channels */ - const Word16 hodirac_flag, /* i : hodirac flag */ + const Word16 input_frame, /* i : input frame length */ + const Word16 dtx_vad, /* i : DTX vad flag */ + const IVAS_FORMAT ivas_format, /* i : ivas format */ + const Word16 nchan_transport, /* i : number of transport channels */ + const Word16 hodirac_flag, /* i : hodirac flag */ const Word16 shift ); ivas_error ivas_spar_md_enc_init_fx( - ivas_spar_md_enc_state_t *hMdEnc, /* o : MD encoder handle */ - const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ - const Word16 sba_order /* i : Ambisonic (SBA) order */ + ivas_spar_md_enc_state_t *hMdEnc, /* o : MD encoder handle */ + const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ + const Word16 sba_order /* i : Ambisonic (SBA) order */ ); void ivas_spar_get_cldfb_gains_fx( SPAR_DEC_HANDLE hSpar, HANDLE_CLDFB_FILTER_BANK cldfbAnaDec0, HANDLE_CLDFB_FILTER_BANK cldfbSynDec0, - const DECODER_CONFIG_HANDLE hDecoderConfig ); + const DECODER_CONFIG_HANDLE hDecoderConfig +); void ivas_sba_getTCs_fx( - Word32 *sba_data[], /* i : SBA signals Q11 */ - Encoder_Struct *st_ivas, /* i/o: Encoder struct */ - const Word16 input_frame /* i : frame length */ + Word32 *sba_data[], /* i : SBA signals Q11 */ + Encoder_Struct *st_ivas, /* i/o: Encoder struct */ + const Word16 input_frame /* i : frame length */ ); ivas_error front_vad_spar_fx( - SPAR_ENC_HANDLE hSpar, /* i/o: SPAR encoder structure */ - const Word32 *omni_in, /* i : omnidirectional input signal Q11 */ - ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : encoder configuration handle */ - const Word16 input_frame /* i : input frame length */ + SPAR_ENC_HANDLE hSpar, /* i/o: SPAR encoder structure */ + const Word32 *omni_in, /* i : omnidirectional input signal Q11 */ + ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : encoder configuration handle */ + const Word16 input_frame /* i : input frame length */ ); ivas_error ivas_spar_enc_fx( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ - Word32 *data_fx[], /* i/o: input/transport audio channel Q11 */ - const Word16 input_frame, /* i : input frame length */ - Word16 *nb_bits_metadata, /* i : number of MD bits written */ - BSTR_ENC_HANDLE hMetaData /* o : MetaData handle */ + Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ + Word32 *data_fx[], /* i/o: input/transport audio channel Q11 */ + const Word16 input_frame, /* i : input frame length */ + Word16 *nb_bits_metadata, /* i : number of MD bits written */ + BSTR_ENC_HANDLE hMetaData /* o : MetaData handle */ ); ivas_error ivas_ism_enc_fx( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ - Word32 *data[], /* i : input signal [channels][samples] Q(q_data) */ - Word16 q_data, /* i : Q-factor of input signal */ - const Word16 input_frame, /* i : input frame length per channel */ - Word16 *nb_bits_metadata, /* i : number of metadata bits */ - const Word16 flag_omasa_ener_brate /* i : less bitrate for objects in OMASA flag */ + Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ + Word32 *data[], /* i : input signal [channels][samples] Q(q_data) */ + Word16 q_data, /* i : Q-factor of input signal */ + const Word16 input_frame, /* i : input frame length per channel */ + Word16 *nb_bits_metadata, /* i : number of metadata bits */ + const Word16 flag_omasa_ener_brate /* i : less bitrate for objects in OMASA flag */ ); ivas_error ivas_sce_enc_fx( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ - const Word16 sce_id, /* i : SCE # identifier */ - const Word32 data_fx[], /* i : input signal for single channel Q(q_data_fx) */ - const Word16 q_data_fx, /* i : Q-factor of input signal for single channel */ - const Word16 input_frame, /* i : input frame length per channel */ - const Word16 nb_bits_metadata /* i : number of metadata bits */ + Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ + const Word16 sce_id, /* i : SCE # identifier */ + const Word32 data_fx[], /* i : input signal for single channel Q(q_data_fx) */ + const Word16 q_data_fx, /* i : Q-factor of input signal for single channel */ + const Word16 input_frame, /* i : input frame length per channel */ + const Word16 nb_bits_metadata /* i : number of metadata bits */ ); ivas_error ivas_cpe_enc_fx( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ - const Word16 cpe_id, /* i : CPE # identifier */ - Word32 data_fx_ch0[], /* i : input signal for channel 0 Q(q_data_fx) */ - Word32 data_fx_ch1[], /* i : input signal for channel 1 Q(q_data_fx) */ - Word16 q_data_fx, /* i : Q-factor of input signal for both channels */ - const Word16 input_frame, /* i : input frame length per channel */ - const Word16 nb_bits_metadata, /* i : number of metadata bits */ - Word16 Q_new_out[] ); + Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ + const Word16 cpe_id, /* i : CPE # identifier */ + Word32 data_fx_ch0[], /* i : input signal for channel 0 Q(q_data_fx) */ + Word32 data_fx_ch1[], /* i : input signal for channel 1 Q(q_data_fx) */ + Word16 q_data_fx, /* i : Q-factor of input signal for both channels */ + const Word16 input_frame, /* i : input frame length per channel */ + const Word16 nb_bits_metadata, /* i : number of metadata bits */ + Word16 Q_new_out[] +); ivas_error ivas_mct_enc_fx( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ - Word32 *data_fx[MCT_MAX_CHANNELS], /* i : input signal buffers Q(q_data_fx) */ - Word16 q_data_fx, /* i : Q-factor of input signal */ - const Word16 input_frame, /* i : input frame length per channel */ - const Word16 nb_bits_metadata /* i : number of metadata bits */ + Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ + Word32 *data_fx[MCT_MAX_CHANNELS], /* i : input signal buffers Q(q_data_fx) */ + Word16 q_data_fx, /* i : Q-factor of input signal */ + const Word16 input_frame, /* i : input frame length per channel */ + const Word16 nb_bits_metadata /* i : number of metadata bits */ ); ivas_error ivas_compute_core_buffers_fx( - Encoder_State *st, /* i/o: encoder state structure */ - Word16 **inp16k_out_fx, /* o : ptr. to inp. signal in the current frame */ - Word16 *old_inp_16k_fx, /* i/o: buffer of old input signal @ 16kHz */ - Word16 new_inp_resamp16k_out_fx[], /* o : new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE */ - const Word16 input_frame, /* i : frame length */ - const Word16 last_element_mode, /* i : last element mode */ - const Word32 sr_core, /* i : core-coder sampling rate */ - Word32 *ener_fx, /* o : residual energy from Levinson-Durbin Q_r */ - Word16 A_fx[NB_SUBFR16k * ( M + 1 )], /* i/o: A(z) unquantized for the 4 subframes */ - Word16 Aw_fx[NB_SUBFR16k * ( M + 1 )], /* i/o: weighted A(z) unquantized for subframes */ - Word32 epsP[M + 1], /* i/o: LP prediction errors */ - Word16 lsp_new_fx[M], /* i/o: LSPs at the end of the frame */ - Word16 lsp_mid_fx[M], /* i/o: LSPs in the middle of the frame */ + Encoder_State *st, /* i/o: encoder state structure */ + Word16 **inp16k_out_fx, /* o : ptr. to inp. signal in the current frame */ + Word16 *old_inp_16k_fx, /* i/o: buffer of old input signal @ 16kHz */ + Word16 new_inp_resamp16k_out_fx[], /* o : new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE */ + const Word16 input_frame, /* i : frame length */ + const Word16 last_element_mode, /* i : last element mode */ + const Word32 sr_core, /* i : core-coder sampling rate */ + Word32 *ener_fx, /* o : residual energy from Levinson-Durbin Q_r */ + Word16 A_fx[NB_SUBFR16k * ( M + 1 )], /* i/o: A(z) unquantized for the 4 subframes */ + Word16 Aw_fx[NB_SUBFR16k * ( M + 1 )], /* i/o: weighted A(z) unquantized for subframes */ + Word32 epsP[M + 1], /* i/o: LP prediction errors */ + Word16 lsp_new_fx[M], /* i/o: LSPs at the end of the frame */ + Word16 lsp_mid_fx[M], /* i/o: LSPs in the middle of the frame */ Word16 Q_old_inp_16k, Word16 Q_r[2], - Word16 *Q_new ); + Word16 *Q_new +); ivas_error ivas_enc_fx( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ - const Word16 *data, /* i : input signal Q0 */ - const Word16 n_samples /* i : number of input samples */ + Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ + const Word16 *data, /* i : input signal Q0 */ + const Word16 n_samples /* i : number of input samples */ ); void reset_metadata_spatial_fx( - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - BSTR_ENC_HANDLE hMetaData, /* i/o: Metadata bitstream handle */ - const Word32 element_brate, /* i : element bitrate */ - Word32 *total_brate, /* o : total bitrate */ - const Word32 core_brate, /* i : core bitrate */ - const Word16 nb_bits_metadata /* i : number of meatdata bits */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + BSTR_ENC_HANDLE hMetaData, /* i/o: Metadata bitstream handle */ + const Word32 element_brate, /* i : element bitrate */ + Word32 *total_brate, /* o : total bitrate */ + const Word32 core_brate, /* i : core bitrate */ + const Word16 nb_bits_metadata /* i : number of meatdata bits */ ); void Euler2Quat_fx( - const Word32 yaw, /* i : yaw (x) Q22 */ - const Word32 pitch, /* i : pitch (y) Q22 */ - const Word32 roll, /* i : roll (z) Q22 */ - IVAS_QUATERNION *quat /* o : quaternion describing the rotation */ + const Word32 yaw, /* i : yaw (x) Q22 */ + const Word32 pitch, /* i : pitch (y) Q22 */ + const Word32 roll, /* i : roll (z) Q22 */ + IVAS_QUATERNION *quat /* o : quaternion describing the rotation */ ); -float deg2rad( - float degrees ); Word32 deg2rad_fx( - Word32 degrees ); + Word32 degrees +); void Quat2EulerDegree_fx( - const IVAS_QUATERNION quat, /* i : quaternion describing the rotation */ - Word32 *yaw_fx, /* o : yaw */ - Word32 *pitch_fx, /* o : pitch */ - Word32 *roll_fx /* o : roll */ + const IVAS_QUATERNION quat, /* i : quaternion describing the rotation */ + Word32 *yaw_fx, /* o : yaw */ + Word32 *pitch_fx, /* o : pitch */ + Word32 *roll_fx /* o : roll */ ); void Copy_Quat_fx( - const IVAS_QUATERNION *in_quat, /* i : quaternion describing the rotation */ - IVAS_QUATERNION *out_quat /* i : quaternion describing the rotation */ + const IVAS_QUATERNION *in_quat, /* i : quaternion describing the rotation */ + IVAS_QUATERNION *out_quat /* o : quaternion describing the rotation */ ); void modify_Quat_q_fx( - const IVAS_QUATERNION *in_quat, /* i : quaternion describing the rotation */ - IVAS_QUATERNION *out_quat, /* i : quaternion describing the rotation */ - Word16 q_new /* i : quaternion describing the rotation */ + const IVAS_QUATERNION *in_quat, /* i : quaternion describing the rotation */ + IVAS_QUATERNION *out_quat, /* i : quaternion describing the rotation */ + Word16 q_new /* o : quaternion describing the rotation */ ); void modify_Rmat_q_fx( - Word32 Rmat_in[3][3], /* i : real-space rotation matrix for this rotation */ - Word32 Rmat_out[3][3], /* o : real-space rotation matrix for this rotation*/ - Word16 q_cur, /* i : current q factor for rotation matrix */ - Word16 q_new /* i : target q factor for rotation matrix */ + Word32 Rmat_in[3][3], /* i : real-space rotation matrix for this rotation */ + Word32 Rmat_out[3][3], /* o : real-space rotation matrix for this rotation */ + Word16 q_cur, /* i : current q factor for rotation matrix */ + Word16 q_new /* i : target q factor for rotation matrix */ ); -/*=============================================================================================*/ -/* clang-format off */ + /*----------------------------------------------------------------------------------* * General IVAS prototypes *----------------------------------------------------------------------------------*/ -/*! r: number of channels to be analysed */ - void copy_encoder_config_ivas_fx( Encoder_Struct *st_ivas, /* i : IVAS encoder structure */ Encoder_State *st, /* o : encoder state structure */ - const Word16 flag_all /* i : flag 1==update all, 0=partial update Q0*/ + const Word16 flag_all /* i : flag 1==update all, 0=partial update Q0*/ ); ivas_error create_mct_enc_fx( @@ -6047,96 +6079,97 @@ void ivas_mct_enc_close_fx( ); ivas_error pre_proc_front_ivas_fx( - SCE_ENC_HANDLE hSCE, /* i/o: SCE encoder structure */ - CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ - const Word32 element_brate, /* i : SCE/CPE element bitrate Q0*/ - const Word16 nb_bits_metadata, /* i : number of metadata bits Q0*/ - const Word16 input_frame, /* i : frame length Q0*/ - const Word16 n, /* i : channel number Q0*/ - Word16 old_inp_12k8_fx[], /* o : buffer of old input signal Q_new-1*/ - Word16 old_inp_16k_fx[], /* o : buffer of old input signal @16kHz Q_new-1*/ - Word32 *ener_fx, /* o : residual energy from Levinson-Durbin epsP_fx_q*/ - Word16 *relE_fx, /* o : frame relative energy Q8*/ - Word16 A_fx[NB_SUBFR16k * ( M + 1 )], /* o : A(z) unquantized for the 4 subframes Q12*/ - Word16 Aw_fx[NB_SUBFR16k * ( M + 1 )], /* o : weighted A(z) unquantized for subframes Q12*/ - Word32 epsP_fx[M + 1], /* o : LP prediction errors epsP_fx_q*/ + SCE_ENC_HANDLE hSCE, /* i/o: SCE encoder structure */ + CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ + const Word32 element_brate, /* i : SCE/CPE element bitrate Q0*/ + const Word16 nb_bits_metadata, /* i : number of metadata bits Q0*/ + const Word16 input_frame, /* i : frame length Q0*/ + const Word16 n, /* i : channel number Q0*/ + Word16 old_inp_12k8_fx[], /* o : buffer of old input signal Q_new-1*/ + Word16 old_inp_16k_fx[], /* o : buffer of old input signal @16kHz Q_new-1*/ + Word32 *ener_fx, /* o : residual energy from Levinson-Durbin epsP_fx_q*/ + Word16 *relE_fx, /* o : frame relative energy Q8*/ + Word16 A_fx[NB_SUBFR16k * ( M + 1 )], /* o : A(z) unquantized for the 4 subframes Q12*/ + Word16 Aw_fx[NB_SUBFR16k * ( M + 1 )], /* o : weighted A(z) unquantized for subframes Q12*/ + Word32 epsP_fx[M + 1], /* o : LP prediction errors epsP_fx_q*/ Word16 *epsP_fx_q, - Word16 lsp_new_fx[M], /* o : LSPs at the end of the frame Q15*/ - Word16 lsp_mid_fx[M], /* o : LSPs in the middle of the frame Q15*/ - Word16 *vad_hover_flag, /* o : VAD hangover flag Q0*/ - Word16 *attack_flag, /* o : flag signaling attack Q0*/ - Word32 realBuffer_fx[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: real buffer Q(q_re_im_buf)*/ - Word32 imagBuffer_fx[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: imag buffer Q(q_re_im_buf)*/ - Word16 *q_re_im_buf, /* i/o: Q-factor of real and imag buffer */ - Word16 old_wsp_fx[], /* o : weighted input signal buffer q_old_wsp*/ + Word16 lsp_new_fx[M], /* o : LSPs at the end of the frame Q15*/ + Word16 lsp_mid_fx[M], /* o : LSPs in the middle of the frame Q15*/ + Word16 *vad_hover_flag, /* o : VAD hangover flag Q0*/ + Word16 *attack_flag, /* o : flag signaling attack Q0*/ + Word32 realBuffer_fx[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: real buffer Q(q_re_im_buf)*/ + Word32 imagBuffer_fx[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: imag buffer Q(q_re_im_buf)*/ + Word16 *q_re_im_buf, /* i/o: Q-factor of real and imag buffer */ + Word16 old_wsp_fx[], /* o : weighted input signal buffer q_old_wsp*/ Word16 *q_old_wsp, - Word16 pitch_fr_fx[NB_SUBFR], /* o : fractional pitch values Q6*/ - Word16 voicing_fr_fx[NB_SUBFR], /* o : fractional pitch gains Q15*/ - Word16 *loc_harm, /* o : harmonicity flag Q0*/ - Word16 *cor_map_sum_fx, /* o : speech/music clasif. parameter Q8*/ - Word16 *vad_flag_dtx, /* o : HE-SAD flag with additional DTX HO Q0*/ - Word32 enerBuffer_fx[CLDFB_NO_CHANNELS_MAX], /* o : energy buffer enerBuffer_fx_exp*/ - Word16 *enerBuffer_fx_exp, /* o : energy buffer */ - Word16 fft_buff_fx[2 * L_FFT], /* o : FFT buffer fft_buff_fx_q*/ - Word16 *fft_buff_fx_q, /* o : FFT buffer */ - const Word16 tdm_A_PCh_fx[M + 1], /* i : unq. LP coeff. of primary channel Q12*/ - const Word16 tdm_lsp_new_PCh_fx[M], /* i : unq. LSPs of primary channel Q15*/ - const Word32 currFlatness_fx, /* i : flatness parameter Q21*/ - const Word16 tdm_ratio_idx, /* i : Current Ratio_L index Q0*/ - Word32 fr_bands_LR_fx[][2 * NB_BANDS], /* i : energy in frequency bands (fr_bands_LR_fx_q) fr_bands_LR_fx_q*/ + Word16 pitch_fr_fx[NB_SUBFR], /* o : fractional pitch values Q6*/ + Word16 voicing_fr_fx[NB_SUBFR], /* o : fractional pitch gains Q15*/ + Word16 *loc_harm, /* o : harmonicity flag Q0*/ + Word16 *cor_map_sum_fx, /* o : speech/music clasif. parameter Q8*/ + Word16 *vad_flag_dtx, /* o : HE-SAD flag with additional DTX HO Q0*/ + Word32 enerBuffer_fx[CLDFB_NO_CHANNELS_MAX], /* o : energy buffer enerBuffer_fx_exp*/ + Word16 *enerBuffer_fx_exp, /* o : energy buffer */ + Word16 fft_buff_fx[2 * L_FFT], /* o : FFT buffer fft_buff_fx_q*/ + Word16 *fft_buff_fx_q, /* o : FFT buffer */ + const Word16 tdm_A_PCh_fx[M + 1], /* i : unq. LP coeff. of primary channel Q12*/ + const Word16 tdm_lsp_new_PCh_fx[M], /* i : unq. LSPs of primary channel Q15*/ + const Word32 currFlatness_fx, /* i : flatness parameter Q21*/ + const Word16 tdm_ratio_idx, /* i : Current Ratio_L index Q0*/ + Word32 fr_bands_LR_fx[][2 * NB_BANDS], /* i : energy in frequency bands (fr_bands_LR_fx_q) fr_bands_LR_fx_q*/ Word16 fr_bands_LR_fx_q[CPE_CHANNELS], - const Word16 Etot_LR_fx[], /* i : total energy Left & Right channel Q8*/ - Word32 lf_E_LR_fx[][2 * VOIC_BINS], /* i : per bin spectrum energy in lf, LR channels (lf_E_LR_fx_q)*/ + const Word16 Etot_LR_fx[], /* i : total energy Left & Right channel Q8*/ + Word32 lf_E_LR_fx[][2 * VOIC_BINS], /* i : per bin spectrum energy in lf, LR channels (lf_E_LR_fx_q)*/ Word16 lf_E_LR_fx_q, - const Word16 localVAD_HE_SAD_LR[], /* i : HE-SAD flag without hangover, LR channels Q0*/ - Word32 band_energies_LR_fx[2 * NB_BANDS], /* o : energy in critical bands without minimum noise floor E_MIN (band_energies_LR_fx_q)*/ + const Word16 localVAD_HE_SAD_LR[], /* i : HE-SAD flag without hangover, LR channels Q0*/ + Word32 band_energies_LR_fx[2 * NB_BANDS], /* o : energy in critical bands without minimum noise floor E_MIN (band_energies_LR_fx_q)*/ Word16 band_energies_LR_fx_q, - const Word16 flag_16k_smc, /* i : flag to indicate if the OL SMC is run at 16 kHz Q0*/ - const Word16 front_vad_flag, /* i : front-VAD flag to overwrite VAD decision Q0*/ - const Word16 force_front_vad, /* i : flag to force VAD decision Q0*/ - const Word16 front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision Q0*/ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) Q0*/ - const Word32 last_ivas_total_brate, /* i : last IVAS total bitrate Q0*/ - const Word32 ivas_total_brate, /* i : IVAS total bitrate - for setting the DTX Q0*/ + const Word16 flag_16k_smc, /* i : flag to indicate if the OL SMC is run at 16 kHz Q0*/ + const Word16 front_vad_flag, /* i : front-VAD flag to overwrite VAD decision Q0*/ + const Word16 force_front_vad, /* i : flag to force VAD decision Q0*/ + const Word16 front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision Q0*/ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) Q0*/ + const Word32 last_ivas_total_brate, /* i : last IVAS total bitrate Q0*/ + const Word32 ivas_total_brate, /* i : IVAS total bitrate - for setting the DTX Q0*/ Word16 *Q_new #ifdef DEBUG_MODE_INFO , const Word16 ch_idx #endif ); + ivas_error pre_proc_ivas_fx( - Encoder_State *st, /* i/o: encoder state structure */ - const Word16 last_element_mode, /* i : last element mode Q0*/ - const Word32 element_brate, /* i : element bitrate Q0*/ - const Word32 last_element_brate, /* i : last element bitrate Q0*/ - const Word16 input_frame, /* i : frame length Q0*/ - Word16 old_inp_12k8_fx[], /* i/o: buffer of old input signal Q_new-1 */ - Word16 old_inp_16k_fx[], /* i/o: buffer of old input signal @ 16kHz Q_new-1 */ - Word16 **inp_fx, /* o : ptr. to inp. signal in the current frame Q_new*/ - Word32 *ener_fx, /* o : residual energy from Levinson-Durbin epsP_fx_q*/ - Word16 A_fx[NB_SUBFR16k * ( M + 1 )], /* i/o: A(z) unquantized for the 4 subframes Q12*/ - Word16 Aw_fx[NB_SUBFR16k * ( M + 1 )], /* i/o: weighted A(z) unquantized for subframes Q14*/ - Word32 epsP_fx[M + 1], /* i : LP prediction errors epsP_fx_q*/ - Word16 *epsP_fx_q, /* i : LP prediction errors */ - Word16 lsp_new_fx[M], /* i/o: LSPs at the end of the frame Q15*/ - Word16 lsp_mid_fx[M], /* i/o: LSPs in the middle of the frame Q15*/ - Word16 *new_inp_resamp16k_fx, /* o : new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE Q_new-1*/ - Word16 *Voicing_flag, /* o : voicing flag for HQ FEC Q0*/ - Word16 old_wsp_fx[], /* i : weighted input signal buffer e_old_wsp*/ + Encoder_State *st, /* i/o: encoder state structure */ + const Word16 last_element_mode, /* i : last element mode Q0*/ + const Word32 element_brate, /* i : element bitrate Q0*/ + const Word32 last_element_brate, /* i : last element bitrate Q0*/ + const Word16 input_frame, /* i : frame length Q0*/ + Word16 old_inp_12k8_fx[], /* i/o: buffer of old input signal Q_new-1 */ + Word16 old_inp_16k_fx[], /* i/o: buffer of old input signal @ 16kHz Q_new-1 */ + Word16 **inp_fx, /* o : ptr. to inp. signal in the current frame Q_new*/ + Word32 *ener_fx, /* o : residual energy from Levinson-Durbin epsP_fx_q*/ + Word16 A_fx[NB_SUBFR16k * ( M + 1 )], /* i/o: A(z) unquantized for the 4 subframes Q12*/ + Word16 Aw_fx[NB_SUBFR16k * ( M + 1 )], /* i/o: weighted A(z) unquantized for subframes Q14*/ + Word32 epsP_fx[M + 1], /* i : LP prediction errors epsP_fx_q*/ + Word16 *epsP_fx_q, /* i : LP prediction errors */ + Word16 lsp_new_fx[M], /* i/o: LSPs at the end of the frame Q15*/ + Word16 lsp_mid_fx[M], /* i/o: LSPs in the middle of the frame Q15*/ + Word16 *new_inp_resamp16k_fx, /* o : new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE Q_new-1*/ + Word16 *Voicing_flag, /* o : voicing flag for HQ FEC Q0*/ + Word16 old_wsp_fx[], /* i : weighted input signal buffer e_old_wsp*/ Word16 e_old_wsp, - const Word16 loc_harm, /* i : harmonicity flag Q0*/ - const Word16 vad_flag_dtx, /* i : HE-SAD flag with additional DTX HO Q0*/ - const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) Q0*/ - const Word16 vad_hover_flag, /* i : VAD hangover flag Q0*/ - const Word16 flag_16k_smc, /* i : flag to indicate if the OL SMC is run at 16 kHz Q0*/ - Word32 enerBuffer_fx[CLDFB_NO_CHANNELS_MAX], /* e_enerBuffer */ + const Word16 loc_harm, /* i : harmonicity flag Q0*/ + const Word16 vad_flag_dtx, /* i : HE-SAD flag with additional DTX HO Q0*/ + const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) Q0*/ + const Word16 vad_hover_flag, /* i : VAD hangover flag Q0*/ + const Word16 flag_16k_smc, /* i : flag to indicate if the OL SMC is run at 16 kHz Q0*/ + Word32 enerBuffer_fx[CLDFB_NO_CHANNELS_MAX], /* e_enerBuffer */ Word16 e_enerBuffer, - Word16 fft_buff_fx[2 * L_FFT], /* Qx */ - Word16 cor_map_sum_fx, /* Q8 */ + Word16 fft_buff_fx[2 * L_FFT], /* Qx */ + Word16 cor_map_sum_fx, /* Q8 */ Word16 *Q_new ); -/*! r: number of clipped samples */ + void ivas_initialize_handles_enc_fx( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); @@ -6162,13 +6195,10 @@ ivas_error ivas_init_decoder_front( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); - void ivas_mct_dec_close( MCT_DEC_HANDLE *hMCT /* i/o: MCT decoder structure */ ); -/*! r: number of channels to be synthesised */ - void copy_decoder_config( Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ Decoder_State *st /* o : decoder state structure */ @@ -6179,36 +6209,36 @@ void ivas_initialize_handles_dec( ); ivas_error ivas_core_enc_fx( - SCE_ENC_HANDLE hSCE, /* i/o: SCE encoder structure */ - CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ - MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ - const Word16 n_CoreChannels, /* i : number of core channels to be coded Q0*/ - Word16 old_inp_12k8_fx[][L_INP_12k8], /* i : buffer of old input signal Q_new-1*/ - Word16 old_inp_16k_fx[][L_INP], /* i : buffer of old input signal Q_new-1*/ - Word16 Q_new[], /* i : Q factor of speech buffers */ - Word32 ener_fx[], /* i : residual energy from Levinson-Durbin epsP_fx_q*/ - Word16 A_fx[][NB_SUBFR16k * ( M + 1 )], /* i : A(z) unquantized for the 4 subframes Q12*/ - Word16 Aw_fx[][NB_SUBFR16k * ( M + 1 )], /* i : weighted A(z) unquantized for subframes Q12*/ - Word32 epsP_fx[][M + 1], /* i : LP prediction errors epsP_fx_q*/ - Word16 epsP_fx_q[], /* i : LP prediction errors */ - Word16 lsp_new_fx[][M], /* i : LSPs at the end of the frame Q15*/ - Word16 lsp_mid_fx[][M], /* i : LSPs in the middle of the frame Q15*/ - const Word16 vad_hover_flag[], /* i : VAD hanglover flag Q0*/ - Word16 attack_flag[], /* i : attack flag (GSC or TC) Q0*/ - Word32 realBuffer_fx[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: real buffer q_re_im_buf*/ - Word32 imagBuffer_fx[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: imag buffer q_re_im_buf*/ - Word16 *q_re_im_buf, /* i : Q factor of re/in CLDFB buffers */ - Word16 old_wsp_fx[][L_WSP], /* i : weighted input signal buffer e_old_wsp*/ - Word16 e_old_wsp[], /* i : Q factor of old_wsp buffer */ - const Word16 loc_harm[], /* i : harmonicity flag Q0*/ - const Word16 cor_map_sum_fx[], /* i : speech/music clasif. parameter Q8*/ - const Word16 vad_flag_dtx[], /* i : HE-SAD flag with additional DTX HO Q0*/ - Word32 enerBuffer_fx[][CLDFB_NO_CHANNELS_MAX], /* o : energy buffer enerBuffer_fx_exp*/ - Word16 enerBuffer_fx_exp[], /* o : energy buffer */ - Word16 fft_buff_fx[][2 * L_FFT], /* i : FFT buffer Qx*/ - const Word16 tdm_SM_or_LRTD_Pri, /* i : channel combination scheme flag Q0*/ - const Word16 ivas_format, /* i : IVAS format Q0*/ - const Word16 flag_16k_smc /* i : flag to indicate if the OL SMC is run at 16 kHz Q0*/ + SCE_ENC_HANDLE hSCE, /* i/o: SCE encoder structure */ + CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ + MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ + const Word16 n_CoreChannels, /* i : number of core channels to be coded Q0*/ + Word16 old_inp_12k8_fx[][L_INP_12k8], /* i : buffer of old input signal Q_new-1*/ + Word16 old_inp_16k_fx[][L_INP], /* i : buffer of old input signal Q_new-1*/ + Word16 Q_new[], /* i : Q factor of speech buffers */ + Word32 ener_fx[], /* i : residual energy from Levinson-Durbin epsP_fx_q*/ + Word16 A_fx[][NB_SUBFR16k * ( M + 1 )], /* i : A(z) unquantized for the 4 subframes Q12*/ + Word16 Aw_fx[][NB_SUBFR16k * ( M + 1 )], /* i : weighted A(z) unquantized for subframes Q12*/ + Word32 epsP_fx[][M + 1], /* i : LP prediction errors epsP_fx_q*/ + Word16 epsP_fx_q[], /* i : LP prediction errors */ + Word16 lsp_new_fx[][M], /* i : LSPs at the end of the frame Q15*/ + Word16 lsp_mid_fx[][M], /* i : LSPs in the middle of the frame Q15*/ + const Word16 vad_hover_flag[], /* i : VAD hanglover flag Q0*/ + Word16 attack_flag[], /* i : attack flag (GSC or TC) Q0*/ + Word32 realBuffer_fx[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: real buffer q_re_im_buf*/ + Word32 imagBuffer_fx[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: imag buffer q_re_im_buf*/ + Word16 *q_re_im_buf, /* i : Q factor of re/in CLDFB buffers */ + Word16 old_wsp_fx[][L_WSP], /* i : weighted input signal buffer e_old_wsp*/ + Word16 e_old_wsp[], /* i : Q factor of old_wsp buffer */ + const Word16 loc_harm[], /* i : harmonicity flag Q0*/ + const Word16 cor_map_sum_fx[], /* i : speech/music clasif. parameter Q8*/ + const Word16 vad_flag_dtx[], /* i : HE-SAD flag with additional DTX HO Q0*/ + Word32 enerBuffer_fx[][CLDFB_NO_CHANNELS_MAX], /* o : energy buffer enerBuffer_fx_exp*/ + Word16 enerBuffer_fx_exp[], /* o : energy buffer */ + Word16 fft_buff_fx[][2 * L_FFT], /* i : FFT buffer Qx*/ + const Word16 tdm_SM_or_LRTD_Pri, /* i : channel combination scheme flag Q0*/ + const Word16 ivas_format, /* i : IVAS format Q0*/ + const Word16 flag_16k_smc /* i : flag to indicate if the OL SMC is run @16 kHz Q0*/ ); void ivas_renderer_select( @@ -6229,8 +6259,8 @@ Word16 is_IVAS_bitrate_fx( const Word32 ivas_total_brate /* i : IVAS total bitrate */ ); -int16_t is_DTXrate( - const int32_t ivas_total_brate /* i : IVAS total bitrate */ +Word16 is_DTXrate( + const Word32 ivas_total_brate /* i : IVAS total bitrate */ ); @@ -6239,27 +6269,27 @@ int16_t is_DTXrate( *----------------------------------------------------------------------------------*/ ivas_error ivas_jbm_dec_set_discard_samples_fx( - Decoder_Struct *st_ivas /* i/o: main IVAS decoder structre */ + Decoder_Struct *st_ivas /* i/o: main IVAS decoder structre */ ); TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode_fx( - Decoder_Struct *st_ivas /* i : IVAS decoder handle */ + Decoder_Struct *st_ivas /* i : IVAS decoder handle */ ); void ivas_jbm_dec_tc_buffer_close_fx( - DECODER_TC_BUFFER_HANDLE *phTcBuffer /* i/o: TC buffer handle */ + DECODER_TC_BUFFER_HANDLE *phTcBuffer /* i/o: TC buffer handle */ ); void ivas_jbm_dec_td_renderers_adapt_subframes( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); ivas_error ivas_jbm_dec_metadata_open( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); void ivas_jbm_masa_sf_to_sf_map( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); @@ -6280,6 +6310,7 @@ void ivas_ism_reset_metadata( void ivas_ism_reset_metadata_enc( ISM_METADATA_HANDLE hIsmMeta /* i/o: ISM metadata handle */ ); + void ivas_ism_reset_metadata_API( ISM_METADATA_HANDLE hIsmMeta /* i/o: ISM metadata handles */ ); @@ -6334,23 +6365,22 @@ ivas_error ivas_ism_dtx_open( void ivas_ism_metadata_sid_enc_fx( ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ - const Word16 flag_noisy_speech, /* i : noisy speech flag */ - const Word16 nchan_ism, /* i : number of objects */ - const Word16 nchan_transport, /* i : number of transport channels */ + const Word16 flag_noisy_speech, /* i : noisy speech 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 */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ - const Word16 sid_flag, /* i : indication of SID frame */ - const Word16 md_diff_flag[], /* i : metadata differental flag */ + const Word16 sid_flag, /* i : indication of SID frame */ + const Word16 md_diff_flag[], /* i : metadata differental flag */ BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ - Word16 nb_bits_metadata[] /* o : number of metadata bits */ + Word16 nb_bits_metadata[] /* o : number of metadata bits */ ); - - void ivas_param_ism_compute_noisy_speech_flag_fx( - Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); + /*----------------------------------------------------------------------------------* * DFT Stereo prototypes *----------------------------------------------------------------------------------*/ @@ -6371,14 +6401,14 @@ UWord16 rc_uni_dec_read_bit( /*! r: Read bit */ UWord16 rc_uni_dec_read_bit_prob_fast( RangeUniDecState *rc_st_dec, /* i/o: RC state handle */ - const Word16 freq0, /* i : Frequency for symbol 0 */ - const UWord16 tot_shift /* i : Total frequency as a power of 2 */ + const Word16 freq0, /* i : Frequency for symbol 0 */ + const UWord16 tot_shift /* i : Total frequency as a power of 2 */ ); /*! r: Read bits */ UWord16 rc_uni_dec_read_bits( RangeUniDecState *rc_st_dec, /* i/o: RC state handle */ - const Word16 bits /* i : Number of bits */ + const Word16 bits /* i : Number of bits */ ); @@ -6406,7 +6436,7 @@ void tdm_bit_alloc( ); /*! r: value of the indice */ -uint16_t get_indice_st( +UWord16 get_indice_st( Decoder_State *st, /* i/o: decoder state structure */ const Word32 element_brate, /* i : element bitrate */ const Word16 pos, /* i : absolute position in the bitstream */ @@ -6420,17 +6450,17 @@ uint16_t get_indice_st( void stereo_mdct_core_enc_fx( CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ - Word16 new_samples[CPE_CHANNELS][L_INP], /* i : new samples Q0*/ - Word16 old_wsp[CPE_CHANNELS][L_WSP], /* i : 12.8kHz weighted speech (for LTP Qx*/ - Word16 pitch_buf_fx[CPE_CHANNELS][NB_SUBFR16k] /* o : floating pitch for each subframe Q6*/ + Word16 new_samples[CPE_CHANNELS][L_INP], /* i : new samples Q0*/ + Word16 old_wsp[CPE_CHANNELS][L_WSP], /* i : 12.8kHz weighted speech (for LTP Qx*/ + Word16 pitch_buf_fx[CPE_CHANNELS][NB_SUBFR16k] /* o : floating pitch for each subframe Q6*/ ); Word16 write_stereo_to_bitstream_fx ( STEREO_MDCT_ENC_DATA_HANDLE hStereoMdct, /* i/o: Stereo MDCT encoder structure */ Encoder_State **sts, /* i/o: Encoder state structure */ - Word16 ms_mask[NB_DIV][MAX_SFB], /* i : bandwise MS mask Q0*/ - const Word16 mct_on, /* i : flag mct block (1) or stereo (0) Q0*/ + Word16 ms_mask[NB_DIV][MAX_SFB], /* i : bandwise MS mask Q0*/ + const Word16 mct_on, /* i : flag mct block (1) or stereo (0) Q0*/ BSTR_ENC_HANDLE hBstr /* i/o: bitstream handle */ ); @@ -6450,9 +6480,9 @@ void stereo_cng_dec_update( *----------------------------------------------------------------------------------*/ void mvc2c( - const uint8_t x[], /* i : input vector */ - uint8_t y[], /* o : output vector */ - const int16_t n /* i : vector size */ + const UWord8 x[], /* i : input vector */ + UWord8 y[], /* o : output vector */ + const Word16 n /* i : vector size */ ); void stereo_switching_dec( @@ -6461,28 +6491,25 @@ void stereo_switching_dec( ); -/*! r: number of bits written */ - - - /*----------------------------------------------------------------------------------* * MCT prototypes *----------------------------------------------------------------------------------*/ + void ivas_mdct_core_whitening_enc_fx( CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ - Word16 new_samples_fx[CPE_CHANNELS][L_INP], /* i : new samples */ - Word16 old_wsp_fx[CPE_CHANNELS][L_WSP], /* i : 12.8kHz weighted speech (for LTP */ - Word16 pitch_buf[CPE_CHANNELS][NB_SUBFR16k], /* o : floating pitch for each subframe */ - Word32 *mdst_spectrum_long[CPE_CHANNELS], /* o : buffer for MDST spectrum */ - Word16 tnsBits[CPE_CHANNELS][NB_DIV], /* o : buffer TNS bits */ - Word32 *orig_spectrum_long[CPE_CHANNELS], /* o : origingal spectrum w/o whitening */ - Word16 tnsSize[CPE_CHANNELS][NB_DIV], /* o : size of TNS */ - Word16 p_param[CPE_CHANNELS][NB_DIV], /* o : pointer to parameter array */ + Word16 new_samples_fx[CPE_CHANNELS][L_INP], /* i : new samples */ + Word16 old_wsp_fx[CPE_CHANNELS][L_WSP], /* i : 12.8kHz weighted speech (for LTP */ + Word16 pitch_buf[CPE_CHANNELS][NB_SUBFR16k], /* o : floating pitch for each subframe */ + Word32 *mdst_spectrum_long[CPE_CHANNELS], /* o : buffer for MDST spectrum */ + Word16 tnsBits[CPE_CHANNELS][NB_DIV], /* o : buffer TNS bits */ + Word32 *orig_spectrum_long[CPE_CHANNELS], /* o : origingal spectrum w/o whitening */ + Word16 tnsSize[CPE_CHANNELS][NB_DIV], /* o : size of TNS */ + Word16 p_param[CPE_CHANNELS][NB_DIV], /* o : pointer to parameter array */ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 mct_on, /* i : flag mct block (1) or stereo (0) */ + const Word16 mct_on, /* i : flag mct block (1) or stereo (0) */ const Word16 nChannels, /* i : total number of coded channels */ -Word16 mdst_spectrum_e[CPE_CHANNELS][NB_DIV], -Word16 orig_spectrum_e[CPE_CHANNELS][NB_DIV] + Word16 mdst_spectrum_e[CPE_CHANNELS][NB_DIV], + Word16 orig_spectrum_e[CPE_CHANNELS][NB_DIV] ); void splitAvailableBitsMCT_fx( @@ -6498,24 +6525,24 @@ void enc_prm_igf_mdct( BSTR_ENC_HANDLE hBstr /* i/o: Bitstream handle */ ); + /*----------------------------------------------------------------------------------* * Q Metadata prototypes for DirAC and MASA *----------------------------------------------------------------------------------*/ -/*! r: number of bits written */ /*! r: number of bits read */ Word16 ivas_qmetadata_dec_decode( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ - UWord16 *bitstream, /* i : bitstream */ - Word16 *index, /* i/o: bitstream position */ - const Word16 hodirac_flag /* i : flag to indicate HO-DirAC mode */ + UWord16 *bitstream, /* i : bitstream */ + Word16 *index, /* i/o: bitstream position */ + const Word16 hodirac_flag /* i : flag to indicate HO-DirAC mode */ ); /*! r: number of bits read */ Word16 ivas_qmetadata_dec_decode_hr_384_512( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: hQMetaData handle */ - UWord16 *bitstream, /* i : bitstream */ - Word16 *index, /* i/o: bitstream position */ + UWord16 *bitstream, /* i : bitstream */ + Word16 *index, /* i/o: bitstream position */ const SPHERICAL_GRID_DATA *sph_grid16, /* i : spherical grid for deindexing */ const Word16 bits_sph_idx, const Word16 bits_sp_coh, @@ -6525,14 +6552,13 @@ Word16 ivas_qmetadata_dec_decode_hr_384_512( /*! r: number of bits read */ Word16 ivas_qmetadata_dec_sid_decode( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ - UWord16 *bitstream, /* i : bitstream */ - Word16 *index, /* i/o: bitstream position */ - const Word16 nchan_transport, /* i : number of transport channels */ - Word16 *element_mode, /* o : element mode */ - const Word16 ivas_format /* i : IVAS format */ + UWord16 *bitstream, /* i : bitstream */ + Word16 *index, /* i/o: bitstream position */ + const Word16 nchan_transport, /* i : number of transport channels */ + Word16 *element_mode, /* o : element mode */ + const Word16 ivas_format /* i : IVAS format */ ); - UWord16 ivas_qmetadata_reorder_generic_fx( const Word16 signed_value ); @@ -6557,39 +6583,38 @@ Word16 ivas_get_sba_dirac_stereo_flag( * DirAC prototypes *----------------------------------------------------------------------------------*/ - ivas_error ivas_dirac_enc_reconfigure( Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ ); ivas_error ivas_mc_paramupmix_enc_open_fx( - Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ + Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ ); void ivas_mc_paramupmix_enc_close_fx( - MC_PARAMUPMIX_ENC_HANDLE *hMCParamUpmix, /* i/o: MC Param-Upmix encoder handle */ - const int32_t input_Fs /* i : input sampling rate */ + MC_PARAMUPMIX_ENC_HANDLE *hMCParamUpmix, /* i/o: MC Param-Upmix encoder handle */ + const Word32 input_Fs /* i : input sampling rate */ ); ivas_error ivas_mc_paramupmix_dec_open( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); void ivas_mc_paramupmix_dec_close( - MC_PARAMUPMIX_DEC_HANDLE *hMCParamUpmix_out /* i/o: Parametric MC decoder handle */ + MC_PARAMUPMIX_DEC_HANDLE *hMCParamUpmix_out /* i/o: Parametric MC decoder handle */ ); void ivas_mc_paramupmix_dec_read_BS( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - Decoder_State *st, /* i/o: decoder state structure */ - MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, /* i/o: decoder MC Param-Upmix handle */ - Word16 *nb_bits /* o : number of bits written */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_State *st, /* i/o: decoder state structure */ + MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, /* i/o: decoder MC Param-Upmix handle */ + Word16 *nb_bits /* o : number of bits written */ ); void ivas_mc_paramupmix_dec_digest_tc( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const UWord8 nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ - const Word16 nSamplesForRendering /* i : number of samples provided */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const UWord8 nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ + const Word16 nSamplesForRendering /* i : number of samples provided */ ); void ivas_param_mc_set_coded_bands_fx( @@ -6597,10 +6622,11 @@ void ivas_param_mc_set_coded_bands_fx( ); UWord16 ivas_param_mc_get_configuration_index_fx( - const MC_LS_SETUP mc_ls_setup, /* i : MC ls setup */ - const Word32 ivas_total_brate /* i : IVAS total bitrate */ + const MC_LS_SETUP mc_ls_setup, /* i : MC ls setup */ + const Word32 ivas_total_brate /* i : IVAS total bitrate */ ); + /*----------------------------------------------------------------------------------* * SPAR prototypes *----------------------------------------------------------------------------------*/ @@ -6611,10 +6637,10 @@ UWord16 ivas_param_mc_get_configuration_index_fx( ivas_error ivas_spar_md_dec_open( ivas_spar_md_dec_state_t **hMdDec_out, /* i/o: SPAR MD decoder handle */ const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ - const Word16 num_channels, /* i : number of internal channels */ - const Word16 sba_order, /* i : SBA order */ - const Word16 sid_format, /* i : SID format */ - const Word32 last_active_ivas_total_brate /* i : IVAS last active bitrate */ + const Word16 num_channels, /* i : number of internal channels */ + const Word16 sba_order, /* i : SBA order */ + const Word16 sid_format, /* i : SID format */ + const Word32 last_active_ivas_total_brate /* i : IVAS last active bitrate */ ); void ivas_spar_md_dec_close( @@ -6624,14 +6650,14 @@ void ivas_spar_md_dec_close( ivas_error ivas_spar_md_dec_init( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ - const Word16 num_channels, /* i : number of internal channels */ - const Word16 sba_order /* i : SBA order */ + const Word16 num_channels, /* i : number of internal channels */ + const Word16 sba_order /* i : SBA order */ ); /* Transient detector module */ ivas_error ivas_transient_det_open_fx( ivas_trans_det_state_t **hTranDet, /* i/o: Transient detector handle */ - const Word32 sampling_rate /* i : sampling rate */ + const Word32 sampling_rate /* i : sampling rate */ ); void ivas_transient_det_close_fx( @@ -6677,29 +6703,31 @@ void ivas_clear_band_coeff_idx( /*----------------------------------------------------------------------------------* * MASA prototypes *----------------------------------------------------------------------------------*/ + ivas_error ivas_masa_enc_open_fx( - Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ + Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ ); void ivas_masa_enc_close_fx( - MASA_ENCODER_HANDLE *hMasa /* i/o: MASA metadata structure */ + MASA_ENCODER_HANDLE *hMasa /* i/o: MASA metadata structure */ ); -int16_t ivas_qmetadata_encode_extended_gr_length_fx( +Word16 ivas_qmetadata_encode_extended_gr_length_fx( const UWord16 value, const UWord16 alphabet_size, - const Word16 gr_param); + const Word16 gr_param +); void ivas_qmetadata_encode_extended_gr_fx( - BSTR_ENC_HANDLE hMetaData, /* i/o: q_metadata handle */ - const UWord16 value, /* i : value to be encoded */ - const UWord16 alphabet_size, /* i : alphabet size */ - const Word16 gr_param); /* i : GR order */ - + BSTR_ENC_HANDLE hMetaData, /* i/o: q_metadata handle */ + const UWord16 value, /* i : value to be encoded */ + const UWord16 alphabet_size, /* i : alphabet size */ + const Word16 gr_param /* i : GR order */ +); void ivas_set_qmetadata_maxbit_req_fx( IVAS_QMETADATA_HANDLE hQMetaData, /* o : qmetadata structure where the requirement value is set */ - const IVAS_FORMAT ivas_format /* i : IVAS format */ + const IVAS_FORMAT ivas_format /* i : IVAS format */ ); @@ -6708,7 +6736,7 @@ void ivas_set_qmetadata_maxbit_req_fx( *-----------------------------------------------------------------------------------*/ void ivas_binaural_hrtf_close_fx( - HRTFS_FASTCONV_HANDLE *hHrtfFastConv /* i/o: decoder binaural hrtf handle */ + HRTFS_FASTCONV_HANDLE *hHrtfFastConv /* i/o: decoder binaural hrtf handle */ ); /*----------------------------------------------------------------------------------* @@ -6716,7 +6744,7 @@ void ivas_binaural_hrtf_close_fx( *----------------------------------------------------------------------------------*/ void ivas_ism_renderer_close( - ISM_RENDERER_HANDLE *hIsmRendererData /* i/o: ISM renderer handle */ + ISM_RENDERER_HANDLE *hIsmRendererData /* i/o: ISM renderer handle */ ); @@ -6736,26 +6764,24 @@ void panning_wrap_angles( * McMASA prototypes *----------------------------------------------------------------------------------*/ - ivas_error ivas_mcmasa_dec_reconfig( - Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ); void ivas_mcmasa_dmx_modify_fx( - const Word16 n_samples, /* i : input frame length in samples */ - Word32 dmx_fx[][L_FRAME48k + NS2SA(48000, IVAS_FB_ENC_DELAY_NS)], /* i/o: downmix signal to be transformed into another format Qx*/ - Word16 dmx_Q[], /* i/o : Q of the intput signal which is being transformed*/ - const Word16 n_chnls_dmx_old, /* i : number of downmix channels in the old format Q0 */ - const Word16 n_chnls_dmx_new /* i : number of downmix channels in the target format Q0*/ + const Word16 n_samples, /* i : input frame length in samples */ + Word32 dmx_fx[][L_FRAME48k + NS2SA(48000, IVAS_FB_ENC_DELAY_NS)], /* i/o: downmix signal to be transformed into another format Qx*/ + Word16 dmx_Q[], /* i/o : Q of the intput signal which is being transformed */ + const Word16 n_chnls_dmx_old, /* i : number of downmix channels in the old format Q0 */ + const Word16 n_chnls_dmx_new /* i : number of downmix channels in the target format Q0 */ ); ivas_error ivas_mono_dmx_renderer_open( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); - void ivas_mono_dmx_renderer_close( - MONO_DOWNMIX_RENDERER_HANDLE *hMonoDmxRenderer /* i/ i/o: Mono downmix structure */ + MONO_DOWNMIX_RENDERER_HANDLE *hMonoDmxRenderer /* i/ i/o: Mono downmix structure */ ); @@ -6767,6 +6793,17 @@ void ivas_lfe_lpf_enc_close_fx( ivas_filters_process_state_t **hLfeLpf /* i/o: LFE LPF handle */ ); +ivas_error ivas_create_lfe_lpf_enc_fx( + ivas_filters_process_state_t **hLfeLpf, /* o : LFE LPF handle */ + const Word32 input_Fs /* i : input sampling rate */ +); + +void ivas_lfe_lpf_enc_apply_fx( + ivas_filters_process_state_t *hLfeLpf, /* i/o: LFE LPF handle */ + Word32 data_lfe_ch[], /* i/o: LFE signal */ + const Word16 input_frame /* i : input frame length per channel */ +); + /*----------------------------------------------------------------------------------* * LFE Coding prototypes @@ -6774,7 +6811,7 @@ void ivas_lfe_lpf_enc_close_fx( ivas_error ivas_create_lfe_enc_fx( LFE_ENC_HANDLE *hLFE, /* o : IVAS LFE encoder structure */ - const Word32 input_Fs /* i : input sampling rate */ + const Word32 input_Fs /* i : input sampling rate */ ); void ivas_lfe_enc_close_fx( @@ -6782,60 +6819,62 @@ void ivas_lfe_enc_close_fx( ); void ivas_filters_init_fx( - ivas_filters_process_state_t *filter_state, /* i/o: filter state handle */ - const Word32 *filt_coeff_fx, /* i : filter coefficients Q31- *filt_coeff_e */ - const Word16 *filt_coeff_e, /* i : exponents of filter coefficients */ - const Word16 order ) ; + ivas_filters_process_state_t *filter_state, /* i/o: filter state handle */ + const Word32 *filt_coeff_fx, /* i : filter coefficients Q31- *filt_coeff_e */ + const Word16 *filt_coeff_e, /* i : exponents of filter coefficients */ + const Word16 order +); void ivas_filter_process_fx( - ivas_filters_process_state_t *filter_state, /* i/o: filter state handle */ - Word32 *pIn_Out_fx, /* i/o: signal subject to filtering Q(q_factor) */ - const Word16 length, /* i : filter order */ - Word16 q_factor ); + ivas_filters_process_state_t *filter_state, /* i/o: filter state handle */ + Word32 *pIn_Out_fx, /* i/o: signal subject to filtering Q(q_factor) */ + const Word16 length, /* i : filter order */ + Word16 q_factor +); /*----------------------------------------------------------------------------------* * OSBA prototypes *----------------------------------------------------------------------------------*/ + ivas_error ivas_osba_enc_reconfig( - Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); void ivas_set_surplus_brate_enc( - Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ #ifdef DEBUG_MODE_INFO , - const int16_t *nb_bits_metadata /* i : number of metadata bits */ + const int16_t *nb_bits_metadata /* i : number of metadata bits */ #endif ); void ivas_set_surplus_brate_dec( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - int32_t *ism_total_brate /* i : ISM total bitrate */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Word32 *ism_total_brate /* i : ISM total bitrate */ ); ivas_error ivas_omasa_separate_object_renderer_open( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); void ivas_omasa_separate_object_renderer_close( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); + /*----------------------------------------------------------------------------------* * Filter-bank (FB) Mixer *----------------------------------------------------------------------------------*/ ivas_error ivas_fb_set_cfg( IVAS_FB_CFG **pFb_cfg_out, /* o : FB config. handle */ - const Word16 ivas_format, /* i : IVAS format */ - const Word16 num_in_chans, /* i : number of FB input channels */ - const Word16 num_out_chans, /* i : number of FB output channels */ - const Word16 active_w_mixing, /* i : active_w_mixing flag */ - const Word32 sampling_Fs, /* i : sampling rate */ - const Word16 nachan_dirac_ana /* i : number of DirAR analysis channels */ + const Word16 ivas_format, /* i : IVAS format */ + const Word16 num_in_chans, /* i : number of FB input channels */ + const Word16 num_out_chans, /* i : number of FB output channels */ + const Word16 active_w_mixing, /* i : active_w_mixing flag */ + const Word32 sampling_Fs, /* i : sampling rate */ + const Word16 nachan_dirac_ana /* i : number of DirAR analysis channels */ ); - -/*=============================================================================================*/ - +/* clang-format on */ #endif diff --git a/lib_com/ivas_rotation_com_fx.c b/lib_com/ivas_rotation_com_fx.c index a922082f7242efab7483136bb97b39b77346eec8..d399c6a660e352ebd6ad625d8d13753c88d432a0 100644 --- a/lib_com/ivas_rotation_com_fx.c +++ b/lib_com/ivas_rotation_com_fx.c @@ -85,9 +85,10 @@ void Euler2Quat_fx( * * Quaternion q factor modification *------------------------------------------------------------------------*/ + void Copy_Quat_fx( const IVAS_QUATERNION *in_quat, /* i : quaternion describing the rotation */ - IVAS_QUATERNION *out_quat /* i : quaternion describing the rotation */ + IVAS_QUATERNION *out_quat /* o : quaternion describing the rotation */ ) { out_quat->q_fact = in_quat->q_fact; @@ -104,14 +105,16 @@ void Copy_Quat_fx( return; } + /*------------------------------------------------------------------------- * Scale_Quat_fx() * * Quaternion q factor modification *------------------------------------------------------------------------*/ + void modify_Quat_q_fx( const IVAS_QUATERNION *in_quat, /* i : quaternion describing the rotation */ - IVAS_QUATERNION *out_quat, /* i : quaternion describing the rotation */ + IVAS_QUATERNION *out_quat, /* o : quaternion describing the rotation */ Word16 q_new /* i : quaternion describing the rotation */ ) { @@ -123,16 +126,18 @@ void modify_Quat_q_fx( return; } + /*------------------------------------------------------------------------- * modify_Rmat_q_fx() * * Rotation matrix q factor modification *------------------------------------------------------------------------*/ + void modify_Rmat_q_fx( - Word32 Rmat_in[3][3], /* i : real-space rotation matrix for this rotation */ - Word32 Rmat_out[3][3], /* o : real-space rotation matrix for this rotation*/ + Word32 Rmat_in[3][3], /* i : real-space rotation matrix for this rotation */ + Word32 Rmat_out[3][3], /* o : real-space rotation matrix for this rotation */ Word16 q_cur, /* i : current q factor for rotation matrix */ - Word16 q_new /* i : target q factor for rotation matrix */ + Word16 q_new /* i : target q factor for rotation matrix */ ) { Word16 j, k; @@ -148,11 +153,13 @@ void modify_Rmat_q_fx( return; } + /*------------------------------------------------------------------------- * Quat2EulerDegree() * * Quaternion handling: calculate corresponding Euler angles in degrees *------------------------------------------------------------------------*/ + void Quat2EulerDegree_fx( const IVAS_QUATERNION quat, /* i : quaternion describing the rotation */ Word32 *yaw_fx, /* o : yaw */ @@ -240,6 +247,7 @@ void Quat2EulerDegree_fx( * * Converts degrees to normalized radians *------------------------------------------------------------------------*/ + Word32 deg2rad_fx( Word32 degrees // Q22 ) @@ -255,18 +263,3 @@ Word32 deg2rad_fx( return Mpy_32_32( PI_OVER_180_FX, degrees ); // Q22 } - -float deg2rad( - float degrees ) -{ - while ( degrees >= 180.0f ) - { - degrees = degrees - 360.0f; - } - while ( degrees <= -180.0f ) - { - degrees = degrees + 360.0f; - } - - return PI_OVER_180 * degrees; -} diff --git a/lib_com/ivas_tools_fx.c b/lib_com/ivas_tools_fx.c index 9001276bf722b5119aeb3458377a247a80ed0add..46067d828c93467479e6b71edf697f4f246736ec 100644 --- a/lib_com/ivas_tools_fx.c +++ b/lib_com/ivas_tools_fx.c @@ -189,57 +189,8 @@ void ivas_syn_output_f_fx( * * *-------------------------------------------------------------------*/ -void mvr2r_inc_fixed_one( - const Word32 x_fx[], /* i : input vector Q29*/ - const Word16 x_inc, /* i : increment for vector x[] Q0*/ - Word32 y_fx[], /* o : output vector Q29*/ - const Word16 y_inc, /* i : increment for vector y[] Q0*/ - const Word16 n /* i : vector size Q0*/ -) -{ - Word16 i; - Word16 ix; - Word16 iy; - - IF( n <= 0 ) - { - /* cannot transfer vectors with size 0 */ - return; - } - - IF( y_fx < x_fx ) - { - ix = 0; - move16(); - iy = 0; - move16(); - FOR( i = 0; i < n; i++ ) - { - y_fx[iy] = x_fx[ix]; /*Q29*/ - move32(); - ix = ix + x_inc; - iy = iy + y_inc; - } - } - ELSE - { - ix = imult1616( sub( n, 1 ), x_inc ); /*Q0*/ - iy = imult1616( sub( n, 1 ), y_inc ); /*Q0*/ - FOR( i = ( n - 1 ); i >= 0; i-- ) - { - y_fx[iy] = x_fx[ix]; /*Q29*/ - move32(); - - ix = ix - x_inc; - iy = iy - y_inc; - } - } - - return; -} - -void mvr2r_inc_fixed( +void mvr2r_inc_fx( const Word32 x_fx[], /* i : input vector Q29*/ const Word16 x_inc, /* i : increment for vector x[] Q0*/ Word32 y_fx[], /* o : output vector Q29*/ @@ -348,45 +299,8 @@ void v_add_inc_fx( * Multiplication of two vectors with explicit increments *-------------------------------------------------------------------*/ -void v_mult_inc_fx( - const Word32 x1_fx[], /* i : Input vector 1 x1_q_fx*/ - Word16 *x1_q_fx, - const Word16 x1_inc, /* i : Increment for input vector 1 Q0*/ - const Word32 x2_fx[], /* i : Input vector 2 x2_q_fx*/ - Word16 *x2_q_fx, - const Word16 x2_inc, /* i : Increment for input vector 1 Q0*/ - Word32 y_fx[], /* o : Output vector that contains vector 1 .* vector 2 y_q_fx*/ - Word16 *y_q_fx, - const Word16 y_inc, /* i : increment for vector y[i] Q0*/ - const Word16 N /* i : Vector length Q0*/ -) -{ - Word16 i; - Word16 ix1 = 0; - Word16 ix2 = 0; - Word16 iy = 0; - - move16(); - move16(); - move16(); - - FOR( i = 0; i < N; i++ ) - { - y_fx[iy] = Mpy_32_32( x1_fx[ix1], x2_fx[ix2] ); /* x1_q_fx + x2_q_fx - 31 */ - move32(); - y_q_fx[iy] = sub( add( x1_q_fx[ix1], x2_q_fx[ix2] ), 31 ); - move16(); - - ix1 = add( ix1, x1_inc ); /*Q0*/ - ix2 = add( ix2, x2_inc ); /*Q0*/ - iy = add( iy, y_inc ); /*Q0*/ - } - - return; -} - // when buffers have constant q/ -void v_mult_inc_fixed( +void v_mult_inc_fx( const Word32 x1_fx[], /* i : Input vector 1 Qx1*/ const Word16 x1_inc, /* i : Increment for input vector 1 Q0*/ const Word32 x2_fx[], /* i : Input vector 2 Qx2*/ @@ -441,28 +355,6 @@ void v_addc_fx( return; } -/*-------------------------------------------------------------------* - * v_addc() - * - * Addition of constant to vector - *-------------------------------------------------------------------*/ -void v_addc_fixed( - const Word32 x[], /* i : Input vector Qx*/ - const Word32 c, /* i : Constant Qx*/ - Word32 y[], /* o : Output vector that contains c*x Qx*/ - const Word16 N /* i : Vector length Q0*/ -) -{ - Word16 i; - - FOR( i = 0; i < N; i++ ) - { - y[i] = L_add( c, x[i] ); /*Qx*/ - move32(); - } - - return; -} /*-------------------------------------------------------------------* * v_min_fx() @@ -528,6 +420,7 @@ void v_min_fx( * * square root of vector *-------------------------------------------------------------------*/ + void v_sqrt_fx( const Word32 x[], /* i : Input vector Qx*/ Word16 exp[], @@ -546,6 +439,7 @@ void v_sqrt_fx( return; } + /*-------------------------------------------------------------------* * v_sub_s() * @@ -589,6 +483,7 @@ void v_sub32_fx( return; } + /*---------------------------------------------------------------------* * dot_product_cholesky() * @@ -598,7 +493,7 @@ void v_sub32_fx( *---------------------------------------------------------------------*/ /*! r: the dot product x'*A*A'*x */ -Word64 dot_product_cholesky_fixed( +Word64 dot_product_cholesky_fx( const Word32 *x, /* i : vector x Q31 - exp_x*/ const Word32 *A, /* i : Cholesky matrix A Q31 - exp_A*/ const Word16 N /* i : vector & matrix size Q0*/ @@ -630,7 +525,16 @@ Word64 dot_product_cholesky_fixed( return suma; } -void v_mult_mat_fixed( + +/*---------------------------------------------------------------------* + * v_mult_mat_fx() + * + * Multiplication of row vector x by matrix A, where x has size Nr and + * A has size Nr x Nc ans it is stored column-wise in memory. + * The resulting row vector y has size Nc + *---------------------------------------------------------------------*/ + +void v_mult_mat_fx( Word32 *y, /* o : the product x*A Qx - guardbits*/ const Word32 *x, /* i : vector x Qx*/ const Word32 *A, /* i : matrix A Q31*/ @@ -662,108 +566,6 @@ void v_mult_mat_fixed( MVR2R_WORD32( tmp_y, y, Nc ); /*Qx - guardbits*/ } -Word32 dot_product_cholesky_fx( - const Word32 *x, /* i : vector x Qx1*/ - const Word32 *A, /* i : Cholesky matrix A Qx2*/ - const Word16 N /* i : vector & matrix size Q0*/ -) -{ - Word16 i, j; - Word32 suma, tmp_sum; - const Word32 *pt_x, *pt_A; - - pt_A = A; - suma = 0; - move32(); - - FOR( i = 0; i < N; i++ ) - { - tmp_sum = 0; - move32(); - pt_x = x; - FOR( j = 0; j <= i; j++ ) - { - tmp_sum = L_add( tmp_sum, Mpy_32_32( *pt_x++, *pt_A++ ) ); /*Qx1 + Qx2 - 31*/ - } - - suma = L_add( suma, Mpy_32_32( tmp_sum, tmp_sum ) ); - } - - return suma; -} - - -/*---------------------------------------------------------------------* - * v_mult_mat_fx() - * - * Multiplication of row vector x by matrix A, where x has size Nr and - * A has size Nr x Nc ans it is stored column-wise in memory. - * The resulting row vector y has size Nc - *---------------------------------------------------------------------*/ - -void v_mult_mat_fx( - Word32 *y_fx, /* o : the product x*A y_q_fx*/ - Word16 *y_q_fx, - const Word32 *x_fx, /* i : vector x x_q_fx*/ - Word16 *x_q_fx, - const Word32 *A_fx, /* i : matrix A A_q_fx*/ - Word16 *A_q_fx, - const Word16 Nr, /* i : number of rows Q0*/ - const Word16 Nc /* i : number of columns Q0*/ -) -{ - Word16 i, j; - const Word32 *pt_x_fx, *pt_A_fx; - Word32 *pt_y_fx; - Word32 tmp_y_fx[MAX_V_MULT_MAT]; - Word32 temp; - Word16 temp_q; - - pt_y_fx = tmp_y_fx; - pt_A_fx = A_fx; /*A_q_fx*/ - pt_x_fx = x_fx; /*x_q_fx*/ - - FOR( i = 0; i < Nc; i++ ) - { - pt_x_fx = x_fx; /*x_q_fx*/ - *pt_y_fx = 0; - move32(); - y_q_fx[i] = 0; - move32(); - FOR( j = 0; j < Nr; j++ ) - { - temp = Mpy_32_32( *pt_x_fx++, *pt_A_fx++ ); /*x_q_fx + A_q_fx - 31*/ - temp_q = sub( add( x_q_fx[j], A_q_fx[Nr * i + j] ), 31 ); - IF( j == 0 ) - { - *pt_y_fx = temp; - move32(); - y_q_fx[i] = temp_q; - move16(); - } - ELSE - { - IF( GT_16( y_q_fx[i], temp_q ) ) - { - *pt_y_fx = L_add( L_shr( *pt_y_fx, sub( y_q_fx[i], temp_q ) ), temp ); - move32(); - y_q_fx[i] = temp_q; - move16(); - } - ELSE - { - *pt_y_fx = L_add( *pt_y_fx, L_shr( temp, sub( temp_q, y_q_fx[i] ) ) ); - move32(); - } - } - } - pt_y_fx++; - } - - MVR2R_WORD32( tmp_y_fx, y_fx, Nc ); /*y_q_fx*/ - - return; -} /*---------------------------------------------------------------------* * logsumexp() @@ -812,14 +614,17 @@ Word32 logsumexp_fx( temp32 = L_add( BASOP_Util_Log2( sum ), L_shl( sum_e, Q25 ) ); /*Q25*/ temp32 = Mpy_32_32( temp32, 1488522239 ); /*logf(x) = log2(x)*logf(2) Q25*/ temp32 = L_add( L_shr( temp32, sub( x_e, 6 ) ), max_exp ); // q = 31-x_e - return temp32; /*31-x_e*/ + + return temp32; /*31-x_e*/ } + /*---------------------------------------------------------------------* * lin_interp() * * Linearly maps x from source range to the target range *---------------------------------------------------------------------*/ + /*! r: mapped output value */ Word32 lin_interp32_fx( const Word32 x, /* i : the value to be mapped Qx */ @@ -858,6 +663,7 @@ Word32 lin_interp32_fx( return temp32; } + /*-------------------------------------------------------------------* * check_bounds_s_fx() * @@ -2124,6 +1930,7 @@ static float wrap_azi( return azi; } + /* helper function for panning_wrap_angles */ static Word32 wrap_azi_fx( const Word32 azi_deg /* Q22 */ ) @@ -2144,6 +1951,8 @@ static Word32 wrap_azi_fx( return azi; /*Q22*/ } + + /*-------------------------------------------------------------------* * panning_wrap_angles() * @@ -2152,6 +1961,7 @@ static Word32 wrap_azi_fx( * elevation = [-90, 90] * Considers direction changes from large elevation values *-------------------------------------------------------------------*/ + void panning_wrap_angles( const float azi_deg, /* i : azimuth in degrees for panning direction (positive left) */ const float ele_deg, /* i : elevation in degrees for panning direction (positive up) */ @@ -2211,6 +2021,8 @@ void panning_wrap_angles( return; } } + + /*-------------------------------------------------------------------* * panning_wrap_angles_fx() * @@ -2219,6 +2031,7 @@ void panning_wrap_angles( * elevation = [-90, 90] * Considers direction changes from large elevation values *-------------------------------------------------------------------*/ + void panning_wrap_angles_fx( const Word32 azi_deg, /* i : azimuth in degrees for panning direction (positive left) Q22 */ const Word32 ele_deg, /* i : elevation in degrees for panning direction (positive up) Q22 */ @@ -2294,7 +2107,7 @@ void panning_wrap_angles_fx( * (modified version of v_sort() to return an index array) *-------------------------------------------------------------------------*/ -void v_sort_ind_fixed( +void v_sort_ind_fx( Word32 *x, /* i/o: Vector to be sorted Qx*/ Word16 *idx, /* o : Original index positions Q0*/ const Word16 len /* i : vector length Q0*/ diff --git a/lib_com/lerp_fx.c b/lib_com/lerp_fx.c index 88492ecdb11e61a9c65645076a111ef749dda374..e35814b12b18064be9cfbc9d996509398609833d 100644 --- a/lib_com/lerp_fx.c +++ b/lib_com/lerp_fx.c @@ -132,13 +132,22 @@ void lerp( const Word16 *f /*Qx*/, Word16 *f_out /*Qx*/, Word16 bufferNewSize /* { lerp_proc( f, f_out, bufferNewSize, bufferOldSize ); } + + return; } + + /*-------------------------------------------------------------* * procedure lerp_proc() * * * * * *-------------------------------------------------------------*/ -static void lerp_proc( const Word16 *f /*Qx*/, Word16 *f_out /*Qx*/, Word16 bufferNewSize /*Q0*/, Word16 bufferOldSize /*Q0*/ ) + +static void lerp_proc( + const Word16 *f /*Qx*/, + Word16 *f_out /*Qx*/, + Word16 bufferNewSize /*Q0*/, + Word16 bufferOldSize /*Q0*/ ) { Word16 i, idx, n; @@ -236,7 +245,11 @@ static void lerp_proc( const Word16 *f /*Qx*/, Word16 *f_out /*Qx*/, Word16 buff } -static void lerp_proc32( Word32 *f /*Qx*/, Word32 *f_out /*Qx*/, Word16 bufferNewSize /*Q0*/, Word16 bufferOldSize /*Q0*/ ) +static void lerp_proc32( + Word32 *f /*Qx*/, + Word32 *f_out /*Qx*/, + Word16 bufferNewSize /*Q0*/, + Word16 bufferOldSize /*Q0*/ ) { Word16 i, idx, n; @@ -338,7 +351,12 @@ static void L_lerp_proc_fx( const Word32 *f_fx, Word32 *f_out_fx, const Word16 b * * *-------------------------------------------------------------*/ -void L_lerp_fx( Word32 *f /*q*/, Word32 *f_out /*q*/, Word16 bufferNewSize /*Q0*/, Word16 bufferOldSize /*Q0*/, Word16 *q ) +void L_lerp_fx( + Word32 *f /*q*/, + Word32 *f_out /*q*/, + Word16 bufferNewSize /*Q0*/, + Word16 bufferOldSize /*Q0*/, + Word16 *q ) { Word16 tmpNewSize; Word16 tmp1, tmp2, tmp_e; diff --git a/lib_com/lpc_tools_fx.c b/lib_com/lpc_tools_fx.c index 9aea1fe4bd490dbbf9c9a8e172cef5615d807161..a5aee205d0d15c8c7dd833ce858cc9749881d56a 100644 --- a/lib_com/lpc_tools_fx.c +++ b/lib_com/lpc_tools_fx.c @@ -556,7 +556,7 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR /*------------------------------------------* * Compute new LPC coeff. -> An[i] - * An[j]= A[j] + K*A[i-j] , j=1 to i-1 + * An[j]= A[j] + K*A[i-j], j=1 to i-1 * An[i]= K *------------------------------------------*/ @@ -746,7 +746,7 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 /*------------------------------------------* * Compute new LPC coeff. -> An[i] - * An[j]= A[j] + K*A[i-j] , j=1 to i-1 + * An[j]= A[j] + K*A[i-j], j=1 to i-1 * An[i]= K *------------------------------------------*/ @@ -936,7 +936,7 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* /*------------------------------------------* * Compute new LPC coeff. -> An[i] - * An[j]= A[j] + K*A[i-j] , j=1 to i-1 + * An[j]= A[j] + K*A[i-j], j=1 to i-1 * An[i]= K *------------------------------------------*/ diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index c93d4b77f55a88d48b0cbce088bbe9c9e9307cb8..0fbc7f7586c164b6b838b95dfc9d58c6ca6198de 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -4035,7 +4035,7 @@ void dec_FDCNG_MSVQ_stage1_fx( { dct_vec[col] = shl( cbpW8[col], dct_col_shift_tab[col] ); // Q0 move32(); - /* LOGIC( 1 ) , SHIFT( 1 ); + /* LOGIC( 1 ), SHIFT( 1 ); in BASOP: s_and(for W8->W16), shl() */ } diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 2054f1065daedc8f1cfb72cbbfe83931de4ef220..32b8a00ee5d5457391c29147ac2dbdce9bcbde59 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -32,6 +32,7 @@ #ifndef PROT_FX2_H #define PROT_FX2_H + /*----------------------------------------------------------------------------------* * Prototypes of RAM counting tool macros *----------------------------------------------------------------------------------*/ @@ -56,6 +57,8 @@ #include "ivas_error.h" #include "ivas_error_utils.h" #include "complex_basop.h" + + #define TCX_IMDCT_SCALE 15 #define TCX_IMDCT_HEADROOM 1 @@ -166,6 +169,7 @@ Word16 L_get_q_buf1( float *ptr_flt, Word16 length ); /*================================================================================*/ /* conversion functions: */ /*================================================================================*/ + Word32 sum_l_fx( const Word32 *vec, /* i : input vector */ const Word16 lvec /* i : length of input vector */ @@ -212,8 +216,9 @@ void set32_fx( ); // tools.c -Word16 Random( /* o : output random value */ - Word16 *seed /* i/o: random seed */ +/* o : output random value */ +Word16 Random( + Word16 *seed /* i/o: random seed */ ); // tools.c @@ -241,7 +246,6 @@ void Copy_pword( const Word16 L /* i : vector length */ ); -// tools.c void Scale_sig( Word16 x[], /* i/o: signal to scale Qx */ const Word16 lg, /* i : size of x[] Q0 */ @@ -254,15 +258,16 @@ void scale_sig( const Word16 exp0 /* i : exponent: x = round(x << exp) Qx ?exp */ ); -// tools.c -Word32 sum2_fx( /* o : sum of all squared vector elements Q(2x+1)*/ - const Word16 *vec, /* i : i vector Qx*/ - const Word16 lvec /* i : length of i vector */ +/* o : sum of all squared vector elements Q(2x+1)*/ +Word32 sum2_fx( + const Word16 *vec, /* i : i vector Qx*/ + const Word16 lvec /* i : length of i vector */ ); -Word64 sum2_fx_no_sat( /* o : sum of all squared vector elements Q(2x)*/ - const Word16 *vec, /* i : i vector Qx*/ - const Word16 lvec /* i : length of i vector */ +/* o : sum of all squared vector elements Q(2x)*/ +Word64 sum2_fx_no_sat( + const Word16 *vec, /* i : i vector Qx*/ + const Word16 lvec /* i : length of i vector */ ); Word16 sign_fx( @@ -272,11 +277,11 @@ Word16 sign_fx( Word16 sign16_fx( const Word16 x /* i : input value of x */ ); + /*========================================================================================================/ mslvq_com_fx.c /========================================================================================================*/ -// mslvq_com_fx Word16 deindex_lvq_fx( Word16 *index, /* i : index to be decoded, as an array of 3 short */ Word16 *x_lvq, /* o : decoded codevector Q(x2.56)*/ @@ -293,7 +298,9 @@ void deindex_lvq_SHB_fx( const Word16 nbits, const Word16 mode ); -Word32 encode_comb_fx( Word16 *cv, Word16 idx_lead ); +Word32 encode_comb_fx( + Word16 *cv, + Word16 idx_lead ); Word32 mslvq_ivas_16( Word16 *pTmp_fx, /* i : M-dimensional input vector */ @@ -350,8 +357,8 @@ swb_bwe_com_fx.c void calc_normal_length_fx( const Word16 core, /* i : core */ - const Word16 *sp, /* i : i signal */ - const Word16 mode, /* i : i mode */ + const Word16 *sp, /* i : i signal */ + const Word16 mode, /* i : i mode */ const Word16 extl, /* i : extension layer */ Word16 *L_swb_norm, /* o : normalize length */ Word16 *prev_L_swb_norm, /*i/o : last normalize length */ @@ -359,17 +366,16 @@ void calc_normal_length_fx( void calc_normal_length_fx_32( const Word16 core, /* i : core : Q0 */ - const Word32 *sp, /* i : i signal : Q12 */ - const Word16 mode, /* i : i mode : Q0 */ + const Word32 *sp, /* i : i signal : Q12 */ + const Word16 mode, /* i : i mode : Q0 */ const Word16 extl, /* i : extension layer : Q0 */ Word16 *L_swb_norm, /* o : normalize length : Q0 */ Word16 *prev_L_swb_norm /*i/o : last normalize length : Q0 */ ); - void hq_generic_decoding_fx( const Word16 HQ_mode, /* i : HQ mode */ - Word32 *coeff_out1_fx, /* i/o: BWE i & temporary buffer */ + Word32 *coeff_out1_fx, /* i/o: BWE i & temporary buffer */ const Word16 *hq_generic_fenv_fx, /* i : SWB frequency envelopes */ Word32 *coeff_out_fx, /* o : SWB signal in MDCT domain */ const Word16 hq_generic_offset, /* i : frequency offset for representing hq generic*/ @@ -386,14 +392,14 @@ Word16 WB_BWE_gain_pred_fx( Word16 *voice_factors, /* i : voicing factors Q15 */ const Word16 pitch_buf[], /* i : pitch buffer Q6 */ Word32 last_core_brate, /* i : previous frame core bitrate */ - Word16 last_wb_bwe_ener, /* i : previous frame wb bwe signal energy */ + Word16 last_wb_bwe_ener, /* i : previous frame wb bwe signal energy */ Word16 Q_syn, Word16 last_extl_fx, Word16 tilt_wb_fx ); /* o : Tilt in Q24 */ Word32 calc_tilt_bwe_fx( - const Word16 *sp0, /* i : i signal */ + const Word16 *sp0, /* i : i signal */ const Word16 exp, /* i : Exp of inp signal */ const Word16 N /* i : signal length */ ); @@ -402,7 +408,7 @@ void calc_norm_envelop_fx( const Word16 SWB_signal[], /* i : SWB spectrum Q_syn*/ Word32 *envelope, /* o : normalized envelope Q_syn*/ const Word16 L_swb_norm, /* i : length of envelope Q0 */ - const Word16 SWB_flength, /* i : Length of i /output */ + const Word16 SWB_flength, /* i : Length of i /output */ const Word16 st_offset /* i : offset */ ); @@ -410,7 +416,7 @@ void WB_BWE_decoding_fx( const Word16 *core_dec_freq, /* i : Frequency domain core decoded signal */ Word16 *WB_fenv, /* i : WB frequency envelopes */ Word32 *WB_signal32, /* o : WB signal in MDCT domain */ - const Word16 WB_flength, /* i : Length of i /output */ + const Word16 WB_flength, /* i : Length of i /output */ const Word16 mode, /* i : classification for WB signal */ const Word16 last_extl, /* i : extl. layer for last frame */ Word32 *prev_Energy, /* i/o: energy for last frame */ @@ -423,14 +429,14 @@ void WB_BWE_decoding_fx( Word16 *prev_flag, /* i/o: attenu flag of last frame */ Word16 prev_coder_type, /* i : coding type of last frame */ Word16 Q_syn, - Word16 *Q_syn_hb /*o : Q value of WB_signal_32 */ + Word16 *Q_syn_hb /* o : Q value of WB_signal_32 */ ); void SWB_BWE_decoding_fx( const Word16 *core_dec_freq, /* i : Frequency domain core decoded signal */ Word16 *SWB_fenv, /* i/o: SWB frequency envelopes */ Word32 *SWB_signal, /* o : SWB signal in MDCT domain */ - const Word16 SWB_flength, /* i : Length of i /output */ + const Word16 SWB_flength, /* i : Length of i /output */ const Word16 mode, /* i : classification for SWB signal */ Word16 *frica_flag, /* o : fricative signal flag */ Word16 *prev_Energy, /* i/o: energy for last frame */ @@ -463,13 +469,13 @@ void calc_norm_envelop_fx_32( const Word32 SWB_signal_fx[], /* i : SWB spectrum : Q12 */ Word32 *envelope_fx, /* o : normalized envelope : Q16 */ const Word16 L_swb_norm, /* i : length of envelope : Q0 */ - const Word16 SWB_flength, /* i : Length of i /output : Q0 */ + const Word16 SWB_flength, /* i : Length of i /output : Q0 */ const Word16 st_offset /* i : offset : Q0 */ ); void hq_generic_decoding_fx( const Word16 HQ_mode, /* i : HQ mode */ - Word32 *coeff_out1_fx, /* i/o: BWE i & temporary buffer */ + Word32 *coeff_out1_fx, /* i/o: BWE i & temporary buffer */ const Word16 *hq_generic_fenv_fx, /* i : SWB frequency envelopes */ Word32 *coeff_out_fx, /* o : SWB signal in MDCT domain */ const Word16 hq_generic_offset, /* i : frequency offset for representing hq generic*/ @@ -479,7 +485,7 @@ void hq_generic_decoding_fx( void hq_generic_decoding_ivas_fx( const Word16 HQ_mode, /* i : HQ mode */ - Word32 *coeff_out1_fx, /* i/o: BWE i & temporary buffer */ + Word32 *coeff_out1_fx, /* i/o: BWE i & temporary buffer */ const Word16 *hq_generic_fenv_fx, /* i : SWB frequency envelopes */ Word32 *coeff_out_fx, /* o : SWB signal in MDCT domain */ const Word16 hq_generic_offset, /* i : frequency offset for representing hq generic*/ @@ -502,7 +508,7 @@ lognorm_fx.c void logqnorm_fx( const Word32 *x, /* i : coefficient vector Qx */ - const Word16 qx, /* i : Q value of i */ + const Word16 qx, /* i : Q value of i */ Word16 *k, /* o : index Q0 */ const Word16 L, /* i : codebook length Q0 */ const Word16 N, /* i : sub-vector size Q0 */ @@ -521,7 +527,7 @@ void logqnorm_2_fx( void calc_norm_fx( const Word32 *L_x, /* i : Input vector. Qx */ - const Word16 qx, /* i : Q value of i */ + const Word16 qx, /* i : Q value of i */ Word16 *norm, /* o : Quantization indices for norms Q0 */ Word16 *normlg, /* o : Quantized norms in log2 Q0 */ const Word16 start_band, /* i : Indice of band to start coding Q0 */ @@ -529,15 +535,17 @@ void calc_norm_fx( const Word16 *band_len, /* i : Length of bands Q0 */ const Word16 *band_start /* i : Start of bands Q0 */ ); + void calc_norm_ivas_fx( - const Word32 *x_fx, /* i : Input vector.(Qin) */ - Word16 *norm, /* o : Quantization indices for norms Q0 */ - Word16 *normlg, /* o : Quantized norms in log2 Q0 */ + const Word32 *x_fx, /* i : Input vector.(Qin) */ + Word16 *norm, /* o : Quantization indices for norms Q0 */ + Word16 *normlg, /* o : Quantized norms in log2 Q0 */ const Word16 start_band, /* i : Indice of band to start coding */ const Word16 num_bands, /* i : Number of bands */ const Word16 *band_len, /* i : Length of bands */ const Word16 *band_start /* i : Start of bands */ ); + void logqnorm_ivas_fx( const Word32 *x_fx, /* i : coefficient vector Qq*/ const Word16 q, /* i : q of coefficient vector */ @@ -546,15 +554,16 @@ void logqnorm_ivas_fx( const Word16 N, /* i : sub-vector size */ const Word32 *thre_fxn /* i : quantization thresholds Q14*/ ); + /*========================================================================================================/ hq_tools_fx.c /========================================================================================================*/ void hq_swb_harmonic_calc_norm_envelop_fx( - const Word32 *L_SWB_signal, /* i : i signal Q=12*/ + const Word32 *L_SWB_signal, /* i : i signal Q=12*/ Word32 *L_envelope, /* o : output envelope Q=12*/ const Word16 L_swb_norm, /* i : length of normaliztion */ - const Word16 SWB_flength /* i : length of i signal */ + const Word16 SWB_flength /* i : length of i signal */ ); /* o : Number of coefficients in nf codebook */ @@ -585,7 +594,7 @@ Word16 find_last_band_fx( void apply_noisefill_HQ_fx( const Word16 *R, /* i : bit allocation */ - const Word16 length, /* i : i frame length */ + const Word16 length, /* i : i frame length */ const Word16 flag_32K_env_ho, /* i : envelope stability hangover flag*/ const Word32 L_core_brate, /* i : core bit rate */ const Word16 last_sfm, /* i : last coded subband */ @@ -637,16 +646,16 @@ void harm_bwe_fx( Word16 *norm, /* i/o: quantization indices for norms */ Word16 *noise_level, /* i/o: noise levels for harmonic modes */ Word16 *prev_noise_level, /* i/o: noise factor in previous frame */ - Word16 *bwe_seed, /* i/o: random seed for generating BWE i */ + Word16 *bwe_seed, /* i/o: random seed for generating BWE i */ Word32 *coeff_out, /* o : coded/noisefilled spectrum */ - const Word16 element_mode /* i : IVAS element mode */ + const Word16 element_mode /* i : IVAS element mode */ ); void hq_fold_bwe_fx( const Word16 last_sfm, /* i : last coded subband Q0 */ const Word16 *sfm_end, /* i : Subband end coefficient Q0 */ const Word16 num_sfm, /* i : Number of subbands Q0 */ - Word16 *coeff /* i/o: coded/noisefilled normalized spectrum Q12 */ + Word16 *coeff /* i/o: coded/noisefilled normalized spectrum Q12*/ ); void apply_nf_gain_fx( @@ -655,7 +664,7 @@ void apply_nf_gain_fx( const Word16 *R, /* i : bit allocation Q0 */ const Word16 *sfm_start, /* i : Subband start coefficient Q0 */ const Word16 *sfm_end, /* i : Subband end coefficient Q0 */ - Word16 *coeff /* i/o: coded/noisefilled normalized spectrum Q12 */ + Word16 *coeff /* i/o: coded/noisefilled normalized spectrum Q12*/ ); void hvq_bwe_fx( @@ -674,7 +683,7 @@ void hvq_bwe_fx( Word16 *norm, /* i/o: quantization indices for norms Q0 */ Word16 *noise_level, /* i/o: noise levels for harmonic modes Q15 */ Word16 *prev_noise_level, /* i/o: noise factor in previous frame Q15 */ - Word16 *bwe_seed, /* i/o: random seed for generating BWE i Q0 */ + Word16 *bwe_seed, /* i/o: random seed for generating BWE i Q0 */ Word32 *L_coeff_out, /* o : coded/noisefilled spectrum Qout*/ const Word16 qin, const Word16 qout ); @@ -696,7 +705,7 @@ void noise_mix_fx( const Word16 istart, /* i : start coefficient Q0 */ const Word16 iend, /* i : end coefficient Q0 */ const Word16 noise_level, /* i : noise_level Q0 */ - Word32 *L_coeff_out, /* o : noisemixed spectrum Qout */ + Word32 *L_coeff_out, /* o : noisemixed spectrum Qout*/ const Word16 qin, const Word16 qout ); @@ -705,8 +714,8 @@ void hq_generic_fine_fx( const Word16 last_sfm, /* i : Last coded band */ const Word16 *sfm_start, /* i : Subband start coefficient */ const Word16 *sfm_end, /* i : Subband end coefficient */ - Word16 *bwe_seed, /* i/o: random seed for generating BWE i */ - Word16 *coeff_out1 /* o : HQ Generic i */ + Word16 *bwe_seed, /* i/o: random seed for generating BWE i */ + Word16 *coeff_out1 /* o : HQ Generic i */ ); void map_hq_generic_fenv_norm_fx( @@ -752,7 +761,7 @@ Word16 calc_nor_delta_hf_ivas_fx( void hq_bwe_fx( const Word16 HQ_mode, /* i : HQ mode */ - Word32 *coeff_out1, /* i/o: BWE i & temporary buffer */ + Word32 *coeff_out1, /* i/o: BWE i & temporary buffer */ const Word16 *hq_generic_fenv, /* i : SWB frequency envelopes */ Word32 *coeff_out, /* o : SWB signal in MDCT domain */ const Word16 hq_generic_offset, /* i : frequency offset for representing hq generic bwe*/ @@ -765,7 +774,7 @@ void hq_bwe_fx( void hq_bwe_ivas_fx( const Word16 HQ_mode, /* i : HQ mode */ - Word32 *coeff_out1, /* i/o: BWE i & temporary buffer */ + Word32 *coeff_out1, /* i/o: BWE i & temporary buffer */ const Word16 *hq_generic_fenv, /* i : SWB frequency envelopes */ Word32 *coeff_out, /* o : SWB signal in MDCT domain */ const Word16 hq_generic_offset, /* i : frequency offset for representing hq generic bwe*/ @@ -861,12 +870,13 @@ Word32 sub_lsp2lsf_fx( void E_LPC_lsp_lsf_conversion( const Word16 lsp[], /* i : lsp[m] (range: -1<=val<1) */ - Word16 lsf[], /* output : lsf[m] normalized (range: 0<=val<=6400) */ - const Word16 m /* i : LPC order */ + Word16 lsf[], /* o : lsf[m] normalized (range: 0<=val<=6400) */ + const Word16 m /* i : LPC order */ ); + void E_LPC_lsf_lsp_conversion( const Word16 lsf[], /* i : lsf[m] normalized (range: 0<=val<=6400) */ - Word16 lsp[], /* o : lsp[m] (range: -1<=val<1) */ + Word16 lsp[], /* o : lsp[m] (range: -1<=val<1) */ const Word16 m /* i : LPC order */ ); @@ -877,7 +887,7 @@ void E_LPC_f_lsp_a_conversion( void E_LPC_a_isp_conversion( const Word16 *a, /* i : LP filter coefficients */ - Word16 *isp, /* o : Line spectral pairs (in the cosine domain) */ + Word16 *isp, /* o : Line spectral pairs (in the cosine domain) */ const Word16 *old_isp, /* i : LSP vector from past frame */ const Word16 m /* i : LPC order */ ); @@ -899,7 +909,7 @@ void E_LPC_f_isp_a_conversion( void E_LPC_a_lsp_conversion( const Word16 *a, /* i : LP filter coefficients */ - Word16 *lsp, /* o : Line spectral pairs (in the cosine domain) */ + Word16 *lsp, /* o : Line spectral pairs (in the cosine domain) */ const Word16 *old_lsp, /* i : LSP vector from past frame */ const Word16 m /* i : LPC order */ ); @@ -923,10 +933,10 @@ void lsp2lpc_fx( Word16 order ); void E_LPC_a_lsp_conversion( - const Word16 *a, /* i : LP filter coefficients */ + const Word16 *a, /* i : LP filter coefficients */ Word16 *lsp, /* o : Line spectral pairs (in the cosine domain) */ - const Word16 *old_lsp, /* i : LSP vector from past frame */ - const Word16 m /* i : LPC order */ + const Word16 *old_lsp, /* i : LSP vector from past frame */ + const Word16 m /* i : LPC order */ ); void v_sort( @@ -1055,9 +1065,9 @@ void lsf2lsp_fx( void lsp2lsf_fx( const Word16 lsp[], /* i : lsp[m] (range: -1<=val<1) Q15*/ - Word16 lsf[], /* o : lsf[m] normalized (range: 0.0<=val<=0.5) Q(x2.56)*/ + Word16 lsf[], /* o : lsf[m] normalized (range: 0.0<=val<=0.5) Q(x2.56)*/ const Word16 m, /* i : LPC order Q0*/ - const Word32 int_fs /* i : internal sampling frequency */ + const Word32 int_fs /* i : internal sampling frequency */ ); void isf2lsf_fx( @@ -1146,8 +1156,8 @@ Word16 vq_dec_lvq_fx( Word16 indices[], /* i : Indices */ Word16 stages, /* i : Number of stages */ Word16 N, /* i : Vector dimension */ - Word16 mode, /* (i): mode_lvq, or mode_lvq_p */ - Word16 no_bits, /* (i): no. bits for lattice */ + Word16 mode, /* i : mode_lvq, or mode_lvq_p */ + Word16 no_bits, /* i : no. bits for lattice */ Word32 *p_offset_scale1, Word32 *p_offset_scale2, Word32 *p_offset_scale1_p, @@ -1161,10 +1171,14 @@ Word16 vq_dec_lvq_ivas_fx( Word16 indices[], /* i : Indices */ Word16 stages, /* i : Number of stages */ Word16 N, /* i : Vector dimension */ - Word16 mode, /* (i): mode_lvq, or mode_lvq_p */ - Word16 no_bits /* (i): no. bits for lattice */ + Word16 mode, /* i : mode_lvq, or mode_lvq_p */ + Word16 no_bits /* i : no. bits for lattice */ ); -void a2rc_fx( const Word16 *a, Word16 *refl, Word16 lpcorder ); + +void a2rc_fx( + const Word16 *a, + Word16 *refl, + Word16 lpcorder ); Word16 vq_dec_lvq_ivas_fx( Word16 sf_flag, /* i : safety net flag */ @@ -1172,8 +1186,8 @@ Word16 vq_dec_lvq_ivas_fx( Word16 indices[], /* i : Indices */ Word16 stages, /* i : Number of stages */ Word16 N, /* i : Vector dimension */ - Word16 mode, /* (i): mode_lvq, or mode_lvq_p */ - Word16 no_bits /* (i): no. bits for lattice */ + Word16 mode, /* i : mode_lvq, or mode_lvq_p */ + Word16 no_bits /* i : no. bits for lattice */ ); void a2rc_fx( @@ -1366,13 +1380,13 @@ void get_next_indice_tmp_fx( /* o : value of the indice */ UWord16 get_indice_1_fx( - Decoder_State *st_fx, /* i/o: decoder state structure */ + Decoder_State *st_fx, /* i/o: decoder state structure */ Word16 pos /* i : absolute position in the bitstream */ ); void reset_indices_enc_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder state structure */ - const Word16 max_num_indices /* i : max number of indices */ + const Word16 max_num_indices /* i : max number of indices */ ); Word16 BRATE2IDX_fx( @@ -1437,7 +1451,7 @@ scale_mem_fx.c Word16 Rescale_exc( Word16 dct_post_old_exc_fx[], /* i/o: Music post processing memory Q_exc*/ - Word16 exc[], /* i/o: excitation to rescale Q_exc */ + Word16 exc[], /* i/o: excitation to rescale Q_exc*/ Word16 bwe_exc[], /* Q_exc */ Word16 *last_exc_dct_in, /* Q_exc */ Word16 lg, /* i : frame size */ @@ -1445,12 +1459,12 @@ Word16 Rescale_exc( Word32 L_gain_code, /* i : decoded codebook gain Q16 */ Word16 *sQ_exc, /* i/o: Excitation scaling factor */ Word16 *sQsubfr, /* i/o: Past excitation scaling factors */ - Word16 exc2[], /* o : local excitation vector Q_exc */ + Word16 exc2[], /* o : local excitation vector Q_exc */ Word16 i_subfr, /* i : subframe number */ const Word16 coder_type ); void Rescale_mem( - const Word16 Q_exc, /* i : current excitation scaling (>=0) */ + const Word16 Q_exc, /* i : current excitation scaling (>=0) */ Word16 *prev_Q_syn, /* i/o : scaling factor of previous frame */ Word16 *Q_syn, /* i/o : scaling factor of frame */ Word16 *mem_syn2, /* i/o : modified synthesis memory Qexp_scale */ @@ -1469,7 +1483,7 @@ void Rescale_mem( void scale_sig32( Word32 x[], /* i/o: signal to scale Qx */ const Word16 lg, /* i : size of x[] Q0 */ - const Word16 exp0 /* i : exponent: x = round(x << exp) Qx xx exp */ + const Word16 exp0 /* i : exponent: x = round(x << exp) Qx xx exp */ ); void Scale_sig64( @@ -1483,6 +1497,7 @@ void scale_sig32_r( const Word16 lg, /* i : size of x[] Q0 */ const Word16 exp0 /* i : exponent: x = round(x << exp) Qx exp */ ); + Word16 rescale_mem( const Word16 *Q_exc, /* i : current excitation scaling (>=0) */ Word16 *prev_Q_syn, /* i/o : scaling factor of previous frame */ @@ -1551,9 +1566,10 @@ Word32 get_gain2( const Word16 y[], /*Q13/o->Q13 */ - Word16 Mbands_gn, /* i : number of bands */ - const Word16 ReUseGain, /* i : Reuse the gain in Ener_per_bd_yQ */ + Word16 Mbands_gn, /* i : number of bands */ + const Word16 ReUseGain, /* i : Reuse the gain in Ener_per_bd_yQ */ Word16 Qexc_diff, Word16 Q_exc ); @@ -1834,8 +1848,8 @@ void Comp_and_apply_gain_ivas_fx( Word16 exc_diffQ[], /* i/o: Quantized excitation */ Word16 Ener_per_bd_iQ[], /* i : Target ener per band Q13 */ Word16 Ener_per_bd_yQ[], /* i/o : Ener per band for norm vector i->Q13/o->Q13 */ - Word16 Mbands_gn, /* i : number of bands */ - const Word16 ReUseGain, /* i : Reuse the gain in Ener_per_bd_yQ */ + Word16 Mbands_gn, /* i : number of bands */ + const Word16 ReUseGain, /* i : Reuse the gain in Ener_per_bd_yQ */ Word16 Qexc_diff, Word16 *Q_exc ); @@ -1907,7 +1921,7 @@ void GetPredictedSignal_fx( ); void Get20Log10Spec_fx( - const Word32 *L_inBuf, /* i : i Q_inBuf */ + const Word32 *L_inBuf, /* i : i Q_inBuf */ Word16 *outBuf_fx, /* o : output Q7 */ const Word16 fLen, /* i : loop length */ const Word16 Q_inBuf /* i : Qvalue of L_inBuf */ @@ -1915,7 +1929,7 @@ void Get20Log10Spec_fx( void GetSynthesizedSpecThinOut_fx( const Word16 *predBuf_fx, /* i : Qss: prediction buffer (i.e., lowband) */ - const Word16 Qss, /* i : Q value of i vector */ + const Word16 Qss, /* i : Q value of i vector */ Word32 *L_outBuf, /* o : QsL: synthesized spectrum */ Word16 QsL, /* o : Q value of synthesized spectrum */ const Word16 nBands_fx, /* i : Q0: number of subbands calculated */ @@ -2094,8 +2108,8 @@ void ton_ene_est_fx( ); void norm_vec_32_16_scale_fx( - Word32 *L_vec_in, /* i : i vector */ - Word16 Qin, /* i : Q value for i vector */ + Word32 *L_vec_in, /* i : i vector */ + Word16 Qin, /* i : Q value for i vector */ Word16 length_fx, /* i :vector size */ Word16 *vec_out_fx, /* o : output vectror */ Word16 *Qout, /* o : Q value for output vectro */ @@ -2107,7 +2121,7 @@ void updat_prev_frm_fx( Word32 L_t_audio[], /* o: core coder buffer */ Word32 L_bwe_br, /* i: core bitrate */ Word16 length_fx, /* i: frame length coded bw */ - const Word16 inner_frame_fx, /* i: i frame length */ + const Word16 inner_frame_fx, /* i: i frame length */ Word16 bands_fx, /* i: sub band resolution */ Word16 bwidth_fx, /* i: NB/WB/SWB indicator */ const Word16 is_transient_fx, /* i: signal class information */ @@ -2171,8 +2185,8 @@ Word16 har_est_fx( ); void FindNBiggest2_simple_fx_har( - const Word32 *L_inBuf, /* i : i buffer (searched) */ - const Word16 Qabs_in, /* i : Q value of i buffer */ + const Word32 *L_inBuf, /* i : i buffer (searched) */ + const Word16 Qabs_in, /* i : Q value of i buffer */ GainItem_fx *pk_sf_fx, /* o : N biggest components found */ const Word16 nIdx_fx, /* i : search length */ Word16 *n_fx, /* i : number of components searched (N biggest) */ @@ -2417,7 +2431,7 @@ Word32 syn_kern_16( void syn_filt_s_lc_fx( const Word16 shift, /* i : scaling to apply Q0 */ const Word16 a[], /* i : LP filter coefficients Q12 */ - const Word16 x[], /* i : i signal Qx */ + const Word16 x[], /* i : i signal Qx */ Word16 y[], /* o : output signal Qx-s */ const Word16 lg /* i : size of filtering Q0 */ ); @@ -2426,7 +2440,7 @@ void Syn_filt_s( const Word16 shift, /* i : scaling to apply Q0 */ const Word16 a[], /* i : LP filter coefficients Q12 */ const Word16 m, /* i : order of LP filter Q0 */ - const Word16 x[], /* i : i signal Qx */ + const Word16 x[], /* i : i signal Qx */ Word16 y[], /* o : output signal Qx-s */ const Word16 lg, /* i : size of filtering Q0 */ Word16 mem[], /* i/o: memory associated with this filtering. Qx-s */ @@ -2621,8 +2635,8 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q0 */ Word16 modify_Fs_fx( const Word16 sigIn_fx[], /* i : signal to decimate Q0 */ - Word16 lg, /* i : length of i Q0 */ - const Word32 fin, /* i : frequency of i Q0 */ + Word16 lg, /* i : length of i Q0 */ + const Word32 fin, /* i : frequency of i Q0 */ Word16 sigOut_fx[], /* o : decimated signal Q0 */ const Word32 fout, /* i : frequency of output Q0 */ Word16 mem_fx[], /* i/o: filter memory Q0 */ @@ -2773,6 +2787,7 @@ Word16 E_UTIL_f_preemph3( Word16 *mem, /* Qx */ Word16 bits /* Q0 */ ); + Word16 E_UTIL_f_preemph3_ivas_fx( Word16 *signal, /* Qx */ const Word16 mu, /* Q15 */ @@ -2914,7 +2929,6 @@ void save_old_syn_fx( Word16 *mem_deemph /* i/o: deemphasis filter memory */ ); -// swb_tbe_com_fx.c void find_td_envelope_fx( const Word16 inp[], /* i : input signal Qx */ const Word16 len, /* i : length of the input signal */ @@ -3623,9 +3637,7 @@ Word16 ppp_extract_pitch_period_fx( Word16 *out, /* o : output residual */ Word16 l, /* i : lag */ Word16 *out_of_bound, /* o : out of bound flag */ - Word16 Qres - -); + Word16 Qres ); void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, /* i : DTFS */ @@ -3688,14 +3700,6 @@ Word32 DTFS_getEngy_band_wb_fx( Word16 lband, Word16 hband ); -// tns_base.c -/** Init TNS configuration. - * Fills STnsConfig structure with sensible content. - * @param nSampleRate Sampling rate of the i . - * @param nFrameLength Frame length. - * @param pTnsConfig TNS configuration to be initialized. - * @return 0 on success, otherwise 1. - */ void InitTnsConfiguration( const Word16 bwidth, const Word16 frameLength, @@ -3714,19 +3718,6 @@ void InitTnsConfiguration_ivas_fx( const Word16 element_mode, const Word16 is_mct ); -/** Modify spectrum using TNS filter. - * Modifies spectrum unsing TNS filter defined by pTnsData. - * If fIsAnalyses is true considers spectrum to be - * an i of encoder and returns residum. - * If fIsAnalyses is false considers spectrum to be - * a residum from decoder and returns output spectrum. - * @param pTnsConfig TNS configuration. - * @param pTnsData TNS data describing filters. - * @param spectrum Input/output spectrum. - * @param fIsAnalysis Defines if TNS filter is applied - * in encoder (TRUE) or in decoder (FALSE). - * @return 0 on success, otherwise 1. - */ void ApplyTnsFilter( STnsConfig const *pTnsConfig, STnsData const *pTnsData, @@ -3822,17 +3813,8 @@ void *SetTnsEnabledSingleFilter( void *p, const Word16 index, const Word16 value void const *GetTnsOnWhite( void const *p, const Word16 index, Word16 *pValue ); void *SetTnsOnWhite( void *p, const Word16 index, const Word16 value ); -/*tns_base.h*/ -/** Reset TNS data. - * Resets TNS data to the initial state. - * @param pTnsData pointer to a TNS data to be reset. - */ void ResetTnsData( STnsData *pTnsData ); -/** Clear TNS filter data. - * Resets TNS filter order and all coefficients to 0. - * @param pTnsFilter pointer to a TNS filter to be cleared. - */ void ClearTnsFilterCoefficients( STnsFilter *pTnsFilter ); /*========================================================================================================/ @@ -4261,7 +4243,6 @@ Word16 getTcxLpcShapedAri( const Word16 element_mode /* i : IVAS element mode */ ); -// tcx_mdct_window.c void mdct_window_sine( PWord16 *window, /* Qx */ Word16 n /* Q0 */ @@ -4286,7 +4267,7 @@ Word16 getInvFrameLen( const Word16 L_frame ); /* returns 1/L_frame in Q21 format */ void tcx_get_windows( - TCX_CONFIG_HANDLE hTcxCfg, /* i : TCX configuration */ + TCX_CONFIG_HANDLE hTcxCfg, /* i : TCX configuration */ const Word16 left_mode, /* i: overlap mode of left window half */ const Word16 right_mode, /* i: overlap mode of right window half */ Word16 *left_overlap, /* o: left overlap length */ @@ -4303,7 +4284,7 @@ void WindowSignal( Word16 right_overlap_mode, /* i : overlap mode of right window half */ Word16 *left_overlap_length, /* o : TCX window left overlap length */ Word16 *right_overlap_length, /* o : TCX window right overlap length */ - const Word16 in[], /* i : i signal */ + const Word16 in[], /* i : i signal */ Word16 *L_frame, /* i/o: frame length */ Word16 out[], /* o : output windowed signal */ const Word16 truncate_aldo, /* i : nonzero to truncate long ALDO slope */ @@ -4450,13 +4431,9 @@ void InitTnsConfigs_ivas_fx( const Word16 element_mode, const Word16 is_mct ); -#define IVAS_CODE_TCX_UTIL -#ifdef IVAS_CODE_TCX_UTIL void SetAllowTnsOnWhite( STnsConfig tnsConfig[2][2], const Word8 allowTnsOnWhite ); -#endif -#undef IVAS_CODE_TCX_UTIL void SetTnsConfig( TCX_CONFIG_HANDLE hTcxCfg, /* i : configuration of TCX */ @@ -4482,7 +4459,6 @@ void init_TCX_config( Word16 L_frameTCX, Word16 fscaleFB ); -// tec_com.c void resetTecDec_Fx( TEC_DEC_HANDLE hTecDec ); @@ -4541,7 +4517,6 @@ void set_TEC_TFA_code_fx( Word16 *tec_flag, Word16 *tfa_flag ); -// tcx_mdct_fx.c void TCX_MDCT( const Word16 *x, /* Qx */ Word32 *y, /* exp(y_e) */ @@ -4591,8 +4566,6 @@ void TCX_MDXT_Inverse_fx( const UWord16 kernel_type /* Q0 */ ); -// edct_fx.c -#define EDCT_FACTOR_SCALE 2 void edct_fx( const Word32 *x, /* i : i signal Qq */ Word32 *y, /* o : output transform Qq */ @@ -4636,12 +4609,10 @@ void edxt_fx( const UWord16 synthesis /* i : nonzero for inverse */ ); -// fft_evs.c void fft16( Word32 *re, Word32 *im, Word16 s, Word16 bScale ); void BASOP_cfft( cmplx *pComplexBuf, Word16 sizeOfFft, Word16 *scale, Word32 workBuffer[2 * BASOP_CFFT_MAX_LENGTH] ); void BASOP_rfft( Word32 *x, Word16 sizeOfFft, Word16 *scale, Word16 isign ); -// fft_fx_evs.c void DoRTFTn_fx( Word32 *x, /* i/o : real part of i and output data */ Word32 *y, /* i/o : imaginary part of i and output data */ @@ -4720,7 +4691,7 @@ void DoRTFTn_fx_ivas( ); -Word16 find_guarded_bits_fx( Word32 n ); +Word16 find_guarded_bits_fx( const Word32 n ); Word16 L_norm_arr( const Word32 *arr, Word16 size ); Word16 norm_arr( Word16 *arr, Word16 size ); @@ -4748,6 +4719,7 @@ void edct2_fx( Word16 *q, const Word16 *ip, const Word16 *w ); + void DoRTFT160_16fx( Word16 x[], /* i/o : real part of i and output data */ Word16 y[] /* i/o : imaginary part of i and output data */ @@ -4757,12 +4729,21 @@ void DoRTFT320_16fx( Word16 *x, /* i/o : real part of i and output data */ Word16 *y /* i/o : imaginary part of i and output data */ ); + void DoRTFT128_16fx( Word16 *x, /* i/o : real part of i and output data Q(Qx+Q_edct)*/ Word16 *y /* i/o : imaginary part of i and output data Q(Qx+Q_edct)*/ ); -void fft3_fx( const Word16[], Word16[], const Word16 ); -void ifft3_fx( const Word16[], Word16[], const Word16 ); + +void fft3_fx( + const Word16[], + Word16[], + const Word16 ); + +void ifft3_fx( + const Word16[], + Word16[], + const Word16 ); void fft3_fx_ivas( const Word32 X[], @@ -4773,7 +4754,6 @@ void ifft3_fx_ivas( Word32 Y[], const Word16 n ); -// fft_rel_fx.c void r_fft_fx_lc( const Word16 *phs_tbl, /* i : Table of phase */ const Word16 SIZE, /* i : Size of the FFT */ @@ -4784,7 +4764,6 @@ void r_fft_fx_lc( const Word16 isign /* i : 1=fft, otherwize it's ifft */ ); -// cldfb_evs void cldfbAnalysis_fx( HANDLE_CLDFB_FILTER_BANK anaCldfb, /*!< Handle of Cldfb Analysis Bank */ Word32 **cldfbReal, /*!< Pointer to real subband slots */ @@ -4957,7 +4936,6 @@ void E_UTIL_voice_factor( Word16 shift /* i : scaling to get 12bit */ ); -// window_ola_fx.c void sinq_fx( const Word16 tmp, /* i : sinus factor cos(tmp*i+phi) Q15*/ const Word16 phi, /* i : sinus phase cos(tmp*i+phi) Q15*/ @@ -5055,10 +5033,10 @@ void bands_and_bit_alloc_fx( Word16 *out_bits_per_bands, /* i/o: Number of bit allowed per allowed subband Q3 */ Word16 *nb_subbands, /* o : Number of subband allowed */ const Word16 *exc_diff, /* i : Difference signal to quantize (encoder side only) */ - Word16 *concat_in, /* o : Concatened PVQ's i vector (encoder side only) */ + Word16 *concat_in, /* o : Concatened PVQ's i vector (encoder side only) */ Word16 *pvq_len, /* o : Number of bin covered with the PVQ */ const Word16 coder_type, /* i : coding type */ - const Word16 bwidth, /* i : i signal bandwidth */ + const Word16 bwidth, /* i : i signal bandwidth */ const Word16 GSC_noisy_speech, /* i : GSC noisy speech flag */ const Word16 L_frame, /* i : frame length */ const Word16 element_mode, /* i : element mode */ @@ -5367,6 +5345,7 @@ void scalebands( const Word16 nband, /* i : Number of bands */ Word32 *bandpow, /* o : Power for each band */ const Word16 flag_fft_en ); + void scalebands_fx( const Word32 *partpow, /* i : Power for each partition */ Word16 *part, /* i : Partition upper boundaries (band indices starting from 0) */ @@ -5965,7 +5944,6 @@ void tcx_arith_render_envelope( Word32 env[] /* o: shaped signal envelope Q16*/ ); - /* returns innovation gain Q16 */ Word32 calc_gain_inov( const Word16 *code, /* i : algebraic excitation Q9 */ @@ -5984,11 +5962,11 @@ void ResetSHBbuffer_Dec_fx( ); void wb_tbe_dec_fx( - Decoder_State *st_fx, /* i/o: decoder state structure */ - const Word16 coder_type, /* i : coding type */ - Word32 *bwe_exc_extended, /* i : bandwidth extended exciatation */ + Decoder_State *st_fx, /* i/o: decoder state structure */ + const Word16 coder_type, /* i : coding type */ + Word32 *bwe_exc_extended, /* i : bandwidth extended exciatation */ const Word16 Q_exc, - const Word16 voice_factors[], /* i : voicing factors */ + const Word16 voice_factors[], /* i : voicing factors */ Word16 *synth, /* i/o: ACELP core synthesis/final synthesis */ Word16 *Q_synth ); @@ -6048,7 +6026,7 @@ void GenTransition_fx( ); void GenTransition_fx32( - TD_BWE_DEC_HANDLE hBWE_TD, /* i/o: TD BWE data handle */ + TD_BWE_DEC_HANDLE hBWE_TD, /* i/o: TD BWE data handle */ Word32 *outputHB_fx, /* o : synthesized HB transitions signal : Q11 */ const Word32 output_Fs, /* i : output sampling rate : Q0 */ const Word16 L_frame, /* i : ACELP frame length : Q0 */ @@ -6102,28 +6080,28 @@ Word16 minimum_l( Word32 *min_val /* o : minimum value in the input vector */ ); -void v_multc_fixed( +void v_multc_fx( const Word32 x[], /* i : Input vector */ const Word32 c, /* i : Constant */ Word32 y[], /* o : Output vector that contains c*x */ const Word16 N /* i : Vector length */ ); -void v_multc_fixed_16( +void v_multc_fx_16( const Word32 x[], /* i : Input vector */ const Word16 c, /* i : Constant */ Word32 y[], /* o : Output vector that contains c*x */ const Word16 N /* i : Vector length */ ); -void v_multc_fixed_16_16( +void v_multc_fx_16_16( const Word16 x[], /* i : Input vector */ const Word16 c, /* i : Constant */ Word16 y[], /* o : Output vector that contains c*x */ const Word16 N /* i : Vector length */ ); -void v_add_fixed( +void v_add_fx_hdrm( const Word32 x1[], /* i : Input vector 1 */ const Word32 x2[], /* i : Input vector 2 */ Word32 y[], /* o : Output vector that contains vector 1 - vector 2 */ @@ -6131,14 +6109,14 @@ void v_add_fixed( const Word16 hdrm /* i : headroom for when subtraction result > 1 or < -1 */ ); -void v_add_fixed_no_hdrm( +void v_add_fx_no_hdrm( const Word32 x1[], /* i : Input vector 1 */ const Word32 x2[], /* i : Input vector 2 */ Word32 y[], /* o : Output vector that contains vector 1 + vector 2 */ const Word16 N /* i : Vector length */ ); -void v_add_fixed_me( +void v_add_fx_me( const Word32 x1[], /* i : Input vector 1 */ const Word16 x1_e, /* i : Exponent for input vector 1 */ const Word32 x2[], /* i : Input vector 2 */ @@ -6157,14 +6135,7 @@ void v_add_w64( const Word16 hdrm /* i : headroom for when subtraction result > 1 or < -1 */ ); -void v_multc_32_16_fixed( - const Word32 x[], /* i : Input vector */ - const Word16 c, /* i : Constant */ - Word32 y[], /* o : Output vector that contains c*x */ - const Word16 N /* i : Vector length */ -); - -void v_sub_fixed( +void v_sub_fx( const Word32 x1[], /* i : Input vector 1 */ const Word32 x2[], /* i : Input vector 2 */ Word32 y[], /* o : Output vector that contains vector 1 - vector 2 */ @@ -6172,7 +6143,7 @@ void v_sub_fixed( const Word16 hdrm /* i : headroom for when subtraction result > 1 or < -1 */ ); -void v_sub_fixed_no_hdrm( +void v_sub_fx_no_hdrm( const Word32 x1[], /* i : Input vector 1 */ const Word32 x2[], /* i : Input vector 2 */ Word32 y[], /* o : Output vector that contains vector 1 - vector 2 */ @@ -6180,21 +6151,21 @@ void v_sub_fixed_no_hdrm( ); /*! r: dot product of x[] and y[] */ -Word32 dotp_fixed( +Word32 dotp_fx32( const Word32 x[], /* i : vector x[] */ const Word32 y[], /* i : vector y[] */ const Word16 n /* i : vector length */ ); /*! r: dot product of x[] and y[] in case of overflow*/ -Word32 dotp_fixed_o( +Word32 dotp_fx32_o( const Word32 x[], /* i : vector x[] */ const Word32 y[], /* i : vector y[] */ const Word16 n, /* i : vector length */ const Word16 log_len, /* i : max factor added to result q after dot product (equal to log2(n)) */ Word16 *res_q ); -Word32 dotp_fixed_32( +Word32 dotp_fx32_fac( const Word32 x[], /* i : vector x[] */ const Word32 y[], /* i : vector y[] */ const Word16 n, /* i : vector length */ @@ -6202,7 +6173,7 @@ Word32 dotp_fixed_32( Word16 *res_q /*stores resultant Q*/ ); -Word32 dotp_fixed_ivas_fx( +Word32 dotp_fx_ivas_fx( const Word32 x[], /* i : vector x[] */ Word16 x_e, const Word32 y[], /* i : vector y[] */ @@ -6210,7 +6181,7 @@ Word32 dotp_fixed_ivas_fx( const Word16 n, /* i : vector length */ Word16 *out_e ); -Word32 dotp_fixed_guarded( +Word32 dotp_fx_guarded( const Word32 x[], /* i : vector x[] */ const Word32 y[], /* i : vector y[] */ const Word16 n /* i : vector length */ @@ -7344,30 +7315,30 @@ void rc_dec_init_fx( /* o : Decoded cumulative frequency */ UWord32 rc_decode_fx( Word16 *BER_detect, /* o : Bit error detection flag */ - PVQ_DEC_HANDLE hPVQ, /* i/o: PVQ decoder handle */ + PVQ_DEC_HANDLE hPVQ, /* i/o: PVQ decoder handle */ UWord32 tot /* i : Total cumulative frequency */ ); void rc_dec_update_fx( - Decoder_State *st_fx, /* i/o: Decoder State */ + Decoder_State *st_fx, /* i/o: Decoder State */ PVQ_DEC_HANDLE hPVQ, /* i/o: PVQ decoder handle */ UWord32 cum_freq, /* i : Cumulative frequency */ UWord32 sym_freq /* i : Symbol frequency */ ); -/* i : Decoded value */ +/* o : Decoded value */ Word32 rc_dec_bits_fx( - Decoder_State *st_fx, /* i/o: Decoder State */ + Decoder_State *st_fx, /* i/o: Decoder State */ PVQ_DEC_HANDLE hPVQ, /* i/o: PVQ decoder handle */ - Word16 bits /* i : Number of bits */ + Word16 bits /* i : Number of bits */ ); -/* i : Decoded value */ +/* o : Decoded value */ UWord32 rc_dec_uniform_fx( - Decoder_State *st_fx, /* i/o: Decoder State */ + Decoder_State *st_fx, /* i/o: Decoder State */ PVQ_DEC_HANDLE hPVQ, /* i/o: PVQ decoder handle */ - UWord32 tot /* i : Maximum value */ + UWord32 tot /* i : Maximum value */ ); void rc_dec_finish_fx( @@ -7377,8 +7348,8 @@ void rc_dec_finish_fx( void pvq_decode_fx( Decoder_State *st_fx, - PVQ_DEC_HANDLE hPVQ, /* i/o: PVQ decoder handle */ - Word16 *xq, /* o: decoded vector (Q15) */ + PVQ_DEC_HANDLE hPVQ, /* i/o: PVQ decoder handle */ + Word16 *xq, /* o: decoded vector (Q15) */ Word16 *y, /* o: decoded vector (non-scaled int) */ const Word16 k_val, /* i: number of allocated pulses */ const Word16 dim, /* i: Length of vector */ @@ -7393,6 +7364,7 @@ void nelp_decoder_fx( const Word16 coder_type, /* i : coding type Q0 */ Word16 *gain_buf /* Q14 */ ); + void decod_nelp_fx( Decoder_State *st_fx, /* i/o: decoder static memory */ Word16 *tmp_noise_fx, /* o : long term temporary noise energy */ @@ -7484,7 +7456,7 @@ void FdCng_decodeSID_fx( void noisy_speech_detection_fx( HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: FD_CNG structure */ const Word16 vad, /* i : VAD flag */ - const Word16 *syn, /* i : i time-domain frame */ + const Word16 *syn, /* i : i time-domain frame */ const Word16 Q ); void generate_comfort_noise_dec_fx( @@ -7567,7 +7539,6 @@ void destroy_cldfb_encoder_fx( Encoder_State *st /* i/o: state structure */ ); -// swb_bwe_dec_fx.c Word16 WB_BWE_gain_deq_fx( Decoder_State *st_fx, /* i/o: decoder state structure */ Word16 *WB_fenv /*Q15*/ @@ -7622,9 +7593,11 @@ void hq_core_dec_fx( const Word16 hq_core_type, /* i : HQ core type Q0*/ const Word16 core_switching_flag /* i : ACELP->HQ switching frame flag Q0*/ ); + void HQ_core_dec_init_fx( HQ_DEC_HANDLE hHQ_core /* i/o: HQ core data handle */ ); + void HQ_nbfec_init_fx( HQ_NBFEC_HANDLE hHQ_nbfec /* i/o: HQ NB FEC data handle */ ); @@ -7817,7 +7790,6 @@ void hvq_dec_fx( Word32 *coefsq_norm, /* o : Output vector in Q12 */ const Word16 core ); -// hvq_pvq_bitalloc_fx.c Word16 hvq_pvq_bitalloc_fx( Word16 num_bits, /* i/o: Number of available bits (including gain bits) */ const Word32 brate, /* i : bitrate */ @@ -8139,14 +8111,14 @@ void sc_vbr_dec_init( ); ivas_error ppp_quarter_decoder_fx( - DTFS_STRUCTURE *CURRCW_Q_DTFS_FX, /* i/o: Current CW DTFS */ + DTFS_STRUCTURE *CURRCW_Q_DTFS_FX, /* i/o: Current CW DTFS */ Word16 prevCW_lag_fx, /* i : Previous lag */ Word16 *lastLgainD_fx, /* i/o: Last gain lowband Q11 */ - Word16 *lastHgainD_fx, /* i/o: Last gain highwband Q11 */ - Word16 *lasterbD_fx, /* i/o: Last ERB vector Q13 */ + Word16 *lastHgainD_fx, /* i/o: Last gain highwband Q11 */ + Word16 *lasterbD_fx, /* i/o: Last ERB vector Q13 */ Word16 bfi, /* i : FER flag */ - Word16 *S_fx, /* i : sine table, Q15 */ - Word16 *C_fx, /* i : cosine table, Q15 */ + Word16 *S_fx, /* i : sine table, Q15 */ + Word16 *C_fx, /* i : cosine table, Q15 */ DTFS_STRUCTURE PREV_CW_D_FX, /* i : Previous DTFS */ Decoder_State *st_fx ); @@ -8182,7 +8154,8 @@ void acelp_plc_mdct_transition_fx( ); void cldfb_reset_memory_fx( - HANDLE_CLDFB_FILTER_BANK hs /* i/o: filter bank handle */ ); + HANDLE_CLDFB_FILTER_BANK hs /* i/o: filter bank handle */ +); void tcxltp_dec_init_fx( TCX_LTP_DEC_HANDLE hTcxLtpDec, /* Q0 */ @@ -8618,7 +8591,8 @@ void getTCXparam_fx( const Word16 *no_param_tns, /* i : number of TNS parameters per subframe Q0 */ Word16 p_param[2], /* o : pointer to parameters for next round of bs reading Q0 */ Word16 nTnsBitsTCX10[2], /*Q0*/ - const Word16 pre_past_flag /*Q0*/ ); + const Word16 pre_past_flag /*Q0*/ +); void dec_prm_fx( Word16 *coder_type, @@ -8714,7 +8688,8 @@ void GetParameters_fx( void const *pParameter, // Q0 Word16 **pStream, // Q0 Word16 *pnSize, // Q0 - Word16 *pnBits ); // Q0 + Word16 *pnBits // Q0 +); void EncodeTnsData_ivas_fx( STnsConfig const *pTnsConfig, /* i : TNS Configuration struct */ @@ -9278,14 +9253,14 @@ void delay_signal_q_adj_fx( const Word16 q_x, const Word16 q_mem ); -Word32 anint_fixed( - Word32 x, /* i: Round to the nearest integer */ - Word16 exp /* i: Exponent for round step */ +Word32 anint_fx( + const Word32 x, /* i: Round to the nearest integer */ + const Word16 exp /* i: Exponent for round step */ ); -Word32 ceil_fixed( - Word32 x, /* i: number to ceil */ - Word16 exp /* i: Exponent for ceil step */ +Word32 ceil_fx( + const Word32 x, /* i: number to ceil */ + const Word16 exp /* i: Exponent for ceil step */ ); void v_add_fx( @@ -9396,7 +9371,6 @@ void cldfbSynthesis_ivas_fx( HANDLE_CLDFB_FILTER_BANK h_cldfb /* i : filter bank state */ ); -// bass_psfilter.c void addBassPostFilter_ivas_fx( const Word32 *harm_timeIn_fx, const Word16 samplesToProcess, @@ -9532,7 +9506,7 @@ void IMDCT_ivas_fx( Word16 *q_acelp_zir_fx, Word16 *pq_win ); -void v_mult16_fixed( +void v_mult16_fx( const Word16 x1[], /* i : Input vector 1 */ const Word16 x2[], /* i : Input vector 2 */ Word16 y[], /* o : Output vector that contains vector 1 .* vector 2 */ @@ -9551,6 +9525,7 @@ Word32 sum2_f_16_fx( const Word16 *vec, /* i : input vector */ const Word16 lvec /* i : length of input vector */ ); + Word32 sum2_f_16_gb_fx( const Word16 *vec, /* i : input vector */ const Word16 lvec, /* i : length of input vector */ @@ -9910,7 +9885,6 @@ Word32 dot_product_mat_fx( const Word16 *x, /* i : vector x Q15 */ const Word32 *A, /* i : matrix A Q0*/ const Word16 m /* i : vector & matrix size */ - ); void Vr_subt( @@ -10383,7 +10357,7 @@ Word32 sum2_32_fx( const Word16 lvec, /* i : length of input vector */ Word16 *e ); -void v_mult_fixed( +void v_mult_fx( const Word32 x1[], /* i : Input vector 1 */ const Word32 x2[], /* i : Input vector 2 */ Word32 y[], /* o : Output vector that contains vector 1 .* vector 2 */ @@ -10594,7 +10568,7 @@ void core_encode_update_ivas_fx( ); void updt_enc_common_ivas_fx( - Encoder_State *st, /* i/o: encoder state structure */ + Encoder_State *st, /* i/o: encoder state structure */ const Word16 Q_new /* i : CUrrent frame scaling */ ); @@ -11287,7 +11261,7 @@ ivas_error acelp_core_enc_ivas_fx( Word16 *q_old_syn_12k8_16, Word16 pitch_buf[NB_SUBFR16k], /* o : floating pitch for each subframe Q6*/ Word16 *unbits, /* o : number of unused bits Q0*/ - STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i/o: TD stereo encoder handle */ + STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i/o: TD stereo encoder handle */ Word16 tdm_lsfQ_PCh[M], /* i : Q LSFs for primary channel X2.56*/ Word16 Q_new ); @@ -11399,10 +11373,8 @@ void UnmapIndex_fx( Word32 *Lag /* Q0 */ ); -#define GET_ADJ( T, L ) GET_ADJ2( T, L, *FractionalResolution ) #define GET_ADJ2( T, L, F ) ( ( ( L ) << ( F ) ) - ( T ) ) - Word32 tcx_hm_render_fx( const Word32 lag, /* i: pitch lag Q0 */ const Word16 fract_res, /* i: fractional resolution of the lag Q0 */ @@ -11436,7 +11408,7 @@ void writeTCXMode_fx( ); void writeTCXWindowing_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ + BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ const Word16 overlap_mode /* i : overlap mode Q0*/ ); diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index b7fe74deed3d8960d179bcf2622531cdcc7b0db8..bfe9db62d269efef90004808a98090c8691b71ec 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -2962,7 +2962,7 @@ void GenShapedSHBExcitation_ivas_enc_fx( /*Word16 out_exp; Word32 temp_pow1 = root_a_over_b_fx(pow1, Q_pow1, pow22, Q_pow22, &out_exp); temp_pow1 = L_shl(temp_pow1, out_exp);*/ - // v_multc_fixed_16_16(White_exc16k, round_fx(temp_pow), White_exc16k, L_FRAME16k); + // v_multc_fx_16_16(White_exc16k, round_fx(temp_pow), White_exc16k, L_FRAME16k); L_tmp = 0; move32(); Q_White_exc16k = add( getScaleFactor16( White_exc16k, L_FRAME16k ), norm_l( temp_pow ) ); @@ -3981,7 +3981,7 @@ void GenShapedSHBExcitation_ivas_dec_fx( /*Word16 out_exp; Word32 temp_pow1 = root_a_over_b_fx(pow1, Q_pow1, pow22, Q_pow22, &out_exp); temp_pow1 = L_shl(temp_pow1, out_exp);*/ - // v_multc_fixed_16_16(White_exc16k, round_fx(temp_pow), White_exc16k, L_FRAME16k); + // v_multc_fx_16_16(White_exc16k, round_fx(temp_pow), White_exc16k, L_FRAME16k); L_tmp = 0; move32(); shift = getScaleFactor16( White_exc16k, L_FRAME16k ); @@ -4311,7 +4311,7 @@ void GenShapedSHBExcitation_ivas_dec_fx( L_tmp = root_a_over_b_fx( pow1, Q_pow1, pow22, Q_pow22, &exp ); Word16 temp_fac = round_fx_sat( L_shl_sat( L_tmp, exp ) ); // Q15 shift = sub( sub( *Q_bwe_exc, NOISE_QADJ ), Q_White_exc16k ); - // v_multc_fixed_16_16(White_exc16k,shr(temp_fac, temp_fac_exp) , mixExc16k, L_FRAME16k); + // v_multc_fx_16_16(White_exc16k,shr(temp_fac, temp_fac_exp) , mixExc16k, L_FRAME16k); FOR( k = 0; k < L_FRAME16k; k++ ) { mixExc16k[k] = mult_r( shl_sat( White_exc16k[k], shift ), temp_fac ); @@ -6356,7 +6356,7 @@ void wb_tbe_extras_reset_synth_fx( *-------------------------------------------------------------------*/ void elliptic_bpf_48k_generic_fx( - const int16_t element_mode, + const Word16 element_mode, Word16 IsUpsampled3, Word16 input_fx[], /* i : input signal Q_input_fx*/ Word16 *Q_input_fx, @@ -6674,7 +6674,7 @@ void synthesise_fb_high_band_fx( Word32 bpf_memory[][4], /* i/o: memory for elliptic bpf 48k */ Word16 bpf_memory_Q[], Word16 Qout, - int16_t element_mode ) + Word16 element_mode ) { Word16 i, j; Word16 excitation_in_interp3_buffer[L_FRAME48k + 4]; diff --git a/lib_com/tcx_utils_fx.c b/lib_com/tcx_utils_fx.c index 1bd773baddeef2ab69fce0e3c0348093223df8ea..a6b32f31040b2c362336ad848a422d6b3b622a40 100644 --- a/lib_com/tcx_utils_fx.c +++ b/lib_com/tcx_utils_fx.c @@ -681,10 +681,6 @@ void lpc2mdct( const PWord16 *ptwiddle; Word32 workBuffer[2 * BASOP_CFFT_MAX_LENGTH]; -#ifndef IVAS_CODE_TCX_UTIL - (void) noInverse; -#endif - assert( length <= FDNS_NPTS ); sizeN = shl( length, 1 ); /*Q0*/ @@ -709,28 +705,17 @@ void lpc2mdct( move32(); } - move16(); -#ifdef IVAS_CODE_TCX_UTIL if ( noInverse ) { - /* half length FFT */ - scale = add( norm_s( lpcCoeffs[0] ), 1 ); - BASOP_cfft( (cmplx *) ComplexData, FDNS_NPTS, &scale, workBuffer ); // tbv -> In float the fft type changes as well - /*Get amplitude*/ - j = sub( length, 1 ); - k = 0; - for ( i = 0; i < length; i++ ) - { - mdct_gains[i] = (float) ( sqrt( RealData[i] * RealData[i] + ImagData[i] * ImagData[i] ) ); - } + assert( !"not supported option in lpc2mdct()" ); } else -#endif { /* half length FFT */ scale = add( norm_s( lpcCoeffs[0] ), 1 ); BASOP_cfft( (cmplx *) ComplexData, FDNS_NPTS, &scale, workBuffer ); /*Q31 - scale*/ - /*Get amplitude*/ + + /* Get amplitude */ j = sub( length, 1 ); k = 0; FOR( i = 0; i < length / 2; i++ ) @@ -2022,7 +2007,6 @@ void InitTnsConfigs_ivas_fx( InitTnsConfiguration_ivas_fx( bwidth, add( L_frame, shr( L_frame, 2 ) ), &tnsConfig[1][1], igfStopFreq, total_brate, element_mode, MCT_flag ); } - void SetTnsConfig( TCX_CONFIG_HANDLE hTcxCfg, /* i : configuration of TCX */ const Word16 isTCX20, /*Q0*/ @@ -2032,8 +2016,7 @@ void SetTnsConfig( hTcxCfg->pCurrentTnsConfig = &hTcxCfg->tnsConfig[isTCX20][isAfterACELP]; assert( hTcxCfg->pCurrentTnsConfig != NULL ); } -#define IVAS_CODE_TCX_UTIL -#ifdef IVAS_CODE_TCX_UTIL + /*-------------------------------------------------------------------* * SetAllowTnsOnWhite * @@ -2055,8 +2038,6 @@ void SetAllowTnsOnWhite( move16(); return; } -#endif -#undef IVAS_CODE_TCX_UTIL void tcx_get_gain( Word32 *x, /* i: spectrum 1 Q31 - x_e*/ diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index dc8017d89d7a69b5d882705d66c142f77fe72bed..1be575c2410063c75a5b55b0cc2d6a3976fcc634 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -667,7 +667,7 @@ Word16 minimum_l( *---------------------------------------------------------------------*/ /*! r: dot product of x[] and y[] */ -Word32 dotp_fixed( +Word32 dotp_fx32( const Word32 x[], /* i : vector x[] Qx */ const Word32 y[], /* i : vector y[] Qy */ const Word16 n /* i : vector length */ @@ -687,7 +687,7 @@ Word32 dotp_fixed( } /*To calculate dot product of two 32 bit arrays in case of overflow*/ -Word32 dotp_fixed_o( +Word32 dotp_fx32_o( const Word32 x[], /* i : vector x[] */ const Word32 y[], /* i : vector y[] */ const Word16 n, /* i : vector length */ @@ -719,7 +719,7 @@ Word32 dotp_fixed_o( } -Word32 dotp_fixed_32( +Word32 dotp_fx32_fac( const Word32 x[], /* i : vector x[] */ const Word32 y[], /* i : vector y[] */ const Word16 n, /* i : vector length */ @@ -777,12 +777,12 @@ void v_add_w64( /*-------------------------------------------------------------------* - * v_sub_fixed() + * v_sub_fx() * * Subtraction of two vectors sample by sample *-------------------------------------------------------------------*/ -void v_sub_fixed( +void v_sub_fx( const Word32 x1[], /* i : Input vector 1 */ const Word32 x2[], /* i : Input vector 2 */ Word32 y[], /* o : Output vector that contains vector 1 - vector 2 */ @@ -801,7 +801,7 @@ void v_sub_fixed( return; } -void v_sub_fixed_no_hdrm( +void v_sub_fx_no_hdrm( const Word32 x1[], /* i : Input vector 1 */ const Word32 x2[], /* i : Input vector 2 */ Word32 y[], /* o : Output vector that contains vector 1 - vector 2 */ @@ -820,12 +820,12 @@ void v_sub_fixed_no_hdrm( } /*-------------------------------------------------------------------* - * v_multc_fixed() + * v_multc() * * Multiplication of vector by constant *-------------------------------------------------------------------*/ -void v_multc_fixed( +void v_multc_fx( const Word32 x[], /* i : Input vector */ const Word32 c, /* i : Constant */ Word32 y[], /* o : Output vector that contains c*x */ @@ -843,7 +843,7 @@ void v_multc_fixed( return; } -void v_multc_fixed_16( +void v_multc_fx_16( const Word32 x[], /* i : Input vector */ const Word16 c, /* i : Constant */ Word32 y[], /* o : Output vector that contains c*x */ @@ -861,7 +861,7 @@ void v_multc_fixed_16( return; } -void v_multc_fixed_16_16( +void v_multc_fx_16_16( const Word16 x[], /* i : Input vector */ const Word16 c, /* i : Constant */ Word16 y[], /* o : Output vector that contains c*x */ @@ -5150,23 +5150,6 @@ void delay_signal_q_adj_fx( return; } -void v_add_fx( - const Word32 x1[], /* i : Input vector 1 */ - const Word32 x2[], /* i : Input vector 2 */ - Word32 y[], /* o : Output vector that contains vector 1 + vector 2 */ - const Word16 N /* i : Vector length */ -) -{ - Word16 i; - - FOR( i = 0; i < N; i++ ) - { - y[i] = L_add_sat( x1[i], x2[i] ); - move32(); - } - - return; -} Word16 floor_log_2( Word32 num ) { @@ -5317,7 +5300,7 @@ Word32 sign_l( } } -void v_mult16_fixed( +void v_mult16_fx( const Word16 x1[], /* i : Input vector 1 */ const Word16 x2[], /* i : Input vector 2 */ Word16 y[], /* o : Output vector that contains vector 1 .* vector 2 */ @@ -5484,7 +5467,7 @@ Word32 dotp_me_fx( return suma; } -Word32 dotp_fixed_guarded( +Word32 dotp_fx_guarded( const Word32 x[], /* i : vector x[] */ const Word32 y[], /* i : vector y[] */ const Word16 n /* i : vector length */ @@ -5504,7 +5487,7 @@ Word32 dotp_fixed_guarded( } -Word32 dotp_fixed_ivas_fx( +Word32 dotp_fx_ivas_fx( const Word32 x[], /* i : vector x[] */ Word16 x_e, const Word32 y[], /* i : vector y[] */ @@ -5525,6 +5508,7 @@ Word32 dotp_fixed_ivas_fx( *out_e = exp; move16(); + return suma; } @@ -5535,8 +5519,7 @@ Word32 dotp_fixed_ivas_fx( * Multiplication of two vectors *-------------------------------------------------------------------*/ - -void v_mult_fixed( +void v_mult_fx( const Word32 x1[], /* i : Input vector 1 */ const Word32 x2[], /* i : Input vector 2 */ Word32 y[], /* o : Output vector that contains vector 1 .* vector 2 */ @@ -5556,12 +5539,14 @@ void v_mult_fixed( /*-------------------------------------------------------------------* - * anint_fixed() + * anint_fx() * * Round to the nearest integer. *-------------------------------------------------------------------*/ -Word32 anint_fixed( Word32 x, Word16 exp ) +Word32 anint_fx( + const Word32 x, + const Word16 exp ) { IF( x == 0 ) { @@ -5579,14 +5564,14 @@ Word32 anint_fixed( Word32 x, Word16 exp ) /*-------------------------------------------------------------------* - * ceil_fixed() + * ceil_fx() * * Ceil to the next multiple of (1 << exp). *-------------------------------------------------------------------*/ -Word32 ceil_fixed( - Word32 x, - Word16 exp ) +Word32 ceil_fx( + const Word32 x, + const Word16 exp ) { Word32 step; @@ -5626,12 +5611,31 @@ void sort_l( /*-------------------------------------------------------------------* - * v_add_fixed() + * v_add() * * Subtraction of two vectors sample by sample *-------------------------------------------------------------------*/ -void v_add_fixed( +void v_add_fx( + const Word32 x1[], /* i : Input vector 1 */ + const Word32 x2[], /* i : Input vector 2 */ + Word32 y[], /* o : Output vector that contains vector 1 + vector 2 */ + const Word16 N /* i : Vector length */ +) +{ + Word16 i; + + FOR( i = 0; i < N; i++ ) + { + y[i] = L_add_sat( x1[i], x2[i] ); + move32(); + } + + return; +} + + +void v_add_fx_hdrm( const Word32 x1[], /* i : Input vector 1 */ const Word32 x2[], /* i : Input vector 2 */ Word32 y[], /* o : Output vector that contains vector 1 - vector 2 */ @@ -5650,7 +5654,7 @@ void v_add_fixed( return; } -void v_add_fixed_no_hdrm( +void v_add_fx_no_hdrm( const Word32 x1[], /* i : Input vector 1 */ const Word32 x2[], /* i : Input vector 2 */ Word32 y[], /* o : Output vector that contains vector 1 + vector 2 */ @@ -5668,7 +5672,7 @@ void v_add_fixed_no_hdrm( return; } -void v_add_fixed_me( +void v_add_fx_me( const Word32 x1[], /* i : Input vector 1 */ const Word16 x1_e, /* i : Exponent for input vector 1 */ const Word32 x2[], /* i : Input vector 2 */ @@ -5696,7 +5700,7 @@ void v_add_fixed_me( } Word16 find_guarded_bits_fx( - Word32 n ) + const Word32 n ) { // return n <= 1 ? 0 : n <= 2 ? 1 // : n <= 4 ? 2 diff --git a/lib_dec/FEC_HQ_phase_ecu_fx.c b/lib_dec/FEC_HQ_phase_ecu_fx.c index 17fece8ec22471c714edab1f22ae3121116290b0..4c6d6fe34623729363d35cce88dbafbf9662bf38 100644 --- a/lib_dec/FEC_HQ_phase_ecu_fx.c +++ b/lib_dec/FEC_HQ_phase_ecu_fx.c @@ -2728,7 +2728,7 @@ static void ivas_rec_wtda_fx( tmp = div_s( 1, shl( ola_len, 1 ) ); // Q15 tmp = round_fx( L_shl( L_mult( tmp, EVS_PI_FX ), 2 ) ); // Q15 sinq_fx( tmp, 0, ola_len, xfwin ); - v_mult16_fixed( xfwin, xfwin, xfwin, ola_len ); /* xfwin = sin^2 of 0..pi/4 */ + v_mult16_fx( xfwin, xfwin, xfwin, ola_len ); /* xfwin = sin^2 of 0..pi/4 */ pOldW = xfwin + sub( ola_len, 1 ); pNewW = xfwin; FOR( i = 0; i < ola_len; i++ ) diff --git a/lib_dec/FEC_adapt_codebook_fx.c b/lib_dec/FEC_adapt_codebook_fx.c index fae55ab5b0aff3d63693e2829d9556c779d66b54..24ddc6463b456cab77b31fec330af17b6b00b081 100644 --- a/lib_dec/FEC_adapt_codebook_fx.c +++ b/lib_dec/FEC_adapt_codebook_fx.c @@ -15,14 +15,12 @@ * Create an artificial onset when it is lost *---------------------------------------------------------------------*/ Word16 FEC_SinOnset_fx( - Word16 *exc, - /* i/o : exc vector to modify */ // Qin = Qold, Qout = Q_exc - Word16 puls_pos, /* i : last pulse position desired */ - const Word16 T0, /* i : Pitch information of the 1 subfr */ - Word32 enr_q, /* i : energy provide by the encoder */ - Word16 *Aq, /* i : A(z) filter Q12 */ - const Word16 L_frame /* i : frame length */ - , + Word16 *exc, /* i/o : exc vector to modify Qin = Qold, Qout = Q_exc */ + Word16 puls_pos, /* i : last pulse position desired */ + const Word16 T0, /* i : Pitch information of the 1 subfr */ + Word32 enr_q, /* i : energy provide by the encoder */ + Word16 *Aq, /* i : A(z) filter Q12 */ + const Word16 L_frame, /* i : frame length */ const Word16 Qold ) { Word16 P0, onset_len, sign, i, len, L_subfr, L_subfr2; diff --git a/lib_dec/FEC_pitch_estim_fx.c b/lib_dec/FEC_pitch_estim_fx.c index b7ad94f8931293ef25288170d9be242c4e0fabc8..4ea25cd857b2ed36ddbceda1a6f27dc1cbaafa9d 100644 --- a/lib_dec/FEC_pitch_estim_fx.c +++ b/lib_dec/FEC_pitch_estim_fx.c @@ -44,10 +44,9 @@ void FEC_pitch_estim_fx( const Word32 old_pitch_buf[], /* i : buffer of old subframe pitch values 15Q16 */ Word16 *bfi_pitch, /* i/o: update of the estimated pitch for FEC Q6*/ Word16 *bfi_pitch_frame, /* o : frame length when pitch was updated */ - Word16 *upd_cnt /* i/o: update counter */ - , - const Word16 coder_type, /* i : coder_type */ - Word16 element_mode /* i : element mode */ + Word16 *upd_cnt, /* i/o: update counter */ + const Word16 coder_type, /* i : coder_type */ + Word16 element_mode /* i : element mode */ ) { Word16 tmp, tmp1, tmp2, tmp3; diff --git a/lib_dec/LD_music_post_filter_fx.c b/lib_dec/LD_music_post_filter_fx.c index f07feac96a5a375ea4cec286dbce448833984e93..d1ec20b0b88a35f8e3217eb632e085cbaabf384f 100644 --- a/lib_dec/LD_music_post_filter_fx.c +++ b/lib_dec/LD_music_post_filter_fx.c @@ -941,11 +941,10 @@ void Post_music_postP_fx( Word16 *mem_deemph, /* i/o: speech deemph filter memory Q_syn*/ Word16 *st_pst_old_syn_fx, /* i/o: psfiler Q_syn*/ Word16 *st_pst_mem_deemp_err_fx, /* i/o: psfiler Q_syn*/ - Word16 *mem_agc, /*Q_syn*/ + Word16 *mem_agc, /* Q_syn */ PFSTAT *pf_stat, /* i/o: All memories related to NB post filter */ - const Word16 *tmp_buffer /* tmp_buffer in Q-1 */ - , - Word16 *mem_tmp2 /* Temporary memory used with scale_syn Q_syn*/ + const Word16 *tmp_buffer, /* tmp_buffer in Q-1 */ + Word16 *mem_tmp2 /* Temporary memory used with scale_syn Q_syn*/ ) { Word16 exc16[DCT_L_POST]; diff --git a/lib_dec/arith_coder_dec_fx.c b/lib_dec/arith_coder_dec_fx.c index 479d35a842b458141c09685a8d1cd4c0877489bb..2919210dc2aab107d81789eb08cf8149730fb927 100644 --- a/lib_dec/arith_coder_dec_fx.c +++ b/lib_dec/arith_coder_dec_fx.c @@ -106,9 +106,8 @@ void tcx_arith_decode_envelope_fx( Word16 tcxltp_pitch, /* i: TCX LTP pitch in FD, -1 if n/a Q0*/ Word16 *arith_bits, /* o: bits used for ari. coding Q0 */ Word16 *signaling_bits, /* o: bits used for signaling Q0 */ - Word16 *nf_seed /* o: noise filling seed Q0 */ - , - Word16 low_complexity /* i: low-complexity flag Q0 */ + Word16 *nf_seed, /* o: noise filling seed Q0 */ + Word16 low_complexity /* i: low-complexity flag Q0 */ ) { Word32 env[N_MAX_ARI]; /* unscaled envelope */ @@ -146,7 +145,6 @@ void tcx_arith_decode_envelope_fx( return; } - *signaling_bits = 0; move16(); assert( st->hTcxDec->enableTcxLpc ); diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index 68f7f02f39a92bc42b8f642461d8a87661dcf817..ee8273a7b1b169da8679322e3ec9942974edaadd 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -622,14 +622,11 @@ void decoder_tcx_fx( test(); IF( ( bfi == 0 ) && ( hTcxCfg->resq != 0 ) ) { - IF( hTcxDec->tcx_lpc_shaped_ari != 0 ) /* new arithmetic coder */ { - Word16 *prm_resq; - prm_resq = prm_sqQ + sub( *prm_target /* = targetBits */ - , + prm_resq = prm_sqQ + sub( *prm_target, /* = targetBits */ hTcxDec->resQBits[frame_cnt] ); i = tcx_ari_res_invQ_spec( x, x_e, L_spec, @@ -663,7 +660,6 @@ void decoder_tcx_fx( } /* for FAC */ - test(); IF( bfi == 0 && st->tcxonly == 0 ) { @@ -733,7 +729,6 @@ void decoder_tcx_fx( } } - IF( hTcxDec->tcx_lpc_shaped_ari == 0 ) /* old arithmetic coder */ { /* noise filling seed */ @@ -3323,7 +3318,7 @@ void IMDCT_ivas_fx( move32(); } q_tmp_fx_32 = sub( q_xn_buf_fx_32, res_e ); - // v_multc_fixed( xn_buf_fx_32 + overlap / 2 + nz, (float) sqrt( (float) L_frame / NORM_MDCT_FACTOR ), tmp_fx_32, L_frame ); + // v_multc_fx( xn_buf_fx_32 + overlap / 2 + nz, (float) sqrt( (float) L_frame / NORM_MDCT_FACTOR ), tmp_fx_32, L_frame ); if ( allow_qwin_change ) { @@ -4093,7 +4088,7 @@ void decoder_tcx_ivas_fx( *-------------------------------------------------------------------*/ void decoder_tcx_invQ_fx( Decoder_State *st, /* i/o: coder memory state */ - int16_t prm[], /* i : parameters */ + Word16 prm[], /* i : parameters */ Word16 A[], /* i : coefficients NxAz[M+1] */ Word16 Aind[], /* i : frame-independent coefficients Az[M+1] */ const Word16 L_spec, @@ -4728,7 +4723,7 @@ void decoder_tcx_noisefilling_fx( *-----------------------------------------------------------------*/ /* Init lengths */ - infoIGFStartLine = get_igf_startline( st, L_frame, L_frameTCX ); + infoIGFStartLine = get_igf_startline_fx( st, L_frame, L_frameTCX ); noiseFillingSize = L_spec; move16(); diff --git a/lib_dec/dlpc_avq_fx.c b/lib_dec/dlpc_avq_fx.c index 07f1ea6f21206fa6b7d77d2886afc525462e6f85..4be63062f666f69a378635d29c244b182a670ae1 100644 --- a/lib_dec/dlpc_avq_fx.c +++ b/lib_dec/dlpc_avq_fx.c @@ -285,10 +285,9 @@ Word16 decode_lpc_avq_fx( } Word16 decode_lpc_avq_ivas_fx( - Decoder_State *st, /* i/o: decoder state structure */ - const Word16 numlpc, /* i : Number of sets of lpc */ - Word16 *param_lpc /* o : lpc parameters */ - , + Decoder_State *st, /* i/o: decoder state structure */ + const Word16 numlpc, /* i : Number of sets of lpc */ + Word16 *param_lpc, /* o : lpc parameters */ const Word16 ch, /* i : channel */ const Word16 element_mode, /* i : element mode */ const Word16 sns_low_br_mode /* i : SNS low-bitrate mode */ diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index 850767d3e05a7f42770eedbbeecfbba05645d9c6..d8805c4f268703c5b33ae3d35f456b6e61aa3a6a 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -3642,9 +3642,8 @@ void generate_comfort_noise_dec_hf_ivas_fx( void generate_masking_noise_fx( Word16 *timeDomainBuffer, /* i/o : pointer to time domain output buffer 15Q0 */ Word16 Q, - HANDLE_FD_CNG_COM hFdCngCom /* i/o : pointer to FD_CNG_COM structure */ - , - Word16 length, /*Q0*/ + HANDLE_FD_CNG_COM hFdCngCom, /* i/o : pointer to FD_CNG_COM structure */ + Word16 length, /*Q0*/ Word16 core /*Q0*/ ) { Word16 i, s, s1, s2, sq, cnt, startBand2, stopFFTbin2; @@ -3856,10 +3855,9 @@ void generate_masking_noise_update_seed_fx( * Generate additional comfort noise (kind of noise filling) * ************************************************************/ void generate_masking_noise_mdct_fx( - Word32 *mdctBuffer, /* i/o: time-domain signal Q31 - mdctBuffer_e*/ - Word16 *mdctBuffer_e, /* i/o: exponent time-domain signal */ - HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */ - , + Word32 *mdctBuffer, /* i/o: time-domain signal Q31 - mdctBuffer_e*/ + Word16 *mdctBuffer_e, /* i/o: exponent time-domain signal */ + HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ Word16 L_frame ) { Word16 i, s, s1, s2, sq, cnt; @@ -4113,12 +4111,12 @@ void generate_masking_noise_mdct_ivas_fx( } /*re-normalization of energy level: M/sqrt(2)*/ - v_multc_fixed( maskingNoise, SQRT_NORM_MDCT_FACTOR_Q27, maskingNoise, hFdCngCom->stopFFTbin ); // Q11 + v_multc_fx( maskingNoise, SQRT_NORM_MDCT_FACTOR_Q27, maskingNoise, hFdCngCom->stopFFTbin ); // Q11 scale_sig32( maskingNoise, hFdCngCom->stopFFTbin, sub( 20, *mdctBuffer_e ) ); // exp = *mdctBuffer_e /* Add some comfort noise on top of decoded signal */ - v_add_fixed( maskingNoise, mdctBuffer, mdctBuffer, hFdCngCom->stopFFTbin, 1 ); + v_add_fx_hdrm( maskingNoise, mdctBuffer, mdctBuffer, hFdCngCom->stopFFTbin, 1 ); *mdctBuffer_e = sub( *mdctBuffer_e, 1 ); move16(); } @@ -4659,7 +4657,7 @@ void generate_masking_noise_ivas_fx( } ELSE { - v_add_fixed_no_hdrm( maskingNoise_fx, timeDomainBuffer, timeDomainBuffer, s_min( hFdCngCom->frameSize, length ) ); /*Q31 - *exp_out*/ + v_add_fx_no_hdrm( maskingNoise_fx, timeDomainBuffer, timeDomainBuffer, s_min( hFdCngCom->frameSize, length ) ); /*Q31 - *exp_out*/ } return; diff --git a/lib_dec/gs_dec_amr_wb_fx.c b/lib_dec/gs_dec_amr_wb_fx.c index eea37431a865aba1ec1ddcc180a859525f672e45..4a0bf352fab3e016e426fa83dbf34ed89d4259ee 100644 --- a/lib_dec/gs_dec_amr_wb_fx.c +++ b/lib_dec/gs_dec_amr_wb_fx.c @@ -122,8 +122,7 @@ static void Ener_per_band_fx( static void Apply_gain_fx( Word16 exc_diffQ_fx[], /* i/o: Quantized excitation Qx*/ Word32 L_Ener_per_bd_iQ[], /* i : Target ener per band Q16*/ - Word32 L_Ener_per_bd_yQ[] /* i : Ener per band for norm vector Qx*/ - , + Word32 L_Ener_per_bd_yQ[], /* i : Ener per band for norm vector Qx*/ const Word16 Q_out ) { Word16 i_band; diff --git a/lib_dec/hq_core_dec_fx.c b/lib_dec/hq_core_dec_fx.c index 5153215dbc021b5fe2ade623fbf2b8e0dea68933..e30fb0ec22cc962b64d9c472ae20a9fd65bde639 100644 --- a/lib_dec/hq_core_dec_fx.c +++ b/lib_dec/hq_core_dec_fx.c @@ -892,7 +892,7 @@ void ivas_hq_core_dec_fx( { /* Rough resampling, but reduces energy loss in case of switch to ACELP in first good frame */ L_lerp_fx_q11( t_audio_q, wtda_audio_LB, st_fx->L_frame, inner_frame ); - v_multc_fixed_16( t_audio_q, ONE_IN_Q14, wtda_audio_LB, st_fx->L_frame ); + v_multc_fx_16( t_audio_q, ONE_IN_Q14, wtda_audio_LB, st_fx->L_frame ); Q_audio = 15; move16(); } @@ -903,7 +903,7 @@ void ivas_hq_core_dec_fx( tmp = Sqrt16( tmp, &tmp_e ); ener_match = shr( tmp, sub( 2, tmp_e ) ); // Q13 - v_multc_fixed_16( t_audio_q, ener_match, t_audio_q, inner_frame ); // Q10 + v_multc_fx_16( t_audio_q, ener_match, t_audio_q, inner_frame ); // Q10 Scale_sig32( t_audio_q, inner_frame, Q2 ); // Q10 + Q2 Q_audio = Q_G_audio; diff --git a/lib_dec/hq_env_dec_fx.c b/lib_dec/hq_env_dec_fx.c index 7c5af1b2aa8d796a21141a34e20bdce3601d41d0..5011dcf86f35da45f47522514903eafdad35afd7 100644 --- a/lib_dec/hq_env_dec_fx.c +++ b/lib_dec/hq_env_dec_fx.c @@ -13,15 +13,15 @@ * Decode envelope indices *------------------------------------------------------------------------*/ -Word16 decode_envelope_indices_fx( /* o : Number of bits Q0*/ - Decoder_State *st_fx, /* i/o: decoder state structure */ - const Word16 start_norm, /* i : starting band index Q0*/ - const Word16 num_sfm, /* i : Number of subbands Q0*/ - const Word16 numnrmibits, /* i : Bitrate of fall-back coding mode Q0*/ - Word16 *difidx, /* o : Diff indices/encoded diff indices Q0*/ - const Word16 flag_HQ2 /* i : indicator of HQ2 core Q0*/ - , - const Word16 is_transient /* i : indicator of HQ_TRANSIENT Q0*/ +/* o : Number of bits Q0*/ +Word16 decode_envelope_indices_fx( + Decoder_State *st_fx, /* i/o: decoder state structure */ + const Word16 start_norm, /* i : starting band index Q0*/ + const Word16 num_sfm, /* i : Number of subbands Q0*/ + const Word16 numnrmibits, /* i : Bitrate of fall-back coding mode Q0*/ + Word16 *difidx, /* o : Diff indices/encoded diff indices Q0*/ + const Word16 flag_HQ2, /* i : indicator of HQ2 core Q0*/ + const Word16 is_transient /* i : indicator of HQ_TRANSIENT Q0*/ ) { Word16 hcode_l; diff --git a/lib_dec/igf_dec_fx.c b/lib_dec/igf_dec_fx.c index 9f2d3baf2270b4167bcd89dfd930225806cb20f9..90fc5669c8c699bc0978b14fcca2c6f09e8ae250 100644 --- a/lib_dec/igf_dec_fx.c +++ b/lib_dec/igf_dec_fx.c @@ -909,9 +909,9 @@ static void IGF_prepStereo( H_IGF_INFO hInfoL, hInfoR; Word16 tb, sfb, strt_cpy, tile_idx; Word16 *swb_offset; - const Word32 c_fx = SQRT2_OVER_2_FIXED; // Q31 - Word16 selectionL = 0; // 0 -> IGF, 1 -> pSpecFlat - Word16 selectionR = 0; // 0 -> IGF, 1 -> pSpecFlat + const Word32 c_fx = SQRT2_OVER_2_FX; // Q31 + Word16 selectionL = 0; // 0 -> IGF, 1 -> pSpecFlat + Word16 selectionR = 0; // 0 -> IGF, 1 -> pSpecFlat move32(); move16(); move16(); @@ -4098,16 +4098,17 @@ void IGFDecReplicateTCX10State_fx( /**********************************************************************/ /* copy the LPC flat spectrum to IGF buffer **************************************************************************/ -void IGFDecCopyLPCFlatSpectrum( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Decoder */ - const Word32 *pSpectrumFlat, /**< in: Q31 | LPC flattend spectrum from TCX dec */ - const Word16 pSpectrumFlat_exp, /**< in: | exponent of pSpectrumFlat */ - const Word16 igfGridIdx /**< in: Q0 | IGF grid index */ + +void IGFDecCopyLPCFlatSpectrum( + const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Decoder */ + const Word32 *pSpectrumFlat, /**< in: Q31 | LPC flattend spectrum from TCX dec */ + const Word16 pSpectrumFlat_exp, /**< in: | exponent of pSpectrumFlat */ + const Word16 igfGridIdx /**< in: Q0 | IGF grid index */ ) { IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData; H_IGF_GRID hGrid; - IF( hInstance ) { hPrivateData = &hInstance->igfData; @@ -4120,6 +4121,8 @@ void IGFDecCopyLPCFlatSpectrum( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in Copy32( pSpectrumFlat, hPrivateData->pSpecFlat, hGrid->startLine ); } + + return; } void IGFDecCopyLPCFlatSpectrum_fx( @@ -4144,13 +4147,18 @@ void IGFDecCopyLPCFlatSpectrum_fx( Copy_Scale_sig32( pSpectrumFlat, hPrivateData->pSpecFlat, hGrid->startLine, sub( pSpectrumFlat_exp, 20 ) ); // Q11 } + + return; } -/**********************************************************************/ /* - store the IGF bitstream information for TCX10 subframes - **************************************************************************/ -void IGFDecStoreTCX10SubFrameData( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Decoder */ - const Word16 subFrameIdx /**< in: Q0 | index of subframe */ + +/**********************************************************************/ /* +store the IGF bitstream information for TCX10 subframes +**************************************************************************/ + +void IGFDecStoreTCX10SubFrameData( + const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Decoder */ + const Word16 subFrameIdx /**< in: Q0 | index of subframe */ ) { IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData; @@ -4168,13 +4176,18 @@ void IGFDecStoreTCX10SubFrameData( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< /* store flattening trigger for current subframe */ hPrivateData->igf_flatteningTrigger_subframe[subFrameIdx] = hInstance->flatteningTrigger; move16(); + + return; } -/**********************************************************************/ /* - restore the IGF bitstream information for TCX10 subframes - **************************************************************************/ -void IGFDecRestoreTCX10SubFrameData( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Decoder */ - const Word16 subFrameIdx /**< in: Q0 | index of subframe */ + +/**********************************************************************/ /* +restore the IGF bitstream information for TCX10 subframes +**************************************************************************/ + +void IGFDecRestoreTCX10SubFrameData( + const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Decoder */ + const Word16 subFrameIdx /**< in: Q0 | index of subframe */ ) { IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData; @@ -4225,11 +4238,13 @@ void IGFDecRestoreTCX10SubFrameData_fx( return; } + /*-----------------------------------------------------------------------* * init_igf_dec() * * Initialize IGF decoder parameters *-----------------------------------------------------------------------*/ + void init_igf_dec( IGF_DEC_INSTANCE_HANDLE hIGFDec /* i/o: IGF decoder handle */ ) @@ -4276,7 +4291,14 @@ void init_igf_dec( return; } -Word16 get_igf_startline( + +/*-----------------------------------------------------------------------* + * init_igget_igf_startline() + * + * + *-----------------------------------------------------------------------*/ + +Word16 get_igf_startline_fx( Decoder_State *st, /* i : decoder state */ const Word16 L_frame, /* i : length of the frame */ const Word16 L_frameTCX /* i : full band frame length */ diff --git a/lib_dec/ivas_binRenderer_internal_fx.c b/lib_dec/ivas_binRenderer_internal_fx.c index 87f4807048a130c8e9f85821795f1af73750dd65..70e288ba31ad46a3f8ab5fa3535d4d8da892973d 100644 --- a/lib_dec/ivas_binRenderer_internal_fx.c +++ b/lib_dec/ivas_binRenderer_internal_fx.c @@ -56,8 +56,14 @@ #define NUM_TAPS_F0_3 ( Word16 )( 29 ) // (Word16) ceil( 0.3f * hBinRenConvModule->numTaps ) #define REVERB_INPUT_DOWNMIX_CHANNELS ( 11 ) + +#define NUM_TAPS_F0_6 ( Word16 )( 58 ) // (Word16) ceil( 0.6f * hBinRenConvModule->numTaps ) +#define NUM_TAPS_F0_5 ( Word16 )( 48 ) // (Word16) ceil( 0.5f * hBinRenConvModule->numTaps ) +#define NUM_TAPS_F0_4 ( Word16 )( 39 ) // (Word16) ceil( 0.4f * hBinRenConvModule->numTaps ) +#define NUM_TAPS_F0_3 ( Word16 )( 29 ) // (Word16) ceil( 0.3f * hBinRenConvModule->numTaps ) + /* Downmix table for sparse frequency domain reverberator*/ -const Word32 dmxmtx_table_fx[BINAURAL_CHANNELS][REVERB_INPUT_DOWNMIX_CHANNELS] = { +static const Word32 dmxmtx_table_fx[BINAURAL_CHANNELS][REVERB_INPUT_DOWNMIX_CHANNELS] = { // Q31 { 0x7fffffff, 0, 1518485623, 0x7fffffff, 0, 0x7fffffff, 0, 0x7fffffff, 0, 0x7fffffff, 0 }, { 0, 0x7fffffff, 1518485623, 0, 0x7fffffff, 0, 0x7fffffff, 0, 0x7fffffff, 0, 0x7fffffff }, @@ -69,6 +75,7 @@ const Word32 dmxmtx_table_fx[BINAURAL_CHANNELS][REVERB_INPUT_DOWNMIX_CHANNELS] = * * *-------------------------------------------------------------------------*/ + static void ivas_binRenderer_filterModule_fx( Word32 out_Conv_CLDFB_real[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : real part of Binaural signals Q6 */ Word32 out_Conv_CLDFB_imag[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : imag part of Binaural signals Q6 */ @@ -168,11 +175,13 @@ static void ivas_binRenderer_filterModule_fx( return; } + /*------------------------------------------------------------------------- * ivas_binRenderer_convModuleOpen() * * Open convolution module handle of fastconv binaural renderer *-------------------------------------------------------------------------*/ + static ivas_error ivas_binRenderer_convModuleOpen( BINAURAL_RENDERER_HANDLE hBinRenderer, const Word16 renderer_type, @@ -324,7 +333,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } - FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) { IF( ( hBinRenConvModule->filterStatesLeftReal_fx[pos_idx][bandIdx] = (Word32 **) malloc( hBinRenderer->nInChannels * sizeof( Word32 * ) ) ) == NULL ) @@ -951,6 +959,7 @@ static void ivas_binaural_obtain_DMX_fx( } } } + IF( NE_16( hBinRenderer->nInChannels, HOA3_CHANNELS ) ) { *Q_in_out = sub( *Q_in_out, 1 ); @@ -1211,12 +1220,11 @@ ivas_error ivas_binRenderer_open_fx( { pRoomAcoustics = &( st_ivas->hRenderConfig->roomAcoustics ); } + IF( NE_32( ( error = ivas_binaural_reverb_init_fx( &( hBinRenderer->hReverb ), st_ivas->hHrtfStatistics, hBinRenderer->conv_band, hBinRenderer->timeSlots, pRoomAcoustics, st_ivas->hDecoderConfig->output_Fs, st_ivas->hHrtfFastConv->fastconvReverberationTimes_fx, st_ivas->hHrtfFastConv->fastconvReverberationEneCorrections_fx, NULL ) ), IVAS_ERR_OK ) ) { return error; } - - /* initialize the dmx matrix */ } ELSE { @@ -1346,11 +1354,13 @@ static void ivas_binRenderer_convModuleClose_fx( return; } + /*------------------------------------------------------------------------- * ivas_binRenderer_close() * * Close fastconv binaural renderer memories *------------------------------------------------------------------------*/ + void ivas_binRenderer_close_fx( BINAURAL_RENDERER_HANDLE *hBinRenderer /* i/o: fastconv binaural renderer handle */ ) @@ -1377,11 +1387,13 @@ void ivas_binRenderer_close_fx( return; } + /*------------------------------------------------------------------------- * ivas_free_pppHrtfMem() * * Free fastconv binaural renderer hrtf memories *------------------------------------------------------------------------*/ + static void ivas_free_pppHrtfMem_fx( Word32 ****ppppHRIR, /*Qx*/ const Word16 dim, @@ -1497,7 +1509,8 @@ void ivas_binaural_add_LFE_fx( } FOR( idx_lfe = 0; idx_lfe < st_ivas->hIntSetup.num_lfe; idx_lfe++ ) { - v_multc_fixed_16( input_fx[st_ivas->hIntSetup.index_lfe[idx_lfe]], gain_fx, lfe_tc, output_frame ); // q_input_fx - 1 + v_multc_fx_16( input_fx[st_ivas->hIntSetup.index_lfe[idx_lfe]], gain_fx, lfe_tc, output_frame ); // q_input_fx - 1 + /* copy LFE to left and right channels */ FOR( idx = 0; idx < output_frame; idx++ ) { @@ -1514,6 +1527,7 @@ void ivas_binaural_add_LFE_fx( return; } + /*------------------------------------------------------------------------- * ivas_binRenderer_fx() * @@ -1565,13 +1579,13 @@ void ivas_binRenderer_fx( /* Rotation in SHD (HOA3) */ IF( EQ_16( hCombinedOrientationData->shd_rot_max_order, -1 ) ) { - rotateFrame_shd_cldfb( RealBuffer_fx, ImagBuffer_fx, hCombinedOrientationData->Rmat_fx[hCombinedOrientationData->subframe_idx], hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, 3 ); + rotateFrame_shd_cldfb_fx( RealBuffer_fx, ImagBuffer_fx, hCombinedOrientationData->Rmat_fx[hCombinedOrientationData->subframe_idx], hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, 3 ); *Q_in = sub( *Q_in, 1 ); //( Q_in + 14 - 15 ) move16(); } ELSE IF( hCombinedOrientationData->shd_rot_max_order > 0 ) { - rotateFrame_shd_cldfb( RealBuffer_fx, ImagBuffer_fx, hCombinedOrientationData->Rmat_fx[hCombinedOrientationData->subframe_idx], hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, hCombinedOrientationData->shd_rot_max_order ); + rotateFrame_shd_cldfb_fx( RealBuffer_fx, ImagBuffer_fx, hCombinedOrientationData->Rmat_fx[hCombinedOrientationData->subframe_idx], hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, hCombinedOrientationData->shd_rot_max_order ); *Q_in = sub( *Q_in, 1 ); //( Q_in + 14 - 15 ) move16(); } @@ -1579,8 +1593,8 @@ void ivas_binRenderer_fx( ELSE { /* Rotation in SD (CICPx) */ - rotateFrame_sd_cldfb_fixed( hCombinedOrientationData->Rmat_fx[hCombinedOrientationData->subframe_idx], RealBuffer_fx, ImagBuffer_fx, - hBinRenderer->hInputSetup, hBinRenderer->hEFAPdata, numTimeSlots, hBinRenderer->conv_band ); + rotateFrame_sd_cldfb_fx( hCombinedOrientationData->Rmat_fx[hCombinedOrientationData->subframe_idx], RealBuffer_fx, ImagBuffer_fx, + hBinRenderer->hInputSetup, hBinRenderer->hEFAPdata, numTimeSlots, hBinRenderer->conv_band ); } } @@ -1591,8 +1605,8 @@ void ivas_binRenderer_fx( IF( hBinRenderer->hInputSetup->is_loudspeaker_setup == 0 && ( NE_16( hBinRenderer->nInChannels, HOA3_CHANNELS ) && NE_16( hBinRenderer->nInChannels, HOA2_CHANNELS ) && NE_16( hBinRenderer->nInChannels, FOA_CHANNELS ) ) ) { - ivas_sba2mc_cldfb_fixed( *( hBinRenderer->hInputSetup ), RealBuffer_fx, ImagBuffer_fx, - hBinRenderer->nInChannels, hBinRenderer->conv_band, numTimeSlots, hBinRenderer->hoa_dec_mtx ); + ivas_sba2mc_cldfb_fx( *( hBinRenderer->hInputSetup ), RealBuffer_fx, ImagBuffer_fx, + hBinRenderer->nInChannels, hBinRenderer->conv_band, numTimeSlots, hBinRenderer->hoa_dec_mtx ); } ivas_binRenderer_filterModule_fx( Cldfb_RealBuffer_Binaural_fx[0], Cldfb_ImagBuffer_Binaural_fx[0], RealBuffer_fx, ImagBuffer_fx, numTimeSlots, hBinRenderer, 0, *Q_in ); @@ -1653,11 +1667,11 @@ void ivas_binRenderer_fx( IF( hBinRenderer->hInputSetup->is_loudspeaker_setup ) { - rotateFrame_sd_cldfb_fixed( Rmat_local, RealBuffer_fx, ImagBuffer_fx, hBinRenderer->hInputSetup, hBinRenderer->hEFAPdata, numTimeSlots, hBinRenderer->conv_band ); + rotateFrame_sd_cldfb_fx( Rmat_local, RealBuffer_fx, ImagBuffer_fx, hBinRenderer->hInputSetup, hBinRenderer->hEFAPdata, numTimeSlots, hBinRenderer->conv_band ); } ELSE { - rotateFrame_shd_cldfb( RealBuffer_fx, ImagBuffer_fx, Rmat_local, hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, hBinRenderer->hInputSetup->ambisonics_order ); + rotateFrame_shd_cldfb_fx( RealBuffer_fx, ImagBuffer_fx, Rmat_local, hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, hBinRenderer->hInputSetup->ambisonics_order ); } ivas_binRenderer_filterModule_fx( Cldfb_RealBuffer_Binaural_fx[pos_idx], Cldfb_ImagBuffer_Binaural_fx[pos_idx], RealBuffer_fx, ImagBuffer_fx, numTimeSlots, hBinRenderer, pos_idx, *Q_in ); @@ -1736,6 +1750,7 @@ void ivas_binRenderer_fx( return; } + /*------------------------------------------------------------------------- * ivas_rend_CldfbMultiBinRendProcess() * @@ -1755,8 +1770,8 @@ void ivas_rend_CldfbMultiBinRendProcess( const Word16 Q_in /* i : LS signals exp */ ) { - int16_t slot_idx, ch_idx, idx, pose_idx, i, j; - int16_t sf_idx; + Word16 slot_idx, ch_idx, idx, pose_idx, i, j; + Word16 sf_idx; Word32 Cldfb_RealBuffer_sfIn[MAX_INPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; Word32 Cldfb_ImagBuffer_sfIn[MAX_INPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; Word32 Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index 6d36b342903b909194a52f873911e86a8ebbcc85..f252f760cddeb0be80ade8389b475c164796e93b 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -960,11 +960,14 @@ static ivas_error ivas_dirac_rend_config_fx( return error; } + + /*------------------------------------------------------------------------- * ivas_dirac_dec_config() * * Open or reconfigure decoder DirAC/MASA handle *-------------------------------------------------------------------------*/ + ivas_error ivas_dirac_dec_config_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const DIRAC_CONFIG_FLAG flag_config_inp /* i/ : Flag determining if we open or reconfigure the DirAC decoder */ @@ -1195,15 +1198,16 @@ ivas_error ivas_dirac_dec_config_fx( } } - return error; } + /*------------------------------------------------------------------------- * ivas_dirac_dec_close() * * Close DirAC memories *------------------------------------------------------------------------*/ + void ivas_dirac_dec_close_fx( DIRAC_DEC_HANDLE *hDirAC_out ) { @@ -1229,11 +1233,14 @@ void ivas_dirac_dec_close_fx( return; } + + /*------------------------------------------------------------------------- * ivas_dirac_dec_read_BS_fx() * * Read DirAC parameters from the bitstream *------------------------------------------------------------------------*/ + void ivas_dirac_dec_read_BS_fx( const Word32 ivas_total_brate, /* i : IVAS total bitrate */ Decoder_State *st, /* i/o: decoder state structure */ @@ -1288,6 +1295,7 @@ void ivas_dirac_dec_read_BS_fx( *nb_bits = add( *nb_bits, ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), nchan_transport, NULL, SBA_FORMAT ) ); move16(); + FOR( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth_fx[i] = hQMetaData->q_direction[0].band_data[1].azimuth_fx[0]; @@ -1415,11 +1423,14 @@ void ivas_dirac_dec_read_BS_fx( return; } + + /*-----------------------------------------------------------------------* * ivas_qmetadata_to_dirac() * * Copy qmetedata to DirAC parameters for rendering *-----------------------------------------------------------------------*/ + void ivas_qmetadata_to_dirac_fx( const IVAS_QMETADATA_HANDLE hQMetaData, /* i : frame of MASA q_metadata */ DIRAC_DEC_HANDLE hDirAC, /* i : DirAC decoder structure */ @@ -1847,7 +1858,6 @@ void ivas_qmetadata_to_dirac_fx( move16(); } - hSpatParamRendCom->energy_ratio1_fx[tmp_write_idx_band][b] = q_direction->band_data[qBand_idx].energy_ratio_fx[0]; move32(); hSpatParamRendCom->diffuseness_vector_fx[tmp_write_idx_band][b] = diffuseness_fx; @@ -1924,97 +1934,16 @@ void ivas_qmetadata_to_dirac_fx( /* update buffer write index */ hSpatParamRendCom->dirac_bs_md_write_idx = add( hSpatParamRendCom->dirac_bs_md_write_idx, MAX_PARAM_SPATIAL_SUBFRAMES ) % hSpatParamRendCom->dirac_md_buffer_length; move16(); + return; } + + /*------------------------------------------------------------------------- * ivas_dirac_dec_set_md_map() * * Set metadata index mapping for DirAC *------------------------------------------------------------------------*/ -void ivas_dirac_dec_set_md_map( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const Word16 nCldfbTs /* i : number of CLDFB time slots */ -) -{ - Word16 num_slots_in_subfr; - DIRAC_DEC_HANDLE hDirAC; - SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; - - hDirAC = st_ivas->hDirAC; - hSpatParamRendCom = st_ivas->hSpatParamRendCom; - - /* adapt subframes */ - hSpatParamRendCom->num_slots = nCldfbTs; - move16(); - hSpatParamRendCom->slots_rendered = 0; - move16(); - num_slots_in_subfr = CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES; - move16(); - hSpatParamRendCom->subframes_rendered = 0; - move16(); - - ivas_jbm_dec_get_adapted_subframes( nCldfbTs, hSpatParamRendCom->subframe_nbslots, &hSpatParamRendCom->nb_subframes ); - - /* copy also to tc buffer */ - /* only for non-combined formats and combinded formats w/o discrete objects */ - test(); - test(); - test(); - IF( ( NE_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) || NE_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) && !( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) ) - { - st_ivas->hTcBuffer->nb_subframes = hSpatParamRendCom->nb_subframes; - move16(); - Copy( hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, hSpatParamRendCom->nb_subframes ); - } - - /* set mapping according to dirac_read_idx */ - - set16_fx( hSpatParamRendCom->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); - - test(); - test(); - IF( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) ) - { - ivas_jbm_dec_get_md_map_even_spacing( nCldfbTs, num_slots_in_subfr, 0, hSpatParamRendCom->dirac_md_buffer_length, hSpatParamRendCom->render_to_md_map ); - } - ELSE IF( hDirAC == NULL || hDirAC->hConfig == NULL || hDirAC->hConfig->dec_param_estim == 0 ) - { - ivas_jbm_dec_get_md_map( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbTs, num_slots_in_subfr, 0, hSpatParamRendCom->dirac_md_buffer_length, hSpatParamRendCom->render_to_md_map ); - } - ELSE - { - ivas_jbm_dec_get_md_map( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbTs, num_slots_in_subfr, hSpatParamRendCom->dirac_read_idx, hSpatParamRendCom->dirac_md_buffer_length, hSpatParamRendCom->render_to_md_map ); - } - - test(); - test(); - IF( hDirAC == NULL || hDirAC->hConfig == NULL || hDirAC->hConfig->dec_param_estim == 0 ) - { - Word64 tmp_fx; - Word16 sf_idx, slot_idx, slot_idx_abs; - Word32 quo, rem; - - slot_idx_abs = 0; - move16(); - FOR( sf_idx = 0; sf_idx < hSpatParamRendCom->nb_subframes; sf_idx++ ) - { - tmp_fx = 0; - move64(); - FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[sf_idx]; slot_idx++ ) - { - tmp_fx = W_add_nosat( tmp_fx, W_deposit32_l( L_deposit_l( hSpatParamRendCom->render_to_md_map[slot_idx_abs] ) ) ); - slot_idx_abs = add( slot_idx_abs, 1 ); - } - iDiv_and_mod_32( W_shl_sat_l( tmp_fx, 16 ), hSpatParamRendCom->subframe_nbslots[sf_idx], &quo, &rem, 0 ); - hSpatParamRendCom->render_to_md_map[sf_idx] = add( round_fx( quo ), hSpatParamRendCom->dirac_read_idx ) % hSpatParamRendCom->dirac_md_buffer_length; - move16(); - } - - set16_fx( &hSpatParamRendCom->render_to_md_map[hSpatParamRendCom->nb_subframes], 0, sub( MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME, hSpatParamRendCom->nb_subframes ) ); - } - - return; -} void ivas_dirac_dec_set_md_map_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ @@ -2053,7 +1982,6 @@ void ivas_dirac_dec_set_md_map_fx( } /* set mapping according to dirac_read_idx */ - set16_fx( hSpatParamRendCom->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); test(); @@ -2410,7 +2338,6 @@ void ivas_dirac_dec_render_sf_fx( } } - hDirAC = st_ivas->hDirAC; hDirACRend = st_ivas->hDirACRend; hSpatParamRendCom = st_ivas->hSpatParamRendCom; @@ -2505,7 +2432,6 @@ void ivas_dirac_dec_render_sf_fx( move16(); } - test(); test(); IF( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ) @@ -3172,12 +3098,13 @@ void ivas_dirac_dec_render_sf_fx( hDirACRend->q_buffer_energy[index - 1] = DirAC_mem.reference_power_q[0]; move16(); - computeDiffuseness_fixed( hDirACRend->buffer_intensity_real_fx, hDirACRend->buffer_energy_fx, num_freq_bands, hSpatParamRendCom->diffuseness_vector_fx[md_idx], hDirACRend->q_buffer_intensity_real, hDirACRend->q_buffer_energy, &hSpatParamRendCom->q_diffuseness_vector ); + computeDiffuseness_fx( hDirACRend->buffer_intensity_real_fx, hDirACRend->buffer_energy_fx, num_freq_bands, hSpatParamRendCom->diffuseness_vector_fx[md_idx], hDirACRend->q_buffer_intensity_real, hDirACRend->q_buffer_energy, &hSpatParamRendCom->q_diffuseness_vector ); } /*-----------------------------------------------------------------* * frequency domain decorrelation *-----------------------------------------------------------------*/ + IF( EQ_16( hDirACRend->proto_signal_decorr_on, 1 ) ) { /* decorrelate prototype frame */ @@ -3198,9 +3125,9 @@ void ivas_dirac_dec_render_sf_fx( hDirACRend->h_freq_domain_decorr_ap_params, hDirACRend->h_freq_domain_decorr_ap_state ); - v_multc_fixed( onset_filter_fx, 536870912 /* 0.25f in Q31 */, onset_filter_fx, hSpatParamRendCom->num_freq_bands ); + v_multc_fx( onset_filter_fx, 536870912 /* 0.25f in Q31 */, onset_filter_fx, hSpatParamRendCom->num_freq_bands ); - v_add_fixed_no_hdrm( onset_filter_fx, onset_filter_subframe_fx, onset_filter_subframe_fx, hSpatParamRendCom->num_freq_bands ); /* Q31 */ + v_add_fx_no_hdrm( onset_filter_fx, onset_filter_subframe_fx, onset_filter_subframe_fx, hSpatParamRendCom->num_freq_bands ); /* Q31 */ p_onset_filter_fx = onset_filter_subframe_fx; } ELSE @@ -3254,6 +3181,7 @@ void ivas_dirac_dec_render_sf_fx( /*-----------------------------------------------------------------* * output synthesis *-----------------------------------------------------------------*/ + test(); IF( ( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_LS ) || EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_SHD ) ) ) { @@ -3373,15 +3301,15 @@ void ivas_dirac_dec_render_sf_fx( IF( NE_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { - v_add_fixed_me( reference_power_fx, sub( 31, DirAC_mem.reference_power_q[0] ), - reference_power_smooth_fx, sub( 31, q_reference_power_smooth[0] ), - reference_power_smooth_fx, &temp_q, - s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), 1 ); + v_add_fx_me( reference_power_fx, sub( 31, DirAC_mem.reference_power_q[0] ), + reference_power_smooth_fx, sub( 31, q_reference_power_smooth[0] ), + reference_power_smooth_fx, &temp_q, + s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), 1 ); q_reference_power_smooth[0] = sub( 31, temp_q ); - v_add_fixed_me( reference_power_fx + CLDFB_NO_CHANNELS_HALF, sub( 31, DirAC_mem.reference_power_q[1] ), - reference_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, sub( 31, q_reference_power_smooth[1] ), - reference_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, &temp_q, - s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), 1 ); + v_add_fx_me( reference_power_fx + CLDFB_NO_CHANNELS_HALF, sub( 31, DirAC_mem.reference_power_q[1] ), + reference_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, sub( 31, q_reference_power_smooth[1] ), + reference_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, &temp_q, + s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), 1 ); q_reference_power_smooth[1] = sub( 31, temp_q ); } } @@ -3830,7 +3758,8 @@ void ivas_dirac_dec_render_sf_fx( Word16 az_q0 = extract_l( L_shr( st_ivas->hIsmMetaData[i]->azimuth_fx, Q22 ) ); Word16 el_q0 = extract_l( L_shr( st_ivas->hIsmMetaData[i]->elevation_fx, Q22 ) ); Word32 az1_32, el1_32; - rotateAziEle_fixed( az_q0, el_q0, &az1_32, &el1_32, st_ivas->hCombinedOrientationData->Rmat_fx[0], st_ivas->hIntSetup.is_planar_setup ); + + rotateAziEle_fx32( az_q0, el_q0, &az1_32, &el1_32, st_ivas->hCombinedOrientationData->Rmat_fx[0], st_ivas->hIntSetup.is_planar_setup ); IF( st_ivas->hEFAPdata != NULL ) { @@ -4097,7 +4026,6 @@ void ivas_dirac_dec_render_sf_fx( { FOR( ch = 0; ch < outchannels; ch++ ) { - test(); test(); IF( ( hDirACRend->hOutSetup.num_lfe > 0 && ( EQ_16( hDirACRend->hOutSetup.index_lfe[idx_lfe], ch ) ) ) ) @@ -4204,7 +4132,6 @@ void ivas_dirac_dec_render_sf_fx( hSpatParamRendCom->subframes_rendered = add( hSpatParamRendCom->subframes_rendered, 1 ); move16(); - IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q = hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev; diff --git a/lib_dec/ivas_dirac_output_synthesis_cov_fx.c b/lib_dec/ivas_dirac_output_synthesis_cov_fx.c index 954dd5f72e35211386a25ec3703f839b8944ea1e..0ecd015ee407bb092acfb99da8bee139c120d20c 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov_fx.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov_fx.c @@ -30,7 +30,6 @@ *******************************************************************************************************/ - #include "basop_util.h" #include "enh32.h" #include @@ -470,9 +469,9 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot_fx( scale_sig32( imag_in_buffer_fx, buf_len, sub( ImagBuffer_e, output_e ) ); cmplx_matrix_square_fx( real_in_buffer_fx, imag_in_buffer_fx, num_bands, nchan_in, real_buffer_fx, imag_buffer_fx, output_e, &output_e ); - v_add_fixed_me( cx_fx, *cx_e, real_buffer_fx, output_e, cx_fx, &tmp1_e, imult1616( nchan_in, nchan_in ), 1 ); + v_add_fx_me( cx_fx, *cx_e, real_buffer_fx, output_e, cx_fx, &tmp1_e, imult1616( nchan_in, nchan_in ), 1 ); - v_add_fixed_me( cx_imag_fx, *cx_imag_e, imag_buffer_fx, output_e, cx_imag_fx, &tmp2_e, imult1616( nchan_in, nchan_in ), 1 ); + v_add_fx_me( cx_imag_fx, *cx_imag_e, imag_buffer_fx, output_e, cx_imag_fx, &tmp2_e, imult1616( nchan_in, nchan_in ), 1 ); cx_fx_norm = L_norm_arr( cx_fx, PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS ); cx_imag_fx_norm = L_norm_arr( cx_imag_fx, PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS ); @@ -552,33 +551,32 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot_fx( move16(); } - v_multc_fixed( mixing_matrix_fx[param_band_idx], L_deposit_h( hParamMC->h_output_synthesis_params.interpolator_fx[slot_idx_tot] ), mixing_matrix_smooth_fx, imult1616( nY, nX ) ); + v_multc_fx( mixing_matrix_fx[param_band_idx], L_deposit_h( hParamMC->h_output_synthesis_params.interpolator_fx[slot_idx_tot] ), mixing_matrix_smooth_fx, imult1616( nY, nX ) ); mixing_matrix_smooth_e = mixing_matrix_e[param_band_idx]; // interpolator is W16 move16(); - v_multc_fixed( h_synthesis_state.mixing_matrix_old_fx[param_band_idx], L_sub( ONE_IN_Q31, L_deposit_h( hParamMC->h_output_synthesis_params.interpolator_fx[slot_idx_tot] ) ), mixing_matrix_buffer_fx, imult1616( nY, nX ) ); + v_multc_fx( h_synthesis_state.mixing_matrix_old_fx[param_band_idx], L_sub( ONE_IN_Q31, L_deposit_h( hParamMC->h_output_synthesis_params.interpolator_fx[slot_idx_tot] ) ), mixing_matrix_buffer_fx, imult1616( nY, nX ) ); mixing_matrix_buffer_e = h_synthesis_state.mixing_matrix_old_exp[param_band_idx]; // interpolator is W16 move16(); - v_add_fixed_me( mixing_matrix_smooth_fx, mixing_matrix_smooth_e, mixing_matrix_buffer_fx, mixing_matrix_buffer_e, mixing_matrix_smooth_fx, &mixing_matrix_smooth_e, imult1616( nY, nX ), 0 ); + v_add_fx_me( mixing_matrix_smooth_fx, mixing_matrix_smooth_e, mixing_matrix_buffer_fx, mixing_matrix_buffer_e, mixing_matrix_smooth_fx, &mixing_matrix_smooth_e, imult1616( nY, nX ), 0 ); IF( have_residual ) { /* residual mixing matrix interpolation*/ - v_multc_fixed( mixing_matrix_res_fx[param_band_idx], L_deposit_h( hParamMC->h_output_synthesis_params.interpolator_fx[slot_idx_tot] ), mixing_matrix_res_smooth_fx, imult1616( nY, nY ) ); + v_multc_fx( mixing_matrix_res_fx[param_band_idx], L_deposit_h( hParamMC->h_output_synthesis_params.interpolator_fx[slot_idx_tot] ), mixing_matrix_res_smooth_fx, imult1616( nY, nY ) ); mixing_matrix_res_smooth_e = mixing_matrix_res_e[param_band_idx]; // interpolator is W16 move16(); set_zero_fx( mixing_matrix_buffer_fx, imult1616( nY, nY ) ); - v_multc_fixed( h_synthesis_state.mixing_matrix_res_old_fx[param_band_idx], L_sub( ONE_IN_Q31, L_deposit_h( hParamMC->h_output_synthesis_params.interpolator_fx[slot_idx_tot] ) ), mixing_matrix_buffer_fx, imult1616( nY, nY ) ); + v_multc_fx( h_synthesis_state.mixing_matrix_res_old_fx[param_band_idx], L_sub( ONE_IN_Q31, L_deposit_h( hParamMC->h_output_synthesis_params.interpolator_fx[slot_idx_tot] ) ), mixing_matrix_buffer_fx, imult1616( nY, nY ) ); mixing_matrix_buffer_e = h_synthesis_state.mixing_matrix_res_old_exp[param_band_idx]; // interpolator is W16 move16(); - v_add_fixed_me( mixing_matrix_res_smooth_fx, mixing_matrix_res_smooth_e, mixing_matrix_buffer_fx, mixing_matrix_buffer_e, mixing_matrix_res_smooth_fx, &mixing_matrix_res_smooth_e, imult1616( nY, nY ), 0 ); + v_add_fx_me( mixing_matrix_res_smooth_fx, mixing_matrix_res_smooth_e, mixing_matrix_buffer_fx, mixing_matrix_buffer_e, mixing_matrix_res_smooth_fx, &mixing_matrix_res_smooth_e, imult1616( nY, nY ), 0 ); } - FOR( band = brange[0]; band < brange[1]; band++ ) { assert( band >= 0 ); @@ -601,17 +599,16 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot_fx( shifter = sub( mixing_matrix_res_smooth_e, 32 ); FOR( ch_idx = 0; ch_idx < nY; ch_idx++ ) { - int i; + Word16 i; Word16 idx; Word64 temp_real, temp_imag; - idx = ch_idx; temp_real = 0; temp_imag = 0; move64(); move64(); - for ( i = 0; i < nY; i++ ) + FOR( i = 0; i < nY; i++ ) { temp_real = W_mac_32_32( temp_real, mixing_matrix_res_smooth_fx[idx], diff_f_real_fx[i] ); temp_imag = W_mac_32_32( temp_imag, mixing_matrix_res_smooth_fx[idx], diff_f_imag_fx[i] ); @@ -650,11 +647,10 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot_fx( FOR( ch_idx = 0; ch_idx < nY; ch_idx++ ) { - int i; + Word16 i; Word16 idx; Word64 temp_real, temp_imag; - idx = ch_idx; temp_real = 0; temp_imag = 0; @@ -721,7 +717,6 @@ Word16 computeMixingMatrices_fx( Word32 svd_s_buffer_fx[MAX_OUTPUT_CHANNELS]; Word16 svd_s_buffer_e[MAX_OUTPUT_CHANNELS]; - Word32 limit_fx; Word16 limit_e; @@ -789,7 +784,6 @@ Word16 computeMixingMatrices_fx( Cy_fx_e = Cy_e; move16(); - /*-----------------------------------------------------------------* * Decomposition of Cy *-----------------------------------------------------------------*/ @@ -905,13 +899,11 @@ Word16 computeMixingMatrices_fx( } } - limit_fx = 0; move32(); limit_e = 0; move16(); - /*-----------------------------------------------------------------* * regularized Kx-1 *-----------------------------------------------------------------*/ @@ -935,12 +927,10 @@ Word16 computeMixingMatrices_fx( *-----------------------------------------------------------------*/ /* Computing Q*Cx*Q' */ - matrix_product_mant_exp_fx( Q_fx, Q_e, lengthCy, lengthCx, 0, Cx_fx, Cx_fx_e, lengthCx, lengthCx, 0, Q_Cx_fx, &Q_Cx_e ); matrix_product_diag_fx( Q_Cx_fx, Q_Cx_e, lengthCy, lengthCx, 0, Q_fx, Q_e, lengthCy, lengthCx, 1, Cy_hat_diag_fx, &Cy_hat_diag_e ); - Word16 com_e = sub( limit_e, Cy_hat_diag_e ); FOR( i = 0; i < lengthCy; ++i ) { @@ -978,13 +968,11 @@ Word16 computeMixingMatrices_fx( move16(); } - /*-----------------------------------------------------------------* * Formulate optimal P *-----------------------------------------------------------------*/ /* Computing the input matrix Kx'*Q'*G_hat'*Ky */ - Word16 mat_mult_buffer1_fx_e; Word16 mat_mult_buffer2_fx_e[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; @@ -1047,8 +1035,6 @@ Word16 computeMixingMatrices_fx( *-----------------------------------------------------------------*/ /* Compute Cy_tilde = M*Cx*M' */ - - Word16 Cx_e_arr[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; set16_fx( Cx_e_arr, Cx_fx_e, PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS ); matrix_product_mant_exp( mixing_matrix_fx, mixing_matrix_fx_e, lengthCy, lengthCx, 0, Cx_fx, Cx_e_arr, lengthCx, lengthCx, 0, mat_mult_buffer1_fx, mat_mult_buffer1_fx_e1 ); @@ -1218,6 +1204,7 @@ Word16 computeMixingMatrices_fx( return out; } + /*-------------------------------------------------------------------* * computeMixingMatricesResidual() * diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index 74767d71e04db289676c8fa01b7cbf390798128e..2aaf6a1478d85457ef52b8cddd4ff03716250ede 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -390,7 +390,7 @@ ivas_error ivas_dec_get_format_fx( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "wrong MC configuration signalled!" ); } - st_ivas->mc_mode = ivas_mc_mode_select_fx( ivas_mc_map_output_config_to_mc_ls_setup_fx( signaled_config ), st_ivas->hDecoderConfig->ivas_total_brate ); + st_ivas->mc_mode = ivas_mc_mode_select_fx( ivas_mc_map_output_config_to_mc_ls_setup_fx( signaled_config ), ivas_total_brate ); st_ivas->transport_config = signaled_config; move16(); } @@ -793,9 +793,7 @@ ivas_error ivas_dec_setup( test(); IF( st_ivas->ini_frame > 0 && EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) { - Word16 n; - - n = add( st_ivas->nchan_transport, st_ivas->nchan_ism ); + Word16 n = add( st_ivas->nchan_transport, st_ivas->nchan_ism ); st_ivas->nCPE = shr_r( n, 1 ); } } @@ -1286,7 +1284,6 @@ static ivas_error ivas_read_format( *-------------------------------------------------------------------*/ /*! r: number of channels to be synthesised */ - Word16 getNumChanSynthesis( Decoder_Struct *st_ivas /* i : IVAS decoder structure */ ) @@ -1322,6 +1319,7 @@ Word16 getNumChanSynthesis( return n; } + /*-------------------------------------------------------------------* * copy_decoder_config() * @@ -1421,8 +1419,8 @@ ivas_error ivas_init_decoder_front( { return error; } - error = ivas_orient_trk_SetTrackingType_fx( st_ivas->hHeadTrackData->OrientationTracker, st_ivas->hDecoderConfig->orientation_tracking ); - IF( NE_32( ( error ), IVAS_ERR_OK ) ) + + IF( NE_32( ( error = ivas_orient_trk_SetTrackingType_fx( st_ivas->hHeadTrackData->OrientationTracker, st_ivas->hDecoderConfig->orientation_tracking ) ), IVAS_ERR_OK ) ) { return error; } @@ -1434,7 +1432,7 @@ ivas_error ivas_init_decoder_front( IF( st_ivas->hDecoderConfig->Opt_ExternalOrientation ) { - IF( NE_32( ( error = ivas_external_orientation_open( &( st_ivas->hExtOrientationData ), st_ivas->hDecoderConfig->render_framesize ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_external_orientation_open_fx( &( st_ivas->hExtOrientationData ), st_ivas->hDecoderConfig->render_framesize ) ), IVAS_ERR_OK ) ) { return error; } @@ -1447,7 +1445,7 @@ ivas_error ivas_init_decoder_front( test(); IF( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) { - IF( NE_32( ( error = ivas_combined_orientation_open( &( st_ivas->hCombinedOrientationData ), st_ivas->hDecoderConfig->output_Fs, st_ivas->hDecoderConfig->render_framesize ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_combined_orientation_open_fx( &( st_ivas->hCombinedOrientationData ), st_ivas->hDecoderConfig->output_Fs, st_ivas->hDecoderConfig->render_framesize ) ), IVAS_ERR_OK ) ) { return error; } @@ -1457,6 +1455,7 @@ ivas_error ivas_init_decoder_front( * Allocate and initialize Binaural Renderer configuration handle *--------------------------------------------------------------------*/ + test(); test(); test(); @@ -1486,6 +1485,7 @@ ivas_error ivas_init_decoder_front( * * Initialize IVAS decoder state structure *-------------------------------------------------------------------*/ + ivas_error ivas_init_decoder_fx( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) @@ -1824,7 +1824,7 @@ ivas_error ivas_init_decoder_fx( test(); test(); test(); - IF( NE_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA ) && NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) && NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) && !( EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) && EQ_32( st_ivas->intern_config, IVAS_AUDIO_CONFIG_FOA ) ) ) + IF( NE_32( output_config, IVAS_AUDIO_CONFIG_FOA ) && NE_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) && NE_32( output_config, IVAS_AUDIO_CONFIG_MONO ) && !( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) && EQ_32( st_ivas->intern_config, IVAS_AUDIO_CONFIG_FOA ) ) ) { IF( NE_32( ( error = ivas_dirac_dec_config_fx( st_ivas, DIRAC_OPEN ) ), IVAS_ERR_OK ) ) { @@ -1849,7 +1849,7 @@ ivas_error ivas_init_decoder_fx( move16(); } - ivas_dirac_config_bands_fx( band_grouping, IVAS_MAX_NUM_BANDS, extract_l( Mpy_32_32_r( st_ivas->hDecoderConfig->output_Fs, INV_CLDFB_BANDWIDTH_Q31 ) ), + ivas_dirac_config_bands_fx( band_grouping, IVAS_MAX_NUM_BANDS, extract_l( Mpy_32_32_r( output_Fs, INV_CLDFB_BANDWIDTH_Q31 ) ), st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0, 1 ); } st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); @@ -1973,6 +1973,7 @@ ivas_error ivas_init_decoder_fx( st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); move16(); + IF( NE_32( ( error = ivas_qmetadata_open_fx( &( st_ivas->hQMetaData ) ) ), IVAS_ERR_OK ) ) { return error; @@ -2001,7 +2002,7 @@ ivas_error ivas_init_decoder_fx( test(); test(); - IF( NE_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA ) && NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) && NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) ) + IF( NE_32( output_config, IVAS_AUDIO_CONFIG_FOA ) && NE_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) && NE_32( output_config, IVAS_AUDIO_CONFIG_MONO ) ) { IF( NE_32( ( error = ivas_dirac_dec_config_fx( st_ivas, DIRAC_OPEN ) ), IVAS_ERR_OK ) ) { @@ -2017,6 +2018,7 @@ ivas_error ivas_init_decoder_fx( st_ivas->hSpar->enc_param_start_band = s_min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); move16(); + IF( ivas_get_hodirac_flag_fx( ivas_total_brate, st_ivas->sba_analysis_order ) ) { st_ivas->hSpar->enc_param_start_band = 0; @@ -2026,7 +2028,7 @@ ivas_error ivas_init_decoder_fx( move16(); } - ivas_dirac_config_bands_fx( band_grouping, IVAS_MAX_NUM_BANDS, extract_l( Mpy_32_32_r( st_ivas->hDecoderConfig->output_Fs, INV_CLDFB_BANDWIDTH_Q31 ) ), + ivas_dirac_config_bands_fx( band_grouping, IVAS_MAX_NUM_BANDS, extract_l( Mpy_32_32_r( output_Fs, INV_CLDFB_BANDWIDTH_Q31 ) ), st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0, 1 ); } @@ -2047,9 +2049,7 @@ ivas_error ivas_init_decoder_fx( st_ivas->nCPE_old = st_ivas->nCPE; move16(); { - Word16 n_all; - - n_all = add( st_ivas->nchan_transport, st_ivas->nchan_ism ); + Word16 n_all = add( st_ivas->nchan_transport, st_ivas->nchan_ism ); st_ivas->nCPE = shr( add( n_all, 1 ), 1 ); } st_ivas->element_mode_init = IVAS_CPE_MDCT; @@ -2295,7 +2295,6 @@ ivas_error ivas_init_decoder_fx( FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, tmp_br ) ), IVAS_ERR_OK ) ) - { return error; } @@ -2363,13 +2362,13 @@ ivas_error ivas_init_decoder_fx( } IF( NE_32( ( error = ivas_masa_dec_open_fx( st_ivas ) ), IVAS_ERR_OK ) ) - { return error; } st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); move16(); + test(); IF( NE_32( st_ivas->renderer_type, RENDERER_DISABLE ) && NE_32( st_ivas->renderer_type, RENDERER_MCMASA_MONO_STEREO ) ) { @@ -2378,6 +2377,7 @@ ivas_error ivas_init_decoder_fx( return error; } } + test(); test(); IF( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && st_ivas->hOutSetup.separateChannelEnabled && !st_ivas->hLsSetupCustom->separate_ch_found ) @@ -2427,6 +2427,7 @@ ivas_error ivas_init_decoder_fx( { st_ivas->element_mode_init = IVAS_CPE_MDCT; /* element_mode_init was IVAS_SCE for SCE initialization */ move16(); + IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, brate_cpe ) ), IVAS_ERR_OK ) ) { return error; @@ -2495,6 +2496,7 @@ ivas_error ivas_init_decoder_fx( /*-------------------------------------------------------------------* * Allocate and initialize rendering handles *--------------------------------------------------------------------*/ + test(); test(); test(); @@ -2554,17 +2556,15 @@ ivas_error ivas_init_decoder_fx( IF( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { - if ( NE_32( ( error = ivas_reverb_open_fx( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ), IVAS_ERR_OK ) ) + if ( NE_32( ( error = ivas_reverb_open_fx( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, output_Fs ) ), IVAS_ERR_OK ) ) { return error; } } #ifndef NONBE_1303_REND_GRANULARITY - granularity = NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); - + granularity = NS2SA_FX2( output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels_fx( st_ivas ); - IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_RENDERER, n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, granularity ) ), IVAS_ERR_OK ) ) { return error; @@ -2590,7 +2590,7 @@ ivas_error ivas_init_decoder_fx( test(); test(); test(); - IF( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_MIXER_CONV_ROOM ) && EQ_32( st_ivas->ivas_format, MC_FORMAT ) && ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) ) + IF( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_MIXER_CONV_ROOM ) && EQ_32( st_ivas->ivas_format, MC_FORMAT ) && ( hDecoderConfig->Opt_Headrotation || hDecoderConfig->Opt_ExternalOrientation ) ) { IF( NE_32( ( error = efap_init_data_fx( &( st_ivas->hEFAPdata ), st_ivas->hIntSetup.ls_azimuth_fx, st_ivas->hIntSetup.ls_elevation_fx, st_ivas->hIntSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ), IVAS_ERR_OK ) ) { @@ -2606,7 +2606,7 @@ ivas_error ivas_init_decoder_fx( move16(); } - IF( NE_32( ( error = ivas_rend_openCrend_fx( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hHrtfCrend, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, 0, num_poses ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_rend_openCrend_fx( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, output_config, st_ivas->hRenderConfig, st_ivas->hHrtfCrend, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, 0, num_poses ) ), IVAS_ERR_OK ) ) { return error; } @@ -2627,7 +2627,7 @@ ivas_error ivas_init_decoder_fx( } ELSE { - granularity = NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); + granularity = NS2SA_FX2( output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels_fx( st_ivas ); @@ -2794,7 +2794,7 @@ ivas_error ivas_init_decoder_fx( } IF( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { - IF( NE_32( ( error = ivas_reverb_open_fx( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_reverb_open_fx( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, output_Fs ) ), IVAS_ERR_OK ) ) { return error; } @@ -2836,7 +2836,7 @@ ivas_error ivas_init_decoder_fx( test(); test(); test(); - IF( ( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) || EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) && !st_ivas->sba_dirac_stereo_flag && NE_16( st_ivas->hDecoderConfig->nchan_out, 1 ) ) + IF( ( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) || EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) && !st_ivas->sba_dirac_stereo_flag && NE_16( hDecoderConfig->nchan_out, 1 ) ) { Word16 Q_cldfbSynDec = Q11; move16(); @@ -2878,7 +2878,7 @@ ivas_error ivas_init_decoder_fx( { IF( st_ivas->hBinRenderer->render_lfe ) { - IF( NE_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && NE_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + IF( NE_16( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && NE_16( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { /* Account for filterbank delay */ delay_ns = L_add( delay_ns, IVAS_FB_DEC_DELAY_NS ); @@ -2931,7 +2931,7 @@ ivas_error ivas_init_decoder_fx( #else n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels_fx( st_ivas ); - IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, ivas_jbm_dec_get_tc_buffer_mode_fx( st_ivas ), n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, ivas_jbm_dec_get_tc_buffer_mode_fx( st_ivas ), n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, NS2SA_FX2( output_Fs, CLDFB_SLOT_NS ) ) ), IVAS_ERR_OK ) ) #endif { return error; @@ -2942,7 +2942,7 @@ ivas_error ivas_init_decoder_fx( test(); IF( ( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) || EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) && st_ivas->hDecoderConfig->Opt_tsm ) { - IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) + IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) { IF( NE_32( ( error = ivas_jbm_dec_metadata_open( st_ivas ) ), IVAS_ERR_OK ) ) { @@ -2952,15 +2952,15 @@ ivas_error ivas_init_decoder_fx( } /*-----------------------------------------------------------------* - * Allocate floating-point output audio buffers + * Allocate output audio buffers *-----------------------------------------------------------------*/ - FOR( n = 0; n < ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ ) + FOR( n = 0; n < ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, ivas_total_brate ); n++ ) { /* note: these are intra-frame heap memories */ IF( ( st_ivas->p_output_fx[n] = (Word32 *) malloc( ( 48000 / FRAMES_PER_SEC ) * sizeof( Word32 ) ) ) == NULL ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for floating-point output audio buffer!\n" ) ); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for output audio buffer!\n" ) ); } set32_fx( st_ivas->p_output_fx[n], 0, 48000 / FRAMES_PER_SEC ); } @@ -3121,6 +3121,7 @@ void destroy_core_dec_fx( return; } + /*------------------------------------------------------------------------- * ivas_initialize_handles_dec() * @@ -3216,7 +3217,7 @@ void ivas_initialize_handles_dec( st_ivas->hTcBuffer = NULL; st_ivas->hJbmMetadata = NULL; - /* floating-point output audio buffers */ + /* output audio buffers */ FOR( i = 0; i < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; i++ ) { st_ivas->p_output_fx[i] = NULL; @@ -3444,10 +3445,9 @@ void ivas_destroy_dec_fx( st_ivas->hJbmMetadata = NULL; } - /* floating-point output audio buffers */ + /* output audio buffers */ FOR( i = 0; i < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; i++ ) { - IF( st_ivas->p_output_fx[i] != NULL ) { free( st_ivas->p_output_fx[i] ); @@ -3476,6 +3476,7 @@ void ivas_init_dec_get_num_cldfb_instances_fx( ) { IVAS_FORMAT ivas_format; + *numCldfbAnalyses = st_ivas->nchan_transport; move16(); *numCldfbSyntheses = st_ivas->hDecoderConfig->nchan_out; @@ -3765,6 +3766,7 @@ static ivas_error doSanityChecks_IVAS( move32(); output_config = st_ivas->hDecoderConfig->output_config; move32(); + /*-----------------------------------------------------------------* * Sanity checks *-----------------------------------------------------------------*/ diff --git a/lib_dec/ivas_ism_dec_fx.c b/lib_dec/ivas_ism_dec_fx.c index 9dd9d6dc912baf9d64e659d1d0e1c7eee831b458..1e0147398f42bfc0dff8b97fc71418f63a16363f 100644 --- a/lib_dec/ivas_ism_dec_fx.c +++ b/lib_dec/ivas_ism_dec_fx.c @@ -298,7 +298,7 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx( } /*-----------------------------------------------------------------* - * floating-point output audio buffers + * output audio buffers *-----------------------------------------------------------------*/ #ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH diff --git a/lib_dec/ivas_ism_dtx_dec_fx.c b/lib_dec/ivas_ism_dtx_dec_fx.c index d5943a90cf19cc9744f181178dca2ae722ff154e..19d99a0bb1fe277e13efc6485f7230bb235ffcba 100644 --- a/lib_dec/ivas_ism_dtx_dec_fx.c +++ b/lib_dec/ivas_ism_dtx_dec_fx.c @@ -163,11 +163,13 @@ void ivas_ism_dtx_limit_noise_energy_for_near_silence_fx( Word32 fac_fx, cng_noise_nrg_obj_fx, cng_noise_nrg_dominant_fx; Word16 ch, cng_noise_level_len, Q_cng_noise_nrg_dominant, exp; HANDLE_FD_CNG_COM hFdCngCom; + hFdCngCom = hSCE[sce_id_dtx]->hCoreCoder[0]->hFdCngDec->hFdCngCom; cng_noise_level_len = sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ); - Q_cng_noise_nrg_dominant = add( Q_cngNoiseLevel[sce_id_dtx], Q_cngNoiseLevel[sce_id_dtx] ); /*stores Q for cng_noise_nrg_dominant_fx*/ - cng_noise_nrg_dominant_fx = dotp_fixed_o( hFdCngCom->cngNoiseLevel, hFdCngCom->cngNoiseLevel, cng_noise_level_len, 9 /*log2(len(hFdCngCom->cngNoiseLevel))*/, &Q_cng_noise_nrg_dominant ); /*Resultant Q_cng_noise_nrg_dominant= (Q_cng_noise_nrg_dominant-x)<=31*/ - IF( LT_32( cng_noise_nrg_dominant_fx, L_shl_sat( 1, Q_cng_noise_nrg_dominant ) ) ) /*cng_noise_nrg_dominant<1.f*/ + Q_cng_noise_nrg_dominant = add( Q_cngNoiseLevel[sce_id_dtx], Q_cngNoiseLevel[sce_id_dtx] ); /*stores Q for cng_noise_nrg_dominant_fx*/ + cng_noise_nrg_dominant_fx = dotp_fx32_o( hFdCngCom->cngNoiseLevel, hFdCngCom->cngNoiseLevel, cng_noise_level_len, 9 /*log2(len(hFdCngCom->cngNoiseLevel))*/, &Q_cng_noise_nrg_dominant ); /*Resultant Q_cng_noise_nrg_dominant= (Q_cng_noise_nrg_dominant-x)<=31*/ + + IF( LT_32( cng_noise_nrg_dominant_fx, L_shl_sat( 1, Q_cng_noise_nrg_dominant ) ) ) /*cng_noise_nrg_dominant<1.f*/ { FOR( ch = 0; ch < nchan_transport; ch++ ) { @@ -177,8 +179,8 @@ void ivas_ism_dtx_limit_noise_energy_for_near_silence_fx( } hFdCngCom = hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom; cng_noise_level_len = sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ); - Word16 Q_cng_noise_nrg_obj = add( Q_cngNoiseLevel[ch], Q_cngNoiseLevel[ch] ); /*Stores Q-factor of cng_noise_nrg_obj*/ - cng_noise_nrg_obj_fx = dotp_fixed_o( hFdCngCom->cngNoiseLevel, hFdCngCom->cngNoiseLevel, cng_noise_level_len, 9, &Q_cng_noise_nrg_obj ); /*Resultant Q_cng_noise_nrg_obj= (Q_cng_noise_nrg_obj-x)<=31*/ + Word16 Q_cng_noise_nrg_obj = add( Q_cngNoiseLevel[ch], Q_cngNoiseLevel[ch] ); /*Stores Q-factor of cng_noise_nrg_obj*/ + cng_noise_nrg_obj_fx = dotp_fx32_o( hFdCngCom->cngNoiseLevel, hFdCngCom->cngNoiseLevel, cng_noise_level_len, 9, &Q_cng_noise_nrg_obj ); /*Resultant Q_cng_noise_nrg_obj= (Q_cng_noise_nrg_obj-x)<=31*/ IF( GT_32( cng_noise_nrg_obj_fx, cng_noise_nrg_dominant_fx ) ) { Word32 temp = 0; @@ -195,8 +197,8 @@ void ivas_ism_dtx_limit_noise_energy_for_near_silence_fx( } exp = sub( 31, Q_temp ); fac_fx = Sqrt32( temp, &exp ); - v_multc_fixed( hFdCngCom->cngNoiseLevel, fac_fx, hFdCngCom->cngNoiseLevel, cng_noise_level_len ); /*Resultant Q of cngNoiseLevel is Q_cngNoiseLevel for ch*/ - scale_sig32( hFdCngCom->cngNoiseLevel, cng_noise_level_len, exp ); /*Restoring Q of hFdCngCom->cngNoiseLevel to Q_cngNoiseLevel */ + v_multc_fx( hFdCngCom->cngNoiseLevel, fac_fx, hFdCngCom->cngNoiseLevel, cng_noise_level_len ); /*Resultant Q of cngNoiseLevel is Q_cngNoiseLevel for ch*/ + scale_sig32( hFdCngCom->cngNoiseLevel, cng_noise_level_len, exp ); /*Restoring Q of hFdCngCom->cngNoiseLevel to Q_cngNoiseLevel */ } } } diff --git a/lib_dec/ivas_ism_renderer_fx.c b/lib_dec/ivas_ism_renderer_fx.c index 36234bf4713f711712cbb3f3b63a4b3a0c6b42b3..97b5b05c3ebe18337ec5c44f76703a59bbdb05b8 100644 --- a/lib_dec/ivas_ism_renderer_fx.c +++ b/lib_dec/ivas_ism_renderer_fx.c @@ -72,7 +72,7 @@ ivas_error ivas_ism_renderer_open_fx( test(); test(); IF( st_ivas->hIntSetup.is_loudspeaker_setup && - st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_STEREO && + NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) && st_ivas->hIntSetup.ls_azimuth_fx != NULL && st_ivas->hIntSetup.ls_elevation_fx != NULL && st_ivas->hEFAPdata == NULL ) { @@ -128,6 +128,7 @@ ivas_error ivas_ism_renderer_open_fx( * * Close struct for object rendering. *-------------------------------------------------------------------------*/ + void ivas_ism_renderer_close( ISM_RENDERER_HANDLE *hIsmRendererData /* i/o: ISM renderer handle */ ) @@ -156,6 +157,7 @@ void ivas_ism_renderer_close( * * Object rendering process *-------------------------------------------------------------------------*/ + void ivas_ism_render_sf_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const RENDERER_TYPE renderer_type, /* i : active renderer type */ @@ -237,10 +239,9 @@ void ivas_ism_render_sf_fx( set32_fx( output_fx[i], 0, n_samples_to_render ); } - FOR( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { - int16_t n_samples_in_subframe; + Word16 n_samples_in_subframe; n_samples_in_subframe = st_ivas->hTcBuffer->n_samples_granularity * st_ivas->hTcBuffer->subframe_nbslots[subframe_idx]; test(); @@ -415,6 +416,7 @@ void ivas_ism_get_stereo_gains_fx( return; } + /*-------------------------------------------------------------------------* * ivas_omasa_separate_object_renderer_open() * diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 35ab02a9d2ff2097895b7bfa7ec4c81cc56339f0..2d9484d45cef9a0b252720616e501b2febc5eb6d 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -59,15 +59,17 @@ static void ivas_jbm_dec_copy_masa_meta_to_buffer( Decoder_Struct *st_ivas ); static void ivas_jbm_masa_sf_to_slot_map( Decoder_Struct *st_ivas, const Word16 nCldfbTs ); - -static Word16 ceil_fx16( Word16 inp, Word16 Q ); -static Word16 ceil_fx16( Word16 inp, Word16 Q ) +static Word16 ceil_fx16( + const Word16 inp, + const Word16 Q ) { Word16 ret = shr( inp, Q ); + IF( ( s_and( inp, sub( shl( 1, Q ), 1 ) ) ) > 0 ) { ret = add( ret, 1 ); } + return ret; } @@ -1782,7 +1784,7 @@ void ivas_jbm_dec_feed_tc_to_renderer_fx( test(); IF( EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) && EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) ) { - v_multc_fixed_16( st_ivas->hTcBuffer->tc_fx[CPE_CHANNELS + n], OMASA_TDREND_MATCHING_GAIN_FX, st_ivas->hTcBuffer->tc_fx[CPE_CHANNELS + n], st_ivas->hTcBuffer->n_samples_available ); + v_multc_fx_16( st_ivas->hTcBuffer->tc_fx[CPE_CHANNELS + n], OMASA_TDREND_MATCHING_GAIN_FX, st_ivas->hTcBuffer->tc_fx[CPE_CHANNELS + n], st_ivas->hTcBuffer->n_samples_available ); } delay_signal32_fx( st_ivas->hTcBuffer->tc_fx[CPE_CHANNELS + n], st_ivas->hTcBuffer->n_samples_available, st_ivas->hMasaIsmData->delayBuffer_fx[n], st_ivas->hMasaIsmData->delayBuffer_size ); } @@ -2451,7 +2453,7 @@ ivas_error ivas_jbm_dec_render_fx( } ELSE IF( EQ_32( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) ) { - ivas_mc_paramupmix_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_tc_fx, p_output_fx ); + ivas_mc_paramupmix_dec_render_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_tc_fx, p_output_fx ); test(); test(); @@ -2853,6 +2855,7 @@ ivas_error ivas_jbm_dec_flush_renderer_fx( { return error; } + IF( NE_32( ( error = getAudioConfigNumChannels( st_ivas->hOutSetup.output_config, &nchan_out ) ), IVAS_ERR_OK ) ) { return error; @@ -2875,6 +2878,7 @@ ivas_error ivas_jbm_dec_flush_renderer_fx( { return error; } + ivas_binaural_add_LFE_fx( st_ivas, *nSamplesRendered, st_ivas->hTcBuffer->tc_fx, p_output_fx ); } ELSE @@ -4674,7 +4678,7 @@ void ivas_jbm_dec_prepare_renderer( test(); IF( EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) && EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) ) { - v_multc_fixed_16( st_ivas->hTcBuffer->tc_fx[CPE_CHANNELS + n], OMASA_TDREND_MATCHING_GAIN_FX, st_ivas->hTcBuffer->tc_fx[CPE_CHANNELS + n], st_ivas->hTcBuffer->n_samples_available ); + v_multc_fx_16( st_ivas->hTcBuffer->tc_fx[CPE_CHANNELS + n], OMASA_TDREND_MATCHING_GAIN_FX, st_ivas->hTcBuffer->tc_fx[CPE_CHANNELS + n], st_ivas->hTcBuffer->n_samples_available ); } delay_signal32_fx( st_ivas->hTcBuffer->tc_fx[CPE_CHANNELS + n], st_ivas->hTcBuffer->n_samples_available, st_ivas->hMasaIsmData->delayBuffer_fx[n], st_ivas->hMasaIsmData->delayBuffer_size ); } diff --git a/lib_dec/ivas_lfe_dec_fx.c b/lib_dec/ivas_lfe_dec_fx.c index 29a64da58ad02646b6483d68a94acdc00cb2b2ed..74d8de662ea8aadd99c86363b514d42e8164fe1e 100644 --- a/lib_dec/ivas_lfe_dec_fx.c +++ b/lib_dec/ivas_lfe_dec_fx.c @@ -315,6 +315,7 @@ static void ivas_create_lfe_lpf_dec_fx( return; } + /*-----------------------------------------------------------------------------------------* * Function ivas_lfe_dec_fx() * @@ -401,6 +402,7 @@ void ivas_lfe_dec_fx( j = add( j, shr( output_frame, 5 ) ); } q_out = Q9; + move16(); } IF( hLFE->filter_state.order > 0 ) @@ -488,7 +490,7 @@ ivas_error ivas_create_lfe_dec_fx( low_pass_delay_dec_out = 0; // Q15 move16(); - if ( delay_ns > ivas_lfe_lpf_delay_ns[IVAS_FILTER_ORDER_4 - 3] ) + IF( GT_32( delay_ns, ivas_lfe_lpf_delay_ns[IVAS_FILTER_ORDER_4 - 3] ) ) { filt_order = 4; low_pass_delay_dec_out = ivas_lfe_lpf_delay_Q15[IVAS_FILTER_ORDER_4 - 3]; diff --git a/lib_dec/ivas_masa_dec_fx.c b/lib_dec/ivas_masa_dec_fx.c index 159167c836f727fd9236b1ce173ccda6ef6d89ec..b6d514e7e1c7101147f483fe1182a003d63a5cc4 100644 --- a/lib_dec/ivas_masa_dec_fx.c +++ b/lib_dec/ivas_masa_dec_fx.c @@ -184,6 +184,7 @@ ivas_error ivas_masa_decode_fx( IF( NE_32( ivas_format, MC_FORMAT ) || NE_16( st_ivas->mc_mode, MC_MODE_MCMASA ) ) { Word16 bits_per_frame = extract_l( Mpy_32_32( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) ); + IF( EQ_32( ivas_format, MASA_FORMAT ) ) { /* re-read the number of objects, needed in case of bad frame */ @@ -221,6 +222,7 @@ ivas_error ivas_masa_decode_fx( move16(); move16(); *nb_bits_read = add( *nb_bits_read, MASA_HEADER_BITS ); + /* read number of directions */ byteBuffer = st->bit_stream[( st->next_bit_pos )--]; move16(); @@ -322,6 +324,7 @@ ivas_error ivas_masa_decode_fx( move16(); st_ivas->hIsmMetaData[0]->ism_md_lowrate_flag = 0; move16(); + IF( EQ_16( st_ivas->hIsmMetaData[0]->ism_imp, ISM_NO_META ) ) { /* read flags */ @@ -357,6 +360,7 @@ ivas_error ivas_masa_decode_fx( move16(); st_ivas->hIsmMetaData[ch]->ism_md_lowrate_flag = 0; move16(); + IF( EQ_16( st_ivas->hIsmMetaData[ch]->ism_imp, ISM_NO_META ) ) { /* read flags */ @@ -370,8 +374,10 @@ ivas_error ivas_masa_decode_fx( move16(); } } + st_ivas->flag_omasa_brate = 0; move16(); + test(); IF( GE_16( st_ivas->nchan_ism, 3 ) && EQ_32( ivas_total_brate, IVAS_128k ) ) { @@ -382,7 +388,6 @@ ivas_error ivas_masa_decode_fx( } } } - byteBuffer = st->bit_stream[st->next_bit_pos]; move16(); st->next_bit_pos = sub( st->next_bit_pos, 1 ); @@ -836,6 +841,7 @@ ivas_error ivas_masa_dec_open_fx( /* these are not needed -> clean. EXT metafile writer in OMASA needs only the number of ISMs and writes default null-data */ ivas_ism_metadata_close( st_ivas->hIsmMetaData, 0 ); } + test(); test(); test(); @@ -1194,8 +1200,8 @@ void ivas_masa_prerender_fx( test(); IF( EQ_32( st_ivas->renderer_type, RENDERER_DIRAC ) || EQ_32( st_ivas->renderer_type, RENDERER_DISABLE ) ) { - v_multc_fixed( output_fx[0], SQRT2_FIXED, output_fx[0], output_frame ); /* q + 30 - 31 = q - 1*/ /* Gain transport signal when transmitting mono with cpe in order to match loudness */ - *q_shift = -1; /* Q has decreased by 1. */ + v_multc_fx( output_fx[0], SQRT2_FX, output_fx[0], output_frame ); /* q + 30 - 31 = q - 1*/ /* Gain transport signal when transmitting mono with cpe in order to match loudness */ + *q_shift = -1; /* Q has decreased by 1. */ move16(); } } diff --git a/lib_dec/ivas_mc_param_dec_fx.c b/lib_dec/ivas_mc_param_dec_fx.c index 54d5e29059e71876fd7a5f4dc6b53aaf289fd153..acfdab5680635595901903244d1d6c68ea1cf56b 100644 --- a/lib_dec/ivas_mc_param_dec_fx.c +++ b/lib_dec/ivas_mc_param_dec_fx.c @@ -1055,14 +1055,14 @@ ivas_error ivas_param_mc_dec_reconfig_fx( FOR( source_param_idx = 0; source_param_idx < parameter_band_mapping.n_source_bands[new_param_band_idx]; source_param_idx++ ) { /* Cx */ - v_multc_fixed_16( cov_state_old.cx_old_fx[parameter_band_mapping.source_band_idx[new_param_band_idx][source_param_idx]], parameter_band_mapping.source_band_factor_fx[new_param_band_idx][source_param_idx], tmp_buf_fx, imult1616( nchan_transport_old, nchan_transport_old ) ); // Q(31 - cov_state_old.cx_old_e) - v_add_fixed_me( tmp_buf_fx, cov_state_old.cx_old_e[parameter_band_mapping.source_band_idx[new_param_band_idx][source_param_idx]], hParamMC->h_output_synthesis_cov_state.cx_old_fx[new_param_band_idx], hParamMC->h_output_synthesis_cov_state.cx_old_e[new_param_band_idx], hParamMC->h_output_synthesis_cov_state.cx_old_fx[new_param_band_idx], &hParamMC->h_output_synthesis_cov_state.cx_old_e[new_param_band_idx], imult1616( nchan_transport_old, nchan_transport_old ), 0 ); // Q(31 - hParamMC->h_output_synthesis_cov_state.cx_old_e[new_param_band_idx]) + v_multc_fx_16( cov_state_old.cx_old_fx[parameter_band_mapping.source_band_idx[new_param_band_idx][source_param_idx]], parameter_band_mapping.source_band_factor_fx[new_param_band_idx][source_param_idx], tmp_buf_fx, imult1616( nchan_transport_old, nchan_transport_old ) ); // Q(31 - cov_state_old.cx_old_e) + v_add_fx_me( tmp_buf_fx, cov_state_old.cx_old_e[parameter_band_mapping.source_band_idx[new_param_band_idx][source_param_idx]], hParamMC->h_output_synthesis_cov_state.cx_old_fx[new_param_band_idx], hParamMC->h_output_synthesis_cov_state.cx_old_e[new_param_band_idx], hParamMC->h_output_synthesis_cov_state.cx_old_fx[new_param_band_idx], &hParamMC->h_output_synthesis_cov_state.cx_old_e[new_param_band_idx], imult1616( nchan_transport_old, nchan_transport_old ), 0 ); // Q(31 - hParamMC->h_output_synthesis_cov_state.cx_old_e[new_param_band_idx]) /* Cy */ - v_multc_fixed_16( cov_state_old.cy_old_fx[parameter_band_mapping.source_band_idx[new_param_band_idx][source_param_idx]], parameter_band_mapping.source_band_factor_fx[new_param_band_idx][source_param_idx], tmp_buf_fx, imult1616( nchan_out_cov, nchan_out_cov ) ); // Q(31 - cov_state_old.cy_old_e) - v_add_fixed_me( tmp_buf_fx, cov_state_old.cy_old_e[parameter_band_mapping.source_band_idx[new_param_band_idx][source_param_idx]], hParamMC->h_output_synthesis_cov_state.cy_old_fx[new_param_band_idx], hParamMC->h_output_synthesis_cov_state.cy_old_e[new_param_band_idx], hParamMC->h_output_synthesis_cov_state.cy_old_fx[new_param_band_idx], &hParamMC->h_output_synthesis_cov_state.cy_old_e[new_param_band_idx], imult1616( nchan_out_cov, nchan_out_cov ), 0 ); // Q(31 - hParamMC->h_output_synthesis_cov_state.cy_old_e[new_param_band_idx]) + v_multc_fx_16( cov_state_old.cy_old_fx[parameter_band_mapping.source_band_idx[new_param_band_idx][source_param_idx]], parameter_band_mapping.source_band_factor_fx[new_param_band_idx][source_param_idx], tmp_buf_fx, imult1616( nchan_out_cov, nchan_out_cov ) ); // Q(31 - cov_state_old.cy_old_e) + v_add_fx_me( tmp_buf_fx, cov_state_old.cy_old_e[parameter_band_mapping.source_band_idx[new_param_band_idx][source_param_idx]], hParamMC->h_output_synthesis_cov_state.cy_old_fx[new_param_band_idx], hParamMC->h_output_synthesis_cov_state.cy_old_e[new_param_band_idx], hParamMC->h_output_synthesis_cov_state.cy_old_fx[new_param_band_idx], &hParamMC->h_output_synthesis_cov_state.cy_old_e[new_param_band_idx], imult1616( nchan_out_cov, nchan_out_cov ), 0 ); // Q(31 - hParamMC->h_output_synthesis_cov_state.cy_old_e[new_param_band_idx]) /* mixing matrix*/ - v_multc_fixed_16( cov_state_old.mixing_matrix_old_fx[parameter_band_mapping.source_band_idx[new_param_band_idx][source_param_idx]], parameter_band_mapping.source_band_factor_fx[new_param_band_idx][source_param_idx], tmp_buf_fx, imult1616( nchan_transport_old, nchan_out_cov ) ); // Q(31 - mixing_matrix_old_exp) - v_add_fixed_me( tmp_buf_fx, cov_state_old.mixing_matrix_old_exp[parameter_band_mapping.source_band_idx[new_param_band_idx][source_param_idx]], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[new_param_band_idx], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_exp[new_param_band_idx], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[new_param_band_idx], &hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_exp[new_param_band_idx], imult1616( nchan_transport_old, nchan_out_cov ), 0 ); // Q(31 - hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_exp[new_param_band_idx]) + v_multc_fx_16( cov_state_old.mixing_matrix_old_fx[parameter_band_mapping.source_band_idx[new_param_band_idx][source_param_idx]], parameter_band_mapping.source_band_factor_fx[new_param_band_idx][source_param_idx], tmp_buf_fx, imult1616( nchan_transport_old, nchan_out_cov ) ); // Q(31 - mixing_matrix_old_exp) + v_add_fx_me( tmp_buf_fx, cov_state_old.mixing_matrix_old_exp[parameter_band_mapping.source_band_idx[new_param_band_idx][source_param_idx]], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[new_param_band_idx], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_exp[new_param_band_idx], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[new_param_band_idx], &hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_exp[new_param_band_idx], imult1616( nchan_transport_old, nchan_out_cov ), 0 ); // Q(31 - hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_exp[new_param_band_idx]) } } FOR( new_param_band_idx = 0; new_param_band_idx < max_param_band_residual; new_param_band_idx++ ) @@ -1070,8 +1070,8 @@ ivas_error ivas_param_mc_dec_reconfig_fx( FOR( source_param_idx = 0; source_param_idx < parameter_band_mapping.n_source_bands[new_param_band_idx]; source_param_idx++ ) { /* residual mixing matrix*/ - v_multc_fixed_16( cov_state_old.mixing_matrix_res_old_fx[parameter_band_mapping.source_band_idx[new_param_band_idx][source_param_idx]], parameter_band_mapping.source_band_factor_fx[new_param_band_idx][source_param_idx], tmp_buf_fx, imult1616( nchan_out_cov, nchan_out_cov ) ); // Q(31 - mixing_matrix_res_old_exp) - v_add_fixed_me( tmp_buf_fx, cov_state_old.mixing_matrix_res_old_exp[parameter_band_mapping.source_band_idx[new_param_band_idx][source_param_idx]], hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_fx[new_param_band_idx], hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_exp[new_param_band_idx], hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_fx[new_param_band_idx], &hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_exp[new_param_band_idx], imult1616( nchan_out_cov, nchan_out_cov ), 0 ); // Q(hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_exp[new_param_band_idx]) + v_multc_fx_16( cov_state_old.mixing_matrix_res_old_fx[parameter_band_mapping.source_band_idx[new_param_band_idx][source_param_idx]], parameter_band_mapping.source_band_factor_fx[new_param_band_idx][source_param_idx], tmp_buf_fx, imult1616( nchan_out_cov, nchan_out_cov ) ); // Q(31 - mixing_matrix_res_old_exp) + v_add_fx_me( tmp_buf_fx, cov_state_old.mixing_matrix_res_old_exp[parameter_band_mapping.source_band_idx[new_param_band_idx][source_param_idx]], hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_fx[new_param_band_idx], hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_exp[new_param_band_idx], hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_fx[new_param_band_idx], &hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_exp[new_param_band_idx], imult1616( nchan_out_cov, nchan_out_cov ), 0 ); // Q(hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_exp[new_param_band_idx]) } } } @@ -2414,8 +2414,8 @@ void ivas_param_mc_dec_render_fx( FOR( idx_lfe = 0; idx_lfe < hLsSetup.num_lfe; idx_lfe++ ) { /* Copy just the first band of LFE*/ - v_multc_fixed_16( Cldfb_RealBuffer_fx[hLsSetup.index_lfe[idx_lfe]][slot_idx], tmp, Cldfb_RealBuffer_fx[hLsSetup.index_lfe[idx_lfe]][slot_idx], 1 ); - v_multc_fixed_16( Cldfb_ImagBuffer_fx[hLsSetup.index_lfe[idx_lfe]][slot_idx], tmp, Cldfb_ImagBuffer_fx[hLsSetup.index_lfe[idx_lfe]][slot_idx], 1 ); + v_multc_fx_16( Cldfb_RealBuffer_fx[hLsSetup.index_lfe[idx_lfe]][slot_idx], tmp, Cldfb_RealBuffer_fx[hLsSetup.index_lfe[idx_lfe]][slot_idx], 1 ); + v_multc_fx_16( Cldfb_ImagBuffer_fx[hLsSetup.index_lfe[idx_lfe]][slot_idx], tmp, Cldfb_ImagBuffer_fx[hLsSetup.index_lfe[idx_lfe]][slot_idx], 1 ); Scale_sig32( Cldfb_RealBuffer_fx[hLsSetup.index_lfe[idx_lfe]][slot_idx], 1, tmp_exp ); Scale_sig32( Cldfb_ImagBuffer_fx[hLsSetup.index_lfe[idx_lfe]][slot_idx], 1, tmp_exp ); @@ -2423,8 +2423,8 @@ void ivas_param_mc_dec_render_fx( { IF( hLsSetup.index_lfe[idx_lfe] != ch ) { - v_add_fixed_no_hdrm( Cldfb_RealBuffer_fx[ch][slot_idx], Cldfb_RealBuffer_fx[hLsSetup.index_lfe[idx_lfe]][slot_idx], Cldfb_RealBuffer_fx[ch][slot_idx], 1 ); - v_add_fixed_no_hdrm( Cldfb_ImagBuffer_fx[ch][slot_idx], Cldfb_ImagBuffer_fx[hLsSetup.index_lfe[idx_lfe]][slot_idx], Cldfb_ImagBuffer_fx[ch][slot_idx], 1 ); + v_add_fx_no_hdrm( Cldfb_RealBuffer_fx[ch][slot_idx], Cldfb_RealBuffer_fx[hLsSetup.index_lfe[idx_lfe]][slot_idx], Cldfb_RealBuffer_fx[ch][slot_idx], 1 ); + v_add_fx_no_hdrm( Cldfb_ImagBuffer_fx[ch][slot_idx], Cldfb_ImagBuffer_fx[hLsSetup.index_lfe[idx_lfe]][slot_idx], Cldfb_ImagBuffer_fx[ch][slot_idx], 1 ); } } } @@ -3180,8 +3180,8 @@ static void ivas_param_mc_get_mixing_matrices_fx( /* smoothing gains are now identical to one, simply add up */ // v_add( Cy_state, Cy_old_state, Cy_full, nY_cov * nY_cov ); - v_add_fixed_me( Cx_state_fx, Cx_state_e, Cx_old_state_fx, hParamMC->h_output_synthesis_cov_state.cx_old_e[param_band_idx], Cx_fx, &Cx_e, imult1616( nX, nX ), 1 ); - v_add_fixed_me( Cy_state_fx, Cy_state_e, Cy_old_state_fx, hParamMC->h_output_synthesis_cov_state.cy_old_e[param_band_idx], Cy_full_fx, &Cy_full_e, imult1616( nY_cov, nY_cov ), 1 ); + v_add_fx_me( Cx_state_fx, Cx_state_e, Cx_old_state_fx, hParamMC->h_output_synthesis_cov_state.cx_old_e[param_band_idx], Cx_fx, &Cx_e, imult1616( nX, nX ), 1 ); + v_add_fx_me( Cy_state_fx, Cy_state_e, Cy_old_state_fx, hParamMC->h_output_synthesis_cov_state.cy_old_e[param_band_idx], Cy_full_fx, &Cy_full_e, imult1616( nY_cov, nY_cov ), 1 ); } Copy32( Cx_state_fx, Cx_old_state_fx, imult1616( nX, nX ) ); @@ -3850,7 +3850,7 @@ static ivas_error param_mc_get_diff_proto_info_fx( p_diff_proto_info->num_protos_diff = 1; move16(); - mvr2r_inc_fixed( proto_mtx, nchan_out_cov, proto_fac_fx, nchan_out_cov, nchan_transport ); + mvr2r_inc_fx( proto_mtx, nchan_out_cov, proto_fac_fx, nchan_out_cov, nchan_transport ); p_diff_proto_info->proto_index_diff[0] = 0; move16(); @@ -3901,7 +3901,7 @@ static ivas_error param_mc_get_diff_proto_info_fx( proto_mtx_ptr += nchan_out_cov; } - mvr2r_inc_fixed( proto_mtx + cur_out_ch, nchan_out_cov, proto_fac_fx + p_diff_proto_info->num_protos_diff, nchan_out_cov, nchan_transport ); + mvr2r_inc_fx( proto_mtx + cur_out_ch, nchan_out_cov, proto_fac_fx + p_diff_proto_info->num_protos_diff, nchan_out_cov, nchan_transport ); p_diff_proto_info->proto_index_diff[cur_out_ch] = p_diff_proto_info->num_protos_diff; move16(); diff --git a/lib_dec/ivas_mc_paramupmix_dec_fx.c b/lib_dec/ivas_mc_paramupmix_dec_fx.c index 6088abe198876fbbf112a7a21636c4873c728fe9..dd26815bdace9e3d0bd0107c7f56aeb261887c5f 100644 --- a/lib_dec/ivas_mc_paramupmix_dec_fx.c +++ b/lib_dec/ivas_mc_paramupmix_dec_fx.c @@ -235,7 +235,7 @@ void ivas_mc_paramupmix_dec_digest_tc( * *------------------------------------------------------------------------*/ -void ivas_mc_paramupmix_dec_render( +void ivas_mc_paramupmix_dec_render_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ @@ -252,7 +252,7 @@ void ivas_mc_paramupmix_dec_render( hMCParamUpmix = st_ivas->hMCParamUpmix; assert( hMCParamUpmix ); - push_wmops( "ivas_mc_paramupmix_dec_render" ); + push_wmops( "ivas_mc_paramupmix_dec_render_fx" ); FOR( ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++ ) { @@ -746,7 +746,7 @@ static void ivas_mc_paramupmix_dec_sf( Word32 Cldfb_RealBuffer_Binaural_fx[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; Word32 Cldfb_ImagBuffer_Binaural_fx[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - int16_t slot_index_start; + Word16 slot_index_start; hMCParamUpmix = st_ivas->hMCParamUpmix; assert( hMCParamUpmix ); diff --git a/lib_dec/ivas_mct_dec_fx.c b/lib_dec/ivas_mct_dec_fx.c index 2295cfe503d2bf45e98cedd2ede3b51904cd32bb..4571716d6c171341e923371e0ef5a5e1b2d22b06 100644 --- a/lib_dec/ivas_mct_dec_fx.c +++ b/lib_dec/ivas_mct_dec_fx.c @@ -199,12 +199,9 @@ ivas_error ivas_mct_dec_fx( move16(); } - /* MCT core decoder */ Word16 q_x[MAX_TRANSPORT_CHANNELS]; ivas_mct_core_dec( hMCT, st_ivas->hCPE, nCPE, output_fx, q_x ); - // Scaling output buffer back to Q11 - /* for sba to stereo output disable any further processing for TCs > 2 as it is not needed*/ test(); @@ -238,7 +235,6 @@ ivas_error ivas_mct_dec_fx( ivas_mdct_core_tns_ns_fx( hCPE, fUseTns[cpe_id], tnsData[cpe_id], x_fx, Aq_fx_32[cpe_id], 1, 20 ); } - test(); test(); IF( EQ_16( st_ivas->renderer_type, RENDERER_MC ) ) @@ -330,7 +326,6 @@ ivas_error ivas_mct_dec_fx( } } - /*----------------------------------------------------------------* * CoreCoder Post-processing and updates *----------------------------------------------------------------*/ @@ -376,6 +371,7 @@ ivas_error ivas_mct_dec_fx( return error; } Copy_Scale_sig_16_32_no_sat( synth_fx[n], output_fx[( cpe_id * CPE_CHANNELS ) + n], output_frame, sub( Q11, Q_synth ) ); // Q11 + /* Save synthesis for HQ FEC */ Word32 output_fx_[L_FRAME48k]; Copy32( output_fx[( cpe_id * CPE_CHANNELS ) + n], output_fx_, L_FRAME48k ); // Q11 @@ -438,6 +434,7 @@ ivas_error ivas_mct_dec_fx( * * Create, allocate and initialize IVAS decoder MCT handle *-------------------------------------------------------------------------*/ + ivas_error create_mct_dec_fx( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) @@ -530,6 +527,7 @@ ivas_error create_mct_dec_fx( hMCT->hBlockData[n]->ch2 = 0; move16(); move16(); + /*-----------------------------------------------------------------* * MDCT stereo initialization *-----------------------------------------------------------------*/ @@ -571,6 +569,7 @@ ivas_error create_mct_dec_fx( return IVAS_ERR_OK; } + /*------------------------------------------------------------------------- * mct_dec_reconfigure() * @@ -952,7 +951,6 @@ static ivas_error ivas_mc_dec_reconfig_fx( ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config ); /* transfer subframe info from DirAC or ParamMC to central tc buffer */ - if ( st_ivas->hTcBuffer->tc_buffer_mode != TC_BUFFER_MODE_BUFFER ) { test(); @@ -1321,6 +1319,7 @@ static ivas_error ivas_mc_dec_reconfig_fx( /*-----------------------------------------------------------------* * re-configure HP20 memories *-----------------------------------------------------------------*/ + IF( NE_32( ( error = ivas_hp20_dec_reconfig_fx( st_ivas, nchan_hp20_old ) ), IVAS_ERR_OK ) ) { return error; @@ -1393,6 +1392,7 @@ static ivas_error ivas_mc_dec_reconfig_fx( IF( st_ivas->hBinRenderer != NULL && ( NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) && NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ) ) { ivas_binRenderer_close_fx( &st_ivas->hBinRenderer ); + test(); IF( ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) ) { @@ -1494,6 +1494,7 @@ static ivas_error ivas_mc_dec_reconfig_fx( /*-----------------------------------------------------------------* * Allocate the LFE handle that is coded separately after the allocation of the core coders *-----------------------------------------------------------------*/ + test(); IF( ( EQ_16( st_ivas->mc_mode, MC_MODE_MCT ) || EQ_16( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) ) ) { @@ -1642,9 +1643,8 @@ static ivas_error ivas_mc_dec_reconfig_fx( } } - /*-----------------------------------------------------------------* - * floating-point output audio buffers + * output audio buffers *-----------------------------------------------------------------*/ nchan_out_buff = ivas_get_nchan_buffers_dec_fx( st_ivas, -1, -1 ); diff --git a/lib_dec/ivas_mct_dec_mct_fx_fx.c b/lib_dec/ivas_mct_dec_mct_fx_fx.c index 299a09a9346a8942db067338b024ab90a2bd2e6e..c5e884f4694db0c4903c45293998e6be42b6fd61 100644 --- a/lib_dec/ivas_mct_dec_mct_fx_fx.c +++ b/lib_dec/ivas_mct_dec_mct_fx_fx.c @@ -205,7 +205,7 @@ static void applyGlobalILD_fx( qratio = L_shl( qratio, q_qratio ); FOR( k = 0; k < nSubframes; k++ ) { - v_multc_fixed( x[ch][k], qratio, x[ch][k], L_subframeTCX ); // Qx - 5 + q_qratio + v_multc_fx( x[ch][k], qratio, x[ch][k], L_subframeTCX ); // Qx - 5 + q_qratio scale_sig32( x[ch][k], L_subframeTCX, sub( 5, q_qratio ) ); } } diff --git a/lib_dec/ivas_mdct_core_dec_fx.c b/lib_dec/ivas_mdct_core_dec_fx.c index 5b54997e910fe7c5ac56876812bbe2f5248f28a7..b951258852201ff1da3b8077675d4bf8cfc2e630 100644 --- a/lib_dec/ivas_mdct_core_dec_fx.c +++ b/lib_dec/ivas_mdct_core_dec_fx.c @@ -1612,7 +1612,7 @@ void ivas_mdct_core_tns_ns_fx( scf_e[ind] = sub( 15, q_shift ); move16(); } - TonalMDCTConceal_SaveFreqSignal_ivas_fx( st->hTonalMDCTConc, x_fx[ch][k], x_e, L_frameTCX[ch], L_frame[ch], &scf_fx[0], scf_e, 0, get_igf_startline( st, L_frame[ch], L_frameTCX[ch] ) ); + TonalMDCTConceal_SaveFreqSignal_ivas_fx( st->hTonalMDCTConc, x_fx[ch][k], x_e, L_frameTCX[ch], L_frame[ch], &scf_fx[0], scf_e, 0, get_igf_startline_fx( st, L_frame[ch], L_frameTCX[ch] ) ); } } ELSE @@ -1708,9 +1708,9 @@ void ivas_mdct_core_tns_ns_fx( however, this frame is nevertheless acting as an transition frame as also visible in L_frameTCX; thus, the safer approach to prevent high frequency artifacts is to apply the SNS up to L_frameTCX; in case this is not necessary, x[] is filled with zeros, and the multiplication is not causing any additional harm */ - v_multc_fixed( x_fx[ch][k] + st->hTcxCfg->psychParamsCurrent->nBins, sns_int_scf_fx[FDNS_NPTS - 1], x_fx[ch][k] + st->hTcxCfg->psychParamsCurrent->nBins, sub( s_max( L_spec[ch], L_frameTCX[ch] ), st->hTcxCfg->psychParamsCurrent->nBins ) ); + v_multc_fx( x_fx[ch][k] + st->hTcxCfg->psychParamsCurrent->nBins, sns_int_scf_fx[FDNS_NPTS - 1], x_fx[ch][k] + st->hTcxCfg->psychParamsCurrent->nBins, sub( s_max( L_spec[ch], L_frameTCX[ch] ), st->hTcxCfg->psychParamsCurrent->nBins ) ); #else - v_multc_fixed( x_fx[ch][k] + st->hTcxCfg->psychParamsCurrent->nBins, sns_int_scf_fx[FDNS_NPTS - 1], x_fx[ch][k] + st->hTcxCfg->psychParamsCurrent->nBins, sub( L_spec[ch], st->hTcxCfg->psychParamsCurrent->nBins ) ); + v_multc_fx( x_fx[ch][k] + st->hTcxCfg->psychParamsCurrent->nBins, sns_int_scf_fx[FDNS_NPTS - 1], x_fx[ch][k] + st->hTcxCfg->psychParamsCurrent->nBins, sub( L_spec[ch], st->hTcxCfg->psychParamsCurrent->nBins ) ); #endif q_2 = sub( add( q_x, q_sns_int_scf ), 31 ); diff --git a/lib_dec/ivas_mono_dmx_renderer_fx.c b/lib_dec/ivas_mono_dmx_renderer_fx.c index 848f457eb468cbf5486ec65b99905265ff1f82a0..f9b3de6ef5a43d7548ff05b7545cded874144b44 100644 --- a/lib_dec/ivas_mono_dmx_renderer_fx.c +++ b/lib_dec/ivas_mono_dmx_renderer_fx.c @@ -256,9 +256,8 @@ void ivas_ism_mono_dmx_fx( move16(); } - /* equalize the downmix */ - v_multc_fixed_16( proto_signal_fx, eq_fx, output_f_fx[0], output_frame ); + v_multc_fx_16( proto_signal_fx, eq_fx, output_f_fx[0], output_frame ); v_shr_32( output_f_fx[0], output_f_fx[0], output_frame, Q_shift ); return; @@ -329,8 +328,8 @@ void ivas_apply_non_diegetic_panning_fx( pan_left_fx = add( mult( non_diegetic_pan_gain_fx, 16384 ), 16384 ); // 0.5.Q15 = 16384 pan_right_fx = sub( 32767, pan_left_fx ); - v_multc_fixed( input_f_fx, L_shl( L_deposit_l( pan_right_fx ), 16 ), output_f_fx[1], output_frame ); - v_multc_fixed( input_f_fx, L_shl( L_deposit_l( pan_left_fx ), 16 ), output_f_fx[0], output_frame ); + v_multc_fx( input_f_fx, L_shl( L_deposit_l( pan_right_fx ), 16 ), output_f_fx[1], output_frame ); + v_multc_fx( input_f_fx, L_shl( L_deposit_l( pan_left_fx ), 16 ), output_f_fx[0], output_frame ); return; } diff --git a/lib_dec/ivas_objectRenderer_internal_fx.c b/lib_dec/ivas_objectRenderer_internal_fx.c index bb6f4fdabeea0b783852a064c8183956f2e59561..6de0709034bbf422519cb6ff418a1e3106118d16 100644 --- a/lib_dec/ivas_objectRenderer_internal_fx.c +++ b/lib_dec/ivas_objectRenderer_internal_fx.c @@ -379,6 +379,7 @@ ivas_error ivas_td_binaural_renderer_sf_splitBinaural( { continue; } + IF( ( error = ivas_td_binaural_open_unwrap_fx( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_transport, diff --git a/lib_dec/ivas_omasa_dec_fx.c b/lib_dec/ivas_omasa_dec_fx.c index 38afd799073c70d97bb73b1dea31644042f158da..aa2034d2bcecabbed7653eb817f95ce16ca267f5 100644 --- a/lib_dec/ivas_omasa_dec_fx.c +++ b/lib_dec/ivas_omasa_dec_fx.c @@ -818,7 +818,7 @@ ivas_error ivas_omasa_dec_config_fx( } /*-----------------------------------------------------------------* - * floating-point output audio buffers + * output audio buffers *-----------------------------------------------------------------*/ nchan_out_buff = ivas_get_nchan_buffers_dec_fx( st_ivas, -1, -1 ); diff --git a/lib_dec/ivas_osba_dec_fx.c b/lib_dec/ivas_osba_dec_fx.c index 3aae0517988ad88923af7e492d1a886e835662e3..7cecc50d7898ecfaa9353064b0a7fec95c1924b3 100644 --- a/lib_dec/ivas_osba_dec_fx.c +++ b/lib_dec/ivas_osba_dec_fx.c @@ -228,6 +228,7 @@ ivas_error ivas_osba_dirac_td_binaural_jbm_fx( } } } + return IVAS_ERR_OK; } @@ -292,7 +293,7 @@ ivas_error ivas_osba_render_sf_fx( if ( !st_ivas->hDecoderConfig->Opt_tsm ) { - int16_t tc_offset; + Word16 tc_offset; tc_offset = st_ivas->hTcBuffer->n_samples_rendered; for ( n = 0; n < st_ivas->nchan_ism; n++ ) { @@ -314,7 +315,7 @@ ivas_error ivas_osba_render_sf_fx( { IF( NE_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ) { - v_add_fixed_no_hdrm( p_output[n], p_output_ism[n], p_output[n], *nSamplesRendered ); + v_add_fx_no_hdrm( p_output[n], p_output_ism[n], p_output[n], *nSamplesRendered ); } } @@ -339,10 +340,6 @@ void ivas_osba_stereo_add_channels_fx( { Word16 n; -#if 0 - IF ( ism_mode == ISM_SBA_MODE_DISC ) - { -#endif IF( NE_16( gain, ONE_IN_Q11 ) ) { assert( 0 && "Object editing is not implemented in the BASOP code!" ); @@ -351,19 +348,9 @@ void ivas_osba_stereo_add_channels_fx( { FOR( n = 0; n < nchan_out; n++ ) { - v_add_fixed_no_hdrm( output_fx[n], tc_fx[n + nchan_ism], output_fx[n], n_samples_to_render ); - } - } -#if 0 - } - ELSE - { - FOR( n = 0; n < nchan_out; n++ ) - { - v_add_fixed_no_hdrm( output_fx[n], tc_fx[n + nchan_ism], output_fx[n], n_samples_to_render ); + v_add_fx_no_hdrm( output_fx[n], tc_fx[n + nchan_ism], output_fx[n], n_samples_to_render ); } } -#endif return; } diff --git a/lib_dec/ivas_qmetadata_dec_fx.c b/lib_dec/ivas_qmetadata_dec_fx.c index f71a40e1cd353b67a81860dd8d88457a6a77b458..cc98c6ec494fba2b1fd1895bfb3e35de277421ce 100644 --- a/lib_dec/ivas_qmetadata_dec_fx.c +++ b/lib_dec/ivas_qmetadata_dec_fx.c @@ -1190,7 +1190,7 @@ Word16 ivas_qmetadata_dec_sid_decode( IF( EQ_16( ivas_format, SBA_FORMAT ) ) { sba_spar_bitlen = ivas_sba_spar_sid_bitlen_fx( nchan_transport ); - metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS - SBA_ORDER_BITS - SBA_PLANAR_BITS - 1; /* -1 for inactive mode header bit*/ + metadata_sid_bits = (Word16) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS - SBA_ORDER_BITS - SBA_PLANAR_BITS - 1; /* -1 for inactive mode header bit*/ metadata_sid_bits = sub( metadata_sid_bits, sba_spar_bitlen ); } ELSE diff --git a/lib_dec/ivas_rom_dec_fx.c b/lib_dec/ivas_rom_dec_fx.c index 8b2a2d27e30190397fede143c25f4d1ac07b923c..ae0ccf31ce837c7488dc9683bad2da8e4fd0a18e 100644 --- a/lib_dec/ivas_rom_dec_fx.c +++ b/lib_dec/ivas_rom_dec_fx.c @@ -357,8 +357,6 @@ const UWord16 * const sym_freq_ECSQ_tab_abs_lsbs[1 + 4] = * DirAC ROM tables *----------------------------------------------------------------------------------*/ - - /*Q10*/ const Word16 dirac_dithering_azi_scale_fx[DIRAC_DIFFUSE_LEVELS] = { @@ -369,10 +367,6 @@ const Word16 dirac_dithering_ele_scale_fx[DIRAC_DIFFUSE_LEVELS] = { 1375 ,2072 ,3680 ,5743 ,9468 ,15979 ,21410 ,28252 }; -/*----------------------------------------------------------------------------------* - * FASTCONV and PARAMETRIC binaural renderer ROM tables - *----------------------------------------------------------------------------------*/ - /*----------------------------------------------------------------------* diff --git a/lib_dec/ivas_sba_dec_fx.c b/lib_dec/ivas_sba_dec_fx.c index d37ae4c0f509b38c40bafd83a81cd36a491f93c9..63463d444beafd20f75149b3ac4af1d60cf70766 100644 --- a/lib_dec/ivas_sba_dec_fx.c +++ b/lib_dec/ivas_sba_dec_fx.c @@ -575,6 +575,7 @@ ivas_error ivas_sba_dec_reconfigure_fx( { return error; } + nchan_transport = add( nchan_transport, st_ivas->nchan_ism ); st_ivas->nCPE = shr_r( nchan_transport, 1 ); move16(); @@ -591,6 +592,7 @@ ivas_error ivas_sba_dec_reconfigure_fx( { ivas_td_binaural_close_fx( &st_ivas->hBinRendererTd ); } + nchan_transport = st_ivas->nchan_transport; move16(); nchan_transport_old = add( nchan_transport_old, st_ivas->nchan_ism ); /*Q0*/ @@ -747,7 +749,7 @@ ivas_error ivas_sba_dec_reconfigure_fx( } /*-----------------------------------------------------------------* - * floating-point output audio buffers + * output audio buffers *-----------------------------------------------------------------*/ nchan_out_buff = ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); /*Q0*/ diff --git a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c index cf22a4048ff6a45d7ca201e8b362a9de48d1181c..42a2524f1f6676a2f216159767685da2dbb0d4ae 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c @@ -622,6 +622,7 @@ static void map_params_dirac_to_stereo( move32(); } } + /* Clamp values here. [-1, 1] is the allowed range, but due to precision issues they can be slightly off which can cause problems later. */ /* In Q31, this clamping happens implicitly */ q_sqrt = 0; @@ -642,6 +643,7 @@ static void map_params_dirac_to_stereo( q_sqrt = 0; move16(); } + /* for residual prediction gain, allowed range is [0, 1]*/ res_pred_gain[b] = L_max( Mpy_32_16_1( diffuseness[b], sub( MAX_16, surrCoh[b] ) ), 0 ); /*Q31*/ move32(); diff --git a/lib_dec/ivas_sba_rendering_internal_fx.c b/lib_dec/ivas_sba_rendering_internal_fx.c index 7a96185b9c7a8838e8cfd40e4502a9ad1a610b60..af03f4b6ef9d61a6c78a50dfbc36b4f5cecea547 100644 --- a/lib_dec/ivas_sba_rendering_internal_fx.c +++ b/lib_dec/ivas_sba_rendering_internal_fx.c @@ -49,7 +49,7 @@ * SBA signals transformed into MC in CLDFB domain *-------------------------------------------------------------------------*/ -void ivas_sba2mc_cldfb_fixed( +void ivas_sba2mc_cldfb_fx( IVAS_OUTPUT_SETUP hInSetup, /* i : Format of input layout */ Word32 RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: cldfb real part (Q_real) */ Word32 ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: cldfb imag part (Q_imag) */ @@ -65,10 +65,10 @@ void ivas_sba2mc_cldfb_fixed( Word32 *p_real_fx, *p_imag_fx, *p_realOut_fx, *p_imagOut_fx; Word16 nb_channels_in; - push_wmops( "ivas_sba2mc_cldfb_fixed" ); + push_wmops( "ivas_sba2mc_cldfb_fx" ); nb_channels_in = hInSetup.nchan_out_woLFE; /*Q0*/ move16(); - assert( EQ_16( nb_channels_in, 16 ) && EQ_16( nb_channels_out, 11 ) && "ivas_sba2mc_cldfb_fixed; only HOA3 to CICP19 is for now supported!" ); + assert( EQ_16( nb_channels_in, 16 ) && EQ_16( nb_channels_out, 11 ) && "ivas_sba2mc_cldfb_fx; only HOA3 to CICP19 is for now supported!" ); FOR( n = 0; n < nb_channels_out; n++ ) { diff --git a/lib_dec/ivas_spar_decoder_fx.c b/lib_dec/ivas_spar_decoder_fx.c index 475b6c88edff5b4541545542641162a37cdb1289..b0a802270e2d51a5cf61214b4903cf9c65d54516 100644 --- a/lib_dec/ivas_spar_decoder_fx.c +++ b/lib_dec/ivas_spar_decoder_fx.c @@ -708,7 +708,7 @@ void ivas_spar_get_cldfb_gains_fx( cf_end = add( sub( hSpar->hFbMixer->cross_fade_end_offset, encfb_delay ), decfb_delay ); /*Q0*/ cf_len = sub( cf_end, cf_start ); weights_fx = hSpar->hFbMixer->cldfb_cross_fade_fx; /*hSpar->hFbMixer->cldfb_cross_fade_q*/ - cf_cldfb_start = shr( extract_l( ceil_fixed( sub( divide1616( sub( cf_start, shr( decfb_delay, 1 ) ), shl( stride, 9 ) ), 32 ), 6 ) ), 6 ); /*Q0*/ + cf_cldfb_start = shr( extract_l( ceil_fx( sub( divide1616( sub( cf_start, shr( decfb_delay, 1 ) ), shl( stride, 9 ) ), 32 ), 6 ) ), 6 ); /*Q0*/ cf_cldfb_end = shr( divide1616( add( sub( cf_start, shr( decfb_delay, 1 ) ), cf_len ), shl( stride, 9 ) ), 6 ); /*q-factor of stride is 9(as max value is 60)*/ /*Q0*/ num_cf_slots = add( sub( cf_cldfb_end, cf_cldfb_start ), 1 ); /*Q0*/ num_samples = add( imult1616( num_cf_slots, stride ), sub( pt_len, stride ) ); /*Q0*/ diff --git a/lib_dec/ivas_stereo_cng_dec_fx.c b/lib_dec/ivas_stereo_cng_dec_fx.c index b8336c928b752dbbae8c6745e4a550fd62825ba8..1f0cff11077368b5c1310c38e19172fc40cb71ae 100644 --- a/lib_dec/ivas_stereo_cng_dec_fx.c +++ b/lib_dec/ivas_stereo_cng_dec_fx.c @@ -59,8 +59,8 @@ #define CM_INIT 50 #define CORR_INIT 8 #define SID_INIT 6 -#define STEREO_CNA_LR_CORR_LT_FILT_FX 2040109440 /* long-term averaging factor for L/R correlation estimation in stereo CNA */ -#define STEREO_CNA_ILD_LT_FILT_FX 1932735283 /* long-term averaging factor for ILD estimation in stereo CNA */ +#define STEREO_CNA_LR_CORR_LT_FILT_FX 2040109440 /* long-term averaging factor for L/R correlation estimation in stereo CNA, == 0.95f */ +#define STEREO_CNA_ILD_LT_FILT_FX 1932735283 /* long-term averaging factor for ILD estimation in stereo CNA, == 0.9f */ /*------------------------------------------------------------------- * stereo_dft_dec_sid_coh() diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c index 37d441aca4d6ca527cb2d51d26d21c5504d6c5bd..aa8d428c7af303c3412fca48b142e3ab22c09220 100644 --- a/lib_dec/ivas_stereo_dft_dec_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_fx.c @@ -4351,11 +4351,10 @@ void stereo_dft_dec_read_BS_fx( ecsq_inst.config_index = sub( shl( hStereoDft->res_cod_mode[k_offset], 1 ), 1 ); /* Q0 */ move16(); - ECSQ_decode( &ecsq_inst, hStereoDft->res_cod_line_max, dec ); + ECSQ_decode_fx( &ecsq_inst, hStereoDft->res_cod_line_max, dec ); n_bits = rc_uni_dec_virtual_finish_fx( &range_uni_dec_state ); /* Q0 */ - set_zero_fx( res_buf_fx, STEREO_DFT_N_8k ); FOR( Word16 c = 0; c < hStereoDft->res_cod_line_max; c++ ) { diff --git a/lib_dec/ivas_stereo_dft_plc_fx.c b/lib_dec/ivas_stereo_dft_plc_fx.c index c29e1e4b54805a2b8dcfb596281740043c7d59b9..4b47d0a1d840d2564975bc4e57e5b3039fb4169c 100644 --- a/lib_dec/ivas_stereo_dft_plc_fx.c +++ b/lib_dec/ivas_stereo_dft_plc_fx.c @@ -124,7 +124,7 @@ void stereo_dft_res_ecu_fx( rfft_fx( res_buf, trigo_dec, L_FRAME8k, +1 ); - v_multc_fixed_16( res_buf, fac, res_buf, L_FRAME8k ); /* hStereoDft->q_dft */ + v_multc_fx_16( res_buf, fac, res_buf, L_FRAME8k ); /* hStereoDft->q_dft */ Copy32( res_buf + ( OFFSET8k - ZP8k ), &hStereoDft->res_cod_mem_fx[0], STEREO_DFT_OVL_8k ); /* hStereoDft->q_dft */ hStereoDft->q_res_cod_mem_fx = hStereoDft->q_dft; move16(); @@ -145,7 +145,7 @@ void stereo_dft_res_ecu_fx( v_shr_32( res_buf, res_buf, L_FRAME8k, negate( q_shift ) ); /* hStereoDft->q_dft */ - v_multc_fixed( res_buf, fac, res_buf, L_FRAME8k ); /* hStereoDft->q_dft */ + v_multc_fx( res_buf, fac, res_buf, L_FRAME8k ); /* hStereoDft->q_dft */ /* Cross-fade memory */ fac = 0; @@ -756,7 +756,7 @@ void stereo_dft_res_ecu_burst_att_fx( fac = L_sub( MAX_32, L_deposit_h( BASOP_Util_Divide3232_Scale( L_sub( hStereoDft->time_offs, L_ana ), L_add( hStereoDft->time_offs, L_ana ), &q_fac ) ) ); /* Q0 */ } - v_multc_fixed( pDFT_RES, fac, pDFT_RES, shl( L_res, 1 ) ); + v_multc_fx( pDFT_RES, fac, pDFT_RES, shl( L_res, 1 ) ); return; } diff --git a/lib_dec/ivas_stereo_eclvq_dec_fx.c b/lib_dec/ivas_stereo_eclvq_dec_fx.c index dfa411145fc3ce2930203029047d821a1d37e45d..df7158c85caa580a15df7c9797e95d5edbe6b3a0 100644 --- a/lib_dec/ivas_stereo_eclvq_dec_fx.c +++ b/lib_dec/ivas_stereo_eclvq_dec_fx.c @@ -119,7 +119,7 @@ static Word16 arith_decode_prob_escape( * the dequantized vector is obtained using the ECSQ_dequantize_vector method * ---------------------------------------------------------------*/ -void ECSQ_decode( +void ECSQ_decode_fx( ECSQ_instance *ecsq_inst, const Word16 N, /* Q0 */ Word16 *output /* Q0 */ diff --git a/lib_dec/ivas_stereo_icbwe_dec_fx.c b/lib_dec/ivas_stereo_icbwe_dec_fx.c index 8ef404ede324f9b8dab878f5eb378d42e56fd88f..d5b289acfa39f8888e9dee25efef36f0a41ee389 100644 --- a/lib_dec/ivas_stereo_icbwe_dec_fx.c +++ b/lib_dec/ivas_stereo_icbwe_dec_fx.c @@ -121,9 +121,8 @@ void stereo_icBWE_dec_fx( const Word16 *fb_synth_ref_fx, /* i : ref. high-band synthesis 16-20 kHz Q_white_exc*/ const Word16 *voice_factors_fx, /* i : voicing factors Q15 */ const Word16 output_frame, /* i : frame length Q0 */ - Word16 *Q_syn /* i : Q of synth and synthRef buffers */ - , - const Word16 Q_white_exc /* i : Q of fb_synth_ref_fx */ + Word16 *Q_syn, /* i : Q of synth and synthRef buffers */ + const Word16 Q_white_exc /* i : Q of fb_synth_ref_fx */ ) { Word16 i, j, k, nbSubFr; @@ -427,7 +426,7 @@ void stereo_icBWE_dec_fx( test(); IF( LT_32( hCPE->hStereoDftDmx->targetGain_fx, 268435456 /* 0.5 in Q29 */ ) || GT_32( hCPE->hStereoDftDmx->targetGain_fx, 1073741824 /* 2.0 in Q29 */ ) ) { - v_multc_fixed_16_16( voice_factors_fx, 16384 /* 0.5 in Q15 */, nlMixFac_fx, NB_SUBFR16k ); + v_multc_fx_16_16( voice_factors_fx, 16384 /* 0.5 in Q15 */, nlMixFac_fx, NB_SUBFR16k ); } } ELSE @@ -435,7 +434,7 @@ void stereo_icBWE_dec_fx( test(); IF( LT_32( hCPE->hStereoTCA->targetGain_fx, 268435456 /* 0.5 in Q29 */ ) || GT_32( hCPE->hStereoTCA->targetGain_fx, 1073741824 /* 2.0 in Q29 */ ) ) { - v_multc_fixed_16_16( voice_factors_fx, 16384 /* 0.5 in Q15 */, nlMixFac_fx, NB_SUBFR16k ); + v_multc_fx_16_16( voice_factors_fx, 16384 /* 0.5 in Q15 */, nlMixFac_fx, NB_SUBFR16k ); } } @@ -636,7 +635,7 @@ void stereo_icBWE_dec_fx( IF( EQ_16( st->extl, FB_TBE ) ) { - v_multc_fixed_16_16( fb_synth_ref_fx, gsMapping_fx, fb_synth_nonref_fx, L_FRAME48k ); + v_multc_fx_16_16( fb_synth_ref_fx, gsMapping_fx, fb_synth_nonref_fx, L_FRAME48k ); } /* generate 32kHz SHB synthesis from 12.8(16)kHz signal */ diff --git a/lib_dec/ivas_stereo_mdct_core_dec_fx.c b/lib_dec/ivas_stereo_mdct_core_dec_fx.c index b2a894a34286b4c3a56972f9b2849ebc849c4d48..eebfa267cf08cec433419553c956cd95fda23383 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_core_dec_fx.c @@ -411,7 +411,7 @@ void stereo_mdct_core_dec_fx( } Word16 s = getScaleFactor32( x_fx[ch][k], L_frameTCX[ch] ); Scale_sig32( x_fx[ch][k], L_frameTCX[ch], s ); /* exp(x_e + 31 - s) */ - TonalMDCTConceal_SaveFreqSignal_ivas_fx( st->hTonalMDCTConc, x_fx[ch][k], sub( x_e[ch][k], s ), L_frameTCX[ch], L_frame[ch], &scf_fx[0], scf_e, 0, get_igf_startline( st, L_frame[ch], L_frameTCX[ch] ) ); + TonalMDCTConceal_SaveFreqSignal_ivas_fx( st->hTonalMDCTConc, x_fx[ch][k], sub( x_e[ch][k], s ), L_frameTCX[ch], L_frame[ch], &scf_fx[0], scf_e, 0, get_igf_startline_fx( st, L_frame[ch], L_frameTCX[ch] ) ); Scale_sig32( x_fx[ch][k], L_frameTCX[ch], negate( s ) ); /* exp(x_e) */ } } diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c index c34fd8624480edd51282215f38a2c11303811c05..43dc48edfad2aa4e00376d17c73518e183879561 100644 --- a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c @@ -48,12 +48,16 @@ static void inverseBwMS_fx( const Word16 startLine, const Word16 stopLine, Word32 x0[], Word32 x1[], const Word32 norm_fac ); -#define NF_RED_FAC_FIXED 1610612736 // Q31 -#define SQRT2_OVER_2_FIXED 1518500250 // Q31 -#define POINT_8_FIXED 1717986918 // Q31 -#define POINT_2_FIXED 429496730 // Q31 -#define ONE_POINT_3_FIXED 87241523 // Q26 -#define POINT_9_FIXED 60397978 // Q26 +/*-------------------------------------------------------------------* + * Local constants + *-------------------------------------------------------------------*/ + +#define NF_RED_FAC_FX 1610612736 // Q31 +#define POINT_8_FX 1717986918 // Q31 +#define POINT_2_FX 429496730 // Q31 +#define ONE_POINT_3_FX 87241523 // Q26 +#define POINT_9_FX 60397978 // Q26 + /*-------------------------------------------------------------------* * parse_stereo_from_bitstream @@ -250,6 +254,7 @@ void parse_stereo_from_bitstream( * * Band-wise M/S stereo processing *-------------------------------------------------------------------*/ + static void inverseBwMS_fx( const Word16 startLine, /* i : start line of sfb Q0*/ const Word16 stopLine, /* i : stop line of sfb Q0*/ @@ -280,6 +285,7 @@ static void inverseBwMS_fx( * * M/S stereo processing *-------------------------------------------------------------------*/ + void inverseMS_fx( const Word16 L_frame, /* i : frame length Q0*/ Word32 x0[], /* i/o: mid/left channel coefficients Qx*/ @@ -298,8 +304,9 @@ void inverseMS_fx( * * apply stereo processing (inverse MS and global ILD) *-------------------------------------------------------------------*/ + void stereo_decoder_tcx_fx( - STEREO_MDCT_DEC_DATA *hStereoMdct, /* i/o: MDCT stereo decoder structure */ + STEREO_MDCT_DEC_DATA *hStereoMdct, /* i/o: MDCT stereo decoder structure */ Word16 ms_mask[NB_DIV][MAX_SFB], /* i : bandwise MS mask Q0*/ Word32 *spec_r_0[NB_DIV], /* i/o: spectrum right channel Qx*/ Word32 *spec_l[], /* i/o: spectrum left channel [NB_DIV][N] Qx*/ @@ -355,11 +362,11 @@ void stereo_decoder_tcx_fx( { IF( EQ_32( spec_r_0[k][i], 0 ) ) { - spec_r[k][i] = Mpy_32_32( spec_r[k][i], NF_RED_FAC_FIXED ); /* Qx */ + spec_r[k][i] = Mpy_32_32( spec_r[k][i], NF_RED_FAC_FX ); /* Qx */ move32(); } } - inverseMS_fx( sfbConf->sfbOffset[sfbConf->nBandsStereoCore], spec_l[k], spec_r[k], SQRT2_OVER_2_FIXED ); + inverseMS_fx( sfbConf->sfbOffset[sfbConf->nBandsStereoCore], spec_l[k], spec_r[k], SQRT2_OVER_2_FX ); } ELSE IF( EQ_16( mdct_stereo_mode[k], SMDCT_BW_MS ) ) { @@ -371,11 +378,11 @@ void stereo_decoder_tcx_fx( { IF( EQ_32( spec_r_0[k][i], 0 ) ) { - spec_r[k][i] = Mpy_32_32( spec_r[k][i], NF_RED_FAC_FIXED ); /* Qx */ + spec_r[k][i] = Mpy_32_32( spec_r[k][i], NF_RED_FAC_FX ); /* Qx */ move32(); } } - inverseBwMS_fx( sfbConf->sfbOffset[sfb], sfbConf->sfbOffset[sfb + 1], spec_l[k], spec_r[k], SQRT2_OVER_2_FIXED ); + inverseBwMS_fx( sfbConf->sfbOffset[sfb], sfbConf->sfbOffset[sfb + 1], spec_l[k], spec_r[k], SQRT2_OVER_2_FX ); } } } @@ -388,11 +395,11 @@ void stereo_decoder_tcx_fx( { IF( EQ_32( spec_r_0[k][i], 0 ) ) { - spec_r[k][i] = Mpy_32_32( spec_r[k][i], NF_RED_FAC_FIXED ); /* Qx */ + spec_r[k][i] = Mpy_32_32( spec_r[k][i], NF_RED_FAC_FX ); /* Qx */ move32(); } } - inverseMS_fx( sub( sfbConf->sfbOffset[sfbConf->sfbCnt], sfbConf->sfbOffset[sfbConf->nBandsStereoCore] ), &spec_l[k][sfbConf->sfbOffset[sfbConf->nBandsStereoCore]], &spec_r[k][sfbConf->sfbOffset[sfbConf->nBandsStereoCore]], SQRT2_OVER_2_FIXED ); + inverseMS_fx( sub( sfbConf->sfbOffset[sfbConf->sfbCnt], sfbConf->sfbOffset[sfbConf->nBandsStereoCore] ), &spec_l[k][sfbConf->sfbOffset[sfbConf->nBandsStereoCore]], &spec_r[k][sfbConf->sfbOffset[sfbConf->nBandsStereoCore]], SQRT2_OVER_2_FX ); } ELSE IF( EQ_16( hStereoMdct->IGFStereoMode[k], SMDCT_BW_MS ) ) { @@ -404,11 +411,11 @@ void stereo_decoder_tcx_fx( { IF( EQ_32( spec_r_0[k][i], 0 ) ) { - spec_r[k][i] = Mpy_32_32( spec_r[k][i], NF_RED_FAC_FIXED ); /* Qx */ + spec_r[k][i] = Mpy_32_32( spec_r[k][i], NF_RED_FAC_FX ); /* Qx */ move32(); } } - inverseBwMS_fx( sfbConf->sfbOffset[sfb], sfbConf->sfbOffset[sfb + 1], spec_l[k], spec_r[k], SQRT2_OVER_2_FIXED ); + inverseBwMS_fx( sfbConf->sfbOffset[sfb], sfbConf->sfbOffset[sfb + 1], spec_l[k], spec_r[k], SQRT2_OVER_2_FX ); } } } @@ -420,15 +427,15 @@ void stereo_decoder_tcx_fx( tmp_32 = L_shr( tmp_32, sub( 5, tmp_e ) ); /* nrgRatio = nrg[1]/nrg[0] */ // Q26 nrgRatio = L_sub( tmp_32, ONE_IN_Q26 ); // Q26 - hStereoMdct->smooth_ratio_fx = W_extract_h( W_mac_32_32( W_mult_32_32( POINT_8_FIXED, hStereoMdct->smooth_ratio_fx ), POINT_2_FIXED, nrgRatio ) ); // Q26 + hStereoMdct->smooth_ratio_fx = W_extract_h( W_mac_32_32( W_mult_32_32( POINT_8_FX, hStereoMdct->smooth_ratio_fx ), POINT_2_FX, nrgRatio ) ); // Q26 move32(); /* set flag to reverse dmx computation in case of right-side panning, only relevant for mono output */ - IF( GT_32( hStereoMdct->smooth_ratio_fx, ONE_POINT_3_FIXED ) ) + IF( GT_32( hStereoMdct->smooth_ratio_fx, ONE_POINT_3_FX ) ) { hStereoMdct->reverse_dmx = 1; /* Q0 */ move16(); } - ELSE IF( LT_32( hStereoMdct->smooth_ratio_fx, POINT_9_FIXED ) ) + ELSE IF( LT_32( hStereoMdct->smooth_ratio_fx, POINT_9_FX ) ) { hStereoMdct->reverse_dmx = 0; /* Q0 */ move16(); @@ -463,16 +470,16 @@ void stereo_decoder_tcx_fx( IF( ( GT_32( nrgRatio, ONE_IN_Q26 ) ) && ( LT_16( k, tmp1 ) ) ) { shift = norm_l( nrgRatio ); - nrgRatio = L_shl( nrgRatio, shift ); /* Q26 + shift */ - v_multc_fixed( spec_r[k], nrgRatio, spec_r[k], L_frameTCX_r ); /* spec_r will be in Qx + shift - Q5 */ - Scale_sig32( spec_r[k], L_frameTCX_r, sub( 5, shift ) ); /* Qx */ + nrgRatio = L_shl( nrgRatio, shift ); /* Q26 + shift */ + v_multc_fx( spec_r[k], nrgRatio, spec_r[k], L_frameTCX_r ); /* spec_r will be in Qx + shift - Q5 */ + Scale_sig32( spec_r[k], L_frameTCX_r, sub( 5, shift ) ); /* Qx */ } ELSE IF( ( LT_32( nrgRatio, ONE_IN_Q26 ) ) && ( LT_16( k, tmp2 ) ) ) { inv_nrgRatio = BASOP_Util_Divide3232_Scale_newton( ONE_IN_Q26, nrgRatio, &tmp_e ); shift = sub( 5, tmp_e ); - v_multc_fixed( spec_l[k], inv_nrgRatio, spec_l[k], L_frameTCX_l ); /* spec_r will be in Qx - tmp_e */ - Scale_sig32( spec_l[k], L_frameTCX_l, sub( 5, shift ) ); /* Qx */ + v_multc_fx( spec_l[k], inv_nrgRatio, spec_l[k], L_frameTCX_l ); /* spec_r will be in Qx - tmp_e */ + Scale_sig32( spec_l[k], L_frameTCX_l, sub( 5, shift ) ); /* Qx */ } } } /* for k */ @@ -659,15 +666,12 @@ void synchonize_channels_mdct_sid_fx( * between active/inactive coding in MDCT-Stereo DTX *-------------------------------------------------------------------*/ -// helper function -static void update_exp( Word16 *a_exp, Word16 *b_exp, Word16 *buff_a, Word16 *buff_b, Word16 legth ); - static void update_exp( Word16 *a_exp, Word16 *b_exp, - Word16 *buff_a, /* exp(a_exp) */ - Word16 *buff_b, /* exp(b_exp) */ - Word16 legth /* Q0 */ + Word16 *buff_a, /* exp(a_exp) */ + Word16 *buff_b, /* exp(b_exp) */ + const Word16 legth /* Q0 */ ) { Word16 diff = 0; diff --git a/lib_dec/ivas_stereo_switching_dec_fx.c b/lib_dec/ivas_stereo_switching_dec_fx.c index 2cd075478f6dc237099144841f8496d8ad00b639..da6adcf338b516d34c97671912252022e0075d3e 100644 --- a/lib_dec/ivas_stereo_switching_dec_fx.c +++ b/lib_dec/ivas_stereo_switching_dec_fx.c @@ -425,10 +425,10 @@ ivas_error stereo_memory_dec_fx( { assert( hCPE->hCoreCoder[0]->hHQ_core->Q_old_out_fx32 == hCPE->hCoreCoder[1]->hHQ_core->Q_old_out_fx32 ); v_add_32( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, hCPE->hCoreCoder[1]->hHQ_core->old_out_fx32, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, extract_l( Mpy_32_16_1( output_Fs, INV_FRAME_PER_SEC_Q15 ) ) ); /* exp(exp_old_out) */ - v_multc_fixed_16( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, 16384 /* 0.5 in Q15 */, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, extract_l( Mpy_32_16_1( output_Fs, INV_FRAME_PER_SEC_Q15 ) ) ); /* exp(exp_old_out) */ + v_multc_fx_16( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, 16384 /* 0.5 in Q15 */, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, extract_l( Mpy_32_16_1( output_Fs, INV_FRAME_PER_SEC_Q15 ) ) ); /* exp(exp_old_out) */ v_add_32( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, hCPE->hCoreCoder[1]->hHQ_core->old_out_LB_fx32, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, L_FRAME32k ); /* q_old_outLB_fx */ - v_multc_fixed_16( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, 16384 /* 0.5 in Q15 */, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, L_FRAME32k ); /* exp(exp_old_out) */ + v_multc_fx_16( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, 16384 /* 0.5 in Q15 */, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, L_FRAME32k ); /* exp(exp_old_out) */ } /*--------------------------------------------------------------* @@ -2140,12 +2140,10 @@ void stereo_td2dft_update_fx( } ELSE IF( EQ_16( hCPE->element_mode, IVAS_CPE_MDCT ) && hCPE->input_mem_fx[0] != NULL ) { - /* update DFT stereo OLA memories */ /*set_zero( hCPE->input_mem_LB[n], STEREO_DFT32MS_OVL_16k );*/ L_lerp_fx_q11( output_fx + sub( sts[n]->L_frame, ovl ), hCPE->input_mem_LB_fx[n], STEREO_DFT32MS_OVL_16k, ovl ); - /* TCX synthesis (it was already delayed in TD stereo in core_switching_post_dec()) */ IF( sts[n]->hTcxDec != NULL ) { diff --git a/lib_dec/ivas_tcx_core_dec_fx.c b/lib_dec/ivas_tcx_core_dec_fx.c index 077c5b2f425820f428578e9969d495afd646faee..b36aad0c187920f8cfcb38dd974b11b18415b28a 100644 --- a/lib_dec/ivas_tcx_core_dec_fx.c +++ b/lib_dec/ivas_tcx_core_dec_fx.c @@ -458,7 +458,7 @@ void stereo_tcx_core_dec_fx( Copy( &lsfnew_uw_fx[k * M], &lsf_fx[( k + 1 ) * M], M ); /* Q2.56 */ Copy( &lsfnew_uw_fx[k * M], &lsf_tmp_fx[( k + 1 ) * M], M ); /* Q2.56 */ - v_multc_fixed_16_16( &lsf_tmp_fx[( k + 1 ) * M], sr_core_ratio, &lsf_tmp_fx[( k + 1 ) * M], M ); + v_multc_fx_16_16( &lsf_tmp_fx[( k + 1 ) * M], sr_core_ratio, &lsf_tmp_fx[( k + 1 ) * M], M ); Scale_sig( &lsf_tmp_fx[( k + 1 ) * M], M, tmp ); test(); IF( !st->lpcQuantization && EQ_32( st->sr_core, INT_FS_16k_FX ) ) diff --git a/lib_dec/jbm_jb4sb_fx.c b/lib_dec/jbm_jb4sb_fx.c index 6357c3a1bc70165220d678a281b327c663a0e179..2c36024b8015a86e61f1421a57e28653b04b2859 100644 --- a/lib_dec/jbm_jb4sb_fx.c +++ b/lib_dec/jbm_jb4sb_fx.c @@ -1330,7 +1330,7 @@ static void JB4_estimateShortTermJitter( } IF( temp != 0 ) { - temp = L_shr( ceil_fixed( temp, sub( 15, exp ) ), sub( 15, exp ) ); // Q31 + temp = L_shr( ceil_fx( temp, sub( 15, exp ) ), sub( 15, exp ) ); // Q31 } h->stJitter = (UWord32) W_mult0_32_32( temp, h->frameDuration ); move32(); diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 69affa988dec7c9b799b47cb65a92b10b7368a55..a68fed3a11dfad9ffe94e6b09aa8a7a4d0f77b44 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -150,7 +150,7 @@ ivas_error IVAS_DEC_ReadFormat( ivas_error IVAS_DEC_GetSamplesDecoder( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const int16_t isSplitRend, /* i : split rendering enabled flag */ + const Word16 isSplitRend, /* i : split rendering enabled flag */ ISAR_SPLIT_REND_BITS_DATA *splitRendBits /* o : output split rendering bits */ ); @@ -206,14 +206,14 @@ ivas_error IVAS_DEC_GetCldfbSamples( Word16 *nOutSamples /* o : number of samples per channel written to output buffer */ ); -int16_t IVAS_DEC_is_split_rendering_enabled( +Word16 IVAS_DEC_is_split_rendering_enabled( IVAS_DEC_HANDLE hIvasDec, /* i : IVAS decoder handle */ - int16_t *isSplitRend /* o : flag to indicate if split rendering is enabled */ + Word16 *isSplitRend /* o : flag to indicate if split rendering is enabled */ ); -int16_t IVAS_DEC_is_split_rendering_coded_out( +Word16 IVAS_DEC_is_split_rendering_coded_out( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - int16_t *isSplitCoded /* o : flag to indicate if split rendering is enabled */ + Word16 *isSplitCoded /* o : flag to indicate if split rendering is enabled */ ); /*! r: error code */ @@ -226,9 +226,9 @@ ivas_error IVAS_DEC_GetObjectMetadata( /*! r: error code */ ivas_error IVAS_DEC_GetMasaMetadata( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - IVAS_MASA_DECODER_EXT_OUT_META_HANDLE *hMasaExtOutMeta, /* o : pointer to handle, which will be set to point to metadata from the most recently decoded frame */ - const UWord8 getFromJbmBuffer /* i : get metadata from a JBM buffer */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_MASA_DECODER_EXT_OUT_META_HANDLE *hMasaExtOutMeta, /* o : pointer to handle, which will be set to point to metadata from the most recently decoded frame */ + const UWord8 getFromJbmBuffer /* i : get metadata from a JBM buffer */ ); /*! r: error code */ @@ -291,17 +291,16 @@ ivas_error IVAS_DEC_VoIP_GetSamples( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ UWord16 nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ Word16 *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels Q0 */ - const UWord32 systemTimestamp_ms, /* i : current system timestamp */ #ifdef SUPPORT_JBM_TRACEFILE JbmTraceFileWriterFn jbmWriterFn, void* jbmWriter, #endif - bool *bitstreamReadDone, /* o : flag indicating that bitstream was read */ - UWord16 *nSamplesRendered /* o : number of samples rendered */ + bool *bitstreamReadDone, /* o : flag indicating that bitstream was read */ + UWord16 *nSamplesRendered, /* o : number of samples rendered */ #ifdef OBJ_EDITING_API - , - bool *parametersAvailableForEditing + bool *parametersAvailableForEditing, /* o : indicates whether objects editing is available */ #endif + const UWord32 systemTimestamp_ms /* i : current system timestamp */ ); ivas_error IVAS_DEC_Flush( diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index e8bb39b8e3e296c1360064f209e6bc11ebac8ba1..67c602eede6f4ccad4ca6be7b1f841e2fa704a73 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -47,7 +47,6 @@ #include #include "wmc_auto.h" -#define INV_1000_Q31 2147484 /*1/1000 IN Q31*/ /*---------------------------------------------------------------------* * Local structs @@ -327,7 +326,7 @@ static ivas_error isar_set_split_rend_setup( splitRendBits->lc3plus_highres = 0; #ifndef TMP_FIX_SPLIT_REND - if ( ( hSplitBinRend->hMultiBinCldfbData = (ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE) malloc( sizeof( ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA ) ) ) == NULL ) + IF( ( hSplitBinRend->hMultiBinCldfbData = (ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE) malloc( sizeof( ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for split rendering structure" ); } @@ -335,7 +334,7 @@ static ivas_error isar_set_split_rend_setup( ISAR_PRE_REND_GetMultiBinPoseData( hSplitBinConfig, &hSplitBinRend->splitrend.multiBinPoseData, ( hCombinedOrientationData != NULL ) ? hCombinedOrientationData->sr_pose_pred_axis : DEFAULT_AXIS ); - if ( hCombinedOrientationData != NULL ) + IF( hCombinedOrientationData != NULL ) { isar_set_split_rend_ht_setup_fx( &hSplitBinRend->splitrend, hCombinedOrientationData->Quaternions, hCombinedOrientationData->Rmat_fx ); } @@ -1157,9 +1156,10 @@ ivas_error IVAS_DEC_GetSamples( { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } + #ifdef OBJ_EDITING_API /* the rendering needs to be prepared at this point */ - if ( hIvasDec->hasBeenPreparedRendering == false ) + IF( hIvasDec->hasBeenPreparedRendering == false ) { return IVAS_ERR_UNKNOWN; } @@ -1603,18 +1603,18 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( Q_out[0] = 31; Word16 num_poses = hSplitBinRend->splitrend.multiBinPoseData.num_poses; - for ( i = 0; i < i_mult( BINAURAL_CHANNELS, numPoses ); i++ ) + FOR( i = 0; i < i_mult( BINAURAL_CHANNELS, numPoses ); i++ ) { - for ( j = 0; j < CLDFB_NO_COL_MAX; j++ ) + FOR( j = 0; j < CLDFB_NO_COL_MAX; j++ ) { q1 = s_min( q1, L_norm_arr( Cldfb_RealBuffer_Binaural[i][j], CLDFB_NO_CHANNELS_MAX ) ); q2 = s_min( q2, L_norm_arr( Cldfb_ImagBuffer_Binaural[i][j], CLDFB_NO_CHANNELS_MAX ) ); } } Q_buff = s_min( q1, q2 ); - for ( i = 0; i < i_mult( BINAURAL_CHANNELS, numPoses ); i++ ) + FOR( i = 0; i < i_mult( BINAURAL_CHANNELS, numPoses ); i++ ) { - for ( j = 0; j < CLDFB_NO_COL_MAX; j++ ) + FOR( j = 0; j < CLDFB_NO_COL_MAX; j++ ) { scale_sig32( Cldfb_RealBuffer_Binaural[i][j], CLDFB_NO_CHANNELS_MAX, Q_buff ); scale_sig32( Cldfb_ImagBuffer_Binaural[i][j], CLDFB_NO_CHANNELS_MAX, Q_buff ); @@ -1674,7 +1674,7 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( ivas_limiter_dec_fx( st_ivas->hLimiter, pOutput, st_ivas->hDecoderConfig->nchan_out, numSamplesPerChannelToDecode, st_ivas->BER_detect, Q11 ); } - ivas_syn_output_fx( pOutput, Q11, numSamplesPerChannelToDecode, st_ivas->hDecoderConfig->nchan_out, (int16_t *) pcmBuf_out ); + ivas_syn_output_fx( pOutput, Q11, numSamplesPerChannelToDecode, st_ivas->hDecoderConfig->nchan_out, (Word16 *) pcmBuf_out ); } #ifndef TMP_FIX_SPLIT_REND @@ -1892,6 +1892,7 @@ static ivas_error IVAS_DEC_GetTcSamples( } } } + if ( hIvasDec->hasBeenFedFirstGoodFrame ) { hIvasDec->hasDecodedFirstGoodFrame = true; @@ -2243,10 +2244,10 @@ ivas_error IVAS_DEC_GetObjectMetadata( test(); test(); test(); - if ( NE_32( st_ivas->ivas_format, ISM_FORMAT ) && - NE_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && - NE_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && - EQ_16( is_masa_ism, 0 ) ) + IF( NE_32( st_ivas->ivas_format, ISM_FORMAT ) && + NE_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && + NE_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && + EQ_16( is_masa_ism, 0 ) ) { return IVAS_ERR_WRONG_MODE; } @@ -2752,7 +2753,9 @@ ivas_error IVAS_DEC_GetHrtfStatisticsHandle( IVAS_DEC_HRTF_STATISTICS_HANDLE **hHrtfStatistics /* o : HRTF statistics handle */ ) { - if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->st_ivas->hHrtfStatistics == NULL ) + test(); + test(); + IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->st_ivas->hHrtfStatistics == NULL ) { return IVAS_ERR_WRONG_PARAMS; } @@ -3064,6 +3067,7 @@ ivas_error IVAS_DEC_FeedRenderConfig( IF( hIvasDec->st_ivas->hDiracDecBin[0] != NULL && hIvasDec->st_ivas->hDiracDecBin[0]->hReverb != NULL ) { ivas_binaural_reverb_close_fx( &( hIvasDec->st_ivas->hDiracDecBin[0]->hReverb ) ); + IF( ( error = ivas_binaural_reverb_init_fx( &( hIvasDec->st_ivas->hDiracDecBin[0]->hReverb ), hIvasDec->st_ivas->hHrtfStatistics, hIvasDec->st_ivas->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), hIvasDec->st_ivas->hDecoderConfig->output_Fs, NULL, NULL, NULL ) ) != IVAS_ERR_OK ) { return error; @@ -3075,6 +3079,7 @@ ivas_error IVAS_DEC_FeedRenderConfig( IF( hIvasDec->st_ivas->hBinRenderer != NULL && hIvasDec->st_ivas->hBinRenderer->hReverb != NULL ) { ivas_binaural_reverb_close_fx( &( hIvasDec->st_ivas->hBinRenderer->hReverb ) ); + IF( ( error = ivas_binaural_reverb_init_fx( &( hIvasDec->st_ivas->hBinRenderer->hReverb ), hIvasDec->st_ivas->hHrtfStatistics, hIvasDec->st_ivas->hBinRenderer->conv_band, hIvasDec->st_ivas->hBinRenderer->timeSlots, &( hRenderConfig->roomAcoustics ), hIvasDec->st_ivas->hDecoderConfig->output_Fs, NULL, NULL, NULL ) ) != IVAS_ERR_OK ) { return error; @@ -3784,7 +3789,7 @@ ivas_error IVAS_DEC_ReadFormat( ivas_error IVAS_DEC_GetSamplesDecoder( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const int16_t isSplitRend, /* i : split rendering enabled flag */ + const Word16 isSplitRend, /* i : split rendering enabled flag */ ISAR_SPLIT_REND_BITS_DATA *splitRendBits /* o : output split rendering bits */ ) { @@ -3808,12 +3813,11 @@ ivas_error IVAS_DEC_GetSamplesDecoder( test(); IF( !hIvasDec->isInitialized || hIvasDec->hasBeenFedFrame ) { - UWord16 l_ts, nTimeScalerOutSamples; UWord8 nTransportChannels; Word16 nResidualSamples, nSamplesTcsScaled, nOutSamplesElse; - if ( isSplitRend ) + IF( isSplitRend ) { IF( ( error = isar_set_split_rend_setup( hIvasDec->st_ivas->hSplitBinRend, &hIvasDec->st_ivas->hRenderConfig->split_rend_config, hIvasDec->st_ivas->hCombinedOrientationData, splitRendBits ) ) != IVAS_ERR_OK ) { @@ -3826,22 +3830,22 @@ ivas_error IVAS_DEC_GetSamplesDecoder( return error; } - if ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm && nTransportChannels != hIvasDec->nTransportChannelsOld ) + IF( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm && NE_16( nTransportChannels, hIvasDec->nTransportChannelsOld ) ) { - if ( ( error = IVAS_DEC_VoIP_reconfigure( hIvasDec, nTransportChannels, l_ts ) ) != IVAS_ERR_OK ) + IF( ( error = IVAS_DEC_VoIP_reconfigure( hIvasDec, nTransportChannels, l_ts ) ) != IVAS_ERR_OK ) { return error; } } /* IVAS TC decoder */ - if ( ( error = IVAS_DEC_GetTcSamples( hIvasDec, hIvasDec->apaExecBuffer_fx, &nOutSamplesElse ) ) != IVAS_ERR_OK ) + IF( ( error = IVAS_DEC_GetTcSamples( hIvasDec, hIvasDec->apaExecBuffer_fx, &nOutSamplesElse ) ) != IVAS_ERR_OK ) { return error; } /* JBM */ - if ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm ) + IF( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm ) { IF( apa_set_scale_fx( hIvasDec->hTimeScaler, hIvasDec->tsm_scale ) != 0 ) { @@ -3856,10 +3860,12 @@ ivas_error IVAS_DEC_GetSamplesDecoder( { tmp_apaExecBuffer[i] = extract_l( L_shr( hIvasDec->apaExecBuffer_fx[i], Q11 ) ); // Q0 } + IF( apa_exec_fx( hIvasDec->hTimeScaler, tmp_apaExecBuffer, (UWord16) imult3216( hIvasDec->nSamplesFrame, nTransportChannels ), (UWord16) hIvasDec->tsm_max_scaling, tmp_apaExecBuffer, &nTimeScalerOutSamples ) != 0 ) { return IVAS_ERR_UNKNOWN; } + FOR( Word32 i = 0; i < APA_BUF_PER_CHANNEL * nTransportChannels; ++i ) { hIvasDec->apaExecBuffer_fx[i] = L_shl( tmp_apaExecBuffer[i], Q11 ); // Q11 @@ -3872,6 +3878,7 @@ ivas_error IVAS_DEC_GetSamplesDecoder( return IVAS_ERR_UNKNOWN; } } + assert( LE_32( (Word32) nTimeScalerOutSamples, APA_BUF ) ); nSamplesTcsScaled = idiv1616U( extract_l( nTimeScalerOutSamples ), nTransportChannels ); hIvasDec->timeScalingDone = 1; @@ -3883,22 +3890,25 @@ ivas_error IVAS_DEC_GetSamplesDecoder( } /* Feed decoded transport channels samples to the renderer */ - if ( ( error = IVAS_DEC_RendererFeedTcSamples( hIvasDec, nSamplesTcsScaled, &nResidualSamples, hIvasDec->apaExecBuffer_fx ) ) != IVAS_ERR_OK ) + IF( ( error = IVAS_DEC_RendererFeedTcSamples( hIvasDec, nSamplesTcsScaled, &nResidualSamples, hIvasDec->apaExecBuffer_fx ) ) != IVAS_ERR_OK ) { return error; } - if ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm ) + IF( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm ) { /* feed residual samples to TSM for the next call */ - if ( apa_set_renderer_residual_samples( hIvasDec->hTimeScaler, (uint16_t) nResidualSamples ) != 0 ) + IF( apa_set_renderer_residual_samples( hIvasDec->hTimeScaler, (uint16_t) nResidualSamples ) != 0 ) { return IVAS_ERR_UNKNOWN; } } hIvasDec->hasBeenFedFrame = false; + move16(); } + hIvasDec->hasBeenPreparedRendering = false; + move16(); IF( hIvasDec->st_ivas->hIsmMetaData[0] ) { @@ -3932,7 +3942,7 @@ ivas_error IVAS_DEC_GetSamplesDecoder( { Word16 obj = 0; PARAM_ISM_DEC_HANDLE hParamIsmDec = hIvasDec->st_ivas->hParamIsmDec; - for ( obj = 0; obj < hIvasDec->st_ivas->nchan_ism; obj++ ) + FOR( obj = 0; obj < hIvasDec->st_ivas->nchan_ism; obj++ ) { hParamIsmDec->edited_azimuth_values_fx[obj] = hParamIsmDec->azimuth_values_fx[obj]; hParamIsmDec->edited_elevation_values_fx[obj] = hParamIsmDec->elevation_values_fx[obj]; @@ -3955,23 +3965,30 @@ ivas_error IVAS_DEC_GetEditableParameters( IVAS_DEC_HANDLE hIvasDec, IVAS_EDITABLE_PARAMETERS *hIvasEditableParameters ) { + Word16 obj; + Decoder_Struct *st_ivas; + ISM_MODE ism_mode; + test(); test(); - test(); - test(); - test(); - IF( !( hIvasDec->st_ivas->ivas_format == ISM_FORMAT || - ( hIvasDec->st_ivas->ivas_format == SBA_ISM_FORMAT && hIvasDec->st_ivas->ism_mode == ISM_SBA_MODE_DISC ) || - ( hIvasDec->st_ivas->ivas_format == MASA_ISM_FORMAT && ( hIvasDec->st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || hIvasDec->st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) ) ) + IF( hIvasEditableParameters == NULL || hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { - return IVAS_ERROR( IVAS_ERR_WRONG_MODE, "Object editing no supported in this operation mode." ); + return IVAS_ERR_UNEXPECTED_NULL_POINTER; } + st_ivas = hIvasDec->st_ivas; + ism_mode = st_ivas->ism_mode; + + test(); + test(); test(); test(); - if ( hIvasEditableParameters == NULL || hIvasDec == NULL || hIvasDec->st_ivas == NULL ) + test(); + IF( !( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) || + ( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_32( ism_mode, ISM_SBA_MODE_DISC ) ) || + ( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && ( EQ_32( ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) || EQ_32( ism_mode, ISM_MASA_MODE_DISC ) ) ) ) ) { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; + return IVAS_ERROR( IVAS_ERR_WRONG_MODE, "Object editing no supported in this operation mode." ); } #ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST @@ -3986,46 +4003,47 @@ ivas_error IVAS_DEC_GetEditableParameters( hIvasEditableParameters->gain_bed_fx = ONE_IN_Q30; move32(); - hIvasEditableParameters->num_obj = hIvasDec->st_ivas->nchan_ism; + hIvasEditableParameters->num_obj = st_ivas->nchan_ism; move16(); + test(); test(); - if ( hIvasDec->st_ivas->ivas_format == ISM_FORMAT || hIvasDec->st_ivas->ivas_format == SBA_ISM_FORMAT ) + IF( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) || EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) { - if ( hIvasDec->st_ivas->ism_mode == ISM_MODE_DISC || hIvasDec->st_ivas->ism_mode == ISM_SBA_MODE_DISC ) + test(); + IF( EQ_32( st_ivas->ism_mode, ISM_MODE_DISC ) || EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) { - Word16 obj; - for ( obj = 0; obj < hIvasEditableParameters->num_obj; obj++ ) + FOR( obj = 0; obj < hIvasEditableParameters->num_obj; obj++ ) { - hIvasEditableParameters->ism_metadata[obj].azimuth_fx = hIvasDec->st_ivas->hIsmMetaData[obj]->azimuth_fx; + hIvasEditableParameters->ism_metadata[obj].azimuth_fx = st_ivas->hIsmMetaData[obj]->azimuth_fx; move32(); - hIvasEditableParameters->ism_metadata[obj].elevation_fx = hIvasDec->st_ivas->hIsmMetaData[obj]->elevation_fx; + hIvasEditableParameters->ism_metadata[obj].elevation_fx = st_ivas->hIsmMetaData[obj]->elevation_fx; move32(); - hIvasEditableParameters->ism_metadata[obj].yaw_fx = hIvasDec->st_ivas->hIsmMetaData[obj]->yaw_fx; + hIvasEditableParameters->ism_metadata[obj].yaw_fx = st_ivas->hIsmMetaData[obj]->yaw_fx; move32(); - hIvasEditableParameters->ism_metadata[obj].pitch_fx = hIvasDec->st_ivas->hIsmMetaData[obj]->pitch_fx; + hIvasEditableParameters->ism_metadata[obj].pitch_fx = st_ivas->hIsmMetaData[obj]->pitch_fx; move32(); - hIvasEditableParameters->ism_metadata[obj].radius_fx = hIvasDec->st_ivas->hIsmMetaData[obj]->radius_fx; + hIvasEditableParameters->ism_metadata[obj].radius_fx = st_ivas->hIsmMetaData[obj]->radius_fx; move16(); - hIvasEditableParameters->ism_metadata[obj].gain_fx = hIvasDec->st_ivas->hIsmMetaData[obj]->edited_gain_fx; + hIvasEditableParameters->ism_metadata[obj].gain_fx = st_ivas->hIsmMetaData[obj]->edited_gain_fx; move32(); - hIvasEditableParameters->ism_metadata[obj].non_diegetic_flag = hIvasDec->st_ivas->hIsmMetaData[obj]->non_diegetic_flag; + hIvasEditableParameters->ism_metadata[obj].non_diegetic_flag = st_ivas->hIsmMetaData[obj]->non_diegetic_flag; move16(); } - if ( hIvasDec->st_ivas->ism_mode == ISM_SBA_MODE_DISC ) + + IF( EQ_32( ism_mode, ISM_SBA_MODE_DISC ) ) { hIvasEditableParameters->gain_bed_fx = ONE_IN_Q30; move32(); } } - else if ( hIvasDec->st_ivas->ism_mode == ISM_MODE_PARAM ) + ELSE IF( EQ_32( ism_mode, ISM_MODE_PARAM ) ) { - Word16 obj; - for ( obj = 0; obj < hIvasEditableParameters->num_obj; obj++ ) + FOR( obj = 0; obj < hIvasEditableParameters->num_obj; obj++ ) { - hIvasEditableParameters->ism_metadata[obj].azimuth_fx = hIvasDec->st_ivas->hParamIsmDec->azimuth_values_fx[obj]; + hIvasEditableParameters->ism_metadata[obj].azimuth_fx = st_ivas->hParamIsmDec->azimuth_values_fx[obj]; move32(); - hIvasEditableParameters->ism_metadata[obj].elevation_fx = hIvasDec->st_ivas->hParamIsmDec->elevation_values_fx[obj]; + hIvasEditableParameters->ism_metadata[obj].elevation_fx = st_ivas->hParamIsmDec->elevation_values_fx[obj]; move32(); hIvasEditableParameters->ism_metadata[obj].yaw_fx = 0; move32(); @@ -4059,17 +4077,31 @@ ivas_error IVAS_DEC_SetEditableParameters( IVAS_DEC_HANDLE hIvasDec, IVAS_EDITABLE_PARAMETERS hIvasEditableParameters ) { - if ( !( hIvasDec->st_ivas->ivas_format == ISM_FORMAT || - ( hIvasDec->st_ivas->ivas_format == SBA_ISM_FORMAT && hIvasDec->st_ivas->ism_mode == ISM_SBA_MODE_DISC ) || - ( hIvasDec->st_ivas->ivas_format == MASA_ISM_FORMAT && ( hIvasDec->st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || hIvasDec->st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) ) || - hIvasDec->st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) + Word16 obj; + Decoder_Struct *st_ivas; + ISM_MODE ism_mode; + + test(); + IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { - return IVAS_ERROR( IVAS_ERR_WRONG_MODE, "Object editing no supported in this operation mode." ); + return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) + st_ivas = hIvasDec->st_ivas; + ism_mode = st_ivas->ism_mode; + + test(); + test(); + test(); + test(); + test(); + test(); + IF( !( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) || + ( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_32( ism_mode, ISM_SBA_MODE_DISC ) ) || + ( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && ( EQ_32( ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) || EQ_32( ism_mode, ISM_MASA_MODE_DISC ) ) ) ) || + EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; + return IVAS_ERROR( IVAS_ERR_WRONG_MODE, "Object editing no supported in this operation mode." ); } #ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST @@ -4079,37 +4111,37 @@ ivas_error IVAS_DEC_SetEditableParameters( } #endif #ifdef DEBUGGING - assert( hIvasEditableParameters.num_obj == hIvasDec->st_ivas->nchan_ism ); + assert( hIvasEditableParameters.num_obj == st_ivas->nchan_ism ); #endif - if ( hIvasDec->st_ivas->ivas_format == ISM_FORMAT || hIvasDec->st_ivas->ivas_format == SBA_ISM_FORMAT ) + test(); + IF( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) || EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) { - if ( hIvasDec->st_ivas->ism_mode == ISM_MODE_DISC || hIvasDec->st_ivas->ism_mode == ISM_SBA_MODE_DISC ) + test(); + IF( EQ_32( st_ivas->ism_mode, ISM_MODE_DISC ) || EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) { - int16_t obj; - for ( obj = 0; obj < hIvasEditableParameters.num_obj; obj++ ) + FOR( obj = 0; obj < hIvasEditableParameters.num_obj; obj++ ) { - hIvasDec->st_ivas->hIsmMetaData[obj]->edited_azimuth_fx = hIvasEditableParameters.ism_metadata[obj].azimuth_fx; - hIvasDec->st_ivas->hIsmMetaData[obj]->edited_elevation_fx = hIvasEditableParameters.ism_metadata[obj].elevation_fx; - hIvasDec->st_ivas->hIsmMetaData[obj]->edited_radius_fx = hIvasEditableParameters.ism_metadata[obj].radius_fx; + st_ivas->hIsmMetaData[obj]->edited_azimuth_fx = hIvasEditableParameters.ism_metadata[obj].azimuth_fx; + st_ivas->hIsmMetaData[obj]->edited_elevation_fx = hIvasEditableParameters.ism_metadata[obj].elevation_fx; + st_ivas->hIsmMetaData[obj]->edited_radius_fx = hIvasEditableParameters.ism_metadata[obj].radius_fx; - hIvasDec->st_ivas->hIsmMetaData[obj]->edited_gain_fx = hIvasEditableParameters.ism_metadata[obj].gain_fx; + st_ivas->hIsmMetaData[obj]->edited_gain_fx = hIvasEditableParameters.ism_metadata[obj].gain_fx; - hIvasDec->st_ivas->hIsmMetaData[obj]->edited_yaw_fx = hIvasEditableParameters.ism_metadata[obj].yaw_fx; - hIvasDec->st_ivas->hIsmMetaData[obj]->edited_pitch_fx = hIvasEditableParameters.ism_metadata[obj].pitch_fx; + st_ivas->hIsmMetaData[obj]->edited_yaw_fx = hIvasEditableParameters.ism_metadata[obj].yaw_fx; + st_ivas->hIsmMetaData[obj]->edited_pitch_fx = hIvasEditableParameters.ism_metadata[obj].pitch_fx; - hIvasDec->st_ivas->hIsmMetaData[obj]->non_diegetic_flag = hIvasEditableParameters.ism_metadata[obj].non_diegetic_flag; + st_ivas->hIsmMetaData[obj]->non_diegetic_flag = hIvasEditableParameters.ism_metadata[obj].non_diegetic_flag; } - if ( hIvasDec->st_ivas->ism_mode == ISM_SBA_MODE_DISC ) + IF( EQ_32( ism_mode, ISM_SBA_MODE_DISC ) ) { - hIvasDec->st_ivas->hSbaIsmData->gain_bed_fx = hIvasEditableParameters.gain_bed_fx; + st_ivas->hSbaIsmData->gain_bed_fx = hIvasEditableParameters.gain_bed_fx; } } - else if ( hIvasDec->st_ivas->ism_mode == ISM_MODE_PARAM ) + ELSE IF( EQ_32( ism_mode, ISM_MODE_PARAM ) ) { - int16_t obj; - for ( obj = 0; obj < hIvasEditableParameters.num_obj; obj++ ) + FOR( obj = 0; obj < hIvasEditableParameters.num_obj; obj++ ) { } } @@ -4132,7 +4164,7 @@ ivas_error IVAS_DEC_SetEditableParameters( ivas_error IVAS_DEC_PrepareRenderer( IVAS_DEC_HANDLE hIvasDec ) { - if ( hIvasDec == NULL ) + IF( hIvasDec == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } @@ -4151,6 +4183,7 @@ ivas_error IVAS_DEC_PrepareRenderer( } #endif + /*---------------------------------------------------------------------* * IVAS_DEC_VoIP_GetSamples( ) * @@ -4158,20 +4191,19 @@ ivas_error IVAS_DEC_PrepareRenderer( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_VoIP_GetSamples( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - UWord16 nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ - Word16 *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels Q0 */ - const UWord32 systemTimestamp_ms, /* i : current system timestamp */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + UWord16 nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ + Word16 *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels Q0 */ #ifdef SUPPORT_JBM_TRACEFILE JbmTraceFileWriterFn jbmWriterFn, void *jbmWriter, #endif - bool *bitstreamReadDone, /* o : that bitstream was read */ - UWord16 *nSamplesRendered /* o : number of samples rendered */ + bool *bitstreamReadDone, /* o : flag indicating that bitstream was read */ + UWord16 *nSamplesRendered, /* o : number of samples rendered */ #ifdef OBJ_EDITING_API - , - bool *parametersAvailableForEditing + bool *parametersAvailableForEditing, /* o : indicates whether objects editing is available */ #endif + const UWord32 systemTimestamp_ms /* i : current system timestamp */ ) { Decoder_Struct *st_ivas; @@ -4361,9 +4393,10 @@ ivas_error IVAS_DEC_VoIP_GetSamples( #ifdef OBJ_EDITING_API /* :TODO: only return here if we really have editing initialized */ - if ( hIvasDec->hasBeenFedFirstGoodFrame && hIvasDec->hasEditableParameters == true && hIvasDec->enableParameterEditing == true ) + IF( hIvasDec->hasBeenFedFirstGoodFrame && hIvasDec->hasEditableParameters == true && hIvasDec->enableParameterEditing == true ) { *parametersAvailableForEditing = true; + move16(); return IVAS_ERR_OK; } #endif @@ -4391,7 +4424,8 @@ ivas_error IVAS_DEC_VoIP_GetSamples( test(); IF( !hIvasDec->isInitialized || hIvasDec->hasBeenFedFrame ) { - if ( hIvasDec->nSamplesAvailableNext == 0 || hIvasDec->nSamplesAvailableNext == hIvasDec->nSamplesFrame ) + test(); + IF( hIvasDec->nSamplesAvailableNext == 0 || EQ_16( hIvasDec->nSamplesAvailableNext, hIvasDec->nSamplesFrame ) ) { uint16_t nSamplesFlushed_ref = hIvasDec->nSamplesFlushed; @@ -5007,8 +5041,8 @@ static ivas_error evs_dec_main_fx( mixer_left_fx = add( shr( st_ivas->hDecoderConfig->non_diegetic_pan_gain_fx, Q1 ), ONE_IN_Q14 ); // Q14 mixer_right_fx = sub( MAX16B, mixer_left_fx ); - v_multc_fixed_16( p_output_fx[0], mixer_right_fx, p_output_fx[1], nOutSamples ); /* Q11 */ - v_multc_fixed_16( p_output_fx[0], mixer_left_fx, p_output_fx[0], nOutSamples ); /* Q11 */ + v_multc_fx_16( p_output_fx[0], mixer_right_fx, p_output_fx[1], nOutSamples ); /* Q11 */ + v_multc_fx_16( p_output_fx[0], mixer_left_fx, p_output_fx[0], nOutSamples ); /* Q11 */ } IF( !st_ivas->hDecoderConfig->Opt_tsm ) @@ -5270,7 +5304,7 @@ ivas_error IVAS_DEC_GetCldfbSamples( IF( hSplitBinRend->hCldfbDataOut->config != IVAS_AUDIO_CONFIG_INVALID ) { num_chs = audioCfg2channels( hSplitBinRend->hCldfbDataOut->config ); - maxBand = (int16_t) ( ( CLDFB_NO_CHANNELS_MAX * hIvasDec->st_ivas->hDecoderConfig->output_Fs ) / 48000 ); + maxBand = (Word16) ( ( CLDFB_NO_CHANNELS_MAX * hIvasDec->st_ivas->hDecoderConfig->output_Fs ) / 48000 ); FOR( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) { @@ -5309,7 +5343,7 @@ static ivas_error ivas_create_handle_isar( { ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE hSplitBinRend; - if ( ( hSplitBinRend = (ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE) malloc( sizeof( ISAR_DEC_SPLIT_REND_WRAPPER ) ) ) == NULL ) + IF( ( hSplitBinRend = (ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE) malloc( sizeof( ISAR_DEC_SPLIT_REND_WRAPPER ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for IVAS decoder handle" ); } @@ -5365,7 +5399,7 @@ static void ivas_destroy_handle_isar( * *---------------------------------------------------------------------*/ -int16_t IVAS_DEC_is_split_rendering_enabled( +Word16 IVAS_DEC_is_split_rendering_enabled( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ Word16 *isSplitRend /* o : flag to indicate if split rendering is enabled */ ) @@ -5481,7 +5515,7 @@ static ivas_error ivas_dec_reconfig_split_rend( FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - if ( ( error = openCldfb_ivas_fx( &( hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] ), CLDFB_SYNTHESIS, st_ivas->hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ) != IVAS_ERR_OK ) + IF( ( error = openCldfb_ivas_fx( &( hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] ), CLDFB_SYNTHESIS, st_ivas->hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ) != IVAS_ERR_OK ) { return error; } @@ -5555,7 +5589,7 @@ static ivas_error ivas_dec_init_split_rend( #ifdef TMP_FIX_SPLIT_REND /* note: this is intra-frame heap memory */ - if ( ( st_ivas->hSplitBinRend->hMultiBinCldfbData = (ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE) malloc( sizeof( ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA ) ) ) == NULL ) + IF( ( st_ivas->hSplitBinRend->hMultiBinCldfbData = (ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE) malloc( sizeof( ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for split rendering structure" ); } @@ -5604,7 +5638,7 @@ static ivas_error ivas_dec_init_split_rend( Word16 IVAS_DEC_is_split_rendering_coded_out( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - int16_t *isSplitCoded /* o : flag to indicate if split rendering is enabled */ + Word16 *isSplitCoded /* o : flag to indicate if split rendering is enabled */ ) { Decoder_Struct *st_ivas; diff --git a/lib_dec/lsf_dec_fx.c b/lib_dec/lsf_dec_fx.c index 913543db8c6b90d0f51beb13a097845f34b0b746..ec45dbae965bd56524cd22c57877730bb79a7afe 100644 --- a/lib_dec/lsf_dec_fx.c +++ b/lib_dec/lsf_dec_fx.c @@ -370,9 +370,8 @@ void lsf_end_dec_fx( Word16 *qlsf, /* o : quantized LSFs in the cosine domain Qx2.56*/ Word16 *lpc_param, /* i : LPC parameters Q0*/ Word16 *LSF_Q_prediction, /* o : LSF prediction mode Q0*/ - Word16 *nb_indices /* o : number of indices Q0*/ - , - const Word16 tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel Qx*/ + Word16 *nb_indices, /* o : number of indices Q0*/ + const Word16 tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel Qx*/ ) { Word16 pred0[M]; /* Prediction for the safety-net quantizer (usually mean)*/ diff --git a/lib_dec/pit_dec_fx.c b/lib_dec/pit_dec_fx.c index 38ec41cb209c196f3333a972a2195ff8f4c0aa46..d490dce4a4e6152ec857f8cefa7f8e08344f8444 100644 --- a/lib_dec/pit_dec_fx.c +++ b/lib_dec/pit_dec_fx.c @@ -591,9 +591,8 @@ void pit_Q_dec_fx( Word16 *T0, /* o : integer pitch lag */ Word16 *T0_frac, /* o : pitch fraction */ Word16 *T0_min, /* i/o: delta search min */ - Word16 *T0_max /* i/o: delta search max */ - , - Word16 *BER_detect /* o : BER detect flag */ + Word16 *T0_max, /* i/o: delta search max */ + Word16 *BER_detect /* o : BER detect flag */ ) { IF( EQ_16( nBits, 10 ) ) /* absolute decoding with 10 bits */ @@ -702,9 +701,8 @@ void pit16k_Q_dec_fx( Word16 *T0, /* o : integer pitch lag */ Word16 *T0_frac, /* o : pitch fraction */ Word16 *T0_min, /* i/o: delta search min */ - Word16 *T0_max /* i/o: delta search max */ - , - Word16 *BER_detect /* o : BER detect flag */ + Word16 *T0_max, /* i/o: delta search max */ + Word16 *BER_detect /* o : BER detect flag */ ) { Word16 index; diff --git a/lib_dec/pitch_extr_fx.c b/lib_dec/pitch_extr_fx.c index 5cabc98b1009ce6c096943078c72b295235bceaf..5d6e397b0c6de34d9660a5c93915a26884056c3b 100644 --- a/lib_dec/pitch_extr_fx.c +++ b/lib_dec/pitch_extr_fx.c @@ -220,8 +220,7 @@ void pitch_pred_linear_fit( a2 = mac_r( L_mac( L_mult( mult_r( 2 * 2048, pg[1] ) /*Q8*/, pg[2] ) /*Q5+16*/, mult_r( 2 * 2048, pg[1] ) /*Q8*/, pg[3] ) /*Q5+16*/, mult_r( -4 * 2048, pg[0] ) /*Q8*/, pg[1] /*Q12*/ ) /*Q5*/; a1 = mac_r( L_mac( L_mult( mult_r( 3 * 2048, pg[0] ) /*Q8*/, pg[1] ) /*Q5+16*/, mult_r( 4 * 2048, pg[0] ) /*Q8*/, pg[2] /*Q12*/ ) /*Q5+16*/, mult_r( 3 * 2048, pg[0] ) /*Q8*/, pg[3] /*Q12*/ ) /*Q5*/; - a = L_mac( L_mac( L_mac( L_mac( L_mult( a1, round_fx( L_shl( ml[0], 4 ) ) ) /*Q4*/ - , + a = L_mac( L_mac( L_mac( L_mac( L_mult( a1, round_fx( L_shl( ml[0], 4 ) ) ) /*Q4*/, round_fx( L_shl( ml[1], 4 ) ) /*Q4*/, a2 ), round_fx( L_shl( ml[2], 4 ) ) /*Q4*/, a3 ), round_fx( L_shl( ml[3], 4 ) ) /*Q4*/, a4 ), @@ -258,8 +257,7 @@ void pitch_pred_linear_fit( b4 = mac_r( L_mac( L_mac( L_mult( mult_r( -3 * 8192, pg[0] ), pg[3] ), mult_r( -2 * 8192, pg[1] ), pg[3] ), mult_r( -32768 / 2, pg[3] ), mult_r( 32768 / 2, pg[2] ) ), mult_r( 32768 / 2, pg[4] ), mult_r( 32768 / 2, pg[3] ) ); /*Q7*/ b5 = mac_r( L_mac( L_mac( L_mult( mult_r( -32768 /*(-4*8192)*/, pg[0] ), pg[4] ), mult_r( -3 * 8192, pg[1] ), pg[4] ), mult_r( -2 * 8192, pg[2] ), pg[4] ), mult_r( -32768 / 2, pg[4] ), mult_r( 32768 / 2, pg[3] ) ) /*Q7*/; - b = L_mac( L_mac( L_mac( L_mac( L_mult( b1, round_fx( L_shl( ml[0], 4 ) ) ) /*Q4*/ - , + b = L_mac( L_mac( L_mac( L_mac( L_mult( b1, round_fx( L_shl( ml[0], 4 ) ) ) /*Q4*/, round_fx( L_shl( ml[1], 4 ) ) /*Q4*/, b2 ), round_fx( L_shl( ml[2], 4 ) ) /*Q4*/, b3 ), round_fx( L_shl( ml[3], 4 ) ) /*Q4*/, b4 ), diff --git a/lib_dec/rom_dec_fx.c b/lib_dec/rom_dec_fx.c index f5c0e4794845db03e52d35730b72c993e476a740..0493e48ebf551cf23c70a032a36725ad572877e1 100644 --- a/lib_dec/rom_dec_fx.c +++ b/lib_dec/rom_dec_fx.c @@ -51,6 +51,7 @@ const Word16 h_low_fx[5] = /* Q15 */ { -410, 3572, 25602, 3572, -410 }; + const Word16 inv_sqi[15] = /* Q15 */ { 8192, /* 1/4 */ @@ -69,9 +70,11 @@ const Word16 inv_sqi[15] = /* Q15 */ 146, /* 1/225 */ 128 /* 1/256 */ }; + /*-------------------------------------------------------------------* * index square used in fec_adapt_codebook *-------------------------------------------------------------------*/ + const Word16 sqi[15] = /* Q0 */ { 4, /* 2 */ @@ -90,8 +93,10 @@ const Word16 sqi[15] = /* Q0 */ 225, /* 15 */ 256 /* 16 */ }; + /* RE8 related tables */ const Word16 mult_avq_tab[7] = {1,1,1,342,1,1,171}; + const Word16 shift_avq_tab[7] = {0,0,1, 10,2,0, 10}; const Word16 hntable[55]= @@ -123,7 +128,7 @@ const Word16 hestable[15]= const Word16 lsf_tab_fx[LPC_SHB_ORDER] = /* Q15 */ { 2315, 3920, 5546, 6759, 7978, - 10254, 11336, 12476, 13437, 14590 + 10254, 11336, 12476, 13437, 14590 }; const Word16 POW_ATT_TABLE0[OFF_FRAMES_LIMIT + 1] = /* Q15 */ @@ -132,15 +137,18 @@ const Word16 POW_ATT_TABLE0[OFF_FRAMES_LIMIT + 1] = /* Q15 */ 20675, 19745, 18856, 18007, 17197, 16423, 8211, 4106, 2053, 1026, 513, 257, 128, 64, 32, 16, 8, 4, 2, 1, 0 }; + const Word16 POW_ATT_TABLE1[OFF_FRAMES_LIMIT + 1] = /* Q15 */ { 32767, 31656, 30581, 29543, 28540, 27571, 26635, 25731, 24857, 24013, 23198, 22410, 21650, 20915, 20205, 19519, 9759, 4880, 2440, 1220, 610, 305, 152, 76, 38, 19, 10, 5, 2, 1, 0 }; + /* frequency group start bins for transient analysis */ /* 125 375 750 1250 2000 4000 8000 16000 24000 */ const Word16 gw[LGW_MAX] = { 1, 3, 6, 10, 16, 32, 64, 128, 192 }; + const Word16 gw_fx[LGW_MAX] = { 1, 3, 6, 10, 16, 32, 64, 128, 192 }; /* Q0 frequency group start bins for transient analysis */ const Word16 gw_len_inv_fx[LGW_MAX - 1] = /* Q15 */ @@ -148,14 +156,15 @@ const Word16 gw_len_inv_fx[LGW_MAX - 1] = /* Q15 */ 16384, 10923, 8192, 5461, 2048, 1024, 512, 512, }; + const Word16 GR_POW_HEADROOM[LGW_MAX] = /* in Q0-- Number of bits down-shifting to prevent from saturation in group power accumulation.*/ { 0, 0, 1, 2, 2, 3, 4, 4, 4 }; + /* 31.25 343.75 718.75 1218.75 1968.75 4000 8000 16000 24000 */ const Word16 ivas_gwlpr[LGW_MAX] = { 1, 3*QUOT_LPR_LTR-1, 6*QUOT_LPR_LTR-1, 10*QUOT_LPR_LTR-1, 16*QUOT_LPR_LTR-1, 32*QUOT_LPR_LTR, 64*QUOT_LPR_LTR, 128*QUOT_LPR_LTR, 192*QUOT_LPR_LTR }; - const Word16 w_hamm48k_2_fx[L_TRANA48k / 2] = /* Q15 */ { 2621, 2623, 2630, 2640, 2654, 2672, 2694, 2721, @@ -215,6 +224,7 @@ const Word16 w_hamm16k_2_fx[L_TRANA16k / 2] = /* Q15 */ 28549, 29053, 29529, 29976, 30393, 30780, 31134, 31455, 31742, 31995, 32213, 32396, 32543, 32653, 32727, 32763 }; + const Word16 w_hamm_sana48k_2_fx[288] = /* Q15 */ { 2621, 2622, 2625, 2630, 2636, 2644, 2654, 2666, @@ -254,6 +264,7 @@ const Word16 w_hamm_sana48k_2_fx[288] = /* Q15 */ 32552, 32579, 32604, 32628, 32649, 32669, 32687, 32703, 32717, 32730, 32741, 32750, 32757, 32762, 32766, 32767 }; + const Word16 w_hamm_sana32k_2_fx[L_PROT_HAMM_LEN2_32k] = /* Q15 */ { 2621, 2623, 2630, 2640, 2654, 2672, 2694, 2721, @@ -281,6 +292,7 @@ const Word16 w_hamm_sana32k_2_fx[L_PROT_HAMM_LEN2_32k] = /* Q15 */ 32283, 32344, 32400, 32452, 32501, 32545, 32585, 32622, 32654, 32682, 32707, 32727, 32743, 32755, 32763, 32767 }; + const Word16 w_hamm_sana16k_2_fx[L_PROT_HAMM_LEN2_16k] = /* Q15 */ { 2621, 2630, 2654, 2695, 2752, 2825, 2914, 3019, @@ -305,30 +317,30 @@ const Word16 swb_hr_inv_frm_len[4] = /* in Q19 */ 4369 /* 1/(960/8) */ }; -const Word16 inv_tbl_2n_minus1[] = { -1, -1, /* Bits = 0 and 1 are not used */ - 21845/*Q16*/, - 18725/*Q17*/, - 17476/*Q18*/, - 16913/*Q19*/, - 16644/*Q20*/, - 16513/*Q21*/ +const Word16 inv_tbl_2n_minus1[] = { + -1, -1, /* Bits = 0 and 1 are not used */ + 21845/*Q16*/, + 18725/*Q17*/, + 17476/*Q18*/, + 16913/*Q19*/, + 16644/*Q20*/, + 16513/*Q21*/ }; /* in Qx */ - /* er_dec_tcx.c */ const Word16 h_high3_32[L_FIR_FER2] = { -1694/*-0.0517f Q15*/, -1923/*-0.0587f Q15*/, -2687/*-0.0820f Q15*/, -3355/*-0.1024f Q15*/, -3814/*-0.1164f Q15*/, 28790/*0.8786f Q15*/, -3814/*-0.1164f Q15*/, -3355/*-0.1024f Q15*/, -2687/*-0.0820f Q15*/, -1923/*-0.0587f Q15*/, -1694/*-0.0517f Q15*/ }; + const Word16 h_high3_16[L_FIR_FER2] = { 0/* 0.f Q15*/, -672/*-0.0205f Q15*/, -2133/*-0.0651f Q15*/, -4116/*-0.1256f Q15*/, -5872/*-0.1792f Q15*/, 26306/*0.8028f Q15*/, -5872/*-0.1792f Q15*/, -4116/*-0.1256f Q15*/, -2133/*-0.0651f Q15*/, -672/*-0.0205f Q15*/, 0/* 0.f Q15*/ }; -const Word16 T_256DIV_L_Frame[] = + +const Word16 T_256DIV_L_Frame[6] = { - 6554 /*L_Frame 640*/ - ,8192 /*L_Frame 512*/ - ,8738 /*L_Frame 480*/ - ,13107/*L_Frame 320*/ - ,16384 /*L_Frame 256*/ - ,26214 /*L_Frame 160*/ + 6554, /*L_Frame 640*/ + 8192, /*L_Frame 512*/ + 8738, /*L_Frame 480*/ + 13107, /*L_Frame 320*/ + 16384, /*L_Frame 256*/ + 26214 /*L_Frame 160*/ }; -/* clang-format on */ - /* Word16 (Q15) Hann window ranging from 0 to 32767/32768 (~0.999969) */ const Word16 pcmdsp_window_hann_960[960] = { @@ -444,3 +456,4 @@ const Word16 pcmdsp_window_hann_640[640] = { 490, 452, 415, 380, 346, 314, 283, 254, 227, 201, 176, 154, 132, 113, 94, 78, 63, 50, 38, 27, 19, 12, 6, 2, 0 }; +/* clang-format on */ diff --git a/lib_enc/acelp_core_enc_fx.c b/lib_enc/acelp_core_enc_fx.c index 75df71db44e1a1b2517708c65c1a57f0e92bc2ea..cdb0d4d34dcbb29a22b41875c877ba088134d278 100644 --- a/lib_enc/acelp_core_enc_fx.c +++ b/lib_enc/acelp_core_enc_fx.c @@ -1284,7 +1284,7 @@ ivas_error acelp_core_enc_ivas_fx( IF( NE_16( att_fx, 32767 /* ONE_IN_Q15 */ ) ) { - v_multc_fixed_16_16( res_fx, att_fx, res_fx, st->L_frame ); + v_multc_fx_16_16( res_fx, att_fx, res_fx, st->L_frame ); } /*-----------------------------------------------------------------* diff --git a/lib_enc/acelp_core_switch_enc_fx.c b/lib_enc/acelp_core_switch_enc_fx.c index 07e4320c8a708b901057b2e8b5876908140b0320..d790b1866163c7d591cee2c33517f51ac04c834b 100644 --- a/lib_enc/acelp_core_switch_enc_fx.c +++ b/lib_enc/acelp_core_switch_enc_fx.c @@ -611,6 +611,7 @@ static void encod_gen_voic_core_switch_ivas_fx( set16_fx( dummyF, -1, NB_SUBFR16k ); /* hack to signal ACELP->HQ switching frame */ pitch = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, core_bitrate, 0, L_frame, GENERIC, &pitch_limit_flag, 0, exc, L_SUBFR, T_op, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, 0 /*hStereoTD->tdm_Pitch_reuse_flag*/, dummyF /*hStereoTD->tdm_Pri_pitch_buf*/, st_fx->element_mode, Q_new ); /* Q6 */ + /*-----------------------------------------------------------------* * Find adaptive exitation *-----------------------------------------------------------------*/ diff --git a/lib_enc/avq_cod_fx.c b/lib_enc/avq_cod_fx.c index 693a662b7d88214cf5e01a903dddf112fd2abae9..982b30d323939a75f3478a442cdae07433583ed9 100644 --- a/lib_enc/avq_cod_fx.c +++ b/lib_enc/avq_cod_fx.c @@ -1,6 +1,7 @@ /*==================================================================================== EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0 ====================================================================================*/ + #include #include #include "options.h" /* Compilation switches */ @@ -13,6 +14,7 @@ /*-------------------------------------------------------------------* * Local prototypes *-------------------------------------------------------------------*/ + static void wrte_cv( BSTR_ENC_HANDLE hBstr, const Word16 nq, const Word16 i_ind, const Word16 kv_ind, UWord16 I, Word16 kv[], Word16 *bits ); /*-------------------------------------------------------------------* @@ -21,12 +23,13 @@ static void wrte_cv( BSTR_ENC_HANDLE hBstr, const Word16 nq, const Word16 i_ind, * Split algevraic vector quantizer (AVQ) base on RE8 latice * *-------------------------------------------------------------------*/ -void AVQ_cod_fx( /* o: comfort noise gain factor */ - const Word16 xri[], /* i: vector to quantize Qx*/ - Word16 xriq[], /* o: quantized normalized vector (assuming the bit budget is enough) */ - const Word16 NB_BITS, /* i: number of allocated bits */ - const Word16 Nsv, /* i: number of subvectors (lg=Nsv*8) */ - const Word16 Q_in_ref /* i: Scaling input */ +/* o: comfort noise gain factor */ +void AVQ_cod_fx( + const Word16 xri[], /* i : vector to quantize Qx*/ + Word16 xriq[], /* o : quantized normalized vector (assuming the bit budget is enough) */ + const Word16 NB_BITS, /* i : number of allocated bits */ + const Word16 Nsv, /* i : number of subvectors (lg=Nsv*8) */ + const Word16 Q_in_ref /* i : Scaling input */ ) { Word16 i, l, iter, c[8]; @@ -158,13 +161,13 @@ void AVQ_cod_fx( /* o: comfort noise gain factor * * Encode subvectors and write indexes into the bitstream *-----------------------------------------------------------------*/ + void AVQ_encmux_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ + BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ const Word16 extl, /* i : extension layer */ - Word16 xriq[], /* i/o: rounded subvectors [0..8*Nsv-1] followed - by rounded bit allocations [8*Nsv..8*Nsv+Nsv-1] */ + Word16 xriq[], /* i/o: rounded subvectors [0..8*Nsv-1] followed by rounded bit allocations [8*Nsv..8*Nsv+Nsv-1] */ Word16 *nb_bits, /* i/o: number of allocated bits */ - const Word16 Nsv, /* i: number of subvectors */ + const Word16 Nsv, /* i : number of subvectors */ Word16 nq_out[], /* o : AVQ nq index */ Word16 avq_bit_sFlag, /* i : flag for AVQ bit saving solution */ Word16 trgtSvPos /* i : target SV for AVQ bit savings */ @@ -180,6 +183,7 @@ void AVQ_encmux_fx( Word16 unusedbitsFlag; Word16 svOrder[NSV_MAX], k, nullVec, dummy_bits; Word16 tmp; + test(); IF( EQ_16( extl, SWB_BWE_HIGHRATE ) || EQ_16( extl, FB_BWE_HIGHRATE ) ) { @@ -582,8 +586,10 @@ void AVQ_encmux_fx( return; } + + /*-------------------------------------------------------------------* - * Function AVQ_cod_lpc_fx() * + * Function AVQ_cod_lpc_fx() * * * * Split algebraic vector quantizer (AVQ) for LPC quantization * *-------------------------------------------------------------------*/ diff --git a/lib_enc/cng_enc_fx.c b/lib_enc/cng_enc_fx.c index b26fd281a369a455a6d83632f041e81903b0a0ec..34be60d8a7c5b6d33502ba91b95184cbf4c4456d 100644 --- a/lib_enc/cng_enc_fx.c +++ b/lib_enc/cng_enc_fx.c @@ -1885,7 +1885,7 @@ void CNG_enc_ivas_fx( L_tmp1 = L_mult0( hTdCngEnc->CNG_att_fx, 26214 /* 1/20.0f in Q19 */ ); // Q26 (7 + 19) L_tmp1 = BASOP_Util_fPow( 1342177280 /*10 in Q27 */, 4, L_tmp1, 5, &exp ); att = extract_h( L_shl( L_sub( L_tmp1, EPSILON_FX ), exp ) ); // Q15 // Subtracting by EPSILON_FX to avoid assertion when L_tmp1 value is 1073741824 and exp =1 - v_multc_fixed_16_16( res1, att, res1, st_fx->L_frame ); /* Q_new */ + v_multc_fx_16_16( res1, att, res1, st_fx->L_frame ); /* Q_new */ } ELSE IF( st_fx->bwidth != NB ) { diff --git a/lib_enc/cod2t32_fx.c b/lib_enc/cod2t32_fx.c index f77e8602b6c01d5a111ae98da44bbaae07e34829..f4dbad642052e26ed32a07cd761cfe209d218211 100644 --- a/lib_enc/cod2t32_fx.c +++ b/lib_enc/cod2t32_fx.c @@ -293,6 +293,8 @@ void acelp_2t32_fx( } return; } + + /*---------------------------------------------------------------------------------- * Function acelp_1t64() * @@ -303,19 +305,21 @@ void acelp_2t32_fx( *----------------------------------------------------------------------------------*/ void acelp_1t64_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 dn[], /* i : corr. between target and h[]. Qx*/ + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + const Word16 dn[], /* i : corr. between target and h[]. Qx*/ const Word16 h[], /* i : impulse response of weighted synthesis filter Q12 */ - Word16 code[], /* o : algebraic (fixed) codebook excitation Q9 */ - Word16 y[], /* o : filtered fixed codebook excitation Q9 */ - const Word16 L_subfr /* i : subframe length */ + Word16 code[], /* o : algebraic (fixed) codebook excitation Q9 */ + Word16 y[], /* o : filtered fixed codebook excitation Q9 */ + const Word16 L_subfr /* i : subframe length */ ) { Word16 i, pos, sgn, index; Word32 L_tmp; + /*-------------------------------------------------------------------* * Find position and sign of maximum impulse. *-------------------------------------------------------------------*/ + pos = emaximum_fx( 0, dn, L_subfr, &L_tmp ); IF( dn[pos] < 0 ) diff --git a/lib_enc/cod4t64_fx.c b/lib_enc/cod4t64_fx.c index d0bb15cc7a8d07740b8bec88d1ab73d30bfe15be..4d342eeb4c72303265286e6401984aeb64037f19 100644 --- a/lib_enc/cod4t64_fx.c +++ b/lib_enc/cod4t64_fx.c @@ -66,11 +66,9 @@ Word16 acelp_4t64_fx( Word16 y[], /* o : filtered fixed codebook excitation Q9*/ Word16 nbbits, /* i : number of bits per codebook */ const Word16 cmpl_flag, /* i : complexity reduction flag */ - const Word16 Opt_AMR_WB /* i : flag indicating AMR-WB IO mode */ - , + const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */ const Word16 element_mode ) { - Word16 i, k, index, track; Word32 L_index; Word16 ind[NPMAXPT * NB_TRACK_FCB_4T + 32]; /* VE3: why +32 ???*/ @@ -468,14 +466,16 @@ Word16 acelp_4t64_fx( return saved_bits; } + /*---------------------------------------------------------------------* *encode class for 3p 4p 5p 6p/track * *---------------------------------------------------------------------*/ -static Word32 fcb_encode_cl_fx( /* o: class index of the pulse on a track */ - const Word32 buffer[], /* i: pulses on a track */ - const Word32 pulse_num, /* i: pulses number on a track */ - const Word32 pos_num /* i: number of the position which have pulse */ +/* o: comfort noise gain factor */ +static Word32 fcb_encode_cl_fx( + const Word32 buffer[], /* i : pulses on a track */ + const Word32 pulse_num, /* i : pulses number on a track */ + const Word32 pos_num /* i : number of the position which have pulse */ ) { Word32 i, k; @@ -500,9 +500,11 @@ static Word32 fcb_encode_cl_fx( /* o: class index of t /*---------------------------------------------------------------------* *encode fcb pulse index * *---------------------------------------------------------------------*/ -static Word32 fcb_encode_PI_fx( /* o: return index of the pulse on a track */ - const Word16 v[], /* i: pulse on a track Q9 */ - const Word32 pulse_num /* i: number of the pulse on a track */ + +/* o: return index of the pulse on a track */ +static Word32 fcb_encode_PI_fx( + const Word16 v[], /* i : pulse on a track Q9 */ + const Word32 pulse_num /* i : number of the pulse on a track */ ) { Word16 sector_p[7]; @@ -528,10 +530,12 @@ static Word32 fcb_encode_PI_fx( /* o: return index of t /*---------------------------------------------------------------------* *encode the class and compute class offset * *---------------------------------------------------------------------*/ -static Word32 fcb_encode_class_fx( /* o: class offset */ - const Word32 sector_6p_num[], /* i: position which have pulse on a track */ - const Word32 pulse_num, /* i: pulse number on a track */ - const Word32 pulse_pos_num /* i: number of position which have pulse on a track */ + +/* o: class offset */ +static Word32 fcb_encode_class_fx( + const Word32 sector_6p_num[], /* i : position which have pulse on a track */ + const Word32 pulse_num, /* i : pulse number on a track */ + const Word32 pulse_pos_num /* i : number of position which have pulse on a track */ ) { Word32 i, j, k; @@ -561,14 +565,18 @@ static Word32 fcb_encode_class_fx( /* o: class o } return mn9_offet; } + + /*---------------------------------------------------------------------* *encode the position * *---------------------------------------------------------------------*/ -static Word32 fcb_encode_position_fx( /* o: return index of the positions which have pulse*/ - const Word16 pos_vector[], /* i: position of the pulse on a track */ - Word32 n, - const Word32 pos_num, /* i: the number of position which have pulse */ - const Word32 flag ) + +/* o: return index of the positions which have pulse*/ +static Word32 fcb_encode_position_fx( + const Word16 pos_vector[], /* i: position of the pulse on a track */ + Word32 n, + const Word32 pos_num, /* i: the number of position which have pulse */ + const Word32 flag ) { Word32 i; Word32 mmm1; @@ -600,20 +608,17 @@ static Word32 fcb_encode_position_fx( /* o: return return mmm1; } -/*-------------------------------------------------------------------* - * search_ixiy - * - * Find the best positions of 2 pulses in a subframe - *-------------------------------------------------------------------*/ /*------------------------------------------------------------* * quant_1p_N1 * * Quantization of 1 pulse with N+1 bits: *-------------------------------------------------------------*/ -static Word16 quant_1p_N1_fx( /* o : return N+1 bits */ - const Word16 pos, /* i : position of the pulse */ - const Word16 N /* i : number of bits FOR position */ + +/* o : return N+1 bits */ +static Word16 quant_1p_N1_fx( + const Word16 pos, /* i : position of the pulse */ + const Word16 N /* i : number of bits FOR position */ ) { Word16 mask; @@ -627,6 +632,7 @@ static Word16 quant_1p_N1_fx( /* o : return N+1 bits { index = add( index, shl( 1, N ) ); /* index += 1 << N */ } + return index; } @@ -635,11 +641,15 @@ static Word16 quant_1p_N1_fx( /* o : return N+1 bits * quant_2p_2N1_fx * * Quantization of 2 pulses with 2*N+1 bits: + + *-------------------------------------------------------------*/ -Word16 quant_2p_2N1_fx( /* o: return (2*N)+1 bits */ - const Word16 pos1, /* i: position of the pulse 1 */ - const Word16 pos2, /* i: position of the pulse 2 */ - const Word16 N /* i: number of bits FOR position */ + +/* o: return (2*N)+1 bits */ +Word16 quant_2p_2N1_fx( + const Word16 pos1, /* i : position of the pulse 1 */ + const Word16 pos2, /* i : position of the pulse 2 */ + const Word16 N /* i : number of bits FOR position */ ) { Word16 mask, tmp; @@ -701,23 +711,29 @@ Word16 quant_2p_2N1_fx( /* o: return (2*N)+1 bits */ return index; } + + /*---------------------------------------------------------------------* * Quantization of 3 pulses with 3*N+1 bits: * *---------------------------------------------------------------------*/ -static Word16 quant_3p_3N1_fx( /* o : return (3*N)+1 bits */ - const Word16 pos1, /* i : position of the pulse 1 */ - const Word16 pos2, /* i : position of the pulse 2 */ - const Word16 pos3, /* i : position of the pulse 3 */ - const Word16 N /* i : number of bits for position */ + +/* o : return (3*N)+1 bits */ +static Word16 quant_3p_3N1_fx( + const Word16 pos1, /* i : position of the pulse 1 */ + const Word16 pos2, /* i : position of the pulse 2 */ + const Word16 pos3, /* i : position of the pulse 3 */ + const Word16 N /* i : number of bits for position */ ) { Word16 nb_pos; Word16 index; nb_pos = shl( 1, sub( N, 1 ) ); /* nb_pos = (1<<(N-1)); */ + /*-------------------------------------------------------* * Quantization of 3 pulses with 3*N+1 bits: * *-------------------------------------------------------*/ + logic16(); logic16(); logic16(); @@ -752,24 +768,30 @@ static Word16 quant_3p_3N1_fx( /* o : return (3*N)+1 bits } return ( index ); } + + /*---------------------------------------------------------------------* * Quantization of 4 pulses with 4*N+1 bits: * *---------------------------------------------------------------------*/ -static Word32 quant_4p_4N1_fx( /* o : return (4*N)+1 bits */ - const Word16 pos1, /* i : position of the pulse 1 */ - const Word16 pos2, /* i : position of the pulse 2 */ - const Word16 pos3, /* i : position of the pulse 3 */ - const Word16 pos4, /* i : position of the pulse 4 */ - const Word16 N /* i : number of bits for position */ + +/* o : return (4*N)+1 bits */ +static Word32 quant_4p_4N1_fx( + const Word16 pos1, /* i : position of the pulse 1 */ + const Word16 pos2, /* i : position of the pulse 2 */ + const Word16 pos3, /* i : position of the pulse 3 */ + const Word16 pos4, /* i : position of the pulse 4 */ + const Word16 N /* i : number of bits for position */ ) { Word16 nb_pos; Word32 index; nb_pos = shl( 1, sub( N, 1 ) ); /* nb_pos = (1<<(N-1)); */ + /*-------------------------------------------------------* * Quantization of 4 pulses with 4*N+1 bits: * *-------------------------------------------------------*/ + logic16(); logic16(); logic16(); @@ -801,15 +823,19 @@ static Word32 quant_4p_4N1_fx( /* o : return (4*N)+1 bits /* index += quant_2p_2N1_fx(pos1, pos4, N) << (2*N); */ index = L_add( index, L_shl( quant_2p_2N1_fx( pos1, pos4, N ), shl( N, 1 ) ) ); } + return ( index ); } + + /*---------------------------------------------------------------------* * Quantization of 4 pulses with 4*N bits: * *---------------------------------------------------------------------*/ -static Word32 quant_4p_4N_fx( /* o : return 4*N bits */ - const Word16 pos[], /* i : position of the pulse 1..4 */ - const Word16 N /* i : number of bits for position */ +/* o : return 4*N bits */ +static Word32 quant_4p_4N_fx( + const Word16 pos[], /* i : position of the pulse 1..4 */ + const Word16 N /* i : number of bits for position */ ) { Word16 i, j, k, nb_pos, n_1, tmp; @@ -881,9 +907,10 @@ static Word32 quant_4p_4N_fx( /* o : return 4*N bits } -static Word32 quant_5p_5N_fx( /* o : return 5*N bits */ - const Word16 pos[], /* i : position of the pulse 1..5 */ - const Word16 N ) /* i : number of bits for position */ +/* o : return 5*N bits */ +static Word32 quant_5p_5N_fx( + const Word16 pos[], /* i : position of the pulse 1..5 */ + const Word16 N ) /* i : number of bits for position */ { Word16 i, j, k, nb_pos, n_1, tmp; Word16 posA[5], posB[5]; @@ -961,9 +988,11 @@ static Word32 quant_5p_5N_fx( /* o : return 5*N bits return ( index ); } -static Word32 quant_6p_6N_2_fx( /* o : return (6*N)-2 bits */ - const Word16 pos[], /* i : position of the pulse 1..6 */ - const Word16 N ) /* i : number of bits for position */ + +/* o : return (6*N)-2 bits */ +static Word32 quant_6p_6N_2_fx( + const Word16 pos[], /* i : position of the pulse 1..6 */ + const Word16 N ) /* i : number of bits for position */ { Word16 i, j, k, nb_pos, n_1; Word16 posA[6], posB[6]; @@ -1047,11 +1076,13 @@ static Word32 quant_6p_6N_2_fx( /* o : return (6*N)-2 bits /*---------------------------------------------------------------------* *order the pulse position * *---------------------------------------------------------------------*/ -static Word32 pre_process_fx( /* o: return sign value of pulse on a track */ - const Word16 v[], /* i: the pulse vector Q9 */ - Word16 pos_vector[], /* o: position of the pulse on a track */ - Word32 pos_vector_num[], /* o: the pulse number on the position which have pulse Q0 */ - Word32 *pulse_pos_num /* i: the number of position which have pulse */ + +/* o: return sign value of pulse on a track */ +static Word32 pre_process_fx( + const Word16 v[], /* i : the pulse vector Q9 */ + Word16 pos_vector[], /* o : position of the pulse on a track */ + Word32 pos_vector_num[], /* o : the pulse number on the position which have pulse Q0 */ + Word32 *pulse_pos_num /* i : the number of position which have pulse */ ) { Word16 j, k; diff --git a/lib_enc/enc_acelp_fx.c b/lib_enc/enc_acelp_fx.c index af0ecd986cd8ec92c367357e14f07b2cf4c27208..ca4c399b0ec345672e3fd2bf5cafd04d0c73bda3 100644 --- a/lib_enc/enc_acelp_fx.c +++ b/lib_enc/enc_acelp_fx.c @@ -1422,7 +1422,6 @@ void E_ACELP_4tsearch_fx( } assert( check ); /* debug code not instrumented */ - /* * Build the codeword, the filtered codeword and index of codevector, as well as store weighted correlations. */ @@ -1483,6 +1482,7 @@ void E_ACELP_4tsearch_fx( * Returns: * void */ + void E_ACELP_4t_fx( Word16 dn[], /*Qdn*/ Word16 cn[] /* Q_xn */, @@ -1496,9 +1496,8 @@ void E_ACELP_4t_fx( const Word16 last_L_frame, /*Q0*/ const Word32 total_brate, /*Q0*/ const Word16 i_subfr, /*Q0*/ - const Word16 cmpl_flag /*Q0*/ - , - const Word16 element_mode /*Q0*/ + const Word16 cmpl_flag, /*Q0*/ + const Word16 element_mode /*Q0*/ ) { PulseConfig config; @@ -1571,9 +1570,11 @@ static void E_ACELP_indexing_shift( } dst[i] = s_or( lshl( src[i], shift_bits ), lsb_bits ); /*Q(shift_bits)*/ move16(); + return; } + #define MAX_IDX_LEN 9 Word16 E_ACELP_indexing_fx( @@ -1722,13 +1723,10 @@ void E_ACELP_adaptive_codebook( ACELP_CbkCorr *g_corr, /* o : ACELP correlation values */ Word16 **pt_indice, /* i/o: quantization indices pointer */ Word16 *pitch_gain, /* o : adaptive codebook gain 1Q14 */ - Word16 exp_xn /* i : exponent of xn (Q_xn-15) */ - , + Word16 exp_xn, /* i : exponent of xn (Q_xn-15) */ Word16 rf_mode, Word16 rf_coder_type, - Word16 *lp_select - -) + Word16 *lp_select ) { Word16 y2[L_SUBFR], xn2[L_SUBFR], code[L_SUBFR]; ACELP_CbkCorr g_corr2; @@ -1811,6 +1809,7 @@ void E_ACELP_adaptive_codebook( * - find filtered pitch exc. y2[]=exc[] convolved with h1[]) * * - compute pitch gain2 * *-----------------------------------------------------------------*/ + test(); IF( EQ_16( mode, NORMAL_OPERATION ) || EQ_16( mode, LOW_PASS ) ) { @@ -1850,6 +1849,7 @@ void E_ACELP_adaptive_codebook( /*-----------------------------------------------------------------* * use the best prediction (minimise quadratic error). * *-----------------------------------------------------------------*/ + test(); IF( EQ_16( mode, LOW_PASS ) || LT_32( L_tmp, L_ener ) ) { diff --git a/lib_enc/enc_acelpx_fx.c b/lib_enc/enc_acelpx_fx.c index 12428bbb45e4061e026038be4f9b95c981ec4d87..00a23895508012d62b6ad339087538802e92e716 100644 --- a/lib_enc/enc_acelpx_fx.c +++ b/lib_enc/enc_acelpx_fx.c @@ -4,21 +4,24 @@ #include #include "options.h" -//#include "prot_fx.h" #include "basop_util.h" #include "options.h" #include "rom_enc.h" #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ + /*--------------------------------------------------------------------------------------* * Local constant *--------------------------------------------------------------------------------------*/ #define _1_Q11 ( 2048 /*1.0f Q11*/ ) /* 1.0f in 4Q11 */ + + /*--------------------------------------------------------------------------------------* * E_ACELP_update_cor *--------------------------------------------------------------------------------------*/ + static void E_ACELP_update_cor_fx( const Word16 pos[], /* i Q0*/ Word16 nb_pulse, /* i Q0*/ @@ -111,11 +114,16 @@ static void E_ACELP_update_cor_fx( { assert( !"Number of pulses not supported" ); } + + return; } + + /*--------------------------------------------------------------------------------------* * E_ACELP_2pulse_searchx * Iterations: nb_pos_ix*16 *--------------------------------------------------------------------------------------*/ + static void E_ACELP_2pulse_searchx_fx( const Word16 nb_pos_ix, /*Q0*/ const Word16 track_x, /*Q0*/ @@ -250,11 +258,15 @@ static void E_ACELP_2pulse_searchx_fx( move16(); assert( ( ( pos[0] & 3 ) == track_x ) && ( ( pos[1] & 3 ) == track_y ) ); /* sanity check */ + + return; } + /*--------------------------------------------------------------------------------------* * E_ACELP_1pulse_searchx *--------------------------------------------------------------------------------------*/ + static void E_ACELP_1pulse_searchx_fx( UWord8 tracks[2], /*Q0*/ Word16 *R, /*Q9+scale*/ @@ -344,21 +356,24 @@ static void E_ACELP_1pulse_searchx_fx( move16(); *ix = x_save; /* Q0 */ move16(); + + return; } + /*--------------------------------------------------------------------------------------* * E_ACELP_4tsearchx_fx * Autocorrelation method for searching pulse positions effectively * Algorithm is identical to traditional covariance method *--------------------------------------------------------------------------------------*/ + void E_ACELP_4tsearchx_fx( Word16 dn[], /*Qdn*/ const Word16 cn[], /*Q_new*/ Word16 Rw[], /*Q9*/ Word16 code[], /*Q9*/ const PulseConfig *config, - Word16 ind[] /*Q0*/ - , + Word16 ind[], /*Q0*/ const Word16 element_mode ) { Word16 sign[L_SUBFR], vec[L_SUBFR]; @@ -384,7 +399,6 @@ void E_ACELP_4tsearchx_fx( ps = 0; /* to avoid compilation warnings */ move16(); - alp = config->alp; /* Q13 */ move16(); nb_pulse = config->nb_pulse; @@ -588,7 +602,6 @@ void E_ACELP_4tsearchx_fx( } } - /* * Store weighted energy of code, build the codeword and index of codevector. */ @@ -636,4 +649,6 @@ void E_ACELP_4tsearchx_fx( move16(); } } + + return; } diff --git a/lib_enc/enc_gen_voic_fx.c b/lib_enc/enc_gen_voic_fx.c index 233dbb8f6be809b07ccf4d396bcc7cdfac6fac51..f4e56fdd3a3df11aa797d147cd8b66279e64f1b5 100644 --- a/lib_enc/enc_gen_voic_fx.c +++ b/lib_enc/enc_gen_voic_fx.c @@ -243,6 +243,7 @@ void encod_gen_voic_fx( *pt_pitch_fx = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, st_fx->core_brate, 0, L_frame, st_fx->coder_type, &pitch_limit_flag, i_subfr_fx, exc_fx, L_SUBFR, st_fx->pitch, &T0_min_fx, &T0_max_fx, &T0_fx, &T0_frac_fx, h1_fx, xn_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, st_fx->element_mode, Q_new ); /* Q6 */ + tbe_celp_exc( L_frame, i_subfr_fx, T0_fx, T0_frac_fx, &error_fx, bwe_exc_fx ); /*-----------------------------------------------------------------* diff --git a/lib_enc/enc_higher_acelp_fx.c b/lib_enc/enc_higher_acelp_fx.c index b1b72ad9a4ce4937e39affe60c44a6b88049e9ce..014ce4603a0a5a1aced83ec0f5f9c174d2232bcd 100644 --- a/lib_enc/enc_higher_acelp_fx.c +++ b/lib_enc/enc_higher_acelp_fx.c @@ -87,6 +87,7 @@ void transf_cdbk_enc_fx( * For inactive frame, find target in residual domain * Deemphasis *--------------------------------------------------------------*/ + IF( EQ_16( st_fx->coder_type, INACTIVE ) ) { gcode16 = round_fx_sat( L_shl_sat( gain_code, Q_new ) ); @@ -136,12 +137,14 @@ void transf_cdbk_enc_fx( /*--------------------------------------------------------------* * Split algebraic vector quantizer based on RE8 lattice *--------------------------------------------------------------*/ + AVQ_cod_fx( x_tran, x_norm, nBits, Nsv, 0 ); /*--------------------------------------------------------------* * Find prequantizer excitation gain * Quantize the gain *--------------------------------------------------------------*/ + L_corr = L_deposit_l( 0 ); L_ener = L_deposit_l( 0 ); FOR( i = 0; i < Nsv * 8; i++ ) @@ -251,6 +254,7 @@ void transf_cdbk_enc_fx( /*--------------------------------------------------------------* * Encode and multiplex subvectors into bit-stream *--------------------------------------------------------------*/ + trgtSvPos = Nsv - 1; move16(); test(); @@ -316,6 +320,7 @@ void transf_cdbk_enc_fx( /*--------------------------------------------------------------* * Preemphasise *--------------------------------------------------------------*/ + /* in extreme cases at subframe boundaries, lower the preemphasis memory to avoid a saturation */ test(); if ( ( nq[7] != 0 ) && ( GT_16( sub( st_fx->last_nq_preQ, nq[0] ), 7 ) ) ) @@ -372,6 +377,8 @@ void transf_cdbk_enc_fx( return; } + + void transf_cdbk_enc_ivas_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 harm_flag_acelp, /* i : harmonic flag for higher rates ACELP Q0*/ @@ -437,6 +444,7 @@ void transf_cdbk_enc_ivas_fx( * For inactive frame, find target in residual domain * Deemphasis *--------------------------------------------------------------*/ + IF( EQ_16( st_fx->coder_type, INACTIVE ) ) { gcode16 = round_fx_sat( L_shl_sat( gain_code, Q_new ) ); @@ -485,12 +493,14 @@ void transf_cdbk_enc_ivas_fx( /*--------------------------------------------------------------* * Split algebraic vector quantizer based on RE8 lattice *--------------------------------------------------------------*/ + AVQ_cod_fx( x_tran, x_norm, nBits, Nsv, 0 ); /*--------------------------------------------------------------* * Find prequantizer excitation gain * Quantize the gain *--------------------------------------------------------------*/ + L_corr = L_deposit_l( 0 ); L_ener = L_deposit_l( 0 ); FOR( i = 0; i < Nsv * 8; i++ ) @@ -602,6 +612,7 @@ void transf_cdbk_enc_ivas_fx( /*--------------------------------------------------------------* * Encode and multiplex subvectors into bit-stream *--------------------------------------------------------------*/ + trgtSvPos = sub( Nsv, 1 ); move16(); test(); @@ -616,7 +627,9 @@ void transf_cdbk_enc_ivas_fx( move16(); move16(); } + AVQ_encmux_fx( st_fx->hBstr, -1, x_norm, &nBits, Nsv, nq, avq_bit_sFlag, trgtSvPos ); + /* save # of AVQ unused bits for next subframe */ *unbits = nBits; move16(); @@ -666,6 +679,7 @@ void transf_cdbk_enc_ivas_fx( /*--------------------------------------------------------------* * Preemphasise *--------------------------------------------------------------*/ + /* in extreme cases at subframe boundaries, lower the preemphasis memory to avoid a saturation */ test(); if ( ( nq[7] != 0 ) && ( GT_16( sub( st_fx->last_nq_preQ, nq[0] ), 7 ) ) ) @@ -746,6 +760,8 @@ void transf_cdbk_enc_ivas_fx( return; } + + /*-------------------------------------------------------------------* * Find target in residual domain - cn[] *-------------------------------------------------------------------*/ @@ -774,13 +790,15 @@ static void find_cn_fx( /*-----------------------------------------------------------------* * Transform domain contribution encoding *-----------------------------------------------------------------*/ -Word16 gain_quant_fx( /* o: quantization index Q0*/ - Word32 *gain, /* i: quantized gain Q16*/ - Word16 *gain16, /* o: quantized gain expg*/ - const Word16 c_min, /* i: log10 of lower limit in Q14*/ - const Word16 c_max, /* i: log10 of upper limit in Q13*/ - const Word16 bits, /* i: number of bits to quantize Q0*/ - Word16 *expg /* o: output exponent of gain16 */ + +/* o: quantization index Q0*/ +Word16 gain_quant_fx( + Word32 *gain, /* i : quantized gain Q16*/ + Word16 *gain16, /* o : quantized gain expg*/ + const Word16 c_min, /* i : log10 of lower limit in Q14*/ + const Word16 c_max, /* i : log10 of upper limit in Q13*/ + const Word16 bits, /* i : number of bits to quantize Q0*/ + Word16 *expg /* o : output exponent of gain16 */ ) { Word16 index, levels; diff --git a/lib_enc/enc_pit_exc_fx.c b/lib_enc/enc_pit_exc_fx.c index 08a86f7319072bdde70b3b2c82f02c2d38382b45..b1ad74b0da240b2627468b5cccd015e687eb9722 100644 --- a/lib_enc/enc_pit_exc_fx.c +++ b/lib_enc/enc_pit_exc_fx.c @@ -266,11 +266,13 @@ void enc_pit_exc_fx( *pt_pitch = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, Pitch_BR, 0, st_fx->L_frame, Pitch_CT, &pitch_limit_flag, i_subfr, exc, L_subfr, st_fx->pitch, &T0_min, &T0_max, T0, T0_frac, h1, xn, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, st_fx->element_mode, Q_new ); /* Q6 */ + /*-----------------------------------------------------------------* * Find adaptive exitation *-----------------------------------------------------------------*/ pred_lt4( &exc[i_subfr], &exc[i_subfr], *T0, *T0_frac, L_subfr + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); + /*-----------------------------------------------------------------* * Gain clipping test to avoid unstable synthesis on frame erasure * or in case of floating point encoder & fixed p. decoder @@ -348,6 +350,7 @@ void enc_pit_exc_fx( gain_enc_mless_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_FRAME, i_subfr, -1, xn, y1, shift_wsp, y2, code, Es_pred, &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain ); } + gp_clip_test_gain_pit_fx( st_fx->element_mode, st_fx->core_brate, gain_pit, st_fx->clip_var_fx ); Lgcode = L_shl_sat( gain_code, Q_new ); /* scaled gain_code with Qnew -> Q16*/ @@ -638,7 +641,6 @@ void enc_pit_exc_ivas_fx( } ELSE { - Local_BR = ACELP_7k20; move32(); Pitch_BR = st_fx->core_brate; @@ -725,6 +727,7 @@ void enc_pit_exc_ivas_fx( * target in residual domain "cn" * Compute impulse response, h1[], of weighted synthesis filter *----------------------------------------------------------------*/ + Copy( &res[i_subfr], &exc[i_subfr], L_subfr ); /* Q_new */ /* condition on target (compared to float) has been put outside the loop */ @@ -767,6 +770,7 @@ void enc_pit_exc_ivas_fx( lp_select = lp_filt_exc_enc_fx( MODE1, AUDIO, i_subfr, exc, h1, xn, y1, xn2, L_subfr, st_fx->L_frame, g_corr, clip_gain, &gain_pit, &lp_flag ); /* Q0 */ + IF( EQ_16( lp_flag, NORMAL_OPERATION ) ) { push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); diff --git a/lib_enc/enc_tran_fx.c b/lib_enc/enc_tran_fx.c index 87642fc44186baca9ea802361312c117210380c8..a4d713fbd0bc781758a10638d6c3a04f428947cc 100644 --- a/lib_enc/enc_tran_fx.c +++ b/lib_enc/enc_tran_fx.c @@ -99,9 +99,11 @@ Word16 encod_tran_fx( L_frame_fx = st_fx->L_frame; move16(); + /*------------------------------------------------------------------* * Initializations *------------------------------------------------------------------*/ + gain_pit = 0; move16(); gain_code = L_deposit_l( 0 ); @@ -196,11 +198,13 @@ Word16 encod_tran_fx( Jopt_flag = 1; move16(); } + /*-----------------------------------------------------------------* * Quantize the gains * Test quantized gain of pitch for pitch clipping algorithm * Update tilt of code: 0.0 (unvoiced) to 0.5 (voiced) *-----------------------------------------------------------------*/ + IF( Jopt_flag == 0 ) { /* SQ gain_code */ @@ -413,6 +417,7 @@ Word16 encod_tran_fx( return tc_subfr; } + Word16 encod_tran_ivas_fx( Encoder_State *st_fx, /* i/o: state structure */ const Word16 speech_fx[], /* i : input speech Q0*/ @@ -574,11 +579,13 @@ Word16 encod_tran_ivas_fx( Jopt_flag = 1; move16(); } + /*-----------------------------------------------------------------* * Quantize the gains * Test quantized gain of pitch for pitch clipping algorithm * Update tilt of code: 0.0 (unvoiced) to 0.5 (voiced) *-----------------------------------------------------------------*/ + IF( Jopt_flag == 0 ) { /* SQ gain_code */ @@ -618,6 +625,7 @@ Word16 encod_tran_ivas_fx( L_tmp = L_msu( L_tmp, y1[L_SUBFR - 1], gain_pit ); // Q_new-1+15+shift L_tmp = L_shl_sat( L_tmp, sub( 1, shift ) ); // Q_new+15 hLPDmem->mem_w0 = round_fx_sat( L_tmp ); /*Q_new-1*/ + /*-----------------------------------------------------------------* * Construct adaptive part of the excitation * Save the non-enhanced excitation for FEC_exc diff --git a/lib_enc/enc_uv_fx.c b/lib_enc/enc_uv_fx.c index 28c79a9685515706fc1314278f47efd228229791..1a531b8bed7810dd5a1bd8abea53ff47792b24e4 100644 --- a/lib_enc/enc_uv_fx.c +++ b/lib_enc/enc_uv_fx.c @@ -1,6 +1,7 @@ /*==================================================================================== EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0 ====================================================================================*/ + #include #include #include "options.h" /* Compilation switches */ @@ -9,12 +10,13 @@ #include "rom_com.h" #include "prot_fx_enc.h" /* Function prototypes */ + /*-------------------------------------------------------------------* * encod_unvoiced() * * Encode unvoiced (UC) frames *-------------------------------------------------------------------*/ -/*fixed point implementation of unvoiced_encoder*/ + void encod_unvoiced_fx( Encoder_State *st_fx, /* i/o: state structure */ const Word16 *speech_fx, /* i : Input speech Q_new*/ @@ -81,7 +83,6 @@ void encod_unvoiced_fx( Q_xn = add( sub( Q_new, 1 ), shift ); Q_new_p5 = add( Q_new, 5 ); - FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) { /*----------------------------------------------------------------* @@ -89,6 +90,7 @@ void encod_unvoiced_fx( * Find the excitation search target "xn" and innovation target in residual domain "cn" * Compute impulse response, h1[], of weighted synthesis filter *----------------------------------------------------------------*/ + i_subfr_idx = shr( i_subfr, 6 ); Copy( &res_fx[i_subfr], &exc_fx[i_subfr], L_SUBFR ); /* Q_new */ @@ -100,9 +102,11 @@ void encod_unvoiced_fx( /* scaling of xn[] to limit dynamic at 12 bits */ Scale_sig( xn_fx, L_SUBFR, shift ); + /*----------------------------------------------------------------* * Unvoiced subframe processing *----------------------------------------------------------------*/ + IF( !uc_two_stage_flag ) { *pt_pitch_fx = gaus_encode_fx( st_fx, i_subfr, h1_fx, xn_fx, exc_fx, &hLPDmem->mem_w0, st_fx->clip_var_fx, @@ -123,9 +127,11 @@ void encod_unvoiced_fx( * Gain clipping test to avoid unstable synthesis on frame erasure * or in case of floating point encoder & fixed p. decoder *-----------------------------------------------------------------*/ + Mode2_gp_clip_fx( st_fx->voicing_fx, i_subfr, st_fx->coder_type, xn_fx, st_fx->clip_var_fx, L_SUBFR, Q_xn ); *pt_pitch_fx = L_SUBFR; move16(); + /*----------------------------------------------------------------------* * Encode the algebraic innovation * *----------------------------------------------------------------------*/ @@ -165,15 +171,18 @@ void encod_unvoiced_fx( /*----------------------------------------------------------* * - voice factor (for pitch enhancement) * *----------------------------------------------------------*/ + E_UTIL_voice_factor( exc_fx, i_subfr, code_fx, gain_pit_fx, L_gain_code_fx, &voice_fac_fx, &( hLPDmem->tilt_code ), L_SUBFR, acelp_cfg->voice_tilt, Q_new, shift ); IF( st_fx->Opt_RF_ON ) { st_fx->hRF->rf_tilt_buf[i_subfr_idx] = hLPDmem->tilt_code; } + /*-----------------------------------------------------------------* * Update memory of the weighting filter *-----------------------------------------------------------------*/ + /* st_fx->mem_w0 = xn[L_SUBFR-1] - (gain_pit*y1[L_SUBFR-1]) - (gain_code*y2[L_SUBFR-1]); */ Ltmp = Mpy_32_16_1( L_gain_code_fx, y2_fx[L_SUBFR - 1] ); /* Q10 */ Ltmp = L_shl( Ltmp, add( 5, Q_xn ) ); /* Q15 + Q_xn */ @@ -222,6 +231,7 @@ void encod_unvoiced_fx( * Synthesize speech to update mem_syn[]. * Update A(z) filters *-----------------------------------------------------------------*/ + Syn_filt_s( 1, p_Aq_fx, M, &exc_fx[i_subfr], &syn_fx[i_subfr], L_SUBFR, hLPDmem->mem_syn, 1 ); p_Aw_fx += ( M + 1 ); @@ -238,6 +248,7 @@ void encod_unvoiced_fx( return; } + void encod_unvoiced_ivas_fx( Encoder_State *st_fx, /* i/o: state structure */ const Word16 *speech_fx, /* i : Input speech Q_new*/ @@ -287,6 +298,7 @@ void encod_unvoiced_ivas_fx( /*------------------------------------------------------------------* * Initializations *------------------------------------------------------------------*/ + gain_pit_fx = 0; move16(); @@ -306,7 +318,6 @@ void encod_unvoiced_ivas_fx( Q_xn = add( sub( Q_new, 1 ), shift ); Q_new_p5 = add( Q_new, 5 ); - FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) { /*----------------------------------------------------------------* @@ -314,6 +325,7 @@ void encod_unvoiced_ivas_fx( * Find the excitation search target "xn" and innovation target in residual domain "cn" * Compute impulse response, h1[], of weighted synthesis filter *----------------------------------------------------------------*/ + i_subfr_idx = shr( i_subfr, 6 ); Copy( &res_fx[i_subfr], &exc_fx[i_subfr], L_SUBFR ); /* Q_new */ @@ -326,9 +338,11 @@ void encod_unvoiced_ivas_fx( /* scaling of xn[] to limit dynamic at 12 bits */ Scale_sig( xn_fx, L_SUBFR, shift ); // Q_new - 1 + shift + /*----------------------------------------------------------------* * Unvoiced subframe processing *----------------------------------------------------------------*/ + IF( !uc_two_stage_flag ) { *pt_pitch_fx = gaus_encode_fx( st_fx, i_subfr, h1_fx, xn_fx, exc_fx, &hLPDmem->mem_w0, st_fx->clip_var_fx, @@ -341,22 +355,25 @@ void encod_unvoiced_ivas_fx( /*----------------------------------------------------------------* * Unvoiced subframe processing in two stages *----------------------------------------------------------------*/ + // PMT("The code below needs validation, never been tested") /* No adaptive codebook (UC) */ set16_fx( y1, 0, L_SUBFR ); set16_fx( exc_fx + i_subfr, 0, L_SUBFR ); + /*-----------------------------------------------------------------* * Gain clipping test to avoid unstable synthesis on frame erasure * or in case of floating point encoder & fixed p. decoder *-----------------------------------------------------------------*/ + Mode2_gp_clip_fx( st_fx->voicing_fx, i_subfr, st_fx->coder_type, xn_fx, st_fx->clip_var_fx, L_SUBFR, Q_xn ); *pt_pitch_fx = L_SUBFR << 6; move16(); + /*----------------------------------------------------------------------* * Encode the algebraic innovation * *----------------------------------------------------------------------*/ - // E_ACELP_innovative_codebook_fx( exc_fx, *pt_pitch_fx, 0, 1, gain_pit_fx, hLPDmem->tilt_code, acelp_cfg, i_subfr, p_Aq_fx, h1_fx, xn_fx, cn_fx, y1, y2_fx, (Word8) st_fx->acelp_autocorr, &prm, code_fx, shift, st_fx->L_frame, st_fx->last_L_frame, st_fx->total_brate, st_fx->element_mode ); inov_encode_ivas_fx( st_fx, st_fx->core_brate, 0, L_FRAME, st_fx->last_L_frame, UNVOICED, st_fx->bwidth, 1, i_subfr, -1, p_Aq_fx, gain_pit_fx, cn_fx, exc_fx, h2_fx, hLPDmem->tilt_code, *pt_pitch_fx, xn_fx, code_fx, y2_fx, &unbits_PI, L_SUBFR, shift, Q_new ); @@ -398,6 +415,7 @@ void encod_unvoiced_ivas_fx( /*----------------------------------------------------------* * - voice factor (for pitch enhancement) * *----------------------------------------------------------*/ + E_UTIL_voice_factor( exc_fx, i_subfr, code_fx, gain_pit_fx, L_gain_code_fx, &voice_fac_fx, &( hLPDmem->tilt_code ), L_SUBFR, acelp_cfg->voice_tilt, Q_new, shift ); if ( st_fx->Opt_RF_ON ) @@ -408,6 +426,7 @@ void encod_unvoiced_ivas_fx( /*-----------------------------------------------------------------* * Update memory of the weighting filter *-----------------------------------------------------------------*/ + /* st_fx->mem_w0 = xn[L_SUBFR-1] - (gain_pit*y1[L_SUBFR-1]) - (gain_code*y2[L_SUBFR-1]); */ Ltmp = Mpy_32_16_1( L_gain_code_fx, y2_fx[L_SUBFR - 1] ); /* Q10 */ Ltmp = L_shl( Ltmp, add( 5, Q_xn ) ); // Qxn+15 @@ -462,6 +481,7 @@ void encod_unvoiced_ivas_fx( * Synthesize speech to update mem_syn[]. * Update A(z) filters *-----------------------------------------------------------------*/ + Syn_filt_s( 1, p_Aq_fx, M, &exc_fx[i_subfr], &syn_fx[i_subfr], L_SUBFR, hLPDmem->mem_syn, 1 ); p_Aw_fx += ( M + 1 ); diff --git a/lib_enc/ext_sig_ana_fx.c b/lib_enc/ext_sig_ana_fx.c index 42f6dc487b52d5df5c56c46676513741ff3d6f8e..20d18c7796b4dd86b8f12380900ba14952119694 100644 --- a/lib_enc/ext_sig_ana_fx.c +++ b/lib_enc/ext_sig_ana_fx.c @@ -914,10 +914,10 @@ void core_signal_analysis_high_bitrate_ivas_fx( tmp = BASOP_Util_Divide1616_Scale( st->bwidth_sw_cnt, BWS_TRAN_PERIOD, &exp_diff ); factor = L_shl( L_deposit_h( tmp ), exp_diff ); // Q31 - v_multc_fixed( hTcxEnc->spectrum_fx[frameno] + i * tcx5SizeFB + L_FRAME16k / ( 2 * nSubframes ), - factor, - hTcxEnc->spectrum_fx[frameno] + i * tcx5SizeFB + L_FRAME16k / ( 2 * nSubframes ), - L_subframe - L_FRAME16k / ( 2 * nSubframes ) ); + v_multc_fx( hTcxEnc->spectrum_fx[frameno] + i * tcx5SizeFB + L_FRAME16k / ( 2 * nSubframes ), + factor, + hTcxEnc->spectrum_fx[frameno] + i * tcx5SizeFB + L_FRAME16k / ( 2 * nSubframes ), + L_subframe - L_FRAME16k / ( 2 * nSubframes ) ); } } hTcxEnc->spectrum_e[frameno] = s_max( exp[0], exp[1] ); @@ -954,7 +954,7 @@ void core_signal_analysis_high_bitrate_ivas_fx( tmp = Sqrt16( tmp, &exp_diff ); factor = L_shl( L_deposit_h( tmp ), exp_diff ); // Q31 - v_multc_fixed( hTcxEnc->spectrum_fx[frameno], factor, hTcxEnc->spectrum_fx[frameno], L_subframe ); + v_multc_fx( hTcxEnc->spectrum_fx[frameno], factor, hTcxEnc->spectrum_fx[frameno], L_subframe ); } ELSE { @@ -996,10 +996,10 @@ void core_signal_analysis_high_bitrate_ivas_fx( tmp = BASOP_Util_Divide1616_Scale( st->bwidth_sw_cnt, BWS_TRAN_PERIOD, &exp_diff ); factor = L_shl( L_deposit_h( tmp ), exp_diff ); // Q31 - v_multc_fixed( hTcxEnc->spectrum_fx[frameno] + L_FRAME16k / nSubframes, - factor, - hTcxEnc->spectrum_fx[frameno] + L_FRAME16k / nSubframes, - L_subframe - L_FRAME16k / nSubframes ); + v_multc_fx( hTcxEnc->spectrum_fx[frameno] + L_FRAME16k / nSubframes, + factor, + hTcxEnc->spectrum_fx[frameno] + L_FRAME16k / nSubframes, + L_subframe - L_FRAME16k / nSubframes ); } IF( NE_16( st->element_mode, IVAS_CPE_MDCT ) ) @@ -1121,10 +1121,10 @@ void core_signal_analysis_high_bitrate_ivas_fx( tmp = BASOP_Util_Divide1616_Scale( st->bwidth_sw_cnt, BWS_TRAN_PERIOD, &exp_diff ); factor = L_shl( L_deposit_h( tmp ), exp_diff ); // Q31 - v_multc_fixed( spectrum[frameno] + i * tcx5SizeFB + L_FRAME16k / ( 2 * nSubframes ), - factor, - spectrum[frameno] + i * tcx5SizeFB + L_FRAME16k / ( 2 * nSubframes ), - L_subframe - L_FRAME16k / ( 2 * nSubframes ) ); + v_multc_fx( spectrum[frameno] + i * tcx5SizeFB + L_FRAME16k / ( 2 * nSubframes ), + factor, + spectrum[frameno] + i * tcx5SizeFB + L_FRAME16k / ( 2 * nSubframes ), + L_subframe - L_FRAME16k / ( 2 * nSubframes ) ); } } } @@ -1149,7 +1149,7 @@ void core_signal_analysis_high_bitrate_ivas_fx( tmp = Sqrt16( tmp, &exp_diff ); factor = L_shl( L_deposit_h( tmp ), exp_diff ); // Q31 - v_multc_fixed( spectrum[frameno], factor, spectrum[frameno], L_subframe ); + v_multc_fx( spectrum[frameno], factor, spectrum[frameno], L_subframe ); } ELSE { @@ -1191,7 +1191,7 @@ void core_signal_analysis_high_bitrate_ivas_fx( tmp = BASOP_Util_Divide1616_Scale( st->bwidth_sw_cnt, BWS_TRAN_PERIOD, &exp_diff ); factor = L_shl( L_deposit_h( tmp ), exp_diff ); // Q31 - v_multc_fixed( spectrum[frameno] + L_FRAME16k / nSubframes, factor, spectrum[frameno] + L_FRAME16k / nSubframes, L_subframe - L_FRAME16k / nSubframes ); + v_multc_fx( spectrum[frameno] + L_FRAME16k / nSubframes, factor, spectrum[frameno] + L_FRAME16k / nSubframes, L_subframe - L_FRAME16k / nSubframes ); } } } diff --git a/lib_enc/find_tilt_fx.c b/lib_enc/find_tilt_fx.c index 5eaa1d4dde05e61d9ede8405a246abdde8e5732c..e267040991aa03cd00a47d929400681729e60a86 100644 --- a/lib_enc/find_tilt_fx.c +++ b/lib_enc/find_tilt_fx.c @@ -28,9 +28,8 @@ void find_tilt_fx( Word32 hp_E[], /* o : energy in HF Q_new + Q_SCALE*/ const Word16 codec_mode, /* i : MODE1 or MODE2 Q0*/ const Word16 Q_new, /* i : scaling factor */ - Word32 *bckr_tilt_lt /* i/o: lf/hf E ratio of background noise Q16*/ - , - Word16 Opt_vbr_mode /* Q0 */ + Word32 *bckr_tilt_lt, /* i/o: lf/hf E ratio of background noise Q16*/ + Word16 Opt_vbr_mode /* Q0 */ ) { Word32 lp_bckr = 0, hp_bckr = 0, lp_E, Ltmp; diff --git a/lib_enc/frame_spec_dif_cor_rate_fx.c b/lib_enc/frame_spec_dif_cor_rate_fx.c index 3e2eb40155f5e006eda820818db061688d9d2299..9678acdbfee4fb3d927c352c00273b9f5914e39c 100644 --- a/lib_enc/frame_spec_dif_cor_rate_fx.c +++ b/lib_enc/frame_spec_dif_cor_rate_fx.c @@ -35,7 +35,7 @@ void frame_spec_dif_cor_rate_fx( Word16 scalefactor, spec_dif_cor_rate; Word32 m, dx, dy; Word16 *pre_spec_low_dif = hVAD_CLDFB->pre_spec_low_dif; - const Word32 FIX_cost1 = 2147484 /* 0.001f Q31 */; + const Word32 FIX_cost1 = INV_1000_Q31; move16(); move32(); diff --git a/lib_enc/gain_enc_fx.c b/lib_enc/gain_enc_fx.c index 27b49c9d61a6d63054a405325c6ddd65a3fa925e..e84d09e3cc963572063bfb0d36b435c9a57e6c29 100644 --- a/lib_enc/gain_enc_fx.c +++ b/lib_enc/gain_enc_fx.c @@ -527,6 +527,8 @@ void gain_enc_mless_fx( return; } + + /*---------------------------------------------------------------------* * gain_enc_SQ() * @@ -807,17 +809,21 @@ void gain_enc_SQ_fx( return; } + + /*-------------------------------------------------------------------* * gain_enc_gaus() * * Quantization of gain for Gaussian codebook *-------------------------------------------------------------------*/ -Word16 gain_enc_gaus_fx( /* o : Return index of quantization */ - Word32 *gain, /* i/o: Code gain to quantize Q16*/ - const Word16 bits, /* i : number of bits to quantize Q0*/ - const Word16 lowBound, /* i : lower bound of quantizer (dB) Q8*/ - const Word16 stepSize, /* i : Step size choice Q14*/ - const Word16 inv_stepSize /* i : Step size choice Q15*/ + +/* o : Return index of quantization */ +Word16 gain_enc_gaus_fx( + Word32 *gain, /* i/o: Code gain to quantize Q16*/ + const Word16 bits, /* i : number of bits to quantize Q0*/ + const Word16 lowBound, /* i : lower bound of quantizer (dB) Q8*/ + const Word16 stepSize, /* i : Step size choice Q14*/ + const Word16 inv_stepSize /* i : Step size choice Q15*/ ) { Word16 index, exp_gain, frac_gain, wtmp; @@ -870,6 +876,7 @@ Word16 gain_enc_gaus_fx( /* o : Return index of quant * - gain_pit = 0 * - gain_code - scalar quantization (no prediciton history used) *-----------------------------------------------------------------*/ + void gain_enc_tc_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const Word16 gains_mode[], /* i : gain bits Q0*/ @@ -898,6 +905,7 @@ void gain_enc_tc_fx( /*----------------------------------------------------------------* * get number of bits for gain quantization *----------------------------------------------------------------*/ + nBits = gains_mode[shr( i_subfr, 6 )]; /*----------------------------------------------------------------* @@ -923,6 +931,7 @@ void gain_enc_tc_fx( /*----------------------------------------------------------------* * compute gain = xy/yy *----------------------------------------------------------------*/ + g_code_fx = div_s( num, den ); i = sub( exp_num, exp_den ); /* Gain_trans in Q7 */ @@ -1012,9 +1021,11 @@ void gain_enc_tc_fx( BREAK; } } + /*----------------------------------------------------------------* * 3-bit -> 2-bit encoding *----------------------------------------------------------------*/ + IF( EQ_16( nBits, 2 ) ) { /* 2-bit -> 3-bit decoding */ @@ -1042,6 +1053,7 @@ void gain_enc_tc_fx( /*-----------------------------------------------------------------* * decode normalized codebook gain *-----------------------------------------------------------------*/ + /**norm_gain_code = *gain_code / *gain_inov;*/ expg = sub( norm_s( *gain_inov_fx ), 1 ); expg = s_max( expg, 0 ); @@ -1049,13 +1061,17 @@ void gain_enc_tc_fx( tmp_fx = div_s( shr( 8192, expg ), *gain_inov_fx ); *norm_gain_code_fx = L_shr( Mult_32_16( *gain_code_fx, tmp_fx ), sub( 1, expg ) ); // Q16 move32(); + return; } + + /*-----------------------------------------------------------------* * Find_Opt_gainQ_fx() * * Find the best quantizer *-----------------------------------------------------------------*/ + static Word16 Find_Opt_gainQ_fx( Word16 *coeff, /* exp(exp_coeff) */ Word16 *exp_coeff, @@ -1189,8 +1205,11 @@ static Word16 Find_Opt_gainQ_fx( L_tmp = L_shl_sat( L_tmp, add( exp_gcode0, 6 ) ); /* Q10 -> Q16 */ *gain_code = L_tmp; /* gain of code in Q16 */ move16(); + return index; } + + /*---------------------------------------------------------------------* * gain_enc_lbr() * @@ -1222,12 +1241,10 @@ void gain_enc_lbr_fx( Word32 gc_mem[], /* i/o: gain_code from previous subframes Q16*/ Word16 gp_mem[], /* i/o: gain_pitch from previous subframes Q14*/ const Word16 clip_gain, /* i : gain pitch clipping flag (1 = clipping) Q0*/ - const Word16 L_subfr /* i : subframe length Q0*/ - , - const Word16 element_mode /* i : mode element Q0*/ + const Word16 L_subfr, /* i : subframe length Q0*/ + const Word16 element_mode /* i : mode element Q0*/ ) { - Word16 index = 0, size, nBits, n_pred, ctype; const Word16 *b, *cdbk = 0; Word16 gcode0, aux[10]; @@ -1244,6 +1261,7 @@ void gain_enc_lbr_fx( L_subfr_sf = 7; move16(); } + /*-----------------------------------------------------------------* * calculate the rest of the correlation coefficients * c2 = , c3 = -2, c4 = 2, c5* = @@ -1293,7 +1311,6 @@ void gain_enc_lbr_fx( *gain_inov = extract_h( L_shl_sat( L_inov, sub( exp_inov, 3 ) ) ); /* gain_inov in Q12 */ move16(); - /*-----------------------------------------------------------------* * select the codebook, size and number of bits * set the gains searching range @@ -1309,6 +1326,7 @@ void gain_enc_lbr_fx( * calculate prediction of gcode * search for the best codeword *-----------------------------------------------------------------*/ + test(); IF( i_subfr == 0 ) { @@ -1618,7 +1636,6 @@ void gain_enc_lbr_fx( aux[3] = round_fx( L_shl( L_tmp1, 12 ) ); /* Q12 */ move16(); - /*aux[4] = (float)log10(gc_mem[2]); = log2(gc_mem[2])*log10(2);*/ exp = norm_l( gc_mem[2] ); @@ -1661,9 +1678,11 @@ void gain_enc_lbr_fx( { push_indice( hBstr, IND_GAIN, index, nBits ); } + return; } + /*-------------------------------------------------------------------* * gain_enc_amr_wb() * @@ -1675,7 +1694,6 @@ void gain_enc_lbr_fx( * mean-squared weighted error criterion is used in the quantizer search. *-------------------------------------------------------------------*/ - void gain_enc_amr_wb_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const Word16 *xn, /* i : target vector Q_xn*/ @@ -1706,6 +1724,7 @@ void gain_enc_amr_wb_fx( * Find the initial quantization pitch index * Set gains search range *----------------------------------------------------------------*/ + IF( GE_32( core_brate, ACELP_12k65 ) ) { t_qua_gain = t_qua_gain7b_fx; // Q14 @@ -1751,6 +1770,7 @@ void gain_enc_amr_wb_fx( } nBits = 6; } + /*----------------------------------------------------------------* * Compute coefficients needed for the quantization. * @@ -1763,6 +1783,7 @@ void gain_enc_amr_wb_fx( * Product and have been computed in Adpt_enr() and * are in vector g_coeff[]. *----------------------------------------------------------------*/ + coeff[0] = g_coeff[0]; move16(); exp_coeff[0] = g_coeff[1]; @@ -1796,6 +1817,7 @@ void gain_enc_amr_wb_fx( * L_tmp = MEAN_ENER - 10log10(energy of code/ L_subfr) * = MEAN_ENER - 3.0103*log2(energy of code/ L_subfr) *----------------------------------------------------------------*/ + L_tmp = Dot_product12( code, code, L_SUBFR, &exp_code ); L_inov = L_add( L_tmp, 0 ); /* exp_code: -18 (code in Q9), -6 (/L_subfr), -31 (L_tmp Q31->Q0) */ @@ -1815,6 +1837,7 @@ void gain_enc_amr_wb_fx( /*----------------------------------------------------------------* * predicted codebook gain *----------------------------------------------------------------*/ + L_tmp = L_shl( L_tmp, 10 ); /* From Q14 to Q24 */ L_tmp = L_mac0( L_tmp, pred_gain_fx[0], past_qua_en[0] ); /* Q14*Q10 -> Q24 */ L_tmp = L_mac0( L_tmp, pred_gain_fx[1], past_qua_en[1] ); /* Q14*Q10 -> Q24 */ diff --git a/lib_enc/hq_core_enc_fx.c b/lib_enc/hq_core_enc_fx.c index dd9f1f2b9a51e01c3a60498e4711aff5bf992e04..2879997ac5d6e225d7fc434ad1e4728dca32635b 100644 --- a/lib_enc/hq_core_enc_fx.c +++ b/lib_enc/hq_core_enc_fx.c @@ -307,6 +307,7 @@ void hq_core_enc_ivas_fx( st->Nb_ACELP_frames = 0; move16(); set_zero_fx( t_audio_fx, L_FRAME48k_EXT ); + /* set input_frame length */ input_frame = input_frame_orig; /* Q0 */ @@ -429,11 +430,9 @@ void hq_core_enc_ivas_fx( /* limit encoded band-width according to the command-line OR BWD limitation */ inner_frame = inner_frame_tbl[st->bwidth]; /* Q0 */ L_spec = l_spec_tbl[st->bwidth]; /* Q0 */ - move16(); move16(); - IF( GT_16( input_frame, inner_frame ) ) { IF( EQ_16( is_transient, 1 ) ) @@ -449,7 +448,6 @@ void hq_core_enc_ivas_fx( } } - /* subtract signaling bits */ num_bits = sub( num_bits, hBstr->nb_bits_tot ); /* Q0 */ @@ -467,12 +465,12 @@ void hq_core_enc_ivas_fx( { FOR( i = 0; i < NUM_TIME_SWITCHING_BLOCKS; i++ ) { - v_multc_fixed( t_audio_fx + add( i_mult2( i, shr( inner_frame, 2 ) ), L_FRAME16k / NUM_TIME_SWITCHING_BLOCKS ), L_tmp, t_audio_fx + add( i_mult2( i, shr( inner_frame, 2 ) ), L_FRAME16k / NUM_TIME_SWITCHING_BLOCKS ), sub( shr( inner_frame, 2 ), L_FRAME16k / NUM_TIME_SWITCHING_BLOCKS ) ); // Q_audio + Q31 - Q31 -> Q_audio + v_multc_fx( t_audio_fx + add( i_mult2( i, shr( inner_frame, 2 ) ), L_FRAME16k / NUM_TIME_SWITCHING_BLOCKS ), L_tmp, t_audio_fx + add( i_mult2( i, shr( inner_frame, 2 ) ), L_FRAME16k / NUM_TIME_SWITCHING_BLOCKS ), sub( shr( inner_frame, 2 ), L_FRAME16k / NUM_TIME_SWITCHING_BLOCKS ) ); // Q_audio + Q31 - Q31 -> Q_audio } } ELSE { - v_multc_fixed( t_audio_fx + L_FRAME16k, L_tmp, t_audio_fx + L_FRAME16k, L_spec - L_FRAME16k ); // Q_audio + Q31 - Q31 -> Q_audio + v_multc_fx( t_audio_fx + L_FRAME16k, L_tmp, t_audio_fx + L_FRAME16k, L_spec - L_FRAME16k ); // Q_audio + Q31 - Q31 -> Q_audio } } @@ -551,7 +549,6 @@ void hq_core_enc_ivas_fx( Copy_Scale_sig_32_16( wtda_audio_fx32, wtda_audio_fx16, 2 * L_FRAME48k, negate( Q_audio ) ); // Q0 TCX_MDCT_Inverse( t_audio_fx, sub( sub( 31, Q_audio ), 15 ), wtda_audio_fx16, overlap, sub( L_frame, overlap ), overlap, st->element_mode ); - /* Window current frame */ Word16 tcx_offset_tmp; @@ -566,7 +563,6 @@ void hq_core_enc_ivas_fx( } tcx_windowing_synthesis_current_frame( wtda_audio_fx16, st->hTcxCfg->tcx_aldo_window_2, st->hTcxCfg->tcx_mdct_window_half, st->hTcxCfg->tcx_mdct_window_minimum, overlap, /*st->hTcxCfg->tcx_mdct_window_length*/ st->hTcxCfg->tcx_mdct_window_half_length, st->hTcxCfg->tcx_mdct_window_min_length, st->last_core == ACELP_CORE, st->hTcxCfg->tcx_last_overlap_mode, /*left mode*/ st->hTcxEnc->acelp_zir, st->hTcxEnc->Txnq, NULL, Aq_old_fx, st->hTcxCfg->tcx_mdct_window_trans, shr( st->L_frame, 1 ), tcx_offset_tmp, st->last_core, 0, 0 ); - /*Compute windowed synthesis in case of switching to ALDO windows in next frame*/ Copy( wtda_audio_fx16 + sub( L_frame, nz ), st->hTcxEnc->old_out_fx, nz + overlap ); /* Q0 */ set16_fx( st->hTcxEnc->old_out_fx + add( nz, overlap ), 0, nz ); @@ -588,7 +584,7 @@ void hq_core_enc_ivas_fx( { Word16 tmp_q = Q_audio; move16(); - Word32 ener_match_fx = SQRT2_FIXED; + Word32 ener_match_fx = SQRT2_FX; move32(); FOR( i = 0; i < input_frame; i++ ) { @@ -600,7 +596,6 @@ void hq_core_enc_ivas_fx( scale_sig32( wtda_audio_fx32, 2 * L_FRAME48k, sub( Q_audio, tmp_q ) ); /* Q_audio */ Inverse_Transform( t_audio_fx, &Q_audio, wtda_audio_fx32, is_transient, L_FRAME16k, inner_frame, st->element_mode ); - out_q = Q_audio; move16(); window_ola_fx( wtda_audio_fx32, output_fx, &out_q, st->hTcxEnc->old_out_fx, &old_q, L_FRAME16k, st->hTcxCfg->tcx_last_overlap_mode, st->hTcxCfg->tcx_curr_overlap_mode, 0, 0, NULL ); diff --git a/lib_enc/hq_lr_enc_fx.c b/lib_enc/hq_lr_enc_fx.c index cce822cae99e9f9b45a0083b34bd44d7c8d81109..cd58e3b95358314438c169dbcc95f32a5efce782 100644 --- a/lib_enc/hq_lr_enc_fx.c +++ b/lib_enc/hq_lr_enc_fx.c @@ -2140,14 +2140,14 @@ static Word16 small_symbol_enc_tran_ivas_fx( /* o : bit * if flag_pack = 0, estimatng else packing bits *--------------------------------------------------------------------------*/ -static Word16 small_symbol_enc_fx( /* o : bits */ - BSTR_ENC_HANDLE hBstr, /* i : handle to the bitstream */ - const Word16 *qbidx, /* i : input of dequantized differential energy Q0*/ - const Word16 BANDS, /* i : number of bands Q0*/ - Word16 *hLCmode, /* i/o: LC mode info Q0*/ - const Word16 flag_pack /* i : indicator of packing or estimating bits Q0*/ - , - const Word16 is_transient /* Q0 */ ) +/* o : bits */ +static Word16 small_symbol_enc_fx( + BSTR_ENC_HANDLE hBstr, /* i : handle to the bitstream */ + const Word16 *qbidx, /* i : input of dequantized differential energy Q0*/ + const Word16 BANDS, /* i : number of bands Q0*/ + Word16 *hLCmode, /* i/o: LC mode info Q0*/ + const Word16 flag_pack, /* i : indicator of packing or estimating bits Q0*/ + const Word16 is_transient /* Q0 */ ) { Word16 i, bits; Word16 difidx[BANDS_MAX], LSB[BANDS_MAX]; @@ -2278,12 +2278,13 @@ static Word16 small_symbol_enc_ivas_fx( } -static Word16 large_symbol_enc_fx( /* o : bits Q0*/ - BSTR_ENC_HANDLE hBstr, /* i : handle to the bitstream */ - Word16 *qbidx, /* i : input of dequantized differential energy Q0*/ - const Word16 BANDS, /* i : number of bands Q0*/ - Word16 *hLCmode0, /* i/o: LC mode info Q0*/ - const Word16 flag_pack /* i : indicator of packing or estimating bits Q0*/ +/* o : bits Q0 */ +static Word16 large_symbol_enc_fx( + BSTR_ENC_HANDLE hBstr, /* i : handle to the bitstream */ + Word16 *qbidx, /* i : input of dequantized differential energy Q0*/ + const Word16 BANDS, /* i : number of bands Q0*/ + Word16 *hLCmode0, /* i/o: LC mode info Q0*/ + const Word16 flag_pack /* i : indicator of packing or estimating bits Q0*/ ) { Word16 i, bits, tmp; @@ -3154,7 +3155,7 @@ static Word16 band_energy_quant_fx( static Word16 band_energy_quant_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const Word32 *L_t_audio, /* i : Q12 : input MDCT signal (Qs) */ const Word16 band_start[], /* i : Q0 : band start table */ const Word16 band_end[], /* i : Q0 : band end table */ @@ -3162,7 +3163,8 @@ static Word16 band_energy_quant_ivas_fx( const Word16 bands, /* i : Q0 : number of bands */ const Word32 L_qint, /* i : Q29 */ const Word16 eref_fx, /* i : Q10 */ - const Word16 is_transient /* i : Q0 : indicator for HQ_TRANSIENT */ ) + const Word16 is_transient /* i : Q0 : indicator for HQ_TRANSIENT */ +) { Word16 i, k; Word16 ebits; diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c index b3ddbf663f702cbd1db6b37f5bdc9dc3563b2b73..6d5618ee1aea0b6ec74127325ecc50d71680ec80 100644 --- a/lib_enc/init_enc_fx.c +++ b/lib_enc/init_enc_fx.c @@ -20,9 +20,9 @@ *-----------------------------------------------------------------------*/ ivas_error init_encoder_fx( - Encoder_State *st_fx, /* i/o: Encoder static variables structure */ - const int16_t var_SID_rate_flag, /* i : flag for variable SID update rate */ - const int16_t interval_SID /* i : interval for SID update */ + Encoder_State *st_fx, /* i/o: Encoder static variables structure */ + const Word16 var_SID_rate_flag, /* i : flag for variable SID update rate */ + const Word16 interval_SID /* i : interval for SID update */ ) { Word16 i; diff --git a/lib_enc/inov_enc_fx.c b/lib_enc/inov_enc_fx.c index 88f95864599a7aebc516b70f56e4f4790203ea48..536cf1479736567f950faf63cc395d23de7e92c5 100644 --- a/lib_enc/inov_enc_fx.c +++ b/lib_enc/inov_enc_fx.c @@ -13,7 +13,7 @@ /*==============================================================================*/ -/* FUNCTION : inov_encode_fx() */ +/* FUNCTION : inov_encode_fx() */ /*------------------------------------------------------------------------------*/ /* PURPOSE : Encode the algebraic innovation */ /*------------------------------------------------------------------------------*/ @@ -333,7 +333,6 @@ Word16 inov_encode_fx( } } - /*----------------------------------------------------------------* * Pitch sharpening *----------------------------------------------------------------*/ @@ -343,6 +342,7 @@ Word16 inov_encode_fx( return stack_pulses; } + Word16 inov_encode_ivas_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ const Word32 core_brate, /* i : core bitrate */ @@ -743,7 +743,6 @@ Word16 inov_encode_ivas_fx( } } - /*----------------------------------------------------------------* * Pitch sharpening *----------------------------------------------------------------*/ diff --git a/lib_enc/ivas_agc_enc_fx.c b/lib_enc/ivas_agc_enc_fx.c index d74e10bdaf25ea124ae9326ad807ac835e6e6e97..10d7cb8c71c2b736bc7fa24bbd467bed6f7dc94b 100644 --- a/lib_enc/ivas_agc_enc_fx.c +++ b/lib_enc/ivas_agc_enc_fx.c @@ -49,13 +49,14 @@ #define TWO_IN_Q29 1073741824 #define ONE_MINUS_M_DELTA_PROD_FLT_FC 1073741824 // Q15 -static Word16 ceil_fx( Word16 inp, Word16 Q ); -static Word32 pow32_fx( Word16 inp, Word16 indx ); -static Word16 BASOP_Util_Cmp_Mant32Exp_sat( Word32 a_m, Word16 a_e, Word32 b_m, Word16 b_e ); -static Word16 ceil_fx( Word16 inp, Word16 Q ) + +static Word16 ceil_fx_loc( + const Word16 inp, + const Word16 Q ) { Word16 ret; Word32 ret_32; + IF( inp > 0 ) { IF( EQ_16( Q, 15 ) ) @@ -77,7 +78,8 @@ static Word16 ceil_fx( Word16 inp, Word16 Q ) return ret; } -Word16 BASOP_Util_Cmp_Mant32Exp_sat /*!< o: flag: result of comparison */ + +static Word16 BASOP_Util_Cmp_Mant32Exp_sat /*!< o: flag: result of comparison */ /* 0, if a == b */ /* 1, if a > b */ /* -1, if a < b */ @@ -90,7 +92,6 @@ Word16 BASOP_Util_Cmp_Mant32Exp_sat /*!< o: flag: result of comparison */ Word32 diff_m; Word16 diff_e, shift, result; - /* This function compares two input parameters, both represented by a 32-bit mantissa and a 16-bit exponent. If both values are identical, 0 is returned. @@ -171,7 +172,9 @@ Word16 BASOP_Util_Cmp_Mant32Exp_sat /*!< o: flag: result of comparison */ return result; } -Word32 pow32_fx( Word16 inp, Word16 indx ) +static Word32 pow32_fx( + const Word16 inp, + const Word16 indx ) { Word32 temp_1, temp_2; IF( EQ_16( indx, 1 ) ) @@ -626,7 +629,7 @@ void ivas_agc_enc_process_fx( div_e = 0; move16(); } - temp_16 = ceil_fx( temp_16, sub( Q15, div_e ) ); /* Q0 */ + temp_16 = ceil_fx_loc( temp_16, sub( Q15, div_e ) ); /* Q0 */ } pState->gain_state[i].gainExpVal = temp_16; /* Q0 */ move16(); diff --git a/lib_enc/ivas_dirac_enc_fx.c b/lib_enc/ivas_dirac_enc_fx.c index efd6129032cbf9f514d40cfaa97e0a960e82f55d..9886b1cb76c99b094f6b57256954cde6fbcc4700 100644 --- a/lib_enc/ivas_dirac_enc_fx.c +++ b/lib_enc/ivas_dirac_enc_fx.c @@ -435,7 +435,7 @@ ivas_error ivas_dirac_enc_fx( ivas_qmetadata_direction_vector_to_azimuth_elevation_fx( &avg_dir_fx[0], Q30, &hQMetaData->q_direction[0].band_data[0].azimuth_fx[i], &hQMetaData->q_direction[0].band_data[0].elevation_fx[i] ); - Word32 tmp = dotp_fixed( avg_dir_fx, avg_dir_fx, 3 ); // 2*avg_dir_e + Word32 tmp = dotp_fx32( avg_dir_fx, avg_dir_fx, 3 ); // 2*avg_dir_e Word16 tmp_e = shl( avg_dir_e, 1 ); tmp = Sqrt32( tmp, &tmp_e ); Word16 er_tmp_e = 0; @@ -1132,9 +1132,10 @@ void ivas_dirac_param_est_enc_fx( intensity_real_fx, cldfb_q, intensity_real_q ); + IF( !hodirac_flag ) { - computeDirectionVectors_fixed( + computeDirectionVectors_fx2( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], @@ -1458,14 +1459,14 @@ void ivas_dirac_param_est_enc_fx( * * *------------------------------------------------------------------------*/ + static void computeIntensityVector_enc_fx( const DIRAC_ENC_HANDLE hDirAC, Word32 Cldfb_RealBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* q_cldfb */ Word32 Cldfb_ImagBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* q_cldfb */ const Word16 enc_param_start_band, /* i : first band to process Q0*/ const Word16 num_frequency_bands, /* Q0 */ - Word32 intensity_real[DIRAC_NUM_DIMS][DIRAC_MAX_NBANDS] /* q_intensity_real */ - , + Word32 intensity_real[DIRAC_NUM_DIMS][DIRAC_MAX_NBANDS], /* q_intensity_real */ Word16 q_cldfb, Word16 q_intensity_real[DIRAC_MAX_NBANDS] ) { diff --git a/lib_enc/ivas_enc_fx.c b/lib_enc/ivas_enc_fx.c index c4d7b75a7ec81a0cfa02fce7e2f9a5135aedf0cf..095d4c2cf4e1c4ebfc579ce37ee4297db16f2c9b 100644 --- a/lib_enc/ivas_enc_fx.c +++ b/lib_enc/ivas_enc_fx.c @@ -310,7 +310,7 @@ ivas_error ivas_enc_fx( /* Stereo transport is used also with monoMASA, duplicate mono if monoMASA */ IF( EQ_16( sub( st_ivas->hEncoderConfig->nchan_inp, hEncoderConfig->nchan_ism ), 1 ) ) { - v_multc_fixed( data_fx[hEncoderConfig->nchan_ism], L_deposit_h( INV_SQRT2_FX_Q15 ) /* Q31 */, data_fx[hEncoderConfig->nchan_ism], input_frame ); + v_multc_fx( data_fx[hEncoderConfig->nchan_ism], L_deposit_h( INV_SQRT2_FX_Q15 ) /* Q31 */, data_fx[hEncoderConfig->nchan_ism], input_frame ); Copy32( data_fx[hEncoderConfig->nchan_ism], data_fx[hEncoderConfig->nchan_ism + 1], input_frame ); /* st_ivas->q_data_fx */ } diff --git a/lib_enc/ivas_front_vad_fx.c b/lib_enc/ivas_front_vad_fx.c index ce09abdbc0e3806675880b57ba31e6820fdad1c9..99da0175f5811480995bcaa76c6323584143300c 100644 --- a/lib_enc/ivas_front_vad_fx.c +++ b/lib_enc/ivas_front_vad_fx.c @@ -304,7 +304,7 @@ ivas_error front_vad_fx( IF( EQ_16( n_chan, CPE_CHANNELS ) ) { /* get average channel energies, adding up was already done, so only need to scale by number of channels */ - v_multc_fixed( &band_energies_LR_fx[0], ONE_IN_Q30 /* 0.5f in Q31 */, &band_energies_LR_fx[0], 2 * NB_BANDS ); + v_multc_fx( &band_energies_LR_fx[0], ONE_IN_Q30 /* 0.5f in Q31 */, &band_energies_LR_fx[0], 2 * NB_BANDS ); /* Logical OR between L and R decisions */ test(); diff --git a/lib_enc/ivas_init_enc_fx.c b/lib_enc/ivas_init_enc_fx.c index 08cdfd044ecab931e1796de1f02f525b81972618..6b1185b1e40dba82ffc0307eb949293da2c3f9e5 100644 --- a/lib_enc/ivas_init_enc_fx.c +++ b/lib_enc/ivas_init_enc_fx.c @@ -279,6 +279,8 @@ Word16 getNumChanAnalysis_fx( return n; } + + /*-------------------------------------------------------------------* * copy_encoder_config_fx() * @@ -421,6 +423,7 @@ void ivas_initialize_handles_enc_fx( * * Initialize IVAS encoder state structure *-------------------------------------------------------------------*/ + ivas_error ivas_init_encoder_fx( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ) @@ -464,7 +467,7 @@ ivas_error ivas_init_encoder_fx( move16(); /*-----------------------------------------------------------------* - * Allocate floating-point input audio buffers + * Allocate input audio buffers *-----------------------------------------------------------------*/ nchan_inp_buff = hEncoderConfig->nchan_inp; /* Q0 */ @@ -489,7 +492,7 @@ ivas_error ivas_init_encoder_fx( /* note: these are intra-frame heap memories */ IF( ( st_ivas->p_data_fx[n] = (Word32 *) malloc( Mpy_32_16_1( input_Fs, INV_FRAME_PER_SEC_Q15 ) * sizeof( Word32 ) ) ) == NULL ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for floating-point input audio buffer!\n" ) ); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for input audio buffer!\n" ) ); } set32_fx( st_ivas->p_data_fx[n], 0, extract_l( Mpy_32_16_1( input_Fs, INV_FRAME_PER_SEC_Q15 ) ) ); } @@ -773,9 +776,6 @@ ivas_error ivas_init_encoder_fx( } ELSE IF( EQ_32( ivas_format, SBA_ISM_FORMAT ) ) { - st_ivas->ism_mode = ISM_MODE_NONE; - move16(); - st_ivas->ism_mode = ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->hEncoderConfig->nchan_ism ); IF( ( error = ivas_ism_metadata_enc_create_fx( st_ivas, hEncoderConfig->nchan_ism, element_brate_tmp ) ) != IVAS_ERR_OK ) @@ -833,12 +833,8 @@ ivas_error ivas_init_encoder_fx( ELSE { /* allocate and initialize MCT core coder */ - { - int16_t n_all; - - n_all = add( st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_ism ); - st_ivas->nCPE = shr_r( n_all, 1 ); - } + Word16 n_all = add( st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_ism ); + st_ivas->nCPE = shr_r( n_all, 1 ); iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &tmp_br, &tmp32, 0 ); tmp_br = L_shl( tmp_br, CPE_CHANNELS_LOG2 ); @@ -865,7 +861,7 @@ ivas_error ivas_init_encoder_fx( st_ivas->mc_mode = ivas_mc_mode_select_fx( hEncoderConfig->mc_input_setup, ivas_total_brate ); /* Q0 */ move32(); - IF( ( error = ivas_create_lfe_lpf_enc_fx( &st_ivas->hLfeLpf, hEncoderConfig->input_Fs ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_create_lfe_lpf_enc_fx( &st_ivas->hLfeLpf, input_Fs ) ) != IVAS_ERR_OK ) { return error; } @@ -977,6 +973,7 @@ ivas_error ivas_init_encoder_fx( { return error; } + ivas_mcmasa_split_brate_fx( st_ivas->hMcMasa->separateChannelEnabled, ivas_total_brate, st_ivas->nSCE, st_ivas->nCPE, &brate_sce, &brate_cpe ); FOR( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) @@ -1032,6 +1029,8 @@ ivas_error ivas_init_encoder_fx( return error; } + + /*------------------------------------------------------------------------- * destroy_core_enc() * @@ -1190,6 +1189,7 @@ void destroy_core_enc_fx( return; } + void destroy_evs_core_enc_fx( ENC_CORE_HANDLE hCoreCoder /* i/o: core encoder structure */ ) @@ -1347,11 +1347,13 @@ void destroy_evs_core_enc_fx( * * Close IVAS encoder handles *-------------------------------------------------------------------------*/ + void ivas_destroy_enc_fx( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ) { Word16 i, n, nchan_inp; + nchan_inp = st_ivas->hEncoderConfig->nchan_inp; move16(); @@ -1459,7 +1461,7 @@ void ivas_destroy_enc_fx( free( st_ivas->ind_list_metadata ); } - /* floating-point input audio buffers */ + /* input audio buffers */ FOR( n = 0; n < MAX_INPUT_CHANNELS + MAX_NUM_OBJECTS; n++ ) { IF( st_ivas->p_data_fx[n] != NULL ) @@ -1475,6 +1477,7 @@ void ivas_destroy_enc_fx( return; } + /*------------------------------------------------------------------------- * ivas_initialize_MD_bstr_enc_fx() * diff --git a/lib_enc/ivas_ism_enc_fx.c b/lib_enc/ivas_ism_enc_fx.c index 6b75a6be7494dc6490eeb62381b0840438e4a4f5..d3aaa46caa6fa269dbf1f00a99bbf860cc59ae0e 100644 --- a/lib_enc/ivas_ism_enc_fx.c +++ b/lib_enc/ivas_ism_enc_fx.c @@ -520,7 +520,6 @@ ivas_error ivas_ism_enc_fx( dbgwrite( &tmpF, sizeof( float ), 1, input_frame, fname( debug_dir, "element_brate", 0, id, ENC ) ); } #endif - pop_wmops(); return error; diff --git a/lib_enc/ivas_masa_enc_fx.c b/lib_enc/ivas_masa_enc_fx.c index 2905491e3c7d20697ac3c905f1b4ea77ab4f2f0b..7d8a0f8354eaed50eefa768990027c5a38fe4e49 100644 --- a/lib_enc/ivas_masa_enc_fx.c +++ b/lib_enc/ivas_masa_enc_fx.c @@ -2774,7 +2774,7 @@ static Word16 encode_lfe_to_total_energy_ratio_fx( FOR( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { // log2LFEratio[i] = log2f( max( 0.001f, hMasa->data.lfeToTotalEnergyRatio[i] ) ); - maxVal = 2147484 /* 0.001f in Q31 */; + maxVal = INV_1000_Q31; move32(); maxVal_e = 0; move16(); diff --git a/lib_enc/ivas_mcmasa_enc_fx.c b/lib_enc/ivas_mcmasa_enc_fx.c index 5c8822919feef1571338decf22762ada6081021e..280da94568e28c042476055c9fef075341e20982 100644 --- a/lib_enc/ivas_mcmasa_enc_fx.c +++ b/lib_enc/ivas_mcmasa_enc_fx.c @@ -286,7 +286,7 @@ ivas_error ivas_mcmasa_enc_open_fx( bufferSize = (Word16) ( ( input_Fs / FRAMES_PER_SEC ) / MAX_PARAM_SPATIAL_SUBFRAMES ); FOR( i = 0; i < 2; i++ ) { - IF( ( hMcMasa->lfeAnaRingBuffer[i] = (Word32 *) malloc( bufferSize * sizeof( float ) ) ) == NULL ) + IF( ( hMcMasa->lfeAnaRingBuffer[i] = (Word32 *) malloc( bufferSize * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); } @@ -1108,8 +1108,8 @@ void ivas_mcmasa_param_est_enc_fx( } /* Y */ - v_multc_fixed( Chnl_RealBuffer_fx[0], hMcMasa->chnlToFoaMtx_fx[1][0], Foa_RealBuffer_fx[1], num_freq_bins ); // inp_q - v_multc_fixed( Chnl_ImagBuffer_fx[0], hMcMasa->chnlToFoaMtx_fx[1][0], Foa_ImagBuffer_fx[1], num_freq_bins ); // inp_q + v_multc_fx( Chnl_RealBuffer_fx[0], hMcMasa->chnlToFoaMtx_fx[1][0], Foa_RealBuffer_fx[1], num_freq_bins ); // inp_q + v_multc_fx( Chnl_ImagBuffer_fx[0], hMcMasa->chnlToFoaMtx_fx[1][0], Foa_ImagBuffer_fx[1], num_freq_bins ); // inp_q FOR( i = 1; i < numAnalysisChannels; i++ ) { v_multc_acc_32_32( Chnl_RealBuffer_fx[i], hMcMasa->chnlToFoaMtx_fx[1][i], Foa_RealBuffer_fx[1], num_freq_bins ); // inp_q @@ -1125,8 +1125,8 @@ void ivas_mcmasa_param_est_enc_fx( } ELSE { - v_multc_fixed( Chnl_RealBuffer_fx[0], hMcMasa->chnlToFoaMtx_fx[2][0], Foa_RealBuffer_fx[2], num_freq_bins ); // inp_q - v_multc_fixed( Chnl_ImagBuffer_fx[0], hMcMasa->chnlToFoaMtx_fx[2][0], Foa_ImagBuffer_fx[2], num_freq_bins ); // inp_q + v_multc_fx( Chnl_RealBuffer_fx[0], hMcMasa->chnlToFoaMtx_fx[2][0], Foa_RealBuffer_fx[2], num_freq_bins ); // inp_q + v_multc_fx( Chnl_ImagBuffer_fx[0], hMcMasa->chnlToFoaMtx_fx[2][0], Foa_ImagBuffer_fx[2], num_freq_bins ); // inp_q FOR( i = 1; i < numAnalysisChannels; i++ ) { v_multc_acc_32_32( Chnl_RealBuffer_fx[i], hMcMasa->chnlToFoaMtx_fx[2][i], Foa_RealBuffer_fx[2], num_freq_bins ); // inp_q @@ -1135,8 +1135,8 @@ void ivas_mcmasa_param_est_enc_fx( } /* X */ - v_multc_fixed( Chnl_RealBuffer_fx[0], hMcMasa->chnlToFoaMtx_fx[3][0], Foa_RealBuffer_fx[3], num_freq_bins ); // inp_q - v_multc_fixed( Chnl_ImagBuffer_fx[0], hMcMasa->chnlToFoaMtx_fx[3][0], Foa_ImagBuffer_fx[3], num_freq_bins ); // inp_q + v_multc_fx( Chnl_RealBuffer_fx[0], hMcMasa->chnlToFoaMtx_fx[3][0], Foa_RealBuffer_fx[3], num_freq_bins ); // inp_q + v_multc_fx( Chnl_ImagBuffer_fx[0], hMcMasa->chnlToFoaMtx_fx[3][0], Foa_ImagBuffer_fx[3], num_freq_bins ); // inp_q FOR( i = 1; i < numAnalysisChannels; i++ ) { v_multc_acc_32_32( Chnl_RealBuffer_fx[i], hMcMasa->chnlToFoaMtx_fx[3][i], Foa_RealBuffer_fx[3], num_freq_bins ); // inp_q @@ -1149,8 +1149,8 @@ void ivas_mcmasa_param_est_enc_fx( Copy32( Foa_ImagBuffer_fx[0], FoaEven_ImagBuffer_fx[0], num_freq_bins ); // inp_q /* Y */ - v_multc_fixed( Chnl_RealBuffer_fx[0], hMcMasa->chnlToFoaEvenMtx_fx[1][0], FoaEven_RealBuffer_fx[1], num_freq_bins ); // inp_q - v_multc_fixed( Chnl_ImagBuffer_fx[0], hMcMasa->chnlToFoaEvenMtx_fx[1][0], FoaEven_ImagBuffer_fx[1], num_freq_bins ); // inp_q + v_multc_fx( Chnl_RealBuffer_fx[0], hMcMasa->chnlToFoaEvenMtx_fx[1][0], FoaEven_RealBuffer_fx[1], num_freq_bins ); // inp_q + v_multc_fx( Chnl_ImagBuffer_fx[0], hMcMasa->chnlToFoaEvenMtx_fx[1][0], FoaEven_ImagBuffer_fx[1], num_freq_bins ); // inp_q FOR( i = 1; i < numAnalysisChannels; i++ ) { v_multc_acc_32_32( Chnl_RealBuffer_fx[i], hMcMasa->chnlToFoaEvenMtx_fx[1][i], FoaEven_RealBuffer_fx[1], num_freq_bins ); // inp_q @@ -1162,8 +1162,8 @@ void ivas_mcmasa_param_est_enc_fx( set_zero_fx( FoaEven_ImagBuffer_fx[2], num_freq_bins ); // inp_q /* X */ - v_multc_fixed( Chnl_RealBuffer_fx[0], hMcMasa->chnlToFoaEvenMtx_fx[3][0], FoaEven_RealBuffer_fx[3], num_freq_bins ); // inp_q - v_multc_fixed( Chnl_ImagBuffer_fx[0], hMcMasa->chnlToFoaEvenMtx_fx[3][0], FoaEven_ImagBuffer_fx[3], num_freq_bins ); // inp_q + v_multc_fx( Chnl_RealBuffer_fx[0], hMcMasa->chnlToFoaEvenMtx_fx[3][0], FoaEven_RealBuffer_fx[3], num_freq_bins ); // inp_q + v_multc_fx( Chnl_ImagBuffer_fx[0], hMcMasa->chnlToFoaEvenMtx_fx[3][0], FoaEven_ImagBuffer_fx[3], num_freq_bins ); // inp_q FOR( i = 1; i < numAnalysisChannels; i++ ) { v_multc_acc_32_32( Chnl_RealBuffer_fx[i], hMcMasa->chnlToFoaEvenMtx_fx[3][i], FoaEven_RealBuffer_fx[3], num_freq_bins ); // inp_q @@ -1181,7 +1181,7 @@ void ivas_mcmasa_param_est_enc_fx( q_intensity_real_fx, inp_q ); - computeDirectionVectors_fixed( + computeDirectionVectors_fx2( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], diff --git a/lib_enc/ivas_mct_enc_mct_fx.c b/lib_enc/ivas_mct_enc_mct_fx.c index 0918c51d24cde78794b32dba5e23234010be407b..d402d834f9fa1b5dcbd409f5902e09c25ee907da 100644 --- a/lib_enc/ivas_mct_enc_mct_fx.c +++ b/lib_enc/ivas_mct_enc_mct_fx.c @@ -153,7 +153,7 @@ static void getNextBestCorrelation_fx( tmp_idx = sub( shr( imult1616( nChannels, sub( nChannels, 1 ) ), 1 ), 1 ); /* sort values */ - v_sort_ind_fixed( tmp_corrVals, tmp_org, add( tmp_idx, 1 ) ); + v_sort_ind_fx( tmp_corrVals, tmp_org, add( tmp_idx, 1 ) ); /* get max, or 2nd max and so on depending on sortInd value */ *max_corr = tmp_corrVals[( tmp_idx - sortInd )]; // Qx @@ -236,7 +236,7 @@ static void getCorrelationMatrix_fx( FOR( n = 0; n < nSubframes; n++ ) { res_q = sub( 31, sts[0]->hTcxEnc->spectrum_e[0] ); - L_tmp = dotp_fixed_32( sts[ch1]->hTcxEnc->spectrum_fx[n], sts[ch2]->hTcxEnc->spectrum_fx[n], L_subframe, 1, &res_q ); + L_tmp = dotp_fx32_fac( sts[ch1]->hTcxEnc->spectrum_fx[n], sts[ch2]->hTcxEnc->spectrum_fx[n], L_subframe, 1, &res_q ); xCorrMatrix[ch1][ch2] = BASOP_Util_Add_Mant32Exp( xCorrMatrix[ch1][ch2], xCorrMatrix_exp[ch1][ch2], L_tmp, sub( 31, res_q ), &xCorrMatrix_exp[ch1][ch2] ); move32(); } @@ -607,8 +607,8 @@ static void getGlobalILD_fx( FOR( k = 0; k < nSubframes; k++ ) { - v_multc_fixed( sts[ch]->hTcxEnc->spectrum_fx[k], L_deposit_h( qratio ), sts[ch]->hTcxEnc->spectrum_fx[k], L_subframe ); // sts[ch]->hTcxEnc->spectrum_e - v_multc_fixed( mdst_spectrum[ch][k], L_deposit_h( qratio ), mdst_spectrum[ch][k], L_subframe ); // sts[ch]->hTcxEnc->spectrum_e + v_multc_fx( sts[ch]->hTcxEnc->spectrum_fx[k], L_deposit_h( qratio ), sts[ch]->hTcxEnc->spectrum_fx[k], L_subframe ); // sts[ch]->hTcxEnc->spectrum_e + v_multc_fx( mdst_spectrum[ch][k], L_deposit_h( qratio ), mdst_spectrum[ch][k], L_subframe ); // sts[ch]->hTcxEnc->spectrum_e } } } @@ -874,8 +874,8 @@ void apply_MCT_enc_fx( FOR( k = 0; k < nSubframes; k++ ) { - v_multc_fixed( sts[ch]->hTcxEnc->spectrum_fx[k], L_deposit_h( qratio ), sts[ch]->hTcxEnc->spectrum_fx[k], L_subframeTCX ); - v_multc_fixed( mdst_spectrum[ch][k], L_deposit_h( qratio ), mdst_spectrum[ch][k], L_subframeTCX ); + v_multc_fx( sts[ch]->hTcxEnc->spectrum_fx[k], L_deposit_h( qratio ), sts[ch]->hTcxEnc->spectrum_fx[k], L_subframeTCX ); + v_multc_fx( mdst_spectrum[ch][k], L_deposit_h( qratio ), mdst_spectrum[ch][k], L_subframeTCX ); set32_fx( inv_spectrum[ch][k], 0, L_subframeTCX ); } sts[ch]->hTcxEnc->spectrum_e[1] = add( sts[ch]->hTcxEnc->spectrum_e[0], exp ); diff --git a/lib_enc/ivas_mdct_core_enc_fx.c b/lib_enc/ivas_mdct_core_enc_fx.c index 86ea8ebe919149397275a57349d1472ac931e4ca..b4eba62010700dd4e91a3944c7a4f0b6b936d6f9 100644 --- a/lib_enc/ivas_mdct_core_enc_fx.c +++ b/lib_enc/ivas_mdct_core_enc_fx.c @@ -362,8 +362,8 @@ static void kernel_switch_trafo_fx( tmp = BASOP_Util_Divide1616_Scale( NORM_MDCT_FACTOR, add( shr( l, 1 ), add( m, shr( r, 1 ) ) ), &exp_tmp ); tmp = Sqrt16( tmp, &exp_tmp ); - factor = L_shl( L_deposit_h( tmp ), sub( exp_tmp, 1 ) ); // Q30 - v_multc_fixed( y, factor, y, add( shr( l, 1 ), add( m, shr( r, 1 ) ) ) ); // (Q_in, Q30) -> Q_in - 1 + factor = L_shl( L_deposit_h( tmp ), sub( exp_tmp, 1 ) ); // Q30 + v_multc_fx( y, factor, y, add( shr( l, 1 ), add( m, shr( r, 1 ) ) ) ); // (Q_in, Q30) -> Q_in - 1 return; } @@ -440,7 +440,7 @@ static void kernel_switch_update_transforms_fx( tmp = BASOP_Util_Divide1616_Scale( NORM_MDCT_FACTOR, s, &exp_tmp ); tmp = Sqrt16( tmp, &exp_tmp ); factor = L_shl( L_deposit_h( tmp ), sub( exp_tmp, Q1 ) ); // Q30 - v_multc_fixed( sigR, factor, sigR, s ); // (Q6, Q30) -> Q5 + v_multc_fx( sigR, factor, sigR, s ); // (Q6, Q30) -> Q5 q_com = L_norm_arr( sigR, s ); q_com = s_min( add( q_com, Q5 ), *q_sig ); @@ -591,8 +591,8 @@ static void kernel_switch_update_transforms_fx( Word16 tmp, exp_tmp; Word32 factor; tmp = BASOP_Util_Divide1616_Scale( bwidthSwCnt, BWS_TRAN_PERIOD, &exp_tmp ); - factor = L_shl( L_deposit_h( tmp ), exp_tmp ); // Q31 - v_multc_fixed( sigR + L_FRAME16k / nSubframes, factor, sigR + L_FRAME16k / nSubframes, sub( s, idiv1616( L_FRAME16k, nSubframes ) ) ); // *q_sig + factor = L_shl( L_deposit_h( tmp ), exp_tmp ); // Q31 + v_multc_fx( sigR + L_FRAME16k / nSubframes, factor, sigR + L_FRAME16k / nSubframes, sub( s, idiv1616( L_FRAME16k, nSubframes ) ) ); // *q_sig } return; diff --git a/lib_enc/ivas_omasa_enc_fx.c b/lib_enc/ivas_omasa_enc_fx.c index 912d615d74760bcc74e213721beddac21d55c342..166bd67318dff995663cc884565ce74a3dc2bf0f 100644 --- a/lib_enc/ivas_omasa_enc_fx.c +++ b/lib_enc/ivas_omasa_enc_fx.c @@ -961,7 +961,6 @@ void ivas_set_surplus_brate_enc( dbgwrite( &tmpF, 4, 1, input_frame, "res/brate_MASA_MD" ); /* == MASA MD bitrate */ } #endif - return; } @@ -1222,8 +1221,8 @@ static void ivas_omasa_param_est_enc_fx( } /* Y */ - v_multc_fixed( Chnl_RealBuffer_fx[0], hOMasa->chnlToFoaMtx_fx[1][0], Foa_RealBuffer_fx[1], num_freq_bins ); /*q*/ - v_multc_fixed( Chnl_ImagBuffer_fx[0], hOMasa->chnlToFoaMtx_fx[1][0], Foa_ImagBuffer_fx[1], num_freq_bins ); /*q*/ + v_multc_fx( Chnl_RealBuffer_fx[0], hOMasa->chnlToFoaMtx_fx[1][0], Foa_RealBuffer_fx[1], num_freq_bins ); /*q*/ + v_multc_fx( Chnl_ImagBuffer_fx[0], hOMasa->chnlToFoaMtx_fx[1][0], Foa_ImagBuffer_fx[1], num_freq_bins ); /*q*/ FOR( i = 1; i < nchan_ism; i++ ) { v_multc_acc_32_32( Chnl_RealBuffer_fx[i], hOMasa->chnlToFoaMtx_fx[1][i], Foa_RealBuffer_fx[1], num_freq_bins ); /*q*/ @@ -1231,30 +1230,29 @@ static void ivas_omasa_param_est_enc_fx( } /* Z */ - v_multc_fixed( Chnl_RealBuffer_fx[0], hOMasa->chnlToFoaMtx_fx[2][0], Foa_RealBuffer_fx[2], num_freq_bins ); /*q*/ - v_multc_fixed( Chnl_ImagBuffer_fx[0], hOMasa->chnlToFoaMtx_fx[2][0], Foa_ImagBuffer_fx[2], num_freq_bins ); /*q*/ + v_multc_fx( Chnl_RealBuffer_fx[0], hOMasa->chnlToFoaMtx_fx[2][0], Foa_RealBuffer_fx[2], num_freq_bins ); /*q*/ + v_multc_fx( Chnl_ImagBuffer_fx[0], hOMasa->chnlToFoaMtx_fx[2][0], Foa_ImagBuffer_fx[2], num_freq_bins ); /*q*/ FOR( i = 1; i < nchan_ism; i++ ) { v_multc_acc_32_32( Chnl_RealBuffer_fx[i], hOMasa->chnlToFoaMtx_fx[2][i], Foa_RealBuffer_fx[2], num_freq_bins ); /*q*/ v_multc_acc_32_32( Chnl_ImagBuffer_fx[i], hOMasa->chnlToFoaMtx_fx[2][i], Foa_ImagBuffer_fx[2], num_freq_bins ); /*q*/ } - /* X */ - v_multc_fixed( Chnl_RealBuffer_fx[0], hOMasa->chnlToFoaMtx_fx[3][0], Foa_RealBuffer_fx[3], num_freq_bins ); /*q*/ - v_multc_fixed( Chnl_ImagBuffer_fx[0], hOMasa->chnlToFoaMtx_fx[3][0], Foa_ImagBuffer_fx[3], num_freq_bins ); /*q*/ + v_multc_fx( Chnl_RealBuffer_fx[0], hOMasa->chnlToFoaMtx_fx[3][0], Foa_RealBuffer_fx[3], num_freq_bins ); /*q*/ + v_multc_fx( Chnl_ImagBuffer_fx[0], hOMasa->chnlToFoaMtx_fx[3][0], Foa_ImagBuffer_fx[3], num_freq_bins ); /*q*/ FOR( i = 1; i < nchan_ism; i++ ) { v_multc_acc_32_32( Chnl_RealBuffer_fx[i], hOMasa->chnlToFoaMtx_fx[3][i], Foa_RealBuffer_fx[3], num_freq_bins ); /*q*/ v_multc_acc_32_32( Chnl_ImagBuffer_fx[i], hOMasa->chnlToFoaMtx_fx[3][i], Foa_ImagBuffer_fx[3], num_freq_bins ); /*q*/ } + /* Direction estimation */ computeIntensityVector_enc_fx( hOMasa->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, num_freq_bands, intensity_real_fx, q_intensity_real_fx, q ); - computeDirectionVectors_fixed( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], 0, q_intensity_real_fx ); + computeDirectionVectors_fx2( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], 0, q_intensity_real_fx ); /* Power estimation for diffuseness */ - computeReferencePower_omasa_ivas_fx( hOMasa->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, reference_power_fx[ts], 0, num_freq_bands, q, q_reference_power_fx ); minimum_fx( q_intensity_real_fx, num_freq_bands, &intensity_real_e ); @@ -1293,7 +1291,7 @@ static void ivas_omasa_param_est_enc_fx( Copy32( reference_power_fx[ts], &( hOMasa->buffer_energy_fx[( index - 1 ) * num_freq_bands] ), num_freq_bands ); hOMasa->buffer_energy_q[( index - 1 )] = sub( 31, ref_exp ); move16(); - computeDiffuseness_fixed( hOMasa->buffer_intensity_real_fx, hOMasa->buffer_energy_fx, num_freq_bands, diffuseness_vector_fx, hOMasa->buffer_intensity_real_q, hOMasa->buffer_energy_q, &q_diffuseness_vector ); + computeDiffuseness_fx( hOMasa->buffer_intensity_real_fx, hOMasa->buffer_energy_fx, num_freq_bands, diffuseness_vector_fx, hOMasa->buffer_intensity_real_q, hOMasa->buffer_energy_q, &q_diffuseness_vector ); FOR( band_m_idx = 0; band_m_idx < hOMasa->nbands; band_m_idx++ ) { diff --git a/lib_enc/ivas_osba_enc_fx.c b/lib_enc/ivas_osba_enc_fx.c index 424e56e4d26131d02790cb5aaa22c67f863e9507..3629b856285ae840e4540f4f21685b290e1d624c 100644 --- a/lib_enc/ivas_osba_enc_fx.c +++ b/lib_enc/ivas_osba_enc_fx.c @@ -354,21 +354,19 @@ ivas_error ivas_osba_enc_reconfig( /*-----------------------------------------------------------------* * Allocate, initialize, and configure SCE/CPE/MCT handles *-----------------------------------------------------------------*/ + nchan_transport = st_ivas->nchan_transport; test(); test(); IF( old_ism_mode == ISM_MODE_NONE && EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) { - { - nchan_transport = add( st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_ism ); - st_ivas->nCPE = shr_r( nchan_transport, 1 ); - } + nchan_transport = add( st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_ism ); + st_ivas->nCPE = shr_r( nchan_transport, 1 ); } ELSE IF( EQ_32( old_ism_mode, ISM_SBA_MODE_DISC ) && st_ivas->ism_mode == ISM_MODE_NONE ) { nchan_transport_old = add( nchan_transport_old, st_ivas->hEncoderConfig->nchan_ism ); - nchan_transport = st_ivas->nchan_transport; } ELSE IF( EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) @@ -377,6 +375,7 @@ ivas_error ivas_osba_enc_reconfig( nchan_transport = add( st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_ism ); st_ivas->nCPE = shr_r( nchan_transport, 1 ); } + Word16 tmp_e; Word32 bitrate_per_chan = L_deposit_h( BASOP_Util_Divide3216_Scale( ivas_total_brate, st_ivas->nchan_transport, &tmp_e ) ); bitrate_per_chan = L_shr( bitrate_per_chan, sub( 15, tmp_e ) ); diff --git a/lib_enc/ivas_pca_enc_fx.c b/lib_enc/ivas_pca_enc_fx.c index 2cb347a026794ad3e32d70cad242c81d02731e86..7eb4f18e71e4fc428d47427a68b9349633fd6667 100644 --- a/lib_enc/ivas_pca_enc_fx.c +++ b/lib_enc/ivas_pca_enc_fx.c @@ -415,9 +415,9 @@ void ivas_pca_enc_fx( { temp_fx32 = r_sm_fx[k * FOA_CHANNELS + k]; // min_q move32(); - IF( LT_32( temp_fx32, L_shr( 64424, sub( 31, hPCA->old_r_sm_q ) ) ) ) // IVAS_PCA_COV_THRES in Q31 + IF( LT_32( temp_fx32, L_shr( 64424, sub( 31, hPCA->old_r_sm_q ) ) ) ) // IVAS_PCA_COV_THRES=3e-5f in Q31 { - temp_fx32 = L_shr( 64424, sub( 31, hPCA->old_r_sm_q ) ); // IVAS_PCA_COV_THRES in Q31 /*hPCA->old_r_sm_q */ + temp_fx32 = L_shr( 64424, sub( 31, hPCA->old_r_sm_q ) ); // IVAS_PCA_COV_THRES=3e-5f in Q31 /*hPCA->old_r_sm_q */ } r_sm_fx[k * FOA_CHANNELS + k] = temp_fx32; /* pointer reuse */ // hPCA->old_r_sm_q move32(); diff --git a/lib_enc/ivas_qmetadata_enc_fx.c b/lib_enc/ivas_qmetadata_enc_fx.c index f69127ff4ca8fb6dd175b0c337b95b509c7138a9..3f18527746af83315451c5160e22d3e48c496f38 100644 --- a/lib_enc/ivas_qmetadata_enc_fx.c +++ b/lib_enc/ivas_qmetadata_enc_fx.c @@ -840,9 +840,8 @@ void ivas_qmetadata_enc_sid_encode_fx( IF( EQ_16( ivas_format, SBA_FORMAT ) ) { - sba_spar_bitlen = ivas_sba_spar_sid_bitlen_fx( nchan_transport ); - metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS - SBA_ORDER_BITS - SBA_PLANAR_BITS - 1; /* -1 for inactive mode header bit*/ + metadata_sid_bits = (Word16) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS - SBA_ORDER_BITS - SBA_PLANAR_BITS - 1; /* -1 for inactive mode header bit*/ metadata_sid_bits = sub( metadata_sid_bits, sba_spar_bitlen ); } ELSE @@ -851,7 +850,6 @@ void ivas_qmetadata_enc_sid_encode_fx( move16(); } - /* Save initial position in bitstream */ bit_pos_start = hMetaData->nb_bits_tot; move16(); @@ -1031,8 +1029,8 @@ void ivas_qmetadata_enc_sid_encode_fx( { /*compute the average direction */ ivas_qmetadata_azimuth_elevation_to_direction_vector_fx( q_direction->band_data[b].azimuth_fx[m], q_direction->band_data[b].elevation_fx[m], direction_vector_fx ); - scale_sig32( direction_vector_fx, 3, Q22 - Q30 ); // Q30 -> Q22 - v_add_fixed_no_hdrm( avg_direction_vector_fx, direction_vector_fx, avg_direction_vector_fx, 3 ); // Q22 + scale_sig32( direction_vector_fx, 3, Q22 - Q30 ); // Q30 -> Q22 + v_add_fx_no_hdrm( avg_direction_vector_fx, direction_vector_fx, avg_direction_vector_fx, 3 ); // Q22 } ivas_qmetadata_direction_vector_to_azimuth_elevation_fx( avg_direction_vector_fx, Q22, &avg_azimuth_fx[b], &avg_elevation_fx[b] ); @@ -2375,7 +2373,7 @@ static Word16 ivas_qmetadata_entropy_encode_dir_fx( /*compute the average direction */ ivas_qmetadata_azimuth_elevation_to_direction_vector_fx( q_direction->band_data[i].azimuth_fx[j], q_direction->band_data[i].elevation_fx[j], direction_vector ); scale_sig32( direction_vector, 3, -8 ); // Q30 -> Q22 - v_add_fixed_no_hdrm( avg_direction_vector, direction_vector, avg_direction_vector, 3 ); + v_add_fx_no_hdrm( avg_direction_vector, direction_vector, avg_direction_vector, 3 ); } } } @@ -2638,7 +2636,7 @@ static Word16 ivas_qmetadata_entropy_encode_dir_fx( IF( LT_16( idx, 4 ) ) { - v_add_fixed_no_hdrm( avg_direction_vector, direction_vector, avg_direction_vector, 3 ); + v_add_fx_no_hdrm( avg_direction_vector, direction_vector, avg_direction_vector, 3 ); } } /* project the quantized average azimuth angle to the same grid as the current sample */ @@ -2669,7 +2667,7 @@ static Word16 ivas_qmetadata_entropy_encode_dir_fx( ivas_qmetadata_azimuth_elevation_to_direction_vector_fx( q_direction->band_data[i].azimuth_fx[j], q_direction->band_data[i].elevation_fx[j], direction_vector ); scale_sig32( direction_vector, 3, -8 ); // Q30 -> Q22 - v_add_fixed_no_hdrm( avg_direction_vector, direction_vector, avg_direction_vector, 3 ); + v_add_fx_no_hdrm( avg_direction_vector, direction_vector, avg_direction_vector, 3 ); ivas_qmetadata_direction_vector_to_azimuth_elevation_fx( avg_direction_vector, Q22, &avg_azimuth, &avg_elevation ); avg_azimuth_index_upd = quantize_phi_enc_fx( L_add( avg_azimuth, 180 << Q22 ), 0, &avg_azimuth, avg_azimuth_alphabet ); diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index 252637e73999bfd53a81b60a4640118f3db6cac1..0e3c0bd405c51fedc3cdc397b35271b23f445391 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -672,7 +672,7 @@ Word16 quantize_sns_fx( Word32 ener_side_fx; Word16 ener_side_q; - v_sub_fixed_no_hdrm( snsQ_out_fx[0][k], snsQ_out_fx[1][k], side_fx, M ); + v_sub_fx_no_hdrm( snsQ_out_fx[0][k], snsQ_out_fx[1][k], side_fx, M ); Word64 L64_sum; L64_sum = 1; diff --git a/lib_enc/ivas_spar_encoder_fx.c b/lib_enc/ivas_spar_encoder_fx.c index 481b969b70cc3e830d3fe8346613775ad9e90243..0b1f77245a19521319ec8798eb0f65bde6e2162b 100644 --- a/lib_enc/ivas_spar_encoder_fx.c +++ b/lib_enc/ivas_spar_encoder_fx.c @@ -730,9 +730,11 @@ static ivas_error ivas_spar_enc_process_fx( { Copy32( data_fx[HOA_keep_ind[i]], data_fx[i], input_frame ); } + /*-----------------------------------------------------------------------------------------* * Transient detector *-----------------------------------------------------------------------------------------*/ + ivas_transient_det_process_fx( hSpar->hTranDet, data_fx[0], input_frame, transient_det ); #ifdef DEBUGGING @@ -743,7 +745,6 @@ static ivas_error ivas_spar_enc_process_fx( dbgwrite_txt( a, 2, "fixed.txt", NULL ); } #endif - if ( LT_32( ivas_total_brate, IVAS_24k4 ) ) { transient_det[1] = 0; @@ -890,12 +891,14 @@ static ivas_error ivas_spar_enc_process_fx( /*-----------------------------------------------------------------------------------------* * Covariance and MD processing *-----------------------------------------------------------------------------------------*/ + IF( NE_32( ( error = ivas_spar_cov_md_process_fx( hEncoderConfig, st_ivas->hSpar, st_ivas->hQMetaData, hMetaData, nchan_inp, sba_order, ppIn_FR_real_fx, ppIn_FR_imag_fx, transient_det, dtx_vad, nchan_transport, &dyn_active_w_flag, pp_fr_q ) ), IVAS_ERR_OK ) ) { return error; } set16_fx( q_p_pcm_tmp_fx, pp_fr_q, nchan_fb_in ); + /*-----------------------------------------------------------------------------------------* * FB mixer *-----------------------------------------------------------------------------------------*/ @@ -972,6 +975,7 @@ static ivas_error ivas_spar_enc_process_fx( v_add_fx( data_fx[idx], p_pcm_tmp_fx[i] + num_del_samples, p_pcm_tmp_fx[i] + num_del_samples, sub( input_frame, num_del_samples ) ); } } + /*-----------------------------------------------------------------------------------------* * PCA encoder *-----------------------------------------------------------------------------------------*/ @@ -990,7 +994,6 @@ static ivas_error ivas_spar_enc_process_fx( } } - /*-----------------------------------------------------------------------------------------* * AGC *-----------------------------------------------------------------------------------------*/ diff --git a/lib_enc/ivas_stereo_dft_enc_fx.c b/lib_enc/ivas_stereo_dft_enc_fx.c index 1eb89a74af4cab0fbcf3994b059aa5dca5c23958..e5522fb377bf0ab53db392a8fae7c58230c46efa 100644 --- a/lib_enc/ivas_stereo_dft_enc_fx.c +++ b/lib_enc/ivas_stereo_dft_enc_fx.c @@ -51,7 +51,7 @@ #define STEREO_DFT_NRG_PAST_MAX_BAND 9 #define STEREO_DFT_NRG_PAST_MAX_BAND_LB 4 -#define STEREO_DFT_DMX_CROSSOVER ( int16_t )( 132 * ( (float) ( STEREO_DFT_N_NS_ENC ) / STEREO_DFT_N_NS ) + 0.5f ) /* crossover bin between binwise and bandwise DMX */ +#define STEREO_DFT_DMX_CROSSOVER ( Word16 )( 132 * ( (float) ( STEREO_DFT_N_NS_ENC ) / STEREO_DFT_N_NS ) + 0.5f ) /* crossover bin between binwise and bandwise DMX */ #define ITD_VAD_E_BAND_N_INIT 200000 #define ITD_SID_PREV_FRAMES 5 diff --git a/lib_enc/ivas_stereo_dft_enc_itd_fx.c b/lib_enc/ivas_stereo_dft_enc_itd_fx.c index aee6e3a6b3d2365b45c45fd7b2b8994097cebacd..eb23e9d01862638d7789f34c293a2818b55ecdb9 100644 --- a/lib_enc/ivas_stereo_dft_enc_itd_fx.c +++ b/lib_enc/ivas_stereo_dft_enc_itd_fx.c @@ -77,7 +77,7 @@ #define ITD_VAD_NOISE_INIT_FRAMES 30 #define ITD_VAD_THRSHOLD 0.001f -#define ITD_VAD_THRSHOLD_Q31 2147484 +#define ITD_VAD_THRSHOLD_Q31 INV_1000_Q31 #define ITD_VAD_MS_SNR_UPDATE_THRESH 15.0f #define ITD_VAD_MS_SNR_UPDATE_THRESH_FX 15 #define HIGHT_SNR_VOICE_TH 10000.0f diff --git a/lib_enc/ivas_stereo_ica_enc_fx.c b/lib_enc/ivas_stereo_ica_enc_fx.c index e5c7af987416ee004fd5405e36a175643b479827..924de4d6595451430d5ab5a91f8c5a96fbd444fa 100644 --- a/lib_enc/ivas_stereo_ica_enc_fx.c +++ b/lib_enc/ivas_stereo_ica_enc_fx.c @@ -609,13 +609,13 @@ static void utilCrossCorr_fx( { IF( EQ_16( winSymmFlag, 0 ) ) { - v_mult_fixed( buf1, win, tempBuf1, len ); - v_mult_fixed( buf2, win, tempBuf2, len ); + v_mult_fx( buf1, win, tempBuf1, len ); + v_mult_fx( buf2, win, tempBuf2, len ); } ELSE { - v_mult_fixed( buf1, win, tempBuf1, ( len >> 1 ) ); - v_mult_fixed( buf2, win, tempBuf2, ( len >> 1 ) ); + v_mult_fx( buf1, win, tempBuf1, ( len >> 1 ) ); + v_mult_fx( buf2, win, tempBuf2, ( len >> 1 ) ); FOR( i = shr( len, 1 ); i < len; i++ ) { @@ -704,7 +704,7 @@ static void utilCrossCorr_fx( *corrEst_e = max_e; move16(); - v_multc_fixed( corrEst, scale, corrEst, j ); + v_multc_fx( corrEst, scale, corrEst, j ); *corrEst_e = add( *corrEst_e, temp2_e ); move16(); @@ -885,9 +885,9 @@ static void corrStatsEst_fx( move32(); /* long term corr Stats estimation */ - v_multc_fixed_16( hStereoTCA->corrEstLT_fx, alpha_fx, hStereoTCA->corrEstLT_fx, 2 * L_NCSHIFT_DS + 1 ); /* Q31-hStereoTCA->corrEstLT_exp */ - v_multc_fixed_16( corrEst_fx, sub( MAX_16, alpha_fx ), corrEst_fx, 2 * L_NCSHIFT_DS + 1 ); /* Q31-corrEst_exp */ - v_add_fixed_me( hStereoTCA->corrEstLT_fx, hStereoTCA->corrEstLT_exp, corrEst_fx, corrEst_exp, hStereoTCA->corrEstLT_fx, &hStereoTCA->corrEstLT_exp, 2 * L_NCSHIFT_DS + 1, 0 ); + v_multc_fx_16( hStereoTCA->corrEstLT_fx, alpha_fx, hStereoTCA->corrEstLT_fx, 2 * L_NCSHIFT_DS + 1 ); /* Q31-hStereoTCA->corrEstLT_exp */ + v_multc_fx_16( corrEst_fx, sub( MAX_16, alpha_fx ), corrEst_fx, 2 * L_NCSHIFT_DS + 1 ); /* Q31-corrEst_exp */ + v_add_fx_me( hStereoTCA->corrEstLT_fx, hStereoTCA->corrEstLT_exp, corrEst_fx, corrEst_exp, hStereoTCA->corrEstLT_fx, &hStereoTCA->corrEstLT_exp, 2 * L_NCSHIFT_DS + 1, 0 ); hStereoTCA->ica_envVarLT_fx = BASOP_Util_Add_Mant32Exp( Mpy_32_16_1( hStereoTCA->ica_envVarLT_fx, SMOOTH_ENV_FACTOR_FX_Q15 ), hStereoTCA->ica_envVarLT_exp, Mpy_32_16_1( tempF_fx, ONE_IN_Q15 - SMOOTH_ENV_FACTOR_FX_Q15 ), tempF_exp, &hStereoTCA->ica_envVarLT_exp ); // SMOOTH_ENV_FACTOR_FX_Q15 (Q31-hStereoTCA->ica_envVarLT_exp) move32(); @@ -1037,15 +1037,15 @@ static void corrStatsEst_fx( IF( LT_32( hStereoTCA->prevTargetGain_fx, 429496730 /*0.8f in Q29*/ ) && vad_flag1 ) { /* ch 2 is prev reference channel */ - v_multc_fixed( corrEst_fx, 644245095 /*1.2f in Q29*/, corrEst_fx, L_NCSHIFT_DS + 1 ); /* Q31-corrEst_exp */ - v_multc_fixed( corrEst_fx + L_NCSHIFT_DS + 1, 447213470 /* 0.833 in Q29*/, corrEst_fx + L_NCSHIFT_DS + 1, L_NCSHIFT_DS ); /* Q31-corrEst_exp */ + v_multc_fx( corrEst_fx, 644245095 /*1.2f in Q29*/, corrEst_fx, L_NCSHIFT_DS + 1 ); /* Q31-corrEst_exp */ + v_multc_fx( corrEst_fx + L_NCSHIFT_DS + 1, 447213470 /* 0.833 in Q29*/, corrEst_fx + L_NCSHIFT_DS + 1, L_NCSHIFT_DS ); /* Q31-corrEst_exp */ corrEst_exp = add( corrEst_exp, 2 ); } ELSE IF( GT_32( hStereoTCA->prevTargetGain_fx, 644245094 /*1.2f in Q29*/ ) && vad_flag1 ) { /* ch 1 is prev reference channel */ - v_multc_fixed( corrEst_fx, 447213470 /* 0.833 f in Q29*/, corrEst_fx, L_NCSHIFT_DS ); /* Q31-corrEst_exp */ - v_multc_fixed( corrEst_fx + L_NCSHIFT_DS, 644245095 /*1.2f in Q29*/, corrEst_fx + L_NCSHIFT_DS, L_NCSHIFT_DS + 1 ); /* Q31-corrEst_exp */ + v_multc_fx( corrEst_fx, 447213470 /* 0.833 f in Q29*/, corrEst_fx, L_NCSHIFT_DS ); /* Q31-corrEst_exp */ + v_multc_fx( corrEst_fx + L_NCSHIFT_DS, 644245095 /*1.2f in Q29*/, corrEst_fx + L_NCSHIFT_DS, L_NCSHIFT_DS + 1 ); /* Q31-corrEst_exp */ corrEst_exp = add( corrEst_exp, 2 ); } test(); @@ -1055,9 +1055,9 @@ static void corrStatsEst_fx( j = s_min( 2 * L_NCSHIFT_DS, add( hStereoTCA->prevCorrLagStats[0], 1 + L_NCSHIFT_DS ) ); k = add( sub( j, i ), 1 ); - v_multc_fixed( corrEst_fx, ONE_IN_Q29 /*1.0f in Q29*/, corrEst_fx, i ); // to allign in same exp (Q31-corrEst_exp) - v_multc_fixed( corrEst_fx + i, 644245095 /*1.2f in Q29*/, corrEst_fx + i, k ); /* Q31-corrEst_exp */ - v_multc_fixed( corrEst_fx + i + k, ONE_IN_Q29 /*1.0f in Q29*/, corrEst_fx + i + k, sub( 2 * L_NCSHIFT_DS + 1, i + k ) ); // to allign in same exp (Q31-corrEst_exp) + v_multc_fx( corrEst_fx, ONE_IN_Q29 /*1.0f in Q29*/, corrEst_fx, i ); // to allign in same exp (Q31-corrEst_exp) + v_multc_fx( corrEst_fx + i, 644245095 /*1.2f in Q29*/, corrEst_fx + i, k ); /* Q31-corrEst_exp */ + v_multc_fx( corrEst_fx + i + k, ONE_IN_Q29 /*1.0f in Q29*/, corrEst_fx + i + k, sub( 2 * L_NCSHIFT_DS + 1, i + k ) ); // to allign in same exp (Q31-corrEst_exp) corrEst_exp = add( corrEst_exp, 2 ); } @@ -1876,17 +1876,17 @@ void stereo_tca_enc_fx( IF( EQ_16( hStereoTCA->prevRefChanIndx, L_CH_INDX ) ) { - v_multc_fixed( bufChanL_fx, ONE_IN_Q29, bufChanL_fx, L_MEM_RECALC_48K + L_MEM_RECALC_48k_SCH + L_FRAME48k + L_NCSHIFTMAX ); /* TO make in common Q bufChan_q - 2*/ - Copy32( ptrChanL_fx - add( lMemRecalc, lMemRecalc_SCh ), input_mem_loc_fx[0], add( lMemRecalc, lMemRecalc_SCh ) ); // bufChan_q - 2 - v_multc_fixed( ptrChanR_fx + sub( prevNCShift, add( lMemRecalc, lMemRecalc_SCh ) ), hStereoTCA->prevTargetGain_fx, input_mem_loc_fx[1], add( lMemRecalc, lMemRecalc_SCh ) ); // bufChan_q-2 - v_multc_fixed( bufChanR_fx, ONE_IN_Q29, bufChanR_fx, L_MEM_RECALC_48K + L_MEM_RECALC_48k_SCH + L_FRAME48k + L_NCSHIFTMAX ); /* TO make in common Q bufChan_q -2*/ + v_multc_fx( bufChanL_fx, ONE_IN_Q29, bufChanL_fx, L_MEM_RECALC_48K + L_MEM_RECALC_48k_SCH + L_FRAME48k + L_NCSHIFTMAX ); /* TO make in common Q bufChan_q - 2*/ + Copy32( ptrChanL_fx - add( lMemRecalc, lMemRecalc_SCh ), input_mem_loc_fx[0], add( lMemRecalc, lMemRecalc_SCh ) ); // bufChan_q - 2 + v_multc_fx( ptrChanR_fx + sub( prevNCShift, add( lMemRecalc, lMemRecalc_SCh ) ), hStereoTCA->prevTargetGain_fx, input_mem_loc_fx[1], add( lMemRecalc, lMemRecalc_SCh ) ); // bufChan_q-2 + v_multc_fx( bufChanR_fx, ONE_IN_Q29, bufChanR_fx, L_MEM_RECALC_48K + L_MEM_RECALC_48k_SCH + L_FRAME48k + L_NCSHIFTMAX ); /* TO make in common Q bufChan_q -2*/ } ELSE { - v_multc_fixed( bufChanL_fx, ONE_IN_Q29, bufChanL_fx, L_MEM_RECALC_48K + L_MEM_RECALC_48k_SCH + L_FRAME48k + L_NCSHIFTMAX ); /* TO make in common Q bufChan_q -2*/ - Copy32( ptrChanL_fx + sub( prevNCShift, add( lMemRecalc, lMemRecalc_SCh ) ), input_mem_loc_fx[0], add( lMemRecalc, lMemRecalc_SCh ) ); // bufChan_q -2 - v_multc_fixed( ptrChanR_fx - add( lMemRecalc, lMemRecalc_SCh ), hStereoTCA->prevTargetGain_fx, input_mem_loc_fx[1], add( lMemRecalc, lMemRecalc_SCh ) ); // bufChan_q -2 - v_multc_fixed( bufChanR_fx, ONE_IN_Q29, bufChanR_fx, L_MEM_RECALC_48K + L_MEM_RECALC_48k_SCH + L_FRAME48k + L_NCSHIFTMAX ); /* TO make in common Q bufChan_q -2*/ + v_multc_fx( bufChanL_fx, ONE_IN_Q29, bufChanL_fx, L_MEM_RECALC_48K + L_MEM_RECALC_48k_SCH + L_FRAME48k + L_NCSHIFTMAX ); /* TO make in common Q bufChan_q -2*/ + Copy32( ptrChanL_fx + sub( prevNCShift, add( lMemRecalc, lMemRecalc_SCh ) ), input_mem_loc_fx[0], add( lMemRecalc, lMemRecalc_SCh ) ); // bufChan_q -2 + v_multc_fx( ptrChanR_fx - add( lMemRecalc, lMemRecalc_SCh ), hStereoTCA->prevTargetGain_fx, input_mem_loc_fx[1], add( lMemRecalc, lMemRecalc_SCh ) ); // bufChan_q -2 + v_multc_fx( bufChanR_fx, ONE_IN_Q29, bufChanR_fx, L_MEM_RECALC_48K + L_MEM_RECALC_48k_SCH + L_FRAME48k + L_NCSHIFTMAX ); /* TO make in common Q bufChan_q -2*/ } bufChan_q = sub( bufChan_q, 2 ); q_com = bufChan_q; @@ -1937,7 +1937,7 @@ void stereo_tca_enc_fx( } ELSE { - v_multc_fixed( target_fx - tempS, hStereoTCA->prevTargetGain_fx, &( input_mem_loc_fx[target_idx][lMemRecalc + lMemRecalc_SCh - tempS - currentNCShift] ), add( currentNCShift, tempS ) ); /* bufChan_q - 2 */ + v_multc_fx( target_fx - tempS, hStereoTCA->prevTargetGain_fx, &( input_mem_loc_fx[target_idx][lMemRecalc + lMemRecalc_SCh - tempS - currentNCShift] ), add( currentNCShift, tempS ) ); /* bufChan_q - 2 */ scale_sig32( input_mem_loc_fx[target_idx], sub( sub( add( lMemRecalc, lMemRecalc_SCh ), tempS ), currentNCShift ), -2 ); scale_sig32( &input_mem_loc_fx[target_idx][lMemRecalc + lMemRecalc_SCh], sub( NS2SA( 48000, L_MEM_RECALC_NS + L_MEM_RECALC_SCH_NS ), add( lMemRecalc, lMemRecalc_SCh ) ), -2 ); scale_sig32( input_mem_loc_fx[0], NS2SA( 48000, L_MEM_RECALC_NS + L_MEM_RECALC_SCH_NS ), -2 ); @@ -1989,12 +1989,12 @@ void stereo_tca_enc_fx( target_idx = L_CH_INDX; /* only to avoid compilation warning */ move16(); - v_multc_fixed( bufChanL_fx, ONE_IN_Q29, bufChanL_fx, L_MEM_RECALC_48K + L_MEM_RECALC_48k_SCH + L_FRAME48k + L_NCSHIFTMAX ); /* TO make in common Q bufChan_q -2*/ + v_multc_fx( bufChanL_fx, ONE_IN_Q29, bufChanL_fx, L_MEM_RECALC_48K + L_MEM_RECALC_48k_SCH + L_FRAME48k + L_NCSHIFTMAX ); /* TO make in common Q bufChan_q -2*/ - Copy32( ptrChanL_fx - add( lMemRecalc, lMemRecalc_SCh ), input_mem_loc_fx[0], add( lMemRecalc, lMemRecalc_SCh ) ); // bufChan_q -2 - v_multc_fixed( ptrChanR_fx - add( lMemRecalc, lMemRecalc_SCh ), hStereoTCA->prevTargetGain_fx, input_mem_loc_fx[1], add( lMemRecalc, lMemRecalc_SCh ) ); // bufChan_q -2 + Copy32( ptrChanL_fx - add( lMemRecalc, lMemRecalc_SCh ), input_mem_loc_fx[0], add( lMemRecalc, lMemRecalc_SCh ) ); // bufChan_q -2 + v_multc_fx( ptrChanR_fx - add( lMemRecalc, lMemRecalc_SCh ), hStereoTCA->prevTargetGain_fx, input_mem_loc_fx[1], add( lMemRecalc, lMemRecalc_SCh ) ); // bufChan_q -2 - v_multc_fixed( bufChanR_fx, ONE_IN_Q29, bufChanR_fx, L_MEM_RECALC_48K + L_MEM_RECALC_48k_SCH + L_FRAME48k + L_NCSHIFTMAX ); /* TO make in common Q bufChan_q -2 */ + v_multc_fx( bufChanR_fx, ONE_IN_Q29, bufChanR_fx, L_MEM_RECALC_48K + L_MEM_RECALC_48k_SCH + L_FRAME48k + L_NCSHIFTMAX ); /* TO make in common Q bufChan_q -2 */ bufChan_q = sub( bufChan_q, 2 ); q_com = bufChan_q; move16(); diff --git a/lib_enc/ivas_stereo_icbwe_enc_fx.c b/lib_enc/ivas_stereo_icbwe_enc_fx.c index 85c35ed50f80ab35a492daf9b536088e6573dffe..f6bf1a0999fecbf98301544fcca9ad8bb4e2f04d 100644 --- a/lib_enc/ivas_stereo_icbwe_enc_fx.c +++ b/lib_enc/ivas_stereo_icbwe_enc_fx.c @@ -132,14 +132,14 @@ static Word16 ic_bwe_enc_specMapping_ivas_fx( /* Calculate rxx(1)/rxx(0) of the non ref target */ - temp00_fx = dotp_fixed_ivas_fx( shb_frame_target_fx, shb_frame_target_e, shb_frame_target_fx, shb_frame_target_e, L_FRAME16k - 1, &temp00_exp ); /* Q31-temp0_exp */ - temp11_fx = dotp_fixed_ivas_fx( shb_frame_target_fx, shb_frame_target_e, shb_frame_target_fx + 1, shb_frame_target_e, L_FRAME16k - 1, &temp11_exp ); /* Q31-temp1_exp */ + temp00_fx = dotp_fx_ivas_fx( shb_frame_target_fx, shb_frame_target_e, shb_frame_target_fx, shb_frame_target_e, L_FRAME16k - 1, &temp00_exp ); /* Q31-temp0_exp */ + temp11_fx = dotp_fx_ivas_fx( shb_frame_target_fx, shb_frame_target_e, shb_frame_target_fx + 1, shb_frame_target_e, L_FRAME16k - 1, &temp11_exp ); /* Q31-temp1_exp */ /* Calculate rxx(1)/rxx(0) of the non ref synth */ - temp0_fx = dotp_fixed_ivas_fx( shb_synth_nonref_fx, *shb_synth_nonref_e, shb_synth_nonref_fx, *shb_synth_nonref_e, L_FRAME16k - 3, &temp0_exp ); /* Q31-temp0_exp */ - temp1_fx = dotp_fixed_ivas_fx( shb_synth_nonref_fx, *shb_synth_nonref_e, shb_synth_nonref_fx + 1, *shb_synth_nonref_e, L_FRAME16k - 3, &temp1_exp ); /* Q31-temp1_exp */ - temp2_fx = dotp_fixed_ivas_fx( shb_synth_nonref_fx, *shb_synth_nonref_e, shb_synth_nonref_fx + 2, *shb_synth_nonref_e, L_FRAME16k - 3, &temp2_exp ); /* Q31-temp2_exp */ - temp3_fx = dotp_fixed_ivas_fx( shb_synth_nonref_fx, *shb_synth_nonref_e, shb_synth_nonref_fx + 3, *shb_synth_nonref_e, L_FRAME16k - 3, &temp3_exp ); /* Q31-temp3_exp */ + temp0_fx = dotp_fx_ivas_fx( shb_synth_nonref_fx, *shb_synth_nonref_e, shb_synth_nonref_fx, *shb_synth_nonref_e, L_FRAME16k - 3, &temp0_exp ); /* Q31-temp0_exp */ + temp1_fx = dotp_fx_ivas_fx( shb_synth_nonref_fx, *shb_synth_nonref_e, shb_synth_nonref_fx + 1, *shb_synth_nonref_e, L_FRAME16k - 3, &temp1_exp ); /* Q31-temp1_exp */ + temp2_fx = dotp_fx_ivas_fx( shb_synth_nonref_fx, *shb_synth_nonref_e, shb_synth_nonref_fx + 2, *shb_synth_nonref_e, L_FRAME16k - 3, &temp2_exp ); /* Q31-temp2_exp */ + temp3_fx = dotp_fx_ivas_fx( shb_synth_nonref_fx, *shb_synth_nonref_e, shb_synth_nonref_fx + 3, *shb_synth_nonref_e, L_FRAME16k - 3, &temp3_exp ); /* Q31-temp3_exp */ exp = s_max( *memShbSpecXcorr_e, s_max( s_max( s_max( temp00_exp, temp11_exp ), s_max( temp0_exp, temp1_exp ) ), s_max( temp2_exp, temp3_exp ) ) ); @@ -734,7 +734,7 @@ void stereo_icBWE_enc_ivas_fx( test(); IF( LT_32( gTarget_fx, 268435456 ) || GT_32( gTarget_fx, 1073741824 ) ) // 0.5 in Q29 or 2.0 in Q29 { - v_multc_fixed( voice_factors_fx, 1073741824, nlMixFac_fx, NB_SUBFR16k ); // Q31, 0.5 in Q31 -> 1073741824 + v_multc_fx( voice_factors_fx, 1073741824, nlMixFac_fx, NB_SUBFR16k ); // Q31, 0.5 in Q31 -> 1073741824 } Word16 L_FRAME16k_by_nbSubFr = L_FRAME16k / NB_SUBFR; @@ -947,7 +947,7 @@ void stereo_icBWE_enc_ivas_fx( test(); IF( LT_32( gTarget_fx, 268435456 ) || GT_32( gTarget_fx, 1073741824 ) ) // 0.5 in Q29 & 2.0 in Q29 { - v_multc_fixed( voice_factors_fx, 1073741824 /*0.5 in Q31*/, nlMixFac_fx, NB_SUBFR16k ); /* Q31 */ + v_multc_fx( voice_factors_fx, 1073741824 /*0.5 in Q31*/, nlMixFac_fx, NB_SUBFR16k ); /* Q31 */ } Word16 L_FRAME16k_by_nbSubFr = L_FRAME16k / NB_SUBFR; diff --git a/lib_enc/ivas_stereo_mdct_igf_enc_fx.c b/lib_enc/ivas_stereo_mdct_igf_enc_fx.c index 6c3588cabc6d7a93997e0937dfd86940f859dee8..d22e1b885b7791d5cdadd3e62de61d00262b0588 100644 --- a/lib_enc/ivas_stereo_mdct_igf_enc_fx.c +++ b/lib_enc/ivas_stereo_mdct_igf_enc_fx.c @@ -80,13 +80,13 @@ static Word16 calcCoh_fx( // Q15 move16(); q_cc = q_ener1; move16(); - ener1_fx = dotp_fixed_o( sig1_fx, sig1_fx, nSamples, gB, &q_ener1 ); /* q_ener1 */ - ener2_fx = dotp_fixed_o( sig2_fx, sig2_fx, nSamples, gB, &q_ener2 ); /* q_ener2 */ - cEner_fx = Mpy_32_32( ener1_fx, ener2_fx ); /* q_ener1+q_ener2-31 */ + ener1_fx = dotp_fx32_o( sig1_fx, sig1_fx, nSamples, gB, &q_ener1 ); /* q_ener1 */ + ener2_fx = dotp_fx32_o( sig2_fx, sig2_fx, nSamples, gB, &q_ener2 ); /* q_ener2 */ + cEner_fx = Mpy_32_32( ener1_fx, ener2_fx ); /* q_ener1+q_ener2-31 */ q_cEner = sub( 62, add( q_ener1, q_ener2 ) ); cEner_fx = Sqrt32( cEner_fx, &q_cEner ); /* Q31-q_cEner */ q_cEner = sub( Q31, q_cEner ); - cc_fx = dotp_fixed_o( sig1_fx, sig2_fx, nSamples, gB, &q_cc ); /* q_cc */ + cc_fx = dotp_fx32_o( sig1_fx, sig2_fx, nSamples, gB, &q_cc ); /* q_cc */ IF( corr != NULL ) { diff --git a/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c b/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c index bcc4462a23f3d3574a5996509226e5e9174a0491..d53eb365d3dcca44ca72231143fec4127c002df0 100644 --- a/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c +++ b/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c @@ -255,8 +255,8 @@ void stereo_coder_tcx_fx( tmp = Inv16( extract_h( nrgRatio_fx[k] ), &e_tmp ); /* Q15-e_tmp */ tmp = shl( tmp, e_tmp ); /* Q15 */ - v_multc_fixed_16( sts[1]->hTcxEnc->spectrum_fx[k], tmp, sts[1]->hTcxEnc->spectrum_fx[k], L_frameTCX ); /* exp: exp_spec */ - v_multc_fixed_16( mdst_spectrum_fx[1][k], tmp, mdst_spectrum_fx[1][k], L_frameTCX ); /* exp: exp_mdct_spec */ + v_multc_fx_16( sts[1]->hTcxEnc->spectrum_fx[k], tmp, sts[1]->hTcxEnc->spectrum_fx[k], L_frameTCX ); /* exp: exp_spec */ + v_multc_fx_16( mdst_spectrum_fx[1][k], tmp, mdst_spectrum_fx[1][k], L_frameTCX ); /* exp: exp_mdct_spec */ } ELSE IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( nrgRatio_fx[k], nrgRatio_e[k], ONE_IN_Q27, 4 ), -1 ) && LT_16( k, EQ_16( sts[0]->core, TCX_20_CORE ) ? 1 : NB_DIV ) ) { @@ -264,8 +264,8 @@ void stereo_coder_tcx_fx( L_frameTCX = idiv1616( L_frameTCX, ( sts[0]->core == TCX_20_CORE ) ? 1 : NB_DIV ); /* Q0 */ /* This operation is resulting in some high MLDs in fixed point. */ - v_multc_fixed_16( sts[0]->hTcxEnc->spectrum_fx[k], extract_l( L_shr( nrgRatio_fx[k], 16 - nrgRatio_e[k] ) ), sts[0]->hTcxEnc->spectrum_fx[k], L_frameTCX ); /* exp: exp_spec */ - v_multc_fixed_16( mdst_spectrum_fx[0][k], extract_l( L_shr( nrgRatio_fx[k], 16 - nrgRatio_e[k] ) ), mdst_spectrum_fx[0][k], L_frameTCX ); /* exp: exp_mdct_spec */ + v_multc_fx_16( sts[0]->hTcxEnc->spectrum_fx[k], extract_l( L_shr( nrgRatio_fx[k], 16 - nrgRatio_e[k] ) ), sts[0]->hTcxEnc->spectrum_fx[k], L_frameTCX ); /* exp: exp_spec */ + v_multc_fx_16( mdst_spectrum_fx[0][k], extract_l( L_shr( nrgRatio_fx[k], 16 - nrgRatio_e[k] ) ), mdst_spectrum_fx[0][k], L_frameTCX ); /* exp: exp_mdct_spec */ } } } @@ -309,7 +309,7 @@ void stereo_coder_tcx_fx( } for ( k = 0; k < nSubframes; k++ ) { - convertToMS_fx( L_frameTCX, sts[0]->hTcxEnc->spectrum_fx[k], sts[1]->hTcxEnc->spectrum_fx[k], SQRT2_OVER_2_FIXED ); + convertToMS_fx( L_frameTCX, sts[0]->hTcxEnc->spectrum_fx[k], sts[1]->hTcxEnc->spectrum_fx[k], SQRT2_OVER_2_FX ); /* Make sure that the MDST is processed in the correct way also */ set_s( &ms_mask[k][0], 1, MAX_SFB ); @@ -428,15 +428,15 @@ void stereo_coder_tcx_fx( move32(); - v_multc_fixed( &sts[0]->hTcxEnc->spectrum_fx[k][startLine], nrgRatio_fx[0], &sts[0]->hTcxEnc->spectrum_fx[k][startLine], sfbWidth ); /* exp: exp_spec+1 */ - v_multc_fixed( &mdst_spectrum_fx[0][k][startLine], nrgRatio_fx[0], &mdst_spectrum_fx[0][k][startLine], sfbWidth ); /* exp: exp_mdct_spec+1 */ - scale_sig32( &sts[0]->hTcxEnc->spectrum_fx[k][startLine], sfbWidth, Q1 ); // exp: exp_spec - scale_sig32( &mdst_spectrum_fx[0][k][startLine], sfbWidth, Q1 ); // exp: exp_mdct_spec + v_multc_fx( &sts[0]->hTcxEnc->spectrum_fx[k][startLine], nrgRatio_fx[0], &sts[0]->hTcxEnc->spectrum_fx[k][startLine], sfbWidth ); /* exp: exp_spec+1 */ + v_multc_fx( &mdst_spectrum_fx[0][k][startLine], nrgRatio_fx[0], &mdst_spectrum_fx[0][k][startLine], sfbWidth ); /* exp: exp_mdct_spec+1 */ + scale_sig32( &sts[0]->hTcxEnc->spectrum_fx[k][startLine], sfbWidth, Q1 ); // exp: exp_spec + scale_sig32( &mdst_spectrum_fx[0][k][startLine], sfbWidth, Q1 ); // exp: exp_mdct_spec - v_multc_fixed( &sts[1]->hTcxEnc->spectrum_fx[k][startLine], nrgRatio_fx[1], &sts[1]->hTcxEnc->spectrum_fx[k][startLine], sfbWidth ); /* exp: exp_spec+1 */ - v_multc_fixed( &mdst_spectrum_fx[1][k][startLine], nrgRatio_fx[1], &mdst_spectrum_fx[1][k][startLine], sfbWidth ); /* exp: exp_mdct_spec+1 */ - scale_sig32( &sts[1]->hTcxEnc->spectrum_fx[k][startLine], sfbWidth, Q1 ); // exp: exp_spec - scale_sig32( &mdst_spectrum_fx[1][k][startLine], sfbWidth, Q1 ); // exp: exp_mdct_spec + v_multc_fx( &sts[1]->hTcxEnc->spectrum_fx[k][startLine], nrgRatio_fx[1], &sts[1]->hTcxEnc->spectrum_fx[k][startLine], sfbWidth ); /* exp: exp_spec+1 */ + v_multc_fx( &mdst_spectrum_fx[1][k][startLine], nrgRatio_fx[1], &mdst_spectrum_fx[1][k][startLine], sfbWidth ); /* exp: exp_mdct_spec+1 */ + scale_sig32( &sts[1]->hTcxEnc->spectrum_fx[k][startLine], sfbWidth, Q1 ); // exp: exp_spec + scale_sig32( &mdst_spectrum_fx[1][k][startLine], sfbWidth, Q1 ); // exp: exp_mdct_spec } } } @@ -584,7 +584,7 @@ void ms_processing_fx( { IF( NE_16( ms_mask[iSubframe][sfb], 0 ) ) { - convertToBwMS_fx( sfbConf->sfbOffset[sfb], sfbConf->sfbOffset[sfb + 1], x_0_fx, x_1_fx, SQRT2_OVER_2_FIXED ); + convertToBwMS_fx( sfbConf->sfbOffset[sfb], sfbConf->sfbOffset[sfb + 1], x_0_fx, x_1_fx, SQRT2_OVER_2_FX ); } } @@ -640,7 +640,7 @@ void ms_inv_mask_processing_fx( IF( EQ_16( ms_mask[iSubframe][sfb], 0 ) ) { - convertToBwMS_fx( sfbConf->sfbOffset[sfb], sfbConf->sfbOffset[sfb + 1], x_inv_0_fx, x_inv_1_fx, SQRT2_OVER_2_FIXED ); + convertToBwMS_fx( sfbConf->sfbOffset[sfb], sfbConf->sfbOffset[sfb + 1], x_inv_0_fx, x_inv_1_fx, SQRT2_OVER_2_FX ); } } @@ -1185,9 +1185,9 @@ static void MsStereoDecision_fx( FOR( i = 0; i < length; i++ ) { - specM_fx[i] = Mpy_32_32( L_add( specL_fx[i], specR_fx[i] ), SQRT2_OVER_2_FIXED ); // Q( q_spec ) + specM_fx[i] = Mpy_32_32( L_add( specL_fx[i], specR_fx[i] ), SQRT2_OVER_2_FX ); // Q( q_spec ) move32(); - specS_fx[i] = Mpy_32_32( L_sub( specL_fx[i], specR_fx[i] ), SQRT2_OVER_2_FIXED ); // Q( q_spec ) + specS_fx[i] = Mpy_32_32( L_sub( specL_fx[i], specR_fx[i] ), SQRT2_OVER_2_FX ); // Q( q_spec ) move32(); } diff --git a/lib_enc/ivas_stereo_switching_enc_fx.c b/lib_enc/ivas_stereo_switching_enc_fx.c index 24ff57217cb95b64d983a3f0ddf6f27312fab872..a219aef81e4572f9f11cfb58caabb463bd6cbba5 100644 --- a/lib_enc/ivas_stereo_switching_enc_fx.c +++ b/lib_enc/ivas_stereo_switching_enc_fx.c @@ -831,7 +831,7 @@ void stereo_switching_enc_fx( test(); IF( hCPE->hStereoTD != NULL && EQ_16( hCPE->hStereoTD->tdm_last_ratio_idx, LRTD_STEREO_LEFT_IS_PRIM ) ) { - v_multc_fixed( hCPE->hCoreCoder[1]->old_input_signal32_fx + sub( input_frame, add( offset, NS2SA_FX2( L_mult0( input_frame, FRAMES_PER_SEC ), L_MEM_RECALC_TBE_NS ) ) ), -MAX_32, sts[1]->cldfbAnaEnc->cldfb_state_fx, offset ); /* Q16+q_inp */ + v_multc_fx( hCPE->hCoreCoder[1]->old_input_signal32_fx + sub( input_frame, add( offset, NS2SA_FX2( L_mult0( input_frame, FRAMES_PER_SEC ), L_MEM_RECALC_TBE_NS ) ) ), -MAX_32, sts[1]->cldfbAnaEnc->cldfb_state_fx, offset ); /* Q16+q_inp */ sts[1]->cldfbAnaEnc->Q_cldfb_state = q_inp; move16(); } diff --git a/lib_enc/lp_exc_e_fx.c b/lib_enc/lp_exc_e_fx.c index 3b77bf3cd4697c528d9248c1aadf575422f1cf9a..4d6084c879694fe13d70d85916e1378c8c5584c3 100644 --- a/lib_enc/lp_exc_e_fx.c +++ b/lib_enc/lp_exc_e_fx.c @@ -1,10 +1,10 @@ /*==================================================================================== EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0 ====================================================================================*/ + #include #include "options.h" /* Compilation switches */ #include "cnst.h" /* Common constants */ -//#include "prot_fx.h" /* Function prototypes */ #include "basop_util.h" #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ @@ -173,6 +173,7 @@ Word16 lp_filt_exc_enc_fx( return select; } + /*-------------------------------------------------------------------* * adpt_enr_fx() * @@ -180,20 +181,20 @@ Word16 lp_filt_exc_enc_fx( * This serves to decide about the filtering of the adaptive excitation *-------------------------------------------------------------------*/ -static Word16 adpt_enr_fx( /* o : adaptive excitation energy mant */ - const Word16 codec_mode, /* i : MODE1 or MODE2 */ - const Word16 *exc, /* i : excitation vector Q_new */ - const Word16 *h1, /* i : impuls response Q15 */ - Word16 *y1, /* o : zero-memory filtered adpt. excitation 12 bits */ - const Word16 L_subfr, /* i : vector length */ - Word16 *gain, /* o : subframe adaptive gain Q14 */ - Word16 *g_corr, /* o : correlations for adptive gain mant/exp*/ - const Word16 clip_gain, /* i : adaptive gain clipping flag Q0 */ - const Word16 *xn, /* i : adaptive codebook target 12 bits Q_new-1+shift*/ - Word16 *xn2, /* o : algebraic codebook target 12 bits Q_new-1+shift*/ - Word16 *exp_ener /* o : adaptive excitation energy exp */ - , - Word16 use_prev_sf_pit_gain /* i : flag to use prev sf pitch gain or not */ +/* o : adaptive excitation energy mant */ +static Word16 adpt_enr_fx( + const Word16 codec_mode, /* i : MODE1 or MODE2 */ + const Word16 *exc, /* i : excitation vector Q_new */ + const Word16 *h1, /* i : impuls response Q15 */ + Word16 *y1, /* o : zero-memory filtered adpt. excitation 12 bits */ + const Word16 L_subfr, /* i : vector length */ + Word16 *gain, /* o : subframe adaptive gain Q14 */ + Word16 *g_corr, /* o : correlations for adptive gain mant/exp*/ + const Word16 clip_gain, /* i : adaptive gain clipping flag Q0 */ + const Word16 *xn, /* i : adaptive codebook target 12 bits Q_new-1+shift*/ + Word16 *xn2, /* o : algebraic codebook target 12 bits Q_new-1+shift*/ + Word16 *exp_ener, /* o : adaptive excitation energy exp */ + Word16 use_prev_sf_pit_gain /* i : flag to use prev sf pitch gain or not */ ) { Word16 ener, i; @@ -274,14 +275,14 @@ static Word16 adpt_enr_fx( /* o : adaptive excitation * codebook excitation y1[]. ( and -2 ) *-------------------------------------------------------------------*/ -Word16 corr_xy1_fx( /* o : pitch gain (0..GAIN_PIT_MAX) */ - const Word16 xn_1[], /* i : target signal Q_new*/ - const Word16 y1_1[], /* i : filtered adaptive codebook excitation 12 bits*/ - Word16 g_corr[], /* o : correlations and -2 mant/exp*/ - const Word16 L_subfr, /* i : vector length */ - const Word16 norm_flag /* i : flag for constraining pitch contribution */ - , - Flag *Overflow_out /* o : propagating the Overflow flag to upper level */ +/* o : pitch gain (0..GAIN_PIT_MAX) */ +Word16 corr_xy1_fx( + const Word16 xn_1[], /* i : target signal Q_new*/ + const Word16 y1_1[], /* i : filtered adaptive codebook excitation 12 bits*/ + Word16 g_corr[], /* o : correlations and -2 mant/exp*/ + const Word16 L_subfr, /* i : vector length */ + const Word16 norm_flag, /* i : flag for constraining pitch contribution */ + Flag *Overflow_out /* o : propagating the Overflow flag to upper level */ ) { Word16 i; diff --git a/lib_enc/lsf_enc_fx.c b/lib_enc/lsf_enc_fx.c index 4d15fba43acdbccc4c6d251a869c4257fbb73caf..0c5656ac447fdddddd91746589b0cce60dc03081 100644 --- a/lib_enc/lsf_enc_fx.c +++ b/lib_enc/lsf_enc_fx.c @@ -1349,9 +1349,11 @@ void lsf_end_enc_fx( /* Update AR-predictor memories */ Copy( qlsf, st->mem_AR_fx, M ); + return; } + void lsf_end_enc_ivas_fx( Encoder_State *st, /* i/o: encoder state structure */ const Word16 *lsf, /* i : LSF in the frequency domain (0..6400) x2.56*/ @@ -1363,8 +1365,7 @@ void lsf_end_enc_ivas_fx( Word16 *lpc_param, Word16 *no_indices, Word16 *bits_param_lpc, - Word16 coder_type_raw /* i : Coder type (LSF coder_type have some special cases)*/ - , + Word16 coder_type_raw, /* i : Coder type (LSF coder_type have some special cases)*/ const Word16 tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ ) { @@ -1435,10 +1436,11 @@ void lsf_end_enc_ivas_fx( move16(); } - /*----------------------------------------------------------------------------------- -* + /*------------------------------------------------------------------------------------* * Calculate the number of stages and levels for each stage based on allowed bit budget * Set absolute threshold for codebook-type decision logic depending on signal bandwidth - *------------------------------------------------------------------------------------ -*/ + *-------------------------------------------------------------------------------------*/ + IF( st->bwidth == NB ) { abs_threshold = SFNETLOWLIMIT_NB / 2; @@ -1455,6 +1457,7 @@ void lsf_end_enc_ivas_fx( /*--------------------------------------------------------------------------------* * LSF quantization of SID frames *--------------------------------------------------------------------------------*/ + IF( EQ_32( st->core_brate, SID_2k40 ) ) { lsfq_CNG_ivas_fx( hBstr, lsf, wghts, qlsf ); @@ -1470,8 +1473,8 @@ void lsf_end_enc_ivas_fx( * Calculate number of stages and levels for each stage based on the allowed bit allocation * (subtract one bit for LSF predictor selection) *----------------------------------------------------------------*/ - lsf_allocate_fx( sub( nBits, shr( predmode, 1 ) ), mode_lvq, mode_lvq_p, &stages0, &stages1, levels0, levels1, bits0, bits1 ); + lsf_allocate_fx( sub( nBits, shr( predmode, 1 ) ), mode_lvq, mode_lvq_p, &stages0, &stages1, levels0, levels1, bits0, bits1 ); /*--------------------------------------------------------------------------------* * LSF quantization of all other frames but SID frames @@ -1537,6 +1540,7 @@ void lsf_end_enc_ivas_fx( pred2[i] = add( pred0[i], mult( Predictors_fx[mode_lvq_p][i], sub( st->mem_AR_fx[i], pred0[i] ) ) ); Tmp2[i] = sub( lsf[i], pred2[i] ); } + /* Adaptive scaling factor (multiplier) is updated in order to reduce the amount of consecutive predictive frames in case of possible frame erasure. AR-predictive usage for VOICED mode is allowed to be higher than other modes. */ test(); @@ -1683,6 +1687,7 @@ void lsf_end_enc_ivas_fx( } } } + /*--------------------------------------------------------------------------* * Write indices to array *--------------------------------------------------------------------------*/ @@ -1868,7 +1873,6 @@ void lsf_end_enc_ivas_fx( } } - /*--------------------------------------------------------------------------* * De-quantize encoded LSF vector *--------------------------------------------------------------------------*/ @@ -1935,9 +1939,11 @@ void lsf_end_enc_ivas_fx( /* Update AR-predictor memories */ Copy( qlsf, st->mem_AR_fx, M ); + return; } + /*-------------------------------------------------------------------* * first_VQstages() * @@ -2107,6 +2113,7 @@ static void first_VQstages( /*------------------------------------------------------------* * Compute error vectors for each node *------------------------------------------------------------*/ + cs = 0; move16(); FOR( c = 0; c < maxC; c++ ) @@ -2131,6 +2138,7 @@ static void first_VQstages( return; } + static void first_VQstages_ivas_fx( const Word16 *const *cb, Word16 u[], /* i : vector to be encoded (prediction and mean removed) */ @@ -2294,6 +2302,7 @@ static void first_VQstages_ivas_fx( /*------------------------------------------------------------* * Compute error vectors for each node *------------------------------------------------------------*/ + cs = 0; move16(); FOR( c = 0; c < maxC; c++ ) @@ -2317,6 +2326,8 @@ static void first_VQstages_ivas_fx( return; } + + /*--------------------------------------------------------------------------- * vq_enc_lsf_lvq() * @@ -2377,7 +2388,6 @@ static Word32 vq_lvq_lsf_enc( first_VQstages( cb, u, levels, stagesVQ, w, M, MSVQ_MAXCNT, indices_firstVQ ); } - FOR( i = 0; i < maxC; i++ ) { Copy( pred, cand[i], M ); @@ -2437,6 +2447,7 @@ static Word32 vq_lvq_lsf_enc( return e[c2]; } + static Word32 vq_lvq_lsf_enc_ivas_fx( Word16 pred_flag, Word16 mode, @@ -2497,7 +2508,6 @@ static Word32 vq_lvq_lsf_enc_ivas_fx( first_VQstages_ivas_fx( cb, u, levels, stagesVQ, w, M, MSVQ_MAXCNT, indices_firstVQ ); } - FOR( i = 0; i < maxC; i++ ) { Copy( pred, cand[i], M ); @@ -2555,6 +2565,8 @@ static Word32 vq_lvq_lsf_enc_ivas_fx( return e[c2]; } + + static void BcTcvq_1st_fx( Word16 x_fx[][2], /*x2.56*/ const Word16 CB_fx[][128][2], /*x2.56*/ @@ -2705,7 +2717,6 @@ static void BcTcvq_SubBlock_fx( Word16 stage1, stage2, state, prev_state, branch; Word16 index, bestCode, brCode[N_DIM]; Word16 temp16_fx; - Word32 dist_fx, minDist_fx, brDist_fx[N_DIM]; Word16 pred_fx[N_DIM], target_fx[N_DIM], brQuant_fx[N_DIM][N_DIM]; @@ -2714,7 +2725,6 @@ static void BcTcvq_SubBlock_fx( FOR( state = 0; state < NUM_STATE; state++ ) { - /* 1st branch search */ prev_state = NTRANS[0][state]; move16(); @@ -2912,8 +2922,11 @@ static Word32 BcTcvq_FixSearch_fx( move16(); minDist_fx = L_shr( minDist_fx, 2 ); /*2.56*2.56*Q(-5 - 2)*/ + return minDist_fx; } + + static Word16 optimalPath_fx( Word32 cDist_fx[][16], /*2.56*2.56*Q(-5 - 2)*/ Word32 blockDist_fx[], /*2.56*2.56*Q(-5 - 2)*/ @@ -3053,7 +3066,6 @@ static void buildCode_fx( set16_fx( BrIndex, 0, ( N_STAGE_VQ - 4 ) ); - FOR( stage = N_STAGE_VQ - 4; stage >= 1; stage-- ) { if ( GT_16( s[stage], 7 ) ) @@ -3092,6 +3104,8 @@ static void buildCode_fx( return; } + + static void BcTcvq_fx( Word16 snFlag, const Word16 *x_fx, // x2.65 diff --git a/lib_enc/multi_harm_fx.c b/lib_enc/multi_harm_fx.c index 707dd397f02cdce2483f2b6c98db5fcc24a117d5..10d89ea75405eefb6f0b9bda29c6626357e08eee 100644 --- a/lib_enc/multi_harm_fx.c +++ b/lib_enc/multi_harm_fx.c @@ -1,10 +1,10 @@ /*==================================================================================== EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0 ====================================================================================*/ + #include -#include "options.h" /* Compilation switches */ -#include "cnst.h" /* Common constants */ -//#include "prot_fx.h" /* Function prototypes */ +#include "options.h" /* Compilation switches */ +#include "cnst.h" /* Common constants */ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ #include "basop_util.h" @@ -20,19 +20,21 @@ * Perform multi-harmonic analysis, information used for UV and VAD decision *---------------------------------------------------------------------*/ -Word16 multi_harm_fx( /* o : frame multi-harmonicity (1-harmonic, 0-not) */ - const Word16 Bin_E[], /* i : log-energy spectrum of the current frame Q7 */ - Word16 old_S[], /* i/o: prev. log-energy spectrum w. subtracted floor Q7 */ - Word16 cor_map_LT[], /* i/o: LT correlation map Q15 */ - Word16 *multi_harm_limit, /* i/o: multi harminic threshold Q9 */ - const Word32 total_brate, /* i : total bitrate Q0 */ - const Word16 bwidth, /* i : input signal bandwidth Q0 */ - Word16 *cor_strong_limit, /* i/o: HF correlation indicator Q0 */ - Word16 *st_mean_avr_dyn, /* i/o: long term average dynamic Q7 */ - Word16 *st_last_sw_dyn, /* i/o: last dynamic Q7 */ - Word16 *cor_map_sum, /* i : sum of correlation map Q8 */ - Word16 *sp_floor, /* o: noise floor estimate Q7 */ - Word16 S_map[] /* o : short-term correlation map Q7 */ +/* o : frame multi-harmonicity (1-harmonic, 0-not) */ +Word16 multi_harm_fx( + + const Word16 Bin_E[], /* i : log-energy spectrum of the current frame Q7 */ + Word16 old_S[], /* i/o: prev. log-energy spectrum w. subtracted floor Q7 */ + Word16 cor_map_LT[], /* i/o: LT correlation map Q15 */ + Word16 *multi_harm_limit, /* i/o: multi harminic threshold Q9 */ + const Word32 total_brate, /* i : total bitrate Q0 */ + const Word16 bwidth, /* i : input signal bandwidth Q0 */ + Word16 *cor_strong_limit, /* i/o: HF correlation indicator Q0 */ + Word16 *st_mean_avr_dyn, /* i/o: long term average dynamic Q7 */ + Word16 *st_last_sw_dyn, /* i/o: last dynamic Q7 */ + Word16 *cor_map_sum, /* i : sum of correlation map Q8 */ + Word16 *sp_floor, /* o: noise floor estimate Q7 */ + Word16 S_map[] /* o : short-term correlation map Q7 */ ) { Word16 i, j, k, L, stemp, N_mins, ind_mins[L_FFT / 4], *pt_mins, harm; @@ -358,19 +360,21 @@ Word16 multi_harm_fx( /* o : frame multi-harmonicity return harm; } -Word16 multi_harm_ivas_fx( /* o : frame multi-harmonicity (1-harmonic, 0-not) */ - const Word16 Bin_E[], /* i : log-energy spectrum of the current frame Q7 */ - Word16 old_S[], /* i/o: prev. log-energy spectrum w. subtracted floor Q7 */ - Word16 cor_map_LT[], /* i/o: LT correlation map Q15 */ - Word16 *multi_harm_limit, /* i/o: multi harminic threshold Q9 */ - const Word32 total_brate, /* i : total bitrate Q0 */ - const Word16 bwidth, /* i : input signal bandwidth Q0 */ - Word16 *cor_strong_limit, /* i/o: HF correlation indicator Q0 */ - Word16 *st_mean_avr_dyn, /* i/o: long term average dynamic Q7 */ - Word16 *st_last_sw_dyn, /* i/o: last dynamic Q7 */ - Word16 *cor_map_sum, /* i : sum of correlation map Q8 */ - Word16 *sp_floor, /* o: noise floor estimate Q7 */ - Word16 S_map[] /* o : short-term correlation map Q7 */ + +/* o : frame multi-harmonicity (1-harmonic, 0-not) */ +Word16 multi_harm_ivas_fx( + const Word16 Bin_E[], /* i : log-energy spectrum of the current frame Q7 */ + Word16 old_S[], /* i/o: prev. log-energy spectrum w. subtracted floor Q7 */ + Word16 cor_map_LT[], /* i/o: LT correlation map Q15 */ + Word16 *multi_harm_limit, /* i/o: multi harminic threshold Q9 */ + const Word32 total_brate, /* i : total bitrate Q0 */ + const Word16 bwidth, /* i : input signal bandwidth Q0 */ + Word16 *cor_strong_limit, /* i/o: HF correlation indicator Q0 */ + Word16 *st_mean_avr_dyn, /* i/o: long term average dynamic Q7 */ + Word16 *st_last_sw_dyn, /* i/o: last dynamic Q7 */ + Word16 *cor_map_sum, /* i : sum of correlation map Q8 */ + Word16 *sp_floor, /* o: noise floor estimate Q7 */ + Word16 S_map[] /* o : short-term correlation map Q7 */ ) { Word16 i, j, k, L, stemp, N_mins, ind_mins[L_FFT / 4], *pt_mins, harm; diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index e64c18468db76ef4f161075c927b97b44f1e13e2..448a93b9ff07d372b829a09e6da8983bc9c7c4d7 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -33,34 +33,32 @@ #ifndef PROT_FX_ENC_H #define PROT_FX_ENC_H +#include "options.h" #include "ivas_cnst.h" #include "stat_enc.h" #include "stat_dec.h" #include "ivas_stat_dec.h" -#include "ivas_error.h" -#include "ivas_error_utils.h" -#include "complex_basop.h" #include "ivas_stat_enc.h" ivas_error acelp_core_enc_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ - const Word16 inp_fx[], /* i : input signal of the current frame Q_new*/ - const Word32 ener_fx, /* i : residual energy from Levinson-Durbin Q6*/ - Word16 A_fx[NB_SUBFR16k * ( M + 1 )], /* i : A(z) unquantized for the 4 subframes Q12*/ - Word16 Aw_fx[NB_SUBFR16k * ( M + 1 )], /* i : weighted A(z) unquant. for subframes Q12*/ - const Word16 epsP_h_fx[M + 1], /* i : LP prediction errors Qx*/ - const Word16 epsP_l_fx[M + 1], /* i : LP prediction errors Qx*/ - Word16 lsp_new_fx[M], /* i : LSPs at the end of the frame Q15*/ - Word16 lsp_mid_fx[M], /* i : LSPs in the middle of the frame Q15*/ - Word16 vad_hover_flag_fx, /* i : VAD hangover flag Q0*/ - const Word16 attack_flag, /* i : attack flag (GSC or TC) Q0*/ - Word32 bwe_exc_extended_fx[], /* i/o: bandwidth extended excitation st->prev_Q_bwe_exc*/ - Word16 *voice_factors_fx, /* o : voicing factors Q15*/ + Encoder_State *st_fx, /* i/o: encoder state structure */ + const Word16 inp_fx[], /* i : input signal of the current frame Q_new*/ + const Word32 ener_fx, /* i : residual energy from Levinson-Durbin Q6*/ + Word16 A_fx[NB_SUBFR16k * ( M + 1 )], /* i : A(z) unquantized for the 4 subframes Q12*/ + Word16 Aw_fx[NB_SUBFR16k * ( M + 1 )], /* i : weighted A(z) unquant. for subframes Q12*/ + const Word16 epsP_h_fx[M + 1], /* i : LP prediction errors Qx*/ + const Word16 epsP_l_fx[M + 1], /* i : LP prediction errors Qx*/ + Word16 lsp_new_fx[M], /* i : LSPs at the end of the frame Q15*/ + Word16 lsp_mid_fx[M], /* i : LSPs in the middle of the frame 15*/ + Word16 vad_hover_flag_fx, /* i : VAD hangover flag Q0*/ + const Word16 attack_flag, /* i : attack flag (GSC or TC) Q0*/ + Word32 bwe_exc_extended_fx[], /* i/o: bandwidth extended excitation st->prev_Q_bwe_exc*/ + Word16 *voice_factors_fx, /* o : voicing factors Q15*/ Word16 old_syn_12k8_16k_fx[], /* o : intermediate ACELP synthesis at 12.8kHz or 16kHz to be used by SWB BWE q_old_syn*/ - Word16 pitch_buf_fx[NB_SUBFR16k], /* o : floating pitch for each subframe Q6*/ - Word16 *unbits_fx, /* o : number of unused bits Q0*/ - STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i/o: TD stereo encoder handle */ + Word16 pitch_buf_fx[NB_SUBFR16k], /* o : floating pitch for each subframe Q6*/ + Word16 *unbits_fx, /* o : number of unused bits Q0*/ + STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i/o: TD stereo encoder handle */ const Word16 Q_new, const Word16 shift ); @@ -97,7 +95,7 @@ void AVQ_encmux_fx( BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ const Word16 extl, /* i : extension layer */ Word16 xriq[], /* i/o: rounded subvectors [0..8*Nsv-1] followed - by rounded bit allocations [8*Nsv..8*Nsv+Nsv-1] */ + by rounded bit allocations [8*Nsv..8*Nsv+Nsv-1] */ Word16 *nb_bits, /* i/o: number of allocated bits */ const Word16 Nsv, /* i: number of subvectors */ Word16 nq_out[], /* o : AVQ nq index */ @@ -107,7 +105,7 @@ void AVQ_encmux_fx( void bw_detect_fx( Encoder_State *st, /* i/o: Encoder State */ - const Word16 signal_in[], /* i : input signal */ + const Word16 signal_in[], /* i : input signal */ Word16 *spectrum, /* i : MDCT spectrum Q_spec */ const Word32 *enerBuffer, /* i : CLDFB Energy Q31 */ const Word16 *cldfbBuf_Ener_Exp, /* i : CLDFB Energy Exponent */ @@ -122,14 +120,14 @@ void core_switching_post_enc_fx( const Word16 A[], /* i : unquant. LP filter coefs. (Q12) */ Word16 Qshift, Word16 Q_new, - const Word16 Qsp, /* i/o : Q from acelp synthsis */ + const Word16 Qsp, /* i/o : Q from acelp synthsis */ Word16 *Qmus /* i/o : Q from mdct synthsis / Q of output synthesis */ ); void core_switching_pre_enc_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ - const Word16 *old_inp_12k8, /* i : old i signal @12.8kHz Qx*/ - const Word16 *old_inp_16k, /* i : old i signal @16kHz Qx*/ + Encoder_State *st_fx, /* i/o: encoder state structure */ + const Word16 *old_inp_12k8, /* i : old i signal @12.8kHz Qx*/ + const Word16 *old_inp_16k, /* i : old i signal @16kHz Qx*/ const Word16 active_cnt, /* i : active frame counter Q0*/ const Word16 last_element_mode /* i : last_element_mode Q0*/ ); @@ -140,19 +138,19 @@ Word16 correlation_shift_fx( ); void dtx_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 vad, /* i : vad flag Q0*/ - const Word16 speech[], /* i : Pointer to the speech frame Q_speech*/ - Word16 Q_speech /* i : Q factor for speech */ + const Word16 speech[], /* i : Pointer to the speech frame Q_speech*/ + Word16 Q_speech /* i : Q factor for speech */ ); void dtx_ivas_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word32 last_ivas_total_brate, /* i : last IVAS total bitrate Q0*/ - const Word32 ivas_total_brate, /* i : IVAS total bitrate Q0*/ + const Word32 ivas_total_brate, /* i : IVAS total bitrate Q0*/ const Word16 vad, /* i : vad flag for DTX Q0*/ - const Word16 speech[], /* i : Pointer to the speech frame Q_speech*/ - Word16 Q_speech /* i : Q factor for speech */ + const Word16 speech[], /* i : Pointer to the speech frame Q_speech*/ + Word16 Q_speech /* i : Q factor for speech */ ); Word16 dtx_hangover_addition_fx( @@ -161,28 +159,30 @@ Word16 dtx_hangover_addition_fx( const Word16 lp_snr, /* i Q8 */ const Word16 cldfb_subtraction, /* i Q0 number of DTX-HO frames CLDFB wants to reduce */ Word16 *vad_hover_flag_ptr, - VAD_HANDLE hVAD, /* i/o: VAD data handle */ + VAD_HANDLE hVAD, /* i/o: VAD data handle */ NOISE_EST_HANDLE hNoiseEst /* i : Noise estimation handle */ ); + Word16 ivas_dtx_hangover_addition_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 vad_flag, /* i Q0 */ const Word16 lp_snr, /* i Q8 */ const Word16 cldfb_subtraction, /* i Q0 number of DTX-HO frames CLDFB wants to reduce */ Word16 *vad_hover_flag_ptr, - VAD_HANDLE hVAD, /* i/o: VAD data handle */ + VAD_HANDLE hVAD, /* i/o: VAD data handle */ NOISE_EST_HANDLE hNoiseEst, /* i : Noise estimation handle */ Word16 *rem_dtx_ho ); + void fb_tbe_enc_fx( - Encoder_State *st, /* i/o: encoder state structure */ + Encoder_State *st, /* i/o: encoder state structure */ const Word16 new_input[], /* i : i speech at 48 kHz sample rate */ - const Word16 fb_exc[], /* i : FB excitation from the SWB part */ + const Word16 fb_exc[], /* i : FB excitation from the SWB part */ Word16 Q_fb_exc ); void fb_tbe_enc_ivas_fx( - Encoder_State *st, /* i/o: encoder state structure */ - const Word16 new_input[], /* i : i speech at 48 kHz sample rate Q_new_input*/ - const Word16 fb_exc[], /* i : FB excitation from the SWB part Q_fb_exc*/ + Encoder_State *st, /* i/o: encoder state structure */ + const Word16 new_input[], /* i : i speech at 48 kHz sample rate Q_new_input*/ + const Word16 fb_exc[], /* i : FB excitation from the SWB part Q_fb_exc*/ Word16 Q_fb_exc, Word16 Q_new_input ); @@ -196,54 +196,54 @@ Word16 ffr_getSfWord32( const Word32 *vector, /*!< Pointer to i vector */ const Word16 len /*!< Length of i vector */ ); + void find_tilt_ivas_fx( - const Word32 fr_bands[], /* i : energy in frequency bands q_fr_bands*/ - const Word16 q_fr_bands, /* i : Q of fr_bands Q0*/ - const Word32 bckr[], /* i : per band background noise energy estimate q_bckr*/ - const Word16 q_bckr, /* i : Q of bckr Q0*/ + const Word32 fr_bands[], /* i : energy in frequency bands q_fr_bands*/ + const Word16 q_fr_bands, /* i : Q of fr_bands Q0*/ + const Word32 bckr[], /* i : per band background noise energy estimate q_bckr*/ + const Word16 q_bckr, /* i : Q of bckr Q0*/ Word32 ee[2], /* o : lf/hf E ration for present frame Q_bckr*/ const Word16 pitch[3], /* i : open loop pitch values for 3 half-frames Q0*/ const Word16 voicing[3], /* i : normalized correlation for 3 half-frames Q15*/ - const Word32 *lf_E, /* i : per bin energy for low frequencies q_lf_E*/ - const Word16 q_lf_E, /* i : Q of lf_E */ - const Word16 corr_shift, /* i : normalized correlation correction Q15*/ - const Word16 bwidth, /* i : i signal bandwidth */ - const Word16 max_band, /* i : maximum critical band */ + const Word32 *lf_E, /* i : per bin energy for low frequencies q_lf_E*/ + const Word16 q_lf_E, /* i : Q of lf_E */ + const Word16 corr_shift, /* i : normalized correlation correction Q15*/ + const Word16 bwidth, /* i : i signal bandwidth */ + const Word16 max_band, /* i : maximum critical band */ Word32 hp_E[], /* o : energy in HF Q_new*/ - const Word16 codec_mode, /* i : MODE1 or MODE2 */ + const Word16 codec_mode, /* i : MODE1 or MODE2 */ Word32 *bckr_tilt_lt, Word16 Opt_vbr_mode ); void find_tilt_fx( - const Word32 fr_bands[], /* i : energy in frequency bands Q_new + Q_SCALE*/ - const Word32 bckr[], /* i : per band background noise energy estimate Q_new + Q_SCALE*/ - Word32 ee[2], /* o : lf/hf E ration for present frame Q6*/ - const Word16 pitch[3], /* i : open loop pitch values for 3 half-frames Q0*/ - const Word16 voicing[3], /* i : normalized correlation for 3 half-frames Q15*/ + const Word32 fr_bands[], /* i : energy in frequency bands Q_new + Q_SCALE*/ + const Word32 bckr[], /* i : per band background noise energy estimate Q_new + Q_SCALE*/ + Word32 ee[2], /* o : lf/hf E ration for present frame Q6*/ + const Word16 pitch[3], /* i : open loop pitch values for 3 half-frames Q0*/ + const Word16 voicing[3], /* i : normalized correlation for 3 half-frames Q15*/ const Word32 *lf_E, /* i : per bin energy for low frequencies Q_new + Q_SCALE - 2*/ - const Word16 corr_shift, /* i : normalized correlation correction Q15*/ + const Word16 corr_shift, /* i : normalized correlation correction Q15*/ const Word16 bwidth, /* i : input signal bandwidth Q0*/ const Word16 max_band, /* i : maximum critical band Q0*/ Word32 hp_E[], /* o : energy in HF Q_new + Q_SCALE*/ - const Word16 codec_mode, /* i : MODE1 or MODE2 Q0*/ - const Word16 Q_new, /* i : scaling factor */ - Word32 *bckr_tilt_lt /* i/o: lf/hf E ratio of background noise Q16*/ - , - Word16 Opt_vbr_mode /* Q0 */ + const Word16 codec_mode, /* i : MODE1 or MODE2 Q0*/ + const Word16 Q_new, /* i : scaling factor */ + Word32 *bckr_tilt_lt, /* i/o: lf/hf E ratio of background noise Q16*/ + Word16 Opt_vbr_mode /* Q0 */ ); /* o : coding type */ Word16 find_uv_ivas_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ - const Word16 *T_op_fr, /* i : pointer to adjusted fractional pitch (4 val.) Q6*/ - const Word16 *voicing_fr, /* i : refined correlation for each subframes Q15*/ - const Word16 *speech, /* i : pointer to speech signal for E computation Q_new*/ - const Word32 *ee, /* i : lf/hf Energy ratio for present frame Q6*/ + const Word16 *T_op_fr, /* i : pointer to adjusted fractional pitch (4 val.) Q6*/ + const Word16 *voicing_fr, /* i : refined correlation for each subframes Q15*/ + const Word16 *speech, /* i : pointer to speech signal for E computation Q_new*/ + const Word32 *ee, /* i : lf/hf Energy ratio for present frame Q6*/ Word32 *dE1X, /* o : sudden energy increase for S/M classifier Q13*/ - const Word16 corr_shift, /* i : normalized correlation correction in noise Q15*/ - const Word16 relE, /* i : relative frame energy Q8*/ - const Word16 Etot, /* i : total energy Q8*/ - const Word32 hp_E[], /* i : energy in HF q_hp_E*/ + const Word16 corr_shift, /* i : normalized correlation correction in noise Q15*/ + const Word16 relE, /* i : relative frame energy Q8*/ + const Word16 Etot, /* i : total energy Q8*/ + const Word32 hp_E[], /* i : energy in HF q_hp_E*/ Word16 *flag_spitch, /* i/o: flag to indicate very short stable pitch and high correlation Q0*/ const Word16 last_core_orig, /* i : original last core Q0*/ STEREO_CLASSIF_HANDLE hStereoClassif, /* i/o: stereo classifier structure */ @@ -252,23 +252,23 @@ Word16 find_uv_ivas_fx( /* o : coding type */ Word16 find_uv_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ - const Word16 *T_op_fr, /* i : pointer to adjusted fractional pitch (4 val.) Q6*/ - const Word16 *voicing_fr, /* i : refined correlation for each subframes Q15*/ - const Word16 *speech, /* i : pointer to speech signal for E computation Q_new*/ - const Word32 *ee, /* i : lf/hf Energy ratio for present frame Q6*/ - const Word16 corr_shift, /* i : normalized correlation correction in noise Q15*/ - const Word16 relE, /* i : relative frame energy Q8*/ - const Word16 Etot, /* i : total energy Q8*/ - const Word32 hp_E[], /* i : energy in HF Q_new + Q_SCALE*/ + Encoder_State *st_fx, /* i/o: encoder state structure */ + const Word16 *T_op_fr, /* i : pointer to adjusted fractional pitch (4 val.) Q6*/ + const Word16 *voicing_fr, /* i : refined correlation for each subframes Q15*/ + const Word16 *speech, /* i : pointer to speech signal for E computation Q_new*/ + const Word32 *ee, /* i : lf/hf Energy ratio for present frame Q6*/ + const Word16 corr_shift, /* i : normalized correlation correction in noise Q15*/ + const Word16 relE, /* i : relative frame energy Q8*/ + const Word16 Etot, /* i : total energy Q8*/ + const Word32 hp_E[], /* i : energy in HF Q_new + Q_SCALE*/ const Word16 Q_new, - Word16 *flag_spitch, /* i/o: flag to indicate very short stable pitch and high correlation Q0*/ + Word16 *flag_spitch, /* i/o: flag to indicate very short stable pitch and high correlation Q0*/ const Word16 shift, - const Word16 last_core_orig /* i : original last core Q0*/ + const Word16 last_core_orig /* i : original last core Q0*/ ); void fine_gain_quant_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const Word16 *ord, /* i : Indices for energy order */ const Word16 num_sfm, /* i : Number of bands */ const Word16 *gain_bits, /* i : Gain adjustment bits per sub band */ @@ -278,21 +278,21 @@ void fine_gain_quant_fx( void hq_core_enc_fx( Encoder_State *st_fx, - const Word16 *audio, /* i : i audio signal Q0 */ - const Word16 input_frame_orig, /* i : frame length Q0*/ - const Word16 hq_core_type, /* i : HQ core type Q0*/ + const Word16 *audio, /* i : i audio signal Q0*/ + const Word16 input_frame_orig, /* i : frame length Q0*/ + const Word16 hq_core_type, /* i : HQ core type Q0*/ const Word16 Voicing_flag, /* i : Voicing flag for FER method selection Q0*/ - const Word16 vad_hover_flag /* i : VAD hangover flag Q0*/ + const Word16 vad_hover_flag /* i : VAD hangover flag Q0*/ ); void long_enr_fx( - Encoder_State *st_fx, /* i/o: state structure */ + Encoder_State *st_fx, /* i/o: state structure */ const Word16 Etot, /* i : total channel E (see lib_enc\analy_sp.c) */ const Word16 localVAD_HE_SAD, /* i : HE-SAD flag without hangover */ Word16 high_lpn_flag ); void ivas_long_enr_fx( - Encoder_State *st_fx, /* i/o: state structure */ + Encoder_State *st_fx, /* i/o: state structure */ const Word32 Etot, /* i : total channel E (see lib_enc\analy_sp.c) Q=24*/ const Word16 localVAD_HE_SAD, /* i : HE-SAD flag without hangover */ Word16 high_lpn_flag, /* i : sp/mus LPN flag */ @@ -300,10 +300,9 @@ void ivas_long_enr_fx( const Word16 n_chan, /* i : number of channels */ const Word16 localVAD_HE_SAD_LR[], /* i : HE-SAD flag without hangover LR channels */ const Word16 Etot_LR[] /* i : total channel energy LR channels Q=8*/ - ); -/* o: MDCT A/B decision */ +/* o: MDCT A/B decision */ Word16 mdct_classifier_fx( const Word16 *Y, /* i: re[0], re[1], ..., re[n/2], im[n/2 - 1], im[n/2 - 2], ..., im[1] */ Encoder_State *st_fx, /* i/o: Encoder state variable */ @@ -371,7 +370,7 @@ void noise_est_fx( const Word32 Le_min_scaled, /*i : Minimum energy value in Q_new + Q_SCALE */ Word16 *sp_floor, /* o : noise floor estimate Q7 */ Word16 S_map[], /* o : short-term correlation map Q7 */ - const Word16 ini_frame /* i : Frame number (init) */ + const Word16 ini_frame /* i : Frame number (init) */ ); void noise_est_ivas_fx( @@ -402,19 +401,18 @@ void noise_est_ivas_fx( Word16 EspecdB[], /* i/o: log E spectrum (with f=0) of the current frame Q7 for multi harm */ Word16 *sp_floor, /* o : noise floor estimate Q7 */ Word16 S_map[], /* o : short-term correlation map Q7 */ - STEREO_CLASSIF_HANDLE hStereoClassif, /* i/o: stereo classifier structure */ - FRONT_VAD_ENC_HANDLE hFrontVad, /* i/o: front-VAD handle */ - const Word16 ini_frame /* i : Frame number (init) */ + STEREO_CLASSIF_HANDLE hStereoClassif, /* i/o: stereo classifier structure */ + FRONT_VAD_ENC_HANDLE hFrontVad, /* i/o: front-VAD handle */ + const Word16 ini_frame /* i : Frame number (init) */ ); void noise_est_pre_fx( const Word16 Etot, /* i : Energy of current frame */ const Word16 ini_frame_fx, /* i : Frame number (init) */ - NOISE_EST_HANDLE hNoiseEst, /* i/o: Noise estimation handle */ - const Word16 idchan, /* i : channel ID */ - const Word16 element_mode, /* i : element mode */ - const Word16 last_element_mode /* i : last element mode */ - + NOISE_EST_HANDLE hNoiseEst, /* i/o: Noise estimation handle */ + const Word16 idchan, /* i : channel ID */ + const Word16 element_mode, /* i : element mode */ + const Word16 last_element_mode /* i : last element mode */ ); void noise_est_pre_32fx( @@ -424,7 +422,6 @@ void noise_est_pre_32fx( const Word16 idchan, /* i : channel ID */ const Word16 element_mode, /* i : element mode */ const Word16 last_element_mode /* i : last element mode */ - ); void pitch_ol2_fx( @@ -481,17 +478,17 @@ void pitch_ol_init_fx( ); void Preemph_scaled( - Word16 new_speech[], /* i : Speech to scale already on 14 bits Q_new*/ - Word16 *Q_new, /* o : Scaling factor */ - Word16 *mem_preemph, /* i/o: Preemph memory Q(-1)*/ - Word16 *Q_max, /* i/o: Q_new limitation */ - const Word16 Preemph_factor, /* i : Preemphasis factor Q15*/ - const Word16 bits, /* i : Bit to remove from the output to (15-bits) */ - const Word16 bit1, /* i : Limit the output scaling to ((15-bits)-bit1) bits */ - const Word16 L_Q_mem, /* i : Number of old scaling to take into account Q0*/ - const Word16 Lframe, /* i : Frame length Q0*/ - const Word16 last_coder_type, /* i : coder_type Q0*/ - const Word16 Search_scaling /* i : enable the search of a proper scaling factor Q0*/ + Word16 new_speech[], /* i : Speech to scale already on 14 bits Q_new*/ + Word16 *Q_new, /* o : Scaling factor */ + Word16 *mem_preemph, /* i/o: Preemph memory Q(-1)*/ + Word16 *Q_max, /* i/o: Q_new limitation */ + const Word16 Preemph_factor, /* i : Preemphasis factor Q15*/ + const Word16 bits, /* i : Bit to remove from the output to (15-bits) */ + const Word16 bit1, /* i : Limit the output scaling to ((15-bits)-bit1) bits */ + const Word16 L_Q_mem, /* i : Number of old scaling to take into account Q0*/ + const Word16 Lframe, /* i : Frame length Q0*/ + const Word16 last_coder_type, /* i : coder_type Q0*/ + const Word16 Search_scaling /* i : enable the search of a proper scaling factor Q0*/ ); void Scale_mem_enc( @@ -530,10 +527,10 @@ void Scale_wsp( Word16 *old_wsp, /* i/o: Old weighted speech buffer */ Word16 *mem_decim2, /* i/o: Decimation buffer */ Word16 *old_wsp12k8, /* i/o: wsp memory @ 12.8 kHz used in pitol2 */ - const Word16 Len_p_look /* i : L_frame + look ahead Q0*/ + const Word16 Len_p_look /* i : L_frame + look ahead Q0*/ ); -/* o : classification for current frames */ +/* o : classification for current frames */ Word16 signal_clas_fx( Encoder_State *st, /* i/o: encoder state structure */ const Word16 *speech, /* i : pointer to speech signal for E computation */ @@ -543,7 +540,7 @@ Word16 signal_clas_fx( Word16 *uc_clas /* o : temporary classification used in music/speech class*/ ); -/* o : classification for current frames */ +/* o : classification for current frames */ Word16 signal_clas_ivas_fx( Encoder_State *st, /* i/o: encoder state structure */ const Word16 *speech, /* i : pointer to speech signal for E computation */ @@ -554,27 +551,27 @@ Word16 signal_clas_ivas_fx( ); void speech_music_classif_fx( - Encoder_State *st, /* i/o: state structure */ - const Word16 *new_inp, /* i : new input signal */ - const Word16 *inp, /* i : input signal to locate attach position */ - const Word16 localVAD_HE_SAD, /* i : HE-SAD flag without hangover */ - const Word16 lsp_new[M], /* i : LSPs in current frame Q15 */ - const Word16 cor_map_sum, /* i : correlation map sum (from multi-harmonic anal.)Q8*/ - const Word32 epsP[M + 1], /* i : LP prediciton error Q_esp*/ - const Word32 PS[], /* i : energy spectrum Q_new+QSCALE*/ - const Word16 Etot, /* i : total frame energy Q8 */ - const Word16 old_cor, /* i : max correlation from previous frame Q15 */ + Encoder_State *st, /* i/o: state structure */ + const Word16 *new_inp, /* i : new input signal */ + const Word16 *inp, /* i : input signal to locate attach position */ + const Word16 localVAD_HE_SAD, /* i : HE-SAD flag without hangover */ + const Word16 lsp_new[M], /* i : LSPs in current frame Q15 */ + const Word16 cor_map_sum, /* i : correlation map sum (from multi-harmonic anal.) Q8*/ + const Word32 epsP[M + 1], /* i : LP prediciton error Q_esp*/ + const Word32 PS[], /* i : energy spectrum Q_new+QSCALE*/ + const Word16 Etot, /* i : total frame energy Q8 */ + const Word16 old_cor, /* i : max correlation from previous frame Q15 */ Word16 *attack_flag, /* o : flag to indicate if attack is to be treated by TC or GSC */ - Word16 non_sta, /* i : unbound non-stationarity for sp/mus classifier */ - Word16 relE, /* i : relative frame energy */ - Word16 Q_esp, /* i : scaling of esP */ - Word16 Q_inp, /* i : scaling of input */ - Word16 *high_lpn_flag_ptr, /* o : noise log prob flag for NOISE_EST */ - Word16 flag_spitch /* i : flag to indicate very short stable pitch */ + Word16 non_sta, /* i : unbound non-stationarity for sp/mus classifier */ + Word16 relE, /* i : relative frame energy */ + Word16 Q_esp, /* i : scaling of esP */ + Word16 Q_inp, /* i : scaling of input */ + Word16 *high_lpn_flag_ptr, /* o : noise log prob flag for NOISE_EST */ + Word16 flag_spitch /* i : flag to indicate very short stable pitch */ ); void StableHighPitchDetect_fx( - Word16 *flag_spitch, /* o : flag to indicate very short stable pitch */ + Word16 *flag_spitch, /* o : flag to indicate very short stable pitch*/ Word16 pitch[], /* i/o: OL pitch buffer */ const Word16 voicing[], /* i : OL pitch gains */ const Word16 wsp[], /* i : weighted speech */ @@ -606,10 +603,10 @@ void StableHighPitchDetect_ivas_fx( void swb_bwe_enc_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ - Word16 *old_input_12k8_fx, /* i : i signal @12.8kHz for SWB BWE */ - Word16 *old_input_16k_fx, /* i : i signal @16kHz for SWB BWE */ + Word16 *old_input_12k8_fx, /* i : i signal @12.8kHz for SWB BWE */ + Word16 *old_input_16k_fx, /* i : i signal @16kHz for SWB BWE */ const Word16 *old_syn_12k8_16k_fx, /* i : ACELP core synthesis at 12.8kHz or 16kHz */ - const Word16 *new_swb_speech_fx, /* i : original i signal at 32kHz */ + const Word16 *new_swb_speech_fx, /* i : original i signal at 32kHz */ Word16 *shb_speech_fx, /* i : SHB target signal (6-14kHz) at 16kHz */ const Word16 coder_type, /* i : coding type */ Word16 Q_shb_speech, @@ -617,9 +614,9 @@ void swb_bwe_enc_fx( void swb_bwe_enc_ivas_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ - const Word16 last_element_mode, /* i : last element mode */ - Word16 *old_input_12k8_fx, /* i : input signal @12.8kHz for SWB BWE */ - Word16 *old_input_16k_fx, /* i : input signal @16kHz for SWB BWE */ + const Word16 last_element_mode, /* i : last element mode */ + Word16 *old_input_12k8_fx, /* i : input signal @12.8kHz for SWB BWE */ + Word16 *old_input_16k_fx, /* i : input signal @16kHz for SWB BWE */ const Word16 *old_syn_12k8_16k_fx, /* i : ACELP core synthesis at 12.8kHz or 16kHz */ const Word16 *new_swb_speech_fx, /* i : original input signal at 32kHz */ const Word16 Q_new_swb_speech, /* i : Q for new_swb_speech_fx */ @@ -635,19 +632,19 @@ void swb_CNG_enc_fx( void swb_CNG_enc_ivas_fx( Encoder_State *st, /* i/o: State structure */ - const Word16 *shb_speech_fx, /* i : SHB target signal (6-14kHz) at 16kHz Q0 */ + const Word16 *shb_speech_fx, /* i : SHB target signal (6-14kHz) at 16kHz Q0 */ const Word16 *syn_12k8_16k_fx /* i : ACELP core synthesis at 12.8kHz or 16kHz Q0 */ ); void swb_pre_proc_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ - const Word16 *input_fx, /* i : original i signal */ - Word16 *new_swb_speech_fx, /* o : original i signal at 32kHz */ + const Word16 *input_fx, /* i : original i signal */ + Word16 *new_swb_speech_fx, /* o : original i signal at 32kHz */ Word16 *shb_speech_fx, /* o : SHB target signal (6-14kHz) at 16kHz */ Word16 *Q_shb_spch, /* o : shb target signal Q factor */ - Word32 realBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : real buffer */ - Word32 imagBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : imag buffer */ - const CLDFB_SCALE_FACTOR *cldfbScale /* i : scale data of real and imag CLDFB buffers */ + Word32 realBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : real buffer */ + Word32 imagBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : imag buffer */ + const CLDFB_SCALE_FACTOR *cldfbScale /* i : scale data of real and imag CLDFB buffers*/ ); void InitSWBencBufferStates_fx( @@ -658,19 +655,19 @@ void InitSWBencBufferStates_fx( void swb_tbe_enc_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 coder_type, /* i : coding type */ - Word16 *new_speech_fx, /* i : original i signal */ + Word16 *new_speech_fx, /* i : original i signal */ Word32 *bwe_exc_extended_fx, /* i : bandwidth extended excitation */ const Word16 voice_factors_fx[], /* i : voicing factors */ Word16 *White_exc16k_fx, /* o : shaped white excitation for the FB TBE */ Word16 *Q_white_exc, /* o : generated white noise for FB Q factor */ Word16 Q_bwe_exc, /* i : bandwidth extended excitation Q factor */ - Word16 Q_shb, /* i : SHB target Q factor */ + Word16 Q_shb, /* i : SHB target Q factor */ Word16 *voicing_fx, /* i : OL maximum normalized correlation */ const Word16 pitch_buf[] /* i : pitch for each subframe */ ); void swb_tbe_enc_ivas_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ STEREO_ICBWE_ENC_HANDLE hStereoICBWE, /* i/o: IC-BWE state structure */ Word16 *shb_speech_fx, /* i : SHB target signal (6-14kHz) at 16kHz Q_shb */ Word32 *bwe_exc_extended, /* i : bandwidth extended exciatation 2 * Q_new */ @@ -716,26 +713,26 @@ void vad_param_updt_fx( Encoder_State *st_fx, /* i/o: state structure */ const Word16 old_pitch1, /* i : OL pitch value from last frame */ const Word16 corr_shift, /* i : correlation shift Q15*/ - const Word16 corr_shiftR, /* i : correlation shift */ + const Word16 corr_shiftR, /* i : correlation shift */ const Word16 Az[], /* i: a coeffs Q12 */ - FRONT_VAD_ENC_HANDLE hFrontVad[], /* i/o: front-VAD handles */ - const Word16 n_channels /* i : number of channels */ + FRONT_VAD_ENC_HANDLE hFrontVad[], /* i/o: front-VAD handles */ + const Word16 n_channels /* i : number of channels */ ); void wb_bwe_enc_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ - const Word16 *new_wb_speech_fx, /* i : original i signal at 16kHz */ + const Word16 *new_wb_speech_fx, /* i : original i signal at 16kHz */ Word16 coder_type /* i : coding type */ ); void wb_bwe_enc_ivas_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ - const Word16 *new_wb_speech_fx /* i : original i signal at 16kHz */ + const Word16 *new_wb_speech_fx /* i : original i signal at 16kHz */ ); void wb_pre_proc_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ - const Word16 *new_inp_resamp16k, /* i : original i signal */ + Encoder_State *st_fx, /* i/o: encoder state structure */ + const Word16 *new_inp_resamp16k, /* i : original i signal */ Word16 *hb_speech /* o : HB target signal (6-8kHz) at 16kHz */ ); @@ -767,46 +764,46 @@ void wb_tbe_enc_ivas_fx( ); Word16 wb_vad_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ - const Word32 fr_bands[], /* i : per band i energy (contains 2 vectors) Q_new+QSCALE*/ + Encoder_State *st_fx, /* i/o: encoder state structure */ + const Word32 fr_bands[], /* i : per band i energy (contains 2 vectors) Q_new+QSCALE*/ Word16 *noisy_speech_HO, /* o : SC-VBR noisy speech HO flag */ Word16 *clean_speech_HO, /* o : SC-VBR clean speech HO flag */ Word16 *NB_speech_HO, /* o : SC-VBR NB speech HO flag */ Word16 *snr_sum_he, /* o : Output snr_sum as weighted spectral measure*/ Word16 *localVAD_HE_SAD, Word16 *flag_noisy_speech_snr, /* o : */ - const Word16 Q_new, /* i : scaling factor Q0 */ - VAD_HANDLE hVAD, /* i/o: VAD data handle */ - NOISE_EST_HANDLE hNoiseEst, /* i : Noise estimation handle */ + const Word16 Q_new, /* i : scaling factor Q0 */ + VAD_HANDLE hVAD, /* i/o: VAD data handle */ + NOISE_EST_HANDLE hNoiseEst, /* i : Noise estimation handle */ Word16 lp_speech, /* i : long term active speech energy average */ Word16 lp_noise /* i : long term noise energy */ ); Word16 wb_vad_ivas_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ - const Word32 fr_bands[], /* i : per band i energy (contains 2 vectors) q_fr_bands*/ - const Word16 q_fr_bands, /* i : Q of fr_bands */ + Encoder_State *st_fx, /* i/o: encoder state structure */ + const Word32 fr_bands[], /* i : per band i energy (contains 2 vectors) q_fr_bands*/ + const Word16 q_fr_bands, /* i : Q of fr_bands */ Word16 *noisy_speech_HO, /* o : SC-VBR noisy speech HO flag */ Word16 *clean_speech_HO, /* o : SC-VBR clean speech HO flag */ Word16 *NB_speech_HO, /* o : SC-VBR NB speech HO flag */ Word16 *snr_sum_he, /* o : Output snr_sum as weighted spectral measure*/ Word16 *localVAD_HE_SAD, Word16 *flag_noisy_speech_snr, /* o : */ - VAD_HANDLE hVAD, /* i/o: VAD data handle */ - NOISE_EST_HANDLE hNoiseEst, /* i : Noise estimation handle */ + VAD_HANDLE hVAD, /* i/o: VAD data handle */ + NOISE_EST_HANDLE hNoiseEst, /* i : Noise estimation handle */ Word16 lp_speech, /* i : long term active speech energy average */ Word16 lp_noise /* i : long term noise energy */ ); Word32 construct_snr_thresh_fx( - Word16 sp_center[], /*(i) spectral center Q10*/ - Word32 snr_flux, /*(i) snr flux Q25*/ - Word32 lt_snr, /*(i) long time time domain snr Q25*/ - Word32 l_snr, /*(i) long time frequency domain snr Q25*/ - Word32 continuous_speech_num, /*(i) amount of continuous speech frames Q0*/ - Word16 continuous_noise_num, /*(i) amount of continuous noise frames Q0*/ - Word32 fg_energy_est_start, /*(i) whether if estimated energy Q0*/ - Word16 bw_index /*(i) band width index Q0*/ + Word16 sp_center[], /*(i) spectral center Q10*/ + Word32 snr_flux, /*(i) snr flux Q25*/ + Word32 lt_snr, /*(i) long time time domain snr Q25*/ + Word32 l_snr, /*(i) long time frequency domain snr Q25*/ + Word32 continuous_speech_num, /*(i) amount of continuous speech frames Q0*/ + Word16 continuous_noise_num, /*(i) amount of continuous noise frames Q0*/ + Word32 fg_energy_est_start, /*(i) whether if estimated energy Q0*/ + Word16 bw_index /*(i) band width index Q0*/ ); void sc_vbr_enc_init_fx( @@ -825,12 +822,12 @@ void attenuateNbSpectrum_fx( /* o : pitch gain (0..GAIN_PIT_MAX) */ Word16 corr_xy1_fx( - const Word16 xn_1[], /* i : target signal */ - const Word16 y1_1[], /* i : filtered adaptive codebook excitation */ - Word16 g_corr[], /* o : correlations and -2 */ - const Word16 L_subfr, /* i : vector length */ - const Word16 norm_flag, /* i : flag for constraining pitch contribution */ - Flag *Overflow_out /* o : propagating the Overflow flag to upper level */ + const Word16 xn_1[], /* i : target signal */ + const Word16 y1_1[], /* i : filtered adaptive codebook excitation */ + Word16 g_corr[], /* o : correlations and -2 */ + const Word16 L_subfr, /* i : vector length */ + const Word16 norm_flag, /* i : flag for constraining pitch contribution */ + Flag *Overflow_out /* o : propagating the Overflow flag to upper level */ ); Word16 E_ACELP_indexing_fx( @@ -850,14 +847,14 @@ void fcb_pulse_track_joint_fx( Word16 gain_quant_fx( Word32 *gain, /* i/o: quantized gain */ Word16 *gain16, - const Word16 c_min, /* i: log10 of lower limit in Q14 */ - const Word16 c_max, /* i: log10 of upper limit in Q13 */ + const Word16 c_min, /* i: log10 of lower limit in Q14 */ + const Word16 c_max, /* i: log10 of upper limit in Q13 */ const Word16 bits, /* i: number of bits to quantize */ Word16 *expg ); void gsc_enc_fx( - Encoder_State *st_fx, /* i/o: State structure */ - Word16 res_dct_in[], /* i : dct of residual signal */ + Encoder_State *st_fx, /* i/o: State structure */ + Word16 res_dct_in[], /* i : dct of residual signal */ Word16 exc_dct_in[], /* i/o: dct of pitch-only excitation / total excitation */ const Word16 Diff_len, const Word16 bits_used, @@ -888,10 +885,10 @@ void LPDmem_enc_init_ivas_fx( ); void lsf_end_enc_fx( - Encoder_State *st, /* i/o: encoder state structure */ - const Word16 *lsf, /* i : LSF in the frequency domain (0..6400) */ - Word16 *qlsf, /* o : quantized LSF */ - const Word16 nBits_in, /* i : number of bits to spend on ISF quantization */ + Encoder_State *st, /* i/o: encoder state structure */ + const Word16 *lsf, /* i : LSF in the frequency domain (0..6400) */ + Word16 *qlsf, /* o : quantized LSF */ + const Word16 nBits_in, /* i : number of bits to spend on ISF quantization */ const Word16 coder_type_org, /* i : coding type */ Word16 Q_ener, /* i : Q valuen for Bin_Ener */ Word16 force_sf, /* i : Force safety-net usage if coding type supports */ @@ -902,10 +899,10 @@ void lsf_end_enc_fx( ); void lsf_end_enc_ivas_fx( - Encoder_State *st, /* i/o: encoder state structure */ - const Word16 *lsf, /* i : LSF in the frequency domain (0..6400) */ - Word16 *qlsf, /* o : quantized LSF */ - const Word16 nBits_in, /* i : number of bits to spend on ISF quantization */ + Encoder_State *st, /* i/o: encoder state structure */ + const Word16 *lsf, /* i : LSF in the frequency domain (0..6400) */ + Word16 *qlsf, /* o : quantized LSF */ + const Word16 nBits_in, /* i : number of bits to spend on ISF quantization */ const Word16 coder_type_org, /* i : coding type */ Word16 Q_ener, /* i : Q valuen for Bin_Ener */ Word16 force_sf, /* i : Force safety-net usage if coding type supports */ @@ -913,7 +910,7 @@ void lsf_end_enc_ivas_fx( Word16 *no_indices, Word16 *bits_param_lpc, Word16 coder_type_raw, /* i : Coder type (LSF coder_type have some special cases)*/ - const Word16 tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ + const Word16 tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ ); void Mode2_abs_pit_enc_fx( @@ -957,11 +954,12 @@ void norm_corr_ivas_fx( Word16 peak_avrg_ratio_fx( const Word32 total_brate, /* Q0 */ - const Word32 *input_hi_fx, /* i : i signal Q_coeff*/ + const Word32 *input_hi_fx, /* i : i signal Q_coeff*/ const Word16 length, /* i : number of coefficients Q0*/ Word16 *mode_count, /* i/o: HQ_HARMONIC mode count Q0*/ Word16 *mode_count1, /* i/o: HQ_NORMAL mode count Q0*/ Word16 Q_coeff ); + Word16 peak_avrg_ratio_ivas_fx( const Word32 total_brate, /* Q0 */ const Word32 *input_hi_fx, /* i : i signal Q_coeff*/ @@ -969,6 +967,7 @@ Word16 peak_avrg_ratio_ivas_fx( Word16 *mode_count, /* i/o: HQ_HARMONIC mode count Q0*/ Word16 *mode_count1, /* i/o: HQ_NORMAL mode count Q0*/ Word16 Q_coeff ); + void hvq_classifier_ivas_fx( const Word32 *input, /* i : input signal Q12 */ Word16 *prev_Npeaks, /* i/o: Peak number memory Q0 */ @@ -982,8 +981,9 @@ void hvq_classifier_ivas_fx( Word16 *hvq_hangover, /* i/o: Mode-switch hangover Q0 */ Word32 *L_pe_gains /* o : peak gains Q12 */ ); + void pit16k_Q_enc_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const Word16 nBits, /* i : # of Q bits */ const Word16 limit_flag, /* i : restrained(0) or extended(1) Q limits */ const Word16 T0, /* i : integer pitch lag */ @@ -991,23 +991,23 @@ void pit16k_Q_enc_fx( Word16 *T0_min, /* i/o: delta search min */ Word16 *T0_max /* o : delta search max */ ); -/* o : chosen integer pitch lag */ + +/* o : chosen integer pitch lag */ Word16 pitch_fr4_fx( - const Word16 exc[], /* i : excitation buffer Q_new*/ - const Word16 xn[], /* i : target signal Q_new-1+shift*/ - const Word16 h[], /* i : weighted synthesis filter impulse response Q(14+shift)*/ - const Word16 t0_min, /* i : minimum value in the searched range. Q0*/ - const Word16 t0_max, /* i : maximum value in the searched range. Q0*/ - Word16 *pit_frac, /* o : chosen fraction (0, 1, 2 or 3) */ - const Word16 i_subfr, /* i : flag to first subframe */ - const Word16 limit_flag, /* i : flag for limits (0=restrained, 1=extended) */ - const Word16 t0_fr2, /* i : minimum value for resolution 1/2 */ - const Word16 t0_fr1, /* i : minimum value for resolution 1 */ - const Word16 L_frame, /* i : length of the frame */ - const Word16 L_subfr /* i : size of subframe */ - , - const Word16 element_mode, /* i : mode element */ - const Word16 Q_new /* i : scaling factor */ + const Word16 exc[], /* i : excitation buffer Q_new*/ + const Word16 xn[], /* i : target signal Q_new-1+shift*/ + const Word16 h[], /* i : weighted synthesis filter impulse response Q(14+shift)*/ + const Word16 t0_min, /* i : minimum value in the searched range. Q0*/ + const Word16 t0_max, /* i : maximum value in the searched range. Q0*/ + Word16 *pit_frac, /* o : chosen fraction (0, 1, 2 or 3) */ + const Word16 i_subfr, /* i : flag to first subframe */ + const Word16 limit_flag, /* i : flag for limits (0=restrained, 1=extended) */ + const Word16 t0_fr2, /* i : minimum value for resolution 1/2 */ + const Word16 t0_fr1, /* i : minimum value for resolution 1 */ + const Word16 L_frame, /* i : length of the frame */ + const Word16 L_subfr, /* i : size of subframe */ + const Word16 element_mode, /* i : mode element */ + const Word16 Q_new /* i : scaling factor */ ); void pit_Q_enc_fx( @@ -1059,7 +1059,7 @@ Word16 WB_BWE_encoding_ivas_fx( void calculate_hangover_attenuation_gain_fx( Encoder_State *st, /* i : encoder state structure */ Word16 *att, /* o : attenuation factor */ - const Word16 vad_hover_flag /* i : VAD hangover flag */ + const Word16 vad_hover_flag /* i : VAD hangover flag */ ); /*transient_detection.h*/ @@ -1093,12 +1093,11 @@ void RunTransientDetection_fx( const Word16 nSamplesAvailable, TRAN_DET_HANDLE hTranDet ); - void RunTransientDetection_ivas_fx( - Word16 *input_fx, /* i : input signal Q: q_input */ + Word16 *input_fx, /* i : input signal Q: q_input */ const Word16 length, /* i : frame length */ TRAN_DET_HANDLE hTranDet, /* i/o: transient detection handle */ - Word16 q_input /*i: stores q for input_fx*/ + Word16 q_input /* i : stores q for input_fx */ ); /** Get the average temporal flatness measure using subblock energies aligned with the TCX. @@ -1131,7 +1130,6 @@ Word16 GetTCXMaxenergyChange_fx( const Word16 nCurrentSubblocks, const Word16 nPrevSubblocks ); - Word16 GetTCXMaxenergyChange_ivas_fx( TRAN_DET_HANDLE hTranDet, const Word8 isTCX10, @@ -1219,24 +1217,24 @@ void HQ_core_enc_init_fx( void AVQ_cod_lpc_fx( Word16 *nvec, /* i : vector to quantize (normalized) */ - Word16 *nvecq, /* o : quantized vector */ - Word16 *indx, /* o : index[] (4 bits per words) */ + Word16 *nvecq, /* o : quantized vector */ + Word16 *indx, /* o : index[] (4 bits per words) */ Word16 Nsv /* i : number of subvectors (lg=Nsv*8) */ ); void ProcessIGF_ivas_fx( Encoder_State *st, /* i : Encoder state */ - Word16 powerSpec_len, /* i : length of pPowerSpectrum buffer */ + Word16 powerSpec_len, /* i : length of pPowerSpectrum buffer */ Word32 *pMDCTSpectrum, /* i : MDCT spectrum */ - Word16 *q_spectrum, /* i/o: Q of spectrum */ + Word16 *q_spectrum, /* i/o: Q of spectrum */ const Word32 *pITFMDCTSpectrum, /* i : MDCT spectrum fir ITF */ - const Word16 q_ITFMDCTSpectrum, /* i : Q of MDCT spectrum fir ITF */ + const Word16 q_ITFMDCTSpectrum, /* i : Q of MDCT spectrum fir ITF */ Word32 *pPowerSpectrum, /* i : MDCT^2 + MDST^2 spectrum, or estimate */ - Word16 *q_powerSpec, /* i/o: Q of power spectrum */ + Word16 *q_powerSpec, /* i/o: Q of power spectrum */ const Word16 isTCX20, /* i : flag indicating if the input is TCX20 or TCX10/2xTCX5 */ const Word16 frameno, /* i : flag indicating index of current subframe */ - const Word16 sp_aud_decision0, /* i : first stage switching decision */ - const Word16 vad_hover_flag /* i : VAD hangover flag */ + const Word16 sp_aud_decision0, /* i : first stage switching decision */ + const Word16 vad_hover_flag /* i : VAD hangover flag */ ); void ProcessIGF_fx( @@ -1253,7 +1251,7 @@ void ProcessIGF_fx( ); void AnalyzePowerSpectrum_fx( - Encoder_State *st, /* i/o: encoder states */ + Encoder_State *st, /* i/o: encoder states */ Word16 L_frame, /* i : frame length */ Word16 L_frameTCX, /* i : full band frame length */ Word16 left_overlap, /* i : left overlap length */ @@ -1265,7 +1263,7 @@ void AnalyzePowerSpectrum_fx( Word16 *powerSpec_e ); void AnalyzePowerSpectrum_ivas_fx( - Encoder_State *st, /* i/o: encoder states */ + Encoder_State *st, /* i/o: encoder states */ Word16 L_frame, /* i : frame length */ Word16 L_frameTCX, /* i : full band frame length */ Word16 left_overlap, /* i : left overlap length */ @@ -1290,30 +1288,33 @@ void AdaptLowFreqEmph_fx( /* o : SQ gain */ Word16 SQ_gain_fx( - Word32 x[], /* i : vector to quantize */ - Word16 x_e, /* i : exponent */ - Word16 nbitsSQ, /* i : number of bits targeted */ - Word16 lg, /* i : vector size (2048 max) */ - Word16 *gain_e ); /* o : SQ gain exponent */ + Word32 x[], /* i : vector to quantize */ + Word16 x_e, /* i : exponent */ + Word16 nbitsSQ, /* i : number of bits targeted */ + Word16 lg, /* i : vector size (2048 max) */ + Word16 *gain_e /* o : SQ gain exponent */ +); /* o : SQ gain */ Word16 SQ_gain_ivas_fx( - Word32 x[], /* i : vector to quantize */ - Word16 x_e, /* i : exponent */ - Word16 nbitsSQ, /* i : number of bits targeted */ - Word16 lg, /* i : vector size (2048 max) */ - Word16 *gain_e ); /* o : SQ gain exponent */ + Word32 x[], /* i : vector to quantize */ + Word16 x_e, /* i : exponent */ + Word16 nbitsSQ, /* i : number of bits targeted */ + Word16 lg, /* i : vector size (2048 max) */ + Word16 *gain_e /* o : SQ gain exponent */ +); /* o : SQ gain */ Word16 SQ_gain_estimate_fx( - Word32 x[], /* i : vector to quantize */ - Word16 x_e, /* i : exponent */ - Word16 nbitsSQ, /* i : number of bits targeted */ - Word16 lg, /* i : vector size (2048 max) */ - Word16 *gain_e ); /* o : SQ gain exponent */ + Word32 x[], /* i : vector to quantize */ + Word16 x_e, /* i : exponent */ + Word16 nbitsSQ, /* i : number of bits targeted */ + Word16 lg, /* i : vector size (2048 max) */ + Word16 *gain_e /* o : SQ gain exponent */ +); void tcx_scalar_quantization_fx( - Word32 *x, /* i: i coefficients */ + Word32 *x, /* i: i coefficients */ Word16 x_e, /* i: exponent */ Word16 *xq, /* o: quantized coefficients */ Word16 L_frame, /* i: frame length */ @@ -1324,7 +1325,7 @@ void tcx_scalar_quantization_fx( const Word16 alfe_flag ); Word16 tcx_scalar_quantization_rateloop_fx( - Word32 *x, /* i : i coefficients */ + Word32 *x, /* i : i coefficients */ Word16 x_e, /* i : exponent */ Word16 *xq, /* o : quantized coefficients */ Word16 L_frame, /* i : frame length */ @@ -1396,29 +1397,30 @@ void tcx_noise_factor_ivas_fx( ); void tcx_encoder_memory_update_ivas_fx( - Word16 *wsig, /* i : target weighted signal, Q_new */ - Word16 *xn_buf, /* i/o: mdct output buffer/time domain weigthed synthesis, Q_new */ - Word16 L_frame_glob, /* i: global frame length */ - const Word16 *Ai, /* i: Unquantized (interpolated) LPC coefficients, Q12 */ - const Word16 *A, /* i: Quantized LPC coefficients, Q = 14 - norm_s(A[0]) */ - Word16 preemph, /* i: preemphasis factor, Q15 */ - LPD_state *LPDmem, /* i/o: coder memory state */ + Word16 *wsig, /* i : target weighted signal, Q_new */ + Word16 *xn_buf, /* i/o: mdct output buffer/time domain weigthed synthesis, Q_new */ + Word16 L_frame_glob, /* i : global frame length */ + const Word16 *Ai, /* i : Unquantized (interpolated) LPC coefficients, Q12 */ + const Word16 *A, /* i : Quantized LPC coefficients, Q = 14 - norm_s(A[0]) */ + Word16 preemph, /* i : preemphasis factor, Q15 */ + LPD_state *LPDmem, /* i/o: coder memory state */ Encoder_State *st, Word16 *synthout, /* Q_new */ Word16 Q_new ); void tcx_encoder_memory_update_fx( - Word16 *wsig, /* i: targert weighted signal */ + Word16 *wsig, /* i: targert weighted signal */ Word16 *xn_buf, /* i/o: mdct output buffer/TD weigthed synthesis */ Word16 L_frame_glob, /* i: global frame length */ const Word16 *Ai, /* i: Unquantized (interpolated) LPC coefficients */ const Word16 *A, /* i: Quantized LPC coefficients */ - Word16 preemph, /* i: preemphasis factor*/ + Word16 preemph, /* i: preemphasis factor */ LPD_state *LPDmem, /* i/o: coder memory state */ Encoder_State *st, Word16 *synthout, /* o: synthesis signal */ Word16 Q_new, Word16 shift ); + Word16 tcx_ari_res_Q_spec_fx( const Word32 x_orig[], /* i: original spectrum Q31-e */ Word16 x_orig_e, /* i: original spectrum exponent Q0 */ @@ -1558,6 +1560,7 @@ void Mode2_pit_encode_fx( Word16 pit_fr2, Word16 pit_max, Word16 pit_res_max ); + void E_ACELP_4tsearch_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, @@ -1567,6 +1570,7 @@ void E_ACELP_4tsearch_fx( Word16 ind[] /*Q0*/, Word16 y[] /*Qy*/, const Word16 element_mode ); + void E_ACELP_4t_fx( Word16 dn[], /* Qdn */ Word16 cn[] /* Q_xn */, @@ -1585,13 +1589,13 @@ void E_ACELP_4t_fx( ); void E_ACELP_innovative_codebook_fx( - Word16 *exc, /* i : pointer to the excitation frame Q_new */ + Word16 *exc, /* i : pointer to the excitation frame Q_new */ Word16 T0, /* i : integer pitch lag Q0 */ Word16 T0_frac, /* i : fraction of lag Q0 */ Word16 T0_res, /* i : pitch resolution Q0 */ Word16 pitch_gain, /* i : adaptive codebook gain 1Q14 */ Word16 tilt_code, /* i : tilt factor Q15 */ - ACELP_config *acelp_cfg, /* i/o: configuration of the ACELP */ + ACELP_config *acelp_cfg, /* i/o: configuration of the ACELP */ Word16 i_subfr, /* i : subframe index */ const Word16 *Aq, /* i : quantized LPC coefficients 3Q12 */ Word16 *h1, /* i : impulse response of weighted synthesis filter 1Q14+shift */ @@ -1610,55 +1614,27 @@ void E_ACELP_innovative_codebook_fx( void CalculateTnsFilt_fx( STnsConfig const *pTnsConfig, /* i : TNS Configuration struct */ - const Word32 pSpectrum[], /* i : MDCT spectrum Qx*/ + const Word32 pSpectrum[], /* i : MDCT spectrum Qx*/ const Word16 pSpectrum_e, STnsData *pTnsData /* o : TNS data struct */ ); -/** Detect TNS parameters. - * Detects if TNS should be used and fills TNS data in pTnsData. - * @param pTnsConfig TNS configuration. - * @param pSpectrum Spectrum lines. - TNS is tested on the spectrum defined by pSpectrum. - * @param sbCnt Number of active subbands. - * @param pTnsData TNS data is filled with sensible information. - * @return Returns 1 if Tns should be used, otherwise 0. - */ Word16 DetectTnsFilt_fx( STnsConfig const *pTnsConfig, Word32 const pSpectrum[], STnsData *pTnsData, Word16 *predictionGain ); -/** Detect TNS parameters. -* Detects if TNS should be used and fills TNS data in pTnsData. -* @param pTnsConfig TNS configuration. -* @param pSpectrum Spectrum lines. -TNS is tested on the spectrum defined by pSpectrum. -* @param sbCnt Number of active subbands. -* @param pTnsData TNS data is filled with sensible information. -* @return Returns 1 if Tns should be used, otherwise 0. -*/ Word16 DetectTnsFilt_ivas_fx( - STnsConfig const *pTnsConfig, /* i : TNS Configuration struct */ - Word32 const pSpectrum[], /* i : MDCT spectrum Q=Qx */ - STnsData *pTnsData, /* o : TNS data struct */ - TRAN_DET_HANDLE hTranDet, /* i : transient detection handle */ - Word8 isTCX10, /* i : TCX10 or TCX20? */ - Word16 ltp_gain, /* i : LTP gain Q=15 */ - Word16 *predictionGain /* o : TNS prediction gain Q=7 */ -); - - -/** Write TNS data into a stream of integers. - * Writes TNS data into a stream of integers. - * @param pTnsConfig TNS configuration. - * @param pTnsData TNS data to be written to a bitstream. - * @param stream Output stream of integers. - * @param pnSize Set to the number of elements written to the stream. - * @param pnBits Set to the number of required. - * @return 0 on success, otherwise 1. - */ + STnsConfig const *pTnsConfig, /* i : TNS Configuration struct */ + Word32 const pSpectrum[], /* i : MDCT spectrum Q=Qx */ + STnsData *pTnsData, /* o : TNS data struct */ + TRAN_DET_HANDLE hTranDet, /* i : transient detection handle */ + Word8 isTCX10, /* i : TCX10 or TCX20? */ + Word16 ltp_gain, /* i : LTP gain Q=15 */ + Word16 *predictionGain /* o : TNS prediction gain Q=7 */ +); + Word16 EncodeTnsData_fx( STnsConfig const *pTnsConfig, STnsData const *pTnsData, @@ -1666,15 +1642,6 @@ Word16 EncodeTnsData_fx( Word16 *pnSize, Word16 *pnBits ); -/** Write TNS data into a bitstream. - * Writes TNS data into a bitstream. - * @param pTnsConfig TNS configuration. - * @param stream Contains TNS data written with EncodeTnsData. - * @param pnSize Set to the number of used elements from stream. - * @param st Encoder state. - * @param pnBits Set to the number of bits written. - * @return 0 on success, otherwise 1. - */ Word16 WriteTnsData_fx( STnsConfig const *pTnsConfig, Word16 const *stream, @@ -1696,6 +1663,7 @@ void subband_FFT_fx( Word32 Offset, /*(i) offset of the CLDFB*/ Word16 *fftoQ /*(o) the Scaling */ ); + Word16 E_ACELP_toeplitz_mul_fx( const Word16 R[], /* Q9 */ const Word16 c[], /* Qx */ @@ -1732,7 +1700,7 @@ Word16 gain_enc_uv_fx( Word16 mean_ener, /*, -2,, -2 and 2 Qx*/ - const Word16 clip_gain /* i : gain pitch clipping flag (1 = clipping) Q0*/ + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + const Word16 gains_mode[], /* i : gain bits Q0*/ + const Word16 element_mode, /* i : element mode Q0*/ + const Word16 L_frame, /* i : length of the frame Q0*/ + const Word16 i_subfr, /* i : subframe index Q0*/ + const Word16 tc_subfr, /* i : TC subframe index Q0*/ + const Word16 *xn, /* i : target vector Q_xn*/ + const Word16 *y1, /* i : zero-memory filtered adaptive excitation Q_xn*/ + const Word16 Q_xn, /* i : xn and y1 scaling */ + const Word16 *y2, /* i : zero-memory filtered algebraic codebook excitation Q9*/ + const Word16 *code, /* i : algebraic excitation Q9*/ + const Word16 Es_pred, /* i : predicted scaled innovation energy Q8*/ + Word16 *gain_pit, /* o : quantized pitch gain Q14*/ + Word32 *gain_code, /* o : quantized codebook gain Q16*/ + Word16 *gain_inov, /* o : gain of the innovation (used for normalization) Q12*/ + Word32 *norm_gain_code, /* o : norm. gain of the codebook excitation Q16*/ + Word16 *g_corr, /* i/o: correlations , -2,, -2 and 2 Qx*/ + const Word16 clip_gain /* i : gain pitch clipping flag (1 = clipping) Q0*/ ); + void updt_IO_switch_enc_fx( - Encoder_State *st, /* i/o: state structure */ + Encoder_State *st, /* i/o: state structure */ const Word16 input_frame /* i : i frame length */ ); @@ -3630,31 +3594,31 @@ void hf_cod_init_fx( ); void analy_lp_AMR_WB_fx( - const Word16 speech[], /* i : pointer to the speech frame Q_new*/ - Word32 *ener, /* o : residual energy from Levinson-Durbin Q_r*/ - Word16 A[], /* o : A(z) filter coefficients Q14*/ - Word16 epsP_h[], /* o : LP analysis residual energies for each iteration Q_r*/ - Word16 epsP_l[], /* o : LP analysis residual energies for each iteration Q_r*/ - Word16 isp_new[], /* o : current frame ISPs Q15*/ - Word16 isp_old[], /* i/o: previous frame unquantized ISPs Q15*/ - Word16 isf_new[], /* o : current frame ISPs Q15*/ - Word16 Top, /* i : open loop pitch lag Q0*/ - Word16 Tnc, /* i : open loop pitch gain Qx*/ + const Word16 speech[], /* i : pointer to the speech frame Q_new*/ + Word32 *ener, /* o : residual energy from Levinson-Durbin Q_r*/ + Word16 A[], /* o : A(z) filter coefficients Q14*/ + Word16 epsP_h[], /* o : LP analysis residual energies for each iteration Q_r*/ + Word16 epsP_l[], /* o : LP analysis residual energies for each iteration Q_r*/ + Word16 isp_new[], /* o : current frame ISPs Q15*/ + Word16 isp_old[], /* i/o: previous frame unquantized ISPs Q15*/ + Word16 isf_new[], /* o : current frame ISPs Q15*/ + Word16 Top, /* i : open loop pitch lag Q0*/ + Word16 Tnc, /* i : open loop pitch gain Qx*/ Word16 Q_new, Word16 *Q_r ); void encod_amr_wb_fx( - Encoder_State *st, /* i/o: state structure */ - const Word16 speech[], /* i : i speech Q_new-1*/ - const Word16 Aw[], /* i : weighted A(z) unquantized for subframes Q12*/ - const Word16 Aq[], /* i : 12k8 Lp coefficient Q12*/ - const Word16 *res, /* i : residual signal Q_new*/ - Word16 *syn, /* i/o: core synthesis st->Q_syn*/ - Word16 *exc, /* i/o: current non-enhanced excitation Q_new*/ - Word16 *exc2, /* i/o: current enhanced excitation Q_new*/ - Word16 *pitch_buf, /* i/o: floating pitch values for each subframe Q6*/ - Word16 hf_gain_fx[NB_SUBFR], /* o : decoded HF gain Q0*/ - const Word16 *speech16k_fx, /* i : i speech @16kHz Qx*/ + Encoder_State *st, /* i/o: state structure */ + const Word16 speech[], /* i : i speech Q_new-1*/ + const Word16 Aw[], /* i : weighted A(z) unquantized for subframes Q12*/ + const Word16 Aq[], /* i : 12k8 Lp coefficient Q12*/ + const Word16 *res, /* i : residual signal Q_new*/ + Word16 *syn, /* i/o: core synthesis st->Q_syn*/ + Word16 *exc, /* i/o: current non-enhanced excitation Q_new*/ + Word16 *exc2, /* i/o: current enhanced excitation Q_new*/ + Word16 *pitch_buf, /* i/o: floating pitch values for each subframe Q6*/ + Word16 hf_gain_fx[NB_SUBFR], /* o : decoded HF gain Q0*/ + const Word16 *speech16k_fx, /* i : i speech @16kHz Qx*/ Word16 shift, Word16 Q_new ); @@ -3671,36 +3635,36 @@ void TBEreset_enc_fx( ); void acelp_core_switch_enc_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ - const Word16 inp12k8[], /* i : i signal @12.8 kHz Q0 */ - const Word16 inp16k[], /* i : i signal @16 kHz Q0 */ - const Word16 A[NB_SUBFR16k * ( M + 1 )], /* i : A(z) unquantized for the 4 subframes Q12*/ + Encoder_State *st_fx, /* i/o: encoder state structure */ + const Word16 inp12k8[], /* i : i signal @12.8 kHz Q0 */ + const Word16 inp16k[], /* i : i signal @16 kHz Q0 */ + const Word16 A[NB_SUBFR16k * ( M + 1 )], /* i : A(z) unquantized for the 4 subframes Q12 */ Word16 shift, Word16 Q_new ); void acelp_core_switch_enc_ivas_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ - const Word16 inp12k8[], /* i : i signal @12.8 kHz Q0 */ - const Word16 inp16k[], /* i : i signal @16 kHz Q0 */ - const Word16 A[NB_SUBFR16k * ( M + 1 )], /* i : A(z) unquantized for the 4 subframes Q12*/ + Encoder_State *st_fx, /* i/o: encoder state structure */ + const Word16 inp12k8[], /* i : i signal @12.8 kHz Q0 */ + const Word16 inp16k[], /* i : i signal @16 kHz Q0 */ + const Word16 A[NB_SUBFR16k * ( M + 1 )], /* i : A(z) unquantized for the 4 subframes Q12 */ Word16 shift, Word16 Q_new ); void gain_enc_amr_wb_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 *xn, /* i : target vector Q_xn*/ - const Word16 Q_xn, /* i : xn and yy1 format */ - const Word16 *yy1, /* i : zero-memory filtered adaptive excitation Q_xn*/ - const Word16 *y2, /* i : zero-memory filtered algebraic codebook excitation Q9*/ - const Word16 *code, /* i : algebraic excitation Q9*/ - const Word32 core_brate, /* i : core bitrate Q0*/ - Word16 *gain_pit, /* i/o: pitch gain / Quantized pitch gain Q14*/ - Word32 *gain_code, /* o : quantized codebook gain Q16*/ - Word16 *gain_inov, /* o : gain of the innovation (used for normalization) Q12*/ - Word32 *norm_gain_code, /* o : norm. gain of the codebook excitation Q16*/ - Word16 *g_coeff, /* i/o: correlations , -2,, -2 and 2 Qx*/ - const Word16 clip_gain, /* i : gain pitch clipping flag (1 = clipping) Q0*/ - Word16 *past_qua_en /* i/o: gain quantization memory (4 words) Q10*/ + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + const Word16 *xn, /* i : target vector Q_xn*/ + const Word16 Q_xn, /* i : xn and yy1 format */ + const Word16 *yy1, /* i : zero-memory filtered adaptive excitation Q_xn*/ + const Word16 *y2, /* i : zero-memory filtered algebraic codebook excitation Q9*/ + const Word16 *code, /* i : algebraic excitation Q9*/ + const Word32 core_brate, /* i : core bitrate Q0*/ + Word16 *gain_pit, /* i/o: pitch gain / Quantized pitch gain Q14*/ + Word32 *gain_code, /* o : quantized codebook gain Q16*/ + Word16 *gain_inov, /* o : gain of the innovation (used for normalization) Q12*/ + Word32 *norm_gain_code, /* o : norm. gain of the codebook excitation Q16*/ + Word16 *g_coeff, /* i/o: correlations , -2,, -2 and 2 Qx*/ + const Word16 clip_gain, /* i : gain pitch clipping flag (1 = clipping) Q0*/ + Word16 *past_qua_en /* i/o: gain quantization memory (4 words) Q10*/ ); void hf_cod_fx( @@ -3771,13 +3735,13 @@ void transf_cdbk_enc_ivas_fx( ); void gain_enc_lbr_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const Word16 gains_mode[], /* i : gain bits Q0*/ const Word16 coder_type, /* i : coding type Q0*/ const Word16 i_subfr, /* i : subframe index Q0*/ const Word16 *xn, /* i : target vector Q_xn*/ const Word16 *y1, /* i : zero-memory filtered adaptive excitation Q_xn*/ - const Word16 Q_xn, /* i : xn and y1 format */ + const Word16 Q_xn, /* i : xn and y1 format */ const Word16 *y2, /* i : zero-memory filtered algebraic codebook excitation Q9*/ const Word16 *code, /* i : algebraic excitation Q9*/ Word16 *gain_pit, /* o : quantized pitch gain Q14*/ @@ -3787,28 +3751,29 @@ void gain_enc_lbr_fx( Word16 *g_corr, /* i/o: correlations , -2,, -2 and 2 mant/exp*/ Word32 gc_mem[], /* i/o: gain_code from previous subframes Q16*/ Word16 gp_mem[], /* i/o: gain_pitch from previous subframes Q14*/ - const Word16 clip_gain, /* i : gain pitch clipping flag (1 = clipping) Q0*/ - const Word16 L_subfr /* i : subframe length Q0*/ - , - const Word16 element_mode /* i : mode element Q0*/ + const Word16 clip_gain, /* i : gain pitch clipping flag (1 = clipping) Q0*/ + const Word16 L_subfr, /* i : subframe length Q0*/ + const Word16 element_mode /* i : mode element Q0*/ ); + void gain_enc_SQ_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 gains_mode[], /* i : gain bits Q0*/ - const Word16 i_subfr, /* i : subframe index Q0*/ - const Word16 *xn, /* i : target vector Q_xn*/ - const Word16 *yy1, /* i : zero-memory filtered adaptive excitation Q_xn*/ - const Word16 *y2, /* i : zero-memory filtered algebraic codebook excitation Q9*/ - const Word16 *code, /* i : algebraic excitation Q9*/ - const Word16 Es_pred, /* i : predicted scaled innovation energy Q8*/ - Word16 *gain_pit, /* o : quantized pitch gain Q14*/ - Word32 *gain_code, /* o : quantized codebook gain Q16*/ - Word16 *gain_inov, /* o : gain of the innovation (used for normalization) Q12*/ - Word32 *norm_gain_code, /* o : norm. gain of the codebook excitation Q16*/ - Word16 *g_corr, /* i/o: correlations , ,, -2 and 2 Qx*/ - const Word16 clip_gain, /* i : gain pitch clipping flag (1 = clipping) Q0*/ - const Word16 Q_xn /* i : xn and y1 scaling */ + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + const Word16 gains_mode[], /* i : gain bits Q0*/ + const Word16 i_subfr, /* i : subframe index Q0*/ + const Word16 *xn, /* i : target vector Q_xn*/ + const Word16 *yy1, /* i : zero-memory filtered adaptive excitation Q_xn*/ + const Word16 *y2, /* i : zero-memory filtered algebraic codebook excitation Q9*/ + const Word16 *code, /* i : algebraic excitation Q9*/ + const Word16 Es_pred, /* i : predicted scaled innovation energy Q8*/ + Word16 *gain_pit, /* o : quantized pitch gain Q14*/ + Word32 *gain_code, /* o : quantized codebook gain Q16*/ + Word16 *gain_inov, /* o : gain of the innovation (used for normalization) Q12*/ + Word32 *norm_gain_code, /* o : norm. gain of the codebook excitation Q16*/ + Word16 *g_corr, /* i/o: correlations , ,, -2 and 2 Qx*/ + const Word16 clip_gain, /* i : gain pitch clipping flag (1 = clipping) Q0*/ + const Word16 Q_xn /* i : xn and y1 scaling */ ); + void updt_tar_fx( const Word16 *x, /* i : old target (for pitch search) */ Word16 *x2, /* o : new target (for codebook search) */ @@ -3816,20 +3781,21 @@ void updt_tar_fx( const Word16 gain, /* i : adaptive codebook gain */ const Word16 L /* i : subframe size */ ); + void updt_tar_HR_fx( - const Word16 *x, /* i : old target (for pitch search) */ - Word16 *x2, /* o : new target (for codebook search) */ - const Word16 *y, /* i : filtered adaptive codebook vector */ - const Word16 gain, /* i : adaptive codebook gain */ - const Word16 Qx, /* i : Scaling factor to adapt output to i */ - const Word16 L /* i : subframe size */ + const Word16 *x, /* i : old target (for pitch search) */ + Word16 *x2, /* o : new target (for codebook search) */ + const Word16 *y, /* i : filtered adaptive codebook vector */ + const Word16 gain, /* i : adaptive codebook gain */ + const Word16 Qx, /* i : Scaling factor to adapt output to i */ + const Word16 L /* i : subframe size */ ); Flag conv_fx( - const Word16 x[], /* i : i vector Q_new*/ - const Word16 h[], /* i : impulse response (or second i vector) Q(15)*/ - Word16 y[], /* o : output vetor (result of convolution) 12 bits*/ - const Word16 L /* i : vector size */ + const Word16 x[], /* i : i vector Q_new*/ + const Word16 h[], /* i : impulse response (or second i vector) Q(15)*/ + Word16 y[], /* o : output vetor (result of convolution) 12 bits*/ + const Word16 L /* i : vector size */ ); ivas_error ppp_voiced_encoder_fx( @@ -3838,13 +3804,13 @@ ivas_error ppp_voiced_encoder_fx( const Word16 bwidth, /* i : audio bandwidth */ const Word16 last_coder_type_raw, /* i : raw last_coder_type */ const Word16 old_pitch_buf[], /* i : buffer of old subframe pitch values */ - Word16 *in_fx, /* i : residual signal */ - Word16 *out_fx, /* o : Quantized residual signal */ - Word16 delay_fx, /* i : open loop pitch */ - Word16 *lpc1_fx, /* i : prev frame de-emphasized LPC */ - Word16 *lpc2_fx, /* i : current frame de-emphasized LPC */ - Word16 *exc_fx, /* i: previous frame quantized excitation */ - Word16 *pitch_fx, /* o: floating pitch values for each subframe */ + Word16 *in_fx, /* i : residual signal */ + Word16 *out_fx, /* o : Quantized residual signal */ + Word16 delay_fx, /* i : open loop pitch */ + Word16 *lpc1_fx, /* i : prev frame de-emphasized LPC */ + Word16 *lpc2_fx, /* i : current frame de-emphasized LPC */ + Word16 *exc_fx, /* i: previous frame quantized excitation */ + Word16 *pitch_fx, /* o: floating pitch values for each subframe */ Word16 Qres ); void signalling_enc_fx( @@ -3852,7 +3818,7 @@ void signalling_enc_fx( ); void transition_enc_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 i_subfr, /* i : subframe index */ Word16 *tc_subfr, /* i/o: TC subframe index */ Word16 *Jopt_flag, /* i : joint optimization flag */ @@ -3863,7 +3829,7 @@ void transition_enc_fx( Word16 *T0_max, /* i/o: higher limit for close-loop search Q0*/ Word16 *exc_fx, /* i/o: pointer to excitation signal frame Q_new*/ Word16 *y1_fx, /* o : zero-memory filtered adaptive excitation Q_new-1+shift*/ - const Word16 *h1_fx, /* i : weighted filter i response Q(14+shift)*/ + const Word16 *h1_fx, /* i : weighted filter i response Q(14+shift)*/ const Word16 *xn_fx, /* i : target vector Q_new-1+shift*/ Word16 *xn2_fx, /* o : target vector for innovation search Q_new-1+shift*/ Word16 *gp_cl_fx, /* i/o: memory of gain of pitch clipping algorithm */ @@ -3873,13 +3839,12 @@ void transition_enc_fx( Word16 **pt_pitch_fx, /* o : floating pitch values */ Word16 *bwe_exc_fx, /* o : excitation for SWB TBE Q_new*/ Word16 *unbits_ACELP, /* i/o: unused bits */ - Word16 Q_new, /* i : Current scaling */ - Word16 shift /* i : downscaling needs for 12 bits convolutions */ - + Word16 Q_new, /* i : Current scaling */ + Word16 shift /* i : downscaling needs for 12 bits convolutions */ ); void transition_enc_ivas_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 i_subfr, /* i : subframe index */ Word16 *tc_subfr, /* i/o: TC subframe index */ Word16 *Jopt_flag, /* i : joint optimization flag */ @@ -3900,13 +3865,12 @@ void transition_enc_ivas_fx( Word16 **pt_pitch_fx, /* o : floating pitch values */ Word16 *bwe_exc_fx, /* o : excitation for SWB TBE Q_new*/ Word16 *unbits_ACELP, /* i/o: unused bits */ - Word16 Q_new, /* i : Current scaling */ - Word16 shift /* i : downscaling needs for 12 bits convolutions */ - + Word16 Q_new, /* i : Current scaling */ + Word16 shift /* i : downscaling needs for 12 bits convolutions */ ); void gain_enc_tc_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const Word16 gains_mode[], /* i : gain bits Q0*/ const Word16 i_subfr, /* i : subframe index Q0*/ const Word16 xn_fx[], /* i : target vector Q_xn*/ @@ -3917,69 +3881,69 @@ void gain_enc_tc_fx( Word32 *gain_code_fx, /* o : quantized codebook gain Q16*/ Word16 *gain_inov_fx, /* o : innovation gain Q12*/ Word32 *norm_gain_code_fx, /* o : norm. gain of the codebook excitation Q16*/ - const Word16 Q_xn /* i : xn and y1 scaling */ + const Word16 Q_xn /* i : xn and y1 scaling */ ); void gain_enc_tc_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 gains_mode[], /* i : gain bits Q0*/ - const Word16 i_subfr, /* i : subframe index Q0*/ - const Word16 xn_fx[], /* i : target vector Q_xn*/ - const Word16 y2_fx[], /* i : zero-memory filtered algebraic codebook excitation Q_xn*/ - const Word16 code_fx[], /* i : algebraic excitation Q9*/ - const Word16 Es_pred_fx, /* i : predicted scaled innovation energy Q8*/ - Word16 *gain_pit_fx, /* o : Pitch gain / Quantized pitch gain Q14*/ - Word32 *gain_code_fx, /* o : quantized codebook gain Q16*/ - Word16 *gain_inov_fx, /* o : innovation gain Q12*/ - Word32 *norm_gain_code_fx, /* o : norm. gain of the codebook excitation Q6*/ - const Word16 Q_xn /* i : xn and y1 scaling */ + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + const Word16 gains_mode[], /* i : gain bits Q0*/ + const Word16 i_subfr, /* i : subframe index Q0*/ + const Word16 xn_fx[], /* i : target vector Q_xn*/ + const Word16 y2_fx[], /* i : zero-memory filtered algebraic codebook excitation Q_xn*/ + const Word16 code_fx[], /* i : algebraic excitation Q9*/ + const Word16 Es_pred_fx, /* i : predicted scaled innovation energy Q8*/ + Word16 *gain_pit_fx, /* o : Pitch gain / Quantized pitch gain Q14*/ + Word32 *gain_code_fx, /* o : quantized codebook gain Q16*/ + Word16 *gain_inov_fx, /* o : innovation gain Q12*/ + Word32 *norm_gain_code_fx, /* o : norm. gain of the codebook excitation Q6*/ + const Word16 Q_xn /* i : xn and y1 scaling */ ); Word16 gaus_encode_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ - const Word16 i_subfr, /* i : subframe index Q0*/ - const Word16 *h1, /* i : weighted filter input response Q14*/ - const Word16 *xn, /* i : target vector Q12*/ - Word16 *exc, /* o : pointer to excitation signal frame Q_new*/ - Word16 *mem_w0, /* o : weighting filter denominator memory Q_new*/ - Word16 *clip_gain, /* o : memory of gain of pitch clipping algorithm [2.56x,Q14,Q8,Q0,Q14,Q14]*/ - Word16 *tilt_code, /* o : synthesis excitation spectrum tilt Q15*/ - Word16 *code, /* o : algebraic excitation Q9*/ - Word32 *gain_code, /* o : Code gain. Q16*/ - Word16 *y2, /* o : zero-memory filtered adaptive excitation Q9*/ - Word16 *gain_inov, /* o : innovation gain Q12*/ - Word16 *voice_fac, /* o : voicing factor Q15*/ - Word16 *gain_pit, /* o : adaptive excitation gain Q14*/ - const Word16 Q_new, /* i : scaling factor */ - const Word16 shift, /* i : scaling factor */ - Word32 *norm_gain_code /* o : normalized innovative cb. gain Q16*/ + Encoder_State *st_fx, /* i/o: encoder state structure */ + const Word16 i_subfr, /* i : subframe index Q0*/ + const Word16 *h1, /* i : weighted filter input response Q14*/ + const Word16 *xn, /* i : target vector Q12*/ + Word16 *exc, /* o : pointer to excitation signal frame Q_new*/ + Word16 *mem_w0, /* o : weighting filter denominator memory Q_new*/ + Word16 *clip_gain, /* o : memory of gain of pitch clipping algorithm [2.56x,Q14,Q8,Q0,Q14,Q14]*/ + Word16 *tilt_code, /* o : synthesis excitation spectrum tilt Q15*/ + Word16 *code, /* o : algebraic excitation Q9*/ + Word32 *gain_code, /* o : Code gain. Q16*/ + Word16 *y2, /* o : zero-memory filtered adaptive excitation Q9*/ + Word16 *gain_inov, /* o : innovation gain Q12*/ + Word16 *voice_fac, /* o : voicing factor Q15*/ + Word16 *gain_pit, /* o : adaptive excitation gain Q14*/ + const Word16 Q_new, /* i : scaling factor */ + const Word16 shift, /* i : scaling factor */ + Word32 *norm_gain_code /* o : normalized innovative cb. gain Q16*/ ); Word16 gaus_encode_ivas_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ - const Word16 i_subfr, /* i : subframe index Q0*/ - const Word16 *h1, /* i : weighted filter input response Q14*/ - const Word16 *xn, /* i : target vector Q12*/ - Word16 *exc, /* o : pointer to excitation signal frame Q_new*/ - Word16 *mem_w0, /* o : weighting filter denominator memory Q_new*/ - Word16 *clip_gain, /* o : memory of gain of pitch clipping algorithm [2.56x,Q14,Q8,Q0,Q14,Q14]*/ - Word16 *tilt_code, /* o : synthesis excitation spectrum tilt Q15*/ - Word16 *code, /* o : algebraic excitation Q9*/ - Word32 *gain_code, /* o : Code gain. Q16*/ - Word16 *y2, /* o : zero-memory filtered adaptive excitation Q9*/ - Word16 *gain_inov, /* o : innovation gain Q12*/ - Word16 *voice_fac, /* o : voicing factor Q15*/ - Word16 *gain_pit, /* o : adaptive excitation gain Q14*/ - const Word16 Q_new, /* i : scaling factor */ - const Word16 shift, /* i : scaling factor */ - Word32 *norm_gain_code /* o : normalized innovative cb. gain Q16*/ + const Word16 i_subfr, /* i : subframe index Q0*/ + const Word16 *h1, /* i : weighted filter input response Q14*/ + const Word16 *xn, /* i : target vector Q12*/ + Word16 *exc, /* o : pointer to excitation signal frame Q_new*/ + Word16 *mem_w0, /* o : weighting filter denominator memory Q_new*/ + Word16 *clip_gain, /* o : memory of gain of pitch clipping algorithm [2.56x,Q14,Q8,Q0,Q14,Q14]*/ + Word16 *tilt_code, /* o : synthesis excitation spectrum tilt Q15*/ + Word16 *code, /* o : algebraic excitation Q9*/ + Word32 *gain_code, /* o : Code gain. Q16*/ + Word16 *y2, /* o : zero-memory filtered adaptive excitation Q9*/ + Word16 *gain_inov, /* o : innovation gain Q12*/ + Word16 *voice_fac, /* o : voicing factor Q15*/ + Word16 *gain_pit, /* o : adaptive excitation gain Q14*/ + const Word16 Q_new, /* i : scaling factor */ + const Word16 shift, /* i : scaling factor */ + Word32 *norm_gain_code /* o : normalized innovative cb. gain Q16*/ ); void pre_proc_fx( Encoder_State *st, /* i/o: encoder state structure */ const Word16 input_frame, /* i : frame length */ - Word16 old_inp_12k8[], /* i/o: buffer of old i signal */ - Word16 old_inp_16k[], /* i/o: buffer of old i signal @ 16kHz */ + Word16 old_inp_12k8[], /* i/o: buffer of old i signal */ + Word16 old_inp_16k[], /* i/o: buffer of old i signal @ 16kHz */ Word16 **inp, /* o : ptr. to inp. signal in the current frame */ Word32 fr_bands[2 * NB_BANDS], /* o : energy in frequency bands */ Word16 *Etot, /* o : total energy */ @@ -3995,33 +3959,35 @@ void pre_proc_fx( Word16 lsp_new[M], /* o : LSPs at the end of the frame */ Word16 lsp_mid[M], /* o : LSPs in the middle of the frame */ Word16 *vad_hover_flag, - Word16 *attack_flag, /* o : flag signalling attack encoded by AC mode (GSC) */ + Word16 *attack_flag, /* o : flag signalling attack encoded by AC mode (GSC) */ Word16 *new_inp_resamp16k, /* o : new i signal @16kHz, non pre-emphasised, used by the WB TBE/BWE */ - Word16 *Voicing_flag, /* o : voicing flag for HQ FEC */ - Word32 realBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o : cldfb real buffer */ - Word32 imagBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o : cldfb imag buffer */ - CLDFB_SCALE_FACTOR *cldfbScale, /* o : cldfb scale */ - Word16 *old_exc, /* i/o: static excitation memory */ - Word16 *hq_core_type, /* o : HQ core type */ + Word16 *Voicing_flag, /* o : voicing flag for HQ FEC */ + Word32 realBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o : cldfb real buffer */ + Word32 imagBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o : cldfb imag buffer */ + CLDFB_SCALE_FACTOR *cldfbScale, /* o : cldfb scale */ + Word16 *old_exc, /* i/o: static excitation memory */ + Word16 *hq_core_type, /* o : HQ core type */ Word16 *Q_new, Word16 *shift, Word16 *Q_r ); void swb_bwe_enc_hr_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ - Word16 *new_input_fx, /* i : i signal */ - Word16 new_input_fx_exp, /* i : Exponent of i signal */ + Word16 *new_input_fx, /* i : i signal */ + Word16 new_input_fx_exp, /* i : Exponent of i signal */ const Word16 input_frame, /* i : frame length */ const Word16 unbits /* i : number of core unused bits */ ); -Word16 gain_enc_gaus_fx( /* o : Return index of quantization */ - Word32 *gain, /* i/o: Code gain to quantize Q16*/ - const Word16 bits, /* i : number of bits to quantize Q0*/ - const Word16 lowBound, /* i : lower bound of quantizer (dB) Q8*/ - const Word16 stepSize, /* i : Step size choice Q14*/ - const Word16 inv_stepSize /* i : Step size choice Q15*/ +/* o : Return index of quantization */ +Word16 gain_enc_gaus_fx( + Word32 *gain, /* i/o: Code gain to quantize Q16*/ + const Word16 bits, /* i : number of bits to quantize Q0*/ + const Word16 lowBound, /* i : lower bound of quantizer (dB) Q8*/ + const Word16 stepSize, /* i : Step size choice Q14*/ + const Word16 inv_stepSize /* i : Step size choice Q15*/ ); + void enc_pit_exc_fx( Encoder_State *st_fx, /* i/o: State structure */ const Word16 *speech, /* i : Input speech Q_new-1*/ @@ -4036,9 +4002,9 @@ void enc_pit_exc_fx( Word16 *pitch_buf, /* i/o: Fractionnal per subframe pitch Q6*/ const Word16 nb_subfr, /* i : Number of subframe considered Q0*/ Word16 *gpit, /* o : pitch mean gpit Q15*/ - Word16 *saved_bit_pos, /* o : saved position in the bitstream before pitch contribution Q0*/ - const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag Q0*/ - const Word16 tdm_Pri_pitch_buf[], /* i : primary channel pitch buffer Q6*/ + Word16 *saved_bit_pos, /* o : saved position in the bitstream before pitch contribution Q0*/ + const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag Q0*/ + const Word16 tdm_Pri_pitch_buf[], /* i : primary channel pitch buffer Q6*/ Word16 Q_new, Word16 shift ); @@ -4056,29 +4022,31 @@ void enc_pit_exc_ivas_fx( Word16 *pitch_buf, /* i/o: Fractionnal per subframe pitch Q6*/ const Word16 nb_subfr, /* i : Number of subframe considered Q0*/ Word16 *gpit, /* o : pitch mean gpit Q15*/ - Word16 *saved_bit_pos, /* o : saved position in the bitstream before pitch contribution Q0*/ - const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag Q0*/ - const Word16 tdm_Pri_pitch_buf[], /* i : primary channel pitch buffer Q6*/ + Word16 *saved_bit_pos, /* o : saved position in the bitstream before pitch contribution Q0*/ + const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag Q0*/ + const Word16 tdm_Pri_pitch_buf[], /* i : primary channel pitch buffer Q6*/ Word16 Q_new, Word16 shift ); -Word16 Pit_exc_contribution_len_fx( /* o : bin where pitch contribution is significant */ - Encoder_State *st_fx, /* i/o: state structure */ - const Word16 *dct_res, /* i : DCT of residual Qnew*/ - Word16 *dct_pitex, /* i/o: DCT of pitch contribution Qnew*/ - Word16 *pitch_buf, /* i/o: Pitch per subframe Q6*/ - const Word16 nb_subfr, /* i : Number of subframe considered Q0*/ - Word16 *hangover, /* i : hangover for the time contribution switching Q0*/ - Word16 Qnew ); - -Word16 Pit_exc_contribution_len_ivas_fx( /* o : bin where pitch contribution is significant */ - Encoder_State *st_fx, /* i/o: state structure */ - const Word16 *dct_res, /* i : DCT of residual Qnew*/ - Word16 *dct_pitex, /* i/o: DCT of pitch contribution Qnew*/ - Word16 *pitch_buf, /* i/o: Pitch per subframe Q6*/ - const Word16 nb_subfr, /* i : Number of subframe considered Q0*/ - Word16 *hangover, /* i : hangover for the time contribution switching Q0*/ - Word16 Qnew ); +/* o : bin where pitch contribution is significant */ +Word16 Pit_exc_contribution_len_fx( + Encoder_State *st_fx, /* i/o: state structure */ + const Word16 *dct_res, /* i : DCT of residual Qnew*/ + Word16 *dct_pitex, /* i/o: DCT of pitch contribution Qnew*/ + Word16 *pitch_buf, /* i/o: Pitch per subframe Q6*/ + const Word16 nb_subfr, /* i : Number of subframe considered Q0*/ + Word16 *hangover, /* i : hangover for the time contribution switching Q0*/ + Word16 Qnew ); + +/* o : bin where pitch contribution is significant */ +Word16 Pit_exc_contribution_len_ivas_fx( + Encoder_State *st_fx, /* i/o: state structure */ + const Word16 *dct_res, /* i : DCT of residual Qnew*/ + Word16 *dct_pitex, /* i/o: DCT of pitch contribution Qnew*/ + Word16 *pitch_buf, /* i/o: Pitch per subframe Q6*/ + const Word16 nb_subfr, /* i : Number of subframe considered Q0*/ + Word16 *hangover, /* i : hangover for the time contribution switching Q0*/ + Word16 Qnew ); Word16 pvq_core_enc_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ @@ -4096,6 +4064,7 @@ Word16 pvq_core_enc_fx( Word16 *maxpulse, /* i : maximum pulse per band */ const Word16 core /* i : number of bands */ ); + Word16 pvq_core_enc_ivas_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ Word16 coefs_norm[], /* i/o: normalized coefficients to encode */ @@ -4135,7 +4104,6 @@ void hq_lr_enc_ivas_fx( const Word16 is_transient_fx /* i : Q0 : transient flag */ ); - void hq_hr_enc_fx( Encoder_State *st_fx, /* i/o: encoder state structure fx */ Word32 *t_audio, /* i/o: transform-domain coefficients Q12 */ @@ -4168,7 +4136,7 @@ void diffcod_fx( Word16 *difidx /* (o) differential code Q0*/ ); -/* o : Consumed bits Q0 */ +/* o : Consumed bits Q0 */ Word16 hq_classifier_enc_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 length, /* i : Frame length Q0 */ @@ -4181,7 +4149,7 @@ Word16 hq_classifier_enc_fx( Word16 *hqswb_clas /* o : HQ class Q0 */ ); -/* o : Consumed bits Q0 */ +/* o : Consumed bits Q0 */ Word16 hq_classifier_enc_ivas_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 length, /* i : Frame length Q0 */ @@ -4211,8 +4179,7 @@ Word16 encode_envelope_indices_ivas_fx( Word16 *difidx, /* i/o: Diff indices/encoded diff indices Q0 */ Word16 *LCmode, /* o : Coding mode if flag_pack=0, i : if flag_pack=1 Q0 */ const Word16 flag_pack, /* i : indicator of packing or estimating bits Q0 */ - const Word16 flag_HQ2 /* i : indicator of HQ2 core Q0 */ - , + const Word16 flag_HQ2, /* i : indicator of HQ2 core Q0 */ const Word16 is_transient /* i : indicator of HQ_TRANSIENT Q0 */ ); @@ -4292,7 +4259,6 @@ Word16 noise_adjust_fx( const Word16 core_sfm /* i : index of the end band for core Q0 */ ); - ivas_error tcq_core_LR_enc_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ Word16 inp_vector_fx[], /* x5 */ @@ -4313,7 +4279,6 @@ ivas_error tcq_core_LR_enc_fx( const Word16 adjustFlag, const Word16 is_transient ); - ivas_error tcq_core_LR_enc_ivas_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ Word32 inp_vector[], @@ -4355,8 +4320,8 @@ void diffcod_lrmdct_fx( ); Word16 peak_vq_enc_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 bwidth, /* i : audio bandwidth */ + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + const Word16 bwidth, /* i : audio bandwidth */ const Word32 *coefs, /* i : Input coefficient vector Q12 */ Word32 *coefs_out, /* o : Quantized output vector Q12 */ const Word32 core_brate, /* i : Core bitrate */ @@ -4369,8 +4334,8 @@ Word16 peak_vq_enc_ivas_fx( ); Word16 peak_vq_enc_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 bwidth, /* i : audio bandwidth */ + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + const Word16 bwidth, /* i : audio bandwidth */ const Word32 *coefs, /* i : Input coefficient vector Q12 */ Word32 *coefs_out, /* o : Quantized output vector Q12 */ const Word32 brate, /* i : Core bitrate */ @@ -4410,7 +4375,8 @@ Word16 E_ACELP_hh_corr( Word16 *x /*Q11*/, Word16 *y /*Qy*/, Word16 L_subfr /*Q0*/, - Word16 bits /*Q0*/ ); + Word16 bits /*Q0*/ +); void acelp_1t64_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ @@ -4420,6 +4386,7 @@ void acelp_1t64_fx( Word16 y[], /* o : filtered fixed codebook excitation */ const Word16 L_subfr /* i : subframe length */ ); + void acelp_2t32_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const Word16 dn[], /* i : corr. between target and h[]. */ @@ -4427,8 +4394,9 @@ void acelp_2t32_fx( Word16 code[], /* o : algebraic (fixed) codebook excitation */ Word16 y[] /* o : filtered fixed codebook excitation */ ); + Word16 acelp_4t64_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ Word16 dn[], /* i : corr. between target and h[]. */ const Word16 cn[], /* i : residual after long term prediction Q_new*/ const Word16 H[], /* i : impulse response of weighted synthesis filter Q12*/ @@ -4438,153 +4406,152 @@ Word16 acelp_4t64_fx( Word16 y[], /* o : filtered fixed codebook excitation Q9*/ Word16 nbbits, /* i : number of bits per codebook */ const Word16 cmpl_flag, /* i : coomplexity reduction flag */ - const Word16 Opt_AMR_WB /* i : flag indicating AMR-WB IO mode */ - , + const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */ const Word16 element_mode ); ivas_error evs_enc_fx( - Encoder_State *st, /* i/o: encoder state structure */ - const Word16 *data, /* i : input signal Q0*/ - Word32 *mem_hp20_in_fx, /* i/o: hp20 filter memory Qx*/ - const Word16 n_samples /* i : number of input samples Q0*/ + Encoder_State *st, /* i/o: encoder state structure */ + const Word16 *data, /* i : input signal Q0*/ + Word32 *mem_hp20_in_fx, /* i/o: hp20 filter memory Qx*/ + const Word16 n_samples /* i : number of input samples Q0*/ ); /* o: Qx y(n) */ /* y(n)(Qx) = alpha(Q15) * x(Qx) + (1.0f-alpha)* y(n-1) (Qx) */ Word16 noise_est_AR1_Qx( - Word16 x, /* i : Qx x(n) */ - Word16 y, /* i : Qx y(n-1) */ - Word16 alpha /*i : Q15 scaling of driving x(n) */ + Word16 x, /* i : Qx x(n) */ + Word16 y, /* i : Qx y(n-1) */ + Word16 alpha /* i : Q15 scaling of driving x(n) */ ); /*o : Qx y( n ) */ Word32 noise_est_AR1_Qx_32( - Word32 x, /* i : Qx x(n) */ - Word32 y, /* i : Qx y(n-1) */ - Word32 alpha /*i : Q15 scaling of driving x(n) */ + Word32 x, /* i : Qx x(n) */ + Word32 y, /* i : Qx y(n-1) */ + Word32 alpha /* i : Q15 scaling of driving x(n) */ ); void FEC_lsf_estim_enc_fx( - Encoder_State *st_fx, /* i : Encoder static memory */ + Encoder_State *st_fx, /* i : Encoder static memory */ Word16 *lsf /* o : estimated LSF vector Qlog2(2.56)*/ ); Word32 mslvq_cng_fx( - Word16 idx_cv, /* i : index of cv from previous stage */ - Word16 *pTmp, /* i : 16 dimensional i vector x2.56*/ - Word16 *quant, /* o : quantized vector x2.56*/ + Word16 idx_cv, /* i : index of cv from previous stage */ + Word16 *pTmp, /* i : 16 dimensional i vector x2.56*/ + Word16 *quant, /* o : quantized vector x2.56*/ Word16 *cv_out, /* o : corresponding 8-dim lattice codevectors (without the scaling) Q13*/ - Word16 *idx_lead, /* o : leader index for each 8-dim subvector */ - Word16 *idx_scale, /* o : scale index for each subvector */ - const Word16 *w, /* i : weights for LSF quantization Q10*/ + Word16 *idx_lead, /* o : leader index for each 8-dim subvector */ + Word16 *idx_scale, /* o : scale index for each subvector */ + const Word16 *w, /* i : weights for LSF quantization Q10*/ Word16 *no_scales ); Word32 mslvq_cng_ivas_fx( - Word16 idx_cv, /* i : index of cv from previous stage */ - Word16 *pTmp, /* i : 16 dimensional i vector x2.56*/ - Word16 *quant, /* o : quantized vector x2.56*/ + Word16 idx_cv, /* i : index of cv from previous stage */ + Word16 *pTmp, /* i : 16 dimensional i vector x2.56*/ + Word16 *quant, /* o : quantized vector x2.56*/ Word16 *cv_out, /* o : corresponding 8-dim lattice codevectors (without the scaling) Q13*/ - Word16 *idx_lead, /* o : leader index for each 8-dim subvector */ - Word16 *idx_scale, /* o : scale index for each subvector */ - const Word16 *w /* i : weights for LSF quantization Q10*/ + Word16 *idx_lead, /* o : leader index for each 8-dim subvector */ + Word16 *idx_scale, /* o : scale index for each subvector */ + const Word16 *w /* i : weights for LSF quantization Q10*/ ); void Unified_weighting_fx( - const Word32 Bin_Ener_128_fx[], /* i : FFT Bin energy 128 bins in two sets Q_ener */ + const Word32 Bin_Ener_128_fx[], /* i : FFT Bin energy 128 bins in two sets Q_ener */ Word16 Q_ener, - const Word16 lsf_fx[], /* i : LSF vector x2.56 */ - Word16 w_fx[], /* o : LP weighting filter (numerator) Q8 */ - const Word16 narrowBand, /* i : flag for Narrowband Q0*/ - const Word16 unvoiced, /* i : flag for Unvoiced frame Q0*/ - const Word32 sr_core, /* i : sampling rate of core-coder Q0*/ - const Word16 order /* i : LP order Q0*/ + const Word16 lsf_fx[], /* i : LSF vector x2.56 */ + Word16 w_fx[], /* o : LP weighting filter (numerator) Q8 */ + const Word16 narrowBand, /* i : flag for Narrowband Q0*/ + const Word16 unvoiced, /* i : flag for Unvoiced frame Q0*/ + const Word32 sr_core, /* i : sampling rate of core-coder Q0*/ + const Word16 order /* i : LP order Q0*/ ); Word32 qlsf_ARSN_tcvq_Enc_16k_fx( const Word16 *x_fx, /* i : Vector to be encoded x2.65 */ Word16 *y_fx, /* o : Quantized LSF vector x2.65 */ - Word16 *indice, /* o : Indices */ - const Word16 *w_fx, /* i : LSF Weights Q10 */ - const Word16 nBits, /* i : number of bits */ - Word16 safety_net /* i : safety_net flag */ + Word16 *indice, /* o : Indices */ + const Word16 *w_fx, /* i : LSF Weights Q10 */ + const Word16 nBits, /* i : number of bits */ + Word16 safety_net /* i : safety_net flag */ ); Word32 mslvq_fx( - Word16 *pTmp, /* i : M-dimensional i vector */ - Word16 *quant, /* o : quantized vector */ - Word16 *cv_out, /* o : corresponding 8-dim lattice codevectors (without the scaling) */ - Word16 *idx_lead, /* o : leader index for each 8-dim subvector */ - Word16 *idx_scale, /* o : scale index for each subvector */ - Word16 *w, /* i : weights for LSF quantization */ - Word16 mode, /* i : number indicating the coding type (V/UV/G...)*/ - Word16 mode_glb, /* i : LVQ coding mode */ - Word16 pred_flag, /* i : prediction flag (0: safety net, 1 - predictive )*/ + Word16 *pTmp, /* i : M-dimensional i vector */ + Word16 *quant, /* o : quantized vector */ + Word16 *cv_out, /* o : corresponding 8-dim lattice codevectors (without the scaling) */ + Word16 *idx_lead, /* o : leader index for each 8-dim subvector */ + Word16 *idx_scale, /* o : scale index for each subvector */ + Word16 *w, /* i : weights for LSF quantization */ + Word16 mode, /* i : number indicating the coding type (V/UV/G...) */ + Word16 mode_glb, /* i : LVQ coding mode */ + Word16 pred_flag, /* i : prediction flag (0: safety net, 1 - predictive ) */ Word16 no_scales[][2] ); - -/* o : frame multi-harmonicity (1-harmonic, 0-not) */ +/* o : frame multi-harmonicity (1-harmonic, 0-not) */ Word16 multi_harm_fx( - const Word16 Bin_E[], /* i : log-energy spectrum of the current frame Q7 */ - Word16 old_S[], /* i/o: prev. log-energy spectrum w. subtracted floor Q7 */ - Word16 cor_map_LT[], /* i/o: LT correlation map Q15 */ - Word16 *multi_harm_limit, /* i/o: multi harminic threshold Q9 */ - const Word32 total_brate, /* i : total bitrate Q0 */ - const Word16 bwidth, /* i : i signal bandwidth Q0 */ - Word16 *cor_strong_limit, /* i/o: HF correlation indicator Q0 */ - Word16 *st_mean_avr_dyn, /* i/o: long term average dynamic Q7 */ - Word16 *st_last_sw_dyn, /* i/o: last dynamic Q7 */ - Word16 *cor_map_sum, /* i : sum of correlation map Q8 */ + const Word16 Bin_E[], /* i : log-energy spectrum of the current frame Q7 */ + Word16 old_S[], /* i/o: prev. log-energy spectrum w. subtracted floor Q7 */ + Word16 cor_map_LT[], /* i/o: LT correlation map Q15 */ + Word16 *multi_harm_limit, /* i/o: multi harminic threshold Q9 */ + const Word32 total_brate, /* i : total bitrate Q0 */ + const Word16 bwidth, /* i : i signal bandwidth Q0 */ + Word16 *cor_strong_limit, /* i/o: HF correlation indicator Q0 */ + Word16 *st_mean_avr_dyn, /* i/o: long term average dynamic Q7 */ + Word16 *st_last_sw_dyn, /* i/o: last dynamic Q7 */ + Word16 *cor_map_sum, /* i : sum of correlation map Q8 */ Word16 *sp_floor, /* o: noise floor estimate Q7 */ Word16 S_map[] /* o : short-term correlation map Q7 */ ); -/* o : frame multi-harmonicity (1-harmonic, 0-not) */ +/* o : frame multi-harmonicity (1-harmonic, 0-not) */ Word16 multi_harm_ivas_fx( - const Word16 Bin_E[], /* i : log-energy spectrum of the current frame Q7 */ - Word16 old_S[], /* i/o: prev. log-energy spectrum w. subtracted floor Q7 */ - Word16 cor_map_LT[], /* i/o: LT correlation map Q15 */ - Word16 *multi_harm_limit, /* i/o: multi harminic threshold Q9 */ - const Word32 total_brate, /* i : total bitrate Q0 */ - const Word16 bwidth, /* i : i signal bandwidth Q0 */ - Word16 *cor_strong_limit, /* i/o: HF correlation indicator Q0 */ - Word16 *st_mean_avr_dyn, /* i/o: long term average dynamic Q7 */ - Word16 *st_last_sw_dyn, /* i/o: last dynamic Q7 */ - Word16 *cor_map_sum, /* i : sum of correlation map Q8 */ + const Word16 Bin_E[], /* i : log-energy spectrum of the current frame Q7 */ + Word16 old_S[], /* i/o: prev. log-energy spectrum w. subtracted floor Q7 */ + Word16 cor_map_LT[], /* i/o: LT correlation map Q15 */ + Word16 *multi_harm_limit, /* i/o: multi harminic threshold Q9 */ + const Word32 total_brate, /* i : total bitrate Q0 */ + const Word16 bwidth, /* i : i signal bandwidth Q0 */ + Word16 *cor_strong_limit, /* i/o: HF correlation indicator Q0 */ + Word16 *st_mean_avr_dyn, /* i/o: long term average dynamic Q7 */ + Word16 *st_last_sw_dyn, /* i/o: last dynamic Q7 */ + Word16 *cor_map_sum, /* i : sum of correlation map Q8 */ Word16 *sp_floor, /* o: noise floor estimate Q7 */ Word16 S_map[] /* o : short-term correlation map Q7 */ ); void pvq_encode_frame_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 *coefs_norm, /* i : normalized coefficients to encode */ - Word16 Q_coefs, /* i : Q-point of coefs_norm[] */ - Word16 *coefs_quant, /* o : quantized coefficients */ - Word16 *gopt, /* o : optimal shape gains */ - Word16 *npulses, /* o : number of pulses per band */ - Word16 *pulse_vector, /* o : non-normalized pulse shapes */ - const Word16 *sfm_start, /* i : indices of first coefficients in the bands */ - const Word16 *sfm_end, /* i : indices of last coefficients in the bands */ - const Word16 *sfmsize, /* i : band sizes */ - const Word16 nb_sfm, /* i : total number of bands */ - const Word16 *R, /* i : bitallocation per band Q3 */ - const Word16 pvq_bits, /* i : number of bits avaiable */ - const Word16 core /* i : core */ + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + const Word16 *coefs_norm, /* i : normalized coefficients to encode */ + Word16 Q_coefs, /* i : Q-point of coefs_norm[] */ + Word16 *coefs_quant, /* o : quantized coefficients */ + Word16 *gopt, /* o : optimal shape gains */ + Word16 *npulses, /* o : number of pulses per band */ + Word16 *pulse_vector, /* o : non-normalized pulse shapes */ + const Word16 *sfm_start, /* i : indices of first coefficients in the bands */ + const Word16 *sfm_end, /* i : indices of last coefficients in the bands */ + const Word16 *sfmsize, /* i : band sizes */ + const Word16 nb_sfm, /* i : total number of bands */ + const Word16 *R, /* i : bitallocation per band Q3 */ + const Word16 pvq_bits, /* i : number of bits avaiable */ + const Word16 core /* i : core */ ); + void pvq_encode_frame_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 *coefs_norm, /* i : normalized coefficients to encode */ - Word16 Q_coefs, /* i : Q-point of coefs_norm[] */ - Word16 *coefs_quant, /* o : quantized coefficients */ - Word16 *gopt, /* o : optimal shape gains */ - Word16 *npulses, /* o : number of pulses per band */ - Word16 *pulse_vector, /* o : non-normalized pulse shapes */ - const Word16 *sfm_start, /* i : indices of first coefficients in the bands */ - const Word16 *sfm_end, /* i : indices of last coefficients in the bands */ - const Word16 *sfmsize, /* i : band sizes */ - const Word16 nb_sfm, /* i : total number of bands */ - const Word16 *R, /* i : bitallocation per band Q3 */ - const Word16 pvq_bits, /* i : number of bits avaiable */ - const Word16 core /* i : core */ + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + const Word16 *coefs_norm, /* i : normalized coefficients to encode */ + Word16 Q_coefs, /* i : Q-point of coefs_norm[] */ + Word16 *coefs_quant, /* o : quantized coefficients */ + Word16 *gopt, /* o : optimal shape gains */ + Word16 *npulses, /* o : number of pulses per band */ + Word16 *pulse_vector, /* o : non-normalized pulse shapes */ + const Word16 *sfm_start, /* i : indices of first coefficients in the bands */ + const Word16 *sfm_end, /* i : indices of last coefficients in the bands */ + const Word16 *sfmsize, /* i : band sizes */ + const Word16 nb_sfm, /* i : total number of bands */ + const Word16 *R, /* i : bitallocation per band Q3 */ + const Word16 pvq_bits, /* i : number of bits avaiable */ + const Word16 core /* i : core */ ); /*Qx o : interpolated value */ @@ -4594,49 +4561,49 @@ Word16 Interpol_4( ); void set_ppp_mode_fx( - Encoder_State *st_fx, /* i/o: state structure */ - const Word16 noisy_speech_HO, /* i : SC-VBR noisy speech HO flag */ - const Word16 clean_speech_HO, /* i : SC-VBR clean speech HO flag */ - const Word16 NB_speech_HO, /* i : SC-VBR NB speech HO flag */ - const Word16 localVAD_he /* i : HE-SAD flag without hangover */ + Encoder_State *st_fx, /* i/o: state structure */ + const Word16 noisy_speech_HO, /* i : SC-VBR noisy speech HO flag */ + const Word16 clean_speech_HO, /* i : SC-VBR clean speech HO flag */ + const Word16 NB_speech_HO, /* i : SC-VBR NB speech HO flag */ + const Word16 localVAD_he /* i : HE-SAD flag without hangover */ ); void decision_matrix_enc_fx( - Encoder_State *st_fx, /* i : encoder state structure */ + Encoder_State *st_fx, /* i : encoder state structure */ Word16 *hq_core_type /* o : HQ core_fx type Q0*/ ); void pvq_encode_fx( BSTR_ENC_HANDLE hBstr, - PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ - const Word16 *x, /* i: vector to quantize Q15-3=>Q12 */ - Word16 *y, /* o: raw pulses (non-scaled short) Q0 */ - Word16 *xq, /* o: quantized vector Q15 */ - Word32 *L_xq, /* o: quantized vector Q31 */ - const Word16 pulses, /* i: number of allocated pulses */ - const Word16 dim, /* i: Length of vector */ - const Word16 neg_gain /* i: - Gain use - negative gain in Q15 0 ..1 */ + PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ + const Word16 *x, /* i : vector to quantize Q15-3=>Q12 */ + Word16 *y, /* o : raw pulses (non-scaled short) Q0 */ + Word16 *xq, /* o : quantized vector Q15 */ + Word32 *L_xq, /* o : quantized vector Q31 */ + const Word16 pulses, /* i : number of allocated pulses */ + const Word16 dim, /* i : Length of vector */ + const Word16 neg_gain /* i : Gain use - negative gain in Q15 0 ..1 */ ); void pvq_encode_ivas_fx( BSTR_ENC_HANDLE hBstr, - PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ - const Word16 *x, /* i: vector to quantize Q15-3=>Q12 */ - Word16 *y, /* o: raw pulses (non-scaled short) Q0 */ - Word16 *xq, /* o: quantized vector Q15 */ - Word32 *L_xq, /* o: quantized vector Q31 */ - const Word16 pulses, /* i: number of allocated pulses */ - const Word16 dim, /* i: Length of vector */ - const Word16 neg_gain /* i: - Gain use - negative gain in Q15 0 ..1 */ + PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ + const Word16 *x, /* i : vector to quantize Q15-3=>Q12 */ + Word16 *y, /* o : raw pulses (non-scaled short) Q0 */ + Word16 *xq, /* o : quantized vector Q15 */ + Word32 *L_xq, /* o : quantized vector Q31 */ + const Word16 pulses, /* i : number of allocated pulses */ + const Word16 dim, /* i : Length of vector */ + const Word16 neg_gain /* i : Gain use - negative gain in Q15 0 ..1 */ ); void rc_enc_init_fx( - PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ - Word16 tot_bits /* i : Total bit budget Q0*/ + PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ + Word16 tot_bits /* i : Total bit budget Q0*/ ); void rc_enc_finish_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: Encoder state */ + BSTR_ENC_HANDLE hBstr, /* i/o: Encoder state */ PVQ_ENC_HANDLE hPVQ /* i/o: PVQ encoder handle */ ); @@ -4647,47 +4614,47 @@ void rc_enc_finish_ivas_fx( ); void rc_encode_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ - UWord32 cum_freq, /* i : Cumulative frequency up to symbol Q0*/ - UWord32 sym_freq, /* i : Symbol probability Q0*/ - UWord32 tot /* i : Total cumulative frequency Q0*/ + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ + UWord32 cum_freq, /* i : Cumulative frequency up to symbol Q0*/ + UWord32 sym_freq, /* i : Symbol probability Q0*/ + UWord32 tot /* i : Total cumulative frequency Q0*/ ); void rc_encode_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ - UWord32 cum_freq, /* i : Cumulative frequency up to symbol Q0*/ - UWord32 sym_freq, /* i : Symbol probability Q0*/ - UWord32 tot /* i : Total cumulative frequency Q0*/ + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ + UWord32 cum_freq, /* i : Cumulative frequency up to symbol Q0*/ + UWord32 sym_freq, /* i : Symbol probability Q0*/ + UWord32 tot /* i : Total cumulative frequency Q0*/ ); void rc_enc_uniform_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ - UWord32 value, /* i : Value to encode Q0*/ - UWord32 tot /* i : Maximum value Q0*/ + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ + UWord32 value, /* i : Value to encode Q0*/ + UWord32 tot /* i : Maximum value Q0*/ ); void rc_enc_uniform_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ - UWord32 value, /* i : Value to encode Q0*/ - UWord32 tot /* i : Maximum value Q0*/ + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ + UWord32 value, /* i : Value to encode Q0*/ + UWord32 tot /* i : Maximum value Q0*/ ); void rc_enc_bits_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ - UWord32 value, /* i : Value to encode Q0*/ - Word16 bits /* i : Number of bits used Q0*/ + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ + UWord32 value, /* i : Value to encode Q0*/ + Word16 bits /* i : Number of bits used Q0*/ ); void rc_enc_bits_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ - UWord32 value, /* i : Value to encode Q0*/ - Word16 bits /* i : Number of bits used Q0*/ + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ + UWord32 value, /* i : Value to encode Q0*/ + Word16 bits /* i : Number of bits used Q0*/ ); void re8_compute_base_index_fx( @@ -4700,7 +4667,7 @@ void tfaCalcEnv_fx( const Word16 *shb_speech, Word32 *enr ); -/* o : pitch index */ +/* o : pitch index */ Word16 delta_pit_enc_fx( const Word16 fr_steps, /* i : fractional resolution steps (2 or 4)*/ const Word16 T0, /* i : integer pitch lag */ @@ -4709,17 +4676,17 @@ Word16 delta_pit_enc_fx( ); void set_impulse_fx( - const Word16 xn_fx[], /* i : target signal Q_new-1+shift*/ - const Word16 h_orig_fx[], /* i : impulse response of weighted synthesis filter Q(14+shift)*/ - Word16 exc_fx[], /* o : adaptive codebook excitation Q_new*/ - Word16 yy1_fx[], /* o : filtered adaptive codebook excitation Q_new*/ - Word16 *imp_shape, /* o : adaptive codebook index Q0*/ - Word16 *imp_pos, /* o : position of the glottal impulse center index Q0*/ - Word32 *gain_trans_fx, /* o : transition gain Q7*/ - Word16 Q_new /* i : Current scaling */ + const Word16 xn_fx[], /* i : target signal Q_new-1+shift*/ + const Word16 h_orig_fx[], /* i : impulse response of weighted synthesis filter Q(14+shift)*/ + Word16 exc_fx[], /* o : adaptive codebook excitation Q_new*/ + Word16 yy1_fx[], /* o : filtered adaptive codebook excitation Q_new*/ + Word16 *imp_shape, /* o : adaptive codebook index Q0*/ + Word16 *imp_pos, /* o : position of the glottal impulse center index Q0*/ + Word32 *gain_trans_fx, /* o : transition gain Q7*/ + Word16 Q_new /* i : Current scaling */ ); -/* o : pitch index */ +/* o : pitch index */ Word16 abs_pit_enc_fx( const Word16 fr_steps, /* i : fractional resolution steps (2 or 4) for shortest pitches*/ const Word16 limit_flag, /* i : restrained(0) or extended(1) limits */ @@ -4728,19 +4695,19 @@ Word16 abs_pit_enc_fx( ); ivas_error ppp_quarter_encoder_fx( - Word16 *returnFlag, /* o : return value */ - DTFS_STRUCTURE *CURRCW_Q_FX, /* o : Quantized (amp/phase) DTFS */ - DTFS_STRUCTURE *TARGETCW_FX, /* o : DTFS with quant phase but unquant Amp */ - Word16 prevCW_lag, /* i : previous lag */ - DTFS_STRUCTURE vCURRCW_NQ_FX, /* i : Unquantized DTFS */ - const Word16 *curr_lpc_fx, /* i : LPCS */ - Word16 *lastLgainE_fx, /* i/o: last low band gain */ - Word16 *lastHgainE_fx, /* i/o: last high band gain */ - Word16 *lasterbE_fx, /* i/o: last ERB vector */ - DTFS_STRUCTURE PREV_CW_E_FX, /* i : past DTFS */ - Word16 *S_fx, /* i : sin table, Q15 */ - Word16 *C_fx, /* i : cos table, Q15 */ - BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle */ + Word16 *returnFlag, /* o : return value */ + DTFS_STRUCTURE *CURRCW_Q_FX, /* o : Quantized (amp/phase) DTFS */ + DTFS_STRUCTURE *TARGETCW_FX, /* o : DTFS with quant phase but unquant Amp */ + Word16 prevCW_lag, /* i : previous lag */ + DTFS_STRUCTURE vCURRCW_NQ_FX, /* i : Unquantized DTFS */ + const Word16 *curr_lpc_fx, /* i : LPCS */ + Word16 *lastLgainE_fx, /* i/o: last low band gain */ + Word16 *lastHgainE_fx, /* i/o: last high band gain */ + Word16 *lasterbE_fx, /* i/o: last ERB vector */ + DTFS_STRUCTURE PREV_CW_E_FX, /* i : past DTFS */ + Word16 *S_fx, /* i : sin table, Q15 */ + Word16 *C_fx, /* i : cos table, Q15 */ + BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle */ ); void index_lvq_fx( @@ -4762,15 +4729,15 @@ void index_lvq_ivas_fx( const Word16 prediction_flag ); ivas_error init_encoder_fx( - Encoder_State *st_fx, /* i/o: Encoder static variables structure */ - const int16_t var_SID_rate_flag, /* i : flag for variable SID update rate */ - const int16_t interval_SID /* i : interval for SID update */ + Encoder_State *st_fx, /* i/o: Encoder static variables structure */ + const Word16 var_SID_rate_flag, /* i : flag for variable SID update rate */ + const Word16 interval_SID /* i : interval for SID update */ ); void copy_encoder_config_fx( - Encoder_Struct *st_ivas, /* i : IVAS encoder structure */ - Encoder_State *st, /* o : encoder state structure */ - const Word16 flag_all /* i : flag 1==update all, 0=partial update Q0*/ + Encoder_Struct *st_ivas, /* i : IVAS encoder structure */ + Encoder_State *st, /* o : encoder state structure */ + const Word16 flag_all /* i : flag 1==update all, 0=partial update Q0*/ ); void destroy_encoder_fx( @@ -4778,9 +4745,9 @@ void destroy_encoder_fx( ); void amr_wb_enc_fx( - Encoder_State *st, /* i/o: encoder state structure */ - const Word16 input_sp[], /* i : i signal Q0*/ - const Word16 n_samples /* i : number of i samples Q0*/ + Encoder_State *st, /* i/o: encoder state structure */ + const Word16 input_sp[], /* i : i signal Q0*/ + const Word16 n_samples /* i : number of i samples Q0*/ ); void writeLPCparam_fx( diff --git a/lib_enc/pvq_encode_fx.c b/lib_enc/pvq_encode_fx.c index 943f815016db7ccbd2538c29c614dcf3104752ca..85704ccf3ba1417296f037dc7caccd8d63ddda6a 100644 --- a/lib_enc/pvq_encode_fx.c +++ b/lib_enc/pvq_encode_fx.c @@ -67,7 +67,7 @@ static Word16 one_pulse_search( en_tmp = en_dn_shift; /* dummy assignment to avoid compiler warning for unused parameter */ /* maximize correlation precision, prior to every unit pulse addition in the vector */ - corr_up_shift = norm_l( L_mac( *L_xy_ptr, 1, max_xabs ) ); /* pre analyze worst case L_xy update in the dim loop , 2 ops */ + corr_up_shift = norm_l( L_mac( *L_xy_ptr, 1, max_xabs ) ); /* pre analyze worst case L_xy update in the dim loop, 2 ops */ imax = -1; /* not needed for search, only added to avoid compiler warning */ /* clean BE code, with split out low/high precision loops */ diff --git a/lib_enc/set_impulse_fx.c b/lib_enc/set_impulse_fx.c index 893e1faaf9ae7f96c0615220c363992b1c72f8e2..68dc2038ea38dd93e3680312453c32b8858a48a0 100644 --- a/lib_enc/set_impulse_fx.c +++ b/lib_enc/set_impulse_fx.c @@ -12,6 +12,7 @@ /*-----------------------------------------------------------------* * Local constant + *-----------------------------------------------------------------*/ #define INPOL 4 /* +- range in samples for impulse position searching */ diff --git a/lib_enc/sig_clas_fx.c b/lib_enc/sig_clas_fx.c index beb97514a0d139e512f3936143a461e75d89de6e..78caad798f008b29eaa213f9f11c55fe575f3713 100644 --- a/lib_enc/sig_clas_fx.c +++ b/lib_enc/sig_clas_fx.c @@ -5,7 +5,6 @@ #include #include "options.h" /* Compilation switches */ #include "cnst.h" /* Common constants */ -//#include "prot_fx.h" /* Function prototypes */ #include "rom_com.h" #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ diff --git a/lib_enc/speech_music_classif_fx.c b/lib_enc/speech_music_classif_fx.c index 24475be37c441e2e8acab79acf339f8e7f59b4d7..38fd1726005ea31439079f1bdebb53e8d36bb85a 100644 --- a/lib_enc/speech_music_classif_fx.c +++ b/lib_enc/speech_music_classif_fx.c @@ -1913,8 +1913,8 @@ Word16 ivas_smc_gmm_fx( Word16 guard_bits = find_guarded_bits_fx( NB_MEL_BANDS ); move16(); - v_mult_mat_fixed( mfcc_fx, melS_fx, dct_mtx_fx, NB_MEL_BANDS, NB_MEL_COEF, guard_bits ); // Q19 - *pFV_fx++ = L_shl( mfcc_fx[2], 1 ); // Q20 + v_mult_mat_fx( mfcc_fx, melS_fx, dct_mtx_fx, NB_MEL_BANDS, NB_MEL_COEF, guard_bits ); // Q19 + *pFV_fx++ = L_shl( mfcc_fx[2], 1 ); // Q20 move32(); *pFV_fx++ = L_shl( mfcc_fx[6], 1 ); move32(); @@ -2171,8 +2171,9 @@ Word16 ivas_smc_gmm_fx( } /* PCA */ - v_sub_fixed_no_hdrm( FV_fx, pca_mean_fx, FV_fx, N_SMC_FEATURES ); - v_mult_mat_fixed( FV_fx, FV_fx, pca_components_fx, N_SMC_FEATURES, N_PCA_COEF, 0 ); + v_sub_fx_no_hdrm( FV_fx, pca_mean_fx, FV_fx, N_SMC_FEATURES ); + v_mult_mat_fx( FV_fx, FV_fx, pca_components_fx, N_SMC_FEATURES, N_PCA_COEF, 0 ); + /*------------------------------------------------------------------* * Calculation of posterior probability * Log-probability @@ -2187,15 +2188,15 @@ Word16 ivas_smc_gmm_fx( FOR( m = 0; m < N_SMC_MIXTURES; m++ ) { v_sub32_fx( FV_fx, &means_speech_fx[m * N_PCA_COEF], fvm_fx, N_PCA_COEF ); - wprob_fx = dot_product_cholesky_fixed( fvm_fx, &prec_chol_speech_fx[m * ( N_PCA_COEF * N_PCA_COEF + N_PCA_COEF ) / 2], N_PCA_COEF ); // Q10 + wprob_fx = dot_product_cholesky_fx( fvm_fx, &prec_chol_speech_fx[m * ( N_PCA_COEF * N_PCA_COEF + N_PCA_COEF ) / 2], N_PCA_COEF ); // Q10 ps_fx[m] = L_sub( L_sub( L_add( log_weights_speech_compute[m], log_det_chol_speech_fx[m] ), W_extract_l( W_shr( wprob_fx, Q10 ) ) ), HALF_N_PCA_COEF_LOG_P12_Q18 ); // Q18 move32(); v_sub32_fx( FV_fx, &means_music_fx[m * N_PCA_COEF], fvm_fx, N_PCA_COEF ); - wprob_fx = dot_product_cholesky_fixed( fvm_fx, &prec_chol_music_fx[m * ( N_PCA_COEF * N_PCA_COEF + N_PCA_COEF ) / 2], N_PCA_COEF ); // Q10 + wprob_fx = dot_product_cholesky_fx( fvm_fx, &prec_chol_music_fx[m * ( N_PCA_COEF * N_PCA_COEF + N_PCA_COEF ) / 2], N_PCA_COEF ); // Q10 pm_fx[m] = L_sub( L_sub( L_add( log_weights_music_compute[m], log_det_chol_music_fx[m] ), W_extract_l( W_shr( wprob_fx, Q10 ) ) ), HALF_N_PCA_COEF_LOG_P12_Q18 ); // Q18 move32(); v_sub32_fx( FV_fx, &means_noise_fx[m * N_PCA_COEF], fvm_fx, N_PCA_COEF ); - wprob_fx = dot_product_cholesky_fixed( fvm_fx, &prec_chol_noise_fx[m * ( N_PCA_COEF * N_PCA_COEF + N_PCA_COEF ) / 2], N_PCA_COEF ); // Q10 + wprob_fx = dot_product_cholesky_fx( fvm_fx, &prec_chol_noise_fx[m * ( N_PCA_COEF * N_PCA_COEF + N_PCA_COEF ) / 2], N_PCA_COEF ); // Q10 pn_fx[m] = L_sub( L_sub( L_add( log_weights_noise_compute[m], log_det_chol_noise_fx[m] ), W_extract_l( W_shr( wprob_fx, Q10 ) ) ), HALF_N_PCA_COEF_LOG_P12_Q18 ); // Q18 move32(); } diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index d9afb7f996e8e889ddcf74a95f8a68dda943d4a8..e20c06fd45eee9b8b8b1158c0df4b16d9722d4a7 100644 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -1685,7 +1685,6 @@ typedef struct enc_core_structure Word16 encoderLookahead_FB; /* pitch_ol for adaptive lag window */ - Word16 old_pitch_la; /* past open loop pitch lag from look-ahead before very short stable pitch detection */ Word16 old_voicing_la; /* past open loop pitch gain from look-ahead */ diff --git a/lib_enc/swb_bwe_enc_fx.c b/lib_enc/swb_bwe_enc_fx.c index bc849fe399dfb61d19c5af925e6b61a6c1d3623b..af72e0f4926c25256e65079a8429764c0bf1d520 100644 --- a/lib_enc/swb_bwe_enc_fx.c +++ b/lib_enc/swb_bwe_enc_fx.c @@ -431,7 +431,7 @@ void swb_bwe_enc_ivas_fx( /* high-band gain control in case of BWS */ IF( st_fx->bwidth_sw_cnt > 0 ) { - v_multc_fixed_16( &yorig_32[L_FRAME16k], div_s( st_fx->bwidth_sw_cnt, BWS_TRAN_PERIOD ), &yorig_32[L_FRAME16k], sub( inner_frame, L_FRAME16k ) ); + v_multc_fx_16( &yorig_32[L_FRAME16k], div_s( st_fx->bwidth_sw_cnt, BWS_TRAN_PERIOD ), &yorig_32[L_FRAME16k], sub( inner_frame, L_FRAME16k ) ); } /* Convert to 16 Bits (Calc Shift Required to Stay within MAX_Q_NEW_INPUT) */ diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index b5b2ca9ad221bdc65baabcdc75610e438bbb0362..0dc1ad698662af60efa13bf37c3ddf24066b0ef1 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -52,13 +52,17 @@ static Word32 pow_off_pk_fx( Word16 a[], Word16 len, Word16 step ); static Word32 pow_off_pk_corrected_fx( Word16 a[], Word16 len, Word16 step ); static void find_max_mem_enc( Encoder_State *st_fx, Word16 *n_mem, Word16 *n_mem2 ); + static void rescale_genSHB_mem_enc( Encoder_State *st_fx, Word16 sf ); + static void find_max_mem_wb_enc( Encoder_State *st_fx, Word16 *n_mem ); + static void rescale_genWB_mem_enc( Encoder_State *st_fx, Word16 sf ); static void Quant_lower_LSF_fx( const Word16 lsf[], Word16 lsf_q[], Word16 lsf_idx[] ); static Word16 Quant_mirror_point_fx( const Word16 lsf[], const Word16 lsf_q[], Word16 *m ); + static Word16 Find_LSF_grid_fx( const Word16 lsf[], Word16 lsf_q[], const Word16 m ); static void Quant_BWE_LSF_fx( Encoder_State *st_fx, const Word16 lsp_shb[], Word16 Q_lsfs[] ); @@ -83,6 +87,7 @@ static void gainFrSmooth_En_ivas_fx( Encoder_State *st_fx, Word16 *shb_frame_fx * * Find norm and max in TBE memories and past buffers *-------------------------------------------------------------------*/ + void find_max_mem_enc( Encoder_State *st_fx, Word16 *n_mem, @@ -188,6 +193,8 @@ void find_max_mem_enc( tempQ15 = sub( s_min( *n_mem, n_mem_32 ), 1 ); *n_mem = s_max( tempQ15, 0 ); move16(); + + return; } @@ -196,7 +203,10 @@ void find_max_mem_enc( * * Rescale genSHB memories *-------------------------------------------------------------------*/ -void rescale_genSHB_mem_enc( Encoder_State *st_fx, Word16 sf ) + +void rescale_genSHB_mem_enc( + Encoder_State *st_fx, + Word16 sf ) { Word16 i; TD_BWE_ENC_HANDLE hBWE_TD = st_fx->hBWE_TD; @@ -5599,6 +5609,7 @@ static void Quant_shb_ener_sf_fx( { push_indice( st_fx->hBstr, IND_SHB_ENER_SF, idxSubEner_fx, NUM_BITS_SHB_ENER_SF ); } + return; } @@ -5653,6 +5664,7 @@ static void Quant_shb_ener_sf_ivas_fx( { push_indice( st_fx->hBstr, IND_SHB_ENER_SF, idxSubEner_fx, NUM_BITS_SHB_ENER_SF ); } + return; } @@ -5687,6 +5699,8 @@ static void Quant_shb_res_gshape_fx( push_indice( st_fx->hBstr, IND_SHB_RES_GS + i, idxSubGain_fx[i], NUM_BITS_SHB_RES_GS ); } } + + return; } @@ -5723,6 +5737,8 @@ static void Quant_shb_res_gshape_ivas_fx( push_indice( st->hBstr, IND_SHB_RES_GS + i, idxSubGain_fx[i], NUM_BITS_SHB_RES_GS ); } } + + return; } @@ -5750,8 +5766,7 @@ static void QuantizeSHBframegain_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ Word32 *GainFrame, /* i/o: Gain Q18 */ const Word16 extl, /* i : extension layer */ - Word32 extl_brate /* i : extension layer bitrate */ - , + Word32 extl_brate, /* i : extension layer bitrate */ Word16 *rf_gainFrame_ind ) { Word16 idxFrameGain; @@ -6630,7 +6645,7 @@ static void gainFrSmooth_En_fx( Encoder_State *st_fx, } test(); - if ( LT_32( lsp_slow_evol_rate, 2147484l /*0.001f Q31*/ ) && LT_32( lsp_fast_evol_rate, 2147484l /*0.001f Q31*/ ) ) + if ( LT_32( lsp_slow_evol_rate, INV_1000_Q31 ) && LT_32( lsp_fast_evol_rate, 2147484l /*0.001f Q31*/ ) ) { *frGainSmoothEn = 1; move16(); @@ -6757,7 +6772,7 @@ static void gainFrSmooth_En_ivas_fx( Encoder_State *st_fx, } test(); - if ( ( BASOP_Util_Cmp_Mant32Exp( lsp_slow_evol_rate, lsp_slow_evol_rate_e, 2147484l /*0.001f in Q31*/, 0 ) < 0 ) && ( BASOP_Util_Cmp_Mant32Exp( lsp_fast_evol_rate, lsp_fast_evol_rate_e, 2147484l /*0.001f in Q31*/, 0 ) < 0 ) ) + if ( ( BASOP_Util_Cmp_Mant32Exp( lsp_slow_evol_rate, lsp_slow_evol_rate_e, INV_1000_Q31, 0 ) < 0 ) && ( BASOP_Util_Cmp_Mant32Exp( lsp_fast_evol_rate, lsp_fast_evol_rate_e, 2147484l /*0.001f in Q31*/, 0 ) < 0 ) ) { *frGainSmoothEn = 1; move16(); diff --git a/lib_enc/vad_fx.c b/lib_enc/vad_fx.c index 349cbf268b7a3399d910c1b4f4eb7ae8a0383f8a..c4c6df6c3b4e55a8e1aa0beccac0951ecdbb63d7 100644 --- a/lib_enc/vad_fx.c +++ b/lib_enc/vad_fx.c @@ -1,10 +1,10 @@ /*==================================================================================== EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0 ====================================================================================*/ + #include #include "options.h" #include "cnst.h" /* Common constants */ -//#include "prot_fx.h" /* Function prototypes */ #include "rom_enc.h" #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ @@ -75,9 +75,10 @@ /* snr_sum = "scale" * (float)log10( L_snr_sum ) ;*/ -static Word16 vad_snr_log_fx( /* o: Q8 */ - Word32 L_snr, /* i: Q4 */ - Word16 scale /* i: scale Q13 , 10.0*log10(2) or 1.0*log10(2) */ +/* o: Q8 */ +static Word16 vad_snr_log_fx( + Word32 L_snr, /* i: Q4 */ + Word16 scale /* i: scale Q13 , 10.0*log10(2) or 1.0*log10(2) */ ) { Word16 e_snr, f_snr; diff --git a/lib_enc/vad_param_updt_fx.c b/lib_enc/vad_param_updt_fx.c index a858c5cc60b905aa65ec2d940759b6720002c5f0..9738da4d653187e2e8c9c77ad19b984e32af1e3a 100644 --- a/lib_enc/vad_param_updt_fx.c +++ b/lib_enc/vad_param_updt_fx.c @@ -1,11 +1,11 @@ /*==================================================================================== EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0 ====================================================================================*/ + #include #include -#include "options.h" /* Compilation switches */ -#include "cnst.h" /* Common constants */ -//#include "prot_fx.h" /* Function prototypes */ +#include "options.h" /* Compilation switches */ +#include "cnst.h" /* Common constants */ #include "ivas_stat_enc.h" /* Function prototypes */ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ @@ -58,8 +58,7 @@ void vad_param_updt_fx( } IF( !st_fx->Opt_AMR_WB ) { - /* fix explanation - , after function dtx_fx, the "vad_flag" parameter can not be used for SID scheduling purposes any longer + /* fix explanation, after function dtx_fx, the "vad_flag" parameter can not be used for SID scheduling purposes any longer as dtx_fx can schedules active frames even if the initial analyzed vad_flag is 0 ) in the worst case without the fix an active frame could be classified as SID frame, quite/very unlikley though */ diff --git a/lib_isar/isar_splitRendererPLC.c b/lib_isar/isar_splitRendererPLC.c index 60eeff74646131f51385c5ceb22327a587dcd128..d807a26e6ea2eebbd5a35efbadce5d281a56e74c 100644 --- a/lib_isar/isar_splitRendererPLC.c +++ b/lib_isar/isar_splitRendererPLC.c @@ -1277,8 +1277,8 @@ void isar_splitBinRendPLC( { FOR( k = 0; k < iNumCols; k++ ) { - v_multc_fixed( &Cldfb_RealBuffer_Binaural_fx[n][k][0], fade_fac_fx, &Cldfb_RealBuffer_Binaural_fx[n][k][0], (Word16) CLDFB_NO_CHANNELS_MAX ); - v_multc_fixed( &Cldfb_ImagBuffer_Binaural_fx[n][k][0], fade_fac_fx, &Cldfb_ImagBuffer_Binaural_fx[n][k][0], (Word16) CLDFB_NO_CHANNELS_MAX ); + v_multc_fx( &Cldfb_RealBuffer_Binaural_fx[n][k][0], fade_fac_fx, &Cldfb_RealBuffer_Binaural_fx[n][k][0], (Word16) CLDFB_NO_CHANNELS_MAX ); + v_multc_fx( &Cldfb_ImagBuffer_Binaural_fx[n][k][0], fade_fac_fx, &Cldfb_ImagBuffer_Binaural_fx[n][k][0], (Word16) CLDFB_NO_CHANNELS_MAX ); } } } diff --git a/lib_isar/lib_isar_post_rend.c b/lib_isar/lib_isar_post_rend.c index c64e593393ac550472f212fa6107e3ff0e497791..baec692cef9cb2dd109748f47b61e9680b6f5e57 100644 --- a/lib_isar/lib_isar_post_rend.c +++ b/lib_isar/lib_isar_post_rend.c @@ -1629,10 +1629,10 @@ static ivas_error renderInputSplitBin( splitBinInput->base.numNewSamplesPerChannel = 0; /* Apply input gain to new audio */ - v_multc_fixed( inAudio.data_fx, - splitBinInput->base.gain_fx, - inAudio.data_fx, - inAudio.config.numSamplesPerChannel * inAudio.config.numChannels ); + v_multc_fx( inAudio.data_fx, + splitBinInput->base.gain_fx, + inAudio.data_fx, + inAudio.config.numSamplesPerChannel * inAudio.config.numChannels ); SWITCH( outConfig ) { diff --git a/lib_isar/lib_isar_pre_rend.c b/lib_isar/lib_isar_pre_rend.c index da4f6542f69b0cfefab4404a2182a7672c1731d3..1ba5cafc4ed0bfb5c5e7b8502b92475e80997521 100644 --- a/lib_isar/lib_isar_pre_rend.c +++ b/lib_isar/lib_isar_pre_rend.c @@ -119,8 +119,8 @@ ivas_error ISAR_PRE_REND_open( FOR( ch = 0; ch < num_ch; ch++ ) { - if ( ( error = openCldfb_ivas_fx( &( hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] ), - CLDFB_ANALYSIS, OutSampleRate, CLDFB_PROTOTYPE_5_00MS, DEC ) ) != IVAS_ERR_OK ) + IF( ( error = openCldfb_ivas_fx( &( hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] ), + CLDFB_ANALYSIS, OutSampleRate, CLDFB_PROTOTYPE_5_00MS, DEC ) ) != IVAS_ERR_OK ) { return error; } @@ -152,7 +152,7 @@ ivas_error ISAR_PRE_REND_open( { IF( EQ_16( pSplitRendConfig->codec, ISAR_SPLIT_REND_CODEC_LC3PLUS ) ) { - if ( ( error = split_renderer_open_lc3plus( hSplitRendWrapper, pSplitRendConfig, OutSampleRate, ivas_frame_size ) ) != IVAS_ERR_OK ) + IF( ( error = split_renderer_open_lc3plus( hSplitRendWrapper, pSplitRendConfig, OutSampleRate, ivas_frame_size ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_rend/ivas_crend_fx.c b/lib_rend/ivas_crend_fx.c index c3d3acf87360472b2b4eff8d069424c51576c5a9..9c3379527d84ee278052b0ce8099af94674a623c 100644 --- a/lib_rend/ivas_crend_fx.c +++ b/lib_rend/ivas_crend_fx.c @@ -2048,8 +2048,7 @@ ivas_error ivas_rend_crendProcessSubframe_fx( Word32 *input_f[], /* i : transport channels Qx */ Word32 *output[], /* i/o: input/output audio channels Qx */ const Word16 n_samples_to_render, /* i : output frame length per channel */ - const Word32 output_Fs /* i : output sampling rate */ - , + const Word32 output_Fs, /* i : output sampling rate */ const Word16 pos_idx ) { Word16 subframe_idx, subframe_len; @@ -2343,8 +2342,8 @@ ivas_error ivas_rend_crendProcessSubframesSplitBin( { Copy32( output[hIntSetup->index_lfe[0]], tmpLfeBuffer, n_samples_to_render ); gain_lfe = ( ( pCrend != NULL ) && ( pCrend->hHrtfCrend != NULL ) ) ? pCrend->hHrtfCrend->gain_lfe_fx : GAIN_LFE_FX; - v_multc_fixed_16( tmpLfeBuffer, gain_lfe, tmpLfeBuffer, n_samples_to_render ); // q_input_fx - 1 - Scale_sig32( tmpLfeBuffer, n_samples_to_render, 1 ); // q_input_fx + v_multc_fx_16( tmpLfeBuffer, gain_lfe, tmpLfeBuffer, n_samples_to_render ); // q_input_fx - 1 + Scale_sig32( tmpLfeBuffer, n_samples_to_render, 1 ); // q_input_fx } ELSE { diff --git a/lib_rend/ivas_dirac_ana_fx.c b/lib_rend/ivas_dirac_ana_fx.c index 4e00b96232a515e7f08383a3c9451ac7aa2cadf5..502f4f5ae81acc7af1caa8d4935f9c1089f9923f 100644 --- a/lib_rend/ivas_dirac_ana_fx.c +++ b/lib_rend/ivas_dirac_ana_fx.c @@ -411,7 +411,7 @@ static void ivas_dirac_param_est_ana_fx( /* Direction estimation */ computeIntensityVector_ana_fx( hDirAC->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, num_freq_bands, intensity_real_fx, intensity_real_q, inp_q ); - computeDirectionVectors_fixed( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], 0, intensity_real_q ); + computeDirectionVectors_fx2( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], 0, intensity_real_q ); /* Power estimation for diffuseness */ computeReferencePower_ana_fx( hDirAC->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, reference_power_fx[ts], num_freq_bands, inp_q, &reference_power_q ); @@ -446,7 +446,7 @@ static void ivas_dirac_param_est_ana_fx( Copy32( reference_power_fx[ts], &( hDirAC->buffer_energy_fx[( index - 1 ) * num_freq_bands] ), num_freq_bands ); hDirAC->buffer_energy_q[index - 1] = reference_power_q; move16(); - computeDiffuseness_fixed( hDirAC->buffer_intensity_real_fx, hDirAC->buffer_energy_fx, num_freq_bands, diffuseness_vector_fx, hDirAC->buffer_intensity_real_q, hDirAC->buffer_energy_q, &diffuseness_q ); + computeDiffuseness_fx( hDirAC->buffer_intensity_real_fx, hDirAC->buffer_energy_fx, num_freq_bands, diffuseness_vector_fx, hDirAC->buffer_intensity_real_q, hDirAC->buffer_energy_q, &diffuseness_q ); FOR( band_m_idx = 0; band_m_idx < hDirAC->nbands; band_m_idx++ ) { @@ -537,10 +537,10 @@ static void ivas_dirac_dmx_fx( IF( EQ_16( nchan_transport, 2 ) ) { v_add_fx( data_in_fx[0], data_in_fx[1], data_out_fx[0], input_frame ); - v_multc_fixed( data_out_fx[0], ONE_IN_Q30, data_out_fx[0], input_frame ); // ONE_IN_Q30 = 0.5* ONE_IN_Q31 + v_multc_fx( data_out_fx[0], ONE_IN_Q30, data_out_fx[0], input_frame ); // ONE_IN_Q30 = 0.5* ONE_IN_Q31 - v_sub_fixed_no_hdrm( data_in_fx[0], data_in_fx[1], data_out_fx[1], input_frame ); - v_multc_fixed( data_out_fx[1], ONE_IN_Q30, data_out_fx[1], input_frame ); + v_sub_fx_no_hdrm( data_in_fx[0], data_in_fx[1], data_out_fx[1], input_frame ); + v_multc_fx( data_out_fx[1], ONE_IN_Q30, data_out_fx[1], input_frame ); FOR( i = 0; i < nchan_transport; i++ ) { diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 30f3f37cef1eba2c9611183d3e176bf3232263b8..71e361f153383dba12614280ef8a4fd1cdc53ed2 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -132,18 +132,7 @@ static void formulate2x2MixingMatrix_fx( Word32 Ein1_fx /*q_Ein*/, Word32 Ein2_f static void matrixMul_fx( Word32 Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_A*/, Word32 Aim[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_A*/, Word16 *q_A, Word32 Bre[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_B*/, Word32 Bim[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_B*/, Word16 *q_B, Word32 outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_out*/, Word32 outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_out*/, Word16 *q_out ); -static void matrixTransp2Mul_fx( - Word32 Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_A*/, - Word32 Aim[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_A*/, - Word16 *q_A, - Word32 Bre[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_B*/, - Word32 Bim[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_B*/, - Word16 *q_B, - Word32 Ascale, - Word32 Bscale, - Word32 outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_out*/, - Word32 outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_out*/, - Word16 *q_out ); +static void matrixTransp2Mul_fx( Word32 Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_A*/, Word32 Aim[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_A*/, Word16 *q_A, Word32 Bre[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_B*/, Word32 Bim[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_B*/, Word16 *q_B, Word32 Ascale, Word32 Bscale, Word32 outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_out*/, Word32 outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_out*/, Word16 *q_out ); /*------------------------------------------------------------------------- @@ -366,6 +355,7 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( IF( !hDiracDecBin->useTdDecorr && !( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) && EQ_32( st_ivas->ism_mode, ISM_MODE_PARAM ) ) ) { Word16 frequency_axis_fx[CLDFB_NO_CHANNELS_MAX]; + ivas_dirac_dec_get_frequency_axis_fx( frequency_axis_fx, output_Fs, nBins ); IF( NE_32( ( error = ivas_dirac_dec_decorr_open_fx( &( hDiracDecBin->h_freq_domain_decorr_ap_params ), @@ -442,7 +432,8 @@ void ivas_dirac_dec_close_binaural_data_fx( DIRAC_DEC_BIN_HANDLE *hBinaural /* i/o: decoder DirAC binaural data handle */ ) { - int16_t pos_idx; + Word16 pos_idx; + test(); IF( hBinaural == NULL || *hBinaural == NULL ) { @@ -633,7 +624,7 @@ void ivas_dirac_dec_binaural_sba_gain_fx( FOR( n = 0; n < nchan_remapped; n++ ) { - v_multc_fixed_16( output[n], gain, output[n], output_frame ); /* Qx to Qx-1*/ + v_multc_fx_16( output[n], gain, output[n], output_frame ); /* Qx to Qx-1*/ } return; @@ -894,8 +885,8 @@ static void ivas_dirac_dec_binaural_internal_fx( { /* At mono input duplicate the channel to dual-mono, and apply gain correction to ensure same overall level as in stereo mode */ - v_multc_fixed_16( Cldfb_RealBuffer_in_fx[0][slot], 23170, Cldfb_RealBuffer_in_fx[0][slot], nBins ); - v_multc_fixed_16( Cldfb_ImagBuffer_in_fx[0][slot], 23170, Cldfb_ImagBuffer_in_fx[0][slot], nBins ); + v_multc_fx_16( Cldfb_RealBuffer_in_fx[0][slot], 23170, Cldfb_RealBuffer_in_fx[0][slot], nBins ); + v_multc_fx_16( Cldfb_ImagBuffer_in_fx[0][slot], 23170, Cldfb_ImagBuffer_in_fx[0][slot], nBins ); Copy32( Cldfb_RealBuffer_in_fx[0][slot], Cldfb_RealBuffer_in_fx[1][slot], nBins ); Copy32( Cldfb_ImagBuffer_in_fx[0][slot], Cldfb_ImagBuffer_in_fx[1][slot], nBins ); @@ -932,8 +923,8 @@ static void ivas_dirac_dec_binaural_internal_fx( IF( EQ_16( config_data.nchan_transport, 1 ) && ( EQ_32( config_data.ivas_format, SBA_FORMAT ) || EQ_32( config_data.ivas_format, SBA_ISM_FORMAT ) ) ) { - v_multc_fixed_16( Cldfb_RealBuffer_in_fx[ch][slot], 23170, Cldfb_RealBuffer_in_fx[ch][slot], nBins ); - v_multc_fixed_16( Cldfb_ImagBuffer_in_fx[ch][slot], 23170, Cldfb_ImagBuffer_in_fx[ch][slot], nBins ); + v_multc_fx_16( Cldfb_RealBuffer_in_fx[ch][slot], 23170, Cldfb_RealBuffer_in_fx[ch][slot], nBins ); + v_multc_fx_16( Cldfb_ImagBuffer_in_fx[ch][slot], 23170, Cldfb_ImagBuffer_in_fx[ch][slot], nBins ); } } } @@ -3659,7 +3650,7 @@ static void eig2x2_fx( } /* Numeric case, when input is near an identity matrix with a gain */ - tmp1 = Mpy_32_32( 2147484, add_fx ); // 2147484 = 1e-3f in Q31 + tmp1 = Mpy_32_32( INV_1000_Q31, add_fx ); IF( LT_16( q_tmp1, q_tmp2 ) ) { @@ -4525,7 +4516,7 @@ static void formulate2x2MixingMatrix_fx( move32(); q_Sx = sub( add( q_Sx, Q14 ), 15 ); - temp = Mpy_32_32( E_in2, 2147484 ); // 2147484 = 0.001f in Q31 + temp = Mpy_32_32( E_in2, INV_1000_Q31 ); temp = L_max( temp, E_in1 ); IF( temp == 0 ) @@ -4554,8 +4545,8 @@ static void formulate2x2MixingMatrix_fx( } move32(); - temp = Mpy_32_32( E_in1, 2147484 ); // 2147484 = 0.001f in Q31 - temp = L_max( temp, E_in2 ); // q_ein + temp = Mpy_32_32( E_in1, 2147484 ); + temp = L_max( temp, E_in2 ); // q_ein IF( temp == 0 ) { IF( E_out2 == 0 ) @@ -4895,7 +4886,6 @@ static void getDirectPartGains_fx( const Word16 isHeadtracked, HRTFS_PARAMBIN_HANDLE hHrtfParambin ) { - // float aziRad, eleRad; Word32 y, mappedX; Word16 aziRadMapped, A, A2, A3; const Word16 LsAngleRad = 17157; // Q15 @@ -5007,8 +4997,8 @@ static void getDirectPartGains_fx( } /* Scaling to have the same expected gain as for the HRTF rendering */ - *lRealp = Mpy_32_32( *lRealp, SQRT2_FIXED ); // Q30 - *rRealp = Mpy_32_32( *rRealp, SQRT2_FIXED ); // Q30 + *lRealp = Mpy_32_32( *lRealp, SQRT2_FX ); // Q30 + *rRealp = Mpy_32_32( *rRealp, SQRT2_FX ); // Q30 *lRealp = L_shr( *lRealp, 2 ); // Q28 *rRealp = L_shr( *rRealp, 2 ); // Q28 @@ -5044,6 +5034,7 @@ static void getDirectPartGains_fx( return; } + static void hrtfShGetHrtf_fx( const Word16 bin, const Word16 aziDeg, @@ -5059,6 +5050,7 @@ static void hrtfShGetHrtf_fx( Word16 k; Word16( *hrtfShCoeffsReInt_fx )[16][60]; Word16( *hrtfShCoeffsImInt_fx )[16][60]; + hrtfShCoeffsReInt_fx = hHrtfParambin->hrtfShCoeffsRe_fx; hrtfShCoeffsImInt_fx = hHrtfParambin->hrtfShCoeffsIm_fx; @@ -5092,11 +5084,7 @@ static void hrtfShGetHrtf_fx( { Word32 shVec[HRTF_SH_CHANNELS]; - ivas_dirac_dec_get_response_fx( aziDeg, - eleDeg, - shVec, - HRTF_SH_ORDER, - Q29 ); + ivas_dirac_dec_get_response_fx( aziDeg, eleDeg, shVec, HRTF_SH_ORDER, Q29 ); FOR( k = 0; k < HRTF_SH_CHANNELS; k++ ) { @@ -5556,7 +5544,7 @@ static void ivas_masa_ext_rend_parambin_internal_fx( Word16 i, j; Word16 nchan_transport; Word16 q_mat; - int16_t pos_idx; + Word16 pos_idx; const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData; Word32 tmp_Cldfb_out_re[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; Word32 tmp_Cldfb_out_im[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; @@ -5667,8 +5655,8 @@ static void ivas_masa_ext_rend_parambin_internal_fx( { /* At mono input duplicate the channel to dual-mono, and apply gain correction to ensure same overall level as in stereo mode */ - v_multc_fixed( Cldfb_RealBuffer_in_fx[0][slot], 1518500224 /* INV_SQRT_2 in Q31 */, Cldfb_RealBuffer_in_fx[0][slot], nBins ); - v_multc_fixed( Cldfb_ImagBuffer_in_fx[0][slot], 1518500224 /* INV_SQRT_2 in Q31 */, Cldfb_ImagBuffer_in_fx[0][slot], nBins ); + v_multc_fx( Cldfb_RealBuffer_in_fx[0][slot], 1518500224 /* INV_SQRT_2 in Q31 */, Cldfb_RealBuffer_in_fx[0][slot], nBins ); + v_multc_fx( Cldfb_ImagBuffer_in_fx[0][slot], 1518500224 /* INV_SQRT_2 in Q31 */, Cldfb_ImagBuffer_in_fx[0][slot], nBins ); Copy32( Cldfb_RealBuffer_in_fx[0][slot], Cldfb_RealBuffer_in_fx[1][slot], nBins ); Copy32( Cldfb_ImagBuffer_in_fx[0][slot], Cldfb_ImagBuffer_in_fx[1][slot], nBins ); diff --git a/lib_rend/ivas_dirac_decorr_dec_fx.c b/lib_rend/ivas_dirac_decorr_dec_fx.c index bd1b4e35aafabfcce4548d7914afade13092b4ef..acbfb3bd2a5ca36e8b63b3ea9959d4c26272d66d 100644 --- a/lib_rend/ivas_dirac_decorr_dec_fx.c +++ b/lib_rend/ivas_dirac_decorr_dec_fx.c @@ -489,7 +489,7 @@ void ivas_dirac_dec_decorr_process_fx( } FOR( ch_idx = 0; ch_idx < num_protos_dir; ch_idx++ ) { - v_mult_fixed( &aux_buffer_fx[2 * ch_idx * num_freq_bands], &aux_buffer_fx[2 * ch_idx * num_freq_bands], &aux_buffer_fx[2 * ch_idx * max_band_decorr_temp], imult1616( 2, max_band_decorr_temp ) ); // q_aux_buffer + v_mult_fx( &aux_buffer_fx[2 * ch_idx * num_freq_bands], &aux_buffer_fx[2 * ch_idx * num_freq_bands], &aux_buffer_fx[2 * ch_idx * max_band_decorr_temp], imult1616( 2, max_band_decorr_temp ) ); // q_aux_buffer } q_aux_buffer = sub( add( add( add( q_input_frame, q_input_frame ), q_shift ), q_shift ), 31 ); @@ -502,6 +502,7 @@ void ivas_dirac_dec_decorr_process_fx( q_aux_buffer = 31; move16(); } + /* compute onset filter */ max_band_decorr = h_freq_domain_decorr_ap_params->max_band_decorr; move16(); @@ -546,9 +547,9 @@ void ivas_dirac_dec_decorr_process_fx( FOR( ch_idx = 0; ch_idx < num_protos_dir; ch_idx++ ) { //** this might effect when max_band_decorr is not equal to max_band_decorr_temp// - v_mult_inc_fixed( &input_frame_fx[2 * ch_idx * num_freq_bands], 2, &onset_filter_fx[ch_idx * num_freq_bands], 1, &aux_buffer_fx[2 * ch_idx * max_band_decorr], 2, max_band_decorr ); // q_input_frame + v_mult_inc_fx( &input_frame_fx[2 * ch_idx * num_freq_bands], 2, &onset_filter_fx[ch_idx * num_freq_bands], 1, &aux_buffer_fx[2 * ch_idx * max_band_decorr], 2, max_band_decorr ); // q_input_frame - v_mult_inc_fixed( &input_frame_fx[2 * ch_idx * num_freq_bands + 1], 2, &onset_filter_fx[ch_idx * num_freq_bands], 1, &aux_buffer_fx[2 * ch_idx * max_band_decorr + 1], 2, max_band_decorr ); // q_input_frame + v_mult_inc_fx( &input_frame_fx[2 * ch_idx * num_freq_bands + 1], 2, &onset_filter_fx[ch_idx * num_freq_bands], 1, &aux_buffer_fx[2 * ch_idx * max_band_decorr + 1], 2, max_band_decorr ); // q_input_frame } q_aux_buffer = q_input_frame; move16(); @@ -750,8 +751,9 @@ void ivas_dirac_dec_decorr_process_fx( IF( h_freq_domain_decorr_ap_params->use_ducker ) { Word16 len1 = shl( imult1616( max_band_decorr, num_protos_dir ), 1 ); + /* compute direct power w/o onsets for the energy ratio, signal is still in the aux buffer */ - v_mult_fixed( aux_buffer_fx, aux_buffer_fx, aux_buffer_fx, len1 ); // 2 *q_aux -31 + v_mult_fx( aux_buffer_fx, aux_buffer_fx, aux_buffer_fx, len1 ); // 2 *q_aux -31 q_aux_buffer = sub( shl( q_aux_buffer, 1 ), 31 ); diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index 574a6950ec9aa2337bfc0d825dbd0b22b89e00c9..326811bd5f14656d8b54b2adefc03399427fb97a 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -724,8 +724,8 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( { IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { - v_multc_fixed( hSpatParamRendCom->energy_ratio1_fx[md_idx], -MAX_32 /*-1 Q31*/, aux_buf, num_freq_bands ); /* 30 + 31 - 31 -> 30 */ - v_addc_fixed( aux_buf, ONE_IN_Q30 /*1 Q30*/, aux_buf, num_freq_bands ); /*30*/ + v_multc_fx( hSpatParamRendCom->energy_ratio1_fx[md_idx], -MAX_32 /*-1 Q31*/, aux_buf, num_freq_bands ); /* 30 + 31 - 31 -> 30 */ + v_addc_fx( aux_buf, ONE_IN_Q30 /*1 Q30*/, aux_buf, num_freq_bands ); /*30*/ Copy32( hSpatParamRendCom->energy_ratio1_fx[md_idx], h_dirac_output_synthesis_state->direct_power_factor_fx, num_freq_bands ); /*Q30*/ @@ -733,8 +733,8 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( h_dirac_output_synthesis_state->diffuse_power_factor_fx, num_freq_bands ); /*Q30*/ - v_multc_fixed( hSpatParamRendCom->energy_ratio2_fx[md_idx], -MAX_32 /*-1 Q31*/, aux_buf, num_freq_bands ); /*30+31-31->30*/ - v_addc_fixed( aux_buf, ONE_IN_Q30 /*1 Q30*/, aux_buf, num_freq_bands ); /*30*/ + v_multc_fx( hSpatParamRendCom->energy_ratio2_fx[md_idx], -MAX_32 /*-1 Q31*/, aux_buf, num_freq_bands ); /*30+31-31->30*/ + v_addc_fx( aux_buf, ONE_IN_Q30 /*1 Q30*/, aux_buf, num_freq_bands ); /*30*/ Copy32( hSpatParamRendCom->energy_ratio2_fx[md_idx], &h_dirac_output_synthesis_state->direct_power_factor_fx[hSpatParamRendCom->num_freq_bands], num_freq_bands ); /*Q30*/ @@ -799,16 +799,15 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( h_dirac_output_synthesis_state->direct_power_factor_q = sub( 31, h_dirac_output_synthesis_state->direct_power_factor_q ); h_dirac_output_synthesis_state->diffuse_power_factor_q = sub( 31, h_dirac_output_synthesis_state->diffuse_power_factor_q ); - v_multc_fixed( h_dirac_output_synthesis_state->direct_power_factor_fx, - ONE_IN_Q29 /*0.25f Q31*/, - h_dirac_output_synthesis_state->direct_power_factor_fx, - num_freq_bands ); /*h_dirac_output_synthesis_state->direct_power_factor_q+Q31-Q31->h_dirac_output_synthesis_state->direct_power_factor_q*/ - v_multc_fixed( h_dirac_output_synthesis_state->diffuse_power_factor_fx, - ONE_IN_Q29 /*0.25f Q31*/, - h_dirac_output_synthesis_state->diffuse_power_factor_fx, - num_freq_bands ); /*h_dirac_output_synthesis_state->diffuse_power_factor_q+Q31-Q31->h_dirac_output_synthesis_state->diffuse_power_factor_q*/ + v_multc_fx( h_dirac_output_synthesis_state->direct_power_factor_fx, + ONE_IN_Q29 /*0.25f Q31*/, + h_dirac_output_synthesis_state->direct_power_factor_fx, + num_freq_bands ); /*h_dirac_output_synthesis_state->direct_power_factor_q+Q31-Q31->h_dirac_output_synthesis_state->direct_power_factor_q*/ + v_multc_fx( h_dirac_output_synthesis_state->diffuse_power_factor_fx, + ONE_IN_Q29 /*0.25f Q31*/, + h_dirac_output_synthesis_state->diffuse_power_factor_fx, + num_freq_bands ); /*h_dirac_output_synthesis_state->diffuse_power_factor_q+Q31-Q31->h_dirac_output_synthesis_state->diffuse_power_factor_q*/ /*Direct gain*/ - Word16 *exp_temp_cy_cross_dir_smooth_fx = (Word16 *) malloc( num_freq_bands * num_channels_dir * sizeof( Word16 ) ); Word16 cy_cross_dir_smooth_e = sub( 31, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ); @@ -1114,19 +1113,19 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( /*Diffuse gain*/ FOR( ch_idx = s_min( 4, nchan_transport ); ch_idx < num_channels_diff; ch_idx++ ) { - v_multc_fixed_16( h_dirac_output_synthesis_state->diffuse_power_factor_fx, - hDirACRend->diffuse_response_function_fx[ch_idx], - aux_buf, - num_freq_bands_diff ); /* h_dirac_output_synthesis_state->diffuse_power_factor_q+15-15*/ + v_multc_fx_16( h_dirac_output_synthesis_state->diffuse_power_factor_fx, + hDirACRend->diffuse_response_function_fx[ch_idx], + aux_buf, + num_freq_bands_diff ); /* h_dirac_output_synthesis_state->diffuse_power_factor_q+15-15*/ temp_q = h_dirac_output_synthesis_state->diffuse_power_factor_q; IF( NE_16( temp_q, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ) ) { Scale_sig32( aux_buf, num_freq_bands, sub( h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, temp_q ) ); /*temp_q->(h_dirac_output_synthesis_state->q_cy_auto_diff_smooth)*/ } - v_add_fixed_no_hdrm( aux_buf, - &h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx[ch_idx * num_freq_bands_diff], - &h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx[ch_idx * num_freq_bands_diff], - num_freq_bands_diff ); /*h_dirac_output_synthesis_state->q_cy_auto_diff_smooth*/ + v_add_fx_no_hdrm( aux_buf, + &h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx[ch_idx * num_freq_bands_diff], + &h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx[ch_idx * num_freq_bands_diff], + num_freq_bands_diff ); /*h_dirac_output_synthesis_state->q_cy_auto_diff_smooth*/ } return; @@ -1254,14 +1253,14 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd_fx( /*Direct gain*/ FOR( ch_idx = 0; ch_idx < nchan_transport_foa; ch_idx++ ) { - v_multc_fixed( diffuseness, // Q30 - ONE_IN_Q31, // Q31 - &h_dirac_output_synthesis_state.cy_cross_dir_smooth_fx[ch_idx * num_freq_bands], // Q30 - num_freq_bands ); - v_multc_fixed( &h_dirac_output_synthesis_state.cy_cross_dir_smooth_fx[ch_idx * num_freq_bands], // Q30 - L_sub( h_dirac_output_synthesis_params.diffuse_compensation_factor_fx, ONE_IN_Q27 ), // Q27 - &h_dirac_output_synthesis_state.cy_cross_dir_smooth_fx[ch_idx * num_freq_bands], // Q26 - num_freq_bands ); + v_multc_fx( diffuseness, // Q30 + ONE_IN_Q31, // Q31 + &h_dirac_output_synthesis_state.cy_cross_dir_smooth_fx[ch_idx * num_freq_bands], // Q30 + num_freq_bands ); + v_multc_fx( &h_dirac_output_synthesis_state.cy_cross_dir_smooth_fx[ch_idx * num_freq_bands], // Q30 + L_sub( h_dirac_output_synthesis_params.diffuse_compensation_factor_fx, ONE_IN_Q27 ), // Q27 + &h_dirac_output_synthesis_state.cy_cross_dir_smooth_fx[ch_idx * num_freq_bands], // Q26 + num_freq_bands ); FOR( l = 0; l < num_freq_bands; l++ ) { @@ -1292,20 +1291,21 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd_fx( move32(); } - v_mult_fixed( aux_buf, ratio_float, ratio_float, num_freq_bands ); //(Q30, Q31) -> Q30 - v_mult_fixed( aux_buf, &ratio_float[num_freq_bands], &ratio_float[num_freq_bands], num_freq_bands ); //(Q30, Q31) -> Q30 + v_mult_fx( aux_buf, ratio_float, ratio_float, num_freq_bands ); //(Q30, Q31) -> Q30 + v_mult_fx( aux_buf, &ratio_float[num_freq_bands], &ratio_float[num_freq_bands], num_freq_bands ); //(Q30, Q31) -> Q30 /*Directional gain*/ FOR( ch_idx = nchan_transport_foa; ch_idx < num_channels_dir; ch_idx++ ) { - v_mult_fixed( ratio_float, // Q30 - &h_dirac_output_synthesis_state.direct_responses_fx[ch_idx * num_freq_bands], // Q31 - &h_dirac_output_synthesis_state.cy_cross_dir_smooth_fx[ch_idx * num_freq_bands], //(Q30, Q31) -> Q30 - num_freq_bands ); - v_mult_fixed( &ratio_float[num_freq_bands], // Q30 - &h_dirac_output_synthesis_state.direct_responses_fx[ch_idx * num_freq_bands + num_freq_bands * num_channels_dir], // Q31 - &h_dirac_output_synthesis_state.cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + num_freq_bands * num_channels_dir], //(Q30, Q31) -> Q30 - num_freq_bands ); + v_mult_fx( ratio_float, // Q30 + &h_dirac_output_synthesis_state.direct_responses_fx[ch_idx * num_freq_bands], // Q31 + &h_dirac_output_synthesis_state.cy_cross_dir_smooth_fx[ch_idx * num_freq_bands], //(Q30, Q31) -> Q30 + num_freq_bands ); + + v_mult_fx( &ratio_float[num_freq_bands], // Q30 + &h_dirac_output_synthesis_state.direct_responses_fx[ch_idx * num_freq_bands + num_freq_bands * num_channels_dir], // Q31 + &h_dirac_output_synthesis_state.cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + num_freq_bands * num_channels_dir], //(Q30, Q31) -> Q30 + num_freq_bands ); // Scale to bring in common Q-factor q_com = s_min( h_dirac_output_synthesis_state.q_cy_cross_dir_smooth_prev, Q30 ); @@ -1331,10 +1331,10 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd_fx( /*Diffuse gain*/ FOR( ch_idx = nchan_transport_foa; ch_idx < num_channels_diff; ch_idx++ ) { - v_multc_fixed_16( h_dirac_output_synthesis_state.diffuse_power_factor_fx, // Q31 - hDirACRend->diffuse_response_function_fx[ch_idx], // Q15 - &h_dirac_output_synthesis_state.cy_auto_diff_smooth_fx[ch_idx * num_freq_bands_diff], // Q31 - num_freq_bands_diff ); + v_multc_fx_16( h_dirac_output_synthesis_state.diffuse_power_factor_fx, // Q31 + hDirACRend->diffuse_response_function_fx[ch_idx], // Q15 + &h_dirac_output_synthesis_state.cy_auto_diff_smooth_fx[ch_idx * num_freq_bands_diff], // Q31 + num_freq_bands_diff ); // Scale to bring in common Q-factor q_com = s_min( h_dirac_output_synthesis_state.q_cy_auto_diff_smooth_prev, Q31 ); @@ -1356,18 +1356,18 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd_fx( /*Direct gain*/ FOR( ch_idx = 0; ch_idx < nchan_transport_foa; ch_idx++ ) { - v_mult_fixed( h_dirac_output_synthesis_state.diffuse_power_factor_fx, // Q31 - h_dirac_output_synthesis_state.diffuse_power_factor_fx, // Q31 - &h_dirac_output_synthesis_state.cy_cross_dir_smooth_fx[ch_idx * num_freq_bands], // Q31 - num_freq_bands ); - v_multc_fixed( &h_dirac_output_synthesis_state.cy_cross_dir_smooth_fx[ch_idx * num_freq_bands], // Q31 - L_sub( L_shr( h_dirac_output_synthesis_params.diffuse_compensation_factor_decorr_fx, Q3 ), ONE_IN_Q26 ), // Q26 - &h_dirac_output_synthesis_state.cy_cross_dir_smooth_fx[ch_idx * num_freq_bands], // Q26 - num_freq_bands_diff ); - v_multc_fixed( &h_dirac_output_synthesis_state.cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + num_freq_bands_diff], // Q31 - L_sub( L_shr( h_dirac_output_synthesis_params.diffuse_compensation_factor_fx, Q1 ), ONE_IN_Q26 ), // Q26 - &h_dirac_output_synthesis_state.cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + num_freq_bands_diff], // Q26 - num_freq_bands - num_freq_bands_diff ); + v_mult_fx( h_dirac_output_synthesis_state.diffuse_power_factor_fx, // Q31 + h_dirac_output_synthesis_state.diffuse_power_factor_fx, // Q31 + &h_dirac_output_synthesis_state.cy_cross_dir_smooth_fx[ch_idx * num_freq_bands], // Q31 + num_freq_bands ); + v_multc_fx( &h_dirac_output_synthesis_state.cy_cross_dir_smooth_fx[ch_idx * num_freq_bands], // Q31 + L_sub( L_shr( h_dirac_output_synthesis_params.diffuse_compensation_factor_decorr_fx, Q3 ), ONE_IN_Q26 ), // Q26 + &h_dirac_output_synthesis_state.cy_cross_dir_smooth_fx[ch_idx * num_freq_bands], // Q26 + num_freq_bands_diff ); + v_multc_fx( &h_dirac_output_synthesis_state.cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + num_freq_bands_diff], // Q31 + L_sub( L_shr( h_dirac_output_synthesis_params.diffuse_compensation_factor_fx, Q1 ), ONE_IN_Q26 ), // Q26 + &h_dirac_output_synthesis_state.cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + num_freq_bands_diff], // Q26 + num_freq_bands - num_freq_bands_diff ); FOR( l = 0; l < num_freq_bands; l++ ) { @@ -1391,10 +1391,10 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd_fx( /*Directional gain*/ FOR( ch_idx = nchan_transport_foa; ch_idx < num_channels_dir; ch_idx++ ) { - v_mult_fixed( h_dirac_output_synthesis_state.direct_power_factor_fx, // Q31 - &h_dirac_output_synthesis_state.direct_responses_fx[ch_idx * num_freq_bands], // Q31 - &h_dirac_output_synthesis_state.cy_cross_dir_smooth_fx[ch_idx * num_freq_bands], // Q31 - num_freq_bands ); + v_mult_fx( h_dirac_output_synthesis_state.direct_power_factor_fx, // Q31 + &h_dirac_output_synthesis_state.direct_responses_fx[ch_idx * num_freq_bands], // Q31 + &h_dirac_output_synthesis_state.cy_cross_dir_smooth_fx[ch_idx * num_freq_bands], // Q31 + num_freq_bands ); // Scale to bring in common Q-factor q_com = s_min( h_dirac_output_synthesis_state.q_cy_cross_dir_smooth_prev, Q31 ); @@ -1415,10 +1415,10 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd_fx( q_com = s_min( h_dirac_output_synthesis_state.q_cy_auto_diff_smooth_prev, Q31 ); FOR( ch_idx = nchan_transport_foa; ch_idx < num_channels_diff; ch_idx++ ) { - v_multc_fixed_16( h_dirac_output_synthesis_state.diffuse_power_factor_fx, // Q31 - hDirACRend->diffuse_response_function_fx[ch_idx], // Q15 - &h_dirac_output_synthesis_state.cy_auto_diff_smooth_fx[ch_idx * num_freq_bands_diff], // Q31 - num_freq_bands_diff ); + v_multc_fx_16( h_dirac_output_synthesis_state.diffuse_power_factor_fx, // Q31 + hDirACRend->diffuse_response_function_fx[ch_idx], // Q15 + &h_dirac_output_synthesis_state.cy_auto_diff_smooth_fx[ch_idx * num_freq_bands_diff], // Q31 + num_freq_bands_diff ); // Scale to bring in common Q-factor Scale_sig32( &h_dirac_output_synthesis_state.cy_auto_diff_smooth_fx[ch_idx * num_freq_bands_diff], @@ -2715,14 +2715,14 @@ void ivas_dirac_dec_compute_directional_responses_fx( /* Panning gains have to be computed only for the first bin of the coding band in MASA, for other bins the previous values can be used */ IF( NE_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { - mvr2r_inc_fixed( &hDirACRend->h_output_synthesis_psd_state.direct_responses_square_fx[k - 1], - hSpatParamRendCom->num_freq_bands, &hDirACRend->h_output_synthesis_psd_state.direct_responses_square_fx[k], - hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*direct_response_square_q*/ + mvr2r_inc_fx( &hDirACRend->h_output_synthesis_psd_state.direct_responses_square_fx[k - 1], + hSpatParamRendCom->num_freq_bands, &hDirACRend->h_output_synthesis_psd_state.direct_responses_square_fx[k], + hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*direct_response_square_q*/ } - mvr2r_inc_fixed( &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[k - 1], - hSpatParamRendCom->num_freq_bands, - &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[k], - hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*direct_response_q*/ + mvr2r_inc_fx( &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[k - 1], + hSpatParamRendCom->num_freq_bands, + &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[k], + hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*direct_response_q*/ } ELSE { @@ -2754,11 +2754,11 @@ void ivas_dirac_dec_compute_directional_responses_fx( test(); IF( masa_band_mapping == NULL && EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { - mvr2r_inc_fixed( direct_response_hoa_fx, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*Q_direct_response_hoa*/ + mvr2r_inc_fx( direct_response_hoa_fx, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*Q_direct_response_hoa*/ IF( hodirac_flag ) { - mvr2r_inc_fixed( direct_response_dir2_fx, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[k + hSpatParamRendCom->num_freq_bands * num_channels_dir], hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*Q_direct_response_dir2*/ + mvr2r_inc_fx( direct_response_dir2_fx, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[k + hSpatParamRendCom->num_freq_bands * num_channels_dir], hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*Q_direct_response_dir2*/ } } ELSE IF( ( ( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) && ( masa_band_mapping != NULL ) ) || @@ -2987,10 +2987,10 @@ void ivas_dirac_dec_compute_directional_responses_fx( direct_response_fx = direct_response_hoa_fx; IF( NE_32( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { - v_mult_fixed( direct_response_fx, direct_response_fx, direct_response_square_fx, num_channels_dir ); /*Q(2*direct_response_q-31)*/ + v_mult_fx( direct_response_fx, direct_response_fx, direct_response_square_fx, num_channels_dir ); /*Q(2*direct_response_q-31)*/ direct_response_square_q = sub( add( direct_response_q, direct_response_q ), 31 ); - mvr2r_inc_fixed( direct_response_square_fx, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_square_fx[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*direct_response_square_q*/ + mvr2r_inc_fx( direct_response_square_fx, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_square_fx[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*direct_response_square_q*/ IF( EQ_16( transport_signal_type, MASA_STEREO_SPACED_MICS ) ) { @@ -3009,7 +3009,7 @@ void ivas_dirac_dec_compute_directional_responses_fx( } } - mvr2r_inc_fixed( direct_response_fx, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*q29*/ + mvr2r_inc_fx( direct_response_fx, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*q29*/ } ELSE { @@ -3264,11 +3264,11 @@ void ivas_dirac_dec_compute_directional_responses_fx( /* Set computed gains */ direct_response_fx = direct_response_ls_fx; - v_mult_fixed( direct_response_fx, direct_response_fx, direct_response_square_fx, num_channels_dir ); /*2*direct_response_q-31*/ + v_mult_fx( direct_response_fx, direct_response_fx, direct_response_square_fx, num_channels_dir ); /*2*direct_response_q-31*/ direct_response_square_q = sub( add( direct_response_q, direct_response_q ), 31 ); - mvr2r_inc_fixed( direct_response_square_fx, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_square_fx[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*direct_response_square_q*/ - mvr2r_inc_fixed( direct_response_fx, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*direct_response_q*/ + mvr2r_inc_fx( direct_response_square_fx, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_square_fx[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*direct_response_square_q*/ + mvr2r_inc_fx( direct_response_fx, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*direct_response_q*/ } ELSE { @@ -3364,16 +3364,15 @@ void ivas_dirac_dec_compute_power_factors_fx( { Word16 i; - v_multc_fixed( diffuseness_fx, L_negate( ( ONE_IN_Q31 ) ), direct_power_factor, num_freq_bands ); // Q30 + v_multc_fx( diffuseness_fx, L_negate( ( ONE_IN_Q31 ) ), direct_power_factor, num_freq_bands ); // Q30 - v_addc_fixed( direct_power_factor, ONE_IN_Q30, direct_power_factor, num_freq_bands ); // Q30 + v_addc_fx( direct_power_factor, ONE_IN_Q30, direct_power_factor, num_freq_bands ); // Q30 Copy32( diffuseness_fx, diffuse_power_factor, num_freq_bands ); // Q30 - v_mult_fixed( &direct_power_factor[max_band_decorr], &direct_power_factor[max_band_decorr], &direct_power_factor[max_band_decorr], num_freq_bands - max_band_decorr ); // Q29 - - v_mult_fixed( &diffuse_power_factor[max_band_decorr], &diffuse_power_factor[max_band_decorr], &diffuse_power_factor[max_band_decorr], num_freq_bands - max_band_decorr ); // Q29 + v_mult_fx( &direct_power_factor[max_band_decorr], &direct_power_factor[max_band_decorr], &direct_power_factor[max_band_decorr], num_freq_bands - max_band_decorr ); // Q29 + v_mult_fx( &diffuse_power_factor[max_band_decorr], &diffuse_power_factor[max_band_decorr], &diffuse_power_factor[max_band_decorr], num_freq_bands - max_band_decorr ); // Q29 FOR( i = 0; i < max_band_decorr; i++ ) { @@ -3382,6 +3381,7 @@ void ivas_dirac_dec_compute_power_factors_fx( diffuse_power_factor[i] = L_shr( diffuse_power_factor[i], 1 ); // Q29 move32(); } + return; } @@ -3391,6 +3391,7 @@ void ivas_dirac_dec_compute_power_factors_fx( * * *------------------------------------------------------------------------*/ + void ivas_lfe_synth_with_filters_fx( MCMASA_LFE_SYNTH_DATA_HANDLE hMasaLfeSynth, /* i/o: LFE synthesis structure for McMASA */ Word32 *data_fx[], /* o : output signals (Q11) */ @@ -3605,7 +3606,7 @@ static void computeTargetPSDs_direct_fx( Word32 aux_buffer_res[CLDFB_NO_CHANNELS_MAX]; /* size: num_freq_bands. */ /* estimate direct and diffuse power */ - v_mult_fixed( direct_power_factor, reference_power, direct_power, num_freq_bands ); /* Q31 + Q(q_reference_power) - Q31 = Q(q_reference_power) */ + v_mult_fx( direct_power_factor, reference_power, direct_power, num_freq_bands ); /* Q31 + Q(q_reference_power) - Q31 = Q(q_reference_power) */ Word16 common1_q = s_min( *q_cy_auto_dir_smooth, s_min( q_reference_power[0], q_reference_power[1] ) ); Word16 common2_q = s_min( *q_cy_cross_dir_smooth, s_min( q_reference_power[0], q_reference_power[1] ) ); @@ -3615,17 +3616,17 @@ static void computeTargetPSDs_direct_fx( { cur_idx = imult1616( ch_idx, num_freq_bands ); - v_mult_fixed( direct_power, &direct_responses_square[cur_idx], aux_buffer_res, num_freq_bands ); /* Q31 + Q(q_reference_power) - Q31 = Q(q_reference_power) */ + v_mult_fx( direct_power, &direct_responses_square[cur_idx], aux_buffer_res, num_freq_bands ); /* Q31 + Q(q_reference_power) - Q31 = Q(q_reference_power) */ scale_sig32( aux_buffer_res, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( common1_q, q_reference_power[0] ) ); /* Q(common1_q) */ scale_sig32( aux_buffer_res + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( common1_q, q_reference_power[1] ) ); /* Q(common1_q) */ scale_sig32( &cy_auto_dir_smooth[cur_idx], num_freq_bands, sub( common1_q, *q_cy_auto_dir_smooth ) ); /* Q(common1_q) */ - v_add_fixed( &cy_auto_dir_smooth[cur_idx], aux_buffer_res, &cy_auto_dir_smooth[cur_idx], num_freq_bands, Q1 ); /* Q(common1_q) - Q1 */ + v_add_fx_hdrm( &cy_auto_dir_smooth[cur_idx], aux_buffer_res, &cy_auto_dir_smooth[cur_idx], num_freq_bands, Q1 ); /* Q(common1_q) - Q1 */ - v_mult_fixed( direct_power, &direct_responses[cur_idx], aux_buffer_res, num_freq_bands ); /* Q31 + Q(q_reference_power) - Q31 = Q(q_reference_power) */ + v_mult_fx( direct_power, &direct_responses[cur_idx], aux_buffer_res, num_freq_bands ); /* Q31 + Q(q_reference_power) - Q31 = Q(q_reference_power) */ scale_sig32( aux_buffer_res, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( common2_q, q_reference_power[0] ) ); /* Q(common2_q) */ scale_sig32( aux_buffer_res + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( common2_q, q_reference_power[1] ) ); /* Q(common2_q) */ scale_sig32( &cy_cross_dir_smooth[cur_idx], num_freq_bands, sub( common2_q, *q_cy_cross_dir_smooth ) ); /* Q(common2_q) */ - v_add_fixed( &cy_cross_dir_smooth[cur_idx], aux_buffer_res, &cy_cross_dir_smooth[cur_idx], num_freq_bands, Q1 ); /* Q(common2_q) - Q1 */ + v_add_fx_hdrm( &cy_cross_dir_smooth[cur_idx], aux_buffer_res, &cy_cross_dir_smooth[cur_idx], num_freq_bands, Q1 ); /* Q(common2_q) - Q1 */ } /* Q adjustment */ @@ -3659,7 +3660,8 @@ static void computeTargetPSDs_direct_subframe_fx( Word32 direct_power[CLDFB_NO_CHANNELS_MAX]; /* size: num_freq_bands. */ /* estimate direct and diffuse power */ - v_mult_fixed( direct_power_factor, reference_power, direct_power, num_freq_bands ); + v_mult_fx( direct_power_factor, reference_power, direct_power, num_freq_bands ); + /* compute target auto and cross PSDs of current frame (smoothed) */ FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { @@ -3667,7 +3669,7 @@ static void computeTargetPSDs_direct_subframe_fx( q_tmp = L_norm_arr( &direct_responses_square[cur_idx], num_freq_bands ); Copy_Scale_sig32( &direct_responses_square[cur_idx], L_tmp, num_freq_bands, q_tmp ); - v_mult_fixed( direct_power, L_tmp, &cy_auto_dir_smooth[cur_idx], num_freq_bands ); // (q_reference_power, q_tmp) -> q_reference_power + q_tmp + v_mult_fx( direct_power, L_tmp, &cy_auto_dir_smooth[cur_idx], num_freq_bands ); // (q_reference_power, q_tmp) -> q_reference_power + q_tmp q_cy_auto_dir_smooth_local[0] = add( add( q_reference_power[0], q_tmp ), L_norm_arr( cy_auto_dir_smooth + cur_idx, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); q_cy_auto_dir_smooth_local[1] = add( add( q_reference_power[1], q_tmp ), L_norm_arr( cy_auto_dir_smooth + cur_idx + CLDFB_NO_CHANNELS_HALF, s_max( sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), 0 ) ) ); @@ -3677,7 +3679,7 @@ static void computeTargetPSDs_direct_subframe_fx( Scale_sig32( cy_auto_dir_smooth + cur_idx, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_cy_auto_dir_smooth[ch_idx], add( q_reference_power[0], q_tmp ) ) ); Scale_sig32( cy_auto_dir_smooth + cur_idx + CLDFB_NO_CHANNELS_HALF, s_max( sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), 0 ), sub( q_cy_auto_dir_smooth[ch_idx], add( q_reference_power[1], q_tmp ) ) ); - v_mult_fixed( direct_power, &direct_responses[cur_idx], &cy_cross_dir_smooth[cur_idx], num_freq_bands ); // (q_reference_power, Q31) -> q_reference_power + v_mult_fx( direct_power, &direct_responses[cur_idx], &cy_cross_dir_smooth[cur_idx], num_freq_bands ); // (q_reference_power, Q31) -> q_reference_power Scale_sig32( &cy_cross_dir_smooth[cur_idx] + CLDFB_NO_CHANNELS_HALF, s_max( sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), 0 ), sub( q_reference_power[0], q_reference_power[1] ) ); } @@ -3706,7 +3708,7 @@ static void computeTargetPSDs_diffuse_fx( Word32 aux_buffer_res[CLDFB_NO_CHANNELS_MAX]; /* size: num_freq_bands. */ /* estimate direct and diffuse power */ - v_mult_fixed( diffuse_power_factor, reference_power, diffuse_power, num_freq_bands ); /* Q31 + Q(q_reference_power) - Q31 = Q(q_reference_power) */ + v_mult_fx( diffuse_power_factor, reference_power, diffuse_power, num_freq_bands ); /* Q31 + Q(q_reference_power) - Q31 = Q(q_reference_power) */ Word16 common_q = s_min( *q_cy_auto_diff_smooth, s_min( q_reference_power[0], q_reference_power[1] ) ); @@ -3715,11 +3717,11 @@ static void computeTargetPSDs_diffuse_fx( { cur_idx = imult1616( ch_idx, num_freq_bands ); - v_multc_fixed( &diffuse_power[start_band], diffuse_responses_square[ch_idx], aux_buffer_res, sub( num_freq_bands, start_band ) ); /* Q31 + Q(q_reference_power) - Q31 = Q(q_reference_power) */ + v_multc_fx( &diffuse_power[start_band], diffuse_responses_square[ch_idx], aux_buffer_res, sub( num_freq_bands, start_band ) ); /* Q31 + Q(q_reference_power) - Q31 = Q(q_reference_power) */ scale_sig32( aux_buffer_res, s_min( sub( num_freq_bands, start_band ), CLDFB_NO_CHANNELS_HALF ), sub( common_q, q_reference_power[0] ) ); /* Q(common_q) */ scale_sig32( aux_buffer_res + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( sub( num_freq_bands, start_band ), CLDFB_NO_CHANNELS_HALF ) ), sub( common_q, q_reference_power[1] ) ); /* Q(common_q) */ scale_sig32( &cy_auto_diff_smooth[cur_idx + start_band], sub( num_freq_bands, start_band ), sub( common_q, *q_cy_auto_diff_smooth ) ); /* Q(common_q) */ - v_add_fixed( &cy_auto_diff_smooth[cur_idx + start_band], aux_buffer_res, &cy_auto_diff_smooth[cur_idx + start_band], sub( num_freq_bands, start_band ), Q1 ); /* Q(common_q) - Q1 */ + v_add_fx_hdrm( &cy_auto_diff_smooth[cur_idx + start_band], aux_buffer_res, &cy_auto_diff_smooth[cur_idx + start_band], sub( num_freq_bands, start_band ), Q1 ); /* Q(common_q) - Q1 */ } /* Q adjustment */ @@ -3746,7 +3748,7 @@ static void computeTargetPSDs_diffuse_subframe_fx( Word16 q_cy_auto_diff_smooth_new, q_diffuse_power; /* estimate direct and diffuse power */ - v_mult_fixed( diffuse_power_factor, reference_power, diffuse_power, num_freq_bands ); // (Q31, q_reference_power) -> q_reference_power + v_mult_fx( diffuse_power_factor, reference_power, diffuse_power, num_freq_bands ); // (Q31, q_reference_power) -> q_reference_power q_diffuse_power = s_min( q_reference_power[0], q_reference_power[1] ); Scale_sig32( diffuse_power, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_diffuse_power, q_reference_power[0] ) ); @@ -3767,7 +3769,7 @@ static void computeTargetPSDs_diffuse_subframe_fx( { Scale_sig32( &cy_auto_diff_smooth[cur_idx], start_band, sub( q_diffuse_power, *q_cy_auto_diff_smooth ) ); } - v_multc_fixed( &diffuse_power[start_band], diffuse_responses_square[ch_idx], &cy_auto_diff_smooth[cur_idx + start_band], sub( num_freq_bands, start_band ) ); // (q_reference_power, Q31) -> q_reference_power + v_multc_fx( &diffuse_power[start_band], diffuse_responses_square[ch_idx], &cy_auto_diff_smooth[cur_idx + start_band], sub( num_freq_bands, start_band ) ); // (q_reference_power, Q31) -> q_reference_power } *q_cy_auto_diff_smooth = q_cy_auto_diff_smooth_new; @@ -3801,7 +3803,7 @@ static void computeTargetPSDs_diffuse_with_onsets_fx( q_reference_power_min_one[1] = sub( q_reference_power[1], Q1 ); /* estimate direct and diffuse power */ - v_mult_fixed( diffuse_power_factor, reference_power, diffuse_power, num_decorr_freq_bands ); // (Q31, q_reference_power) -> q_reference_power + v_mult_fx( diffuse_power_factor, reference_power, diffuse_power, num_decorr_freq_bands ); // (Q31, q_reference_power) -> q_reference_power q_common = s_min( *q_cy_auto_diff_smooth, s_min( q_reference_power_min_one[0], q_reference_power_min_one[1] ) ); @@ -3813,12 +3815,12 @@ static void computeTargetPSDs_diffuse_with_onsets_fx( cur_idx = imult1616( ch_idx, num_freq_bands ); diff_idx = imult1616( proto_frame_diff_index[ch_idx], num_freq_bands ); - v_multc_fixed( &onset_filter[diff_idx], diffuse_responses_square[ch_idx], aux_buffer_res1, num_decorr_freq_bands ); // (Q31, Q31) -> Q31 - v_multc_fixed( &onset_filter[diff_idx], INT_MIN, aux_buffer_res, num_decorr_freq_bands ); // (Q31, Q31) -> Q31 - v_addc_fixed( aux_buffer_res, ONE_IN_Q31, aux_buffer_res, num_decorr_freq_bands ); // Q31 - v_multc_fixed( aux_buffer_res, diffuse_response_p4, aux_buffer_res, num_decorr_freq_bands ); // (Q31, Q31) -> Q31 - v_add_fixed( aux_buffer_res1, aux_buffer_res, aux_buffer_res, num_decorr_freq_bands, Q1 ); // Q30 - v_mult_fixed( aux_buffer_res, diffuse_power, aux_buffer_res, num_decorr_freq_bands ); // (Q30, q_reference_power) -> q_reference_power - Q1 + v_multc_fx( &onset_filter[diff_idx], diffuse_responses_square[ch_idx], aux_buffer_res1, num_decorr_freq_bands ); // (Q31, Q31) -> Q31 + v_multc_fx( &onset_filter[diff_idx], INT_MIN, aux_buffer_res, num_decorr_freq_bands ); // (Q31, Q31) -> Q31 + v_addc_fx( aux_buffer_res, ONE_IN_Q31, aux_buffer_res, num_decorr_freq_bands ); // Q31 + v_multc_fx( aux_buffer_res, diffuse_response_p4, aux_buffer_res, num_decorr_freq_bands ); // (Q31, Q31) -> Q31 + v_add_fx_hdrm( aux_buffer_res1, aux_buffer_res, aux_buffer_res, num_decorr_freq_bands, Q1 ); // Q30 + v_mult_fx( aux_buffer_res, diffuse_power, aux_buffer_res, num_decorr_freq_bands ); // (Q30, q_reference_power) -> q_reference_power - Q1 IF( NE_16( q_common, q_reference_power_min_one[0] ) ) { @@ -3832,7 +3834,7 @@ static void computeTargetPSDs_diffuse_with_onsets_fx( { scale_sig32( &cy_auto_diff_smooth[cur_idx], num_decorr_freq_bands, sub( q_common, *q_cy_auto_diff_smooth ) ); // q_common } - v_add_fixed( &cy_auto_diff_smooth[cur_idx], aux_buffer_res, &cy_auto_diff_smooth[cur_idx], num_decorr_freq_bands, Q1 ); // (q_common - Q1) + v_add_fx_hdrm( &cy_auto_diff_smooth[cur_idx], aux_buffer_res, &cy_auto_diff_smooth[cur_idx], num_decorr_freq_bands, Q1 ); // (q_common - Q1) scale_sig32( &cy_auto_diff_smooth[cur_idx + num_decorr_freq_bands], sub( num_freq_bands, num_decorr_freq_bands ), sub( sub( q_common, Q1 ), *q_cy_auto_diff_smooth ) ); // (q_common - Q1) } diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c index f7b51e8b1b162ec4880dfed71f71d40fae2f6671..97b5ae51ea82e1cb63ac61cf491b04074424da0a 100644 --- a/lib_rend/ivas_dirac_rend_fx.c +++ b/lib_rend/ivas_dirac_rend_fx.c @@ -3999,9 +3999,9 @@ static void ivas_masa_ext_dirac_render_sf_fx( hDirACRend->h_freq_domain_decorr_ap_params, hDirACRend->h_freq_domain_decorr_ap_state ); - v_multc_fixed( onset_filter_fx, 536870912 /* 0.25f in Q31 */, onset_filter_fx, hSpatParamRendCom->num_freq_bands ); /* Q31 */ - v_add_fixed_no_hdrm( onset_filter_fx, onset_filter_subframe_fx, onset_filter_subframe_fx, hSpatParamRendCom->num_freq_bands ); /* Q31 */ - p_onset_filter_fx = onset_filter_subframe_fx; /*q31*/ + v_multc_fx( onset_filter_fx, 536870912 /* 0.25f in Q31 */, onset_filter_fx, hSpatParamRendCom->num_freq_bands ); /* Q31 */ + v_add_fx_no_hdrm( onset_filter_fx, onset_filter_subframe_fx, onset_filter_subframe_fx, hSpatParamRendCom->num_freq_bands ); /* Q31 */ + p_onset_filter_fx = onset_filter_subframe_fx; /*q31*/ } ELSE { @@ -4089,7 +4089,7 @@ static void ivas_masa_ext_dirac_render_sf_fx( DirAC_mem.reference_power_smooth_q[1] = DirAC_mem.reference_power_q[1]; move16(); move16(); - v_add_fixed_no_hdrm( reference_power_fix, reference_power_smooth_fx, reference_power_smooth_fx, hSpatParamRendCom->num_freq_bands ); // DirAC_mem.reference_power_smooth_q + v_add_fx_no_hdrm( reference_power_fix, reference_power_smooth_fx, reference_power_smooth_fx, hSpatParamRendCom->num_freq_bands ); // DirAC_mem.reference_power_smooth_q } } /*Rescaling proto_direct_buffer_f*/ diff --git a/lib_rend/ivas_efap_fx.c b/lib_rend/ivas_efap_fx.c index 68908cfaa36eb8aef6acb6aef1964a83e79a3cd1..23ffbe0bd17bffb0c2f17d128bac4ba46e9325d4 100644 --- a/lib_rend/ivas_efap_fx.c +++ b/lib_rend/ivas_efap_fx.c @@ -66,7 +66,6 @@ * Local function prototypes *-----------------------------------------------------------------------*/ - static ivas_error poly_init_fx( EFAP *efap, const Word16 efip_flag ); static ivas_error sphere_triangulation_fx( const Word16 numSpk, EFAP_VERTEX_DATA *vtxData, EFAP_POLYSET_DATA *polyData, Word32 ***dmTranspose /*q31*/, Word16 *numTot, const Word16 efip_flag ); static void initial_polyeder_fx( EFAP_VERTEX_DATA *vtxData, EFAP_LS_TRIANGLE *triArray, Word16 *numTri, Word16 *vtxInHull ); @@ -75,7 +74,6 @@ static void add_vertex_to_convex_hull_fx( const EFAP_VERTEX_DATA *vtxData, const static void sort_vertices_fx( const EFAP_VERTEX *vertexArray, const Word16 *numVtx, Word16 *order ); static void visible_edges_fx( const EFAP_LS_TRIANGLE *triArray, const Word16 *visible, const Word16 numSurface, Word16 *numEdges, Word16 *edges ); - static void flip_plane_fx( const EFAP_VERTEX *vtxArray, Word16 *surface, const Word32 centroid[3] /*q31*/ ); static void remap_ghosts_fx( EFAP_VERTEX *vtxArray, EFAP_LS_TRIANGLE *triArray, Word16 numSpk, Word16 *numVertex, Word16 numTri, Word32 **downmixMatrix /*q31*/ ); static void vertex_init_fx( const Word32 *aziSpk /*q22*/, const Word32 *eleSpk /*q22*/, EFAP_VERTEX_DATA *efapVtxData ); @@ -83,6 +81,7 @@ static void efap_panning_fx( const Word32 azi /*q22*/, const Word32 ele /*q22*/, static void get_poly_gains_fx( const Word32 azi /*q22*/, const Word32 ele /*q22*/, const Word32 aziPoly[EFAP_MAX_CHAN_NUM] /*q22*/, const Word32 elePoly[EFAP_MAX_CHAN_NUM] /*q22*/, const Word16 numChan, Word32 *buffer /*q31*/ ); static Word32 get_tri_gain_fx( const Word32 A[2] /*q22*/, const Word32 B[2] /*q22*/, const Word32 C[2] /*q22*/, const Word32 P_minus_A[2] /*q22*/ ); + /*-----------------------------------------------------------------------* * EFAP Utils *-----------------------------------------------------------------------*/ @@ -90,7 +89,6 @@ static Word32 get_tri_gain_fx( const Word32 A[2] /*q22*/, const Word32 B[2] /*q2 static void add_vertex_fx( EFAP_VERTEX *vtxArray, const Word32 azi /*q22*/, const Word32 ele /*q22*/, const Word16 pos, const EFAP_VTX_DMX_TYPE ); static void efap_sort_s_fx( Word16 *x, Word16 *idx, const Word16 len ); - static Word32 vertex_distance_fx( const EFAP_VERTEX *vtxArray, const EFAP_LS_TRIANGLE tri, const Word16 vtxIdx ); static Word32 point_plane_distance_fx( const Word32 P1[3] /*q31*/, const Word32 P2[3] /*q31*/, const Word32 P3[3] /*q31*/, const Word32 X[3] /*q31*/ ); static Word32 point_poly_distance_fx( const EFAP_POLYSET poly, const Word32 X[3] /*q31*/ ); @@ -110,6 +108,7 @@ static Word16 in_poly_fx( const Word32 P[2] /*q22*/, const EFAP_POLYSET poly ); static Word16 in_tri_fx( Word32 A[2] /*q22*/, Word32 B[2] /*q22*/, Word32 C[2] /*q22*/, Word32 P_minus_A[2] /*q22*/ ); static void sph2cart_fx( const Word32 azi /*q22*/, const Word32 ele /*q22*/, Word32 *pos /*q31*/ ); + /*-----------------------------------------------------------------------* * Global function definitions *-----------------------------------------------------------------------*/ @@ -175,6 +174,7 @@ ivas_error efap_init_data_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for EFAP bufferS\n" ) ); } + /* get upper bound of number of polygons required */ polyset_size = efap_poly_limit[num_speaker_nodes - 1]; @@ -636,11 +636,11 @@ static void initial_polyeder_fx( /* 2. attempt to create a triangle with nonzero area */ tmp = 0; move32(); - v_sub_fixed( vtxData->vertexArray[tetrahedron[1]].pos, vtxData->vertexArray[tetrahedron[0]].pos, tmp1, 3, 1 ); // tmp1 Q(31-1) + v_sub_fx( vtxData->vertexArray[tetrahedron[1]].pos, vtxData->vertexArray[tetrahedron[0]].pos, tmp1, 3, 1 ); // tmp1 Q(31-1) WHILE( LT_16( tetrahedron[2], numVtx ) ) { - v_sub_fixed( vtxData->vertexArray[tetrahedron[2]].pos, vtxData->vertexArray[tetrahedron[0]].pos, tmp2, 3, 1 ); // tmp2 Q(31-1) - efap_crossp_fx( tmp1, tmp2, tmpCross ); // tmpCross Q29 + v_sub_fx( vtxData->vertexArray[tetrahedron[2]].pos, vtxData->vertexArray[tetrahedron[0]].pos, tmp2, 3, 1 ); // tmp2 Q(31-1) + efap_crossp_fx( tmp1, tmp2, tmpCross ); // tmpCross Q29 FOR( i = 0; i < 3; i++ ) { tmp = L_add( tmp, Mpy_32_32( tmpCross[i], tmpCross[i] ) ); // tmp Q27 @@ -659,8 +659,8 @@ static void initial_polyeder_fx( move32(); WHILE( LT_16( tetrahedron[3], numVtx ) ) { - v_sub_fixed( vtxData->vertexArray[tetrahedron[3]].pos, vtxData->vertexArray[tetrahedron[0]].pos, tmp3, 3, 1 ); // tmp3 Q30 - tmp = dotp_fixed( tmp3, tmpCross, 3 ); // tmp Q28 + v_sub_fx( vtxData->vertexArray[tetrahedron[3]].pos, vtxData->vertexArray[tetrahedron[0]].pos, tmp3, 3, 1 ); // tmp3 Q30 + tmp = dotp_fx32( tmp3, tmpCross, 3 ); // tmp Q28 IF( GT_32( L_abs( tmp ), POLY_THRESH_Q28 /*1e-4f Q28*/ ) ) { BREAK; @@ -867,7 +867,7 @@ static void add_ghost_speakers_fx( { tmpAngleDiff[i] = L_sub( tmpAzi[i + 1], tmpAzi[i] ); // q22 move32(); - sectors[i] = ceil_fixed( Mpy_32_32( tmpAngleDiff[i], maxAngle ), Q22 ); // q22 + sectors[i] = ceil_fx( Mpy_32_32( tmpAngleDiff[i], maxAngle ), Q22 ); // q22 move32(); if ( GT_32( sectors[i], Q22_1 /*1 q22*/ ) ) @@ -877,7 +877,7 @@ static void add_ghost_speakers_fx( } tmpAngleDiff[k - 1] = L_sub( L_add( tmpAzi[0], Q22_360_DEG /*360 q22*/ ), tmpAzi[k - 1] ); // q22 - sectors[k - 1] = ceil_fixed( Mpy_32_32( tmpAngleDiff[k - 1], maxAngle ), Q22 ); // q22 + sectors[k - 1] = ceil_fx( Mpy_32_32( tmpAngleDiff[k - 1], maxAngle ), Q22 ); // q22 if ( GT_32( sectors[k - 1], Q22_1 /*1 q22*/ ) ) { @@ -1551,7 +1551,7 @@ static void get_poly_gains_fx( A[1] = elePoly[i - 1]; // q22 move32(); - v_sub_fixed_no_hdrm( P, A, P_minus_A, 2 ); /* Precalculate value of (P-A) q22*/ + v_sub_fx_no_hdrm( P, A, P_minus_A, 2 ); /* Precalculate value of (P-A) q22*/ FOR( j = i; j < numChan - 2 + i; ++j ) { @@ -1604,18 +1604,18 @@ static Word32 get_tri_gain_fx( tmpN[1] = L_sub( C[0], B[0] ); // q22 move32(); - v_sub_fixed_no_hdrm( B, A, tmpSub1, 2 ); // tmpSub1 q22 + v_sub_fx_no_hdrm( B, A, tmpSub1, 2 ); // tmpSub1 q22 - tmpDot1 = dotp_fixed( tmpN, tmpSub1, 2 ); // Q13 + tmpDot1 = dotp_fx32( tmpN, tmpSub1, 2 ); // Q13 Word16 exp = Q18; move16(); Word32 inv_tmpDot2 = L_shl( tmpDot1, norm_l( tmpDot1 ) ); exp = sub( exp, norm_l( tmpDot1 ) ); - Word16 inv_tmpDot1 = Inv16( extract_h( inv_tmpDot2 ), &exp ); // 15-exp - v_multc_fixed( tmpN, L_shl( inv_tmpDot1, add( Q16, exp ) ), N, 2 ); // 22+31-31->22 + Word16 inv_tmpDot1 = Inv16( extract_h( inv_tmpDot2 ), &exp ); // 15-exp + v_multc_fx( tmpN, L_shl( inv_tmpDot1, add( Q16, exp ) ), N, 2 ); // 22+31-31->22 - tmpDot2 = dotp_fixed( P_minus_A, N, 2 ); // 22+22-31->13 + tmpDot2 = dotp_fx32( P_minus_A, N, 2 ); // 22+22-31->13 if ( EQ_32( tmpDot2, 8191 ) ) { @@ -1660,15 +1660,23 @@ static void add_vertex_fx( move32(); IF( LT_32( Q22_180_DEG /*180 q22*/, ele ) ) - tmp = Q22_180_DEG /*180 q22*/; + { + tmp = Q22_180_DEG /*180 q22*/; + } ELSE + { tmp = ele; // Q22 + } move32(); + IF( GT_32( -Q22_180_DEG /*180 q22*/, tmp ) ) - vtxArray[pos].ele = -Q22_180_DEG /*180 q22*/; + { + vtxArray[pos].ele = -Q22_180_DEG /*180 q22*/; + } ELSE - vtxArray[pos] - .ele = tmp; // q22 + { + vtxArray[pos].ele = tmp; // q22 + } move32(); /* Converting spherical coordinates to cartesians, assuming radius = 1 */ @@ -1678,7 +1686,7 @@ static void add_vertex_fx( /* IdxAziTmp */ tmp = L_abs( L_sub( Q22_90_DEG /*90 q22*/, L_abs( vtxArray[pos].azi ) ) ); // Q22 - idxAziTmp = L_shr( anint_fixed( tmp, Q22 ), Q22 ); // q22-q22->q0 + idxAziTmp = L_shr( anint_fx( tmp, Q22 ), Q22 ); // q22-q22->q0 /* IdxEleTmp */ tmp = L_abs( vtxArray[pos].ele ); // q22 @@ -1837,20 +1845,21 @@ static Word32 point_plane_distance_fx( // returns output in Q28 } /* Cross Product */ - v_sub_fixed( P1, P2, tmpCross1, 3, 1 ); // tmpCross1 q30 - v_sub_fixed( P1, P3, tmpCross2, 3, 1 ); // tmpCross2 q30 + v_sub_fx( P1, P2, tmpCross1, 3, 1 ); // tmpCross1 q30 + v_sub_fx( P1, P3, tmpCross2, 3, 1 ); // tmpCross2 q30 /* resultCross = cross(P1-P2,P1-P3) */ efap_crossp_fx( tmpCross1, tmpCross2, resultCross ); // Q29 /* Dot Product */ - tmpNorm = dotp_fixed( resultCross, resultCross, 3 ); // Q27 + tmpNorm = dotp_fx32( resultCross, resultCross, 3 ); // Q27 Word16 exp = 4; move16(); - tmpNorm = ISqrt32( tmpNorm, &exp ); // Q29 - v_sub_fixed( X, P1, tmpDot1, 3, 1 ); // Q30 - v_multc_fixed( resultCross, tmpNorm, tmpDot2, 3 ); // Q29 - exp - dist = L_shl( dotp_fixed( tmpDot1, tmpDot2, 3 ), exp ); // Q28 + tmpNorm = ISqrt32( tmpNorm, &exp ); // Q29 + v_sub_fx( X, P1, tmpDot1, 3, 1 ); // Q30 + v_multc_fx( resultCross, tmpNorm, tmpDot2, 3 ); // Q29 - exp + dist = L_shl( dotp_fx32( tmpDot1, tmpDot2, 3 ), exp ); // Q28 + return dist; } @@ -2246,16 +2255,16 @@ static void sort_channels_vertex_fx( } /* First Base Vector */ - v_sub_fixed( P2, P1, tmpU, 3, 1 ); // tmpU Q30 + v_sub_fx( P2, P1, tmpU, 3, 1 ); // tmpU Q30 Word16 exp1 = 2; move16(); - normU = ISqrt32( dotp_fixed( tmpU, tmpU, 3 ) /*q29*/, &exp1 ); /*q=31-exp1*/ + normU = ISqrt32( dotp_fx32( tmpU, tmpU, 3 ) /*q29*/, &exp1 ); /*q=31-exp1*/ // normU = L_shl_sat( normU, exp ); //normU Q31 - v_multc_fixed( tmpU, normU, U, 3 ); // U Q30 - exp1 + v_multc_fx( tmpU, normU, U, 3 ); // U Q30 - exp1 /* Second Base Vector */ - v_sub_fixed( P3, P2, tmpV1, 3, 1 ); // tmpV1 Q30 - v_multc_fixed( U, dotp_fixed( U, tmpV1, 3 ), tmpV2, 3 ); // tmpV2 Q28 - 2*exp1 + v_sub_fx( P3, P2, tmpV1, 3, 1 ); // tmpV1 Q30 + v_multc_fx( U, dotp_fx32( U, tmpV1, 3 ), tmpV2, 3 ); // tmpV2 Q28 - 2*exp1 FOR( i = 0; i < 3; i++ ) { @@ -2263,12 +2272,12 @@ static void sort_channels_vertex_fx( move32(); } - v_sub_fixed_no_hdrm( tmpV1, tmpV2, tmpV3, 3 ); // tmpV3 Q30 + v_sub_fx_no_hdrm( tmpV1, tmpV2, tmpV3, 3 ); // tmpV3 Q30 Word16 exp2 = 2; move16(); - normV = ISqrt32( dotp_fixed( tmpV3, tmpV3, 3 ) /*q29*/, &exp2 ); // q=31-exp2 + normV = ISqrt32( dotp_fx32( tmpV3, tmpV3, 3 ) /*q29*/, &exp2 ); // q=31-exp2 - v_multc_fixed( tmpV3, normV, V, 3 ); // V Q30 - exp2 + v_multc_fx( tmpV3, normV, V, 3 ); // V Q30 - exp2 /* Center of the first Triangle */ FOR( i = 0; i < 3; ++i ) @@ -2286,10 +2295,10 @@ static void sort_channels_vertex_fx( move32(); } - v_sub_fixed( tmpP, MC, P, 3, 1 ); // P Q30 + v_sub_fx( tmpP, MC, P, 3, 1 ); // P Q30 - x = dotp_fixed( P, U, 3 ); // x Q29 - exp1 - y = dotp_fixed( P, V, 3 ); // y Q29 - exp2 + x = dotp_fx32( P, U, 3 ); // x Q29 - exp1 + y = dotp_fx32( P, V, 3 ); // y Q29 - exp2 // Executing azi[i] = atan2f( y, x ); azi[i] = L_shl( BASOP_util_atan2( y, x, sub( exp2, exp1 ) ), Q16 ); // azi 2Q29 @@ -2297,7 +2306,7 @@ static void sort_channels_vertex_fx( } /* Sorting the azi vec */ - v_sort_ind_fixed( azi, order, lengthChannels ); + v_sort_ind_fx( azi, order, lengthChannels ); /* Updating the channel array */ FOR( i = 0; i < lengthChannels; ++i ) @@ -2445,7 +2454,7 @@ static Word16 in_poly_fx( /* Angles are in Q22 */ A[1] = poly.polyEle[0]; // q22 move32(); - v_sub_fixed_no_hdrm( P, A, P_minus_A, 2 ); /* Precalculate value of (P-A) q22*/ + v_sub_fx_no_hdrm( P, A, P_minus_A, 2 ); /* Precalculate value of (P-A) q22*/ FOR( n = 1; n < sub( numVertices, 1 ); ++n ) { @@ -2514,8 +2523,8 @@ static Word16 in_tri_fx( I'll just compute the determinant and if it's equal to 0, that means the two vectors are colinear */ - v_sub_fixed_no_hdrm( B, A, tmpDot1, 2 ); // tmpDot1 q22 - v_sub_fixed_no_hdrm( C, A, tmpDot2, 2 ); // tmpDot2 q22 + v_sub_fx_no_hdrm( B, A, tmpDot1, 2 ); // tmpDot1 q22 + v_sub_fx_no_hdrm( C, A, tmpDot2, 2 ); // tmpDot2 q22 /* Verification of the non-colinearity : Q22 * Q22 = Q13 */ invFactor = Msub_32_32( Mpy_32_32( tmpDot1[0], tmpDot2[1] ), tmpDot1[1], tmpDot2[0] ); /*q22+q22-q31->q13*/ diff --git a/lib_rend/ivas_mcmasa_ana_fx.c b/lib_rend/ivas_mcmasa_ana_fx.c index 0236b080b5da2c5179acc2aac1bc8e06b3dd945a..dbaf5b7d90079e783bb42ca5e2f5c9d995630a96 100644 --- a/lib_rend/ivas_mcmasa_ana_fx.c +++ b/lib_rend/ivas_mcmasa_ana_fx.c @@ -715,8 +715,8 @@ void ivas_mcmasa_param_est_ana_fx( } /* Y */ - v_multc_fixed( Chnl_RealBuffer_fx[0], hMcMasa->chnlToFoaMtx_fx[1][0], Foa_RealBuffer_fx[1], num_freq_bins ); /*inp_q*/ - v_multc_fixed( Chnl_ImagBuffer_fx[0], hMcMasa->chnlToFoaMtx_fx[1][0], Foa_ImagBuffer_fx[1], num_freq_bins ); /*inp_q*/ + v_multc_fx( Chnl_RealBuffer_fx[0], hMcMasa->chnlToFoaMtx_fx[1][0], Foa_RealBuffer_fx[1], num_freq_bins ); /*inp_q*/ + v_multc_fx( Chnl_ImagBuffer_fx[0], hMcMasa->chnlToFoaMtx_fx[1][0], Foa_ImagBuffer_fx[1], num_freq_bins ); /*inp_q*/ FOR( i = 1; i < numAnalysisChannels; i++ ) { v_multc_acc_32_32( Chnl_RealBuffer_fx[i], hMcMasa->chnlToFoaMtx_fx[1][i], Foa_RealBuffer_fx[1], num_freq_bins ); /*inp_q*/ @@ -731,8 +731,8 @@ void ivas_mcmasa_param_est_ana_fx( } ELSE { - v_multc_fixed( Chnl_RealBuffer_fx[0], hMcMasa->chnlToFoaMtx_fx[2][0], Foa_RealBuffer_fx[2], num_freq_bins ); /*inp_q*/ - v_multc_fixed( Chnl_ImagBuffer_fx[0], hMcMasa->chnlToFoaMtx_fx[2][0], Foa_ImagBuffer_fx[2], num_freq_bins ); /*inp_q*/ + v_multc_fx( Chnl_RealBuffer_fx[0], hMcMasa->chnlToFoaMtx_fx[2][0], Foa_RealBuffer_fx[2], num_freq_bins ); /*inp_q*/ + v_multc_fx( Chnl_ImagBuffer_fx[0], hMcMasa->chnlToFoaMtx_fx[2][0], Foa_ImagBuffer_fx[2], num_freq_bins ); /*inp_q*/ FOR( i = 1; i < numAnalysisChannels; i++ ) { v_multc_acc_32_32( Chnl_RealBuffer_fx[i], hMcMasa->chnlToFoaMtx_fx[2][i], Foa_RealBuffer_fx[2], num_freq_bins ); /*inp_q*/ @@ -740,8 +740,8 @@ void ivas_mcmasa_param_est_ana_fx( } } /* X */ - v_multc_fixed( Chnl_RealBuffer_fx[0], hMcMasa->chnlToFoaMtx_fx[3][0], Foa_RealBuffer_fx[3], num_freq_bins ); /*inp_q*/ - v_multc_fixed( Chnl_ImagBuffer_fx[0], hMcMasa->chnlToFoaMtx_fx[3][0], Foa_ImagBuffer_fx[3], num_freq_bins ); /*inp_q*/ + v_multc_fx( Chnl_RealBuffer_fx[0], hMcMasa->chnlToFoaMtx_fx[3][0], Foa_RealBuffer_fx[3], num_freq_bins ); /*inp_q*/ + v_multc_fx( Chnl_ImagBuffer_fx[0], hMcMasa->chnlToFoaMtx_fx[3][0], Foa_ImagBuffer_fx[3], num_freq_bins ); /*inp_q*/ FOR( i = 1; i < numAnalysisChannels; i++ ) { v_multc_acc_32_32( Chnl_RealBuffer_fx[i], hMcMasa->chnlToFoaMtx_fx[3][i], Foa_RealBuffer_fx[3], num_freq_bins ); /*inp_q*/ @@ -754,8 +754,8 @@ void ivas_mcmasa_param_est_ana_fx( Copy32( Foa_ImagBuffer_fx[0], FoaEven_ImagBuffer_fx[0], num_freq_bins ); /*inp_q*/ /* Y */ - v_multc_fixed( Chnl_RealBuffer_fx[0], hMcMasa->chnlToFoaEvenMtx_fx[1][0], FoaEven_RealBuffer_fx[1], num_freq_bins ); /*inp_q*/ - v_multc_fixed( Chnl_ImagBuffer_fx[0], hMcMasa->chnlToFoaEvenMtx_fx[1][0], FoaEven_ImagBuffer_fx[1], num_freq_bins ); /*inp_q*/ + v_multc_fx( Chnl_RealBuffer_fx[0], hMcMasa->chnlToFoaEvenMtx_fx[1][0], FoaEven_RealBuffer_fx[1], num_freq_bins ); /*inp_q*/ + v_multc_fx( Chnl_ImagBuffer_fx[0], hMcMasa->chnlToFoaEvenMtx_fx[1][0], FoaEven_ImagBuffer_fx[1], num_freq_bins ); /*inp_q*/ FOR( i = 1; i < numAnalysisChannels; i++ ) { v_multc_acc_32_32( Chnl_RealBuffer_fx[i], hMcMasa->chnlToFoaEvenMtx_fx[1][i], FoaEven_RealBuffer_fx[1], num_freq_bins ); /*inp_q*/ @@ -767,8 +767,8 @@ void ivas_mcmasa_param_est_ana_fx( set_zero_fx( FoaEven_ImagBuffer_fx[2], num_freq_bins ); /* X */ - v_multc_fixed( Chnl_RealBuffer_fx[0], hMcMasa->chnlToFoaEvenMtx_fx[3][0], FoaEven_RealBuffer_fx[3], num_freq_bins ); /*inp_q*/ - v_multc_fixed( Chnl_ImagBuffer_fx[0], hMcMasa->chnlToFoaEvenMtx_fx[3][0], FoaEven_ImagBuffer_fx[3], num_freq_bins ); /*inp_q*/ + v_multc_fx( Chnl_RealBuffer_fx[0], hMcMasa->chnlToFoaEvenMtx_fx[3][0], FoaEven_RealBuffer_fx[3], num_freq_bins ); /*inp_q*/ + v_multc_fx( Chnl_ImagBuffer_fx[0], hMcMasa->chnlToFoaEvenMtx_fx[3][0], FoaEven_ImagBuffer_fx[3], num_freq_bins ); /*inp_q*/ FOR( i = 1; i < numAnalysisChannels; i++ ) { v_multc_acc_32_32( Chnl_RealBuffer_fx[i], hMcMasa->chnlToFoaEvenMtx_fx[3][i], FoaEven_RealBuffer_fx[3], num_freq_bins ); /*inp_q*/ @@ -778,8 +778,7 @@ void ivas_mcmasa_param_est_ana_fx( /* Direction estimation */ computeIntensityVector_ana_fx( hMcMasa->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, num_freq_bands, intensity_real_fx, intensity_real_q, inp_q ); - computeDirectionVectors_fixed( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], 0, - intensity_real_q ); /* Q direction_vector_fx = Q30*/ + computeDirectionVectors_fx2( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], 0, intensity_real_q ); /* Q direction_vector_fx = Q30*/ /* Power and intensity estimation for diffuseness */ computeIntensityVector_ana_fx( hMcMasa->band_grouping, FoaEven_RealBuffer_fx, FoaEven_ImagBuffer_fx, num_freq_bands, intensity_even_real_fx, intensity_even_real_q, inp_q ); @@ -824,7 +823,8 @@ void ivas_mcmasa_param_est_ana_fx( Copy32( reference_power_fx[ts], &( hMcMasa->buffer_energy_fx[i_mult( index - 1, num_freq_bands )] ), num_freq_bands ); hMcMasa->buffer_energy_q[index - 1] = reference_power_q; move16(); - computeDiffuseness_fixed( hMcMasa->buffer_intensity_real_fx, hMcMasa->buffer_energy_fx, num_freq_bands, diffuseness_vector_fx, hMcMasa->buffer_intensity_real_q, hMcMasa->buffer_energy_q, out_exp ); // out_exp = Q30 + computeDiffuseness_fx( hMcMasa->buffer_intensity_real_fx, hMcMasa->buffer_energy_fx, num_freq_bands, diffuseness_vector_fx, hMcMasa->buffer_intensity_real_q, hMcMasa->buffer_energy_q, out_exp ); // out_exp = Q30 + /* Compute vertical diffuseness, and tune original diffuseness if needed */ IF( !hMcMasa->isHorizontalSetup ) { diff --git a/lib_rend/ivas_objectRenderer_fx.c b/lib_rend/ivas_objectRenderer_fx.c index cd39614547d46de88f7868914d63aeddc6ab8866..773c8ac0168272b2c85561544e5aadeebb3b1fe9 100644 --- a/lib_rend/ivas_objectRenderer_fx.c +++ b/lib_rend/ivas_objectRenderer_fx.c @@ -234,6 +234,7 @@ ivas_error ivas_td_binaural_open_unwrap_fx( } } } + test(); test(); IF( EQ_16( ivas_format, ISM_FORMAT ) || EQ_16( ivas_format, MASA_ISM_FORMAT ) || EQ_16( ivas_format, SBA_ISM_FORMAT ) ) @@ -257,7 +258,8 @@ ivas_error ivas_td_binaural_open_unwrap_fx( move32(); move32(); move32(); - if ( NULL == distAtt ) + + IF( NULL == distAtt ) { DistAtten.DistAttenModel = TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED; // Q0 move16(); @@ -268,13 +270,18 @@ ivas_error ivas_td_binaural_open_unwrap_fx( DistAtten.RollOffFactor_fx = ONE_IN_Q30; // Q30 move32(); } - else + ELSE { DistAtten.DistAttenModel = TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED; // Q0 + move16(); DistAtten.MaxDist_fx = distAtt[0]; + move32(); DistAtten.RefDist_fx = distAtt[1]; + move32(); DistAtten.RollOffFactor_fx = distAtt[2]; + move32(); } + IF( NE_32( ( error = TDREND_MIX_SRC_SetDirAtten_fx( pBinRendTd, nS, DirAtten_p ) ), IVAS_ERR_OK ) ) { return error; @@ -448,13 +455,11 @@ ivas_error ivas_td_binaural_renderer_unwrap_fx( } /* Render subframe */ - IF( NE_32( ( error = TDREND_GetMix_fx( hBinRendererTd, output_fx, subframe_length, subframe_idx ) ), IVAS_ERR_OK ) ) { return error; } - /* Advance subframe pointer */ c_indx = 0; move16(); @@ -504,7 +509,6 @@ ivas_error TDREND_GetMix_fx( Word32 hrf_left_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; Word32 hrf_right_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; Word16 intp_count; - Word16 hrf_left_delta_e = 0, hrf_right_delta_e = 0; move16(); move16(); diff --git a/lib_rend/ivas_objectRenderer_hrFilt_fx.c b/lib_rend/ivas_objectRenderer_hrFilt_fx.c index ac0bf6d558e986d2b7ba5507b3cd1005f5ee8dc9..a162ec4c9fb5a53a02861e5d367c92100e403da7 100644 --- a/lib_rend/ivas_objectRenderer_hrFilt_fx.c +++ b/lib_rend/ivas_objectRenderer_hrFilt_fx.c @@ -44,13 +44,13 @@ * Local function prototypes *---------------------------------------------------------------------*/ -static Word32 round_fixed( Word32 n, Word16 q ); static void getPeriodicBSplineSampVec_fx( Word32 *BfVec_fx, Word16 *AzIdx, const Word16 NumBFs, const Word32 t_fx, Word16 *num_az_idx, const Word32 knot_interval_fx, const Word32 azimKSeq_0_fx, const Word16 azimSegSamples, const Word32 *azimBsShape_fx, const Word16 subSampFactor ); static void getStandardBSplineSampVec_fx( Word32 *BfVec_fx, Word16 *NzIdx, Word16 *num_idx, const Word16 NumBFs, const Word32 t_fx, const Word32 *KSeq_fx, const Word16 SegSamples, const Word16 *BsLen, const Word16 *BsStart, const Word32 *BsShape_fx ); static void GenerateFilter_fx( const Word32 elev, Word32 azim, ModelParams_t *model, ModelEval_t *modelEval ); static void GenerateITD_fx( const Word32 elev, Word32 azim, ModelParamsITD_t *model, ModelEval_t *modelEval ); static void SkipSmallest_ValueIndex_fx( Word16 *use_inds, const ValueIndex_t *VI, const Word16 N, const Word16 n_smallest ); + /*-------------------------------------------------------------------* * TDREND_REND_RenderSourceHRFilt() * @@ -151,9 +151,11 @@ void GetFilterFromAngle_fx( return; } -static Word32 round_fixed( /* o : Output value Q0 */ - Word32 num, /* i : Input value */ - Word16 q /* i : Input q-factor */ + +/* o : Output value Q0 */ +static Word32 round_hrFilt_fx( + Word32 num, /* i : Input value */ + Word16 q /* i : Input q-factor */ ) { Word32 half; @@ -561,6 +563,7 @@ static void GenerateITD_fx( Word32 tmp32 = Mpy_32_16_1( modelEval->itdMod_fx, model->resamp_factor_fx ); // Q = 31 - ( itdMod_e + 1 ) Word16 tmp_q = sub( 30, itdMod_e ); + IF( tmp_q < 0 ) { tmp32 = L_shr( tmp32, tmp_q ); @@ -573,7 +576,7 @@ static void GenerateITD_fx( tmp_q = 31; move16(); } - modelEval->itdMod_fx = L_negate( round_fixed( tmp32, tmp_q ) ); // Q0 + modelEval->itdMod_fx = L_negate( round_hrFilt_fx( tmp32, tmp_q ) ); // Q0 return; } @@ -623,7 +626,7 @@ static void getPeriodicBSplineSampVec_fx( tmp32 = L_deposit_h( BASOP_Util_Divide3232_Scale( L_sub( t_fx, azimKSeq_0_fx ), tmp32, &tmp_e2 ) ); tmp_e2 = add( tmp_e2, sub( 9, tmp_e1 ) ); tmp32 = L_shr( tmp32, sub( 9, tmp_e2 ) ); // Q22 (assuming tmp32 will be in range of Q22) - d0 = extract_l( round_fixed( tmp32, Q22 ) ); + d0 = extract_l( round_hrFilt_fx( tmp32, Q22 ) ); } /* find segment */ @@ -691,7 +694,7 @@ static void getStandardBSplineSampVec_fx( tmp32 = L_deposit_h( BASOP_Util_Divide3232_Scale( L_sub( t_fx, KSeq_fx[0] ), tmp32, &tmp_e3 ) ); tmp_e3 = add( tmp_e3, sub( 9, tmp_e2 ) ); tmp32 = L_shr( tmp32, sub( 9, tmp_e3 ) ); // Q22 (assuming tmp32 will be in range of Q22) - d0 = extract_l( round_fixed( tmp32, 22 ) ); + d0 = extract_l( round_hrFilt_fx( tmp32, 22 ) ); /* find segment */ nI = 0; diff --git a/lib_rend/ivas_objectRenderer_sources_fx.c b/lib_rend/ivas_objectRenderer_sources_fx.c index 90ac586ee23437e9861127afa0d90b014bedf041..f4f57fde545dde59cc1e5ec403d15008dcad8530 100644 --- a/lib_rend/ivas_objectRenderer_sources_fx.c +++ b/lib_rend/ivas_objectRenderer_sources_fx.c @@ -135,6 +135,7 @@ ivas_error TDREND_MIX_SRC_SetDir_fx( * * Set directional attenuation for the mixer. --------------------------------------------------------------------*/ + ivas_error TDREND_MIX_SRC_SetDirAtten_fx( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ const Word16 SrcInd, /* i : Source index Q0 */ @@ -168,6 +169,7 @@ ivas_error TDREND_MIX_SRC_SetDistAtten( ) { TDREND_SRC_SPATIAL_t *SrcSpatial_p; + IF( GT_16( SrcInd, hBinRendererTd->MaxSrcInd ) ) { return ( IVAS_ERROR( IVAS_ERR_INVALID_INDEX, "Index exceeds max index\n" ) ); @@ -274,6 +276,7 @@ static void TDREND_SRC_REND_Init_fx( return; } + /*-------------------------------------------------------------------* * TDREND_SRC_REND_UpdateFiltersFromSpatialParams() * @@ -284,31 +287,19 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ TDREND_SRC_REND_t *SrcRend_p, /* i/o: Source object */ TDREND_SRC_SPATIAL_t *SrcSpatial_p, /* i : Spatial aspects of source */ - Word32 *hrf_left_prev, - /* i/o: Left filter */ // exp(hrf_left_prev_e) - Word16 *hrf_left_prev_e, - /* i/o: Left filter exponent */ // Q0 - Word32 *hrf_right_prev, - /* i/o: Right filter */ // exp(hrf_right_prev_e) - Word16 *hrf_right_prev_e, - /* i/o: Right filter exponent */ // Q0 - Word32 *hrf_left_delta, - /* o : Left filter interpolation delta */ // exp(hrf_left_delta_e) - Word16 *hrf_left_delta_e, - /* o : Left filter interpolation delta exponent */ // Q0 - Word32 *hrf_right_delta, - /* o : Right filter interpolation delta */ // exp(hrf_right_delta_e) - Word16 *hrf_right_delta_e, - /* o : Right filter interpolation delta exponent */ // Q0 - Word16 *intp_count, - /* o : Interpolation count */ // Q0 - Word16 *filterlength, - /* o : Length of filters */ // Q0 - Word16 *itd, - /* o : ITD value */ // Q0 - Word32 *Gain, - /* o : Gain value */ // Q30 - TDREND_SRC_t *Src_p /* i/o: Source pointer */ + Word32 *hrf_left_prev, /* i/o: Left filter exp(hrf_left_prev_e) */ + Word16 *hrf_left_prev_e, /* i/o: Left filter exponent Q0 */ + Word32 *hrf_right_prev, /* i/o: Right filter exp(hrf_right_prev_e) */ + Word16 *hrf_right_prev_e, /* i/o: Right filter exponent Q0 */ + Word32 *hrf_left_delta, /* o : Left filter interpolation delta exp(hrf_left_delta_e) */ + Word16 *hrf_left_delta_e, /* o : Left filter interpolation delta exponent Q0 */ + Word32 *hrf_right_delta, /* o : Right filter interpolation delta exp(hrf_right_delta_e) */ + Word16 *hrf_right_delta_e, /* o : Right filter interpolation delta exponent Q0 */ + Word16 *intp_count, /* o : Interpolation count Q0 */ + Word16 *filterlength, /* o : Length of filters Q0 */ + Word16 *itd, /* o : ITD value Q0 */ + Word32 *Gain, /* o : Gain value Q30 */ + TDREND_SRC_t *Src_p /* i/o: Source pointer */ ) { TDREND_MIX_Listener_t *Listener_p; @@ -397,11 +388,11 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( move32(); } - /* Update total gains */ *Gain = L_shl( Mpy_32_32( L_shl( L_mult( *SrcRend_p->SrcGain_p_fx, *SrcRend_p->DirGain_p_fx ), 1 ), L_shl( L_mult( *SrcRend_p->DistGain_p_fx, hBinRendererTd->Gain_fx ), 1 ) ), 1 ); // Q30 move32(); - /* Delta for interpolation, in case the angular step exceeds MAX_ANGULAR_STEP */ + + /* Delta for interpolation, in case the angular step exceeds MAX_ANGULAR_STEP=0.01f */ Word32 ele_tmp = Src_p->elev_prev_fx; // Q22 move32(); IF( GT_32( ele_tmp, DEG_180_IN_Q22 ) ) @@ -468,8 +459,6 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( move16(); } - test(); - IF( ( *intp_count > 0 ) ) { /* Set deltas for interpolation */ @@ -490,8 +479,8 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( *hrf_left_delta_e = tmp_e; move16(); - Word32 fac = L_deposit_h( div_s( 1, *intp_count ) ); // Q15 - v_multc_fixed( hrf_left_delta, fac, hrf_left_delta, *filterlength ); // exp(hrf_left_delta_e) + Word32 fac = L_deposit_h( div_s( 1, *intp_count ) ); // Q15 + v_multc_fx( hrf_left_delta, fac, hrf_left_delta, *filterlength ); // exp(hrf_left_delta_e) tmp_e = s_max( *hrf_right_prev_e, hrf_right_e ); FOR( Word16 i = 0; i < *filterlength; i++ ) @@ -509,7 +498,7 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( *hrf_right_delta_e = tmp_e; move16(); - v_multc_fixed( hrf_right_delta, fac, hrf_right_delta, *filterlength ); // exp(hrf_right_delta_e) + v_multc_fx( hrf_right_delta, fac, hrf_right_delta, *filterlength ); // exp(hrf_right_delta_e) } ELSE { @@ -531,6 +520,7 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( return; } + /*-------------------------------------------------------------------* * TDREND_SRC_SPATIAL_Alloc() * @@ -656,6 +646,7 @@ static void TDREND_SRC_SPATIAL_SetDirAtten_fx( return; } + /*-------------------------------------------------------------------* * TDREND_SRC_SPATIAL_SetDistAtten() * @@ -680,6 +671,7 @@ static void TDREND_SRC_SPATIAL_SetDistAtten( return; } + /*-------------------------------------------------------------------* * TDREND_SRC_SPATIAL_GetDirGain() * @@ -687,11 +679,11 @@ static void TDREND_SRC_SPATIAL_SetDistAtten( --------------------------------------------------------------------*/ /*! r: Gain value */ -static Word16 TDREND_SRC_SPATIAL_GetDirGain_fx( /* o : Directional Gain Output Q14 */ - const TDREND_DirAtten_t *DirAtten_p, /* i : Directional attenuation specification */ - const Word32 *Front_p_fx, /* i : Front-pointing vector Q30 */ - const Word32 *RelPos_p_fx, /* i : Relative position */ - const Word16 RelPos_p_e /* i : Relative position exp RelPos_p_e */ +static Word16 TDREND_SRC_SPATIAL_GetDirGain_fx( + const TDREND_DirAtten_t *DirAtten_p, /* i : Directional attenuation specification */ + const Word32 *Front_p_fx, /* i : Front-pointing vector Q30 */ + const Word32 *RelPos_p_fx, /* i : Relative position */ + const Word16 RelPos_p_e /* i : Relative position exp RelPos_p_e */ ) { Word16 DirGain_fx; // Q14 @@ -712,7 +704,7 @@ static Word16 TDREND_SRC_SPATIAL_GetDirGain_fx( Vec_fx[i] = L_negate( RelPos_p_fx[i] ); // exp(RelPos_p_e) move32(); } - ProjCoef_fx = dotp_fixed( Vec_fx, Front_p_fx, 3 ); // exp: RelPos_p_e + 1 + ProjCoef_fx = dotp_fx32( Vec_fx, Front_p_fx, 3 ); // exp: RelPos_p_e + 1 ProjCoef_e = add( RelPos_p_e, 1 ); NormRelPos_fx = TDREND_SPATIAL_VecNorm_fx( RelPos_p_fx, RelPos_p_e, &NormRelPos_e ); // exp(NormRelPos_e) @@ -772,10 +764,10 @@ static Word16 TDREND_SRC_SPATIAL_GetDirGain_fx( --------------------------------------------------------------------*/ /*! r: Gain value */ -static Word16 TDREND_SRC_SPATIAL_GetDistGain_fx( /* o : Distance gain Q14 */ - const TDREND_DistAtten_t *DistAtten_p, /* i : Distance attenuation parameters */ - const Word32 Dist_fx, /* i : Distance value Dist_e */ - const Word16 Dist_e /* i : Distance value exp */ +static Word16 TDREND_SRC_SPATIAL_GetDistGain_fx( + const TDREND_DistAtten_t *DistAtten_p, /* i : Distance attenuation parameters */ + const Word32 Dist_fx, /* i : Distance value Dist_e */ + const Word16 Dist_e /* i : Distance value exp */ ) { Word16 DistGain_fx; // Q14 @@ -845,11 +837,13 @@ static Word16 TDREND_SRC_SPATIAL_GetDistGain_fx( return DistGain_fx; } + /*-------------------------------------------------------------------* * TDREND_SRC_Alloc() * * Allocate a source. --------------------------------------------------------------------*/ + ivas_error TDREND_SRC_Alloc( TDREND_SRC_t **Src_pp /* i/o: Source */ ) @@ -882,6 +876,7 @@ ivas_error TDREND_SRC_Alloc( return IVAS_ERR_OK; } + /*-------------------------------------------------------------------* * TDREND_SRC_Dealloc() * @@ -903,13 +898,17 @@ void TDREND_SRC_Dealloc( /* Free the Src_p variable */ free( Src_p ); Src_p = NULL; + return; } + + /*-------------------------------------------------------------------* * TDREND_SRC_Init() * * Initializes a source. --------------------------------------------------------------------*/ + void TDREND_SRC_Init_fx( TDREND_SRC_t *Src_p, /* i/o: Source to initialize */ const TDREND_PosType_t PosType /* i : Position type specifier */ @@ -953,5 +952,6 @@ void TDREND_SRC_Init_fx( move32(); Src_p->prevGain_fx = ONE_IN_Q30; // Q30 move32(); + return; } diff --git a/lib_rend/ivas_objectRenderer_vec_fx.c b/lib_rend/ivas_objectRenderer_vec_fx.c index 0d8c11aabc2d1f7bbbca125f01563c194a940636..140861539307a16b008dcd1fc0a29922d844c8b6 100644 --- a/lib_rend/ivas_objectRenderer_vec_fx.c +++ b/lib_rend/ivas_objectRenderer_vec_fx.c @@ -141,12 +141,13 @@ void TDREND_SPATIAL_VecMapToNewCoordSystem_fx( v_sub_32( Vec_p, TranslVec_p, LisRelPosAbs, 3 ); /* Evalute the relative Vec in the coordinates of the Orientation vectors, */ /* which form an orthonormal basis */ - MappedVec_p[0] = dotp_fixed( LisRelPosAbs, DirVec_p, 3 ); // Q: Qy + Qy - Q31 + MappedVec_p[0] = dotp_fx32( LisRelPosAbs, DirVec_p, 3 ); // Q: Qy + Qy - Q31 move32(); - MappedVec_p[1] = dotp_fixed( LisRelPosAbs, RightVec_p, 3 ); // Q: Qy + Qy - Q31 + MappedVec_p[1] = dotp_fx32( LisRelPosAbs, RightVec_p, 3 ); // Q: Qy + Qy - Q31 move32(); - MappedVec_p[2] = dotp_fixed( LisRelPosAbs, UpVec_p, 3 ); // Q: Qy + Qy - Q31 + MappedVec_p[2] = dotp_fx32( LisRelPosAbs, UpVec_p, 3 ); // Q: Qy + Qy - Q31 move32(); + return; } @@ -157,7 +158,6 @@ void TDREND_SPATIAL_VecMapToNewCoordSystem_fx( *-------------------------------------------------------------------*/ /*! r: Flag if the orientation has been updated */ - Word16 TDREND_SPATIAL_EvalOrthonormOrient_fx( Word32 *FrontVecON_p_fx, /* i/o: Normalized front vector Q30 */ Word32 *UpVecON_p_fx, /* i/o: Normalized up vector Q30 */ diff --git a/lib_rend/ivas_omasa_ana_fx.c b/lib_rend/ivas_omasa_ana_fx.c index 67e72e84c0578a544a54372d4f469ae923a0bb2f..e441b3596d14dbe4d6108c0d815216e68fc8dfbe 100644 --- a/lib_rend/ivas_omasa_ana_fx.c +++ b/lib_rend/ivas_omasa_ana_fx.c @@ -490,14 +490,14 @@ static void ivas_omasa_param_est_ana_fx( FOR( i = 1; i < nchan_ism; i++ ) { - v_add_fixed_no_hdrm( Chnl_RealBuffer_fx[i], Foa_RealBuffer_fx[0], Foa_RealBuffer_fx[0], num_freq_bins ); // Q: Chnl_RealBuffer_q - v_add_fixed_no_hdrm( Chnl_ImagBuffer_fx[i], Foa_ImagBuffer_fx[0], Foa_ImagBuffer_fx[0], num_freq_bins ); // Q: Chnl_ImagBuffer_q + v_add_fx_no_hdrm( Chnl_RealBuffer_fx[i], Foa_RealBuffer_fx[0], Foa_RealBuffer_fx[0], num_freq_bins ); // Q: Chnl_RealBuffer_q + v_add_fx_no_hdrm( Chnl_ImagBuffer_fx[i], Foa_ImagBuffer_fx[0], Foa_ImagBuffer_fx[0], num_freq_bins ); // Q: Chnl_ImagBuffer_q } /* Y */ - v_multc_fixed( Chnl_RealBuffer_fx[0], hOMasa->chnlToFoaMtx_fx[1][0], Foa_RealBuffer_fx[1], num_freq_bins ); // Q: Chnl_RealBuffer_q - v_multc_fixed( Chnl_ImagBuffer_fx[0], hOMasa->chnlToFoaMtx_fx[1][0], Foa_ImagBuffer_fx[1], num_freq_bins ); // Q: Chnl_ImagBuffer_q + v_multc_fx( Chnl_RealBuffer_fx[0], hOMasa->chnlToFoaMtx_fx[1][0], Foa_RealBuffer_fx[1], num_freq_bins ); // Q: Chnl_RealBuffer_q + v_multc_fx( Chnl_ImagBuffer_fx[0], hOMasa->chnlToFoaMtx_fx[1][0], Foa_ImagBuffer_fx[1], num_freq_bins ); // Q: Chnl_ImagBuffer_q FOR( i = 1; i < nchan_ism; i++ ) { @@ -507,8 +507,8 @@ static void ivas_omasa_param_est_ana_fx( /* Z */ - v_multc_fixed( Chnl_RealBuffer_fx[0], hOMasa->chnlToFoaMtx_fx[2][0], Foa_RealBuffer_fx[2], num_freq_bins ); // Q: Chnl_RealBuffer_q - v_multc_fixed( Chnl_ImagBuffer_fx[0], hOMasa->chnlToFoaMtx_fx[2][0], Foa_ImagBuffer_fx[2], num_freq_bins ); // Q: Chnl_ImagBuffer_q + v_multc_fx( Chnl_RealBuffer_fx[0], hOMasa->chnlToFoaMtx_fx[2][0], Foa_RealBuffer_fx[2], num_freq_bins ); // Q: Chnl_RealBuffer_q + v_multc_fx( Chnl_ImagBuffer_fx[0], hOMasa->chnlToFoaMtx_fx[2][0], Foa_ImagBuffer_fx[2], num_freq_bins ); // Q: Chnl_ImagBuffer_q FOR( i = 1; i < nchan_ism; i++ ) { @@ -516,8 +516,8 @@ static void ivas_omasa_param_est_ana_fx( v_multc_acc_32_32( Chnl_ImagBuffer_fx[i], hOMasa->chnlToFoaMtx_fx[2][i], Foa_ImagBuffer_fx[2], num_freq_bins ); // Q: Chnl_ImagBuffer_q } - v_multc_fixed( Chnl_RealBuffer_fx[0], hOMasa->chnlToFoaMtx_fx[3][0], Foa_RealBuffer_fx[3], num_freq_bins ); // Q: Chnl_RealBuffer_q - v_multc_fixed( Chnl_ImagBuffer_fx[0], hOMasa->chnlToFoaMtx_fx[3][0], Foa_ImagBuffer_fx[3], num_freq_bins ); // Q: Chnl_ImagBuffer_q + v_multc_fx( Chnl_RealBuffer_fx[0], hOMasa->chnlToFoaMtx_fx[3][0], Foa_RealBuffer_fx[3], num_freq_bins ); // Q: Chnl_RealBuffer_q + v_multc_fx( Chnl_ImagBuffer_fx[0], hOMasa->chnlToFoaMtx_fx[3][0], Foa_ImagBuffer_fx[3], num_freq_bins ); // Q: Chnl_ImagBuffer_q FOR( i = 1; i < nchan_ism; i++ ) { @@ -526,9 +526,9 @@ static void ivas_omasa_param_est_ana_fx( } computeIntensityVector_ana_fx( hOMasa->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, num_freq_bands, intensity_real_fx, intensity_real_q, inp_q ); - computeDirectionVectors_fixed( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], 0, intensity_real_q ); /* Q direction_vector_fx = Q30*/ - /* Power estimation for diffuseness */ + computeDirectionVectors_fx2( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], 0, intensity_real_q ); /* Q direction_vector_fx = Q30*/ + /* Power estimation for diffuseness */ computeReferencePower_ana_fx( hOMasa->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, reference_power_fx[ts], num_freq_bands, inp_q, &reference_power_q ); /* Aligning intensity_real to a common Q-factor */ @@ -563,7 +563,7 @@ static void ivas_omasa_param_est_ana_fx( hOMasa->buffer_energy_q[index - 1] = reference_power_q; move16(); - computeDiffuseness_fixed( hOMasa->buffer_intensity_real_fx, hOMasa->buffer_energy_fx, num_freq_bands, diffuseness_vector_fx, hOMasa->buffer_intensity_real_q, hOMasa->buffer_energy_q, &diffuseness_q ); // diffuseness_q=Q30 + computeDiffuseness_fx( hOMasa->buffer_intensity_real_fx, hOMasa->buffer_energy_fx, num_freq_bands, diffuseness_vector_fx, hOMasa->buffer_intensity_real_q, hOMasa->buffer_energy_q, &diffuseness_q ); // diffuseness_q=Q30 FOR( band_m_idx = 0; band_m_idx < hOMasa->nbands; band_m_idx++ ) { @@ -654,7 +654,6 @@ static void ivas_omasa_dmx_fx( const Word16 interpolator_fx[L_FRAME48k] ) { Word16 i, j, k, l, tmp1, tmp2; - Word16 azimuth_fx, elevation_fx; Word16 gains_fx[MASA_MAX_TRANSPORT_CHANNELS]; Word16 g1_fx, g2_fx, scale; @@ -686,7 +685,6 @@ static void ivas_omasa_dmx_fx( { FOR( k = 0; k < input_frame; k++ ) { - g1_fx = interpolator_fx[k]; // Q15 move16(); scale = BASOP_Util_Add_MantExp( 16384, 1, negate( g1_fx ), 0, &g2_fx ); @@ -761,8 +759,6 @@ static void ivas_omasa_dmx_fx( return; } -/* Compute downmix */ - /*--------------------------------------------------------------------------* * computeIntensityVector_ana() @@ -850,11 +846,6 @@ void computeIntensityVector_ana_fx( return; } -/*--------------------------------------------------------------------------* - * computeIntensityVector_ana() - * - * - *--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------* diff --git a/lib_rend/ivas_output_init_fx.c b/lib_rend/ivas_output_init_fx.c index 170581b2391c5b786729aaf3836c9f9abdfe1477..f67a9293a1adaa833fde29178b35a1dc97f12b15 100644 --- a/lib_rend/ivas_output_init_fx.c +++ b/lib_rend/ivas_output_init_fx.c @@ -501,7 +501,7 @@ ivas_error ivas_output_buff_dec_fx( /* note: these are intra-frame heap memories */ IF( ( p_output_f[ch] = (Word32 *) malloc( ( 48000 / FRAMES_PER_SEC ) * sizeof( Word32 ) ) ) == NULL ) /* note: 32000 == max internal sampling rate */ { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for floating-point output audio buffer!\n" ) ); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for output audio buffer!\n" ) ); } } } diff --git a/lib_rend/ivas_prot_rend_fx.h b/lib_rend/ivas_prot_rend_fx.h index 512d4fd21d8de391b898979b6481250b0f605f5e..c695138da5bcb22863df3e25983c94dbe407c554 100644 --- a/lib_rend/ivas_prot_rend_fx.h +++ b/lib_rend/ivas_prot_rend_fx.h @@ -49,11 +49,13 @@ IVAS_REND_AudioConfigType getAudioConfigType( const AUDIO_CONFIG config ); + ivas_error getAudioConfigNumChannels( const AUDIO_CONFIG config, Word16 *numChannels ); + /*----------------------------------------------------------------------------------* * output setup prototypes *----------------------------------------------------------------------------------*/ @@ -87,45 +89,28 @@ ivas_error get_channel_config( ); -/*----------------------------------------------------------------------------------* - * Limiter prototypes - *----------------------------------------------------------------------------------*/ - -void ivas_limiter_dec_fx( - IVAS_LIMITER_HANDLE hLimiter, /* i/o: limiter struct handle */ - Word32 *output[MAX_OUTPUT_CHANNELS], /* i/o: input/output buffer */ - const Word16 num_channels, /* i : number of channels to be processed */ - const Word16 output_frame, /* i : number of samples per channel in the buffer */ - const Word16 BER_detect, /* i : BER detect flag */ - Word16 q_factor /* i : Q factor of the output samples */ -); - -void limiter_process_fx( - IVAS_LIMITER_HANDLE hLimiter, /* i/o: limiter struct handle */ - const Word16 output_frame, /* i : number of samples to be processed per channel in the I/O buffer */ - const Word32 threshold, /* i : signal amplitude above which limiting starts to be applied */ - const Word16 BER_detect, /* i : BER detect flag */ - Word16 *strong_saturation_cnt, /* i/o: counter of strong saturations (can be NULL) */ - Word16 q_factor /* i : Q factor of output samples */ -); /*----------------------------------------------------------------------------------* * TD decorr. function prototypes *----------------------------------------------------------------------------------*/ + ivas_error ivas_td_decorr_dec_open_fx( ivas_td_decorr_state_t **hTdDecorr, /* i/o: TD decorrelator handle */ const Word32 output_Fs, /* i : output sampling rate */ const Word16 nchan_internal, /* i : number of internal channels */ const Word16 ducking_flag /* i : ducking flag */ ); + void ivas_td_decorr_dec_close( ivas_td_decorr_state_t **hTdDecorr /* i/o: TD decorrelator handle */ ); + void ivas_td_decorr_process_fx( ivas_td_decorr_state_t *hTdDecorr, /* i/o: TD decoderrelator handle */ Word32 *pcm_in[], /* i : input audio channels */ Word32 **ppOut_pcm, /* o : output audio channels */ const Word16 output_frame /* i : output frame length */ ); + ivas_error ivas_td_decorr_reconfig_dec( const IVAS_FORMAT ivas_format, /* i : IVAS format */ const Word32 ivas_total_brate, /* i : total IVAS bitrate */ @@ -141,6 +126,8 @@ void ivas_td_decorr_APD_iir_filter_fx( const Word16 num_APD_sections, /* i : numbef of APD sections */ const Word16 output_frame /* i : output frame length */ ); + + /*----------------------------------------------------------------------------------* * Amplitude Panning EFAP prototypes *----------------------------------------------------------------------------------*/ @@ -153,6 +140,10 @@ ivas_error efap_init_data_fx( const Word16 efap_mode /* i : indicates whether EFAP or EFIP is used */ ); +void efap_free_data_fx( + EFAP_HANDLE *hEFAPdata /* i/o: EFAP handle to be freed */ +); + void efap_determine_gains_fx( EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ Word32 *gains, /* o : gain vector for speaker nodes for given direction Q30 */ @@ -240,7 +231,7 @@ void ivas_dirac_dec_close_binaural_data_fx( ); ivas_error ivas_dirac_dec_binaural_copy_hrtfs_fx( - HRTFS_PARAMBIN_HANDLE *hHrtfParambin /* i/o: HRTF structure for rendering */ + HRTFS_PARAMBIN_HANDLE *hHrtfParambin /* i/o: HRTF structure for rendering */ ); ivas_error ivas_dirac_alloc_mem_fx( @@ -472,17 +463,17 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( Word16 q_diffuseness, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ - const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ - const IVAS_OUTPUT_SETUP hOutSetup, /* i : output setup structure */ - const Word16 nchan_transport, /* i : number of transport channels*/ + const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ + const IVAS_OUTPUT_SETUP hOutSetup, /* i : output setup structure */ + const Word16 nchan_transport, /* i : number of transport channels */ const Word16 md_idx, - const Word16 hodirac_flag, /* i : flag to indicate HO-DirAC mode */ + const Word16 hodirac_flag, /* i : flag to indicate HO-DirAC mode */ const Word16 dec_param_estim ); void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd_fx( - Word32 RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ - Word32 ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ + Word32 RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ + Word32 ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ const Word16 nchan_transport, /* i : number of transport channels */ @@ -496,8 +487,8 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd_fx( ); void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( - Word32 RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ - Word32 ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ + Word32 RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ + Word32 ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ const Word16 nbslots, /* i : number of slots to process */ @@ -578,9 +569,9 @@ void ivas_dirac_deallocate_parameters_fx( ); void ivas_masa_ext_dirac_render_fx( - MASA_EXT_REND_HANDLE hMasaExtRend, /* i/o: MASA renderer structure */ - Word32 *output_f[], /* i/o: input/output signals in time domain q11*/ - const Word16 num_subframes /* i : number of subframes to render */ + MASA_EXT_REND_HANDLE hMasaExtRend, /* i/o: MASA renderer structure */ + Word32 *output_f[], /* i/o: input/output signals in time domain q11 */ + const Word16 num_subframes /* i : number of subframes to render */ ); @@ -644,18 +635,18 @@ ivas_error ivas_HRTF_statistics_binary_open_fx( *----------------------------------------------------------------------------------*/ ivas_error ivas_td_binaural_renderer_unwrap_fx( - const REVERB_HANDLE hReverb, /* i : Reverberator handle */ - const AUDIO_CONFIG transport_config, /* i : Transport configuration */ - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD binaural object renderer handle */ - const Word16 num_src, /* i : number of sources to render */ - const Word16 lfe_idx, /* i : LFE channel index */ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - ISM_METADATA_HANDLE *hIsmMetaData, /* i : ISM metadata handle */ - COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i/o: combined orientaton data handle */ + const REVERB_HANDLE hReverb, /* i : Reverberator handle */ + const AUDIO_CONFIG transport_config, /* i : Transport configuration */ + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD binaural object renderer handle */ + const Word16 num_src, /* i : number of sources to render */ + const Word16 lfe_idx, /* i : LFE channel index */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + ISM_METADATA_HANDLE *hIsmMetaData, /* i : ISM metadata handle */ + COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i/o: combined orientaton data handle */ const Word16 ism_md_subframe_update, /* i : Number of subframes to delay ism metadata to sync with audio */ Word32 *output_fx[], /* i/o: SCE channels / Binaural synthesis Q11 */ - const Word16 output_frame, /* i : output frame length */ - const Word16 num_subframes /* i : number of subframes to render */ + const Word16 output_frame, /* i : output frame length */ + const Word16 num_subframes /* i : number of subframes to render */ ); ivas_error ivas_td_binaural_renderer_ext_fx( @@ -668,7 +659,7 @@ ivas_error ivas_td_binaural_renderer_ext_fx( const Word16 ism_md_subframe_update_ext, /* i : Metadata Delay in subframes to sync with audio delay */ const Word32 output_Fs, /* i : output sampling rate */ const Word16 output_frame, /* i : output frame length */ - Word32 output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis Q11 */ + Word32 output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis Q11 */ Word16 *exp ); @@ -704,10 +695,10 @@ void ivas_td_binaural_close_fx( ); ivas_error TDREND_GetMix_fx( - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ - Word32 *output[], /* i/o: ISM object synth / rendered output in 0,1 */ - const Word16 subframe_length, /* i/o: subframe length Q11 */ -const Word16 subframe_idx /* i : Subframe index to 5 ms subframe */ + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ + Word32 *output[], /* i/o: ISM object synth/rendered output in 0,1 */ + const Word16 subframe_length, /* i/o: subframe length Q11 */ + const Word16 subframe_idx /* i : Subframe index to 5 ms subframe */ ); void BSplineModelEvalDealloc_fx( @@ -718,15 +709,15 @@ void BSplineModelEvalDealloc_fx( /* ----- Object renderer - hrfilt ----- */ void GetFilterFromAngle_fx( - TDREND_HRFILT_FiltSet_t *HrFiltSet_p, /* i/o: HR filter set structure */ - const Word32 Elev_fx, /* i : Elevation, degrees Q22 */ - Word32 Azim_fx, /* i : Azimuth, degrees Q22 */ - const Word16 filterlength, /* i : Filter length */ - Word32 *hrf_left_fx, /* o : Left HR filter */ - Word16 *hrf_left_e, /* o : Left HR filter exponent */ - Word32 *hrf_right_fx, /* o : Right HR filter */ - Word16 *hrf_right_e, /* o : Right HR filter exponent */ - Word16 *itd /* o : ITD value Q0 */ + TDREND_HRFILT_FiltSet_t *HrFiltSet_p, /* i/o: HR filter set structure */ + const Word32 Elev_fx, /* i : Elevation, degrees Q22 */ + Word32 Azim_fx, /* i : Azimuth, degrees Q22 */ + const Word16 filterlength, /* i : Filter length */ + Word32 *hrf_left_fx, /* o : Left HR filter */ + Word16 *hrf_left_e, /* o : Left HR filter exponent */ + Word32 *hrf_right_fx, /* o : Right HR filter */ + Word16 *hrf_right_e, /* o : Right HR filter exponent */ + Word16 *itd /* o : ITD value Q0 */ ); void HRTF_model_precalc( @@ -734,14 +725,14 @@ void HRTF_model_precalc( ); ivas_error TDREND_REND_RenderSourceHRFilt_fx( - TDREND_SRC_t *Src_p, /* i/o: The source to be rendered */ - Word32 *hrf_left_delta_fx, /* i/o: Left filter interpolation delta */ - Word16 *hrf_left_delta_e, /* i/o: Left filter interpolation delta exp */ - Word32 *hrf_right_delta_fx, /* i/o: Right filter interpolation delta */ - Word16 *hrf_right_delta_e, /* i/o: Right filter interpolation delta exp */ - const Word16 intp_count, /* i : Interpolation count */ + TDREND_SRC_t *Src_p, /* i/o: The source to be rendered */ + Word32 *hrf_left_delta_fx, /* i/o: Left filter interpolation delta */ + Word16 *hrf_left_delta_e, /* i/o: Left filter interpolation delta exp */ + Word32 *hrf_right_delta_fx, /* i/o: Right filter interpolation delta */ + Word16 *hrf_right_delta_e, /* i/o: Right filter interpolation delta exp */ + const Word16 intp_count, /* i : Interpolation count */ Word32 output_buf_fx[][L_SPATIAL_SUBFR_48k], /* o : Output buffer same Q as Src_p->InputFrame_p_fx Q11 */ - const Word16 subframe_length /* i : Subframe length in use */ + const Word16 subframe_length /* i : Subframe length in use */ ); /* ----- Object renderer - sources ----- */ @@ -778,22 +769,22 @@ ivas_error TDREND_MIX_SRC_SetPlayState( ); void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ - TDREND_SRC_REND_t *SrcRend_p, /* i/o: Source object */ - TDREND_SRC_SPATIAL_t *SrcSpatial_p, /* i : Spatial aspects of source */ - Word32 *hrf_left_prev, /* i/o: Left filter */ - Word16 *hrf_left_prev_e, /* i/o: Left filter exponent */ - Word32 *hrf_right_prev, /* i/o: Right filter */ - Word16 *hrf_right_prev_e, /* i/o: Right filter exponent */ - Word32 *hrf_left_delta, /* o : Left filter interpolation delta */ - Word16 *hrf_left_delta_e, /* o : Left filter interpolation delta exponent */ - Word32 *hrf_right_delta, /* o : Right filter interpolation delta */ - Word16 *hrf_right_delta_e, /* o : Right filter interpolation delta exponent */ - Word16 *intp_count, /* o : Interpolation count */ - Word16 *filterlength, /* o : Length of filters */ - Word16 *itd, /* o : ITD value */ - Word32 *Gain, /* o : Gain value Q30 */ - TDREND_SRC_t *Src_p /* i/o: Source pointer */ + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ + TDREND_SRC_REND_t *SrcRend_p, /* i/o: Source object */ + TDREND_SRC_SPATIAL_t *SrcSpatial_p, /* i : Spatial aspects of source */ + Word32 *hrf_left_prev, /* i/o: Left filter */ + Word16 *hrf_left_prev_e, /* i/o: Left filter exponent */ + Word32 *hrf_right_prev, /* i/o: Right filter */ + Word16 *hrf_right_prev_e, /* i/o: Right filter exponent */ + Word32 *hrf_left_delta, /* o : Left filter interpolation delta */ + Word16 *hrf_left_delta_e, /* o : Left filter interpolation delta exponent */ + Word32 *hrf_right_delta, /* o : Right filter interpolation delta */ + Word16 *hrf_right_delta_e, /* o : Right filter interpolation delta exponent */ + Word16 *intp_count, /* o : Interpolation count */ + Word16 *filterlength, /* o : Length of filters */ + Word16 *itd, /* o : ITD value */ + Word32 *Gain, /* o : Gain value Q30 */ + TDREND_SRC_t *Src_p /* i/o: Source pointer */ ); ivas_error TDREND_SRC_Alloc( @@ -809,36 +800,31 @@ void TDREND_SRC_Init_fx( const TDREND_PosType_t PosType /* i : Position type specifier */ ); -/* ----- Object renderer - vec ----- */ void TDREND_SPATIAL_VecInit_fx( - Word32 *Pos_p, /* o : Output vector */ - const Word32 PosX, /* i : X value */ - const Word32 PosY, /* i : Y value */ - const Word32 PosZ /* i : Z value */ + Word32 *Pos_p, /* o : Output vector */ + const Word32 PosX, /* i : X value */ + const Word32 PosY, /* i : Y value */ + const Word32 PosZ /* i : Z value */ ); -/*! r: Euclidian norm value */ - void TDREND_SPATIAL_VecNormalize_fx( - const Word32 *Vec_p_fx, /* i : Input vector Qx */ - Word16 q, /* i : Input vector Q-factor */ - Word32 *VecNorm_p_fx /* o : Normalised output vector Q30 */ + const Word32 *Vec_p_fx, /* i : Input vector Qx */ + Word16 q, /* i : Input vector Q-factor */ + Word32 *VecNorm_p_fx /* o : Normalised output vector Q30 */ ); Word16 TDREND_SPATIAL_EvalOrthonormOrient_fx( - Word32 *FrontVecON_p_fx, /* i/o: Normalized front vector Q30 */ - Word32 *UpVecON_p_fx, /* i/o: Normalized up vector Q30 */ - Word32 *RightVecON_p_fx, /* i/o: Normalized right vector Q30 */ - const Word32 *FrontVec_p_fx, /* i : Input front vector Qx */ - const Word32 *UpVec_p_fx, /* i : Input up vector orient_q */ - const Word16 orient_q /* i : Input up Q-factor */ + Word32 *FrontVecON_p_fx, /* i/o: Normalized front vector Q30 */ + Word32 *UpVecON_p_fx, /* i/o: Normalized up vector Q30 */ + Word32 *RightVecON_p_fx, /* i/o: Normalized right vector Q30 */ + const Word32 *FrontVec_p_fx, /* i : Input front vector Qx */ + const Word32 *UpVec_p_fx, /* i : Input up vector orient_q */ + const Word16 orient_q /* i : Input up Q-factor */ ); -/* ----- Object renderer - mix ----- */ - ivas_error TDREND_MIX_AddSrc_fx( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ - Word16 *SrcInd, /* o : Source index */ + Word16 *SrcInd, /* o : Source index */ const TDREND_PosType_t PosType /* i : Position type (absolute/relative) */ ); @@ -855,32 +841,30 @@ ivas_error TDREND_MIX_Init_fx( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ TDREND_HRFILT_FiltSet_t **hHrtfTD, /* i/o: HRTF data (initialized in case of NULL) */ const TDREND_MixSpatSpec_t *MixSpatSpec_p, /* i : Mixer spatial specification */ - const Word32 output_Fs /* i : Output sampling rate */ + const Word32 output_Fs /* i : Output sampling rate */ ); - /* ----- Object renderer - sfx ----- */ - void TDREND_Apply_ITD_fx( - Word32 *input_fx, /* i : Input subframe to be time adjusted Qx */ - Word32 *out_left_fx, /* o : Output left channel with ITD applied Qx */ - Word32 *out_right_fx, /* o : Output right channel with ITD applied Qx */ - Word16 *previtd, /* i/o: Previous ITD value */ - const Word16 itd, /* i : Current subframe ITD value */ - Word32 *mem_itd_fx, /* i/o: ITD buffer memory Qx */ - const Word16 length /* i : Subframe length */ + Word32 *input_fx, /* i : Input subframe to be time adjusted Qx */ + Word32 *out_left_fx, /* o : Output left channel with ITD applied Qx */ + Word32 *out_right_fx, /* o : Output right channel with ITD applied Qx */ + Word16 *previtd, /* i/o: Previous ITD value */ + const Word16 itd, /* i : Current subframe ITD value */ + Word32 *mem_itd_fx, /* i/o: ITD buffer memory Qx */ + const Word16 length /* i : Subframe length */ ); void TDREND_firfilt_fx( - Word32 *signal_fx, /* i/o: Input signal / Filtered signal Qx */ - Word32 *filter_fx, /* i/o: FIR filter Qy */ - const Word16 filter_e, /* i : FIR filter exp */ - const Word32 *filter_delta_fx, /* i : FIR filter delta Qy */ - const Word16 intp_count, /* i : interpolation count */ - Word32 *mem_fx, /* i/o: filter memory Qx */ - const Word16 subframe_length, /* i : Length of signal */ - const Word16 filterlength, /* i : Filter length */ - const Word32 Gain_fx, /* i : Gain Q30 */ - const Word32 prevGain_fx /* i : Previous gain Q30 */ + Word32 *signal_fx, /* i/o: Input signal / Filtered signal Qx */ + Word32 *filter_fx, /* i/o: FIR filter Qy */ + const Word16 filter_e, /* i : FIR filter exp */ + const Word32 *filter_delta_fx, /* i : FIR filter delta Qy */ + const Word16 intp_count, /* i : interpolation count */ + Word32 *mem_fx, /* i/o: filter memory Qx */ + const Word16 subframe_length, /* i : Length of signal */ + const Word16 filterlength, /* i : Filter length */ + const Word32 Gain_fx, /* i : Gain Q30 */ + const Word32 prevGain_fx /* i : Previous gain Q30 */ ); @@ -968,7 +952,7 @@ ivas_error ivas_reverb_open_fx( ); void ivas_reverb_close_fx( - REVERB_HANDLE *hReverb /* i/o: Reverberator handle */ + REVERB_HANDLE *hReverb /* i/o: Reverberator handle */ ); ivas_error ivas_reverb_process_fx( @@ -998,15 +982,15 @@ void ivas_rev_delay_line_feed_sample_fx( ); void ivas_rev_delay_line_get_sample_blk_fx( - ivas_rev_delay_line_t *pDelay, /* i : the delay line */ - const UWord16 blk_size, /* i : number of samples in the data block */ + ivas_rev_delay_line_t *pDelay, /* i : the delay line */ + const UWord16 blk_size, /* i : number of samples in the data block */ Word32 *output /* i/o: amples gotten out of delay line, and amplified by set gainin */ ); void ivas_rev_delay_line_feed_sample_blk_fx( - ivas_rev_delay_line_t *pDelay, /* i/o: the delay line */ - const UWord16 blk_size, /* i : number of samples in the input data block */ - Word32 *input /* i : the samples to feed Q11 */ + ivas_rev_delay_line_t *pDelay, /* i/o: the delay line */ + const UWord16 blk_size, /* i : number of samples in the input data block */ + Word32 *input /* i : the samples to feed Q11 */ ); void ivas_reverb_iir_filt_init( @@ -1025,7 +1009,7 @@ void ivas_reverb_iir_filt_2taps_feed_blk_fx( ivas_rev_iir_filter_t *iirFilter, /* i/o: IIR filter */ const UWord16 blk_size, /* i : size */ const Word32 *input, /* i : input buffer */ - Word32 *output /* i : output buffer */ + Word32 *output /* o : output buffer */ ); UWord16 int_log2( @@ -1086,6 +1070,7 @@ void ivas_reverb_define_window_fft_fx( const Word16 transitionLength, const Word16 spectrumLength ); + Word16 ivas_reverb_calc_color_filters_fx( const Word32 *pTargetL, const Word32 *pTargetR, @@ -1153,7 +1138,6 @@ void ivas_shoebox_init( shoebox_config_t *cal ); - void ivas_shoebox_set_scene ( shoebox_obj_t *obj, shoebox_output_t *ER_PARAMS, @@ -1183,7 +1167,8 @@ ivas_error ivas_er_compute_reflections( ivas_error ivas_er_encoder_init( er_struct_t *reflections -); +); + ivas_error ivas_er_process( er_struct_t *reflections, const Word16 frame_size, @@ -1192,6 +1177,7 @@ ivas_error ivas_er_process( const AUDIO_CONFIG inConfig ); + /*---------------------------------------------------------------------------------* * Rotation Prototypes *-----------------------------------------------------------------------------------*/ @@ -1238,7 +1224,7 @@ void rotateAziEle_fx_frac_az_el( const Word16 isPlanar /* i : is roation planar and elevation meaningless? */ ); -void rotateAziEle_fixed( +void rotateAziEle_fx32( Word16 azi_in, /* i : output elevation */ Word16 ele_in, /* i : input elevation */ Word32 *azi, /* o : rotated azimuth */ @@ -1284,7 +1270,7 @@ void ivas_combined_orientation_set_to_start_index( COMBINED_ORIENTATION_HANDLE hCombinedOrientationData /* i/o: combined orientation handle */ ); -void rotateFrame_shd_cldfb( +void rotateFrame_shd_cldfb_fx( Word32 Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain real part */ Word32 Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain imag part */ Word32 Rmat[3][3], /* i : real-space rotation matrix */ @@ -1293,7 +1279,7 @@ void rotateFrame_shd_cldfb( const Word16 shd_rot_max_order /* i : split-order rotation method */ ); -void rotateFrame_sd_cldfb_fixed( +void rotateFrame_sd_cldfb_fx( Word32 Rmat[3][3], /* i : real-space rotation matrix */ Word32 Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain real part */ Word32 Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain imag part */ @@ -1303,7 +1289,7 @@ void rotateFrame_sd_cldfb_fixed( const Word16 nb_band /* i : number of CLDFB bands to process */ ); -ivas_error ivas_external_orientation_open( +ivas_error ivas_external_orientation_open_fx( EXTERNAL_ORIENTATION_HANDLE *hExtOrientationData, /* o : external orientation handle */ const Word16 num_subframes /* i : number of subframes */ ); @@ -1311,10 +1297,10 @@ ivas_error ivas_external_orientation_open( void ivas_external_orientation_close_fx( EXTERNAL_ORIENTATION_HANDLE *hExtOrientationData /* i/o: external orientation handle */ ); -ivas_error ivas_combined_orientation_open( - COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* o : combined orientation handle */ - const Word32 fs, /* i : sampling rate */ - const Word16 num_subframes /* i : number of subframes */ +ivas_error ivas_combined_orientation_open_fx( + COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* o : combined orientation handle */ + const Word32 fs, /* i : sampling rate */ + const Word16 num_subframes /* i : number of subframes */ ); void ivas_combined_orientation_close_fx( @@ -1409,10 +1395,10 @@ ivas_error ivas_orient_trk_GetTrackedRotation_fx( ); ivas_error ivas_orient_trk_Process_fx( - ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ - IVAS_QUATERNION absRot, /* i : absolute head rotation */ - Word32 updateRate_fx, /* i : rotation update rate [Hz] */ - IVAS_QUATERNION *pTrkRot /* o : tracked rotation */ + ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ + IVAS_QUATERNION absRot, /* i : absolute head rotation */ + Word32 updateRate_fx, /* i : rotation update rate [Hz] */ + IVAS_QUATERNION *pTrkRot /* o : tracked rotation */ ); @@ -1423,16 +1409,16 @@ ivas_error ivas_orient_trk_Process_fx( ivas_error ivas_mcmasa_ana_open( MCMASA_ANA_HANDLE *hMcMasaPtr, /* i/o: McMASA data handle pointer */ const AUDIO_CONFIG inConfig, /* i : Input config */ - Word32 input_Fs /* i : Sampling frequency */ + Word32 input_Fs /* i : Sampling frequency */ ); void ivas_mcmasa_ana_fx( - MCMASA_ANA_HANDLE hMcMasa, /* i/o: McMASA encoder handle */ - Word32 data[][L_FRAME48k], /* i/o: Input / transport audio signals */ + MCMASA_ANA_HANDLE hMcMasa, /* i/o: McMASA encoder handle */ + Word32 data[][L_FRAME48k], /* i/o: Input / transport audio signals */ Word16 q_data, - const Word16 input_frame, /* i : Input frame size */ - const Word16 nchan_transport, /* i : Number of transport channels */ - const Word16 nchan_inp /* i : Number of input channels */ + const Word16 input_frame, /* i : Input frame size */ + const Word16 nchan_transport, /* i : Number of transport channels */ + const Word16 nchan_inp /* i : Number of input channels */ ); void ivas_mcmasa_ana_close( @@ -1441,30 +1427,32 @@ void ivas_mcmasa_ana_close( ivas_error ivas_omasa_ana_open( OMASA_ANA_HANDLE *hOMasaPtr, /* i/o: OMASA data handle pointer */ - Word32 input_Fs, /* i : Sampling frequency */ - UWord16 total_num_objects /* i : Number of objects */ + Word32 input_Fs, /* i : Sampling frequency */ + UWord16 total_num_objects /* i : Number of objects */ ); void ivas_omasa_ana_fx( OMASA_ANA_HANDLE hOMasa, /* i/o: OMASA analysis handle */ - Word32 data_in_f_fx[][L_FRAME48k], /* i/o: Input / transport audio signals */ + Word32 data_in_f_fx[][L_FRAME48k], /* i/o: Input / transport audio signals */ Word16 *q, - const Word16 input_frame, /* i : Input frame size */ - const Word16 nchan_transport, /* i : Number of transport channels */ - const Word16 nchan_ism /* i : Number of objects for parameter analysis*/ + const Word16 input_frame, /* i : Input frame size */ + const Word16 nchan_transport, /* i : Number of transport channels */ + const Word16 nchan_ism /* i : Number of objects for parameter analysis*/ ); void ivas_omasa_ana_close( OMASA_ANA_HANDLE *hOMasa /* i/o: analysis OMASA handle */ ); + void computeIntensityVector_ana_fx( - const Word16 *band_grouping, /* i : Band grouping for estimation */ - Word32 Cldfb_RealBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], /* i : Real part of input signal Qx */ - Word32 Cldfb_ImagBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], /* i : Imag part of input sig Qx */ - const Word16 num_frequency_bands, /* i : Number of frequency bands */ - Word32 intensity_real[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS], /* o : Intensity */ + const Word16 *band_grouping, /* i : Band grouping for estimation */ + Word32 Cldfb_RealBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], /* i : Real part of input signal Qx */ + Word32 Cldfb_ImagBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], /* i : Imag part of input sig Qx */ + const Word16 num_frequency_bands, /* i : Number of frequency bands */ + Word32 intensity_real[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS], /* o : Intensity */ Word16 q_intensity_real[MASA_FREQUENCY_BANDS], - Word16 inp_q ); + Word16 inp_q +); void computeReferencePower_ana_fx( const Word16 *band_grouping, /* i : Band grouping for estimation */ @@ -1488,7 +1476,7 @@ void ivas_create_masa_out_meta_fx( Word16 energyRatio_q, Word16 spreadCoherence_q, Word16 surroundingCoherence_q - ); +); ivas_error ivas_dirac_ana_open_fx( DIRAC_ANA_HANDLE *hDirACPtr, /* i/o: DIRAC data handle pointer */ @@ -1496,11 +1484,11 @@ ivas_error ivas_dirac_ana_open_fx( ); void ivas_dirac_ana_fx( - DIRAC_ANA_HANDLE hDirAC, /* i/o: DIRAC analysis handle */ - Word32 data_in_fx[][L_FRAME48k], /* i/o: Input / transport audio signals */ - const Word16 input_frame, /* i : Input frame size */ + DIRAC_ANA_HANDLE hDirAC, /* i/o: DIRAC analysis handle */ + Word32 data_in_fx[][L_FRAME48k], /* i/o: Input / transport audio signals */ + const Word16 input_frame, /* i : Input frame size */ const Word16 nchan_transport, /* i : Number of transport channels */ - const Word16 data_q /*i : Q of data_in_fx*/ + const Word16 data_q /* i : Q of data_in_fx */ ); void ivas_dirac_ana_close_fx( @@ -1521,14 +1509,15 @@ void ivas_prerend_merge_masa_metadata_fx( ivas_error masaPrerendOpen_fx( MASA_PREREND_HANDLE *hMasaPrerendPtr, /* o : handle to the opened prerenderer */ - Word16 numTransports, /* i : number of transport channels */ - Word32 input_Fs /* i : signal sampling rate */ + Word16 numTransports, /* i : number of transport channels */ + Word32 input_Fs /* i : signal sampling rate */ ); void masaPrerendClose_fx( MASA_PREREND_HANDLE *hMasaPrerendPtr /* i/o: prerenderer handle to be closed */ ); + /*----------------------------------------------------------------------------------* * Split rendering *----------------------------------------------------------------------------------*/ diff --git a/lib_rend/ivas_render_config_fx.c b/lib_rend/ivas_render_config_fx.c index 2b0b5b5b1980a9e957c5b07e5c6a5d9470f1fb51..3c43b59e1fa44312f199d2cd4af6d26c10e6229a 100644 --- a/lib_rend/ivas_render_config_fx.c +++ b/lib_rend/ivas_render_config_fx.c @@ -42,10 +42,8 @@ * Local constants *-----------------------------------------------------------------------*/ -#define IVAS_REVERB_DEFAULT_PRE_DELAY 0.016f -#define IVAS_REVERB_DEFAULT_PRE_DELAY_FX 2147484 -#define IVAS_REVERB_DEFAULT_INPUT_DELAY 0.1f -#define IVAS_REVERB_DEFAULT_INPUT_DELAY_FX 13421773 +#define IVAS_REVERB_DEFAULT_PRE_DELAY_FX 2147484 // 0.016 +#define IVAS_REVERB_DEFAULT_INPUT_DELAY_FX 13421773 // 0.1 #define IVAS_REVERB_DEFAULT_USE_ER 0 diff --git a/lib_rend/ivas_reverb_fx.c b/lib_rend/ivas_reverb_fx.c index 793d58430bd5b920160248a623afd4ae5693e029..7fe1883ed444d661a59a83b28f324c6789a10f7a 100644 --- a/lib_rend/ivas_reverb_fx.c +++ b/lib_rend/ivas_reverb_fx.c @@ -130,12 +130,12 @@ static ivas_error calc_jot_t60_coeffs_fx( Word16 *pH_dB_fx, Word16 pH_dB_exp, co /*------------------------------------------------------------------------- - * wrap_rad_fixed() + * wrap_rad_fx() * * *------------------------------------------------------------------------*/ -static Word16 wrap_rad_fixed( +static Word16 wrap_rad_fx( Word32 angle /* Q13 */ ) { Word32 L_tmp = angle; @@ -258,7 +258,7 @@ static void ivas_binaural_reverb_setReverbTimes_fx( tmp = add( mult( EVS_PI_FX, tmp ), EPSILLON_FX ); // to avoid divide by 0 issue tmp_exp = sub( add( binCenterFreq_exp, 2 ), norm ); - sine_inp = wrap_rad_fixed( L_shl( tmp, sub( tmp_exp, 2 ) ) ); // Q13 + sine_inp = wrap_rad_fx( L_shl( tmp, sub( tmp_exp, 2 ) ) ); // Q13 sine = getSinWord16( sine_inp ); // Q15 div1 = BASOP_Util_Divide1616_Scale( sine, tmp, &scale ); @@ -2162,8 +2162,8 @@ void ivas_binaural_reverb_processSubframe_fx( /* Add the data from the end of the loop to the beginning, with an attenuation factor * according to RT60. This procedure generates an IIR decaying response. The response * is decorrelated later on. */ - v_multc_fixed( hReverb->loopBufReal_fx[bin] + hReverb->loopBufLength[bin], hReverb->loopAttenuationFactor_fx[bin], hReverb->loopBufReal_fx[bin], numSlots ); - v_multc_fixed( hReverb->loopBufImag_fx[bin] + hReverb->loopBufLength[bin], hReverb->loopAttenuationFactor_fx[bin], hReverb->loopBufImag_fx[bin], numSlots ); + v_multc_fx( hReverb->loopBufReal_fx[bin] + hReverb->loopBufLength[bin], hReverb->loopAttenuationFactor_fx[bin], hReverb->loopBufReal_fx[bin], numSlots ); + v_multc_fx( hReverb->loopBufImag_fx[bin] + hReverb->loopBufLength[bin], hReverb->loopAttenuationFactor_fx[bin], hReverb->loopBufImag_fx[bin], numSlots ); } /* 2) Apply the determined pre-delay to the input audio, and add the delayed audio to the loop. */ @@ -2194,13 +2194,13 @@ void ivas_binaural_reverb_processSubframe_fx( { IF( s_and( ch, 1 ) ) { - v_add_fixed_no_hdrm( hReverb->preDelayBufferReal_fx[idx], inReal[ch][sample], hReverb->preDelayBufferReal_fx[idx], hReverb->numBins ); - v_add_fixed_no_hdrm( hReverb->preDelayBufferImag_fx[idx], inImag[ch][sample], hReverb->preDelayBufferImag_fx[idx], hReverb->numBins ); + v_add_fx_no_hdrm( hReverb->preDelayBufferReal_fx[idx], inReal[ch][sample], hReverb->preDelayBufferReal_fx[idx], hReverb->numBins ); + v_add_fx_no_hdrm( hReverb->preDelayBufferImag_fx[idx], inImag[ch][sample], hReverb->preDelayBufferImag_fx[idx], hReverb->numBins ); } ELSE { - v_sub_fixed_no_hdrm( hReverb->preDelayBufferReal_fx[idx], inImag[ch][sample], hReverb->preDelayBufferReal_fx[idx], hReverb->numBins ); - v_add_fixed_no_hdrm( hReverb->preDelayBufferImag_fx[idx], inReal[ch][sample], hReverb->preDelayBufferImag_fx[idx], hReverb->numBins ); + v_sub_fx_no_hdrm( hReverb->preDelayBufferReal_fx[idx], inImag[ch][sample], hReverb->preDelayBufferReal_fx[idx], hReverb->numBins ); + v_add_fx_no_hdrm( hReverb->preDelayBufferImag_fx[idx], inReal[ch][sample], hReverb->preDelayBufferImag_fx[idx], hReverb->numBins ); } } idx = add( idx, 1 ) % hReverb->preDelayBufferLength; @@ -2230,20 +2230,20 @@ void ivas_binaural_reverb_processSubframe_fx( SWITCH( phaseShiftTypePr[tapIdx] ) { case 0: /* 0 degrees phase */ - v_add_fixed_no_hdrm( hReverb->outputBufferReal_fx[bin][ch], tapRealPr_fx[tapIdx], hReverb->outputBufferReal_fx[bin][ch], numSlots ); - v_add_fixed_no_hdrm( hReverb->outputBufferImag_fx[bin][ch], tapImagPr_fx[tapIdx], hReverb->outputBufferImag_fx[bin][ch], numSlots ); + v_add_fx_no_hdrm( hReverb->outputBufferReal_fx[bin][ch], tapRealPr_fx[tapIdx], hReverb->outputBufferReal_fx[bin][ch], numSlots ); + v_add_fx_no_hdrm( hReverb->outputBufferImag_fx[bin][ch], tapImagPr_fx[tapIdx], hReverb->outputBufferImag_fx[bin][ch], numSlots ); BREAK; case 1: /* 90 degrees phase */ - v_sub_fixed_no_hdrm( hReverb->outputBufferReal_fx[bin][ch], tapImagPr_fx[tapIdx], hReverb->outputBufferReal_fx[bin][ch], numSlots ); - v_add_fixed_no_hdrm( hReverb->outputBufferImag_fx[bin][ch], tapRealPr_fx[tapIdx], hReverb->outputBufferImag_fx[bin][ch], numSlots ); + v_sub_fx_no_hdrm( hReverb->outputBufferReal_fx[bin][ch], tapImagPr_fx[tapIdx], hReverb->outputBufferReal_fx[bin][ch], numSlots ); + v_add_fx_no_hdrm( hReverb->outputBufferImag_fx[bin][ch], tapRealPr_fx[tapIdx], hReverb->outputBufferImag_fx[bin][ch], numSlots ); BREAK; case 2: /* 180 degrees phase */ - v_sub_fixed_no_hdrm( hReverb->outputBufferReal_fx[bin][ch], tapRealPr_fx[tapIdx], hReverb->outputBufferReal_fx[bin][ch], numSlots ); - v_sub_fixed_no_hdrm( hReverb->outputBufferImag_fx[bin][ch], tapImagPr_fx[tapIdx], hReverb->outputBufferImag_fx[bin][ch], numSlots ); + v_sub_fx_no_hdrm( hReverb->outputBufferReal_fx[bin][ch], tapRealPr_fx[tapIdx], hReverb->outputBufferReal_fx[bin][ch], numSlots ); + v_sub_fx_no_hdrm( hReverb->outputBufferImag_fx[bin][ch], tapImagPr_fx[tapIdx], hReverb->outputBufferImag_fx[bin][ch], numSlots ); BREAK; default: /* 270 degrees phase */ - v_add_fixed_no_hdrm( hReverb->outputBufferReal_fx[bin][ch], tapImagPr_fx[tapIdx], hReverb->outputBufferReal_fx[bin][ch], numSlots ); - v_sub_fixed_no_hdrm( hReverb->outputBufferImag_fx[bin][ch], tapRealPr_fx[tapIdx], hReverb->outputBufferImag_fx[bin][ch], numSlots ); + v_add_fx_no_hdrm( hReverb->outputBufferReal_fx[bin][ch], tapImagPr_fx[tapIdx], hReverb->outputBufferReal_fx[bin][ch], numSlots ); + v_sub_fx_no_hdrm( hReverb->outputBufferImag_fx[bin][ch], tapRealPr_fx[tapIdx], hReverb->outputBufferImag_fx[bin][ch], numSlots ); BREAK; } } diff --git a/lib_rend/ivas_reverb_iir_filter_fx.c b/lib_rend/ivas_reverb_iir_filter_fx.c index e09ec70055ccf358879a06134430ec4765136b78..981a40466474a3b428557c4682243db0234cb885 100644 --- a/lib_rend/ivas_reverb_iir_filter_fx.c +++ b/lib_rend/ivas_reverb_iir_filter_fx.c @@ -116,6 +116,8 @@ void ivas_reverb_iir_filt_set( return; } + + /*-----------------------------------------------------------------------------------------* * Function ivas_reverb_iir_filt_2taps_feed_blk() * @@ -126,7 +128,7 @@ void ivas_reverb_iir_filt_2taps_feed_blk_fx( ivas_rev_iir_filter_t *iirFilter, /* i/o: IIR filter */ const UWord16 blk_size, /* i : size */ const Word32 *input, /* i : input buffer Q30 */ - Word32 *output /* i/o : output buffer Q30 */ + Word32 *output /* i/o: output buffer Q30 */ ) { UWord16 i; diff --git a/lib_rend/ivas_rom_rend.h b/lib_rend/ivas_rom_rend.h index f98fc83dfdffbf316301365134ab51355456c681..5b0f33864b00d441ae9cf83f227b09556f1be6f4 100644 --- a/lib_rend/ivas_rom_rend.h +++ b/lib_rend/ivas_rom_rend.h @@ -84,7 +84,6 @@ extern const Word32 diffuseFieldCoherenceDifferenceX_fx[BINAURAL_COHERENCE_DIFFE extern const Word32 diffuseFieldCoherenceDifferenceY_fx[BINAURAL_COHERENCE_DIFFERENCE_BINS]; /*Q-31*/ extern const Word32 diffuseFieldCoherenceDifferenceZ_fx[BINAURAL_COHERENCE_DIFFERENCE_BINS]; /*Q-31*/ - /*----------------------------------------------------------------------------------* * TD ISM Object renderer *----------------------------------------------------------------------------------*/ @@ -96,12 +95,14 @@ extern const Word32 SincTable_fx[321]; /*----------------------------------------------------------------------------------* * t-design and SN3D normalization table *----------------------------------------------------------------------------------*/ + /* SN3D norm (Fixed) */ extern const Word32 norm_sn3d_hoa3_int[16]; /*Q-29*/ /* Order 11 t-design (Fixed) */ extern const Word32 t_design_11_azimuth_int[70]; /*Q-22*/ extern const Word32 t_design_11_elevation_int[70]; /*Q-22*/ + /*----------------------------------------------------------------------* * Reverberator ROM tables *-----------------------------------------------------------------------*/ @@ -110,17 +111,12 @@ extern const Word32 ivas_reverb_default_fc_fx[]; /*Q-16*/ extern const Word32 ivas_reverb_default_RT60_fx[]; /*Q-26*/ extern const Word32 ivas_reverb_default_DSR_fx[]; /*Q-30*/ -/*----------------------------------------------------------------------------------* - * Renderer SBA & MC enc/dec matrices - *----------------------------------------------------------------------------------*/ - /*----------------------------------------------------------------------------------* * EFAP ROM tables *----------------------------------------------------------------------------------*/ extern const Word8 efap_poly_limit[MAX_OUTPUT_CHANNELS]; - /*----------------------------------------------------------------------------------* * LS Configuration Converter ROM tables *----------------------------------------------------------------------------------*/ diff --git a/lib_rend/ivas_rom_rend_fx.c b/lib_rend/ivas_rom_rend_fx.c index 6b27d9f1732c7929f22727c517ded829c3bf9d92..467061cdd862d7290f19cd8fc82c46735fde66e7 100644 --- a/lib_rend/ivas_rom_rend_fx.c +++ b/lib_rend/ivas_rom_rend_fx.c @@ -282,15 +282,13 @@ const Word32 ivas_reverb_default_DSR_fx[IVAS_REVERB_DEFAULT_N_BANDS] /*Q30*/ = 66, 30, 28 }; -/*----------------------------------------------------------------------------------* - * Renderer SBA & MC enc/dec matrices - *----------------------------------------------------------------------------------*/ - /*----------------------------------------------------------------------------------* * EFAP ROM tables *----------------------------------------------------------------------------------*/ -const Word8 efap_poly_limit[MAX_OUTPUT_CHANNELS] = {22, 22, 22, 26, 30, 34, 36, 42, 42, 44, 47, 51, 52, 54, 54, 54}; +const Word8 efap_poly_limit[MAX_OUTPUT_CHANNELS] = { + 22, 22, 22, 26, 30, 34, 36, 42, 42, 44, 47, 51, 52, 54, 54, 54 +}; /*----------------------------------------------------------------------------------* diff --git a/lib_rend/ivas_rotation_fx.c b/lib_rend/ivas_rotation_fx.c index 0524155c89f962cb5a76017ecbfc25369740d058..ff7a6ac5c4a4f53f47a2d2c58c6ec9e08e09d67f 100644 --- a/lib_rend/ivas_rotation_fx.c +++ b/lib_rend/ivas_rotation_fx.c @@ -557,7 +557,7 @@ void rotateAziEle_fx_frac_az_el( * Apply rotation to direction parameters azimuth and elevation *------------------------------------------------------------------------*/ -void rotateAziEle_fixed( +void rotateAziEle_fx32( Word16 azi_in, /* i : output elevation Q0 */ Word16 ele_in, /* i : input elevation Q0 */ Word32 *azi, /* o : rotated azimuth Q22 */ @@ -992,12 +992,15 @@ void rotateFrame_sd( pop_wmops(); return; } + + /*------------------------------------------------------------------------- * rotateFrame_shd_cldfb() * * Apply rotation to signals in Spherical Harmonic Domain and in CLDFB *------------------------------------------------------------------------*/ -void rotateFrame_shd_cldfb( + +void rotateFrame_shd_cldfb_fx( Word32 Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain real part Qx -> Qx-1 */ Word32 Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain imag part Qx -> Qx-1 */ Word32 Rmat[3][3], /* i : real-space rotation matrix Q30 */ @@ -1117,15 +1120,18 @@ void rotateFrame_shd_cldfb( move32(); } } + return; } + + /*------------------------------------------------------------------------- * rotateFrame_sd_cldfb() * * Apply rotation to signals in Spatial Domain and in CLDFB *------------------------------------------------------------------------*/ -void rotateFrame_sd_cldfb_fixed( +void rotateFrame_sd_cldfb_fx( Word32 Rmat_fx[3][3], /* i : real-space rotation matrix (Q30) */ Word32 Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain real part Qx */ Word32 Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain imag part Qx */ @@ -1244,12 +1250,14 @@ void rotateFrame_sd_cldfb_fixed( return; } + /*-----------------------------------------------------------------------* - * ivas_external_orientation_open() + * ivas_external_orientation_open_fx() * * Allocate and initialize external orientation handle *-----------------------------------------------------------------------*/ -ivas_error ivas_external_orientation_open( + +ivas_error ivas_external_orientation_open_fx( EXTERNAL_ORIENTATION_HANDLE *hExtOrientationData, /* o : external orientation handle */ const Word16 num_subframes /* i : number of subframes */ ) @@ -1267,6 +1275,7 @@ ivas_error ivas_external_orientation_open( move32(); identity.q_fact = 31; move16(); + /* Allocate handle */ IF( ( *hExtOrientationData = (EXTERNAL_ORIENTATION_HANDLE) malloc( sizeof( EXTERNAL_ORIENTATION_DATA ) ) ) == NULL ) { @@ -1274,6 +1283,7 @@ ivas_error ivas_external_orientation_open( } ( *hExtOrientationData )->num_subframes = num_subframes; move16(); + /* Enable head rotation and disable external orientation as default */ FOR( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { @@ -1288,14 +1298,17 @@ ivas_error ivas_external_orientation_open( ( *hExtOrientationData )->Quaternions[i] = identity; } + return IVAS_ERR_OK; } + /*-----------------------------------------------------------------------* * ivas_external_orientation_close() * * Deallocate external orientation handle *-----------------------------------------------------------------------*/ + void ivas_external_orientation_close_fx( EXTERNAL_ORIENTATION_HANDLE *hExtOrientationData /* i/o: external orientation handle */ ) @@ -1318,7 +1331,8 @@ void ivas_external_orientation_close_fx( * * Allocate and initialize combined orientation handle *-----------------------------------------------------------------------*/ -ivas_error ivas_combined_orientation_open( + +ivas_error ivas_combined_orientation_open_fx( COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* o : combined orientation handle */ const Word32 fs, /* i : sampling rate */ const Word16 num_subframes /* i : number of subframes */ diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 85c4dedd2eb33676b4ac2164f52822fe262b8f10..221c56950dd4c59553b1ab8a1ef2a030459605f1 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -262,17 +262,6 @@ typedef struct dirac_output_synthesis_state_structure /* only pointer to local buffers */ Word32 *diffuse_responses_square_fx; /* squared diffuse responses. Size: num_channels. */ /* Q31 */ - /* only pointer to local buffers */ - - - /* only pointer to local buffers */ - - /* Output gain memories */ - - /* only pointer to local buffers */ - - /* PSD memories */ - const Word32 *onset_filter_fx; /* Q31 */ /* Temporal smoothing memories */ @@ -518,7 +507,6 @@ typedef struct triplet_search_structure } VBAP_SEARCH_STRUCT; - /* VBAP data structure. Contains the formed virtual surface arrangement * and supporting data. */ typedef struct vbap_data_structure { @@ -535,6 +523,7 @@ typedef struct vbap_data_structure Word16 *object_mode_bottom_virtual_speaker_node_division_gains_fx; /* Q16 */ Word16 *object_mode_top_virtual_speaker_node_division_gains_fx; /* Q16 */ Word16 *object_mode_back_virtual_speaker_node_division_gains_fx; /* Q16 */ + } VBAP_DATA, *VBAP_HANDLE; @@ -574,7 +563,6 @@ typedef struct ivas_binaural_reverb_struct UWord32 binRend_RandNext; Word16 highestBinauralCoherenceBin; - Word32 dmxmtx_fx[BINAURAL_CHANNELS][MAX_OUTPUT_CHANNELS]; Word32 foa_enc_fx[MAX_OUTPUT_CHANNELS][FOA_CHANNELS]; @@ -672,6 +660,7 @@ typedef struct ivas_dirac_dec_binaural_data_structure HANDLE_DIRAC_DECORR_STATE h_freq_domain_decorr_ap_state; } DIRAC_DEC_BIN_DATA, *DIRAC_DEC_BIN_HANDLE; + typedef struct ivas_binaural_rendering_conv_module_struct_fx { Word32 ***filterTapsLeftReal_fx; @@ -687,6 +676,7 @@ typedef struct ivas_binaural_rendering_conv_module_struct_fx } BINRENDERER_CONV_MODULE_FX, *BINRENDERER_CONV_MODULE_HANDLE_FX; + /*----------------------------------------------------------------------------------* * EFAP structures *----------------------------------------------------------------------------------*/ @@ -709,6 +699,7 @@ typedef struct EFAP_VERTEX_DATA Word16 *vtxOrder; /* Array that indicates the order of the vertex ranked by increasing azimuth */ } EFAP_VERTEX_DATA; + typedef struct EFAP_POLYSET { Word16 chan[EFAP_MAX_CHAN_NUM]; /* An array indicating the loudspeaker index of the polygon vertices */ @@ -718,6 +709,7 @@ typedef struct EFAP_POLYSET Word32 polyEle[EFAP_MAX_CHAN_NUM]; /* An array (same length as "chan"), with the elevation of the channels */ /* Q22 */ } EFAP_POLYSET; + typedef struct EFAP_LS_TRIANGLE { Word16 LS[3]; /* Array indicating the loudspeaker index of the triangle vertices */ @@ -747,6 +739,7 @@ typedef struct EFAP } EFAP, *EFAP_HANDLE; + /*----------------------------------------------------------------------------------* * Orientation tracking structure *----------------------------------------------------------------------------------*/ @@ -766,6 +759,7 @@ typedef struct ivas_orient_trk_state_t } ivas_orient_trk_state_t; + /*----------------------------------------------------------------------------------* * Head rotation data structure *----------------------------------------------------------------------------------*/ @@ -799,11 +793,14 @@ typedef struct ivas_binaural_head_track_struct ivas_orient_trk_state_t *OrientationTracker; ISAR_SPLIT_REND_ROT_AXIS sr_pose_pred_axis; + } HEAD_TRACK_DATA, *HEAD_TRACK_DATA_HANDLE; + /*----------------------------------------------------------------------------------* * External orientation data structure *----------------------------------------------------------------------------------*/ + typedef struct ivas_external_orientation_struct { Word8 enableHeadRotation[MAX_PARAM_SPATIAL_SUBFRAMES]; /* 0 - disable, 1 - enable, 2 - freeze to previous rotation */ @@ -814,9 +811,12 @@ typedef struct ivas_external_orientation_struct Word16 num_subframes; } EXTERNAL_ORIENTATION_DATA, *EXTERNAL_ORIENTATION_HANDLE; + + /*----------------------------------------------------------------------------------* * Combined orientation data structure for the external orienations and head orientation *----------------------------------------------------------------------------------*/ + typedef struct ivas_combined_orientation_struct { Word16 enableCombinedOrientation[MAX_PARAM_SPATIAL_SUBFRAMES]; @@ -851,8 +851,10 @@ typedef struct ivas_combined_orientation_struct Word16 cur_subframe_samples_rendered; Word16 subframe_idx_start; Word16 cur_subframe_samples_rendered_start; + } COMBINED_ORIENTATION_DATA, *COMBINED_ORIENTATION_HANDLE; + /*----------------------------------------------------------------------------------* * Reverberator structure *----------------------------------------------------------------------------------*/ @@ -867,6 +869,7 @@ typedef struct ivas_rev_delay_line_t Word16 Delay; UWord16 BufferPos; Word16 Gain_fx; // Q14 + } ivas_rev_delay_line_t; typedef struct ivas_rev_iir_filter_t @@ -881,8 +884,8 @@ typedef struct ivas_rev_iir_filter_t } ivas_rev_iir_filter_t; -typedef float rv_fftwf_type_complex[2]; /* complex type of fftwf library */ typedef Word32 rv_fftwf_type_complex_fx[2]; /* complex type of fftwf library */ + /* Convertion block for FFT filter: from time domain to frequency domain (with OLS) and back */ typedef struct ivas_reverb_t2f_f2t_t { @@ -890,13 +893,12 @@ typedef struct ivas_reverb_t2f_f2t_t Word16 log2_fft_size; Word16 block_size; Word16 hist_size; /* rv_fft_size - rv_block_size */ - // float fft_history_L[RV_FILTER_MAX_HISTORY]; Word32 fft_history_L_fx[RV_FILTER_MAX_HISTORY]; - // float fft_history_R[RV_FILTER_MAX_HISTORY]; Word32 fft_history_R_fx[RV_FILTER_MAX_HISTORY]; Word16 prev_shift; } ivas_reverb_t2f_f2t_t; + /* FFT filter with its frequency response coefficients */ typedef struct ivas_reverb_fft_filter_t { @@ -935,6 +937,7 @@ typedef struct ivas_reverb_state_t } REVERB_DATA, *REVERB_HANDLE; + /*----------------------------------------------------------------------------------* * Shoebox structure *----------------------------------------------------------------------------------*/ @@ -1017,7 +1020,6 @@ typedef struct er_struct_t Word32 user_origin_fx[3]; // is not needed Word32 *circ_buffers; - UWord16 *closest_ch_idx; shoebox_output_t shoebox_data; shoebox_obj_t shoebox_lib; @@ -1283,6 +1285,7 @@ typedef struct Word32 binaural_latency_ns; BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd; TDREND_HRFILT_FiltSet_t **hHrtfTD; + } TDREND_WRAPPER, *TDREND_WRAPPER_HANDLE; @@ -1320,6 +1323,7 @@ typedef struct ivas_hrtf_crend_structure } HRTFS_CREND_DATA, *HRTFS_CREND_HANDLE; + /* Main Crend structure */ typedef struct ivas_crend_state_t { @@ -1422,7 +1426,7 @@ typedef struct ivas_hrtf_statistics_struct typedef struct { - int32_t binaural_latency_ns; + Word32 binaural_latency_ns; BINAURAL_RENDERER_HANDLE hCldfbRend; HRTFS_FASTCONV_HANDLE hHrtfFastConv; @@ -1432,6 +1436,7 @@ typedef struct /*----------------------------------------------------------------------------------* * Limiter structure *----------------------------------------------------------------------------------*/ + typedef struct { Word16 max_num_channels; @@ -1446,9 +1451,9 @@ typedef struct int32_t cnt_frames_limited; /* counter of frames in which the limiter is applied */ #endif - } IVAS_LIMITER, *IVAS_LIMITER_HANDLE; + /*----------------------------------------------------------------------------------* * Loudspeaker Configuration Conversion structure *----------------------------------------------------------------------------------*/ @@ -1465,11 +1470,11 @@ typedef struct ivas_LS_setupconversion_struct } LSSETUP_CONVERSION_STRUCT, *LSSETUP_CONVERSION_HANDLE; - typedef struct ivas_LS_setupconversion_matrix_fx { Word16 index; Word32 value; + } LS_CONVERSION_MATRIX_FX; typedef struct ivas_LS_setupconversion_mapping_fx @@ -1477,7 +1482,9 @@ typedef struct ivas_LS_setupconversion_mapping_fx AUDIO_CONFIG input_config; AUDIO_CONFIG output_config; const LS_CONVERSION_MATRIX_FX *conversion_matrix_fx; + } LS_CONVERSION_MAPPING_FX; + typedef struct ivas_mono_downmix_renderer_struct { Word32 inputEnergy_fx; @@ -1491,6 +1498,7 @@ typedef struct ivas_mono_downmix_renderer_struct /*----------------------------------------------------------------------------------* * Custom Loudspeaker configuration structure *----------------------------------------------------------------------------------*/ + typedef struct ivas_LS_setup_custom { Word16 is_planar_setup; /* flag to indicate if setup is planar or not */ @@ -1502,8 +1510,8 @@ typedef struct ivas_LS_setup_custom Word16 separate_ch_found; /* flag to indicate if a center channel was found */ Word16 separate_ch_gains_fx[MAX_OUTPUT_CHANNELS]; /* gains to pan McMASA separateChannel in case no center channel is present */ -} LSSETUP_CUSTOM_STRUCT, *LSSETUP_CUSTOM_HANDLE; +} LSSETUP_CUSTOM_STRUCT, *LSSETUP_CUSTOM_HANDLE; /* Channel types in a channel-based config */ typedef enum @@ -1514,6 +1522,7 @@ typedef enum } ChannelType; + /*----------------------------------------------------------------------------------* * MASA external renderer structure *----------------------------------------------------------------------------------*/ @@ -1536,6 +1545,7 @@ typedef struct ivas_masa_external_rendering_struct HANDLE_CLDFB_FILTER_BANK cldfbSynRend[MAX_OUTPUT_CHANNELS]; } MASA_EXT_REND_DATA, *MASA_EXT_REND_HANDLE; + /*----------------------------------------------------------------------------------* * Multichannel MASA (McMASA) analysis structure *----------------------------------------------------------------------------------*/ @@ -1582,7 +1592,6 @@ typedef struct ivas_mcmasa_ana_data_structure Word16 numHorizontalChannels; UWord8 isHorizontalSetup; - MASA_DECODER_EXT_OUT_META_HANDLE hMasaOut; SPHERICAL_GRID_DATA *sph_grid16; @@ -1591,6 +1600,7 @@ typedef struct ivas_mcmasa_ana_data_structure } MCMASA_ANA_DATA, *MCMASA_ANA_HANDLE; + /*----------------------------------------------------------------------------------* * Object MASA (OMASA) analysis structure *----------------------------------------------------------------------------------*/ @@ -1604,15 +1614,12 @@ typedef struct ivas_omasa_ana_data_structure HANDLE_CLDFB_FILTER_BANK cldfbAnaEnc[MAX_NUM_OBJECTS]; /* DirAC parameter estimation */ - - Word16 band_grouping[MASA_FREQUENCY_BANDS + 1]; Word16 block_grouping[5]; /* diffuseness */ Word16 index_buffer_intensity; - MASA_DECODER_EXT_OUT_META_HANDLE hMasaOut; SPHERICAL_GRID_DATA *sph_grid16; @@ -1632,12 +1639,13 @@ typedef struct ivas_omasa_ana_data_structure Word16 buffer_energy_q[DIRAC_NO_COL_AVG_DIFF]; Word32 chnlToFoaMtx_fx[FOA_CHANNELS][MCMASA_MAX_ANA_CHANS]; // Q15 - } OMASA_ANA_DATA, *OMASA_ANA_HANDLE; + /*----------------------------------------------------------------------------------* * DirAC analysis structure *----------------------------------------------------------------------------------*/ + typedef struct ivas_dirac_ana_data_structure { Word16 nbands; @@ -1665,6 +1673,8 @@ typedef struct ivas_dirac_ana_data_structure Word16 energy_e[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; } DIRAC_ANA_DATA, *DIRAC_ANA_HANDLE; + + /*----------------------------------------------------------------------------------* * MASA prerend structure *----------------------------------------------------------------------------------*/ diff --git a/lib_rend/ivas_vbap_fx.c b/lib_rend/ivas_vbap_fx.c index 6ebaf3b4d64446661e7308da02c4e7ecb77b05ca..ec24a33628bdabc5d80a5e854501304680790682 100644 --- a/lib_rend/ivas_vbap_fx.c +++ b/lib_rend/ivas_vbap_fx.c @@ -1229,8 +1229,9 @@ static void matrix_inverse_3x3_32_fx( Word32 determinant_fx; /* Q28 */ Word32 cross_vec_fx[3]; /* Q29 */ Word16 exp_inverse_matrix_fx[3][3]; + vbap_crossp_fx( input_matrix_fx[1], input_matrix_fx[2], cross_vec_fx ); - determinant_fx = dotp_fixed( input_matrix_fx[0], cross_vec_fx, 3 ); + determinant_fx = dotp_fx32( input_matrix_fx[0], cross_vec_fx, 3 ); Word16 inv_mat_exp = 0; move16(); @@ -1526,19 +1527,20 @@ static Word16 determine_virtual_surface_triplets_fx( /* All triplets should be stored now. Sort them for search use and then determine the initial search indices for * each search sector for this search struct. */ - v_sort_ind_fixed( triplet_azidegs_fx, triplet_order, num_triplets ); + v_sort_ind_fx( triplet_azidegs_fx, triplet_order, num_triplets ); reorder_triplets_fx( triplets, triplet_order, num_triplets ); determine_initial_search_indices_fx( num_triplets, triplet_azidegs_fx, initial_search_indices ); return num_triplets; } + + /*-------------------------------------------------------------------------* * determine_initial_search_indices() * * Determine initial search indices used for fast search of correct triangle *-------------------------------------------------------------------------*/ - static void determine_initial_search_indices_fx( const Word16 num_triplets, /* i : number of triplets */ const Word32 triplet_azidegs_fx[VBAP_MAX_NUM_TRIPLETS], /* i : azimuths of triplets (in degrees) Q19 */ @@ -1595,6 +1597,7 @@ static void determine_initial_search_indices_fx( return; } + /*-------------------------------------------------------------------------* * determine_connections() * @@ -1664,6 +1667,8 @@ static ivas_error determine_connections_fx( return IVAS_ERR_OK; } + + /*-------------------------------------------------------------------------* * determine_connection_class() * @@ -1680,7 +1685,6 @@ static enum ConnectionClass determine_connection_class_fx( ) { Word16 ch, k; - const Word32 *p1_fx, *v2_fx; Word32 v1v1_fx, v1v2_fx, v2v2_fx, v1p1_fx, v2p1_fx; /* Q25, Q27, Q29, Q27, Q29 */ Word32 determinant_fx; /* Q23 */ @@ -1694,7 +1698,7 @@ static enum ConnectionClass determine_connection_class_fx( /* Check if connection passes through origin. This is not desired. * When this happens, unit vectors point in opposite directions. */ - uvecdot_fx = L_add( L_shl( dotp_fixed( node_data[chA].unit_vec_fx, node_data[chB].unit_vec_fx, 3 ), 1 ), ONE_IN_Q30 ); // Q30 - adding one guard bit + uvecdot_fx = L_add( L_shl( dotp_fx32( node_data[chA].unit_vec_fx, node_data[chB].unit_vec_fx, 3 ), 1 ), ONE_IN_Q30 ); // Q30 - adding one guard bit test(); IF( LT_32( uvecdot_fx, VBAP_EPSILON_Q3O ) && GT_32( uvecdot_fx, L_negate( VBAP_EPSILON_Q3O ) ) ) @@ -1729,16 +1733,16 @@ static enum ConnectionClass determine_connection_class_fx( v2_fx = node_data[ch].unit_vec_fx; // Q30 move32(); - v1v1_fx = dotp_fixed( v1_fx, v1_fx, 3 ); // Q25 + v1v1_fx = dotp_fx32( v1_fx, v1_fx, 3 ); // Q25 move32(); - v1v2_fx = dotp_fixed( v1_fx, v2_fx, 3 ); // Q27 + v1v2_fx = dotp_fx32( v1_fx, v2_fx, 3 ); // Q27 move32(); v2v2_fx = ONE_IN_Q29; move32(); - v1p1_fx = dotp_fixed( v1_fx, p1_fx, 3 ); // Q27 + v1p1_fx = dotp_fx32( v1_fx, p1_fx, 3 ); // Q27 move32(); - v2p1_fx = dotp_fixed( v2_fx, p1_fx, 3 ); // Q29 + v2p1_fx = dotp_fx32( v2_fx, p1_fx, 3 ); // Q29 move32(); Word32 tmp1 = Mpy_32_32( v1v2_fx, v1v2_fx ); // Q23 @@ -1826,7 +1830,7 @@ static enum ConnectionClass determine_connection_class_fx( vec_diff_fx[i] = L_shr( vec_diff_fx[i], 2 ); move32(); } - Word32 res = dotp_fixed( vTarget_fx, v2_fx, 3 ); // 31 - (max_vTarget_e + 2) + 30 - 31 = 28 - max_vTarget_e + Word32 res = dotp_fx32( vTarget_fx, v2_fx, 3 ); // 31 - (max_vTarget_e + 2) + 30 - 31 = 28 - max_vTarget_e move32(); IF( GT_32( res, L_shr( 2147054208 /* 0.9998f in Q31 */, sub( 31, sub( 28, max_vTarget_e ) ) ) ) ) @@ -1837,7 +1841,7 @@ static enum ConnectionClass determine_connection_class_fx( /* A special case, mainly accounting for ELEVATED L,R,C speaker nodes. A triplet between these nodes is not desired if there is a top node, a penalty is implemented to take care of this. */ - Word32 vec_diff_dotp = dotp_fixed( vec_diff_fx, vec_diff_fx, 3 ); // exp : 2 * max_vec_diff_e + 4 + Word32 vec_diff_dotp = dotp_fx32( vec_diff_fx, vec_diff_fx, 3 ); // exp : 2 * max_vec_diff_e + 4 move32(); Word32 var = Mpy_32_32( vec_diff_dotp, 51200 /*25.0f in Q11*/ ); // exp : 2 * max_vec_diff_e + 4 + 20 Word16 Flag1 = BASOP_Util_Cmp_Mant32Exp( v1v1_fx, Q31 - Q25, var, add( shl( max_vec_diff_e, 1 ), 4 + 20 ) ); @@ -2035,8 +2039,8 @@ static ivas_error get_half_sphere_connection_options_fx( c_options[index].chB = chB; move16(); - unit_vec_dotp = dotp_fixed( speaker_node_data[chA].unit_vec_fx, speaker_node_data[chB].unit_vec_fx, 3 ); // Q29 - unit_vec_dotp_sq = Mpy_32_32( unit_vec_dotp, unit_vec_dotp ); // Q27 + unit_vec_dotp = dotp_fx32( speaker_node_data[chA].unit_vec_fx, speaker_node_data[chB].unit_vec_fx, 3 ); // Q29 + unit_vec_dotp_sq = Mpy_32_32( unit_vec_dotp, unit_vec_dotp ); // Q27 one_minus_unit_vec_dotp_sq = L_sub( ONE_IN_Q27, unit_vec_dotp_sq ); Word16 exp_uv = Q31 - Q27; move16(); @@ -2069,9 +2073,11 @@ static ivas_error get_half_sphere_connection_options_fx( } } } + /* Number of found connection options at the half sphere */ *num_connection_options = index; move16(); + /* Init memory for reordered connection options and order by arc_weighted, * which informs of the preference order of the connections in case they cross */ IF( ( c_options_reorder = (ConnectionOption *) malloc( sizeof( ConnectionOption ) * ( *num_connection_options ) ) ) == NULL ) @@ -2124,11 +2130,13 @@ static ivas_error get_half_sphere_connection_options_fx( return IVAS_ERR_OK; } + /*-------------------------------------------------------------------------* * formulate_half_sphere_connections() * * Formulate half-sphere connections *-------------------------------------------------------------------------*/ + static ivas_error formulate_half_sphere_connections_fx( const VBAP_SPEAKER_NODE *speaker_node_data, /* i : speaker node data */ const Word16 num_speaker_nodes, /* i : number of speaker nodes */ @@ -2253,8 +2261,8 @@ static ivas_error formulate_half_sphere_connections_fx( /* If the plane intersection is between both connections, then the two connections cross. */ /* Study first if the crossing is between arc chA-chB */ - var1 = dotp_fixed( planeCrossingVec_fx, speaker_node_data[chA].unit_vec_fx, 3 ); // Q24 = 26 - tmp_exp - var2 = dotp_fixed( planeCrossingVec_fx, speaker_node_data[chB].unit_vec_fx, 3 ); // Q24 = 26 - tmp_exp + var1 = dotp_fx32( planeCrossingVec_fx, speaker_node_data[chA].unit_vec_fx, 3 ); // Q24 = 26 - tmp_exp + var2 = dotp_fx32( planeCrossingVec_fx, speaker_node_data[chB].unit_vec_fx, 3 ); // Q24 = 26 - tmp_exp var1_sq = Mpy_32_32( var1, var1 ); //(2 * (Q_planeCrossingVec - Q1) ) - Q31 var2_sq = Mpy_32_32( var2, var2 ); @@ -2318,9 +2326,9 @@ static ivas_error formulate_half_sphere_connections_fx( /* Study if the crossing is also between arc cmp_chA-cmp_chB */ IF( within_first_arc > 0 ) { - var1 = dotp_fixed( planeCrossingVec_fx, speaker_node_data[cmp_chA].unit_vec_fx, 3 ); + var1 = dotp_fx32( planeCrossingVec_fx, speaker_node_data[cmp_chA].unit_vec_fx, 3 ); move32(); - var2 = dotp_fixed( planeCrossingVec_fx, speaker_node_data[cmp_chB].unit_vec_fx, 3 ); + var2 = dotp_fx32( planeCrossingVec_fx, speaker_node_data[cmp_chB].unit_vec_fx, 3 ); move32(); // final_exp_A, final_exp_B, exp_var1_sq, exp_var2_sq; diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 1f46ca932d417270d2b8a2c80c03061291959156..c47d35a332042c45e0cfe901d72cf689d7a60ac6 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -429,7 +429,7 @@ void IVAS_REND_cldfbSynthesis_wrapper( Word32 **realBuffer, /* i : real values */ Word32 **imagBuffer, /* i : imag values */ Word32 *timeOut, /* o : output time domain samples */ - const int16_t samplesToProcess, /* i : number of processed samples */ + const Word16 samplesToProcess, /* i : number of processed samples */ IVAS_CLDFB_FILTER_BANK_HANDLE h_cldfb, /* i : filter bank state */ Word16 Q_cldfb, Word16 *Q_out diff --git a/lib_rend/lib_rend_fx.c b/lib_rend/lib_rend_fx.c index e0508e5d4a9f757ef641a2673cfb23e4d2c15271..10c646ce26026b1486ec6a102ebc80ce1e5ecd21 100644 --- a/lib_rend/lib_rend_fx.c +++ b/lib_rend/lib_rend_fx.c @@ -62,15 +62,11 @@ * Local types *-------------------------------------------------------------------*/ -typedef float pan_vector[MAX_OUTPUT_CHANNELS]; -typedef float pan_matrix[MAX_INPUT_CHANNELS][MAX_OUTPUT_CHANNELS]; -typedef float rotation_gains[MAX_INPUT_CHANNELS][MAX_INPUT_CHANNELS]; typedef Word32 pan_vector_fx[MAX_OUTPUT_CHANNELS]; typedef Word32 pan_matrix_fx[MAX_INPUT_CHANNELS][MAX_OUTPUT_CHANNELS]; typedef Word16 rotation_gains_fx[MAX_INPUT_CHANNELS][MAX_INPUT_CHANNELS]; typedef Word32 rotation_gains_Word32[MAX_INPUT_CHANNELS][MAX_INPUT_CHANNELS]; typedef Word32 rotation_matrix_fx[3][3]; -typedef float rotation_matrix[3][3]; /* EFAP wrapper to simplify writing panning gains to a vector that includes LFE channels */ typedef struct @@ -122,7 +118,6 @@ typedef struct rotation_matrix_fx rot_mat_prev; pan_vector_fx prev_pan_gains_fx; rotation_matrix_fx rot_mat_prev_fx; - pan_vector prev_pan_gains; Word8 firstFrameRendered; TDREND_WRAPPER splitTdRendWrappers[MAX_HEAD_ROT_POSES - 1]; /* Additional TD Rend instances used for split rendering */ Word32 *bufferData_fx; @@ -140,13 +135,9 @@ typedef struct { Word16 numLfeChannels; bool pan_lfe; - // float lfeInputGain; Word32 lfeInputGain_fx; /* Q31 */ - // float lfeOutputAzimuth; Word16 lfeOutputAzimuth_fx; - // float lfeOutputElevation; Word16 lfeOutputElevation_fx; - // IVAS_REND_LfePanMtx lfePanMtx; IVAS_REND_LfePanMtx_fx lfePanMtx_fx; /* Q31 */ } lfe_routing; @@ -177,7 +168,6 @@ typedef struct typedef struct { input_base base; - // pan_matrix hoaDecMtx; pan_matrix_fx hoaDecMtx_fx; CLDFB_REND_WRAPPER cldfbRendWrapper; CREND_WRAPPER_HANDLE crendWrapper; @@ -1010,6 +1000,8 @@ static ivas_error getMcConfigValues_fx( return IVAS_ERR_OK; } + + static ivas_error initEfap( EFAP_WRAPPER *pEfapWrapper, AUDIO_CONFIG outConfig, @@ -2104,7 +2096,7 @@ static ivas_error updateLfePanGainsForMcOut( } /* linear input gain */ - v_multc_fixed( inputMc->lfeRouting.lfePanMtx_fx[i], inputMc->lfeRouting.lfeInputGain_fx, inputMc->lfeRouting.lfePanMtx_fx[i], numOutChannels ); /* Q31 */ + v_multc_fx( inputMc->lfeRouting.lfePanMtx_fx[i], inputMc->lfeRouting.lfeInputGain_fx, inputMc->lfeRouting.lfePanMtx_fx[i], numOutChannels ); /* Q31 */ } return error; @@ -2138,7 +2130,7 @@ static ivas_error updateLfePanGainsForAmbiOut( ivas_dirac_dec_get_response_fx( inputMc->lfeRouting.lfeOutputAzimuth_fx, inputMc->lfeRouting.lfeOutputElevation_fx, inputMc->lfeRouting.lfePanMtx_fx[i], outAmbiOrder, Q29 ); /* linear input gain */ - v_multc_fixed( inputMc->lfeRouting.lfePanMtx_fx[i], inputMc->lfeRouting.lfeInputGain_fx, inputMc->lfeRouting.lfePanMtx_fx[i], IVAS_MAX_OUTPUT_CHANNELS ); /* Q31 */ + v_multc_fx( inputMc->lfeRouting.lfePanMtx_fx[i], inputMc->lfeRouting.lfeInputGain_fx, inputMc->lfeRouting.lfePanMtx_fx[i], IVAS_MAX_OUTPUT_CHANNELS ); /* Q31 */ } return error; @@ -3311,7 +3303,7 @@ ivas_error IVAS_REND_Open( hIvasRend->hExternalOrientationData = NULL; IF( Opt_ExternalOrientation ) { - IF( NE_32( ( error = ivas_external_orientation_open( &( hIvasRend->hExternalOrientationData ), num_subframes ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_external_orientation_open_fx( &( hIvasRend->hExternalOrientationData ), num_subframes ) ), IVAS_ERR_OK ) ) { return error; } @@ -3321,7 +3313,7 @@ ivas_error IVAS_REND_Open( hIvasRend->hCombinedOrientationData = NULL; IF( Opt_Headrotation || Opt_ExternalOrientation ) { - IF( NE_32( ( error = ivas_combined_orientation_open( &( hIvasRend->hCombinedOrientationData ), outputSampleRate, num_subframes ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_combined_orientation_open_fx( &( hIvasRend->hCombinedOrientationData ), outputSampleRate, num_subframes ) ), IVAS_ERR_OK ) ) { return error; } @@ -3338,7 +3330,7 @@ ivas_error IVAS_REND_Open( test(); IF( EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { - if ( ( hIvasRend->splitRendWrapper = (SPLIT_REND_WRAPPER *) malloc( sizeof( SPLIT_REND_WRAPPER ) ) ) == NULL ) + IF( ( hIvasRend->splitRendWrapper = (SPLIT_REND_WRAPPER *) malloc( sizeof( SPLIT_REND_WRAPPER ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for IVAS renderer handle" ); } @@ -3935,7 +3927,7 @@ static ivas_error ivas_pre_rend_init( move16(); move32(); - IF( ( pSplitRendEncBuffer->data_fx = malloc( bufConfig.numChannels * bufConfig.numSamplesPerChannel * sizeof( float ) ) ) == NULL ) + IF( ( pSplitRendEncBuffer->data_fx = malloc( bufConfig.numChannels * bufConfig.numSamplesPerChannel * sizeof( Word32 ) ) ) == NULL ) { return IVAS_ERR_FAILED_ALLOC; } @@ -4124,6 +4116,7 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( } #ifdef NONBE_1377_REND_DIRATT_CONF + /*-------------------------------------------------------------------* * IVAS_REND_SetObjectIDs() * @@ -4134,21 +4127,22 @@ ivas_error IVAS_REND_SetObjectIDs( IVAS_REND_HANDLE hIvasRend /* i/o: Renderer handle */ ) { - int16_t i; + Word16 i; /* Validate function arguments */ - if ( hIvasRend == NULL ) + IF( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; i++ ) + FOR( i = 0; i < RENDERER_MAX_ISM_INPUTS; i++ ) { hIvasRend->inputsIsm[i].object_id = i; } return IVAS_ERR_OK; } + #endif /*-------------------------------------------------------------------* @@ -4156,6 +4150,7 @@ ivas_error IVAS_REND_SetObjectIDs( * * *-------------------------------------------------------------------*/ + ivas_error IVAS_REND_SetInputGain_fx( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_REND_InputId inputId, /* i : ID of the input */ @@ -4182,11 +4177,13 @@ ivas_error IVAS_REND_SetInputGain_fx( return IVAS_ERR_OK; } + /*-------------------------------------------------------------------* * IVAS_REND_SetInputLfeMtx() * * *-------------------------------------------------------------------*/ + ivas_error IVAS_REND_SetInputLfeMtx_fx( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_REND_InputId inputId, /* i : ID of the input */ @@ -4230,6 +4227,7 @@ ivas_error IVAS_REND_SetInputLfeMtx_fx( return IVAS_ERR_OK; } + /*-------------------------------------------------------------------* * IVAS_REND_SetInputLfePos() * @@ -4283,11 +4281,13 @@ ivas_error IVAS_REND_SetInputLfePos_fx( return IVAS_ERR_OK; } + /*-------------------------------------------------------------------* * IVAS_REND_RemoveInput() * * *-------------------------------------------------------------------*/ + /* ToDo; unused function */ ivas_error IVAS_REND_RemoveInput( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ @@ -4335,6 +4335,7 @@ ivas_error IVAS_REND_RemoveInput( * * *-------------------------------------------------------------------*/ + ivas_error IVAS_REND_GetInputNumChannels( IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ const IVAS_REND_InputId inputId, /* i : ID of the input */ @@ -4364,11 +4365,13 @@ ivas_error IVAS_REND_GetInputNumChannels( return IVAS_ERR_OK; } + /*-------------------------------------------------------------------* * IVAS_REND_GetNumAllObjects() * * *-------------------------------------------------------------------*/ + ivas_error IVAS_REND_GetNumAllObjects( IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ Word16 *numChannels /* o : number of all objects */ @@ -4600,6 +4603,7 @@ ivas_error IVAS_REND_FeedInputAudio_fx( { return error; } + test(); test(); IF( ( EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_MASA1 ) || EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_MASA2 ) ) && EQ_32( inputBase->inConfig, IVAS_AUDIO_CONFIG_OBA ) ) @@ -4670,6 +4674,7 @@ ivas_error IVAS_REND_FeedInputObjectMetadata( * * *-------------------------------------------------------------------*/ + ivas_error IVAS_REND_FeedInputObjectMetadataToOMasa( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const Word16 inputIndex, /* i : Index of the input */ @@ -4870,6 +4875,7 @@ Word16 IVAS_REND_FeedRenderConfig( { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } + hRenderConfig = hIvasRend->hRendererConfig; hRenderConfig->roomAcoustics.nBands = renderConfig.roomAcoustics.nBands; @@ -4902,21 +4908,24 @@ Word16 IVAS_REND_FeedRenderConfig( /* Re-initialize reverb instance if already available */ /* ISM inputs */ - for ( i = 0, pIsmInput = hIvasRend->inputsIsm; i < RENDERER_MAX_ISM_INPUTS; ++i, ++pIsmInput ) + FOR( ( i = 0, pIsmInput = hIvasRend->inputsIsm ); i < RENDERER_MAX_ISM_INPUTS; ( ++i, ++pIsmInput ) ) { IF( EQ_32( pIsmInput->base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) { /* Skip inactive inputs */ continue; } - if ( pIsmInput->hReverb != NULL ) + + IF( pIsmInput->hReverb != NULL ) { IF( NE_32( ( error = ivas_reverb_open_fx( &pIsmInput->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ) ), IVAS_ERR_OK ) ) { return error; } } - if ( pIsmInput->crendWrapper != NULL && pIsmInput->crendWrapper->hCrend[0] != NULL ) + + test(); + IF( pIsmInput->crendWrapper != NULL && pIsmInput->crendWrapper->hCrend[0] != NULL ) { IF( NE_32( ( error = ivas_reverb_open_fx( &pIsmInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ) ), IVAS_ERR_OK ) ) { @@ -4926,7 +4935,7 @@ Word16 IVAS_REND_FeedRenderConfig( } /* MASA inputs */ - for ( i = 0, pMasaInput = hIvasRend->inputsMasa; i < RENDERER_MAX_MASA_INPUTS; ++i, ++pMasaInput ) + FOR( ( i = 0, pMasaInput = hIvasRend->inputsMasa ); i < RENDERER_MAX_MASA_INPUTS; ( ++i, ++pMasaInput ) ) { IF( EQ_32( pMasaInput->base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) { @@ -4934,19 +4943,23 @@ Word16 IVAS_REND_FeedRenderConfig( continue; } - if ( pMasaInput->hMasaExtRend != NULL ) + IF( pMasaInput->hMasaExtRend != NULL ) { - if ( pMasaInput->hMasaExtRend->hDiracDecBin[0] != NULL && pMasaInput->hMasaExtRend->hDiracDecBin[0]->hReverb != NULL ) + test(); + IF( pMasaInput->hMasaExtRend->hDiracDecBin[0] != NULL && pMasaInput->hMasaExtRend->hDiracDecBin[0]->hReverb != NULL ) { ivas_binaural_reverb_close_fx( &pMasaInput->hMasaExtRend->hDiracDecBin[0]->hReverb ); + IF( NE_32( ( error = ivas_binaural_reverb_init_fx( &pMasaInput->hMasaExtRend->hDiracDecBin[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, pMasaInput->hMasaExtRend->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), *pMasaInput->base.ctx.pOutSampleRate, NULL, NULL, NULL ) ), IVAS_ERR_OK ) ) { return error; } } - if ( pMasaInput->hMasaExtRend->hReverb != NULL ) + + IF( pMasaInput->hMasaExtRend->hReverb != NULL ) { ivas_binaural_reverb_close_fx( &pMasaInput->hMasaExtRend->hReverb ); + IF( NE_32( ( error = ivas_binaural_reverb_init_fx( &pMasaInput->hMasaExtRend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, pMasaInput->hMasaExtRend->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), *pMasaInput->base.ctx.pOutSampleRate, NULL, NULL, NULL ) ), IVAS_ERR_OK ) ) { return error; @@ -4956,7 +4969,7 @@ Word16 IVAS_REND_FeedRenderConfig( } /* Multi-channel inputs */ - for ( i = 0, pMcInput = hIvasRend->inputsMc; i < RENDERER_MAX_MC_INPUTS; ++i, ++pMcInput ) + FOR( ( i = 0, pMcInput = hIvasRend->inputsMc ); i < RENDERER_MAX_MC_INPUTS; ( ++i, ++pMcInput ) ) { IF( EQ_32( pMcInput->base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) { @@ -4964,14 +4977,17 @@ Word16 IVAS_REND_FeedRenderConfig( continue; } - if ( pMcInput->hReverb != NULL ) + IF( pMcInput->hReverb != NULL ) { IF( NE_32( ( error = ivas_reverb_open_fx( &pMcInput->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pMcInput->base.ctx.pOutSampleRate ) ), IVAS_ERR_OK ) ) { return error; } } - if ( pMcInput->crendWrapper != NULL && pMcInput->crendWrapper->hCrend[0] && pMcInput->crendWrapper->hCrend[0]->hReverb != NULL ) + + test(); + test(); + IF( pMcInput->crendWrapper != NULL && pMcInput->crendWrapper->hCrend[0] && pMcInput->crendWrapper->hCrend[0]->hReverb != NULL ) { IF( NE_32( ( error = ivas_reverb_open_fx( &pMcInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pMcInput->base.ctx.pOutSampleRate ) ), IVAS_ERR_OK ) ) { @@ -4981,14 +4997,17 @@ Word16 IVAS_REND_FeedRenderConfig( } /* SBA inputs */ - for ( i = 0, pSbaInput = hIvasRend->inputsSba; i < RENDERER_MAX_SBA_INPUTS; ++i, ++pSbaInput ) + FOR( ( i = 0, pSbaInput = hIvasRend->inputsSba ); i < RENDERER_MAX_SBA_INPUTS; ( ++i, ++pSbaInput ) ) { IF( EQ_32( pSbaInput->base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) { /* Skip inactive inputs */ continue; } - if ( pSbaInput->crendWrapper != NULL && pSbaInput->crendWrapper->hCrend[0] != NULL && pSbaInput->crendWrapper->hCrend[0]->hReverb != NULL ) + + test(); + test(); + IF( pSbaInput->crendWrapper != NULL && pSbaInput->crendWrapper->hCrend[0] != NULL && pSbaInput->crendWrapper->hCrend[0]->hReverb != NULL ) { IF( NE_32( ( error = ivas_reverb_open_fx( &pSbaInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pSbaInput->base.ctx.pOutSampleRate ) ), IVAS_ERR_OK ) ) { @@ -5033,11 +5052,13 @@ Word16 IVAS_REND_FeedRenderConfig( return IVAS_ERR_OK; } + /*-------------------------------------------------------------------* * IVAS_REND_SetHeadRotation() * * *-------------------------------------------------------------------*/ + ivas_error IVAS_REND_SetHeadRotation( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_QUATERNION headRot, /* i : head orientations for next rendering call */ @@ -5136,11 +5157,13 @@ ivas_error IVAS_REND_SetHeadRotation( return IVAS_ERR_OK; } + /*-------------------------------------------------------------------* * IVAS_REND_DisableHeadRotation() * * *-------------------------------------------------------------------*/ + ivas_error IVAS_REND_DisableHeadRotation( IVAS_REND_HANDLE hIvasRend /* i/o: Renderer handle */ ) @@ -5205,7 +5228,7 @@ ivas_error IVAS_REND_SetOrientationTrackingMode( const IVAS_HEAD_ORIENT_TRK_T orientation_tracking /* i : Head orientation tracking type */ ) { - if ( hIvasRend->headRotData.headRotEnabled == 0 ) + IF( hIvasRend->headRotData.headRotEnabled == 0 ) { return IVAS_ERR_OK; } @@ -5655,9 +5678,8 @@ static ivas_error rotateFrameMc_fx( move16(); } - /* gains for current subframe rotation */ - rotateAziEle_fixed( (Word16) L_shr( ls_azimuth[ch_in_woLFE], 22 ), (Word16) L_shr( ls_elevation[ch_in_woLFE], 22 ), &azimuth_fx, &elevation_fx, Rmat_fx, is_planar_setup ); + rotateAziEle_fx32( (Word16) L_shr( ls_azimuth[ch_in_woLFE], 22 ), (Word16) L_shr( ls_elevation[ch_in_woLFE], 22 ), &azimuth_fx, &elevation_fx, Rmat_fx, is_planar_setup ); test(); test(); @@ -6564,7 +6586,7 @@ static ivas_error renderInputIsm( move32(); /* Apply input gain to new audio */ - v_multc_fixed( inAudio.data_fx, ismInput->base.gain_fx, inAudio.data_fx, imult1616( inAudio.config.numSamplesPerChannel, inAudio.config.numChannels ) ); + v_multc_fx( inAudio.data_fx, ismInput->base.gain_fx, inAudio.data_fx, imult1616( inAudio.config.numSamplesPerChannel, inAudio.config.numChannels ) ); *outAudio.pq_fact = sub( *outAudio.pq_fact, Q1 ); move16(); exp = *outAudio.pq_fact; @@ -6709,10 +6731,10 @@ static ivas_error renderLfeToBinaural_fx( assert( mcInput->binauralDelaySmp < frame_size ); /* Get delayed LFE signal from previous frame, apply gain and save in tmp buffer */ - v_multc_fixed( mcInput->lfeDelayBuffer_fx, gain_fx, tmpLfeBuffer, num_cpy_smpl_prev_frame ); /* Qx - 1 */ + v_multc_fx( mcInput->lfeDelayBuffer_fx, gain_fx, tmpLfeBuffer, num_cpy_smpl_prev_frame ); /* Qx - 1 */ /* Continue filling tmp buffer, now with LFE signal from current frame */ - v_multc_fixed( lfeInput, gain_fx, tmpLfeBuffer + num_cpy_smpl_prev_frame, num_cpy_smpl_cur_frame ); /* Qx - 1 */ + v_multc_fx( lfeInput, gain_fx, tmpLfeBuffer + num_cpy_smpl_prev_frame, num_cpy_smpl_cur_frame ); /* Qx - 1 */ /* Save remaining LFE samples of current frame for next frame */ MVR2R_WORD32( lfeInput + num_cpy_smpl_cur_frame, mcInput->lfeDelayBuffer_fx, num_cpy_smpl_prev_frame ); @@ -6745,7 +6767,7 @@ static ivas_error renderLfeToBinaural_fx( { writePtr = getSmplPtr_fx( outAudio, add( i_mult( pose_idx, BINAURAL_CHANNELS ), ear_idx ), 0 ); move32(); - v_add_fixed_no_hdrm( writePtr, tmpLfeBuffer, writePtr, frame_size ); /* Q(out_q) */ + v_add_fx_no_hdrm( writePtr, tmpLfeBuffer, writePtr, frame_size ); /* Q(out_q) */ } } @@ -7395,9 +7417,10 @@ static ivas_error renderInputMc( } mcInput->base.numNewSamplesPerChannel = 0; move32(); - v_multc_fixed( inAudio.data_fx, mcInput->base.gain_fx, inAudio.data_fx, inAudio.config.numSamplesPerChannel * inAudio.config.numChannels ); - *outAudio.pq_fact = sub( *outAudio.pq_fact, Q1 ); // reducing the Q by 1 compensating for the v_mult_fixed done + v_multc_fx( inAudio.data_fx, mcInput->base.gain_fx, inAudio.data_fx, inAudio.config.numSamplesPerChannel * inAudio.config.numChannels ); + *outAudio.pq_fact = sub( *outAudio.pq_fact, Q1 ); // reducing the Q by 1 compensating for the v_mult_fx done move16(); + /* set combined orientation subframe info to start info */ ivas_combined_orientation_set_to_start_index( *( mcInput->base.ctx.pCombinedOrientationData ) ); @@ -7957,7 +7980,7 @@ static ivas_error renderInputSba( *outAudio.pq_fact = outAudio.q_factor; move16(); /* Apply input gain to new audio */ - v_multc_fixed( inAudio.data_fx, sbaInput->base.gain_fx, inAudio.data_fx, i_mult( inAudio.config.numSamplesPerChannel, inAudio.config.numChannels ) ); + v_multc_fx( inAudio.data_fx, sbaInput->base.gain_fx, inAudio.data_fx, i_mult( inAudio.config.numSamplesPerChannel, inAudio.config.numChannels ) ); *outAudio.pq_fact = sub( *outAudio.pq_fact, 1 ); // to compensate for the qfactor reduction in gain multiplication. move16(); @@ -8205,7 +8228,7 @@ static void renderMasaToMasa( ELSE IF( EQ_16( masaInput->base.inputBuffer.config.numChannels, 2 ) && EQ_16( outAudio.config.numChannels, 1 ) ) { // v_add( tmpBuffer[0], tmpBuffer[1], tmpBuffer[0], masaInput->base.inputBuffer.config.numSamplesPerChannel ); - v_add_fixed_no_hdrm( tmpBuffer_fx[0], tmpBuffer_fx[1], tmpBuffer_fx[0], masaInput->base.inputBuffer.config.numSamplesPerChannel ); + v_add_fx_no_hdrm( tmpBuffer_fx[0], tmpBuffer_fx[1], tmpBuffer_fx[0], masaInput->base.inputBuffer.config.numSamplesPerChannel ); } /* Copy metadata */ @@ -8326,7 +8349,7 @@ static ivas_error renderInputMasa( *outAudio.pq_fact = outAudio.q_factor; move16(); /* Apply input gain to new audio */ - v_multc_fixed( inAudio.data_fx, masaInput->base.gain_fx, inAudio.data_fx, i_mult( inAudio.config.numSamplesPerChannel, inAudio.config.numChannels ) ); + v_multc_fx( inAudio.data_fx, masaInput->base.gain_fx, inAudio.data_fx, i_mult( inAudio.config.numSamplesPerChannel, inAudio.config.numChannels ) ); *outAudio.pq_fact = sub( *outAudio.pq_fact, 1 ); // to compensate for the qfactor reduction in gain multiplication. move16(); @@ -9288,7 +9311,8 @@ ivas_error IVAS_REND_GetHrtfTdHandle( IVAS_DEC_HRTF_TD_HANDLE **hHrtfTD /* o : TD rend. HRTF handle */ ) { - if ( hIvasRend == NULL || hIvasRend->hHrtfs.hHrtfTD == NULL ) + test(); + IF( hIvasRend == NULL || hIvasRend->hHrtfs.hHrtfTD == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } @@ -9333,7 +9357,8 @@ ivas_error IVAS_REND_GetHrtfFastConvHandle( IVAS_DEC_HRTF_FASTCONV_HANDLE **hHrtfFastConv /* o : FASTCONV HRTF handle */ ) { - if ( hIvasRend == NULL || hIvasRend->hHrtfs.hHrtfFastConv == NULL ) + test(); + IF( hIvasRend == NULL || hIvasRend->hHrtfs.hHrtfFastConv == NULL ) { return IVAS_ERR_WRONG_PARAMS; } @@ -9355,7 +9380,8 @@ ivas_error IVAS_REND_GetHrtfParamBinHandle( IVAS_DEC_HRTF_PARAMBIN_HANDLE **hHrtfParambin /* o : Parametric binauralizer HRTF handle */ ) { - if ( hIvasRend == NULL || hIvasRend->hHrtfs.hHrtfParambin == NULL ) + test(); + IF( hIvasRend == NULL || hIvasRend->hHrtfs.hHrtfParambin == NULL ) { return IVAS_ERR_WRONG_PARAMS; } @@ -9377,7 +9403,8 @@ ivas_error IVAS_REND_GetHrtfStatisticsHandle( IVAS_DEC_HRTF_STATISTICS_HANDLE **hHrtfStatistics /* o : HRTF statistics handle */ ) { - if ( hIvasRend == NULL || hIvasRend->hHrtfs.hHrtfStatistics == NULL ) + test(); + IF( hIvasRend == NULL || hIvasRend->hHrtfs.hHrtfStatistics == NULL ) { return IVAS_ERR_WRONG_PARAMS; } @@ -9850,13 +9877,13 @@ static ivas_error ivas_masa_ext_rend_parambin_init( num_poses = 1; move16(); - if ( inputMasa->base.ctx.pSplitRendWrapper != NULL ) + IF( inputMasa->base.ctx.pSplitRendWrapper != NULL ) { num_poses = inputMasa->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses; move16(); } - for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) + FOR( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { hDiracDecBin = inputMasa->hMasaExtRend->hDiracDecBin[pos_idx]; @@ -10041,7 +10068,7 @@ static ivas_error initMasaExtRenderer( move32(); hMasaExtRend->hDirACRend = NULL; hMasaExtRend->hSpatParamRendCom = NULL; - for ( i = 0; i < MAX_HEAD_ROT_POSES; i++ ) + FOR( i = 0; i < MAX_HEAD_ROT_POSES; i++ ) { hMasaExtRend->hDiracDecBin[i] = NULL; } @@ -10153,7 +10180,8 @@ static ivas_error initMasaExtRenderer( return error; } } - if ( NE_32( ( error = ivas_masa_ext_rend_parambin_init( inputMasa, hRendCfg, hrtfs->hHrtfStatistics ) ), IVAS_ERR_OK ) ) + + IF( NE_32( ( error = ivas_masa_ext_rend_parambin_init( inputMasa, hRendCfg, hrtfs->hHrtfStatistics ) ), IVAS_ERR_OK ) ) { return error; } @@ -10219,7 +10247,7 @@ static void freeMasaExtRenderer( ivas_spat_hSpatParamRendCom_close_fx( &hMasaExtRend->hSpatParamRendCom ); } - for ( i = 0; i < MAX_HEAD_ROT_POSES; i++ ) + FOR( i = 0; i < MAX_HEAD_ROT_POSES; i++ ) { if ( hMasaExtRend->hDiracDecBin[i] != NULL ) { @@ -10592,7 +10620,7 @@ ivas_error IVAS_REND_PrintConfig( IVAS_REND_HANDLE hIvasRend /* i : IVAS renderer handle */ ) { - if ( hIvasRend == NULL ) + IF( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; }