Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
269a0dee
Commit
269a0dee
authored
Nov 05, 2011
by
Mashiat Sarker Shakkhar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement lms_update()
parent
0faae518
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
0 deletions
+49
-0
wmalosslessdec.c
libavcodec/wmalosslessdec.c
+49
-0
No files found.
libavcodec/wmalosslessdec.c
View file @
269a0dee
...
...
@@ -771,6 +771,55 @@ static int lms_predict(WmallDecodeCtx *s, int ich, int ilms)
return
pred
;
}
static
void
lms_update
(
WmallDecodeCtx
*
s
,
int
ich
,
int
ilms
,
int32_t
input
,
int32_t
pred
)
{
int
icoef
;
int
recent
=
s
->
cdlms
[
ich
][
ilms
].
recent
;
int
range
=
1
<<
(
s
->
bits_per_sample
-
1
);
int
bps
=
s
->
bits_per_sample
>
16
?
4
:
2
;
// bytes per sample
if
(
input
>
pred
)
{
for
(
icoef
=
0
;
icoef
<
s
->
cdlms
[
ich
][
ilms
].
order
;
icoef
++
)
s
->
cdlms
[
ich
][
ilms
].
coefs
[
icoef
]
+=
s
->
cdlms
[
ich
][
ilms
].
lms_updates
[
icoef
+
recent
];
}
else
{
for
(
icoef
=
0
;
icoef
<
s
->
cdlms
[
ich
][
ilms
].
order
;
icoef
++
)
s
->
cdlms
[
ich
][
ilms
].
coefs
[
icoef
]
-=
s
->
cdlms
[
ich
][
ilms
].
lms_updates
[
icoef
];
// XXX: [icoef + recent] ?
}
s
->
cdlms
[
ich
][
ilms
].
recent
--
;
s
->
cdlms
[
ich
][
ilms
].
lms_prevvalues
[
recent
]
=
av_clip
(
input
,
-
range
,
range
-
1
);
if
(
input
>
pred
)
s
->
cdlms
[
ich
][
ilms
].
lms_updates
[
recent
]
=
s
->
update_speed
[
ich
];
else
if
(
input
<
pred
)
s
->
cdlms
[
ich
][
ilms
].
lms_updates
[
recent
]
=
-
s
->
update_speed
[
ich
];
/* XXX: spec says:
cdlms[iCh][ilms].updates[iRecent + cdlms[iCh][ilms].order >> 4] >>= 2;
lms_updates[iCh][ilms][iRecent + cdlms[iCh][ilms].order >> 3] >>= 1;
Questions is - are cdlms[iCh][ilms].updates[] and lms_updates[][][] two
seperate buffers? Here I've assumed that the two are same which makes
more sense to me.
*/
s
->
cdlms
[
ich
][
ilms
].
lms_updates
[
recent
+
s
->
cdlms
[
ich
][
ilms
].
order
>>
4
]
>>=
2
;
s
->
cdlms
[
ich
][
ilms
].
lms_updates
[
recent
+
s
->
cdlms
[
ich
][
ilms
].
order
>>
3
]
>>=
1
;
/* XXX: recent + (s->cdlms[ich][ilms].order >> 4) ? */
if
(
s
->
cdlms
[
ich
][
ilms
].
recent
==
0
)
{
/* XXX: This memcpy()s will probably fail if a fixed 32-bit buffer is used.
follow kshishkov's suggestion of using a union. */
memcpy
(
s
->
cdlms
[
ich
][
ilms
].
lms_prevvalues
+
s
->
cdlms
[
ich
][
ilms
].
order
,
s
->
cdlms
[
ich
][
ilms
].
lms_prevvalues
,
bps
*
s
->
cdlms
[
ich
][
ilms
].
order
);
memcpy
(
s
->
cdlms
[
ich
][
ilms
].
lms_updates
+
s
->
cdlms
[
ich
][
ilms
].
order
,
s
->
cdlms
[
ich
][
ilms
].
lms_updates
,
bps
*
s
->
cdlms
[
ich
][
ilms
].
order
);
s
->
cdlms
[
ich
][
ilms
].
recent
=
s
->
cdlms
[
ich
][
ilms
].
order
;
}
}
/**
*@brief Decode a single subframe (block).
*@param s codec context
...
...
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