LCOV - code coverage report
Current view: top level - lib_isar - isar_PredDecoder.c (source / functions) Hit Total Coverage
Test: Coverage on main -- merged total coverage @ efe53129c9ed87a5067dd0a8fb9dca41db9c4add Lines: 160 183 87.4 %
Date: 2026-02-12 08:06:51 Functions: 7 7 100.0 %

          Line data    Source code
       1             : /******************************************************************************************************
       2             : 
       3             :    (C) 2022-2026 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.h"
      37             : #include "isar_prot.h"
      38             : #include "isar_lcld_prot.h"
      39             : #include "isar_rom_lcld_tables.h"
      40             : #include "wmc_auto.h"
      41             : 
      42             : 
      43             : /*-------------------------------------------------------------------*
      44             :  * Function CreatePredictionDecoder()
      45             :  *
      46             :  *
      47             :  *-------------------------------------------------------------------*/
      48             : 
      49        2149 : ivas_error CreatePredictionDecoder(
      50             :     PredictionDecoder **psPredictionDecoder_out,
      51             :     const int32_t iChannels,
      52             :     const int32_t iNumBlocks )
      53             : {
      54             :     int16_t n;
      55             :     int16_t m;
      56        2149 :     PredictionDecoder *psPredictionDecoder = NULL;
      57             : 
      58        2149 :     if ( ( psPredictionDecoder = (PredictionDecoder *) malloc( sizeof( PredictionDecoder ) ) ) == NULL )
      59             :     {
      60           0 :         return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
      61             :     }
      62             : 
      63        2149 :     psPredictionDecoder->iChannels = iChannels;
      64        2149 :     psPredictionDecoder->iNumBlocks = iNumBlocks;
      65        2149 :     psPredictionDecoder->iNumSubSets = LCLD_BLOCKS_PER_FRAME / psPredictionDecoder->iNumBlocks;
      66        2149 :     psPredictionDecoder->iSubSetId = 0;
      67             : 
      68             :     /* PLC_IMPROVEMENT */
      69        2149 :     if ( ( psPredictionDecoder->ppiDecodingFailedPrev = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ) ) == NULL )
      70             :     {
      71           0 :         return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD decoder Module \n" ) );
      72             :     }
      73        2149 :     if ( ( psPredictionDecoder->ppiDecodingFailed = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ) ) == NULL )
      74             :     {
      75           0 :         return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD decoder Module \n" ) );
      76             :     }
      77        2149 :     if ( ( psPredictionDecoder->ppiDecodingUnresolved = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ) ) == NULL )
      78             :     {
      79           0 :         return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD decoder Module \n" ) );
      80             :     }
      81             : 
      82        6447 :     for ( n = 0; n < iChannels; n++ )
      83             :     {
      84             :         int32_t k;
      85        4298 :         if ( ( psPredictionDecoder->ppiDecodingUnresolved[n] = (int32_t *) malloc( sizeof( int32_t ) * LCLD_MAX_NUM_PRED_SUBSETS ) ) == NULL )
      86             :         {
      87           0 :             return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD decoder Module \n" ) );
      88             :         }
      89        4298 :         if ( ( psPredictionDecoder->ppiDecodingFailed[n] = (int32_t *) malloc( sizeof( int32_t ) * LCLD_MAX_NUM_PRED_SUBSETS ) ) == NULL )
      90             :         {
      91           0 :             return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD decoder Module \n" ) );
      92             :         }
      93        4298 :         if ( ( psPredictionDecoder->ppiDecodingFailedPrev[n] = (int32_t *) malloc( sizeof( int32_t ) * LCLD_MAX_NUM_PRED_SUBSETS ) ) == NULL )
      94             :         {
      95           0 :             return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD decoder Module \n" ) );
      96             :         }
      97       38682 :         for ( k = 0; k < LCLD_MAX_NUM_PRED_SUBSETS; k++ )
      98             :         {
      99       34384 :             psPredictionDecoder->ppiDecodingUnresolved[n][k] = 0;
     100       34384 :             psPredictionDecoder->ppiDecodingFailed[n][k] = 0;
     101       34384 :             psPredictionDecoder->ppiDecodingFailedPrev[n][k] = 0;
     102             :         }
     103             :     }
     104             : 
     105        2149 :     if ( ( psPredictionDecoder->piPredChanEnable = (int32_t *) malloc( sizeof( int32_t ) * iChannels ) ) == NULL )
     106             :     {
     107           0 :         return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
     108             :     }
     109        2149 :     if ( ( psPredictionDecoder->ppiPredBandEnable = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ) ) == NULL )
     110             :     {
     111           0 :         return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
     112             :     }
     113        2149 :     if ( ( psPredictionDecoder->ppfA1Real = (float **) malloc( sizeof( float * ) * iChannels ) ) == NULL )
     114             :     {
     115           0 :         return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
     116             :     }
     117        2149 :     if ( ( psPredictionDecoder->ppfA1Imag = (float **) malloc( sizeof( float * ) * iChannels ) ) == NULL )
     118             :     {
     119           0 :         return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
     120             :     }
     121        2149 :     if ( ( psPredictionDecoder->ppiA1Mag = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ) ) == NULL )
     122             :     {
     123           0 :         return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
     124             :     }
     125        2149 :     if ( ( psPredictionDecoder->ppiA1Phase = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ) ) == NULL )
     126             :     {
     127           0 :         return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
     128             :     }
     129        2149 :     if ( ( psPredictionDecoder->ppfPredStateReal = (float **) malloc( sizeof( float * ) * iChannels ) ) == NULL )
     130             :     {
     131           0 :         return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD decoder Module \n" ) );
     132             :     }
     133        2149 :     if ( ( psPredictionDecoder->ppfPredStateImag = (float **) malloc( sizeof( float * ) * iChannels ) ) == NULL )
     134             :     {
     135           0 :         return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD decoder Module \n" ) );
     136             :     }
     137             : 
     138        6447 :     for ( n = 0; n < psPredictionDecoder->iChannels; n++ )
     139             :     {
     140        4298 :         psPredictionDecoder->piPredChanEnable[n] = 0;
     141        4298 :         if ( ( psPredictionDecoder->ppiPredBandEnable[n] = (int32_t *) malloc( LCLD_BANDS * sizeof( int32_t ) ) ) == NULL )
     142             :         {
     143           0 :             return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
     144             :         }
     145      262178 :         for ( m = 0; m < LCLD_BANDS; m++ )
     146             :         {
     147      257880 :             psPredictionDecoder->ppiPredBandEnable[n][m] = 0;
     148             :         }
     149        4298 :         if ( ( psPredictionDecoder->ppfA1Real[n] = (float *) malloc( sizeof( float ) * LCLD_BANDS ) ) == NULL )
     150             :         {
     151           0 :             return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
     152             :         }
     153        4298 :         if ( ( psPredictionDecoder->ppfA1Imag[n] = (float *) malloc( sizeof( float ) * LCLD_BANDS ) ) == NULL )
     154             :         {
     155           0 :             return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
     156             :         }
     157        4298 :         if ( ( psPredictionDecoder->ppiA1Mag[n] = (int32_t *) malloc( sizeof( int32_t ) * LCLD_BANDS ) ) == NULL )
     158             :         {
     159           0 :             return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
     160             :         }
     161        4298 :         if ( ( psPredictionDecoder->ppiA1Phase[n] = (int32_t *) malloc( sizeof( int32_t ) * LCLD_BANDS ) ) == NULL )
     162             :         {
     163           0 :             return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
     164             :         }
     165        4298 :         if ( ( psPredictionDecoder->ppfPredStateReal[n] = (float *) malloc( LCLD_BANDS * sizeof( float ) ) ) == NULL )
     166             :         {
     167           0 :             return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionDecoder Module \n" ) );
     168             :         }
     169        4298 :         if ( ( psPredictionDecoder->ppfPredStateImag[n] = (float *) malloc( LCLD_BANDS * sizeof( float ) ) ) == NULL )
     170             :         {
     171           0 :             return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionDecoder Module \n" ) );
     172             :         }
     173      262178 :         for ( m = 0; m < LCLD_BANDS; m++ )
     174             :         {
     175      257880 :             psPredictionDecoder->ppfPredStateReal[n][m] = 0;
     176      257880 :             psPredictionDecoder->ppfPredStateImag[n][m] = 0;
     177             :         }
     178             :     }
     179             : 
     180             :     /* pre-define these tables? */
     181       19341 :     for ( n = 0; n < ( 1 << PRED_QUNAT_FILTER_MAG_BITS ); n++ )
     182             :     {
     183       17192 :         const float fInvMagScale = M_PI / ( 2.0f * (float) ( 1 << ( PRED_QUNAT_FILTER_MAG_BITS ) ) + 1.0f );
     184       17192 :         psPredictionDecoder->pfMagLUT[n] = sinf( fInvMagScale * (float) n );
     185             :     }
     186             : 
     187       70917 :     for ( n = 0; n < ( 1 << PRED_QUANT_FILTER_PHASE_BITS ); n++ )
     188             :     {
     189       68768 :         const float fInvPhaseScale = M_PI / (float) ( 1 << ( PRED_QUANT_FILTER_PHASE_BITS - 1 ) );
     190             :         int16_t iVal;
     191             : 
     192       68768 :         iVal = n + PRED_QUANT_FILTER_PHASE_MIN;
     193       68768 :         psPredictionDecoder->pfP2RRealLUT[n] = cosf( fInvPhaseScale * (float) iVal );
     194       68768 :         psPredictionDecoder->pfP2RImagLUT[n] = sinf( fInvPhaseScale * (float) iVal );
     195             :     }
     196             : 
     197        2149 :     *psPredictionDecoder_out = psPredictionDecoder;
     198             : 
     199        2149 :     return IVAS_ERR_OK;
     200             : }
     201             : 
     202             : 
     203             : /*-------------------------------------------------------------------*
     204             :  * Function DeletePredictionDecoder()
     205             :  *
     206             :  *
     207             :  *-------------------------------------------------------------------*/
     208             : 
     209        2149 : void DeletePredictionDecoder(
     210             :     PredictionDecoder *psPredictionDecoder )
     211             : {
     212             :     int32_t n;
     213             : 
     214        6447 :     for ( n = 0; n < psPredictionDecoder->iChannels; n++ )
     215             :     {
     216        4298 :         free( psPredictionDecoder->ppiPredBandEnable[n] );
     217        4298 :         free( psPredictionDecoder->ppfA1Real[n] );
     218        4298 :         free( psPredictionDecoder->ppfA1Imag[n] );
     219        4298 :         free( psPredictionDecoder->ppiA1Mag[n] );
     220        4298 :         free( psPredictionDecoder->ppiA1Phase[n] );
     221        4298 :         free( psPredictionDecoder->ppfPredStateReal[n] );
     222        4298 :         free( psPredictionDecoder->ppfPredStateImag[n] );
     223             :         /* PLC_IMPROVEMENT */
     224        4298 :         free( psPredictionDecoder->ppiDecodingUnresolved[n] );
     225        4298 :         free( psPredictionDecoder->ppiDecodingFailed[n] );
     226        4298 :         free( psPredictionDecoder->ppiDecodingFailedPrev[n] );
     227             :     }
     228        2149 :     free( psPredictionDecoder->piPredChanEnable );
     229        2149 :     free( psPredictionDecoder->ppiPredBandEnable );
     230        2149 :     free( psPredictionDecoder->ppfA1Real );
     231        2149 :     free( psPredictionDecoder->ppfA1Imag );
     232        2149 :     free( psPredictionDecoder->ppiA1Mag );
     233        2149 :     free( psPredictionDecoder->ppiA1Phase );
     234        2149 :     free( psPredictionDecoder->ppfPredStateReal );
     235        2149 :     free( psPredictionDecoder->ppfPredStateImag );
     236             :     /* PLC_IMPROVEMENT */
     237        2149 :     free( psPredictionDecoder->ppiDecodingUnresolved );
     238        2149 :     free( psPredictionDecoder->ppiDecodingFailed );
     239        2149 :     free( psPredictionDecoder->ppiDecodingFailedPrev );
     240             : 
     241        2149 :     free( psPredictionDecoder );
     242        2149 :     psPredictionDecoder = NULL;
     243             : 
     244        2149 :     return;
     245             : }
     246             : 
     247             : 
     248             : /*-------------------------------------------------------------------*
     249             :  * Function ReadPredictors()
     250             :  *
     251             :  *
     252             :  *-------------------------------------------------------------------*/
     253             : 
     254      335441 : int16_t ReadPredictors(
     255             :     PredictionDecoder *psPredictionDecoder,
     256             :     ISAR_SPLIT_REND_BITS_HANDLE pBits )
     257             : {
     258      335441 :     int16_t iBitsRead = 0;
     259             :     int32_t c;
     260             :     int32_t b;
     261      335441 :     int16_t iNumPredBandBits = 6;
     262      335441 :     const int16_t iSubSetBits = ( LCLD_MAX_NUM_PRED_SUBSETS > 4 ? 3 : 2 );
     263             : 
     264      335441 :     psPredictionDecoder->iNumSubSets = ISAR_SPLIT_REND_BITStream_read_int32( pBits, iSubSetBits ) + 1;
     265      335441 :     iBitsRead += iSubSetBits;
     266             : 
     267      335441 :     if ( psPredictionDecoder->iNumSubSets > 1 )
     268             :     {
     269       22522 :         psPredictionDecoder->iSubSetId = ISAR_SPLIT_REND_BITStream_read_int32( pBits, iSubSetBits );
     270       22522 :         iBitsRead += iSubSetBits;
     271       22522 :         iNumPredBandBits = ( psPredictionDecoder->iNumSubSets >= 4 ? 4 : 5 );
     272             :     }
     273             :     else
     274             :     {
     275      312919 :         psPredictionDecoder->iSubSetId = 0;
     276             :     }
     277             : 
     278     1006323 :     for ( c = 0; c < psPredictionDecoder->iChannels; c++ )
     279             :     {
     280      670882 :         psPredictionDecoder->piPredChanEnable[c] = ISAR_SPLIT_REND_BITStream_read_int32( pBits, psPredictionDecoder->iNumSubSets );
     281      670882 :         iBitsRead += (int16_t) psPredictionDecoder->iNumSubSets;
     282             : 
     283      670882 :         if ( get_bit( psPredictionDecoder->piPredChanEnable[c], psPredictionDecoder->iSubSetId ) )
     284             :         {
     285      325127 :             int32_t b0 = psPredictionDecoder->iSubSetId;
     286      325127 :             int32_t bstep = psPredictionDecoder->iNumSubSets;
     287             :             int32_t iNumPredBands;
     288             : 
     289    19435517 :             for ( b = b0; b < LCLD_BANDS; b += bstep )
     290             :             {
     291    19110390 :                 psPredictionDecoder->ppiPredBandEnable[c][b] = 0;
     292             :             }
     293      325127 :             iNumPredBands = ISAR_SPLIT_REND_BITStream_read_int32( pBits, iNumPredBandBits );
     294      325127 :             iBitsRead += iNumPredBandBits;
     295      325127 :             iNumPredBands = iNumPredBands * psPredictionDecoder->iNumSubSets + b0;
     296             : 
     297     4565697 :             for ( b = b0; b < iNumPredBands; b += bstep )
     298             :             {
     299     4240570 :                 psPredictionDecoder->ppiPredBandEnable[c][b] = ISAR_SPLIT_REND_BITStream_read_int32( pBits, 1 );
     300     4240570 :                 iBitsRead += 1;
     301             : 
     302     4240570 :                 if ( psPredictionDecoder->ppiPredBandEnable[c][b] == 1 )
     303             :                 {
     304             :                     int32_t iA1Mag;
     305             :                     int32_t iA1Phase;
     306             :                     float fA1Real;
     307             :                     float fA1Imag;
     308     1999458 :                     iA1Mag = ISAR_SPLIT_REND_BITStream_read_int32( pBits, PRED_QUNAT_FILTER_MAG_BITS );
     309     1999458 :                     iBitsRead += PRED_QUNAT_FILTER_MAG_BITS;
     310     1999458 :                     iA1Phase = ISAR_SPLIT_REND_BITStream_read_int32( pBits, PRED_QUANT_FILTER_PHASE_BITS );
     311     1999458 :                     iBitsRead += PRED_QUANT_FILTER_PHASE_BITS;
     312             : 
     313     1999458 :                     psPredictionDecoder->ppiA1Mag[c][b] = iA1Mag;
     314     1999458 :                     psPredictionDecoder->ppiA1Phase[c][b] = iA1Phase + PRED_QUANT_FILTER_PHASE_MIN;
     315             : 
     316     1999458 :                     fA1Real = psPredictionDecoder->pfMagLUT[iA1Mag] * psPredictionDecoder->pfP2RRealLUT[iA1Phase];
     317     1999458 :                     fA1Imag = psPredictionDecoder->pfMagLUT[iA1Mag] * psPredictionDecoder->pfP2RImagLUT[iA1Phase];
     318             : 
     319     1999458 :                     psPredictionDecoder->ppfA1Real[c][b] = fA1Real;
     320     1999458 :                     psPredictionDecoder->ppfA1Imag[c][b] = fA1Imag;
     321             :                 }
     322             :             }
     323             :         }
     324             :     }
     325             : 
     326             :     /* disable any inactive prediction bands */
     327     1006323 :     for ( c = 0; c < psPredictionDecoder->iChannels; c++ )
     328             :     {
     329             :         int32_t set;
     330     1431856 :         for ( set = 0; set < psPredictionDecoder->iNumSubSets; set++ )
     331             :         {
     332      760974 :             if ( !get_bit( psPredictionDecoder->piPredChanEnable[c], set ) )
     333             :             {
     334    21162925 :                 for ( b = set; b < LCLD_BANDS; b += psPredictionDecoder->iNumSubSets )
     335             :                 {
     336    20745780 :                     psPredictionDecoder->ppiPredBandEnable[c][b] = 0;
     337             :                 }
     338             :             }
     339             :         }
     340             :     }
     341             : 
     342      335441 :     return iBitsRead;
     343             : }
     344             : 
     345             : 
     346             : /*-------------------------------------------------------------------*
     347             :  * Function AnyDecodingUnresolved()
     348             :  *
     349             :  *
     350             :  *-------------------------------------------------------------------*/
     351             : 
     352      335441 : int32_t AnyDecodingUnresolved(
     353             :     PredictionDecoder *psPredictionDecoder )
     354             : {
     355             :     int32_t n, ch;
     356     1006323 :     for ( ch = 0; ch < psPredictionDecoder->iChannels; ch++ )
     357             :     {
     358     1431856 :         for ( n = 0; n < psPredictionDecoder->iNumSubSets; n++ )
     359             :         {
     360      760974 :             if ( psPredictionDecoder->ppiDecodingUnresolved[ch][n] == 1 )
     361             :             {
     362           0 :                 return 1;
     363             :             }
     364             :         }
     365             :     }
     366      335441 :     return 0;
     367             : }
     368             : 
     369             : 
     370             : /*-------------------------------------------------------------------*
     371             :  * Function UpdateDecodingFailedStatus()
     372             :  *
     373             :  *
     374             :  *-------------------------------------------------------------------*/
     375             : 
     376      335441 : void UpdateDecodingFailedStatus(
     377             :     PredictionDecoder *psPredictionDecoder )
     378             : {
     379             :     int32_t n, ch;
     380             : 
     381     1006323 :     for ( ch = 0; ch < psPredictionDecoder->iChannels; ch++ )
     382             :     {
     383     1431856 :         for ( n = 0; n < psPredictionDecoder->iNumSubSets; n++ )
     384             :         {
     385      760974 :             psPredictionDecoder->ppiDecodingFailedPrev[ch][n] = psPredictionDecoder->ppiDecodingFailed[ch][n];
     386             :         }
     387             :     }
     388             : 
     389      335441 :     return;
     390             : }
     391             : 
     392             : 
     393             : /*-------------------------------------------------------------------*
     394             :  * Function UpdateDecodingUnresolved()
     395             :  *
     396             :  *
     397             :  *-------------------------------------------------------------------*/
     398             : 
     399      335441 : void UpdateDecodingUnresolved(
     400             :     PredictionDecoder *psPredictionDecoder )
     401             : {
     402             :     int32_t n, ch;
     403             : 
     404      335441 :     int32_t iCurrentSubSet = psPredictionDecoder->iSubSetId;
     405             : 
     406     1006323 :     for ( ch = 0; ch < psPredictionDecoder->iChannels; ch++ )
     407             :     {
     408             :         /* Prediction data always available for current subset */
     409      670882 :         psPredictionDecoder->ppiDecodingUnresolved[ch][iCurrentSubSet] = 0;
     410             : 
     411     1431856 :         for ( n = 0; n < psPredictionDecoder->iNumSubSets; n++ )
     412             :         {
     413      760974 :             int32_t iSubSetActive = get_bit( psPredictionDecoder->piPredChanEnable[ch], n );
     414      760974 :             if ( iSubSetActive == 0 )
     415             :             {
     416             :                 /* Prediction information available inactive subsets (e.g. no Prediction) */
     417      417145 :                 psPredictionDecoder->ppiDecodingUnresolved[ch][n] = 0;
     418             :             }
     419             :         }
     420             :     }
     421             : 
     422      335441 :     return;
     423             : }
     424             : 
     425             : 
     426             : /*-------------------------------------------------------------------*
     427             :  * Function ApplyInversePredictors()
     428             :  *
     429             :  *
     430             :  *-------------------------------------------------------------------*/
     431             : 
     432      335441 : void ApplyInversePredictors(
     433             :     PredictionDecoder *psPredictionDecoder,
     434             :     float ***pppfReal,
     435             :     float ***pppfImag )
     436             : {
     437             :     int32_t c;
     438             : 
     439     1006323 :     for ( c = 0; c < psPredictionDecoder->iChannels; c++ )
     440             :     {
     441      670882 :         if ( psPredictionDecoder->piPredChanEnable[c] > 0 )
     442             :         {
     443             :             int32_t b;
     444    20628187 :             for ( b = 0; b < LCLD_BANDS; b++ )
     445             :             {
     446    20290020 :                 if ( psPredictionDecoder->ppiPredBandEnable[c][b] == 1 )
     447             :                 {
     448             :                     int32_t n;
     449             :                     float fA1Real;
     450             :                     float fA1Imag;
     451     2042684 :                     float fPrevReal = 0.0f;
     452     2042684 :                     float fPrevImag = 0.0f;
     453     2042684 :                     int32_t iSubset = b % psPredictionDecoder->iNumSubSets;
     454             : 
     455     2042684 :                     if ( iSubset != psPredictionDecoder->iSubSetId )
     456             :                     {
     457       43226 :                         fPrevReal = psPredictionDecoder->ppfPredStateReal[c][b];
     458       43226 :                         fPrevImag = psPredictionDecoder->ppfPredStateImag[c][b];
     459             :                     }
     460             : 
     461     2042684 :                     fA1Real = psPredictionDecoder->ppfA1Real[c][b];
     462     2042684 :                     fA1Imag = psPredictionDecoder->ppfA1Imag[c][b];
     463    34033772 :                     for ( n = 0; n < psPredictionDecoder->iNumBlocks; n++ )
     464             :                     {
     465             :                         float fReal;
     466             :                         float fImag;
     467             : 
     468    31991088 :                         fReal = pppfReal[c][n][b] - fA1Real * fPrevReal + fA1Imag * fPrevImag;
     469    31991088 :                         fImag = pppfImag[c][n][b] - fA1Real * fPrevImag - fA1Imag * fPrevReal;
     470             : 
     471    31991088 :                         pppfReal[c][n][b] = fReal;
     472    31991088 :                         pppfImag[c][n][b] = fImag;
     473             : 
     474    31991088 :                         fPrevReal = fReal;
     475    31991088 :                         fPrevImag = fImag;
     476             :                     }
     477     2042684 :                     psPredictionDecoder->ppfPredStateReal[c][b] = fPrevReal;
     478     2042684 :                     psPredictionDecoder->ppfPredStateImag[c][b] = fPrevImag;
     479             :                 }
     480             :             }
     481             :         }
     482             :     }
     483             : 
     484      335441 :     return;
     485             : }

Generated by: LCOV version 1.14