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
0aa3903a
Commit
0aa3903a
authored
17 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
Cheating decoder now produces the same result as the encoder
parent
6e9058ad
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
libcelt/bands.c
+1
-1
1 addition, 1 deletion
libcelt/bands.c
libcelt/testcelt.c
+1
-1
1 addition, 1 deletion
libcelt/testcelt.c
libcelt/vq.c
+11
-7
11 additions, 7 deletions
libcelt/vq.c
with
13 additions
and
9 deletions
libcelt/bands.c
+
1
−
1
View file @
0aa3903a
...
...
@@ -197,7 +197,7 @@ void unquant_bands(const CELTMode *m, float *X, float *P, ec_dec *dec)
float
n
=
sqrt
(
B
*
(
eBands
[
i
+
1
]
-
eBands
[
i
]));
for
(
j
=
B
*
eBands
[
i
];
j
<
B
*
eBands
[
i
+
1
];
j
++
)
X
[
j
]
=
0
;
//
copy_unquant(X+B*eBands[i], B*(eBands[i+1]-eBands[i]), -q, norm, B, eBands[i], dec);
copy_unquant
(
X
+
B
*
eBands
[
i
],
B
*
(
eBands
[
i
+
1
]
-
eBands
[
i
]),
-
q
,
norm
,
B
,
eBands
[
i
],
dec
);
for
(
j
=
B
*
eBands
[
i
];
j
<
B
*
eBands
[
i
+
1
];
j
++
)
norm
[
j
]
=
X
[
j
]
*
n
;
}
...
...
This diff is collapsed.
Click to expand it.
libcelt/testcelt.c
+
1
−
1
View file @
0aa3903a
...
...
@@ -59,7 +59,7 @@ int main(int argc, char *argv[])
fread
(
in
,
sizeof
(
short
),
FRAME_SIZE
,
fin
);
celt_encode
(
enc
,
in
);
data
=
celt_encoder_get_bytes
(
enc
,
&
len
);
//
celt_decode(dec, data, len, in);
celt_decode
(
dec
,
data
,
len
,
in
);
fwrite
(
in
,
sizeof
(
short
),
FRAME_SIZE
,
fout
);
}
celt_encoder_destroy
(
enc
);
...
...
This diff is collapsed.
Click to expand it.
libcelt/vq.c
+
11
−
7
View file @
0aa3903a
...
...
@@ -199,6 +199,7 @@ void copy_quant(float *x, int N, int K, float *Y, int B, int N0, ec_enc *enc)
int
best
=
0
;
float
best_score
=
0
;
float
s
=
1
;
int
sign
;
float
E
;
for
(
i
=
0
;
i
<
N0
*
B
-
N
;
i
+=
B
)
{
...
...
@@ -221,11 +222,12 @@ void copy_quant(float *x, int N, int K, float *Y, int B, int N0, ec_enc *enc)
s
=
-
1
;
}
}
//printf ("e%d e%d ", s, best);
if
(
s
==-
1
)
ec_enc_uint
(
enc
,
1
,
1
);
if
(
s
<
0
)
sign
=
1
;
else
ec_enc_uint
(
enc
,
0
,
1
);
sign
=
0
;
//printf ("%d %d ", sign, best);
ec_enc_uint
(
enc
,
sign
,
2
);
ec_enc_uint
(
enc
,
best
/
B
,
N0
-
N
/
B
);
//printf ("%d %f\n", best, best_score);
if
(
K
==
0
)
...
...
@@ -302,16 +304,18 @@ void alg_unquant(float *x, int N, int K, float *p, ec_dec *dec)
void
copy_unquant
(
float
*
x
,
int
N
,
int
K
,
float
*
Y
,
int
B
,
int
N0
,
ec_dec
*
dec
)
{
int
i
,
j
;
int
s
;
int
sign
;
float
s
;
int
best
;
float
E
;
if
(
ec_dec_uint
(
dec
,
1
)
==
0
)
sign
=
ec_dec_uint
(
dec
,
2
);
if
(
sign
==
0
)
s
=
1
;
else
s
=
-
1
;
best
=
B
*
ec_dec_uint
(
dec
,
N0
-
N
/
B
);
printf
(
"
d
%d
d
%d "
,
s
,
best
);
//
printf ("%d %d ", s
ign
, best);
if
(
K
==
0
)
{
...
...
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