]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/vf_bm3d.c
avfilter: Constify all AVFilters
[ffmpeg] / libavfilter / vf_bm3d.c
index 2343f2e1149fbf67a06772ea515796abc08dab30..326b258616f3e5635377451ab1d72beb66dea80d 100644 (file)
@@ -443,7 +443,7 @@ static void basic_block_filtering(BM3DContext *s, const uint8_t *src, int src_li
         }
     }
 
-    threshold[0] = s->hard_threshold * s->sigma;
+    threshold[0] = s->hard_threshold * s->sigma * M_SQRT2 * block_size * block_size * (1 << (s->depth - 8)) / 255.f;
     threshold[1] = threshold[0] * sqrtf(2.f);
     threshold[2] = threshold[0] * 2.f;
     threshold[3] = threshold[0] * sqrtf(8.f);
@@ -942,27 +942,19 @@ static av_cold int init(AVFilterContext *ctx)
     }
 
     pad.type         = AVMEDIA_TYPE_VIDEO;
-    pad.name         = av_strdup("source");
+    pad.name         = "source";
     pad.config_props = config_input;
-    if (!pad.name)
-        return AVERROR(ENOMEM);
 
-    if ((ret = ff_insert_inpad(ctx, 0, &pad)) < 0) {
-        av_freep(&pad.name);
+    if ((ret = ff_insert_inpad(ctx, 0, &pad)) < 0)
         return ret;
-    }
 
     if (s->ref) {
         pad.type         = AVMEDIA_TYPE_VIDEO;
-        pad.name         = av_strdup("reference");
+        pad.name         = "reference";
         pad.config_props = NULL;
-        if (!pad.name)
-            return AVERROR(ENOMEM);
 
-        if ((ret = ff_insert_inpad(ctx, 1, &pad)) < 0) {
-            av_freep(&pad.name);
+        if ((ret = ff_insert_inpad(ctx, 1, &pad)) < 0)
             return ret;
-        }
     }
 
     return 0;
@@ -1027,9 +1019,6 @@ static av_cold void uninit(AVFilterContext *ctx)
     BM3DContext *s = ctx->priv;
     int i;
 
-    for (i = 0; i < ctx->nb_inputs; i++)
-        av_freep(&ctx->input_pads[i].name);
-
     if (s->ref)
         ff_framesync_uninit(&s->fs);
 
@@ -1066,7 +1055,7 @@ static const AVFilterPad bm3d_outputs[] = {
     { NULL }
 };
 
-AVFilter ff_vf_bm3d = {
+const AVFilter ff_vf_bm3d = {
     .name          = "bm3d",
     .description   = NULL_IF_CONFIG_SMALL("Block-Matching 3D denoiser."),
     .priv_size     = sizeof(BM3DContext),