Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Opus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xiph.Org
Opus
Commits
2dd3d325
Commit
2dd3d325
authored
15 years ago
by
Gregory Maxwell
Browse files
Options
Downloads
Patches
Plain Diff
For celt_encoder_ctl CELT_SET_LTP is replaced with CELT_SET_PREDICTION
which allows the caller to request that frames be independent.
parent
f43488cd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libcelt/celt.c
+21
-10
21 additions, 10 deletions
libcelt/celt.c
libcelt/celt.h
+7
-3
7 additions, 3 deletions
libcelt/celt.h
with
28 additions
and
13 deletions
libcelt/celt.c
+
21
−
10
View file @
2dd3d325
...
...
@@ -79,8 +79,10 @@ struct CELTEncoder {
int
overlap
;
int
channels
;
int
pitch_enabled
;
int
pitch_available
;
int
pitch_enabled
;
/* Complexity level is allowed to use pitch */
int
pitch_permitted
;
/* Use of the LTP is permitted by the user */
int
pitch_available
;
/* Amount of pitch buffer available */
int
force_intra
;
int
delayedIntra
;
celt_word16_t
tonal_average
;
int
fold_decision
;
...
...
@@ -137,7 +139,9 @@ CELTEncoder *celt_encoder_create(const CELTMode *mode)
st
->
VBR_rate
=
0
;
st
->
pitch_enabled
=
1
;
st
->
pitch_permitted
=
1
;
st
->
pitch_available
=
1
;
st
->
force_intra
=
0
;
st
->
delayedIntra
=
1
;
st
->
tonal_average
=
QCONST16
(
1
.,
8
);
st
->
fold_decision
=
1
;
...
...
@@ -669,14 +673,14 @@ int celt_encode_float(CELTEncoder * restrict st, const celt_sig_t * pcm, celt_si
compute_band_energies
(
st
->
mode
,
freq
,
bandE
);
intra_ener
=
st
->
delayedIntra
;
if
(
intra_decision
(
bandE
,
st
->
oldBandE
,
st
->
mode
->
nbEBands
)
||
shortBlocks
)
intra_ener
=
(
st
->
force_intra
||
st
->
delayedIntra
)
;
if
(
shortBlocks
||
intra_decision
(
bandE
,
st
->
oldBandE
,
st
->
mode
->
nbEBands
))
st
->
delayedIntra
=
1
;
else
st
->
delayedIntra
=
0
;
/* Pitch analysis: we do it early to save on the peak stack space */
/* Don't use pitch if there isn't enough data available yet, or if we're using shortBlocks */
has_pitch
=
st
->
pitch_enabled
&&
(
st
->
pitch_available
>=
MAX_PERIOD
)
&&
(
!
shortBlocks
)
&&
!
intra_ener
;
has_pitch
=
st
->
pitch_enabled
&&
st
->
pitch_permitted
&&
(
st
->
pitch_available
>=
MAX_PERIOD
)
&&
(
!
shortBlocks
)
&&
!
intra_ener
;
#ifdef EXP_PSY
ALLOC
(
tonality
,
MAX_PERIOD
/
4
,
celt_word16_t
);
{
...
...
@@ -1013,15 +1017,22 @@ int celt_encoder_ctl(CELTEncoder * restrict st, int request, ...)
}
}
break
;
case
CELT_SET_
LTP
_REQUEST
:
case
CELT_SET_
PREDICTION
_REQUEST
:
{
int
value
=
va_arg
(
ap
,
celt_int32_t
);
if
(
value
<
0
||
value
>
1
||
(
value
==
1
&&
st
->
pitch_available
==
0
)
)
if
(
value
<
0
||
value
>
2
)
goto
bad_arg
;
if
(
value
==
0
)
st
->
pitch_enabled
=
0
;
else
st
->
pitch_enabled
=
1
;
{
st
->
force_intra
=
1
;
st
->
pitch_permitted
=
0
;
}
else
if
(
value
=
1
)
{
st
->
force_intra
=
0
;
st
->
pitch_permitted
=
0
;
}
else
{
st
->
force_intra
=
0
;
st
->
pitch_permitted
=
1
;
}
}
break
;
case
CELT_SET_VBR_RATE_REQUEST
:
...
...
This diff is collapsed.
Click to expand it.
libcelt/celt.h
+
7
−
3
View file @
2dd3d325
...
...
@@ -77,9 +77,13 @@ extern "C" {
#define CELT_SET_COMPLEXITY_REQUEST 2
/** Controls the complexity from 0-10 (int) */
#define CELT_SET_COMPLEXITY(x) CELT_SET_COMPLEXITY_REQUEST, _celt_check_int(x)
#define CELT_SET_LTP_REQUEST 4
/** Activate or deactivate the use of the long term predictor (PITCH) from 0 or 1 (int) */
#define CELT_SET_LTP(x) CELT_SET_LTP_REQUEST, _celt_check_int(x)
#define CELT_SET_PREDICTION_REQUEST 4
/** Controls the use of interframe prediction.
0=Independent frames
1=Short term interframe prediction allowed
2=Long term prediction allowed
*/
#define CELT_SET_PREDICTION(x) CELT_SET_PREDICTION_REQUEST, _celt_check_int(x)
#define CELT_SET_VBR_RATE_REQUEST 6
/** Set the target VBR rate in bits per second (int); 0=CBR (default) */
#define CELT_SET_VBR_RATE(x) CELT_SET_VBR_RATE_REQUEST, _celt_check_int(x)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment