LCOV - code coverage report
Current view: top level - lib_enc - updt_tar_fx.c (source / functions) Hit Total Coverage
Test: Coverage on main enc/dec/rend @ 3b2f07138c61dcf997bbf4165d0882f794b2995f Lines: 19 19 100.0 %
Date: 2025-05-03 01:55:50 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /*====================================================================================
       2             :     EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
       3             :   ====================================================================================*/
       4             : #include <stdint.h>
       5             : #include "options.h" /* Compilation switches                   */
       6             : #include "cnst.h"
       7             : //#include "prot_fx.h"     /* Function prototypes                    */
       8             : #include "prot_fx.h"     /* Function prototypes                    */
       9             : #include "prot_fx_enc.h" /* Function prototypes                    */
      10             : 
      11             : /*----------------------------------------------------------------------------------*
      12             :  * procedure updt_tar:
      13             :  *
      14             :  * Update the target vector for codebook search.
      15             :  *----------------------------------------------------------------------------------*/
      16     1441305 : void updt_tar_fx(
      17             :     const Word16 *x,   /* i  : old target (for pitch search)    Qz  */
      18             :     Word16 *x2,        /* o  : new target (for codebook search)  Qz */
      19             :     const Word16 *y,   /* i  : filtered adaptive codebook vector Qz */
      20             :     const Word16 gain, /* i  : adaptive codebook gain        Q14 */
      21             :     const Word16 L     /* i  : subframe size                     */
      22             : )
      23             : {
      24             :     Word16 i;
      25             :     Word32 L_tmp;
      26             : #ifdef BASOP_NOGLOB_DECLARE_LOCAL
      27     1441305 :     Flag Overflow = 0;
      28     1441305 :     move32();
      29             : #endif
      30             : 
      31             : 
      32    96143065 :     FOR( i = 0; i < L; i++ )
      33             :     {
      34             :         /*x2[i] = x[i] - gain*y[i];*/
      35    94701760 :         L_tmp = L_mult( x[i], 16384 ); /* (Qz*Q14) -> (Qz+15) */
      36    94701760 :         L_tmp = L_msu_sat( L_tmp, y[i], gain );
      37    94701760 :         x2[i] = extract_h( L_shl_o( L_tmp, 1, &Overflow ) );
      38    94701760 :         move16();
      39             :     }
      40     1441305 :     return;
      41             : }
      42             : /*----------------------------------------------------------------------------------*
      43             :  * procedure updt_tar:
      44             :  *
      45             :  * Update the target vector for codebook search.
      46             :  *----------------------------------------------------------------------------------*/
      47      122250 : void updt_tar_HR_fx(
      48             :     const Word16 *x,   /* i  : old target (for pitch search)    Qz */
      49             :     Word16 *x2,        /* o  : new target (for codebook search) Qz */
      50             :     const Word16 *y,   /* i  : filtered adaptive codebook vector Qz      */
      51             :     const Word16 gain, /* i  : adaptive codebook gain  Q2              */
      52             :     const Word16 Qx,   /* i  : Scaling factor to adapt output to input */
      53             :     const Word16 L     /* i  : subframe size                           */
      54             : )
      55             : {
      56             :     Word16 i;
      57             :     Word32 L_tmp, L_tmp1;
      58             : #ifdef BASOP_NOGLOB_DECLARE_LOCAL
      59      122250 :     Flag Overflow = 0;
      60      122250 :     move32();
      61             : #endif
      62             : 
      63     7946250 :     FOR( i = 0; i < L; i++ )
      64             :     {
      65             :         /*x2[i] = x[i] - gain*y[i];*/
      66     7824000 :         L_tmp = L_mult( x[i], 32767 );                                        /* (Qz*Q15) = (Qz+16) */
      67     7824000 :         L_tmp1 = L_shl_o( L_mult_o( y[i], gain, &Overflow ), Qx, &Overflow ); /* ((Qz+2+1)<<Qx) = Qz+Qx+3*/
      68     7824000 :         L_tmp = L_sub_o( L_tmp, L_tmp1, &Overflow );
      69     7824000 :         x2[i] = extract_h( L_tmp ); /*(Qz + 16)-16 = Qz*/
      70     7824000 :         move16();
      71             :     }
      72      122250 :     return;
      73             : }

Generated by: LCOV version 1.14