aboutsummaryrefslogtreecommitdiffstats
path: root/codecs/lpc10
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2000-01-05 00:19:54 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2000-01-05 00:19:54 +0000
commit94c814efa279137c044174612060b44b60207340 (patch)
tree0a2231c442a05034b46ace81f29c2dfa2fcc6b1c /codecs/lpc10
parentbc5ebd9645aa3b9387365e8b050c9f0753958b52 (diff)
Version 0.1.2 from FTP
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@156 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'codecs/lpc10')
-rwxr-xr-xcodecs/lpc10/README89
-rwxr-xr-xcodecs/lpc10/lpc10.h229
2 files changed, 318 insertions, 0 deletions
diff --git a/codecs/lpc10/README b/codecs/lpc10/README
new file mode 100755
index 000000000..30abe4c97
--- /dev/null
+++ b/codecs/lpc10/README
@@ -0,0 +1,89 @@
+Tue Aug 20 16:19:51 CDT 1996
+Andy Fingerhut (jaf@arl.wustl.edu)
+
+In release 1.4, there are quite a few hand modifications to the C code
+that was automatically created from the Fortran code with f2c. They
+are all summarized in change log comments at the beginning of the
+changed files. All of the original files from f2c were checked in to
+RCS before modification, so it is possible to see exactly what changes
+were made, for the extremely curious. That precaution was also for my
+benefit, in case I ever recompile the Fortran sources, and want to
+make similar changes to that new C source code.
+
+Below is the README file for this directory included with the 1.3
+release of the LPC-10 package. A few parts of it are a little out of
+date, but it is correct for the most part.
+
+
+Sun Jul 7 15:30:31 CDT 1996
+Andy Fingerhut (jaf@arl.wustl.edu)
+
+To create the LPC-10 library, copy the appropriate makefile to the
+proper name for easy use, e.g., for Unix, copy makefile.unx to the
+file "Makefile". The file makefile.dos has been used with some
+version of the 'nmake' utility that comes with the Microsoft C
+compiler (the same one used for Nautilus v1.5a, which I believe
+specifies Microsoft C version 7.0 or later).
+
+Then edit the file lpc10.h in the directory above. It should already
+be set up to work properly on any Unix compiler for which "int" is 32
+bits and "short" is 16 bits, and under the Microsoft C compiler
+configured so that "long" is 32 bits and "int" is 16 bits. There must
+be a typedef for the two types INT32 and INT16 in that file. You
+should choose types that compile to those sizes using your compiler,
+because there are places in the LPC-10 code that expect INT16's to
+have exactly 16 bits (at least, I *think* they must be no larger), and
+INT32's to have exactly 32 bits.
+
+
+A few notes on how these files were created
+-------------------------------------------
+
+(This section is mostly for my benefit, so I can remember what I did.
+You don't need to read it if you just want to use this package. It
+might be useful to read it if you change the Fortran sources and want
+to recreate a usable library of C sources. -- Andy)
+
+These C sources were created automatically from the Fortran sources
+using f2c, for the most part. Listed below are the extra
+modifications that were made after this automatic conversion. Many of
+them were made so that it was not necessary to install f2c in order to
+use this LPC-10 coder.
+
+1.
+
+Put all of those files that were necessary for only the coder, rather
+than an application that uses the coder, into this subdirectory called
+lpc10.
+
+2.
+
+Copied f2c.h from the f2c distribution into this subdirectory. Some
+modifications were made to the "typedef" statements in this file, to
+explicitly indicate the sizes (in bits) that different integer types
+should be. The types INT32 and INT16 must be defined in a file called
+lpc10.h in the directory above. Created the file f2clib.c, containing
+only the functions pow_ii(), r_sign(), and i_nint() from the f2c
+library.
+
+3.
+
+The f2c output originally had a file called contrl_com.c, that defined
+a small structure containing a few variables that were used in many
+different functions of the LPC10 code. Every file containing
+functions that used it defined it as "extern", while contrl_com.c
+actually allocated storage for the structure. Bill Dorsey, one of the
+lead developers of Nautilus, said that the Microsoft C compiler had
+problems either compiling this file, or linking it with all of the
+other compiled files, so he just eliminated that file and removed the
+"extern" keyword from the one of the files that declared it that way.
+The file chosen (arbitrarily) was analys.c.
+
+4.
+
+Copied the makefiles for Unix and Microsoft C from the Nautilus v1.5a
+distribution into the lpc10 directory. Modified them to take out
+references to Nautilus. These makefiles don't create an executable,
+but a library of compiled functions called liblpc10.a (Unix) or
+LPC10.LIB (DOS). This library can be used when linking an executable
+that calls the functions lpcini_(), lpcenc_(), and lpcdec_().
diff --git a/codecs/lpc10/lpc10.h b/codecs/lpc10/lpc10.h
new file mode 100755
index 000000000..4194ac64e
--- /dev/null
+++ b/codecs/lpc10/lpc10.h
@@ -0,0 +1,229 @@
+/*
+
+$Log$
+Revision 1.1 2000/01/05 00:20:06 markster
+Version 0.1.2 from FTP
+
+Revision 1.1 2000/01/05 00:20:06 markster
+Add broken lpc10 code... It's not too far from working I don't think...
+
+ * Revision 1.1 1996/08/19 22:47:31 jaf
+ * Initial revision
+ *
+
+*/
+
+#ifndef __LPC10_H__
+#define __LPC10_H__
+
+#define LPC10_SAMPLES_PER_FRAME 180
+#define LPC10_BITS_IN_COMPRESSED_FRAME 54
+
+
+/*
+
+ The "#if defined"'s in this file are by no means intended to be
+ complete. They are what Nautilus uses, which has been successfully
+ compiled under DOS with the Microsoft C compiler, and under a few
+ versions of Unix with the GNU C compiler.
+
+ */
+
+#if defined(unix)
+typedef short INT16;
+typedef int INT32;
+#endif
+
+
+#if defined(__MSDOS__) || defined(MSDOS)
+typedef int INT16;
+typedef long INT32;
+#endif
+
+
+
+/* The initial values for every member of this structure is 0, except
+ where noted in comments. */
+
+/* These two lines are copied from f2c.h. There should be a more
+ elegant way of doing this than having the same declarations in two
+ files. */
+
+typedef float real;
+typedef INT32 integer;
+typedef INT32 logical;
+typedef INT16 shortint;
+
+struct lpc10_encoder_state {
+ /* State used only by function hp100 */
+ real z11;
+ real z21;
+ real z12;
+ real z22;
+
+ /* State used by function analys */
+ real inbuf[540], pebuf[540];
+ real lpbuf[696], ivbuf[312];
+ real bias;
+ integer osbuf[10]; /* no initial value necessary */
+ integer osptr; /* initial value 1 */
+ integer obound[3];
+ integer vwin[6] /* was [2][3] */; /* initial value vwin[4] = 307; vwin[5] = 462; */
+ integer awin[6] /* was [2][3] */; /* initial value awin[4] = 307; awin[5] = 462; */
+ integer voibuf[8] /* was [2][4] */;
+ real rmsbuf[3];
+ real rcbuf[30] /* was [10][3] */;
+ real zpre;
+
+
+ /* State used by function onset */
+ real n;
+ real d__; /* initial value 1.f */
+ real fpc; /* no initial value necessary */
+ real l2buf[16];
+ real l2sum1;
+ integer l2ptr1; /* initial value 1 */
+ integer l2ptr2; /* initial value 9 */
+ integer lasti; /* no initial value necessary */
+ logical hyst; /* initial value FALSE_ */
+
+ /* State used by function voicin */
+ real dither; /* initial value 20.f */
+ real snr;
+ real maxmin;
+ real voice[6] /* was [2][3] */; /* initial value is probably unnecessary */
+ integer lbve, lbue, fbve, fbue;
+ integer ofbue, sfbue;
+ integer olbue, slbue;
+ /* Initial values:
+ lbve = 3000;
+ fbve = 3000;
+ fbue = 187;
+ ofbue = 187;
+ sfbue = 187;
+ lbue = 93;
+ olbue = 93;
+ slbue = 93;
+ snr = (real) (fbve / fbue << 6);
+ */
+
+ /* State used by function dyptrk */
+ real s[60];
+ integer p[120] /* was [60][2] */;
+ integer ipoint;
+ real alphax;
+
+ /* State used by function chanwr */
+ integer isync;
+
+};
+
+
+struct lpc10_decoder_state {
+
+ /* State used by function decode */
+ integer iptold; /* initial value 60 */
+ logical first; /* initial value TRUE_ */
+ integer ivp2h;
+ integer iovoic;
+ integer iavgp; /* initial value 60 */
+ integer erate;
+ integer drc[30] /* was [3][10] */;
+ integer dpit[3];
+ integer drms[3];
+
+ /* State used by function synths */
+ real buf[360];
+ integer buflen; /* initial value 180 */
+
+ /* State used by function pitsyn */
+ integer ivoico; /* no initial value necessary as long as first_pitsyn is initially TRUE_ */
+ integer ipito; /* no initial value necessary as long as first_pitsyn is initially TRUE_ */
+ real rmso; /* initial value 1.f */
+ real rco[10]; /* no initial value necessary as long as first_pitsyn is initially TRUE_ */
+ integer jsamp; /* no initial value necessary as long as first_pitsyn is initially TRUE_ */
+ logical first_pitsyn; /* initial value TRUE_ */
+
+ /* State used by function bsynz */
+ integer ipo;
+ real exc[166];
+ real exc2[166];
+ real lpi1;
+ real lpi2;
+ real lpi3;
+ real hpi1;
+ real hpi2;
+ real hpi3;
+ real rmso_bsynz;
+
+ /* State used by function random */
+ integer j; /* initial value 2 */
+ integer k; /* initial value 5 */
+ shortint y[5]; /* initial value { -21161,-8478,30892,-10216,16950 } */
+
+ /* State used by function deemp */
+ real dei1;
+ real dei2;
+ real deo1;
+ real deo2;
+ real deo3;
+
+};
+
+
+
+/*
+
+ Calling sequence:
+
+ Call create_lpc10_encoder_state(), which returns a pointer to an
+ already initialized lpc10_encoder_state structure.
+
+ lpc10_encode reads indices 0 through (LPC10_SAMPLES_PER_FRAME-1) of
+ array speech[], and writes indices 0 through
+ (LPC10_BITS_IN_COMPRESSED_FRAME-1) of array bits[], and both reads
+ and writes the lpc10_encoder_state structure contents. The
+ lpc10_encoder_state structure should *not* be initialized for every
+ frame of encoded speech. Once at the beginning of execution, done
+ automatically for you by create_lpc10_encoder_state(), is enough.
+
+ init_lpc10_encoder_state() reinitializes the lpc10_encoder_state
+ structure. This might be useful if you are finished processing one
+ sound sample, and want to reuse the same lpc10_encoder_state
+ structure to process another sound sample. There might be other
+ uses as well.
+
+ Note that the comments in the lpc10/lpcenc.c file imply that indices
+ 1 through 180 of array speech[] are read. These comments were
+ written for the Fortran version of the code, before it was
+ automatically converted to C by the conversion program f2c. f2c
+ seems to use the convention that the pointers to arrays passed as
+ function arguments point to the first index used in the Fortran
+ code, whatever index that might be (usually 1), and then it modifies
+ the pointer inside of the function, like so:
+
+ if (speech) {
+ --speech;
+ }
+
+ So that the code can access the first value at index 1 and the last
+ at index 180. This makes the translated C code "closer" to the
+ original Fortran code.
+
+ The calling sequence for the decoder is similar to the encoder. The
+ only significant difference is that the array bits[] is read
+ (indices 0 through (LPC10_BITS_IN_COMPRESSED_FRAME-1)), and the
+ array speech[] is written (indices 0 through
+ (LPC10_SAMPLES_PER_FRAME-1)).
+
+ */
+
+struct lpc10_encoder_state * create_lpc10_encoder_state ();
+void init_lpc10_encoder_state (struct lpc10_encoder_state *st);
+int lpc10_encode (real *speech, INT32 *bits, struct lpc10_encoder_state *st);
+
+struct lpc10_decoder_state * create_lpc10_decoder_state ();
+void init_lpc10_decoder_state (struct lpc10_decoder_state *st);
+int lpc10_decode (INT32 *bits, real *speech, struct lpc10_decoder_state *st);
+
+#endif /* __LPC10_H__ */