LCOV - code coverage report
Current view: top level - lib_com - ivas_spar_com_quant_util_fx.c (source / functions) Hit Total Coverage
Test: Coverage on main enc/dec/rend @ 3b2f07138c61dcf997bbf4165d0882f794b2995f Lines: 231 245 94.3 %
Date: 2025-05-03 01:55:50 Functions: 9 9 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 "math.h"
      36             : #include "prot_fx.h"
      37             : #include "ivas_rom_com.h"
      38             : #include <assert.h>
      39             : #include "wmc_auto.h"
      40             : #include "ivas_rom_com_fx.h"
      41             : #include "ivas_prot_fx.h"
      42             : 
      43             : 
      44             : /*-----------------------------------------------------------------------------------------*
      45             :  * Function ivas_quantise_real_values()
      46             :  *
      47             :  * Quantize real values
      48             :  *-----------------------------------------------------------------------------------------*/
      49      838804 : void ivas_quantise_real_values_enc_fx_varq(
      50             :     const Word32 *values_fx,
      51             :     const Word16 q_levels,
      52             :     const Word32 min_value_fx,
      53             :     const Word32 max_value_fx,
      54             :     Word16 *index,
      55             :     Word32 *quant_fx,
      56             :     const Word16 dim,
      57             :     Word16 inp_q )
      58             : {
      59             :     Word16 i;
      60             :     Word32 q_step_fx, one_by_q_step_fx;
      61      838804 :     test();
      62      838804 :     IF( EQ_16( q_levels, 1 ) )
      63             :     {
      64           0 :         FOR( i = 0; i < dim; i++ )
      65             :         {
      66           0 :             quant_fx[i] = 0;
      67           0 :             move32();
      68           0 :             index[i] = 0;
      69           0 :             move16();
      70             :         }
      71             :     }
      72      838804 :     ELSE IF( q_levels && NE_32( max_value_fx, min_value_fx ) )
      73      838804 :     {
      74      838804 :         Word16 nor_q_level = norm_l( sub( q_levels, 1 ) );
      75      838804 :         Word32 one_by_q_levels = divide3232( L_shl( 1, ( nor_q_level ) ), L_shl( sub( q_levels, 1 ), ( nor_q_level ) ) ); // Q15
      76      838804 :         one_by_q_levels = L_shl( one_by_q_levels, 16 );                                                                   // Q31
      77      838804 :         q_step_fx = Mpy_32_32( L_sub( max_value_fx, min_value_fx ), one_by_q_levels );                                    // Q28
      78             :         Word16 exp;
      79      838804 :         Word16 one_by_max_min = BASOP_Util_Divide3232_Scale( ONE_IN_Q28, L_sub( max_value_fx, min_value_fx ), &exp ); // Q(15-exp)
      80      838804 :         one_by_q_step_fx = L_mult0( sub( q_levels, 1 ), one_by_max_min );                                             // Q(15-exp)
      81             :         Word32 val_fx;
      82      838804 :         IF( LT_16( inp_q, Q28 ) )
      83             :         {
      84       58258 :             FOR( i = 0; i < dim; i++ )
      85             :             {
      86       50400 :                 val_fx = L_max( L_shr( min_value_fx, sub( Q28, inp_q ) ), L_min( values_fx[i], L_shr( max_value_fx, sub( Q28, inp_q ) ) ) ); // Q(inp_q)
      87       50400 :                 val_fx = L_shl( val_fx, sub( Q28, inp_q ) );                                                                                 // Q28
      88       50400 :                 index[i] = round_fx( L_shl( Mpy_32_32( one_by_q_step_fx, val_fx ), add( Q4, exp ) ) );                                       // Q0
      89       50400 :                 move16();
      90       50400 :                 quant_fx[i] = imult3216( q_step_fx, index[i] ); // Q28
      91       50400 :                 move32();
      92             :             }
      93             :         }
      94             :         ELSE
      95             :         {
      96     5608394 :             FOR( i = 0; i < dim; i++ )
      97             :             {
      98     4777448 :                 val_fx = L_max( min_value_fx, L_min( L_shr( values_fx[i], sub( inp_q, Q28 ) ), max_value_fx ) ); // Q28
      99     4777448 :                 index[i] = round_fx( L_shl( Mpy_32_32( one_by_q_step_fx, val_fx ), add( Q4, exp ) ) );           // Q0
     100     4777448 :                 move16();
     101     4777448 :                 quant_fx[i] = imult3216( q_step_fx, index[i] ); // Q28
     102     4777448 :                 move32();
     103             :             }
     104             :         }
     105             :     }
     106             :     ELSE
     107             :     {
     108           0 :         FOR( i = 0; i < dim; i++ )
     109             :         {
     110           0 :             quant_fx[i] = values_fx[i];
     111           0 :             move32();
     112             :         }
     113             :     }
     114      838804 :     return;
     115             : }
     116             : 
     117             : 
     118        6684 : void ivas_quantise_real_values_fx(
     119             :     const Word32 *values_fx, /*q28*/
     120             :     const Word16 q_levels,
     121             :     const Word32 min_value_fx, /*q28*/
     122             :     const Word32 max_value_fx, /*q28*/
     123             :     Word16 *index,
     124             :     Word32 *quant_fx, /*q28*/
     125             :     const Word16 dim )
     126             : {
     127             :     Word16 i;
     128             :     Word32 q_step_fx, one_by_q_step_fx;
     129        6684 :     test();
     130        6684 :     IF( EQ_16( q_levels, 1 ) )
     131             :     {
     132        1272 :         FOR( i = 0; i < dim; i++ )
     133             :         {
     134         636 :             quant_fx[i] = 0;
     135         636 :             move32();
     136         636 :             index[i] = 0;
     137         636 :             move16();
     138             :         }
     139             :     }
     140        6048 :     ELSE IF( q_levels && NE_32( max_value_fx, min_value_fx ) )
     141        6048 :     {
     142        6048 :         Word16 nor_q_level = norm_l( sub( q_levels, 1 ) );
     143        6048 :         Word32 one_by_q_levels = divide3232( L_shl( 1, ( nor_q_level ) ), L_shl( sub( q_levels, 1 ), ( nor_q_level ) ) ); // q15
     144        6048 :         one_by_q_levels = L_shl( one_by_q_levels, 16 );                                                                   // q31
     145        6048 :         q_step_fx = Mpy_32_32( L_sub( max_value_fx, min_value_fx ), one_by_q_levels );                                    // q28
     146        6048 :         Word16 one_by_max_min = divide3232( ONE_IN_Q28, L_sub( max_value_fx, min_value_fx ) );                            // q15
     147        6048 :         one_by_q_step_fx = L_mult0( sub( q_levels, 1 ), one_by_max_min );                                                 // q15
     148             :         Word32 val_fx;
     149       12096 :         FOR( i = 0; i < dim; i++ )
     150             :         {
     151        6048 :             val_fx = L_max( min_value_fx, L_min( values_fx[i], max_value_fx ) );        // q28
     152        6048 :             index[i] = extract_l( L_shr( Mpy_32_32( one_by_q_step_fx, val_fx ), 12 ) ); // q15+q28-q31-q12=>q0
     153        6048 :             move16();
     154        6048 :             quant_fx[i] = imult3216( q_step_fx, index[i] ); // q28
     155        6048 :             move16();
     156             :         }
     157             :     }
     158             :     ELSE
     159             :     {
     160           0 :         FOR( i = 0; i < dim; i++ )
     161             :         {
     162           0 :             quant_fx[i] = values_fx[i]; // q28
     163           0 :             move32();
     164             :         }
     165             :     }
     166        6684 :     return;
     167             : }
     168             : 
     169     2481748 : void ivas_quantise_real_values_enc_fx(
     170             :     const Word32 *values_fx, // Q28
     171             :     const Word16 q_levels,
     172             :     const Word32 min_value_fx, // Q28
     173             :     const Word32 max_value_fx, // Q28
     174             :     Word16 *index,
     175             :     Word32 *quant_fx, // Q28
     176             :     const Word16 dim )
     177             : {
     178             :     Word16 i;
     179             :     Word32 q_step_fx, one_by_q_step_fx;
     180     2481748 :     test();
     181     2481748 :     IF( EQ_16( q_levels, 1 ) )
     182             :     {
     183        5960 :         FOR( i = 0; i < dim; i++ )
     184             :         {
     185        2980 :             quant_fx[i] = 0;
     186        2980 :             move32();
     187        2980 :             index[i] = 0;
     188        2980 :             move16();
     189             :         }
     190             :     }
     191     2478768 :     ELSE IF( q_levels && NE_32( max_value_fx, min_value_fx ) )
     192     2478768 :     {
     193     2478768 :         Word16 nor_q_level = norm_l( sub( q_levels, 1 ) );
     194     2478768 :         Word32 one_by_q_levels = divide3232( L_shl( 1, ( nor_q_level ) ), L_shl( sub( q_levels, 1 ), ( nor_q_level ) ) ); // Q15
     195     2478768 :         one_by_q_levels = L_shl( one_by_q_levels, 16 );                                                                   // Q31
     196     2478768 :         q_step_fx = Mpy_32_32( L_sub( max_value_fx, min_value_fx ), one_by_q_levels );                                    // Q28
     197             :         Word16 exp;
     198     2478768 :         Word16 one_by_max_min = BASOP_Util_Divide3232_Scale( ONE_IN_Q28, L_sub( max_value_fx, min_value_fx ), &exp ); // Q(15-exp)
     199     2478768 :         one_by_q_step_fx = L_mult0( sub( q_levels, 1 ), one_by_max_min );                                             // Q(15-exp)
     200             :         Word32 val_fx;
     201    12218368 :         FOR( i = 0; i < dim; i++ )
     202             :         {
     203     9739600 :             val_fx = L_max( min_value_fx, L_min( values_fx[i], max_value_fx ) );                   // Q28
     204     9739600 :             index[i] = round_fx( L_shl( Mpy_32_32( one_by_q_step_fx, val_fx ), add( Q4, exp ) ) ); //(Q(15-exp)+Q28-Q31)+Q4+Q(exp)=Q0
     205     9739600 :             move16();
     206     9739600 :             quant_fx[i] = imult3216( q_step_fx, index[i] ); // Q28
     207     9739600 :             move32();
     208             :         }
     209             :     }
     210             :     ELSE
     211             :     {
     212           0 :         FOR( i = 0; i < dim; i++ )
     213             :         {
     214           0 :             quant_fx[i] = values_fx[i]; // Q28
     215           0 :             move32();
     216             :         }
     217             :     }
     218     2481748 :     return;
     219             : }
     220             : 
     221             : /*-----------------------------------------------------------------------------------------*
     222             :  * Function ivas_spar_get_uniform_quant_strat()
     223             :  *
     224             :  * Sets the quant strat values
     225             :  *-----------------------------------------------------------------------------------------*/
     226             : /*-----------------------------------------------------------------------------------------*
     227             :  * Function ivas_spar_get_uniform_quant_strat_fx()
     228             :  *
     229             :  * Sets the quant strat values
     230             :  *-----------------------------------------------------------------------------------------*/
     231        5183 : void ivas_spar_get_uniform_quant_strat_fx(
     232             :     ivas_spar_md_com_cfg *pSpar_md_com_cfg,
     233             :     const Word16 table_idx )
     234             : {
     235             :     Word16 i;
     236        5183 :     Word16 active_w = ivas_spar_br_table_consts[table_idx].active_w;
     237        5183 :     move16();
     238             :     Word16 PQ_q_lvl, C_q_lvl, Pr_q_lvl, Pc_q_lvl;
     239             : 
     240        5183 :     pSpar_md_com_cfg->num_quant_strats = MAX_QUANT_STRATS;
     241        5183 :     move16();
     242             : 
     243       20732 :     FOR( i = 0; i < pSpar_md_com_cfg->num_quant_strats; i++ )
     244             :     {
     245       15549 :         PQ_q_lvl = ivas_spar_br_table_consts[table_idx].q_lvls[i][0];
     246       15549 :         move16();
     247       15549 :         C_q_lvl = ivas_spar_br_table_consts[table_idx].q_lvls[i][1];
     248       15549 :         move16();
     249       15549 :         Pr_q_lvl = ivas_spar_br_table_consts[table_idx].q_lvls[i][2];
     250       15549 :         move16();
     251       15549 :         Pc_q_lvl = ivas_spar_br_table_consts[table_idx].q_lvls[i][3];
     252       15549 :         move16();
     253             : 
     254       15549 :         IF( active_w )
     255             :         {
     256        5580 :             pSpar_md_com_cfg->quant_strat[i].PR.q_levels[0] = PQ_q_lvl;
     257        5580 :             move16();
     258        5580 :             pSpar_md_com_cfg->quant_strat[i].PR.q_levels[1] = PQ_q_lvl;
     259        5580 :             move16();
     260        5580 :             pSpar_md_com_cfg->quant_strat[i].PR.min_fx = -322122547; // -1.2*Q28
     261        5580 :             move32();
     262        5580 :             pSpar_md_com_cfg->quant_strat[i].PR.max_fx = 322122547; // 1.2*Q28
     263        5580 :             move32();
     264             : 
     265        5580 :             pSpar_md_com_cfg->quant_strat[i].C.q_levels[0] = C_q_lvl;
     266        5580 :             move16();
     267        5580 :             pSpar_md_com_cfg->quant_strat[i].C.q_levels[1] = C_q_lvl;
     268        5580 :             move16();
     269        5580 :             pSpar_md_com_cfg->quant_strat[i].C.min_fx = -214748364; //-.8*Q28
     270        5580 :             move32();
     271        5580 :             pSpar_md_com_cfg->quant_strat[i].C.max_fx = 214748364; //.8*Q28
     272        5580 :             move32();
     273             : 
     274        5580 :             pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[0] = Pr_q_lvl;
     275        5580 :             move16();
     276        5580 :             pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[1] = Pr_q_lvl;
     277        5580 :             move16();
     278        5580 :             pSpar_md_com_cfg->quant_strat[i].P_r.min_fx = 0;
     279        5580 :             move32();
     280        5580 :             pSpar_md_com_cfg->quant_strat[i].P_r.max_fx = 214748364; //.8*Q28
     281        5580 :             move32();
     282             : 
     283        5580 :             pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[0] = Pc_q_lvl;
     284        5580 :             move16();
     285        5580 :             pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[1] = Pc_q_lvl;
     286        5580 :             move16();
     287        5580 :             pSpar_md_com_cfg->quant_strat[i].P_c.min_fx = -214748364; //-.8*Q28
     288        5580 :             move32();
     289        5580 :             pSpar_md_com_cfg->quant_strat[i].P_c.max_fx = 214748364; //.8*Q28
     290        5580 :             move32();
     291             :         }
     292             :         ELSE
     293             :         {
     294        9969 :             pSpar_md_com_cfg->quant_strat[i].PR.q_levels[0] = PQ_q_lvl;
     295        9969 :             move16();
     296        9969 :             pSpar_md_com_cfg->quant_strat[i].PR.q_levels[1] = PQ_q_lvl;
     297        9969 :             move16();
     298        9969 :             pSpar_md_com_cfg->quant_strat[i].PR.max_fx = ONE_IN_Q28; // 1 Q28
     299        9969 :             move32();
     300        9969 :             pSpar_md_com_cfg->quant_strat[i].PR.min_fx = -ONE_IN_Q28; //-1 Q28
     301        9969 :             move32();
     302             : 
     303        9969 :             pSpar_md_com_cfg->quant_strat[i].C.q_levels[0] = C_q_lvl;
     304        9969 :             move16();
     305        9969 :             pSpar_md_com_cfg->quant_strat[i].C.q_levels[1] = C_q_lvl;
     306        9969 :             move16();
     307        9969 :             pSpar_md_com_cfg->quant_strat[i].C.max_fx = ONE_IN_Q29; // 2 Q28
     308        9969 :             move32();
     309        9969 :             pSpar_md_com_cfg->quant_strat[i].C.min_fx = -ONE_IN_Q29; //-2 Q28
     310        9969 :             move32();
     311             : 
     312        9969 :             pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[0] = Pr_q_lvl;
     313        9969 :             move16();
     314        9969 :             pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[1] = Pr_q_lvl;
     315        9969 :             move16();
     316        9969 :             pSpar_md_com_cfg->quant_strat[i].P_r.max_fx = ONE_IN_Q28; // 1 Q28
     317        9969 :             move32();
     318        9969 :             pSpar_md_com_cfg->quant_strat[i].P_r.min_fx = 0; // Q28
     319        9969 :             move32();
     320             : 
     321        9969 :             pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[0] = Pc_q_lvl;
     322        9969 :             move16();
     323        9969 :             pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[1] = Pc_q_lvl;
     324        9969 :             move16();
     325        9969 :             pSpar_md_com_cfg->quant_strat[i].P_c.max_fx = ONE_IN_Q27; // 0.5 Q28
     326        9969 :             move32();
     327        9969 :             pSpar_md_com_cfg->quant_strat[i].P_c.min_fx = -ONE_IN_Q27; //-0.5 Q28
     328        9969 :             move32();
     329             :         }
     330             :     }
     331             : 
     332        5183 :     return;
     333             : }
     334             : 
     335             : 
     336             : /*-----------------------------------------------------------------------------------------*
     337             :  * Function ivas_map_prior_coeffs_quant()
     338             :  *
     339             :  * Map prior coeffs
     340             :  *-----------------------------------------------------------------------------------------*/
     341      159592 : void ivas_map_prior_coeffs_quant(
     342             :     ivas_spar_md_prev_t *pSpar_md_prior,
     343             :     ivas_spar_md_com_cfg *pSpar_md_cfg,
     344             :     const Word16 qsi,
     345             :     const Word16 nB )
     346             : {
     347             :     Word16 i, j;
     348             : 
     349      159592 :     IF( NE_16( qsi, pSpar_md_cfg->prev_quant_idx ) )
     350             :     {
     351        1850 :         ivas_quant_strat_t qs = pSpar_md_cfg->quant_strat[qsi];
     352        1850 :         ivas_quant_strat_t prev_qs = pSpar_md_cfg->quant_strat[pSpar_md_cfg->prev_quant_idx];
     353        1850 :         Word32 one_by_q_lvl_PR_fx = one_by_q_level[max( ( prev_qs.PR.q_levels[0] - 1 ), 1 )]; /*q31*/
     354        1850 :         move32();
     355        1850 :         Word32 one_by_q_lvl_C_fx = one_by_q_level[max( ( prev_qs.C.q_levels[0] - 1 ), 1 )]; /*q31*/
     356        1850 :         move32();
     357        1850 :         Word32 one_by_q_lvl_P_r_fx = one_by_q_level[max( ( prev_qs.P_r.q_levels[0] - 1 ), 1 )]; /*q31*/
     358        1850 :         move32();
     359       16650 :         FOR( i = 0; i < nB; i++ )
     360             :         {
     361      162800 :             FOR( j = 0; j < IVAS_SPAR_MAX_CH - 1; j++ )
     362             :             {
     363      148000 :                 Word32 trial1 = L_mult0( sub( qs.PR.q_levels[0], 1 ), pSpar_md_prior->band_coeffs_idx[i].pred_index_re[j] ); /*q0*/
     364      148000 :                 trial1 = L_shl( trial1, 16 );                                                                                /*q16*/
     365      148000 :                 trial1 = round_fx( Mpy_32_32( trial1, one_by_q_lvl_PR_fx ) );                                                /*q16+q31-31-16->0*/
     366      148000 :                 pSpar_md_prior->band_coeffs_idx_mapped[i].pred_index_re[j] = extract_l( trial1 );                            /*q0*/
     367      148000 :                 move16();
     368      148000 :                 Word32 trial2 = L_mult0( sub( qs.P_r.q_levels[0], 1 ), pSpar_md_prior->band_coeffs_idx[i].decd_index_re[j] ); /*q0*/
     369      148000 :                 trial2 = L_shl( trial2, 16 );                                                                                 /*q16*/
     370      148000 :                 trial2 = round_fx( Mpy_32_32( trial2, one_by_q_lvl_P_r_fx ) );                                                /*q16+q31-31-16->0*/
     371      148000 :                 pSpar_md_prior->band_coeffs_idx_mapped[i].decd_index_re[j] = extract_l( trial2 );                             /*q0*/
     372      148000 :                 move16();
     373             :             }
     374      325600 :             FOR( j = 0; j < IVAS_SPAR_MAX_C_COEFF; j++ )
     375             :             {
     376      310800 :                 Word32 trial1 = L_mult0( sub( qs.C.q_levels[0], 1 ), pSpar_md_prior->band_coeffs_idx[i].drct_index_re[j] ); /*q0*/
     377      310800 :                 trial1 = L_shl( trial1, 16 );                                                                               /*q16*/
     378      310800 :                 trial1 = round_fx( Mpy_32_32( trial1, one_by_q_lvl_C_fx ) );                                                /*q16+q31-31-16->0*/
     379      310800 :                 pSpar_md_prior->band_coeffs_idx_mapped[i].drct_index_re[j] = extract_l( trial1 );                           /*q0*/
     380      310800 :                 move16();
     381             :             }
     382             :         }
     383             :     }
     384             :     ELSE
     385             :     {
     386     1419678 :         FOR( i = 0; i < nB; i++ )
     387             :         {
     388    13881296 :             FOR( j = 0; j < IVAS_SPAR_MAX_CH - 1; j++ )
     389             :             {
     390    12619360 :                 pSpar_md_prior->band_coeffs_idx_mapped[i].pred_index_re[j] = pSpar_md_prior->band_coeffs_idx[i].pred_index_re[j];
     391    12619360 :                 move16();
     392    12619360 :                 pSpar_md_prior->band_coeffs_idx_mapped[i].decd_index_re[j] = pSpar_md_prior->band_coeffs_idx[i].decd_index_re[j];
     393    12619360 :                 move16();
     394             :             }
     395    27762592 :             FOR( j = 0; j < IVAS_SPAR_MAX_C_COEFF; j++ )
     396             :             {
     397    26500656 :                 pSpar_md_prior->band_coeffs_idx_mapped[i].drct_index_re[j] = pSpar_md_prior->band_coeffs_idx[i].drct_index_re[j];
     398    26500656 :                 move16();
     399             :             }
     400             :         }
     401             :     }
     402             : 
     403      159592 :     return;
     404             : }
     405             : 
     406             : /*-----------------------------------------------------------------------------------------*
     407             :  * Function ivas_spar_quant_dtx_init()
     408             :  *
     409             :  * Init SPAR MD with minmax vals
     410             :  *-----------------------------------------------------------------------------------------*/
     411        1907 : void ivas_spar_quant_dtx_init_fx(
     412             :     ivas_spar_md_t *spar_md,
     413             :     Word32 *min_max /*q28*/ )
     414             : {
     415        1907 :     spar_md->min_max_fx[0] = min_max[0]; // q28
     416        1907 :     move32();
     417        1907 :     spar_md->min_max_fx[1] = min_max[1]; // q28
     418        1907 :     move32();
     419             : 
     420        1907 :     return;
     421             : }
     422             : 
     423             : /*-----------------------------------------------------------------------------------------*
     424             :  * Function ivas_copy_band_coeffs_idx_to_arr()
     425             :  *
     426             :  * Copy pred band coeffs to arr
     427             :  *-----------------------------------------------------------------------------------------*/
     428             : 
     429     1617057 : void ivas_copy_band_coeffs_idx_to_arr(
     430             :     ivas_band_coeffs_ind_t *pBands_idx,
     431             :     const Word16 nB,
     432             :     Word16 *pSymbol_re,
     433             :     ivas_cell_dim_t *pCell_dims,
     434             :     const ivas_coeffs_type_t coeff_type )
     435             : {
     436             :     Word16 i, len;
     437     1617057 :     Word16 *pPtr_idx = NULL;
     438             : 
     439    14539229 :     FOR( i = 0; i < nB; i++ )
     440             :     {
     441    12922172 :         SWITCH( coeff_type )
     442             :         {
     443     3283304 :             case PRED_COEFF:
     444             :             {
     445     3283304 :                 pPtr_idx = pBands_idx[i].pred_index_re;
     446     3283304 :                 BREAK;
     447             :             }
     448     3275728 :             case DRCT_COEFF:
     449             :             {
     450     3275728 :                 pPtr_idx = pBands_idx[i].drct_index_re;
     451     3275728 :                 BREAK;
     452             :             }
     453     3275664 :             case DECD_COEFF:
     454             :             {
     455     3275664 :                 pPtr_idx = pBands_idx[i].decd_index_re;
     456     3275664 :                 BREAK;
     457             :             }
     458     3087476 :             case DECX_COEFF:
     459             :             {
     460     3087476 :                 BREAK;
     461             :             }
     462             :         }
     463    12922172 :         len = imult1616( pCell_dims[i].dim1, pCell_dims[i].dim2 );
     464    12922172 :         IF( NE_16( coeff_type, DECX_COEFF ) )
     465             :         {
     466     9834696 :             Copy( pPtr_idx, pSymbol_re, len );
     467     9834696 :             pSymbol_re += len;
     468             :         }
     469             :     }
     470             : 
     471             : 
     472     1617057 :     return;
     473             : }
     474             : 
     475             : 
     476             : /*-----------------------------------------------------------------------------------------*
     477             :  * Function ivas_clear_band_coeffs()
     478             :  *
     479             :  * clear band coeffs array in SPAR MD
     480             :  *-----------------------------------------------------------------------------------------*/
     481             : 
     482        5389 : void ivas_clear_band_coeffs_fx(
     483             :     ivas_band_coeffs_t *pband_coeffs,
     484             :     const UWord16 num_bands )
     485             : {
     486             :     UWord16 i;
     487             : 
     488       70057 :     FOR( i = 0; i < num_bands; i++ )
     489             :     {
     490       64668 :         set32_fx( (Word32 *) pband_coeffs[i].C_re_fx, 0, ( IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS ) * ( IVAS_SPAR_MAX_DMX_CHS - 1 ) );
     491       64668 :         set32_fx( (Word32 *) pband_coeffs[i].P_re_fx, 0, ( IVAS_SPAR_MAX_CH - 1 ) );
     492       64668 :         set32_fx( (Word32 *) pband_coeffs[i].C_quant_re_fx, 0, ( IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS ) * ( IVAS_SPAR_MAX_DMX_CHS - 1 ) );
     493       64668 :         set32_fx( (Word32 *) pband_coeffs[i].P_quant_re_fx, 0, ( IVAS_SPAR_MAX_CH - 1 ) );
     494       64668 :         set32_fx( pband_coeffs[i].pred_re_fx, 0, ( IVAS_SPAR_MAX_CH - 1 ) );
     495       64668 :         set32_fx( pband_coeffs[i].pred_quant_re_fx, 0, ( IVAS_SPAR_MAX_CH - 1 ) );
     496             :     }
     497             : 
     498        5389 :     return;
     499             : }
     500             : /*-----------------------------------------------------------------------------------------*
     501             :  * Function ivas_clear_band_coeff_idx()
     502             :  *
     503             :  * clear band coeffs index array in SPAR MD
     504             :  *-----------------------------------------------------------------------------------------*/
     505             : 
     506       10875 : void ivas_clear_band_coeff_idx(
     507             :     ivas_band_coeffs_ind_t *pband_coeff_idx,
     508             :     const UWord16 num_bands )
     509             : {
     510             :     UWord16 i;
     511      141375 :     FOR( i = 0; i < num_bands; i++ )
     512             :     {
     513      130500 :         set16_fx( pband_coeff_idx[i].pred_index_re, 0, ( sub( IVAS_SPAR_MAX_CH, 1 ) ) );
     514      130500 :         set16_fx( pband_coeff_idx[i].drct_index_re, 0, IVAS_SPAR_MAX_C_COEFF );
     515      130500 :         set16_fx( pband_coeff_idx[i].decd_index_re, 0, sub( IVAS_SPAR_MAX_CH, 1 ) );
     516             :     }
     517             : 
     518       10875 :     return;
     519             : }

Generated by: LCOV version 1.14