Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2017-04-23 19:19:40 +0300
committerPaul B Mahol <onemda@gmail.com>2017-04-23 19:21:51 +0300
commit710c97d5f6a880597701ea7b3ad56920cd0fb731 (patch)
tree15c902bc3dfffea462b55bba88dcacf08a1699d0
parent9d1f9ba582aa8b62d08922a126fe36784d434003 (diff)
avfilter/vf_premultiply: add planes option
Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r--doc/filters.texi8
-rw-r--r--libavfilter/vf_premultiply.c13
2 files changed, 20 insertions, 1 deletions
diff --git a/doc/filters.texi b/doc/filters.texi
index ac32995dea..4c733f016e 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -11077,6 +11077,14 @@ of second stream as alpha.
Both streams must have same dimensions and same pixel format.
+The filter accepts the following option:
+
+@table @option
+@item planes
+Set which planes will be processed, unprocessed planes will be copied.
+By default value 0xf, all planes will be processed.
+@end table
+
@section prewitt
Apply prewitt operator to input video stream.
diff --git a/libavfilter/vf_premultiply.c b/libavfilter/vf_premultiply.c
index e1b79ab779..8a5f9eac64 100644
--- a/libavfilter/vf_premultiply.c
+++ b/libavfilter/vf_premultiply.c
@@ -30,6 +30,7 @@
typedef struct PreMultiplyContext {
const AVClass *class;
int width[4], height[4];
+ int linesize[4];
int nb_planes;
int planes;
int half, depth, offset;
@@ -47,6 +48,7 @@ typedef struct PreMultiplyContext {
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
static const AVOption premultiply_options[] = {
+ { "planes", "set planes", OFFSET(planes), AV_OPT_TYPE_INT, {.i64=0xF}, 0, 0xF, FLAGS },
{ NULL }
};
@@ -269,6 +271,12 @@ static int process_frame(FFFrameSync *fs)
}
for (p = 0; p < s->nb_planes; p++) {
+ if (!((1 << p) & s->planes)) {
+ av_image_copy_plane(out->data[p], out->linesize[p], base->data[p], base->linesize[p],
+ s->linesize[p], s->height[p]);
+ continue;
+ }
+
s->premultiply[p](base->data[p], alpha->data[0],
out->data[p],
base->linesize[p], alpha->linesize[0],
@@ -287,10 +295,13 @@ static int config_input(AVFilterLink *inlink)
AVFilterContext *ctx = inlink->dst;
PreMultiplyContext *s = ctx->priv;
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
- int vsub, hsub;
+ int vsub, hsub, ret;
s->nb_planes = av_pix_fmt_count_planes(inlink->format);
+ if ((ret = av_image_fill_linesizes(s->linesize, inlink->format, inlink->w)) < 0)
+ return ret;
+
hsub = desc->log2_chroma_w;
vsub = desc->log2_chroma_h;
s->height[1] = s->height[2] = AV_CEIL_RSHIFT(inlink->h, vsub);