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
6cde5dd2
Commit
6cde5dd2
authored
16 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
alg_quant() now handles the sign of X[] separately from the quantisation
process
parent
8ed86581
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/vq.c
+16
-6
16 additions, 6 deletions
libcelt/vq.c
libcelt/vq.h
+1
-1
1 addition, 1 deletion
libcelt/vq.h
with
17 additions
and
7 deletions
libcelt/vq.c
+
16
−
6
View file @
6cde5dd2
...
...
@@ -91,7 +91,7 @@ static void mix_pitch_and_residual(int * restrict iy, celt_norm_t * restrict X,
}
void
alg_quant
(
celt_norm_t
*
X
,
celt_mask_t
*
W
,
int
N
,
int
K
,
const
celt_norm_t
*
P
,
ec_enc
*
enc
)
void
alg_quant
(
celt_norm_t
*
X
,
celt_mask_t
*
W
,
int
N
,
int
K
,
celt_norm_t
*
P
,
ec_enc
*
enc
)
{
VARDECL
(
celt_norm_t
,
y
);
VARDECL
(
int
,
iy
);
...
...
@@ -122,8 +122,11 @@ void alg_quant(celt_norm_t *X, celt_mask_t *W, int N, int K, const celt_norm_t *
X
[
j
]
-=
P
[
j
];
if
(
X
[
j
]
>
0
)
signx
[
j
]
=
1
;
else
else
{
signx
[
j
]
=-
1
;
X
[
j
]
=-
X
[
j
];
P
[
j
]
=-
P
[
j
];
}
iy
[
j
]
=
0
;
y
[
j
]
=
0
;
sum
=
MAC16_16
(
sum
,
P
[
j
],
P
[
j
]);
...
...
@@ -164,7 +167,7 @@ void alg_quant(celt_norm_t *X, celt_mask_t *W, int N, int K, const celt_norm_t *
do
{
celt_word16_t
Rxy
,
Ryy
;
/* Select sign based on X[j] alone */
s
=
MULT16_16
(
signx
[
j
],
magnitude
)
;
s
=
magnitude
;
/* Temporary sums of the new pulse(s) */
Rxy
=
EXTRACT16
(
SHR32
(
MAC16_16
(
xy
,
s
,
X
[
j
]),
rshift
));
/* We're multiplying y[j] by two so we don't have to do it here */
...
...
@@ -185,7 +188,7 @@ void alg_quant(celt_norm_t *X, celt_mask_t *W, int N, int K, const celt_norm_t *
}
while
(
++
j
<
N
);
j
=
best_id
;
is
=
MULT16_16
(
signx
[
j
],
pulsesAtOnce
)
;
is
=
pulsesAtOnce
;
s
=
SHL16
(
is
,
yshift
);
/* Updating the sums of the new pulse(s) */
...
...
@@ -216,7 +219,7 @@ void alg_quant(celt_norm_t *X, celt_mask_t *W, int N, int K, const celt_norm_t *
celt_word16_t
Rxy
,
Ryy
,
Ryp
;
celt_word16_t
num
;
/* Select sign based on X[j] alone */
s
=
MULT16_16
(
signx
[
j
],
magnitude
)
;
s
=
magnitude
;
/* Temporary sums of the new pulse(s) */
Rxy
=
ROUND16
(
MAC16_16
(
xy
,
s
,
X
[
j
]),
14
);
/* We're multiplying y[j] by two so we don't have to do it here */
...
...
@@ -242,8 +245,15 @@ void alg_quant(celt_norm_t *X, celt_mask_t *W, int N, int K, const celt_norm_t *
best_id
=
j
;
}
}
while
(
++
j
<
N
);
iy
[
best_id
]
+=
signx
[
best_id
]
;
iy
[
best_id
]
+=
1
;
}
j
=
0
;
do
{
P
[
j
]
=
MULT16_16
(
signx
[
j
],
P
[
j
]);
X
[
j
]
=
MULT16_16
(
signx
[
j
],
X
[
j
]);
if
(
signx
[
j
]
<
0
)
iy
[
j
]
=
-
iy
[
j
];
}
while
(
++
j
<
N
);
encode_pulses
(
iy
,
N
,
K
,
enc
);
/* Recompute the gain in one pass to reduce the encoder-decoder mismatch
...
...
This diff is collapsed.
Click to expand it.
libcelt/vq.h
+
1
−
1
View file @
6cde5dd2
...
...
@@ -50,7 +50,7 @@
* @param p Pitch vector (it is assumed that p+x is a unit vector)
* @param enc Entropy encoder state
*/
void
alg_quant
(
celt_norm_t
*
X
,
celt_mask_t
*
W
,
int
N
,
int
K
,
const
celt_norm_t
*
P
,
ec_enc
*
enc
);
void
alg_quant
(
celt_norm_t
*
X
,
celt_mask_t
*
W
,
int
N
,
int
K
,
celt_norm_t
*
P
,
ec_enc
*
enc
);
/** Algebraic pulse decoder
* @param x Decoded normalised spectrum (returned)
...
...
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