[FFmpeg-cvslog] lavfi/vf_colorconstancy: cosmetic update

Mina git at videolan.org
Tue Aug 14 21:57:27 EEST 2018


ffmpeg | branch: master | Mina <minasamy_ at hotmail.com> | Tue Aug 14 20:56:51 2018 +0200| [f5559dd8694cbc28b8dbb501378270077f5a72b5] | committer: Thilo Borgmann

lavfi/vf_colorconstancy: cosmetic update

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

 libavfilter/vf_colorconstancy.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavfilter/vf_colorconstancy.c b/libavfilter/vf_colorconstancy.c
index e8271f34ec..e3bb39e51b 100644
--- a/libavfilter/vf_colorconstancy.c
+++ b/libavfilter/vf_colorconstancy.c
@@ -28,7 +28,6 @@
  * J. van de Weijer, Th. Gevers, A. Gijsenij "Edge-Based Color Constancy".
  */
 
-#include "libavutil/bprint.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
@@ -42,6 +41,8 @@
 
 #define GREY_EDGE "greyedge"
 
+#define SQRT3 1.73205080757
+
 #define NUM_PLANES    3
 #define MAX_DIFF_ORD  2
 #define MAX_META_DATA 4
@@ -145,7 +146,7 @@ static int set_gauss(AVFilterContext *ctx)
         sum1 = 0.0;
         for (i = 0; i < filtersize; ++i) {
             s->gauss[1][i] = - (GINDX(filtersize, i) / pow(sigma, 2)) * s->gauss[0][i];
-            sum1 += s->gauss[1][i] *GINDX(filtersize, i);
+            sum1 += s->gauss[1][i] * GINDX(filtersize, i);
         }
 
         for (i = 0; i < filtersize; ++i) {
@@ -595,7 +596,6 @@ static int diagonal_transformation(AVFilterContext *ctx, void *arg, int jobnr, i
     ThreadData *td = arg;
     AVFrame *in = td->in;
     AVFrame *out = td->out;
-    double sqrt3 = pow(3.0, 0.5);
     int plane;
 
     for (plane = 0; plane < NUM_PLANES; ++plane) {
@@ -610,7 +610,7 @@ static int diagonal_transformation(AVFilterContext *ctx, void *arg, int jobnr, i
         unsigned i;
 
         for (i = slice_start; i < slice_end; ++i) {
-            temp = src[i] / (s->white[plane] * sqrt3);
+            temp = src[i] / (s->white[plane] * SQRT3);
             dst[i] = av_clip_uint8((int)(temp + 0.5));
         }
     }
@@ -657,12 +657,12 @@ static int config_props(AVFilterLink *inlink)
     double sigma = s->sigma;
     int ret;
 
-    if (!sigma && s->difford) {
-        av_log(ctx, AV_LOG_ERROR, "Sigma can't be set to 0 when difford > 0.\n");
+    if (!floor(break_off_sigma * sigma + 0.5) && s->difford) {
+        av_log(ctx, AV_LOG_ERROR, "floor(%f * sigma) must be > 0 when difford > 0.\n", break_off_sigma);
         return AVERROR(EINVAL);
     }
 
-    s->filtersize = 2 * floor(break_off_sigma * s->sigma + 0.5) + 1;
+    s->filtersize = 2 * floor(break_off_sigma * sigma + 0.5) + 1;
     if (ret=set_gauss(ctx)) {
         return ret;
     }



More information about the ffmpeg-cvslog mailing list