#include "jpge.h"
#include <stdlib.h>
#include <string.h>
#define JPGE_MAX(a,b) …
#define JPGE_MIN(a,b) …
namespace jpge {
static inline void* jpge_malloc(size_t nSize) { … }
static inline void jpge_free(void* p) { … }
enum { … };
enum { … };
static uint8 s_zag[64] = …;
static int16 s_std_lum_quant[64] = …;
static int16 s_std_croma_quant[64] = …;
static int16 s_alt_quant[64] = …;
static uint8 s_dc_lum_bits[17] = …;
static uint8 s_dc_lum_val[DC_LUM_CODES] = …;
static uint8 s_ac_lum_bits[17] = …;
static uint8 s_ac_lum_val[AC_LUM_CODES] = …;
static uint8 s_dc_chroma_bits[17] = …;
static uint8 s_dc_chroma_val[DC_CHROMA_CODES] = …;
static uint8 s_ac_chroma_bits[17] = …;
static uint8 s_ac_chroma_val[AC_CHROMA_CODES] = …;
template <class T> inline void clear_obj(T& obj) { … }
const int YR = …, YG = …, YB = …, CB_R = …, CB_G = …, CB_B = …, CR_R = …, CR_G = …, CR_B = …;
static inline uint8 clamp(int i) { … }
static inline int left_shifti(int val, uint32 bits)
{ … }
static void RGB_to_YCC(uint8* pDst, const uint8* pSrc, int num_pixels)
{ … }
static void RGB_to_Y(uint8* pDst, const uint8* pSrc, int num_pixels)
{ … }
static void RGBA_to_YCC(uint8* pDst, const uint8* pSrc, int num_pixels)
{ … }
static void RGBA_to_Y(uint8* pDst, const uint8* pSrc, int num_pixels)
{ … }
static void Y_to_YCC(uint8* pDst, const uint8* pSrc, int num_pixels)
{ … }
enum { … };
#define DCT_DESCALE(x, n) …
#define DCT_MUL(var, c) …
#define DCT1D(s0, s1, s2, s3, s4, s5, s6, s7) …
static void DCT2D(int32* p)
{ … }
struct sym_freq { … };
static inline sym_freq* radix_sort_syms(uint num_syms, sym_freq* pSyms0, sym_freq* pSyms1)
{ … }
static void calculate_minimum_redundancy(sym_freq* A, int n)
{ … }
static void huffman_enforce_max_code_size(int* pNum_codes, int code_list_len, int max_code_size)
{ … }
void jpeg_encoder::optimize_huffman_table(int table_num, int table_len)
{ … }
void jpeg_encoder::emit_byte(uint8 i)
{ … }
void jpeg_encoder::emit_word(uint i)
{ … }
void jpeg_encoder::emit_marker(int marker)
{ … }
void jpeg_encoder::emit_jfif_app0()
{ … }
void jpeg_encoder::emit_dqt()
{ … }
void jpeg_encoder::emit_sof()
{ … }
void jpeg_encoder::emit_dht(uint8* bits, uint8* val, int index, bool ac_flag)
{ … }
void jpeg_encoder::emit_dhts()
{ … }
void jpeg_encoder::emit_sos()
{ … }
void jpeg_encoder::emit_markers()
{ … }
void jpeg_encoder::compute_huffman_table(uint* codes, uint8* code_sizes, uint8* bits, uint8* val)
{ … }
void jpeg_encoder::compute_quant_table(int32* pDst, int16* pSrc)
{ … }
void jpeg_encoder::first_pass_init()
{ … }
bool jpeg_encoder::second_pass_init()
{ … }
bool jpeg_encoder::jpg_open(int p_x_res, int p_y_res, int src_channels)
{ … }
void jpeg_encoder::load_block_8_8_grey(int x)
{ … }
void jpeg_encoder::load_block_8_8(int x, int y, int c)
{ … }
void jpeg_encoder::load_block_16_8(int x, int c)
{ … }
void jpeg_encoder::load_block_16_8_8(int x, int c)
{ … }
void jpeg_encoder::load_quantized_coefficients(int component_num)
{ … }
void jpeg_encoder::flush_output_buffer()
{ … }
void jpeg_encoder::put_bits(uint bits, uint len)
{ … }
void jpeg_encoder::code_coefficients_pass_one(int component_num)
{ … }
void jpeg_encoder::code_coefficients_pass_two(int component_num)
{ … }
void jpeg_encoder::code_block(int component_num)
{ … }
void jpeg_encoder::process_mcu_row()
{ … }
bool jpeg_encoder::terminate_pass_one()
{ … }
bool jpeg_encoder::terminate_pass_two()
{ … }
bool jpeg_encoder::process_end_of_image()
{ … }
void jpeg_encoder::load_mcu(const void* pSrc)
{ … }
void jpeg_encoder::clear()
{ … }
jpeg_encoder::jpeg_encoder()
{ … }
jpeg_encoder::~jpeg_encoder()
{ … }
bool jpeg_encoder::init(output_stream* pStream, int width, int height, int src_channels, const params& comp_params)
{ … }
void jpeg_encoder::deinit()
{ … }
bool jpeg_encoder::process_scanline(const void* pScanline)
{ … }
#include <stdio.h>
class cfile_stream : public output_stream
{ … };
bool compress_image_to_jpeg_file(const char* pFilename, int width, int height, int num_channels, const uint8* pImage_data, const params& comp_params)
{ … }
class memory_stream : public output_stream
{ … };
bool compress_image_to_jpeg_file_in_memory(void* pDstBuf, int& buf_size, int width, int height, int num_channels, const uint8* pImage_data, const params& comp_params)
{ … }
}