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
1908818e
Commit
1908818e
authored
Jan 12, 2020
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_normalize: move luts into private context
parent
273886fa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
vf_normalize.c
libavfilter/vf_normalize.c
+4
-4
No files found.
libavfilter/vf_normalize.c
View file @
1908818e
...
...
@@ -112,6 +112,7 @@ typedef struct NormalizeContext {
NormalizeHistory
min
[
3
],
max
[
3
];
// Min and max for each channel in {R,G,B}.
uint8_t
*
history_mem
;
// Single allocation for above history entries
uint8_t
lut
[
3
][
256
];
// Lookup table
}
NormalizeContext
;
#define OFFSET(x) offsetof(NormalizeContext, x)
...
...
@@ -139,7 +140,6 @@ static void normalize(NormalizeContext *s, AVFrame *in, AVFrame *out)
float
rgb_min_smoothed
;
// Min input range for linked normalization
float
rgb_max_smoothed
;
// Max input range for linked normalization
uint8_t
lut
[
3
][
256
];
// Lookup table
int
x
,
y
,
c
;
// First, scan the input frame to find, for each channel, the minimum
...
...
@@ -216,7 +216,7 @@ static void normalize(NormalizeContext *s, AVFrame *in, AVFrame *out)
if
(
min
[
c
].
smoothed
==
max
[
c
].
smoothed
)
{
// There is no dynamic range to expand. No mapping for this channel.
for
(
in_val
=
min
[
c
].
in
;
in_val
<=
max
[
c
].
in
;
in_val
++
)
lut
[
c
][
in_val
]
=
min
[
c
].
out
;
s
->
lut
[
c
][
in_val
]
=
min
[
c
].
out
;
}
else
{
// We must set lookup values for all values in the original input
// range [min.in,max.in]. Since the original input range may be
...
...
@@ -227,7 +227,7 @@ static void normalize(NormalizeContext *s, AVFrame *in, AVFrame *out)
int
out_val
=
(
in_val
-
min
[
c
].
smoothed
)
*
scale
+
min
[
c
].
out
+
0
.
5
f
;
out_val
=
FFMAX
(
out_val
,
0
);
out_val
=
FFMIN
(
out_val
,
255
);
lut
[
c
][
in_val
]
=
out_val
;
s
->
lut
[
c
][
in_val
]
=
out_val
;
}
}
}
...
...
@@ -238,7 +238,7 @@ static void normalize(NormalizeContext *s, AVFrame *in, AVFrame *out)
uint8_t
*
outp
=
out
->
data
[
0
]
+
y
*
out
->
linesize
[
0
];
for
(
x
=
0
;
x
<
in
->
width
;
x
++
)
{
for
(
c
=
0
;
c
<
3
;
c
++
)
outp
[
s
->
co
[
c
]]
=
lut
[
c
][
inp
[
s
->
co
[
c
]]];
outp
[
s
->
co
[
c
]]
=
s
->
lut
[
c
][
inp
[
s
->
co
[
c
]]];
if
(
s
->
num_components
==
4
)
// Copy alpha as-is.
outp
[
s
->
co
[
3
]]
=
inp
[
s
->
co
[
3
]];
...
...
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