LCOV - code coverage report
Current view: top level - lib_enc - cod4t64.c (source / functions) Hit Total Coverage
Test: Coverage on main @ 6baab0c613aa6c7100498ed7b93676aa8198a493 Lines: 440 443 99.3 %
Date: 2025-05-28 04:28:20 Functions: 14 14 100.0 %

          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             : #ifdef DEBUGGING
      40             : #include "debug.h"
      41             : #endif
      42             : #include <math.h>
      43             : #include "cnst.h"
      44             : #include "rom_enc.h"
      45             : #include "prot.h"
      46             : #include "rom_com.h"
      47             : #include "wmc_auto.h"
      48             : 
      49             : /*---------------------------------------------------------------------*
      50             :  * Local function prototypes
      51             :  *---------------------------------------------------------------------*/
      52             : 
      53             : static int16_t quant_1p_N1( const int16_t pos, const int16_t N );
      54             : static int16_t quant_3p_3N1( const int16_t pos1, const int16_t pos2, const int16_t pos3, const int16_t N );
      55             : static int32_t quant_4p_4N( const int16_t pos[], const int16_t N );
      56             : static int32_t quant_5p_5N( const int16_t pos[], const int16_t N );
      57             : static int32_t quant_6p_6N_2( const int16_t pos[], const int16_t N );
      58             : static int16_t pre_process( const float v[], int16_t pos_vector[], int16_t pos_vector_num[], int16_t *pulse_pos_num );
      59             : static int32_t fcb_encode_position( const int16_t pos_vector[], int16_t n, const int16_t pos_num, const int16_t flag );
      60             : static int32_t fcb_encode_class( const int16_t buffer[], const int16_t pulse_num, const int16_t pos_num );
      61             : static int32_t fcb_encode_PI( const float v[], const int16_t pulse_num );
      62             : 
      63             : 
      64             : /*---------------------------------------------------------------------*
      65             :  * ACELP_4t64()
      66             :  *
      67             :  * 20, 36, 44, 52, 64, 72, 88 bits algebraic codebook.
      68             :  * 4 tracks x 16 positions per track = 64 samples.
      69             :  *
      70             :  * 20 bits --> 4 pulses in a frame of 64 samples.
      71             :  * 36 bits --> 8 pulses in a frame of 64 samples.
      72             :  * 44 bits 13 + 9 + 13 + 9 --> 10 pulses in a frame of 64 samples.
      73             :  * 52 bits 13 + 13 + 13 + 13 --> 12 pulses in a frame of 64 samples.
      74             :  * 64 bits 2 + 2 + 2 + 2 + 14 + 14 + 14 + 14 -->
      75             :  *                               16 pulses in a frame of 64 samples.
      76             :  * 72 bits 10 + 2 + 10 + 2 + 10 + 14 + 10 + 14 -->
      77             :  *                               18 pulses in a frame of 64 samples.
      78             :  * 88 bits 11 + 11 + 11 + 11 + 11 + 11 + 11 + 11 -->
      79             :  *                               24 pulses in a frame of 64 samples.
      80             :  * All pulses can have two (2) possible amplitudes: +1 or -1.
      81             :  * Each pulse can have sixteen (16) possible positions.
      82             :  *---------------------------------------------------------------------*/
      83             : 
      84      623449 : int16_t acelp_4t64(
      85             :     BSTR_ENC_HANDLE hBstr,    /* i/o: encoder bitstream handle                      */
      86             :     float dn[],               /* i  : corr. between target and h[].                 */
      87             :     const float cn[],         /* i  : residual after long term prediction           */
      88             :     const float H[],          /* i  : impulse response of weighted synthesis filter */
      89             :     float R[],                /* i  : autocorrelation values                        */
      90             :     const int16_t acelpautoc, /* i  : autocorrealtion flag                          */
      91             :     float code[],             /* o  : algebraic (fixed) codebook excitation         */
      92             :     float y[],                /* o  : filtered fixed codebook excitation            */
      93             :     int16_t nbbits,           /* i  : number of bits per codebook                   */
      94             :     const int16_t cmpl_flag,  /* i  : coomplexity reduction flag                    */
      95             :     const int16_t Opt_AMR_WB  /* i  : flag indicating AMR-WB IO mode                */
      96             : )
      97             : {
      98             :     int16_t i, k, index, track;
      99             :     int32_t L_index;
     100             : 
     101             :     int16_t ind[NPMAXPT * NB_TRACK_FCB_4T + 32];
     102      623449 :     int16_t saved_bits = 0;
     103             :     PulseConfig config;
     104             :     int16_t wordcnt, bitcnt;
     105             :     int16_t indexing_indices[6];
     106             : 
     107             :     /*-----------------------------------------------------------------*
     108             :      * Configuration
     109             :      *-----------------------------------------------------------------*/
     110             : 
     111             : 
     112      623449 :     switch ( nbbits )
     113             :     {
     114       12483 :         case 20:               /* EVS/AMR-WB pulse indexing: 20 bits, 4 pulses, 4 tracks  */
     115       12483 :             config.nbiter = 4; /* 4x12x16=768 loop                                        */
     116       12483 :             config.alp = 2.0f;
     117       12483 :             config.nb_pulse = 4;
     118       12483 :             config.fixedpulses = 0;
     119       12483 :             config.nbpos[0] = 4;
     120       12483 :             config.nbpos[1] = 8;
     121       12483 :             break;
     122             : 
     123       37475 :         case 28:               /* EVS pulse indexing: 28 bits, 6 pulses, 4 tracks     */
     124       37475 :             config.nbiter = 4; /* 4x20x16=1280 loops                                  */
     125       37475 :             config.alp = 1.0f; /* coeff for sign setting                              */
     126       37475 :             config.nb_pulse = 6;
     127       37475 :             config.fixedpulses = 0;
     128       37475 :             config.nbpos[0] = 6;
     129       37475 :             config.nbpos[1] = 6;
     130       37475 :             config.nbpos[2] = 8;
     131       37475 :             break;
     132             : 
     133      559270 :         case 36:               /* EVS/AMR-WB pulse indexing: 36 bits, 8 pulses, 4 tracks  */
     134      559270 :             config.nbiter = 4; /* 4x20x16=1280 loops                                      */
     135      559270 :             config.alp = 1.0f; /* coeff for sign setting                                  */
     136      559270 :             config.nb_pulse = 8;
     137      559270 :             config.fixedpulses = 2;
     138      559270 :             config.nbpos[0] = 4;
     139      559270 :             config.nbpos[1] = 8;
     140      559270 :             config.nbpos[2] = 8;
     141      559270 :             break;
     142             : 
     143        3059 :         case 43:               /* EVS pulse indexing:    43 bits, 10 pulses, 4 tracks */
     144             :         case 44:               /* AMR-WB pulse indexing: 44 bits, 10 pulses, 4 tracks */
     145        3059 :             config.nbiter = 4; /* 4x26x16=1664 loops                                  */
     146        3059 :             config.alp = 1.0f;
     147        3059 :             config.nb_pulse = 10;
     148        3059 :             config.fixedpulses = 2;
     149        3059 :             config.nbpos[0] = 4;
     150        3059 :             config.nbpos[1] = 6;
     151        3059 :             config.nbpos[2] = 8;
     152        3059 :             config.nbpos[3] = 8;
     153        3059 :             break;
     154             : 
     155         800 :         case 50:               /* EVS pulse indexing:    50 bits, 12 pulses, 4 tracks */
     156             :         case 52:               /* AMR-WB pulse indexing: 52 bits, 12 pulses, 4 tracks */
     157         800 :             config.nbiter = 4; /* 4x26x16=1664 loops                                  */
     158         800 :             config.alp = 1.0f;
     159         800 :             config.nb_pulse = 12;
     160         800 :             config.fixedpulses = 4;
     161         800 :             config.nbpos[0] = 4;
     162         800 :             config.nbpos[1] = 6;
     163         800 :             config.nbpos[2] = 8;
     164         800 :             config.nbpos[3] = 8;
     165         800 :             break;
     166             : 
     167        1045 :         case 62:               /* EVS pulse indexing:    62 bits, 16 pulses, 4 tracks */
     168             :         case 64:               /* AMR-WB pulse indexing: 64 bits, 16 pulses, 4 tracks */
     169        1045 :             config.nbiter = 3; /* 3x36x16=1728 loops                                  */
     170        1045 :             config.alp = 0.8F;
     171        1045 :             config.nb_pulse = 16;
     172        1045 :             config.fixedpulses = 4;
     173        1045 :             config.nbpos[0] = 4;
     174        1045 :             config.nbpos[1] = 4;
     175        1045 :             config.nbpos[2] = 6;
     176        1045 :             config.nbpos[3] = 6;
     177        1045 :             config.nbpos[4] = 8;
     178        1045 :             config.nbpos[5] = 8;
     179        1045 :             break;
     180             : 
     181        5304 :         case 72:               /* AMR-WB pulse indexing: 72 bits, 18 pulses, 4 tracks */
     182        5304 :             config.nbiter = 3; /* 3x35x16=1680 loops                                  */
     183        5304 :             config.alp = 0.75F;
     184        5304 :             config.nb_pulse = 18;
     185        5304 :             config.fixedpulses = 4;
     186        5304 :             config.nbpos[0] = 2;
     187        5304 :             config.nbpos[1] = 3;
     188        5304 :             config.nbpos[2] = 4;
     189        5304 :             config.nbpos[3] = 5;
     190        5304 :             config.nbpos[4] = 6;
     191        5304 :             config.nbpos[5] = 7;
     192        5304 :             config.nbpos[6] = 8;
     193        5304 :             break;
     194             : 
     195        4012 :         case 88:               /* AMR-WB pulse indexing: 88 bits, 24 pulses, 4 tracks */
     196        4012 :             config.nbiter = 2; /* 2x53x16=1696 loop                                   */
     197        4012 :             config.alp = 0.5f;
     198        4012 :             config.nb_pulse = 24;
     199        4012 :             config.fixedpulses = 4;
     200        4012 :             config.nbpos[0] = 2;
     201        4012 :             config.nbpos[1] = 2;
     202        4012 :             config.nbpos[2] = 3;
     203        4012 :             config.nbpos[3] = 4;
     204        4012 :             config.nbpos[4] = 5;
     205        4012 :             config.nbpos[5] = 6;
     206        4012 :             config.nbpos[6] = 7;
     207        4012 :             config.nbpos[7] = 8;
     208        4012 :             config.nbpos[8] = 8;
     209        4012 :             config.nbpos[9] = 8;
     210        4012 :             break;
     211             : 
     212           1 :         case 87: /* EVS pulse indexing:   87 bits, 26 pulses, 4 tracks  */
     213           1 :             config.nbiter = 1;
     214           1 :             config.alp = 0.5F;
     215           1 :             config.nb_pulse = 26;
     216           1 :             config.fixedpulses = 4;
     217           1 :             config.nbpos[0] = 4;
     218           1 :             config.nbpos[1] = 6;
     219           1 :             config.nbpos[2] = 6;
     220           1 :             config.nbpos[3] = 8;
     221           1 :             config.nbpos[4] = 8;
     222           1 :             config.nbpos[5] = 8;
     223           1 :             config.nbpos[6] = 8;
     224           1 :             config.nbpos[7] = 8;
     225           1 :             config.nbpos[8] = 8;
     226           1 :             config.nbpos[9] = 8;
     227           1 :             config.nbpos[10] = 8;
     228           1 :             break;
     229             :     }
     230             : 
     231             :     /* reduce the number of iterations as a compromise between the performance and complexity */
     232      623449 :     if ( cmpl_flag > 0 )
     233             :     {
     234      544173 :         config.nbiter = cmpl_flag;
     235             :     }
     236             : 
     237      623449 :     config.codetrackpos = TRACKPOS_FIXED_FIRST;
     238      623449 :     config.bits = nbbits;
     239             : 
     240             : 
     241             :     /*-----------------------------------------------------------------*
     242             :      * Search
     243             :      *-----------------------------------------------------------------*/
     244             : 
     245      623449 :     if ( acelpautoc )
     246             :     {
     247      541571 :         E_ACELP_4tsearchx( dn, cn, R, code, &config, ind );
     248             : 
     249             :         /* Generate weighted code */
     250      541571 :         set_f( y, 0.0f, L_SUBFR );
     251    35202115 :         for ( i = 0; i < L_SUBFR; i++ )
     252             :         {
     253             :             /* Code is sparse, so check which samples are non-zero */
     254    34660544 :             if ( code[i] != 0 )
     255             :             {
     256   137142604 :                 for ( k = 0; k < L_SUBFR - i; k++ )
     257             :                 {
     258   132911669 :                     y[i + k] += code[i] * H[k];
     259             :                 }
     260             :             }
     261             :         }
     262             :     }
     263             :     else
     264             :     {
     265       81878 :         E_ACELP_4tsearch( dn, cn, H, code, &config, ind, y );
     266             :     }
     267             : 
     268             :     /*-----------------------------------------------------------------*
     269             :      * Indexing
     270             :      *-----------------------------------------------------------------*/
     271             : 
     272      623449 :     if ( !Opt_AMR_WB )
     273             :     {
     274             :         /* EVS pulse indexing */
     275             : 
     276      607321 :         saved_bits = E_ACELP_indexing( code, config, NB_TRACK_FCB_4T, indexing_indices );
     277             : 
     278      607321 :         saved_bits = 0;
     279             : 
     280      607321 :         wordcnt = nbbits >> 4;
     281      607321 :         bitcnt = nbbits & 15;
     282     1773333 :         for ( i = 0; i < wordcnt; i++ )
     283             :         {
     284     1166012 :             push_indice( hBstr, IND_ALG_CDBK_4T64, indexing_indices[i], 16 );
     285             :         }
     286      607321 :         if ( bitcnt )
     287             :         {
     288      607321 :             push_indice( hBstr, IND_ALG_CDBK_4T64, indexing_indices[i], bitcnt );
     289             :         }
     290             :     }
     291             :     else
     292             :     {
     293             :         /* AMR-WB pulse indexing */
     294             : 
     295       16128 :         if ( nbbits == 20 )
     296             :         {
     297        5400 :             for ( track = 0; track < NB_TRACK_FCB_4T; track++ )
     298             :             {
     299        4320 :                 k = track * NPMAXPT;
     300        4320 :                 index = quant_1p_N1( ind[k], 4 );
     301        4320 :                 push_indice( hBstr, IND_ALG_CDBK_4T64, index, 5 );
     302             :             }
     303             :         }
     304       15048 :         else if ( nbbits == 36 )
     305             :         {
     306       15860 :             for ( track = 0; track < NB_TRACK_FCB_4T; track++ )
     307             :             {
     308       12688 :                 k = track * NPMAXPT;
     309       12688 :                 index = quant_2p_2N1( ind[k], ind[k + 1], 4 );
     310       12688 :                 push_indice( hBstr, IND_ALG_CDBK_4T64, index, 9 );
     311             :             }
     312             :         }
     313       11876 :         else if ( nbbits == 44 )
     314             :         {
     315        2880 :             for ( track = 0; track < ( NB_TRACK_FCB_4T - 2 ); track++ )
     316             :             {
     317        1920 :                 k = track * NPMAXPT;
     318        1920 :                 index = quant_3p_3N1( ind[k], ind[k + 1], ind[k + 2], 4 );
     319        1920 :                 push_indice( hBstr, IND_ALG_CDBK_4T64, index, 13 );
     320             :             }
     321             : 
     322        2880 :             for ( track = 2; track < NB_TRACK_FCB_4T; track++ )
     323             :             {
     324        1920 :                 k = track * NPMAXPT;
     325        1920 :                 index = quant_2p_2N1( ind[k], ind[k + 1], 4 );
     326        1920 :                 push_indice( hBstr, IND_ALG_CDBK_4T64, index, 9 );
     327             :             }
     328             :         }
     329       10916 :         else if ( nbbits == 52 )
     330             :         {
     331        4000 :             for ( track = 0; track < NB_TRACK_FCB_4T; track++ )
     332             :             {
     333        3200 :                 k = track * NPMAXPT;
     334        3200 :                 index = quant_3p_3N1( ind[k], ind[k + 1], ind[k + 2], 4 );
     335        3200 :                 push_indice( hBstr, IND_ALG_CDBK_4T64, index, 13 );
     336             :             }
     337             :         }
     338       10116 :         else if ( nbbits == 64 )
     339             :         {
     340        4000 :             for ( track = 0; track < NB_TRACK_FCB_4T; track++ )
     341             :             {
     342        3200 :                 k = track * NPMAXPT;
     343        3200 :                 L_index = quant_4p_4N( &ind[k], 4 );
     344        3200 :                 index = ( ( L_index >> 14 ) & 3 );
     345        3200 :                 push_indice( hBstr, IND_ALG_CDBK_4T64_1, index, 2 );
     346             :             }
     347             : 
     348        4000 :             for ( track = 0; track < NB_TRACK_FCB_4T; track++ )
     349             :             {
     350        3200 :                 k = track * NPMAXPT;
     351        3200 :                 L_index = quant_4p_4N( &ind[k], 4 );
     352        3200 :                 index = ( L_index & 0x3FFF );
     353        3200 :                 push_indice( hBstr, IND_ALG_CDBK_4T64_2, index, 14 );
     354             :             }
     355             :         }
     356        9316 :         else if ( nbbits == 72 )
     357             :         {
     358       15912 :             for ( track = 0; track < ( NB_TRACK_FCB_4T - 2 ); track++ )
     359             :             {
     360       10608 :                 k = track * NPMAXPT;
     361       10608 :                 L_index = quant_5p_5N( &ind[k], 4 );
     362       10608 :                 index = ( ( L_index >> 10 ) & 0x03FF );
     363       10608 :                 push_indice( hBstr, IND_ALG_CDBK_4T64_1, index, 10 );
     364             :             }
     365             : 
     366       15912 :             for ( track = 2; track < NB_TRACK_FCB_4T; track++ )
     367             :             {
     368       10608 :                 k = track * NPMAXPT;
     369       10608 :                 L_index = quant_4p_4N( &ind[k], 4 );
     370       10608 :                 index = ( ( L_index >> 14 ) & 3 );
     371       10608 :                 push_indice( hBstr, IND_ALG_CDBK_4T64_1, index, 2 );
     372             :             }
     373             : 
     374       15912 :             for ( track = 0; track < ( NB_TRACK_FCB_4T - 2 ); track++ )
     375             :             {
     376       10608 :                 k = track * NPMAXPT;
     377       10608 :                 L_index = quant_5p_5N( &ind[k], 4 );
     378       10608 :                 index = ( L_index & 0x03FF );
     379       10608 :                 push_indice( hBstr, IND_ALG_CDBK_4T64_2, index, 10 );
     380             :             }
     381             : 
     382       15912 :             for ( track = 2; track < NB_TRACK_FCB_4T; track++ )
     383             :             {
     384       10608 :                 k = track * NPMAXPT;
     385       10608 :                 L_index = quant_4p_4N( &ind[k], 4 );
     386       10608 :                 index = ( L_index & 0x3FFF );
     387       10608 :                 push_indice( hBstr, IND_ALG_CDBK_4T64_2, index, 14 );
     388             :             }
     389             :         }
     390        4012 :         else if ( nbbits == 88 )
     391             :         {
     392       20060 :             for ( track = 0; track < NB_TRACK_FCB_4T; track++ )
     393             :             {
     394       16048 :                 k = track * NPMAXPT;
     395       16048 :                 L_index = quant_6p_6N_2( &ind[k], 4 );
     396       16048 :                 index = ( ( L_index >> 11 ) & 0x07FF );
     397       16048 :                 push_indice( hBstr, IND_ALG_CDBK_4T64_1, index, 11 );
     398             :             }
     399             : 
     400       20060 :             for ( track = 0; track < NB_TRACK_FCB_4T; track++ )
     401             :             {
     402       16048 :                 k = track * NPMAXPT;
     403       16048 :                 L_index = quant_6p_6N_2( &ind[k], 4 );
     404       16048 :                 index = ( L_index & 0x07FF );
     405       16048 :                 push_indice( hBstr, IND_ALG_CDBK_4T64_2, index, 11 );
     406             :             }
     407             :         }
     408             :     }
     409             : 
     410      623449 :     return saved_bits;
     411             : }
     412             : 
     413             : 
     414             : /*---------------------------------------------------------------------*
     415             :  * Quantization of 1 pulse with N+1 bits:                              *
     416             :  *---------------------------------------------------------------------*/
     417             : 
     418             : /*! r: return N+1 bits */
     419      107688 : static int16_t quant_1p_N1(
     420             :     const int16_t pos, /* i  : position of the pulse       */
     421             :     const int16_t N    /* i  : number of bits for position */
     422             : )
     423             : {
     424             :     int16_t mask, index;
     425             : 
     426      107688 :     mask = ( ( 1 << N ) - 1 );
     427             : 
     428      107688 :     index = ( pos & mask );
     429             : 
     430      107688 :     if ( ( pos & NB_POS_FCB_4T ) != 0 )
     431             :     {
     432       53831 :         index += 1 << N;
     433             :     }
     434             : 
     435      107688 :     return index;
     436             : }
     437             : 
     438             : 
     439             : /*---------------------------------------------------------------------*
     440             :  * Quantization of 2 pulses with 2*N+1 bits:                           *
     441             :  *---------------------------------------------------------------------*/
     442             : 
     443             : /*! r: return (2*N)+1 bits */
     444      679561 : int16_t quant_2p_2N1(
     445             :     const int16_t pos1, /* i  : position of the pulse 1     */
     446             :     const int16_t pos2, /* i  : position of the pulse 2     */
     447             :     const int16_t N     /* i  : number of bits for position */
     448             : )
     449             : {
     450             :     int16_t mask, index;
     451             : 
     452      679561 :     mask = ( ( 1 << N ) - 1 );
     453             : 
     454             :     /*-----------------------------------------------------------------*
     455             :      * sign of 1st pulse == sign of 2nd pulse
     456             :      *-----------------------------------------------------------------*/
     457             : 
     458      679561 :     if ( ( ( pos2 ^ pos1 ) & NB_POS_FCB_4T ) == 0 )
     459             :     {
     460      360183 :         if ( ( pos1 - pos2 ) <= 0 )
     461             :         {
     462      322056 :             index = ( ( pos1 & mask ) << N ) + ( pos2 & mask );
     463             :         }
     464             :         else
     465             :         {
     466       38127 :             index = ( ( pos2 & mask ) << N ) + ( pos1 & mask );
     467             :         }
     468      360183 :         if ( ( pos1 & NB_POS_FCB_4T ) != 0 )
     469             :         {
     470      180152 :             index += 1 << ( 2 * N );
     471             :         }
     472             :     }
     473             :     else
     474             :     {
     475             : 
     476             :         /*-----------------------------------------------------------------*
     477             :          * sign of 1st pulse != sign of 2nd pulse
     478             :          *-----------------------------------------------------------------*/
     479      319378 :         if ( ( ( pos1 & mask ) - ( pos2 & mask ) ) <= 0 )
     480             :         {
     481      281371 :             index = ( ( pos2 & mask ) << N ) + ( pos1 & mask );
     482      281371 :             if ( ( pos2 & NB_POS_FCB_4T ) != 0 )
     483             :             {
     484      139045 :                 index += 1 << ( 2 * N );
     485             :             }
     486             :         }
     487             :         else
     488             :         {
     489       38007 :             index = ( ( pos1 & mask ) << N ) + ( pos2 & mask );
     490       38007 :             if ( ( pos1 & NB_POS_FCB_4T ) != 0 )
     491             :             {
     492       18290 :                 index += 1 << ( 2 * N );
     493             :             }
     494             :         }
     495             :     }
     496             : 
     497      679561 :     return index;
     498             : }
     499             : 
     500             : /*---------------------------------------------------------------------*
     501             :  * Quantization of 3 pulses with 3*N+1 bits:                           *
     502             :  *---------------------------------------------------------------------*/
     503             : 
     504             : /*! r: return (3*N)+1 bits */
     505       75442 : static int16_t quant_3p_3N1(
     506             :     const int16_t pos1, /* i  : position of the pulse 1     */
     507             :     const int16_t pos2, /* i  : position of the pulse 2     */
     508             :     const int16_t pos3, /* i  : position of the pulse 3     */
     509             :     const int16_t N     /* i  : number of bits for position */
     510             : )
     511             : {
     512             :     int16_t index, nb_pos;
     513             : 
     514       75442 :     nb_pos = ( 1 << ( N - 1 ) );
     515             : 
     516             :     /* Quantization of 3 pulses with 3*N+1 bits */
     517       75442 :     if ( ( ( pos1 ^ pos2 ) & nb_pos ) == 0 )
     518             :     {
     519       36826 :         index = quant_2p_2N1( pos1, pos2, ( N - 1 ) );
     520       36826 :         index += ( pos1 & nb_pos ) << N;
     521       36826 :         index += quant_1p_N1( pos3, N ) << ( 2 * N );
     522             :     }
     523       38616 :     else if ( ( ( pos1 ^ pos3 ) & nb_pos ) == 0 )
     524             :     {
     525       21106 :         index = quant_2p_2N1( pos1, pos3, ( N - 1 ) );
     526       21106 :         index += ( pos1 & nb_pos ) << N;
     527       21106 :         index += quant_1p_N1( pos2, N ) << ( 2 * N );
     528             :     }
     529             :     else
     530             :     {
     531       17510 :         index = quant_2p_2N1( pos2, pos3, ( N - 1 ) );
     532       17510 :         index += ( pos2 & nb_pos ) << N;
     533       17510 :         index += quant_1p_N1( pos1, N ) << ( 2 * N );
     534             :     }
     535             : 
     536       75442 :     return index;
     537             : }
     538             : 
     539             : /*---------------------------------------------------------------------*
     540             :  * Quantization of 4 pulses with 4*N+1 bits:                           *
     541             :  *---------------------------------------------------------------------*/
     542             : 
     543             : /*! r: return (4*N)+1 bits */
     544        4538 : static int32_t quant_4p_4N1(
     545             :     const int16_t pos1, /* i  : position of the pulse 1     */
     546             :     const int16_t pos2, /* i  : position of the pulse 2     */
     547             :     const int16_t pos3, /* i  : position of the pulse 3     */
     548             :     const int16_t pos4, /* i  : position of the pulse 4     */
     549             :     const int16_t N     /* i  : number of bits for position */
     550             : )
     551             : {
     552             :     int32_t index, nb_pos;
     553             : 
     554        4538 :     nb_pos = ( 1 << ( N - 1 ) );
     555             : 
     556             :     /* Quantization of 4 pulses with 4*N+1 bits */
     557        4538 :     if ( ( ( pos1 ^ pos2 ) & nb_pos ) == 0 )
     558             :     {
     559        2310 :         index = quant_2p_2N1( pos1, pos2, ( N - 1 ) );
     560        2310 :         index += ( pos1 & nb_pos ) << N;
     561        2310 :         index += quant_2p_2N1( pos3, pos4, N ) << ( 2 * N );
     562             :     }
     563        2228 :     else if ( ( ( pos1 ^ pos3 ) & nb_pos ) == 0 )
     564             :     {
     565        1212 :         index = quant_2p_2N1( pos1, pos3, ( N - 1 ) );
     566        1212 :         index += ( pos1 & nb_pos ) << N;
     567        1212 :         index += quant_2p_2N1( pos2, pos4, N ) << ( 2 * N );
     568             :     }
     569             :     else
     570             :     {
     571        1016 :         index = quant_2p_2N1( pos2, pos3, ( N - 1 ) );
     572        1016 :         index += ( pos2 & nb_pos ) << N;
     573        1016 :         index += quant_2p_2N1( pos1, pos4, N ) << ( 2 * N );
     574             :     }
     575             : 
     576        4538 :     return ( index );
     577             : }
     578             : 
     579             : /*---------------------------------------------------------------------*
     580             :  * Quantization of 4 pulses with 4*N bits:                             *
     581             :  *---------------------------------------------------------------------*/
     582             : 
     583             : /*! r: return 4*N bits */
     584       42686 : static int32_t quant_4p_4N(
     585             :     const int16_t pos[], /* i  : position of the pulse 1..4  */
     586             :     const int16_t N      /* i  : number of bits for position */
     587             : )
     588             : {
     589             :     int16_t i, j, k, n_1;
     590             :     int16_t posA[4], posB[4];
     591       42686 :     int32_t nb_pos, index = 0;
     592             : 
     593       42686 :     n_1 = N - 1;
     594       42686 :     nb_pos = ( 1 << n_1 );
     595             : 
     596       42686 :     i = 0;
     597       42686 :     j = 0;
     598      213430 :     for ( k = 0; k < 4; k++ )
     599             :     {
     600      170744 :         if ( ( pos[k] & nb_pos ) == 0 )
     601             :         {
     602       85318 :             posA[i++] = pos[k];
     603             :         }
     604             :         else
     605             :         {
     606       85426 :             posB[j++] = pos[k];
     607             :         }
     608             :     }
     609             : 
     610       42686 :     switch ( i )
     611             :     {
     612        2332 :         case 0:
     613        2332 :             index = 1 << ( ( 4 * N ) - 3 );
     614        2332 :             index += quant_4p_4N1( posB[0], posB[1], posB[2], posB[3], n_1 );
     615        2332 :             break;
     616       10646 :         case 1:
     617       10646 :             index = quant_1p_N1( posA[0], n_1 ) << ( ( 3 * n_1 ) + 1 );
     618       10646 :             index += quant_3p_3N1( posB[0], posB[1], posB[2], n_1 );
     619       10646 :             break;
     620       16658 :         case 2:
     621       16658 :             index = quant_2p_2N1( posA[0], posA[1], n_1 ) << ( ( 2 * n_1 ) + 1 );
     622       16658 :             index += quant_2p_2N1( posB[0], posB[1], n_1 );
     623       16658 :             break;
     624       10844 :         case 3:
     625       10844 :             index = quant_3p_3N1( posA[0], posA[1], posA[2], n_1 ) << N;
     626       10844 :             index += quant_1p_N1( posB[0], n_1 );
     627       10844 :             break;
     628        2206 :         case 4:
     629        2206 :             index = quant_4p_4N1( posA[0], posA[1], posA[2], posA[3], n_1 );
     630        2206 :             break;
     631             :     }
     632       42686 :     index += ( i & 3 ) << ( ( 4 * N ) - 2 );
     633             : 
     634       42686 :     return ( index );
     635             : }
     636             : 
     637             : /*---------------------------------------------------------------------*
     638             :  * Quantization of 5 pulses with 5*N bits:                             *
     639             :  *---------------------------------------------------------------------*/
     640             : 
     641             : /*! r: return 5*N bits */
     642       27652 : static int32_t quant_5p_5N(
     643             :     const int16_t pos[], /* i  : position of the pulse 1..5  */
     644             :     const int16_t N      /* i  : number of bits for position */
     645             : )
     646             : {
     647             :     int16_t i, j, k, n_1, nb_pos;
     648             :     int16_t posA[5], posB[5];
     649       27652 :     int32_t index = 0;
     650             : 
     651       27652 :     n_1 = N - 1;
     652       27652 :     nb_pos = ( 1 << n_1 );
     653             : 
     654       27652 :     i = 0;
     655       27652 :     j = 0;
     656      165912 :     for ( k = 0; k < 5; k++ )
     657             :     {
     658      138260 :         if ( ( pos[k] & nb_pos ) == 0 )
     659             :         {
     660       69002 :             posA[i++] = pos[k];
     661             :         }
     662             :         else
     663             :         {
     664       69258 :             posB[j++] = pos[k];
     665             :         }
     666             :     }
     667       27652 :     switch ( i )
     668             :     {
     669         752 :         case 0:
     670         752 :             index = 1 << ( ( 5 * N ) - 1 );
     671         752 :             index += quant_3p_3N1( posB[0], posB[1], posB[2], n_1 ) << ( ( 2 * N ) + 1 );
     672         752 :             index += quant_2p_2N1( posB[3], posB[4], N );
     673         752 :             break;
     674        4132 :         case 1:
     675        4132 :             index = 1 << ( ( 5 * N ) - 1 );
     676        4132 :             index += quant_3p_3N1( posB[0], posB[1], posB[2], n_1 ) << ( ( 2 * N ) + 1 );
     677        4132 :             index += quant_2p_2N1( posB[3], posA[0], N );
     678        4132 :             break;
     679        8880 :         case 2:
     680        8880 :             index = 1 << ( ( 5 * N ) - 1 );
     681        8880 :             index += quant_3p_3N1( posB[0], posB[1], posB[2], n_1 ) << ( ( 2 * N ) + 1 );
     682        8880 :             index += quant_2p_2N1( posA[0], posA[1], N );
     683        8880 :             break;
     684        9166 :         case 3:
     685        9166 :             index = quant_3p_3N1( posA[0], posA[1], posA[2], n_1 ) << ( ( 2 * N ) + 1 );
     686        9166 :             index += quant_2p_2N1( posB[0], posB[1], N );
     687        9166 :             break;
     688        3998 :         case 4:
     689        3998 :             index = quant_3p_3N1( posA[0], posA[1], posA[2], n_1 ) << ( ( 2 * N ) + 1 );
     690        3998 :             index += quant_2p_2N1( posA[3], posB[0], N );
     691        3998 :             break;
     692         724 :         case 5:
     693         724 :             index = quant_3p_3N1( posA[0], posA[1], posA[2], n_1 ) << ( ( 2 * N ) + 1 );
     694         724 :             index += quant_2p_2N1( posA[3], posA[4], N );
     695         724 :             break;
     696             :     }
     697             : 
     698       27652 :     return ( index );
     699             : }
     700             : 
     701             : /*---------------------------------------------------------------------*
     702             :  * Quantization of 6 pulses with 6*N-2 bits:                           *
     703             :  *---------------------------------------------------------------------*/
     704             : 
     705             : /*! r: return 6*N-2 bits */
     706       32096 : static int32_t quant_6p_6N_2(
     707             :     const int16_t pos[], /* i  : position of the pulse 1..6  */
     708             :     const int16_t N      /* i  : number of bits for position */
     709             : )
     710             : {
     711             :     int16_t i, j, k, n_1;
     712             :     int16_t posA[6], posB[6];
     713       32096 :     int32_t nb_pos, index = 0;
     714             : 
     715       32096 :     n_1 = N - 1;
     716       32096 :     nb_pos = 1 << n_1;
     717             : 
     718       32096 :     i = 0;
     719       32096 :     j = 0;
     720      224672 :     for ( k = 0; k < 6; k++ )
     721             :     {
     722      192576 :         if ( ( pos[k] & nb_pos ) == 0 )
     723             :         {
     724       94696 :             posA[i++] = pos[k];
     725             :         }
     726             :         else
     727             :         {
     728       97880 :             posB[j++] = pos[k];
     729             :         }
     730             :     }
     731       32096 :     switch ( i )
     732             :     {
     733         530 :         case 0:
     734         530 :             index = 1 << ( ( 6 * N ) - 5 );
     735         530 :             index += quant_5p_5N( posB, n_1 ) << N;
     736         530 :             index += quant_1p_N1( posB[5], n_1 );
     737         530 :             break;
     738        2902 :         case 1:
     739        2902 :             index = 1 << ( ( 6 * N ) - 5 );
     740        2902 :             index += quant_5p_5N( posB, n_1 ) << N;
     741        2902 :             index += quant_1p_N1( posA[0], n_1 );
     742        2902 :             break;
     743        7836 :         case 2:
     744        7836 :             index = 1 << ( ( 6 * N ) - 5 );
     745        7836 :             index += quant_4p_4N( posB, n_1 ) << ( ( 2 * n_1 ) + 1 );
     746        7836 :             index += quant_2p_2N1( posA[0], posA[1], n_1 );
     747        7836 :             break;
     748       10590 :         case 3:
     749       10590 :             index = quant_3p_3N1( posA[0], posA[1], posA[2], n_1 ) << ( ( 3 * n_1 ) + 1 );
     750       10590 :             index += quant_3p_3N1( posB[0], posB[1], posB[2], n_1 );
     751       10590 :             break;
     752        7234 :         case 4:
     753        7234 :             i = 2;
     754        7234 :             index = quant_4p_4N( posA, n_1 ) << ( ( 2 * n_1 ) + 1 );
     755        7234 :             index += quant_2p_2N1( posB[0], posB[1], n_1 );
     756        7234 :             break;
     757        2608 :         case 5:
     758        2608 :             i = 1;
     759        2608 :             index = quant_5p_5N( posA, n_1 ) << N;
     760        2608 :             index += quant_1p_N1( posB[0], n_1 );
     761        2608 :             break;
     762         396 :         case 6:
     763         396 :             i = 0;
     764         396 :             index = quant_5p_5N( posA, n_1 ) << N;
     765         396 :             index += quant_1p_N1( posA[5], n_1 );
     766         396 :             break;
     767             :     }
     768             : 
     769       32096 :     index += ( i & 3 ) << ( ( 6 * N ) - 4 );
     770             : 
     771       32096 :     return ( index );
     772             : }
     773             : 
     774             : /*---------------------------------------------------------------------*
     775             :  *order the pulse position                                             *
     776             :  *---------------------------------------------------------------------*/
     777             : 
     778             : /*! r: return sign value of pulse on a track */
     779      493720 : static int16_t pre_process(
     780             :     const float v[],          /* i  : the pulse vector                                   */
     781             :     int16_t pos_vector[],     /* o  : position of the pulse on a track                   */
     782             :     int16_t pos_vector_num[], /* o  : the pulse number on the position which have pulse  */
     783             :     int16_t *pulse_pos_num    /* i  : the number of position which have pulse            */
     784             : )
     785             : {
     786             :     int16_t j, k;
     787             :     int16_t sign;
     788             : 
     789      493720 :     sign = 0;
     790      493720 :     j = 0;
     791     8393240 :     for ( k = 0; k < 64; k += 4 )
     792             :     {
     793     7899520 :         if ( v[k] )
     794             :         {
     795     1411149 :             pos_vector[j] = k >> 2;
     796     1411149 :             pos_vector_num[j] = (int16_t) fabsf( v[k] );
     797     1411149 :             if ( v[k] > 0 )
     798             :             {
     799      705457 :                 sign = sign << 1;
     800             :             }
     801             :             else
     802             :             {
     803      705692 :                 sign = ( sign << 1 ) + 1;
     804             :             }
     805     1411149 :             j++;
     806             :         }
     807             :     }
     808      493720 :     *pulse_pos_num = j;
     809             : 
     810      493720 :     return sign;
     811             : }
     812             : 
     813             : /*---------------------------------------------------------------------*
     814             :  *encode the position                                                  *
     815             :  *---------------------------------------------------------------------*/
     816             : 
     817             : /*! r: return index of the positions which have pulse */
     818      493720 : static int32_t fcb_encode_position(
     819             :     const int16_t pos_vector[], /* i  : position of the pulse on a track                */
     820             :     int16_t n,
     821             :     const int16_t pos_num, /* i  : the number of position which have pulse         */
     822             :     const int16_t flag )
     823             : {
     824             :     int16_t i;
     825             :     int32_t mmm1;
     826             :     int16_t temp2;
     827             : 
     828      493720 :     mmm1 = PI_select_table[n][pos_num] - 1;
     829      493720 :     temp2 = pos_num;
     830             : 
     831      493720 :     if ( flag ) /* no decrease */
     832             :     {
     833     1904869 :         for ( i = 0; i < pos_num; i++ )
     834             :         {
     835     1411149 :             mmm1 -= PI_select_table[n - pos_vector[i] - 1][temp2--];
     836             :         }
     837             :     }
     838             :     else
     839             :     {
     840           0 :         for ( i = 0; i < pos_num; i++ )
     841             :         {
     842           0 :             mmm1 -= PI_select_table[n - pos_vector[i] - 1][temp2--];
     843           0 :             n--;
     844             :         }
     845             :     }
     846             : 
     847      493720 :     return mmm1;
     848             : }
     849             : 
     850             : /*---------------------------------------------------------------------*
     851             :  *encode class for 3p 4p 5p 6p/track                                   *
     852             :  *---------------------------------------------------------------------*/
     853             : 
     854             : /*! r: class index of the pulse on a track */
     855       62528 : static int32_t fcb_encode_cl(
     856             :     const int16_t buffer[],  /* i  : pulses on a track                         */
     857             :     const int16_t pulse_num, /* i  : pulses number on a track                  */
     858             :     const int16_t pos_num    /* i  : number of the position which have pulse   */
     859             : )
     860             : {
     861             :     int32_t k;
     862             :     int16_t i, temp1, temp2;
     863             : 
     864       62528 :     temp1 = pos_num + pulse_num - 1;
     865       62528 :     temp2 = pulse_num;
     866       62528 :     k = PI_select_table[temp1][pulse_num] - 1;
     867       62528 :     temp1--;
     868      132539 :     for ( i = 0; i < pulse_num; i++ )
     869             :     {
     870       70011 :         k -= PI_select_table[temp1 - buffer[i]][temp2--];
     871       70011 :         temp1--;
     872             :     }
     873             : 
     874       62528 :     return k;
     875             : }
     876             : 
     877             : /*---------------------------------------------------------------------*
     878             :  *encode the class and compute class offset                            *
     879             :  *---------------------------------------------------------------------*/
     880             : 
     881             : /*! r: class offset */
     882      493720 : static int32_t fcb_encode_class(
     883             :     const int16_t sector_6p_num[], /* i  : position which have pulse on a track             */
     884             :     const int16_t pulse_num,       /* i  : pulse number on a track                          */
     885             :     const int16_t pulse_pos_num    /* i  : number of position which have pulse on a track   */
     886             : )
     887             : {
     888             :     int16_t i, j;
     889             :     int32_t k, mn9_offet;
     890             :     int16_t vector_class[6];
     891             :     int16_t *vector_class_ptr;
     892             : 
     893      493720 :     mn9_offet = 0;
     894             : 
     895      493720 :     if ( pulse_pos_num < pulse_num )
     896             :     {
     897       62528 :         vector_class_ptr = vector_class;
     898      180101 :         for ( i = 0; i < pulse_pos_num; i++ )
     899             :         {
     900      187584 :             for ( j = 0; j < ( sector_6p_num[i] - 1 ); j++ )
     901             :             {
     902       70011 :                 *vector_class_ptr++ = i;
     903             :             }
     904             :         }
     905       62528 :         k = fcb_encode_cl( vector_class, pulse_num - pulse_pos_num, pulse_pos_num );
     906       62528 :         mn9_offet = PI_factor[pulse_pos_num] * k;
     907             :     }
     908             : 
     909      493720 :     return mn9_offet;
     910             : }
     911             : 
     912             : 
     913             : /*---------------------------------------------------------------------*
     914             :  *encode fcb pulse index                                               *
     915             :  *---------------------------------------------------------------------*/
     916             : 
     917             : /*! r: return index of the  pulse on a track */
     918      493720 : static int32_t fcb_encode_PI(
     919             :     const float v[],        /* i  : the pulse vector                      */
     920             :     const int16_t pulse_num /* i  : number of the pulse on a track        */
     921             : )
     922             : {
     923             :     int16_t vector_p[7];
     924             :     int16_t pulse_pos_num;
     925             :     int16_t vector_p_num[7];
     926             :     int32_t code_index;
     927             :     int16_t sign;
     928             : 
     929             :     /*order the pulse position*/
     930      493720 :     sign = pre_process( v, vector_p, vector_p_num, &pulse_pos_num );
     931             : 
     932             :     /*encode the position*/
     933      493720 :     code_index = fcb_encode_position( vector_p, 16, pulse_pos_num, 1 );
     934             : 
     935             :     /*encode the class and compute class offset*/
     936      493720 :     code_index += fcb_encode_class( vector_p_num, pulse_num, pulse_pos_num );
     937             : 
     938      493720 :     code_index = PI_offset[pulse_num][pulse_num + 1 - pulse_pos_num] + ( code_index << pulse_pos_num ) + sign;
     939             : 
     940      493720 :     return code_index;
     941             : }
     942             : 
     943             : 
     944             : /*--------------------------------------------------------------------------*
     945             :  * E_ACELP_code43bit
     946             :  *
     947             :  * Fixed bit-length arithmetic coding of pulses
     948             :  * v - (input) pulse vector
     949             :  * s - (output) encoded state
     950             :  * n - (output) range of possible states (0...n-1)
     951             :  * p - (output) number of pulses found
     952             :  * len - (input) length of pulse vector
     953             :  * trackstep - (input) step between tracks
     954             :  *--------------------------------------------------------------------------*/
     955             : 
     956      246860 : int16_t E_ACELP_code43bit(
     957             :     const float code[],
     958             :     uint32_t *ps,
     959             :     int16_t *p,
     960             :     uint16_t idxs[] )
     961             : {
     962             :     int16_t j, k, track;
     963             :     int16_t ind[32];
     964             :     int16_t tmp;
     965             :     int32_t joint_index;
     966      246860 :     int32_t joint_offset = 3611648; /*offset for 3 pulses per track*/
     967      246860 :     int16_t saved_bits = 0;
     968             : 
     969      740580 :     for ( track = 0; track < 2; track++ )
     970             :     {
     971      493720 :         k = track * NPMAXPT;
     972      493720 :         ps[track] = fcb_encode_PI( code + track, 3 );
     973      493720 :         p[track] = 3;
     974             :     }
     975             : 
     976      740580 :     for ( track = 2; track < NB_TRACK_FCB_4T; track++ )
     977             :     {
     978      493720 :         j = track * NPMAXPT;
     979     8178018 :         for ( k = track; k < 64; k += 4 )
     980             :         {
     981     7709011 :             if ( code[k] )
     982             :             {
     983      962727 :                 tmp = k >> 2;
     984      962727 :                 if ( code[k] < 0 )
     985             :                 {
     986      480526 :                     tmp += 16;
     987             :                 }
     988      962727 :                 if ( fabs( code[k] ) > 1 )
     989             :                 {
     990       24713 :                     ind[j] = tmp;
     991       24713 :                     ind[j + 1] = tmp;
     992       24713 :                     break;
     993             :                 }
     994             :                 else
     995             :                 {
     996      938014 :                     ind[j] = tmp;
     997      938014 :                     j++;
     998             :                 }
     999             :             }
    1000             :         }
    1001      493720 :         k = track * NPMAXPT;
    1002      493720 :         ps[track] = quant_2p_2N1( ind[k], ind[k + 1], 4 );
    1003      493720 :         p[track] = 2;
    1004             :     }
    1005      246860 :     joint_index = ps[0] * 5472 + ps[1];
    1006      246860 :     if ( joint_index >= joint_offset )
    1007             :     {
    1008      207207 :         joint_index += joint_offset;
    1009             :     }
    1010             :     else
    1011             :     {
    1012       39653 :         saved_bits += 1;
    1013             :     }
    1014             : 
    1015      246860 :     idxs[0] = ( ( ps[2] << 9 ) + ps[3] ) & 0xffff;
    1016      246860 :     idxs[1] = ( ( joint_index << 2 ) + ( ps[2] >> 7 ) ) & 0xffff;
    1017      246860 :     idxs[2] = (uint16_t) ( joint_index >> 14 );
    1018             : 
    1019      246860 :     return saved_bits;
    1020             : }

Generated by: LCOV version 1.14