1 /*******************************************************************************
2 * Copyright 2016-2019 Intel Corporation.
3 *
4 * This software and the related documents are Intel copyrighted materials, and
5 * your use of them is governed by the express license under which they were
6 * provided to you (License). Unless the License provides otherwise, you may not
7 * use, modify, copy, publish, distribute, disclose or transmit this software or
8 * the related documents without Intel's prior written permission.
9 *
10 * This software and the related documents are provided as is, with no express
11 * or implied warranties, other than those that are expressly stated in the
12 * License.
13 *******************************************************************************/
14
15 #if !defined( __IPP_IW_IMAGE__ )
16 #define __IPP_IW_IMAGE__
17
18 #include "iw/iw_core.h"
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23
24 /* /////////////////////////////////////////////////////////////////////////////
25 // Image IW definitions
26 ///////////////////////////////////////////////////////////////////////////// */
27
28 typedef IppiSizeL IwiSize;
29 typedef IppiRectL IwiRoi;
30 typedef IppiPointL IwiPoint;
31 typedef IppiBorderType IwiBorderType;
32
33 typedef struct {
34 IwSize left;
35 IwSize top;
36 IwSize right;
37 IwSize bottom;
38 } IwiBorderSize;
39
40 // Special channels descriptor
41 // These codes specify how to process non-standard channels configurations
42 // If the descriptor is not supported, then error will be returned.
43 // If the descriptor is for different channels number, then it will be ignored.
44 typedef enum _IwiChDescriptor
45 {
46 iwiChDesc_None = 0, // Process all channels
47
48 // C4 descriptors
49 iwiChDesc_C4M1110 = 0x00004007, // Process only the first 3 channels as RGB. Equivalent of AC4 functions from the main Intel(R) IPP library.
50 iwiChDesc_C4M1000 = 0x00004001, // Process only the first channel as Gray-scale.
51 iwiChDesc_C4M1001 = 0x00004009, // Process only the first channel and the last channel as Gray-scale with Alpha.
52 iwiChDesc_C4M1XX0 = 0x00064001, // Process only the first channel as Gray-scale and replicate it to remaining color channels.
53 iwiChDesc_C4M1XX1 = 0x00064009 // Process only the first channel and the last channel as Gray-scale with Alpha and replicate Gray-scale to remaining color channels.
54
55 } IwiChDescriptor;
56
57
58 /* /////////////////////////////////////////////////////////////////////////////
59 // Image IW utility functions
60 ///////////////////////////////////////////////////////////////////////////// */
61
62 // Convert IppiMaskSize enumerator to actual IwiSize size
63 // Returns:
64 // Width and height of IppiMaskSize in pixels
65 IW_DECL(IwiSize) iwiMaskToSize(
66 IppiMaskSize mask // Kernel or mask size enumerator
67 );
68
69 // Convert kernel or mask size to border size
70 // Returns:
71 // Border required for a filter with specified kernel size
iwiSizeToBorderSize(IwiSize kernelSize)72 static IW_INLINE IwiBorderSize iwiSizeToBorderSize(
73 IwiSize kernelSize // Size of kernel as from iwiMaskToSize() or arbitrary
74 )
75 {
76 IwiBorderSize bordSize;
77 bordSize.left = bordSize.right = kernelSize.width/2;
78 bordSize.top = bordSize.bottom = kernelSize.height/2;
79 return bordSize;
80 }
81
82 // Converts symmetric kernel or mask length to border size
83 // Returns:
84 // Border required for a filter with specified kernel length
iwiSizeSymToBorderSize(IwSize kernelSize)85 static IW_INLINE IwiBorderSize iwiSizeSymToBorderSize(
86 IwSize kernelSize // Size of symmetric kernel
87 )
88 {
89 IwiBorderSize bordSize;
90 bordSize.left = bordSize.right = kernelSize/2;
91 bordSize.top = bordSize.bottom = kernelSize/2;
92 return bordSize;
93 }
94
95 // Shift pointer to specific pixel coordinates
96 // Returns:
97 // Shifted pointer
iwiShiftPtr(const void * pPtr,IwSize step,int typeSize,int channels,IwSize y,IwSize x)98 static IW_INLINE void* iwiShiftPtr(
99 const void *pPtr, // Original pointer
100 IwSize step, // Image step
101 int typeSize, // Size of image type as from iwTypeToLen()
102 int channels, // Number of channels in image
103 IwSize y, // y shift, as rows
104 IwSize x // x shift, as columns
105 )
106 {
107 return (((Ipp8u*)pPtr) + step*y + typeSize*channels*x);
108 }
109
110 // Shift pointer to specific pixel coordinates for read-only image
111 // Returns:
112 // Shifted pointer
iwiShiftPtrConst(const void * pPtr,IwSize step,int typeSize,int channels,IwSize y,IwSize x)113 static IW_INLINE const void* iwiShiftPtrConst(
114 const void *pPtr, // Original pointer
115 IwSize step, // Image step
116 int typeSize, // Size of image type as from iwTypeToLen()
117 int channels, // Number of channels in image
118 IwSize y, // y shift, as rows
119 IwSize x // x shift, as columns
120 )
121 {
122 return (((const Ipp8u*)pPtr) + step*y + typeSize*channels*x);
123 }
124
125
126 /* /////////////////////////////////////////////////////////////////////////////
127 // IwiImage - Image structure
128 ///////////////////////////////////////////////////////////////////////////// */
129
130 // IwiImage is a base structure for IW image processing functions to store input and output data.
131 typedef struct _IwiImage
132 {
133 // public:
134 void *m_ptr; // Pointer to the start of actual image data. This pointer must be NULL for read-only image.
135 const void *m_ptrConst; // Pointer to the start of actual read-only image data. This pointer is valid for any image.
136 IwSize m_step; // Distance, in bytes, between the starting points of consecutive lines in the source image memory
137 IwiSize m_size; // Image size, in pixels
138 IppDataType m_dataType; // Image pixel type
139 int m_typeSize; // Size of image pixel type in bytes
140 int m_channels; // Number of image channels
141 IwiBorderSize m_inMemSize; // Memory border size around image data
142
143 // private:
144 void *m_pBuffer; // Pointer to the allocated image buffer. This variable must be NULL for any external buffer.
145
146 } IwiImage;
147
148 // Initializes image structure with external buffer
149 // Returns:
150 // ippStsDataTypeErr data type is illegal
151 // ippStsNumChannelsErr channels value is illegal
152 // ippStsSizeErr size fields values are illegal
153 // ippStsNullPtrErr unexpected NULL pointer
154 // ippStsNoErr no errors
155 IW_DECL(IppStatus) iwiImage_InitExternal(
156 IwiImage *pImage, // Pointer to IwiImage structure
157 IwiSize size, // Image size, in pixels, without border
158 IppDataType dataType, // Image pixel type
159 int channels, // Number of image channels
160 const IwiBorderSize *pInMemBorder, // Size of border around image or NULL if there is no border
161 void *pBuffer, // Pointer to the external buffer image buffer
162 IwSize step // Distance, in bytes, between the starting points of consecutive lines in the external buffer
163 );
164
165 // Initializes image structure with external read-only buffer
166 // Returns:
167 // ippStsDataTypeErr data type is illegal
168 // ippStsNumChannelsErr channels value is illegal
169 // ippStsSizeErr size fields values are illegal
170 // ippStsNullPtrErr unexpected NULL pointer
171 // ippStsNoErr no errors
172 IW_DECL(IppStatus) iwiImage_InitExternalConst(
173 IwiImage *pImage, // Pointer to IwiImage structure
174 IwiSize size, // Image size, in pixels, without border
175 IppDataType dataType, // Image pixel type
176 int channels, // Number of image channels
177 const IwiBorderSize *pInMemBorder, // Size of border around image or NULL if there is no border
178 const void *pBuffer, // Pointer to the external buffer image buffer
179 IwSize step // Distance, in bytes, between the starting points of consecutive lines in the external buffer
180 );
181
182 // Resets image structure values. This functions doesn't release data!
183 IW_DECL(void) iwiImage_Init(
184 IwiImage *pImage
185 );
186
187 // Allocates image data for initialized structure. iwiImage_Init must be called once before.
188 // Returns:
189 // ippStsDataTypeErr data type is illegal
190 // ippStsNumChannelsErr channels value is illegal
191 // ippStsSizeErr size fields values are illegal
192 // ippStsNullPtrErr unexpected NULL pointer
193 // ippStsNoErr no errors
194 IW_DECL(IppStatus) iwiImage_Alloc(
195 IwiImage *pImage, // Pointer to IwiImage structure
196 IwiSize size, // Image size, in pixels, without border
197 IppDataType dataType, // Image pixel type
198 int channels, // Number of image channels
199 const IwiBorderSize *pInMemBorder // Size of border around image or NULL if there is no border
200 );
201
202 // Releases image data if it was allocated by iwiImage_Alloc
203 IW_DECL(void) iwiImage_Release(
204 IwiImage *pImage // Pointer to IwiImage structure
205 );
206
207 // Returns pointer to specified pixel position in image buffer
208 // Returns:
209 // Pointer to the image data
210 IW_DECL(void*) iwiImage_GetPtr(
211 const IwiImage *pImage, // Pointer to IwiImage structure
212 IwSize y, // y shift, as rows
213 IwSize x, // x shift, as columns
214 int ch // channels shift
215 );
216
217 // Returns pointer to specified pixel position in read-only image buffer
218 // Returns:
219 // Pointer to the image data
220 IW_DECL(const void*) iwiImage_GetPtrConst(
221 const IwiImage *pImage, // Pointer to IwiImage structure
222 IwSize y, // y shift, as rows
223 IwSize x, // x shift, as columns
224 int ch // channels shift
225 );
226
227 // Add border size to current inMem image border, making image size smaller. Resulted image cannot be smaller than 1x1 pixels
228 // Returns:
229 // ippStsSizeErr ROI size is illegal
230 // ippStsNullPtrErr unexpected NULL pointer
231 // ippStsNoErr no errors
232 IW_DECL(IppStatus) iwiImage_BorderAdd(
233 IwiImage *pImage, // Pointer to IwiImage structure
234 IwiBorderSize borderSize // Size of border
235 );
236
237 // Subtracts border size from current inMem image border, making image size bigger. Resulted border cannot be lesser than 0
238 // Returns:
239 // ippStsOutOfRangeErr ROI is out of image
240 // ippStsNullPtrErr unexpected NULL pointer
241 // ippStsNoErr no errors
242 IW_DECL(IppStatus) iwiImage_BorderSub(
243 IwiImage *pImage, // Pointer to IwiImage structure
244 IwiBorderSize borderSize // Size of border
245 );
246
247 // Set border size to current inMem image border, adjusting image size. Resulted image cannot be smaller than 1x1 pixels
248 // Returns:
249 // ippStsSizeErr ROI size is illegal
250 // ippStsNullPtrErr unexpected NULL pointer
251 // ippStsNoErr no errors
252 IW_DECL(IppStatus) iwiImage_BorderSet(
253 IwiImage *pImage, // Pointer to IwiImage structure
254 IwiBorderSize borderSize // Size of border
255 );
256
257 // Applies ROI to the current image by adjusting size and starting point of the image. Can be applied recursively.
258 // This function saturates ROIs which step outside of the image border.
259 // If ROI has no intersection with the image then resulted image size will be 0x0
260 // Returns:
261 // ippStsNullPtrErr unexpected NULL pointer
262 // ippStsNoErr no errors
263 IW_DECL(IppStatus) iwiImage_RoiSet(
264 IwiImage *pImage, // Pointer to IwiImage structure
265 IwiRoi roi // ROI rectangle of the required sub-image
266 );
267
268 // Returns sub-image with size and starting point of the specified ROI. Can be applied recursively.
269 // See iwiImage_RoiSet
270 // Returns:
271 // IwiImage structure of sub-image
272 IW_DECL(IwiImage) iwiImage_GetRoiImage(
273 const IwiImage *pImage, // Pointer to IwiImage structure
274 IwiRoi roi // ROI rectangle of the required sub-image
275 );
276
277 /* /////////////////////////////////////////////////////////////////////////////
278 // IW Tiling
279 ///////////////////////////////////////////////////////////////////////////// */
280
281 /* /////////////////////////////////////////////////////////////////////////////
282 // Manual tiling control
283 ///////////////////////////////////////////////////////////////////////////// */
284
285 // Returns border with proper ippBorderInMem flags for current tile position, image size and border size
286 // Returns:
287 // Border type with proper ippBorderInMem flags
288 IW_DECL(IwiBorderType) iwiTile_GetTileBorder(
289 IwiRoi roi, // [in] Tile position and size
290 IwiBorderType border, // [in] Initial border type
291 IwiBorderSize borderSize, // [in] Border size
292 IwiSize srcImageSize // [in] Source image size
293 );
294
295 // Returns minimal acceptable tile size for the current border size and type
296 // Returns:
297 // Minimal tile size
298 IW_DECL(IwiSize) iwiTile_GetMinTileSize(
299 IwiBorderType border, // [in] Border type
300 IwiBorderSize borderSize // [in] Border size
301 );
302
303 /* Function corrects ROI position and size to prevent overlapping between filtering function border and image border in
304 // case of border reconstruction. If image already has a right or a bottom border in memory and border type flags
305 // ippBorderInMemRight or ippBorderInMemBottom were specified accordingly then no correction is required.
306 //
307 // Overlapping example:
308 // image border
309 // /
310 // |-------------------|
311 // | image { [ ]~|~} ~ - pixels of the tile border which overlaps the image border.
312 // | { [ ]~|~} One pixel of the tile border is inside the image, the other is outside
313 // | { [ tile ]~|~}
314 // | { [ ]~|~}
315 // |-------------------| \
316 // tile border (2px)
317 //
318 // Assumption 1: processing of some pixels can be delayed. If your program expects EXACT same result as specified
319 // tile parameters demand then you should not use this function.
320 // Assumption 2: tile size for a function is not less than the maximum border size (use function iwiTile_GetMinTileSize)
321 //
322 // To prevent borders overlapping this function changes the tile according to following logic (keeping assumptions in mind):
323 // 1. If the "right" tile border overlaps "right" image border, then function decreases tile size to move
324 // whole border inside the image.
325 //
326 // Corrected overlapping:
327 // image border
328 // /
329 // |--------------------|
330 // | image { [ ] }|
331 // | { [ ] }|
332 // | { [ tile] }|
333 // | { [ ] }|
334 // |--------------------\
335 // tile border
336 //
337 // 2. Now we need to compensate right adjacent tile. So if the "left" tile border is located in the overlapping zone of
338 // the "right" image boundary, then the function assumes that the previous step was taken and changes tile position and
339 // size to process all remaining input
340 //
341 // Before compensation: After compensation (now missing pixels are inside tile ROI):
342 // image border image border
343 // / /
344 // |--------------------| |--------------------|
345 // | image { ~[ ]| } | image { [~ ]| }
346 // | { ~[ ]| } | { [~ ]| }
347 // | { ~[ ]| } | { [~ ]| }
348 // | { ~[ ]| } | { [~ ]| }
349 // |---------------\----| |--------------\-----|
350 // tile border tile border
351 // ~ - missing pixels after step 1
352 */
353 // Returns:
354 // Corrected ROI
355 IW_DECL(IwiRoi) iwiTile_CorrectBordersOverlap(
356 IwiRoi roi, // [in] Tile position and size to be checked and corrected
357 IwiBorderType border, // [in] Border type
358 IwiBorderSize borderSize, // [in] Border size
359 IwiSize srcImageSize // [in] Source image size
360 );
361
362 /* /////////////////////////////////////////////////////////////////////////////
363 // IwiTile - tiling structure
364 ///////////////////////////////////////////////////////////////////////////// */
365
366 // Function pointer type for return of src ROI by dst ROI
367 // Returns:
368 // 0 if operation is successful, any other if failed
369 typedef int (IPP_STDCALL *IwiTile_GetSrcRoiFunPtr)(
370 IwiRoi dstRoi, // [in] Destination ROI for transform operation
371 IwiRoi *pSrcRoi, // [in,out] Output source ROI for transform operation
372 void* pParams // [in] Parameters of transform operation
373 );
374
375 // Tile geometric transform structure
376 // This structure contains function pointers and parameters which are necessary for tile geometric transformations inside the pipeline
377 typedef struct _IwiTileTransform
378 {
379 // public:
380 IwiTile_GetSrcRoiFunPtr getSrcRoiFun; // Pointer to IwiRoiRectTransformFunctionPtr function which returns source ROI for the current destination one
381 void *pParams; // Pointer to user parameters for transform functions
382
383 IwiSize srcImageSize; // Image size before transformation
384
385 } IwiTileTransform;
386
387 // Main structure for semi-automatic ROI operations
388 // This structure provides main context for tiling across IW API
389 // Mainly it contains values for complex pipelines tiling
390 typedef struct _IwiTile
391 {
392 // private:
393 IwiRoi m_srcRoi; // Absolute ROI for the source image
394 IwiRoi m_dstRoi; // Absolute ROI for the destination image
395
396 IwiPoint m_untaintSrcPos; // Absolute unaligned source ROI position
397 IwiPoint m_untaintDstPos; // Absolute unaligned destination ROI position
398
399 IwiRoi m_boundSrcRoi; // Relative ROI for the source image bounded to the buffer
400 IwiRoi m_boundDstRoi; // Relative ROI for the destination image bounded to the buffer
401
402 IwiSize m_srcBufferSize; // Actual source buffer size
403 IwiSize m_dstBufferSize; // Actual destination buffer size
404
405 IwiSize m_srcImageSize; // Full source image size
406 IwiSize m_dstImageSize; // Full destination image size
407
408 IwiSize m_srcExImageSize; // Source image size extended on parent InMem border size
409 IwiSize m_dstExImageSize; // Destination image size extended on parent InMem border size
410
411 IwiSize m_maxTileSize; // Maximum tile size
412
413 IwiBorderType m_borderType; // Type of source image border
414 IwiBorderSize m_borderSize; // Border required for the current operation
415 IwiBorderSize m_borderSizeAcc; // Accumulated border size for current and parent operations
416 IwiBorderSize m_externalMem; // Amount of memory required to process InMem border for current edge tile
417 IwiBorderSize m_externalMemAcc; // Amount of memory required to process InMem border for all edge tiles
418
419 IwiTileTransform m_transformStruct; // Transformation proxy functions and data structure
420
421 int m_initialized; // Internal initialization states
422
423 struct _IwiTile *m_pChild; // Next Tile in the pipeline
424 struct _IwiTile *m_pParent; // Previous Tile in the pipeline
425
426 } IwiTile;
427
428 /* /////////////////////////////////////////////////////////////////////////////
429 // IwiTile-based basic tiling
430 ///////////////////////////////////////////////////////////////////////////// */
431
432 // Basic tiling initializer for IwiTile structure.
433 // Use this method to set up single function tiling or tiling for pipelines with border-less functions.
434 // For functions which operate with different sizes for source and destination images use destination size as a base
435 // for tile parameters.
436 // Returns:
437 // Valid IwiTile structure for simple tiling
438 IW_DECL(IwiTile) iwiTile_SetRoi(
439 IwiRoi tileRoi // [in] Tile offset and size
440 );
441
442 /* /////////////////////////////////////////////////////////////////////////////
443 // IwiTile-based pipeline tiling
444 ///////////////////////////////////////////////////////////////////////////// */
445
446 // Important notice:
447 // This tiling API is created for tiling of complex pipelines with functions which use borders.
448 // Tiling of pipelines instead of isolated functions can increase scalability of threading or performance of
449 // non-threaded functions by performing all operations inside CPU cache.
450 //
451 // This is advanced tiling method, so you better know what you are doing.
452 // 1. Pipeline tiling operates in reverse order: from destination to source.
453 // a. Use tile size based on final destination image size
454 // b. Initialize IwiTile structure with iwiTilePipeline_Init for the last operation
455 // c. Initialize IwiTile structure for other operations from last to first with iwiTilePipeline_InitChild
456 // 2. Derive border size for each operation from its mask size, kernel size or specific border size getter if any
457 // 3. If you have geometric transform inside pipeline, fill IwiTileTransform structure for IwiTile for this transform operation
458 // 4. In case of threading don't forget to copy initialized IwiTile structures to local thread or initialize them on
459 // per-thread basis. Access to structures is not thread safe!
460 // 5. Do not exceed maximum tile size specified during initialization. This can lead to buffers overflow!
461 //
462 // There is a set of examples covering usage of tiling. Please refer to them for help.
463 //
464 // Pipeline tiling with scaling is not supported in this version.
465
466 // Pipeline tiling root node initializer for IwiTile structure.
467 // This initializer should be used first and for IwiTile structure of the final operation.
468 // Returns:
469 // ippStsBadArgErr incorrect arg/param of the function
470 // ippStsNullPtrErr unexpected NULL pointer
471 // ippStsNoErr no errors
472 IW_DECL(IppStatus) iwiTilePipeline_Init(
473 IwiTile *pTile, // [in] Pointer to IwiTile structure
474 IwiSize tileSizeMax, // [in] Maximum tile size for intermediate buffers size calculation
475 IwiSize dstImageSize, // [in] Destination image size for current operation
476 const IwiBorderType *pBorderType, // [in] Border type for the current operation. NULL if operation doesn't have a border
477 const IwiBorderSize *pBorderSize, // [in] Border size for the current operation. NULL if operation doesn't have a border
478 const IwiTileTransform *pTransformStruct // [in] Initialized transform structure if operation performs geometric transformation. NULL if operation doesn't perform transformation
479 );
480
481 // Pipeline tiling child node initializer for IwiTile structure.
482 // This initializer should be called for any operation preceding the last operation in reverse order.
483 // Returns:
484 // ippStsBadArgErr incorrect arg/param of the function
485 // ippStsNullPtrErr unexpected NULL pointer
486 // ippStsNoErr no errors
487 IW_DECL(IppStatus) iwiTilePipeline_InitChild(
488 IwiTile *pTile, // [in] Pointer to IwiTile structure
489 IwiTile *pParent, // [in] Pointer to IwiTile structure of previous operation
490 const IwiBorderType *pBorderType, // [in] Border type for the current operation. NULL if operation doesn't have a border
491 const IwiBorderSize *pBorderSize, // [in] Border size for the current operation. NULL if operation doesn't have a border
492 const IwiTileTransform *pTransformStruct // [in] Initialized transform structure if operation performs geometric transformation. NULL if operation doesn't perform transformation
493 );
494
495 // Releases allocated data from the pipeline tiling structure.
496 IW_DECL(void) iwiTilePipeline_Release(
497 IwiTile *pTile // [in] Pointer to IwiTile structure
498 );
499
500 // Returns buffer size required to store destination intermediate image for the current pipeline element.
501 // Returns:
502 // ippStsContextMatchErr internal structure is not initialized or of invalid type
503 // ippStsNullPtrErr unexpected NULL pointer
504 // ippStsNoErr no errors
505 IW_DECL(IppStatus) iwiTilePipeline_GetDstBufferSize(
506 const IwiTile *pTile, // [in] Pointer to IwiTile structure
507 IwiSize *pDstSize // [out] Minimal required size of destination intermediate buffer
508 );
509
510 // Returns full size of source image for the child pipeline element which includes required InMem borders.
511 // This function is required to supply correct image size for geometric transform functions.
512 // Returns:
513 // ippStsContextMatchErr internal structure is not initialized or of invalid type
514 // ippStsNullPtrErr unexpected NULL pointer
515 // ippStsNoErr no errors
516 IW_DECL(IppStatus) iwiTilePipeline_GetChildSrcImageSize(
517 const IwiTile *pTile, // [in] Pointer to IwiTile structure
518 IwiSize srcOrigSize, // [in] Original source image size
519 IwiSize *pSrcFullSize // [out] Pointer to IwiSize structure to write full image size
520 );
521
522 // Returns full size of destination image for the child pipeline element which includes required InMem borders.
523 // This function is required to supply correct image size for geometric transform functions.
524 // Returns:
525 // ippStsContextMatchErr internal structure is not initialized or of invalid type
526 // ippStsNullPtrErr unexpected NULL pointer
527 // ippStsNoErr no errors
528 IW_DECL(IppStatus) iwiTilePipeline_GetChildDstImageSize(
529 const IwiTile *pTile, // [in] Pointer to IwiTile structure
530 IwiSize dstOrigSize, // [in] Original destination image size
531 IwiSize *pDstFullSize // [out] Pointer to IwiSize structure to write full image size
532 );
533
534 // Sets current tile rectangle for the pipeline to process
535 // Returns:
536 // ippStsContextMatchErr internal structure is not initialized or of invalid type
537 // ippStsNullPtrErr unexpected NULL pointer
538 // ippStsNoErr no errors
539 IW_DECL(IppStatus) iwiTilePipeline_SetRoi(
540 IwiTile *pTile, // [in] Pointer to IwiTile structure
541 IwiRoi tileRoi // [in] Tile offset and size
542 );
543
544 // This function builds border for the current tile source buffer.
545 // This allows to feed function with InMem borders only thus reducing possiblity of borders conflicts on image boundary.
546 // By default this function is not applied to the first image in the pipeline, only to intermediate buffers, but
547 // it can be used manually to construct border for it too.
548 // Returns:
549 // ippStsContextMatchErr internal structure is not initialized or of invalid type
550 // ippStsNullPtrErr unexpected NULL pointer
551 // ippStsNoErr no errors
552 IW_DECL(IppStatus) iwiTilePipeline_BuildBorder(
553 const IwiTile *pTile, // [in] Pointer to IwiTile structure for current tile
554 IwiImage *pSrcImage, // [in,out] Pointer to the source image for which to build border
555 IwiBorderType *pBorder, // [in,out] Extrapolation algorithm for out of image pixels. Updated InMem flags will be returned here
556 const Ipp64f *pBorderVal // [in] Pointer to array of border values for ippBorderConst. One element for each channel. Can be NULL for any other border
557 );
558
559 // Calculates actual border parameter with InMem flags for the current tile absolute and relative offsets and sizes
560 // Returns:
561 // ippStsContextMatchErr internal structure is not initialized or of invalid type
562 // ippStsNullPtrErr unexpected NULL pointer
563 // ippStsNoErr no errors
564 IW_DECL(IppStatus) iwiTilePipeline_GetTileBorder(
565 const IwiTile *pTile, // [in] Pointer to IwiTile structure
566 IwiBorderType *pBorder // [in,out] Pointer to border type, actual tile border will be written here
567 );
568
569 // Checks for image and buffer boundaries for the source buffer and limits tile rectangle
570 // Returns:
571 // ippStsContextMatchErr internal structure is not initialized or of invalid type
572 // ippStsNullPtrErr unexpected NULL pointer
573 // ippStsNoErr no errors
574 IW_DECL(IppStatus) iwiTilePipeline_GetBoundedSrcRoi(
575 const IwiTile *pTile, // [in] Pointer to IwiTile structure
576 IwiRoi *pBoundedRoi // [out] Pointer to ROI adjusted to source buffer boundaries
577 );
578
579 // Checks for image and buffer boundaries for the destination buffer and limits tile rectangle
580 // Returns:
581 // ippStsContextMatchErr internal structure is not initialized or of invalid type
582 // ippStsNullPtrErr unexpected NULL pointer
583 // ippStsNoErr no errors
584 IW_DECL(IppStatus) iwiTilePipeline_GetBoundedDstRoi(
585 const IwiTile *pTile, // [in] Pointer to IwiTile structure
586 IwiRoi *pBoundedRoi // [out] Pointer to ROI adjusted to destination buffer boundaries
587 );
588
589 // Returns minimal acceptable tile size for current pipeline
590 // Returns:
591 // ippStsContextMatchErr internal structure is not initialized or of invalid type
592 // ippStsNullPtrErr unexpected NULL pointer
593 // ippStsNoErr no errors
594 IW_DECL(IppStatus) iwiTilePipeline_GetMinTileSize(
595 const IwiTile *pTile, // [in] Pointer to IwiTile structure
596 IwiSize *pMinTileSize // [out] Pointer to the minimal tile size for current pipeline
597 );
598
599 #ifdef __cplusplus
600 }
601 #endif
602
603 #endif
604