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)  

jquant1.c File Reference
#include "jinclude.h"
#include "jpeglib.h"
Include dependency graph for jquant1.c:

Go to the source code of this file.

Classes

struct  my_cquantizer
 

Macros

#define JPEG_INTERNALS
 
#define ODITHER_SIZE   16 /* dimension of dither matrix */
 
#define ODITHER_CELLS   (ODITHER_SIZE*ODITHER_SIZE) /* # cells in matrix */
 
#define ODITHER_MASK   (ODITHER_SIZE-1) /* mask for wrapping around counters */
 
#define MAX_Q_COMPS   4 /* max components I can handle */
 

Typedefs

typedef int ODITHER_MATRIX[16][16]
 
typedef int(* ODITHER_MATRIX_PTR)[16]
 
typedef INT16 FSERROR
 
typedef int LOCFSERROR
 
typedef FSERRORFSERRPTR
 
typedef my_cquantizermy_cquantize_ptr
 

Functions

static int select_ncolors (j_decompress_ptr cinfo, int Ncolors[])
 
static int output_value (j_decompress_ptr cinfo, int ci, int j, int maxj)
 
static int largest_input_value (j_decompress_ptr cinfo, int ci, int j, int maxj)
 
static void create_colormap (j_decompress_ptr cinfo)
 
static void create_colorindex (j_decompress_ptr cinfo)
 
static ODITHER_MATRIX_PTR make_odither_array (j_decompress_ptr cinfo, int ncolors)
 
static void create_odither_tables (j_decompress_ptr cinfo)
 
static void color_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows)
 
static void color_quantize3 (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows)
 
static void quantize_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows)
 
static void quantize3_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows)
 
static void quantize_fs_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows)
 
static void alloc_fs_workspace (j_decompress_ptr cinfo)
 
static void start_pass_1_quant (j_decompress_ptr cinfo, boolean is_pre_scan)
 
static void finish_pass_1_quant (j_decompress_ptr cinfo)
 
static void new_color_map_1_quant (j_decompress_ptr cinfo)
 
void jinit_1pass_quantizer (j_decompress_ptr cinfo)
 

Variables

static const UINT8 base_dither_matrix [16][16]
 

Macro Definition Documentation

◆ JPEG_INTERNALS

#define JPEG_INTERNALS

Definition at line 13 of file jquant1.c.

◆ MAX_Q_COMPS

#define MAX_Q_COMPS   4 /* max components I can handle */

Definition at line 140 of file jquant1.c.

◆ ODITHER_CELLS

#define ODITHER_CELLS   (ODITHER_SIZE*ODITHER_SIZE) /* # cells in matrix */

Definition at line 73 of file jquant1.c.

◆ ODITHER_MASK

#define ODITHER_MASK   (ODITHER_SIZE-1) /* mask for wrapping around counters */

Definition at line 74 of file jquant1.c.

◆ ODITHER_SIZE

#define ODITHER_SIZE   16 /* dimension of dither matrix */

Definition at line 71 of file jquant1.c.

Typedef Documentation

◆ FSERROR

typedef INT16 FSERROR

Definition at line 128 of file jquant1.c.

◆ FSERRPTR

typedef FSERROR* FSERRPTR

Definition at line 135 of file jquant1.c.

◆ LOCFSERROR

typedef int LOCFSERROR

Definition at line 129 of file jquant1.c.

◆ my_cquantize_ptr

Definition at line 167 of file jquant1.c.

◆ ODITHER_MATRIX

typedef int ODITHER_MATRIX[16][16]

Definition at line 76 of file jquant1.c.

◆ ODITHER_MATRIX_PTR

typedef int(* ODITHER_MATRIX_PTR)[16]

Definition at line 77 of file jquant1.c.

Function Documentation

◆ alloc_fs_workspace()

static void alloc_fs_workspace ( j_decompress_ptr  cinfo)
static

Definition at line 722 of file jquant1.c.

References my_cquantizer::fserrors, i, JPOOL_IMAGE, and SIZEOF.

Referenced by start_pass_1_quant().

◆ color_quantize()

static void color_quantize ( j_decompress_ptr  cinfo,
JSAMPARRAY  input_buf,
JSAMPARRAY  output_buf,
int  num_rows 
)
static

Definition at line 459 of file jquant1.c.

References col, my_cquantizer::colorindex, for(), GETJSAMPLE, input_buf, JSAMPLE, num_rows, output_buf, row, and width.

Referenced by start_pass_1_quant().

◆ color_quantize3()

static void color_quantize3 ( j_decompress_ptr  cinfo,
JSAMPARRAY  input_buf,
JSAMPARRAY  output_buf,
int  num_rows 
)
static

Definition at line 487 of file jquant1.c.

References col, my_cquantizer::colorindex, for(), GETJSAMPLE, input_buf, JSAMPLE, num_rows, output_buf, row, and width.

Referenced by start_pass_1_quant().

◆ create_colorindex()

◆ create_colormap()

◆ create_odither_tables()

static void create_odither_tables ( j_decompress_ptr  cinfo)
static

Definition at line 432 of file jquant1.c.

References for(), i, j, make_odither_array(), my_cquantizer::Ncolors, NULL, and my_cquantizer::odither.

Referenced by start_pass_1_quant().

◆ finish_pass_1_quant()

static void finish_pass_1_quant ( j_decompress_ptr  cinfo)
static

Definition at line 798 of file jquant1.c.

◆ jinit_1pass_quantizer()

void jinit_1pass_quantizer ( j_decompress_ptr  cinfo)

Definition at line 821 of file jquant1.c.

Referenced by master_selection().

◆ largest_input_value()

static int largest_input_value ( j_decompress_ptr  cinfo,
int  ci,
int  j,
int  maxj 
)
static

Definition at line 259 of file jquant1.c.

References INT32, j, and MAXJSAMPLE.

Referenced by create_colorindex().

◆ make_odither_array()

static ODITHER_MATRIX_PTR make_odither_array ( j_decompress_ptr  cinfo,
int  ncolors 
)
static

Definition at line 396 of file jquant1.c.

References base_dither_matrix, den, int(), INT32, j, JPOOL_IMAGE, k, MAXJSAMPLE, num, ODITHER_CELLS, ODITHER_SIZE, and SIZEOF.

Referenced by create_odither_tables().

◆ new_color_map_1_quant()

static void new_color_map_1_quant ( j_decompress_ptr  cinfo)
static

Definition at line 810 of file jquant1.c.

References ERREXIT, and JERR_MODE_CHANGE.

◆ output_value()

static int output_value ( j_decompress_ptr  cinfo,
int  ci,
int  j,
int  maxj 
)
static

Definition at line 245 of file jquant1.c.

References INT32, j, and MAXJSAMPLE.

Referenced by create_colormap().

◆ quantize3_ord_dither()

static void quantize3_ord_dither ( j_decompress_ptr  cinfo,
JSAMPARRAY  input_buf,
JSAMPARRAY  output_buf,
int  num_rows 
)
static

◆ quantize_fs_dither()

◆ quantize_ord_dither()

static void quantize_ord_dither ( j_decompress_ptr  cinfo,
JSAMPARRAY  input_buf,
JSAMPARRAY  output_buf,
int  num_rows 
)
static

◆ select_ncolors()

static int select_ncolors ( j_decompress_ptr  cinfo,
int  Ncolors[] 
)
static

Definition at line 186 of file jquant1.c.

References changed, ERREXIT1, FALSE, i, int(), j, JCS_RGB, JERR_QUANT_FEW_COLORS, RGB_BLUE, RGB_GREEN, RGB_RED, temp, and TRUE.

Referenced by create_colormap().

◆ start_pass_1_quant()

Variable Documentation

◆ base_dither_matrix

const UINT8 base_dither_matrix[16][16]
static
Initial value:
= {
{ 0,192, 48,240, 12,204, 60,252, 3,195, 51,243, 15,207, 63,255 },
{ 128, 64,176,112,140, 76,188,124,131, 67,179,115,143, 79,191,127 },
{ 32,224, 16,208, 44,236, 28,220, 35,227, 19,211, 47,239, 31,223 },
{ 160, 96,144, 80,172,108,156, 92,163, 99,147, 83,175,111,159, 95 },
{ 8,200, 56,248, 4,196, 52,244, 11,203, 59,251, 7,199, 55,247 },
{ 136, 72,184,120,132, 68,180,116,139, 75,187,123,135, 71,183,119 },
{ 40,232, 24,216, 36,228, 20,212, 43,235, 27,219, 39,231, 23,215 },
{ 168,104,152, 88,164,100,148, 84,171,107,155, 91,167,103,151, 87 },
{ 2,194, 50,242, 14,206, 62,254, 1,193, 49,241, 13,205, 61,253 },
{ 130, 66,178,114,142, 78,190,126,129, 65,177,113,141, 77,189,125 },
{ 34,226, 18,210, 46,238, 30,222, 33,225, 17,209, 45,237, 29,221 },
{ 162, 98,146, 82,174,110,158, 94,161, 97,145, 81,173,109,157, 93 },
{ 10,202, 58,250, 6,198, 54,246, 9,201, 57,249, 5,197, 53,245 },
{ 138, 74,186,122,134, 70,182,118,137, 73,185,121,133, 69,181,117 },
{ 42,234, 26,218, 38,230, 22,214, 41,233, 25,217, 37,229, 21,213 },
{ 170,106,154, 90,166,102,150, 86,169,105,153, 89,165,101,149, 85 }
}

Definition at line 79 of file jquant1.c.

Referenced by make_odither_array().