Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Unified Diff: rdcolmap.c

Issue 1953443002: Update to libjpeg_turbo 1.4.90 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « rdbmp.c ('k') | rdgif.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: rdcolmap.c
diff --git a/rdcolmap.c b/rdcolmap.c
index 42b343763b59af25303d43462c8149e837694a5b..ed8ca3b6ab9f8c41de3871a0b2cb1f17ebfda968 100644
--- a/rdcolmap.c
+++ b/rdcolmap.c
@@ -3,7 +3,8 @@
*
* Copyright (C) 1994-1996, Thomas G. Lane.
* This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
+ * For conditions of distribution and use, see the accompanying README.ijg
+ * file.
*
* This file implements djpeg's "-map file" switch. It reads a source image
* and constructs a colormap to be supplied to the JPEG decompressor.
@@ -21,9 +22,9 @@
* currently implemented.
*/
-#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */
+#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */
-#ifdef QUANT_2PASS_SUPPORTED /* otherwise can't quantize to supplied map */
+#ifdef QUANT_2PASS_SUPPORTED /* otherwise can't quantize to supplied map */
/* Portions of this code are based on the PBMPLUS library, which is:
**
@@ -54,9 +55,9 @@ add_map_entry (j_decompress_ptr cinfo, int R, int G, int B)
/* Check for duplicate color. */
for (index = 0; index < ncolors; index++) {
if (GETJSAMPLE(colormap0[index]) == R &&
- GETJSAMPLE(colormap1[index]) == G &&
- GETJSAMPLE(colormap2[index]) == B)
- return; /* color is already in map */
+ GETJSAMPLE(colormap1[index]) == G &&
+ GETJSAMPLE(colormap2[index]) == B)
+ return; /* color is already in map */
}
/* Check for map overflow. */
@@ -76,7 +77,7 @@ add_map_entry (j_decompress_ptr cinfo, int R, int G, int B)
*/
LOCAL(void)
-read_gif_map (j_decompress_ptr cinfo, FILE * infile)
+read_gif_map (j_decompress_ptr cinfo, FILE *infile)
{
int header[13];
int i, colormaplen;
@@ -107,9 +108,9 @@ read_gif_map (j_decompress_ptr cinfo, FILE * infile)
if (R == EOF || G == EOF || B == EOF)
ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
add_map_entry(cinfo,
- R << (BITS_IN_JSAMPLE-8),
- G << (BITS_IN_JSAMPLE-8),
- B << (BITS_IN_JSAMPLE-8));
+ R << (BITS_IN_JSAMPLE-8),
+ G << (BITS_IN_JSAMPLE-8),
+ B << (BITS_IN_JSAMPLE-8));
}
}
@@ -118,12 +119,12 @@ read_gif_map (j_decompress_ptr cinfo, FILE * infile)
LOCAL(int)
-pbm_getc (FILE * infile)
+pbm_getc (FILE *infile)
/* Read next char, skipping over any comments */
/* A comment/newline sequence is returned as a newline */
{
register int ch;
-
+
ch = getc(infile);
if (ch == '#') {
do {
@@ -135,7 +136,7 @@ pbm_getc (FILE * infile)
LOCAL(unsigned int)
-read_pbm_integer (j_decompress_ptr cinfo, FILE * infile)
+read_pbm_integer (j_decompress_ptr cinfo, FILE *infile)
/* Read an unsigned decimal integer from the PPM file */
/* Swallows one trailing character after the integer */
/* Note that on a 16-bit-int machine, only values up to 64k can be read. */
@@ -143,17 +144,17 @@ read_pbm_integer (j_decompress_ptr cinfo, FILE * infile)
{
register int ch;
register unsigned int val;
-
+
/* Skip any leading whitespace */
do {
ch = pbm_getc(infile);
if (ch == EOF)
ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
} while (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r');
-
+
if (ch < '0' || ch > '9')
ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
-
+
val = ch - '0';
while ((ch = pbm_getc(infile)) >= '0' && ch <= '9') {
val *= 10;
@@ -168,14 +169,14 @@ read_pbm_integer (j_decompress_ptr cinfo, FILE * infile)
*/
LOCAL(void)
-read_ppm_map (j_decompress_ptr cinfo, FILE * infile)
+read_ppm_map (j_decompress_ptr cinfo, FILE *infile)
{
int c;
unsigned int w, h, maxval, row, col;
int R, G, B;
/* Initial 'P' has already been read by read_color_map */
- c = getc(infile); /* save format discriminator for a sec */
+ c = getc(infile); /* save format discriminator for a sec */
/* while we fetch the remaining header info */
w = read_pbm_integer(cinfo, infile);
@@ -190,26 +191,26 @@ read_ppm_map (j_decompress_ptr cinfo, FILE * infile)
ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
switch (c) {
- case '3': /* it's a text-format PPM file */
+ case '3': /* it's a text-format PPM file */
for (row = 0; row < h; row++) {
for (col = 0; col < w; col++) {
- R = read_pbm_integer(cinfo, infile);
- G = read_pbm_integer(cinfo, infile);
- B = read_pbm_integer(cinfo, infile);
- add_map_entry(cinfo, R, G, B);
+ R = read_pbm_integer(cinfo, infile);
+ G = read_pbm_integer(cinfo, infile);
+ B = read_pbm_integer(cinfo, infile);
+ add_map_entry(cinfo, R, G, B);
}
}
break;
- case '6': /* it's a raw-format PPM file */
+ case '6': /* it's a raw-format PPM file */
for (row = 0; row < h; row++) {
for (col = 0; col < w; col++) {
- R = getc(infile);
- G = getc(infile);
- B = getc(infile);
- if (R == EOF || G == EOF || B == EOF)
- ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
- add_map_entry(cinfo, R, G, B);
+ R = getc(infile);
+ G = getc(infile);
+ B = getc(infile);
+ if (R == EOF || G == EOF || B == EOF)
+ ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
+ add_map_entry(cinfo, R, G, B);
}
}
break;
@@ -228,7 +229,7 @@ read_ppm_map (j_decompress_ptr cinfo, FILE * infile)
*/
GLOBAL(void)
-read_color_map (j_decompress_ptr cinfo, FILE * infile)
+read_color_map (j_decompress_ptr cinfo, FILE *infile)
{
/* Allocate space for a color map of maximum supported size. */
cinfo->colormap = (*cinfo->mem->alloc_sarray)
« no previous file with comments | « rdbmp.c ('k') | rdgif.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698