diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2016-03-27 01:38:28 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2016-03-27 01:38:28 +0000 |
commit | 367c9cb514c9da766488b9bdb218a18e31cb7624 (patch) | |
tree | f9e343be94161a4837f0f1c1d072a35538ae0f63 /converter/ppm/ppmtompeg/jpeg.c | |
parent | 6e88e3326cb0c7f7975b56189278cab3f84ba1bd (diff) | |
download | netpbm-mirror-367c9cb514c9da766488b9bdb218a18e31cb7624.tar.gz netpbm-mirror-367c9cb514c9da766488b9bdb218a18e31cb7624.tar.xz netpbm-mirror-367c9cb514c9da766488b9bdb218a18e31cb7624.zip |
Promote Stable (10.47) to Super Stable
git-svn-id: http://svn.code.sf.net/p/netpbm/code/super_stable@2691 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/ppm/ppmtompeg/jpeg.c')
-rw-r--r-- | converter/ppm/ppmtompeg/jpeg.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/converter/ppm/ppmtompeg/jpeg.c b/converter/ppm/ppmtompeg/jpeg.c index b51cf083..a703cf39 100644 --- a/converter/ppm/ppmtompeg/jpeg.c +++ b/converter/ppm/ppmtompeg/jpeg.c @@ -15,6 +15,7 @@ * HEADER FILES * *==============*/ #define _XOPEN_SOURCE /* Make sure stdio.h contains fileno() */ +#include <unistd.h> #include <stdio.h> #include "all.h" /* With the lossless jpeg patch applied to the Jpeg library @@ -52,6 +53,17 @@ extern void jcopy_sample_rows JPP((JSAMPARRAY input_array, int source_row, #define HEADER_SIZE 607 /*JFIF header size used on output images*/ +static int +minDctVScaledSize(struct jpeg_decompress_struct const cinfo) { + +#if JPEG_LIB_VERSION >= 70 + return cinfo.min_DCT_v_scaled_size; +#else + return cinfo.min_DCT_scaled_size; +#endif +} + + /*=======================================================================* * * @@ -416,11 +428,7 @@ ReadJPEG(MpegFrame * const mf, */ /* set parameters for decompression */ -#ifdef JPEG4 - cinfo.want_raw_output = TRUE; -#else cinfo.raw_data_out = TRUE; -#endif cinfo.out_color_space = JCS_YCbCr; /* calculate image output dimensions */ @@ -466,13 +474,7 @@ ReadJPEG(MpegFrame * const mf, /* Make an 8-row-high sample array that will go away when done with image */ -#ifdef JPEG4 - buffer_height = 8; /* could be 2, 4,8 rows high */ -#elif JPEG_LIB_VERSION >= 70 - buffer_height = cinfo.max_v_samp_factor * cinfo.min_DCT_v_scaled_size; -#else - buffer_height = cinfo.max_v_samp_factor * cinfo.min_DCT_scaled_size; -#endif + buffer_height = cinfo.max_v_samp_factor * minDctVScaledSize(cinfo); for(cp=0,compptr = cinfo.comp_info;cp<cinfo.num_components; cp++,compptr++) { @@ -496,11 +498,7 @@ ReadJPEG(MpegFrame * const mf, while (cinfo.output_scanline < cinfo.output_height) { -#ifdef JPEG4 - (void) jpeg_read_raw_scanlines(&cinfo, scanarray, buffer_height); -#else (void) jpeg_read_raw_data(&cinfo, scanarray, buffer_height); -#endif /* alter subsample ratio's if neccessary */ if ((h_samp[0]==2) && (h_samp[1]==1) && (h_samp[2]==1) && |