Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
eacb3ec9
Commit
eacb3ec9
authored
Jul 31, 2017
by
Nicolas George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/vf_lut3d: convert to framesync2.
parent
a8ab52fa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
24 deletions
+27
-24
Makefile
libavfilter/Makefile
+1
-1
vf_lut3d.c
libavfilter/vf_lut3d.c
+26
-23
No files found.
libavfilter/Makefile
View file @
eacb3ec9
...
...
@@ -197,7 +197,7 @@ OBJS-$(CONFIG_FSPP_FILTER) += vf_fspp.o
OBJS-$(CONFIG_GBLUR_FILTER)
+=
vf_gblur.o
OBJS-$(CONFIG_GEQ_FILTER)
+=
vf_geq.o
OBJS-$(CONFIG_GRADFUN_FILTER)
+=
vf_gradfun.o
OBJS-$(CONFIG_HALDCLUT_FILTER)
+=
vf_lut3d.o
dualinput.o
framesync
.o
OBJS-$(CONFIG_HALDCLUT_FILTER)
+=
vf_lut3d.o
framesync2
.o
OBJS-$(CONFIG_HFLIP_FILTER)
+=
vf_hflip.o
OBJS-$(CONFIG_HISTEQ_FILTER)
+=
vf_histeq.o
OBJS-$(CONFIG_HISTOGRAM_FILTER)
+=
vf_histogram.o
...
...
libavfilter/vf_lut3d.c
View file @
eacb3ec9
...
...
@@ -31,8 +31,8 @@
#include "libavutil/avstring.h"
#include "avfilter.h"
#include "drawutils.h"
#include "dualinput.h"
#include "formats.h"
#include "framesync2.h"
#include "internal.h"
#include "video.h"
...
...
@@ -70,7 +70,7 @@ typedef struct LUT3DContext {
int
clut_step
;
int
clut_is16bit
;
int
clut_width
;
FF
DualInputContext
dinput
;
FF
FrameSync
fs
;
#endif
}
LUT3DContext
;
...
...
@@ -681,24 +681,21 @@ static int config_output(AVFilterLink *outlink)
LUT3DContext
*
lut3d
=
ctx
->
priv
;
int
ret
;
ret
=
ff_framesync2_init_dualinput
(
&
lut3d
->
fs
,
ctx
);
if
(
ret
<
0
)
return
ret
;
outlink
->
w
=
ctx
->
inputs
[
0
]
->
w
;
outlink
->
h
=
ctx
->
inputs
[
0
]
->
h
;
outlink
->
time_base
=
ctx
->
inputs
[
0
]
->
time_base
;
if
((
ret
=
ff_
dualinput_init
(
ctx
,
&
lut3d
->
dinput
))
<
0
)
if
((
ret
=
ff_
framesync2_configure
(
&
lut3d
->
fs
))
<
0
)
return
ret
;
return
0
;
}
static
int
filter_frame_hald
(
AVFilterLink
*
inlink
,
AVFrame
*
inpicref
)
{
LUT3DContext
*
s
=
inlink
->
dst
->
priv
;
return
ff_dualinput_filter_frame
(
&
s
->
dinput
,
inlink
,
inpicref
);
}
static
int
request_frame
(
AVFilterLink
*
outlink
)
static
int
activate
(
AVFilterContext
*
ctx
)
{
LUT3DContext
*
s
=
outlink
->
src
->
priv
;
return
ff_
dualinput_request_frame
(
&
s
->
dinput
,
outlink
);
LUT3DContext
*
s
=
ctx
->
priv
;
return
ff_
framesync2_activate
(
&
s
->
fs
);
}
static
int
config_clut
(
AVFilterLink
*
inlink
)
...
...
@@ -751,45 +748,50 @@ static int config_clut(AVFilterLink *inlink)
return
0
;
}
static
AVFrame
*
update_apply_clut
(
AVFilterContext
*
ctx
,
AVFrame
*
main
,
const
AVFrame
*
second
)
static
int
update_apply_clut
(
FFFrameSync
*
fs
)
{
AVFilterContext
*
ctx
=
fs
->
parent
;
AVFilterLink
*
inlink
=
ctx
->
inputs
[
0
];
AVFrame
*
main
,
*
second
,
*
out
;
int
ret
;
ret
=
ff_framesync2_dualinput_get
(
fs
,
&
main
,
&
second
);
if
(
ret
<
0
)
return
ret
;
if
(
!
second
)
return
ff_filter_frame
(
ctx
->
outputs
[
0
],
main
);
update_clut
(
ctx
->
priv
,
second
);
return
apply_lut
(
inlink
,
main
);
out
=
apply_lut
(
inlink
,
main
);
return
ff_filter_frame
(
ctx
->
outputs
[
0
],
out
);
}
static
av_cold
int
haldclut_init
(
AVFilterContext
*
ctx
)
{
LUT3DContext
*
lut3d
=
ctx
->
priv
;
lut3d
->
dinput
.
process
=
update_apply_clut
;
lut3d
->
fs
.
on_event
=
update_apply_clut
;
return
0
;
}
static
av_cold
void
haldclut_uninit
(
AVFilterContext
*
ctx
)
{
LUT3DContext
*
lut3d
=
ctx
->
priv
;
ff_
dualinput_uninit
(
&
lut3d
->
dinput
);
ff_
framesync2_uninit
(
&
lut3d
->
fs
);
}
static
const
AVOption
haldclut_options
[]
=
{
{
"shortest"
,
"force termination when the shortest input terminates"
,
OFFSET
(
dinput
.
shortest
),
AV_OPT_TYPE_BOOL
,
{
.
i64
=
0
},
0
,
1
,
FLAGS
},
{
"repeatlast"
,
"continue applying the last clut after eos"
,
OFFSET
(
dinput
.
repeatlast
),
AV_OPT_TYPE_BOOL
,
{
.
i64
=
1
},
0
,
1
,
FLAGS
},
COMMON_OPTIONS
};
AVFILTER_DEFINE_CLASS
(
haldclut
);
FRAMESYNC_DEFINE_CLASS
(
haldclut
,
LUT3DContext
,
fs
);
static
const
AVFilterPad
haldclut_inputs
[]
=
{
{
.
name
=
"main"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
filter_frame
=
filter_frame_hald
,
.
config_props
=
config_input
,
},{
.
name
=
"clut"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
filter_frame
=
filter_frame_hald
,
.
config_props
=
config_clut
,
},
{
NULL
}
...
...
@@ -799,7 +801,6 @@ static const AVFilterPad haldclut_outputs[] = {
{
.
name
=
"default"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
request_frame
=
request_frame
,
.
config_props
=
config_output
,
},
{
NULL
}
...
...
@@ -809,9 +810,11 @@ AVFilter ff_vf_haldclut = {
.
name
=
"haldclut"
,
.
description
=
NULL_IF_CONFIG_SMALL
(
"Adjust colors using a Hald CLUT."
),
.
priv_size
=
sizeof
(
LUT3DContext
),
.
preinit
=
haldclut_framesync_preinit
,
.
init
=
haldclut_init
,
.
uninit
=
haldclut_uninit
,
.
query_formats
=
query_formats
,
.
activate
=
activate
,
.
inputs
=
haldclut_inputs
,
.
outputs
=
haldclut_outputs
,
.
priv_class
=
&
haldclut_class
,
...
...
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