123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- #include "spstproc.h"
- const char spstproc_id[] = "@(#)$Id $" spstproc_h;
- #include <stdlib.h>
- #include <stdio.h>
- #include "typedef.h"
- #include "basic_op.h"
- #include "oper_32b.h"
- #include "count.h"
- #include "syn_filt.h"
- #include "cnst.h"
- int subframePostProc(
- Word16 *speech,
- enum Mode mode,
- Word16 i_subfr,
- Word16 gain_pit,
- Word16 gain_code,
- Word16 *Aq,
- Word16 synth[],
- Word16 xn[],
- Word16 code[],
- Word16 y1[],
- Word16 y2[],
- Word16 *mem_syn,
- Word16 *mem_err,
- Word16 *mem_w0,
- Word16 *exc,
- Word16 *sharp
- )
- {
- Word16 i, j, k;
- Word16 temp;
- Word32 L_temp;
- Word16 tempShift;
- Word16 kShift;
- Word16 pitch_fac;
- test ();
- if (sub_ex(mode, MR122) != 0)
- {
- tempShift = 1; move16 ();
- kShift = 2; move16 ();
- pitch_fac = gain_pit; move16 ();
- }
- else
- {
- tempShift = 2; move16 ();
- kShift = 4; move16 ();
- pitch_fac = shr_ex (gain_pit, 1);
- }
-
-
-
- *sharp = gain_pit; move16 ();
- test ();
- if (sub_ex(*sharp, SHARPMAX) > 0)
- {
- *sharp = SHARPMAX; move16 ();
- }
-
- for (i = 0; i < L_SUBFR; i++) {
-
-
- L_temp = L_mult_ex (exc[i + i_subfr], pitch_fac);
- L_temp = L_mac_ex (L_temp, code[i], gain_code);
- L_temp = L_shl_ex (L_temp, tempShift);
- exc[i + i_subfr] = round_ex (L_temp); move16 ();
- }
- Syn_filt(Aq, &exc[i_subfr], &synth[i_subfr], L_SUBFR,
- mem_syn, 1);
- for (i = L_SUBFR - M, j = 0; i < L_SUBFR; i++, j++) {
- mem_err[j] = sub_ex(speech[i_subfr + i],
- synth[i_subfr + i]); move16 ();
-
- temp = extract_h_ex(L_shl_ex(L_mult_ex(y1[i], gain_pit), 1));
- k = extract_h_ex(L_shl_ex(L_mult_ex(y2[i], gain_code), kShift));
- mem_w0[j] = sub_ex(xn[i], add_ex(temp, k)); move16 ();
- }
- return 0;
- }
|