Eliminate excessive I/O overhead when reading BMP files in cjpeg
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@592 632fc199-4ca6-4c93-a231-07263d6284db
This commit is contained in:
@@ -27,6 +27,9 @@ enabled. This specifically caused the jpegoptim program to fail if it was
|
|||||||
linked against a version of libjpeg-turbo that was built with libjpeg v7 or v8
|
linked against a version of libjpeg-turbo that was built with libjpeg v7 or v8
|
||||||
emulation.
|
emulation.
|
||||||
|
|
||||||
|
[6] Eliminated excessive I/O overhead that occurred when reading BMP files in
|
||||||
|
cjpeg.
|
||||||
|
|
||||||
|
|
||||||
1.1.0
|
1.1.0
|
||||||
=====
|
=====
|
||||||
|
|||||||
12
rdbmp.c
12
rdbmp.c
@@ -3,6 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||||
* Modified 2009-2010 by Guido Vollbeding.
|
* Modified 2009-2010 by Guido Vollbeding.
|
||||||
|
* Modified 2011 by Siarhei Siamashka.
|
||||||
* This file is part of the Independent JPEG Group's software.
|
* 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 file.
|
||||||
*
|
*
|
||||||
@@ -220,10 +221,9 @@ preload_image (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
|
|||||||
{
|
{
|
||||||
bmp_source_ptr source = (bmp_source_ptr) sinfo;
|
bmp_source_ptr source = (bmp_source_ptr) sinfo;
|
||||||
register FILE *infile = source->pub.input_file;
|
register FILE *infile = source->pub.input_file;
|
||||||
register int c;
|
|
||||||
register JSAMPROW out_ptr;
|
register JSAMPROW out_ptr;
|
||||||
JSAMPARRAY image_ptr;
|
JSAMPARRAY image_ptr;
|
||||||
JDIMENSION row, col;
|
JDIMENSION row;
|
||||||
cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress;
|
cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress;
|
||||||
|
|
||||||
/* Read the data into a virtual array in input-file row order. */
|
/* Read the data into a virtual array in input-file row order. */
|
||||||
@@ -237,11 +237,11 @@ preload_image (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
|
|||||||
((j_common_ptr) cinfo, source->whole_image,
|
((j_common_ptr) cinfo, source->whole_image,
|
||||||
row, (JDIMENSION) 1, TRUE);
|
row, (JDIMENSION) 1, TRUE);
|
||||||
out_ptr = image_ptr[0];
|
out_ptr = image_ptr[0];
|
||||||
for (col = source->row_width; col > 0; col--) {
|
if (fread(out_ptr, 1, source->row_width, infile) != source->row_width) {
|
||||||
/* inline copy of read_byte() for speed */
|
if (feof(infile))
|
||||||
if ((c = getc(infile)) == EOF)
|
|
||||||
ERREXIT(cinfo, JERR_INPUT_EOF);
|
ERREXIT(cinfo, JERR_INPUT_EOF);
|
||||||
*out_ptr++ = (JSAMPLE) c;
|
else
|
||||||
|
ERREXIT(cinfo, JERR_FILE_READ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (progress != NULL)
|
if (progress != NULL)
|
||||||
|
|||||||
Reference in New Issue
Block a user