]> git.sesse.net Git - ffmpeg/commitdiff
avfilter/vf_bm3d: improve threshold scaling with different block_size and depth
authorPaul B Mahol <onemda@gmail.com>
Mon, 18 Nov 2019 22:20:18 +0000 (23:20 +0100)
committerPaul B Mahol <onemda@gmail.com>
Mon, 18 Nov 2019 23:12:47 +0000 (00:12 +0100)
libavfilter/vf_bm3d.c

index 2343f2e1149fbf67a06772ea515796abc08dab30..e5d2b8bc63264d649e4937272f04699b21997293 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);