From 31606b501f67d7df7810fb229b61931ae9e64547 Mon Sep 17 00:00:00 2001
From: Stephan Hilb <stephan@ecshi.net>
Date: Wed, 14 Jul 2021 20:00:13 +0200
Subject: [PATCH] fix minor stuff

---
 src/mesh.jl | 2 +-
 src/run.jl  | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/mesh.jl b/src/mesh.jl
index 3ccf9ab..98a96a6 100644
--- a/src/mesh.jl
+++ b/src/mesh.jl
@@ -358,7 +358,7 @@ function test_mesh(mesh)
 	edgemap[e3] = push!(get!(edgemap, e3, []), cell)
     end
     for (edge, cells) in edgemap
-	@assert(length(cells) <= 2)
+	@assert(1 <= length(cells) <= 2)
     end
     # are cells positively oriented?
     for cell in cells(mesh)
diff --git a/src/run.jl b/src/run.jl
index b4c75c9..7fef3a5 100644
--- a/src/run.jl
+++ b/src/run.jl
@@ -117,6 +117,7 @@ function step!(ctx::L1L2TVContext)
     print("solve ... ")
     ctx.du.data .= A \ b
 
+
     # solve dp1
     function dp1_update(x; g, u, p1, du, tdata)
 	m1 = max(gamma1, norm(T(tdata, u) - g))
@@ -332,7 +333,7 @@ function denoise(img; name, params...)
     ctx = L1L2TVContext(name, mesh, m; T, tdata = nothing, S, params...)
 
     interpolate!(ctx.g, x -> interpolate_bilinear(img, x))
-    m = size(img) ./ 2
+    m = (size(img) .- 1) ./ 2 .+ 1
     interpolate!(ctx.g, x -> norm(x .- m) < norm(m) / 3)
 
     save_denoise(ctx, i) =
-- 
GitLab