[Bf-blender-cvs] [17ef4821174] temp-T101739-fix-seam-bleeding-non-manifold: Added post check to test if encoding and decoding gets similar results.
Jeroen Bakker
noreply at git.blender.org
Tue Jan 17 12:49:08 CET 2023
Commit: 17ef4821174e233cef0f3588cab81594291ac8ff
Author: Jeroen Bakker
Date: Tue Jan 17 12:39:23 2023 +0100
Branches: temp-T101739-fix-seam-bleeding-non-manifold
https://developer.blender.org/rB17ef4821174e233cef0f3588cab81594291ac8ff
Added post check to test if encoding and decoding gets similar results.
===================================================================
M source/blender/blenkernel/intern/pbvh_pixels_copy.cc
===================================================================
diff --git a/source/blender/blenkernel/intern/pbvh_pixels_copy.cc b/source/blender/blenkernel/intern/pbvh_pixels_copy.cc
index c20fe04b93e..d1fdbaaa8d0 100644
--- a/source/blender/blenkernel/intern/pbvh_pixels_copy.cc
+++ b/source/blender/blenkernel/intern/pbvh_pixels_copy.cc
@@ -470,18 +470,31 @@ struct Rows {
static void extend_last_group(CopyPixelTile &tile_pixels, const CopyPixelCommand &command)
{
- /*
- printf("(%d,%d) = mix((%d,%d), (%d,%d), %f);\n",
- UNPACK2(command.destination),
- UNPACK2(command.source_1),
- UNPACK2(command.source_2),
- command.mix_factor);
- */
CopyPixelGroup &group = tile_pixels.groups.last();
CopyPixelCommand last_command = last_copy_command(tile_pixels, group);
DeltaCopyPixelCommand delta_command = last_command.encode_delta(command);
tile_pixels.command_deltas.append(delta_command);
group.num_deltas += 1;
+
+#ifndef NDEBUG
+ /* Check if decoding the encoded command gives the same result.*/
+ CopyPixelCommand test_command = last_copy_command(tile_pixels, group);
+# if 0
+ printf("(%d,%d) = mix((%d,%d), (%d,%d), %f); -> (%d,%d) = mix((%d,%d), (%d,%d), %f);\n",
+ UNPACK2(command.destination),
+ UNPACK2(command.source_1),
+ UNPACK2(command.source_2),
+ command.mix_factor,
+ UNPACK2(test_command.destination),
+ UNPACK2(test_command.source_1),
+ UNPACK2(test_command.source_2),
+ test_command.mix_factor);
+# endif
+ BLI_assert(test_command.destination == command.destination);
+ BLI_assert(test_command.source_1 == command.source_1);
+ BLI_assert(test_command.source_2 == command.source_2);
+ BLI_assert(abs(test_command.mix_factor - command.mix_factor) < (1.0 / 255) + 0.001);
+#endif
}
// TODO: move to group. */
More information about the Bf-blender-cvs
mailing list