Leptonica 1.68
C Image Processing Library
|
Low-level helpers for orthogonal rotation. More...
Go to the source code of this file.
Functions | |
void | rotate90Low (l_uint32 *datad, l_int32 wd, l_int32 hd, l_int32 d, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_int32 direction) |
void | flipLRLow (l_uint32 *data, l_int32 w, l_int32 h, l_int32 d, l_int32 wpl, l_uint8 *tab, l_uint32 *buffer) |
void | flipTBLow (l_uint32 *data, l_int32 h, l_int32 wpl, l_uint32 *buffer) |
l_uint8 * | makeReverseByteTab1 (void) |
l_uint8 * | makeReverseByteTab2 (void) |
l_uint8 * | makeReverseByteTab4 (void) |
Low-level helpers for orthogonal rotation.
90-degree rotation (cw) void rotate90Low() LR-flip void flipLRLow() TB-flip void flipTBLow() Byte reverse tables l_uint8 *makeReverseByteTab1() l_uint8 *makeReverseByteTab2() l_uint8 *makeReverseByteTab4()
Definition in file rotateorthlow.c.
void rotate90Low | ( | l_uint32 * | datad, |
l_int32 | wd, | ||
l_int32 | hd, | ||
l_int32 | d, | ||
l_int32 | wpld, | ||
l_uint32 * | datas, | ||
l_int32 | wpls, | ||
l_int32 | direction | ||
) |
direction: 1 for cw rotation -1 for ccw rotation
Notes: (1) The dest must be cleared in advance because not all source pixels are written to the destination.
Definition at line 56 of file rotateorthlow.c.
References GET_DATA_BIT, GET_DATA_BYTE, GET_DATA_DIBIT, GET_DATA_QBIT, GET_DATA_TWO_BYTES, L_ERROR, PROCNAME, SET_DATA_BIT, SET_DATA_BYTE, SET_DATA_DIBIT, SET_DATA_QBIT, and SET_DATA_TWO_BYTES.
Referenced by pixRotate90().
void flipLRLow | ( | l_uint32 * | data, |
l_int32 | w, | ||
l_int32 | h, | ||
l_int32 | d, | ||
l_int32 | wpl, | ||
l_uint8 * | tab, | ||
l_uint32 * | buffer | ||
) |
Notes: (1) The pixel access routines allow a trivial implementation. However, for d < 8, it is more efficient to right-justify each line to a 32-bit boundary and then extract bytes and do pixel reversing. In those cases, as in the 180 degree rotation, we right-shift the data (if necessary) to right-justify on the 32 bit boundary, and then read the bytes off each raster line in reverse order, reversing the pixels in each byte using a table. These functions for 1, 2 and 4 bpp were tested against the "trivial" version (shown here for 4 bpp): for (i = 0; i < h; i++) { line = data + i * wpl; memcpy(buffer, line, bpl); for (j = 0; j < w; j++) { val = GET_DATA_QBIT(buffer, w - 1 - j); SET_DATA_QBIT(line, j, val); } } (2) This operation is in-place.
Definition at line 280 of file rotateorthlow.c.
References GET_DATA_BYTE, GET_DATA_TWO_BYTES, L_ERROR, PROCNAME, rasteropHipLow(), SET_DATA_BYTE, and SET_DATA_TWO_BYTES.
Referenced by pixFlipLR().
Notes: (1) This is simple and fast. We use the memcpy function to do all the work on aligned data, regardless of pixel depth. (2) This operation is in-place.
Definition at line 404 of file rotateorthlow.c.
Referenced by pixFlipTB().
l_uint8* makeReverseByteTab1 | ( | void | ) |
Notes: (1) This generates an 8 bit lookup table for reversing the order of eight 1-bit pixels.
Definition at line 437 of file rotateorthlow.c.
References CALLOC, ERROR_PTR, NULL, and PROCNAME.
Referenced by pixFlipLR().
l_uint8* makeReverseByteTab2 | ( | void | ) |
Notes: (1) This generates an 8 bit lookup table for reversing the order of four 2-bit pixels.
Definition at line 469 of file rotateorthlow.c.
References CALLOC, ERROR_PTR, NULL, and PROCNAME.
Referenced by pixFlipLR().
l_uint8* makeReverseByteTab4 | ( | void | ) |
Notes: (1) This generates an 8 bit lookup table for reversing the order of two 4-bit pixels.
Definition at line 496 of file rotateorthlow.c.
References CALLOC, ERROR_PTR, NULL, and PROCNAME.
Referenced by pixFlipLR().