Skip to content
Snippets Groups Projects
Commit 013c31d6 authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

Got MDCT analysis-synthesis to work

parent f02ba119
No related branches found
No related tags found
No related merge requests found
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
*~
......@@ -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>
......
......@@ -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
......
......@@ -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]);
}
}
......
/* (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 */
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;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment