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

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 65 of file jquant2.cpp.

◆ BOX_C0_ELEMS

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

Definition at line 664 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 660 of file jquant2.cpp.

Referenced by fill_inverse_cmap().

◆ BOX_C0_SHIFT

#define BOX_C0_SHIFT   (C0_SHIFT + BOX_C0_LOG)

Definition at line 668 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 665 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 661 of file jquant2.cpp.

Referenced by fill_inverse_cmap().

◆ BOX_C1_SHIFT

#define BOX_C1_SHIFT   (C1_SHIFT + BOX_C1_LOG)

Definition at line 669 of file jquant2.cpp.

Referenced by find_nearby_colors().

◆ BOX_C2_ELEMS

#define BOX_C2_ELEMS   (1 << BOX_C2_LOG)

Definition at line 666 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 662 of file jquant2.cpp.

Referenced by fill_inverse_cmap().

◆ BOX_C2_SHIFT

#define BOX_C2_SHIFT   (C2_SHIFT + BOX_C2_LOG)

Definition at line 670 of file jquant2.cpp.

Referenced by find_nearby_colors().

◆ C0_SCALE

#define C0_SCALE   R_SCALE

Definition at line 75 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 81 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 87 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 64 of file jquant2.cpp.

◆ HIST_C0_BITS

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

Definition at line 121 of file jquant2.cpp.

◆ HIST_C0_ELEMS

#define HIST_C0_ELEMS   (1 << HIST_C0_BITS)

Definition at line 126 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 122 of file jquant2.cpp.

◆ HIST_C1_ELEMS

#define HIST_C1_ELEMS   (1 << HIST_C1_BITS)

Definition at line 127 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 123 of file jquant2.cpp.

◆ HIST_C2_ELEMS

#define HIST_C2_ELEMS   (1 << HIST_C2_BITS)

Definition at line 128 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 63 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 259 of file jquant2.cpp.

◆ FSERROR

typedef INT16 FSERROR

Definition at line 168 of file jquant2.cpp.

◆ FSERRPTR

typedef FSERROR FAR* FSERRPTR

Definition at line 175 of file jquant2.cpp.

◆ hist1d

typedef histcell hist1d[HIST_C2_ELEMS]

Definition at line 139 of file jquant2.cpp.

◆ hist2d

typedef hist1d FAR* hist2d

Definition at line 140 of file jquant2.cpp.

◆ hist3d

typedef hist2d* hist3d

Definition at line 141 of file jquant2.cpp.

◆ histcell

typedef UINT16 histcell

Definition at line 135 of file jquant2.cpp.

◆ histptr

typedef histcell FAR* histptr

Definition at line 137 of file jquant2.cpp.

◆ LOCFSERROR

typedef int LOCFSERROR

Definition at line 169 of file jquant2.cpp.

◆ my_cquantize_ptr

Definition at line 198 of file jquant2.cpp.

Function Documentation

◆ compute_color()

compute_color ( j_decompress_ptr  cinfo,
boxptr  boxp,
int  icolor 
)

Definition at line 530 of file jquant2.cpp.

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

Referenced by select_colors().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fill_inverse_cmap()

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

Definition at line 922 of file jquant2.cpp.

References BOX_C0_ELEMS, BOX_C0_LOG, BOX_C0_SHIFT, BOX_C1_ELEMS, BOX_C1_LOG, BOX_C2_ELEMS, BOX_C2_LOG, C0_SHIFT, find_best_colors(), find_nearby_colors(), GETJSAMPLE, mrpt::math::histogram(), my_cquantizer::histogram, and MAXNUMCOLORS.

Referenced by pass2_fs_dither(), and pass2_no_dither().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_best_colors()

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

Definition at line 835 of file jquant2.cpp.

References BOX_C0_ELEMS, BOX_C1_ELEMS, BOX_C2_ELEMS, C0_SCALE, C1_SCALE, C2_SCALE, GETJSAMPLE, STEP_C0, STEP_C1, and STEP_C2.

Referenced by fill_inverse_cmap().

Here is the caller graph for this function:

◆ find_biggest_color_pop()

find_biggest_color_pop ( boxptr  boxlist,
int  numboxes 
)

Definition at line 262 of file jquant2.cpp.

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

Referenced by median_cut().

Here is the caller graph for this function:

◆ find_biggest_volume()

find_biggest_volume ( boxptr  boxlist,
int  numboxes 
)

Definition at line 283 of file jquant2.cpp.

References box::volume.

Referenced by median_cut().

Here is the caller graph for this function:

◆ find_nearby_colors()

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

Definition at line 681 of file jquant2.cpp.

References BOX_C0_SHIFT, BOX_C1_SHIFT, BOX_C2_SHIFT, C0_SCALE, C0_SHIFT, C1_SCALE, C1_SHIFT, C2_SCALE, C2_SHIFT, GETJSAMPLE, and MAXNUMCOLORS.

Referenced by fill_inverse_cmap().

Here is the caller graph for this function:

◆ finish_pass1()

finish_pass1 ( j_decompress_ptr  cinfo)

Definition at line 1232 of file jquant2.cpp.

References my_cquantizer::desired, my_cquantizer::needs_zeroed, select_colors(), my_cquantizer::sv_colormap, and TRUE.

Referenced by start_pass_2_quant().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ finish_pass2()

finish_pass2 ( j_decompress_ptr  )

Definition at line 1244 of file jquant2.cpp.

Referenced by start_pass_2_quant().

Here is the caller graph for this function:

◆ init_error_limit()

init_error_limit ( j_decompress_ptr  cinfo)

Definition at line 1192 of file jquant2.cpp.

References my_cquantizer::error_limiter, JPOOL_IMAGE, MAXJSAMPLE, SIZEOF, and STEPSIZE.

Referenced by jinit_2pass_quantizer(), and start_pass_2_quant().

Here is the caller graph for this function:

◆ 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 
)

Definition at line 431 of file jquant2.cpp.

References mrpt::obs::gnss::b1, mrpt::obs::gnss::b2, C0_SCALE, C0_SHIFT, C1_SCALE, C1_SHIFT, C2_SCALE, C2_SHIFT, find_biggest_color_pop(), find_biggest_volume(), and update_box().

Referenced by select_colors().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ new_color_map_2_quant()

new_color_map_2_quant ( j_decompress_ptr  cinfo)

Definition at line 1315 of file jquant2.cpp.

References my_cquantizer::needs_zeroed, and TRUE.

Referenced by jinit_2pass_quantizer().

Here is the caller graph for this function:

◆ pass2_fs_dither()

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

Definition at line 1020 of file jquant2.cpp.

References C0_SHIFT, C1_SHIFT, C2_SHIFT, my_cquantizer::error_limiter, FALSE, fill_inverse_cmap(), for(), my_cquantizer::fserrors, GETJSAMPLE, mrpt::math::histogram(), my_cquantizer::histogram, inptr, my_cquantizer::on_odd_row, outptr, output_buf, range_limit, RIGHT_SHIFT, SHIFT_TEMPS, and TRUE.

Referenced by start_pass_2_quant().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pass2_no_dither()

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

Definition at line 984 of file jquant2.cpp.

References C0_SHIFT, C1_SHIFT, C2_SHIFT, fill_inverse_cmap(), for(), GETJSAMPLE, mrpt::math::histogram(), my_cquantizer::histogram, inptr, outptr, and output_buf.

Referenced by start_pass_2_quant().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ prescan_quantize()

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

Definition at line 210 of file jquant2.cpp.

References C0_SHIFT, C1_SHIFT, C2_SHIFT, for(), GETJSAMPLE, mrpt::math::histogram(), my_cquantizer::histogram, MRPT_UNUSED_PARAM, and output_buf.

Referenced by start_pass_2_quant().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ select_colors()

select_colors ( j_decompress_ptr  cinfo,
int  desired_colors 
)

Definition at line 578 of file jquant2.cpp.

References C0_SHIFT, box::c0max, box::c0min, C1_SHIFT, box::c1max, box::c1min, C2_SHIFT, box::c2max, box::c2min, compute_color(), JPOOL_IMAGE, MAXJSAMPLE, median_cut(), SIZEOF, TRACEMS1, and update_box().

Referenced by finish_pass1().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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 
)

Definition at line 304 of file jquant2.cpp.

References C0_SCALE, C0_SHIFT, C1_SCALE, C1_SHIFT, C2_SCALE, C2_SHIFT, HIST_C2_ELEMS, mrpt::math::histogram(), and my_cquantizer::histogram.

Referenced by median_cut(), and select_colors().

Here is the call graph for this function:
Here is the caller graph for this function:



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019