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
80e68ce1
Commit
80e68ce1
authored
Jun 10, 2019
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_normalize: fix filtering of RGB0 formats
parent
19541616
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
vf_normalize.c
libavfilter/vf_normalize.c
+9
-7
No files found.
libavfilter/vf_normalize.c
View file @
80e68ce1
...
@@ -76,6 +76,7 @@
...
@@ -76,6 +76,7 @@
#include "libavutil/opt.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "avfilter.h"
#include "drawutils.h"
#include "formats.h"
#include "formats.h"
#include "internal.h"
#include "internal.h"
#include "video.h"
#include "video.h"
...
@@ -90,8 +91,9 @@ typedef struct NormalizeContext {
...
@@ -90,8 +91,9 @@ typedef struct NormalizeContext {
float
independence
;
float
independence
;
float
strength
;
float
strength
;
int
co
[
4
];
// Offsets to R,G,B,A bytes respectively in each pixel
uint8_t
co
[
4
];
// Offsets to R,G,B,A bytes respectively in each pixel
int
num_components
;
// Number of components in the pixel format
int
num_components
;
// Number of components in the pixel format
int
step
;
int
history_len
;
// Number of frames to average; based on smoothing factor
int
history_len
;
// Number of frames to average; based on smoothing factor
int
frame_num
;
// Increments on each frame, starting from 0.
int
frame_num
;
// Increments on each frame, starting from 0.
...
@@ -147,8 +149,8 @@ static void normalize(NormalizeContext *s, AVFrame *in, AVFrame *out)
...
@@ -147,8 +149,8 @@ static void normalize(NormalizeContext *s, AVFrame *in, AVFrame *out)
min
[
c
].
in
=
FFMIN
(
min
[
c
].
in
,
inp
[
s
->
co
[
c
]]);
min
[
c
].
in
=
FFMIN
(
min
[
c
].
in
,
inp
[
s
->
co
[
c
]]);
max
[
c
].
in
=
FFMAX
(
max
[
c
].
in
,
inp
[
s
->
co
[
c
]]);
max
[
c
].
in
=
FFMAX
(
max
[
c
].
in
,
inp
[
s
->
co
[
c
]]);
}
}
inp
+=
s
->
num_components
;
inp
+=
s
->
step
;
outp
+=
s
->
num_components
;
outp
+=
s
->
step
;
}
}
}
}
...
@@ -237,8 +239,8 @@ static void normalize(NormalizeContext *s, AVFrame *in, AVFrame *out)
...
@@ -237,8 +239,8 @@ static void normalize(NormalizeContext *s, AVFrame *in, AVFrame *out)
if
(
s
->
num_components
==
4
)
if
(
s
->
num_components
==
4
)
// Copy alpha as-is.
// Copy alpha as-is.
outp
[
s
->
co
[
3
]]
=
inp
[
s
->
co
[
3
]];
outp
[
s
->
co
[
3
]]
=
inp
[
s
->
co
[
3
]];
inp
+=
s
->
num_components
;
inp
+=
s
->
step
;
outp
+=
s
->
num_components
;
outp
+=
s
->
step
;
}
}
}
}
...
@@ -286,9 +288,9 @@ static int config_input(AVFilterLink *inlink)
...
@@ -286,9 +288,9 @@ static int config_input(AVFilterLink *inlink)
const
AVPixFmtDescriptor
*
desc
=
av_pix_fmt_desc_get
(
inlink
->
format
);
const
AVPixFmtDescriptor
*
desc
=
av_pix_fmt_desc_get
(
inlink
->
format
);
int
c
;
int
c
;
for
(
c
=
0
;
c
<
4
;
++
c
)
ff_fill_rgba_map
(
s
->
co
,
inlink
->
format
);
s
->
co
[
c
]
=
desc
->
comp
[
c
].
offset
;
s
->
num_components
=
desc
->
nb_components
;
s
->
num_components
=
desc
->
nb_components
;
s
->
step
=
av_get_padded_bits_per_pixel
(
desc
)
>>
3
;
// Convert smoothing value to history_len (a count of frames to average,
// Convert smoothing value to history_len (a count of frames to average,
// must be at least 1). Currently this is a direct assignment, but the
// must be at least 1). Currently this is a direct assignment, but the
// smoothing value was originally envisaged as a number of seconds. In
// smoothing value was originally envisaged as a number of seconds. In
...
...
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