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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Alexander Traud
Opus
Commits
896471dc
Commit
896471dc
authored
16 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
Disabling the folding sign bit
parent
a2012d8d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
libcelt/bands.c
+2
-10
2 additions, 10 deletions
libcelt/bands.c
libcelt/rate.c
+1
-10
1 addition, 10 deletions
libcelt/rate.c
libcelt/vq.c
+6
-46
6 additions, 46 deletions
libcelt/vq.c
libcelt/vq.h
+1
-7
1 addition, 7 deletions
libcelt/vq.h
with
10 additions
and
73 deletions
libcelt/bands.c
+
2
−
10
View file @
896471dc
...
...
@@ -413,11 +413,7 @@ void quant_bands(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, ce
/* If pitch isn't available, use intra-frame prediction */
if
(
eBands
[
i
]
>=
m
->
pitchEnd
||
q
<=
0
)
{
q
-=
1
;
if
(
q
<
0
)
intra_fold
(
m
,
X
+
C
*
eBands
[
i
],
eBands
[
i
+
1
]
-
eBands
[
i
],
norm
,
P
+
C
*
eBands
[
i
],
eBands
[
i
],
B
);
else
intra_prediction
(
m
,
X
+
C
*
eBands
[
i
],
W
+
C
*
eBands
[
i
],
eBands
[
i
+
1
]
-
eBands
[
i
],
q
,
norm
,
P
+
C
*
eBands
[
i
],
eBands
[
i
],
B
,
enc
);
intra_fold
(
m
,
X
+
C
*
eBands
[
i
],
eBands
[
i
+
1
]
-
eBands
[
i
],
q
,
norm
,
P
+
C
*
eBands
[
i
],
eBands
[
i
],
B
);
}
if
(
q
>
0
)
...
...
@@ -500,11 +496,7 @@ void unquant_bands(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P,
/* If pitch isn't available, use intra-frame prediction */
if
(
eBands
[
i
]
>=
m
->
pitchEnd
||
q
<=
0
)
{
q
-=
1
;
if
(
q
<
0
)
intra_fold
(
m
,
X
+
C
*
eBands
[
i
],
eBands
[
i
+
1
]
-
eBands
[
i
],
norm
,
P
+
C
*
eBands
[
i
],
eBands
[
i
],
B
);
else
intra_unquant
(
m
,
X
+
C
*
eBands
[
i
],
eBands
[
i
+
1
]
-
eBands
[
i
],
q
,
norm
,
P
+
C
*
eBands
[
i
],
eBands
[
i
],
B
,
dec
);
intra_fold
(
m
,
X
+
C
*
eBands
[
i
],
eBands
[
i
+
1
]
-
eBands
[
i
],
q
,
norm
,
P
+
C
*
eBands
[
i
],
eBands
[
i
],
B
);
}
if
(
q
>
0
)
...
...
This diff is collapsed.
Click to expand it.
libcelt/rate.c
+
1
−
10
View file @
896471dc
...
...
@@ -69,16 +69,7 @@ celt_int16_t **compute_alloc_cache(CELTMode *m, int C)
int
pulses
=
j
;
/* For bands where there's no pitch, id 1 corresponds to intra prediction
with no pulse. id 2 means intra prediction with one pulse, and so on.*/
if
(
eBands
[
i
]
>=
m
->
pitchEnd
)
pulses
-=
1
;
if
(
pulses
<
0
)
bits
[
i
][
j
]
=
0
;
else
{
bits
[
i
][
j
]
=
get_required_bits
(
N
,
pulses
,
BITRES
);
/* Add the intra-frame prediction sign bit */
if
(
eBands
[
i
]
>=
m
->
pitchEnd
)
bits
[
i
][
j
]
+=
(
1
<<
BITRES
);
}
bits
[
i
][
j
]
=
get_required_bits
(
N
,
pulses
,
BITRES
);
}
for
(;
j
<
MAX_PULSES
;
j
++
)
bits
[
i
][
j
]
=
BITOVERFLOW
;
...
...
This diff is collapsed.
Click to expand it.
libcelt/vq.c
+
6
−
46
View file @
896471dc
...
...
@@ -304,58 +304,18 @@ static void fold(const CELTMode *m, int N, celt_norm_t *Y, celt_norm_t * restric
#define KGAIN 6
void
intra_
prediction
(
const
CELTMode
*
m
,
celt_norm_t
*
restrict
x
,
celt_mask_t
*
W
,
int
N
,
int
K
,
celt_norm_t
*
Y
,
celt_norm_t
*
restrict
P
,
int
N0
,
int
B
,
ec_enc
*
enc
)
void
intra_
fold
(
const
CELTMode
*
m
,
celt_norm_t
*
restrict
x
,
int
N
,
int
K
,
celt_norm_t
*
Y
,
celt_norm_t
*
restrict
P
,
int
N0
,
int
B
)
{
int
j
;
celt_word16_t
s
=
1
;
int
sign
;
celt_word16_t
pred_gain
;
celt_word32_t
xy
=
0
;
const
int
C
=
CHANNELS
(
m
);
pred_gain
=
celt_div
((
celt_word32_t
)
MULT16_16
(
Q15_ONE
,
N
),(
celt_word32_t
)(
N
+
KGAIN
*
K
));
fold
(
m
,
N
,
Y
,
P
,
N0
,
B
);
for
(
j
=
0
;
j
<
C
*
N
;
j
++
)
xy
=
MAC16_16
(
xy
,
P
[
j
],
x
[
j
]);
if
(
xy
<
0
)
{
s
=
-
1
;
sign
=
1
;
}
else
{
s
=
1
;
sign
=
0
;
}
ec_enc_bits
(
enc
,
sign
,
1
);
renormalise_vector
(
P
,
s
*
pred_gain
,
C
*
N
,
1
);
}
void
intra_unquant
(
const
CELTMode
*
m
,
celt_norm_t
*
x
,
int
N
,
int
K
,
celt_norm_t
*
Y
,
celt_norm_t
*
restrict
P
,
int
N0
,
int
B
,
ec_dec
*
dec
)
{
celt_word16_t
s
;
celt_word16_t
pred_gain
;
const
int
C
=
CHANNELS
(
m
);
if
(
ec_dec_bits
(
dec
,
1
)
==
0
)
s
=
1
;
if
(
K
==
0
)
pred_gain
=
Q15ONE
;
else
s
=
-
1
;
pred_gain
=
celt_div
((
celt_word32_t
)
MULT16_16
(
Q15_ONE
,
N
),(
celt_word32_t
)(
N
+
KGAIN
*
K
));
fold
(
m
,
N
,
Y
,
P
,
N0
,
B
);
renormalise_vector
(
P
,
s
*
pred_gain
,
C
*
N
,
1
);
}
void
intra_fold
(
const
CELTMode
*
m
,
celt_norm_t
*
x
,
int
N
,
celt_norm_t
*
Y
,
celt_norm_t
*
restrict
P
,
int
N0
,
int
B
)
{
const
int
C
=
CHANNELS
(
m
);
pred_gain
=
celt_div
((
celt_word32_t
)
MULT16_16
(
Q15_ONE
,
N
),(
celt_word32_t
)(
N
+
KGAIN
*
K
));
fold
(
m
,
N
,
Y
,
P
,
N0
,
B
);
renormalise_vector
(
P
,
Q15ONE
,
C
*
N
,
1
);
renormalise_vector
(
P
,
pred_gain
,
C
*
N
,
1
);
}
This diff is collapsed.
Click to expand it.
libcelt/vq.h
+
1
−
7
View file @
896471dc
...
...
@@ -73,13 +73,7 @@ void renormalise_vector(celt_norm_t *X, celt_word16_t value, int N, int stride);
* @param P Pitch vector (it is assumed that p+x is a unit vector)
* @param B Stride (number of channels multiplied by the number of MDCTs per frame)
* @param N0 Number of valid offsets
* @param enc Entropy encoder state
*/
void
intra_prediction
(
const
CELTMode
*
m
,
celt_norm_t
*
restrict
x
,
celt_mask_t
*
W
,
int
N
,
int
K
,
celt_norm_t
*
Y
,
celt_norm_t
*
restrict
P
,
int
N0
,
int
B
,
ec_enc
*
enc
);
void
intra_unquant
(
const
CELTMode
*
m
,
celt_norm_t
*
x
,
int
N
,
int
K
,
celt_norm_t
*
Y
,
celt_norm_t
*
P
,
int
N0
,
int
B
,
ec_dec
*
dec
);
/** Encode the entire band as a "fold" from other parts of the spectrum. No bits required (only use is case of an emergency!) */
void
intra_fold
(
const
CELTMode
*
m
,
celt_norm_t
*
x
,
int
N
,
celt_norm_t
*
Y
,
celt_norm_t
*
P
,
int
N0
,
int
B
);
void
intra_fold
(
const
CELTMode
*
m
,
celt_norm_t
*
restrict
x
,
int
N
,
int
K
,
celt_norm_t
*
Y
,
celt_norm_t
*
restrict
P
,
int
N0
,
int
B
);
#endif
/* VQ_H */
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