]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/vf_colorbalance.c
avfilter: Constify all AVFilters
[ffmpeg] / libavfilter / vf_colorbalance.c
index cc90dc08c78ef89b1883d264c7f026b6ff36f26d..4e13ce97b9a9497afde4499dd3d23499a6992250 100644 (file)
@@ -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];
         }
@@ -439,7 +439,7 @@ static const AVFilterPad colorbalance_outputs[] = {
     { NULL }
 };
 
-AVFilter ff_vf_colorbalance = {
+const AVFilter ff_vf_colorbalance = {
     .name          = "colorbalance",
     .description   = NULL_IF_CONFIG_SMALL("Adjust the color balance."),
     .priv_size     = sizeof(ColorBalanceContext),