16 #define JPEG_INTERNALS 45 unsigned char fixed_bin[4];
63 #define DC_STAT_BINS 64 64 #define AC_STAT_BINS 256 103 #ifdef RIGHT_SHIFT_IS_UNSIGNED 104 #define ISHIFT_TEMPS int ishift_temp; 105 #define IRIGHT_SHIFT(x,shft) \ 106 ((ishift_temp = (x)) < 0 ? \ 107 (ishift_temp >> (shft)) | ((~0) << (16-(shft))) : \ 108 (ishift_temp >> (shft))) 111 #define IRIGHT_SHIFT(x,shft) ((x) >> (shft)) 122 if (--
dest->free_in_buffer == 0)
123 if (! (*
dest->empty_output_buffer) (cinfo))
124 ERREXIT(cinfo, JERR_CANT_SUSPEND);
142 if ((
temp = (
e->a - 1 +
e->c) & 0xFFFF0000L) <
e->c)
143 e->c =
temp + 0x8000L;
148 if (
e->c & 0xF8000000L) {
150 if (
e->buffer >= 0) {
155 if (
e->buffer + 1 == 0xFF)
163 else if (
e->buffer >= 0) {
180 if (
e->c & 0x7FFF800L) {
184 emit_byte((
int) ((
e->c >> 19) & 0xFF), cinfo);
185 if (((
e->c >> 19) & 0xFF) == 0xFF)
187 if (
e->c & 0x7F800L) {
188 emit_byte((
int) ((
e->c >> 11) & 0xFF), cinfo);
189 if (((
e->c >> 11) & 0xFF) == 0xFF)
222 register unsigned char nl, nm;
231 nl = qe & 0xFF; qe >>= 8;
232 nm = qe & 0xFF; qe >>= 8;
236 if (
val != (sv >> 7)) {
246 *st = (sv & 0x80) ^ nl;
258 *st = (sv & 0x80) ^ nm;
270 if (
e->buffer >= 0) {
275 if (
e->buffer + 1 == 0xFF)
285 }
else if (
temp == 0xFF) {
291 else if (
e->buffer >= 0) {
312 }
while (
e->a < 0x8000L);
333 for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
334 compptr = cinfo->cur_comp_info[ci];
336 if (cinfo->Ss == 0 && cinfo->Ah == 0) {
350 entropy->
a = 0x10000
L;
373 if (cinfo->restart_interval) {
384 for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
385 ci = cinfo->MCU_membership[blkn];
386 tbl = cinfo->cur_comp_info[ci]->dc_tbl_no;
432 if (
m < (
int) ((1
L << cinfo->arith_dc_L[tbl]) >> 1))
434 else if (
m > (
int) ((1
L << cinfo->arith_dc_U[tbl]) >> 1))
456 const int * natural_order;
463 if (cinfo->restart_interval) {
473 natural_order = cinfo->natural_order;
477 tbl = cinfo->cur_comp_info[0]->ac_tbl_no;
488 if ((
v = (*
block)[natural_order[ke]]) >= 0) {
489 if (
v >>= cinfo->Al)
break;
492 if (
v >>= cinfo->Al)
break;
497 for (
k = cinfo->Ss - 1;
k < ke;) {
501 if ((
v = (*
block)[natural_order[++
k]]) >= 0) {
502 if (
v >>= cinfo->Al) {
509 if (
v >>= cinfo->Al) {
529 (
k <= cinfo->arith_ac_K[tbl] ? 189 : 217);
567 if (cinfo->restart_interval) {
581 for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
583 arith_encode(cinfo, st, (MCU_data[blkn][0][0] >> Al) & 1);
598 const int * natural_order;
605 if (cinfo->restart_interval) {
615 natural_order = cinfo->natural_order;
619 tbl = cinfo->cur_comp_info[0]->ac_tbl_no;
630 if ((
v = (*
block)[natural_order[ke]]) >= 0) {
631 if (
v >>= cinfo->Al)
break;
634 if (
v >>= cinfo->Al)
break;
639 for (kex = ke; kex > 0; kex--)
640 if ((
v = (*
block)[natural_order[kex]]) >= 0) {
641 if (
v >>= cinfo->Ah)
break;
644 if (
v >>= cinfo->Ah)
break;
648 for (
k = cinfo->Ss - 1;
k < ke;) {
653 if ((
v = (*
block)[natural_order[++
k]]) >= 0) {
654 if (
v >>= cinfo->Al) {
665 if (
v >>= cinfo->Al) {
697 const int * natural_order;
706 if (cinfo->restart_interval) {
716 natural_order = cinfo->natural_order;
719 for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
720 block = MCU_data[blkn];
721 ci = cinfo->MCU_membership[blkn];
722 compptr = cinfo->cur_comp_info[ci];
765 if (
m < (
int) ((1
L << cinfo->arith_dc_L[tbl]) >> 1))
767 else if (
m > (
int) ((1
L << cinfo->arith_dc_U[tbl]) >> 1))
777 if ((ke = cinfo->lim_Se) == 0)
continue;
782 if ((*
block)[natural_order[ke]])
break;
786 for (
k = 0;
k < ke;) {
789 while ((
v = (*
block)[natural_order[++
k]]) == 0) {
813 (
k <= cinfo->arith_ac_K[tbl] ? 189 : 217);
828 if (k < cinfo->lim_Se) {
849 if (gather_statistics)
854 ERREXIT(cinfo, JERR_NOT_COMPILED);
859 if (cinfo->progressive_mode) {
860 if (cinfo->Ah == 0) {
875 for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
876 compptr = cinfo->cur_comp_info[ci];
878 if (cinfo->Ss == 0 && cinfo->Ah == 0) {
881 ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl);
883 entropy->
dc_stats[tbl] = (
unsigned char *) (*cinfo->mem->alloc_small)
894 ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl);
896 entropy->
ac_stats[tbl] = (
unsigned char *) (*cinfo->mem->alloc_small)
899 #ifdef CALCULATE_SPECTRAL_CONDITIONING 900 if (cinfo->progressive_mode)
902 cinfo->arith_ac_K[tbl] = cinfo->Ss + ((8 + cinfo->Se - cinfo->Ss) >> 4);
909 entropy->
a = 0x10000
L;
933 cinfo->entropy = &entropy->
pub;
static unsigned int block
encode_mcu_DC_first(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
arith_encode(j_compress_ptr cinfo, unsigned char *st, int val)
emit_byte(int val, j_compress_ptr cinfo)
encode_mcu_AC_first(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
struct jpeg_common_struct * j_common_ptr
unsigned char fixed_bin[4]
struct jpeg_entropy_encoder pub
#define MEMZERO(addr, type, size)
encode_mcu_DC_refine(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
jpeg_component_info * compptr
finish_pass(j_compress_ptr cinfo)
unsigned char * ac_stats[NUM_ARITH_TBLS]
unsigned char * dc_stats[NUM_ARITH_TBLS]
jinit_arith_encoder(j_compress_ptr cinfo)
arith_entropy_encoder * arith_entropy_ptr
encode_mcu(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
unsigned int restarts_to_go
#define IRIGHT_SHIFT(x, shft)
#define ERREXIT1(cinfo, code, p1)
encode_mcu_AC_refine(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
int last_dc_val[MAX_COMPS_IN_SCAN]
GLfloat GLfloat GLfloat v2
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
int dc_context[MAX_COMPS_IN_SCAN]
emit_restart(j_compress_ptr cinfo, int restart_num)
start_pass(j_compress_ptr cinfo, boolean gather_statistics)
const INT32 jpeg_aritab[113+1]
#define MAX_COMPS_IN_SCAN
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *