| OLD | NEW | 
|    1 /* |    1 /* | 
|    2  *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |    2  *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 
|    3  * |    3  * | 
|    4  *  Use of this source code is governed by a BSD-style license |    4  *  Use of this source code is governed by a BSD-style license | 
|    5  *  that can be found in the LICENSE file in the root of the source |    5  *  that can be found in the LICENSE file in the root of the source | 
|    6  *  tree. An additional intellectual property rights grant can be found |    6  *  tree. An additional intellectual property rights grant can be found | 
|    7  *  in the file PATENTS.  All contributing project authors may |    7  *  in the file PATENTS.  All contributing project authors may | 
|    8  *  be found in the AUTHORS file in the root of the source tree. |    8  *  be found in the AUTHORS file in the root of the source tree. | 
|    9  */ |    9  */ | 
|   10  |   10  | 
| (...skipping 26 matching lines...) Expand all  Loading... | 
|   37  *---------------------------------------------------------------*/ |   37  *---------------------------------------------------------------*/ | 
|   38  |   38  | 
|   39 void WebRtcIlbcfix_DecodeImpl( |   39 void WebRtcIlbcfix_DecodeImpl( | 
|   40     int16_t *decblock,    /* (o) decoded signal block */ |   40     int16_t *decblock,    /* (o) decoded signal block */ | 
|   41     const uint16_t *bytes, /* (i) encoded signal bits */ |   41     const uint16_t *bytes, /* (i) encoded signal bits */ | 
|   42     IlbcDecoder *iLBCdec_inst, /* (i/o) the decoder state |   42     IlbcDecoder *iLBCdec_inst, /* (i/o) the decoder state | 
|   43                                            structure */ |   43                                            structure */ | 
|   44     int16_t mode      /* (i) 0: bad packet, PLC, |   44     int16_t mode      /* (i) 0: bad packet, PLC, | 
|   45                                                                    1: normal */ |   45                                                                    1: normal */ | 
|   46                            ) { |   46                            ) { | 
|   47   int i; |   47   size_t i; | 
|   48   int16_t order_plus_one; |   48   int16_t order_plus_one; | 
|   49  |   49  | 
|   50   int16_t last_bit; |   50   int16_t last_bit; | 
|   51   int16_t *data; |   51   int16_t *data; | 
|   52   /* Stack based */ |   52   /* Stack based */ | 
|   53   int16_t decresidual[BLOCKL_MAX]; |   53   int16_t decresidual[BLOCKL_MAX]; | 
|   54   int16_t PLCresidual[BLOCKL_MAX + LPC_FILTERORDER]; |   54   int16_t PLCresidual[BLOCKL_MAX + LPC_FILTERORDER]; | 
|   55   int16_t syntdenum[NSUB_MAX*(LPC_FILTERORDER+1)]; |   55   int16_t syntdenum[NSUB_MAX*(LPC_FILTERORDER+1)]; | 
|   56   int16_t PLClpc[LPC_FILTERORDER + 1]; |   56   int16_t PLClpc[LPC_FILTERORDER + 1]; | 
|   57 #ifndef WEBRTC_ARCH_BIG_ENDIAN |   57 #ifndef WEBRTC_ARCH_BIG_ENDIAN | 
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   99       WebRtcIlbcfix_DecoderInterpolateLsp(syntdenum, weightdenum, |   99       WebRtcIlbcfix_DecoderInterpolateLsp(syntdenum, weightdenum, | 
|  100                                           lsfdeq, LPC_FILTERORDER, iLBCdec_inst)
     ; |  100                                           lsfdeq, LPC_FILTERORDER, iLBCdec_inst)
     ; | 
|  101  |  101  | 
|  102       /* Decode the residual using the cb and gain indexes */ |  102       /* Decode the residual using the cb and gain indexes */ | 
|  103       WebRtcIlbcfix_DecodeResidual(iLBCdec_inst, iLBCbits_inst, decresidual, syn
     tdenum); |  103       WebRtcIlbcfix_DecodeResidual(iLBCdec_inst, iLBCbits_inst, decresidual, syn
     tdenum); | 
|  104  |  104  | 
|  105       /* preparing the plc for a future loss! */ |  105       /* preparing the plc for a future loss! */ | 
|  106       WebRtcIlbcfix_DoThePlc( |  106       WebRtcIlbcfix_DoThePlc( | 
|  107           PLCresidual, PLClpc, 0, decresidual, |  107           PLCresidual, PLClpc, 0, decresidual, | 
|  108           syntdenum + (LPC_FILTERORDER + 1) * (iLBCdec_inst->nsub - 1), |  108           syntdenum + (LPC_FILTERORDER + 1) * (iLBCdec_inst->nsub - 1), | 
|  109           (int16_t)(iLBCdec_inst->last_lag), iLBCdec_inst); |  109           iLBCdec_inst->last_lag, iLBCdec_inst); | 
|  110  |  110  | 
|  111       /* Use the output from doThePLC */ |  111       /* Use the output from doThePLC */ | 
|  112       WEBRTC_SPL_MEMCPY_W16(decresidual, PLCresidual, iLBCdec_inst->blockl); |  112       WEBRTC_SPL_MEMCPY_W16(decresidual, PLCresidual, iLBCdec_inst->blockl); | 
|  113     } |  113     } | 
|  114  |  114  | 
|  115   } |  115   } | 
|  116  |  116  | 
|  117   if (mode == 0) { |  117   if (mode == 0) { | 
|  118     /* the data is bad (either a PLC call |  118     /* the data is bad (either a PLC call | 
|  119      * was made or a bit error was detected) |  119      * was made or a bit error was detected) | 
|  120      */ |  120      */ | 
|  121  |  121  | 
|  122     /* packet loss conceal */ |  122     /* packet loss conceal */ | 
|  123  |  123  | 
|  124     WebRtcIlbcfix_DoThePlc(PLCresidual, PLClpc, 1, decresidual, syntdenum, |  124     WebRtcIlbcfix_DoThePlc(PLCresidual, PLClpc, 1, decresidual, syntdenum, | 
|  125                            (int16_t)(iLBCdec_inst->last_lag), iLBCdec_inst); |  125                            iLBCdec_inst->last_lag, iLBCdec_inst); | 
|  126  |  126  | 
|  127     WEBRTC_SPL_MEMCPY_W16(decresidual, PLCresidual, iLBCdec_inst->blockl); |  127     WEBRTC_SPL_MEMCPY_W16(decresidual, PLCresidual, iLBCdec_inst->blockl); | 
|  128  |  128  | 
|  129     order_plus_one = LPC_FILTERORDER + 1; |  129     order_plus_one = LPC_FILTERORDER + 1; | 
|  130  |  130  | 
|  131     for (i = 0; i < iLBCdec_inst->nsub; i++) { |  131     for (i = 0; i < iLBCdec_inst->nsub; i++) { | 
|  132       WEBRTC_SPL_MEMCPY_W16(syntdenum+(i*order_plus_one), |  132       WEBRTC_SPL_MEMCPY_W16(syntdenum+(i*order_plus_one), | 
|  133                             PLClpc, order_plus_one); |  133                             PLClpc, order_plus_one); | 
|  134     } |  134     } | 
|  135   } |  135   } | 
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  181             data+i*SUBL, data+i*SUBL, |  181             data+i*SUBL, data+i*SUBL, | 
|  182             syntdenum+(i-2)*(LPC_FILTERORDER+1), |  182             syntdenum+(i-2)*(LPC_FILTERORDER+1), | 
|  183             LPC_FILTERORDER+1, SUBL); |  183             LPC_FILTERORDER+1, SUBL); | 
|  184       } |  184       } | 
|  185     } |  185     } | 
|  186  |  186  | 
|  187     /* Save the filter state */ |  187     /* Save the filter state */ | 
|  188     WEBRTC_SPL_MEMCPY_W16(iLBCdec_inst->syntMem, &data[iLBCdec_inst->blockl-LPC_
     FILTERORDER], LPC_FILTERORDER); |  188     WEBRTC_SPL_MEMCPY_W16(iLBCdec_inst->syntMem, &data[iLBCdec_inst->blockl-LPC_
     FILTERORDER], LPC_FILTERORDER); | 
|  189  |  189  | 
|  190   } else { /* Enhancer not activated */ |  190   } else { /* Enhancer not activated */ | 
|  191     int16_t lag; |  191     size_t lag; | 
|  192  |  192  | 
|  193     /* Find last lag (since the enhancer is not called to give this info) */ |  193     /* Find last lag (since the enhancer is not called to give this info) */ | 
|  194     lag = 20; |  194     lag = 20; | 
|  195     if (iLBCdec_inst->mode==20) { |  195     if (iLBCdec_inst->mode==20) { | 
|  196       lag = (int16_t)WebRtcIlbcfix_XcorrCoef( |  196       lag = WebRtcIlbcfix_XcorrCoef( | 
|  197           &decresidual[iLBCdec_inst->blockl-60], |  197           &decresidual[iLBCdec_inst->blockl-60], | 
|  198           &decresidual[iLBCdec_inst->blockl-60-lag], |  198           &decresidual[iLBCdec_inst->blockl-60-lag], | 
|  199           60, |  199           60, | 
|  200           80, lag, -1); |  200           80, lag, -1); | 
|  201     } else { |  201     } else { | 
|  202       lag = (int16_t)WebRtcIlbcfix_XcorrCoef( |  202       lag = WebRtcIlbcfix_XcorrCoef( | 
|  203           &decresidual[iLBCdec_inst->blockl-ENH_BLOCKL], |  203           &decresidual[iLBCdec_inst->blockl-ENH_BLOCKL], | 
|  204           &decresidual[iLBCdec_inst->blockl-ENH_BLOCKL-lag], |  204           &decresidual[iLBCdec_inst->blockl-ENH_BLOCKL-lag], | 
|  205           ENH_BLOCKL, |  205           ENH_BLOCKL, | 
|  206           100, lag, -1); |  206           100, lag, -1); | 
|  207     } |  207     } | 
|  208  |  208  | 
|  209     /* Store lag (it is needed if next packet is lost) */ |  209     /* Store lag (it is needed if next packet is lost) */ | 
|  210     (*iLBCdec_inst).last_lag = lag; |  210     (*iLBCdec_inst).last_lag = lag; | 
|  211  |  211  | 
|  212     /* copy data and run synthesis filter */ |  212     /* copy data and run synthesis filter */ | 
| (...skipping 22 matching lines...) Expand all  Loading... | 
|  235  |  235  | 
|  236   WEBRTC_SPL_MEMCPY_W16(iLBCdec_inst->old_syntdenum, |  236   WEBRTC_SPL_MEMCPY_W16(iLBCdec_inst->old_syntdenum, | 
|  237                         syntdenum, iLBCdec_inst->nsub*(LPC_FILTERORDER+1)); |  237                         syntdenum, iLBCdec_inst->nsub*(LPC_FILTERORDER+1)); | 
|  238  |  238  | 
|  239   iLBCdec_inst->prev_enh_pl=0; |  239   iLBCdec_inst->prev_enh_pl=0; | 
|  240  |  240  | 
|  241   if (mode==0) { /* PLC was used */ |  241   if (mode==0) { /* PLC was used */ | 
|  242     iLBCdec_inst->prev_enh_pl=1; |  242     iLBCdec_inst->prev_enh_pl=1; | 
|  243   } |  243   } | 
|  244 } |  244 } | 
| OLD | NEW |