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
16072 16072
16073@item format16073@item format
16074Set output pixel format. Default is @code{yuva444p}.16074Set output pixel format. Default is @code{yuva444p}.
16075
16076@item map0s
16077@item map1s
16078@item map2s
16079@item map3s
16080Set 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
16086Set input to output plane mapping for output Nth plane. Default is @code{0}.
16075@end table16087@end table
16076 16088
16077@subsection Examples16089@subsection Examples
libavfilter/vf_mergeplanes.c+17−7
@@ -28,8 +28,8 @@ · 27 unmodified lines
28#include "framesync.h"28#include "framesync.h"
29 29
30typedef struct Mapping {30typedef struct Mapping {
31 uint8_t input;31 int input;
32 uint8_t plane;32 int plane;
33} Mapping;33} Mapping;
34 34
35typedef struct InputParam {35typedef struct InputParam {
@@ -56,8 +56,16 @@ typedef struct MergePlanesContext { · 20 unmodified lines
56#define OFFSET(x) offsetof(MergePlanesContext, x)56#define OFFSET(x) offsetof(MergePlanesContext, x)
57#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM57#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
58static const AVOption mergeplanes_options[] = {58static 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 },
60 { "format", "set output pixel format", OFFSET(out_fmt), AV_OPT_TYPE_PIXEL_FMT, {.i64=AV_PIX_FMT_YUVA444P}, 0, INT_MAX, .flags=FLAGS },60 { "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 },
61 { NULL }69 { NULL }
62};70};
63 71
@@ -78,10 +86,12 @@ static av_cold int init(AVFilterContext *ctx) · 14 unmodified lines
78 s->nb_planes = av_pix_fmt_count_planes(s->out_fmt);86 s->nb_planes = av_pix_fmt_count_planes(s->out_fmt);
79 87
80 for (i = s->nb_planes - 1; i >= 0; i--) {88 for (i = s->nb_planes - 1; i >= 0; i--) {
81 s->map[i].plane = m & 0xf;89 if (m >= 0 && m <= 0x33333333) {
82 m >>= 4;90 s->map[i].plane = m & 0xf;
83 s->map[i].input = m & 0xf;91 m >>= 4;
84 m >>= 4;92 s->map[i].input = m & 0xf;
93 m >>= 4;
94 }
85 95
86 if (s->map[i].plane > 3 || s->map[i].input > 3) {96 if (s->map[i].plane > 3 || s->map[i].input > 3) {
87 av_log(ctx, AV_LOG_ERROR, "Mapping with out of range input and/or plane number.\n");97 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