History

avfilter/vf_mergeplanes: add alternative for less user friendly option

Paul B Mahol committed 4 years ago

Commit 385bc751 parent f92e4632 files · +29 −7Browse files

Unified · Split

2 files
  1. doc/filters.texi +12 −0
  2. libavfilter/vf_mergeplanes.c +17 −7
doc/filters.texi+12−0
@@ -16072,6 +16072,18 @@ plane, 'Cc' describes the mapping for the output stream third plane and · 16071 unmodified lines
1607216072
1607316073 @item format
1607416074 Set output pixel format. Default is @code{yuva444p}.
16075+
16076+@item map0s
16077+@item map1s
16078+@item map2s
16079+@item map3s
16080+Set input to output stream mapping for output Nth plane. Default is @code{0}.
16081+
16082+@item map0p
16083+@item map1p
16084+@item map2p
16085+@item map3p
16086+Set input to output plane mapping for output Nth plane. Default is @code{0}.
1607516087 @end table
1607616088
1607716089 @subsection Examples
libavfilter/vf_mergeplanes.c+17−7
@@ -28,8 +28,8 @@ · 27 unmodified lines
2828 #include "framesync.h"
2929
3030 typedef struct Mapping {
31− uint8_t input;
32− uint8_t plane;
31+ int input;
32+ int plane;
3333 } Mapping;
3434
3535 typedef struct InputParam {
@@ -56,8 +56,16 @@ typedef struct MergePlanesContext { · 20 unmodified lines
5656 #define OFFSET(x) offsetof(MergePlanesContext, x)
5757 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
5858 static const AVOption mergeplanes_options[] = {
59− { "mapping", "set input to output plane mapping", OFFSET(mapping), AV_OPT_TYPE_INT, {.i64=0}, 0, 0x33333333, FLAGS },
59+ { "mapping", "set input to output plane mapping", OFFSET(mapping), AV_OPT_TYPE_INT, {.i64=-1}, -1, 0x33333333, FLAGS },
6060 { "format", "set output pixel format", OFFSET(out_fmt), AV_OPT_TYPE_PIXEL_FMT, {.i64=AV_PIX_FMT_YUVA444P}, 0, INT_MAX, .flags=FLAGS },
61+ { "map0s", "set 1st input to output stream mapping", OFFSET(map[0].input), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, FLAGS },
62+ { "map0p", "set 1st input to output plane mapping", OFFSET(map[0].plane), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, FLAGS },
63+ { "map1s", "set 2nd input to output stream mapping", OFFSET(map[1].input), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, FLAGS },
64+ { "map1p", "set 2nd input to output plane mapping", OFFSET(map[1].plane), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, FLAGS },
65+ { "map2s", "set 3rd input to output stream mapping", OFFSET(map[2].input), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, FLAGS },
66+ { "map2p", "set 3rd input to output plane mapping", OFFSET(map[2].plane), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, FLAGS },
67+ { "map3s", "set 4th input to output stream mapping", OFFSET(map[3].input), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, FLAGS },
68+ { "map3p", "set 4th input to output plane mapping", OFFSET(map[3].plane), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, FLAGS },
6169 { NULL }
6270 };
6371
@@ -78,10 +86,12 @@ static av_cold int init(AVFilterContext *ctx) · 14 unmodified lines
7886 s->nb_planes = av_pix_fmt_count_planes(s->out_fmt);
7987
8088 for (i = s->nb_planes - 1; i >= 0; i--) {
81− s->map[i].plane = m & 0xf;
82− m >>= 4;
83− s->map[i].input = m & 0xf;
84− m >>= 4;
89+ if (m >= 0 && m <= 0x33333333) {
90+ s->map[i].plane = m & 0xf;
91+ m >>= 4;
92+ s->map[i].input = m & 0xf;
93+ m >>= 4;
94+ }
8595
8696 if (s->map[i].plane > 3 || s->map[i].input > 3) {
8797 av_log(ctx, AV_LOG_ERROR, "Mapping with out of range input and/or plane number.\n");

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t