w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

jbig2arith.cc File Reference
#include "jbig2arith.h"
#include <string.h>
#include <stdio.h>
#include <sys/time.h>
Include dependency graph for jbig2arith.cc:

Go to the source code of this file.

Classes

struct  context
 
struct  intencrange_s
 

Macros

#define u64   uint64_t
 
#define u32   uint32_t
 
#define u16   uint16_t
 
#define u8   uint8_t
 
#define restrict   __restrict__
 
#define STATETABLE
 
#define F(x)   x
 
#define SWITCH(x)   (x + 46)
 
#define F(x)   (x + 46)
 
#define SWITCH(x)   ((x) - 46)
 
#define likely(x)   x
 
#define unlikely(x)   x
 
#define TPGDCTX   0x9b25
 

Functions

void jbig2enc_init (struct jbig2enc_ctx *ctx)
 
void jbig2enc_reset (struct jbig2enc_ctx *ctx)
 
void jbig2enc_flush (struct jbig2enc_ctx *ctx)
 
void jbig2enc_dealloc (struct jbig2enc_ctx *ctx)
 
static void emit (struct jbig2enc_ctx *__restrict__ ctx)
 
static void byteout (struct jbig2enc_ctx *__restrict__ ctx)
 
static void encode_bit (struct jbig2enc_ctx *__restrict__ ctx, uint8_t *__restrict__ context, uint32_t ctxnum, uint8_t d)
 
static void encode_final (struct jbig2enc_ctx *__restrict__ ctx)
 
void jbig2enc_final (struct jbig2enc_ctx *__restrict__ ctx)
 
void jbig2enc_oob (struct jbig2enc_ctx *__restrict__ ctx, int proc)
 
void jbig2enc_int (struct jbig2enc_ctx *__restrict__ ctx, int proc, int value)
 
void jbig2enc_iaid (struct jbig2enc_ctx *__restrict__ ctx, int symcodelen, int value)
 
static uint8_t image_get (const uint8_t *__restrict__ image, int x, int y, int mx, int my)
 
unsigned jbig2enc_datasize (const struct jbig2enc_ctx *ctx)
 
void jbig2enc_tobuffer (const struct jbig2enc_ctx *__restrict__ ctx, uint8_t *__restrict__ buffer)
 
void jbig2enc_bitimage (struct jbig2enc_ctx *__restrict__ ctx, const uint8_t *__restrict__ idata, int mx, int my, bool duplicate_line_removal)
 
void jbig2enc_refine (struct jbig2enc_ctx *__restrict__ ctx, const uint8_t *__restrict__ itempl, int tx, int ty, const uint8_t *__restrict__ itarget, int mx, int my, int ox, int oy)
 
void jbig2enc_image (struct jbig2enc_ctx *__restrict__ ctx, const uint8_t *__restrict__ data, int mx, int my, bool duplicate_line_removal)
 

Variables

struct context ctbl []
 
static struct intencrange_s intencrange []
 
static const uint8_t input []
 

Macro Definition Documentation

◆ F [1/2]

#define F (   x)    x

◆ F [2/2]

#define F (   x)    (x + 46)

◆ likely

#define likely (   x)    x

Definition at line 115 of file jbig2arith.cc.

◆ restrict

#define restrict   __restrict__

Definition at line 29 of file jbig2arith.cc.

◆ STATETABLE

#define STATETABLE

◆ SWITCH [1/2]

#define SWITCH (   x)    (x + 46)

◆ SWITCH [2/2]

#define SWITCH (   x)    ((x) - 46)

◆ TPGDCTX

#define TPGDCTX   0x9b25

Definition at line 461 of file jbig2arith.cc.

◆ u16

#define u16   uint16_t

Definition at line 25 of file jbig2arith.cc.

◆ u32

#define u32   uint32_t

Definition at line 24 of file jbig2arith.cc.

◆ u64

#define u64   uint64_t

Definition at line 23 of file jbig2arith.cc.

◆ u8

#define u8   uint8_t

Definition at line 26 of file jbig2arith.cc.

◆ unlikely

#define unlikely (   x)    x

Definition at line 116 of file jbig2arith.cc.

Function Documentation

◆ byteout()

static void byteout ( struct jbig2enc_ctx *__restrict__  ctx)
static

Definition at line 193 of file jbig2arith.cc.

References emit(), and printf().

Referenced by encode_bit(), and encode_final().

◆ emit()

◆ encode_bit()

static void encode_bit ( struct jbig2enc_ctx *__restrict__  ctx,
uint8_t *__restrict__  context,
uint32_t  ctxnum,
uint8_t  d 
)
static

◆ encode_final()

static void encode_final ( struct jbig2enc_ctx *__restrict__  ctx)
static

Definition at line 286 of file jbig2arith.cc.

References byteout(), emit(), printf(), and u32.

◆ image_get()

static uint8_t image_get ( const uint8_t *__restrict__  image,
int  x,
int  y,
int  mx,
int  my 
)
static

Definition at line 434 of file jbig2arith.cc.

References mx, cordic::x, and y.

Referenced by jbig2enc_image().

◆ jbig2enc_bitimage()

void jbig2enc_bitimage ( struct jbig2enc_ctx *__restrict__  ctx,
const uint8_t *__restrict__  idata,
int  mx,
int  my,
bool  duplicate_line_removal 
)

Definition at line 468 of file jbig2arith.cc.

References c1, c2, data, encode_bit(), m, memcmp, mx, restrict, TPGDCTX, u16, u32, u8, v, w1, w2, w3, cordic::x, and y.

Referenced by jbig2_encode_generic(), and jbig2enc_symboltable().

◆ jbig2enc_datasize()

unsigned jbig2enc_datasize ( const struct jbig2enc_ctx ctx)

◆ jbig2enc_dealloc()

void jbig2enc_dealloc ( struct jbig2enc_ctx ctx)

◆ jbig2enc_final()

void jbig2enc_final ( struct jbig2enc_ctx *__restrict__  ctx)

Definition at line 315 of file jbig2arith.cc.

Referenced by jbig2_encode_generic(), jbig2enc_symboltable(), and jbig2enc_textregion().

◆ jbig2enc_flush()

void jbig2enc_flush ( struct jbig2enc_ctx ctx)

◆ jbig2enc_iaid()

void jbig2enc_iaid ( struct jbig2enc_ctx *__restrict__  ctx,
int  symcodelen,
int  value 
)

Definition at line 406 of file jbig2arith.cc.

References encode_bit(), i, malloc, mask, memset(), prev, u32, u8, and v.

Referenced by jbig2enc_textregion().

◆ jbig2enc_image()

void jbig2enc_image ( struct jbig2enc_ctx *__restrict__  ctx,
const uint8_t *__restrict__  data,
int  mx,
int  my,
bool  duplicate_line_removal 
)

Definition at line 716 of file jbig2arith.cc.

References c1, c2, data, encode_bit(), image_get(), memcmp, mx, TPGDCTX, u16, u8, v, cordic::x, and y.

◆ jbig2enc_init()

◆ jbig2enc_int()

void jbig2enc_int ( struct jbig2enc_ctx *__restrict__  ctx,
int  proc,
int  value 
)

◆ jbig2enc_oob()

void jbig2enc_oob ( struct jbig2enc_ctx *__restrict__  ctx,
int  proc 
)

Definition at line 350 of file jbig2arith.cc.

References encode_bit(), and u8.

Referenced by jbig2enc_symboltable(), and jbig2enc_textregion().

◆ jbig2enc_refine()

void jbig2enc_refine ( struct jbig2enc_ctx *__restrict__  ctx,
const uint8_t *__restrict__  itempl,
int  tx,
int  ty,
const uint8_t *__restrict__  itarget,
int  mx,
int  my,
int  ox,
int  oy 
)

Definition at line 575 of file jbig2arith.cc.

References c1, c2, data, encode_bit(), fprintf, m, mx, restrict, u16, u32, u8, v, w1, w2, w3, w4, w5, cordic::x, and y.

Referenced by jbig2enc_textregion().

◆ jbig2enc_reset()

◆ jbig2enc_tobuffer()

void jbig2enc_tobuffer ( const struct jbig2enc_ctx *__restrict__  ctx,
uint8_t *__restrict__  buffer 
)

Definition at line 449 of file jbig2arith.cc.

References i, j, JBIG2_OUTPUTBUFFER_SIZE, and memcpy.

Referenced by jbig2_encode_generic(), jbig2_pages_complete(), and jbig2_produce_page().

Variable Documentation

◆ ctbl

struct context ctbl[]

Definition at line 1 of file jbig2arith.cc.

Referenced by encode_bit().

◆ input

const uint8_t input[] ( void  )
static
Initial value:
= { 0, 2, 0, 0x51, 0, 0, 0, 0xc0, 0x03, 0x52, 0x87,
0x2a, 0xaa, 0xaa, 0xaa, 0xaa, 0x82, 0xc0, 0x20, 0, 0xfc, 0xd7, 0x9e, 0xf6,
0xbf, 0x7f, 0xed, 0x90, 0x4f, 0x46, 0xa3, 0xbf }

Definition at line 426 of file jbig2arith.cc.

◆ intencrange

struct intencrange_s intencrange[]
static
Initial value:
= {
{0, 3, 0, 2, 0, 2},
{-1, -1, 9, 4, 0, 0},
{-3, -2, 5, 3, 2, 1},
{4, 19, 2, 3, 4, 4},
{-19,-4, 3, 3, 4, 4},
{20, 83, 6, 4, 20, 6},
{-83,-20, 7, 4, 20, 6},
{84, 339, 14,5, 84, 8},
{-339,-84,15,5, 84, 8},
{340,4435,30,6, 340, 12},
{-4435,-340,31,6,340, 12},
{4436,2000000000,62,6,4436, 32},
{-2000000000,-4436,63,6,4436, 32}
}

Definition at line 315 of file jbig2arith.cc.

Referenced by jbig2enc_int().