ReactOS  0.4.14-dev-315-gbb6fece
jcmarker.c File Reference
#include "jinclude.h"
#include "jpeglib.h"
Include dependency graph for jcmarker.c:

Go to the source code of this file.

Classes

struct  my_marker_writer
 

Macros

#define JPEG_INTERNALS
 

Typedefs

typedef my_marker_writermy_marker_ptr
 

Enumerations

enum  JPEG_MARKER {
  M_SOF0 = 0xc0, M_SOF1 = 0xc1, M_SOF2 = 0xc2, M_SOF3 = 0xc3,
  M_SOF5 = 0xc5, M_SOF6 = 0xc6, M_SOF7 = 0xc7, M_JPG = 0xc8,
  M_SOF9 = 0xc9, M_SOF10 = 0xca, M_SOF11 = 0xcb, M_SOF13 = 0xcd,
  M_SOF14 = 0xce, M_SOF15 = 0xcf, M_DHT = 0xc4, M_DAC = 0xcc,
  M_RST0 = 0xd0, M_RST1 = 0xd1, M_RST2 = 0xd2, M_RST3 = 0xd3,
  M_RST4 = 0xd4, M_RST5 = 0xd5, M_RST6 = 0xd6, M_RST7 = 0xd7,
  M_SOI = 0xd8, M_EOI = 0xd9, M_SOS = 0xda, M_DQT = 0xdb,
  M_DNL = 0xdc, M_DRI = 0xdd, M_DHP = 0xde, M_EXP = 0xdf,
  M_APP0 = 0xe0, M_APP1 = 0xe1, M_APP2 = 0xe2, M_APP3 = 0xe3,
  M_APP4 = 0xe4, M_APP5 = 0xe5, M_APP6 = 0xe6, M_APP7 = 0xe7,
  M_APP8 = 0xe8, M_APP9 = 0xe9, M_APP10 = 0xea, M_APP11 = 0xeb,
  M_APP12 = 0xec, M_APP13 = 0xed, M_APP14 = 0xee, M_APP15 = 0xef,
  M_JPG0 = 0xf0, M_JPG8 = 0xf8, M_JPG13 = 0xfd, M_COM = 0xfe,
  M_TEM = 0x01, M_ERROR = 0x100, M_SOF0 = 0xc0, M_SOF1 = 0xc1,
  M_SOF2 = 0xc2, M_SOF3 = 0xc3, M_SOF5 = 0xc5, M_SOF6 = 0xc6,
  M_SOF7 = 0xc7, M_JPG = 0xc8, M_SOF9 = 0xc9, M_SOF10 = 0xca,
  M_SOF11 = 0xcb, M_SOF13 = 0xcd, M_SOF14 = 0xce, M_SOF15 = 0xcf,
  M_DHT = 0xc4, M_DAC = 0xcc, M_RST0 = 0xd0, M_RST1 = 0xd1,
  M_RST2 = 0xd2, M_RST3 = 0xd3, M_RST4 = 0xd4, M_RST5 = 0xd5,
  M_RST6 = 0xd6, M_RST7 = 0xd7, M_SOI = 0xd8, M_EOI = 0xd9,
  M_SOS = 0xda, M_DQT = 0xdb, M_DNL = 0xdc, M_DRI = 0xdd,
  M_DHP = 0xde, M_EXP = 0xdf, M_APP0 = 0xe0, M_APP1 = 0xe1,
  M_APP2 = 0xe2, M_APP3 = 0xe3, M_APP4 = 0xe4, M_APP5 = 0xe5,
  M_APP6 = 0xe6, M_APP7 = 0xe7, M_APP8 = 0xe8, M_APP9 = 0xe9,
  M_APP10 = 0xea, M_APP11 = 0xeb, M_APP12 = 0xec, M_APP13 = 0xed,
  M_APP14 = 0xee, M_APP15 = 0xef, M_JPG0 = 0xf0, M_JPG8 = 0xf8,
  M_JPG13 = 0xfd, M_COM = 0xfe, M_TEM = 0x01, M_ERROR = 0x100
}
 

Functions

 emit_byte (j_compress_ptr cinfo, int val)
 
 emit_marker (j_compress_ptr cinfo, JPEG_MARKER mark)
 
 emit_2bytes (j_compress_ptr cinfo, int value)
 
 emit_dqt (j_compress_ptr cinfo, int index)
 
 emit_dht (j_compress_ptr cinfo, int index, boolean is_ac)
 
 emit_dac (j_compress_ptr cinfo)
 
 emit_dri (j_compress_ptr cinfo)
 
 emit_lse_ict (j_compress_ptr cinfo)
 
 emit_sof (j_compress_ptr cinfo, JPEG_MARKER code)
 
 emit_sos (j_compress_ptr cinfo)
 
 emit_pseudo_sos (j_compress_ptr cinfo)
 
 emit_jfif_app0 (j_compress_ptr cinfo)
 
 emit_adobe_app14 (j_compress_ptr cinfo)
 
 write_marker_header (j_compress_ptr cinfo, int marker, unsigned int datalen)
 
 write_marker_byte (j_compress_ptr cinfo, int val)
 
 write_file_header (j_compress_ptr cinfo)
 
 write_frame_header (j_compress_ptr cinfo)
 
 write_scan_header (j_compress_ptr cinfo)
 
 write_file_trailer (j_compress_ptr cinfo)
 
 write_tables_only (j_compress_ptr cinfo)
 
 jinit_marker_writer (j_compress_ptr cinfo)
 

Macro Definition Documentation

◆ JPEG_INTERNALS

#define JPEG_INTERNALS

Definition at line 12 of file jcmarker.c.

Typedef Documentation

◆ my_marker_ptr

Definition at line 94 of file jcmarker.c.

Enumeration Type Documentation

◆ JPEG_MARKER

Enumerator
M_SOF0 
M_SOF1 
M_SOF2 
M_SOF3 
M_SOF5 
M_SOF6 
M_SOF7 
M_JPG 
M_SOF9 
M_SOF10 
M_SOF11 
M_SOF13 
M_SOF14 
M_SOF15 
M_DHT 
M_DAC 
M_RST0 
M_RST1 
M_RST2 
M_RST3 
M_RST4 
M_RST5 
M_RST6 
M_RST7 
M_SOI 
M_EOI 
M_SOS 
M_DQT 
M_DNL 
M_DRI 
M_DHP 
M_EXP 
M_APP0 
M_APP1 
M_APP2 
M_APP3 
M_APP4 
M_APP5 
M_APP6 
M_APP7 
M_APP8 
M_APP9 
M_APP10 
M_APP11 
M_APP12 
M_APP13 
M_APP14 
M_APP15 
M_JPG0 
M_JPG8 
M_JPG13 
M_COM 
M_TEM 
M_ERROR 
M_SOF0 
M_SOF1 
M_SOF2 
M_SOF3 
M_SOF5 
M_SOF6 
M_SOF7 
M_JPG 
M_SOF9 
M_SOF10 
M_SOF11 
M_SOF13 
M_SOF14 
M_SOF15 
M_DHT 
M_DAC 
M_RST0 
M_RST1 
M_RST2 
M_RST3 
M_RST4 
M_RST5 
M_RST6 
M_RST7 
M_SOI 
M_EOI 
M_SOS 
M_DQT 
M_DNL 
M_DRI 
M_DHP 
M_EXP 
M_APP0 
M_APP1 
M_APP2 
M_APP3 
M_APP4 
M_APP5 
M_APP6 
M_APP7 
M_APP8 
M_APP9 
M_APP10 
M_APP11 
M_APP12 
M_APP13 
M_APP14 
M_APP15 
M_JPG0 
M_JPG8 
M_JPG13 
M_COM 
M_TEM 
M_ERROR 

Definition at line 17 of file jcmarker.c.

17  { /* JPEG marker codes */
18  M_SOF0 = 0xc0,
19  M_SOF1 = 0xc1,
20  M_SOF2 = 0xc2,
21  M_SOF3 = 0xc3,
22 
23  M_SOF5 = 0xc5,
24  M_SOF6 = 0xc6,
25  M_SOF7 = 0xc7,
26 
27  M_JPG = 0xc8,
28  M_SOF9 = 0xc9,
29  M_SOF10 = 0xca,
30  M_SOF11 = 0xcb,
31 
32  M_SOF13 = 0xcd,
33  M_SOF14 = 0xce,
34  M_SOF15 = 0xcf,
35 
36  M_DHT = 0xc4,
37 
38  M_DAC = 0xcc,
39 
40  M_RST0 = 0xd0,
41  M_RST1 = 0xd1,
42  M_RST2 = 0xd2,
43  M_RST3 = 0xd3,
44  M_RST4 = 0xd4,
45  M_RST5 = 0xd5,
46  M_RST6 = 0xd6,
47  M_RST7 = 0xd7,
48 
49  M_SOI = 0xd8,
50  M_EOI = 0xd9,
51  M_SOS = 0xda,
52  M_DQT = 0xdb,
53  M_DNL = 0xdc,
54  M_DRI = 0xdd,
55  M_DHP = 0xde,
56  M_EXP = 0xdf,
57 
58  M_APP0 = 0xe0,
59  M_APP1 = 0xe1,
60  M_APP2 = 0xe2,
61  M_APP3 = 0xe3,
62  M_APP4 = 0xe4,
63  M_APP5 = 0xe5,
64  M_APP6 = 0xe6,
65  M_APP7 = 0xe7,
66  M_APP8 = 0xe8,
67  M_APP9 = 0xe9,
68  M_APP10 = 0xea,
69  M_APP11 = 0xeb,
70  M_APP12 = 0xec,
71  M_APP13 = 0xed,
72  M_APP14 = 0xee,
73  M_APP15 = 0xef,
74 
75  M_JPG0 = 0xf0,
76  M_JPG8 = 0xf8,
77  M_JPG13 = 0xfd,
78  M_COM = 0xfe,
79 
80  M_TEM = 0x01,
81 
82  M_ERROR = 0x100
83 } JPEG_MARKER;
Definition: jcmarker.c:56
Definition: jcmarker.c:49
Definition: jcmarker.c:51
Definition: jcmarker.c:36
Definition: jcmarker.c:53
Definition: jcmarker.c:55
Definition: jcmarker.c:78
Definition: jcmarker.c:50
JPEG_MARKER
Definition: jcmarker.c:17
Definition: jcmarker.c:38
Definition: jcmarker.c:80
Definition: jcmarker.c:52
Definition: jcmarker.c:54
Definition: jcmarker.c:27

Function Documentation

◆ emit_2bytes()

emit_2bytes ( j_compress_ptr  cinfo,
int  value 
)

Definition at line 133 of file jcmarker.c.

135 {
136  emit_byte(cinfo, (value >> 8) & 0xFF);
137  emit_byte(cinfo, value & 0xFF);
138 }
emit_byte(j_compress_ptr cinfo, int val)
Definition: jcmarker.c:110

Referenced by emit_adobe_app14(), emit_dac(), emit_dht(), emit_dqt(), emit_dri(), emit_jfif_app0(), emit_lse_ict(), emit_pseudo_sos(), emit_sof(), emit_sos(), and write_marker_header().

◆ emit_adobe_app14()

emit_adobe_app14 ( j_compress_ptr  cinfo)

Definition at line 434 of file jcmarker.c.

436 {
437  /*
438  * Length of APP14 block (2 bytes)
439  * Block ID (5 bytes - ASCII "Adobe")
440  * Version Number (2 bytes - currently 100)
441  * Flags0 (2 bytes - currently 0)
442  * Flags1 (2 bytes - currently 0)
443  * Color transform (1 byte)
444  *
445  * Although Adobe TN 5116 mentions Version = 101, all the Adobe files
446  * now in circulation seem to use Version = 100, so that's what we write.
447  *
448  * We write the color transform byte as 1 if the JPEG color space is
449  * YCbCr, 2 if it's YCCK, 0 otherwise. Adobe's definition has to do with
450  * whether the encoder performed a transformation, which is pretty useless.
451  */
452 
453  emit_marker(cinfo, M_APP14);
454 
455  emit_2bytes(cinfo, 2 + 5 + 2 + 2 + 2 + 1); /* length */
456 
457  emit_byte(cinfo, 0x41); /* Identifier: ASCII "Adobe" */
458  emit_byte(cinfo, 0x64);
459  emit_byte(cinfo, 0x6F);
460  emit_byte(cinfo, 0x62);
461  emit_byte(cinfo, 0x65);
462  emit_2bytes(cinfo, 100); /* Version */
463  emit_2bytes(cinfo, 0); /* Flags0 */
464  emit_2bytes(cinfo, 0); /* Flags1 */
465  switch (cinfo->jpeg_color_space) {
466  case JCS_YCbCr:
467  emit_byte(cinfo, 1); /* Color transform = 1 */
468  break;
469  case JCS_YCCK:
470  emit_byte(cinfo, 2); /* Color transform = 2 */
471  break;
472  default:
473  emit_byte(cinfo, 0); /* Color transform = 0 */
474  break;
475  }
476 }
J_COLOR_SPACE jpeg_color_space
Definition: jpeglib.h:331
emit_byte(j_compress_ptr cinfo, int val)
Definition: jcmarker.c:110
emit_marker(j_compress_ptr cinfo, JPEG_MARKER mark)
Definition: jcmarker.c:124
emit_2bytes(j_compress_ptr cinfo, int value)
Definition: jcmarker.c:133

Referenced by write_file_header().

◆ emit_byte()

emit_byte ( j_compress_ptr  cinfo,
int  val 
)

Definition at line 110 of file jcmarker.c.

112 {
113  struct jpeg_destination_mgr * dest = cinfo->dest;
114 
115  *(dest->next_output_byte)++ = (JOCTET) val;
116  if (--dest->free_in_buffer == 0) {
117  if (! (*dest->empty_output_buffer) (cinfo))
118  ERREXIT(cinfo, JERR_CANT_SUSPEND);
119  }
120 }
#define ERREXIT(msg)
Definition: rdjpgcom.c:72
GLuint GLfloat * val
Definition: glext.h:7180
struct jpeg_destination_mgr * dest
Definition: jpeglib.h:295
char JOCTET
Definition: jmorecfg.h:167
static char * dest
Definition: rtl.c:135

Referenced by emit_2bytes(), emit_adobe_app14(), emit_dac(), emit_dht(), emit_dqt(), emit_jfif_app0(), emit_lse_ict(), emit_marker(), emit_pseudo_sos(), emit_sof(), emit_sos(), and write_marker_byte().

◆ emit_dac()

emit_dac ( j_compress_ptr  cinfo)

Definition at line 225 of file jcmarker.c.

229 {
230 #ifdef C_ARITH_CODING_SUPPORTED
231  char dc_in_use[NUM_ARITH_TBLS];
232  char ac_in_use[NUM_ARITH_TBLS];
233  int length, i;
235 
236  for (i = 0; i < NUM_ARITH_TBLS; i++)
237  dc_in_use[i] = ac_in_use[i] = 0;
238 
239  for (i = 0; i < cinfo->comps_in_scan; i++) {
240  compptr = cinfo->cur_comp_info[i];
241  /* DC needs no table for refinement scan */
242  if (cinfo->Ss == 0 && cinfo->Ah == 0)
243  dc_in_use[compptr->dc_tbl_no] = 1;
244  /* AC needs no table when not present */
245  if (cinfo->Se)
246  ac_in_use[compptr->ac_tbl_no] = 1;
247  }
248 
249  length = 0;
250  for (i = 0; i < NUM_ARITH_TBLS; i++)
251  length += dc_in_use[i] + ac_in_use[i];
252 
253  if (length) {
254  emit_marker(cinfo, M_DAC);
255 
256  emit_2bytes(cinfo, length*2 + 2);
257 
258  for (i = 0; i < NUM_ARITH_TBLS; i++) {
259  if (dc_in_use[i]) {
260  emit_byte(cinfo, i);
261  emit_byte(cinfo, cinfo->arith_dc_L[i] + (cinfo->arith_dc_U[i]<<4));
262  }
263  if (ac_in_use[i]) {
264  emit_byte(cinfo, i + 0x10);
265  emit_byte(cinfo, cinfo->arith_ac_K[i]);
266  }
267  }
268  }
269 #endif /* C_ARITH_CODING_SUPPORTED */
270 }
UINT8 arith_ac_K[NUM_ARITH_TBLS]
Definition: jpeglib.h:348
emit_byte(j_compress_ptr cinfo, int val)
Definition: jcmarker.c:110
jpeg_component_info * compptr
Definition: jdct.h:238
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
Definition: glfuncs.h:248
UINT8 arith_dc_U[NUM_ARITH_TBLS]
Definition: jpeglib.h:347
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
Definition: jcmarker.c:38
jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]
Definition: jpeglib.h:423
UINT8 arith_dc_L[NUM_ARITH_TBLS]
Definition: jpeglib.h:346
#define NUM_ARITH_TBLS
Definition: jpeglib.h:54
emit_marker(j_compress_ptr cinfo, JPEG_MARKER mark)
Definition: jcmarker.c:124
emit_2bytes(j_compress_ptr cinfo, int value)
Definition: jcmarker.c:133

Referenced by write_scan_header().

◆ emit_dht()

emit_dht ( j_compress_ptr  cinfo,
int  index,
boolean  is_ac 
)

Definition at line 187 of file jcmarker.c.

189 {
190  JHUFF_TBL * htbl;
191  int length, i;
192 
193  if (is_ac) {
194  htbl = cinfo->ac_huff_tbl_ptrs[index];
195  index += 0x10; /* output index has AC bit set */
196  } else {
197  htbl = cinfo->dc_huff_tbl_ptrs[index];
198  }
199 
200  if (htbl == NULL)
201  ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, index);
202 
203  if (! htbl->sent_table) {
204  emit_marker(cinfo, M_DHT);
205 
206  length = 0;
207  for (i = 1; i <= 16; i++)
208  length += htbl->bits[i];
209 
210  emit_2bytes(cinfo, length + 2 + 1 + 16);
211  emit_byte(cinfo, index);
212 
213  for (i = 1; i <= 16; i++)
214  emit_byte(cinfo, htbl->bits[i]);
215 
216  for (i = 0; i < length; i++)
217  emit_byte(cinfo, htbl->huffval[i]);
218 
219  htbl->sent_table = TRUE;
220  }
221 }
#define TRUE
Definition: types.h:120
JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS]
Definition: jpeglib.h:342
UINT8 huffval[256]
Definition: jpeglib.h:113
boolean sent_table
Definition: jpeglib.h:119
emit_byte(j_compress_ptr cinfo, int val)
Definition: jcmarker.c:110
JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS]
Definition: jpeglib.h:343
Definition: jcmarker.c:36
UINT8 bits[17]
Definition: jpeglib.h:111
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
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
#define index(s, c)
Definition: various.h:29
#define ERREXIT1(cinfo, code, p1)
Definition: jerror.h:212
emit_marker(j_compress_ptr cinfo, JPEG_MARKER mark)
Definition: jcmarker.c:124
emit_2bytes(j_compress_ptr cinfo, int value)
Definition: jcmarker.c:133

Referenced by write_scan_header(), and write_tables_only().

◆ emit_dqt()

emit_dqt ( j_compress_ptr  cinfo,
int  index 
)

Definition at line 146 of file jcmarker.c.

149 {
150  JQUANT_TBL * qtbl = cinfo->quant_tbl_ptrs[index];
151  int prec;
152  int i;
153 
154  if (qtbl == NULL)
155  ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, index);
156 
157  prec = 0;
158  for (i = 0; i <= cinfo->lim_Se; i++) {
159  if (qtbl->quantval[cinfo->natural_order[i]] > 255)
160  prec = 1;
161  }
162 
163  if (! qtbl->sent_table) {
164  emit_marker(cinfo, M_DQT);
165 
166  emit_2bytes(cinfo,
167  prec ? cinfo->lim_Se * 2 + 2 + 1 + 2 : cinfo->lim_Se + 1 + 1 + 2);
168 
169  emit_byte(cinfo, index + (prec<<4));
170 
171  for (i = 0; i <= cinfo->lim_Se; i++) {
172  /* The table entries must be emitted in zigzag order. */
173  unsigned int qval = qtbl->quantval[cinfo->natural_order[i]];
174  if (prec)
175  emit_byte(cinfo, (int) (qval >> 8));
176  emit_byte(cinfo, (int) (qval & 0xFF));
177  }
178 
179  qtbl->sent_table = TRUE;
180  }
181 
182  return prec;
183 }
#define TRUE
Definition: types.h:120
UINT16 quantval[DCTSIZE2]
Definition: jpeglib.h:97
emit_byte(j_compress_ptr cinfo, int val)
Definition: jcmarker.c:110
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
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
#define index(s, c)
Definition: various.h:29
#define ERREXIT1(cinfo, code, p1)
Definition: jerror.h:212
JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS]
Definition: jpeglib.h:336
const int * natural_order
Definition: jpeglib.h:437
boolean sent_table
Definition: jpeglib.h:103
Definition: jcmarker.c:52
emit_marker(j_compress_ptr cinfo, JPEG_MARKER mark)
Definition: jcmarker.c:124
emit_2bytes(j_compress_ptr cinfo, int value)
Definition: jcmarker.c:133

Referenced by write_frame_header(), and write_tables_only().

◆ emit_dri()

emit_dri ( j_compress_ptr  cinfo)

Definition at line 274 of file jcmarker.c.

276 {
277  emit_marker(cinfo, M_DRI);
278 
279  emit_2bytes(cinfo, 4); /* fixed length */
280 
281  emit_2bytes(cinfo, (int) cinfo->restart_interval);
282 }
unsigned int restart_interval
Definition: jpeglib.h:370
emit_marker(j_compress_ptr cinfo, JPEG_MARKER mark)
Definition: jcmarker.c:124
Definition: jcmarker.c:54
emit_2bytes(j_compress_ptr cinfo, int value)
Definition: jcmarker.c:133

Referenced by write_scan_header().

◆ emit_jfif_app0()

emit_jfif_app0 ( j_compress_ptr  cinfo)

Definition at line 399 of file jcmarker.c.

401 {
402  /*
403  * Length of APP0 block (2 bytes)
404  * Block ID (4 bytes - ASCII "JFIF")
405  * Zero byte (1 byte to terminate the ID string)
406  * Version Major, Minor (2 bytes - major first)
407  * Units (1 byte - 0x00 = none, 0x01 = inch, 0x02 = cm)
408  * Xdpu (2 bytes - dots per unit horizontal)
409  * Ydpu (2 bytes - dots per unit vertical)
410  * Thumbnail X size (1 byte)
411  * Thumbnail Y size (1 byte)
412  */
413 
414  emit_marker(cinfo, M_APP0);
415 
416  emit_2bytes(cinfo, 2 + 4 + 1 + 2 + 1 + 2 + 2 + 1 + 1); /* length */
417 
418  emit_byte(cinfo, 0x4A); /* Identifier: ASCII "JFIF" */
419  emit_byte(cinfo, 0x46);
420  emit_byte(cinfo, 0x49);
421  emit_byte(cinfo, 0x46);
422  emit_byte(cinfo, 0);
423  emit_byte(cinfo, cinfo->JFIF_major_version); /* Version fields */
424  emit_byte(cinfo, cinfo->JFIF_minor_version);
425  emit_byte(cinfo, cinfo->density_unit); /* Pixel size information */
426  emit_2bytes(cinfo, (int) cinfo->X_density);
427  emit_2bytes(cinfo, (int) cinfo->Y_density);
428  emit_byte(cinfo, 0); /* No thumbnail image */
429  emit_byte(cinfo, 0);
430 }
UINT8 JFIF_major_version
Definition: jpeglib.h:376
emit_byte(j_compress_ptr cinfo, int val)
Definition: jcmarker.c:110
UINT8 JFIF_minor_version
Definition: jpeglib.h:377
emit_marker(j_compress_ptr cinfo, JPEG_MARKER mark)
Definition: jcmarker.c:124
emit_2bytes(j_compress_ptr cinfo, int value)
Definition: jcmarker.c:133

Referenced by write_file_header().

◆ emit_lse_ict()

emit_lse_ict ( j_compress_ptr  cinfo)

Definition at line 286 of file jcmarker.c.

288 {
289  /* Support only 1 transform */
290  if (cinfo->color_transform != JCT_SUBTRACT_GREEN ||
291  cinfo->num_components < 3)
292  ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
293 
294  emit_marker(cinfo, M_JPG8);
295 
296  emit_2bytes(cinfo, 24); /* fixed length */
297 
298  emit_byte(cinfo, 0x0D); /* ID inverse transform specification */
299  emit_2bytes(cinfo, MAXJSAMPLE); /* MAXTRANS */
300  emit_byte(cinfo, 3); /* Nt=3 */
301  emit_byte(cinfo, cinfo->comp_info[1].component_id);
302  emit_byte(cinfo, cinfo->comp_info[0].component_id);
303  emit_byte(cinfo, cinfo->comp_info[2].component_id);
304  emit_byte(cinfo, 0x80); /* F1: CENTER1=1, NORM1=0 */
305  emit_2bytes(cinfo, 0); /* A(1,1)=0 */
306  emit_2bytes(cinfo, 0); /* A(1,2)=0 */
307  emit_byte(cinfo, 0); /* F2: CENTER2=0, NORM2=0 */
308  emit_2bytes(cinfo, 1); /* A(2,1)=1 */
309  emit_2bytes(cinfo, 0); /* A(2,2)=0 */
310  emit_byte(cinfo, 0); /* F3: CENTER3=0, NORM3=0 */
311  emit_2bytes(cinfo, 1); /* A(3,1)=1 */
312  emit_2bytes(cinfo, 0); /* A(3,2)=0 */
313 }
J_COLOR_TRANSFORM color_transform
Definition: jpeglib.h:387
#define ERREXIT(msg)
Definition: rdjpgcom.c:72
#define MAXJSAMPLE
Definition: jmorecfg.h:83
emit_byte(j_compress_ptr cinfo, int val)
Definition: jcmarker.c:110
emit_marker(j_compress_ptr cinfo, JPEG_MARKER mark)
Definition: jcmarker.c:124
jpeg_component_info * comp_info
Definition: jpeglib.h:333
emit_2bytes(j_compress_ptr cinfo, int value)
Definition: jcmarker.c:133

Referenced by write_frame_header().

◆ emit_marker()

emit_marker ( j_compress_ptr  cinfo,
JPEG_MARKER  mark 
)

Definition at line 124 of file jcmarker.c.

126 {
127  emit_byte(cinfo, 0xFF);
128  emit_byte(cinfo, (int) mark);
129 }
emit_byte(j_compress_ptr cinfo, int val)
Definition: jcmarker.c:110

Referenced by emit_adobe_app14(), emit_dac(), emit_dht(), emit_dqt(), emit_dri(), emit_jfif_app0(), emit_lse_ict(), emit_pseudo_sos(), emit_sof(), emit_sos(), write_file_header(), write_file_trailer(), write_marker_header(), and write_tables_only().

◆ emit_pseudo_sos()

emit_pseudo_sos ( j_compress_ptr  cinfo)

Definition at line 383 of file jcmarker.c.

385 {
386  emit_marker(cinfo, M_SOS);
387 
388  emit_2bytes(cinfo, 2 + 1 + 3); /* length */
389 
390  emit_byte(cinfo, 0); /* Ns */
391 
392  emit_byte(cinfo, 0); /* Ss */
393  emit_byte(cinfo, cinfo->block_size * cinfo->block_size - 1); /* Se */
394  emit_byte(cinfo, 0); /* Ah/Al */
395 }
Definition: jcmarker.c:51
emit_byte(j_compress_ptr cinfo, int val)
Definition: jcmarker.c:110
emit_marker(j_compress_ptr cinfo, JPEG_MARKER mark)
Definition: jcmarker.c:124
emit_2bytes(j_compress_ptr cinfo, int value)
Definition: jcmarker.c:133

Referenced by write_frame_header().

◆ emit_sof()

emit_sof ( j_compress_ptr  cinfo,
JPEG_MARKER  code 
)

Definition at line 317 of file jcmarker.c.

319 {
320  int ci;
322 
323  emit_marker(cinfo, code);
324 
325  emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */
326 
327  /* Make sure image isn't bigger than SOF field can handle */
328  if ((long) cinfo->jpeg_height > 65535L ||
329  (long) cinfo->jpeg_width > 65535L)
330  ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) 65535);
331 
332  emit_byte(cinfo, cinfo->data_precision);
333  emit_2bytes(cinfo, (int) cinfo->jpeg_height);
334  emit_2bytes(cinfo, (int) cinfo->jpeg_width);
335 
336  emit_byte(cinfo, cinfo->num_components);
337 
338  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
339  ci++, compptr++) {
340  emit_byte(cinfo, compptr->component_id);
342  emit_byte(cinfo, compptr->quant_tbl_no);
343  }
344 }
emit_byte(j_compress_ptr cinfo, int val)
Definition: jcmarker.c:110
jpeg_component_info * compptr
Definition: jdct.h:238
JDIMENSION jpeg_height
Definition: jpeglib.h:320
JDIMENSION jpeg_width
Definition: jpeglib.h:319
static const WCHAR L[]
Definition: oid.c:1250
#define ERREXIT1(cinfo, code, p1)
Definition: jerror.h:212
emit_marker(j_compress_ptr cinfo, JPEG_MARKER mark)
Definition: jcmarker.c:124
jpeg_component_info * comp_info
Definition: jpeglib.h:333
emit_2bytes(j_compress_ptr cinfo, int value)
Definition: jcmarker.c:133

Referenced by write_frame_header().

◆ emit_sos()

emit_sos ( j_compress_ptr  cinfo)

Definition at line 348 of file jcmarker.c.

350 {
351  int i, td, ta;
353 
354  emit_marker(cinfo, M_SOS);
355 
356  emit_2bytes(cinfo, 2 * cinfo->comps_in_scan + 2 + 1 + 3); /* length */
357 
358  emit_byte(cinfo, cinfo->comps_in_scan);
359 
360  for (i = 0; i < cinfo->comps_in_scan; i++) {
361  compptr = cinfo->cur_comp_info[i];
362  emit_byte(cinfo, compptr->component_id);
363 
364  /* We emit 0 for unused field(s); this is recommended by the P&M text
365  * but does not seem to be specified in the standard.
366  */
367 
368  /* DC needs no table for refinement scan */
369  td = cinfo->Ss == 0 && cinfo->Ah == 0 ? compptr->dc_tbl_no : 0;
370  /* AC needs no table when not present */
371  ta = cinfo->Se ? compptr->ac_tbl_no : 0;
372 
373  emit_byte(cinfo, (td << 4) + ta);
374  }
375 
376  emit_byte(cinfo, cinfo->Ss);
377  emit_byte(cinfo, cinfo->Se);
378  emit_byte(cinfo, (cinfo->Ah << 4) + cinfo->Al);
379 }
Definition: jcmarker.c:51
emit_byte(j_compress_ptr cinfo, int val)
Definition: jcmarker.c:110
jpeg_component_info * compptr
Definition: jdct.h:238
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
Definition: glfuncs.h:248
jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]
Definition: jpeglib.h:423
emit_marker(j_compress_ptr cinfo, JPEG_MARKER mark)
Definition: jcmarker.c:124
emit_2bytes(j_compress_ptr cinfo, int value)
Definition: jcmarker.c:133

Referenced by write_scan_header().

◆ jinit_marker_writer()

jinit_marker_writer ( j_compress_ptr  cinfo)

Definition at line 700 of file jcmarker.c.

701 {
703 
704  /* Create the subobject */
706  (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
708  cinfo->marker = &marker->pub;
709  /* Initialize method pointers */
710  marker->pub.write_file_header = write_file_header;
711  marker->pub.write_frame_header = write_frame_header;
712  marker->pub.write_scan_header = write_scan_header;
713  marker->pub.write_file_trailer = write_file_trailer;
714  marker->pub.write_tables_only = write_tables_only;
715  marker->pub.write_marker_header = write_marker_header;
716  marker->pub.write_marker_byte = write_marker_byte;
717  /* Initialize private state */
718  marker->last_restart_interval = 0;
719 }
write_file_header(j_compress_ptr cinfo)
Definition: jcmarker.c:519
write_scan_header(j_compress_ptr cinfo)
Definition: jcmarker.c:613
struct jpeg_common_struct * j_common_ptr
Definition: jpeglib.h:284
write_file_trailer(j_compress_ptr cinfo)
Definition: jcmarker.c:657
write_marker_byte(j_compress_ptr cinfo, int val)
Definition: jcmarker.c:500
#define SIZEOF(_ar)
Definition: calc.h:97
#define JPOOL_IMAGE
Definition: jpeglib.h:808
int marker
Definition: jpeglib.h:1027
write_marker_header(j_compress_ptr cinfo, int marker, unsigned int datalen)
Definition: jcmarker.c:488
my_marker_writer * my_marker_ptr
Definition: jcmarker.c:94
struct jpeg_marker_writer * marker
Definition: jpeglib.h:447
write_tables_only(j_compress_ptr cinfo)
Definition: jcmarker.c:671
write_frame_header(j_compress_ptr cinfo)
Definition: jcmarker.c:545

Referenced by jinit_compress_master(), jpeg_write_tables(), and transencode_master_selection().

◆ write_file_header()

write_file_header ( j_compress_ptr  cinfo)

Definition at line 519 of file jcmarker.c.

520 {
522 
523  emit_marker(cinfo, M_SOI); /* first the SOI */
524 
525  /* SOI is defined to reset restart interval to 0 */
526  marker->last_restart_interval = 0;
527 
528  if (cinfo->write_JFIF_header) /* next an optional JFIF APP0 */
529  emit_jfif_app0(cinfo);
530  if (cinfo->write_Adobe_marker) /* next an optional Adobe APP14 */
531  emit_adobe_app14(cinfo);
532 }
boolean write_Adobe_marker
Definition: jpeglib.h:385
Definition: jcmarker.c:49
emit_jfif_app0(j_compress_ptr cinfo)
Definition: jcmarker.c:399
boolean write_JFIF_header
Definition: jpeglib.h:375
int marker
Definition: jpeglib.h:1027
my_marker_writer * my_marker_ptr
Definition: jcmarker.c:94
struct jpeg_marker_writer * marker
Definition: jpeglib.h:447
emit_adobe_app14(j_compress_ptr cinfo)
Definition: jcmarker.c:434
emit_marker(j_compress_ptr cinfo, JPEG_MARKER mark)
Definition: jcmarker.c:124

Referenced by jinit_marker_writer().

◆ write_file_trailer()

write_file_trailer ( j_compress_ptr  cinfo)

Definition at line 657 of file jcmarker.c.

658 {
659  emit_marker(cinfo, M_EOI);
660 }
Definition: jcmarker.c:50
emit_marker(j_compress_ptr cinfo, JPEG_MARKER mark)
Definition: jcmarker.c:124

Referenced by jinit_marker_writer().

◆ write_frame_header()

write_frame_header ( j_compress_ptr  cinfo)

Definition at line 545 of file jcmarker.c.

546 {
547  int ci, prec;
548  boolean is_baseline;
550 
551  /* Emit DQT for each quantization table.
552  * Note that emit_dqt() suppresses any duplicate tables.
553  */
554  prec = 0;
555  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
556  ci++, compptr++) {
557  prec += emit_dqt(cinfo, compptr->quant_tbl_no);
558  }
559  /* now prec is nonzero iff there are any 16-bit quant tables. */
560 
561  /* Check for a non-baseline specification.
562  * Note we assume that Huffman table numbers won't be changed later.
563  */
564  if (cinfo->arith_code || cinfo->progressive_mode ||
565  cinfo->data_precision != 8 || cinfo->block_size != DCTSIZE) {
566  is_baseline = FALSE;
567  } else {
568  is_baseline = TRUE;
569  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
570  ci++, compptr++) {
571  if (compptr->dc_tbl_no > 1 || compptr->ac_tbl_no > 1)
572  is_baseline = FALSE;
573  }
574  if (prec && is_baseline) {
575  is_baseline = FALSE;
576  /* If it's baseline except for quantizer size, warn the user */
577  TRACEMS(cinfo, 0, JTRC_16BIT_TABLES);
578  }
579  }
580 
581  /* Emit the proper SOF marker */
582  if (cinfo->arith_code) {
583  if (cinfo->progressive_mode)
584  emit_sof(cinfo, M_SOF10); /* SOF code for progressive arithmetic */
585  else
586  emit_sof(cinfo, M_SOF9); /* SOF code for sequential arithmetic */
587  } else {
588  if (cinfo->progressive_mode)
589  emit_sof(cinfo, M_SOF2); /* SOF code for progressive Huffman */
590  else if (is_baseline)
591  emit_sof(cinfo, M_SOF0); /* SOF code for baseline implementation */
592  else
593  emit_sof(cinfo, M_SOF1); /* SOF code for non-baseline Huffman file */
594  }
595 
596  /* Check to emit LSE inverse color transform specification marker */
597  if (cinfo->color_transform)
598  emit_lse_ict(cinfo);
599 
600  /* Check to emit pseudo SOS marker */
601  if (cinfo->progressive_mode && cinfo->block_size != DCTSIZE)
602  emit_pseudo_sos(cinfo);
603 }
J_COLOR_TRANSFORM color_transform
Definition: jpeglib.h:387
#define TRUE
Definition: types.h:120
emit_pseudo_sos(j_compress_ptr cinfo)
Definition: jcmarker.c:383
emit_dqt(j_compress_ptr cinfo, int index)
Definition: jcmarker.c:146
jpeg_component_info * compptr
Definition: jdct.h:238
#define TRACEMS(cinfo, lvl, code)
Definition: jerror.h:265
emit_sof(j_compress_ptr cinfo, JPEG_MARKER code)
Definition: jcmarker.c:317
emit_lse_ict(j_compress_ptr cinfo)
Definition: jcmarker.c:286
boolean arith_code
Definition: jpeglib.h:358
boolean progressive_mode
Definition: jpeglib.h:404
#define DCTSIZE
Definition: jpeglib.h:50
jpeg_component_info * comp_info
Definition: jpeglib.h:333

Referenced by jinit_marker_writer().

◆ write_marker_byte()

write_marker_byte ( j_compress_ptr  cinfo,
int  val 
)

Definition at line 500 of file jcmarker.c.

502 {
503  emit_byte(cinfo, val);
504 }
emit_byte(j_compress_ptr cinfo, int val)
Definition: jcmarker.c:110
GLuint GLfloat * val
Definition: glext.h:7180

Referenced by jinit_marker_writer(), and jpeg_write_marker().

◆ write_marker_header()

write_marker_header ( j_compress_ptr  cinfo,
int  marker,
unsigned int  datalen 
)

Definition at line 488 of file jcmarker.c.

490 {
491  if (datalen > (unsigned int) 65533) /* safety check */
492  ERREXIT(cinfo, JERR_BAD_LENGTH);
493 
494  emit_marker(cinfo, (JPEG_MARKER) marker);
495 
496  emit_2bytes(cinfo, (int) (datalen + 2)); /* total length */
497 }
#define ERREXIT(msg)
Definition: rdjpgcom.c:72
int const JOCTET unsigned int datalen
Definition: jpeglib.h:1027
int marker
Definition: jpeglib.h:1027
JPEG_MARKER
Definition: jcmarker.c:17
emit_marker(j_compress_ptr cinfo, JPEG_MARKER mark)
Definition: jcmarker.c:124
emit_2bytes(j_compress_ptr cinfo, int value)
Definition: jcmarker.c:133

Referenced by jinit_marker_writer().

◆ write_scan_header()

write_scan_header ( j_compress_ptr  cinfo)

Definition at line 613 of file jcmarker.c.

614 {
616  int i;
618 
619  if (cinfo->arith_code) {
620  /* Emit arith conditioning info. We may have some duplication
621  * if the file has multiple scans, but it's so small it's hardly
622  * worth worrying about.
623  */
624  emit_dac(cinfo);
625  } else {
626  /* Emit Huffman tables.
627  * Note that emit_dht() suppresses any duplicate tables.
628  */
629  for (i = 0; i < cinfo->comps_in_scan; i++) {
630  compptr = cinfo->cur_comp_info[i];
631  /* DC needs no table for refinement scan */
632  if (cinfo->Ss == 0 && cinfo->Ah == 0)
633  emit_dht(cinfo, compptr->dc_tbl_no, FALSE);
634  /* AC needs no table when not present */
635  if (cinfo->Se)
636  emit_dht(cinfo, compptr->ac_tbl_no, TRUE);
637  }
638  }
639 
640  /* Emit DRI if required --- note that DRI value could change for each scan.
641  * We avoid wasting space with unnecessary DRIs, however.
642  */
643  if (cinfo->restart_interval != marker->last_restart_interval) {
644  emit_dri(cinfo);
645  marker->last_restart_interval = cinfo->restart_interval;
646  }
647 
648  emit_sos(cinfo);
649 }
#define TRUE
Definition: types.h:120
emit_sos(j_compress_ptr cinfo)
Definition: jcmarker.c:348
jpeg_component_info * compptr
Definition: jdct.h:238
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
Definition: glfuncs.h:248
int marker
Definition: jpeglib.h:1027
my_marker_writer * my_marker_ptr
Definition: jcmarker.c:94
emit_dri(j_compress_ptr cinfo)
Definition: jcmarker.c:274
if(!(yy_init))
Definition: macro.lex.yy.c:714
struct jpeg_marker_writer * marker
Definition: jpeglib.h:447
unsigned int restart_interval
Definition: jpeglib.h:370
emit_dht(j_compress_ptr cinfo, int index, boolean is_ac)
Definition: jcmarker.c:187
boolean arith_code
Definition: jpeglib.h:358
jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]
Definition: jpeglib.h:423
emit_dac(j_compress_ptr cinfo)
Definition: jcmarker.c:225

Referenced by jinit_marker_writer().

◆ write_tables_only()

write_tables_only ( j_compress_ptr  cinfo)

Definition at line 671 of file jcmarker.c.

672 {
673  int i;
674 
675  emit_marker(cinfo, M_SOI);
676 
677  for (i = 0; i < NUM_QUANT_TBLS; i++) {
678  if (cinfo->quant_tbl_ptrs[i] != NULL)
679  (void) emit_dqt(cinfo, i);
680  }
681 
682  if (! cinfo->arith_code) {
683  for (i = 0; i < NUM_HUFF_TBLS; i++) {
684  if (cinfo->dc_huff_tbl_ptrs[i] != NULL)
685  emit_dht(cinfo, i, FALSE);
686  if (cinfo->ac_huff_tbl_ptrs[i] != NULL)
687  emit_dht(cinfo, i, TRUE);
688  }
689  }
690 
691  emit_marker(cinfo, M_EOI);
692 }
Definition: jcmarker.c:49
#define TRUE
Definition: types.h:120
JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS]
Definition: jpeglib.h:342
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define NUM_QUANT_TBLS
Definition: jpeglib.h:52
#define NUM_HUFF_TBLS
Definition: jpeglib.h:53
JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS]
Definition: jpeglib.h:343
emit_dqt(j_compress_ptr cinfo, int index)
Definition: jcmarker.c:146
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
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
Definition: jcmarker.c:50
emit_dht(j_compress_ptr cinfo, int index, boolean is_ac)
Definition: jcmarker.c:187
boolean arith_code
Definition: jpeglib.h:358
JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS]
Definition: jpeglib.h:336
emit_marker(j_compress_ptr cinfo, JPEG_MARKER mark)
Definition: jcmarker.c:124

Referenced by jinit_marker_writer().