![]() |
Oyranos
git-devel
Oyranos is a full featured Color Management System
|
Control pixel access order. More...
#include <oyPixelAccess_s.h>
Public Member Functions | |
OYAPI oyPixelAccess_s *OYEXPORT | oyPixelAccess_New (oyObject_s object) |
allocate a new PixelAccess object More... | |
OYAPI oyPixelAccess_s *OYEXPORT | oyPixelAccess_Copy (oyPixelAccess_s *pixelaccess, oyObject_s object) |
Copy or Reference a PixelAccess object. More... | |
OYAPI int OYEXPORT | oyPixelAccess_Release (oyPixelAccess_s **pixelaccess) |
release and possibly deallocate a oyPixelAccess_s object More... | |
int | oyPixelAccess_ChangeRectangle (oyPixelAccess_s *pixel_access, double start_x, double start_y, oyRectangle_s *output_rectangle) |
Change the ticket for a conversion graph. More... | |
int | oyPixelAccess_ArrayIsFocussed (oyPixelAccess_s *pixel_access) |
Tell if array has changed focus as of changed output_rectangle. More... | |
oyPixelAccess_s * | oyPixelAccess_Create (int32_t start_x, int32_t start_y, oyFilterPlug_s *plug, oyPIXEL_ACCESS_TYPE_e type, oyObject_s object) |
Allocate and initialise a basic oyPixelAccess_s object. More... | |
oyImage_s * | oyPixelAccess_GetOutputImage (oyPixelAccess_s *pixel_access) |
Access oyPixelAccess_s::output_image. More... | |
int | oyPixelAccess_SetOutputImage (oyPixelAccess_s *pixel_access, oyImage_s *image) |
Set oyPixelAccess_s::output_image. More... | |
int | oyPixelAccess_SynchroniseROI (oyPixelAccess_s *pixel_access_new, oyPixelAccess_s *pixel_access_src) |
Set a new ticket according to old ticket geometries. More... | |
int | oyPixelAccess_SetArrayFocus (oyPixelAccess_s *pixel_access, int undo) |
Ensure that the array is in output ROI focus. More... | |
const char * | oyPixelAccess_Show (oyPixelAccess_s *pixel_access) |
Print ticket geometries. More... | |
oyRectangle_s * | oyPixelAccess_GetArrayROI (oyPixelAccess_s *pixel_access) |
Access oyPixelAccess_s::output_array_roi. More... | |
int | oyPixelAccess_RoiToPixels (oyPixelAccess_s *pixel_access, oyRectangle_s *roi, oyRectangle_s **pixel_rectangle) |
Calculate pixel rectangle from ROI. More... | |
int | oyPixelAccess_PixelsToRoi (oyPixelAccess_s *pixel_access, oyRectangle_s *pixel_rectangle, oyRectangle_s **roi) |
Calculate ROI rectangle from pixel rectangle. More... | |
oyFilterGraph_s * | oyPixelAccess_GetGraph (oyPixelAccess_s *pixel_access) |
Access oyPixelAccess_s::graph. More... | |
int | oyPixelAccess_SetFromString (oyPixelAccess_s *ticket, const char *key, const char *value, int flags) |
Set oyPixelAccess_s::graph::options. More... | |
oyOptions_s * | oyPixelAccess_GetRequestQueue (oyPixelAccess_s *pixel_access) |
Access oyPixelAccess_s::request_queue. More... | |
oyArray2d_s * | oyPixelAccess_GetArray (oyPixelAccess_s *pixel_access) |
Access oyPixelAccess_s::array. More... | |
int | oyPixelAccess_SetArray (oyPixelAccess_s *pixel_access, oyArray2d_s *array, int has_roi_focus) |
Set oyPixelAccess_s::array. More... | |
oyStruct_s * | oyPixelAccess_GetUserData (oyPixelAccess_s *pixel_access) |
Access oyPixelAccess_s::user_data. More... | |
int | oyPixelAccess_SetUserData (oyPixelAccess_s *pixel_access, oyStruct_s *user_data) |
Set oyPixelAccess_s::user_data. More... | |
int32_t | oyPixelAccess_GetWorkspaceID (oyPixelAccess_s *pixel_access) |
Access oyPixelAccess_s::workspace_id. More... | |
int | oyPixelAccess_SetWorkspaceID (oyPixelAccess_s *pixel_access, int32_t workspace_id) |
Set oyPixelAccess_s::workspace_id. More... | |
double | oyPixelAccess_GetStart (oyPixelAccess_s *pixel_access, int vertical) |
Access oyPixelAccess_s::start_xy. More... | |
double | oyPixelAccess_GetOldStart (oyPixelAccess_s *pixel_access, int vertical) |
Access oyPixelAccess_s::start_xy_old. More... | |
int | oyPixelAccess_SetOldStart (oyPixelAccess_s *pixel_access, int vertical, double start) |
Access oyPixelAccess_s::start_xy_old. More... | |
void | oyPixelAccess_Release__Members (oyPixelAccess_s_ *pixelaccess) |
Custom PixelAccess destructor. More... | |
int | oyPixelAccess_Init__Members (oyPixelAccess_s_ *pixelaccess) |
Custom PixelAccess constructor. More... | |
int | oyPixelAccess_Copy__Members (oyPixelAccess_s_ *dst, oyPixelAccess_s_ *src) |
Custom PixelAccess copy constructor. More... | |
![]() | |
const char * | oyStruct_GetTextFromModule (oyStruct_s *obj, oyNAME_e name_type, uint32_t flags) |
get object infos from a module More... | |
const char * | oyStruct_GetText (oyStruct_s *obj, oyNAME_e name_type, uint32_t flags) |
Get a text dump. More... | |
int | oyStruct_RegisterStaticMessageFunc (int type, oyStruct_RegisterStaticMessageFunc_f msg, oyStruct_RegisterStaticFreeFunc_f free_func) |
register a function for verbosity More... | |
const char * | oyStruct_GetInfo (oyPointer context_object, oyNAME_e type, int flags) |
get a additional string from a object More... | |
const char * | oyStructTypeToText (oyOBJECT_e type) |
Objects type to small string. More... | |
Data Fields | |
const oyOBJECT_e | type_ |
Type of object. More... | |
oyStruct_Copy_f | copy |
Copy function. More... | |
oyStruct_Release_f | release |
Release function. More... | |
oyObject_s | oy_ |
Oyranos internal object. More... | |
![]() | |
const oyOBJECT_e | type_ |
Type of object. More... | |
oyStruct_Copy_f | copy |
Copy function. More... | |
oyStruct_Release_f | release |
Release function. More... | |
oyObject_s | oy_ |
Oyranos internal object. More... | |
Control pixel access order.
A struct to control pixel access. It is a kind of flexible pixel iterator. The order or pattern of access is defined by the [array_xy and] start_[x,y] variables.
oyPixelAccess_s is like a job ticket. Goal is to maintain all intermediate and processing dependend memory references in this structure.
[The index variable specifies the iterator position in the array_xy index array.]
[pixels_n says how many pixels are to be processed for the cache. pixels_n is used to calculate the buffers located with getBuffer and freeBuffer. The amount of pixel specified in pixels_n must be processed by each filter, because other filters are relying on a properly filled cache. This variable also determins the size of the next iteration.]
[The relation of pixels_n to array_xy and start_[x,y] is that a minimum of pixels_n must be processed by starting with start_[x,y] and processing pixels_n through array_xy. array_xy specifies the offset pixel distance to a next pixel in x and y directions. In case pixels_n is larger than array_n the array_xy has to be continued at array_xy[0,1] after reaching its end (array_n).
Example:
Thus a line iterator behaviour can be specified by simply setting array_xy = {1,0}, for a advancement in x direction of one, array_n = 1, as we need just this type of advancement and pixels_n = image_width, for saying how often the pattern descibed in array_xy has to be applied.]
Handling of pixel access is to be supported by a filter in a function of type oyCMMFilter_GetNext_f() in oyCMMapi4_s::oyCMMConnector_GetNext().
Access to the buffers by concurrenting threads is handled by passing different oyPixelAccess_s objects per thread.
From the module point of view it is a requirement to obtain the intermediate buffers from somewhere. These are the ones to read from and to write computed results into.
Pixel in- and output buffers separation:
Access to input and output buffers:
Thread synchronisation:
Area dimensions:
Possible strategies are (old text):
Relation of positional parameters: start_xy relative to original image width | +-----|------------------------------+ original | | | image ---+ | | | ---+-----------------------+ | | | +---------- output_array | | +---------------+ | | | | | | | | | | | | | | | | +------+--------+ | | | | \ | | | +------------\----------+ | | \ | +--------------------\---------------+ output_array_roi relative to array width/channels
Rectangles are passed in relative units. start_xy and output_array_roi are of type oyRectangle_s and are defined in relative units to the enclosing images/array data width. start_xy::x 0.1 means 0.1 x original_image::width . output_roi::0.3333,0.0,0.333,0.333 in a array of data size 9x3 / 3 channels means the upper middle pixel.
int oyPixelAccess_ArrayIsFocussed | ( | oyPixelAccess_s * | pixel_access | ) |
Tell if array has changed focus as of changed output_rectangle.
Function oyPixelAccess_ArrayIsFocussed
[in] | pixel_access | pixel iterator configuration |
Referenced by oyPixelAccess_Show().
int oyPixelAccess_ChangeRectangle | ( | oyPixelAccess_s * | pixel_access, |
double | start_x, | ||
double | start_y, | ||
oyRectangle_s * | output_rectangle | ||
) |
Change the ticket for a conversion graph.
Function oyPixelAccess_ChangeRectangle
[in,out] | pixel_access | optional pixel iterator configuration |
[in] | start_x | x position relative to virtual source image |
[in] | start_y | y position relative to virtual source image |
[in] | output_rectangle | the region in the output image; optional |
The output_rectangle is absolute to oyPixelAccess_GetArray(). A passed in output_rectangle will call oyPixelAccess_SetArrayFocus( pixel_access(::array), undo=1 ).
OYAPI oyPixelAccess_s *OYEXPORT oyPixelAccess_Copy | ( | oyPixelAccess_s * | pixelaccess, |
oyObject_s | object | ||
) |
Copy or Reference a PixelAccess object.
Function oyPixelAccess_Copy
The function is for copying and for referencing. The reference is the most often used way, which saves resourcs and time.
[in] | pixelaccess | PixelAccess struct object |
object | NULL - means reference, the optional object triggers a real copy |
int oyPixelAccess_Copy__Members | ( | oyPixelAccess_s_ * | dst, |
oyPixelAccess_s_ * | src | ||
) |
Custom PixelAccess copy constructor.
Function oyPixelAccess_Copy__Members
oyPixelAccess_s * oyPixelAccess_Create | ( | int32_t | start_x, |
int32_t | start_y, | ||
oyFilterPlug_s * | plug, | ||
oyPIXEL_ACCESS_TYPE_e | type, | ||
oyObject_s | object | ||
) |
Allocate and initialise a basic oyPixelAccess_s object.
Function oyPixelAccess_Create
The filters have no obligation to pass end to end informations. The ticket must hold all pices of interesst.
oyArray2d_s * oyPixelAccess_GetArray | ( | oyPixelAccess_s * | pixel_access | ) |
Access oyPixelAccess_s::array.
Function oyPixelAccess_GetArray
Referenced by oyPixelAccess_SetArrayFocus(), and oyPixelAccess_Show().
oyRectangle_s * oyPixelAccess_GetArrayROI | ( | oyPixelAccess_s * | pixel_access | ) |
Access oyPixelAccess_s::output_array_roi.
Function oyPixelAccess_GetArrayROI
The rectangle unit is normalised to array::width/channels.
Referenced by oyPixelAccess_Show().
oyFilterGraph_s * oyPixelAccess_GetGraph | ( | oyPixelAccess_s * | pixel_access | ) |
Access oyPixelAccess_s::graph.
Function oyPixelAccess_GetGraph
Referenced by oyPixelAccess_SetFromString(), and oyPixelAccess_Show().
double oyPixelAccess_GetOldStart | ( | oyPixelAccess_s * | pixel_access, |
int | vertical | ||
) |
Access oyPixelAccess_s::start_xy_old.
Function oyPixelAccess_GetOldStart
oyImage_s * oyPixelAccess_GetOutputImage | ( | oyPixelAccess_s * | pixel_access | ) |
Access oyPixelAccess_s::output_image.
Function oyPixelAccess_GetOutputImage
Referenced by oyPixelAccess_Show(), and oyPixelAccess_SynchroniseROI().
oyOptions_s * oyPixelAccess_GetRequestQueue | ( | oyPixelAccess_s * | pixel_access | ) |
Access oyPixelAccess_s::request_queue.
Function oyPixelAccess_GetRequestQueue
double oyPixelAccess_GetStart | ( | oyPixelAccess_s * | pixel_access, |
int | vertical | ||
) |
Access oyPixelAccess_s::start_xy.
Function oyPixelAccess_GetStart
Referenced by oyPixelAccess_SynchroniseROI().
oyStruct_s * oyPixelAccess_GetUserData | ( | oyPixelAccess_s * | pixel_access | ) |
Access oyPixelAccess_s::user_data.
Function oyPixelAccess_GetUserData
int32_t oyPixelAccess_GetWorkspaceID | ( | oyPixelAccess_s * | pixel_access | ) |
Access oyPixelAccess_s::workspace_id.
Function oyPixelAccess_GetWorkspaceID
A ID for distinct resources.
int oyPixelAccess_Init__Members | ( | oyPixelAccess_s_ * | pixelaccess | ) |
Custom PixelAccess constructor.
Function oyPixelAccess_Init__Members
OYAPI oyPixelAccess_s *OYEXPORT oyPixelAccess_New | ( | oyObject_s | object | ) |
allocate a new PixelAccess object
Function oyPixelAccess_New
int oyPixelAccess_PixelsToRoi | ( | oyPixelAccess_s * | pixel_access, |
oyRectangle_s * | pixel_rectangle, | ||
oyRectangle_s ** | roi | ||
) |
Calculate ROI rectangle from pixel rectangle.
Function oyPixelAccess_PixelsToRoi
For obtaining the oyPixelAccess_s::output_array_roi see oyPixelAccess_GetArrayROI().
[in] | pixel_access | pixel iterator configuration |
[in] | pixel_rectangle | pixel rectangle; optional
|
[in,out] | roi | returns a rectangle with ROI |
Referenced by oyPixelAccess_SynchroniseROI().
OYAPI int OYEXPORT oyPixelAccess_Release | ( | oyPixelAccess_s ** | pixelaccess | ) |
release and possibly deallocate a oyPixelAccess_s object
Function oyPixelAccess_Release
[in,out] | pixelaccess | PixelAccess struct object |
void oyPixelAccess_Release__Members | ( | oyPixelAccess_s_ * | pixelaccess | ) |
Custom PixelAccess destructor.
Function oyPixelAccess_Release__Members
int oyPixelAccess_RoiToPixels | ( | oyPixelAccess_s * | pixel_access, |
oyRectangle_s * | roi, | ||
oyRectangle_s ** | pixel_rectangle | ||
) |
Calculate pixel rectangle from ROI.
Function oyPixelAccess_RoiToPixels
[in] | pixel_access | pixel iterator configuration |
[in] | roi | alternative ROI in array::width/channels == 1.0 unit; optional, default: is pixel_access::output_array_roi |
[in,out] | pixel_rectangle | rectangle for pixel results in pixels |
Referenced by oyPixelAccess_SynchroniseROI().
int oyPixelAccess_SetArray | ( | oyPixelAccess_s * | pixel_access, |
oyArray2d_s * | array, | ||
int | has_roi_focus | ||
) |
Set oyPixelAccess_s::array.
Function oyPixelAccess_SetArray
[in,out] | pixel_access | pixel iterator configuration; optional |
[in] | array | channel data |
[in] | has_roi_focus | 0 - the supplied array is not yet focused for the pixel_access::output_array_roi 1 - the array is already in focus for pixel_access::output_array_roi |
int oyPixelAccess_SetArrayFocus | ( | oyPixelAccess_s * | pixel_access, |
int | undo | ||
) |
Ensure that the array is in output ROI focus.
Function oyPixelAccess_SetArrayFocus
The output_array_roi is a absolute rectangle. The unit is relative to a existing oyPixelAccess_GetArray() or to the output image. Undoing will change the oyPixelAccess_GetArray() back to it's data area (oyArray2d_GetDataGeo1()).
After calling this function the oyPixelAccess_GetArray() obtained array might be changed through oyArray2d_SetFocus().
[in,out] | pixel_access | pixel iterator configuration |
undo | undo a previously possibly set focus |
References oyPixelAccess_GetArray().
int oyPixelAccess_SetFromString | ( | oyPixelAccess_s * | ticket, |
const char * | key, | ||
const char * | value, | ||
int | flags | ||
) |
Set oyPixelAccess_s::graph::options.
References oyFilterGraph_s::oyFilterGraph_GetOptions(), oyFilterGraph_s::oyFilterGraph_Release(), oyOptions_s::oyOptions_Release(), oyOptions_s::oyOptions_SetFromString(), and oyPixelAccess_GetGraph().
int oyPixelAccess_SetOldStart | ( | oyPixelAccess_s * | pixel_access, |
int | vertical, | ||
double | start | ||
) |
Access oyPixelAccess_s::start_xy_old.
Function oyPixelAccess_SetOldStart
int oyPixelAccess_SetOutputImage | ( | oyPixelAccess_s * | pixel_access, |
oyImage_s * | image | ||
) |
Set oyPixelAccess_s::output_image.
Function oyPixelAccess_SetOutputImage
int oyPixelAccess_SetUserData | ( | oyPixelAccess_s * | pixel_access, |
oyStruct_s * | user_data | ||
) |
Set oyPixelAccess_s::user_data.
Function oyPixelAccess_SetUserData
int oyPixelAccess_SetWorkspaceID | ( | oyPixelAccess_s * | pixel_access, |
int32_t | workspace_id | ||
) |
Set oyPixelAccess_s::workspace_id.
Function oyPixelAccess_SWorkspaceID
A ID for distinct resources.
const char * oyPixelAccess_Show | ( | oyPixelAccess_s * | pixel_access | ) |
Print ticket geometries.
Function oyPixelAccess_Show
This function is not thread safe.
[in] | pixel_access | pixel iterator configuration |
References oy_, oyFilterGraph_s::oyFilterGraph_GetOptions(), oyImage_s::oyImage_GetWidth(), oyObject_GetAlloc(), oyObject_GetDeAlloc(), oyPixelAccess_ArrayIsFocussed(), oyPixelAccess_GetArray(), oyPixelAccess_GetArrayROI(), oyPixelAccess_GetGraph(), and oyPixelAccess_GetOutputImage().
int oyPixelAccess_SynchroniseROI | ( | oyPixelAccess_s * | pixel_access_new, |
oyPixelAccess_s * | pixel_access_src | ||
) |
Set a new ticket according to old ticket geometries.
Function oyPixelAccess_SynchroniseROI
After a new ticket is generated, the old geometries might become invalid, as channel counts change or the array sizes becomes different. This function convinently changes the ROI and start_xy dimensions after such critical changes.
[in,out] | pixel_access_new | to be modified pixel iterator configuration |
[in] | pixel_access_src | pixel iterator configuration pattern |
References oy_debug, oyImage_s::oyImage_GetWidth(), oyPixelAccess_GetOutputImage(), oyPixelAccess_GetStart(), oyPixelAccess_PixelsToRoi(), and oyPixelAccess_RoiToPixels().
oyStruct_Copy_f oyPixelAccess_s::copy |
Copy function.
oyObject_s oyPixelAccess_s::oy_ |
Oyranos internal object.
Features name and hash. Do not change during object life time.
Referenced by oyPixelAccess_Show().
oyStruct_Release_f oyPixelAccess_s::release |
Release function.
const oyOBJECT_e oyPixelAccess_s::type_ |
Type of object.
The struct type tells Oyranos how to interprete hidden fields.