#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "allheaders.h"
#define DEBUG_UNROLLING 0 |
void ditherTo2bppLineLow | ( | l_uint32 * | lined, | |
l_int32 | w, | |||
l_uint32 * | bufs1, | |||
l_uint32 * | bufs2, | |||
l_int32 * | tabval, | |||
l_int32 * | tab38, | |||
l_int32 * | tab14, | |||
l_int32 | lastlineflag | |||
) |
void ditherTo2bppLow | ( | l_uint32 * | datad, | |
l_int32 | w, | |||
l_int32 | h, | |||
l_int32 | wpld, | |||
l_uint32 * | datas, | |||
l_int32 | wpls, | |||
l_uint32 * | bufs1, | |||
l_uint32 * | bufs2, | |||
l_int32 * | tabval, | |||
l_int32 * | tab38, | |||
l_int32 * | tab14 | |||
) |
void ditherToBinaryLineLow | ( | l_uint32 * | lined, | |
l_int32 | w, | |||
l_uint32 * | bufs1, | |||
l_uint32 * | bufs2, | |||
l_int32 | lowerclip, | |||
l_int32 | upperclip, | |||
l_int32 | lastlineflag | |||
) |
void ditherToBinaryLineLUTLow | ( | l_uint32 * | lined, | |
l_int32 | w, | |||
l_uint32 * | bufs1, | |||
l_uint32 * | bufs2, | |||
l_int32 * | tabval, | |||
l_int32 * | tab38, | |||
l_int32 * | tab14, | |||
l_int32 | lastlineflag | |||
) |
Input: lined (ptr to beginning of dest line w (width of image in pixels) bufs1 (buffer of current source line) bufs2 (buffer of next source line) tabval (value to assign for current pixel) tab38 (excess value to give to neighboring 3/8 pixels) tab14 (excess value to give to neighboring 1/4 pixel) lastlineflag (0 if not last dest line, 1 if last dest line) Return: void
void ditherToBinaryLow | ( | l_uint32 * | datad, | |
l_int32 | w, | |||
l_int32 | h, | |||
l_int32 | wpld, | |||
l_uint32 * | datas, | |||
l_int32 | wpls, | |||
l_uint32 * | bufs1, | |||
l_uint32 * | bufs2, | |||
l_int32 | lowerclip, | |||
l_int32 | upperclip | |||
) |
void ditherToBinaryLUTLow | ( | l_uint32 * | datad, | |
l_int32 | w, | |||
l_int32 | h, | |||
l_int32 | wpld, | |||
l_uint32 * | datas, | |||
l_int32 | wpls, | |||
l_uint32 * | bufs1, | |||
l_uint32 * | bufs2, | |||
l_int32 * | tabval, | |||
l_int32 * | tab38, | |||
l_int32 * | tab14 | |||
) |
Low-level function for doing Floyd-Steinberg error diffusion dithering from 8 bpp (datas) to 1 bpp (datad). Two source line buffers, bufs1 and bufs2, are provided, along with three 256-entry lookup tables: tabval gives the output pixel value, tab38 gives the extra (plus or minus) transferred to the pixels directly to the left and below, and tab14 gives the extra transferred to the diagonal below. The choice of 3/8 and 1/4 is traditional but arbitrary when you use a lookup table; the only constraint is that the sum is 1. See other comments below.
l_int32 make8To1DitherTables | ( | l_int32 ** | ptabval, | |
l_int32 ** | ptab38, | |||
l_int32 ** | ptab14, | |||
l_int32 | lowerclip, | |||
l_int32 | upperclip | |||
) |
Input: &tabval (value assigned to output pixel; 0 or 1) &tab38 (amount propagated to pixels left and below) &tab14 (amount propagated to pixel to left and down) lowerclip (values near 0 where the excess is not propagated) upperclip (values near 255 where the deficit is not propagated)
Return: 0 if OK, 1 on error
l_int32 make8To2DitherTables | ( | l_int32 ** | ptabval, | |
l_int32 ** | ptab38, | |||
l_int32 ** | ptab14, | |||
l_int32 | cliptoblack, | |||
l_int32 | cliptowhite | |||
) |
Input: &tabval (value assigned to output pixel; 0, 1, 2 or 3) &tab38 (amount propagated to pixels left and below) &tab14 (amount propagated to pixel to left and down) cliptoblack (values near 0 where the excess is not propagated) cliptowhite (values near 255 where the deficit is not propagated)
Return: 0 if OK, 1 on error
void thresholdTo2bppLow | ( | l_uint32 * | datad, | |
l_int32 | h, | |||
l_int32 | wpld, | |||
l_uint32 * | datas, | |||
l_int32 | wpls, | |||
l_int32 * | tab | |||
) |
void thresholdTo4bppLow | ( | l_uint32 * | datad, | |
l_int32 | h, | |||
l_int32 | wpld, | |||
l_uint32 * | datas, | |||
l_int32 | wpls, | |||
l_int32 * | tab | |||
) |
void thresholdToBinaryLineLow | ( | l_uint32 * | lined, | |
l_int32 | w, | |||
l_uint32 * | lines, | |||
l_int32 | d, | |||
l_int32 | thresh | |||
) |
void thresholdToBinaryLow | ( | l_uint32 * | datad, | |
l_int32 | w, | |||
l_int32 | h, | |||
l_int32 | wpld, | |||
l_uint32 * | datas, | |||
l_int32 | d, | |||
l_int32 | wpls, | |||
l_int32 | thresh | |||
) |