[FFmpeg-cvslog] avfilter/vf_fftfilt: use the name 's' for the pointer to the private context

Paul B Mahol git at videolan.org
Thu Jan 14 22:29:43 CET 2016


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu Jan 14 22:19:52 2016 +0100| [2bbc7e9625f2cceb0adad95f8d8b9bbf15881dd4] | committer: Paul B Mahol

avfilter/vf_fftfilt: use the name 's' for the pointer to the private context

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

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

 libavfilter/vf_fftfilt.c |  144 +++++++++++++++++++++++-----------------------
 1 file changed, 72 insertions(+), 72 deletions(-)

diff --git a/libavfilter/vf_fftfilt.c b/libavfilter/vf_fftfilt.c
index 915de02..bc493e3 100644
--- a/libavfilter/vf_fftfilt.c
+++ b/libavfilter/vf_fftfilt.c
@@ -73,8 +73,8 @@ AVFILTER_DEFINE_CLASS(fftfilt);
 
 static inline double lum(void *priv, double x, double y, int plane)
 {
-    FFTFILTContext *fftfilt = priv;
-    return fftfilt->rdft_vdata[plane][(int)x * fftfilt->rdft_vlen[plane] + (int)y];
+    FFTFILTContext *s = priv;
+    return s->rdft_vdata[plane][(int)x * s->rdft_vlen[plane] + (int)y];
 }
 
 static double weight_Y(void *priv, double x, double y) { return lum(priv, x, y, Y); }
@@ -93,95 +93,95 @@ static void copy_rev (FFTSample *dest, int w, int w2)
 }
 
 /*Horizontal pass - RDFT*/
-static void rdft_horizontal(FFTFILTContext *fftfilt, AVFrame *in, int w, int h, int plane)
+static void rdft_horizontal(FFTFILTContext *s, AVFrame *in, int w, int h, int plane)
 {
     int i, j;
-    fftfilt->rdft = av_rdft_init(fftfilt->rdft_hbits[plane], DFT_R2C);
+    s->rdft = av_rdft_init(s->rdft_hbits[plane], DFT_R2C);
 
     for (i = 0; i < h; i++) {
         for (j = 0; j < w; j++)
-            fftfilt->rdft_hdata[plane][i * fftfilt->rdft_hlen[plane] + j] = *(in->data[plane] + in->linesize[plane] * i + j);
+            s->rdft_hdata[plane][i * s->rdft_hlen[plane] + j] = *(in->data[plane] + in->linesize[plane] * i + j);
 
-        copy_rev(fftfilt->rdft_hdata[plane] + i * fftfilt->rdft_hlen[plane], w, fftfilt->rdft_hlen[plane]);
+        copy_rev(s->rdft_hdata[plane] + i * s->rdft_hlen[plane], w, s->rdft_hlen[plane]);
     }
 
     for (i = 0; i < h; i++)
-        av_rdft_calc(fftfilt->rdft, fftfilt->rdft_hdata[plane] + i * fftfilt->rdft_hlen[plane]);
+        av_rdft_calc(s->rdft, s->rdft_hdata[plane] + i * s->rdft_hlen[plane]);
 
-    av_rdft_end(fftfilt->rdft);
+    av_rdft_end(s->rdft);
 }
 
 /*Vertical pass - RDFT*/
-static void rdft_vertical(FFTFILTContext *fftfilt, int h, int plane)
+static void rdft_vertical(FFTFILTContext *s, int h, int plane)
 {
     int i, j;
-    fftfilt->rdft = av_rdft_init(fftfilt->rdft_vbits[plane], DFT_R2C);
+    s->rdft = av_rdft_init(s->rdft_vbits[plane], DFT_R2C);
 
-    for (i = 0; i < fftfilt->rdft_hlen[plane]; i++) {
+    for (i = 0; i < s->rdft_hlen[plane]; i++) {
         for (j = 0; j < h; j++)
-            fftfilt->rdft_vdata[plane][i * fftfilt->rdft_vlen[plane] + j] =
-            fftfilt->rdft_hdata[plane][j * fftfilt->rdft_hlen[plane] + i];
-        copy_rev(fftfilt->rdft_vdata[plane] + i * fftfilt->rdft_vlen[plane], h, fftfilt->rdft_vlen[plane]);
+            s->rdft_vdata[plane][i * s->rdft_vlen[plane] + j] =
+            s->rdft_hdata[plane][j * s->rdft_hlen[plane] + i];
+        copy_rev(s->rdft_vdata[plane] + i * s->rdft_vlen[plane], h, s->rdft_vlen[plane]);
     }
 
-    for (i = 0; i < fftfilt->rdft_hlen[plane]; i++)
-        av_rdft_calc(fftfilt->rdft, fftfilt->rdft_vdata[plane] + i * fftfilt->rdft_vlen[plane]);
+    for (i = 0; i < s->rdft_hlen[plane]; i++)
+        av_rdft_calc(s->rdft, s->rdft_vdata[plane] + i * s->rdft_vlen[plane]);
 
-    av_rdft_end(fftfilt->rdft);
+    av_rdft_end(s->rdft);
 }
 /*Vertical pass - IRDFT*/
-static void irdft_vertical(FFTFILTContext *fftfilt, int h, int plane)
+static void irdft_vertical(FFTFILTContext *s, int h, int plane)
 {
     int i, j;
-    fftfilt->rdft = av_rdft_init(fftfilt->rdft_vbits[plane], IDFT_C2R);
-    for (i = 0; i < fftfilt->rdft_hlen[plane]; i++)
-        av_rdft_calc(fftfilt->rdft, fftfilt->rdft_vdata[plane] + i * fftfilt->rdft_vlen[plane]);
+    s->rdft = av_rdft_init(s->rdft_vbits[plane], IDFT_C2R);
+    for (i = 0; i < s->rdft_hlen[plane]; i++)
+        av_rdft_calc(s->rdft, s->rdft_vdata[plane] + i * s->rdft_vlen[plane]);
 
-    for (i = 0; i < fftfilt->rdft_hlen[plane]; i++)
+    for (i = 0; i < s->rdft_hlen[plane]; i++)
         for (j = 0; j < h; j++)
-            fftfilt->rdft_hdata[plane][j * fftfilt->rdft_hlen[plane] + i] =
-            fftfilt->rdft_vdata[plane][i * fftfilt->rdft_vlen[plane] + j];
+            s->rdft_hdata[plane][j * s->rdft_hlen[plane] + i] =
+            s->rdft_vdata[plane][i * s->rdft_vlen[plane] + j];
 
-    av_rdft_end(fftfilt->rdft);
+    av_rdft_end(s->rdft);
 }
 
 /*Horizontal pass - IRDFT*/
-static void irdft_horizontal(FFTFILTContext *fftfilt, AVFrame *out, int w, int h, int plane)
+static void irdft_horizontal(FFTFILTContext *s, AVFrame *out, int w, int h, int plane)
 {
     int i, j;
-    fftfilt->rdft = av_rdft_init(fftfilt->rdft_hbits[plane], IDFT_C2R);
+    s->rdft = av_rdft_init(s->rdft_hbits[plane], IDFT_C2R);
     for (i = 0; i < h; i++)
-        av_rdft_calc(fftfilt->rdft, fftfilt->rdft_hdata[plane] + i * fftfilt->rdft_hlen[plane]);
+        av_rdft_calc(s->rdft, s->rdft_hdata[plane] + i * s->rdft_hlen[plane]);
 
     for (i = 0; i < h; i++)
         for (j = 0; j < w; j++)
-            *(out->data[plane] + out->linesize[plane] * i + j) = av_clip(fftfilt->rdft_hdata[plane][i
-                                                                         *fftfilt->rdft_hlen[plane] + j] * 4 /
-                                                                         (fftfilt->rdft_hlen[plane] *
-                                                                          fftfilt->rdft_vlen[plane]), 0, 255);
+            *(out->data[plane] + out->linesize[plane] * i + j) = av_clip(s->rdft_hdata[plane][i
+                                                                         *s->rdft_hlen[plane] + j] * 4 /
+                                                                         (s->rdft_hlen[plane] *
+                                                                          s->rdft_vlen[plane]), 0, 255);
 
-    av_rdft_end(fftfilt->rdft);
+    av_rdft_end(s->rdft);
 }
 
 static av_cold int initialize(AVFilterContext *ctx)
 {
-    FFTFILTContext *fftfilt = ctx->priv;
+    FFTFILTContext *s = ctx->priv;
     int ret = 0, plane;
 
-    if (!fftfilt->dc[U] && !fftfilt->dc[V]) {
-        fftfilt->dc[U] = fftfilt->dc[Y];
-        fftfilt->dc[V] = fftfilt->dc[Y];
+    if (!s->dc[U] && !s->dc[V]) {
+        s->dc[U] = s->dc[Y];
+        s->dc[V] = s->dc[Y];
     } else {
-        if (!fftfilt->dc[U]) fftfilt->dc[U] = fftfilt->dc[V];
-        if (!fftfilt->dc[V]) fftfilt->dc[V] = fftfilt->dc[U];
+        if (!s->dc[U]) s->dc[U] = s->dc[V];
+        if (!s->dc[V]) s->dc[V] = s->dc[U];
     }
 
-    if (!fftfilt->weight_str[U] && !fftfilt->weight_str[V]) {
-        fftfilt->weight_str[U] = av_strdup(fftfilt->weight_str[Y]);
-        fftfilt->weight_str[V] = av_strdup(fftfilt->weight_str[Y]);
+    if (!s->weight_str[U] && !s->weight_str[V]) {
+        s->weight_str[U] = av_strdup(s->weight_str[Y]);
+        s->weight_str[V] = av_strdup(s->weight_str[Y]);
     } else {
-        if (!fftfilt->weight_str[U]) fftfilt->weight_str[U] = av_strdup(fftfilt->weight_str[V]);
-        if (!fftfilt->weight_str[V]) fftfilt->weight_str[V] = av_strdup(fftfilt->weight_str[U]);
+        if (!s->weight_str[U]) s->weight_str[U] = av_strdup(s->weight_str[V]);
+        if (!s->weight_str[V]) s->weight_str[V] = av_strdup(s->weight_str[U]);
     }
 
     for (plane = 0; plane < 3; plane++) {
@@ -189,7 +189,7 @@ static av_cold int initialize(AVFilterContext *ctx)
         const char *const func2_names[] = {"weight_Y", "weight_U", "weight_V", NULL };
         double (*func2[])(void *, double, double) = { weight_Y, weight_U, weight_V, p[plane], NULL };
 
-        ret = av_expr_parse(&fftfilt->weight_expr[plane], fftfilt->weight_str[plane], var_names,
+        ret = av_expr_parse(&s->weight_expr[plane], s->weight_str[plane], var_names,
                             NULL, NULL, func2_names, func2, 0, ctx);
         if (ret < 0)
             break;
@@ -199,7 +199,7 @@ static av_cold int initialize(AVFilterContext *ctx)
 
 static int config_props(AVFilterLink *inlink)
 {
-    FFTFILTContext *fftfilt = inlink->dst->priv;
+    FFTFILTContext *s = inlink->dst->priv;
     const AVPixFmtDescriptor *desc;
     int rdft_hbits, rdft_vbits, i, j, plane;
     double values[VAR_VARS_NB];
@@ -211,16 +211,16 @@ static int config_props(AVFilterLink *inlink)
 
         /* RDFT - Array initialization for Horizontal pass*/
         for (rdft_hbits = 1; 1 << rdft_hbits < w*10/9; rdft_hbits++);
-        fftfilt->rdft_hbits[i] = rdft_hbits;
-        fftfilt->rdft_hlen[i] = 1 << rdft_hbits;
-        if (!(fftfilt->rdft_hdata[i] = av_malloc_array(h, fftfilt->rdft_hlen[i] * sizeof(FFTSample))))
+        s->rdft_hbits[i] = rdft_hbits;
+        s->rdft_hlen[i] = 1 << rdft_hbits;
+        if (!(s->rdft_hdata[i] = av_malloc_array(h, s->rdft_hlen[i] * sizeof(FFTSample))))
             return AVERROR(ENOMEM);
 
         /* RDFT - Array initialization for Vertical pass*/
         for (rdft_vbits = 1; 1 << rdft_vbits < h*10/9; rdft_vbits++);
-        fftfilt->rdft_vbits[i] = rdft_vbits;
-        fftfilt->rdft_vlen[i] = 1 << rdft_vbits;
-        if (!(fftfilt->rdft_vdata[i] = av_malloc_array(fftfilt->rdft_hlen[i], fftfilt->rdft_vlen[i] * sizeof(FFTSample))))
+        s->rdft_vbits[i] = rdft_vbits;
+        s->rdft_vlen[i] = 1 << rdft_vbits;
+        if (!(s->rdft_vdata[i] = av_malloc_array(s->rdft_hlen[i], s->rdft_vlen[i] * sizeof(FFTSample))))
             return AVERROR(ENOMEM);
     }
 
@@ -229,16 +229,16 @@ static int config_props(AVFilterLink *inlink)
     values[VAR_H] = inlink->h;
     for (plane = 0; plane < 3; plane++)
     {
-        if(!(fftfilt->weight[plane] = av_malloc_array(fftfilt->rdft_hlen[plane], fftfilt->rdft_vlen[plane] * sizeof(double))))
+        if(!(s->weight[plane] = av_malloc_array(s->rdft_hlen[plane], s->rdft_vlen[plane] * sizeof(double))))
             return AVERROR(ENOMEM);
-        for (i = 0; i < fftfilt->rdft_hlen[plane]; i++)
+        for (i = 0; i < s->rdft_hlen[plane]; i++)
         {
             values[VAR_X] = i;
-            for (j = 0; j < fftfilt->rdft_vlen[plane]; j++)
+            for (j = 0; j < s->rdft_vlen[plane]; j++)
             {
                 values[VAR_Y] = j;
-                fftfilt->weight[plane][i * fftfilt->rdft_vlen[plane] + j] =
-                av_expr_eval(fftfilt->weight_expr[plane], values, fftfilt);
+                s->weight[plane][i * s->rdft_vlen[plane] + j] =
+                av_expr_eval(s->weight_expr[plane], values, s);
             }
         }
     }
@@ -250,7 +250,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
     AVFilterContext *ctx = inlink->dst;
     AVFilterLink *outlink = inlink->dst->outputs[0];
     const AVPixFmtDescriptor *desc;
-    FFTFILTContext *fftfilt = ctx->priv;
+    FFTFILTContext *s = ctx->priv;
     AVFrame *out;
     int i, j, plane;
 
@@ -270,19 +270,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
             h = FF_CEIL_RSHIFT(h, desc->log2_chroma_h);
         }
 
-        rdft_horizontal(fftfilt, in, w, h, plane);
-        rdft_vertical(fftfilt, h, plane);
+        rdft_horizontal(s, in, w, h, plane);
+        rdft_vertical(s, h, plane);
 
         /*Change user defined parameters*/
-        for (i = 0; i < fftfilt->rdft_hlen[plane]; i++)
-            for (j = 0; j < fftfilt->rdft_vlen[plane]; j++)
-                fftfilt->rdft_vdata[plane][i * fftfilt->rdft_vlen[plane] + j] *=
-                  fftfilt->weight[plane][i * fftfilt->rdft_vlen[plane] + j];
+        for (i = 0; i < s->rdft_hlen[plane]; i++)
+            for (j = 0; j < s->rdft_vlen[plane]; j++)
+                s->rdft_vdata[plane][i * s->rdft_vlen[plane] + j] *=
+                  s->weight[plane][i * s->rdft_vlen[plane] + j];
 
-        fftfilt->rdft_vdata[plane][0] += fftfilt->rdft_hlen[plane] * fftfilt->rdft_vlen[plane] * fftfilt->dc[plane];
+        s->rdft_vdata[plane][0] += s->rdft_hlen[plane] * s->rdft_vlen[plane] * s->dc[plane];
 
-        irdft_vertical(fftfilt, h, plane);
-        irdft_horizontal(fftfilt, out, w, h, plane);
+        irdft_vertical(s, h, plane);
+        irdft_horizontal(s, out, w, h, plane);
     }
 
     av_frame_free(&in);
@@ -291,13 +291,13 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 
 static av_cold void uninit(AVFilterContext *ctx)
 {
-    FFTFILTContext *fftfilt = ctx->priv;
+    FFTFILTContext *s = ctx->priv;
     int i;
     for (i = 0; i < MAX_PLANES; i++) {
-        av_free(fftfilt->rdft_hdata[i]);
-        av_free(fftfilt->rdft_vdata[i]);
-        av_expr_free(fftfilt->weight_expr[i]);
-        av_free(fftfilt->weight[i]);
+        av_free(s->rdft_hdata[i]);
+        av_free(s->rdft_vdata[i]);
+        av_expr_free(s->weight_expr[i]);
+        av_free(s->weight[i]);
     }
 }
 



More information about the ffmpeg-cvslog mailing list