Leptonica 1.68
C Image Processing Library

binreducelow.c File Reference

Low-level implementation of power of 2 reduction. More...

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "allheaders.h"

Go to the source code of this file.

Functions

void reduceBinary2Low (l_uint32 *datad, l_int32 wpld, l_uint32 *datas, l_int32 hs, l_int32 wpls, l_uint8 *tab)
void reduceRankBinary2Low (l_uint32 *datad, l_int32 wpld, l_uint32 *datas, l_int32 hs, l_int32 wpls, l_uint8 *tab, l_int32 level)
l_uint8makeSubsampleTab2x (void)

Detailed Description

Low-level implementation of power of 2 reduction.

        Low-level subsampled reduction
                void       reduceBinary2Low()

        Low-level threshold reduction
                void       reduceRankBinary2Low()
                l_uint8   *makeSubsampleTab2x()

Definition in file binreducelow.c.


Function Documentation

void reduceBinary2Low ( l_uint32 datad,
l_int32  wpld,
l_uint32 datas,
l_int32  hs,
l_int32  wpls,
l_uint8 tab 
)

reduceBinary2Low()

After folding, the data is in bytes 0 and 2 of the word, and the bits in each byte are in the following order (with 0 being the leftmost originating pair and 7 being the rightmost originating pair):

0 4 1 5 2 6 3 7

These need to be permuted to

0 1 2 3 4 5 6 7

which is done with an 8-bit table generated by makeSubsampleTab2x().

Definition at line 60 of file binreducelow.c.

References L_MIN, and SET_DATA_TWO_BYTES.

Referenced by pixReduceBinary2().

void reduceRankBinary2Low ( l_uint32 datad,
l_int32  wpld,
l_uint32 datas,
l_int32  hs,
l_int32  wpls,
l_uint8 tab,
l_int32  level 
)

reduceRankBinary2Low()

Rank filtering is done to the UL corner of each 2x2 pixel block, using only logical operations.

Then these pixels are chosen in the 2x subsampling process, subsampled, as described above in reduceBinary2Low().

Definition at line 107 of file binreducelow.c.

References L_MIN, and SET_DATA_TWO_BYTES.

Referenced by pixReduceRankBinary2().

l_uint8* makeSubsampleTab2x ( void  )

makeSubsampleTab2x()

This table permutes the bits in a byte, from 0 4 1 5 2 6 3 7 to 0 1 2 3 4 5 6 7

Definition at line 237 of file binreducelow.c.

References CALLOC, ERROR_PTR, NULL, and PROCNAME.

Referenced by pixReduceBinary2(), pixReduceRankBinary2(), and pixReduceRankBinaryCascade().

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines