Leptonica  1.82.0
Image processing and image analysis suite
arrayaccess.c File Reference
#include "allheaders.h"

Go to the source code of this file.

Functions

l_int32 l_getDataBit (const void *line, l_int32 n)
 
void l_setDataBit (void *line, l_int32 n)
 
void l_clearDataBit (void *line, l_int32 n)
 
void l_setDataBitVal (void *line, l_int32 n, l_int32 val)
 
l_int32 l_getDataDibit (const void *line, l_int32 n)
 
void l_setDataDibit (void *line, l_int32 n, l_int32 val)
 
void l_clearDataDibit (void *line, l_int32 n)
 
l_int32 l_getDataQbit (const void *line, l_int32 n)
 
void l_setDataQbit (void *line, l_int32 n, l_int32 val)
 
void l_clearDataQbit (void *line, l_int32 n)
 
l_int32 l_getDataByte (const void *line, l_int32 n)
 
void l_setDataByte (void *line, l_int32 n, l_int32 val)
 
l_int32 l_getDataTwoBytes (const void *line, l_int32 n)
 
void l_setDataTwoBytes (void *line, l_int32 n, l_int32 val)
 
l_int32 l_getDataFourBytes (const void *line, l_int32 n)
 
void l_setDataFourBytes (void *line, l_int32 n, l_int32 val)
 

Detailed Description

    Access within an array of 32-bit words
          l_int32     l_getDataBit()
          void        l_setDataBit()
          void        l_clearDataBit()
          void        l_setDataBitVal()
          l_int32     l_getDataDibit()
          void        l_setDataDibit()
          void        l_clearDataDibit()
          l_int32     l_getDataQbit()
          void        l_setDataQbit()
          void        l_clearDataQbit()
          l_int32     l_getDataByte()
          void        l_setDataByte()
          l_int32     l_getDataTwoBytes()
          void        l_setDataTwoBytes()
          l_int32     l_getDataFourBytes()
          void        l_setDataFourBytes()
    Note that these all require 32-bit alignment, and hence an input
    ptr to l_uint32.  However, this is not enforced by the compiler.
    Instead, we allow the use of a void* ptr, because the line ptrs
    are an efficient way to get random access (see pixGetLinePtrs()).
    It is then necessary to cast internally within each function
    because ptr arithmetic requires knowing the size of the units
    being referenced.

Definition in file arrayaccess.c.

Function Documentation

◆ l_clearDataBit()

void l_clearDataBit ( void *  line,
l_int32  n 
)

l_clearDataBit()

Parameters
[in]lineptr to beginning of data line
[in]npixel index
Returns
void

Action: sets the 1-bit pixel to 0

Definition at line 111 of file arrayaccess.c.

◆ l_clearDataDibit()

void l_clearDataDibit ( void *  line,
l_int32  n 
)

l_clearDataDibit()

Parameters
[in]lineptr to beginning of data line
[in]npixel index
Returns
void

Action: sets the 2-bit pixel to 0

Definition at line 195 of file arrayaccess.c.

◆ l_clearDataQbit()

void l_clearDataQbit ( void *  line,
l_int32  n 
)

l_clearDataQbit()

Parameters
[in]lineptr to beginning of data line
[in]npixel index
Returns
void

Action: sets the 4-bit pixel to 0

Definition at line 248 of file arrayaccess.c.

◆ l_getDataBit()

l_int32 l_getDataBit ( const void *  line,
l_int32  n 
)

l_getDataBit()

Parameters
[in]lineptr to beginning of data line
[in]npixel index
Returns
val of the nth 1-bit pixel.

Definition at line 77 of file arrayaccess.c.

◆ l_getDataByte()

l_int32 l_getDataByte ( const void *  line,
l_int32  n 
)

l_getDataByte()

Parameters
[in]lineptr to beginning of data line
[in]npixel index
Returns
value of the n-th byte pixel

Definition at line 263 of file arrayaccess.c.

◆ l_getDataDibit()

l_int32 l_getDataDibit ( const void *  line,
l_int32  n 
)

l_getDataDibit()

Parameters
[in]lineptr to beginning of data line
[in]npixel index
Returns
val of the nth 2-bit pixel.

Definition at line 157 of file arrayaccess.c.

◆ l_getDataFourBytes()

l_int32 l_getDataFourBytes ( const void *  line,
l_int32  n 
)

l_getDataFourBytes()

Parameters
[in]lineptr to beginning of data line
[in]npixel index
Returns
value of the n-th 4-byte pixel

Definition at line 343 of file arrayaccess.c.

Referenced by l_uncompressGrayHistograms().

◆ l_getDataQbit()

l_int32 l_getDataQbit ( const void *  line,
l_int32  n 
)

l_getDataQbit()

Parameters
[in]lineptr to beginning of data line
[in]npixel index
Returns
val of the nth 4-bit pixel.

Definition at line 210 of file arrayaccess.c.

◆ l_getDataTwoBytes()

l_int32 l_getDataTwoBytes ( const void *  line,
l_int32  n 
)

l_getDataTwoBytes()

Parameters
[in]lineptr to beginning of data line
[in]npixel index
Returns
value of the n-th 2-byte pixel

Definition at line 303 of file arrayaccess.c.

◆ l_setDataBit()

void l_setDataBit ( void *  line,
l_int32  n 
)

l_setDataBit()

Parameters
[in]lineptr to beginning of data line
[in]npixel index
Returns
void

Action: sets the pixel to 1

Definition at line 94 of file arrayaccess.c.

◆ l_setDataBitVal()

void l_setDataBitVal ( void *  line,
l_int32  n,
l_int32  val 
)

l_setDataBitVal()

Parameters
[in]lineptr to beginning of data line
[in]npixel index
[in]valval to be inserted: 0 or 1
Returns
void
Notes:
     (1) This is an accessor for a 1 bpp pix.
     (2) It is actually a little slower than using:
           if (val == 0)
               l_ClearDataBit(line, n);
           else
               l_SetDataBit(line, n);

Definition at line 137 of file arrayaccess.c.

◆ l_setDataByte()

void l_setDataByte ( void *  line,
l_int32  n,
l_int32  val 
)

l_setDataByte()

Parameters
[in]lineptr to beginning of data line
[in]npixel index
[in]valval to be inserted: 0 - 0xff
Returns
void

Definition at line 283 of file arrayaccess.c.

◆ l_setDataDibit()

void l_setDataDibit ( void *  line,
l_int32  n,
l_int32  val 
)

l_setDataDibit()

Parameters
[in]lineptr to beginning of data line
[in]npixel index
[in]valval to be inserted: 0 - 3
Returns
void

Definition at line 173 of file arrayaccess.c.

◆ l_setDataFourBytes()

void l_setDataFourBytes ( void *  line,
l_int32  n,
l_int32  val 
)

l_setDataFourBytes()

Parameters
[in]lineptr to beginning of data line
[in]npixel index
[in]valval to be inserted: 0 - 0xffffffff
Returns
void

Definition at line 359 of file arrayaccess.c.

Referenced by l_compressGrayHistograms().

◆ l_setDataQbit()

void l_setDataQbit ( void *  line,
l_int32  n,
l_int32  val 
)

l_setDataQbit()

Parameters
[in]lineptr to beginning of data line
[in]npixel index
[in]valval to be inserted: 0 - 0xf
Returns
void

Definition at line 226 of file arrayaccess.c.

◆ l_setDataTwoBytes()

void l_setDataTwoBytes ( void *  line,
l_int32  n,
l_int32  val 
)

l_setDataTwoBytes()

Parameters
[in]lineptr to beginning of data line
[in]npixel index
[in]valval to be inserted: 0 - 0xffff
Returns
void

Definition at line 323 of file arrayaccess.c.