Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
2e91a96d
Commit
2e91a96d
authored
7 years ago
by
Vittorio Giovara
Browse files
Options
Downloads
Patches
Plain Diff
zscale: Factor out graph building
parent
0a243bed
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavfilter/vf_zscale.c
+31
-21
31 additions, 21 deletions
libavfilter/vf_zscale.c
with
31 additions
and
21 deletions
libavfilter/vf_zscale.c
+
31
−
21
View file @
2e91a96d
...
@@ -438,6 +438,34 @@ static void format_init(zimg_image_format *format, AVFrame *frame, const AVPixFm
...
@@ -438,6 +438,34 @@ static void format_init(zimg_image_format *format, AVFrame *frame, const AVPixFm
format
->
chroma_location
=
location
==
-
1
?
convert_chroma_location
(
frame
->
chroma_location
)
:
location
;
format
->
chroma_location
=
location
==
-
1
?
convert_chroma_location
(
frame
->
chroma_location
)
:
location
;
}
}
static
int
graph_build
(
zimg_filter_graph
**
graph
,
zimg_graph_builder_params
*
params
,
zimg_image_format
*
src_format
,
zimg_image_format
*
dst_format
,
void
**
tmp
,
size_t
*
tmp_size
)
{
int
ret
;
size_t
size
;
zimg_filter_graph_free
(
*
graph
);
*
graph
=
zimg_filter_graph_build
(
src_format
,
dst_format
,
params
);
if
(
!*
graph
)
return
print_zimg_error
(
NULL
);
ret
=
zimg_filter_graph_get_tmp_size
(
*
graph
,
&
size
);
if
(
ret
)
return
print_zimg_error
(
NULL
);
if
(
size
>
*
tmp_size
)
{
av_freep
(
tmp
);
*
tmp
=
av_malloc
(
size
);
if
(
!*
tmp
)
return
AVERROR
(
ENOMEM
);
*
tmp_size
=
size
;
}
return
0
;
}
static
int
filter_frame
(
AVFilterLink
*
link
,
AVFrame
*
in
)
static
int
filter_frame
(
AVFilterLink
*
link
,
AVFrame
*
in
)
{
{
ZScaleContext
*
s
=
link
->
dst
->
priv
;
ZScaleContext
*
s
=
link
->
dst
->
priv
;
...
@@ -447,7 +475,6 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
...
@@ -447,7 +475,6 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
zimg_image_buffer_const
src_buf
=
{
ZIMG_API_VERSION
};
zimg_image_buffer_const
src_buf
=
{
ZIMG_API_VERSION
};
zimg_image_buffer
dst_buf
=
{
ZIMG_API_VERSION
};
zimg_image_buffer
dst_buf
=
{
ZIMG_API_VERSION
};
char
buf
[
32
];
char
buf
[
32
];
size_t
tmp_size
;
int
ret
=
0
,
plane
;
int
ret
=
0
,
plane
;
AVFrame
*
out
;
AVFrame
*
out
;
...
@@ -520,27 +547,10 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
...
@@ -520,27 +547,10 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
if
(
s
->
chromal
!=
-
1
)
if
(
s
->
chromal
!=
-
1
)
out
->
chroma_location
=
(
int
)
s
->
dst_format
.
chroma_location
-
1
;
out
->
chroma_location
=
(
int
)
s
->
dst_format
.
chroma_location
-
1
;
zimg_filter_graph_free
(
s
->
graph
);
ret
=
graph_build
(
&
s
->
graph
,
&
s
->
params
,
&
s
->
src_format
,
&
s
->
dst_format
,
s
->
graph
=
zimg_filter_graph_build
(
&
s
->
src_format
,
&
s
->
dst_format
,
&
s
->
params
);
&
s
->
tmp
,
&
s
->
tmp_size
);
if
(
!
s
->
graph
)
{
if
(
ret
<
0
)
ret
=
print_zimg_error
(
link
->
dst
);
goto
fail
;
}
if
((
ret
=
zimg_filter_graph_get_tmp_size
(
s
->
graph
,
&
tmp_size
)))
{
ret
=
print_zimg_error
(
link
->
dst
);
goto
fail
;
goto
fail
;
}
if
(
tmp_size
>
s
->
tmp_size
)
{
av_freep
(
&
s
->
tmp
);
s
->
tmp
=
av_malloc
(
tmp_size
);
if
(
!
s
->
tmp
)
{
ret
=
AVERROR
(
ENOMEM
);
goto
fail
;
}
s
->
tmp_size
=
tmp_size
;
}
s
->
in_colorspace
=
in
->
colorspace
;
s
->
in_colorspace
=
in
->
colorspace
;
s
->
in_trc
=
in
->
color_trc
;
s
->
in_trc
=
in
->
color_trc
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment