[xiph-commits] r13653 - in trunk/ghost: . libghost
jm at svn.xiph.org
jm at svn.xiph.org
Wed Aug 29 08:35:36 PDT 2007
Author: jm
Date: 2007-08-29 08:35:35 -0700 (Wed, 29 Aug 2007)
New Revision: 13653
Modified:
trunk/ghost/Ghost.kdevelop
trunk/ghost/libghost/ceft.c
trunk/ghost/libghost/ghost.c
trunk/ghost/libghost/ghost.h
Log:
Bits of tuning, plus added pre-emphasis
Modified: trunk/ghost/Ghost.kdevelop
===================================================================
--- trunk/ghost/Ghost.kdevelop 2007-08-29 11:42:06 UTC (rev 13652)
+++ trunk/ghost/Ghost.kdevelop 2007-08-29 15:35:35 UTC (rev 13653)
@@ -10,6 +10,8 @@
<projectdirectory>.</projectdirectory>
<absoluteprojectpath>false</absoluteprojectpath>
<description></description>
+ <projectname>Ghost</projectname>
+ <defaultencoding></defaultencoding>
</general>
<kdevautoproject>
<general>
@@ -20,10 +22,10 @@
<mainprogram>libghost/testghost</mainprogram>
<directoryradio>executable</directoryradio>
<runarguments>
- <testghost></testghost>
+ <testghost/>
</runarguments>
<customdirectory>/</customdirectory>
- <programargs></programargs>
+ <programargs/>
<terminal>false</terminal>
<autocompile>true</autocompile>
<envvars/>
@@ -55,7 +57,7 @@
<kdevdebugger>
<general>
<dbgshell>libtool</dbgshell>
- <programargs></programargs>
+ <programargs/>
<gdbpath></gdbpath>
<configGdbScript></configGdbScript>
<runShellScript></runShellScript>
@@ -132,12 +134,27 @@
<includeTypes>true</includeTypes>
<includeEnums>true</includeEnums>
<includeTypedefs>false</includeTypedefs>
- <automaticCodeCompletion>true</automaticCodeCompletion>
+ <automaticCodeCompletion>false</automaticCodeCompletion>
<automaticArgumentsHint>true</automaticArgumentsHint>
<automaticHeaderCompletion>true</automaticHeaderCompletion>
<codeCompletionDelay>250</codeCompletionDelay>
<argumentsHintDelay>400</argumentsHintDelay>
<headerCompletionDelay>250</headerCompletionDelay>
+ <showOnlyAccessibleItems>false</showOnlyAccessibleItems>
+ <completionBoxItemOrder>0</completionBoxItemOrder>
+ <howEvaluationContextMenu>true</howEvaluationContextMenu>
+ <showCommentWithArgumentHint>true</showCommentWithArgumentHint>
+ <statusBarTypeEvaluation>false</statusBarTypeEvaluation>
+ <namespaceAliases>std=_GLIBCXX_STD;__gnu_cxx=std</namespaceAliases>
+ <processPrimaryTypes>true</processPrimaryTypes>
+ <processFunctionArguments>false</processFunctionArguments>
+ <preProcessAllHeaders>false</preProcessAllHeaders>
+ <parseMissingHeadersExperimental>false</parseMissingHeadersExperimental>
+ <resolveIncludePathsUsingMakeExperimental>false</resolveIncludePathsUsingMakeExperimental>
+ <alwaysParseInBackground>true</alwaysParseInBackground>
+ <usePermanentCaching>true</usePermanentCaching>
+ <alwaysIncludeNamespaces>false</alwaysIncludeNamespaces>
+ <includePaths>.;</includePaths>
</codecompletion>
<creategettersetter>
<prefixGet></prefixGet>
@@ -147,6 +164,21 @@
<inlineGet>true</inlineGet>
<inlineSet>true</inlineSet>
</creategettersetter>
+ <qt>
+ <used>false</used>
+ <version>3</version>
+ <includestyle>3</includestyle>
+ <root>/usr/share/qt3</root>
+ <designerintegration>EmbeddedKDevDesigner</designerintegration>
+ <qmake>/usr/bin/qmake-qt3</qmake>
+ <designer>/usr/bin/designer-qt3</designer>
+ <designerpluginpaths/>
+ </qt>
+ <splitheadersource>
+ <enabled>false</enabled>
+ <synchronize>true</synchronize>
+ <orientation>Vertical</orientation>
+ </splitheadersource>
</kdevcppsupport>
<kdevfileview>
<groups>
Modified: trunk/ghost/libghost/ceft.c
===================================================================
--- trunk/ghost/libghost/ceft.c 2007-08-29 11:42:06 UTC (rev 13652)
+++ trunk/ghost/libghost/ceft.c 2007-08-29 15:35:35 UTC (rev 13653)
@@ -150,6 +150,18 @@
for (i=0;i<N;i++)
y[i] = 0;
+ if (0)
+ {
+ int tmp = N;
+ int b=0;
+ while (tmp>1)
+ {
+ b++;
+ tmp >>= 1;
+ }
+ printf ("%d\n", 1+K*b);
+ }
+
for (i=0;i<K;i++)
{
int best_id=0;
@@ -220,23 +232,13 @@
}
-#define NBANDS 18 /*or 21 if we discard the small last band*/
-int qbank[] = {1, 2, 4, 6, 8, 10, 12, 14, 16, 20, 24, 28, 36, 44, 52, 68, 84, 116, 128};
+#define NBANDS 20
+int qbank[] = {1, 2, 3, 4, 5, 6, 8, 10, 12, 14, 16, 20, 24, 28, 36, 44, 52, 68, 84, 116, 128};
-
-#if 1
#define PBANDS 6
int pbank[] = {1, 5, 9, 20, 44, 84, 128};
-//#define PBANDS 22 /*or 22 if we discard the small last band*/
-//int pbank[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16, 20, 24, 28, 36, 44, 52, 68, 84, 116, 128};
-#else
-#define PBANDS 1
-int pbank[] = {1, 128};
-
-#endif
-
void compute_bank(float *X, float *bank)
{
int i;
@@ -335,12 +337,12 @@
for (i=0;i<NBANDS;i++)
{
int q=0;
- if (i < 5)
- q = 3;
- else if (i<10)
+ if (i < 4)
q = 2;
- else if (i<15)
+ else if (i<8)
q = 2;
+ else if (i<12)
+ q = 2;
else
q = 1;
//q = 1;
@@ -351,7 +353,7 @@
X[255] = 0;
}
-void pitch_quant_bank(float *X, float *P)
+void pitch_quant_bank(float *X, float *P, float *gains)
{
int i;
for (i=0;i<PBANDS;i++)
@@ -372,6 +374,10 @@
//gain *= 1+.02*gain;
if (gain > .9)
gain = .9;
+ if (gain < 0)
+ gain = 0;
+
+ gains[i] = gain;
for (j=pbank[i];j<pbank[i+1];j++)
{
P[j*2-1] *= gain;
@@ -464,6 +470,7 @@
float bank[NBANDS];
float pitch_bank[NBANDS];
float p[st->length];
+ float gains[PBANDS];
for (i=0;i<st->length;i++)
p[i] = pitch[i]*window[i];
@@ -483,6 +490,24 @@
compute_bank(X, bank);
normalise_bank(X, bank);
+#if 0
+ float q = .25f;
+ for (i=0;i<NBANDS;i++)
+ {
+ if (i<4)
+ q = .25;
+ else if (i<8)
+ q = .5;
+ else if (i<12)
+ q = 1;
+ else
+ q = 1;
+ int sc = floor(.5 + log(bank[i])/q);
+ printf ("%d ", sc);
+ bank[i] = exp(q * sc);
+ }
+ printf ("\n");
+#endif
/*printf ("%f ", fabs(X[0]));
for (i=0;i<NBANDS;i++)
printf ("%f ", bank[i]);
@@ -494,19 +519,19 @@
for(i=0;i<st->length;i++)
Xbak[i] = X[i];
- /*for(i=0;i<st->length;i++)
+ for(i=0;i<st->length;i++)
printf ("%f ", X[i]);
printf ("\n");
- */
- pitch_quant_bank(X, Xp);
+ pitch_quant_bank(X, Xp, gains);
+
for (i=1;i<st->length;i++)
X[i] -= Xp[i];
- //Quantise input
+//Quantise input
quant_bank3(X, Xp);
//quant_bank2(X);
-
+
//pitch_renormalise_bank(X, Xp);
#if 0
Modified: trunk/ghost/libghost/ghost.c
===================================================================
--- trunk/ghost/libghost/ghost.c 2007-08-29 11:42:06 UTC (rev 13652)
+++ trunk/ghost/libghost/ghost.c 2007-08-29 15:35:35 UTC (rev 13653)
@@ -149,6 +149,10 @@
st->adpcm = adpcm_init(8);
st->ceft = ceft_init(st->length);
+ st->preemph = .0;
+ st->preemph_mem = 0;
+ st->deemph_mem = 0;
+
return st;
}
@@ -167,8 +171,12 @@
for (i=0;i<PCM_BUF_SIZE-st->advance;i++)
st->pcm_buf[i] = st->pcm_buf[i+st->advance];
+
for (i=0;i<st->advance;i++)
- st->new_pcm[i]=pcm[i];
+ {
+ st->new_pcm[i]=pcm[i]-st->preemph*st->preemph_mem;
+ st->preemph_mem = pcm[i];
+ }
compute_curve(st->psy, st->pcm_buf, curve);
mask_gain = curve_to_lpc(st->psy, curve, awk1, awk2, MASK_LPC_ORDER);
@@ -392,8 +400,11 @@
pcm[i] = st->current_frame[i]-st->new_noise[i];*/
for (i=0;i<st->advance;i++)
- pcm[i] = st->current_frame[i]-st->new_noise[i] /*+ noise[i]*/;
-
+ {
+ float tmp = st->current_frame[i]-st->new_noise[i] /*+ noise[i]*/;
+ pcm[i] = tmp + st->preemph*st->deemph_mem;
+ st->deemph_mem = pcm[i];
+ }
}
}
Modified: trunk/ghost/libghost/ghost.h
===================================================================
--- trunk/ghost/libghost/ghost.h 2007-08-29 11:42:06 UTC (rev 13652)
+++ trunk/ghost/libghost/ghost.h 2007-08-29 15:35:35 UTC (rev 13653)
@@ -59,6 +59,10 @@
void *lpc_fft;
ADPCMState *adpcm;
CEFTState *ceft;
+
+ float preemph_mem;
+ float deemph_mem;
+ float preemph;
} GhostEncState;
GhostEncState *ghost_encoder_state_new(int sampling_rate);
More information about the commits
mailing list