[FFmpeg-cvslog] lavfi/overlay: add yuv422 format mode
Stefano Sabatini
git at videolan.org
Sun Feb 2 12:08:21 CET 2014
ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Fri Jan 24 17:53:03 2014 +0100| [a270f63e832b6fffaef41b3bb898024827a7877e] | committer: Stefano Sabatini
lavfi/overlay: add yuv422 format mode
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a270f63e832b6fffaef41b3bb898024827a7877e
---
doc/filters.texi | 3 ++
libavfilter/version.h | 2 +-
libavfilter/vf_overlay.c | 14 +++++++++-
tests/fate/filter-video.mak | 3 ++
tests/filtergraphs/overlay_yuv422 | 4 +++
tests/ref/fate/filter-overlay_yuv422 | 51 ++++++++++++++++++++++++++++++++++
6 files changed, 75 insertions(+), 2 deletions(-)
diff --git a/doc/filters.texi b/doc/filters.texi
index f8da117..bf48abf 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -5936,6 +5936,9 @@ It accepts the following values:
@item yuv420
force YUV420 output
+ at item yuv422
+force YUV422 output
+
@item yuv444
force YUV444 output
diff --git a/libavfilter/version.h b/libavfilter/version.h
index d86fade..5dbea05 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -31,7 +31,7 @@
#define LIBAVFILTER_VERSION_MAJOR 4
#define LIBAVFILTER_VERSION_MINOR 1
-#define LIBAVFILTER_VERSION_MICRO 101
+#define LIBAVFILTER_VERSION_MICRO 102
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index 9047dee..938033a 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -92,7 +92,7 @@ typedef struct {
uint8_t overlay_is_packed_rgb;
uint8_t overlay_rgba_map[4];
uint8_t overlay_has_alpha;
- enum OverlayFormat { OVERLAY_FORMAT_YUV420, OVERLAY_FORMAT_YUV444, OVERLAY_FORMAT_RGB, OVERLAY_FORMAT_NB} format;
+ enum OverlayFormat { OVERLAY_FORMAT_YUV420, OVERLAY_FORMAT_YUV422, OVERLAY_FORMAT_YUV444, OVERLAY_FORMAT_RGB, OVERLAY_FORMAT_NB} format;
enum EvalMode { EVAL_MODE_INIT, EVAL_MODE_FRAME, EVAL_MODE_NB } eval_mode;
FFDualInputContext dinput;
@@ -191,6 +191,13 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_YUVA420P, AV_PIX_FMT_NONE
};
+ static const enum AVPixelFormat main_pix_fmts_yuv422[] = {
+ AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_NONE
+ };
+ static const enum AVPixelFormat overlay_pix_fmts_yuv422[] = {
+ AV_PIX_FMT_YUVA422P, AV_PIX_FMT_NONE
+ };
+
static const enum AVPixelFormat main_pix_fmts_yuv444[] = {
AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVA444P, AV_PIX_FMT_NONE
};
@@ -218,6 +225,10 @@ static int query_formats(AVFilterContext *ctx)
main_formats = ff_make_format_list(main_pix_fmts_yuv420);
overlay_formats = ff_make_format_list(overlay_pix_fmts_yuv420);
break;
+ case OVERLAY_FORMAT_YUV422:
+ main_formats = ff_make_format_list(main_pix_fmts_yuv422);
+ overlay_formats = ff_make_format_list(overlay_pix_fmts_yuv422);
+ break;
case OVERLAY_FORMAT_YUV444:
main_formats = ff_make_format_list(main_pix_fmts_yuv444);
overlay_formats = ff_make_format_list(overlay_pix_fmts_yuv444);
@@ -587,6 +598,7 @@ static const AVOption overlay_options[] = {
{ "shortest", "force termination when the shortest input terminates", OFFSET(dinput.shortest), AV_OPT_TYPE_INT, { .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" },
+ { "yuv422", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_YUV422}, .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" },
{ "repeatlast", "repeat overlay of the last overlay frame", OFFSET(dinput.repeatlast), AV_OPT_TYPE_INT, {.i64=1}, 0, 1, FLAGS },
diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak
index c89be6a..68e9f87 100644
--- a/tests/fate/filter-video.mak
+++ b/tests/fate/filter-video.mak
@@ -80,6 +80,9 @@ fate-filter-overlay_rgb: CMD = framecrc -c:v pgmyuv -i $(SRC) -filter_complex_sc
FATE_FILTER_VSYNTH-$(call ALLYES, SPLIT_FILTER SCALE_FILTER PAD_FILTER OVERLAY_FILTER) += fate-filter-overlay_yuv420
fate-filter-overlay_yuv420: CMD = framecrc -c:v pgmyuv -i $(SRC) -filter_complex_script $(SRC_PATH)/tests/filtergraphs/overlay_yuv420
+FATE_FILTER_VSYNTH-$(call ALLYES, SPLIT_FILTER SCALE_FILTER PAD_FILTER OVERLAY_FILTER) += fate-filter-overlay_yuv422
+fate-filter-overlay_yuv422: CMD = framecrc -c:v pgmyuv -i $(SRC) -filter_complex_script $(SRC_PATH)/tests/filtergraphs/overlay_yuv422
+
FATE_FILTER_VSYNTH-$(call ALLYES, SPLIT_FILTER SCALE_FILTER PAD_FILTER OVERLAY_FILTER) += fate-filter-overlay_yuv444
fate-filter-overlay_yuv444: CMD = framecrc -c:v pgmyuv -i $(SRC) -filter_complex_script $(SRC_PATH)/tests/filtergraphs/overlay_yuv444
diff --git a/tests/filtergraphs/overlay_yuv422 b/tests/filtergraphs/overlay_yuv422
new file mode 100644
index 0000000..e5df859
--- /dev/null
+++ b/tests/filtergraphs/overlay_yuv422
@@ -0,0 +1,4 @@
+sws_flags=+accurate_rnd+bitexact;
+split [main][over];
+[over] scale=88:72, pad=96:80:4:4 [overf];
+[main][overf] overlay=240:16:format=yuv422
diff --git a/tests/ref/fate/filter-overlay_yuv422 b/tests/ref/fate/filter-overlay_yuv422
new file mode 100644
index 0000000..982386b
--- /dev/null
+++ b/tests/ref/fate/filter-overlay_yuv422
@@ -0,0 +1,51 @@
+#tb 0: 1/25
+0, 0, 0, 1, 304128, 0x9b9e09b2
+0, 1, 1, 1, 304128, 0x33addb48
+0, 2, 2, 1, 304128, 0xd5b973e9
+0, 3, 3, 1, 304128, 0xcb847cb6
+0, 4, 4, 1, 304128, 0xf64536f0
+0, 5, 5, 1, 304128, 0xda17564a
+0, 6, 6, 1, 304128, 0x85e33692
+0, 7, 7, 1, 304128, 0x081a657f
+0, 8, 8, 1, 304128, 0xf15f69ee
+0, 9, 9, 1, 304128, 0x0a2dd737
+0, 10, 10, 1, 304128, 0x14ae5b1b
+0, 11, 11, 1, 304128, 0x0b654f1e
+0, 12, 12, 1, 304128, 0x35a11962
+0, 13, 13, 1, 304128, 0x010b7514
+0, 14, 14, 1, 304128, 0x5db20c43
+0, 15, 15, 1, 304128, 0xafb6c615
+0, 16, 16, 1, 304128, 0xa671a3ac
+0, 17, 17, 1, 304128, 0x1a0fc75d
+0, 18, 18, 1, 304128, 0xe3a05ff1
+0, 19, 19, 1, 304128, 0x58437c36
+0, 20, 20, 1, 304128, 0x1303f940
+0, 21, 21, 1, 304128, 0xec2f3248
+0, 22, 22, 1, 304128, 0xe9ff7d49
+0, 23, 23, 1, 304128, 0x3972a1ed
+0, 24, 24, 1, 304128, 0xee2311df
+0, 25, 25, 1, 304128, 0x5b62c4d9
+0, 26, 26, 1, 304128, 0x9e1e52e2
+0, 27, 27, 1, 304128, 0x60c56d07
+0, 28, 28, 1, 304128, 0x313a8534
+0, 29, 29, 1, 304128, 0x9f548f56
+0, 30, 30, 1, 304128, 0x8d894ed3
+0, 31, 31, 1, 304128, 0x3ce0500a
+0, 32, 32, 1, 304128, 0xb8dd487a
+0, 33, 33, 1, 304128, 0xdde97863
+0, 34, 34, 1, 304128, 0x8d9d1689
+0, 35, 35, 1, 304128, 0x703634dd
+0, 36, 36, 1, 304128, 0x3e321210
+0, 37, 37, 1, 304128, 0x6b5a1a8c
+0, 38, 38, 1, 304128, 0xffc1015d
+0, 39, 39, 1, 304128, 0x4abc4495
+0, 40, 40, 1, 304128, 0x3c03ada9
+0, 41, 41, 1, 304128, 0x6fa0344a
+0, 42, 42, 1, 304128, 0x36572833
+0, 43, 43, 1, 304128, 0x31646c4d
+0, 44, 44, 1, 304128, 0xa22d18c7
+0, 45, 45, 1, 304128, 0xf3b058f2
+0, 46, 46, 1, 304128, 0x4c6be349
+0, 47, 47, 1, 304128, 0xda98914a
+0, 48, 48, 1, 304128, 0x1a6d2f58
+0, 49, 49, 1, 304128, 0x12684280
More information about the ffmpeg-cvslog
mailing list