]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/vf_colorbalance.c
dnn_backend_openvino.c: remove extra semicolon
[ffmpeg] / libavfilter / vf_colorbalance.c
index 56f9d5c49cd8cf2b516ede4785892c35586d4cfd..6dc1b284831ee0d5c7ee1ce391d2d92a49808d27 100644 (file)
@@ -111,7 +111,7 @@ static float get_component(float v, float l,
     v += m;
     v += h;
 
-    return av_clipf(v + 0.5f, 0, 1);
+    return av_clipf(v, 0, 1);
 }
 
 static float hfun(float n, float h, float s, float l)
@@ -188,9 +188,9 @@ static int color_balance8_p(AVFilterContext *ctx, void *arg, int jobnr, int nb_j
             if (s->preserve_lightness)
                 preservel(&r, &g, &b, l);
 
-            dstr[j] = av_clip_uint8(r * max);
-            dstg[j] = av_clip_uint8(g * max);
-            dstb[j] = av_clip_uint8(b * max);
+            dstr[j] = av_clip_uint8(lrintf(r * max));
+            dstg[j] = av_clip_uint8(lrintf(g * max));
+            dstb[j] = av_clip_uint8(lrintf(b * max));
             if (in != out && out->linesize[3])
                 dsta[j] = srca[j];
         }
@@ -242,9 +242,9 @@ static int color_balance16_p(AVFilterContext *ctx, void *arg, int jobnr, int nb_
             if (s->preserve_lightness)
                 preservel(&r, &g, &b, l);
 
-            dstr[j] = av_clip_uintp2_c(r * max, depth);
-            dstg[j] = av_clip_uintp2_c(g * max, depth);
-            dstb[j] = av_clip_uintp2_c(b * max, depth);
+            dstr[j] = av_clip_uintp2_c(lrintf(r * max), depth);
+            dstg[j] = av_clip_uintp2_c(lrintf(g * max), depth);
+            dstb[j] = av_clip_uintp2_c(lrintf(b * max), depth);
             if (in != out && out->linesize[3])
                 dsta[j] = srca[j];
         }
@@ -299,9 +299,9 @@ static int color_balance8(AVFilterContext *ctx, void *arg, int jobnr, int nb_job
             if (s->preserve_lightness)
                 preservel(&r, &g, &b, l);
 
-            dst[j + roffset] = av_clip_uint8(r * max);
-            dst[j + goffset] = av_clip_uint8(g * max);
-            dst[j + boffset] = av_clip_uint8(b * max);
+            dst[j + roffset] = av_clip_uint8(lrintf(r * max));
+            dst[j + goffset] = av_clip_uint8(lrintf(g * max));
+            dst[j + boffset] = av_clip_uint8(lrintf(b * max));
             if (in != out && step == 4)
                 dst[j + aoffset] = src[j + aoffset];
         }
@@ -351,9 +351,9 @@ static int color_balance16(AVFilterContext *ctx, void *arg, int jobnr, int nb_jo
             if (s->preserve_lightness)
                 preservel(&r, &g, &b, l);
 
-            dst[j + roffset] = av_clip_uintp2_c(r * max, depth);
-            dst[j + goffset] = av_clip_uintp2_c(g * max, depth);
-            dst[j + boffset] = av_clip_uintp2_c(b * max, depth);
+            dst[j + roffset] = av_clip_uintp2_c(lrintf(r * max), depth);
+            dst[j + goffset] = av_clip_uintp2_c(lrintf(g * max), depth);
+            dst[j + boffset] = av_clip_uintp2_c(lrintf(b * max), depth);
             if (in != out && step == 4)
                 dst[j + aoffset] = src[j + aoffset];
         }