@@ -226,9 +226,9 @@ MagickExport Image *ComplexImages(const Image *images,const ComplexOperator op,
226226 progress = 0 ;
227227#if defined(MAGICKCORE_OPENMP_SUPPORT )
228228 #pragma omp parallel for schedule(static) shared(progress,status) \
229- magick_number_threads(images ,complex_images,images ->rows,1L)
229+ magick_number_threads(Cr_image ,complex_images,Cr_image ->rows,1L)
230230#endif
231- for (y = 0 ; y < (ssize_t ) images -> rows ; y ++ )
231+ for (y = 0 ; y < (ssize_t ) Cr_image -> rows ; y ++ )
232232 {
233233 register const Quantum
234234 * magick_restrict Ai ,
@@ -245,14 +245,10 @@ MagickExport Image *ComplexImages(const Image *images,const ComplexOperator op,
245245
246246 if (status == MagickFalse )
247247 continue ;
248- Ar = GetCacheViewVirtualPixels (Ar_view ,0 ,y ,
249- MagickMax (Ar_image -> columns ,Cr_image -> columns ),1 ,exception );
250- Ai = GetCacheViewVirtualPixels (Ai_view ,0 ,y ,
251- MagickMax (Ai_image -> columns ,Ci_image -> columns ),1 ,exception );
252- Br = GetCacheViewVirtualPixels (Br_view ,0 ,y ,
253- MagickMax (Br_image -> columns ,Cr_image -> columns ),1 ,exception );
254- Bi = GetCacheViewVirtualPixels (Bi_view ,0 ,y ,
255- MagickMax (Bi_image -> columns ,Ci_image -> columns ),1 ,exception );
248+ Ar = GetCacheViewVirtualPixels (Ar_view ,0 ,y ,Cr_image -> columns ,1 ,exception );
249+ Ai = GetCacheViewVirtualPixels (Ai_view ,0 ,y ,Cr_image -> columns ,1 ,exception );
250+ Br = GetCacheViewVirtualPixels (Br_view ,0 ,y ,Cr_image -> columns ,1 ,exception );
251+ Bi = GetCacheViewVirtualPixels (Bi_view ,0 ,y ,Cr_image -> columns ,1 ,exception );
256252 Cr = QueueCacheViewAuthenticPixels (Cr_view ,0 ,y ,Cr_image -> columns ,1 ,exception );
257253 Ci = QueueCacheViewAuthenticPixels (Ci_view ,0 ,y ,Ci_image -> columns ,1 ,exception );
258254 if ((Ar == (const Quantum * ) NULL ) || (Ai == (const Quantum * ) NULL ) ||
@@ -262,12 +258,12 @@ MagickExport Image *ComplexImages(const Image *images,const ComplexOperator op,
262258 status = MagickFalse ;
263259 continue ;
264260 }
265- for (x = 0 ; x < (ssize_t ) images -> columns ; x ++ )
261+ for (x = 0 ; x < (ssize_t ) Cr_image -> columns ; x ++ )
266262 {
267263 register ssize_t
268264 i ;
269265
270- for (i = 0 ; i < (ssize_t ) GetPixelChannels (images ); i ++ )
266+ for (i = 0 ; i < (ssize_t ) GetPixelChannels (Cr_image ); i ++ )
271267 {
272268 switch (op )
273269 {
@@ -289,21 +285,21 @@ MagickExport Image *ComplexImages(const Image *images,const ComplexOperator op,
289285 double
290286 gamma ;
291287
292- gamma = PerceptibleReciprocal (Br [i ]* Br [i ]+ Bi [i ]* Bi [i ]+ snr );
293- Cr [i ]= gamma * (Ar [i ]* Br [i ]+ Ai [i ]* Bi [i ]);
294- Ci [i ]= gamma * (Ai [i ]* Br [i ]- Ar [i ]* Bi [i ]);
288+ gamma = PerceptibleReciprocal (( double ) Br [i ]* Br [i ]+ Bi [i ]* Bi [i ]+ snr );
289+ Cr [i ]= gamma * (( double ) Ar [i ]* Br [i ]+ ( double ) Ai [i ]* Bi [i ]);
290+ Ci [i ]= gamma * (( double ) Ai [i ]* Br [i ]- ( double ) Ar [i ]* Bi [i ]);
295291 break ;
296292 }
297293 case MagnitudePhaseComplexOperator :
298294 {
299- Cr [i ]= sqrt (Ar [i ]* Ar [i ]+ Ai [i ]* Ai [i ]);
300- Ci [i ]= atan2 (Ai [i ],Ar [i ])/(2.0 * MagickPI )+ 0.5 ;
295+ Cr [i ]= sqrt (( double ) Ar [i ]* Ar [i ]+ ( double ) Ai [i ]* Ai [i ]);
296+ Ci [i ]= atan2 (( double ) Ai [i ],( double ) Ar [i ])/(2.0 * MagickPI )+ 0.5 ;
301297 break ;
302298 }
303299 case MultiplyComplexOperator :
304300 {
305- Cr [i ]= QuantumScale * (Ar [i ]* Br [i ]- Ai [i ]* Bi [i ]);
306- Ci [i ]= QuantumScale * (Ai [i ]* Br [i ]+ Ar [i ]* Bi [i ]);
301+ Cr [i ]= QuantumScale * (( double ) Ar [i ]* Br [i ]- ( double ) Ai [i ]* Bi [i ]);
302+ Ci [i ]= QuantumScale * (( double ) Ai [i ]* Br [i ]+ ( double ) Ar [i ]* Bi [i ]);
307303 break ;
308304 }
309305 case RealImaginaryComplexOperator :
0 commit comments