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
496d97f4
Commit
496d97f4
authored
Aug 26, 2016
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_owdenoise: hight bit-depth support
parent
f077ad69
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
8 deletions
+38
-8
vf_owdenoise.c
libavfilter/vf_owdenoise.c
+38
-8
No files found.
libavfilter/vf_owdenoise.c
View file @
496d97f4
...
...
@@ -42,6 +42,7 @@ typedef struct {
float
*
plane
[
16
+
1
][
4
];
int
linesize
;
int
hsub
,
vsub
;
int
pixel_depth
;
}
OWDenoiseContext
;
#define OFFSET(x) offsetof(OWDenoiseContext, x)
...
...
@@ -188,9 +189,18 @@ static void filter(OWDenoiseContext *s,
while
(
1
<<
depth
>
width
||
1
<<
depth
>
height
)
depth
--
;
for
(
y
=
0
;
y
<
height
;
y
++
)
for
(
x
=
0
;
x
<
width
;
x
++
)
s
->
plane
[
0
][
0
][
y
*
s
->
linesize
+
x
]
=
src
[
y
*
src_linesize
+
x
];
if
(
s
->
pixel_depth
<=
8
)
{
for
(
y
=
0
;
y
<
height
;
y
++
)
for
(
x
=
0
;
x
<
width
;
x
++
)
s
->
plane
[
0
][
0
][
y
*
s
->
linesize
+
x
]
=
src
[
y
*
src_linesize
+
x
];
}
else
{
const
uint16_t
*
src16
=
(
const
uint16_t
*
)
src
;
src_linesize
/=
2
;
for
(
y
=
0
;
y
<
height
;
y
++
)
for
(
x
=
0
;
x
<
width
;
x
++
)
s
->
plane
[
0
][
0
][
y
*
s
->
linesize
+
x
]
=
src16
[
y
*
src_linesize
+
x
];
}
for
(
i
=
0
;
i
<
depth
;
i
++
)
decompose2D2
(
s
->
plane
[
i
+
1
],
s
->
plane
[
i
][
0
],
s
->
plane
[
0
]
+
1
,
s
->
linesize
,
1
<<
i
,
width
,
height
);
...
...
@@ -211,11 +221,23 @@ static void filter(OWDenoiseContext *s,
for
(
i
=
depth
-
1
;
i
>=
0
;
i
--
)
compose2D2
(
s
->
plane
[
i
][
0
],
s
->
plane
[
i
+
1
],
s
->
plane
[
0
]
+
1
,
s
->
linesize
,
1
<<
i
,
width
,
height
);
for
(
y
=
0
;
y
<
height
;
y
++
)
{
for
(
x
=
0
;
x
<
width
;
x
++
)
{
i
=
s
->
plane
[
0
][
0
][
y
*
s
->
linesize
+
x
]
+
dither
[
x
&
7
][
y
&
7
]
*
(
1
.
0
/
64
)
+
1
.
0
/
128
;
// yes the rounding is insane but optimal :)
if
((
unsigned
)
i
>
255U
)
i
=
~
(
i
>>
31
);
dst
[
y
*
dst_linesize
+
x
]
=
i
;
if
(
s
->
pixel_depth
<=
8
)
{
for
(
y
=
0
;
y
<
height
;
y
++
)
{
for
(
x
=
0
;
x
<
width
;
x
++
)
{
i
=
s
->
plane
[
0
][
0
][
y
*
s
->
linesize
+
x
]
+
dither
[
x
&
7
][
y
&
7
]
*
(
1
.
0
/
64
)
+
1
.
0
/
128
;
// yes the rounding is insane but optimal :)
if
((
unsigned
)
i
>
255U
)
i
=
~
(
i
>>
31
);
dst
[
y
*
dst_linesize
+
x
]
=
i
;
}
}
}
else
{
uint16_t
*
dst16
=
(
uint16_t
*
)
dst
;
dst_linesize
/=
2
;
for
(
y
=
0
;
y
<
height
;
y
++
)
{
for
(
x
=
0
;
x
<
width
;
x
++
)
{
i
=
s
->
plane
[
0
][
0
][
y
*
s
->
linesize
+
x
];
dst16
[
y
*
dst_linesize
+
x
]
=
i
;
}
}
}
}
...
...
@@ -277,6 +299,13 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_YUV410P
,
AV_PIX_FMT_YUV440P
,
AV_PIX_FMT_YUVA444P
,
AV_PIX_FMT_YUVA422P
,
AV_PIX_FMT_YUVA420P
,
AV_PIX_FMT_YUV420P9
,
AV_PIX_FMT_YUV422P9
,
AV_PIX_FMT_YUV444P9
,
AV_PIX_FMT_YUV420P10
,
AV_PIX_FMT_YUV422P10
,
AV_PIX_FMT_YUV444P10
,
AV_PIX_FMT_YUV440P10
,
AV_PIX_FMT_YUV444P12
,
AV_PIX_FMT_YUV422P12
,
AV_PIX_FMT_YUV420P12
,
AV_PIX_FMT_YUV440P12
,
AV_PIX_FMT_YUV444P14
,
AV_PIX_FMT_YUV422P14
,
AV_PIX_FMT_YUV420P14
,
AV_PIX_FMT_YUV420P16
,
AV_PIX_FMT_YUV422P16
,
AV_PIX_FMT_YUV444P16
,
AV_PIX_FMT_NONE
};
AVFilterFormats
*
fmts_list
=
ff_make_format_list
(
pix_fmts
);
...
...
@@ -294,6 +323,7 @@ static int config_input(AVFilterLink *inlink)
s
->
hsub
=
desc
->
log2_chroma_w
;
s
->
vsub
=
desc
->
log2_chroma_h
;
s
->
pixel_depth
=
desc
->
comp
[
0
].
depth
;
s
->
linesize
=
FFALIGN
(
inlink
->
w
,
16
);
for
(
j
=
0
;
j
<
4
;
j
++
)
{
...
...
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