summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/libjpeg/src/jddctmgr.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/libjpeg/src/jddctmgr.c')
-rw-r--r--src/3rdparty/libjpeg/src/jddctmgr.c65
1 files changed, 39 insertions, 26 deletions
diff --git a/src/3rdparty/libjpeg/src/jddctmgr.c b/src/3rdparty/libjpeg/src/jddctmgr.c
index 266f446623..0bd8c2b591 100644
--- a/src/3rdparty/libjpeg/src/jddctmgr.c
+++ b/src/3rdparty/libjpeg/src/jddctmgr.c
@@ -6,7 +6,7 @@
* Modified 2002-2010 by Guido Vollbeding.
* libjpeg-turbo Modifications:
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
- * Copyright (C) 2010, 2015, D. R. Commander.
+ * Copyright (C) 2010, 2015, 2022, D. R. Commander.
* Copyright (C) 2013, MIPS Technologies, Inc., California.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
@@ -26,7 +26,7 @@
#include "jpeglib.h"
#include "jdct.h" /* Private declarations for DCT subsystem */
#include "jsimddct.h"
-#include "jpegcomp.h"
+#include "jpegapicomp.h"
/*
@@ -100,7 +100,7 @@ start_pass(j_decompress_ptr cinfo)
int ci, i;
jpeg_component_info *compptr;
int method = 0;
- inverse_DCT_method_ptr method_ptr = NULL;
+ _inverse_DCT_method_ptr method_ptr = NULL;
JQUANT_TBL *qtbl;
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
@@ -109,42 +109,46 @@ start_pass(j_decompress_ptr cinfo)
switch (compptr->_DCT_scaled_size) {
#ifdef IDCT_SCALING_SUPPORTED
case 1:
- method_ptr = jpeg_idct_1x1;
+ method_ptr = _jpeg_idct_1x1;
method = JDCT_ISLOW; /* jidctred uses islow-style table */
break;
case 2:
+#ifdef WITH_SIMD
if (jsimd_can_idct_2x2())
method_ptr = jsimd_idct_2x2;
else
- method_ptr = jpeg_idct_2x2;
+#endif
+ method_ptr = _jpeg_idct_2x2;
method = JDCT_ISLOW; /* jidctred uses islow-style table */
break;
case 3:
- method_ptr = jpeg_idct_3x3;
+ method_ptr = _jpeg_idct_3x3;
method = JDCT_ISLOW; /* jidctint uses islow-style table */
break;
case 4:
+#ifdef WITH_SIMD
if (jsimd_can_idct_4x4())
method_ptr = jsimd_idct_4x4;
else
- method_ptr = jpeg_idct_4x4;
+#endif
+ method_ptr = _jpeg_idct_4x4;
method = JDCT_ISLOW; /* jidctred uses islow-style table */
break;
case 5:
- method_ptr = jpeg_idct_5x5;
+ method_ptr = _jpeg_idct_5x5;
method = JDCT_ISLOW; /* jidctint uses islow-style table */
break;
case 6:
-#if defined(__mips__)
+#if defined(WITH_SIMD) && defined(__mips__)
if (jsimd_can_idct_6x6())
method_ptr = jsimd_idct_6x6;
else
#endif
- method_ptr = jpeg_idct_6x6;
+ method_ptr = _jpeg_idct_6x6;
method = JDCT_ISLOW; /* jidctint uses islow-style table */
break;
case 7:
- method_ptr = jpeg_idct_7x7;
+ method_ptr = _jpeg_idct_7x7;
method = JDCT_ISLOW; /* jidctint uses islow-style table */
break;
#endif
@@ -152,28 +156,34 @@ start_pass(j_decompress_ptr cinfo)
switch (cinfo->dct_method) {
#ifdef DCT_ISLOW_SUPPORTED
case JDCT_ISLOW:
+#ifdef WITH_SIMD
if (jsimd_can_idct_islow())
method_ptr = jsimd_idct_islow;
else
- method_ptr = jpeg_idct_islow;
+#endif
+ method_ptr = _jpeg_idct_islow;
method = JDCT_ISLOW;
break;
#endif
#ifdef DCT_IFAST_SUPPORTED
case JDCT_IFAST:
+#ifdef WITH_SIMD
if (jsimd_can_idct_ifast())
method_ptr = jsimd_idct_ifast;
else
- method_ptr = jpeg_idct_ifast;
+#endif
+ method_ptr = _jpeg_idct_ifast;
method = JDCT_IFAST;
break;
#endif
#ifdef DCT_FLOAT_SUPPORTED
case JDCT_FLOAT:
+#ifdef WITH_SIMD
if (jsimd_can_idct_float())
method_ptr = jsimd_idct_float;
else
- method_ptr = jpeg_idct_float;
+#endif
+ method_ptr = _jpeg_idct_float;
method = JDCT_FLOAT;
break;
#endif
@@ -184,40 +194,40 @@ start_pass(j_decompress_ptr cinfo)
break;
#ifdef IDCT_SCALING_SUPPORTED
case 9:
- method_ptr = jpeg_idct_9x9;
+ method_ptr = _jpeg_idct_9x9;
method = JDCT_ISLOW; /* jidctint uses islow-style table */
break;
case 10:
- method_ptr = jpeg_idct_10x10;
+ method_ptr = _jpeg_idct_10x10;
method = JDCT_ISLOW; /* jidctint uses islow-style table */
break;
case 11:
- method_ptr = jpeg_idct_11x11;
+ method_ptr = _jpeg_idct_11x11;
method = JDCT_ISLOW; /* jidctint uses islow-style table */
break;
case 12:
-#if defined(__mips__)
+#if defined(WITH_SIMD) && defined(__mips__)
if (jsimd_can_idct_12x12())
method_ptr = jsimd_idct_12x12;
else
#endif
- method_ptr = jpeg_idct_12x12;
+ method_ptr = _jpeg_idct_12x12;
method = JDCT_ISLOW; /* jidctint uses islow-style table */
break;
case 13:
- method_ptr = jpeg_idct_13x13;
+ method_ptr = _jpeg_idct_13x13;
method = JDCT_ISLOW; /* jidctint uses islow-style table */
break;
case 14:
- method_ptr = jpeg_idct_14x14;
+ method_ptr = _jpeg_idct_14x14;
method = JDCT_ISLOW; /* jidctint uses islow-style table */
break;
case 15:
- method_ptr = jpeg_idct_15x15;
+ method_ptr = _jpeg_idct_15x15;
method = JDCT_ISLOW; /* jidctint uses islow-style table */
break;
case 16:
- method_ptr = jpeg_idct_16x16;
+ method_ptr = _jpeg_idct_16x16;
method = JDCT_ISLOW; /* jidctint uses islow-style table */
break;
#endif
@@ -225,7 +235,7 @@ start_pass(j_decompress_ptr cinfo)
ERREXIT1(cinfo, JERR_BAD_DCTSIZE, compptr->_DCT_scaled_size);
break;
}
- idct->pub.inverse_DCT[ci] = method_ptr;
+ idct->pub._inverse_DCT[ci] = method_ptr;
/* Create multiplier table from quant table.
* However, we can skip this if the component is uninteresting
* or if we already built the table. Also, if no quant table
@@ -327,12 +337,15 @@ start_pass(j_decompress_ptr cinfo)
*/
GLOBAL(void)
-jinit_inverse_dct(j_decompress_ptr cinfo)
+_jinit_inverse_dct(j_decompress_ptr cinfo)
{
my_idct_ptr idct;
int ci;
jpeg_component_info *compptr;
+ if (cinfo->data_precision != BITS_IN_JSAMPLE)
+ ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
+
idct = (my_idct_ptr)
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(my_idct_controller));
@@ -345,7 +358,7 @@ jinit_inverse_dct(j_decompress_ptr cinfo)
compptr->dct_table =
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(multiplier_table));
- MEMZERO(compptr->dct_table, sizeof(multiplier_table));
+ memset(compptr->dct_table, 0, sizeof(multiplier_table));
/* Mark multiplier table not yet set up for any method */
idct->cur_method[ci] = -1;
}