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
c0279956
Commit
c0279956
authored
Mar 18, 2013
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vf_fade: use the name 's' for the pointer to the private context
This is shorter and consistent across filters.
parent
d3735f7a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
28 deletions
+28
-28
vf_fade.c
libavfilter/vf_fade.c
+28
-28
No files found.
libavfilter/vf_fade.c
View file @
c0279956
...
@@ -47,21 +47,21 @@ typedef struct {
...
@@ -47,21 +47,21 @@ typedef struct {
static
av_cold
int
init
(
AVFilterContext
*
ctx
)
static
av_cold
int
init
(
AVFilterContext
*
ctx
)
{
{
FadeContext
*
fade
=
ctx
->
priv
;
FadeContext
*
s
=
ctx
->
priv
;
fade
->
fade_per_frame
=
(
1
<<
16
)
/
fade
->
nb_frames
;
s
->
fade_per_frame
=
(
1
<<
16
)
/
s
->
nb_frames
;
if
(
fade
->
type
==
FADE_IN
)
{
if
(
s
->
type
==
FADE_IN
)
{
fade
->
factor
=
0
;
s
->
factor
=
0
;
}
else
if
(
fade
->
type
==
FADE_OUT
)
{
}
else
if
(
s
->
type
==
FADE_OUT
)
{
fade
->
fade_per_frame
=
-
fade
->
fade_per_frame
;
s
->
fade_per_frame
=
-
s
->
fade_per_frame
;
fade
->
factor
=
(
1
<<
16
);
s
->
factor
=
(
1
<<
16
);
}
}
fade
->
stop_frame
=
fade
->
start_frame
+
fade
->
nb_frames
;
s
->
stop_frame
=
s
->
start_frame
+
s
->
nb_frames
;
av_log
(
ctx
,
AV_LOG_VERBOSE
,
av_log
(
ctx
,
AV_LOG_VERBOSE
,
"type:%s start_frame:%d nb_frames:%d
\n
"
,
"type:%s start_frame:%d nb_frames:%d
\n
"
,
fade
->
type
==
FADE_IN
?
"in"
:
"out"
,
fade
->
start_frame
,
s
->
type
==
FADE_IN
?
"in"
:
"out"
,
s
->
start_frame
,
fade
->
nb_frames
);
s
->
nb_frames
);
return
0
;
return
0
;
}
}
...
@@ -82,31 +82,31 @@ static int query_formats(AVFilterContext *ctx)
...
@@ -82,31 +82,31 @@ static int query_formats(AVFilterContext *ctx)
static
int
config_props
(
AVFilterLink
*
inlink
)
static
int
config_props
(
AVFilterLink
*
inlink
)
{
{
FadeContext
*
fade
=
inlink
->
dst
->
priv
;
FadeContext
*
s
=
inlink
->
dst
->
priv
;
const
AVPixFmtDescriptor
*
pixdesc
=
av_pix_fmt_desc_get
(
inlink
->
format
);
const
AVPixFmtDescriptor
*
pixdesc
=
av_pix_fmt_desc_get
(
inlink
->
format
);
fade
->
hsub
=
pixdesc
->
log2_chroma_w
;
s
->
hsub
=
pixdesc
->
log2_chroma_w
;
fade
->
vsub
=
pixdesc
->
log2_chroma_h
;
s
->
vsub
=
pixdesc
->
log2_chroma_h
;
fade
->
bpp
=
av_get_bits_per_pixel
(
pixdesc
)
>>
3
;
s
->
bpp
=
av_get_bits_per_pixel
(
pixdesc
)
>>
3
;
return
0
;
return
0
;
}
}
static
int
filter_frame
(
AVFilterLink
*
inlink
,
AVFrame
*
frame
)
static
int
filter_frame
(
AVFilterLink
*
inlink
,
AVFrame
*
frame
)
{
{
FadeContext
*
fade
=
inlink
->
dst
->
priv
;
FadeContext
*
s
=
inlink
->
dst
->
priv
;
uint8_t
*
p
;
uint8_t
*
p
;
int
i
,
j
,
plane
;
int
i
,
j
,
plane
;
if
(
fade
->
factor
<
UINT16_MAX
)
{
if
(
s
->
factor
<
UINT16_MAX
)
{
/* luma or rgb plane */
/* luma or rgb plane */
for
(
i
=
0
;
i
<
frame
->
height
;
i
++
)
{
for
(
i
=
0
;
i
<
frame
->
height
;
i
++
)
{
p
=
frame
->
data
[
0
]
+
i
*
frame
->
linesize
[
0
];
p
=
frame
->
data
[
0
]
+
i
*
frame
->
linesize
[
0
];
for
(
j
=
0
;
j
<
inlink
->
w
*
fade
->
bpp
;
j
++
)
{
for
(
j
=
0
;
j
<
inlink
->
w
*
s
->
bpp
;
j
++
)
{
/*
fade
->factor is using 16 lower-order bits for decimal
/*
s
->factor is using 16 lower-order bits for decimal
* places. 32768 = 1 << 15, it is an integer representation
* places. 32768 = 1 << 15, it is an integer representation
* of 0.5 and is for rounding. */
* of 0.5 and is for rounding. */
*
p
=
(
*
p
*
fade
->
factor
+
32768
)
>>
16
;
*
p
=
(
*
p
*
s
->
factor
+
32768
)
>>
16
;
p
++
;
p
++
;
}
}
}
}
...
@@ -115,12 +115,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
...
@@ -115,12 +115,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
/* chroma planes */
/* chroma planes */
for
(
plane
=
1
;
plane
<
3
;
plane
++
)
{
for
(
plane
=
1
;
plane
<
3
;
plane
++
)
{
for
(
i
=
0
;
i
<
frame
->
height
;
i
++
)
{
for
(
i
=
0
;
i
<
frame
->
height
;
i
++
)
{
p
=
frame
->
data
[
plane
]
+
(
i
>>
fade
->
vsub
)
*
frame
->
linesize
[
plane
];
p
=
frame
->
data
[
plane
]
+
(
i
>>
s
->
vsub
)
*
frame
->
linesize
[
plane
];
for
(
j
=
0
;
j
<
inlink
->
w
>>
fade
->
hsub
;
j
++
)
{
for
(
j
=
0
;
j
<
inlink
->
w
>>
s
->
hsub
;
j
++
)
{
/* 8421367 = ((128 << 1) + 1) << 15. It is an integer
/* 8421367 = ((128 << 1) + 1) << 15. It is an integer
* representation of 128.5. The .5 is for rounding
* representation of 128.5. The .5 is for rounding
* purposes. */
* purposes. */
*
p
=
((
*
p
-
128
)
*
fade
->
factor
+
8421367
)
>>
16
;
*
p
=
((
*
p
-
128
)
*
s
->
factor
+
8421367
)
>>
16
;
p
++
;
p
++
;
}
}
}
}
...
@@ -128,11 +128,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
...
@@ -128,11 +128,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
}
}
}
}
if
(
fade
->
frame_index
>=
fade
->
start_frame
&&
if
(
s
->
frame_index
>=
s
->
start_frame
&&
fade
->
frame_index
<=
fade
->
stop_frame
)
s
->
frame_index
<=
s
->
stop_frame
)
fade
->
factor
+=
fade
->
fade_per_frame
;
s
->
factor
+=
s
->
fade_per_frame
;
fade
->
factor
=
av_clip_uint16
(
fade
->
factor
);
s
->
factor
=
av_clip_uint16
(
s
->
factor
);
fade
->
frame_index
++
;
s
->
frame_index
++
;
return
ff_filter_frame
(
inlink
->
dst
->
outputs
[
0
],
frame
);
return
ff_filter_frame
(
inlink
->
dst
->
outputs
[
0
],
frame
);
}
}
...
...
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