Leptonica  1.54
Файл src/binreducelow.c
#include <string.h>
#include "allheaders.h"

Функции

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)

Функции

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

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().

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().