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
468c5395
Commit
468c5395
authored
Dec 07, 2007
by
Jean-Marc Valin
Browse files
More code for laplace decoding (doesn't work)
parent
6887fb51
Changes
1
Hide whitespace changes
Inline
Side-by-side
libentcode/laplace.c
View file @
468c5395
...
...
@@ -63,15 +63,27 @@ void ec_laplace_encode(ec_enc *enc, int value, int decay)
ec_encode
(
enc
,
fl
,
fs
,
ft
);
}
void
ec_laplace_decode
(
ec_dec
*
dec
,
int
decay
)
int
ec_laplace_decode
(
ec_dec
*
dec
,
int
decay
)
{
int
val
;
int
fl
,
fh
,
fs
,
ft
,
fm
;
ft
=
ec_laplace_get_total
(
decay
);
fm
=
ec_decode
(
dec
,
ft
);
printf
(
"dec: %d/%d
\n
"
,
fm
,
ft
);
//loop on values here to find fl, fh
//ec_dec_update(dec, fl, fh, ft);
fl
=
0
;
fs
=
1
<<
15
;
fh
=
fs
;
while
(
fm
>=
fh
)
{
fl
=
fh
;
fs
=
(
fs
*
decay
)
>>
14
;
fh
+=
fs
*
2
;
val
++
;
}
if
(
fm
>=
fl
+
fs
)
val
=
-
val
;
ec_dec_update
(
dec
,
fl
,
fh
,
ft
);
}
#if 0
...
...
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