29 #ifdef P_R_O_T_O_T_Y_P_E_S 41 #define contrl_1 contrl_ 116 static integer enctab[16] = { 0,7,11,12,13,10,6,1,14,9,5,2,3,4,8,15 };
117 static integer entau[60] = { 19,11,27,25,29,21,23,22,30,14,15,7,39,38,46,
118 42,43,41,45,37,53,49,51,50,54,52,60,56,58,26,90,88,92,84,86,82,83,
119 81,85,69,77,73,75,74,78,70,71,67,99,97,113,112,114,98,106,104,108,
121 static integer enadd[8] = { 1920,-768,2432,1280,3584,1536,2816,-1152 };
122 static real enscl[8] = { .0204f,.0167f,.0145f,.0147f,.0143f,.0135f,.0125f,
124 static integer enbits[8] = { 6,5,4,4,4,4,3,3 };
125 static integer entab6[64] = { 0,0,0,0,0,0,1,1,1,1,1,1,1,2,2,2,2,2,2,2,3,3,
126 3,3,3,3,3,4,4,4,4,4,4,4,5,5,5,5,5,6,6,6,6,6,7,7,7,7,7,8,8,8,8,9,9,
127 9,10,10,11,11,12,13,14,15 };
128 static integer rmst[64] = { 1024,936,856,784,718,656,600,550,502,460,420,
129 384,352,328,294,270,246,226,206,188,172,158,144,132,120,110,102,
130 92,84,78,70,64,60,54,50,46,42,38,34,32,30,26,24,22,20,18,17,16,15,
131 14,13,12,11,10,9,8,7,6,5,4,3,2,1,0 };
140 integer idel, nbit, i__, j, i2, i3, mrk;
284 for (i__ = 1; i__ <= i__1; ++i__) {
285 irc[i__] = (
integer)(rc[i__] * 32768.f);
290 if (voice[1] != 0 && voice[2] != 0) {
291 *ipitch = entau[*pitch - 1];
295 if (voice[1] != voice[2]) {
299 *ipitch = (voice[1] << 1) + voice[2];
305 *irms =
min(*irms,1023);
307 if (*irms > rmst[j - 1]) {
310 if (*irms < rmst[j - 1]) {
315 if (*irms > rmst[j - 1]) {
320 for (i__ = 1; i__ <= 2; ++i__) {
337 for (i__ = 3; i__ <= i__1; ++i__) {
344 nbit = enbits[
contrl_1.order + 1 - i__ - 1];
360 if (*ipitch == 0 || *ipitch == 127) {
361 irc[5] = enctab[(irc[1] & 30) / 2];
362 irc[6] = enctab[(irc[2] & 30) / 2];
363 irc[7] = enctab[(irc[3] & 30) / 2];
364 irc[8] = enctab[(*irms & 30) / 2];
365 irc[9] = enctab[(irc[4] & 30) / 2] / 2;
366 irc[10] = enctab[(irc[4] & 30) / 2] & 1;
int encode_(integer *voice, integer *pitch, real *rms, real *rc, integer *ipitch, integer *irms, integer *irc)
integer pow_ii(integer *ap, integer *bp)