w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

jpegio.c
Go to the documentation of this file.
1 /*====================================================================*
2  - Copyright (C) 2001 Leptonica. All rights reserved.
3  - This software is distributed in the hope that it will be
4  - useful, but with NO WARRANTY OF ANY KIND.
5  - No author or distributor accepts responsibility to anyone for the
6  - consequences of using this software, or for whether it serves any
7  - particular purpose or works at all, unless he or she says so in
8  - writing. Everyone is granted permission to copy, modify and
9  - redistribute this source code, for commercial or non-commercial
10  - purposes, with the following restrictions: (1) the origin of this
11  - source code must not be misrepresented; (2) modified versions must
12  - be plainly marked as such; and (3) this notice may not be removed
13  - or altered from any source or modified source distribution.
14  *====================================================================*/
15 
16 /*
17  * jpegio.c
18  *
19  * Reading jpeg:
20  * PIX *pixReadJpeg() [ special top level ]
21  * PIX *pixReadStreamJpeg()
22  *
23  * Writing jpeg:
24  * l_int32 pixWriteJpeg() [ special top level ]
25  * l_int32 pixWriteStreamJpeg()
26  *
27  * static void jpeg_error_do_not_exit();
28  *
29  * Documentation: libjpeg.doc can be found, along with all
30  * source code, at ftp://ftp.uu.net/graphics/jpeg
31  * Download and untar the file: jpegsrc.v6b.tar.gz
32  * A good paper on jpeg can also be found there: wallace.ps.gz
33  *
34  * The functions in libjpeg make it very simple to compress
35  * and decompress images. On input (decompression from file),
36  * 3 component color images can be read into either an 8 bpp Pix
37  * with a colormap or a 32 bpp Pix with RGB components. For output
38  * (compression to file), all color Pix, whether 8 bpp with a
39  * colormap or 32 bpp, are written compressed as a set of three
40  * 8 bpp (rgb) images.
41  *
42  * The default behavior of the jpeg library is to call exit.
43  * This is often undesirable, and the caller should make the
44  * decision when to abort a process. So I inserted setjmp(s)
45  * in the reader and writer, wrote a static error handler that
46  * does not exit, and set up the cinfo structure so that the
47  * low-level jpeg library will call this error handler instead
48  * of the default function error_exit().
49  */
50 
51 #include <stdio.h>
52 #include <stdlib.h>
53 #include <string.h>
54 
55 #include "allheaders.h"
56 
57 static void jpeg_error_do_not_exit(j_common_ptr cinfo);
58 static jmp_buf jpeg_jmpbuf;
59 
60 
61 /*---------------------------------------------------------------------*
62  * Reading Jpeg *
63  *---------------------------------------------------------------------*/
64 /*!
65  * pixReadJpeg()
66  *
67  * Input: filename
68  * colormap flag (0 means return RGB image if color;
69  * 1 means create colormap and return 8 bpp
70  * palette image if color)
71  * reduction (scaling factor: 1, 2, 4 or 8)
72  * &pnwarn (<optional return> number of warnings about
73  * corrupted data)
74  * Return: pix, or null on error
75  *
76  * Images reduced by factors of 2, 4 or 8 can be returned
77  * significantly faster than full resolution images.
78  *
79  * The jpeg library will return warnings (or exit) if
80  * the jpeg data is bad. Use this function if you want the
81  * jpeg library to create an 8 bpp palette image, or to
82  * tell if the jpeg data has been corrupted. For corrupt jpeg
83  * data, there are two possible outcomes:
84  * (1) a damaged pix will be returned, along with a nonzero
85  * number of warnings, or
86  * (2) for sufficiently serious problems, the library will attempt
87  * to exit (caught by our error handler) and no pix will be returned.
88  */
89 PIX *
90 pixReadJpeg(const char *filename,
91  l_int32 cmflag,
93  l_int32 *pnwarn)
94 {
95 FILE *fp;
96 PIX *pix;
97 
98  PROCNAME("pixReadJpeg");
99 
100  if (!filename)
101  return (PIX *)ERROR_PTR("filename not defined", procName, NULL);
102  if (pnwarn)
103  *pnwarn = 0; /* init */
104  if (cmflag != 0 && cmflag != 1)
105  cmflag = 0; /* default */
106  if (reduction != 1 && reduction != 2 && reduction != 4 && reduction != 8)
107  return (PIX *)ERROR_PTR("reduction not in {1,2,4,8}", procName, NULL);
108 
109  if ((fp = fopenReadStream(filename)) == NULL)
110  return (PIX *)ERROR_PTR("image file not found", procName, NULL);
111  pix = pixReadStreamJpeg(fp, cmflag, reduction, pnwarn, 0);
112  fclose(fp);
113 
114  if (!pix)
115  return (PIX *)ERROR_PTR("image not returned", procName, NULL);
116  return pix;
117 }
118 
119 
120 /*!
121  * pixReadStreamJpeg()
122  *
123  * Input: stream
124  * colormap flag (0 means return RGB image if color;
125  * 1 means create colormap and return 8 bpp
126  * palette image if color)
127  * reduction (scaling factor: 1, 2, 4 or 8)
128  * &pnwarn (<optional return> number of warnings)
129  * hint: a bitwise OR of L_HINT_* values
130  * Return: pix, or null on error
131  *
132  * Usage: see pixReadJpeg()
133  */
134 PIX *
136  l_int32 cmflag,
138  l_int32 *pnwarn,
139  l_int32 hint)
140 {
141 l_uint8 rval, gval, bval;
142 l_int32 i, j, k;
143 l_int32 w, h, wpl, spp, ncolors, cindex;
144 l_uint32 *data;
145 l_uint32 *line, *ppixel;
146 JSAMPROW rowbuffer;
147 PIX *pix;
148 PIXCMAP *cmap;
149 struct jpeg_decompress_struct cinfo;
150 struct jpeg_error_mgr jerr;
151 
152  PROCNAME("pixReadStreamJpeg");
153 
154  if (!fp)
155  return (PIX *)ERROR_PTR("fp not defined", procName, NULL);
156  if (pnwarn)
157  *pnwarn = 0; /* init */
158  if (cmflag != 0 && cmflag != 1)
159  cmflag = 0; /* default */
160  if (reduction != 1 && reduction != 2 && reduction != 4 && reduction != 8)
161  return (PIX *)ERROR_PTR("reduction not in {1,2,4,8}", procName, NULL);
162 
163  if (BITS_IN_JSAMPLE != 8) /* set in jmorecfg.h */
164  return (PIX *)ERROR_PTR("BITS_IN_JSAMPLE != 8", procName, NULL);
165 
166  rewind(fp);
167 
168  pix = NULL; /* init */
169  if (setjmp(jpeg_jmpbuf)) {
170  pixDestroy(&pix);
171  FREE((void *)rowbuffer);
172  return (PIX *)ERROR_PTR("internal jpeg error", procName, NULL);
173  }
174 
175  rowbuffer = NULL;
176  cinfo.err = jpeg_std_error(&jerr);
177  jerr.error_exit = jpeg_error_do_not_exit; /* catch error; do not exit! */
178 
179  jpeg_create_decompress(&cinfo);
180  jpeg_stdio_src(&cinfo, fp);
181  jpeg_read_header(&cinfo, TRUE);
182  cinfo.scale_denom = reduction;
183  if (hint & L_HINT_GRAY)
186 
187  /* Allocate the image and a row buffer */
188  spp = cinfo.out_color_components;
189  if (spp != 1 && spp != 3)
190  return (PIX *)ERROR_PTR("spp must be 1 or 3", procName, NULL);
191  w = cinfo.output_width;
192  h = cinfo.output_height;
193  if ((spp == 3) && (cmflag == 0)) /* get full color pix */
194  {
195  if ((rowbuffer = (JSAMPROW)CALLOC(sizeof(JSAMPLE), spp * w)) == NULL)
196  return (PIX *)ERROR_PTR("rowbuffer not made", procName, NULL);
197  if ((pix = pixCreate(w, h, 32)) == NULL)
198  return (PIX *)ERROR_PTR("pix not made", procName, NULL);
199  }
200  else { /* 8 bpp gray or colormapped */
201  if ((rowbuffer = (JSAMPROW)CALLOC(sizeof(JSAMPLE), w)) == NULL)
202  return (PIX *)ERROR_PTR("rowbuffer not made", procName, NULL);
203  if ((pix = pixCreate(w, h, 8)) == NULL)
204  return (PIX *)ERROR_PTR("pix not made", procName, NULL);
205  }
206 
207  if (spp == 1) /* Grayscale or colormapped */
208  jpeg_start_decompress(&cinfo);
209  else { /* Color; spp == 3 */
210  if (cmflag == 0) { /* -- 24 bit color in 32 bit pix -- */
211  cinfo.quantize_colors = FALSE;
212  jpeg_start_decompress(&cinfo);
213  }
214  else { /* Color quantize to 8 bits */
215  cinfo.quantize_colors = TRUE;
216  cinfo.desired_number_of_colors = 256;
217  jpeg_start_decompress(&cinfo);
218 
219  /* Construct a pix cmap */
220  cmap = pixcmapCreate(8);
221  ncolors = cinfo.actual_number_of_colors;
222  for (cindex = 0; cindex < ncolors; cindex++)
223  {
224  rval = cinfo.colormap[0][cindex];
225  gval = cinfo.colormap[1][cindex];
226  bval = cinfo.colormap[2][cindex];
227  pixcmapAddColor(cmap, rval, gval, bval);
228  }
230  }
231  }
232 
233  wpl = pixGetWpl(pix);
234  data = pixGetData(pix);
235 
236  /* Decompress */
237  if ((spp == 3) && (cmflag == 0))
238  { /* -- 24 bit color -- */
239  for (i = 0; i < h; i++) {
240  if (jpeg_read_scanlines(&cinfo, &rowbuffer, (JDIMENSION)1) != 1)
241  return (PIX *)ERROR_PTR("bad read scanline", procName, NULL);
242  ppixel = data + i * wpl;
243  for (j = k = 0; j < w; j++)
244  {
245  SET_DATA_BYTE(ppixel, COLOR_RED, rowbuffer[k++]);
246  SET_DATA_BYTE(ppixel, COLOR_GREEN, rowbuffer[k++]);
247  SET_DATA_BYTE(ppixel, COLOR_BLUE, rowbuffer[k++]);
248  ppixel++;
249  }
250  }
251  }
252  else { /* 8 bpp grayscale or colormapped pix */
253  for (i = 0; i < h; i++) {
254  if (jpeg_read_scanlines(&cinfo, &rowbuffer, (JDIMENSION)1) != 1)
255  return (PIX *)ERROR_PTR("bad read scanline", procName, NULL);
256  line = data + i * wpl;
257  for (j = 0; j < w; j++)
258  SET_DATA_BYTE(line, j, rowbuffer[j]);
259  }
260  }
261 
262  if (pnwarn)
263  *pnwarn = cinfo.err->num_warnings;
264 
265  switch (cinfo.density_unit)
266  {
267  case 1: /* pixels per inch */
268  pixSetXRes(pix, cinfo.X_density);
269  pixSetYRes(pix, cinfo.Y_density);
270  break;
271  case 2: /* pixels per centimeter */
272  pixSetXRes(pix, (l_int32)((l_float32)cinfo.X_density * 2.54 + 0.5));
273  pixSetYRes(pix, (l_int32)((l_float32)cinfo.Y_density * 2.54 + 0.5));
274  break;
275  default: /* the pixel density may not be defined; ignore */
276  break;
277  }
278 
279  jpeg_finish_decompress(&cinfo);
280  jpeg_destroy_decompress(&cinfo);
281  FREE((void *)rowbuffer);
282 
283  return pix;
284 }
285 
286 
287 
288 /*---------------------------------------------------------------------*
289  * Writing Jpeg *
290  *---------------------------------------------------------------------*/
291 /*!
292  * pixWriteJpeg()
293  *
294  * Input: filename
295  * pix
296  * quality (1 - 100; 75 is default)
297  * progressive (0 for baseline sequential; 1 for progressive)
298  * Return: 0 if OK; 1 on error
299  */
300 l_int32
301 pixWriteJpeg(const char *filename,
302  PIX *pix,
304  l_int32 progressive)
305 {
306 FILE *fp;
307 
308  PROCNAME("pixWriteJpeg");
309 
310  if (!pix)
311  return ERROR_INT("pix not defined", procName, 1);
312  if (!filename)
313  return ERROR_INT("filename not defined", procName, 1);
314 
315  if ((fp = fopen(filename, "wb+")) == NULL)
316  return ERROR_INT("stream not opened", procName, 1);
317 
318  if (pixWriteStreamJpeg(fp, pix, quality, progressive)) {
319  fclose(fp);
320  return ERROR_INT("pix not written to stream", procName, 1);
321  }
322 
323  fclose(fp);
324  return 0;
325 }
326 
327 
328 /*!
329  * pixWriteStreamJpeg()
330  *
331  * Input: stream
332  * pix (8 or 32 bpp)
333  * quality (1 - 100; 75 is default value; 0 is also default)
334  * progressive (0 for baseline sequential; 1 for progressive)
335  * Return: 0 if OK, 1 on error
336  *
337  * Action: there are three possibilities
338  * (1) grayscale image, no colormap: compress as 8 bpp image.
339  * (2) 24 bpp full color image: copy each line into the color
340  * line buffer, and compress as three 8 bpp images.
341  * (3) 8 bpp colormapped image: convert each line to three
342  * 8 bpp line images in the color line buffer, and
343  * compress as three 8 bpp images.
344  *
345  * Notes:
346  * (1) Under the covers, the library transforms rgb to a
347  * luminence-chromaticity triple, each component of which is
348  * also 8 bits, and compresses that. It uses 2 Huffman tables,
349  * a higher resolution one (with more quantization levels)
350  * for luminosity and a lower resolution one for the chromas.
351  * (2) Progressive encoding gives better compression, at the
352  * expense of slower encoding and decoding.
353  */
354 l_int32
356  PIX *pix,
358  l_int32 progressive)
359 {
360 l_uint8 byteval;
361 l_int32 xres, yres;
362 l_int32 i, j, k;
363 l_int32 w, h, d, wpl, spp, colorflg, rowsamples;
364 l_int32 *rmap, *gmap, *bmap;
365 l_uint32 *ppixel, *line, *data;
366 JSAMPROW rowbuffer;
367 PIXCMAP *cmap;
368 struct jpeg_compress_struct cinfo;
369 struct jpeg_error_mgr jerr;
370 const char *text;
371 
372  PROCNAME("pixWriteStreamJpeg");
373 
374  if (!fp)
375  return ERROR_INT("stream not open", procName, 1);
376  if (!pix)
377  return ERROR_INT("pix not defined", procName, 1);
378  rewind(fp);
379 
380  if (setjmp(jpeg_jmpbuf)) {
381  FREE((void *)rowbuffer);
382  if (colorflg == 1) {
383  FREE((void *)rmap);
384  FREE((void *)gmap);
385  FREE((void *)bmap);
386  }
387  return ERROR_INT("internal jpeg error", procName, 1);
388  }
389 
390  rowbuffer = NULL;
391  rmap = NULL;
392  gmap = NULL;
393  bmap = NULL;
394  w = pixGetWidth(pix);
395  h = pixGetHeight(pix);
396  d = pixGetDepth(pix);
397  if (d != 8 && d != 32)
398  return ERROR_INT("bpp must be 8 or 32", procName, 1);
399 
400  if (quality <= 0)
401  quality = 75; /* default */
402 
403  if (d == 32)
404  colorflg = 2; /* 24 bpp rgb; no colormap */
405  else if ((cmap = pixGetColormap(pix)) == NULL)
406  colorflg = 0; /* 8 bpp grayscale; no colormap */
407  else {
408  colorflg = 1; /* 8 bpp; colormap */
409  pixcmapToArrays(cmap, &rmap, &gmap, &bmap);
410  }
411 
412  cinfo.err = jpeg_std_error(&jerr);
413  jerr.error_exit = jpeg_error_do_not_exit; /* catch error; do not exit! */
414 
415  jpeg_create_compress(&cinfo);
416  jpeg_stdio_dest(&cinfo, fp);
417 
418  cinfo.image_width = w;
419  cinfo.image_height = h;
420 
421  if (colorflg == 0) {
422  cinfo.input_components = 1;
424  }
425  else { /* colorflg == 1 or 2 */
426  cinfo.input_components = 3;
427  cinfo.in_color_space = JCS_RGB;
428  }
429 
430  jpeg_set_defaults(&cinfo);
431 
432  xres = pixGetXRes(pix);
433  yres = pixGetYRes(pix);
434  if ((xres != 0) && (yres != 0)) {
435  cinfo.density_unit = 1; /* designates pixels per inch */
436  cinfo.X_density = xres;
437  cinfo.Y_density = yres;
438  }
439 
440  jpeg_set_quality(&cinfo, quality, TRUE);
441  if (progressive) {
442  jpeg_simple_progression(&cinfo);
443  }
444 
445  jpeg_start_compress(&cinfo, TRUE);
446 
447  if ((text = pixGetText(pix))) {
448  jpeg_write_marker(&cinfo, JPEG_COM, (const JOCTET *)text, strlen(text));
449  }
450 
451  /* Allocate row buffer */
452  spp = cinfo.input_components;
453  rowsamples = spp * w;
454  if ((rowbuffer = (JSAMPROW)CALLOC(sizeof(JSAMPLE), rowsamples)) == NULL)
455  return ERROR_INT("calloc fail for rowbuffer", procName, 1);
456 
457  data = pixGetData(pix);
458  wpl = pixGetWpl(pix);
459  for (i = 0; i < h; i++) {
460  line = data + i * wpl;
461  if (colorflg == 0) { /* 8 bpp gray */
462  for (j = 0; j < w; j++)
463  rowbuffer[j] = GET_DATA_BYTE(line, j);
464  }
465  else if (colorflg == 1) { /* 8 bpp colormapped */
466  for (j = 0; j < w; j++) {
467  byteval = GET_DATA_BYTE(line, j);
468  rowbuffer[3 * j + COLOR_RED] = rmap[byteval];
469  rowbuffer[3 * j + COLOR_GREEN] = gmap[byteval];
470  rowbuffer[3 * j + COLOR_BLUE] = bmap[byteval];
471  }
472  }
473  else { /* 24 bpp color */
474  ppixel = line;
475  for (j = k = 0; j < w; j++) {
476  rowbuffer[k++] = GET_DATA_BYTE(ppixel, COLOR_RED);
477  rowbuffer[k++] = GET_DATA_BYTE(ppixel, COLOR_GREEN);
478  rowbuffer[k++] = GET_DATA_BYTE(ppixel, COLOR_BLUE);
479  ppixel++;
480  }
481  }
482  jpeg_write_scanlines(&cinfo, &rowbuffer, 1);
483  }
484 
485  jpeg_finish_compress(&cinfo);
486 
487  FREE((void *)rowbuffer);
488  if (colorflg == 1) {
489  FREE((void *)rmap);
490  FREE((void *)gmap);
491  FREE((void *)bmap);
492  }
493 
494  jpeg_destroy_compress(&cinfo);
495 
496  return 0;
497 }
498 
499 
500  /* The default jpeg error_exit() kills the process.
501  * We don't want leptonica to allow this to happen.
502  * If you want this default behavior, remove the
503  * calls to this in the functions above. */
505 {
506  (*cinfo->err->output_message) (cinfo);
507  jpeg_destroy(cinfo);
508  longjmp(jpeg_jmpbuf, 0);
509  return;
510 }
#define text(a)
Definition: aptex-macros.h:925
#define GET_DATA_BYTE(pdata, n)
Definition: arrayaccess.h:98
#define SET_DATA_BYTE(pdata, n, val)
Definition: arrayaccess.h:106
static char gmap[128]
Definition: asciitopgm.c:19
PIXCMAP * pixcmapCreate(l_int32 depth)
Definition: colormap.c:68
l_int32 pixcmapAddColor(PIXCMAP *cmap, l_int32 rval, l_int32 gval, l_int32 bval)
Definition: colormap.c:162
l_int32 pixcmapToArrays(PIXCMAP *cmap, l_int32 **prmap, l_int32 **pgmap, l_int32 **pbmap)
Definition: colormap.c:616
@ FALSE
Definition: dd.h:101
@ TRUE
Definition: dd.h:102
int w
Definition: dviconv.c:26
int h
Definition: dviconv.c:9
#define fopen
Definition: xxstdio.h:21
struct rect data
Definition: dvipdfm.c:64
#define PROCNAME(name)
Definition: environ.h:131
#define ERROR_PTR(a, b, c)
Definition: environ.h:132
unsigned int l_uint32
Definition: environ.h:33
unsigned char l_uint8
Definition: environ.h:29
#define ERROR_INT(a, b, c)
Definition: environ.h:133
int l_int32
Definition: environ.h:32
float l_float32
Definition: environ.h:34
#define d(n)
Definition: gpos-common.c:151
struct fractpoint hint
Definition: hints.c:78
const unsigned char FREE
Definition: image.cpp:34
@ L_HINT_GRAY
Definition: imageio.h:51
pix
Definition: in_pcx.cpp:383
PIX * pixReadStreamJpeg(FILE *fp, l_int32 cmflag, l_int32 reduction, l_int32 *pnwarn, l_int32 hint)
Definition: jpegio.c:135
static jmp_buf jpeg_jmpbuf
Definition: jpegio.c:58
l_int32 pixWriteJpeg(const char *filename, PIX *pix, l_int32 quality, l_int32 progressive)
Definition: jpegio.c:301
static void jpeg_error_do_not_exit(j_common_ptr cinfo)
Definition: jpegio.c:504
PIX * pixReadJpeg(const char *filename, l_int32 cmflag, l_int32 reduction, l_int32 *pnwarn)
Definition: jpegio.c:90
l_int32 pixWriteStreamJpeg(FILE *fp, PIX *pix, l_int32 quality, l_int32 progressive)
Definition: jpegio.c:355
void jpeg_destroy_compress(j_compress_ptr cinfo)
Definition: jcapimin.c:88
void jpeg_write_marker(j_compress_ptr cinfo, int marker, const JOCTET *dataptr, unsigned int datalen)
Definition: jcapimin.c:192
void jpeg_finish_compress(j_compress_ptr cinfo)
Definition: jcapimin.c:147
void jpeg_start_compress(j_compress_ptr cinfo, boolean write_all_tables)
Definition: jcapistd.c:38
JDIMENSION jpeg_write_scanlines(j_compress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION num_lines)
Definition: jcapistd.c:77
void jpeg_destroy(j_common_ptr cinfo)
Definition: jcomapi.c:69
void jpeg_set_defaults(j_compress_ptr cinfo)
Definition: jcparam.c:268
void jpeg_set_quality(j_compress_ptr cinfo, int quality, boolean force_baseline)
Definition: jcparam.c:132
void jpeg_simple_progression(j_compress_ptr cinfo)
Definition: jcparam.c:537
boolean jpeg_finish_decompress(j_decompress_ptr cinfo)
Definition: jdapimin.c:369
void jpeg_destroy_decompress(j_decompress_ptr cinfo)
Definition: jdapimin.c:91
int jpeg_read_header(j_decompress_ptr cinfo, boolean require_image)
Definition: jdapimin.c:241
JDIMENSION jpeg_read_scanlines(j_decompress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION max_lines)
Definition: jdapistd.c:152
boolean jpeg_start_decompress(j_decompress_ptr cinfo)
Definition: jdapistd.c:38
void jpeg_stdio_dest(j_compress_ptr cinfo, FILE *outfile)
Definition: jdatadst.c:130
void jpeg_stdio_src(j_decompress_ptr cinfo, FILE *infile)
Definition: jdatasrc.c:182
void jpeg_calc_output_dimensions(j_decompress_ptr cinfo)
Definition: jdmaster.c:84
struct jpeg_error_mgr * jpeg_std_error(struct jpeg_error_mgr *err)
Definition: jerror.c:231
unsigned int JDIMENSION
Definition: jmorecfg.h:171
char JOCTET
Definition: jmorecfg.h:115
char JSAMPLE
Definition: jmorecfg.h:64
#define BITS_IN_JSAMPLE
Definition: jmorecfg.h:23
JSAMPLE * JSAMPROW
Definition: jpeglib.h:66
@ JCS_GRAYSCALE
Definition: jpeglib.h:208
@ JCS_RGB
Definition: jpeglib.h:209
#define jpeg_create_decompress(cinfo)
Definition: jpeglib.h:897
#define jpeg_create_compress(cinfo)
Definition: jpeglib.h:894
#define JPEG_COM
Definition: jpeglib.h:1048
#define NULL
Definition: ftobjs.h:61
small capitals from c petite p scientific i
Definition: afcover.h:80
#define fclose
Definition: debug.h:100
#define CALLOC(t, n)
Definition: hash.c:21
l_uint32 * pixGetData(PIX *pix)
Definition: pix1.c:793
void pixDestroy(PIX **ppix)
Definition: pix1.c:225
l_int32 pixSetYRes(PIX *pix, l_uint32 res)
Definition: pix1.c:602
l_int32 pixSetXRes(PIX *pix, l_uint32 res)
Definition: pix1.c:553
l_int32 pixGetWpl(PIX *pix)
Definition: pix1.c:477
l_int32 pixGetDepth(PIX *pix)
Definition: pix1.c:449
char * pixGetText(PIX *pix)
Definition: pix1.c:658
l_uint32 pixGetXRes(PIX *pix)
Definition: pix1.c:529
l_int32 pixSetColormap(PIX *pix, PIXCMAP *colormap)
Definition: pix1.c:778
PIXCMAP * pixGetColormap(PIX *pix)
Definition: pix1.c:766
l_uint32 pixGetYRes(PIX *pix)
Definition: pix1.c:541
FILE * fopenReadStream(const char *filename)
Definition: utils.c:992
PIX * pixCreate(l_int32 width, l_int32 height, l_int32 depth)
Definition: pix1.c:90
l_int32 pixGetHeight(PIX *pix)
Definition: pix1.c:419
l_int32 pixGetWidth(PIX *pix)
Definition: pix1.c:389
int k
Definition: otp-parser.c:70
static int xres
Definition: pbmto4425.c:21
static int yres
Definition: pbmto4425.c:22
char * filename[256]
Definition: pbmtopk.c:46
void reduction()
@ COLOR_BLUE
Definition: pix.h:102
@ COLOR_RED
Definition: pix.h:100
@ COLOR_GREEN
Definition: pix.h:101
#define fp
static int quality
Definition: ppmtopjxl.c:45
char line[1024]
Definition: process_score.c:29
#define gval(n)
Definition: ltable.h:14
Definition: pix.h:51
struct jpeg_error_mgr * err
Definition: jpeglib.h:254
JDIMENSION image_height
Definition: jpeglib.h:280
struct jpeg_error_mgr * err
Definition: jpeglib.h:269
J_COLOR_SPACE in_color_space
Definition: jpeglib.h:282
JDIMENSION image_width
Definition: jpeglib.h:279
JDIMENSION output_height
Definition: jpeglib.h:460
JSAMPARRAY colormap
Definition: jpeglib.h:479
boolean quantize_colors
Definition: jpeglib.h:443
J_COLOR_SPACE out_color_space
Definition: jpeglib.h:430
struct jpeg_error_mgr * err
Definition: jpeglib.h:412
JDIMENSION output_width
Definition: jpeglib.h:459
unsigned int scale_denom
Definition: jpeglib.h:432
long num_warnings
Definition: jpeglib.h:676
void(* error_exit)(j_common_ptr cinfo)
Definition: jpeglib.h:645
void(* output_message)(j_common_ptr cinfo)
Definition: jpeglib.h:649
Definition: bdf.c:133
#define FILE
Definition: t1stdio.h:34
int j
Definition: t4ht.c:1589
*job_name strlen((char *) job_name) - 4)
static unsigned short spp
Definition: tifftopnm.c:58
TT_CharMap cmap
Definition: ttf2pfb.c:163