[FFmpeg-cvslog] lavfi/field, il, noise: use av_pix_fmt_count_planes()

Paul B Mahol git at videolan.org
Fri May 24 15:03:36 CEST 2013


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Fri May 24 12:53:23 2013 +0000| [2516b393d4dda849851cc44ccb610bd87cec1798] | committer: Paul B Mahol

lavfi/field, il, noise: use av_pix_fmt_count_planes()

Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2516b393d4dda849851cc44ccb610bd87cec1798
---

 libavfilter/vf_field.c |    6 +-----
 libavfilter/vf_il.c    |    6 ++----
 libavfilter/vf_noise.c |    6 ++----
 3 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/libavfilter/vf_field.c b/libavfilter/vf_field.c
index bbe66de..b281945 100644
--- a/libavfilter/vf_field.c
+++ b/libavfilter/vf_field.c
@@ -55,12 +55,8 @@ static int config_props_output(AVFilterLink *outlink)
     AVFilterContext *ctx = outlink->src;
     FieldContext *field = ctx->priv;
     AVFilterLink *inlink = ctx->inputs[0];
-    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
-    int i;
 
-    for (i = 0; i < desc->nb_components; i++)
-        field->nb_planes = FFMAX(field->nb_planes, desc->comp[i].plane);
-    field->nb_planes++;
+    field->nb_planes = av_pix_fmt_count_planes(outlink->format);
 
     outlink->w = inlink->w;
     outlink->h = (inlink->h + (field->type == FIELD_TYPE_TOP)) / 2;
diff --git a/libavfilter/vf_il.c b/libavfilter/vf_il.c
index c2ed6ab..86dc683 100644
--- a/libavfilter/vf_il.c
+++ b/libavfilter/vf_il.c
@@ -100,11 +100,9 @@ static int config_input(AVFilterLink *inlink)
 {
     IlContext *il = inlink->dst->priv;
     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
-    int i, ret;
+    int ret;
 
-    for (i = 0; i < desc->nb_components; i++)
-        il->nb_planes = FFMAX(il->nb_planes, desc->comp[i].plane);
-    il->nb_planes++;
+    il->nb_planes = av_pix_fmt_count_planes(inlink->format);
 
     il->has_alpha = !!(desc->flags & AV_PIX_FMT_FLAG_ALPHA);
     if ((ret = av_image_fill_linesizes(il->linesize, inlink->format, inlink->w)) < 0)
diff --git a/libavfilter/vf_noise.c b/libavfilter/vf_noise.c
index 15f5fcf..62852c7 100644
--- a/libavfilter/vf_noise.c
+++ b/libavfilter/vf_noise.c
@@ -184,11 +184,9 @@ static int config_input(AVFilterLink *inlink)
 {
     NoiseContext *n = inlink->dst->priv;
     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
-    int i, ret;
+    int ret;
 
-    for (i = 0; i < desc->nb_components; i++)
-        n->nb_planes = FFMAX(n->nb_planes, desc->comp[i].plane);
-    n->nb_planes++;
+    n->nb_planes = av_pix_fmt_count_planes(inlink->format);
 
     if ((ret = av_image_fill_linesizes(n->linesize, inlink->format, inlink->w)) < 0)
         return ret;



More information about the ffmpeg-cvslog mailing list