Created
February 14, 2016 00:14
-
-
Save benklett/c8a87d6ac9f25a94b1d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -bur a/jpeg-9b/change.log b/jpeg-9b/change.log | |
--- a/jpeg-9b/change.log 2015-10-09 21:16:50.000000000 +0200 | |
+++ b/jpeg-9b/change.log 2016-01-17 10:02:20.000000000 +0100 | |
@@ -1,13 +1,16 @@ | |
CHANGE LOG for Independent JPEG Group's JPEG software | |
-Version 9b 10-Jan-2016 | |
+Version 9b 17-Jan-2016 | |
----------------------- | |
Improvements and optimizations in DCT and color calculations. | |
Normalize range limit array composition and access pattern. | |
Thank to Sia Furler and Maddie Ziegler for inspiration. | |
+Use merged upsample with scaled DCT sizes larger than 8. | |
+Thank to Taylor Hatala for inspiration. | |
+ | |
Check for excessive comment lengths in argument parsing in wrjpgcom.c. | |
Thank to Julian Cohen for hint. | |
diff -bur a/jpeg-9b/jdarith.c b/jpeg-9b/jdarith.c | |
--- a/jpeg-9b/jdarith.c 2013-10-23 01:18:28.000000000 +0200 | |
+++ b/jpeg-9b/jdarith.c 2015-12-21 21:40:54.000000000 +0100 | |
@@ -1,7 +1,7 @@ | |
/* | |
* jdarith.c | |
* | |
- * Developed 1997-2013 by Guido Vollbeding. | |
+ * Developed 1997-2015 by Guido Vollbeding. | |
* This file is part of the Independent JPEG Group's software. | |
* For conditions of distribution and use, see the accompanying README file. | |
* | |
@@ -94,7 +94,7 @@ | |
* (instead of fixed) with the bit shift counter CT. | |
* Thus, we also need only one (variable instead of | |
* fixed size) shift for the LPS/MPS decision, and | |
- * we can get away with any renormalization update | |
+ * we can do away with any renormalization update | |
* of C (except for new data insertion, of course). | |
* | |
* I've also introduced a new scheme for accessing | |
diff -bur a/jpeg-9b/jdmaster.c b/jpeg-9b/jdmaster.c | |
--- a/jpeg-9b/jdmaster.c 2015-07-19 20:16:40.000000000 +0200 | |
+++ b/jpeg-9b/jdmaster.c 2015-12-05 17:15:26.000000000 +0100 | |
@@ -45,11 +45,23 @@ | |
use_merged_upsample (j_decompress_ptr cinfo) | |
{ | |
#ifdef UPSAMPLE_MERGING_SUPPORTED | |
- /* Merging is the equivalent of plain box-filter upsampling */ | |
- if (cinfo->do_fancy_upsampling || cinfo->CCIR601_sampling) | |
+ /* Merging is the equivalent of plain box-filter upsampling. */ | |
+ /* The following condition is only needed if fancy shall select | |
+ * a different upsampling method. In our current implementation | |
+ * fancy only affects the DCT scaling, thus we can use fancy | |
+ * upsampling and merged upsample simultaneously, in particular | |
+ * with scaled DCT sizes larger than the default DCTSIZE. | |
+ */ | |
+#if 0 | |
+ if (cinfo->do_fancy_upsampling) | |
+ return FALSE; | |
+#endif | |
+ if (cinfo->CCIR601_sampling) | |
return FALSE; | |
/* jdmerge.c only supports YCC=>RGB color conversion */ | |
- if (cinfo->jpeg_color_space != JCS_YCbCr || cinfo->num_components != 3 || | |
+ if ((cinfo->jpeg_color_space != JCS_YCbCr && | |
+ cinfo->jpeg_color_space != JCS_BG_YCC) || | |
+ cinfo->num_components != 3 || | |
cinfo->out_color_space != JCS_RGB || | |
cinfo->out_color_components != RGB_PIXELSIZE || | |
cinfo->color_transform) | |
diff -bur a/jpeg-9b/jdmerge.c b/jpeg-9b/jdmerge.c | |
--- a/jpeg-9b/jdmerge.c 2013-04-13 18:20:44.000000000 +0200 | |
+++ b/jpeg-9b/jdmerge.c 2015-12-03 16:35:38.000000000 +0100 | |
@@ -2,7 +2,7 @@ | |
* jdmerge.c | |
* | |
* Copyright (C) 1994-1996, Thomas G. Lane. | |
- * Modified 2013 by Guido Vollbeding. | |
+ * Modified 2013-2015 by Guido Vollbeding. | |
* This file is part of the Independent JPEG Group's software. | |
* For conditions of distribution and use, see the accompanying README file. | |
* | |
@@ -24,7 +24,7 @@ | |
* multiplications needed for color conversion. | |
* | |
* This file currently provides implementations for the following cases: | |
- * YCbCr => RGB color conversion only. | |
+ * YCC => RGB color conversion only (YCbCr or BG_YCC). | |
* Sampling ratios of 2h1v or 2h2v. | |
* No scaling needed at upsample time. | |
* Corner-aligned (non-CCIR601) sampling alignment. | |
@@ -76,12 +76,13 @@ | |
/* | |
- * Initialize tables for YCC->RGB colorspace conversion. | |
+ * Initialize tables for YCbCr->RGB and BG_YCC->RGB colorspace conversion. | |
* This is taken directly from jdcolor.c; see that file for more info. | |
*/ | |
LOCAL(void) | |
build_ycc_rgb_table (j_decompress_ptr cinfo) | |
+/* Normal case, sYCC */ | |
{ | |
my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; | |
int i; | |
@@ -119,6 +120,46 @@ | |
} | |
+LOCAL(void) | |
+build_bg_ycc_rgb_table (j_decompress_ptr cinfo) | |
+/* Wide gamut case, bg-sYCC */ | |
+{ | |
+ my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; | |
+ int i; | |
+ INT32 x; | |
+ SHIFT_TEMPS | |
+ | |
+ upsample->Cr_r_tab = (int *) | |
+ (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, | |
+ (MAXJSAMPLE+1) * SIZEOF(int)); | |
+ upsample->Cb_b_tab = (int *) | |
+ (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, | |
+ (MAXJSAMPLE+1) * SIZEOF(int)); | |
+ upsample->Cr_g_tab = (INT32 *) | |
+ (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, | |
+ (MAXJSAMPLE+1) * SIZEOF(INT32)); | |
+ upsample->Cb_g_tab = (INT32 *) | |
+ (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, | |
+ (MAXJSAMPLE+1) * SIZEOF(INT32)); | |
+ | |
+ for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) { | |
+ /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */ | |
+ /* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */ | |
+ /* Cr=>R value is nearest int to 2.804 * x */ | |
+ upsample->Cr_r_tab[i] = (int) | |
+ RIGHT_SHIFT(FIX(2.804) * x + ONE_HALF, SCALEBITS); | |
+ /* Cb=>B value is nearest int to 3.544 * x */ | |
+ upsample->Cb_b_tab[i] = (int) | |
+ RIGHT_SHIFT(FIX(3.544) * x + ONE_HALF, SCALEBITS); | |
+ /* Cr=>G value is scaled-up -1.428272572 * x */ | |
+ upsample->Cr_g_tab[i] = (- FIX(1.428272572)) * x; | |
+ /* Cb=>G value is scaled-up -0.688272572 * x */ | |
+ /* We also add in ONE_HALF so that need not do it in inner loop */ | |
+ upsample->Cb_g_tab[i] = (- FIX(0.688272572)) * x + ONE_HALF; | |
+ } | |
+} | |
+ | |
+ | |
/* | |
* Initialize for an upsampling pass. | |
*/ | |
@@ -375,7 +416,7 @@ | |
upsample = (my_upsample_ptr) | |
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, | |
SIZEOF(my_upsampler)); | |
- cinfo->upsample = (struct jpeg_upsampler *) upsample; | |
+ cinfo->upsample = &upsample->pub; | |
upsample->pub.start_pass = start_pass_merged_upsample; | |
upsample->pub.need_context_rows = FALSE; | |
@@ -395,6 +436,9 @@ | |
upsample->spare_row = NULL; | |
} | |
+ if (cinfo->jpeg_color_space == JCS_BG_YCC) | |
+ build_bg_ycc_rgb_table(cinfo); | |
+ else | |
build_ycc_rgb_table(cinfo); | |
} | |
diff -bur a/jpeg-9b/jdsample.c b/jpeg-9b/jdsample.c | |
--- a/jpeg-9b/jdsample.c 2008-12-30 12:29:14.000000000 +0100 | |
+++ b/jpeg-9b/jdsample.c 2015-12-10 10:16:42.000000000 +0100 | |
@@ -2,7 +2,7 @@ | |
* jdsample.c | |
* | |
* Copyright (C) 1991-1996, Thomas G. Lane. | |
- * Modified 2002-2008 by Guido Vollbeding. | |
+ * Modified 2002-2015 by Guido Vollbeding. | |
* This file is part of the Independent JPEG Group's software. | |
* For conditions of distribution and use, see the accompanying README file. | |
* | |
@@ -296,13 +296,12 @@ | |
my_upsample_ptr upsample; | |
int ci; | |
jpeg_component_info * compptr; | |
- boolean need_buffer; | |
int h_in_group, v_in_group, h_out_group, v_out_group; | |
upsample = (my_upsample_ptr) | |
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, | |
SIZEOF(my_upsampler)); | |
- cinfo->upsample = (struct jpeg_upsampler *) upsample; | |
+ cinfo->upsample = &upsample->pub; | |
upsample->pub.start_pass = start_pass_upsample; | |
upsample->pub.upsample = sep_upsample; | |
upsample->pub.need_context_rows = FALSE; /* until we find out differently */ | |
@@ -325,17 +324,17 @@ | |
h_out_group = cinfo->max_h_samp_factor; | |
v_out_group = cinfo->max_v_samp_factor; | |
upsample->rowgroup_height[ci] = v_in_group; /* save for use later */ | |
- need_buffer = TRUE; | |
if (! compptr->component_needed) { | |
/* Don't bother to upsample an uninteresting component. */ | |
upsample->methods[ci] = noop_upsample; | |
- need_buffer = FALSE; | |
- } else if (h_in_group == h_out_group && v_in_group == v_out_group) { | |
+ continue; /* don't need to allocate buffer */ | |
+ } | |
+ if (h_in_group == h_out_group && v_in_group == v_out_group) { | |
/* Fullsize components can be processed without any work. */ | |
upsample->methods[ci] = fullsize_upsample; | |
- need_buffer = FALSE; | |
- } else if (h_in_group * 2 == h_out_group && | |
- v_in_group == v_out_group) { | |
+ continue; /* don't need to allocate buffer */ | |
+ } | |
+ if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) { | |
/* Special case for 2h1v upsampling */ | |
upsample->methods[ci] = h2v1_upsample; | |
} else if (h_in_group * 2 == h_out_group && | |
@@ -350,12 +349,10 @@ | |
upsample->v_expand[ci] = (UINT8) (v_out_group / v_in_group); | |
} else | |
ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL); | |
- if (need_buffer) { | |
upsample->color_buf[ci] = (*cinfo->mem->alloc_sarray) | |
((j_common_ptr) cinfo, JPOOL_IMAGE, | |
(JDIMENSION) jround_up((long) cinfo->output_width, | |
(long) cinfo->max_h_samp_factor), | |
(JDIMENSION) cinfo->max_v_samp_factor); | |
} | |
- } | |
} | |
diff -bur a/jpeg-9b/jversion.h b/jpeg-9b/jversion.h | |
--- a/jpeg-9b/jversion.h 2015-07-24 10:40:54.000000000 +0200 | |
+++ b/jpeg-9b/jversion.h 2016-01-17 10:04:18.000000000 +0100 | |
@@ -9,6 +9,6 @@ | |
*/ | |
-#define JVERSION "9b 10-Jan-2016" | |
+#define JVERSION "9b 17-Jan-2016" | |
#define JCOPYRIGHT "Copyright (C) 2016, Thomas G. Lane, Guido Vollbeding" | |
diff -bur a/jpeg-9b/README b/jpeg-9b/README | |
--- a/jpeg-9b/README 2015-09-18 13:22:18.000000000 +0200 | |
+++ b/jpeg-9b/README 2016-01-17 10:06:18.000000000 +0100 | |
@@ -1,7 +1,7 @@ | |
The Independent JPEG Group's JPEG software | |
========================================== | |
-README for release 9b of 10-Jan-2016 | |
+README for release 9b of 17-Jan-2016 | |
==================================== | |
This distribution contains the ninth public release of the Independent JPEG | |
diff -bur a/jpeg-9b/usage.txt b/jpeg-9b/usage.txt | |
--- a/jpeg-9b/usage.txt 2015-09-20 14:04:26.000000000 +0200 | |
+++ b/jpeg-9b/usage.txt 2016-01-03 11:06:14.000000000 +0100 | |
@@ -48,11 +48,12 @@ | |
The currently supported image file formats are: PPM (PBMPLUS color format), | |
PGM (PBMPLUS grayscale format), BMP, Targa, and RLE (Utah Raster Toolkit | |
-format). (RLE is supported only if the URT library is available.) | |
-cjpeg recognizes the input image format automatically, with the exception | |
-of some Targa-format files. You have to tell djpeg which format to generate. | |
+format). (RLE is supported only if the URT library is available, which it | |
+isn't on most non-Unix systems.) cjpeg recognizes the input image format | |
+automatically, with the exception of some Targa-format files. You have to | |
+tell djpeg which format to generate. | |
-JPEG files are in the defacto standard JFIF file format. There are other, | |
+JPEG files are in the standard JFIF file format. There are other, | |
less widely used JPEG-based file formats, but we don't support them. | |
All switch names may be abbreviated; for example, -grayscale may be written |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment