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
7aafac97
Commit
7aafac97
authored
Jul 15, 2015
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_smartblur: use the name 's' for the pointer to the private context
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
61641627
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
31 deletions
+31
-31
vf_smartblur.c
libavfilter/vf_smartblur.c
+31
-31
No files found.
libavfilter/vf_smartblur.c
View file @
7aafac97
...
@@ -84,34 +84,34 @@ AVFILTER_DEFINE_CLASS(smartblur);
...
@@ -84,34 +84,34 @@ AVFILTER_DEFINE_CLASS(smartblur);
static
av_cold
int
init
(
AVFilterContext
*
ctx
)
static
av_cold
int
init
(
AVFilterContext
*
ctx
)
{
{
SmartblurContext
*
s
blur
=
ctx
->
priv
;
SmartblurContext
*
s
=
ctx
->
priv
;
/* make chroma default to luma values, if not explicitly set */
/* make chroma default to luma values, if not explicitly set */
if
(
s
blur
->
chroma
.
radius
<
RADIUS_MIN
)
if
(
s
->
chroma
.
radius
<
RADIUS_MIN
)
s
blur
->
chroma
.
radius
=
sblur
->
luma
.
radius
;
s
->
chroma
.
radius
=
s
->
luma
.
radius
;
if
(
s
blur
->
chroma
.
strength
<
STRENGTH_MIN
)
if
(
s
->
chroma
.
strength
<
STRENGTH_MIN
)
s
blur
->
chroma
.
strength
=
sblur
->
luma
.
strength
;
s
->
chroma
.
strength
=
s
->
luma
.
strength
;
if
(
s
blur
->
chroma
.
threshold
<
THRESHOLD_MIN
)
if
(
s
->
chroma
.
threshold
<
THRESHOLD_MIN
)
s
blur
->
chroma
.
threshold
=
sblur
->
luma
.
threshold
;
s
->
chroma
.
threshold
=
s
->
luma
.
threshold
;
s
blur
->
luma
.
quality
=
sblur
->
chroma
.
quality
=
3
.
0
;
s
->
luma
.
quality
=
s
->
chroma
.
quality
=
3
.
0
;
s
blur
->
sws_flags
=
SWS_BICUBIC
;
s
->
sws_flags
=
SWS_BICUBIC
;
av_log
(
ctx
,
AV_LOG_VERBOSE
,
av_log
(
ctx
,
AV_LOG_VERBOSE
,
"luma_radius:%f luma_strength:%f luma_threshold:%d "
"luma_radius:%f luma_strength:%f luma_threshold:%d "
"chroma_radius:%f chroma_strength:%f chroma_threshold:%d
\n
"
,
"chroma_radius:%f chroma_strength:%f chroma_threshold:%d
\n
"
,
s
blur
->
luma
.
radius
,
sblur
->
luma
.
strength
,
sblur
->
luma
.
threshold
,
s
->
luma
.
radius
,
s
->
luma
.
strength
,
s
->
luma
.
threshold
,
s
blur
->
chroma
.
radius
,
sblur
->
chroma
.
strength
,
sblur
->
chroma
.
threshold
);
s
->
chroma
.
radius
,
s
->
chroma
.
strength
,
s
->
chroma
.
threshold
);
return
0
;
return
0
;
}
}
static
av_cold
void
uninit
(
AVFilterContext
*
ctx
)
static
av_cold
void
uninit
(
AVFilterContext
*
ctx
)
{
{
SmartblurContext
*
s
blur
=
ctx
->
priv
;
SmartblurContext
*
s
=
ctx
->
priv
;
sws_freeContext
(
s
blur
->
luma
.
filter_context
);
sws_freeContext
(
s
->
luma
.
filter_context
);
sws_freeContext
(
s
blur
->
chroma
.
filter_context
);
sws_freeContext
(
s
->
chroma
.
filter_context
);
}
}
static
int
query_formats
(
AVFilterContext
*
ctx
)
static
int
query_formats
(
AVFilterContext
*
ctx
)
...
@@ -159,17 +159,17 @@ static int alloc_sws_context(FilterParam *f, int width, int height, unsigned int
...
@@ -159,17 +159,17 @@ static int alloc_sws_context(FilterParam *f, int width, int height, unsigned int
static
int
config_props
(
AVFilterLink
*
inlink
)
static
int
config_props
(
AVFilterLink
*
inlink
)
{
{
SmartblurContext
*
s
blur
=
inlink
->
dst
->
priv
;
SmartblurContext
*
s
=
inlink
->
dst
->
priv
;
const
AVPixFmtDescriptor
*
desc
=
av_pix_fmt_desc_get
(
inlink
->
format
);
const
AVPixFmtDescriptor
*
desc
=
av_pix_fmt_desc_get
(
inlink
->
format
);
s
blur
->
hsub
=
desc
->
log2_chroma_w
;
s
->
hsub
=
desc
->
log2_chroma_w
;
s
blur
->
vsub
=
desc
->
log2_chroma_h
;
s
->
vsub
=
desc
->
log2_chroma_h
;
alloc_sws_context
(
&
s
blur
->
luma
,
inlink
->
w
,
inlink
->
h
,
sblur
->
sws_flags
);
alloc_sws_context
(
&
s
->
luma
,
inlink
->
w
,
inlink
->
h
,
s
->
sws_flags
);
alloc_sws_context
(
&
s
blur
->
chroma
,
alloc_sws_context
(
&
s
->
chroma
,
FF_CEIL_RSHIFT
(
inlink
->
w
,
s
blur
->
hsub
),
FF_CEIL_RSHIFT
(
inlink
->
w
,
s
->
hsub
),
FF_CEIL_RSHIFT
(
inlink
->
h
,
s
blur
->
vsub
),
FF_CEIL_RSHIFT
(
inlink
->
h
,
s
->
vsub
),
s
blur
->
sws_flags
);
s
->
sws_flags
);
return
0
;
return
0
;
}
}
...
@@ -240,11 +240,11 @@ static void blur(uint8_t *dst, const int dst_linesize,
...
@@ -240,11 +240,11 @@ static void blur(uint8_t *dst, const int dst_linesize,
static
int
filter_frame
(
AVFilterLink
*
inlink
,
AVFrame
*
inpic
)
static
int
filter_frame
(
AVFilterLink
*
inlink
,
AVFrame
*
inpic
)
{
{
SmartblurContext
*
s
blur
=
inlink
->
dst
->
priv
;
SmartblurContext
*
s
=
inlink
->
dst
->
priv
;
AVFilterLink
*
outlink
=
inlink
->
dst
->
outputs
[
0
];
AVFilterLink
*
outlink
=
inlink
->
dst
->
outputs
[
0
];
AVFrame
*
outpic
;
AVFrame
*
outpic
;
int
cw
=
FF_CEIL_RSHIFT
(
inlink
->
w
,
s
blur
->
hsub
);
int
cw
=
FF_CEIL_RSHIFT
(
inlink
->
w
,
s
->
hsub
);
int
ch
=
FF_CEIL_RSHIFT
(
inlink
->
h
,
s
blur
->
vsub
);
int
ch
=
FF_CEIL_RSHIFT
(
inlink
->
h
,
s
->
vsub
);
outpic
=
ff_get_video_buffer
(
outlink
,
outlink
->
w
,
outlink
->
h
);
outpic
=
ff_get_video_buffer
(
outlink
,
outlink
->
w
,
outlink
->
h
);
if
(
!
outpic
)
{
if
(
!
outpic
)
{
...
@@ -255,18 +255,18 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
...
@@ -255,18 +255,18 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
blur
(
outpic
->
data
[
0
],
outpic
->
linesize
[
0
],
blur
(
outpic
->
data
[
0
],
outpic
->
linesize
[
0
],
inpic
->
data
[
0
],
inpic
->
linesize
[
0
],
inpic
->
data
[
0
],
inpic
->
linesize
[
0
],
inlink
->
w
,
inlink
->
h
,
s
blur
->
luma
.
threshold
,
inlink
->
w
,
inlink
->
h
,
s
->
luma
.
threshold
,
s
blur
->
luma
.
filter_context
);
s
->
luma
.
filter_context
);
if
(
inpic
->
data
[
2
])
{
if
(
inpic
->
data
[
2
])
{
blur
(
outpic
->
data
[
1
],
outpic
->
linesize
[
1
],
blur
(
outpic
->
data
[
1
],
outpic
->
linesize
[
1
],
inpic
->
data
[
1
],
inpic
->
linesize
[
1
],
inpic
->
data
[
1
],
inpic
->
linesize
[
1
],
cw
,
ch
,
s
blur
->
chroma
.
threshold
,
cw
,
ch
,
s
->
chroma
.
threshold
,
s
blur
->
chroma
.
filter_context
);
s
->
chroma
.
filter_context
);
blur
(
outpic
->
data
[
2
],
outpic
->
linesize
[
2
],
blur
(
outpic
->
data
[
2
],
outpic
->
linesize
[
2
],
inpic
->
data
[
2
],
inpic
->
linesize
[
2
],
inpic
->
data
[
2
],
inpic
->
linesize
[
2
],
cw
,
ch
,
s
blur
->
chroma
.
threshold
,
cw
,
ch
,
s
->
chroma
.
threshold
,
s
blur
->
chroma
.
filter_context
);
s
->
chroma
.
filter_context
);
}
}
av_frame_free
(
&
inpic
);
av_frame_free
(
&
inpic
);
...
...
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