bit-ops.h File Reference

Bit operations. More...

## Functions

void | stp_fold (const unsigned char *line, int single_length, unsigned char *outbuf)
| Interleave a buffer consisting of two bit strings of length single_length into one string of packed two-bit ints.
void | stp_fold_3bit (const unsigned char *line, int single_length, unsigned char *outbuf)
| Interleave a buffer consisting of three bit strings of length single_length into one string of packed three-bit ints.
void | stp_fold_3bit_323 (const unsigned char *line, int single_length, unsigned char *outbuf)
| Interleave a buffer consisting of three bit strings of length single_length into one string of packed three-bit ints.
void | stp_fold_4bit (const unsigned char *line, int single_length, unsigned char *outbuf)
| Interleave a buffer consisting of four bit strings of length single_length into one string of packed four-bit ints.
void | stp_fold_8bit (const unsigned char *line, int single_length, unsigned char *outbuf)
| Interleave a buffer consisting of eight bit strings of length single_length into one string of packed eight-bit ints.
void | stp_split (int height, int bits, int n, const unsigned char *in, int stride, unsigned char **outs)
| Split an input sequence of packed 1 or 2 bit integers into two or more outputs of equal length, distributing non-zero integers round robin into each output.
void | stp_split_2 (int height, int bits, const unsigned char *in, unsigned char *outhi, unsigned char *outlo)
| Deprecated – use stp_split.
void | stp_split_4 (int height, int bits, const unsigned char *in, unsigned char *out0, unsigned char *out1, unsigned char *out2, unsigned char *out3)
| Deprecated – use stp_split.
void | stp_unpack (int height, int bits, int n, const unsigned char *in, unsigned char **outs)
| Unpack an input sequence of packed 1 or 2 bit integers into two or more outputs of equal length.
void | stp_unpack_2 (int height, int bits, const unsigned char *in, unsigned char *outlo, unsigned char *outhi)
| Deprecated – use stp_unpack.
void | stp_unpack_4 (int height, int bits, const unsigned char *in, unsigned char *out0, unsigned char *out1, unsigned char *out2, unsigned char *out3)
| Deprecated – use stp_unpack.
void | stp_unpack_8 (int height, int bits, const unsigned char *in, unsigned char *out0, unsigned char *out1, unsigned char *out2, unsigned char *out3, unsigned char *out4, unsigned char *out5, unsigned char *out6, unsigned char *out7)
| Deprecated – use stp_unpack.

void

stp_unpack_16 (int height, int bits, const unsigned char *in, unsigned char *out0, unsigned char *out1, unsigned char *out2, unsigned char *out3, unsigned char *out4, unsigned char *out5, unsigned char *out6, unsigned char *out7, unsigned char *out8, unsigned char *out9, unsigned char *out10, unsigned char *out11, unsigned char *out12, unsigned char *out13, unsigned char *out14, unsigned char *out15)

| Deprecated – use stp_unpack.

## Detailed Description

Bit operations.

## Function Documentation

## stp_fold()

void stp_fold | ( | const unsigned char * | line,
|  | int | single_length,
|  | unsigned char * | outbuf
| ) |  |

extern

Interleave a buffer consisting of two bit strings of length single_length into one string of packed two-bit ints.

Parameters

  line | the input bit string
  single_length | the length (in bytes) of the input
  outbuf | the output.

## stp_fold_3bit()

void stp_fold_3bit | ( | const unsigned char * | line,
|  | int | single_length,
|  | unsigned char * | outbuf
| ) |  |

extern

Interleave a buffer consisting of three bit strings of length single_length into one string of packed three-bit ints.

Parameters

  line | the input bit string
  single_length | the length (in bytes) of the input
  outbuf | the output.

## stp_fold_3bit_323()

void stp_fold_3bit_323 | ( | const unsigned char * | line,
|  | int | single_length,
|  | unsigned char * | outbuf
| ) |  |

extern

Interleave a buffer consisting of three bit strings of length single_length into one string of packed three-bit ints.

Parameters

  line | the input bit string
  single_length | the length (in bytes) of the input
  outbuf | the output.

## stp_fold_4bit()

void stp_fold_4bit | ( | const unsigned char * | line,
|  | int | single_length,
|  | unsigned char * | outbuf
| ) |  |

extern

Interleave a buffer consisting of four bit strings of length single_length into one string of packed four-bit ints.

Parameters

  line | the input bit string
  single_length | the length (in bytes) of the input
  outbuf | the output.

## stp_fold_8bit()

void stp_fold_8bit | ( | const unsigned char * | line,
|  | int | single_length,
|  | unsigned char * | outbuf
| ) |  |

extern

Interleave a buffer consisting of eight bit strings of length single_length into one string of packed eight-bit ints.

Parameters

  line | the input bit string
  single_length | the length (in bytes) of the input
  outbuf | the output.

## stp_split()

void stp_split | ( | int | height,
|  | int | bits,
|  | int | n,
|  | const unsigned char * | in,
|  | int | stride,
|  | unsigned char ** | outs
| ) |  |

extern

Split an input sequence of packed 1 or 2 bit integers into two or more outputs of equal length, distributing non-zero integers round robin into each output.

Used in "high quality" modes when extra passes are made, to ensure that each pass gets an equal number of ink drops. Each output is as long as the input.

Parameters

  height | the number of integers in the input divided by 8
  bits | the bit depth (1 or 2)
  n | the number of outputs into which the input should be distributed
  in | the input bit string
  stride | the stride across the outputs (if it's necessary to distribute the input over non-contiguous members of the array of outputs)
  outs | the array of output bit strings

## stp_split_2()

void stp_split_2 | ( | int | height,
|  | int | bits,
|  | const unsigned char * | in,
|  | unsigned char * | outhi,
|  | unsigned char * | outlo
| ) |  |

extern

Deprecated – use stp_split.

## stp_split_4()

void stp_split_4 | ( | int | height,
|  | int | bits,
|  | const unsigned char * | in,
|  | unsigned char * | out0,
|  | unsigned char * | out1,
|  | unsigned char * | out2,
|  | unsigned char * | out3
| ) |  |

extern

Deprecated – use stp_split.

## stp_unpack()

void stp_unpack | ( | int | height,
|  | int | bits,
|  | int | n,
|  | const unsigned char * | in,
|  | unsigned char ** | outs
| ) |  |

extern

Unpack an input sequence of packed 1 or 2 bit integers into two or more outputs of equal length.

The input is round robined into the outputs. Each output is 1/n as long as the input.

Parameters

  height | the number of integers in the input divided by 8
  bits | the bit depth (1 or 2)
  n | the number of outputs into which the input should be distributed
  in | the input bit string
  outs | the array of output bit strings

## stp_unpack_16()

void stp_unpack_16 | ( | int | height,
|  | int | bits,
|  | const unsigned char * | in,
|  | unsigned char * | out0,
|  | unsigned char * | out1,
|  | unsigned char * | out2,
|  | unsigned char * | out3,
|  | unsigned char * | out4,
|  | unsigned char * | out5,
|  | unsigned char * | out6,
|  | unsigned char * | out7,
|  | unsigned char * | out8,
|  | unsigned char * | out9,
|  | unsigned char * | out10,
|  | unsigned char * | out11,
|  | unsigned char * | out12,
|  | unsigned char * | out13,
|  | unsigned char * | out14,
|  | unsigned char * | out15
| ) |  |

extern

Deprecated – use stp_unpack.

## stp_unpack_2()

void stp_unpack_2 | ( | int | height,
|  | int | bits,
|  | const unsigned char * | in,
|  | unsigned char * | outlo,
|  | unsigned char * | outhi
| ) |  |

extern

Deprecated – use stp_unpack.

## stp_unpack_4()

void stp_unpack_4 | ( | int | height,
|  | int | bits,
|  | const unsigned char * | in,
|  | unsigned char * | out0,
|  | unsigned char * | out1,
|  | unsigned char * | out2,
|  | unsigned char * | out3
| ) |  |

extern

Deprecated – use stp_unpack.

## stp_unpack_8()

void stp_unpack_8 | ( | int | height,
|  | int | bits,
|  | const unsigned char * | in,
|  | unsigned char * | out0,
|  | unsigned char * | out1,
|  | unsigned char * | out2,
|  | unsigned char * | out3,
|  | unsigned char * | out4,
|  | unsigned char * | out5,
|  | unsigned char * | out6,
|  | unsigned char * | out7
| ) |  |

extern

Deprecated – use stp_unpack.