From e06e4c180324bebbd41bce9ea4898642f380b614 Mon Sep 17 00:00:00 2001 From: anthony Date: Wed, 15 Sep 2010 04:03:52 +0000 Subject: [PATCH] OpenMP on verbose filter output (one copy only) --- magick/resample.c | 39 ++++++++++--------- magick/resize.c | 98 +++++++++++++++++++++++++---------------------- 2 files changed, 73 insertions(+), 64 deletions(-) diff --git a/magick/resample.c b/magick/resample.c index 297496835..59dc1880b 100644 --- a/magick/resample.c +++ b/magick/resample.c @@ -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; Qfilter_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; Qfilter_lut[Q] + /resample_filter->filter_lut[0] ); + } return; } diff --git a/magick/resize.c b/magick/resize.c index 90c5dd258..88e362807 100644 --- a/magick/resize.c +++ b/magick/resize.c @@ -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); } -- 2.40.0