ref: 6baa8e18d9135eca37a6c58054815aa8cb34498f
parent: 98d2a4917e1693480b71bc8a51cc270d85350d58
author: Jean-Marc Valin <[email protected]>
date: Fri Dec 7 19:08:37 EST 2007
A bit of quality tuning, plus created a higher quality mode
--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -152,7 +152,6 @@
const int *eBands = m->eBands;
B = m->nbMdctBlocks;
float norm[B*eBands[m->nbEBands+1]];
- //float bits = 0;
for (i=0;i<m->nbEBands;i++)
{
@@ -163,16 +162,16 @@
alg_quant(X+B*eBands[i], B*(eBands[i+1]-eBands[i]), q, P+B*eBands[i], enc);
for (j=B*eBands[i];j<B*eBands[i+1];j++)
norm[j] = X[j] * n;
- //bits += log2(ncwrs(B*(eBands[i+1]-eBands[i]), q));
+ //printf ("%f ", log2(ncwrs(B*(eBands[i+1]-eBands[i]), q))/(B*(eBands[i+1]-eBands[i])));
} else {
float n = sqrt(B*(eBands[i+1]-eBands[i]));
copy_quant(X+B*eBands[i], B*(eBands[i+1]-eBands[i]), -q, norm, B, eBands[i], enc);
for (j=B*eBands[i];j<B*eBands[i+1];j++)
norm[j] = X[j] * n;
- //bits += 1+log2(eBands[i]-(eBands[i+1]-eBands[i]))+log2(ncwrs(B*(eBands[i+1]-eBands[i]), -q));
+ //printf ("%f ", (1+log2(eBands[i]-(eBands[i+1]-eBands[i]))+log2(ncwrs(B*(eBands[i+1]-eBands[i]), -q)))/(B*(eBands[i+1]-eBands[i])));
}
}
- //printf ("%f\n", bits);
+ //printf ("\n");
for (i=B*eBands[m->nbEBands];i<B*eBands[m->nbEBands+1];i++)
X[i] = 0;
}
--- a/libcelt/celt.h
+++ b/libcelt/celt.h
@@ -38,6 +38,7 @@
typedef struct CELTMode CELTMode;
extern const CELTMode const *celt_mode1;
+extern const CELTMode const *celt_mode2;
/* Encoder stuff */
--- a/libcelt/modes.c
+++ b/libcelt/modes.c
@@ -37,11 +37,12 @@
const int qbank1[NBANDS128+2] = {0, 2, 4, 6, 8, 12, 16, 20, 24, 28, 36, 44, 52, 68, 84, 116, 128};
-const int qpulses1[NBANDS128] = {7, 5, 4, 4, 3, 3, 3, 4, 4, 4, -2, -1, -1, -1, 0};
+const int qpulses1[NBANDS128] = {7, 5, 5, 5, 4, 5, 4, 5, 5, 4, -2, 0, 0, 0, 0};
+const int qpulses2[NBANDS128] = {28,24,20,16,24,20, 18, 12, 10, 10,-7, -4, 0, 0, 0};
const int pbank1[PBANDS128+2] = {0, 4, 8, 12, 20, PITCH_END128, 128};
-
+/* Approx 38 kbps @ 44.1 kHz */
const CELTMode mode1 = {
256, /**< frameSize */
128, /**< mdctSize */
@@ -56,4 +57,20 @@
qpulses1 /**< nbPulses */
};
+/* Approx 58 kbps @ 44.1 kHz */
+const CELTMode mode2 = {
+ 256, /**< frameSize */
+ 128, /**< mdctSize */
+ 2, /**< nbMdctBlocks */
+
+ NBANDS128, /**< nbEBands */
+ PBANDS128, /**< nbPBands */
+ PITCH_END128,/**< pitchEnd */
+
+ qbank1, /**< eBands */
+ pbank1, /**< pBands*/
+ qpulses2 /**< nbPulses */
+};
+
const CELTMode const *celt_mode1 = &mode1;
+const CELTMode const *celt_mode2 = &mode2;