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
db592f3b
Commit
db592f3b
authored
Sep 04, 2015
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_waveform: stop abusing s->size for calculating limit
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
55886c67
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
vf_waveform.c
libavfilter/vf_waveform.c
+9
-7
No files found.
libavfilter/vf_waveform.c
View file @
db592f3b
...
@@ -56,6 +56,7 @@ typedef struct WaveformContext {
...
@@ -56,6 +56,7 @@ typedef struct WaveformContext {
int
*
peak
;
int
*
peak
;
int
filter
;
int
filter
;
int
bits
;
int
bits
;
int
max
;
int
size
;
int
size
;
void
(
*
waveform
)(
struct
WaveformContext
*
s
,
AVFrame
*
in
,
AVFrame
*
out
,
void
(
*
waveform
)(
struct
WaveformContext
*
s
,
AVFrame
*
in
,
AVFrame
*
out
,
int
component
,
int
intensity
,
int
offset
,
int
column
);
int
component
,
int
intensity
,
int
offset
,
int
column
);
...
@@ -152,8 +153,8 @@ static int query_formats(AVFilterContext *ctx)
...
@@ -152,8 +153,8 @@ static int query_formats(AVFilterContext *ctx)
static
void
envelope_instant16
(
WaveformContext
*
s
,
AVFrame
*
out
,
int
plane
,
int
component
)
static
void
envelope_instant16
(
WaveformContext
*
s
,
AVFrame
*
out
,
int
plane
,
int
component
)
{
{
const
int
dst_linesize
=
out
->
linesize
[
component
]
/
2
;
const
int
dst_linesize
=
out
->
linesize
[
component
]
/
2
;
const
int
bg
=
s
->
bg_color
[
component
]
*
(
s
->
size
/
256
);
const
int
bg
=
s
->
bg_color
[
component
]
*
(
s
->
max
/
256
);
const
int
limit
=
s
->
size
-
1
;
const
int
limit
=
s
->
max
-
1
;
const
int
is_chroma
=
(
component
==
1
||
component
==
2
);
const
int
is_chroma
=
(
component
==
1
||
component
==
2
);
const
int
shift_w
=
(
is_chroma
?
s
->
desc
->
log2_chroma_w
:
0
);
const
int
shift_w
=
(
is_chroma
?
s
->
desc
->
log2_chroma_w
:
0
);
const
int
shift_h
=
(
is_chroma
?
s
->
desc
->
log2_chroma_h
:
0
);
const
int
shift_h
=
(
is_chroma
?
s
->
desc
->
log2_chroma_h
:
0
);
...
@@ -253,8 +254,8 @@ static void envelope_instant(WaveformContext *s, AVFrame *out, int plane, int co
...
@@ -253,8 +254,8 @@ static void envelope_instant(WaveformContext *s, AVFrame *out, int plane, int co
static
void
envelope_peak16
(
WaveformContext
*
s
,
AVFrame
*
out
,
int
plane
,
int
component
)
static
void
envelope_peak16
(
WaveformContext
*
s
,
AVFrame
*
out
,
int
plane
,
int
component
)
{
{
const
int
dst_linesize
=
out
->
linesize
[
component
]
/
2
;
const
int
dst_linesize
=
out
->
linesize
[
component
]
/
2
;
const
int
bg
=
s
->
bg_color
[
component
]
*
(
s
->
size
/
256
);
const
int
bg
=
s
->
bg_color
[
component
]
*
(
s
->
max
/
256
);
const
int
limit
=
s
->
size
-
1
;
const
int
limit
=
s
->
max
-
1
;
const
int
is_chroma
=
(
component
==
1
||
component
==
2
);
const
int
is_chroma
=
(
component
==
1
||
component
==
2
);
const
int
shift_w
=
(
is_chroma
?
s
->
desc
->
log2_chroma_w
:
0
);
const
int
shift_w
=
(
is_chroma
?
s
->
desc
->
log2_chroma_w
:
0
);
const
int
shift_h
=
(
is_chroma
?
s
->
desc
->
log2_chroma_h
:
0
);
const
int
shift_h
=
(
is_chroma
?
s
->
desc
->
log2_chroma_h
:
0
);
...
@@ -444,7 +445,7 @@ static void lowpass16(WaveformContext *s, AVFrame *in, AVFrame *out,
...
@@ -444,7 +445,7 @@ static void lowpass16(WaveformContext *s, AVFrame *in, AVFrame *out,
const
int
src_linesize
=
in
->
linesize
[
plane
]
/
2
;
const
int
src_linesize
=
in
->
linesize
[
plane
]
/
2
;
const
int
dst_linesize
=
out
->
linesize
[
plane
]
/
2
;
const
int
dst_linesize
=
out
->
linesize
[
plane
]
/
2
;
const
int
dst_signed_linesize
=
dst_linesize
*
(
mirror
==
1
?
-
1
:
1
);
const
int
dst_signed_linesize
=
dst_linesize
*
(
mirror
==
1
?
-
1
:
1
);
const
int
limit
=
s
->
size
-
1
;
const
int
limit
=
s
->
max
-
1
;
const
int
max
=
limit
-
intensity
;
const
int
max
=
limit
-
intensity
;
const
int
src_h
=
FF_CEIL_RSHIFT
(
in
->
height
,
shift_h
);
const
int
src_h
=
FF_CEIL_RSHIFT
(
in
->
height
,
shift_h
);
const
int
src_w
=
FF_CEIL_RSHIFT
(
in
->
width
,
shift_w
);
const
int
src_w
=
FF_CEIL_RSHIFT
(
in
->
width
,
shift_w
);
...
@@ -985,7 +986,7 @@ static void color16(WaveformContext *s, AVFrame *in, AVFrame *out,
...
@@ -985,7 +986,7 @@ static void color16(WaveformContext *s, AVFrame *in, AVFrame *out,
{
{
const
int
plane
=
s
->
desc
->
comp
[
component
].
plane
;
const
int
plane
=
s
->
desc
->
comp
[
component
].
plane
;
const
int
mirror
=
s
->
mirror
;
const
int
mirror
=
s
->
mirror
;
const
int
limit
=
s
->
size
-
1
;
const
int
limit
=
s
->
max
-
1
;
const
uint16_t
*
c0_data
=
(
const
uint16_t
*
)
in
->
data
[
plane
+
0
];
const
uint16_t
*
c0_data
=
(
const
uint16_t
*
)
in
->
data
[
plane
+
0
];
const
uint16_t
*
c1_data
=
(
const
uint16_t
*
)
in
->
data
[(
plane
+
1
)
%
s
->
ncomp
];
const
uint16_t
*
c1_data
=
(
const
uint16_t
*
)
in
->
data
[(
plane
+
1
)
%
s
->
ncomp
];
const
uint16_t
*
c2_data
=
(
const
uint16_t
*
)
in
->
data
[(
plane
+
2
)
%
s
->
ncomp
];
const
uint16_t
*
c2_data
=
(
const
uint16_t
*
)
in
->
data
[(
plane
+
2
)
%
s
->
ncomp
];
...
@@ -1172,7 +1173,8 @@ static int config_input(AVFilterLink *inlink)
...
@@ -1172,7 +1173,8 @@ static int config_input(AVFilterLink *inlink)
s
->
desc
=
av_pix_fmt_desc_get
(
inlink
->
format
);
s
->
desc
=
av_pix_fmt_desc_get
(
inlink
->
format
);
s
->
ncomp
=
s
->
desc
->
nb_components
;
s
->
ncomp
=
s
->
desc
->
nb_components
;
s
->
bits
=
s
->
desc
->
comp
[
0
].
depth_minus1
+
1
;
s
->
bits
=
s
->
desc
->
comp
[
0
].
depth_minus1
+
1
;
s
->
intensity
=
s
->
fintensity
*
((
1
<<
s
->
bits
)
-
1
);
s
->
max
=
1
<<
s
->
bits
;
s
->
intensity
=
s
->
fintensity
*
(
s
->
max
-
1
);
switch
(
s
->
filter
)
{
switch
(
s
->
filter
)
{
case
LOWPASS
:
case
LOWPASS
:
...
...
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