Browse files

Futz with progressCallback constants

  • Loading branch information...
1 parent e74d43c commit 9ed4769aa7c88f6b5a48820d882a3cf6891cf2a8 @bootchk committed Sep 6, 2011
Showing with 12 additions and 6 deletions.
  1. +0 −2 Test/testResynth.py
  2. +1 −1 src/buildSwitches.h
  3. +3 −0 src/imageSynthConstants.h
  4. +3 −1 src/refiner.h
  5. +1 −1 src/refinerThreaded.h
  6. +4 −1 src/synthesize.h
View
2 Test/testResynth.py
@@ -213,8 +213,6 @@ def main():
parameters = "0,0, True, drawable_of_file_with_anti_selection('"+ zappath + "', select1).ID, -1, -1, 0.0, 0.117, 16, 500"
runtest('zap-texture', 'resynthfull', test, parameters, select1)
- return
-
# Resynthesis of small file from full context
test = "pdb.plug_in_resynthesizer"
# !!! Note we want the ID of the drawable
View
2 src/buildSwitches.h
@@ -67,7 +67,7 @@ then run >automake from the top directory.
// Requires file refinerThreaded.h
// Primarily affects file synthesize.h
// Whether threading is POSIX threads or glib threads depends on SYNTH_USE_GLIB
-// #define SYNTH_THREADED TRUE
+#define SYNTH_THREADED TRUE
// If not defined, uses POSIX threads. Moot unless SYNTH_THREADED
#define SYNTH_USE_GLIB_THREADS
View
3 src/imageSynthConstants.h
@@ -95,3 +95,6 @@ for banded randomization of target points.
#define IMAGE_SYNTH_BAND_FRACTION 0.1
+// Count of target pixels synthesized per deep progress callback
+// !!! This must in binary all x lower bits ones i.e. 2^12-1
+#define IMAGE_SYNTH_CALLBACK_COUNT 4095
View
4 src/refiner.h
@@ -73,7 +73,9 @@ refiner(
void
deepProgressCallback()
{
- completedPixelCount += 4096;
+ // !!! Note if estimatedPixelCountToCompletion is small
+ // this calls back once for each pass with a percentComplete greater than 100.
+ completedPixelCount += IMAGE_SYNTH_CALLBACK_COUNT;
guint percentComplete = ((float)completedPixelCount/estimatedPixelCountToCompletion)*100;
if ( percentComplete > priorReportedPercentComplete )
{
View
2 src/refinerThreaded.h
@@ -282,7 +282,7 @@ refiner(
void
deepProgressCallback()
{
- completedPixelCount += 4096;
+ completedPixelCount += IMAGE_SYNTH_CALLBACK_COUNT;
guint percentComplete = ((float)completedPixelCount/estimatedPixelCountToCompletion)*100;
if ( percentComplete > priorReportedPercentComplete )
{
View
5 src/synthesize.h
@@ -478,7 +478,10 @@ synthesize(
#ifdef DEEP_PROGRESS
// Callback to the level which calculates percent and forwards to the ultimate calling process.
- if ((target_index&4095) == 0) deepProgressCallback();
+ // Modulo is the intuitive way to do this.
+ // But here, we are testing for x lower bits all 1, say 4095, 1111111111.
+ // Don't AND with an arbitrary single bit, say 4096, since one bit is often set.
+ if ((target_index&IMAGE_SYNTH_CALLBACK_COUNT) == 0) deepProgressCallback();
#endif
position = g_array_index(targetPoints, Coordinates, target_index);

0 comments on commit 9ed4769

Please sign in to comment.