1 //
2 // Copyright (c) 2017 The Khronos Group Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 #include "../testBase.h"
17 #include "../common.h"
18
19 extern int test_copy_image_generic( cl_context context, cl_command_queue queue, image_descriptor *srcImageInfo, image_descriptor *dstImageInfo,
20 const size_t sourcePos[], const size_t destPos[], const size_t regionSize[], MTdata d );
21
set_image_dimensions(image_descriptor * imageInfo,size_t width,size_t height,size_t depth,size_t rowPadding,size_t slicePadding)22 static void set_image_dimensions( image_descriptor *imageInfo, size_t width, size_t height, size_t depth, size_t rowPadding, size_t slicePadding )
23 {
24 size_t pixelSize = get_pixel_size( imageInfo->format );
25
26 imageInfo->width = width;
27 imageInfo->height = height;
28 imageInfo->depth = depth;
29 imageInfo->rowPitch = imageInfo->width * pixelSize + rowPadding;
30
31 if (gEnablePitch)
32 {
33 do {
34 rowPadding++;
35 imageInfo->rowPitch = imageInfo->width * pixelSize + rowPadding;
36 } while ((imageInfo->rowPitch % pixelSize) != 0);
37 }
38
39 imageInfo->slicePitch = imageInfo->rowPitch * (imageInfo->height + slicePadding);
40
41 if (depth == 0)
42 imageInfo->type = CL_MEM_OBJECT_IMAGE2D;
43 else
44 imageInfo->type = CL_MEM_OBJECT_IMAGE3D;
45 }
46
47
test_copy_image_size_2D_3D(cl_context context,cl_command_queue queue,image_descriptor * srcImageInfo,image_descriptor * dstImageInfo,MTdata d)48 int test_copy_image_size_2D_3D( cl_context context, cl_command_queue queue, image_descriptor *srcImageInfo, image_descriptor *dstImageInfo, MTdata d )
49 {
50 size_t sourcePos[ 4 ] = { 0 }, destPos[ 4 ] = { 0 }, regionSize[ 3 ];
51 int ret = 0, retCode;
52
53 image_descriptor *threeImage, *twoImage;
54
55 if( srcImageInfo->depth > 0 )
56 {
57 threeImage = srcImageInfo;
58 twoImage = dstImageInfo;
59 }
60 else
61 {
62 threeImage = dstImageInfo;
63 twoImage = srcImageInfo;
64 }
65
66 size_t twoImage_lod = 0, twoImage_width_lod = twoImage->width, twoImage_row_pitch_lod;
67 size_t twoImage_height_lod = twoImage->height;
68 size_t threeImage_lod = 0, threeImage_width_lod = threeImage->width, threeImage_row_pitch_lod, threeImage_slice_pitch_lod;
69 size_t threeImage_height_lod = threeImage->height, depth_lod = threeImage->depth;
70 size_t width_lod, height_lod;
71 size_t twoImage_max_mip_level,threeImage_max_mip_level;
72
73 if( gTestMipmaps )
74 {
75 twoImage_max_mip_level = twoImage->num_mip_levels;
76 threeImage_max_mip_level = threeImage->num_mip_levels;
77 // Work at random mip levels
78 twoImage_lod = (size_t)random_in_range( 0, twoImage_max_mip_level ? twoImage_max_mip_level - 1 : 0, d );
79 threeImage_lod = (size_t)random_in_range( 0, threeImage_max_mip_level ? threeImage_max_mip_level - 1 : 0, d );
80 twoImage_width_lod = ( twoImage->width >> twoImage_lod )? ( twoImage->width >> twoImage_lod ) : 1;
81 threeImage_width_lod = ( threeImage->width >> threeImage_lod )? ( threeImage->width >> threeImage_lod ) : 1;
82 twoImage_height_lod = ( twoImage->height >> twoImage_lod )? ( twoImage->height >> twoImage_lod ) : 1;
83 threeImage_height_lod = ( threeImage->height >> threeImage_lod )? ( threeImage->height >> threeImage_lod ) : 1;
84 depth_lod = ( threeImage->depth >> threeImage_lod )? ( threeImage->depth >> threeImage_lod ) : 1;
85 twoImage_row_pitch_lod = twoImage_width_lod * get_pixel_size( twoImage->format );
86 threeImage_row_pitch_lod = threeImage_width_lod * get_pixel_size( threeImage->format );
87 threeImage_slice_pitch_lod = threeImage_height_lod * threeImage_row_pitch_lod;
88 }
89 width_lod = ( twoImage_width_lod > threeImage_width_lod ) ? threeImage_width_lod : twoImage_width_lod;
90 height_lod = ( twoImage_height_lod > threeImage_height_lod ) ? threeImage_height_lod : twoImage_height_lod;
91
92 // First, try just a full covering region
93 sourcePos[ 0 ] = sourcePos[ 1 ] = sourcePos[ 2 ] = sourcePos[ 3 ] = 0;
94 destPos[ 0 ] = destPos[ 1 ] = destPos[ 2 ] = destPos[ 3 ] = 0;
95 regionSize[ 0 ] = width_lod;
96 regionSize[ 1 ] = height_lod;
97 regionSize[ 2 ] = 1;
98
99 if( srcImageInfo->depth == 0 )
100 {
101 // 2D to 3D
102 destPos[ 2 ] = (size_t)random_in_range( 0, (int)dstImageInfo->depth - 1, d );
103 if(gTestMipmaps)
104 {
105 destPos[ 2 ] = (size_t)random_in_range( 0, (int)depth_lod - 1, d );
106 sourcePos[ 2 ] = twoImage_lod;
107 destPos[ 3 ] = threeImage_lod;
108 regionSize[ 0 ] = width_lod;
109 regionSize[ 1 ] = height_lod;
110 }
111 }
112 else
113 {
114 // 3D to 2D
115 sourcePos[ 2 ] = (size_t)random_in_range( 0, (int)srcImageInfo->depth - 1, d );
116 if(gTestMipmaps)
117 {
118 sourcePos[ 2 ] = (size_t)random_in_range( 0, (int)depth_lod - 1, d );
119 sourcePos[ 3 ] = threeImage_lod;
120 destPos[ 2 ] = twoImage_lod;
121 regionSize[ 0 ] = width_lod;
122 regionSize[ 1 ] = height_lod;
123 }
124 }
125
126 retCode = test_copy_image_generic( context, queue, srcImageInfo, dstImageInfo, sourcePos, destPos, regionSize, d );
127 if( retCode < 0 )
128 return retCode;
129 else
130 ret += retCode;
131
132 // Now try a sampling of different random regions
133 for( int i = 0; i < 8; i++ )
134 {
135 if( gTestMipmaps )
136 {
137 // Work at a random mip level
138 twoImage_lod = (size_t)random_in_range( 0, twoImage_max_mip_level ? twoImage_max_mip_level - 1 : 0, d );
139 threeImage_lod = (size_t)random_in_range( 0, threeImage_max_mip_level ? threeImage_max_mip_level - 1 : 0, d );
140 twoImage_width_lod = ( twoImage->width >> twoImage_lod )? ( twoImage->width >> twoImage_lod ) : 1;
141 threeImage_width_lod = ( threeImage->width >> threeImage_lod )? ( threeImage->width >> threeImage_lod ) : 1;
142 twoImage_height_lod = ( twoImage->height >> twoImage_lod )? ( twoImage->height >> twoImage_lod ) : 1;
143 threeImage_height_lod = ( threeImage->height >> threeImage_lod )? ( threeImage->height >> threeImage_lod ) : 1;
144 width_lod = ( twoImage_width_lod > threeImage_width_lod ) ? threeImage_width_lod : twoImage_width_lod;
145 height_lod = ( twoImage_height_lod > threeImage_height_lod ) ? threeImage_height_lod : twoImage_height_lod;
146 depth_lod = ( threeImage->depth >> threeImage_lod )? ( threeImage->depth >> threeImage_lod ) : 1;
147 }
148 // Pick a random size
149 regionSize[ 0 ] = random_in_ranges( 8, srcImageInfo->width, dstImageInfo->width, d );
150 regionSize[ 1 ] = random_in_ranges( 8, srcImageInfo->height, dstImageInfo->height, d );
151 if( gTestMipmaps )
152 {
153 regionSize[ 0 ] = ( width_lod > 8 ) ? random_in_range( 8, width_lod, d ) : width_lod;
154 regionSize[ 1 ] = ( height_lod > 8) ? random_in_range( 8, height_lod, d ): height_lod;
155 }
156
157 // Now pick positions within valid ranges
158 sourcePos[ 0 ] = ( srcImageInfo->width > regionSize[ 0 ] ) ? (size_t)random_in_range( 0, (int)( srcImageInfo->width - regionSize[ 0 ] - 1 ), d ) : 0;
159 sourcePos[ 1 ] = ( srcImageInfo->height > regionSize[ 1 ] ) ? (size_t)random_in_range( 0, (int)( srcImageInfo->height - regionSize[ 1 ] - 1 ), d ) : 0;
160 sourcePos[ 2 ] = ( srcImageInfo->depth > 0 ) ? (size_t)random_in_range( 0, (int)( srcImageInfo->depth - 1 ), d ) : 0;
161
162 if (gTestMipmaps)
163 {
164 if( srcImageInfo->depth > 0 )
165 {
166 sourcePos[ 0 ] = ( threeImage_width_lod > regionSize[ 0 ] ) ? (size_t)random_in_range( 0, (int)( threeImage_width_lod - regionSize[ 0 ] - 1 ), d ) : 0;
167 sourcePos[ 1 ] = ( threeImage_height_lod > regionSize[ 1 ] ) ? (size_t)random_in_range( 0, (int)( threeImage_height_lod - regionSize[ 1 ] - 1 ), d ) : 0;
168 sourcePos[ 2 ] = (size_t)random_in_range( 0, (int)( depth_lod - 1 ), d );
169 sourcePos[ 3 ] = threeImage_lod;
170 }
171 else
172 {
173 sourcePos[ 0 ] = ( twoImage_width_lod > regionSize[ 0 ] ) ? (size_t)random_in_range( 0, (int)( twoImage_width_lod - regionSize[ 0 ] - 1 ), d ) : 0;
174 sourcePos[ 1 ] = ( twoImage_height_lod > regionSize[ 1 ] ) ? (size_t)random_in_range( 0, (int)( twoImage_height_lod - regionSize[ 1 ] - 1 ), d ) : 0;
175
176 }
177 }
178
179 destPos[ 0 ] = ( dstImageInfo->width > regionSize[ 0 ] ) ? (size_t)random_in_range( 0, (int)( dstImageInfo->width - regionSize[ 0 ] - 1 ), d ) : 0;
180 destPos[ 1 ] = ( dstImageInfo->height > regionSize[ 1 ] ) ? (size_t)random_in_range( 0, (int)( dstImageInfo->height - regionSize[ 1 ] - 1 ), d ) : 0;
181 destPos[ 2 ] = ( dstImageInfo->depth > 0 ) ? (size_t)random_in_range( 0, (int)( dstImageInfo->depth - 1 ), d ) : 0;
182
183 if (gTestMipmaps)
184 {
185 if( dstImageInfo->depth > 0 )
186 {
187 destPos[ 0 ] = ( threeImage_width_lod > regionSize[ 0 ] ) ? (size_t)random_in_range( 0, (int)( threeImage_width_lod - regionSize[ 0 ] - 1 ), d ) : 0;
188 destPos[ 1 ] = ( threeImage_height_lod > regionSize[ 1 ] ) ? (size_t)random_in_range( 0, (int)( threeImage_height_lod - regionSize[ 1 ] - 1 ), d ) : 0;
189 destPos[ 2 ] = (size_t)random_in_range( 0, (int)( depth_lod - 1 ), d );
190 destPos[ 3 ] = threeImage_lod;
191 }
192 else
193 {
194 destPos[ 0 ] = ( twoImage_width_lod > regionSize[ 0 ] ) ? (size_t)random_in_range( 0, (int)( twoImage_width_lod - regionSize[ 0 ] - 1 ), d ) : 0;
195 destPos[ 1 ] = ( twoImage_height_lod > regionSize[ 1 ] ) ? (size_t)random_in_range( 0, (int)( twoImage_height_lod - regionSize[ 1 ] - 1 ), d ) : 0;
196
197 }
198 }
199
200 // Go for it!
201 retCode = test_copy_image_generic( context, queue, srcImageInfo, dstImageInfo, sourcePos, destPos, regionSize, d );
202 if( retCode < 0 )
203 return retCode;
204 else
205 ret += retCode;
206 }
207
208 return ret;
209 }
210
211
test_copy_image_set_2D_3D(cl_device_id device,cl_context context,cl_command_queue queue,cl_image_format * format,bool reverse=false)212 int test_copy_image_set_2D_3D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, bool reverse = false )
213 {
214 size_t maxWidth, maxHeight, max3DWidth, max3DHeight, max3DDepth;
215 cl_ulong maxAllocSize, memSize;
216 image_descriptor srcImageInfo = { 0 };
217 image_descriptor dstImageInfo = { 0 };
218 RandomSeed seed( gRandomSeed );
219
220 srcImageInfo.format = dstImageInfo.format = format;
221
222 int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
223 error |= clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_HEIGHT, sizeof( maxHeight ), &maxHeight, NULL );
224 error |= clGetDeviceInfo( device, CL_DEVICE_IMAGE3D_MAX_WIDTH, sizeof( max3DWidth ), &max3DWidth, NULL );
225 error |= clGetDeviceInfo( device, CL_DEVICE_IMAGE3D_MAX_HEIGHT, sizeof( max3DHeight ), &max3DHeight, NULL );
226 error |= clGetDeviceInfo( device, CL_DEVICE_IMAGE3D_MAX_DEPTH, sizeof( max3DDepth ), &max3DDepth, NULL );
227 error |= clGetDeviceInfo( device, CL_DEVICE_MAX_MEM_ALLOC_SIZE, sizeof( maxAllocSize ), &maxAllocSize, NULL );
228 error |= clGetDeviceInfo( device, CL_DEVICE_GLOBAL_MEM_SIZE, sizeof( memSize ), &memSize, NULL );
229 test_error( error, "Unable to get max image 2D or 3D size from device" );
230
231 if (memSize > (cl_ulong)SIZE_MAX) {
232 memSize = (cl_ulong)SIZE_MAX;
233 }
234
235 if( gTestSmallImages )
236 {
237 for( dstImageInfo.width = 4; dstImageInfo.width < 17; dstImageInfo.width++ )
238 {
239 for( dstImageInfo.height = 4; dstImageInfo.height < 13; dstImageInfo.height++ )
240 {
241 for( dstImageInfo.depth = 4; dstImageInfo.depth < 9; dstImageInfo.depth++ )
242 {
243 size_t rowPadding = gEnablePitch ? 256 : 0;
244 size_t slicePadding = gEnablePitch ? 3 : 0;
245
246 set_image_dimensions( &dstImageInfo, dstImageInfo.width, dstImageInfo.height, dstImageInfo.depth, rowPadding, slicePadding );
247 set_image_dimensions( &srcImageInfo, dstImageInfo.width, dstImageInfo.height, 0, rowPadding, slicePadding );
248
249 if (gTestMipmaps)
250 {
251 srcImageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(srcImageInfo.width, srcImageInfo.height, 0), seed);
252 srcImageInfo.type = CL_MEM_OBJECT_IMAGE2D;
253 dstImageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(dstImageInfo.width, dstImageInfo.height, dstImageInfo.depth), seed);
254 dstImageInfo.type = CL_MEM_OBJECT_IMAGE3D;
255 srcImageInfo.rowPitch = srcImageInfo.width * get_pixel_size( srcImageInfo.format );
256 srcImageInfo.slicePitch = 0;
257 dstImageInfo.rowPitch = dstImageInfo.width * get_pixel_size( dstImageInfo.format );
258 dstImageInfo.slicePitch = dstImageInfo.rowPitch * dstImageInfo.height;
259 }
260
261 if( gDebugTrace )
262 log_info( " at size %d,%d to %d,%d,%d\n", (int)srcImageInfo.width, (int)srcImageInfo.height, (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.depth );
263
264 int ret;
265 if( reverse )
266 ret = test_copy_image_size_2D_3D( context, queue, &dstImageInfo, &srcImageInfo, seed );
267 else
268 ret = test_copy_image_size_2D_3D( context, queue, &srcImageInfo, &dstImageInfo, seed );
269 if( ret )
270 return -1;
271 }
272 }
273 }
274 }
275 else if( gTestMaxImages )
276 {
277 // Try a specific set of maximum sizes
278 size_t numberOfSizes3D, numberOfSizes2D;
279 size_t sizes3D[100][3], sizes2D[100][3];
280
281 // Try to allocate a bit smaller images because we need the 2D ones as well for the copy.
282 get_max_sizes(&numberOfSizes3D, 100, sizes3D, max3DWidth, max3DHeight, max3DDepth, 1, maxAllocSize/2, memSize/2, CL_MEM_OBJECT_IMAGE3D, dstImageInfo.format);
283 get_max_sizes(&numberOfSizes2D, 100, sizes2D, maxWidth, maxHeight, 1, 1, maxAllocSize/2, memSize/2, CL_MEM_OBJECT_IMAGE2D, srcImageInfo.format);
284
285 for( size_t i = 0; i < numberOfSizes2D; i++ )
286 for( size_t j = 0; j < numberOfSizes3D; j++ )
287 {
288 size_t rowPadding = gEnablePitch ? 256 : 0;
289 size_t slicePadding = gEnablePitch ? 3 : 0;
290
291 set_image_dimensions( &dstImageInfo, sizes3D[ j ][ 0 ], sizes3D[ j ][ 1 ], sizes3D[ j ][ 2 ], rowPadding, slicePadding );
292 set_image_dimensions( &srcImageInfo, sizes2D[ i ][ 0 ], sizes2D[ i ][ 1 ], 0, rowPadding, slicePadding );
293 cl_ulong dstSize = get_image_size(&dstImageInfo);
294 cl_ulong srcSize = get_image_size(&srcImageInfo);
295
296 if (gTestMipmaps)
297 {
298 srcImageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(srcImageInfo.width, srcImageInfo.height, 0), seed);
299 srcImageInfo.type = CL_MEM_OBJECT_IMAGE2D;
300 dstImageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(dstImageInfo.width, dstImageInfo.height, dstImageInfo.depth), seed);
301 dstImageInfo.type = CL_MEM_OBJECT_IMAGE3D;
302 srcImageInfo.rowPitch = srcImageInfo.width * get_pixel_size( srcImageInfo.format );
303 srcImageInfo.slicePitch = 0;
304 dstImageInfo.rowPitch = dstImageInfo.width * get_pixel_size( dstImageInfo.format );
305 dstImageInfo.slicePitch = dstImageInfo.rowPitch * dstImageInfo.height;
306 dstSize = 4 * compute_mipmapped_image_size( dstImageInfo );
307 srcSize = 4 * compute_mipmapped_image_size( srcImageInfo );
308 }
309
310 if( dstSize < maxAllocSize && dstSize < ( memSize / 3 ) && srcSize < maxAllocSize && srcSize < ( memSize / 3 ) )
311 {
312 log_info( "Testing %d x %d to %d x %d x %d\n", (int)srcImageInfo.width, (int)srcImageInfo.height, (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.depth );
313 if( gDebugTrace )
314 log_info( " at max size %d,%d to %d,%d,%d\n", (int)srcImageInfo.width, (int)srcImageInfo.height, (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.depth );
315 int ret;
316 if( reverse )
317 ret = test_copy_image_size_2D_3D( context, queue, &dstImageInfo, &srcImageInfo, seed );
318 else
319 ret = test_copy_image_size_2D_3D( context, queue, &srcImageInfo, &dstImageInfo, seed );
320 if( ret )
321 return -1;
322 }
323 else
324 {
325 log_info("Not testing max size %d x %d to %d x %d x %d due to memory constraints.\n",
326 (int)srcImageInfo.width, (int)srcImageInfo.height, (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.depth);
327 }
328
329 }
330 }
331 else
332 {
333 for( int i = 0; i < NUM_IMAGE_ITERATIONS; i++ )
334 {
335 cl_ulong srcSize, dstSize;
336 size_t rowPadding = gEnablePitch ? 256 : 0;
337 size_t slicePadding = gEnablePitch ? 3 : 0;
338
339 // Loop until we get a size that a) will fit in the max alloc size and b) that an allocation of that
340 // image, the result array, plus offset arrays, will fit in the global ram space
341 do
342 {
343 dstImageInfo.width = (size_t)random_log_in_range( 16, (int)max3DWidth / 32, seed );
344 dstImageInfo.height = (size_t)random_log_in_range( 16, (int)max3DHeight / 32, seed );
345 dstImageInfo.depth = (size_t)random_log_in_range( 16, (int)max3DDepth / 32, seed );
346 srcImageInfo.width = (size_t)random_log_in_range( 16, (int)maxWidth / 32, seed );
347 srcImageInfo.height = (size_t)random_log_in_range( 16, (int)maxHeight / 32, seed );
348
349 if (gTestMipmaps)
350 {
351 srcImageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(srcImageInfo.width, srcImageInfo.height, 0), seed);
352 srcImageInfo.type = CL_MEM_OBJECT_IMAGE2D;
353 dstImageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(dstImageInfo.width, dstImageInfo.height, dstImageInfo.depth), seed);
354 dstImageInfo.type = CL_MEM_OBJECT_IMAGE3D;
355 srcImageInfo.rowPitch = srcImageInfo.width * get_pixel_size( srcImageInfo.format );
356 srcImageInfo.slicePitch = 0;
357 dstImageInfo.rowPitch = dstImageInfo.width * get_pixel_size( dstImageInfo.format );
358 dstImageInfo.slicePitch = dstImageInfo.rowPitch * dstImageInfo.height;
359 srcSize = 4 * compute_mipmapped_image_size( srcImageInfo );
360 dstSize = 4 * compute_mipmapped_image_size( dstImageInfo );
361 }
362 else
363 {
364 set_image_dimensions( &srcImageInfo, srcImageInfo.width, srcImageInfo.height, 0, rowPadding, slicePadding );
365 set_image_dimensions( &dstImageInfo, dstImageInfo.width, dstImageInfo.height, dstImageInfo.depth, rowPadding, slicePadding );
366
367 srcSize = (cl_ulong)srcImageInfo.rowPitch * (cl_ulong)srcImageInfo.height * 4;
368 dstSize = (cl_ulong)dstImageInfo.slicePitch * (cl_ulong)dstImageInfo.depth * 4;
369 }
370 } while( srcSize > maxAllocSize || ( srcSize * 3 ) > memSize || dstSize > maxAllocSize || ( dstSize * 3 ) > memSize);
371
372 if( gDebugTrace )
373 log_info( " at size %d,%d to %d,%d,%d\n", (int)srcImageInfo.width, (int)srcImageInfo.height, (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.depth );
374 int ret;
375 if( reverse )
376 ret = test_copy_image_size_2D_3D( context, queue, &dstImageInfo, &srcImageInfo, seed );
377 else
378 ret = test_copy_image_size_2D_3D( context, queue, &srcImageInfo, &dstImageInfo, seed );
379 if( ret )
380 return -1;
381 }
382 }
383
384 return 0;
385 }
386