Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
dacae40a
Commit
dacae40a
authored
Jun 05, 2020
by
Limin Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_overlay: add yuv420p10 and yuv422p10 10bit format support
Signed-off-by:
Limin Wang
<
lance.lmwang@gmail.com
>
parent
4d787c16
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
87 additions
and
0 deletions
+87
-0
filters.texi
doc/filters.texi
+6
-0
vf_overlay.c
libavfilter/vf_overlay.c
+79
-0
vf_overlay.h
libavfilter/vf_overlay.h
+2
-0
No files found.
doc/filters.texi
View file @
dacae40a
...
...
@@ -14342,9 +14342,15 @@ It accepts the following values:
@item yuv420
force YUV420 output
@item yuv420p10
force YUV420p10 output
@item yuv422
force YUV422 output
@item yuv422p10
force YUV422p10 output
@item yuv444
force YUV444 output
...
...
libavfilter/vf_overlay.c
View file @
dacae40a
...
...
@@ -154,6 +154,7 @@ static int process_command(AVFilterContext *ctx, const char *cmd, const char *ar
static
const
enum
AVPixelFormat
alpha_pix_fmts
[]
=
{
AV_PIX_FMT_YUVA420P
,
AV_PIX_FMT_YUVA422P
,
AV_PIX_FMT_YUVA444P
,
AV_PIX_FMT_YUVA420P10
,
AV_PIX_FMT_YUVA422P10
,
AV_PIX_FMT_ARGB
,
AV_PIX_FMT_ABGR
,
AV_PIX_FMT_RGBA
,
AV_PIX_FMT_BGRA
,
AV_PIX_FMT_GBRAP
,
AV_PIX_FMT_NONE
};
...
...
@@ -172,6 +173,14 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_YUVA420P
,
AV_PIX_FMT_NONE
};
static
const
enum
AVPixelFormat
main_pix_fmts_yuv420p10
[]
=
{
AV_PIX_FMT_YUV420P10
,
AV_PIX_FMT_YUVA420P10
,
AV_PIX_FMT_NONE
};
static
const
enum
AVPixelFormat
overlay_pix_fmts_yuv420p10
[]
=
{
AV_PIX_FMT_YUVA420P10
,
AV_PIX_FMT_NONE
};
static
const
enum
AVPixelFormat
main_pix_fmts_yuv422
[]
=
{
AV_PIX_FMT_YUV422P
,
AV_PIX_FMT_YUVJ422P
,
AV_PIX_FMT_YUVA422P
,
AV_PIX_FMT_NONE
};
...
...
@@ -179,6 +188,13 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_YUVA422P
,
AV_PIX_FMT_NONE
};
static
const
enum
AVPixelFormat
main_pix_fmts_yuv422p10
[]
=
{
AV_PIX_FMT_YUV422P10
,
AV_PIX_FMT_YUVA422P10
,
AV_PIX_FMT_NONE
};
static
const
enum
AVPixelFormat
overlay_pix_fmts_yuv422p10
[]
=
{
AV_PIX_FMT_YUVA422P10
,
AV_PIX_FMT_NONE
};
static
const
enum
AVPixelFormat
main_pix_fmts_yuv444
[]
=
{
AV_PIX_FMT_YUV444P
,
AV_PIX_FMT_YUVJ444P
,
AV_PIX_FMT_YUVA444P
,
AV_PIX_FMT_NONE
};
...
...
@@ -217,6 +233,13 @@ static int query_formats(AVFilterContext *ctx)
goto
fail
;
}
break
;
case
OVERLAY_FORMAT_YUV420P10
:
if
(
!
(
main_formats
=
ff_make_format_list
(
main_pix_fmts_yuv420p10
))
||
!
(
overlay_formats
=
ff_make_format_list
(
overlay_pix_fmts_yuv420p10
)))
{
ret
=
AVERROR
(
ENOMEM
);
goto
fail
;
}
break
;
case
OVERLAY_FORMAT_YUV422
:
if
(
!
(
main_formats
=
ff_make_format_list
(
main_pix_fmts_yuv422
))
||
!
(
overlay_formats
=
ff_make_format_list
(
overlay_pix_fmts_yuv422
)))
{
...
...
@@ -224,6 +247,13 @@ static int query_formats(AVFilterContext *ctx)
goto
fail
;
}
break
;
case
OVERLAY_FORMAT_YUV422P10
:
if
(
!
(
main_formats
=
ff_make_format_list
(
main_pix_fmts_yuv422p10
))
||
!
(
overlay_formats
=
ff_make_format_list
(
overlay_pix_fmts_yuv422p10
)))
{
ret
=
AVERROR
(
ENOMEM
);
goto
fail
;
}
break
;
case
OVERLAY_FORMAT_YUV444
:
if
(
!
(
main_formats
=
ff_make_format_list
(
main_pix_fmts_yuv444
))
||
!
(
overlay_formats
=
ff_make_format_list
(
overlay_pix_fmts_yuv444
)))
{
...
...
@@ -566,6 +596,7 @@ static av_always_inline void blend_plane_##depth##_##nbits##bits(AVFilterContext
} \
}
DEFINE_BLEND_PLANE
(
8
,
8
);
DEFINE_BLEND_PLANE
(
16
,
10
);
#define DEFINE_ALPHA_COMPOSITE(depth, nbits) \
static inline void alpha_composite_##depth##_##nbits##bits(const AVFrame *src, const AVFrame *dst, \
...
...
@@ -617,6 +648,7 @@ static inline void alpha_composite_##depth##_##nbits##bits(const AVFrame *src, c
} \
}
DEFINE_ALPHA_COMPOSITE
(
8
,
8
);
DEFINE_ALPHA_COMPOSITE
(
16
,
10
);
#define DEFINE_BLEND_SLICE_YUV(depth, nbits) \
static av_always_inline void blend_slice_yuv_##depth##_##nbits##bits(AVFilterContext *ctx, \
...
...
@@ -648,6 +680,7 @@ static av_always_inline void blend_slice_yuv_##depth##_##nbits##bits(AVFilterCon
jobnr, nb_jobs); \
}
DEFINE_BLEND_SLICE_YUV
(
8
,
8
);
DEFINE_BLEND_SLICE_YUV
(
16
,
10
);
static
av_always_inline
void
blend_slice_planar_rgb
(
AVFilterContext
*
ctx
,
AVFrame
*
dst
,
const
AVFrame
*
src
,
...
...
@@ -694,6 +727,38 @@ static int blend_slice_yuva420(AVFilterContext *ctx, void *arg, int jobnr, int n
return
0
;
}
static
int
blend_slice_yuv420p10
(
AVFilterContext
*
ctx
,
void
*
arg
,
int
jobnr
,
int
nb_jobs
)
{
OverlayContext
*
s
=
ctx
->
priv
;
ThreadData
*
td
=
arg
;
blend_slice_yuv_16_10bits
(
ctx
,
td
->
dst
,
td
->
src
,
1
,
1
,
0
,
s
->
x
,
s
->
y
,
1
,
jobnr
,
nb_jobs
);
return
0
;
}
static
int
blend_slice_yuva420p10
(
AVFilterContext
*
ctx
,
void
*
arg
,
int
jobnr
,
int
nb_jobs
)
{
OverlayContext
*
s
=
ctx
->
priv
;
ThreadData
*
td
=
arg
;
blend_slice_yuv_16_10bits
(
ctx
,
td
->
dst
,
td
->
src
,
1
,
1
,
1
,
s
->
x
,
s
->
y
,
1
,
jobnr
,
nb_jobs
);
return
0
;
}
static
int
blend_slice_yuv422p10
(
AVFilterContext
*
ctx
,
void
*
arg
,
int
jobnr
,
int
nb_jobs
)
{
OverlayContext
*
s
=
ctx
->
priv
;
ThreadData
*
td
=
arg
;
blend_slice_yuv_16_10bits
(
ctx
,
td
->
dst
,
td
->
src
,
1
,
0
,
0
,
s
->
x
,
s
->
y
,
1
,
jobnr
,
nb_jobs
);
return
0
;
}
static
int
blend_slice_yuva422p10
(
AVFilterContext
*
ctx
,
void
*
arg
,
int
jobnr
,
int
nb_jobs
)
{
OverlayContext
*
s
=
ctx
->
priv
;
ThreadData
*
td
=
arg
;
blend_slice_yuv_16_10bits
(
ctx
,
td
->
dst
,
td
->
src
,
1
,
0
,
1
,
s
->
x
,
s
->
y
,
1
,
jobnr
,
nb_jobs
);
return
0
;
}
static
int
blend_slice_yuv422
(
AVFilterContext
*
ctx
,
void
*
arg
,
int
jobnr
,
int
nb_jobs
)
{
OverlayContext
*
s
=
ctx
->
priv
;
...
...
@@ -857,9 +922,15 @@ static int config_input_main(AVFilterLink *inlink)
case
OVERLAY_FORMAT_YUV420
:
s
->
blend_slice
=
s
->
main_has_alpha
?
blend_slice_yuva420
:
blend_slice_yuv420
;
break
;
case
OVERLAY_FORMAT_YUV420P10
:
s
->
blend_slice
=
s
->
main_has_alpha
?
blend_slice_yuva420p10
:
blend_slice_yuv420p10
;
break
;
case
OVERLAY_FORMAT_YUV422
:
s
->
blend_slice
=
s
->
main_has_alpha
?
blend_slice_yuva422
:
blend_slice_yuv422
;
break
;
case
OVERLAY_FORMAT_YUV422P10
:
s
->
blend_slice
=
s
->
main_has_alpha
?
blend_slice_yuva422p10
:
blend_slice_yuv422p10
;
break
;
case
OVERLAY_FORMAT_YUV444
:
s
->
blend_slice
=
s
->
main_has_alpha
?
blend_slice_yuva444
:
blend_slice_yuv444
;
break
;
...
...
@@ -874,9 +945,15 @@ static int config_input_main(AVFilterLink *inlink)
case
AV_PIX_FMT_YUVA420P
:
s
->
blend_slice
=
blend_slice_yuva420
;
break
;
case
AV_PIX_FMT_YUVA420P10
:
s
->
blend_slice
=
blend_slice_yuva420p10
;
break
;
case
AV_PIX_FMT_YUVA422P
:
s
->
blend_slice
=
blend_slice_yuva422
;
break
;
case
AV_PIX_FMT_YUVA422P10
:
s
->
blend_slice
=
blend_slice_yuva422p10
;
break
;
case
AV_PIX_FMT_YUVA444P
:
s
->
blend_slice
=
blend_slice_yuva444
;
break
;
...
...
@@ -1028,7 +1105,9 @@ static const AVOption overlay_options[] = {
{
"shortest"
,
"force termination when the shortest input terminates"
,
OFFSET
(
fs
.
opt_shortest
),
AV_OPT_TYPE_BOOL
,
{
.
i64
=
0
},
0
,
1
,
FLAGS
},
{
"format"
,
"set output format"
,
OFFSET
(
format
),
AV_OPT_TYPE_INT
,
{.
i64
=
OVERLAY_FORMAT_YUV420
},
0
,
OVERLAY_FORMAT_NB
-
1
,
FLAGS
,
"format"
},
{
"yuv420"
,
""
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
OVERLAY_FORMAT_YUV420
},
.
flags
=
FLAGS
,
.
unit
=
"format"
},
{
"yuv420p10"
,
""
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
OVERLAY_FORMAT_YUV420P10
},
.
flags
=
FLAGS
,
.
unit
=
"format"
},
{
"yuv422"
,
""
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
OVERLAY_FORMAT_YUV422
},
.
flags
=
FLAGS
,
.
unit
=
"format"
},
{
"yuv422p10"
,
""
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
OVERLAY_FORMAT_YUV422P10
},
.
flags
=
FLAGS
,
.
unit
=
"format"
},
{
"yuv444"
,
""
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
OVERLAY_FORMAT_YUV444
},
.
flags
=
FLAGS
,
.
unit
=
"format"
},
{
"rgb"
,
""
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
OVERLAY_FORMAT_RGB
},
.
flags
=
FLAGS
,
.
unit
=
"format"
},
{
"gbrp"
,
""
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
OVERLAY_FORMAT_GBRP
},
.
flags
=
FLAGS
,
.
unit
=
"format"
},
...
...
libavfilter/vf_overlay.h
View file @
dacae40a
...
...
@@ -41,7 +41,9 @@ enum var_name {
enum
OverlayFormat
{
OVERLAY_FORMAT_YUV420
,
OVERLAY_FORMAT_YUV420P10
,
OVERLAY_FORMAT_YUV422
,
OVERLAY_FORMAT_YUV422P10
,
OVERLAY_FORMAT_YUV444
,
OVERLAY_FORMAT_RGB
,
OVERLAY_FORMAT_GBRP
,
...
...
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