123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- #include "dec_gain.h"
- const char dec_gain_id[] = "@(#)$Id $" dec_gain_h;
-
- #include <stdlib.h>
- #include <stdio.h>
- #include "typedef.h"
- #include "basic_op.h"
- #include "oper_32b.h"
- #include "count.h"
- #include "mode.h"
- #include "cnst.h"
- #include "pow2.h"
- #include "log2.h"
- #include "gc_pred.h"
- #include "qua_gain.tab"
- #include "qgain475.tab"
- void Dec_gain(
- gc_predState *pred_state,
- enum Mode mode,
- Word16 index,
- Word16 code[],
- Word16 evenSubfr,
- Word16 * gain_pit,
- Word16 * gain_cod
- )
- {
- const Word16 *p;
- Word16 frac, gcode0, exp, qua_ener, qua_ener_MR122;
- Word16 g_code;
- Word32 L_tmp;
-
-
- index = shl_ex (index, 2);
-
- test(); test(); test();
- if ( sub_ex (mode, MR102) == 0
- || sub_ex (mode, MR74) == 0
- || sub_ex (mode, MR67) == 0)
- {
- p = &table_gain_highrates[index]; move16 ();
-
- *gain_pit = *p++; move16 ();
- g_code = *p++; move16 ();
- qua_ener_MR122 = *p++; move16 ();
- qua_ener = *p; move16 ();
- }
- else
- {
- test();
- if (sub_ex (mode, MR475) == 0)
- {
- index = add_ex (index, shl_ex(sub_ex(1, evenSubfr), 1));
- p = &table_gain_MR475[index]; move16 ();
-
- *gain_pit = *p++; move16 ();
- g_code = *p++; move16 ();
-
-
-
- Log2 (L_deposit_l_ex (g_code), &exp, &frac);
- exp = sub_ex(exp, 12);
-
- qua_ener_MR122 = add_ex (shr_r_ex (frac, 5), shl_ex (exp, 10));
-
-
- L_tmp = Mpy_32_16(exp, frac, 24660);
- qua_ener = round_ex (L_shl_ex (L_tmp, 13));
- }
- else
- {
- p = &table_gain_lowrates[index]; move16 ();
-
- *gain_pit = *p++; move16 ();
- g_code = *p++; move16 ();
- qua_ener_MR122 = *p++; move16 ();
- qua_ener = *p; move16 ();
- }
- }
-
-
- gc_pred(pred_state, mode, code, &exp, &frac, NULL, NULL);
- gcode0 = extract_l_ex(Pow2(14, frac));
-
- L_tmp = L_mult_ex(g_code, gcode0);
- L_tmp = L_shr_ex(L_tmp, sub_ex(10, exp));
- *gain_cod = extract_h_ex(L_tmp);
-
- gc_pred_update(pred_state, qua_ener_MR122, qua_ener);
- return;
- }
|