Loading Workspace_msvc/lib_dec.vcxproj +1 −0 Original line number Diff line number Diff line Loading @@ -315,6 +315,7 @@ <ClCompile Include="..\lib_dec\ivas_output_config.c" /> <ClCompile Include="..\lib_dec\ivas_out_setup_conversion.c" /> <ClCompile Include="..\lib_dec\ivas_pca_dec.c" /> <ClCompile Include="..\lib_dec\ivas_pca_dec_fx.c" /> <ClCompile Include="..\lib_dec\ivas_post_proc.c" /> <ClCompile Include="..\lib_dec\ivas_range_uni_dec.c" /> <ClCompile Include="..\lib_dec\ivas_qmetadata_dec.c" /> Loading Workspace_msvc/lib_dec.vcxproj.filters +1 −0 Original line number Diff line number Diff line Loading @@ -285,6 +285,7 @@ <ClCompile Include="..\lib_dec\ivas_sns_dec.c" /> <ClCompile Include="..\lib_dec\waveadjust_fec_dec_fx.c" /> <ClCompile Include="..\lib_dec\acelp_core_dec_ivas_fx.c" /> <ClCompile Include="..\lib_dec\ivas_pca_dec_fx.c" /> </ItemGroup> <ItemGroup> <ClInclude Include="..\lib_dec\ivas_rom_dec.h" /> Loading lib_com/ivas_pca_tools.c +382 −3 Original line number Diff line number Diff line Loading @@ -39,7 +39,9 @@ #include "ivas_rom_com.h" #include "wmc_auto.h" #include "prot.h" #ifdef IVAS_FLOAT_FIXED #include "prot_fx1.h" #endif /*---------------------------------------------------------------------* * eye_matrix() Loading @@ -65,7 +67,28 @@ void eye_matrix( return; } #ifdef IVAS_FLOAT_FIXED void eye_matrix_fx( Word16 *mat, const Word16 n, const Word16 d) { Word16 i; FOR(i = 0; i < n * n; i++) { mat[i] = 0; move16(); } FOR(i = 0; i < n; i++) { mat[i * n + i] = d; move16(); } return; } #endif /*---------------------------------------------------------------------* * cov() * Loading Loading @@ -537,7 +560,63 @@ void dquat2mat( return; } #ifdef IVAS_FLOAT_FIXED void dquat2mat_fx( const Word16 *ql, const Word16 *qr, Word16 *m ) { Word16 a, b, c, d; Word16 w, x, y, z; Word16 aw, ax, ay, az; Word16 bw, bx, by, bz; Word16 cw, cx, cy, cz; Word16 dw, dx, dy, dz; a = ql[0];move16(); b = ql[1];move16(); c = ql[2];move16(); d = ql[3];move16(); w = qr[0];move16(); x = qr[1];move16(); y = qr[2];move16(); z = qr[3];move16(); aw = mult( a, w ); // Ql + Qr - 15 ax = mult( a, x ); ay = mult( a, y ); az = mult( a, z ); bw = mult( b, w ); bx = mult( b, x ); by = mult( b, y ); bz = mult( b, z ); cw = mult( c, w ); cx = mult( c, x ); cy = mult( c, y ); cz = mult( c, z ); dw = mult( d, w ); dx = mult( d, x ); dy = mult( d, y ); dz = mult( d, z ); m[0] = sub( sub( aw, bx ), add( cy, dz ) ); m[1] = sub( sub( cz, dy ), add( ax, bw ) ); m[2] = add( sub( sub( -ay, bz ), cw ), dx ); m[3] = sub( sub( by, az ), add( cx, dw ) ); m[4] = add( sub( add( bw, ax ), dy ), cz ); m[5] = add( add( add( -bx, aw ), dz ), cy ); m[6] = sub( sub( add( -by, az ), dw ), cx ); m[7] = add( sub( sub( -bz, ay ), dx ), cw ); m[8] = sub( add( add( cw, dx ), ay ), bz ); m[9] = sub( sub( add( -cx, dw ), az ), by ); m[10] = add( add( add( -cy, dz ), aw ), bx ); m[11] = sub( add( sub( -cz, dy ), ax ), bw ); m[12] = add( add( sub( dw, cx ), by ), az ); m[13] = add( sub( sub( -dx, cw ), bz ), ay ); m[14] = sub( add( sub( -dy, cz ), bw ), ax ); m[15] = add( add( add( -dz, cy ), bx ), aw ); return; } #endif /*---------------------------------------------------------------------* * quat_shortestpath() * Loading Loading @@ -594,7 +673,63 @@ void quat_shortestpath( return; } #ifdef IVAS_FLOAT_FIXED // Not tested void quat_shortestpath_fx( const Word16 *q00, Word16 *q01, const Word16 *q10, Word16 *q11) { Word32 d0, d1; Word16 res, i; Word16 exp1 = 0, exp2 = 0; d0 = dotp_fx(q00, q01, IVAS_PCA_INTERP, &exp1); d1 = dotp_fx(q10, q11, IVAS_PCA_INTERP, &exp2); res = 0; move16(); IF(LT_32(d0, 0) && LT_32(d1, 0)) { res = 1; move16(); } ELSE { IF(LT_32(d0, 0)) { IF(GT_32((-d0), d1)) { res = 1; move16(); } } ELSE { IF(LT_32(d1, 0)) { IF(GT_32((-d1), d0)) { res = 1; move16(); } } } } IF(res) { FOR(i = 0; i < IVAS_PCA_INTERP; i++) { q01[i] = -q01[i];move16(); q11[i] = -q11[i];move16(); } } return; } #endif /*---------------------------------------------------------------------* * mat_det4() * Loading Loading @@ -652,6 +787,24 @@ static void norm_quat( return; } #ifdef IVAS_FLOAT_FIXED static void norm_quat_fx( Word16 *q) { Word32 norm_q; Word16 i, exp1 = 0, exp; norm_q = dotp_fx(q, q, IVAS_PCA_INTERP, &exp1); exp1 = (31 - (exp1 + 2)); norm_q = ISqrt32(norm_q, &exp1); /*q(15 - exp)*/ FOR(i = 0; i < IVAS_PCA_INTERP; i++) { q[i] = mult(q[i], (Word16)L_shr(norm_q, 15)); // todo : recheck } return; } #endif static void quat_nlerp_preproc( const float *q0, Loading @@ -671,6 +824,30 @@ static void quat_nlerp_preproc( return; } #ifdef IVAS_FLOAT_FIXED static void quat_nlerp_preproc_fx( const Word16 *q0, const Word16 *q1, const Word16 alpha, Word16 *q_slerp) { Word16 i; Word16 tmp1, tmp2; FOR(i = 0; i < IVAS_PCA_INTERP; i++) { tmp1 = mult((MAX_16 - alpha), q1[i]); tmp2 = mult_r(alpha, q0[i]); IF((alpha == q0[i]) && (alpha == 32767)) tmp2 = 32767; q_slerp[i] = add(tmp1, tmp2); } norm_quat_fx(q_slerp); return; } #endif void pca_interp_preproc( const float *prev_ql, Loading @@ -695,7 +872,39 @@ void pca_interp_preproc( return; } #ifdef IVAS_FLOAT_FIXED void pca_interp_preproc_fx( const Word16 *prev_ql, const Word16 *prev_qr, const Word16 *ql, const Word16 *qr, const Word16 len, Word16 *ql_interp, Word16 *qr_interp) { Word16 alpha; Word16 j; Word16 tmp, tmp2, tmp3; FOR(j = 0; j < len; j++) { tmp = sub(len, 1); IF(EQ_16(j, 0)) { alpha = 0; move16(); } ELSE alpha = idiv1616(j, tmp); // the increment can be updated by simple delta //q15 tmp2 = mult(EVS_PI_FX, alpha); // q13 tmp3 = getCosWord16(tmp2); // q14 alpha = shr(sub(ONE_IN_Q14, tmp3), 1); // q15 alpha = sub(MAX_16, alpha); quat_nlerp_preproc_fx(prev_ql, ql, alpha, &ql_interp[j * IVAS_PCA_INTERP]); quat_nlerp_preproc_fx(prev_qr, qr, alpha, &qr_interp[j * IVAS_PCA_INTERP]); } return; } #endif static float acos_clip( float v ) Loading Loading @@ -728,7 +937,25 @@ static void sp2cart( return; } #ifdef IVAS_FLOAT_FIXED static void sp2cart_fx( const Word16 ph1, const Word16 ph2, const Word16 ph3, Word16 *q ) { Word16 s1, s2, s1s2; s1 = getSinWord16( ph1 ); // q15 s2 = getSinWord16( ph2 ); // q15 s1s2 = mult( s1, s2 ); // q15 q[3] = mult( getSinWord16( ph3 ), s1s2 ); // q15 q[2] = mult( getCosWord16( ph3 ), s1s2 ); // q15 q[1] = mult( getCosWord16( ph2 ), s1 ); // q15 q[0] = getCosWord16( ph1 ); // q14 return; } #endif static int16_t calc_n2( const float ph1 ) { Loading @@ -743,7 +970,22 @@ static int16_t calc_n2( return n2; } #ifdef IVAS_FLOAT_FIXED static Word16 calc_n2_fx( const Word16 ph1 ) { Word16 n2; Word16 temp = mult( 23040, getSinWord16( ph1 ) ); // q8 n2 = round_fx( temp ); IF( EQ_16( s_and( n2, 1 ), 0 ) ) { n2 = add( n2, ONE_IN_Q8 ); } return n2; } #endif static int16_t calc_n3( const float ph1, Loading @@ -767,7 +1009,32 @@ static int16_t calc_n3( return n3; } #ifdef IVAS_FLOAT_FIXED static Word16 calc_n3_fx( const Word16 ph1, const Word16 ph2 ) { Word16 n3; Word16 temp1 = mult( 23040, getSinWord16( ph1 ) ); // q7 + q15 - q15 n3 = round_fx( mult( temp1, getSinWord16( ph2 ) ) ); // q7 + q15 - q15 IF( EQ_16( n3, 0 ) ) { n3 = ONE_IN_Q7; move16(); } ELSE { IF( ( s_and( n3, 1 ) ) == 1 ) { n3 = add( n3, ONE_IN_Q7 ); } } return n3; } #endif static void q_ang_2surv( const float a, Loading Loading @@ -923,7 +1190,25 @@ static int16_t get_pca_offset_n2( return index2; } #ifdef IVAS_FLOAT_FIXED static Word16 get_pca_offset_n2_fx( const Word16 index1 ) { Word16 index2; IF( LE_16(index1, IVAS_PCA_N1_EQ )) { index2 = ivas_pca_offset_n2[index1]; move16(); } ELSE { index2 = ivas_pca_offset_n2[IVAS_PCA_N1 - 1 - index1]; move16(); } return index2; } #endif /*---------------------------------------------------------------------* * pca_enc_s3() Loading Loading @@ -1116,3 +1401,97 @@ void pca_dec_s3( return; } #ifdef IVAS_FLOAT_FIXED // Not tested void pca_dec_s3_fx( const Word32 index, Word16 *q_fx ) { Word16 ph1_q_fx, ph2_q_fx, ph3_q_fx; Word32 j; Word16 i; Word16 n1, n2, n3; Word16 index1, index2, index3; Word16 d_fx; j = index; move16(); index1 = -1; move16(); FOR( i = 0; i < IVAS_PCA_N1; i++ ) { IF( j < ivas_pca_offset_index1[i + 1] ) { index1 = i; move16(); break; } } assert( index1 > -1 ); n1 = IVAS_PCA_N1; move16(); Word16 num_fx = 12868; d_fx = idiv1616( num_fx, n1 ); // Q12 ph1_q_fx = mult( index1, d_fx ); // Q12 n2 = calc_n2_fx( ph1_q_fx ); j = L_sub(j , ivas_pca_offset_index1[index1]); index2 = -1; move16(); FOR( i = 0; i < n2; i++ ) { IF( j < ivas_pca_offset_index2[i + get_pca_offset_n2_fx( index1 ) + 1] ) { index2 = i; move16(); break; } } assert( index2 > -1 ); IF( EQ_16(n2, 1) ) { ph2_q_fx = 0; move16(); } ELSE { num_fx = 12868; move16(); d_fx = idiv1616( num_fx, n1 ); // Q12 ph2_q_fx = mult( index2, d_fx ); // Q12 } j = L_sub(j, ivas_pca_offset_index2[index2 + get_pca_offset_n2_fx( index1 )]); index3 = (Word16) j; move16(); n3 = calc_n3_fx( ph1_q_fx, ph2_q_fx ); IF( EQ_16(n3, 1 )) { ph3_q_fx = 0; move16(); } ELSE { num_fx = 6434; move16(); d_fx = idiv1616( num_fx, n3 ); // Q11 ph3_q_fx = mult( index3, d_fx ); // Q11 } sp2cart_fx( ph1_q_fx, ph2_q_fx, ph3_q_fx, q_fx ); return; } #endif No newline at end of file lib_com/ivas_prot.h +60 −5 Original line number Diff line number Diff line Loading @@ -5065,9 +5065,15 @@ int16_t ivas_is_res_channel( void ivas_spar_dec_agc_pca( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ float *output[], /* i/o: input/output audio channels */ const int16_t output_frame /* i : output frame length */ const Word16 output_frame /* i : output frame length */ ); #ifdef IVAS_FLOAT_FIXED 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 */ ); #endif void ivas_spar_dec_set_render_map( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t nCldfbTs /* i : number of CLDFB time slots */ Loading Loading @@ -5511,14 +5517,39 @@ void ivas_pca_dec( const int16_t bfi, /* i : bad frame indicator */ float *pcm_out[] /* o : output audio channels */ ); #ifdef IVAS_FLOAT_FIXED 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 */ ); void ivas_pca_dec_init_fx( 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 */ ); #endif /* PCA utilities */ void eye_matrix( float *mat, const int16_t n, const float d ); #ifdef IVAS_FLOAT_FIXED void eye_matrix_fx( Word16 *mat, const Word16 n, const Word16 d ); #endif void cov_subfr( float **ptr_sig, float *r, Loading Loading @@ -5572,7 +5603,27 @@ void pca_interp_preproc( float *ql_interp, float *qr_interp ); #ifdef IVAS_FLOAT_FIXED void dquat2mat_fx( const Word16 *ql, const Word16 *qr, Word16 *m); void quat_shortestpath_fx( const Word16 *q00, Word16 *q01, const Word16 *q10, Word16 *q11); void pca_interp_preproc_fx( const Word16 *prev_ql, const Word16 *prev_qr, const Word16 *ql, const Word16 *qr, const Word16 len, Word16 *ql_interp, Word16 *qr_interp); #endif void pca_enc_s3( float *q, int32_t *index Loading @@ -5582,7 +5633,11 @@ void pca_dec_s3( const int32_t index, float *q ); #ifdef IVAS_FLOAT_FIXED void pca_dec_s3_fx( const Word32 index, Word16 *q); #endif int16_t ivas_get_bits_to_encode( int32_t val ); Loading lib_com/ivas_prot_fx.h +55 −1 Original line number Diff line number Diff line Loading @@ -155,6 +155,11 @@ ivas_error ivas_omasa_dec_config_fx( Word16 SrcInd[MAX_NUM_TDREND_CHANNELS], Word16 *data /* o : output synthesis signal */ ); ivas_error ivas_td_binaural_renderer_sf_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float *output[], /* i/o: SCE channels / Binaural synthesis */ const int16_t n_samples_granularity /* i : granularity of the renderer/buffer */ ); #endif void ivas_omasa_modify_masa_energy_ratios_fx( Loading Loading @@ -1901,10 +1906,59 @@ ivas_error ivas_qmetadata_allocate_memory( void ivas_qmetadata_close( IVAS_QMETADATA_HANDLE *hQMetaData /* i/o: q_metadata handle */ ); #endif 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 */ ); 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 */ ); 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 ); 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 */ ); 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_FX *headPosition_fx, /* i : Listener orientation */ const IVAS_VECTOR3_FX *Pos_fx /* i : Listener Position */ ); void QuatToRotMat_fx( const IVAS_QUATERNION_FX 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 */ ); 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 */ ); #endif // IVAS_FLOAT_FIXED #endif Loading
Workspace_msvc/lib_dec.vcxproj +1 −0 Original line number Diff line number Diff line Loading @@ -315,6 +315,7 @@ <ClCompile Include="..\lib_dec\ivas_output_config.c" /> <ClCompile Include="..\lib_dec\ivas_out_setup_conversion.c" /> <ClCompile Include="..\lib_dec\ivas_pca_dec.c" /> <ClCompile Include="..\lib_dec\ivas_pca_dec_fx.c" /> <ClCompile Include="..\lib_dec\ivas_post_proc.c" /> <ClCompile Include="..\lib_dec\ivas_range_uni_dec.c" /> <ClCompile Include="..\lib_dec\ivas_qmetadata_dec.c" /> Loading
Workspace_msvc/lib_dec.vcxproj.filters +1 −0 Original line number Diff line number Diff line Loading @@ -285,6 +285,7 @@ <ClCompile Include="..\lib_dec\ivas_sns_dec.c" /> <ClCompile Include="..\lib_dec\waveadjust_fec_dec_fx.c" /> <ClCompile Include="..\lib_dec\acelp_core_dec_ivas_fx.c" /> <ClCompile Include="..\lib_dec\ivas_pca_dec_fx.c" /> </ItemGroup> <ItemGroup> <ClInclude Include="..\lib_dec\ivas_rom_dec.h" /> Loading
lib_com/ivas_pca_tools.c +382 −3 Original line number Diff line number Diff line Loading @@ -39,7 +39,9 @@ #include "ivas_rom_com.h" #include "wmc_auto.h" #include "prot.h" #ifdef IVAS_FLOAT_FIXED #include "prot_fx1.h" #endif /*---------------------------------------------------------------------* * eye_matrix() Loading @@ -65,7 +67,28 @@ void eye_matrix( return; } #ifdef IVAS_FLOAT_FIXED void eye_matrix_fx( Word16 *mat, const Word16 n, const Word16 d) { Word16 i; FOR(i = 0; i < n * n; i++) { mat[i] = 0; move16(); } FOR(i = 0; i < n; i++) { mat[i * n + i] = d; move16(); } return; } #endif /*---------------------------------------------------------------------* * cov() * Loading Loading @@ -537,7 +560,63 @@ void dquat2mat( return; } #ifdef IVAS_FLOAT_FIXED void dquat2mat_fx( const Word16 *ql, const Word16 *qr, Word16 *m ) { Word16 a, b, c, d; Word16 w, x, y, z; Word16 aw, ax, ay, az; Word16 bw, bx, by, bz; Word16 cw, cx, cy, cz; Word16 dw, dx, dy, dz; a = ql[0];move16(); b = ql[1];move16(); c = ql[2];move16(); d = ql[3];move16(); w = qr[0];move16(); x = qr[1];move16(); y = qr[2];move16(); z = qr[3];move16(); aw = mult( a, w ); // Ql + Qr - 15 ax = mult( a, x ); ay = mult( a, y ); az = mult( a, z ); bw = mult( b, w ); bx = mult( b, x ); by = mult( b, y ); bz = mult( b, z ); cw = mult( c, w ); cx = mult( c, x ); cy = mult( c, y ); cz = mult( c, z ); dw = mult( d, w ); dx = mult( d, x ); dy = mult( d, y ); dz = mult( d, z ); m[0] = sub( sub( aw, bx ), add( cy, dz ) ); m[1] = sub( sub( cz, dy ), add( ax, bw ) ); m[2] = add( sub( sub( -ay, bz ), cw ), dx ); m[3] = sub( sub( by, az ), add( cx, dw ) ); m[4] = add( sub( add( bw, ax ), dy ), cz ); m[5] = add( add( add( -bx, aw ), dz ), cy ); m[6] = sub( sub( add( -by, az ), dw ), cx ); m[7] = add( sub( sub( -bz, ay ), dx ), cw ); m[8] = sub( add( add( cw, dx ), ay ), bz ); m[9] = sub( sub( add( -cx, dw ), az ), by ); m[10] = add( add( add( -cy, dz ), aw ), bx ); m[11] = sub( add( sub( -cz, dy ), ax ), bw ); m[12] = add( add( sub( dw, cx ), by ), az ); m[13] = add( sub( sub( -dx, cw ), bz ), ay ); m[14] = sub( add( sub( -dy, cz ), bw ), ax ); m[15] = add( add( add( -dz, cy ), bx ), aw ); return; } #endif /*---------------------------------------------------------------------* * quat_shortestpath() * Loading Loading @@ -594,7 +673,63 @@ void quat_shortestpath( return; } #ifdef IVAS_FLOAT_FIXED // Not tested void quat_shortestpath_fx( const Word16 *q00, Word16 *q01, const Word16 *q10, Word16 *q11) { Word32 d0, d1; Word16 res, i; Word16 exp1 = 0, exp2 = 0; d0 = dotp_fx(q00, q01, IVAS_PCA_INTERP, &exp1); d1 = dotp_fx(q10, q11, IVAS_PCA_INTERP, &exp2); res = 0; move16(); IF(LT_32(d0, 0) && LT_32(d1, 0)) { res = 1; move16(); } ELSE { IF(LT_32(d0, 0)) { IF(GT_32((-d0), d1)) { res = 1; move16(); } } ELSE { IF(LT_32(d1, 0)) { IF(GT_32((-d1), d0)) { res = 1; move16(); } } } } IF(res) { FOR(i = 0; i < IVAS_PCA_INTERP; i++) { q01[i] = -q01[i];move16(); q11[i] = -q11[i];move16(); } } return; } #endif /*---------------------------------------------------------------------* * mat_det4() * Loading Loading @@ -652,6 +787,24 @@ static void norm_quat( return; } #ifdef IVAS_FLOAT_FIXED static void norm_quat_fx( Word16 *q) { Word32 norm_q; Word16 i, exp1 = 0, exp; norm_q = dotp_fx(q, q, IVAS_PCA_INTERP, &exp1); exp1 = (31 - (exp1 + 2)); norm_q = ISqrt32(norm_q, &exp1); /*q(15 - exp)*/ FOR(i = 0; i < IVAS_PCA_INTERP; i++) { q[i] = mult(q[i], (Word16)L_shr(norm_q, 15)); // todo : recheck } return; } #endif static void quat_nlerp_preproc( const float *q0, Loading @@ -671,6 +824,30 @@ static void quat_nlerp_preproc( return; } #ifdef IVAS_FLOAT_FIXED static void quat_nlerp_preproc_fx( const Word16 *q0, const Word16 *q1, const Word16 alpha, Word16 *q_slerp) { Word16 i; Word16 tmp1, tmp2; FOR(i = 0; i < IVAS_PCA_INTERP; i++) { tmp1 = mult((MAX_16 - alpha), q1[i]); tmp2 = mult_r(alpha, q0[i]); IF((alpha == q0[i]) && (alpha == 32767)) tmp2 = 32767; q_slerp[i] = add(tmp1, tmp2); } norm_quat_fx(q_slerp); return; } #endif void pca_interp_preproc( const float *prev_ql, Loading @@ -695,7 +872,39 @@ void pca_interp_preproc( return; } #ifdef IVAS_FLOAT_FIXED void pca_interp_preproc_fx( const Word16 *prev_ql, const Word16 *prev_qr, const Word16 *ql, const Word16 *qr, const Word16 len, Word16 *ql_interp, Word16 *qr_interp) { Word16 alpha; Word16 j; Word16 tmp, tmp2, tmp3; FOR(j = 0; j < len; j++) { tmp = sub(len, 1); IF(EQ_16(j, 0)) { alpha = 0; move16(); } ELSE alpha = idiv1616(j, tmp); // the increment can be updated by simple delta //q15 tmp2 = mult(EVS_PI_FX, alpha); // q13 tmp3 = getCosWord16(tmp2); // q14 alpha = shr(sub(ONE_IN_Q14, tmp3), 1); // q15 alpha = sub(MAX_16, alpha); quat_nlerp_preproc_fx(prev_ql, ql, alpha, &ql_interp[j * IVAS_PCA_INTERP]); quat_nlerp_preproc_fx(prev_qr, qr, alpha, &qr_interp[j * IVAS_PCA_INTERP]); } return; } #endif static float acos_clip( float v ) Loading Loading @@ -728,7 +937,25 @@ static void sp2cart( return; } #ifdef IVAS_FLOAT_FIXED static void sp2cart_fx( const Word16 ph1, const Word16 ph2, const Word16 ph3, Word16 *q ) { Word16 s1, s2, s1s2; s1 = getSinWord16( ph1 ); // q15 s2 = getSinWord16( ph2 ); // q15 s1s2 = mult( s1, s2 ); // q15 q[3] = mult( getSinWord16( ph3 ), s1s2 ); // q15 q[2] = mult( getCosWord16( ph3 ), s1s2 ); // q15 q[1] = mult( getCosWord16( ph2 ), s1 ); // q15 q[0] = getCosWord16( ph1 ); // q14 return; } #endif static int16_t calc_n2( const float ph1 ) { Loading @@ -743,7 +970,22 @@ static int16_t calc_n2( return n2; } #ifdef IVAS_FLOAT_FIXED static Word16 calc_n2_fx( const Word16 ph1 ) { Word16 n2; Word16 temp = mult( 23040, getSinWord16( ph1 ) ); // q8 n2 = round_fx( temp ); IF( EQ_16( s_and( n2, 1 ), 0 ) ) { n2 = add( n2, ONE_IN_Q8 ); } return n2; } #endif static int16_t calc_n3( const float ph1, Loading @@ -767,7 +1009,32 @@ static int16_t calc_n3( return n3; } #ifdef IVAS_FLOAT_FIXED static Word16 calc_n3_fx( const Word16 ph1, const Word16 ph2 ) { Word16 n3; Word16 temp1 = mult( 23040, getSinWord16( ph1 ) ); // q7 + q15 - q15 n3 = round_fx( mult( temp1, getSinWord16( ph2 ) ) ); // q7 + q15 - q15 IF( EQ_16( n3, 0 ) ) { n3 = ONE_IN_Q7; move16(); } ELSE { IF( ( s_and( n3, 1 ) ) == 1 ) { n3 = add( n3, ONE_IN_Q7 ); } } return n3; } #endif static void q_ang_2surv( const float a, Loading Loading @@ -923,7 +1190,25 @@ static int16_t get_pca_offset_n2( return index2; } #ifdef IVAS_FLOAT_FIXED static Word16 get_pca_offset_n2_fx( const Word16 index1 ) { Word16 index2; IF( LE_16(index1, IVAS_PCA_N1_EQ )) { index2 = ivas_pca_offset_n2[index1]; move16(); } ELSE { index2 = ivas_pca_offset_n2[IVAS_PCA_N1 - 1 - index1]; move16(); } return index2; } #endif /*---------------------------------------------------------------------* * pca_enc_s3() Loading Loading @@ -1116,3 +1401,97 @@ void pca_dec_s3( return; } #ifdef IVAS_FLOAT_FIXED // Not tested void pca_dec_s3_fx( const Word32 index, Word16 *q_fx ) { Word16 ph1_q_fx, ph2_q_fx, ph3_q_fx; Word32 j; Word16 i; Word16 n1, n2, n3; Word16 index1, index2, index3; Word16 d_fx; j = index; move16(); index1 = -1; move16(); FOR( i = 0; i < IVAS_PCA_N1; i++ ) { IF( j < ivas_pca_offset_index1[i + 1] ) { index1 = i; move16(); break; } } assert( index1 > -1 ); n1 = IVAS_PCA_N1; move16(); Word16 num_fx = 12868; d_fx = idiv1616( num_fx, n1 ); // Q12 ph1_q_fx = mult( index1, d_fx ); // Q12 n2 = calc_n2_fx( ph1_q_fx ); j = L_sub(j , ivas_pca_offset_index1[index1]); index2 = -1; move16(); FOR( i = 0; i < n2; i++ ) { IF( j < ivas_pca_offset_index2[i + get_pca_offset_n2_fx( index1 ) + 1] ) { index2 = i; move16(); break; } } assert( index2 > -1 ); IF( EQ_16(n2, 1) ) { ph2_q_fx = 0; move16(); } ELSE { num_fx = 12868; move16(); d_fx = idiv1616( num_fx, n1 ); // Q12 ph2_q_fx = mult( index2, d_fx ); // Q12 } j = L_sub(j, ivas_pca_offset_index2[index2 + get_pca_offset_n2_fx( index1 )]); index3 = (Word16) j; move16(); n3 = calc_n3_fx( ph1_q_fx, ph2_q_fx ); IF( EQ_16(n3, 1 )) { ph3_q_fx = 0; move16(); } ELSE { num_fx = 6434; move16(); d_fx = idiv1616( num_fx, n3 ); // Q11 ph3_q_fx = mult( index3, d_fx ); // Q11 } sp2cart_fx( ph1_q_fx, ph2_q_fx, ph3_q_fx, q_fx ); return; } #endif No newline at end of file
lib_com/ivas_prot.h +60 −5 Original line number Diff line number Diff line Loading @@ -5065,9 +5065,15 @@ int16_t ivas_is_res_channel( void ivas_spar_dec_agc_pca( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ float *output[], /* i/o: input/output audio channels */ const int16_t output_frame /* i : output frame length */ const Word16 output_frame /* i : output frame length */ ); #ifdef IVAS_FLOAT_FIXED 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 */ ); #endif void ivas_spar_dec_set_render_map( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t nCldfbTs /* i : number of CLDFB time slots */ Loading Loading @@ -5511,14 +5517,39 @@ void ivas_pca_dec( const int16_t bfi, /* i : bad frame indicator */ float *pcm_out[] /* o : output audio channels */ ); #ifdef IVAS_FLOAT_FIXED 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 */ ); void ivas_pca_dec_init_fx( 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 */ ); #endif /* PCA utilities */ void eye_matrix( float *mat, const int16_t n, const float d ); #ifdef IVAS_FLOAT_FIXED void eye_matrix_fx( Word16 *mat, const Word16 n, const Word16 d ); #endif void cov_subfr( float **ptr_sig, float *r, Loading Loading @@ -5572,7 +5603,27 @@ void pca_interp_preproc( float *ql_interp, float *qr_interp ); #ifdef IVAS_FLOAT_FIXED void dquat2mat_fx( const Word16 *ql, const Word16 *qr, Word16 *m); void quat_shortestpath_fx( const Word16 *q00, Word16 *q01, const Word16 *q10, Word16 *q11); void pca_interp_preproc_fx( const Word16 *prev_ql, const Word16 *prev_qr, const Word16 *ql, const Word16 *qr, const Word16 len, Word16 *ql_interp, Word16 *qr_interp); #endif void pca_enc_s3( float *q, int32_t *index Loading @@ -5582,7 +5633,11 @@ void pca_dec_s3( const int32_t index, float *q ); #ifdef IVAS_FLOAT_FIXED void pca_dec_s3_fx( const Word32 index, Word16 *q); #endif int16_t ivas_get_bits_to_encode( int32_t val ); Loading
lib_com/ivas_prot_fx.h +55 −1 Original line number Diff line number Diff line Loading @@ -155,6 +155,11 @@ ivas_error ivas_omasa_dec_config_fx( Word16 SrcInd[MAX_NUM_TDREND_CHANNELS], Word16 *data /* o : output synthesis signal */ ); ivas_error ivas_td_binaural_renderer_sf_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float *output[], /* i/o: SCE channels / Binaural synthesis */ const int16_t n_samples_granularity /* i : granularity of the renderer/buffer */ ); #endif void ivas_omasa_modify_masa_energy_ratios_fx( Loading Loading @@ -1901,10 +1906,59 @@ ivas_error ivas_qmetadata_allocate_memory( void ivas_qmetadata_close( IVAS_QMETADATA_HANDLE *hQMetaData /* i/o: q_metadata handle */ ); #endif 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 */ ); 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 */ ); 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 ); 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 */ ); 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_FX *headPosition_fx, /* i : Listener orientation */ const IVAS_VECTOR3_FX *Pos_fx /* i : Listener Position */ ); void QuatToRotMat_fx( const IVAS_QUATERNION_FX 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 */ ); 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 */ ); #endif // IVAS_FLOAT_FIXED #endif