mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-25 18:07:31 +09:00
libjpeg-turbo: update to 2.1.x rev 0734e34f6
This commit is contained in:
parent
667129e471
commit
19dc62b0a2
139 changed files with 989 additions and 962 deletions
|
|
@ -2,8 +2,8 @@
|
|||
* jsimd_x86_64.c
|
||||
*
|
||||
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
* Copyright (C) 2009-2011, 2014, 2016, 2018, 2022, D. R. Commander.
|
||||
* Copyright (C) 2015-2016, 2018, Matthieu Darbois.
|
||||
* Copyright (C) 2009-2011, 2014, 2016, 2018, 2022-2023, D. R. Commander.
|
||||
* Copyright (C) 2015-2016, 2018, 2022, Matthieu Darbois.
|
||||
*
|
||||
* Based on the x86 SIMD extension for IJG JPEG library,
|
||||
* Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
|
|
@ -21,7 +21,6 @@
|
|||
#include "../../jdct.h"
|
||||
#include "../../jsimddct.h"
|
||||
#include "../jsimd.h"
|
||||
#include "jconfigint.h"
|
||||
|
||||
/*
|
||||
* In the PIC cases, we have no guarantee that constants will keep
|
||||
|
|
@ -32,13 +31,11 @@
|
|||
#define IS_ALIGNED_SSE(ptr) (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */
|
||||
#define IS_ALIGNED_AVX(ptr) (IS_ALIGNED(ptr, 5)) /* 32 byte alignment */
|
||||
|
||||
static unsigned int simd_support = (unsigned int)(~0);
|
||||
static unsigned int simd_huffman = 1;
|
||||
static THREAD_LOCAL unsigned int simd_support = (unsigned int)(~0);
|
||||
static THREAD_LOCAL unsigned int simd_huffman = 1;
|
||||
|
||||
/*
|
||||
* Check what SIMD accelerations are supported.
|
||||
*
|
||||
* FIXME: This code is racy under a multi-threaded environment.
|
||||
*/
|
||||
LOCAL(void)
|
||||
init_simd(void)
|
||||
|
|
@ -148,6 +145,9 @@ jsimd_rgb_ycc_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
|
|||
void (*avx2fct) (JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
|
||||
void (*sse2fct) (JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
|
||||
|
||||
if (simd_support == ~0U)
|
||||
init_simd();
|
||||
|
||||
switch (cinfo->in_color_space) {
|
||||
case JCS_EXT_RGB:
|
||||
avx2fct = jsimd_extrgb_ycc_convert_avx2;
|
||||
|
|
@ -197,6 +197,9 @@ jsimd_rgb_gray_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
|
|||
void (*avx2fct) (JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
|
||||
void (*sse2fct) (JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
|
||||
|
||||
if (simd_support == ~0U)
|
||||
init_simd();
|
||||
|
||||
switch (cinfo->in_color_space) {
|
||||
case JCS_EXT_RGB:
|
||||
avx2fct = jsimd_extrgb_gray_convert_avx2;
|
||||
|
|
@ -246,6 +249,9 @@ jsimd_ycc_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
|||
void (*avx2fct) (JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
|
||||
void (*sse2fct) (JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
|
||||
|
||||
if (simd_support == ~0U)
|
||||
init_simd();
|
||||
|
||||
switch (cinfo->out_color_space) {
|
||||
case JCS_EXT_RGB:
|
||||
avx2fct = jsimd_ycc_extrgb_convert_avx2;
|
||||
|
|
@ -336,6 +342,9 @@ GLOBAL(void)
|
|||
jsimd_h2v2_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr,
|
||||
JSAMPARRAY input_data, JSAMPARRAY output_data)
|
||||
{
|
||||
if (simd_support == ~0U)
|
||||
init_simd();
|
||||
|
||||
if (simd_support & JSIMD_AVX2)
|
||||
jsimd_h2v2_downsample_avx2(cinfo->image_width, cinfo->max_v_samp_factor,
|
||||
compptr->v_samp_factor,
|
||||
|
|
@ -352,6 +361,9 @@ GLOBAL(void)
|
|||
jsimd_h2v1_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr,
|
||||
JSAMPARRAY input_data, JSAMPARRAY output_data)
|
||||
{
|
||||
if (simd_support == ~0U)
|
||||
init_simd();
|
||||
|
||||
if (simd_support & JSIMD_AVX2)
|
||||
jsimd_h2v1_downsample_avx2(cinfo->image_width, cinfo->max_v_samp_factor,
|
||||
compptr->v_samp_factor,
|
||||
|
|
@ -406,6 +418,9 @@ GLOBAL(void)
|
|||
jsimd_h2v2_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
|
||||
JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
|
||||
{
|
||||
if (simd_support == ~0U)
|
||||
init_simd();
|
||||
|
||||
if (simd_support & JSIMD_AVX2)
|
||||
jsimd_h2v2_upsample_avx2(cinfo->max_v_samp_factor, cinfo->output_width,
|
||||
input_data, output_data_ptr);
|
||||
|
|
@ -418,6 +433,9 @@ GLOBAL(void)
|
|||
jsimd_h2v1_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
|
||||
JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
|
||||
{
|
||||
if (simd_support == ~0U)
|
||||
init_simd();
|
||||
|
||||
if (simd_support & JSIMD_AVX2)
|
||||
jsimd_h2v1_upsample_avx2(cinfo->max_v_samp_factor, cinfo->output_width,
|
||||
input_data, output_data_ptr);
|
||||
|
|
@ -472,6 +490,9 @@ GLOBAL(void)
|
|||
jsimd_h2v2_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
|
||||
JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
|
||||
{
|
||||
if (simd_support == ~0U)
|
||||
init_simd();
|
||||
|
||||
if (simd_support & JSIMD_AVX2)
|
||||
jsimd_h2v2_fancy_upsample_avx2(cinfo->max_v_samp_factor,
|
||||
compptr->downsampled_width, input_data,
|
||||
|
|
@ -486,6 +507,9 @@ GLOBAL(void)
|
|||
jsimd_h2v1_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
|
||||
JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
|
||||
{
|
||||
if (simd_support == ~0U)
|
||||
init_simd();
|
||||
|
||||
if (simd_support & JSIMD_AVX2)
|
||||
jsimd_h2v1_fancy_upsample_avx2(cinfo->max_v_samp_factor,
|
||||
compptr->downsampled_width, input_data,
|
||||
|
|
@ -545,6 +569,9 @@ jsimd_h2v2_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
|||
void (*avx2fct) (JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY);
|
||||
void (*sse2fct) (JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY);
|
||||
|
||||
if (simd_support == ~0U)
|
||||
init_simd();
|
||||
|
||||
switch (cinfo->out_color_space) {
|
||||
case JCS_EXT_RGB:
|
||||
avx2fct = jsimd_h2v2_extrgb_merged_upsample_avx2;
|
||||
|
|
@ -593,6 +620,9 @@ jsimd_h2v1_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
|||
void (*avx2fct) (JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY);
|
||||
void (*sse2fct) (JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY);
|
||||
|
||||
if (simd_support == ~0U)
|
||||
init_simd();
|
||||
|
||||
switch (cinfo->out_color_space) {
|
||||
case JCS_EXT_RGB:
|
||||
avx2fct = jsimd_h2v1_extrgb_merged_upsample_avx2;
|
||||
|
|
@ -682,6 +712,9 @@ GLOBAL(void)
|
|||
jsimd_convsamp(JSAMPARRAY sample_data, JDIMENSION start_col,
|
||||
DCTELEM *workspace)
|
||||
{
|
||||
if (simd_support == ~0U)
|
||||
init_simd();
|
||||
|
||||
if (simd_support & JSIMD_AVX2)
|
||||
jsimd_convsamp_avx2(sample_data, start_col, workspace);
|
||||
else
|
||||
|
|
@ -751,6 +784,9 @@ jsimd_can_fdct_float(void)
|
|||
GLOBAL(void)
|
||||
jsimd_fdct_islow(DCTELEM *data)
|
||||
{
|
||||
if (simd_support == ~0U)
|
||||
init_simd();
|
||||
|
||||
if (simd_support & JSIMD_AVX2)
|
||||
jsimd_fdct_islow_avx2(data);
|
||||
else
|
||||
|
|
@ -812,6 +848,9 @@ jsimd_can_quantize_float(void)
|
|||
GLOBAL(void)
|
||||
jsimd_quantize(JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace)
|
||||
{
|
||||
if (simd_support == ~0U)
|
||||
init_simd();
|
||||
|
||||
if (simd_support & JSIMD_AVX2)
|
||||
jsimd_quantize_avx2(coef_block, divisors, workspace);
|
||||
else
|
||||
|
|
@ -966,6 +1005,9 @@ jsimd_idct_islow(j_decompress_ptr cinfo, jpeg_component_info *compptr,
|
|||
JCOEFPTR coef_block, JSAMPARRAY output_buf,
|
||||
JDIMENSION output_col)
|
||||
{
|
||||
if (simd_support == ~0U)
|
||||
init_simd();
|
||||
|
||||
if (simd_support & JSIMD_AVX2)
|
||||
jsimd_idct_islow_avx2(compptr->dct_table, coef_block, output_buf,
|
||||
output_col);
|
||||
|
|
@ -1036,7 +1078,7 @@ jsimd_can_encode_mcu_AC_first_prepare(void)
|
|||
GLOBAL(void)
|
||||
jsimd_encode_mcu_AC_first_prepare(const JCOEF *block,
|
||||
const int *jpeg_natural_order_start, int Sl,
|
||||
int Al, JCOEF *values, size_t *zerobits)
|
||||
int Al, UJCOEF *values, size_t *zerobits)
|
||||
{
|
||||
jsimd_encode_mcu_AC_first_prepare_sse2(block, jpeg_natural_order_start,
|
||||
Sl, Al, values, zerobits);
|
||||
|
|
@ -1060,7 +1102,7 @@ jsimd_can_encode_mcu_AC_refine_prepare(void)
|
|||
GLOBAL(int)
|
||||
jsimd_encode_mcu_AC_refine_prepare(const JCOEF *block,
|
||||
const int *jpeg_natural_order_start, int Sl,
|
||||
int Al, JCOEF *absvalues, size_t *bits)
|
||||
int Al, UJCOEF *absvalues, size_t *bits)
|
||||
{
|
||||
return jsimd_encode_mcu_AC_refine_prepare_sse2(block,
|
||||
jpeg_natural_order_start,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue