tizen 2.3.1 release
[external/opencore-amr.git] / opencore / codecs_v2 / audio / gsm_amr / amr_nb / dec / src / ph_disp.cpp
1 /* ------------------------------------------------------------------
2  * Copyright (C) 1998-2009 PacketVideo
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13  * express or implied.
14  * See the License for the specific language governing permissions
15  * and limitations under the License.
16  * -------------------------------------------------------------------
17  */
18 /****************************************************************************************
19 Portions of this file are derived from the following 3GPP standard:
20
21     3GPP TS 26.073
22     ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
23     Available from http://www.3gpp.org
24
25 (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
26 Permission to distribute, modify and use this file under the standard license
27 terms listed above has been obtained from the copyright holder.
28 ****************************************************************************************/
29 /*
30 ------------------------------------------------------------------------------
31
32
33
34  Filename: ph_disp.cpp
35  Functions:
36             ph_disp_reset
37             ph_disp_lock
38             ph_disp_release
39             ph_disp
40
41 ------------------------------------------------------------------------------
42  MODULE DESCRIPTION
43
44  This file contains the function that performs adaptive phase dispersion of
45  the excitation signal. The phase dispersion initialization, reset, and
46  exit functions are included in this file, as well as, the phase dispersion
47  lock and release functions.
48
49 ------------------------------------------------------------------------------
50 */
51
52 /*----------------------------------------------------------------------------
53 ; INCLUDES
54 ----------------------------------------------------------------------------*/
55 #include "ph_disp.h"
56 #include "typedef.h"
57 #include "basic_op.h"
58 #include "cnst.h"
59
60 /*----------------------------------------------------------------------------
61 ; MACROS
62 ; Define module specific macros here
63 ----------------------------------------------------------------------------*/
64
65 /*----------------------------------------------------------------------------
66 ; DEFINES
67 ; Include all pre-processor statements here. Include conditional
68 ; compile variables also.
69 ----------------------------------------------------------------------------*/
70
71 /*----------------------------------------------------------------------------
72 ; LOCAL FUNCTION DEFINITIONS
73 ; Function Prototype declaration
74 ----------------------------------------------------------------------------*/
75
76 /*----------------------------------------------------------------------------
77 ; LOCAL VARIABLE DEFINITIONS
78 ; Variable declaration - defined here and used outside this module
79 ----------------------------------------------------------------------------*/
80
81
82 /*
83 ------------------------------------------------------------------------------
84  FUNCTION NAME: ph_disp_reset
85 ------------------------------------------------------------------------------
86  INPUT AND OUTPUT DEFINITIONS
87
88  Inputs:
89     state = pointer to a structure of type ph_dispState
90
91  Outputs:
92     Structure pointed to by state is initialized to zeros
93
94  Returns:
95     return_value = 0, if reset was successful; -1, otherwise (int)
96
97  Global Variables Used:
98     None
99
100  Local Variables Needed:
101     None
102
103 ------------------------------------------------------------------------------
104  FUNCTION DESCRIPTION
105
106  This function resets the variables used by the phase dispersion function.
107
108 ------------------------------------------------------------------------------
109  REQUIREMENTS
110
111  None
112
113 ------------------------------------------------------------------------------
114  REFERENCES
115
116  ph_disp.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
117
118 ------------------------------------------------------------------------------
119  PSEUDO-CODE
120
121 int ph_disp_reset (ph_dispState *state)
122 {
123   Word16 i;
124
125    if (state == (ph_dispState *) NULL){
126       fprint(stderr, "ph_disp_reset: invalid parameter\n");
127       return -1;
128    }
129    for (i=0; i<PHDGAINMEMSIZE; i++)
130    {
131        state->gainMem[i] = 0;
132    }
133    state->prevState = 0;
134    state->prevCbGain = 0;
135    state->lockFull = 0;
136    state->onset = 0;          // assume no onset in start
137
138    return 0;
139 }
140
141 ------------------------------------------------------------------------------
142  CAUTION [optional]
143  [State any special notes, constraints or cautions for users of this function]
144
145 ------------------------------------------------------------------------------
146 */
147
148 Word16 ph_disp_reset(ph_dispState *state)
149 {
150     register Word16 i;
151
152     if (state == (ph_dispState *) NULL)
153     {
154         /*  fprint(stderr, "ph_disp_reset: invalid parameter\n");  */
155         return(-1);
156     }
157     for (i = 0; i < PHDGAINMEMSIZE; i++)
158     {
159         state->gainMem[i] = 0;
160     }
161     state->prevState = 0;
162     state->prevCbGain = 0;
163     state->lockFull = 0;
164     state->onset = 0;          /* assume no onset in start */
165
166     return(0);
167 }
168
169 /****************************************************************************/
170
171 /*
172 ------------------------------------------------------------------------------
173  FUNCTION NAME: ph_disp_lock
174 ------------------------------------------------------------------------------
175  INPUT AND OUTPUT DEFINITIONS
176
177  Inputs:
178     state = pointer to a structure of type ph_dispState
179
180  Outputs:
181     lockFull field of the structure pointed to by state is set to 1
182
183  Returns:
184     None
185
186  Global Variables Used:
187     None
188
189  Local Variables Needed:
190     None
191
192 ------------------------------------------------------------------------------
193  FUNCTION DESCRIPTION
194
195  This function sets the lockFull flag to indicate a lock condition.
196
197 ------------------------------------------------------------------------------
198  REQUIREMENTS
199
200  None
201
202 ------------------------------------------------------------------------------
203  REFERENCES
204
205  ph_disp.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
206
207 ------------------------------------------------------------------------------
208  PSEUDO-CODE
209
210 void ph_disp_lock (ph_dispState *state)
211 {
212   state->lockFull = 1;
213   return;
214 }
215
216 ------------------------------------------------------------------------------
217  CAUTION [optional]
218  [State any special notes, constraints or cautions for users of this function]
219
220 ------------------------------------------------------------------------------
221 */
222
223 void ph_disp_lock(ph_dispState *state)
224 {
225     state->lockFull = 1;
226
227     return;
228 }
229
230 /****************************************************************************/
231
232 /*
233 ------------------------------------------------------------------------------
234  FUNCTION NAME: ph_disp_release
235 ------------------------------------------------------------------------------
236  INPUT AND OUTPUT DEFINITIONS
237
238  Inputs:
239     state = pointer to a structure of type ph_dispState
240
241  Outputs:
242     lockFull field of the structure pointed to by state is set to 0
243
244  Returns:
245     None
246
247  Global Variables Used:
248     None
249
250  Local Variables Needed:
251     None
252
253 ------------------------------------------------------------------------------
254  FUNCTION DESCRIPTION
255
256  This function clears the lockFull flag to indicate an unlocked state.
257
258 ------------------------------------------------------------------------------
259  REQUIREMENTS
260
261  None
262
263 ------------------------------------------------------------------------------
264  REFERENCES
265
266  ph_disp.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
267
268 ------------------------------------------------------------------------------
269  PSEUDO-CODE
270
271 void ph_disp_release (ph_dispState *state)
272 {
273   state->lockFull = 0;
274   return;
275 }
276
277 ------------------------------------------------------------------------------
278  CAUTION [optional]
279  [State any special notes, constraints or cautions for users of this function]
280
281 ------------------------------------------------------------------------------
282 */
283
284 void ph_disp_release(ph_dispState *state)
285 {
286     state->lockFull = 0;
287
288     return;
289 }
290
291 /****************************************************************************/
292
293 /*
294 ------------------------------------------------------------------------------
295  FUNCTION NAME: ph_disp
296 ------------------------------------------------------------------------------
297  INPUT AND OUTPUT DEFINITIONS
298
299  Inputs:
300     state = pointer to a structure of type ph_dispState
301     mode = codec mode (enum Mode)
302     x = LTP excitation signal buffer (Word16)
303     cbGain = codebook gain (Word16)
304     ltpGain = LTP gain (Word16)
305     inno = innovation buffer (Word16)
306     pitch_fac = pitch factor used to scale the LTP excitation (Word16)
307     tmp_shift = shift factor applied to sum of scaled LTP excitation and
308                 innovation before rounding (Word16)
309     pOverflow = pointer to overflow indicator (Flag)
310
311  Outputs:
312     structure pointed to by state contains the updated gainMem array,
313       prevState, prevCbGain, and onset fields
314     x buffer contains the new excitation signal
315     inno buffer contains the new innovation signal
316     pOverflow -> 1 if there is overflow
317
318  Returns:
319     None
320
321  Global Variables Used:
322     None
323
324  Local Variables Needed:
325     None
326
327 ------------------------------------------------------------------------------
328  FUNCTION DESCRIPTION
329
330  This function performs adaptive phase dispersion, i.e., forming of total
331  excitation for the synthesis part of the decoder.
332
333 ------------------------------------------------------------------------------
334  REQUIREMENTS
335
336  None
337
338 ------------------------------------------------------------------------------
339  REFERENCES
340
341  ph_disp.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
342
343 ------------------------------------------------------------------------------
344  PSEUDO-CODE
345
346 void ph_disp (
347       ph_dispState *state, // i/o     : State struct
348       enum Mode mode,      // i       : codec mode
349       Word16 x[],          // i/o Q0  : in:  LTP excitation signal
350                            //           out: total excitation signal
351       Word16 cbGain,       // i   Q1  : Codebook gain
352       Word16 ltpGain,      // i   Q14 : LTP gain
353       Word16 inno[],       // i/o Q13 : Innovation vector (Q12 for 12.2)
354       Word16 pitch_fac,    // i   Q14 : pitch factor used to scale the
355                                         LTP excitation (Q13 for 12.2)
356       Word16 tmp_shift     // i   Q0  : shift factor applied to sum of
357                                         scaled LTP ex & innov. before
358                                         rounding
359 )
360 {
361    Word16 i, i1;
362    Word16 tmp1;
363    Word32 L_temp;
364    Word16 impNr;           // indicator for amount of disp./filter used
365
366    Word16 inno_sav[L_SUBFR];
367    Word16 ps_poss[L_SUBFR];
368    Word16 j, nze, nPulse, ppos;
369    const Word16 *ph_imp;   // Pointer to phase dispersion filter
370
371    // Update LTP gain memory
372    for (i = PHDGAINMEMSIZE-1; i > 0; i--)
373    {
374        state->gainMem[i] = state->gainMem[i-1];
375    }
376    state->gainMem[0] = ltpGain;
377
378    // basic adaption of phase dispersion
379    if (sub(ltpGain, PHDTHR2LTP) < 0) {    // if (ltpGain < 0.9)
380        if (sub(ltpGain, PHDTHR1LTP) > 0)
381        {  // if (ltpGain > 0.6
382           impNr = 1; // medium dispersion
383        }
384        else
385        {
386           impNr = 0; // maximum dispersion
387        }
388    }
389    else
390    {
391       impNr = 2; // no dispersion
392    }
393
394    // onset indicator
395    // onset = (cbGain  > onFact * cbGainMem[0])
396    tmp1 = pv_round(L_shl(L_mult(state->prevCbGain, ONFACTPLUS1), 2));
397    if (sub(cbGain, tmp1) > 0)
398    {
399        state->onset = ONLENGTH;
400    }
401    else
402    {
403        if (state->onset > 0)
404        {
405            state->onset = sub (state->onset, 1);
406        }
407    }
408
409    // if not onset, check ltpGain buffer and use max phase dispersion if
410       half or more of the ltpGain-parameters say so
411    if (state->onset == 0)
412    {
413        // Check LTP gain memory and set filter accordingly
414        i1 = 0;
415        for (i = 0; i < PHDGAINMEMSIZE; i++)
416        {
417            if (sub(state->gainMem[i], PHDTHR1LTP) < 0)
418            {
419                i1 = add (i1, 1);
420            }
421        }
422        if (sub(i1, 2) > 0)
423        {
424            impNr = 0;
425        }
426
427    }
428    // Restrict decrease in phase dispersion to one step if not onset
429    if ((sub(impNr, add(state->prevState, 1)) > 0) && (state->onset == 0))
430    {
431        impNr = sub (impNr, 1);
432    }
433    // if onset, use one step less phase dispersion
434    if((sub(impNr, 2) < 0) && (state->onset > 0))
435    {
436        impNr = add (impNr, 1);
437    }
438
439    // disable for very low levels
440    if(sub(cbGain, 10) < 0)
441    {
442        impNr = 2;
443    }
444
445    if(sub(state->lockFull, 1) == 0)
446    {
447        impNr = 0;
448    }
449
450    // update static memory
451    state->prevState = impNr;
452    state->prevCbGain = cbGain;
453
454    // do phase dispersion for all modes but 12.2 and 7.4;
455    // don't modify the innovation if impNr >=2 (= no phase disp)
456    if (sub(mode, MR122) != 0 &&
457        sub(mode, MR102) != 0 &&
458        sub(mode, MR74) != 0 &&
459        sub(impNr, 2) < 0)
460    {
461        // track pulse positions, save innovation,
462           and initialize new innovation
463        nze = 0;
464        for (i = 0; i < L_SUBFR; i++)
465        {
466            if (inno[i] != 0)
467            {
468                ps_poss[nze] = i;
469                nze = add (nze, 1);
470            }
471            inno_sav[i] = inno[i];
472            inno[i] = 0;
473        }
474        // Choose filter corresponding to codec mode and dispersion criterium
475        if (sub (mode, MR795) == 0)
476        {
477            if (impNr == 0)
478            {
479                ph_imp = ph_imp_low_MR795;
480            }
481            else
482            {
483                ph_imp = ph_imp_mid_MR795;
484            }
485        }
486        else
487        {
488            if (impNr == 0)
489            {
490                ph_imp = ph_imp_low;
491            }
492            else
493            {
494                ph_imp = ph_imp_mid;
495            }
496        }
497
498        // Do phase dispersion of innovation
499        for (nPulse = 0; nPulse < nze; nPulse++)
500        {
501            ppos = ps_poss[nPulse];
502
503            // circular convolution with impulse response
504            j = 0;
505            for (i = ppos; i < L_SUBFR; i++)
506            {
507                // inno[i1] += inno_sav[ppos] * ph_imp[i1-ppos]
508                tmp1 = mult(inno_sav[ppos], ph_imp[j++]);
509                inno[i] = add(inno[i], tmp1);
510            }
511
512            for (i = 0; i < ppos; i++)
513            {
514                // inno[i] += inno_sav[ppos] * ph_imp[L_SUBFR-ppos+i]
515                tmp1 = mult(inno_sav[ppos], ph_imp[j++]);
516                inno[i] = add(inno[i], tmp1);
517            }
518        }
519    }
520
521    // compute total excitation for synthesis part of decoder
522    // (using modified innovation if phase dispersion is active)
523    for (i = 0; i < L_SUBFR; i++)
524    {
525        // x[i] = gain_pit*x[i] + cbGain*code[i];
526        L_temp = L_mult (        x[i],    pitch_fac);
527                                                 // 12.2: Q0 * Q13
528                                                 //  7.4: Q0 * Q14
529        L_temp = L_mac  (L_temp, inno[i], cbGain);
530                                                 // 12.2: Q12 * Q1
531                                                 //  7.4: Q13 * Q1
532        L_temp = L_shl (L_temp, tmp_shift);                 // Q16
533        x[i] = pv_round (L_temp);
534    }
535
536    return;
537 }
538
539 ------------------------------------------------------------------------------
540  CAUTION [optional]
541  [State any special notes, constraints or cautions for users of this function]
542
543 ------------------------------------------------------------------------------
544 */
545
546 void ph_disp(
547     ph_dispState *state,    /* i/o     : State struct                       */
548     enum Mode mode,         /* i       : codec mode                         */
549     Word16 x[],             /* i/o Q0  : in:  LTP excitation signal         */
550     /*           out: total excitation signal       */
551     Word16 cbGain,          /* i   Q1  : Codebook gain                      */
552     Word16 ltpGain,         /* i   Q14 : LTP gain                           */
553     Word16 inno[],          /* i/o Q13 : Innovation vector (Q12 for 12.2)   */
554     Word16 pitch_fac,       /* i   Q14 : pitch factor used to scale the
555                                          LTP excitation (Q13 for 12.2)      */
556     Word16 tmp_shift,       /* i   Q0  : shift factor applied to sum of
557                                          scaled LTP ex & innov. before
558                                          rounding                           */
559     CommonAmrTbls* common_amr_tbls, /* i : ptr to struct of table ptrs      */
560     Flag   *pOverflow       /* i/o     : oveflow indicator                  */
561 )
562 {
563     register Word16 i, i1;
564     register Word16 tmp1;
565     Word32 L_temp;
566     Word32 L_temp2;
567     Word16 impNr;           /* indicator for amount of disp./filter used */
568
569     Word16 inno_sav[L_SUBFR];
570     Word16 ps_poss[L_SUBFR];
571     register Word16 nze, nPulse;
572     Word16 ppos;
573     const Word16 *ph_imp;   /* Pointer to phase dispersion filter */
574
575     Word16 *p_inno;
576     Word16 *p_inno_sav;
577     Word16 *p_x;
578     const Word16 *p_ph_imp;
579     Word16 c_inno_sav;
580
581     const Word16* ph_imp_low_MR795_ptr = common_amr_tbls->ph_imp_low_MR795_ptr;
582     const Word16* ph_imp_mid_MR795_ptr = common_amr_tbls->ph_imp_mid_MR795_ptr;
583     const Word16* ph_imp_low_ptr = common_amr_tbls->ph_imp_low_ptr;
584     const Word16* ph_imp_mid_ptr = common_amr_tbls->ph_imp_mid_ptr;
585
586     /* Update LTP gain memory */
587     /* Unrolled FOR loop below since PHDGAINMEMSIZE is assumed to stay */
588     /* the same.                                                       */
589     /* for (i = PHDGAINMEMSIZE-1; i > 0; i--)                          */
590     /* {                                                               */
591     /*    state->gainMem[i] = state->gainMem[i-1];                     */
592     /* }                                                               */
593     state->gainMem[4] = state->gainMem[3];
594     state->gainMem[3] = state->gainMem[2];
595     state->gainMem[2] = state->gainMem[1];
596     state->gainMem[1] = state->gainMem[0];
597     state->gainMem[0] = ltpGain;
598
599     /* basic adaption of phase dispersion */
600
601     if (ltpGain < PHDTHR2LTP)    /* if (ltpGain < 0.9) */
602     {
603         if (ltpGain > PHDTHR1LTP)
604         {  /* if (ltpGain > 0.6 */
605             impNr = 1; /* medium dispersion */
606         }
607         else
608         {
609             impNr = 0; /* maximum dispersion */
610         }
611     }
612     else
613     {
614         impNr = 2; /* no dispersion */
615     }
616
617     /* onset indicator */
618     /* onset = (cbGain  > onFact * cbGainMem[0]) */
619
620     L_temp = ((Word32) state->prevCbGain * ONFACTPLUS1) << 1;
621
622     /* (L_temp << 2) calculation with saturation check */
623     if (L_temp > (Word32) 0X1fffffffL)
624     {
625         *pOverflow = 1;
626         L_temp = MAX_32;
627     }
628     else if (L_temp < (Word32) - 536870912)
629     {
630         *pOverflow = 1;
631         L_temp = MIN_32;
632     }
633     else
634     {
635         L_temp <<= 2;
636     }
637
638     tmp1 = pv_round(L_temp, pOverflow);
639
640     if (cbGain > tmp1)
641     {
642         state->onset = ONLENGTH;
643     }
644     else
645     {
646
647         if (state->onset > 0)
648         {
649             state->onset -= 1;
650         }
651     }
652
653     /* if not onset, check ltpGain buffer and use max phase dispersion if
654        half or more of the ltpGain-parameters say so */
655     if (state->onset == 0)
656     {
657         /* Check LTP gain memory and set filter accordingly */
658         i1 = 0;
659         for (i = 0; i < PHDGAINMEMSIZE; i++)
660         {
661             if (state->gainMem[i] < PHDTHR1LTP)
662             {
663                 i1 += 1;
664             }
665         }
666
667         if (i1 > 2)
668         {
669             impNr = 0;
670         }
671     }
672     /* Restrict decrease in phase dispersion to one step if not onset */
673     if ((impNr > ((state->prevState) + 1)) && (state->onset == 0))
674     {
675         impNr -= 1;
676     }
677
678     /* if onset, use one step less phase dispersion */
679     if ((impNr < 2) && (state->onset > 0))
680     {
681         impNr += 1;
682     }
683
684     /* disable for very low levels */
685     if (cbGain < 10)
686     {
687         impNr = 2;
688     }
689
690     if (state->lockFull == 1)
691     {
692         impNr = 0;
693     }
694
695     /* update static memory */
696     state->prevState = impNr;
697     state->prevCbGain = cbGain;
698
699     /* do phase dispersion for all modes but 12.2 and 7.4;
700        don't modify the innovation if impNr >=2 (= no phase disp) */
701     if ((mode != MR122) && (mode != MR102) && (mode != MR74) && (impNr < 2))
702     {
703         /* track pulse positions, save innovation,
704            and initialize new innovation          */
705         nze = 0;
706         p_inno = &inno[0];
707         p_inno_sav = &inno_sav[0];
708
709         for (i = 0; i < L_SUBFR; i++)
710         {
711             if (*(p_inno) != 0)
712             {
713                 ps_poss[nze] = i;
714                 nze += 1;
715             }
716             *(p_inno_sav++) = *(p_inno);
717             *(p_inno++) = 0;
718         }
719
720         /* Choose filter corresponding to codec mode and dispersion criterium */
721         if (mode == MR795)
722         {
723             if (impNr == 0)
724             {
725                 ph_imp = ph_imp_low_MR795_ptr;
726             }
727             else
728             {
729                 ph_imp = ph_imp_mid_MR795_ptr;
730             }
731         }
732         else
733         {
734             if (impNr == 0)
735             {
736                 ph_imp = ph_imp_low_ptr;
737             }
738             else
739             {
740                 ph_imp = ph_imp_mid_ptr;
741             }
742         }
743
744         /* Do phase dispersion of innovation */
745         for (nPulse = 0; nPulse < nze; nPulse++)
746         {
747             ppos = ps_poss[nPulse];
748
749             /* circular convolution with impulse response */
750             c_inno_sav = inno_sav[ppos];
751             p_inno = &inno[ppos];
752             p_ph_imp = ph_imp;
753
754             for (i = ppos; i < L_SUBFR; i++)
755             {
756                 /* inno[i1] += inno_sav[ppos] * ph_imp[i1-ppos] */
757                 L_temp = ((Word32) c_inno_sav * *(p_ph_imp++)) >> 15;
758                 tmp1 = (Word16) L_temp;
759                 *(p_inno) = add_16(*(p_inno), tmp1, pOverflow);
760                 p_inno += 1;
761             }
762
763             p_inno = &inno[0];
764
765             for (i = 0; i < ppos; i++)
766             {
767                 /* inno[i] += inno_sav[ppos] * ph_imp[L_SUBFR-ppos+i] */
768                 L_temp = ((Word32) c_inno_sav * *(p_ph_imp++)) >> 15;
769                 tmp1 = (Word16) L_temp;
770                 *(p_inno) = add_16(*(p_inno), tmp1, pOverflow);
771                 p_inno += 1;
772             }
773         }
774     }
775
776     /* compute total excitation for synthesis part of decoder
777        (using modified innovation if phase dispersion is active) */
778     p_inno = &inno[0];
779     p_x = &x[0];
780
781     for (i = 0; i < L_SUBFR; i++)
782     {
783         /* x[i] = gain_pit*x[i] + cbGain*code[i]; */
784         L_temp = L_mult(x[i], pitch_fac, pOverflow);
785         /* 12.2: Q0 * Q13 */
786         /*  7.4: Q0 * Q14 */
787         L_temp2 = ((Word32) * (p_inno++) * cbGain) << 1;
788         L_temp = L_add(L_temp, L_temp2, pOverflow);
789         /* 12.2: Q12 * Q1 */
790         /*  7.4: Q13 * Q1 */
791         L_temp = L_shl(L_temp, tmp_shift, pOverflow);                  /* Q16 */
792         *(p_x++) = pv_round(L_temp, pOverflow);
793     }
794
795     return;
796 }