Main MRPT website > C++ reference for MRPT 1.5.7
Classes | Macros | Typedefs | Functions
jquant2.cpp File Reference
#include "jinclude.h"
#include "mrpt_jpeglib.h"
#include <mrpt/utils/mrpt_macros.h>
Include dependency graph for jquant2.cpp:

Go to the source code of this file.

Classes

struct  my_cquantizer
 
struct  box
 

Macros

#define JPEG_INTERNALS
 
#define R_SCALE   2 /* scale R distances by this much */
 
#define G_SCALE   3 /* scale G distances by this much */
 
#define B_SCALE   1 /* and B by this much */
 
#define C0_SCALE   R_SCALE
 
#define C1_SCALE   G_SCALE
 
#define C2_SCALE   B_SCALE
 
#define MAXNUMCOLORS   (MAXJSAMPLE+1) /* maximum size of colormap */
 
#define HIST_C0_BITS   5 /* bits of precision in R/B histogram */
 
#define HIST_C1_BITS   6 /* bits of precision in G histogram */
 
#define HIST_C2_BITS   5 /* bits of precision in B/R histogram */
 
#define HIST_C0_ELEMS   (1<<HIST_C0_BITS)
 
#define HIST_C1_ELEMS   (1<<HIST_C1_BITS)
 
#define HIST_C2_ELEMS   (1<<HIST_C2_BITS)
 
#define C0_SHIFT   (BITS_IN_JSAMPLE-HIST_C0_BITS)
 
#define C1_SHIFT   (BITS_IN_JSAMPLE-HIST_C1_BITS)
 
#define C2_SHIFT   (BITS_IN_JSAMPLE-HIST_C2_BITS)
 
#define BOX_C0_LOG   (HIST_C0_BITS-3)
 
#define BOX_C1_LOG   (HIST_C1_BITS-3)
 
#define BOX_C2_LOG   (HIST_C2_BITS-3)
 
#define BOX_C0_ELEMS   (1<<BOX_C0_LOG) /* # of hist cells in update box */
 
#define BOX_C1_ELEMS   (1<<BOX_C1_LOG)
 
#define BOX_C2_ELEMS   (1<<BOX_C2_LOG)
 
#define BOX_C0_SHIFT   (C0_SHIFT + BOX_C0_LOG)
 
#define BOX_C1_SHIFT   (C1_SHIFT + BOX_C1_LOG)
 
#define BOX_C2_SHIFT   (C2_SHIFT + BOX_C2_LOG)
 
#define STEP_C0   ((1 << C0_SHIFT) * C0_SCALE)
 
#define STEP_C1   ((1 << C1_SHIFT) * C1_SCALE)
 
#define STEP_C2   ((1 << C2_SHIFT) * C2_SCALE)
 
#define STEPSIZE   ((MAXJSAMPLE+1)/16)
 

Typedefs

typedef UINT16 histcell
 
typedef histcell FARhistptr
 
typedef histcell hist1d[HIST_C2_ELEMS]
 
typedef hist1d FARhist2d
 
typedef hist2dhist3d
 
typedef INT16 FSERROR
 
typedef int LOCFSERROR
 
typedef FSERROR FARFSERRPTR
 
typedef my_cquantizermy_cquantize_ptr
 
typedef boxboxptr
 

Functions

 prescan_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows)
 
 find_biggest_color_pop (boxptr boxlist, int numboxes)
 
 find_biggest_volume (boxptr boxlist, int numboxes)
 
 update_box (j_decompress_ptr cinfo, boxptr boxp)
 
 median_cut (j_decompress_ptr cinfo, boxptr boxlist, int numboxes, int desired_colors)
 
 compute_color (j_decompress_ptr cinfo, boxptr boxp, int icolor)
 
 select_colors (j_decompress_ptr cinfo, int desired_colors)
 
 find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2, JSAMPLE colorlist[])
 
 find_best_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2, int numcolors, JSAMPLE colorlist[], JSAMPLE bestcolor[])
 
 fill_inverse_cmap (j_decompress_ptr cinfo, int c0, int c1, int c2)
 
 pass2_no_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows)
 
 pass2_fs_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows)
 
 init_error_limit (j_decompress_ptr cinfo)
 
 finish_pass1 (j_decompress_ptr cinfo)
 
 finish_pass2 (j_decompress_ptr)
 
 start_pass_2_quant (j_decompress_ptr cinfo, boolean is_pre_scan)
 
 new_color_map_2_quant (j_decompress_ptr cinfo)
 
 jinit_2pass_quantizer (j_decompress_ptr cinfo)
 

Macro Definition Documentation

◆ B_SCALE

#define B_SCALE   1 /* and B by this much */

Definition at line 66 of file jquant2.cpp.

◆ BOX_C0_ELEMS

#define BOX_C0_ELEMS   (1<<BOX_C0_LOG) /* # of hist cells in update box */

Definition at line 620 of file jquant2.cpp.

Referenced by fill_inverse_cmap(), and find_best_colors().

◆ BOX_C0_LOG

#define BOX_C0_LOG   (HIST_C0_BITS-3)

Definition at line 616 of file jquant2.cpp.

Referenced by fill_inverse_cmap().

◆ BOX_C0_SHIFT

#define BOX_C0_SHIFT   (C0_SHIFT + BOX_C0_LOG)

Definition at line 624 of file jquant2.cpp.

Referenced by fill_inverse_cmap(), and find_nearby_colors().

◆ BOX_C1_ELEMS

#define BOX_C1_ELEMS   (1<<BOX_C1_LOG)

Definition at line 621 of file jquant2.cpp.

Referenced by fill_inverse_cmap(), and find_best_colors().

◆ BOX_C1_LOG

#define BOX_C1_LOG   (HIST_C1_BITS-3)

Definition at line 617 of file jquant2.cpp.

Referenced by fill_inverse_cmap().

◆ BOX_C1_SHIFT

#define BOX_C1_SHIFT   (C1_SHIFT + BOX_C1_LOG)

Definition at line 625 of file jquant2.cpp.

Referenced by find_nearby_colors().

◆ BOX_C2_ELEMS

#define BOX_C2_ELEMS   (1<<BOX_C2_LOG)

Definition at line 622 of file jquant2.cpp.

Referenced by fill_inverse_cmap(), and find_best_colors().

◆ BOX_C2_LOG

#define BOX_C2_LOG   (HIST_C2_BITS-3)

Definition at line 618 of file jquant2.cpp.

Referenced by fill_inverse_cmap().

◆ BOX_C2_SHIFT

#define BOX_C2_SHIFT   (C2_SHIFT + BOX_C2_LOG)

Definition at line 626 of file jquant2.cpp.

Referenced by find_nearby_colors().

◆ C0_SCALE

#define C0_SCALE   R_SCALE

Definition at line 76 of file jquant2.cpp.

Referenced by find_best_colors(), find_nearby_colors(), median_cut(), and update_box().

◆ C0_SHIFT

#define C0_SHIFT   (BITS_IN_JSAMPLE-HIST_C0_BITS)

◆ C1_SCALE

#define C1_SCALE   G_SCALE

Definition at line 82 of file jquant2.cpp.

Referenced by find_best_colors(), find_nearby_colors(), median_cut(), and update_box().

◆ C1_SHIFT

#define C1_SHIFT   (BITS_IN_JSAMPLE-HIST_C1_BITS)

◆ C2_SCALE

#define C2_SCALE   B_SCALE

Definition at line 88 of file jquant2.cpp.

Referenced by find_best_colors(), find_nearby_colors(), median_cut(), and update_box().

◆ C2_SHIFT

#define C2_SHIFT   (BITS_IN_JSAMPLE-HIST_C2_BITS)

◆ G_SCALE

#define G_SCALE   3 /* scale G distances by this much */

Definition at line 65 of file jquant2.cpp.

◆ HIST_C0_BITS

#define HIST_C0_BITS   5 /* bits of precision in R/B histogram */

Definition at line 123 of file jquant2.cpp.

◆ HIST_C0_ELEMS

#define HIST_C0_ELEMS   (1<<HIST_C0_BITS)

Definition at line 128 of file jquant2.cpp.

Referenced by jinit_2pass_quantizer(), and start_pass_2_quant().

◆ HIST_C1_BITS

#define HIST_C1_BITS   6 /* bits of precision in G histogram */

Definition at line 124 of file jquant2.cpp.

◆ HIST_C1_ELEMS

#define HIST_C1_ELEMS   (1<<HIST_C1_BITS)

Definition at line 129 of file jquant2.cpp.

Referenced by jinit_2pass_quantizer(), and start_pass_2_quant().

◆ HIST_C2_BITS

#define HIST_C2_BITS   5 /* bits of precision in B/R histogram */

Definition at line 125 of file jquant2.cpp.

◆ HIST_C2_ELEMS

#define HIST_C2_ELEMS   (1<<HIST_C2_BITS)

Definition at line 130 of file jquant2.cpp.

Referenced by jinit_2pass_quantizer(), start_pass_2_quant(), and update_box().

◆ JPEG_INTERNALS

#define JPEG_INTERNALS

Definition at line 10 of file jquant2.cpp.

◆ MAXNUMCOLORS

#define MAXNUMCOLORS   (MAXJSAMPLE+1) /* maximum size of colormap */

◆ R_SCALE

#define R_SCALE   2 /* scale R distances by this much */

Definition at line 64 of file jquant2.cpp.

◆ STEP_C0

#define STEP_C0   ((1 << C0_SHIFT) * C0_SCALE)

Referenced by find_best_colors().

◆ STEP_C1

#define STEP_C1   ((1 << C1_SHIFT) * C1_SCALE)

Referenced by find_best_colors().

◆ STEP_C2

#define STEP_C2   ((1 << C2_SHIFT) * C2_SCALE)

Referenced by find_best_colors().

◆ STEPSIZE

#define STEPSIZE   ((MAXJSAMPLE+1)/16)

Referenced by init_error_limit().

Typedef Documentation

◆ boxptr

typedef box* boxptr

Definition at line 261 of file jquant2.cpp.

◆ FSERROR

typedef INT16 FSERROR

Definition at line 172 of file jquant2.cpp.

◆ FSERRPTR

typedef FSERROR FAR* FSERRPTR

Definition at line 179 of file jquant2.cpp.

◆ hist1d

typedef histcell hist1d[HIST_C2_ELEMS]

Definition at line 142 of file jquant2.cpp.

◆ hist2d

typedef hist1d FAR* hist2d

Definition at line 143 of file jquant2.cpp.

◆ hist3d

typedef hist2d* hist3d

Definition at line 144 of file jquant2.cpp.

◆ histcell

typedef UINT16 histcell

Definition at line 138 of file jquant2.cpp.

◆ histptr

typedef histcell FAR* histptr

Definition at line 140 of file jquant2.cpp.

◆ LOCFSERROR

typedef int LOCFSERROR

Definition at line 173 of file jquant2.cpp.

◆ my_cquantize_ptr

Definition at line 202 of file jquant2.cpp.

Function Documentation

◆ compute_color()

compute_color ( j_decompress_ptr  cinfo,
boxptr  boxp,
int  icolor 
)

Definition at line 491 of file jquant2.cpp.

References mrpt::math::histogram(), and my_cquantizer::histogram.

Referenced by select_colors().

◆ fill_inverse_cmap()

fill_inverse_cmap ( j_decompress_ptr  cinfo,
int  c0,
int  c1,
int  c2 
)

◆ find_best_colors()

find_best_colors ( j_decompress_ptr  cinfo,
int  minc0,
int  minc1,
int  minc2,
int  numcolors,
JSAMPLE  colorlist[],
JSAMPLE  bestcolor[] 
)

◆ find_biggest_color_pop()

find_biggest_color_pop ( boxptr  boxlist,
int  numboxes 
)

Definition at line 265 of file jquant2.cpp.

References box::colorcount, and box::volume.

Referenced by median_cut().

◆ find_biggest_volume()

find_biggest_volume ( boxptr  boxlist,
int  numboxes 
)

Definition at line 285 of file jquant2.cpp.

References box::volume.

Referenced by median_cut().

◆ find_nearby_colors()

find_nearby_colors ( j_decompress_ptr  cinfo,
int  minc0,
int  minc1,
int  minc2,
JSAMPLE  colorlist[] 
)

◆ finish_pass1()

finish_pass1 ( j_decompress_ptr  cinfo)

◆ finish_pass2()

finish_pass2 ( j_decompress_ptr  )

Definition at line 1148 of file jquant2.cpp.

Referenced by start_pass_2_quant().

◆ init_error_limit()

init_error_limit ( j_decompress_ptr  cinfo)

◆ jinit_2pass_quantizer()

jinit_2pass_quantizer ( j_decompress_ptr  cinfo)

◆ median_cut()

median_cut ( j_decompress_ptr  cinfo,
boxptr  boxlist,
int  numboxes,
int  desired_colors 
)

◆ new_color_map_2_quant()

new_color_map_2_quant ( j_decompress_ptr  cinfo)

Definition at line 1222 of file jquant2.cpp.

References my_cquantizer::needs_zeroed, and TRUE.

Referenced by jinit_2pass_quantizer().

◆ pass2_fs_dither()

pass2_fs_dither ( j_decompress_ptr  cinfo,
JSAMPARRAY  input_buf,
JSAMPARRAY  output_buf,
int  num_rows 
)

◆ pass2_no_dither()

pass2_no_dither ( j_decompress_ptr  cinfo,
JSAMPARRAY  input_buf,
JSAMPARRAY  output_buf,
int  num_rows 
)

◆ prescan_quantize()

prescan_quantize ( j_decompress_ptr  cinfo,
JSAMPARRAY  input_buf,
JSAMPARRAY  output_buf,
int  num_rows 
)

◆ select_colors()

select_colors ( j_decompress_ptr  cinfo,
int  desired_colors 
)

◆ start_pass_2_quant()

start_pass_2_quant ( j_decompress_ptr  cinfo,
boolean  is_pre_scan 
)

◆ update_box()

update_box ( j_decompress_ptr  cinfo,
boxptr  boxp 
)



Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019