mirror of
https://github.com/opencv/opencv.git
synced 2024-11-27 20:50:25 +08:00
parent
3289a0aff9
commit
0ec72cbd10
15
3rdparty/libjpeg/README
vendored
15
3rdparty/libjpeg/README
vendored
@ -1,7 +1,7 @@
|
|||||||
The Independent JPEG Group's JPEG software
|
The Independent JPEG Group's JPEG software
|
||||||
==========================================
|
==========================================
|
||||||
|
|
||||||
README for release 9b of 17-Jan-2016
|
README for release 9c of 14-Jan-2018
|
||||||
====================================
|
====================================
|
||||||
|
|
||||||
This distribution contains the ninth public release of the Independent JPEG
|
This distribution contains the ninth public release of the Independent JPEG
|
||||||
@ -115,7 +115,7 @@ with respect to this software, its quality, accuracy, merchantability, or
|
|||||||
fitness for a particular purpose. This software is provided "AS IS", and you,
|
fitness for a particular purpose. This software is provided "AS IS", and you,
|
||||||
its user, assume the entire risk as to its quality and accuracy.
|
its user, assume the entire risk as to its quality and accuracy.
|
||||||
|
|
||||||
This software is copyright (C) 1991-2016, Thomas G. Lane, Guido Vollbeding.
|
This software is copyright (C) 1991-2018, Thomas G. Lane, Guido Vollbeding.
|
||||||
All Rights Reserved except as specified below.
|
All Rights Reserved except as specified below.
|
||||||
|
|
||||||
Permission is hereby granted to use, copy, modify, and distribute this
|
Permission is hereby granted to use, copy, modify, and distribute this
|
||||||
@ -246,8 +246,8 @@ ARCHIVE LOCATIONS
|
|||||||
The "official" archive site for this software is www.ijg.org.
|
The "official" archive site for this software is www.ijg.org.
|
||||||
The most recent released version can always be found there in
|
The most recent released version can always be found there in
|
||||||
directory "files". This particular version will be archived as
|
directory "files". This particular version will be archived as
|
||||||
http://www.ijg.org/files/jpegsrc.v9b.tar.gz, and in Windows-compatible
|
http://www.ijg.org/files/jpegsrc.v9c.tar.gz, and in Windows-compatible
|
||||||
"zip" archive format as http://www.ijg.org/files/jpegsr9b.zip.
|
"zip" archive format as http://www.ijg.org/files/jpegsr9c.zip.
|
||||||
|
|
||||||
The JPEG FAQ (Frequently Asked Questions) article is a source of some
|
The JPEG FAQ (Frequently Asked Questions) article is a source of some
|
||||||
general information about JPEG.
|
general information about JPEG.
|
||||||
@ -293,8 +293,11 @@ communication about JPEG configuration in Sigma Photo Pro software.
|
|||||||
|
|
||||||
Thank to Andrew Finkenstadt for hosting the ijg.org site.
|
Thank to Andrew Finkenstadt for hosting the ijg.org site.
|
||||||
|
|
||||||
Last but not least special thank to Thomas G. Lane for the original
|
Thank to Thomas G. Lane for the original design and development of
|
||||||
design and development of this singular software package.
|
this singular software package.
|
||||||
|
|
||||||
|
Thank to Lars Goehler, Andreas Heinecke, Sebastian Fuss, Yvonne Roebert,
|
||||||
|
Andrej Werner, and Ulf-Dietrich Braumann for support and public relations.
|
||||||
|
|
||||||
|
|
||||||
FILE FORMAT WARS
|
FILE FORMAT WARS
|
||||||
|
21
3rdparty/libjpeg/change.log
vendored
21
3rdparty/libjpeg/change.log
vendored
@ -1,6 +1,27 @@
|
|||||||
CHANGE LOG for Independent JPEG Group's JPEG software
|
CHANGE LOG for Independent JPEG Group's JPEG software
|
||||||
|
|
||||||
|
|
||||||
|
Version 9c 14-Jan-2018
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
jpegtran: add an option to the -wipe switch to fill the region
|
||||||
|
with the average of adjacent blocks, instead of gray out.
|
||||||
|
Thank to Caitlyn Feddock and Maddie Ziegler for inspiration.
|
||||||
|
|
||||||
|
Make range extension bits adjustable (in jpegint.h).
|
||||||
|
Thank to Robin Watts for suggestion.
|
||||||
|
|
||||||
|
Provide macros for fflush() and ferror() in jinclude.h in order
|
||||||
|
to facilitate adaption by applications using an own FILE class.
|
||||||
|
Thank to Gerhard Huber for suggestion.
|
||||||
|
|
||||||
|
Add libjpeg pkg-config file. Thank to Mark Lavi, Vincent Torri,
|
||||||
|
Patrick McMunn, and Huw Davies for suggestion.
|
||||||
|
|
||||||
|
Add sanity checks in cjpeg image reader modules.
|
||||||
|
Thank to Bingchang, Liu for reports.
|
||||||
|
|
||||||
|
|
||||||
Version 9b 17-Jan-2016
|
Version 9b 17-Jan-2016
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
|
169
3rdparty/libjpeg/jcinit.c
vendored
169
3rdparty/libjpeg/jcinit.c
vendored
@ -2,7 +2,7 @@
|
|||||||
* jcinit.c
|
* jcinit.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||||
* Modified 2003-2013 by Guido Vollbeding.
|
* Modified 2003-2017 by Guido Vollbeding.
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
@ -21,6 +21,168 @@
|
|||||||
#include "jpeglib.h"
|
#include "jpeglib.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Compute JPEG image dimensions and related values.
|
||||||
|
* NOTE: this is exported for possible use by application.
|
||||||
|
* Hence it mustn't do anything that can't be done twice.
|
||||||
|
*/
|
||||||
|
|
||||||
|
GLOBAL(void)
|
||||||
|
jpeg_calc_jpeg_dimensions (j_compress_ptr cinfo)
|
||||||
|
/* Do computations that are needed before master selection phase */
|
||||||
|
{
|
||||||
|
/* Sanity check on input image dimensions to prevent overflow in
|
||||||
|
* following calculations.
|
||||||
|
* We do check jpeg_width and jpeg_height in initial_setup in jcmaster.c,
|
||||||
|
* but image_width and image_height can come from arbitrary data,
|
||||||
|
* and we need some space for multiplication by block_size.
|
||||||
|
*/
|
||||||
|
if (((long) cinfo->image_width >> 24) || ((long) cinfo->image_height >> 24))
|
||||||
|
ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION);
|
||||||
|
|
||||||
|
#ifdef DCT_SCALING_SUPPORTED
|
||||||
|
|
||||||
|
/* Compute actual JPEG image dimensions and DCT scaling choices. */
|
||||||
|
if (cinfo->scale_num >= cinfo->scale_denom * cinfo->block_size) {
|
||||||
|
/* Provide block_size/1 scaling */
|
||||||
|
cinfo->jpeg_width = cinfo->image_width * cinfo->block_size;
|
||||||
|
cinfo->jpeg_height = cinfo->image_height * cinfo->block_size;
|
||||||
|
cinfo->min_DCT_h_scaled_size = 1;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 1;
|
||||||
|
} else if (cinfo->scale_num * 2 >= cinfo->scale_denom * cinfo->block_size) {
|
||||||
|
/* Provide block_size/2 scaling */
|
||||||
|
cinfo->jpeg_width = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 2L);
|
||||||
|
cinfo->jpeg_height = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 2L);
|
||||||
|
cinfo->min_DCT_h_scaled_size = 2;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 2;
|
||||||
|
} else if (cinfo->scale_num * 3 >= cinfo->scale_denom * cinfo->block_size) {
|
||||||
|
/* Provide block_size/3 scaling */
|
||||||
|
cinfo->jpeg_width = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 3L);
|
||||||
|
cinfo->jpeg_height = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 3L);
|
||||||
|
cinfo->min_DCT_h_scaled_size = 3;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 3;
|
||||||
|
} else if (cinfo->scale_num * 4 >= cinfo->scale_denom * cinfo->block_size) {
|
||||||
|
/* Provide block_size/4 scaling */
|
||||||
|
cinfo->jpeg_width = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 4L);
|
||||||
|
cinfo->jpeg_height = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 4L);
|
||||||
|
cinfo->min_DCT_h_scaled_size = 4;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 4;
|
||||||
|
} else if (cinfo->scale_num * 5 >= cinfo->scale_denom * cinfo->block_size) {
|
||||||
|
/* Provide block_size/5 scaling */
|
||||||
|
cinfo->jpeg_width = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 5L);
|
||||||
|
cinfo->jpeg_height = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 5L);
|
||||||
|
cinfo->min_DCT_h_scaled_size = 5;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 5;
|
||||||
|
} else if (cinfo->scale_num * 6 >= cinfo->scale_denom * cinfo->block_size) {
|
||||||
|
/* Provide block_size/6 scaling */
|
||||||
|
cinfo->jpeg_width = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 6L);
|
||||||
|
cinfo->jpeg_height = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 6L);
|
||||||
|
cinfo->min_DCT_h_scaled_size = 6;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 6;
|
||||||
|
} else if (cinfo->scale_num * 7 >= cinfo->scale_denom * cinfo->block_size) {
|
||||||
|
/* Provide block_size/7 scaling */
|
||||||
|
cinfo->jpeg_width = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 7L);
|
||||||
|
cinfo->jpeg_height = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 7L);
|
||||||
|
cinfo->min_DCT_h_scaled_size = 7;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 7;
|
||||||
|
} else if (cinfo->scale_num * 8 >= cinfo->scale_denom * cinfo->block_size) {
|
||||||
|
/* Provide block_size/8 scaling */
|
||||||
|
cinfo->jpeg_width = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 8L);
|
||||||
|
cinfo->jpeg_height = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 8L);
|
||||||
|
cinfo->min_DCT_h_scaled_size = 8;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 8;
|
||||||
|
} else if (cinfo->scale_num * 9 >= cinfo->scale_denom * cinfo->block_size) {
|
||||||
|
/* Provide block_size/9 scaling */
|
||||||
|
cinfo->jpeg_width = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 9L);
|
||||||
|
cinfo->jpeg_height = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 9L);
|
||||||
|
cinfo->min_DCT_h_scaled_size = 9;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 9;
|
||||||
|
} else if (cinfo->scale_num * 10 >= cinfo->scale_denom * cinfo->block_size) {
|
||||||
|
/* Provide block_size/10 scaling */
|
||||||
|
cinfo->jpeg_width = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 10L);
|
||||||
|
cinfo->jpeg_height = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 10L);
|
||||||
|
cinfo->min_DCT_h_scaled_size = 10;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 10;
|
||||||
|
} else if (cinfo->scale_num * 11 >= cinfo->scale_denom * cinfo->block_size) {
|
||||||
|
/* Provide block_size/11 scaling */
|
||||||
|
cinfo->jpeg_width = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 11L);
|
||||||
|
cinfo->jpeg_height = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 11L);
|
||||||
|
cinfo->min_DCT_h_scaled_size = 11;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 11;
|
||||||
|
} else if (cinfo->scale_num * 12 >= cinfo->scale_denom * cinfo->block_size) {
|
||||||
|
/* Provide block_size/12 scaling */
|
||||||
|
cinfo->jpeg_width = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 12L);
|
||||||
|
cinfo->jpeg_height = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 12L);
|
||||||
|
cinfo->min_DCT_h_scaled_size = 12;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 12;
|
||||||
|
} else if (cinfo->scale_num * 13 >= cinfo->scale_denom * cinfo->block_size) {
|
||||||
|
/* Provide block_size/13 scaling */
|
||||||
|
cinfo->jpeg_width = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 13L);
|
||||||
|
cinfo->jpeg_height = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 13L);
|
||||||
|
cinfo->min_DCT_h_scaled_size = 13;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 13;
|
||||||
|
} else if (cinfo->scale_num * 14 >= cinfo->scale_denom * cinfo->block_size) {
|
||||||
|
/* Provide block_size/14 scaling */
|
||||||
|
cinfo->jpeg_width = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 14L);
|
||||||
|
cinfo->jpeg_height = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 14L);
|
||||||
|
cinfo->min_DCT_h_scaled_size = 14;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 14;
|
||||||
|
} else if (cinfo->scale_num * 15 >= cinfo->scale_denom * cinfo->block_size) {
|
||||||
|
/* Provide block_size/15 scaling */
|
||||||
|
cinfo->jpeg_width = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 15L);
|
||||||
|
cinfo->jpeg_height = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 15L);
|
||||||
|
cinfo->min_DCT_h_scaled_size = 15;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 15;
|
||||||
|
} else {
|
||||||
|
/* Provide block_size/16 scaling */
|
||||||
|
cinfo->jpeg_width = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 16L);
|
||||||
|
cinfo->jpeg_height = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 16L);
|
||||||
|
cinfo->min_DCT_h_scaled_size = 16;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* !DCT_SCALING_SUPPORTED */
|
||||||
|
|
||||||
|
/* Hardwire it to "no scaling" */
|
||||||
|
cinfo->jpeg_width = cinfo->image_width;
|
||||||
|
cinfo->jpeg_height = cinfo->image_height;
|
||||||
|
cinfo->min_DCT_h_scaled_size = DCTSIZE;
|
||||||
|
cinfo->min_DCT_v_scaled_size = DCTSIZE;
|
||||||
|
|
||||||
|
#endif /* DCT_SCALING_SUPPORTED */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Master selection of compression modules.
|
* Master selection of compression modules.
|
||||||
* This is done once at the start of processing an image. We determine
|
* This is done once at the start of processing an image. We determine
|
||||||
@ -37,7 +199,7 @@ jinit_compress_master (j_compress_ptr cinfo)
|
|||||||
if (cinfo->data_precision != BITS_IN_JSAMPLE)
|
if (cinfo->data_precision != BITS_IN_JSAMPLE)
|
||||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||||
|
|
||||||
/* Sanity check on image dimensions */
|
/* Sanity check on input image dimensions */
|
||||||
if (cinfo->image_height <= 0 || cinfo->image_width <= 0 ||
|
if (cinfo->image_height <= 0 || cinfo->image_width <= 0 ||
|
||||||
cinfo->input_components <= 0)
|
cinfo->input_components <= 0)
|
||||||
ERREXIT(cinfo, JERR_EMPTY_IMAGE);
|
ERREXIT(cinfo, JERR_EMPTY_IMAGE);
|
||||||
@ -48,6 +210,9 @@ jinit_compress_master (j_compress_ptr cinfo)
|
|||||||
if ((long) jd_samplesperrow != samplesperrow)
|
if ((long) jd_samplesperrow != samplesperrow)
|
||||||
ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
|
ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
|
||||||
|
|
||||||
|
/* Compute JPEG image dimensions and related values. */
|
||||||
|
jpeg_calc_jpeg_dimensions(cinfo);
|
||||||
|
|
||||||
/* Initialize master control (includes parameter checking/processing) */
|
/* Initialize master control (includes parameter checking/processing) */
|
||||||
jinit_c_master_control(cinfo, FALSE /* full compression */);
|
jinit_c_master_control(cinfo, FALSE /* full compression */);
|
||||||
|
|
||||||
|
192
3rdparty/libjpeg/jcmaster.c
vendored
192
3rdparty/libjpeg/jcmaster.c
vendored
@ -2,7 +2,7 @@
|
|||||||
* jcmaster.c
|
* jcmaster.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||||
* Modified 2003-2013 by Guido Vollbeding.
|
* Modified 2003-2017 by Guido Vollbeding.
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
@ -43,191 +43,13 @@ typedef my_comp_master * my_master_ptr;
|
|||||||
* Support routines that do various essential calculations.
|
* Support routines that do various essential calculations.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* Compute JPEG image dimensions and related values.
|
|
||||||
* NOTE: this is exported for possible use by application.
|
|
||||||
* Hence it mustn't do anything that can't be done twice.
|
|
||||||
*/
|
|
||||||
|
|
||||||
GLOBAL(void)
|
|
||||||
jpeg_calc_jpeg_dimensions (j_compress_ptr cinfo)
|
|
||||||
/* Do computations that are needed before master selection phase */
|
|
||||||
{
|
|
||||||
#ifdef DCT_SCALING_SUPPORTED
|
|
||||||
|
|
||||||
/* Sanity check on input image dimensions to prevent overflow in
|
|
||||||
* following calculation.
|
|
||||||
* We do check jpeg_width and jpeg_height in initial_setup below,
|
|
||||||
* but image_width and image_height can come from arbitrary data,
|
|
||||||
* and we need some space for multiplication by block_size.
|
|
||||||
*/
|
|
||||||
if (((long) cinfo->image_width >> 24) || ((long) cinfo->image_height >> 24))
|
|
||||||
ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION);
|
|
||||||
|
|
||||||
/* Compute actual JPEG image dimensions and DCT scaling choices. */
|
|
||||||
if (cinfo->scale_num >= cinfo->scale_denom * cinfo->block_size) {
|
|
||||||
/* Provide block_size/1 scaling */
|
|
||||||
cinfo->jpeg_width = cinfo->image_width * cinfo->block_size;
|
|
||||||
cinfo->jpeg_height = cinfo->image_height * cinfo->block_size;
|
|
||||||
cinfo->min_DCT_h_scaled_size = 1;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 1;
|
|
||||||
} else if (cinfo->scale_num * 2 >= cinfo->scale_denom * cinfo->block_size) {
|
|
||||||
/* Provide block_size/2 scaling */
|
|
||||||
cinfo->jpeg_width = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 2L);
|
|
||||||
cinfo->jpeg_height = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 2L);
|
|
||||||
cinfo->min_DCT_h_scaled_size = 2;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 2;
|
|
||||||
} else if (cinfo->scale_num * 3 >= cinfo->scale_denom * cinfo->block_size) {
|
|
||||||
/* Provide block_size/3 scaling */
|
|
||||||
cinfo->jpeg_width = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 3L);
|
|
||||||
cinfo->jpeg_height = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 3L);
|
|
||||||
cinfo->min_DCT_h_scaled_size = 3;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 3;
|
|
||||||
} else if (cinfo->scale_num * 4 >= cinfo->scale_denom * cinfo->block_size) {
|
|
||||||
/* Provide block_size/4 scaling */
|
|
||||||
cinfo->jpeg_width = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 4L);
|
|
||||||
cinfo->jpeg_height = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 4L);
|
|
||||||
cinfo->min_DCT_h_scaled_size = 4;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 4;
|
|
||||||
} else if (cinfo->scale_num * 5 >= cinfo->scale_denom * cinfo->block_size) {
|
|
||||||
/* Provide block_size/5 scaling */
|
|
||||||
cinfo->jpeg_width = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 5L);
|
|
||||||
cinfo->jpeg_height = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 5L);
|
|
||||||
cinfo->min_DCT_h_scaled_size = 5;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 5;
|
|
||||||
} else if (cinfo->scale_num * 6 >= cinfo->scale_denom * cinfo->block_size) {
|
|
||||||
/* Provide block_size/6 scaling */
|
|
||||||
cinfo->jpeg_width = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 6L);
|
|
||||||
cinfo->jpeg_height = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 6L);
|
|
||||||
cinfo->min_DCT_h_scaled_size = 6;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 6;
|
|
||||||
} else if (cinfo->scale_num * 7 >= cinfo->scale_denom * cinfo->block_size) {
|
|
||||||
/* Provide block_size/7 scaling */
|
|
||||||
cinfo->jpeg_width = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 7L);
|
|
||||||
cinfo->jpeg_height = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 7L);
|
|
||||||
cinfo->min_DCT_h_scaled_size = 7;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 7;
|
|
||||||
} else if (cinfo->scale_num * 8 >= cinfo->scale_denom * cinfo->block_size) {
|
|
||||||
/* Provide block_size/8 scaling */
|
|
||||||
cinfo->jpeg_width = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 8L);
|
|
||||||
cinfo->jpeg_height = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 8L);
|
|
||||||
cinfo->min_DCT_h_scaled_size = 8;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 8;
|
|
||||||
} else if (cinfo->scale_num * 9 >= cinfo->scale_denom * cinfo->block_size) {
|
|
||||||
/* Provide block_size/9 scaling */
|
|
||||||
cinfo->jpeg_width = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 9L);
|
|
||||||
cinfo->jpeg_height = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 9L);
|
|
||||||
cinfo->min_DCT_h_scaled_size = 9;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 9;
|
|
||||||
} else if (cinfo->scale_num * 10 >= cinfo->scale_denom * cinfo->block_size) {
|
|
||||||
/* Provide block_size/10 scaling */
|
|
||||||
cinfo->jpeg_width = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 10L);
|
|
||||||
cinfo->jpeg_height = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 10L);
|
|
||||||
cinfo->min_DCT_h_scaled_size = 10;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 10;
|
|
||||||
} else if (cinfo->scale_num * 11 >= cinfo->scale_denom * cinfo->block_size) {
|
|
||||||
/* Provide block_size/11 scaling */
|
|
||||||
cinfo->jpeg_width = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 11L);
|
|
||||||
cinfo->jpeg_height = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 11L);
|
|
||||||
cinfo->min_DCT_h_scaled_size = 11;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 11;
|
|
||||||
} else if (cinfo->scale_num * 12 >= cinfo->scale_denom * cinfo->block_size) {
|
|
||||||
/* Provide block_size/12 scaling */
|
|
||||||
cinfo->jpeg_width = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 12L);
|
|
||||||
cinfo->jpeg_height = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 12L);
|
|
||||||
cinfo->min_DCT_h_scaled_size = 12;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 12;
|
|
||||||
} else if (cinfo->scale_num * 13 >= cinfo->scale_denom * cinfo->block_size) {
|
|
||||||
/* Provide block_size/13 scaling */
|
|
||||||
cinfo->jpeg_width = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 13L);
|
|
||||||
cinfo->jpeg_height = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 13L);
|
|
||||||
cinfo->min_DCT_h_scaled_size = 13;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 13;
|
|
||||||
} else if (cinfo->scale_num * 14 >= cinfo->scale_denom * cinfo->block_size) {
|
|
||||||
/* Provide block_size/14 scaling */
|
|
||||||
cinfo->jpeg_width = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 14L);
|
|
||||||
cinfo->jpeg_height = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 14L);
|
|
||||||
cinfo->min_DCT_h_scaled_size = 14;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 14;
|
|
||||||
} else if (cinfo->scale_num * 15 >= cinfo->scale_denom * cinfo->block_size) {
|
|
||||||
/* Provide block_size/15 scaling */
|
|
||||||
cinfo->jpeg_width = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 15L);
|
|
||||||
cinfo->jpeg_height = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 15L);
|
|
||||||
cinfo->min_DCT_h_scaled_size = 15;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 15;
|
|
||||||
} else {
|
|
||||||
/* Provide block_size/16 scaling */
|
|
||||||
cinfo->jpeg_width = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 16L);
|
|
||||||
cinfo->jpeg_height = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 16L);
|
|
||||||
cinfo->min_DCT_h_scaled_size = 16;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 16;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else /* !DCT_SCALING_SUPPORTED */
|
|
||||||
|
|
||||||
/* Hardwire it to "no scaling" */
|
|
||||||
cinfo->jpeg_width = cinfo->image_width;
|
|
||||||
cinfo->jpeg_height = cinfo->image_height;
|
|
||||||
cinfo->min_DCT_h_scaled_size = DCTSIZE;
|
|
||||||
cinfo->min_DCT_v_scaled_size = DCTSIZE;
|
|
||||||
|
|
||||||
#endif /* DCT_SCALING_SUPPORTED */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
jpeg_calc_trans_dimensions (j_compress_ptr cinfo)
|
initial_setup (j_compress_ptr cinfo)
|
||||||
{
|
|
||||||
if (cinfo->min_DCT_h_scaled_size != cinfo->min_DCT_v_scaled_size)
|
|
||||||
ERREXIT2(cinfo, JERR_BAD_DCTSIZE,
|
|
||||||
cinfo->min_DCT_h_scaled_size, cinfo->min_DCT_v_scaled_size);
|
|
||||||
|
|
||||||
cinfo->block_size = cinfo->min_DCT_h_scaled_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
LOCAL(void)
|
|
||||||
initial_setup (j_compress_ptr cinfo, boolean transcode_only)
|
|
||||||
/* Do computations that are needed before master selection phase */
|
/* Do computations that are needed before master selection phase */
|
||||||
{
|
{
|
||||||
int ci, ssize;
|
int ci, ssize;
|
||||||
jpeg_component_info *compptr;
|
jpeg_component_info *compptr;
|
||||||
|
|
||||||
if (transcode_only)
|
|
||||||
jpeg_calc_trans_dimensions(cinfo);
|
|
||||||
else
|
|
||||||
jpeg_calc_jpeg_dimensions(cinfo);
|
|
||||||
|
|
||||||
/* Sanity check on block_size */
|
/* Sanity check on block_size */
|
||||||
if (cinfo->block_size < 1 || cinfo->block_size > 16)
|
if (cinfo->block_size < 1 || cinfo->block_size > 16)
|
||||||
ERREXIT2(cinfo, JERR_BAD_DCTSIZE, cinfo->block_size, cinfo->block_size);
|
ERREXIT2(cinfo, JERR_BAD_DCTSIZE, cinfo->block_size, cinfo->block_size);
|
||||||
@ -414,13 +236,9 @@ validate_script (j_compress_ptr cinfo)
|
|||||||
* out-of-range reconstructed DC values during the first DC scan,
|
* out-of-range reconstructed DC values during the first DC scan,
|
||||||
* which might cause problems for some decoders.
|
* which might cause problems for some decoders.
|
||||||
*/
|
*/
|
||||||
#if BITS_IN_JSAMPLE == 8
|
|
||||||
#define MAX_AH_AL 10
|
|
||||||
#else
|
|
||||||
#define MAX_AH_AL 13
|
|
||||||
#endif
|
|
||||||
if (Ss < 0 || Ss >= DCTSIZE2 || Se < Ss || Se >= DCTSIZE2 ||
|
if (Ss < 0 || Ss >= DCTSIZE2 || Se < Ss || Se >= DCTSIZE2 ||
|
||||||
Ah < 0 || Ah > MAX_AH_AL || Al < 0 || Al > MAX_AH_AL)
|
Ah < 0 || Ah > (cinfo->data_precision > 8 ? 13 : 10) ||
|
||||||
|
Al < 0 || Al > (cinfo->data_precision > 8 ? 13 : 10))
|
||||||
ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
|
ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
|
||||||
if (Ss == 0) {
|
if (Ss == 0) {
|
||||||
if (Se != 0) /* DC and AC together not OK */
|
if (Se != 0) /* DC and AC together not OK */
|
||||||
@ -812,7 +630,7 @@ jinit_c_master_control (j_compress_ptr cinfo, boolean transcode_only)
|
|||||||
master->pub.is_last_pass = FALSE;
|
master->pub.is_last_pass = FALSE;
|
||||||
|
|
||||||
/* Validate parameters, determine derived values */
|
/* Validate parameters, determine derived values */
|
||||||
initial_setup(cinfo, transcode_only);
|
initial_setup(cinfo);
|
||||||
|
|
||||||
if (cinfo->scan_info != NULL) {
|
if (cinfo->scan_info != NULL) {
|
||||||
#ifdef C_MULTISCAN_FILES_SUPPORTED
|
#ifdef C_MULTISCAN_FILES_SUPPORTED
|
||||||
|
24
3rdparty/libjpeg/jctrans.c
vendored
24
3rdparty/libjpeg/jctrans.c
vendored
@ -2,7 +2,7 @@
|
|||||||
* jctrans.c
|
* jctrans.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1995-1998, Thomas G. Lane.
|
* Copyright (C) 1995-1998, Thomas G. Lane.
|
||||||
* Modified 2000-2013 by Guido Vollbeding.
|
* Modified 2000-2017 by Guido Vollbeding.
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
@ -85,12 +85,15 @@ jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
|
|||||||
jpeg_set_defaults(dstinfo);
|
jpeg_set_defaults(dstinfo);
|
||||||
/* jpeg_set_defaults may choose wrong colorspace, eg YCbCr if input is RGB.
|
/* jpeg_set_defaults may choose wrong colorspace, eg YCbCr if input is RGB.
|
||||||
* Fix it to get the right header markers for the image colorspace.
|
* Fix it to get the right header markers for the image colorspace.
|
||||||
* Note: Entropy table assignment in jpeg_set_colorspace depends
|
* Note: Entropy table assignment in jpeg_set_colorspace
|
||||||
* on color_transform.
|
* depends on color_transform.
|
||||||
|
* Adaption is also required for setting the appropriate
|
||||||
|
* entropy coding mode dependent on image data precision.
|
||||||
*/
|
*/
|
||||||
dstinfo->color_transform = srcinfo->color_transform;
|
dstinfo->color_transform = srcinfo->color_transform;
|
||||||
jpeg_set_colorspace(dstinfo, srcinfo->jpeg_color_space);
|
jpeg_set_colorspace(dstinfo, srcinfo->jpeg_color_space);
|
||||||
dstinfo->data_precision = srcinfo->data_precision;
|
dstinfo->data_precision = srcinfo->data_precision;
|
||||||
|
dstinfo->arith_code = srcinfo->data_precision > 8 ? TRUE : FALSE;
|
||||||
dstinfo->CCIR601_sampling = srcinfo->CCIR601_sampling;
|
dstinfo->CCIR601_sampling = srcinfo->CCIR601_sampling;
|
||||||
/* Copy the source's quantization tables. */
|
/* Copy the source's quantization tables. */
|
||||||
for (tblno = 0; tblno < NUM_QUANT_TBLS; tblno++) {
|
for (tblno = 0; tblno < NUM_QUANT_TBLS; tblno++) {
|
||||||
@ -157,6 +160,18 @@ jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LOCAL(void)
|
||||||
|
jpeg_calc_trans_dimensions (j_compress_ptr cinfo)
|
||||||
|
/* Do computations that are needed before master selection phase */
|
||||||
|
{
|
||||||
|
if (cinfo->min_DCT_h_scaled_size != cinfo->min_DCT_v_scaled_size)
|
||||||
|
ERREXIT2(cinfo, JERR_BAD_DCTSIZE,
|
||||||
|
cinfo->min_DCT_h_scaled_size, cinfo->min_DCT_v_scaled_size);
|
||||||
|
|
||||||
|
cinfo->block_size = cinfo->min_DCT_h_scaled_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Master selection of compression modules for transcoding.
|
* Master selection of compression modules for transcoding.
|
||||||
* This substitutes for jcinit.c's initialization of the full compressor.
|
* This substitutes for jcinit.c's initialization of the full compressor.
|
||||||
@ -166,6 +181,9 @@ LOCAL(void)
|
|||||||
transencode_master_selection (j_compress_ptr cinfo,
|
transencode_master_selection (j_compress_ptr cinfo,
|
||||||
jvirt_barray_ptr * coef_arrays)
|
jvirt_barray_ptr * coef_arrays)
|
||||||
{
|
{
|
||||||
|
/* Do computations that are needed before master selection phase */
|
||||||
|
jpeg_calc_trans_dimensions(cinfo);
|
||||||
|
|
||||||
/* Initialize master control (includes parameter checking/processing) */
|
/* Initialize master control (includes parameter checking/processing) */
|
||||||
jinit_c_master_control(cinfo, TRUE /* transcode only */);
|
jinit_c_master_control(cinfo, TRUE /* transcode only */);
|
||||||
|
|
||||||
|
6
3rdparty/libjpeg/jdatadst.c
vendored
6
3rdparty/libjpeg/jdatadst.c
vendored
@ -2,7 +2,7 @@
|
|||||||
* jdatadst.c
|
* jdatadst.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||||
* Modified 2009-2012 by Guido Vollbeding.
|
* Modified 2009-2017 by Guido Vollbeding.
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
@ -170,9 +170,9 @@ term_destination (j_compress_ptr cinfo)
|
|||||||
if (JFWRITE(dest->outfile, dest->buffer, datacount) != datacount)
|
if (JFWRITE(dest->outfile, dest->buffer, datacount) != datacount)
|
||||||
ERREXIT(cinfo, JERR_FILE_WRITE);
|
ERREXIT(cinfo, JERR_FILE_WRITE);
|
||||||
}
|
}
|
||||||
fflush(dest->outfile);
|
JFFLUSH(dest->outfile);
|
||||||
/* Make sure we wrote the output file OK */
|
/* Make sure we wrote the output file OK */
|
||||||
if (ferror(dest->outfile))
|
if (JFERROR(dest->outfile))
|
||||||
ERREXIT(cinfo, JERR_FILE_WRITE);
|
ERREXIT(cinfo, JERR_FILE_WRITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
8
3rdparty/libjpeg/jdcolor.c
vendored
8
3rdparty/libjpeg/jdcolor.c
vendored
@ -2,7 +2,7 @@
|
|||||||
* jdcolor.c
|
* jdcolor.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||||
* Modified 2011-2015 by Guido Vollbeding.
|
* Modified 2011-2017 by Guido Vollbeding.
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
@ -14,6 +14,12 @@
|
|||||||
#include "jpeglib.h"
|
#include "jpeglib.h"
|
||||||
|
|
||||||
|
|
||||||
|
#if RANGE_BITS < 2
|
||||||
|
/* Deliberate syntax err */
|
||||||
|
Sorry, this code requires 2 or more range extension bits.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Private subobject */
|
/* Private subobject */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
11
3rdparty/libjpeg/jdct.h
vendored
11
3rdparty/libjpeg/jdct.h
vendored
@ -2,7 +2,7 @@
|
|||||||
* jdct.h
|
* jdct.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||||
* Modified 2002-2015 by Guido Vollbeding.
|
* Modified 2002-2017 by Guido Vollbeding.
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
@ -79,13 +79,12 @@ typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */
|
|||||||
* converting them to unsigned form (0..MAXJSAMPLE). The raw outputs could
|
* converting them to unsigned form (0..MAXJSAMPLE). The raw outputs could
|
||||||
* be quite far out of range if the input data is corrupt, so a bulletproof
|
* be quite far out of range if the input data is corrupt, so a bulletproof
|
||||||
* range-limiting step is required. We use a mask-and-table-lookup method
|
* range-limiting step is required. We use a mask-and-table-lookup method
|
||||||
* to do the combined operations quickly, assuming that MAXJSAMPLE+1
|
* to do the combined operations quickly, assuming that RANGE_CENTER
|
||||||
* is a power of 2. See the comments with prepare_range_limit_table
|
* (defined in jpegint.h) is a power of 2. See the comments with
|
||||||
* (in jdmaster.c) for more info.
|
* prepare_range_limit_table (in jdmaster.c) for more info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define RANGE_MASK (MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
|
#define RANGE_MASK (RANGE_CENTER * 2 - 1)
|
||||||
#define RANGE_CENTER (MAXJSAMPLE * 2 + 2)
|
|
||||||
#define RANGE_SUBSET (RANGE_CENTER - CENTERJSAMPLE)
|
#define RANGE_SUBSET (RANGE_CENTER - CENTERJSAMPLE)
|
||||||
|
|
||||||
#define IDCT_range_limit(cinfo) ((cinfo)->sample_range_limit - RANGE_SUBSET)
|
#define IDCT_range_limit(cinfo) ((cinfo)->sample_range_limit - RANGE_SUBSET)
|
||||||
|
9
3rdparty/libjpeg/jdhuff.c
vendored
9
3rdparty/libjpeg/jdhuff.c
vendored
@ -2,7 +2,7 @@
|
|||||||
* jdhuff.c
|
* jdhuff.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||||
* Modified 2006-2013 by Guido Vollbeding.
|
* Modified 2006-2016 by Guido Vollbeding.
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
@ -799,10 +799,6 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
*/
|
*/
|
||||||
if (! entropy->insufficient_data) {
|
if (! entropy->insufficient_data) {
|
||||||
|
|
||||||
Se = cinfo->Se;
|
|
||||||
Al = cinfo->Al;
|
|
||||||
natural_order = cinfo->natural_order;
|
|
||||||
|
|
||||||
/* Load up working state.
|
/* Load up working state.
|
||||||
* We can avoid loading/saving bitread state if in an EOB run.
|
* We can avoid loading/saving bitread state if in an EOB run.
|
||||||
*/
|
*/
|
||||||
@ -814,6 +810,9 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
EOBRUN--; /* ...process it now (we do nothing) */
|
EOBRUN--; /* ...process it now (we do nothing) */
|
||||||
else {
|
else {
|
||||||
BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
|
BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
|
||||||
|
Se = cinfo->Se;
|
||||||
|
Al = cinfo->Al;
|
||||||
|
natural_order = cinfo->natural_order;
|
||||||
block = MCU_data[0];
|
block = MCU_data[0];
|
||||||
tbl = entropy->ac_derived_tbl;
|
tbl = entropy->ac_derived_tbl;
|
||||||
|
|
||||||
|
46
3rdparty/libjpeg/jdmainct.c
vendored
46
3rdparty/libjpeg/jdmainct.c
vendored
@ -2,7 +2,7 @@
|
|||||||
* jdmainct.c
|
* jdmainct.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||||
* Modified 2002-2012 by Guido Vollbeding.
|
* Modified 2002-2016 by Guido Vollbeding.
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
@ -26,8 +26,8 @@
|
|||||||
* trivial. Its responsibility is to provide context rows for upsampling/
|
* trivial. Its responsibility is to provide context rows for upsampling/
|
||||||
* rescaling, and doing this in an efficient fashion is a bit tricky.
|
* rescaling, and doing this in an efficient fashion is a bit tricky.
|
||||||
*
|
*
|
||||||
* Postprocessor input data is counted in "row groups". A row group
|
* Postprocessor input data is counted in "row groups". A row group is
|
||||||
* is defined to be (v_samp_factor * DCT_scaled_size / min_DCT_scaled_size)
|
* defined to be (v_samp_factor * DCT_v_scaled_size / min_DCT_v_scaled_size)
|
||||||
* sample rows of each component. (We require DCT_scaled_size values to be
|
* sample rows of each component. (We require DCT_scaled_size values to be
|
||||||
* chosen such that these numbers are integers. In practice DCT_scaled_size
|
* chosen such that these numbers are integers. In practice DCT_scaled_size
|
||||||
* values will likely be powers of two, so we actually have the stronger
|
* values will likely be powers of two, so we actually have the stronger
|
||||||
@ -37,8 +37,8 @@
|
|||||||
* applying).
|
* applying).
|
||||||
*
|
*
|
||||||
* The coefficient controller will deliver data to us one iMCU row at a time;
|
* The coefficient controller will deliver data to us one iMCU row at a time;
|
||||||
* each iMCU row contains v_samp_factor * DCT_scaled_size sample rows, or
|
* each iMCU row contains v_samp_factor * DCT_v_scaled_size sample rows, or
|
||||||
* exactly min_DCT_scaled_size row groups. (This amount of data corresponds
|
* exactly min_DCT_v_scaled_size row groups. (This amount of data corresponds
|
||||||
* to one row of MCUs when the image is fully interleaved.) Note that the
|
* to one row of MCUs when the image is fully interleaved.) Note that the
|
||||||
* number of sample rows varies across components, but the number of row
|
* number of sample rows varies across components, but the number of row
|
||||||
* groups does not. Some garbage sample rows may be included in the last iMCU
|
* groups does not. Some garbage sample rows may be included in the last iMCU
|
||||||
@ -75,7 +75,7 @@
|
|||||||
* We could do this most simply by copying data around in our buffer, but
|
* We could do this most simply by copying data around in our buffer, but
|
||||||
* that'd be very slow. We can avoid copying any data by creating a rather
|
* that'd be very slow. We can avoid copying any data by creating a rather
|
||||||
* strange pointer structure. Here's how it works. We allocate a workspace
|
* strange pointer structure. Here's how it works. We allocate a workspace
|
||||||
* consisting of M+2 row groups (where M = min_DCT_scaled_size is the number
|
* consisting of M+2 row groups (where M = min_DCT_v_scaled_size is the number
|
||||||
* of row groups per iMCU row). We create two sets of redundant pointers to
|
* of row groups per iMCU row). We create two sets of redundant pointers to
|
||||||
* the workspace. Labeling the physical row groups 0 to M+1, the synthesized
|
* the workspace. Labeling the physical row groups 0 to M+1, the synthesized
|
||||||
* pointer lists look like this:
|
* pointer lists look like this:
|
||||||
@ -100,11 +100,11 @@
|
|||||||
* the first or last sample row as necessary (this is cheaper than copying
|
* the first or last sample row as necessary (this is cheaper than copying
|
||||||
* sample rows around).
|
* sample rows around).
|
||||||
*
|
*
|
||||||
* This scheme breaks down if M < 2, ie, min_DCT_scaled_size is 1. In that
|
* This scheme breaks down if M < 2, ie, min_DCT_v_scaled_size is 1. In that
|
||||||
* situation each iMCU row provides only one row group so the buffering logic
|
* situation each iMCU row provides only one row group so the buffering logic
|
||||||
* must be different (eg, we must read two iMCU rows before we can emit the
|
* must be different (eg, we must read two iMCU rows before we can emit the
|
||||||
* first row group). For now, we simply do not support providing context
|
* first row group). For now, we simply do not support providing context
|
||||||
* rows when min_DCT_scaled_size is 1. That combination seems unlikely to
|
* rows when min_DCT_v_scaled_size is 1. That combination seems unlikely to
|
||||||
* be worth providing --- if someone wants a 1/8th-size preview, they probably
|
* be worth providing --- if someone wants a 1/8th-size preview, they probably
|
||||||
* want it quick and dirty, so a context-free upsampler is sufficient.
|
* want it quick and dirty, so a context-free upsampler is sufficient.
|
||||||
*/
|
*/
|
||||||
@ -118,17 +118,18 @@ typedef struct {
|
|||||||
/* Pointer to allocated workspace (M or M+2 row groups). */
|
/* Pointer to allocated workspace (M or M+2 row groups). */
|
||||||
JSAMPARRAY buffer[MAX_COMPONENTS];
|
JSAMPARRAY buffer[MAX_COMPONENTS];
|
||||||
|
|
||||||
boolean buffer_full; /* Have we gotten an iMCU row from decoder? */
|
|
||||||
JDIMENSION rowgroup_ctr; /* counts row groups output to postprocessor */
|
JDIMENSION rowgroup_ctr; /* counts row groups output to postprocessor */
|
||||||
|
JDIMENSION rowgroups_avail; /* row groups available to postprocessor */
|
||||||
|
|
||||||
/* Remaining fields are only used in the context case. */
|
/* Remaining fields are only used in the context case. */
|
||||||
|
|
||||||
|
boolean buffer_full; /* Have we gotten an iMCU row from decoder? */
|
||||||
|
|
||||||
/* These are the master pointers to the funny-order pointer lists. */
|
/* These are the master pointers to the funny-order pointer lists. */
|
||||||
JSAMPIMAGE xbuffer[2]; /* pointers to weird pointer lists */
|
JSAMPIMAGE xbuffer[2]; /* pointers to weird pointer lists */
|
||||||
|
|
||||||
int whichptr; /* indicates which pointer set is now in use */
|
int whichptr; /* indicates which pointer set is now in use */
|
||||||
int context_state; /* process_data state machine status */
|
int context_state; /* process_data state machine status */
|
||||||
JDIMENSION rowgroups_avail; /* row groups available to postprocessor */
|
|
||||||
JDIMENSION iMCU_row_ctr; /* counts iMCU rows to detect image top/bot */
|
JDIMENSION iMCU_row_ctr; /* counts iMCU rows to detect image top/bot */
|
||||||
} my_main_controller;
|
} my_main_controller;
|
||||||
|
|
||||||
@ -195,7 +196,7 @@ alloc_funny_pointers (j_decompress_ptr cinfo)
|
|||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
make_funny_pointers (j_decompress_ptr cinfo)
|
make_funny_pointers (j_decompress_ptr cinfo)
|
||||||
/* Create the funny pointer lists discussed in the comments above.
|
/* Create the funny pointer lists discussed in the comments above.
|
||||||
* The actual workspace is already allocated (in main->buffer),
|
* The actual workspace is already allocated (in mainp->buffer),
|
||||||
* and the space for the pointer lists is allocated too.
|
* and the space for the pointer lists is allocated too.
|
||||||
* This routine just fills in the curiously ordered lists.
|
* This routine just fills in the curiously ordered lists.
|
||||||
* This will be repeated at the beginning of each pass.
|
* This will be repeated at the beginning of each pass.
|
||||||
@ -317,12 +318,12 @@ start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)
|
|||||||
mainp->whichptr = 0; /* Read first iMCU row into xbuffer[0] */
|
mainp->whichptr = 0; /* Read first iMCU row into xbuffer[0] */
|
||||||
mainp->context_state = CTX_PREPARE_FOR_IMCU;
|
mainp->context_state = CTX_PREPARE_FOR_IMCU;
|
||||||
mainp->iMCU_row_ctr = 0;
|
mainp->iMCU_row_ctr = 0;
|
||||||
|
mainp->buffer_full = FALSE; /* Mark buffer empty */
|
||||||
} else {
|
} else {
|
||||||
/* Simple case with no context needed */
|
/* Simple case with no context needed */
|
||||||
mainp->pub.process_data = process_data_simple_main;
|
mainp->pub.process_data = process_data_simple_main;
|
||||||
|
mainp->rowgroup_ctr = mainp->rowgroups_avail; /* Mark buffer empty */
|
||||||
}
|
}
|
||||||
mainp->buffer_full = FALSE; /* Mark buffer empty */
|
|
||||||
mainp->rowgroup_ctr = 0;
|
|
||||||
break;
|
break;
|
||||||
#ifdef QUANT_2PASS_SUPPORTED
|
#ifdef QUANT_2PASS_SUPPORTED
|
||||||
case JBUF_CRANK_DEST:
|
case JBUF_CRANK_DEST:
|
||||||
@ -348,17 +349,14 @@ process_data_simple_main (j_decompress_ptr cinfo,
|
|||||||
JDIMENSION out_rows_avail)
|
JDIMENSION out_rows_avail)
|
||||||
{
|
{
|
||||||
my_main_ptr mainp = (my_main_ptr) cinfo->main;
|
my_main_ptr mainp = (my_main_ptr) cinfo->main;
|
||||||
JDIMENSION rowgroups_avail;
|
|
||||||
|
|
||||||
/* Read input data if we haven't filled the main buffer yet */
|
/* Read input data if we haven't filled the main buffer yet */
|
||||||
if (! mainp->buffer_full) {
|
if (mainp->rowgroup_ctr >= mainp->rowgroups_avail) {
|
||||||
if (! (*cinfo->coef->decompress_data) (cinfo, mainp->buffer))
|
if (! (*cinfo->coef->decompress_data) (cinfo, mainp->buffer))
|
||||||
return; /* suspension forced, can do nothing more */
|
return; /* suspension forced, can do nothing more */
|
||||||
mainp->buffer_full = TRUE; /* OK, we have an iMCU row to work with */
|
mainp->rowgroup_ctr = 0; /* OK, we have an iMCU row to work with */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* There are always min_DCT_scaled_size row groups in an iMCU row. */
|
|
||||||
rowgroups_avail = (JDIMENSION) cinfo->min_DCT_v_scaled_size;
|
|
||||||
/* Note: at the bottom of the image, we may pass extra garbage row groups
|
/* Note: at the bottom of the image, we may pass extra garbage row groups
|
||||||
* to the postprocessor. The postprocessor has to check for bottom
|
* to the postprocessor. The postprocessor has to check for bottom
|
||||||
* of image anyway (at row resolution), so no point in us doing it too.
|
* of image anyway (at row resolution), so no point in us doing it too.
|
||||||
@ -366,14 +364,8 @@ process_data_simple_main (j_decompress_ptr cinfo,
|
|||||||
|
|
||||||
/* Feed the postprocessor */
|
/* Feed the postprocessor */
|
||||||
(*cinfo->post->post_process_data) (cinfo, mainp->buffer,
|
(*cinfo->post->post_process_data) (cinfo, mainp->buffer,
|
||||||
&mainp->rowgroup_ctr, rowgroups_avail,
|
&mainp->rowgroup_ctr, mainp->rowgroups_avail,
|
||||||
output_buf, out_row_ctr, out_rows_avail);
|
output_buf, out_row_ctr, out_rows_avail);
|
||||||
|
|
||||||
/* Has postprocessor consumed all the data yet? If so, mark buffer empty */
|
|
||||||
if (mainp->rowgroup_ctr >= rowgroups_avail) {
|
|
||||||
mainp->buffer_full = FALSE;
|
|
||||||
mainp->rowgroup_ctr = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -498,7 +490,9 @@ jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
|
|||||||
alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */
|
alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */
|
||||||
ngroups = cinfo->min_DCT_v_scaled_size + 2;
|
ngroups = cinfo->min_DCT_v_scaled_size + 2;
|
||||||
} else {
|
} else {
|
||||||
|
/* There are always min_DCT_v_scaled_size row groups in an iMCU row. */
|
||||||
ngroups = cinfo->min_DCT_v_scaled_size;
|
ngroups = cinfo->min_DCT_v_scaled_size;
|
||||||
|
mainp->rowgroups_avail = (JDIMENSION) ngroups;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||||
|
13
3rdparty/libjpeg/jdmaster.c
vendored
13
3rdparty/libjpeg/jdmaster.c
vendored
@ -2,7 +2,7 @@
|
|||||||
* jdmaster.c
|
* jdmaster.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||||
* Modified 2002-2015 by Guido Vollbeding.
|
* Modified 2002-2017 by Guido Vollbeding.
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
@ -237,18 +237,17 @@ prepare_range_limit_table (j_decompress_ptr cinfo)
|
|||||||
JSAMPLE * table;
|
JSAMPLE * table;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
table = (JSAMPLE *)
|
table = (JSAMPLE *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo,
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
JPOOL_IMAGE, (RANGE_CENTER * 2 + MAXJSAMPLE + 1) * SIZEOF(JSAMPLE));
|
||||||
5 * (MAXJSAMPLE+1) * SIZEOF(JSAMPLE));
|
|
||||||
/* First segment of range limit table: limit[x] = 0 for x < 0 */
|
/* First segment of range limit table: limit[x] = 0 for x < 0 */
|
||||||
MEMZERO(table, 2 * (MAXJSAMPLE+1) * SIZEOF(JSAMPLE));
|
MEMZERO(table, RANGE_CENTER * SIZEOF(JSAMPLE));
|
||||||
table += 2 * (MAXJSAMPLE+1); /* allow negative subscripts of table */
|
table += RANGE_CENTER; /* allow negative subscripts of table */
|
||||||
cinfo->sample_range_limit = table;
|
cinfo->sample_range_limit = table;
|
||||||
/* Main part of range limit table: limit[x] = x */
|
/* Main part of range limit table: limit[x] = x */
|
||||||
for (i = 0; i <= MAXJSAMPLE; i++)
|
for (i = 0; i <= MAXJSAMPLE; i++)
|
||||||
table[i] = (JSAMPLE) i;
|
table[i] = (JSAMPLE) i;
|
||||||
/* End of range limit table: limit[x] = MAXJSAMPLE for x > MAXJSAMPLE */
|
/* End of range limit table: limit[x] = MAXJSAMPLE for x > MAXJSAMPLE */
|
||||||
for (; i < 3 * (MAXJSAMPLE+1); i++)
|
for (; i <= MAXJSAMPLE + RANGE_CENTER; i++)
|
||||||
table[i] = MAXJSAMPLE;
|
table[i] = MAXJSAMPLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
8
3rdparty/libjpeg/jdmerge.c
vendored
8
3rdparty/libjpeg/jdmerge.c
vendored
@ -2,7 +2,7 @@
|
|||||||
* jdmerge.c
|
* jdmerge.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||||
* Modified 2013-2015 by Guido Vollbeding.
|
* Modified 2013-2017 by Guido Vollbeding.
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
@ -40,6 +40,12 @@
|
|||||||
#ifdef UPSAMPLE_MERGING_SUPPORTED
|
#ifdef UPSAMPLE_MERGING_SUPPORTED
|
||||||
|
|
||||||
|
|
||||||
|
#if RANGE_BITS < 2
|
||||||
|
/* Deliberate syntax err */
|
||||||
|
Sorry, this code requires 2 or more range extension bits.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Private subobject */
|
/* Private subobject */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
4
3rdparty/libjpeg/jfdctflt.c
vendored
4
3rdparty/libjpeg/jfdctflt.c
vendored
@ -2,7 +2,7 @@
|
|||||||
* jfdctflt.c
|
* jfdctflt.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||||
* Modified 2003-2015 by Guido Vollbeding.
|
* Modified 2003-2017 by Guido Vollbeding.
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
@ -48,7 +48,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if DCTSIZE != 8
|
#if DCTSIZE != 8
|
||||||
Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
|
Sorry, this code only copes with 8x8 DCT blocks. /* deliberate syntax err */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
4
3rdparty/libjpeg/jfdctfst.c
vendored
4
3rdparty/libjpeg/jfdctfst.c
vendored
@ -2,7 +2,7 @@
|
|||||||
* jfdctfst.c
|
* jfdctfst.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||||
* Modified 2003-2015 by Guido Vollbeding.
|
* Modified 2003-2017 by Guido Vollbeding.
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
@ -44,7 +44,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if DCTSIZE != 8
|
#if DCTSIZE != 8
|
||||||
Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
|
Sorry, this code only copes with 8x8 DCT blocks. /* deliberate syntax err */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
4
3rdparty/libjpeg/jidctflt.c
vendored
4
3rdparty/libjpeg/jidctflt.c
vendored
@ -2,7 +2,7 @@
|
|||||||
* jidctflt.c
|
* jidctflt.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1994-1998, Thomas G. Lane.
|
* Copyright (C) 1994-1998, Thomas G. Lane.
|
||||||
* Modified 2010-2015 by Guido Vollbeding.
|
* Modified 2010-2017 by Guido Vollbeding.
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
@ -50,7 +50,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if DCTSIZE != 8
|
#if DCTSIZE != 8
|
||||||
Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
|
Sorry, this code only copes with 8x8 DCT blocks. /* deliberate syntax err */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
4
3rdparty/libjpeg/jidctfst.c
vendored
4
3rdparty/libjpeg/jidctfst.c
vendored
@ -2,7 +2,7 @@
|
|||||||
* jidctfst.c
|
* jidctfst.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1994-1998, Thomas G. Lane.
|
* Copyright (C) 1994-1998, Thomas G. Lane.
|
||||||
* Modified 2015 by Guido Vollbeding.
|
* Modified 2015-2017 by Guido Vollbeding.
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
@ -46,7 +46,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if DCTSIZE != 8
|
#if DCTSIZE != 8
|
||||||
Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
|
Sorry, this code only copes with 8x8 DCT blocks. /* deliberate syntax err */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
35
3rdparty/libjpeg/jidctint.c
vendored
35
3rdparty/libjpeg/jidctint.c
vendored
@ -2,7 +2,7 @@
|
|||||||
* jidctint.c
|
* jidctint.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||||
* Modification developed 2002-2015 by Guido Vollbeding.
|
* Modification developed 2002-2016 by Guido Vollbeding.
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
@ -166,6 +166,7 @@
|
|||||||
/*
|
/*
|
||||||
* Perform dequantization and inverse DCT on one block of coefficients.
|
* Perform dequantization and inverse DCT on one block of coefficients.
|
||||||
*
|
*
|
||||||
|
* Optimized algorithm with 12 multiplications in the 1-D kernel.
|
||||||
* cK represents sqrt(2) * cos(K*pi/16).
|
* cK represents sqrt(2) * cos(K*pi/16).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -428,7 +429,7 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Perform dequantization and inverse DCT on one block of coefficients,
|
* Perform dequantization and inverse DCT on one block of coefficients,
|
||||||
* producing a 7x7 output block.
|
* producing a reduced-size 7x7 output block.
|
||||||
*
|
*
|
||||||
* Optimized algorithm with 12 multiplications in the 1-D kernel.
|
* Optimized algorithm with 12 multiplications in the 1-D kernel.
|
||||||
* cK represents sqrt(2) * cos(K*pi/14).
|
* cK represents sqrt(2) * cos(K*pi/14).
|
||||||
@ -2623,7 +2624,7 @@ jpeg_idct_16x16 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
|||||||
tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
|
tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
|
||||||
tmp0 <<= CONST_BITS;
|
tmp0 <<= CONST_BITS;
|
||||||
/* Add fudge factor here for final descale. */
|
/* Add fudge factor here for final descale. */
|
||||||
tmp0 += 1 << (CONST_BITS-PASS1_BITS-1);
|
tmp0 += ONE << (CONST_BITS-PASS1_BITS-1);
|
||||||
|
|
||||||
z1 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
|
z1 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
|
||||||
tmp1 = MULTIPLY(z1, FIX(1.306562965)); /* c4[16] = c2[8] */
|
tmp1 = MULTIPLY(z1, FIX(1.306562965)); /* c4[16] = c2[8] */
|
||||||
@ -2920,13 +2921,6 @@ jpeg_idct_16x8 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
|||||||
* The rotator is c(-6).
|
* The rotator is c(-6).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
|
|
||||||
z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
|
|
||||||
|
|
||||||
z1 = MULTIPLY(z2 + z3, FIX_0_541196100); /* c6 */
|
|
||||||
tmp2 = z1 + MULTIPLY(z2, FIX_0_765366865); /* c2-c6 */
|
|
||||||
tmp3 = z1 - MULTIPLY(z3, FIX_1_847759065); /* c2+c6 */
|
|
||||||
|
|
||||||
z2 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
|
z2 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
|
||||||
z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
|
z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
|
||||||
z2 <<= CONST_BITS;
|
z2 <<= CONST_BITS;
|
||||||
@ -2937,6 +2931,13 @@ jpeg_idct_16x8 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
|||||||
tmp0 = z2 + z3;
|
tmp0 = z2 + z3;
|
||||||
tmp1 = z2 - z3;
|
tmp1 = z2 - z3;
|
||||||
|
|
||||||
|
z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
|
||||||
|
z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
|
||||||
|
|
||||||
|
z1 = MULTIPLY(z2 + z3, FIX_0_541196100); /* c6 */
|
||||||
|
tmp2 = z1 + MULTIPLY(z2, FIX_0_765366865); /* c2-c6 */
|
||||||
|
tmp3 = z1 - MULTIPLY(z3, FIX_1_847759065); /* c2+c6 */
|
||||||
|
|
||||||
tmp10 = tmp0 + tmp2;
|
tmp10 = tmp0 + tmp2;
|
||||||
tmp13 = tmp0 - tmp2;
|
tmp13 = tmp0 - tmp2;
|
||||||
tmp11 = tmp1 + tmp3;
|
tmp11 = tmp1 + tmp3;
|
||||||
@ -4883,13 +4884,6 @@ jpeg_idct_4x8 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
|||||||
* The rotator is c(-6).
|
* The rotator is c(-6).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
|
|
||||||
z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
|
|
||||||
|
|
||||||
z1 = MULTIPLY(z2 + z3, FIX_0_541196100); /* c6 */
|
|
||||||
tmp2 = z1 + MULTIPLY(z2, FIX_0_765366865); /* c2-c6 */
|
|
||||||
tmp3 = z1 - MULTIPLY(z3, FIX_1_847759065); /* c2+c6 */
|
|
||||||
|
|
||||||
z2 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
|
z2 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
|
||||||
z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
|
z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
|
||||||
z2 <<= CONST_BITS;
|
z2 <<= CONST_BITS;
|
||||||
@ -4900,6 +4894,13 @@ jpeg_idct_4x8 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
|||||||
tmp0 = z2 + z3;
|
tmp0 = z2 + z3;
|
||||||
tmp1 = z2 - z3;
|
tmp1 = z2 - z3;
|
||||||
|
|
||||||
|
z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
|
||||||
|
z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
|
||||||
|
|
||||||
|
z1 = MULTIPLY(z2 + z3, FIX_0_541196100); /* c6 */
|
||||||
|
tmp2 = z1 + MULTIPLY(z2, FIX_0_765366865); /* c2-c6 */
|
||||||
|
tmp3 = z1 - MULTIPLY(z3, FIX_1_847759065); /* c2+c6 */
|
||||||
|
|
||||||
tmp10 = tmp0 + tmp2;
|
tmp10 = tmp0 + tmp2;
|
||||||
tmp13 = tmp0 - tmp2;
|
tmp13 = tmp0 - tmp2;
|
||||||
tmp11 = tmp1 + tmp3;
|
tmp11 = tmp1 + tmp3;
|
||||||
|
6
3rdparty/libjpeg/jinclude.h
vendored
6
3rdparty/libjpeg/jinclude.h
vendored
@ -2,6 +2,7 @@
|
|||||||
* jinclude.h
|
* jinclude.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 1991-1994, Thomas G. Lane.
|
* Copyright (C) 1991-1994, Thomas G. Lane.
|
||||||
|
* Modified 2017 by Guido Vollbeding.
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
@ -83,9 +84,14 @@
|
|||||||
* The modules that use fread() and fwrite() always invoke them through
|
* The modules that use fread() and fwrite() always invoke them through
|
||||||
* these macros. On some systems you may need to twiddle the argument casts.
|
* these macros. On some systems you may need to twiddle the argument casts.
|
||||||
* CAUTION: argument order is different from underlying functions!
|
* CAUTION: argument order is different from underlying functions!
|
||||||
|
*
|
||||||
|
* Furthermore, macros are provided for fflush() and ferror() in order
|
||||||
|
* to facilitate adaption by applications using an own FILE class.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define JFREAD(file,buf,sizeofbuf) \
|
#define JFREAD(file,buf,sizeofbuf) \
|
||||||
((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
|
((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
|
||||||
#define JFWRITE(file,buf,sizeofbuf) \
|
#define JFWRITE(file,buf,sizeofbuf) \
|
||||||
((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
|
((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
|
||||||
|
#define JFFLUSH(file) fflush(file)
|
||||||
|
#define JFERROR(file) ferror(file)
|
||||||
|
15
3rdparty/libjpeg/jpegint.h
vendored
15
3rdparty/libjpeg/jpegint.h
vendored
@ -2,7 +2,7 @@
|
|||||||
* jpegint.h
|
* jpegint.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||||
* Modified 1997-2013 by Guido Vollbeding.
|
* Modified 1997-2017 by Guido Vollbeding.
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
@ -260,6 +260,19 @@ struct jpeg_color_quantizer {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* Definition of range extension bits for decompression processes.
|
||||||
|
* See the comments with prepare_range_limit_table (in jdmaster.c)
|
||||||
|
* for more info.
|
||||||
|
* The recommended default value for normal applications is 2.
|
||||||
|
* Applications with special requirements may use a different value.
|
||||||
|
* For example, Ghostscript wants to use 3 for proper handling of
|
||||||
|
* wacky images with oversize coefficient values.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define RANGE_BITS 2
|
||||||
|
#define RANGE_CENTER (CENTERJSAMPLE << RANGE_BITS)
|
||||||
|
|
||||||
|
|
||||||
/* Miscellaneous useful macros */
|
/* Miscellaneous useful macros */
|
||||||
|
|
||||||
#undef MAX
|
#undef MAX
|
||||||
|
28
3rdparty/libjpeg/jpeglib.h
vendored
28
3rdparty/libjpeg/jpeglib.h
vendored
@ -2,7 +2,7 @@
|
|||||||
* jpeglib.h
|
* jpeglib.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||||
* Modified 2002-2015 by Guido Vollbeding.
|
* Modified 2002-2017 by Guido Vollbeding.
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
@ -39,7 +39,7 @@ extern "C" {
|
|||||||
|
|
||||||
#define JPEG_LIB_VERSION 90 /* Compatibility version 9.0 */
|
#define JPEG_LIB_VERSION 90 /* Compatibility version 9.0 */
|
||||||
#define JPEG_LIB_VERSION_MAJOR 9
|
#define JPEG_LIB_VERSION_MAJOR 9
|
||||||
#define JPEG_LIB_VERSION_MINOR 2
|
#define JPEG_LIB_VERSION_MINOR 3
|
||||||
|
|
||||||
|
|
||||||
/* Various constants determining the sizes of things.
|
/* Various constants determining the sizes of things.
|
||||||
@ -137,9 +137,9 @@ typedef struct {
|
|||||||
/* The decompressor output side may not use these variables. */
|
/* The decompressor output side may not use these variables. */
|
||||||
int dc_tbl_no; /* DC entropy table selector (0..3) */
|
int dc_tbl_no; /* DC entropy table selector (0..3) */
|
||||||
int ac_tbl_no; /* AC entropy table selector (0..3) */
|
int ac_tbl_no; /* AC entropy table selector (0..3) */
|
||||||
|
|
||||||
/* Remaining fields should be treated as private by applications. */
|
/* Remaining fields should be treated as private by applications. */
|
||||||
|
|
||||||
/* These values are computed during compression or decompression startup: */
|
/* These values are computed during compression or decompression startup: */
|
||||||
/* Component's size in DCT blocks.
|
/* Component's size in DCT blocks.
|
||||||
* Any dummy blocks added to complete an MCU are not counted; therefore
|
* Any dummy blocks added to complete an MCU are not counted; therefore
|
||||||
@ -411,10 +411,10 @@ struct jpeg_compress_struct {
|
|||||||
JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */
|
JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */
|
||||||
/* The coefficient controller receives data in units of MCU rows as defined
|
/* The coefficient controller receives data in units of MCU rows as defined
|
||||||
* for fully interleaved scans (whether the JPEG file is interleaved or not).
|
* for fully interleaved scans (whether the JPEG file is interleaved or not).
|
||||||
* There are v_samp_factor * DCTSIZE sample rows of each component in an
|
* There are v_samp_factor * DCT_v_scaled_size sample rows of each component
|
||||||
* "iMCU" (interleaved MCU) row.
|
* in an "iMCU" (interleaved MCU) row.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These fields are valid during any one scan.
|
* These fields are valid during any one scan.
|
||||||
* They describe the components and MCUs actually appearing in the scan.
|
* They describe the components and MCUs actually appearing in the scan.
|
||||||
@ -422,10 +422,10 @@ struct jpeg_compress_struct {
|
|||||||
int comps_in_scan; /* # of JPEG components in this scan */
|
int comps_in_scan; /* # of JPEG components in this scan */
|
||||||
jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN];
|
jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN];
|
||||||
/* *cur_comp_info[i] describes component that appears i'th in SOS */
|
/* *cur_comp_info[i] describes component that appears i'th in SOS */
|
||||||
|
|
||||||
JDIMENSION MCUs_per_row; /* # of MCUs across the image */
|
JDIMENSION MCUs_per_row; /* # of MCUs across the image */
|
||||||
JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */
|
JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */
|
||||||
|
|
||||||
int blocks_in_MCU; /* # of DCT blocks per MCU */
|
int blocks_in_MCU; /* # of DCT blocks per MCU */
|
||||||
int MCU_membership[C_MAX_BLOCKS_IN_MCU];
|
int MCU_membership[C_MAX_BLOCKS_IN_MCU];
|
||||||
/* MCU_membership[i] is index in cur_comp_info of component owning */
|
/* MCU_membership[i] is index in cur_comp_info of component owning */
|
||||||
@ -636,7 +636,7 @@ struct jpeg_decompress_struct {
|
|||||||
* in fully interleaved JPEG scans, but are used whether the scan is
|
* in fully interleaved JPEG scans, but are used whether the scan is
|
||||||
* interleaved or not. We define an iMCU row as v_samp_factor DCT block
|
* interleaved or not. We define an iMCU row as v_samp_factor DCT block
|
||||||
* rows of each component. Therefore, the IDCT output contains
|
* rows of each component. Therefore, the IDCT output contains
|
||||||
* v_samp_factor*DCT_v_scaled_size sample rows of a component per iMCU row.
|
* v_samp_factor * DCT_v_scaled_size sample rows of a component per iMCU row.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
JSAMPLE * sample_range_limit; /* table for fast range-limiting */
|
JSAMPLE * sample_range_limit; /* table for fast range-limiting */
|
||||||
@ -711,7 +711,7 @@ struct jpeg_error_mgr {
|
|||||||
#define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffer */
|
#define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffer */
|
||||||
/* Reset error state variables at start of a new image */
|
/* Reset error state variables at start of a new image */
|
||||||
JMETHOD(void, reset_error_mgr, (j_common_ptr cinfo));
|
JMETHOD(void, reset_error_mgr, (j_common_ptr cinfo));
|
||||||
|
|
||||||
/* The message ID code and any parameters are saved here.
|
/* The message ID code and any parameters are saved here.
|
||||||
* A message can have one string parameter or up to 8 int parameters.
|
* A message can have one string parameter or up to 8 int parameters.
|
||||||
*/
|
*/
|
||||||
@ -721,11 +721,11 @@ struct jpeg_error_mgr {
|
|||||||
int i[8];
|
int i[8];
|
||||||
char s[JMSG_STR_PARM_MAX];
|
char s[JMSG_STR_PARM_MAX];
|
||||||
} msg_parm;
|
} msg_parm;
|
||||||
|
|
||||||
/* Standard state variables for error facility */
|
/* Standard state variables for error facility */
|
||||||
|
|
||||||
int trace_level; /* max msg_level that will be displayed */
|
int trace_level; /* max msg_level that will be displayed */
|
||||||
|
|
||||||
/* For recoverable corrupt-data errors, we emit a warning message,
|
/* For recoverable corrupt-data errors, we emit a warning message,
|
||||||
* but keep going unless emit_message chooses to abort. emit_message
|
* but keep going unless emit_message chooses to abort. emit_message
|
||||||
* should count warnings in num_warnings. The surrounding application
|
* should count warnings in num_warnings. The surrounding application
|
||||||
|
6
3rdparty/libjpeg/jversion.h
vendored
6
3rdparty/libjpeg/jversion.h
vendored
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* jversion.h
|
* jversion.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 1991-2016, Thomas G. Lane, Guido Vollbeding.
|
* Copyright (C) 1991-2018, Thomas G. Lane, Guido Vollbeding.
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
@ -9,6 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#define JVERSION "9b 17-Jan-2016"
|
#define JVERSION "9c 14-Jan-2018"
|
||||||
|
|
||||||
#define JCOPYRIGHT "Copyright (C) 2016, Thomas G. Lane, Guido Vollbeding"
|
#define JCOPYRIGHT "Copyright (C) 2018, Thomas G. Lane, Guido Vollbeding"
|
||||||
|
Loading…
Reference in New Issue
Block a user