Line data Source code
1 : /******************************************************************************************************
2 :
3 : (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
4 : Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
5 : Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
6 : Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
7 : contributors to this repository. All Rights Reserved.
8 :
9 : This software is protected by copyright law and by international treaties.
10 : The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
11 : Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
12 : Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
13 : Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
14 : contributors to this repository retain full ownership rights in their respective contributions in
15 : the software. This notice grants no license of any kind, including but not limited to patent
16 : license, nor is any license granted by implication, estoppel or otherwise.
17 :
18 : Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
19 : contributions.
20 :
21 : This software is provided "AS IS", without any express or implied warranties. The software is in the
22 : development stage. It is intended exclusively for experts who have experience with such software and
23 : solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
24 : and fitness for a particular purpose are hereby disclaimed and excluded.
25 :
26 : Any dispute, controversy or claim arising under or in relation to providing this software shall be
27 : submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
28 : accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
29 : the United Nations Convention on Contracts on the International Sales of Goods.
30 :
31 : *******************************************************************************************************/
32 :
33 : /*====================================================================================
34 : EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
35 : ====================================================================================*/
36 :
37 : #include <stdint.h>
38 : #include "options.h"
39 : #include "prot_fx.h"
40 : #include "wmc_auto.h"
41 : #include "rom_com.h"
42 : #include "prot_fx_enc.h"
43 :
44 :
45 524971357 : Word32 Interpol_lc_fx( /* o : interpolated value Q15 */
46 : const Word16 *x, /* i : input vector Q0 */
47 : const Word16 *win, /* i : interpolation window Q14 */
48 : const Word16 frac, /* i : fraction (0..up_samp) Q0 */
49 : const Word16 up_samp, /* i : upsampling factor Q0 */
50 : const Word16 nb_coef /* i : number of coefficients Q0 */
51 : )
52 : {
53 : Word16 i;
54 : const Word16 *c1, *c2, *x2;
55 : Word32 L_sum;
56 :
57 524971357 : x2 = &x[1];
58 524971357 : c1 = &win[frac];
59 524971357 : c2 = &win[sub( up_samp, frac )];
60 : {
61 524971357 : Word64 L_sum64 = 0;
62 524971357 : move64();
63 22023447157 : FOR( i = 0; i < nb_coef; i++ )
64 : {
65 : /* Using L_mac0 limits the risk of saturation during the loop, saturation may occures after the loop */
66 21498475800 : L_sum64 = W_mac0_16_16( L_sum64, *x, *c1 ); /*Q14*/
67 21498475800 : --x;
68 21498475800 : L_sum64 = W_mac0_16_16( L_sum64, *x2, *c2 ); /*Q14*/
69 21498475800 : ++x2;
70 21498475800 : c2 += up_samp; /* move16() not needed, since the coefficient can be rearrange in bit exact way */
71 21498475800 : c1 += up_samp;
72 : }
73 524971357 : L_sum = W_sat_l( L_sum64 ); /*Q14*/
74 : }
75 524971357 : L_sum = L_shl_sat( L_sum, 1 ); /*Q15*/
76 524971357 : return L_sum;
77 : }
78 :
79 :
80 12119497 : Word16 Interpol_4( /* Qx o : interpolated value */
81 : Word16 *x, /* Qx i : input vector */
82 : Word16 frac /* Q0 i : fraction (-4..+3) */
83 : )
84 : {
85 : Word16 i;
86 : Word32 L_sum;
87 : #ifdef BASOP_NOGLOB_DECLARE_LOCAL
88 12119497 : Flag Overflow = 0;
89 : #endif
90 :
91 12119497 : x = x - L_INTERPOL1 + 1;
92 :
93 12119497 : L_sum = L_mult( x[0], ( inter4_1_fx + UP_SAMP - 1 )[-frac] ); /*Qx+14+1*/
94 96955976 : FOR( i = 1; i < 2 * L_INTERPOL1; i++ )
95 : {
96 : /*
97 : * Here, additions with UP_SAMP are not counted
98 : * because, the window could easily be modified
99 : * so that the values needed are contiguous.
100 : */
101 84836479 : frac -= UP_SAMP;
102 84836479 : L_sum = L_mac( L_sum, x[i], ( inter4_1_fx + UP_SAMP - 1 )[-frac] ); /*Qx+14+1*/
103 : }
104 : BASOP_SATURATE_WARNING_OFF_EVS
105 : /* Here, saturation might occur by intention */
106 12119497 : L_sum = L_shl_o( L_sum, 1, &Overflow ); /*Qx+14+2*/
107 : BASOP_SATURATE_WARNING_ON_EVS
108 12119497 : return round_fx_o( L_sum, &Overflow ); /*Qx*/
109 : }
|