example.c: Write correct dimensions to PPM header
The dimensions in the PPM header of the output file generated by 'example decompress' were always 640 x 480, regardless of the size of the JPEG image being decompressed. Our regression tests (which this commit also fixes) missed the bug because they decompressed the 640 x 480 image generated by 'example compress'. Fixes #778
This commit is contained in:
@@ -1259,7 +1259,7 @@ foreach(libtype ${TEST_LIBTYPES})
|
|||||||
set(MD5_JPEG_CROP cdb35ff4b4519392690ea040c56ea99c)
|
set(MD5_JPEG_CROP cdb35ff4b4519392690ea040c56ea99c)
|
||||||
|
|
||||||
set(MD5_JPEG_EXAMPLE_COMPRESS 5e502da0c3c0f957a58c536f31e973dc)
|
set(MD5_JPEG_EXAMPLE_COMPRESS 5e502da0c3c0f957a58c536f31e973dc)
|
||||||
set(MD5_PPM_EXAMPLE_DECOMPRESS 2ff0e8505ee6e0ffaeb24037d5650b57)
|
set(MD5_PPM_EXAMPLE_DECOMPRESS 70194fdcb73370ee7ba0db868d0c6fc8)
|
||||||
else()
|
else()
|
||||||
set(cjpeg cjpeg)
|
set(cjpeg cjpeg)
|
||||||
set(djpeg djpeg)
|
set(djpeg djpeg)
|
||||||
@@ -1343,7 +1343,7 @@ foreach(libtype ${TEST_LIBTYPES})
|
|||||||
set(MD5_JPEG_CROP b4197f377e621c4e9b1d20471432610d)
|
set(MD5_JPEG_CROP b4197f377e621c4e9b1d20471432610d)
|
||||||
|
|
||||||
set(MD5_JPEG_EXAMPLE_COMPRESS 95d4d72e2ef127332654c2599afb47bf)
|
set(MD5_JPEG_EXAMPLE_COMPRESS 95d4d72e2ef127332654c2599afb47bf)
|
||||||
set(MD5_PPM_EXAMPLE_DECOMPRESS 6fdde7301575bfd711e295b969b6b3de)
|
set(MD5_PPM_EXAMPLE_DECOMPRESS dea1d7bbc37e39adf628342c86096641)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# CC: null SAMP: fullsize FDCT: islow ENT: huff
|
# CC: null SAMP: fullsize FDCT: islow ENT: huff
|
||||||
@@ -1673,9 +1673,7 @@ foreach(libtype ${TEST_LIBTYPES})
|
|||||||
|
|
||||||
add_test(NAME example-${sample_bits}bit-${libtype}-decompress
|
add_test(NAME example-${sample_bits}bit-${libtype}-decompress
|
||||||
COMMAND example${suffix} decompress ${EXAMPLE_12BIT_ARG}
|
COMMAND example${suffix} decompress ${EXAMPLE_12BIT_ARG}
|
||||||
${testout}-example.jpg ${testout}-example.ppm)
|
${TESTIMAGES}/${TESTORIG} ${testout}-example.ppm)
|
||||||
set_tests_properties(example-${sample_bits}bit-${libtype}-decompress
|
|
||||||
PROPERTIES DEPENDS example-${sample_bits}bit-${libtype}-compress)
|
|
||||||
add_test(NAME example-${sample_bits}bit-${libtype}-decompress-cmp
|
add_test(NAME example-${sample_bits}bit-${libtype}-decompress-cmp
|
||||||
COMMAND md5cmp ${MD5_PPM_EXAMPLE_DECOMPRESS} ${testout}-example.ppm)
|
COMMAND md5cmp ${MD5_PPM_EXAMPLE_DECOMPRESS} ${testout}-example.ppm)
|
||||||
set_tests_properties(example-${sample_bits}bit-${libtype}-decompress-cmp
|
set_tests_properties(example-${sample_bits}bit-${libtype}-decompress-cmp
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* This file was part of the Independent JPEG Group's software.
|
* This file was part of the Independent JPEG Group's software.
|
||||||
* Copyright (C) 1992-1996, Thomas G. Lane.
|
* Copyright (C) 1992-1996, Thomas G. Lane.
|
||||||
* libjpeg-turbo Modifications:
|
* libjpeg-turbo Modifications:
|
||||||
* Copyright (C) 2017, 2019, 2022-2023, D. R. Commander.
|
* Copyright (C) 2017, 2019, 2022-2024, D. R. Commander.
|
||||||
* For conditions of distribution and use, see the accompanying README.ijg
|
* For conditions of distribution and use, see the accompanying README.ijg
|
||||||
* file.
|
* file.
|
||||||
*
|
*
|
||||||
@@ -443,7 +443,7 @@ do_read_JPEG_file(struct jpeg_decompress_struct *cinfo, char *infilename,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* emit header for raw PPM format */
|
/* emit header for raw PPM format */
|
||||||
fprintf(outfile, "P6\n%d %d\n%d\n", WIDTH, HEIGHT,
|
fprintf(outfile, "P6\n%u %u\n%d\n", cinfo->image_width, cinfo->image_height,
|
||||||
cinfo->data_precision == 12 ? MAXJ12SAMPLE : MAXJSAMPLE);
|
cinfo->data_precision == 12 ? MAXJ12SAMPLE : MAXJSAMPLE);
|
||||||
|
|
||||||
/* Step 4: set parameters for decompression */
|
/* Step 4: set parameters for decompression */
|
||||||
|
|||||||
Reference in New Issue
Block a user