]> granicus.if.org Git - imagemagick/commitdiff
OpenMP on verbose filter output (one copy only)
authoranthony <anthony@git.imagemagick.org>
Wed, 15 Sep 2010 04:03:52 +0000 (04:03 +0000)
committeranthony <anthony@git.imagemagick.org>
Wed, 15 Sep 2010 04:03:52 +0000 (04:03 +0000)
magick/resample.c
magick/resize.c

index 2974968356a0d52678294a017b7a079d9be6a51c..59dc1880bb47b8687245e90804b2d3a572182a3b 100644 (file)
@@ -1471,24 +1471,27 @@ MagickExport void SetResampleFilter(ResampleFilter *resample_filter,
     break;
 #endif
   }
-  if (GetImageArtifact(resample_filter->image,"resample:verbose")
-        != (const char *) NULL)
-    {
-      /* Debug output of the filter weighting LUT
-        Gnuplot the LUT with hoizontal adjusted to 'r' using...
-          plot [0:2][-.2:1] "lut.dat" using (sqrt($0/1024)*2):1 with lines
-        The filter values is normalized for comparision
-      */
-      printf("# Resampling Filter LUT (%d values)\n", WLUT_WIDTH);
-      printf("#\n");
-      printf("# Plot using the gnuplot command\n");
-      printf("#   plot [0:2][-.2:1] \"lut.dat\" ");
-      printf(           "using (sqrt($0/%d)*2):1 with lines\n", WLUT_WIDTH);
-      printf("#\n");
-      for(Q=0; Q<WLUT_WIDTH; Q++)
-        printf("%lf\n", resample_filter->filter_lut[Q]
-                          /resample_filter->filter_lut[0] );
-    }
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
+  if( GetOpenMPThreadId() == 0 )
+#endif
+    if (GetImageArtifact(resample_filter->image,"resample:verbose")
+          != (const char *) NULL)
+      {
+        /* Debug output of the filter weighting LUT
+          Gnuplot the LUT with hoizontal adjusted to 'r' using...
+            plot [0:2][-.2:1] "lut.dat" using (sqrt($0/1024)*2):1 with lines
+          The filter values is normalized for comparision
+        */
+        printf("# Resampling Filter LUT (%d values)\n", WLUT_WIDTH);
+        printf("#\n");
+        printf("# Plot using the gnuplot command\n");
+        printf("#   plot [0:2][-.2:1] \"lut.dat\" ");
+        printf(           "using (sqrt($0/%d)*2):1 with lines\n", WLUT_WIDTH);
+        printf("#\n");
+        for(Q=0; Q<WLUT_WIDTH; Q++)
+          printf("%lf\n", resample_filter->filter_lut[Q]
+                            /resample_filter->filter_lut[0] );
+      }
   return;
 }
 \f
index 90c5dd258ed36d97918699fd422678fe827f57d3..88e3628070975d64a29a8600edeaad2023f92e88 100644 (file)
@@ -1042,54 +1042,60 @@ MagickExport ResizeFilter *AcquireResizeFilter(const Image *image,
   /*
     Expert Option Request for verbose details of the resulting filter
   */
-  artifact=GetImageArtifact(image,"filter:verbose");
-  if (artifact != (const char *) NULL)
-    {
-      double
-        support,
-        x;
-
-      /* Reset the filter_type for specific compound filters so the actual
-       * 'function' is returned, not the user selection.  Specifically this
-       * is needed for the Sinc and Cubic compound filters.
-       */
-      if ( resize_filter->filter == SincTrig )
-        filter_type=SincFilter;
-      if ( resize_filter->filter == SincFast )
-        filter_type=SincFastFilter;
-      if ( resize_filter->filter == CubicBC )
-        filter_type=CubicFilter;
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
+  if( GetOpenMPThreadId() == 0 ) {
+#endif
+    artifact=GetImageArtifact(image,"filter:verbose");
+    if (artifact != (const char *) NULL)
+      {
+        double
+          support,
+          x;
 
-      /*
-        Report Filter Details
-      */
-      support = GetResizeFilterSupport(resize_filter); /* support range */
-      (void) fprintf(stdout,"#\n# Resize Filter (for graphing)\n#\n");
-      (void) fprintf(stdout,"# filter = %s\n",
-           MagickOptionToMnemonic(MagickFilterOptions, filter_type) );
-      (void) fprintf(stdout,"# window = %s\n",
-           MagickOptionToMnemonic(MagickFilterOptions, window_type) );
-      (void) fprintf(stdout,"# support = %.*g\n",
-           GetMagickPrecision(),resize_filter->support );
-      (void) fprintf(stdout,"# win-support = %.*g\n",
-           GetMagickPrecision(),resize_filter->window_support );
-      (void) fprintf(stdout,"# blur = %.*g\n",
-           GetMagickPrecision(),resize_filter->blur );
-      (void) fprintf(stdout,"# blurred_support = %.*g\n",
-           GetMagickPrecision(),support);
-      (void) fprintf(stdout,"# B,C = %.*g,%.*g\n",
-           GetMagickPrecision(),B,   GetMagickPrecision(),C);
-      (void) fprintf(stdout,"#\n");
-      /*
-        Output values of resulting filter graph -- for graphing filter result.
-      */
-      for (x=0.0; x <= support; x+=0.01f)
-        (void) fprintf(stdout,"%5.2lf\t%.*g\n", x,
-          GetMagickPrecision(), GetResizeFilterWeight(resize_filter,x));
-      /* A final value so gnuplot can graph the 'stop' properly */
-      (void) fprintf(stdout,"%5.2lf\t%.*g\n",support,
-           GetMagickPrecision(), 0.0);
+        /* Reset the filter_type for specific compound filters so the actual
+        * 'function' is returned, not the user selection.  Specifically this
+        * is needed for the Sinc and Cubic compound filters.
+        */
+        if ( resize_filter->filter == SincTrig )
+          filter_type=SincFilter;
+        if ( resize_filter->filter == SincFast )
+          filter_type=SincFastFilter;
+        if ( resize_filter->filter == CubicBC )
+          filter_type=CubicFilter;
+
+        /*
+          Report Filter Details
+        */
+        support = GetResizeFilterSupport(resize_filter); /* support range */
+        (void) fprintf(stdout,"#\n# Resize Filter (for graphing)\n#\n");
+        (void) fprintf(stdout,"# filter = %s\n",
+            MagickOptionToMnemonic(MagickFilterOptions, filter_type) );
+        (void) fprintf(stdout,"# window = %s\n",
+            MagickOptionToMnemonic(MagickFilterOptions, window_type) );
+        (void) fprintf(stdout,"# support = %.*g\n",
+            GetMagickPrecision(),resize_filter->support );
+        (void) fprintf(stdout,"# win-support = %.*g\n",
+            GetMagickPrecision(),resize_filter->window_support );
+        (void) fprintf(stdout,"# blur = %.*g\n",
+            GetMagickPrecision(),resize_filter->blur );
+        (void) fprintf(stdout,"# blurred_support = %.*g\n",
+            GetMagickPrecision(),support);
+        (void) fprintf(stdout,"# B,C = %.*g,%.*g\n",
+            GetMagickPrecision(),B,   GetMagickPrecision(),C);
+        (void) fprintf(stdout,"#\n");
+        /*
+          Output values of resulting filter graph -- for graphing filter result.
+        */
+        for (x=0.0; x <= support; x+=0.01f)
+          (void) fprintf(stdout,"%5.2lf\t%.*g\n", x,
+            GetMagickPrecision(), GetResizeFilterWeight(resize_filter,x));
+        /* A final value so gnuplot can graph the 'stop' properly */
+        (void) fprintf(stdout,"%5.2lf\t%.*g\n",support,
+            GetMagickPrecision(), 0.0);
+      }
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
     }
+#endif
   return(resize_filter);
 }
 \f