Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/quite/celt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore27
-rw-r--r--celt.kdevelop57
-rw-r--r--libcelt/Makefile.am2
-rw-r--r--libcelt/celt.c8
-rw-r--r--libcelt/celt.h46
-rw-r--r--libcelt/testcelt.c60
6 files changed, 142 insertions, 58 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f988805
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,27 @@
+Makefile
+Makefile.in
+aclocal.m4
+autom4te.cache
+*.kdevelop.pcs
+*.kdevses
+config.guess
+config.h
+config.h.in
+config.log
+config.status
+config.sub
+configure
+depcomp
+install-sh
+.deps
+.libs
+*.la
+testcelt
+libtool
+ltmain.sh
+missing
+stamp-h1
+*.sw
+*.o
+*.lo
+*~
diff --git a/celt.kdevelop b/celt.kdevelop
index c4e9153..37c063b 100644
--- a/celt.kdevelop
+++ b/celt.kdevelop
@@ -8,27 +8,12 @@
<primarylanguage>C</primarylanguage>
<ignoreparts/>
<projectname>celt</projectname>
- <projectdirectory>.</projectdirectory>
- <absoluteprojectpath>false</absoluteprojectpath>
- <description/>
- <defaultencoding/>
</general>
<kdevautoproject>
<general>
<useconfiguration>default</useconfiguration>
</general>
- <run>
- <mainprogram/>
- <programargs/>
- <globaldebugarguments/>
- <globalcwd/>
- <useglobalprogram>true</useglobalprogram>
- <terminal>false</terminal>
- <autocompile>false</autocompile>
- <autoinstall>false</autoinstall>
- <autokdesu>false</autokdesu>
- <envvars/>
- </run>
+ <run/>
<configurations>
<optimized>
<builddir>optimized</builddir>
@@ -56,20 +41,7 @@
<kdevdebugger>
<general>
<dbgshell>libtool</dbgshell>
- <gdbpath/>
- <configGdbScript/>
- <runShellScript/>
- <runGdbScript/>
- <breakonloadinglibs>true</breakonloadinglibs>
- <separatetty>false</separatetty>
- <floatingtoolbar>false</floatingtoolbar>
- <raiseGDBOnStart>false</raiseGDBOnStart>
</general>
- <display>
- <staticmembers>false</staticmembers>
- <demanglenames>true</demanglenames>
- <outputradix>10</outputradix>
- </display>
</kdevdebugger>
<kdevdoctreeview>
<ignoretocs>
@@ -131,12 +103,13 @@
<used>false</used>
<version>3</version>
<includestyle>3</includestyle>
- <root></root>
+ <root>/usr/share/qt3</root>
<designerintegration>EmbeddedKDevDesigner</designerintegration>
- <qmake></qmake>
- <designer></designer>
+ <qmake>/usr/bin/qmake-qt3</qmake>
+ <designer>/usr/bin/designer</designer>
<designerpluginpaths/>
</qt>
+ <references/>
<codecompletion>
<automaticCodeCompletion>false</automaticCodeCompletion>
<automaticArgumentsHint>true</automaticArgumentsHint>
@@ -160,27 +133,7 @@
<alwaysIncludeNamespaces>false</alwaysIncludeNamespaces>
<includePaths>.;</includePaths>
</codecompletion>
- <creategettersetter>
- <prefixGet/>
- <prefixSet>set</prefixSet>
- <prefixVariable>m_,_</prefixVariable>
- <parameterName>theValue</parameterName>
- <inlineGet>true</inlineGet>
- <inlineSet>true</inlineSet>
- </creategettersetter>
- <splitheadersource>
- <enabled>false</enabled>
- <synchronize>true</synchronize>
- <orientation>Vertical</orientation>
- </splitheadersource>
- <references/>
</kdevcppsupport>
- <cppsupportpart>
- <filetemplates>
- <interfacesuffix>.h</interfacesuffix>
- <implementationsuffix>.cpp</implementationsuffix>
- </filetemplates>
- </cppsupportpart>
<kdevfileview>
<groups>
<hidenonprojectfiles>false</hidenonprojectfiles>
diff --git a/libcelt/Makefile.am b/libcelt/Makefile.am
index 44ea494..ec58f36 100644
--- a/libcelt/Makefile.am
+++ b/libcelt/Makefile.am
@@ -15,7 +15,7 @@ libcelt_la_SOURCES = celt.c mdct.c
libcelt_la_LDFLAGS = -version-info @CELT_LT_CURRENT@:@CELT_LT_REVISION@:@CELT_LT_AGE@
-noinst_HEADERS = os_support.h arch.h mdct.h
+noinst_HEADERS = arch.h celt.h mdct.h os_support.h
noinst_PROGRAMS = testcelt
testcelt_SOURCES = testcelt.c
diff --git a/libcelt/celt.c b/libcelt/celt.c
index 20c6e17..22c3fd0 100644
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -32,6 +32,8 @@
#include "os_support.h"
#include "mdct.h"
#include <math.h>
+#include "celt.h"
+
#define MAX_PERIOD 2048
@@ -51,9 +53,9 @@ struct CELTState_ {
float *out_mem;
};
-typedef struct CELTState_ CELTState;
-CELTState *celt_init(int blockSize, int blocksPerFrame)
+
+CELTState *celt_encoder_new(int blockSize, int blocksPerFrame)
{
int i, N;
N = blockSize;
@@ -127,7 +129,7 @@ void celt_encode(CELTState *st, short *pcm)
st->mdct_overlap[j] = x[N+j];
for (j=0;j<N;j++)
- pcm[i*N+j] = st->out_mem[MAX_PERIOD+(i-B)*N+j];
+ pcm[i*N+j] = (short)floor(.5+st->out_mem[MAX_PERIOD+(i-B)*N+j]);
}
}
diff --git a/libcelt/celt.h b/libcelt/celt.h
new file mode 100644
index 0000000..3fe7558
--- /dev/null
+++ b/libcelt/celt.h
@@ -0,0 +1,46 @@
+/* (C) 2007 Jean-Marc Valin, CSIRO
+*/
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ - Neither the name of the Xiph.org Foundation nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef CELT_H
+#define CELT_H
+
+struct CELTState_;
+typedef struct CELTState_ CELTState;
+
+
+
+CELTState *celt_encoder_new(int blockSize, int blocksPerFrame);
+
+void celt_encode(CELTState *st, short *pcm);
+
+
+
+#endif /*CELT_H */
diff --git a/libcelt/testcelt.c b/libcelt/testcelt.c
index 5ec5601..5f9812a 100644
--- a/libcelt/testcelt.c
+++ b/libcelt/testcelt.c
@@ -1,5 +1,61 @@
-int main()
-{
+/* (C) 2007 Jean-Marc Valin, CSIRO
+*/
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ - Neither the name of the Xiph.org Foundation nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "celt.h"
+#include <stdio.h>
+
+#define FRAME_SIZE 256
+#define NBLOCKS 2
+
+int main(int argc, char *argv[])
+{
+ char *inFile, *outFile;
+ FILE *fin, *fout;
+ short in[FRAME_SIZE];
+ CELTState *st;
+
+ inFile = argv[1];
+ fin = fopen(inFile, "rb");
+ outFile = argv[2];
+ fout = fopen(outFile, "wb+");
+
+ st = celt_encoder_new(FRAME_SIZE/NBLOCKS, NBLOCKS);
+
+ while (!feof(fin))
+ {
+ fread(in, sizeof(short), FRAME_SIZE, fin);
+ celt_encode(st, in);
+ fwrite(in, sizeof(short), FRAME_SIZE, fout);
+ }
return 0;
}