![]() |
Leptonica
1.82.0
Image processing and image analysis suite
|
#include <string.h>
#include "allheaders.h"
Go to the source code of this file.
Macros | |
#define | COMBINE_PARTIAL(d, s, m) ( ((d) & ~(m)) | ((s) & (m)) ) |
Functions | |
static void | rasteropUniWordAlignedLow (l_uint32 *datad, l_int32 dwpl, l_int32 dx, l_int32 dy, l_int32 dw, l_int32 dh, l_int32 op) |
static void | rasteropUniGeneralLow (l_uint32 *datad, l_int32 dwpl, l_int32 dx, l_int32 dy, l_int32 dw, l_int32 dh, l_int32 op) |
static void | rasteropWordAlignedLow (l_uint32 *datad, l_int32 dwpl, l_int32 dx, l_int32 dy, l_int32 dw, l_int32 dh, l_int32 op, l_uint32 *datas, l_int32 swpl, l_int32 sx, l_int32 sy) |
static void | rasteropVAlignedLow (l_uint32 *datad, l_int32 dwpl, l_int32 dx, l_int32 dy, l_int32 dw, l_int32 dh, l_int32 op, l_uint32 *datas, l_int32 swpl, l_int32 sx, l_int32 sy) |
static void | rasteropGeneralLow (l_uint32 *datad, l_int32 dwpl, l_int32 dx, l_int32 dy, l_int32 dw, l_int32 dh, l_int32 op, l_uint32 *datas, l_int32 swpl, l_int32 sx, l_int32 sy) |
static void | shiftDataHorizontalLow (l_uint32 *datad, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_int32 shift) |
void | rasteropUniLow (l_uint32 *datad, l_int32 dpixw, l_int32 dpixh, l_int32 depth, l_int32 dwpl, l_int32 dx, l_int32 dy, l_int32 dw, l_int32 dh, l_int32 op) |
void | rasteropLow (l_uint32 *datad, l_int32 dpixw, l_int32 dpixh, l_int32 depth, l_int32 dwpl, l_int32 dx, l_int32 dy, l_int32 dw, l_int32 dh, l_int32 op, l_uint32 *datas, l_int32 spixw, l_int32 spixh, l_int32 swpl, l_int32 sx, l_int32 sy) |
void | rasteropVipLow (l_uint32 *data, l_int32 pixw, l_int32 pixh, l_int32 depth, l_int32 wpl, l_int32 x, l_int32 w, l_int32 shift) |
void | rasteropHipLow (l_uint32 *data, l_int32 pixh, l_int32 depth, l_int32 wpl, l_int32 y, l_int32 h, l_int32 shift) |
Variables | |
static const l_int32 | SHIFT_LEFT = 0 |
static const l_int32 | SHIFT_RIGHT = 1 |
static const l_uint32 | lmask32 [] |
static const l_uint32 | rmask32 [] |
Low level dest-only void rasteropUniLow() static void rasteropUniWordAlignedlLow() static void rasteropUniGeneralLow() Low level src and dest void rasteropLow() static void rasteropWordAlignedLow() static void rasteropVAlignedLow() static void rasteropGeneralLow() Low level in-place full height vertical block transfer void rasteropVipLow() Low level in-place full width horizontal block transfer void rasteropHipLow() static void shiftDataHorizontalLow()
Definition in file roplow.c.
|
static |
[in] | datad | ptr to dest image data |
[in] | dwpl | wpl of dest |
[in] | dx | x val of UL corner of dest rectangle |
[in] | dy | y val of UL corner of dest rectangle |
[in] | dw | width of dest rectangle |
[in] | dh | height of dest rectangle |
[in] | op | op code |
[in] | datas | ptr to src image data |
[in] | swpl | wpl of src |
[in] | sx | x val of UL corner of src rectangle |
[in] | sy | y val of UL corner of src rectangle |
This is called when the src and dest rects are do not have the same 32-bit word alignment.
The method is a generalization of rasteropVAlignLow. There, the src image pieces were directly merged with the dest. Here, we shift the source bits to fill words that are aligned with the dest, and then use those "source words" exactly in place of the source words that were used in rasteropVAlignLow.
The critical parameter is thus the shift required for the src. Consider the left edge of the rectangle. The overhang into the src and dest words are found, and the difference is exactly this shift. There are two separate cases, depending on whether the src pixels are shifted left or right. If the src overhang is larger than the dest overhang, the src is shifted to the right, and a number of pixels equal to the shift are left over for filling the next dest word, if necessary.
But if the dest overhang is larger than the src overhang, the src is shifted to the left, and depending on the width of transferred pixels, it may also be necessary to shift pixels in from the next src word, in order to fill the dest word. An interesting case is where the src overhang equals the width, dw, of the block. Then all the pixels necessary to fill the first dest word can be taken from the first src word, up to the last src pixel in the word, and no pixels from the next src word are required. Consider this simple example, where a single pixel from the src is transferred to the dest: pix1 = pixCreate(32, 1, 1); pix2 = pixCreate(32, 1, 1); pixRasterop(pix1, 30, 0, 1, 1, PIX_SRC, pix2, 31, 0); Here, the pixel at the right end of the src image (sx = 31) is shifted one bit to the left (to dx = 30). The width (1) equals the src overhang (1), and no pixels from the next word are required. (This must be true because there is only one src word.)
Definition at line 1359 of file roplow.c.
References lept_stderr().
Referenced by rasteropLow().
void rasteropHipLow | ( | l_uint32 * | data, |
l_int32 | pixh, | ||
l_int32 | depth, | ||
l_int32 | wpl, | ||
l_int32 | y, | ||
l_int32 | h, | ||
l_int32 | shift | ||
) |
[in] | data | ptr to image data |
[in] | pixh | height |
[in] | depth | depth |
[in] | wpl | wpl |
[in] | y | y val of UL corner of rectangle |
[in] | h | height of rectangle |
[in] | shift | + shifts data to the left in a horizontal column |
Notes: (1) This clears the pixels that are left exposed after the rasterop. Therefore, for Pix with depth > 1, these pixels become black, and must be subsequently SET if they are to be white. For example, see pixRasteropHip(). (2) This function performs clipping and calls shiftDataHorizontalLow() to do the in-place rasterop on each line.
Definition at line 2386 of file roplow.c.
References shiftDataHorizontalLow().
Referenced by pixRasteropHip().
void rasteropLow | ( | l_uint32 * | datad, |
l_int32 | dpixw, | ||
l_int32 | dpixh, | ||
l_int32 | depth, | ||
l_int32 | dwpl, | ||
l_int32 | dx, | ||
l_int32 | dy, | ||
l_int32 | dw, | ||
l_int32 | dh, | ||
l_int32 | op, | ||
l_uint32 * | datas, | ||
l_int32 | spixw, | ||
l_int32 | spixh, | ||
l_int32 | swpl, | ||
l_int32 | sx, | ||
l_int32 | sy | ||
) |
[in] | datad | ptr to dest image data |
[in] | dpixw | width of dest |
[in] | dpixh | height of dest |
[in] | depth | depth of src and dest |
[in] | dwpl | wpl of dest |
[in] | dx | x val of UL corner of dest rectangle |
[in] | dy | y val of UL corner of dest rectangle |
[in] | dw | width of dest rectangle |
[in] | dh | height of dest rectangle |
[in] | op | op code |
[in] | datas | ptr to src image data |
[in] | spixw | width of src |
[in] | spixh | height of src |
[in] | swpl | wpl of src |
[in] | sx | x val of UL corner of src rectangle |
[in] | sy | y val of UL corner of src rectangle |
Action: Scales width, performs clipping, checks alignment and dispatches for the rasterop.
Warning: the two images must have equal depth. This is not checked.
Definition at line 485 of file roplow.c.
References lept_stderr(), rasteropGeneralLow(), rasteropVAlignedLow(), and rasteropWordAlignedLow().
|
static |
[in] | datad | ptr to dest image data |
[in] | dwpl | wpl of dest |
[in] | dx | x val of UL corner of dest rectangle |
[in] | dy | y val of UL corner of dest rectangle |
[in] | dw | width of dest rectangle |
[in] | dh | height of dest rectangle |
[in] | op | op code |
Definition at line 289 of file roplow.c.
Referenced by rasteropUniLow().
void rasteropUniLow | ( | l_uint32 * | datad, |
l_int32 | dpixw, | ||
l_int32 | dpixh, | ||
l_int32 | depth, | ||
l_int32 | dwpl, | ||
l_int32 | dx, | ||
l_int32 | dy, | ||
l_int32 | dw, | ||
l_int32 | dh, | ||
l_int32 | op | ||
) |
[in] | datad | ptr to dest image data |
[in] | dpixw | width of dest |
[in] | dpixh | height of dest |
[in] | depth | depth of src and dest |
[in] | dwpl | wpl of dest |
[in] | dx | x val of UL corner of dest rectangle |
[in] | dy | y val of UL corner of dest rectangle |
[in] | dw | width of dest rectangle |
[in] | dh | height of dest rectangle |
[in] | op | op code |
Action: scales width, performs clipping, checks alignment, and dispatches for the rasterop.
Definition at line 128 of file roplow.c.
References rasteropUniGeneralLow(), and rasteropUniWordAlignedLow().
Referenced by pixRasterop().
|
static |
[in] | datad | ptr to dest image data |
[in] | dwpl | wpl of dest |
[in] | dx | x val of UL corner of dest rectangle |
[in] | dy | y val of UL corner of dest rectangle |
[in] | dw | width of dest rectangle |
[in] | dh | height of dest rectangle |
[in] | op | op code |
This is called when the dest rect is left aligned on 32-bit word boundaries. That is: dx & 31 == 0.
We make an optimized implementation of this because it is a common case: e.g., operating on a full dest image.
Definition at line 208 of file roplow.c.
Referenced by rasteropUniLow().
|
static |
[in] | datad | ptr to dest image data |
[in] | dwpl | wpl of dest |
[in] | dx | x val of UL corner of dest rectangle |
[in] | dy | y val of UL corner of dest rectangle |
[in] | dw | width of dest rectangle |
[in] | dh | height of dest rectangle |
[in] | op | op code |
[in] | datas | ptr to src image data |
[in] | swpl | wpl of src |
[in] | sx | x val of UL corner of src rectangle |
[in] | sy | y val of UL corner of src rectangle |
This is called when the left side of the src and dest rects have the same alignment relative to 32-bit word boundaries; i.e., dx & 31) == (sx & 31
Definition at line 830 of file roplow.c.
Referenced by rasteropLow().
void rasteropVipLow | ( | l_uint32 * | data, |
l_int32 | pixw, | ||
l_int32 | pixh, | ||
l_int32 | depth, | ||
l_int32 | wpl, | ||
l_int32 | x, | ||
l_int32 | w, | ||
l_int32 | shift | ||
) |
[in] | data | ptr to image data |
[in] | pixw | width |
[in] | pixh | height |
[in] | depth | depth |
[in] | wpl | wpl |
[in] | x | x val of UL corner of rectangle |
[in] | w | width of rectangle |
[in] | shift | + shifts data downward in vertical column |
Notes: (1) This clears the pixels that are left exposed after the translation. You can consider them as pixels that are shifted in from outside the image. This can be later overridden by the incolor parameter in higher-level functions that call this. For example, for images with depth > 1, these pixels are cleared to black; to be white they must later be SET to white. See, e.g., pixRasteropVip(). (2) This function scales the width to accommodate any depth, performs clipping, and then does the in-place rasterop.
Definition at line 2173 of file roplow.c.
Referenced by pixRasteropVip().
|
static |
[in] | datad | ptr to dest image data |
[in] | dwpl | wpl of dest |
[in] | dx | x val of UL corner of dest rectangle |
[in] | dy | y val of UL corner of dest rectangle |
[in] | dw | width of dest rectangle |
[in] | dh | height of dest rectangle |
[in] | op | op code |
[in] | datas | ptr to src image data |
[in] | swpl | wpl of src |
[in] | sx | x val of UL corner of src rectangle |
[in] | sy | y val of UL corner of src rectangle |
This is called when both the src and dest rects are left aligned on 32-bit word boundaries. That is: dx & 31 == 0 and sx & 31 == 0
We make an optimized implementation of this because it is a common case: e.g., two images are rasterop'd starting from their UL corners 0,0.
Definition at line 606 of file roplow.c.
Referenced by rasteropLow().
|
static |
[in] | datad | ptr to beginning of dest line |
[in] | wpld | wpl of dest |
[in] | datas | ptr to beginning of src line |
[in] | wpls | wpl of src |
[in] | shift | horizontal shift of block; >0 is to right |
Notes: (1) This can also be used for in-place operation; see, e.g., rasteropHipLow(). (2) We are clearing the pixels that are shifted in from outside the image. This can be overridden by the incolor parameter in higher-level functions that call this.
Definition at line 2435 of file roplow.c.
Referenced by rasteropHipLow().
|
static |
|
static |