Page 1 of 1
Unsharpmask taking longer than expected??
Posted: 2008-04-22T05:16:14-07:00
by teopau
I tried using unsharpmask on a relatively large image of 576x320. It seem that when radius>=14, the processing time is significantly longer when sigma=1.
I'm using ImageMagick 6.3.8.2 VisualMagick API compiled with Visual Studio 6 sp5.
Re: Unsharpmask taking longer than expected??
Posted: 2008-04-22T06:16:20-07:00
by magick
Not a bug. Processing time is relative to the radius of the convolution filter. The larger the radius, the more operations that must be performed for each pixel in the image. We assume if you use a small radius (e.g. 3) the process runs faster than if you use a medium radius (.e.g 7) and you get some slow down with a radius of a large radius (e.g. 11). If so that is the expected behavior.
Re: Unsharpmask taking longer than expected??
Posted: 2008-04-22T17:45:26-07:00
by teopau
Yes i do understand that the greater the radius, the longer the time. But I'm refering to sigma=1 that takes much longer when radius>=14. Sigma of other values takes about the same time, is this normal?
Re: Unsharpmask taking longer than expected??
Posted: 2008-04-22T18:51:31-07:00
by magick
You can track the 1-D kernel required for the unsharp mask by adding -debug transform to your command line. You can see that there is nothing special about a radius >= 14 with a sigma of 1. It creates a 1-D kernel with a width of 31 (for radius of 15). There is an additional penalty as the radius gets larger because the algorithm has to process additional virtual pixels which are outside the image canvas region and have slightly slower access time than pixels within the image canvas region.
Re: Unsharpmask taking longer than expected??
Posted: 2008-04-24T00:14:53-07:00
by teopau
I'm using source distribution compiled with VC6. I compared the convert.exe from binary distribution and source compile and found the the times is significantly longer, mostly spent in cache (virtual pixels?).
The first 3 runs is from binary with sigma=1,2,3 with times ranging from 4.56-6.09sec.
The next 3 runs is from souce with sigma=1,2,3 with times ranging from 5.766-11.5sec.
I guest this is due to the aging VC6 compiler. But I'm having problems with the binary distribution. The demo could compile ok but would give access violation.
Below is the snippet of the debug output.
C:\Program Files\ImageMagick-6.4.0-Q8>convert Picture17.bmp -unsharp 30x1+1+0 Picture17-sharp.bmp
2008-04-24T11:55:04+08:00 0:01 0.078u 6.4.0 Transform convert[3728]: effect.c/BlurImageChannel/1063/Transform
60: 0
2008-04-24T11:55:04+08:00 0:02 1.016u 6.4.0 Cache convert[3728]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+0+0]
2008-04-24T11:55:04+08:00 0:02 1.016u 6.4.0 Cache convert[3728]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+2+0]
2008-04-24T11:55:05+08:00 0:02 1.031u 6.4.0 Cache convert[3728]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+4+0]
2008-04-24T11:55:05+08:00 0:02 1.063u 6.4.0 Cache convert[3728]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+8+0]
2008-04-24T11:55:05+08:00 0:02 1.125u 6.4.0 Cache convert[3728]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+16+0]
2008-04-24T11:55:05+08:00 0:02 1.250u 6.4.0 Cache convert[3728]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+32+0]
2008-04-24T11:55:05+08:00 0:02 1.484u 6.4.0 Cache convert[3728]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+64+0]
2008-04-24T11:55:05+08:00 0:03 1.953u 6.4.0 Cache convert[3728]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+128+0]
2008-04-24T11:55:06+08:00 0:04 2.922u 6.4.0 Cache convert[3728]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+256+0]
2008-04-24T11:55:07+08:00 0:05 3.859u 6.4.0 Cache convert[3728]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+384+0]
2008-04-24T11:55:08+08:00 0:06 4.813u 6.4.0 Cache convert[3728]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+512+0]
2008-04-24T11:55:09+08:00 0:06 5.281u 6.4.0 Cache convert[3728]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+575+0]
C:\Program Files\ImageMagick-6.4.0-Q8>convert Picture17.bmp -unsharp 30x2+1+0 Picture17-sharp.bmp
2008-04-24T11:55:34+08:00 0:01 0.094u 6.4.0 Transform convert[3788]: effect.c/BlurImageChannel/1063/Transform
60: 0
2008-04-24T11:55:35+08:00 0:02 1.391u 6.4.0 Cache convert[3788]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+0+0]
2008-04-24T11:55:35+08:00 0:02 1.406u 6.4.0 Cache convert[3788]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+2+0]
2008-04-24T11:55:35+08:00 0:02 1.422u 6.4.0 Cache convert[3788]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+4+0]
2008-04-24T11:55:35+08:00 0:02 1.453u 6.4.0 Cache convert[3788]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+8+0]
2008-04-24T11:55:35+08:00 0:02 1.531u 6.4.0 Cache convert[3788]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+16+0]
2008-04-24T11:55:35+08:00 0:03 1.656u 6.4.0 Cache convert[3788]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+32+0]
2008-04-24T11:55:36+08:00 0:03 1.922u 6.4.0 Cache convert[3788]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+64+0]
2008-04-24T11:55:36+08:00 0:03 2.453u 6.4.0 Cache convert[3788]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+128+0]
2008-04-24T11:55:37+08:00 0:04 3.484u 6.4.0 Cache convert[3788]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+256+0]
2008-04-24T11:55:38+08:00 0:05 4.516u 6.4.0 Cache convert[3788]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+384+0]
2008-04-24T11:55:39+08:00 0:06 5.563u 6.4.0 Cache convert[3788]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+512+0]
2008-04-24T11:55:40+08:00 0:07 6.094u 6.4.0 Cache convert[3788]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+575+0]
C:\Program Files\ImageMagick-6.4.0-Q8>convert Picture17.bmp -unsharp 30x3+1+0 Picture17-sharp.bmp
2008-04-24T11:55:57+08:00 0:01 0.094u 6.4.0 Transform convert[2112]: effect.c/BlurImageChannel/1063/Transform
60: 3.71581e-023
2008-04-24T11:55:57+08:00 0:01 0.641u 6.4.0 Cache convert[2112]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+0+0]
2008-04-24T11:55:57+08:00 0:01 0.656u 6.4.0 Cache convert[2112]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+2+0]
2008-04-24T11:55:57+08:00 0:02 0.672u 6.4.0 Cache convert[2112]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+4+0]
2008-04-24T11:55:57+08:00 0:02 0.703u 6.4.0 Cache convert[2112]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+8+0]
2008-04-24T11:55:57+08:00 0:02 0.766u 6.4.0 Cache convert[2112]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+16+0]
2008-04-24T11:55:57+08:00 0:02 0.875u 6.4.0 Cache convert[2112]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+32+0]
2008-04-24T11:55:58+08:00 0:02 1.094u 6.4.0 Cache convert[2112]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+64+0]
2008-04-24T11:55:58+08:00 0:02 1.516u 6.4.0 Cache convert[2112]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+128+0]
2008-04-24T11:55:59+08:00 0:03 2.391u 6.4.0 Cache convert[2112]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+256+0]
2008-04-24T11:56:00+08:00 0:04 3.266u 6.4.0 Cache convert[2112]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+384+0]
2008-04-24T11:56:01+08:00 0:05 4.141u 6.4.0 Cache convert[2112]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+512+0]
2008-04-24T11:56:01+08:00 0:05 4.563u 6.4.0 Cache convert[2112]: cache.c/ReadCachePixels/3970/Cache
Picture17.bmp[0][1x320+575+0]
D:\ImageMagick-6.4.0\VisualMagick\bin>convert Picture17.bmp -unsharp 30x1+1+0 Picture17-sharp.bmp
2008-04-24T11:51:23+08:00 0:01 0.344u 6.4.0 Transform convert[2880]: effect.c/unknown/1063/Transform
60: 1.02355e-192
2008-04-24T11:51:27+08:00 0:05 3.891u 6.4.0 Cache convert[2880]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+0+0]
2008-04-24T11:51:27+08:00 0:05 3.922u 6.4.0 Cache convert[2880]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+2+0]
2008-04-24T11:51:27+08:00 0:05 3.938u 6.4.0 Cache convert[2880]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+4+0]
2008-04-24T11:51:27+08:00 0:05 4.000u 6.4.0 Cache convert[2880]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+8+0]
2008-04-24T11:51:27+08:00 0:05 4.109u 6.4.0 Cache convert[2880]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+16+0]
2008-04-24T11:51:27+08:00 0:05 4.313u 6.4.0 Cache convert[2880]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+32+0]
2008-04-24T11:51:28+08:00 0:06 4.734u 6.4.0 Cache convert[2880]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+64+0]
2008-04-24T11:51:28+08:00 0:07 5.578u 6.4.0 Cache convert[2880]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+128+0]
2008-04-24T11:51:30+08:00 0:08 7.266u 6.4.0 Cache convert[2880]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+256+0]
2008-04-24T11:51:32+08:00 0:10 8.969u 6.4.0 Cache convert[2880]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+384+0]
2008-04-24T11:51:34+08:00 0:12 10.672u 6.4.0 Cache convert[2880]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+512+0]
2008-04-24T11:51:34+08:00 0:12 11.500u 6.4.0 Cache convert[2880]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+575+0]
D:\ImageMagick-6.4.0-9\ImageMagick-6.4.0\VisualMagick\bin>convert Picture17.bmp -unsharp 30x2+1+0 Picture17-sharp.bmp
2008-04-24T11:52:31+08:00 0:01 0.328u 6.4.0 Transform convert[2816]: effect.c/unknown/1063/Transform
60: 1.20712e-049
2008-04-24T11:52:33+08:00 0:03 1.906u 6.4.0 Cache convert[2816]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+0+0]
2008-04-24T11:52:33+08:00 0:03 1.938u 6.4.0 Cache convert[2816]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+2+0]
2008-04-24T11:52:33+08:00 0:03 1.953u 6.4.0 Cache convert[2816]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+4+0]
2008-04-24T11:52:33+08:00 0:03 1.984u 6.4.0 Cache convert[2816]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+8+0]
2008-04-24T11:52:33+08:00 0:03 2.078u 6.4.0 Cache convert[2816]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+16+0]
2008-04-24T11:52:33+08:00 0:03 2.234u 6.4.0 Cache convert[2816]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+32+0]
2008-04-24T11:52:34+08:00 0:03 2.547u 6.4.0 Cache convert[2816]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+64+0]
2008-04-24T11:52:34+08:00 0:04 3.172u 6.4.0 Cache convert[2816]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+128+0]
2008-04-24T11:52:36+08:00 0:05 4.422u 6.4.0 Cache convert[2816]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+256+0]
2008-04-24T11:52:37+08:00 0:07 5.688u 6.4.0 Cache convert[2816]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+384+0]
2008-04-24T11:52:38+08:00 0:08 6.938u 6.4.0 Cache convert[2816]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+512+0]
2008-04-24T11:52:39+08:00 0:09 7.578u 6.4.0 Cache convert[2816]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+575+0]
D:\ImageMagick-6.4.0-9\ImageMagick-6.4.0\VisualMagick\bin>convert Picture17.bmp -unsharp 30x3+1+0 Picture17-sharp.bmp
2008-04-24T11:53:09+08:00 0:01 0.344u 6.4.0 Transform convert[3448]: effect.c/unknown/1063/Transform
60: 3.71581e-023
2008-04-24T11:53:09+08:00 0:02 1.000u 6.4.0 Cache convert[3448]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+0+0]
2008-04-24T11:53:09+08:00 0:02 1.016u 6.4.0 Cache convert[3448]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+2+0]
2008-04-24T11:53:09+08:00 0:02 1.031u 6.4.0 Cache convert[3448]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+4+0]
2008-04-24T11:53:09+08:00 0:02 1.063u 6.4.0 Cache convert[3448]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+8+0]
2008-04-24T11:53:09+08:00 0:02 1.125u 6.4.0 Cache convert[3448]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+16+0]
2008-04-24T11:53:09+08:00 0:02 1.266u 6.4.0 Cache convert[3448]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+32+0]
2008-04-24T11:53:10+08:00 0:02 1.531u 6.4.0 Cache convert[3448]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+64+0]
2008-04-24T11:53:10+08:00 0:03 2.047u 6.4.0 Cache convert[3448]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+128+0]
2008-04-24T11:53:11+08:00 0:04 3.109u 6.4.0 Cache convert[3448]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+256+0]
2008-04-24T11:53:12+08:00 0:05 4.172u 6.4.0 Cache convert[3448]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+384+0]
2008-04-24T11:53:13+08:00 0:06 5.234u 6.4.0 Cache convert[3448]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+512+0]
2008-04-24T11:53:14+08:00 0:07 5.766u 6.4.0 Cache convert[3448]: cache.c/unknown/3970/Cache
Picture17.bmp[0][1x320+575+0]
Re: Unsharpmask taking longer than expected??
Posted: 2008-04-24T08:13:25-07:00
by magick
> The demo could compile ok but would give access violation.
There is most likely linkage problems between Visual Studio 7 (ImageMagick binaries) and Visual 6. The linkage problems most likely only apply to Magick++. The MagickCore libaries probably work fine between Visual Studio 7 and 6. There may be a compiler option that can fix the problem but you'll need to Google it because we have limited knowledge in the Windows environment (we are Linux developers).
Re: Unsharpmask taking longer than expected??
Posted: 2008-04-27T22:43:20-07:00
by teopau
Thanks for your little tip. I got it running perfectly by replacing CORE_RL_Magick++_.dll with my own compile.