LCOV - code coverage report
Current view: top level - lib_enc - ivas_stereo_adapt_GR_enc.c (source / functions) Hit Total Coverage
Test: Coverage on main @ 6baab0c613aa6c7100498ed7b93676aa8198a493 Lines: 167 174 96.0 %
Date: 2025-05-28 04:28:20 Functions: 10 10 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             : #include <stdint.h>
      34             : #include "options.h"
      35             : #include "cnst.h"
      36             : #include "ivas_prot.h"
      37             : #include "prot.h"
      38             : #include "stat_enc.h"
      39             : #include "wmc_auto.h"
      40             : #include "ivas_rom_com.h"
      41             : #ifdef DEBUGGING
      42             : #include "debug.h"
      43             : #endif
      44             : 
      45             : 
      46             : /*---------------------------------------------------------------------*
      47             :  * Local function prototypes
      48             :  *---------------------------------------------------------------------*/
      49             : 
      50             : static int16_t adapt_GR_sg( const int16_t *in, const int16_t len, const int16_t no_symb, int16_t *nbits, int16_t *in_enc, const int16_t *map0, const int16_t no_GR_ord );
      51             : 
      52             : 
      53             : /*---------------------------------------------------------------------*
      54             :  * calculate_diff()
      55             :  *
      56             :  * calculate difference wrt previous frame and maps it to positive integer
      57             :  *---------------------------------------------------------------------*/
      58             : 
      59      811999 : static void calculate_diff(
      60             :     const int16_t *in,   /* i  : current frame values  */
      61             :     const int16_t *prev, /* i  : previous frmae values */
      62             :     int16_t *in_diff,    /* o  : difference values     */
      63             :     const int16_t len    /* i  : vector length         */
      64             : )
      65             : {
      66             :     int16_t i, tmp;
      67             : 
      68     7144651 :     for ( i = 0; i < len; i++ )
      69             :     {
      70     6332652 :         tmp = in[i] - prev[i];
      71     6332652 :         if ( tmp > 0 )
      72             :         {
      73     1166814 :             in_diff[i] = 2 * tmp - 1;
      74             :         }
      75             :         else
      76             :         {
      77     5165838 :             if ( tmp < 0 )
      78             :             {
      79      937037 :                 in_diff[i] = -2 * tmp;
      80             :             }
      81             :             else
      82             :             {
      83     4228801 :                 in_diff[i] = 0;
      84             :             }
      85             :         }
      86             :     }
      87             : 
      88      811999 :     return;
      89             : }
      90             : 
      91             : 
      92             : /*---------------------------------------------------------------------*
      93             :  * calculate_bit_diff()
      94             :  *
      95             :  * estimates the GR number of bits for encoding differential values
      96             :  * selects between GR order 0 or 1
      97             :  *---------------------------------------------------------------------*/
      98             : 
      99             : /*! r: number of bits */
     100      811999 : static int16_t calculate_bit_diff(
     101             :     int16_t *in_diff,  /* i  : values to be encoded */
     102             :     int16_t len,       /* i  : number of params     */
     103             :     int16_t *flag_diff /* o  : selected GR order    */
     104             : )
     105             : {
     106             :     int16_t i, nb, nb1;
     107             : 
     108      811999 :     nb = 0;
     109      811999 :     nb1 = 0;
     110     7144651 :     for ( i = 0; i < len; i++ )
     111             :     {
     112     6332652 :         nb += in_diff[i];
     113     6332652 :         nb1 += ( ( in_diff[i] ) >> 1 );
     114             :     }
     115      811999 :     nb += len;
     116      811999 :     nb1 += 2 * len;
     117             : 
     118      811999 :     if ( nb1 < nb )
     119             :     {
     120       72677 :         nb = nb1 + 1;
     121       72677 :         *flag_diff = 1; /* GR order for differential coding */
     122             :     }
     123             :     else
     124             :     {
     125      739322 :         nb = nb + 1;
     126      739322 :         *flag_diff = 0;
     127             :     }
     128             : 
     129      811999 :     return nb;
     130             : }
     131             : 
     132             : 
     133             : /*---------------------------------------------------------------------*
     134             :  * adapt_GR_ief()
     135             :  *
     136             :  * adaptive GR coding considering also the differential case
     137             :  *---------------------------------------------------------------------*/
     138             : 
     139             : /*! r: used GR order */
     140      638759 : int16_t adapt_GR_ief(
     141             :     const int16_t *in,               /*  i  : vector to encode                                 */
     142             :     int16_t *in_diff,                /*  o  : encoded symbols in case of differential encoding */
     143             :     const int16_t *prev,             /*  i  : previous frame data                              */
     144             :     const int16_t len,               /*  i  : input vector length                              */
     145             :     const int16_t no_symb,           /*  i  : number of symbols                                */
     146             :     int16_t *nbits,                  /*  o  : number of used bits                              */
     147             :     int16_t *in_enc,                 /*  o  : symbold actually encoded after adapt_GR          */
     148             :     const int16_t *map0,             /*  i  : mapping array                                    */
     149             :     const int16_t no_GR_ord,         /*  i  : number of GR order to try 2: 0,1; 3:0,1,2        */
     150             :     int16_t *nbits_diff,             /*  o  : number bits in diff encoding                     */
     151             :     const int16_t side_gain_counter, /*  i  : number of frames since last abs coding           */
     152             :     float *side_gain_bitdiff_lp,     /*  i/o: LP-filtered bit difference between abs/diff      */
     153             :     const int16_t try_diff           /*  i  : diff coding allowed 1/0                          */
     154             : )
     155             : {
     156             :     int16_t nb_diff, flag, flag_diff;
     157             :     int16_t bitdiff;
     158             : 
     159      638759 :     flag = adapt_GR_sg( in, len, no_symb, nbits, in_enc, map0, no_GR_ord );
     160             : 
     161      638759 :     if ( try_diff ) /* inter-frame prediction allowed */
     162             :     {
     163      226550 :         calculate_diff( in, prev, in_diff, len );
     164      226550 :         nb_diff = calculate_bit_diff( in_diff, len, &flag_diff );
     165      226550 :         *nbits_diff = nb_diff;
     166      226550 :         bitdiff = min( 5 * len, *nbits ) - ( nb_diff + 1 );
     167      226550 :         *side_gain_bitdiff_lp = STEREO_DFT_BITDIFF_LP_FAC * ( (float) bitdiff ) + ( 1.0f - STEREO_DFT_BITDIFF_LP_FAC ) * ( *side_gain_bitdiff_lp );
     168      226550 :         if ( bitdiff > STEREO_DFT_BITDIFF_ABS_SELECT * ( *side_gain_bitdiff_lp ) * ( (float) side_gain_counter ) / ( (float) ( STEREO_DFT_FEC_THRESHOLD + 1 ) ) )
     169             :         {
     170      193389 :             flag = no_GR_ord + flag_diff;
     171      193389 :             *nbits = nb_diff + 1;
     172             :         }
     173             :     }
     174             :     else
     175             :     {
     176      412209 :         *nbits_diff = 100;
     177      412209 :         flag_diff = -1;
     178             :     }
     179             : 
     180      638759 :     return flag;
     181             : }
     182             : 
     183             : 
     184             : /*---------------------------------------------------------------------*
     185             :  * adapt_GR_rpg1_ief()
     186             :  *
     187             :  *  use adaptive GR for RPG's considering also the differential case
     188             :  *---------------------------------------------------------------------*/
     189             : 
     190             : /*! r: used GR order */
     191      615015 : int16_t adapt_GR_rpg1_ief(
     192             :     const int16_t *in,       /*  i  : res pred gains input vector                       */
     193             :     int16_t *in_diff,        /*  o  : encoded symbols in case of differential encoding  */
     194             :     const int16_t *prev,     /*  i  : previous frame data                               */
     195             :     const int16_t len,       /*  i  : input vector length                               */
     196             :     const int16_t no_symb,   /*  i  : number of symbols                                 */
     197             :     int16_t *nbits,          /*  o  : number of used bits                               */
     198             :     int16_t *in_enc,         /*  o  : symbold actually encoded after adapt_GR           */
     199             :     const int16_t *maps,     /*  i  : mapping array                                     */
     200             :     int16_t *nbits_diff,     /*  o  : estimated no of bits for differential encoding    */
     201             :     const int16_t no_GR_ord, /*  i  : number of GR order to try 2: 0,1; 3:0,1,2         */
     202             :     const int16_t try_diff   /*  i  : diff coding allowed 1/0                           */
     203             : )
     204             : {
     205             :     const int16_t *map0;
     206             :     int16_t s, i, GR_ord, flag_diff, nb_diff;
     207             : 
     208      615015 :     map0 = &maps[8 * NO_SYMB_GR_PRED_G];
     209             : 
     210      615015 :     if ( in[0] == 0 )
     211             :     {
     212      131576 :         s = 0;
     213     1100570 :         for ( i = 0; i < len; i++ )
     214             :         {
     215      968994 :             s += in[i];
     216             :         }
     217             : 
     218      131576 :         if ( s == 0 )
     219             :         {
     220             :             /* encode only the first zero with GR1 */
     221       93246 :             *nbits = ( ( map0[0] ) >> 1 ) + 2;
     222       93246 :             in_enc[0] = map0[0];
     223             :         }
     224             :         else
     225             :         {
     226       38330 :             *nbits = 1000; /* large number such that the plain coding will be selected */
     227             :         }
     228      131576 :         GR_ord = 1;
     229             :     }
     230             :     else
     231             :     {
     232      483439 :         GR_ord = adapt_GR_sg( in, len, no_symb, nbits, in_enc, maps, no_GR_ord );
     233             :     }
     234             : 
     235      615015 :     if ( try_diff )
     236             :     {
     237      585449 :         calculate_diff( in, prev, in_diff, len );
     238      585449 :         nb_diff = calculate_bit_diff( in_diff, len, &flag_diff );
     239      585449 :         *nbits_diff = nb_diff;
     240             : 
     241      585449 :         if ( ( nb_diff + 1 ) < *nbits ) /* there is one more bit to signal differential coding */
     242             :         {
     243      412661 :             GR_ord = no_GR_ord + flag_diff;
     244             : 
     245      412661 :             *nbits = nb_diff + 1;
     246             :         }
     247             :     }
     248             :     else
     249             :     {
     250       29566 :         *nbits_diff = 100;
     251             :     }
     252             : 
     253      615015 :     return GR_ord;
     254             : }
     255             : 
     256             : 
     257             : /*---------------------------------------------------------------------*
     258             :  * adapt_GR_sg()
     259             :  *
     260             :  * adaptive GR coding
     261             :  *---------------------------------------------------------------------*/
     262             : 
     263             : /*! r: GR order */
     264     1122198 : static int16_t adapt_GR_sg(
     265             :     const int16_t *in,      /* i  : data to be encoded                       */
     266             :     const int16_t len,      /* i  : number of params to be encoded           */
     267             :     const int16_t no_symb,  /* i  : max number of symbols                    */
     268             :     int16_t *nbits,         /* o  : estimated number of bits                 */
     269             :     int16_t *in_enc,        /* o  : mapped symbols                           */
     270             :     const int16_t *map0,    /* i  : mapping                                  */
     271             :     const int16_t no_GR_ord /* i  : number of GR orders to be tested (2 or 3)*/
     272             : )
     273             : {
     274             :     const int16_t *map;
     275             :     int16_t nbits0, nbits1, nbits2, symb, map_symb, i, nb0, nb1, nb2;
     276             : 
     277     1122198 :     if ( no_symb == NO_SYMB_GR_SIDE_G )
     278             :     {
     279      638759 :         map = &map0[15 * no_symb];
     280             :     }
     281             :     else
     282             :     {
     283      483439 :         map = &( map0[8 * no_symb] );
     284             :     }
     285             : 
     286     1122198 :     set_s( in_enc, 0, len );
     287             : 
     288     1122198 :     nbits1 = 0;
     289     1122198 :     nbits0 = 0;
     290     1122198 :     nbits2 = 0;
     291             : 
     292    10752416 :     for ( i = 0; i < len; i++ )
     293             :     {
     294     9630218 :         symb = in[i];
     295     9630218 :         map_symb = map[symb];
     296             : 
     297     9630218 :         if ( i == 0 )
     298             :         {
     299             :             /* GR order is 1 for first band*/
     300     1122198 :             nb0 = ( map_symb >> 1 ) + 1;
     301     1122198 :             nb2 = nb0 - 2;
     302             :         }
     303             :         else
     304             :         {
     305     8508020 :             nb0 = map_symb;
     306     8508020 :             nb2 = ( ( map_symb ) >> 2 );
     307             :         }
     308     9630218 :         nb1 = ( ( map_symb ) >> 1 );
     309             : 
     310     9630218 :         in_enc[i] = map_symb;
     311     9630218 :         nbits0 += nb0;
     312     9630218 :         nbits1 += nb1;
     313     9630218 :         nbits2 += nb2;
     314             : 
     315             :         /* update counts */
     316     9630218 :         map = &( map0[symb * no_symb] );
     317             :     }
     318             : 
     319     1122198 :     if ( no_GR_ord == 2 )
     320             :     {
     321      483439 :         nbits0 += len + 1;
     322      483439 :         nbits1 += 2 * len + 1;
     323      483439 :         if ( ( nbits0 <= nbits1 ) )
     324             :         {
     325      262322 :             *nbits = nbits0;
     326      262322 :             return 0;
     327             :         }
     328             :         else
     329             :         {
     330      221117 :             *nbits = nbits1;
     331      221117 :             return 1;
     332             :         }
     333             :     }
     334             :     else
     335             :     {
     336      638759 :         if ( no_GR_ord == 3 )
     337             :         {
     338      638759 :             nbits0 += len + 2;
     339      638759 :             nbits1 += 2 * len + 1;
     340      638759 :             nbits2 += 3 * len + 2;
     341             : 
     342      638759 :             if ( ( nbits1 <= nbits2 ) && ( nbits1 <= nbits0 ) )
     343             :             {
     344      338119 :                 *nbits = nbits1;
     345      338119 :                 return 1;
     346             :             }
     347             : 
     348      300640 :             if ( ( nbits0 <= nbits2 ) && ( nbits0 <= nbits1 ) )
     349             :             {
     350      239426 :                 *nbits = nbits0;
     351      239426 :                 return 0;
     352             :             }
     353             : 
     354       61214 :             if ( ( nbits2 <= nbits0 ) && ( nbits2 <= nbits1 ) )
     355             :             {
     356       61214 :                 *nbits = nbits2;
     357       61214 :                 return 2;
     358             :             }
     359             :         }
     360             :         else
     361             :         {
     362           0 :             IVAS_ERROR( IVAS_ERR_INTERNAL, "Wrong number of GR orders!" );
     363             :         }
     364             :     }
     365             : 
     366           0 :     return -1;
     367             : }
     368             : 
     369             : 
     370             : /*---------------------------------------------------------------------*
     371             :  * write_GR0()
     372             :  *
     373             :  * write data with GR order 0
     374             :  *---------------------------------------------------------------------*/
     375             : 
     376             : /*! r: number of bits written */
     377      860600 : int16_t write_GR0(
     378             :     BSTR_ENC_HANDLE hBstr, /* i/o: Encoder bitstream handle    */
     379             :     const int16_t ind,     /* i  : bitstream index             */
     380             :     const int16_t *in,     /* i  : data to be encoded          */
     381             :     const int16_t len      /* i  : input data length           */
     382             : )
     383             : {
     384      860600 :     int16_t nb = 0, i, n, val;
     385             : 
     386     7564893 :     for ( i = 0; i < len; i++ )
     387             :     {
     388     6704293 :         n = in[i] + 1;
     389             : 
     390     6704293 :         if ( n < 16 )
     391             :         {
     392     6704029 :             val = ( 1 << in[i] ) - 1;
     393     6704029 :             val = 2 * val;
     394     6704029 :             push_indice( hBstr, ind, val, n );
     395             :         }
     396             :         else
     397             :         {
     398         264 :             push_indice( hBstr, ind, 16383, 14 );
     399         264 :             push_indice( hBstr, ind, ( 1 << ( n - 15 ) ) - 1, n - 15 );
     400         264 :             push_indice( hBstr, ind, 0, 1 );
     401             :         }
     402     6704293 :         nb += n;
     403             :     }
     404             : 
     405      860600 :     return nb;
     406             : }
     407             : 
     408             : 
     409             : /*---------------------------------------------------------------------*
     410             :  * write_GR1()
     411             :  *
     412             :  * write data with GR order 1
     413             :  *---------------------------------------------------------------------*/
     414             : 
     415             : /*! r: number of bits written */
     416      878030 : int16_t write_GR1(
     417             :     BSTR_ENC_HANDLE hBstr, /* i/o: Encoder bitstream handle    */
     418             :     const int16_t ind,     /* i  : bitstream index             */
     419             :     const int16_t *in,     /* i  : data to be encoded          */
     420             :     const int16_t len      /* i  : input data length           */
     421             : )
     422             : {
     423      878030 :     int16_t nb = 0, i, n, val;
     424             : 
     425     3740097 :     for ( i = 0; i < len; i++ )
     426             :     {
     427     2862067 :         n = ( in[i] >> 1 );
     428     2862067 :         if ( n < 14 )
     429             :         {
     430     2853200 :             val = ( 1 << n ) - 1;
     431     2853200 :             val = 4 * val + ( in[i] & 1 );
     432     2853200 :             push_indice( hBstr, ind, val, n + 2 );
     433             :         }
     434             :         else
     435             :         {
     436        8867 :             push_indice( hBstr, ind, 16383, 14 );
     437        8867 :             if ( n > 14 )
     438             :             {
     439        3201 :                 push_indice( hBstr, ind, ( 1 << ( n - 14 ) ) - 1, n - 14 ); /* 1 n times */
     440             :             }
     441        8867 :             push_indice( hBstr, ind, 0, 1 );
     442        8867 :             push_indice( hBstr, ind, in[i] & 1, 1 );
     443             :         }
     444     2862067 :         nb += n + 2;
     445             :     }
     446             : 
     447      878030 :     return nb;
     448             : }
     449             : 
     450             : 
     451             : /*---------------------------------------------------------------------*
     452             :  * write_GR2()
     453             :  *
     454             :  * write data with GR order 2
     455             :  *---------------------------------------------------------------------*/
     456             : 
     457             : /*! r: number of bits written */
     458       27196 : static int16_t write_GR2(
     459             :     BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle        */
     460             :     const int16_t ind,     /* i  : bitstream index         */
     461             :     const int16_t *in,     /* i  : data to be encoded      */
     462             :     const int16_t len      /* i  : input data length       */
     463             : )
     464             : {
     465       27196 :     int16_t nb = 0, i, n;
     466             : 
     467      274525 :     for ( i = 0; i < len; i++ )
     468             :     {
     469      247329 :         n = ( in[i] >> 2 );
     470      247329 :         if ( n < 14 )
     471             :         {
     472      247329 :             if ( n > 0 )
     473             :             {
     474      133163 :                 push_indice( hBstr, ind, ( 1 << n ) - 1, n ); /* 1 n times */
     475             :             }
     476      247329 :             push_indice( hBstr, ind, 0, 1 );
     477      247329 :             push_indice( hBstr, ind, in[i] & 3, 2 );
     478             :         }
     479             :         else
     480             :         {
     481           0 :             push_indice( hBstr, ind, 16383, 14 );
     482           0 :             if ( n > 14 )
     483             :             {
     484           0 :                 push_indice( hBstr, ind, ( 1 << ( n - 14 ) ) - 1, n - 14 ); /* 1 n times */
     485             :             }
     486           0 :             push_indice( hBstr, ind, 0, 1 );
     487           0 :             push_indice( hBstr, ind, in[i] & 3, 2 );
     488             :         }
     489      247329 :         nb += n + 3;
     490             :     }
     491             : 
     492       27196 :     return nb;
     493             : }
     494             : 
     495             : 
     496             : /*---------------------------------------------------------------------*
     497             :  * write_bitstream_GR()
     498             :  *
     499             :  * generic GR encoder for GR order 0 or 1
     500             :  *---------------------------------------------------------------------*/
     501             : 
     502             : /*! r: number of bits written */
     503      596238 : int16_t write_bitstream_GR(
     504             :     BSTR_ENC_HANDLE hBstr, /* i/o: Encoder bitstream handle */
     505             :     const int16_t ind,     /* i  : bitstream index          */
     506             :     const int16_t *in,     /* i  : input vector             */
     507             :     const int16_t len,     /* i  : input vector length      */
     508             :     const int16_t GR_ord   /* i  : GR order                 */
     509             : )
     510             : {
     511      596238 :     int16_t nb = 0;
     512             : 
     513      596238 :     push_indice( hBstr, ind, GR_ord, 1 );
     514      596238 :     nb += 1;
     515             : 
     516      596238 :     if ( GR_ord == 0 )
     517             :     {
     518      584092 :         nb += write_GR0( hBstr, ind, in, len );
     519             :     }
     520             :     else
     521             :     {
     522       12146 :         nb += write_GR1( hBstr, ind, in, len );
     523             :     }
     524             : 
     525      596238 :     return nb;
     526             : }
     527             : 
     528             : 
     529             : /*---------------------------------------------------------------------*
     530             :  * write_bitstream_adapt_GR()
     531             :  *
     532             :  * write encoded data using adaptive GR
     533             :  *---------------------------------------------------------------------*/
     534             : 
     535             : /*! r: number of bits written */
     536      525764 : int16_t write_bitstream_adapt_GR(
     537             :     BSTR_ENC_HANDLE hBstr,  /* i/o: Encoder bitstream handle                    */
     538             :     const int16_t ind,      /* i  : bitstream index                             */
     539             :     const int16_t *in,      /* i  : values to be written in bitstream           */
     540             :     const int16_t len,      /* i  : values vector length                        */
     541             :     const int16_t GR_ord,   /* i  : GR order to be used                         */
     542             :     const int16_t no_GR_ord /* i  : speech/music 0/1                            */
     543             : )
     544             : {
     545      525764 :     int16_t nb = 0;
     546             : 
     547      525764 :     nb = 0;
     548             :     /* first component first */
     549      525764 :     nb += write_GR1( hBstr, ind, in, 1 );
     550             : 
     551             :     /* write the GR order */
     552      525764 :     if ( no_GR_ord == 2 )
     553             :     {
     554       84423 :         push_indice( hBstr, ind, GR_ord, 1 );
     555       84423 :         nb += 1;
     556             :     }
     557             :     else
     558             :     {
     559      441341 :         if ( GR_ord == 1 )
     560             :         {
     561      239713 :             push_indice( hBstr, ind, 0, 1 ); /* GR order = 1*/
     562      239713 :             nb += 1;
     563             :         }
     564             :         else
     565             :         {
     566      201628 :             push_indice( hBstr, ind, 1, 1 );
     567      201628 :             push_indice( hBstr, ind, GR_ord >> 1, 1 ); /* '10' for GR ord = 0; '11' for GR ord 2 */
     568      201628 :             nb += 2;
     569             :         }
     570             :     }
     571             : 
     572      525764 :     if ( GR_ord == 0 )
     573             :     {
     574             : 
     575      245207 :         nb += write_GR0( hBstr, ind, &in[1], len - 1 );
     576             :     }
     577             :     else
     578             :     {
     579      280557 :         if ( GR_ord == 1 )
     580             :         {
     581      253361 :             nb += write_GR1( hBstr, ind, &in[1], len - 1 );
     582             :         }
     583             :         else
     584             :         {
     585       27196 :             nb += write_GR2( hBstr, ind, &in[1], len - 1 );
     586             :         }
     587             :     }
     588             : 
     589      525764 :     return nb;
     590             : }

Generated by: LCOV version 1.14