Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Mark Harris
Opus
Commits
6baa8e18
Commit
6baa8e18
authored
Dec 08, 2007
by
Jean-Marc Valin
Browse files
A bit of quality tuning, plus created a higher quality mode
parent
98d2a491
Changes
3
Hide whitespace changes
Inline
Side-by-side
libcelt/bands.c
View file @
6baa8e18
...
...
@@ -152,7 +152,6 @@ void quant_bands(const CELTMode *m, float *X, float *P, ec_enc *enc)
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 @@ void quant_bands(const CELTMode *m, float *X, float *P, ec_enc *enc)
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
;
}
...
...
libcelt/celt.h
View file @
6baa8e18
...
...
@@ -38,6 +38,7 @@ typedef struct CELTDecoder CELTDecoder;
typedef
struct
CELTMode
CELTMode
;
extern
const
CELTMode
const
*
celt_mode1
;
extern
const
CELTMode
const
*
celt_mode2
;
/* Encoder stuff */
...
...
libcelt/modes.c
View file @
6baa8e18
...
...
@@ -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 @@ const CELTMode mode1 = {
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
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment