123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259 |
- #include "c1035pf.h"
- const char c1035pf_id[] = "@(#)$Id $" c1035pf_h;
- #include "typedef.h"
- #include "basic_op.h"
- #include "count.h"
- #include "cnst.h"
- #include "inv_sqrt_ex.h"
- #include "set_sign.h"
- #include "cor_h.h"
- #include "s10_8pf.h"
- #define NB_PULSE 10
- #include "gray.tab"
- void q_p (
- Word16 *ind,
- Word16 n
- )
- {
- Word16 tmp;
-
- tmp = *ind; move16 ();
-
- test ();
- if (sub_ex (n, 5) < 0)
- {
- *ind = (tmp & 0x8) | gray[tmp & 0x7]; logic16 (); logic16 ();
- logic16 (); move16 ();
- }
- else
- {
- *ind = gray[tmp & 0x7]; logic16 (); move16 ();
- }
- }
- static void build_code (
- Word16 codvec[],
- Word16 sign[],
- Word16 cod[],
- Word16 h[],
- Word16 y[],
- Word16 indx[]
- )
- {
- Word16 i, j, k, track, index, _sign[NB_PULSE];
- Word16 *p0, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8, *p9;
- Word32 s;
- for (i = 0; i < L_CODE; i++)
- {
- cod[i] = 0; move16 ();
- }
- for (i = 0; i < NB_TRACK; i++)
- {
- indx[i] = -1; move16 ();
- }
-
- for (k = 0; k < NB_PULSE; k++)
- {
-
- i = codvec[k]; move16 ();
-
- j = sign[i]; move16 ();
-
- index = mult_ex (i, 6554);
-
- track = sub_ex (i, extract_l_ex (L_shr_ex (L_mult_ex (index, 5), 1)));
- test ();
- if (j > 0)
- {
- cod[i] = add_ex (cod[i], 4096); move16 ();
- _sign[k] = 8192; move16 ();
-
- }
- else
- {
- cod[i] = sub_ex (cod[i], 4096); move16 ();
- _sign[k] = -8192; move16 ();
- index = add_ex (index, 8);
- }
-
- test (); move16 ();
- if (indx[track] < 0)
- {
- indx[track] = index; move16 ();
- }
- else
- {
- test (); logic16 (); logic16 ();
- if (((index ^ indx[track]) & 8) == 0)
- {
-
-
- test ();
- if (sub_ex (indx[track], index) <= 0)
- {
- indx[track + 5] = index; move16 ();
- }
- else
- {
- indx[track + 5] = indx[track];
- move16 ();
- indx[track] = index; move16 ();
- }
- }
- else
- {
-
-
- test (); logic16 (); logic16 ();
- if (sub_ex ((indx[track] & 7), (index & 7)) <= 0)
- {
- indx[track + 5] = indx[track];
- move16 ();
- indx[track] = index; move16 ();
- }
- else
- {
- indx[track + 5] = index; move16 ();
- }
- }
- }
- }
-
- p0 = h - codvec[0]; move16 ();
- p1 = h - codvec[1]; move16 ();
- p2 = h - codvec[2]; move16 ();
- p3 = h - codvec[3]; move16 ();
- p4 = h - codvec[4]; move16 ();
- p5 = h - codvec[5]; move16 ();
- p6 = h - codvec[6]; move16 ();
- p7 = h - codvec[7]; move16 ();
- p8 = h - codvec[8]; move16 ();
- p9 = h - codvec[9]; move16 ();
-
- for (i = 0; i < L_CODE; i++)
- {
- s = 0; move32 ();
- s = L_mac_ex (s, *p0++, _sign[0]);
- s = L_mac_ex (s, *p1++, _sign[1]);
- s = L_mac_ex (s, *p2++, _sign[2]);
- s = L_mac_ex (s, *p3++, _sign[3]);
- s = L_mac_ex (s, *p4++, _sign[4]);
- s = L_mac_ex (s, *p5++, _sign[5]);
- s = L_mac_ex (s, *p6++, _sign[6]);
- s = L_mac_ex (s, *p7++, _sign[7]);
- s = L_mac_ex (s, *p8++, _sign[8]);
- s = L_mac_ex (s, *p9++, _sign[9]);
- y[i] = round_ex (s); move16 ();
- }
- }
- void code_10i40_35bits (
- Word16 x[],
- Word16 cn[],
- Word16 h[],
- Word16 cod[],
- Word16 y[],
- Word16 indx[]
- )
- {
- Word16 ipos[NB_PULSE], pos_max[NB_TRACK], codvec[NB_PULSE];
- Word16 dn[L_CODE], sign[L_CODE];
- Word16 rr[L_CODE][L_CODE], i;
- cor_h_x_ex (h, x, dn, 2);
- set_sign12k2 (dn, cn, sign, pos_max, NB_TRACK, ipos, STEP);
- cor_h (h, sign, rr);
- search_10and8i40 (NB_PULSE, STEP, NB_TRACK,
- dn, rr, ipos, pos_max, codvec);
-
- build_code (codvec, sign, cod, h, y, indx);
- for (i = 0; i < 10; i++)
- {
- q_p (&indx[i], i);
- }
- return;
- }
|