mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 00:08:39 +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
|
|
@ -1,7 +1,205 @@
|
|||
2.1.6
|
||||
=====
|
||||
|
||||
### Significant changes relative to 2.1.5.1:
|
||||
|
||||
1. Fixed an oversight in 1.4 beta1[8] that caused various segfaults and buffer
|
||||
overruns when attempting to decompress various specially-crafted malformed
|
||||
12-bit-per-component JPEG images using a 12-bit-per-component build of djpeg
|
||||
(`-DWITH_12BIT=1`) with both color quantization and RGB565 color conversion
|
||||
enabled.
|
||||
|
||||
2. Fixed an issue whereby `jpeg_crop_scanline()` sometimes miscalculated the
|
||||
downsampled width for components with 4x2 or 2x4 subsampling factors if
|
||||
decompression scaling was enabled. This caused the components to be upsampled
|
||||
incompletely, which caused the color converter to read from uninitialized
|
||||
memory. With 12-bit data precision, this caused a buffer overrun or underrun
|
||||
and subsequent segfault if the sample value read from uninitialized memory was
|
||||
outside of the valid sample range.
|
||||
|
||||
3. Fixed a long-standing issue whereby the `tjTransform()` function, when used
|
||||
with the `TJXOP_TRANSPOSE`, `TJXOP_TRANSVERSE`, `TJXOP_ROT90`, or
|
||||
`TJXOP_ROT270` transform operation and without automatic JPEG destination
|
||||
buffer (re)allocation or lossless cropping, computed the worst-case transformed
|
||||
JPEG image size based on the source image dimensions rather than the
|
||||
transformed image dimensions. If a calling program allocated the JPEG
|
||||
destination buffer based on the transformed image dimensions, as the API
|
||||
documentation instructs, and attempted to transform a specially-crafted 4:2:2,
|
||||
4:4:0, or 4:1:1 JPEG source image containing a large amount of metadata, the
|
||||
issue caused `tjTransform()` to overflow the JPEG destination buffer rather
|
||||
than fail gracefully. The issue could be worked around by setting
|
||||
`TJXOPT_COPYNONE`. Note that, irrespective of this issue, `tjTransform()`
|
||||
cannot reliably transform JPEG source images that contain a large amount of
|
||||
metadata unless automatic JPEG destination buffer (re)allocation is used or
|
||||
`TJXOPT_COPYNONE` is set.
|
||||
|
||||
4. Fixed an issue that caused the C Huffman encoder (which is not used by
|
||||
default on x86 and Arm CPUs) to read from uninitialized memory when attempting
|
||||
to transform a specially-crafted malformed arithmetic-coded JPEG source image
|
||||
into a baseline Huffman-coded JPEG destination image.
|
||||
|
||||
5. Fixed two minor issues in the interblock smoothing algorithm that caused
|
||||
mathematical (but not necessarily perceptible) edge block errors when
|
||||
decompressing progressive JPEG images exactly two DCT blocks in width or that
|
||||
use vertical chrominance subsampling.
|
||||
|
||||
6. Fixed a signed integer overflow in the `tjCompressFromYUV()`,
|
||||
`tjDecodeYUV()`, `tjDecompressToYUV2()`, and `tjEncodeYUV3()` functions,
|
||||
detected by the Clang and GCC undefined behavior sanitizers, that could be
|
||||
triggered by setting the `align` parameter to an unreasonably large value.
|
||||
This issue did not pose a security threat, but removing the warning made it
|
||||
easier to detect actual security issues, should they arise in the future.
|
||||
|
||||
7. Fixed a segfault that occurred when attempting to use the jpegtran `-drop`
|
||||
option with a specially-crafted malformed input image or drop image
|
||||
(specifically an image in which all of the scans contain fewer components than
|
||||
the number of components specified in the Start Of Frame segment.)
|
||||
|
||||
8. Fixed an issue whereby the CPU usage of the default marker processor in the
|
||||
decompressor grew exponentially with the number of markers. This caused an
|
||||
unreasonable slow-down in `jpeg_read_header()` if an application called
|
||||
`jpeg_save_markers()` to save markers of a particular type and then attempted
|
||||
to decompress a JPEG image containing an excessive number of markers of that
|
||||
type.
|
||||
|
||||
9. Fixed a segfault in djpeg that occurred if a negative width was specified
|
||||
with the `-crop` option. Since the cropping region width was read into an
|
||||
unsigned 32-bit integer, a negative width was interpreted as a very large
|
||||
value. With certain negative width and positive left boundary values, the
|
||||
bounds checks in djpeg and `jpeg_crop_scanline()` overflowed and did not detect
|
||||
the out-of-bounds width, which caused a buffer overrun in the upsampling or
|
||||
color conversion routine. Both bounds checks now use 64-bit integers to guard
|
||||
against overflow, and djpeg now checks for negative numbers when it parses the
|
||||
crop specification from the command line.
|
||||
|
||||
10. Fixed an issue whereby the TurboJPEG lossless transformation function and
|
||||
methods checked the specified cropping region against the source image
|
||||
dimensions and level of chrominance subsampling rather than the destination
|
||||
image dimensions and level of chrominance subsampling, which caused some
|
||||
cropping regions to be unduly rejected when performing 90-degree rotation,
|
||||
270-degree rotation, transposition, transverse transposition, or grayscale
|
||||
conversion.
|
||||
|
||||
11. Fixed an issue whereby the TurboJPEG lossless transformation function and
|
||||
methods did not honor `TJXOPT_COPYNONE`/`TJTransform.OPT_COPYNONE` unless it
|
||||
was specified for all lossless transforms.
|
||||
|
||||
|
||||
2.1.5.1
|
||||
=======
|
||||
|
||||
### Significant changes relative to 2.1.5:
|
||||
|
||||
1. The SIMD dispatchers in libjpeg-turbo 2.1.4 and prior stored the list of
|
||||
supported SIMD instruction sets in a global variable, which caused an innocuous
|
||||
race condition whereby the variable could have been initialized multiple times
|
||||
if `jpeg_start_*compress()` was called simultaneously in multiple threads.
|
||||
libjpeg-turbo 2.1.5 included an undocumented attempt to fix this race condition
|
||||
by making the SIMD support variable thread-local. However, that caused another
|
||||
issue whereby, if `jpeg_start_*compress()` was called in one thread and
|
||||
`jpeg_read_*()` or `jpeg_write_*()` was called in a second thread, the SIMD
|
||||
support variable was never initialized in the second thread. On x86 systems,
|
||||
this led the second thread to incorrectly assume that AVX2 instructions were
|
||||
always available, and when it attempted to use those instructions on older x86
|
||||
CPUs that do not support them, an illegal instruction error occurred. The SIMD
|
||||
dispatchers now ensure that the SIMD support variable is initialized before
|
||||
dispatching based on its value.
|
||||
|
||||
|
||||
2.1.5
|
||||
=====
|
||||
|
||||
### Significant changes relative to 2.1.4:
|
||||
|
||||
1. Fixed issues in the build system whereby, when using the Ninja Multi-Config
|
||||
CMake generator, a static build of libjpeg-turbo (a build in which
|
||||
`ENABLE_SHARED` is `0`) could not be installed, a Windows installer could not
|
||||
be built, and the Java regression tests failed.
|
||||
|
||||
2. Fixed a regression introduced by 2.0 beta1[15] that caused a buffer overrun
|
||||
in the progressive Huffman encoder when attempting to transform a
|
||||
specially-crafted malformed 12-bit-per-component JPEG image into a progressive
|
||||
12-bit-per-component JPEG image using a 12-bit-per-component build of
|
||||
libjpeg-turbo (`-DWITH_12BIT=1`.) Given that the buffer overrun was fully
|
||||
contained within the progressive Huffman encoder structure and did not cause a
|
||||
segfault or other user-visible errant behavior, given that the lossless
|
||||
transformer (unlike the decompressor) is not generally exposed to arbitrary
|
||||
data exploits, and given that 12-bit-per-component builds of libjpeg-turbo are
|
||||
uncommon, this issue did not likely pose a security risk.
|
||||
|
||||
3. Fixed an issue whereby, when using a 12-bit-per-component build of
|
||||
libjpeg-turbo (`-DWITH_12BIT=1`), passing samples with values greater than 4095
|
||||
or less than 0 to `jpeg_write_scanlines()` caused a buffer overrun or underrun
|
||||
in the RGB-to-YCbCr color converter.
|
||||
|
||||
4. Fixed a floating point exception that occurred when attempting to use the
|
||||
jpegtran `-drop` and `-trim` options to losslessly transform a
|
||||
specially-crafted malformed JPEG image.
|
||||
|
||||
5. Fixed an issue in `tjBufSizeYUV2()` whereby it returned a bogus result,
|
||||
rather than throwing an error, if the `align` parameter was not a power of 2.
|
||||
Fixed a similar issue in `tjCompressFromYUV()` whereby it generated a corrupt
|
||||
JPEG image in certain cases, rather than throwing an error, if the `align`
|
||||
parameter was not a power of 2.
|
||||
|
||||
6. Fixed an issue whereby `tjDecompressToYUV2()`, which is a wrapper for
|
||||
`tjDecompressToYUVPlanes()`, used the desired YUV image dimensions rather than
|
||||
the actual scaled image dimensions when computing the plane pointers and
|
||||
strides to pass to `tjDecompressToYUVPlanes()`. This caused a buffer overrun
|
||||
and subsequent segfault if the desired image dimensions exceeded the scaled
|
||||
image dimensions.
|
||||
|
||||
7. Fixed an issue whereby, when decompressing a 12-bit-per-component JPEG image
|
||||
(`-DWITH_12BIT=1`) using an alpha-enabled output color space such as
|
||||
`JCS_EXT_RGBA`, the alpha channel was set to 255 rather than 4095.
|
||||
|
||||
8. Fixed an issue whereby the Java version of TJBench did not accept a range of
|
||||
quality values.
|
||||
|
||||
9. Fixed an issue whereby, when `-progressive` was passed to TJBench, the JPEG
|
||||
input image was not transformed into a progressive JPEG image prior to
|
||||
decompression.
|
||||
|
||||
|
||||
2.1.4
|
||||
=====
|
||||
|
||||
### Significant changes relative to 2.1.3:
|
||||
|
||||
1. Fixed a regression introduced in 2.1.3 that caused build failures with
|
||||
Visual Studio 2010.
|
||||
|
||||
2. The `tjDecompressHeader3()` function in the TurboJPEG C API and the
|
||||
`TJDecompressor.setSourceImage()` method in the TurboJPEG Java API now accept
|
||||
"abbreviated table specification" (AKA "tables-only") datastreams, which can be
|
||||
used to prime the decompressor with quantization and Huffman tables that can be
|
||||
used when decompressing subsequent "abbreviated image" datastreams.
|
||||
|
||||
3. libjpeg-turbo now performs run-time detection of AltiVec instructions on
|
||||
OS X/PowerPC systems if AltiVec instructions are not enabled at compile time.
|
||||
This allows both AltiVec-equipped (PowerPC G4 and G5) and non-AltiVec-equipped
|
||||
(PowerPC G3) CPUs to be supported using the same build of libjpeg-turbo.
|
||||
|
||||
4. Fixed an error ("Bogus virtual array access") that occurred when attempting
|
||||
to decompress a progressive JPEG image with a height less than or equal to one
|
||||
iMCU (8 * the vertical sampling factor) using buffered-image mode with
|
||||
interblock smoothing enabled. This was a regression introduced by
|
||||
2.1 beta1[6(b)].
|
||||
|
||||
5. Fixed two issues that prevented partial image decompression from working
|
||||
properly with buffered-image mode:
|
||||
|
||||
- Attempting to call `jpeg_crop_scanline()` after
|
||||
`jpeg_start_decompress()` but before `jpeg_start_output()` resulted in an error
|
||||
("Improper call to JPEG library in state 207".)
|
||||
- Attempting to use `jpeg_skip_scanlines()` resulted in an error ("Bogus
|
||||
virtual array access") under certain circumstances.
|
||||
|
||||
|
||||
2.1.3
|
||||
=====
|
||||
|
||||
### Significant changes relative to 2.1.2
|
||||
### Significant changes relative to 2.1.2:
|
||||
|
||||
1. Fixed a regression introduced by 2.0 beta1[7] whereby cjpeg compressed PGM
|
||||
input files into full-color JPEG images unless the `-grayscale` option was
|
||||
|
|
@ -25,7 +223,7 @@ be reproduced using the libjpeg API, not using djpeg.
|
|||
2.1.2
|
||||
=====
|
||||
|
||||
### Significant changes relative to 2.1.1
|
||||
### Significant changes relative to 2.1.1:
|
||||
|
||||
1. Fixed a regression introduced by 2.1 beta1[13] that caused the remaining
|
||||
GAS implementations of AArch64 (Arm 64-bit) Neon SIMD functions (which are used
|
||||
|
|
@ -36,9 +234,9 @@ prevented libjpeg-turbo from working properly with other linkers and also
|
|||
represented a potential security risk.
|
||||
|
||||
2. Fixed an issue whereby the `tjTransform()` function incorrectly computed the
|
||||
MCU block size for 4:4:4 JPEG images with non-unary sampling factors and thus
|
||||
unduly rejected some cropping regions, even though those regions aligned with
|
||||
8x8 MCU block boundaries.
|
||||
iMCU size for 4:4:4 JPEG images with non-unary sampling factors and thus unduly
|
||||
rejected some cropping regions, even though those regions aligned with 8x8 iMCU
|
||||
boundaries.
|
||||
|
||||
3. Fixed a regression introduced by 2.1 beta1[13] that caused the build system
|
||||
to enable the Arm Neon SIMD extensions when targetting Armv6 and other legacy
|
||||
|
|
@ -57,7 +255,7 @@ image contains incomplete or corrupt image data.
|
|||
2.1.1
|
||||
=====
|
||||
|
||||
### Significant changes relative to 2.1.0
|
||||
### Significant changes relative to 2.1.0:
|
||||
|
||||
1. Fixed a regression introduced in 2.1.0 that caused build failures with
|
||||
non-GCC-compatible compilers for Un*x/Arm platforms.
|
||||
|
|
@ -86,11 +284,11 @@ transform a specially-crafted malformed JPEG image.
|
|||
2.1.0
|
||||
=====
|
||||
|
||||
### Significant changes relative to 2.1 beta1
|
||||
### Significant changes relative to 2.1 beta1:
|
||||
|
||||
1. Fixed a regression introduced by 2.1 beta1[6(b)] whereby attempting to
|
||||
decompress certain progressive JPEG images with one or more component planes of
|
||||
width 8 or less caused a buffer overrun.
|
||||
1. Fixed a regression (CVE-2021-29390) introduced by 2.1 beta1[6(b)] whereby
|
||||
attempting to decompress certain progressive JPEG images with one or more
|
||||
component planes of width 8 or less caused a buffer overrun.
|
||||
|
||||
2. Fixed a regression introduced by 2.1 beta1[6(b)] whereby attempting to
|
||||
decompress a specially-crafted malformed progressive JPEG image caused the
|
||||
|
|
@ -121,10 +319,10 @@ progressive JPEG format described in the report
|
|||
["Two Issues with the JPEG Standard"](https://libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf).
|
||||
|
||||
7. The PPM reader now throws an error, rather than segfaulting (due to a buffer
|
||||
overrun) or generating incorrect pixels, if an application attempts to use the
|
||||
`tjLoadImage()` function to load a 16-bit binary PPM file (a binary PPM file
|
||||
with a maximum value greater than 255) into a grayscale image buffer or to load
|
||||
a 16-bit binary PGM file into an RGB image buffer.
|
||||
overrun, CVE-2021-46822) or generating incorrect pixels, if an application
|
||||
attempts to use the `tjLoadImage()` function to load a 16-bit binary PPM file
|
||||
(a binary PPM file with a maximum value greater than 255) into a grayscale
|
||||
image buffer or to load a 16-bit binary PGM file into an RGB image buffer.
|
||||
|
||||
8. Fixed an issue in the PPM reader that caused incorrect pixels to be
|
||||
generated when using the `tjLoadImage()` function to load a 16-bit binary PPM
|
||||
|
|
@ -290,11 +488,11 @@ methods in the TurboJPEG Java API.
|
|||
|
||||
2. Fixed or worked around multiple issues with `jpeg_skip_scanlines()`:
|
||||
|
||||
- Fixed segfaults or "Corrupt JPEG data: premature end of data segment"
|
||||
errors in `jpeg_skip_scanlines()` that occurred when decompressing 4:2:2 or
|
||||
4:2:0 JPEG images using merged (non-fancy) upsampling/color conversion (that
|
||||
is, when setting `cinfo.do_fancy_upsampling` to `FALSE`.) 2.0.0[6] was a
|
||||
similar fix, but it did not cover all cases.
|
||||
- Fixed segfaults (CVE-2020-35538) or "Corrupt JPEG data: premature end of
|
||||
data segment" errors in `jpeg_skip_scanlines()` that occurred when
|
||||
decompressing 4:2:2 or 4:2:0 JPEG images using merged (non-fancy)
|
||||
upsampling/color conversion (that is, when setting `cinfo.do_fancy_upsampling`
|
||||
to `FALSE`.) 2.0.0[6] was a similar fix, but it did not cover all cases.
|
||||
- `jpeg_skip_scanlines()` now throws an error if two-pass color
|
||||
quantization is enabled. Two-pass color quantization never worked properly
|
||||
with `jpeg_skip_scanlines()`, and the issues could not readily be fixed.
|
||||
|
|
@ -620,16 +818,15 @@ encounters a warning from the underlying libjpeg API (the default behavior is
|
|||
to allow the operation to complete unless a fatal error is encountered.)
|
||||
|
||||
5. Introduced a new flag in the TurboJPEG C and Java APIs (`TJFLAG_PROGRESSIVE`
|
||||
and `TJ.FLAG_PROGRESSIVE`, respectively) that causes the library to use
|
||||
progressive entropy coding in JPEG images generated by compression and
|
||||
transform operations. Additionally, a new transform option
|
||||
(`TJXOPT_PROGRESSIVE` in the C API and `TJTransform.OPT_PROGRESSIVE` in the
|
||||
Java API) has been introduced, allowing progressive entropy coding to be
|
||||
enabled for selected transforms in a multi-transform operation.
|
||||
and `TJ.FLAG_PROGRESSIVE`, respectively) that causes compression and transform
|
||||
operations to generate progressive JPEG images. Additionally, a new transform
|
||||
option (`TJXOPT_PROGRESSIVE` in the C API and `TJTransform.OPT_PROGRESSIVE` in
|
||||
the Java API) has been introduced, allowing progressive JPEG images to be
|
||||
generated by selected transforms in a multi-transform operation.
|
||||
|
||||
6. Introduced a new transform option in the TurboJPEG API (`TJXOPT_COPYNONE` in
|
||||
the C API and `TJTransform.OPT_COPYNONE` in the Java API) that allows the
|
||||
copying of markers (including EXIF and ICC profile data) to be disabled for a
|
||||
copying of markers (including Exif and ICC profile data) to be disabled for a
|
||||
particular transform.
|
||||
|
||||
7. Added two functions to the TurboJPEG C API (`tjLoadImage()` and
|
||||
|
|
@ -760,13 +957,13 @@ bug that has existed since the introduction of libjpeg v7/v8 API/ABI emulation
|
|||
in libjpeg-turbo v1.1.
|
||||
|
||||
7. The lossless transform features in jpegtran and the TurboJPEG API will now
|
||||
always attempt to adjust the EXIF image width and height tags if the image size
|
||||
always attempt to adjust the Exif image width and height tags if the image size
|
||||
changed as a result of the transform. This behavior has always existed when
|
||||
using libjpeg v8 API/ABI emulation. It was supposed to be available with
|
||||
libjpeg v7 API/ABI emulation as well but did not work properly due to a bug.
|
||||
Furthermore, there was never any good reason not to enable it with libjpeg v6b
|
||||
API/ABI emulation, since the behavior is entirely internal. Note that
|
||||
`-copy all` must be passed to jpegtran in order to transfer the EXIF tags from
|
||||
`-copy all` must be passed to jpegtran in order to transfer the Exif tags from
|
||||
the source image to the destination image.
|
||||
|
||||
8. Fixed several memory leaks in the TurboJPEG API library that could occur
|
||||
|
|
@ -788,7 +985,7 @@ for two reasons: it allows testers to more easily work around the 2 GB limit
|
|||
in libFuzzer, and it allows developers of security-sensitive applications to
|
||||
more easily defend against one of the progressive JPEG exploits (LJT-01-004)
|
||||
identified in
|
||||
[this report](http://www.libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf).
|
||||
[this report](https://libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf).
|
||||
|
||||
10. TJBench will now run each benchmark for 1 second prior to starting the
|
||||
timer, in order to improve the consistency of the results. Furthermore, the
|
||||
|
|
@ -1815,7 +2012,7 @@ and unit tests now work on those architectures.
|
|||
0.0.93
|
||||
======
|
||||
|
||||
### Significant changes since 0.0.91:
|
||||
### Significant changes relative to 0.0.91:
|
||||
|
||||
1. 2982659: Fixed x86-64 build on FreeBSD systems
|
||||
|
||||
|
|
|
|||
|
|
@ -1,30 +1,33 @@
|
|||
libjpeg-turbo Licenses
|
||||
======================
|
||||
|
||||
libjpeg-turbo is covered by three compatible BSD-style open source licenses:
|
||||
libjpeg-turbo is covered by two compatible BSD-style open source licenses:
|
||||
|
||||
- The IJG (Independent JPEG Group) License, which is listed in
|
||||
[README.ijg](README.ijg)
|
||||
|
||||
This license applies to the libjpeg API library and associated programs
|
||||
(any code inherited from libjpeg, and any modifications to that code.)
|
||||
This license applies to the libjpeg API library and associated programs,
|
||||
including any code inherited from libjpeg and any modifications to that
|
||||
code. Note that the libjpeg-turbo SIMD source code bears the
|
||||
[zlib License](https://opensource.org/licenses/Zlib), but in the context of
|
||||
the overall libjpeg API library, the terms of the zlib License are subsumed
|
||||
by the terms of the IJG License.
|
||||
|
||||
- The Modified (3-clause) BSD License, which is listed below
|
||||
|
||||
This license covers the TurboJPEG API library and associated programs, as
|
||||
well as the build system.
|
||||
|
||||
- The [zlib License](https://opensource.org/licenses/Zlib)
|
||||
|
||||
This license is a subset of the other two, and it covers the libjpeg-turbo
|
||||
SIMD extensions.
|
||||
This license applies to the TurboJPEG API library and associated programs, as
|
||||
well as the build system. Note that the TurboJPEG API library wraps the
|
||||
libjpeg API library, so in the context of the overall TurboJPEG API library,
|
||||
both the terms of the IJG License and the terms of the Modified (3-clause)
|
||||
BSD License apply.
|
||||
|
||||
|
||||
Complying with the libjpeg-turbo Licenses
|
||||
=========================================
|
||||
|
||||
This section provides a roll-up of the libjpeg-turbo licensing terms, to the
|
||||
best of our understanding.
|
||||
best of our understanding. This is not a license in and of itself. It is
|
||||
intended solely for clarification.
|
||||
|
||||
1. If you are distributing a modified version of the libjpeg-turbo source,
|
||||
then:
|
||||
|
|
@ -38,7 +41,7 @@ best of our understanding.
|
|||
- Clauses 1 and 3 of the zlib License
|
||||
|
||||
2. You must add your own copyright notice to the header of each source
|
||||
file you modified, so others can tell that you modified that file (if
|
||||
file you modified, so others can tell that you modified that file. (If
|
||||
there is not an existing copyright header in that file, then you can
|
||||
simply add a notice stating that you modified the file.)
|
||||
|
||||
|
|
@ -91,7 +94,7 @@ best of our understanding.
|
|||
The Modified (3-clause) BSD License
|
||||
===================================
|
||||
|
||||
Copyright (C)2009-2022 D. R. Commander. All Rights Reserved.<br>
|
||||
Copyright (C)2009-2024 D. R. Commander. All Rights Reserved.<br>
|
||||
Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -119,8 +122,8 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Why Three Licenses?
|
||||
===================
|
||||
Why Two Licenses?
|
||||
=================
|
||||
|
||||
The zlib License could have been used instead of the Modified (3-clause) BSD
|
||||
License, and since the IJG License effectively subsumes the distribution
|
||||
|
|
|
|||
|
|
@ -21,7 +21,9 @@ derivative of libjpeg v6b developed by Miyasaka Masaru. The TigerVNC and
|
|||
VirtualGL projects made numerous enhancements to the codec in 2009, and in
|
||||
early 2010, libjpeg-turbo spun off into an independent project, with the goal
|
||||
of making high-speed JPEG compression/decompression technology available to a
|
||||
broader range of users and developers.
|
||||
broader range of users and developers. libjpeg-turbo is an ISO/IEC and ITU-T
|
||||
reference implementation of the JPEG standard.
|
||||
|
||||
|
||||
|
||||
License
|
||||
|
|
@ -52,7 +54,8 @@ JPEG images:
|
|||
top of the TurboJPEG API. The TurboJPEG API is recommended for first-time
|
||||
users of libjpeg-turbo. Refer to [tjexample.c](tjexample.c) and
|
||||
[TJExample.java](java/TJExample.java) for examples of its usage and to
|
||||
<http://libjpeg-turbo.org/Documentation/Documentation> for API documentation.
|
||||
<https://libjpeg-turbo.org/Documentation/Documentation> for API
|
||||
documentation.
|
||||
|
||||
- **libjpeg API**<br>
|
||||
This is the de facto industry-standard API for compressing and decompressing
|
||||
|
|
@ -180,7 +183,7 @@ supported and which aren't.
|
|||
NOTE: As of this writing, extensive research has been conducted into the
|
||||
usefulness of DCT scaling as a means of data reduction and SmartScale as a
|
||||
means of quality improvement. Readers are invited to peruse the research at
|
||||
<http://www.libjpeg-turbo.org/About/SmartScale> and draw their own conclusions,
|
||||
<https://libjpeg-turbo.org/About/SmartScale> and draw their own conclusions,
|
||||
but it is the general belief of our project that these features have not
|
||||
demonstrated sufficient usefulness to justify inclusion in libjpeg-turbo.
|
||||
|
||||
|
|
@ -274,30 +277,35 @@ Mathematical Compatibility
|
|||
==========================
|
||||
|
||||
For the most part, libjpeg-turbo should produce identical output to libjpeg
|
||||
v6b. The one exception to this is when using the floating point DCT/IDCT, in
|
||||
which case the outputs of libjpeg v6b and libjpeg-turbo can differ for the
|
||||
following reasons:
|
||||
v6b. There are two exceptions:
|
||||
|
||||
- The SSE/SSE2 floating point DCT implementation in libjpeg-turbo is ever so
|
||||
slightly more accurate than the implementation in libjpeg v6b, but not by
|
||||
any amount perceptible to human vision (generally in the range of 0.01 to
|
||||
0.08 dB gain in PNSR.)
|
||||
1. When decompressing a JPEG image that uses 4:4:0 chrominance subsampling, the
|
||||
outputs of libjpeg v6b and libjpeg-turbo can differ because libjpeg-turbo
|
||||
implements a "fancy" (smooth) 4:4:0 upsampling algorithm and libjpeg did not.
|
||||
|
||||
- When not using the SIMD extensions, libjpeg-turbo uses the more accurate
|
||||
(and slightly faster) floating point IDCT algorithm introduced in libjpeg
|
||||
v8a as opposed to the algorithm used in libjpeg v6b. It should be noted,
|
||||
however, that this algorithm basically brings the accuracy of the floating
|
||||
point IDCT in line with the accuracy of the accurate integer IDCT. The
|
||||
floating point DCT/IDCT algorithms are mainly a legacy feature, and they do
|
||||
not produce significantly more accuracy than the accurate integer algorithms
|
||||
(to put numbers on this, the typical difference in PNSR between the two
|
||||
algorithms is less than 0.10 dB, whereas changing the quality level by 1 in
|
||||
the upper range of the quality scale is typically more like a 1.0 dB
|
||||
difference.)
|
||||
2. When using the floating point DCT/IDCT, the outputs of libjpeg v6b and
|
||||
libjpeg-turbo can differ for the following reasons:
|
||||
|
||||
- If the floating point algorithms in libjpeg-turbo are not implemented using
|
||||
SIMD instructions on a particular platform, then the accuracy of the
|
||||
floating point DCT/IDCT can depend on the compiler settings.
|
||||
- The SSE/SSE2 floating point DCT implementation in libjpeg-turbo is ever
|
||||
so slightly more accurate than the implementation in libjpeg v6b, but not
|
||||
by any amount perceptible to human vision (generally in the range of 0.01
|
||||
to 0.08 dB gain in PNSR.)
|
||||
|
||||
- When not using the SIMD extensions, libjpeg-turbo uses the more accurate
|
||||
(and slightly faster) floating point IDCT algorithm introduced in libjpeg
|
||||
v8a as opposed to the algorithm used in libjpeg v6b. It should be noted,
|
||||
however, that this algorithm basically brings the accuracy of the
|
||||
floating point IDCT in line with the accuracy of the accurate integer
|
||||
IDCT. The floating point DCT/IDCT algorithms are mainly a legacy
|
||||
feature, and they do not produce significantly more accuracy than the
|
||||
accurate integer algorithms. (To put numbers on this, the typical
|
||||
difference in PNSR between the two algorithms is less than 0.10 dB,
|
||||
whereas changing the quality level by 1 in the upper range of the quality
|
||||
scale is typically more like a 1.0 dB difference.)
|
||||
|
||||
- If the floating point algorithms in libjpeg-turbo are not implemented
|
||||
using SIMD instructions on a particular platform, then the accuracy of
|
||||
the floating point DCT/IDCT can depend on the compiler settings.
|
||||
|
||||
While libjpeg-turbo does emulate the libjpeg v8 API/ABI, under the hood it is
|
||||
still using the same algorithms as libjpeg v6b, so there are several specific
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1996, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2009-2012, 2015, D. R. Commander.
|
||||
* Copyright (C) 2009-2012, 2015, 2022, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
|
|
@ -48,9 +48,9 @@ rgb_ycc_convert_internal(j_compress_ptr cinfo, JSAMPARRAY input_buf,
|
|||
outptr2 = output_buf[2][output_row];
|
||||
output_row++;
|
||||
for (col = 0; col < num_cols; col++) {
|
||||
r = inptr[RGB_RED];
|
||||
g = inptr[RGB_GREEN];
|
||||
b = inptr[RGB_BLUE];
|
||||
r = RANGE_LIMIT(inptr[RGB_RED]);
|
||||
g = RANGE_LIMIT(inptr[RGB_GREEN]);
|
||||
b = RANGE_LIMIT(inptr[RGB_BLUE]);
|
||||
inptr += RGB_PIXELSIZE;
|
||||
/* If the inputs are 0..MAXJSAMPLE, the outputs of these equations
|
||||
* must be too; we do not need an explicit range-limiting operation.
|
||||
|
|
@ -100,9 +100,9 @@ rgb_gray_convert_internal(j_compress_ptr cinfo, JSAMPARRAY input_buf,
|
|||
outptr = output_buf[0][output_row];
|
||||
output_row++;
|
||||
for (col = 0; col < num_cols; col++) {
|
||||
r = inptr[RGB_RED];
|
||||
g = inptr[RGB_GREEN];
|
||||
b = inptr[RGB_BLUE];
|
||||
r = RANGE_LIMIT(inptr[RGB_RED]);
|
||||
g = RANGE_LIMIT(inptr[RGB_GREEN]);
|
||||
b = RANGE_LIMIT(inptr[RGB_BLUE]);
|
||||
inptr += RGB_PIXELSIZE;
|
||||
/* Y */
|
||||
outptr[col] = (JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* Copyright (C) 1991-1996, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
* Copyright (C) 2009-2012, 2015, D. R. Commander.
|
||||
* Copyright (C) 2009-2012, 2015, 2022, D. R. Commander.
|
||||
* Copyright (C) 2014, MIPS Technologies, Inc., California.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
|
|
@ -17,7 +17,6 @@
|
|||
#include "jinclude.h"
|
||||
#include "jpeglib.h"
|
||||
#include "jsimd.h"
|
||||
#include "jconfigint.h"
|
||||
|
||||
|
||||
/* Private subobject */
|
||||
|
|
@ -84,6 +83,18 @@ typedef my_color_converter *my_cconvert_ptr;
|
|||
#define B_CR_OFF (7 * (MAXJSAMPLE + 1))
|
||||
#define TABLE_SIZE (8 * (MAXJSAMPLE + 1))
|
||||
|
||||
/* 12-bit samples use a 16-bit data type, so it is possible to pass
|
||||
* out-of-range sample values (< 0 or > 4095) to jpeg_write_scanlines().
|
||||
* Thus, we mask the incoming 12-bit samples to guard against overrunning
|
||||
* or underrunning the conversion tables.
|
||||
*/
|
||||
|
||||
#if BITS_IN_JSAMPLE == 12
|
||||
#define RANGE_LIMIT(value) ((value) & 0xFFF)
|
||||
#else
|
||||
#define RANGE_LIMIT(value) (value)
|
||||
#endif
|
||||
|
||||
|
||||
/* Include inline routines for colorspace extensions */
|
||||
|
||||
|
|
@ -392,9 +403,9 @@ cmyk_ycck_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
|
|||
outptr3 = output_buf[3][output_row];
|
||||
output_row++;
|
||||
for (col = 0; col < num_cols; col++) {
|
||||
r = MAXJSAMPLE - inptr[0];
|
||||
g = MAXJSAMPLE - inptr[1];
|
||||
b = MAXJSAMPLE - inptr[2];
|
||||
r = MAXJSAMPLE - RANGE_LIMIT(inptr[0]);
|
||||
g = MAXJSAMPLE - RANGE_LIMIT(inptr[1]);
|
||||
b = MAXJSAMPLE - RANGE_LIMIT(inptr[2]);
|
||||
/* K passes through as-is */
|
||||
outptr3[col] = inptr[3];
|
||||
inptr += 4;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
* Copyright (C) 2011, 2014-2015, D. R. Commander.
|
||||
* Copyright (C) 2011, 2014-2015, 2024, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
|
|
@ -114,8 +114,8 @@ flss(UINT16 val)
|
|||
* Compute values to do a division using reciprocal.
|
||||
*
|
||||
* This implementation is based on an algorithm described in
|
||||
* "How to optimize for the Pentium family of microprocessors"
|
||||
* (http://www.agner.org/assem/).
|
||||
* "Optimizing subroutines in assembly language:
|
||||
* An optimization guide for x86 platforms" (https://agner.org/optimize).
|
||||
* More information about the basic algorithm can be found in
|
||||
* the paper "Integer Division Using Reciprocals" by Robert Alverson.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2009-2011, 2014-2016, 2018-2022, D. R. Commander.
|
||||
* Copyright (C) 2009-2011, 2014-2016, 2018-2024, D. R. Commander.
|
||||
* Copyright (C) 2015, Matthieu Darbois.
|
||||
* Copyright (C) 2018, Matthias Räncker.
|
||||
* Copyright (C) 2020, Arm Limited.
|
||||
|
|
@ -27,43 +27,8 @@
|
|||
#include "jinclude.h"
|
||||
#include "jpeglib.h"
|
||||
#include "jsimd.h"
|
||||
#include "jconfigint.h"
|
||||
#include <limits.h>
|
||||
|
||||
/*
|
||||
* NOTE: If USE_CLZ_INTRINSIC is defined, then clz/bsr instructions will be
|
||||
* used for bit counting rather than the lookup table. This will reduce the
|
||||
* memory footprint by 64k, which is important for some mobile applications
|
||||
* that create many isolated instances of libjpeg-turbo (web browsers, for
|
||||
* instance.) This may improve performance on some mobile platforms as well.
|
||||
* This feature is enabled by default only on Arm processors, because some x86
|
||||
* chips have a slow implementation of bsr, and the use of clz/bsr cannot be
|
||||
* shown to have a significant performance impact even on the x86 chips that
|
||||
* have a fast implementation of it. When building for Armv6, you can
|
||||
* explicitly disable the use of clz/bsr by adding -mthumb to the compiler
|
||||
* flags (this defines __thumb__).
|
||||
*/
|
||||
|
||||
/* NOTE: Both GCC and Clang define __GNUC__ */
|
||||
#if (defined(__GNUC__) && (defined(__arm__) || defined(__aarch64__))) || \
|
||||
defined(_M_ARM) || defined(_M_ARM64)
|
||||
#if !defined(__thumb__) || defined(__thumb2__)
|
||||
#define USE_CLZ_INTRINSIC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef USE_CLZ_INTRINSIC
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#define JPEG_NBITS_NONZERO(x) (32 - _CountLeadingZeros(x))
|
||||
#else
|
||||
#define JPEG_NBITS_NONZERO(x) (32 - __builtin_clz(x))
|
||||
#endif
|
||||
#define JPEG_NBITS(x) (x ? JPEG_NBITS_NONZERO(x) : 0)
|
||||
#else
|
||||
#include "jpeg_nbits_table.h"
|
||||
#define JPEG_NBITS(x) (jpeg_nbits_table[x])
|
||||
#define JPEG_NBITS_NONZERO(x) JPEG_NBITS(x)
|
||||
#endif
|
||||
#include "jpeg_nbits.h"
|
||||
|
||||
|
||||
/* Expanded entropy encoder object for Huffman encoding.
|
||||
|
|
@ -501,6 +466,8 @@ flush_bits(working_state *state)
|
|||
int localbuf = 0;
|
||||
|
||||
if (state->simd) {
|
||||
if (state->cur.free_bits < 0)
|
||||
ERREXIT(state->cinfo, JERR_BAD_DCT_COEF);
|
||||
#if defined(__aarch64__) && !defined(NEON_INTRINSICS)
|
||||
put_bits = state->cur.free_bits;
|
||||
#else
|
||||
|
|
@ -519,7 +486,7 @@ flush_bits(working_state *state)
|
|||
temp = (JOCTET)(put_buffer >> put_bits);
|
||||
EMIT_BYTE(temp)
|
||||
}
|
||||
if (put_bits) {
|
||||
if (put_bits > 0) {
|
||||
/* fill partial byte with ones */
|
||||
temp = (JOCTET)((put_buffer << (8 - put_bits)) | (0xFF >> put_bits));
|
||||
EMIT_BYTE(temp)
|
||||
|
|
@ -551,6 +518,10 @@ encode_one_block_simd(working_state *state, JCOEFPTR block, int last_dc_val,
|
|||
JOCTET _buffer[BUFSIZE], *buffer;
|
||||
int localbuf = 0;
|
||||
|
||||
#ifdef ZERO_BUFFERS
|
||||
memset(_buffer, 0, sizeof(_buffer));
|
||||
#endif
|
||||
|
||||
LOAD_BUFFER()
|
||||
|
||||
buffer = jsimd_huff_encode_one_block(state, buffer, block, last_dc_val,
|
||||
|
|
@ -589,6 +560,11 @@ encode_one_block(working_state *state, JCOEFPTR block, int last_dc_val,
|
|||
|
||||
/* Find the number of bits needed for the magnitude of the coefficient */
|
||||
nbits = JPEG_NBITS(nbits);
|
||||
/* Check for out-of-range coefficient values.
|
||||
* Since we're encoding a difference, the range limit is twice as much.
|
||||
*/
|
||||
if (nbits > MAX_COEF_BITS + 1)
|
||||
ERREXIT(state->cinfo, JERR_BAD_DCT_COEF);
|
||||
|
||||
/* Emit the Huffman-coded symbol for the number of bits.
|
||||
* Emit that number of bits of the value, if positive,
|
||||
|
|
@ -614,6 +590,9 @@ encode_one_block(working_state *state, JCOEFPTR block, int last_dc_val,
|
|||
temp += nbits; \
|
||||
nbits ^= temp; \
|
||||
nbits = JPEG_NBITS_NONZERO(nbits); \
|
||||
/* Check for out-of-range coefficient values */ \
|
||||
if (nbits > MAX_COEF_BITS) \
|
||||
ERREXIT(state->cinfo, JERR_BAD_DCT_COEF); \
|
||||
/* if run length > 15, must emit special run-length-16 codes (0xF0) */ \
|
||||
while (r >= 16 * 16) { \
|
||||
r -= 16 * 16; \
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* It was modified by The libjpeg-turbo Project to include only code relevant
|
||||
* to libjpeg-turbo.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2022, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
|
|
@ -25,6 +25,14 @@
|
|||
#define MAX_COEF_BITS 14
|
||||
#endif
|
||||
|
||||
/* The progressive Huffman encoder uses an unsigned 16-bit data type to store
|
||||
* absolute values of coefficients, because it is possible to inject a
|
||||
* coefficient value of -32768 into the encoder by attempting to transform a
|
||||
* malformed 12-bit JPEG image, and the absolute value of -32768 would overflow
|
||||
* a signed 16-bit integer.
|
||||
*/
|
||||
typedef unsigned short UJCOEF;
|
||||
|
||||
/* Derived data constructed for each Huffman table */
|
||||
|
||||
typedef struct {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
#include "jinclude.h"
|
||||
#include "jpeglib.h"
|
||||
#include "jpegcomp.h"
|
||||
#include "jconfigint.h"
|
||||
|
||||
|
||||
/* Private state */
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1994-1997, Thomas G. Lane.
|
||||
* It was modified by The libjpeg-turbo Project to include only code relevant
|
||||
* to libjpeg-turbo.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2024, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
|
|
@ -51,6 +51,7 @@ jpeg_abort(j_common_ptr cinfo)
|
|||
* A bit kludgy to do it here, but this is the most central place.
|
||||
*/
|
||||
((j_decompress_ptr)cinfo)->marker_list = NULL;
|
||||
((j_decompress_ptr)cinfo)->master->marker_list_end = NULL;
|
||||
} else {
|
||||
cinfo->global_state = CSTATE_START;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,10 @@
|
|||
#define JPEG_LIB_VERSION 62
|
||||
|
||||
/* libjpeg-turbo version */
|
||||
#define LIBJPEG_TURBO_VERSION 1.5.1
|
||||
#define LIBJPEG_TURBO_VERSION 2.1.5.1
|
||||
|
||||
/* libjpeg-turbo version in integer form */
|
||||
#define LIBJPEG_TURBO_VERSION_NUMBER 2001005
|
||||
|
||||
/* Support arithmetic encoding */
|
||||
/*#undef C_ARITH_CODING_SUPPORTED */
|
||||
|
|
@ -13,6 +16,12 @@
|
|||
/* Support arithmetic decoding */
|
||||
/*#undef D_ARITH_CODING_SUPPORTED */
|
||||
|
||||
/* Support in-memory source/destination managers */
|
||||
#define MEM_SRCDST_SUPPORTED 1
|
||||
|
||||
/* Use accelerated SIMD routines. */
|
||||
#define WITH_SIMD 1
|
||||
|
||||
/*
|
||||
* Define BITS_IN_JSAMPLE as either
|
||||
* 8 for 8-bit sample values (the usual setting)
|
||||
|
|
@ -21,41 +30,13 @@
|
|||
* JPEG standard, and the IJG code does not support anything else!
|
||||
* We do not support run-time selection of data precision, sorry.
|
||||
*/
|
||||
|
||||
#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */
|
||||
|
||||
/* Define to 1 if you have the <locale.h> header file. */
|
||||
/*#undef HAVE_LOCALE_H */
|
||||
|
||||
/* Define to 1 if you have the <stddef.h> header file. */
|
||||
#define HAVE_STDDEF_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Compiler supports 'unsigned char'. */
|
||||
#define HAVE_UNSIGNED_CHAR 1
|
||||
|
||||
/* Compiler supports 'unsigned short'. */
|
||||
#define HAVE_UNSIGNED_SHORT 1
|
||||
|
||||
/* Compiler does not support pointers to unspecified structures. */
|
||||
/* #define INCOMPLETE_TYPES_BROKEN 1 */
|
||||
|
||||
/* Support in-memory source/destination managers */
|
||||
/* #undef MEM_SRCDST_SUPPORTED */
|
||||
|
||||
/* Compiler has <strings.h> rather than standard <string.h>. */
|
||||
/* #undef NEED_BSD_STRINGS */
|
||||
|
||||
/* Need to include <sys/types.h> in order to obtain size_t. */
|
||||
#define NEED_SYS_TYPES_H 1
|
||||
|
||||
/* Broken compiler shifts signed values as an unsigned shift. */
|
||||
/* Define if your (broken) compiler shifts signed values as if they were
|
||||
unsigned. */
|
||||
/* #undef RIGHT_SHIFT_IS_UNSIGNED */
|
||||
|
||||
/* Use accelerated SIMD routines. */
|
||||
#define WITH_SIMD 1
|
||||
|
||||
/* Define to 1 if type `char' is unsigned and you are not using gcc. */
|
||||
#ifndef __CHAR_UNSIGNED__
|
||||
/* # undef __CHAR_UNSIGNED__ */
|
||||
|
|
|
|||
|
|
@ -1,15 +1,25 @@
|
|||
/* libjpeg-turbo build number */
|
||||
#define BUILD "20220624"
|
||||
|
||||
/* How to hide global symbols. */
|
||||
#define HIDDEN __attribute__((visibility("hidden")))
|
||||
|
||||
/* Need to use Mozilla-specific function inlining. */
|
||||
#include "mozilla/Attributes.h"
|
||||
#define INLINE MOZ_ALWAYS_INLINE
|
||||
|
||||
/* How to obtain thread-local storage */
|
||||
#if defined(_MSC_VER)
|
||||
#define THREAD_LOCAL __declspec(thread)
|
||||
#else
|
||||
#define THREAD_LOCAL __thread
|
||||
#endif
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME "libjpeg-turbo"
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "2.1.3"
|
||||
#define VERSION "2.1.5.1"
|
||||
|
||||
/* The size of `size_t', as computed by sizeof. */
|
||||
#ifdef HAVE_64BIT_BUILD
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1995-1997, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2011, 2015, 2018, 2021-2022, D. R. Commander.
|
||||
* Copyright (C) 2016, 2018, Matthieu Darbois.
|
||||
* Copyright (C) 2011, 2015, 2018, 2021-2022, 2024, D. R. Commander.
|
||||
* Copyright (C) 2016, 2018, 2022, Matthieu Darbois.
|
||||
* Copyright (C) 2020, Arm Limited.
|
||||
* Copyright (C) 2021, Alex Richardson.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
|
|
@ -22,7 +22,6 @@
|
|||
#include "jinclude.h"
|
||||
#include "jpeglib.h"
|
||||
#include "jsimd.h"
|
||||
#include "jconfigint.h"
|
||||
#include <limits.h>
|
||||
|
||||
#ifdef HAVE_INTRIN_H
|
||||
|
|
@ -39,40 +38,7 @@
|
|||
|
||||
#ifdef C_PROGRESSIVE_SUPPORTED
|
||||
|
||||
/*
|
||||
* NOTE: If USE_CLZ_INTRINSIC is defined, then clz/bsr instructions will be
|
||||
* used for bit counting rather than the lookup table. This will reduce the
|
||||
* memory footprint by 64k, which is important for some mobile applications
|
||||
* that create many isolated instances of libjpeg-turbo (web browsers, for
|
||||
* instance.) This may improve performance on some mobile platforms as well.
|
||||
* This feature is enabled by default only on Arm processors, because some x86
|
||||
* chips have a slow implementation of bsr, and the use of clz/bsr cannot be
|
||||
* shown to have a significant performance impact even on the x86 chips that
|
||||
* have a fast implementation of it. When building for Armv6, you can
|
||||
* explicitly disable the use of clz/bsr by adding -mthumb to the compiler
|
||||
* flags (this defines __thumb__).
|
||||
*/
|
||||
|
||||
/* NOTE: Both GCC and Clang define __GNUC__ */
|
||||
#if (defined(__GNUC__) && (defined(__arm__) || defined(__aarch64__))) || \
|
||||
defined(_M_ARM) || defined(_M_ARM64)
|
||||
#if !defined(__thumb__) || defined(__thumb2__)
|
||||
#define USE_CLZ_INTRINSIC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef USE_CLZ_INTRINSIC
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#define JPEG_NBITS_NONZERO(x) (32 - _CountLeadingZeros(x))
|
||||
#else
|
||||
#define JPEG_NBITS_NONZERO(x) (32 - __builtin_clz(x))
|
||||
#endif
|
||||
#define JPEG_NBITS(x) (x ? JPEG_NBITS_NONZERO(x) : 0)
|
||||
#else
|
||||
#include "jpeg_nbits_table.h"
|
||||
#define JPEG_NBITS(x) (jpeg_nbits_table[x])
|
||||
#define JPEG_NBITS_NONZERO(x) JPEG_NBITS(x)
|
||||
#endif
|
||||
#include "jpeg_nbits.h"
|
||||
|
||||
|
||||
/* Expanded entropy encoder object for progressive Huffman encoding. */
|
||||
|
|
@ -83,11 +49,11 @@ typedef struct {
|
|||
/* Pointer to routine to prepare data for encode_mcu_AC_first() */
|
||||
void (*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);
|
||||
/* Pointer to routine to prepare data for encode_mcu_AC_refine() */
|
||||
int (*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);
|
||||
|
||||
/* Mode flag: TRUE for optimization, FALSE for actual data output */
|
||||
boolean gather_statistics;
|
||||
|
|
@ -157,14 +123,14 @@ METHODDEF(boolean) encode_mcu_DC_first(j_compress_ptr cinfo,
|
|||
JBLOCKROW *MCU_data);
|
||||
METHODDEF(void) encode_mcu_AC_first_prepare
|
||||
(const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al,
|
||||
JCOEF *values, size_t *zerobits);
|
||||
UJCOEF *values, size_t *zerobits);
|
||||
METHODDEF(boolean) encode_mcu_AC_first(j_compress_ptr cinfo,
|
||||
JBLOCKROW *MCU_data);
|
||||
METHODDEF(boolean) encode_mcu_DC_refine(j_compress_ptr cinfo,
|
||||
JBLOCKROW *MCU_data);
|
||||
METHODDEF(int) encode_mcu_AC_refine_prepare
|
||||
(const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al,
|
||||
JCOEF *absvalues, size_t *bits);
|
||||
UJCOEF *absvalues, size_t *bits);
|
||||
METHODDEF(boolean) encode_mcu_AC_refine(j_compress_ptr cinfo,
|
||||
JBLOCKROW *MCU_data);
|
||||
METHODDEF(void) finish_pass_phuff(j_compress_ptr cinfo);
|
||||
|
|
@ -584,8 +550,8 @@ encode_mcu_DC_first(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||
continue; \
|
||||
/* For a negative coef, want temp2 = bitwise complement of abs(coef) */ \
|
||||
temp2 ^= temp; \
|
||||
values[k] = (JCOEF)temp; \
|
||||
values[k + DCTSIZE2] = (JCOEF)temp2; \
|
||||
values[k] = (UJCOEF)temp; \
|
||||
values[k + DCTSIZE2] = (UJCOEF)temp2; \
|
||||
zerobits |= ((size_t)1U) << k; \
|
||||
} \
|
||||
}
|
||||
|
|
@ -593,7 +559,7 @@ encode_mcu_DC_first(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||
METHODDEF(void)
|
||||
encode_mcu_AC_first_prepare(const JCOEF *block,
|
||||
const int *jpeg_natural_order_start, int Sl,
|
||||
int Al, JCOEF *values, size_t *bits)
|
||||
int Al, UJCOEF *values, size_t *bits)
|
||||
{
|
||||
register int k, temp, temp2;
|
||||
size_t zerobits = 0U;
|
||||
|
|
@ -666,12 +632,17 @@ encode_mcu_AC_first(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||
register int nbits, r;
|
||||
int Sl = cinfo->Se - cinfo->Ss + 1;
|
||||
int Al = cinfo->Al;
|
||||
JCOEF values_unaligned[2 * DCTSIZE2 + 15];
|
||||
JCOEF *values;
|
||||
const JCOEF *cvalue;
|
||||
UJCOEF values_unaligned[2 * DCTSIZE2 + 15];
|
||||
UJCOEF *values;
|
||||
const UJCOEF *cvalue;
|
||||
size_t zerobits;
|
||||
size_t bits[8 / SIZEOF_SIZE_T];
|
||||
|
||||
#ifdef ZERO_BUFFERS
|
||||
memset(values_unaligned, 0, sizeof(values_unaligned));
|
||||
memset(bits, 0, sizeof(bits));
|
||||
#endif
|
||||
|
||||
entropy->next_output_byte = cinfo->dest->next_output_byte;
|
||||
entropy->free_in_buffer = cinfo->dest->free_in_buffer;
|
||||
|
||||
|
|
@ -681,7 +652,7 @@ encode_mcu_AC_first(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||
emit_restart(entropy, entropy->next_restart_num);
|
||||
|
||||
#ifdef WITH_SIMD
|
||||
cvalue = values = (JCOEF *)PAD((JUINTPTR)values_unaligned, 16);
|
||||
cvalue = values = (UJCOEF *)PAD((JUINTPTR)values_unaligned, 16);
|
||||
#else
|
||||
/* Not using SIMD, so alignment is not needed */
|
||||
cvalue = values = values_unaligned;
|
||||
|
|
@ -815,7 +786,7 @@ encode_mcu_DC_refine(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||
zerobits |= ((size_t)1U) << k; \
|
||||
signbits |= ((size_t)(temp2 + 1)) << k; \
|
||||
} \
|
||||
absvalues[k] = (JCOEF)temp; /* save abs value for main pass */ \
|
||||
absvalues[k] = (UJCOEF)temp; /* save abs value for main pass */ \
|
||||
if (temp == 1) \
|
||||
EOB = k + koffset; /* EOB = index of last newly-nonzero coef */ \
|
||||
} \
|
||||
|
|
@ -824,7 +795,7 @@ encode_mcu_DC_refine(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||
METHODDEF(int)
|
||||
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)
|
||||
{
|
||||
register int k, temp, temp2;
|
||||
int EOB = 0;
|
||||
|
|
@ -931,12 +902,17 @@ encode_mcu_AC_refine(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||
unsigned int BR;
|
||||
int Sl = cinfo->Se - cinfo->Ss + 1;
|
||||
int Al = cinfo->Al;
|
||||
JCOEF absvalues_unaligned[DCTSIZE2 + 15];
|
||||
JCOEF *absvalues;
|
||||
const JCOEF *cabsvalue, *EOBPTR;
|
||||
UJCOEF absvalues_unaligned[DCTSIZE2 + 15];
|
||||
UJCOEF *absvalues;
|
||||
const UJCOEF *cabsvalue, *EOBPTR;
|
||||
size_t zerobits, signbits;
|
||||
size_t bits[16 / SIZEOF_SIZE_T];
|
||||
|
||||
#ifdef ZERO_BUFFERS
|
||||
memset(absvalues_unaligned, 0, sizeof(absvalues_unaligned));
|
||||
memset(bits, 0, sizeof(bits));
|
||||
#endif
|
||||
|
||||
entropy->next_output_byte = cinfo->dest->next_output_byte;
|
||||
entropy->free_in_buffer = cinfo->dest->free_in_buffer;
|
||||
|
||||
|
|
@ -946,7 +922,7 @@ encode_mcu_AC_refine(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||
emit_restart(entropy, entropy->next_restart_num);
|
||||
|
||||
#ifdef WITH_SIMD
|
||||
cabsvalue = absvalues = (JCOEF *)PAD((JUINTPTR)absvalues_unaligned, 16);
|
||||
cabsvalue = absvalues = (UJCOEF *)PAD((JUINTPTR)absvalues_unaligned, 16);
|
||||
#else
|
||||
/* Not using SIMD, so alignment is not needed */
|
||||
cabsvalue = absvalues = absvalues_unaligned;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
#include "jinclude.h"
|
||||
#include "jpeglib.h"
|
||||
#include "jdmaster.h"
|
||||
#include "jconfigint.h"
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2010, 2015-2020, 2022, D. R. Commander.
|
||||
* Copyright (C) 2010, 2015-2020, 2022-2024, D. R. Commander.
|
||||
* Copyright (C) 2015, Google, Inc.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
|
|
@ -159,16 +159,20 @@ jpeg_crop_scanline(j_decompress_ptr cinfo, JDIMENSION *xoffset,
|
|||
JDIMENSION input_xoffset;
|
||||
boolean reinit_upsampler = FALSE;
|
||||
jpeg_component_info *compptr;
|
||||
#ifdef UPSAMPLE_MERGING_SUPPORTED
|
||||
my_master_ptr master = (my_master_ptr)cinfo->master;
|
||||
#endif
|
||||
|
||||
if (cinfo->global_state != DSTATE_SCANNING || cinfo->output_scanline != 0)
|
||||
if ((cinfo->global_state != DSTATE_SCANNING &&
|
||||
cinfo->global_state != DSTATE_BUFIMAGE) || cinfo->output_scanline != 0)
|
||||
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
|
||||
|
||||
if (!xoffset || !width)
|
||||
ERREXIT(cinfo, JERR_BAD_CROP_SPEC);
|
||||
|
||||
/* xoffset and width must fall within the output image dimensions. */
|
||||
if (*width == 0 || *xoffset + *width > cinfo->output_width)
|
||||
if (*width == 0 ||
|
||||
(unsigned long long)(*xoffset) + *width > cinfo->output_width)
|
||||
ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
|
||||
|
||||
/* No need to do anything if the caller wants the entire width. */
|
||||
|
|
@ -209,11 +213,13 @@ jpeg_crop_scanline(j_decompress_ptr cinfo, JDIMENSION *xoffset,
|
|||
*/
|
||||
*width = *width + input_xoffset - *xoffset;
|
||||
cinfo->output_width = *width;
|
||||
#ifdef UPSAMPLE_MERGING_SUPPORTED
|
||||
if (master->using_merged_upsample && cinfo->max_v_samp_factor == 2) {
|
||||
my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
|
||||
upsample->out_row_width =
|
||||
cinfo->output_width * cinfo->out_color_components;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Set the first and last iMCU columns that we must decompress. These values
|
||||
* will be used in single-scan decompressions.
|
||||
|
|
@ -231,9 +237,11 @@ jpeg_crop_scanline(j_decompress_ptr cinfo, JDIMENSION *xoffset,
|
|||
/* Set downsampled_width to the new output width. */
|
||||
orig_downsampled_width = compptr->downsampled_width;
|
||||
compptr->downsampled_width =
|
||||
(JDIMENSION)jdiv_round_up((long)(cinfo->output_width *
|
||||
compptr->h_samp_factor),
|
||||
(long)cinfo->max_h_samp_factor);
|
||||
(JDIMENSION)jdiv_round_up((long)cinfo->output_width *
|
||||
(long)(compptr->h_samp_factor *
|
||||
compptr->_DCT_scaled_size),
|
||||
(long)(cinfo->max_h_samp_factor *
|
||||
cinfo->_min_DCT_scaled_size));
|
||||
if (compptr->downsampled_width < 2 && orig_downsampled_width >= 2)
|
||||
reinit_upsampler = TRUE;
|
||||
|
||||
|
|
@ -324,7 +332,9 @@ LOCAL(void)
|
|||
read_and_discard_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
|
||||
{
|
||||
JDIMENSION n;
|
||||
#ifdef UPSAMPLE_MERGING_SUPPORTED
|
||||
my_master_ptr master = (my_master_ptr)cinfo->master;
|
||||
#endif
|
||||
JSAMPLE dummy_sample[1] = { 0 };
|
||||
JSAMPROW dummy_row = dummy_sample;
|
||||
JSAMPARRAY scanlines = NULL;
|
||||
|
|
@ -348,10 +358,12 @@ read_and_discard_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
|
|||
cinfo->cquantize->color_quantize = noop_quantize;
|
||||
}
|
||||
|
||||
#ifdef UPSAMPLE_MERGING_SUPPORTED
|
||||
if (master->using_merged_upsample && cinfo->max_v_samp_factor == 2) {
|
||||
my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
|
||||
scanlines = &upsample->spare_row;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (n = 0; n < num_lines; n++)
|
||||
jpeg_read_scanlines(cinfo, scanlines, 1);
|
||||
|
|
@ -424,7 +436,8 @@ jpeg_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
|
|||
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
|
||||
|
||||
/* Do not skip past the bottom of the image. */
|
||||
if (cinfo->output_scanline + num_lines >= cinfo->output_height) {
|
||||
if ((unsigned long long)cinfo->output_scanline + num_lines >=
|
||||
cinfo->output_height) {
|
||||
num_lines = cinfo->output_height - cinfo->output_scanline;
|
||||
cinfo->output_scanline = cinfo->output_height;
|
||||
(*cinfo->inputctl->finish_input_pass) (cinfo);
|
||||
|
|
@ -517,7 +530,7 @@ jpeg_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
|
|||
* all of the entropy decoding occurs in jpeg_start_decompress(), assuming
|
||||
* that the input data source is non-suspending. This makes skipping easy.
|
||||
*/
|
||||
if (cinfo->inputctl->has_multiple_scans) {
|
||||
if (cinfo->inputctl->has_multiple_scans || cinfo->buffered_image) {
|
||||
if (cinfo->upsample->need_context_rows) {
|
||||
cinfo->output_scanline += lines_to_skip;
|
||||
cinfo->output_iMCU_row += lines_to_skip / lines_per_iMCU_row;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* Copyright (C) 1994-1997, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
* Copyright (C) 2010, 2015-2016, 2019-2020, D. R. Commander.
|
||||
* Copyright (C) 2010, 2015-2016, 2019-2020, 2022-2023, D. R. Commander.
|
||||
* Copyright (C) 2015, 2020, Google, Inc.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
|
|
@ -430,7 +430,8 @@ decompress_smooth_data(j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
|
|||
my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
|
||||
JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
|
||||
JDIMENSION block_num, last_block_column;
|
||||
int ci, block_row, block_rows, access_rows;
|
||||
int ci, block_row, block_rows, access_rows, image_block_row,
|
||||
image_block_rows;
|
||||
JBLOCKARRAY buffer;
|
||||
JBLOCKROW buffer_ptr, prev_prev_block_row, prev_block_row;
|
||||
JBLOCKROW next_block_row, next_next_block_row;
|
||||
|
|
@ -475,7 +476,7 @@ decompress_smooth_data(j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
|
|||
if (!compptr->component_needed)
|
||||
continue;
|
||||
/* Count non-dummy DCT block rows in this iMCU row. */
|
||||
if (cinfo->output_iMCU_row < last_iMCU_row - 1) {
|
||||
if (cinfo->output_iMCU_row + 1 < last_iMCU_row) {
|
||||
block_rows = compptr->v_samp_factor;
|
||||
access_rows = block_rows * 3; /* this and next two iMCU rows */
|
||||
} else if (cinfo->output_iMCU_row < last_iMCU_row) {
|
||||
|
|
@ -496,6 +497,7 @@ decompress_smooth_data(j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
|
|||
(JDIMENSION)access_rows, FALSE);
|
||||
buffer += 2 * compptr->v_samp_factor; /* point to current iMCU row */
|
||||
} else if (cinfo->output_iMCU_row > 0) {
|
||||
access_rows += compptr->v_samp_factor; /* prior iMCU row too */
|
||||
buffer = (*cinfo->mem->access_virt_barray)
|
||||
((j_common_ptr)cinfo, coef->whole_image[ci],
|
||||
(cinfo->output_iMCU_row - 1) * compptr->v_samp_factor,
|
||||
|
|
@ -538,29 +540,30 @@ decompress_smooth_data(j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
|
|||
inverse_DCT = cinfo->idct->inverse_DCT[ci];
|
||||
output_ptr = output_buf[ci];
|
||||
/* Loop over all DCT blocks to be processed. */
|
||||
image_block_rows = block_rows * cinfo->total_iMCU_rows;
|
||||
for (block_row = 0; block_row < block_rows; block_row++) {
|
||||
image_block_row = cinfo->output_iMCU_row * block_rows + block_row;
|
||||
buffer_ptr = buffer[block_row] + cinfo->master->first_MCU_col[ci];
|
||||
|
||||
if (block_row > 0 || cinfo->output_iMCU_row > 0)
|
||||
if (image_block_row > 0)
|
||||
prev_block_row =
|
||||
buffer[block_row - 1] + cinfo->master->first_MCU_col[ci];
|
||||
else
|
||||
prev_block_row = buffer_ptr;
|
||||
|
||||
if (block_row > 1 || cinfo->output_iMCU_row > 1)
|
||||
if (image_block_row > 1)
|
||||
prev_prev_block_row =
|
||||
buffer[block_row - 2] + cinfo->master->first_MCU_col[ci];
|
||||
else
|
||||
prev_prev_block_row = prev_block_row;
|
||||
|
||||
if (block_row < block_rows - 1 || cinfo->output_iMCU_row < last_iMCU_row)
|
||||
if (image_block_row < image_block_rows - 1)
|
||||
next_block_row =
|
||||
buffer[block_row + 1] + cinfo->master->first_MCU_col[ci];
|
||||
else
|
||||
next_block_row = buffer_ptr;
|
||||
|
||||
if (block_row < block_rows - 2 ||
|
||||
cinfo->output_iMCU_row < last_iMCU_row - 1)
|
||||
if (image_block_row < image_block_rows - 2)
|
||||
next_next_block_row =
|
||||
buffer[block_row + 2] + cinfo->master->first_MCU_col[ci];
|
||||
else
|
||||
|
|
@ -583,11 +586,11 @@ decompress_smooth_data(j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
|
|||
/* Update DC values */
|
||||
if (block_num == cinfo->master->first_MCU_col[ci] &&
|
||||
block_num < last_block_column) {
|
||||
DC04 = (int)prev_prev_block_row[1][0];
|
||||
DC09 = (int)prev_block_row[1][0];
|
||||
DC14 = (int)buffer_ptr[1][0];
|
||||
DC19 = (int)next_block_row[1][0];
|
||||
DC24 = (int)next_next_block_row[1][0];
|
||||
DC04 = DC05 = (int)prev_prev_block_row[1][0];
|
||||
DC09 = DC10 = (int)prev_block_row[1][0];
|
||||
DC14 = DC15 = (int)buffer_ptr[1][0];
|
||||
DC19 = DC20 = (int)next_block_row[1][0];
|
||||
DC24 = DC25 = (int)next_next_block_row[1][0];
|
||||
}
|
||||
if (block_num + 1 < last_block_column) {
|
||||
DC05 = (int)prev_prev_block_row[2][0];
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2009, 2011, 2015, D. R. Commander.
|
||||
* Copyright (C) 2009, 2011, 2015, 2023, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
|
|
@ -62,10 +62,10 @@ ycc_rgb_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
|||
((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
|
||||
SCALEBITS))];
|
||||
outptr[RGB_BLUE] = range_limit[y + Cbbtab[cb]];
|
||||
/* Set unused byte to 0xFF so it can be interpreted as an opaque */
|
||||
/* Set unused byte to MAXJSAMPLE so it can be interpreted as an opaque */
|
||||
/* alpha channel value */
|
||||
#ifdef RGB_ALPHA
|
||||
outptr[RGB_ALPHA] = 0xFF;
|
||||
outptr[RGB_ALPHA] = MAXJSAMPLE;
|
||||
#endif
|
||||
outptr += RGB_PIXELSIZE;
|
||||
}
|
||||
|
|
@ -94,10 +94,10 @@ gray_rgb_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
|||
outptr = *output_buf++;
|
||||
for (col = 0; col < num_cols; col++) {
|
||||
outptr[RGB_RED] = outptr[RGB_GREEN] = outptr[RGB_BLUE] = inptr[col];
|
||||
/* Set unused byte to 0xFF so it can be interpreted as an opaque */
|
||||
/* Set unused byte to MAXJSAMPLE so it can be interpreted as an opaque */
|
||||
/* alpha channel value */
|
||||
#ifdef RGB_ALPHA
|
||||
outptr[RGB_ALPHA] = 0xFF;
|
||||
outptr[RGB_ALPHA] = MAXJSAMPLE;
|
||||
#endif
|
||||
outptr += RGB_PIXELSIZE;
|
||||
}
|
||||
|
|
@ -130,10 +130,10 @@ rgb_rgb_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
|||
outptr[RGB_RED] = inptr0[col];
|
||||
outptr[RGB_GREEN] = inptr1[col];
|
||||
outptr[RGB_BLUE] = inptr2[col];
|
||||
/* Set unused byte to 0xFF so it can be interpreted as an opaque */
|
||||
/* Set unused byte to MAXJSAMPLE so it can be interpreted as an opaque */
|
||||
/* alpha channel value */
|
||||
#ifdef RGB_ALPHA
|
||||
outptr[RGB_ALPHA] = 0xFF;
|
||||
outptr[RGB_ALPHA] = MAXJSAMPLE;
|
||||
#endif
|
||||
outptr += RGB_PIXELSIZE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
#include "jinclude.h"
|
||||
#include "jpeglib.h"
|
||||
#include "jsimd.h"
|
||||
#include "jconfigint.h"
|
||||
|
||||
|
||||
/* Private subobject */
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
#include "jinclude.h"
|
||||
#include "jdmainct.h"
|
||||
#include "jconfigint.h"
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2012, 2015, 2022, D. R. Commander.
|
||||
* Copyright (C) 2012, 2015, 2022, 2024, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
|
|
@ -815,13 +815,11 @@ save_marker(j_decompress_ptr cinfo)
|
|||
/* Done reading what we want to read */
|
||||
if (cur_marker != NULL) { /* will be NULL if bogus length word */
|
||||
/* Add new marker to end of list */
|
||||
if (cinfo->marker_list == NULL) {
|
||||
cinfo->marker_list = cur_marker;
|
||||
if (cinfo->marker_list == NULL || cinfo->master->marker_list_end == NULL) {
|
||||
cinfo->marker_list = cinfo->master->marker_list_end = cur_marker;
|
||||
} else {
|
||||
jpeg_saved_marker_ptr prev = cinfo->marker_list;
|
||||
while (prev->next != NULL)
|
||||
prev = prev->next;
|
||||
prev->next = cur_marker;
|
||||
cinfo->master->marker_list_end->next = cur_marker;
|
||||
cinfo->master->marker_list_end = cur_marker;
|
||||
}
|
||||
/* Reset pointer & calc remaining data length */
|
||||
data = cur_marker->data;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 2002-2009 by Guido Vollbeding.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2009-2011, 2016, 2019, 2022, D. R. Commander.
|
||||
* Copyright (C) 2009-2011, 2016, 2019, 2022-2023, D. R. Commander.
|
||||
* Copyright (C) 2013, Linaro Limited.
|
||||
* Copyright (C) 2015, Google, Inc.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
|
|
@ -480,7 +480,8 @@ master_selection(j_decompress_ptr cinfo)
|
|||
if (cinfo->raw_data_out)
|
||||
ERREXIT(cinfo, JERR_NOTIMPL);
|
||||
/* 2-pass quantizer only works in 3-component color space. */
|
||||
if (cinfo->out_color_components != 3) {
|
||||
if (cinfo->out_color_components != 3 ||
|
||||
cinfo->out_color_space == JCS_RGB565) {
|
||||
cinfo->enable_1pass_quant = TRUE;
|
||||
cinfo->enable_external_quant = FALSE;
|
||||
cinfo->enable_2pass_quant = FALSE;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@
|
|||
#include "jpeglib.h"
|
||||
#include "jdmerge.h"
|
||||
#include "jsimd.h"
|
||||
#include "jconfigint.h"
|
||||
|
||||
#ifdef UPSAMPLE_MERGING_SUPPORTED
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2011, 2015, 2020, D. R. Commander.
|
||||
* Copyright (C) 2011, 2015, 2020, 2023, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
|
|
@ -57,7 +57,7 @@ h2v1_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
|||
outptr[RGB_GREEN] = range_limit[y + cgreen];
|
||||
outptr[RGB_BLUE] = range_limit[y + cblue];
|
||||
#ifdef RGB_ALPHA
|
||||
outptr[RGB_ALPHA] = 0xFF;
|
||||
outptr[RGB_ALPHA] = MAXJSAMPLE;
|
||||
#endif
|
||||
outptr += RGB_PIXELSIZE;
|
||||
y = *inptr0++;
|
||||
|
|
@ -65,7 +65,7 @@ h2v1_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
|||
outptr[RGB_GREEN] = range_limit[y + cgreen];
|
||||
outptr[RGB_BLUE] = range_limit[y + cblue];
|
||||
#ifdef RGB_ALPHA
|
||||
outptr[RGB_ALPHA] = 0xFF;
|
||||
outptr[RGB_ALPHA] = MAXJSAMPLE;
|
||||
#endif
|
||||
outptr += RGB_PIXELSIZE;
|
||||
}
|
||||
|
|
@ -81,7 +81,7 @@ h2v1_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
|||
outptr[RGB_GREEN] = range_limit[y + cgreen];
|
||||
outptr[RGB_BLUE] = range_limit[y + cblue];
|
||||
#ifdef RGB_ALPHA
|
||||
outptr[RGB_ALPHA] = 0xFF;
|
||||
outptr[RGB_ALPHA] = MAXJSAMPLE;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -131,7 +131,7 @@ h2v2_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
|||
outptr0[RGB_GREEN] = range_limit[y + cgreen];
|
||||
outptr0[RGB_BLUE] = range_limit[y + cblue];
|
||||
#ifdef RGB_ALPHA
|
||||
outptr0[RGB_ALPHA] = 0xFF;
|
||||
outptr0[RGB_ALPHA] = MAXJSAMPLE;
|
||||
#endif
|
||||
outptr0 += RGB_PIXELSIZE;
|
||||
y = *inptr00++;
|
||||
|
|
@ -139,7 +139,7 @@ h2v2_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
|||
outptr0[RGB_GREEN] = range_limit[y + cgreen];
|
||||
outptr0[RGB_BLUE] = range_limit[y + cblue];
|
||||
#ifdef RGB_ALPHA
|
||||
outptr0[RGB_ALPHA] = 0xFF;
|
||||
outptr0[RGB_ALPHA] = MAXJSAMPLE;
|
||||
#endif
|
||||
outptr0 += RGB_PIXELSIZE;
|
||||
y = *inptr01++;
|
||||
|
|
@ -147,7 +147,7 @@ h2v2_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
|||
outptr1[RGB_GREEN] = range_limit[y + cgreen];
|
||||
outptr1[RGB_BLUE] = range_limit[y + cblue];
|
||||
#ifdef RGB_ALPHA
|
||||
outptr1[RGB_ALPHA] = 0xFF;
|
||||
outptr1[RGB_ALPHA] = MAXJSAMPLE;
|
||||
#endif
|
||||
outptr1 += RGB_PIXELSIZE;
|
||||
y = *inptr01++;
|
||||
|
|
@ -155,7 +155,7 @@ h2v2_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
|||
outptr1[RGB_GREEN] = range_limit[y + cgreen];
|
||||
outptr1[RGB_BLUE] = range_limit[y + cblue];
|
||||
#ifdef RGB_ALPHA
|
||||
outptr1[RGB_ALPHA] = 0xFF;
|
||||
outptr1[RGB_ALPHA] = MAXJSAMPLE;
|
||||
#endif
|
||||
outptr1 += RGB_PIXELSIZE;
|
||||
}
|
||||
|
|
@ -171,14 +171,14 @@ h2v2_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
|||
outptr0[RGB_GREEN] = range_limit[y + cgreen];
|
||||
outptr0[RGB_BLUE] = range_limit[y + cblue];
|
||||
#ifdef RGB_ALPHA
|
||||
outptr0[RGB_ALPHA] = 0xFF;
|
||||
outptr0[RGB_ALPHA] = MAXJSAMPLE;
|
||||
#endif
|
||||
y = *inptr01;
|
||||
outptr1[RGB_RED] = range_limit[y + cred];
|
||||
outptr1[RGB_GREEN] = range_limit[y + cgreen];
|
||||
outptr1[RGB_BLUE] = range_limit[y + cblue];
|
||||
#ifdef RGB_ALPHA
|
||||
outptr1[RGB_ALPHA] = 0xFF;
|
||||
outptr1[RGB_ALPHA] = MAXJSAMPLE;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2022, D. R. Commander.
|
||||
* Copyright (C) 2022, 2024, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
|
|
@ -40,13 +40,11 @@
|
|||
* Create the message string table.
|
||||
* We do this from the master message list in jerror.h by re-reading
|
||||
* jerror.h with a suitable definition for macro JMESSAGE.
|
||||
* The message table is made an external symbol just in case any applications
|
||||
* want to refer to it directly.
|
||||
*/
|
||||
|
||||
#define JMESSAGE(code, string) string,
|
||||
|
||||
const char * const jpeg_std_message_table[] = {
|
||||
static const char * const jpeg_std_message_table[] = {
|
||||
#include "jerror.h"
|
||||
NULL
|
||||
};
|
||||
|
|
@ -189,9 +187,9 @@ format_message(j_common_ptr cinfo, char *buffer)
|
|||
|
||||
/* Format the message into the passed buffer */
|
||||
if (isstring)
|
||||
snprintf(buffer, JMSG_LENGTH_MAX, msgtext, err->msg_parm.s);
|
||||
SNPRINTF(buffer, JMSG_LENGTH_MAX, msgtext, err->msg_parm.s);
|
||||
else
|
||||
snprintf(buffer, JMSG_LENGTH_MAX, msgtext,
|
||||
SNPRINTF(buffer, JMSG_LENGTH_MAX, msgtext,
|
||||
err->msg_parm.i[0], err->msg_parm.i[1],
|
||||
err->msg_parm.i[2], err->msg_parm.i[3],
|
||||
err->msg_parm.i[4], err->msg_parm.i[5],
|
||||
|
|
@ -229,23 +227,17 @@ reset_error_mgr(j_common_ptr cinfo)
|
|||
GLOBAL(struct jpeg_error_mgr *)
|
||||
jpeg_std_error(struct jpeg_error_mgr *err)
|
||||
{
|
||||
memset(err, 0, sizeof(struct jpeg_error_mgr));
|
||||
|
||||
err->error_exit = error_exit;
|
||||
err->emit_message = emit_message;
|
||||
err->output_message = output_message;
|
||||
err->format_message = format_message;
|
||||
err->reset_error_mgr = reset_error_mgr;
|
||||
|
||||
err->trace_level = 0; /* default = no tracing */
|
||||
err->num_warnings = 0; /* no warnings emitted yet */
|
||||
err->msg_code = 0; /* may be useful as a flag for "no error" */
|
||||
|
||||
/* Initialize message table pointers */
|
||||
err->jpeg_message_table = jpeg_std_message_table;
|
||||
err->last_jpeg_message = (int)JMSG_LASTMSGCODE - 1;
|
||||
|
||||
err->addon_message_table = NULL;
|
||||
err->first_addon_message = 0; /* for safety */
|
||||
err->last_addon_message = 0;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1994, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2022, D. R. Commander.
|
||||
* Copyright (C) 2022-2023, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
|
|
@ -45,6 +45,18 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#define SNPRINTF(str, n, format, ...) \
|
||||
_snprintf_s(str, n, _TRUNCATE, format, ##__VA_ARGS__)
|
||||
|
||||
#else
|
||||
|
||||
#define SNPRINTF snprintf
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef NO_GETENV
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
|
@ -111,6 +123,8 @@ static INLINE int GETENV_S(char *buffer, size_t buffer_size, const char *name)
|
|||
|
||||
#else
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
/* This provides a similar interface to the Microsoft _putenv_s() function, but
|
||||
* other than parameter validation, it has no advantages over setenv().
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -68,10 +68,13 @@ round_up_pow2(size_t a, size_t b)
|
|||
* There isn't any really portable way to determine the worst-case alignment
|
||||
* requirement. This module assumes that the alignment requirement is
|
||||
* multiples of ALIGN_SIZE.
|
||||
* By default, we define ALIGN_SIZE as sizeof(double). This is necessary on
|
||||
* some workstations (where doubles really do need 8-byte alignment) and will
|
||||
* work fine on nearly everything. If your machine has lesser alignment needs,
|
||||
* you can save a few bytes by making ALIGN_SIZE smaller.
|
||||
* By default, we define ALIGN_SIZE as the maximum of sizeof(double) and
|
||||
* sizeof(void *). This is necessary on some workstations (where doubles
|
||||
* really do need 8-byte alignment) and will work fine on nearly everything.
|
||||
* We use the maximum of sizeof(double) and sizeof(void *) since sizeof(double)
|
||||
* may be insufficient, for example, on CHERI-enabled platforms with 16-byte
|
||||
* pointers and a 16-byte alignment requirement. If your machine has lesser
|
||||
* alignment needs, you can save a few bytes by making ALIGN_SIZE smaller.
|
||||
* The only place I know of where this will NOT work is certain Macintosh
|
||||
* 680x0 compilers that define double as a 10-byte IEEE extended float.
|
||||
* Doing 10-byte alignment is counterproductive because longwords won't be
|
||||
|
|
@ -81,7 +84,7 @@ round_up_pow2(size_t a, size_t b)
|
|||
|
||||
#ifndef ALIGN_SIZE /* so can override from jconfig.h */
|
||||
#ifndef WITH_SIMD
|
||||
#define ALIGN_SIZE sizeof(double)
|
||||
#define ALIGN_SIZE MAX(sizeof(void *), sizeof(double))
|
||||
#else
|
||||
#define ALIGN_SIZE 32 /* Most of the SIMD instructions we support require
|
||||
16-byte (128-bit) alignment, but AVX2 requires
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1992-1996, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2017-2018, D. R. Commander.
|
||||
* Copyright (C) 2017-2018, 2024, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
GLOBAL(void *)
|
||||
jpeg_get_small(j_common_ptr cinfo, size_t sizeofobject)
|
||||
{
|
||||
return (void *)malloc(sizeofobject);
|
||||
return (void *)MALLOC(sizeofobject);
|
||||
}
|
||||
|
||||
GLOBAL(void)
|
||||
|
|
@ -48,7 +48,7 @@ jpeg_free_small(j_common_ptr cinfo, void *object, size_t sizeofobject)
|
|||
GLOBAL(void *)
|
||||
jpeg_get_large(j_common_ptr cinfo, size_t sizeofobject)
|
||||
{
|
||||
return (void *)malloc(sizeofobject);
|
||||
return (void *)MALLOC(sizeofobject);
|
||||
}
|
||||
|
||||
GLOBAL(void)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,33 @@
|
|||
static const unsigned char jpeg_nbits_table[65536] = {
|
||||
/*
|
||||
* Copyright (C) 2024, D. R. Commander.
|
||||
*
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*/
|
||||
|
||||
#include "jpeg_nbits.h"
|
||||
#include "jconfig.h"
|
||||
#include "jconfigint.h"
|
||||
|
||||
|
||||
#ifndef USE_CLZ_INTRINSIC
|
||||
|
||||
#define INCLUDE_JPEG_NBITS_TABLE
|
||||
|
||||
/* When building for x86[-64] with the SIMD extensions enabled, the C Huffman
|
||||
* encoders can reuse jpeg_nbits_table from the SSE2 baseline Huffman encoder.
|
||||
*/
|
||||
#if (defined(__x86_64__) || defined(__i386__) || defined(_M_IX86) || \
|
||||
defined(_M_X64)) && defined(WITH_SIMD)
|
||||
#undef INCLUDE_JPEG_NBITS_TABLE
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef INCLUDE_JPEG_NBITS_TABLE
|
||||
|
||||
const unsigned char HIDDEN jpeg_nbits_table[65536] = {
|
||||
0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||
|
|
@ -4096,3 +4125,11 @@ static const unsigned char jpeg_nbits_table[65536] = {
|
|||
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
|
||||
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
/* Suppress compiler warnings about empty translation unit. */
|
||||
|
||||
typedef int dummy_jpeg_nbits_table;
|
||||
|
||||
#endif
|
||||
43
media/libjpeg/jpeg_nbits.h
Normal file
43
media/libjpeg/jpeg_nbits.h
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (C) 2014, 2021, 2024, D. R. Commander.
|
||||
* Copyright (C) 2014, Olle Liljenzin.
|
||||
* Copyright (C) 2020, Arm Limited.
|
||||
*
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*/
|
||||
|
||||
/*
|
||||
* NOTE: If USE_CLZ_INTRINSIC is defined, then clz/bsr instructions will be
|
||||
* used for bit counting rather than the lookup table. This will reduce the
|
||||
* memory footprint by 64k, which is important for some mobile applications
|
||||
* that create many isolated instances of libjpeg-turbo (web browsers, for
|
||||
* instance.) This may improve performance on some mobile platforms as well.
|
||||
* This feature is enabled by default only on Arm processors, because some x86
|
||||
* chips have a slow implementation of bsr, and the use of clz/bsr cannot be
|
||||
* shown to have a significant performance impact even on the x86 chips that
|
||||
* have a fast implementation of it. When building for Armv6, you can
|
||||
* explicitly disable the use of clz/bsr by adding -mthumb to the compiler
|
||||
* flags (this defines __thumb__).
|
||||
*/
|
||||
|
||||
/* NOTE: Both GCC and Clang define __GNUC__ */
|
||||
#if (defined(__GNUC__) && (defined(__arm__) || defined(__aarch64__))) || \
|
||||
defined(_M_ARM) || defined(_M_ARM64)
|
||||
#if !defined(__thumb__) || defined(__thumb2__)
|
||||
#define USE_CLZ_INTRINSIC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef USE_CLZ_INTRINSIC
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#define JPEG_NBITS_NONZERO(x) (32 - _CountLeadingZeros(x))
|
||||
#else
|
||||
#define JPEG_NBITS_NONZERO(x) (32 - __builtin_clz(x))
|
||||
#endif
|
||||
#define JPEG_NBITS(x) (x ? JPEG_NBITS_NONZERO(x) : 0)
|
||||
#else
|
||||
extern const unsigned char jpeg_nbits_table[65536];
|
||||
#define JPEG_NBITS(x) (jpeg_nbits_table[x])
|
||||
#define JPEG_NBITS_NONZERO(x) JPEG_NBITS(x)
|
||||
#endif
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 1997-2009 by Guido Vollbeding.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2015-2016, 2019, 2021, D. R. Commander.
|
||||
* Copyright (C) 2015-2016, 2019, 2021, 2024, D. R. Commander.
|
||||
* Copyright (C) 2015, Google, Inc.
|
||||
* Copyright (C) 2021, Alex Richardson.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
|
|
@ -174,6 +174,9 @@ struct jpeg_decomp_master {
|
|||
|
||||
/* Last iMCU row that was successfully decoded */
|
||||
JDIMENSION last_good_iMCU_row;
|
||||
|
||||
/* Tail of list of saved markers */
|
||||
jpeg_saved_marker_ptr marker_list_end;
|
||||
};
|
||||
|
||||
/* Input control module */
|
||||
|
|
@ -294,6 +297,12 @@ struct jpeg_color_quantizer {
|
|||
#undef MIN
|
||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
|
||||
#ifdef ZERO_BUFFERS
|
||||
#define MALLOC(size) calloc(1, size)
|
||||
#else
|
||||
#define MALLOC(size) malloc(size)
|
||||
#endif
|
||||
|
||||
|
||||
/* We assume that right shift corresponds to signed division by 2 with
|
||||
* rounding towards minus infinity. This is correct for typical "arithmetic
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@
|
|||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||
* Modified 2002-2009 by Guido Vollbeding.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2009-2011, 2013-2014, 2016-2017, 2020, D. R. Commander.
|
||||
* Copyright (C) 2009-2011, 2013-2014, 2016-2017, 2020, 2023-2024,
|
||||
D. R. Commander.
|
||||
* Copyright (C) 2015, Google, Inc.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
|
|
@ -15,6 +16,16 @@
|
|||
* and perhaps jerror.h if they want to know the exact error codes.
|
||||
*/
|
||||
|
||||
/* NOTE: This header file does not include stdio.h, despite the fact that it
|
||||
* uses FILE and size_t. That is by design, since the libjpeg API predates the
|
||||
* widespread adoption of ANSI/ISO C. Referring to libjpeg.txt, it is a
|
||||
* documented requirement that calling programs "include system headers that
|
||||
* define at least the typedefs FILE and size_t" before including jpeglib.h.
|
||||
* Technically speaking, changing that requirement by including stdio.h here
|
||||
* would break backward API compatibility. Please do not file bug reports,
|
||||
* feature requests, or pull requests regarding this.
|
||||
*/
|
||||
|
||||
#ifndef JPEGLIB_H
|
||||
#define JPEGLIB_H
|
||||
|
||||
|
|
@ -238,7 +249,8 @@ typedef enum {
|
|||
JCS_EXT_BGRA, /* blue/green/red/alpha */
|
||||
JCS_EXT_ABGR, /* alpha/blue/green/red */
|
||||
JCS_EXT_ARGB, /* alpha/red/green/blue */
|
||||
JCS_RGB565 /* 5-bit red/6-bit green/5-bit blue */
|
||||
JCS_RGB565 /* 5-bit red/6-bit green/5-bit blue
|
||||
[decompression only] */
|
||||
} J_COLOR_SPACE;
|
||||
|
||||
/* DCT/IDCT algorithm options. */
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1996, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2009, 2014-2015, 2020, D. R. Commander.
|
||||
* Copyright (C) 2009, 2014-2015, 2020, 2023, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
|
|
@ -1230,7 +1230,8 @@ jinit_2pass_quantizer(j_decompress_ptr cinfo)
|
|||
cquantize->error_limiter = NULL;
|
||||
|
||||
/* Make sure jdmaster didn't give me a case I can't handle */
|
||||
if (cinfo->out_color_components != 3)
|
||||
if (cinfo->out_color_components != 3 ||
|
||||
cinfo->out_color_space == JCS_RGB565)
|
||||
ERREXIT(cinfo, JERR_NOTIMPL);
|
||||
|
||||
/* Allocate the histogram/inverse colormap storage */
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
* jsimd.h
|
||||
*
|
||||
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
* Copyright (C) 2011, 2014, D. R. Commander.
|
||||
* Copyright (C) 2015-2016, 2018, Matthieu Darbois.
|
||||
* Copyright (C) 2011, 2014, 2022, D. R. Commander.
|
||||
* Copyright (C) 2015-2016, 2018, 2022, Matthieu Darbois.
|
||||
* Copyright (C) 2020, Arm Limited.
|
||||
*
|
||||
* Based on the x86 SIMD extension for IJG JPEG library,
|
||||
|
|
@ -114,10 +114,10 @@ EXTERN(int) jsimd_can_encode_mcu_AC_first_prepare(void);
|
|||
|
||||
EXTERN(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);
|
||||
UJCOEF *values, size_t *zerobits);
|
||||
|
||||
EXTERN(int) jsimd_can_encode_mcu_AC_refine_prepare(void);
|
||||
|
||||
EXTERN(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);
|
||||
UJCOEF *absvalues, size_t *bits);
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
* jsimd_none.c
|
||||
*
|
||||
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
* Copyright (C) 2009-2011, 2014, D. R. Commander.
|
||||
* Copyright (C) 2015-2016, 2018, Matthieu Darbois.
|
||||
* Copyright (C) 2009-2011, 2014, 2022, D. R. Commander.
|
||||
* Copyright (C) 2015-2016, 2018, 2022, Matthieu Darbois.
|
||||
* Copyright (C) 2020, Arm Limited.
|
||||
*
|
||||
* Based on the x86 SIMD extension for IJG JPEG library,
|
||||
|
|
@ -412,7 +412,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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -425,7 +425,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 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-2020, Thomas G. Lane, Guido Vollbeding.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2010, 2012-2022, D. R. Commander.
|
||||
* Copyright (C) 2010, 2012-2024, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
|
|
@ -36,19 +36,20 @@
|
|||
* their code
|
||||
*/
|
||||
|
||||
#define JCOPYRIGHT \
|
||||
"Copyright (C) 2009-2022 D. R. Commander\n" \
|
||||
#define JCOPYRIGHT1 \
|
||||
"Copyright (C) 2009-2024 D. R. Commander\n" \
|
||||
"Copyright (C) 2015, 2020 Google, Inc.\n" \
|
||||
"Copyright (C) 2019-2020 Arm Limited\n" \
|
||||
"Copyright (C) 2015-2016, 2018 Matthieu Darbois\n" \
|
||||
"Copyright (C) 2011-2016 Siarhei Siamashka\n" \
|
||||
"Copyright (C) 2015 Intel Corporation\n" \
|
||||
"Copyright (C) 2015 Intel Corporation\n"
|
||||
#define JCOPYRIGHT2 \
|
||||
"Copyright (C) 2013-2014 Linaro Limited\n" \
|
||||
"Copyright (C) 2013-2014 MIPS Technologies, Inc.\n" \
|
||||
"Copyright (C) 2009, 2012 Pierre Ossman for Cendio AB\n" \
|
||||
"Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies)\n" \
|
||||
"Copyright (C) 1999-2006 MIYASAKA Masaru\n" \
|
||||
"Copyright (C) 1991-2020 Thomas G. Lane, Guido Vollbeding"
|
||||
"Copyright (C) 1991-2020 Thomas G. Lane, Guido Vollbeding\n"
|
||||
|
||||
#define JCOPYRIGHT_SHORT \
|
||||
"Copyright (C) 1991-2022 The libjpeg-turbo Project and many others"
|
||||
"Copyright (C) 1991-2024 The libjpeg-turbo Project and many others"
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ SOURCES += [
|
|||
'jidctred.c',
|
||||
'jmemmgr.c',
|
||||
'jmemnobs.c',
|
||||
'jpeg_nbits.c',
|
||||
'jquant1.c',
|
||||
'jquant2.c',
|
||||
'jutils.c',
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
* Copyright (C) 2011, Nokia Corporation and/or its subsidiary(-ies).
|
||||
* Copyright (C) 2009-2011, 2013-2014, 2016, 2018, 2022, D. R. Commander.
|
||||
* Copyright (C) 2015-2016, 2018, Matthieu Darbois.
|
||||
* Copyright (C) 2015-2016, 2018, 2022, Matthieu Darbois.
|
||||
* Copyright (C) 2019, Google LLC.
|
||||
* Copyright (C) 2020, Arm Limited.
|
||||
*
|
||||
|
|
@ -25,12 +25,10 @@
|
|||
#include "../../../jsimddct.h"
|
||||
#include "../../jsimd.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
static unsigned int simd_support = ~0;
|
||||
static unsigned int simd_huffman = 1;
|
||||
static THREAD_LOCAL unsigned int simd_support = ~0;
|
||||
static THREAD_LOCAL unsigned int simd_huffman = 1;
|
||||
|
||||
#if !defined(__ARM_NEON__) && (defined(__linux__) || defined(ANDROID) || defined(__ANDROID__))
|
||||
|
||||
|
|
@ -98,8 +96,6 @@ parse_proc_cpuinfo(int bufsize)
|
|||
|
||||
/*
|
||||
* Check what SIMD accelerations are supported.
|
||||
*
|
||||
* FIXME: This code is racy under a multi-threaded environment.
|
||||
*/
|
||||
LOCAL(void)
|
||||
init_simd(void)
|
||||
|
|
@ -947,7 +943,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_neon(block, jpeg_natural_order_start,
|
||||
Sl, Al, values, zerobits);
|
||||
|
|
@ -972,7 +968,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_neon(block,
|
||||
jpeg_natural_order_start, Sl,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
* Copyright (C) 2011, Nokia Corporation and/or its subsidiary(-ies).
|
||||
* Copyright (C) 2009-2011, 2013-2014, 2016, 2018, 2020, 2022, D. R. Commander.
|
||||
* Copyright (C) 2015-2016, 2018, Matthieu Darbois.
|
||||
* Copyright (C) 2015-2016, 2018, 2022, Matthieu Darbois.
|
||||
* Copyright (C) 2020, Arm Limited.
|
||||
*
|
||||
* Based on the x86 SIMD extension for IJG JPEG library,
|
||||
|
|
@ -23,20 +23,17 @@
|
|||
#include "../../../jdct.h"
|
||||
#include "../../../jsimddct.h"
|
||||
#include "../../jsimd.h"
|
||||
#include "jconfigint.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#define JSIMD_FASTLD3 1
|
||||
#define JSIMD_FASTST3 2
|
||||
#define JSIMD_FASTTBL 4
|
||||
|
||||
static unsigned int simd_support = ~0;
|
||||
static unsigned int simd_huffman = 1;
|
||||
static unsigned int simd_features = JSIMD_FASTLD3 | JSIMD_FASTST3 |
|
||||
JSIMD_FASTTBL;
|
||||
static THREAD_LOCAL unsigned int simd_support = ~0;
|
||||
static THREAD_LOCAL unsigned int simd_huffman = 1;
|
||||
static THREAD_LOCAL unsigned int simd_features = JSIMD_FASTLD3 |
|
||||
JSIMD_FASTST3 | JSIMD_FASTTBL;
|
||||
|
||||
#if defined(__linux__) || defined(ANDROID) || defined(__ANDROID__)
|
||||
|
||||
|
|
@ -111,8 +108,6 @@ parse_proc_cpuinfo(int bufsize)
|
|||
|
||||
/*
|
||||
* Check what SIMD accelerations are supported.
|
||||
*
|
||||
* FIXME: This code is racy under a multi-threaded environment.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
@ -1023,7 +1018,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_neon(block, jpeg_natural_order_start,
|
||||
Sl, Al, values, zerobits);
|
||||
|
|
@ -1050,7 +1045,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_neon(block,
|
||||
jpeg_natural_order_start,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
* jcphuff-neon.c - prepare data for progressive Huffman encoding (Arm Neon)
|
||||
*
|
||||
* Copyright (C) 2020-2021, Arm Limited. All Rights Reserved.
|
||||
* Copyright (C) 2022, Matthieu Darbois. All Rights Reserved.
|
||||
* Copyright (C) 2022, D. R. Commander. All Rights Reserved.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
|
@ -21,7 +23,6 @@
|
|||
*/
|
||||
|
||||
#define JPEG_INTERNALS
|
||||
#include "jconfigint.h"
|
||||
#include "../../jinclude.h"
|
||||
#include "../../jpeglib.h"
|
||||
#include "../../jsimd.h"
|
||||
|
|
@ -41,10 +42,10 @@
|
|||
|
||||
void jsimd_encode_mcu_AC_first_prepare_neon
|
||||
(const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al,
|
||||
JCOEF *values, size_t *zerobits)
|
||||
UJCOEF *values, size_t *zerobits)
|
||||
{
|
||||
JCOEF *values_ptr = values;
|
||||
JCOEF *diff_values_ptr = values + DCTSIZE2;
|
||||
UJCOEF *values_ptr = values;
|
||||
UJCOEF *diff_values_ptr = values + DCTSIZE2;
|
||||
|
||||
/* Rows of coefficients to zero (since they haven't been processed) */
|
||||
int i, rows_to_zero = 8;
|
||||
|
|
@ -68,23 +69,23 @@ void jsimd_encode_mcu_AC_first_prepare_neon
|
|||
coefs2 = vld1q_lane_s16(block + jpeg_natural_order_start[15], coefs2, 7);
|
||||
|
||||
/* Isolate sign of coefficients. */
|
||||
int16x8_t sign_coefs1 = vshrq_n_s16(coefs1, 15);
|
||||
int16x8_t sign_coefs2 = vshrq_n_s16(coefs2, 15);
|
||||
uint16x8_t sign_coefs1 = vreinterpretq_u16_s16(vshrq_n_s16(coefs1, 15));
|
||||
uint16x8_t sign_coefs2 = vreinterpretq_u16_s16(vshrq_n_s16(coefs2, 15));
|
||||
/* Compute absolute value of coefficients and apply point transform Al. */
|
||||
int16x8_t abs_coefs1 = vabsq_s16(coefs1);
|
||||
int16x8_t abs_coefs2 = vabsq_s16(coefs2);
|
||||
coefs1 = vshlq_s16(abs_coefs1, vdupq_n_s16(-Al));
|
||||
coefs2 = vshlq_s16(abs_coefs2, vdupq_n_s16(-Al));
|
||||
uint16x8_t abs_coefs1 = vreinterpretq_u16_s16(vabsq_s16(coefs1));
|
||||
uint16x8_t abs_coefs2 = vreinterpretq_u16_s16(vabsq_s16(coefs2));
|
||||
abs_coefs1 = vshlq_u16(abs_coefs1, vdupq_n_s16(-Al));
|
||||
abs_coefs2 = vshlq_u16(abs_coefs2, vdupq_n_s16(-Al));
|
||||
|
||||
/* Compute diff values. */
|
||||
int16x8_t diff1 = veorq_s16(coefs1, sign_coefs1);
|
||||
int16x8_t diff2 = veorq_s16(coefs2, sign_coefs2);
|
||||
uint16x8_t diff1 = veorq_u16(abs_coefs1, sign_coefs1);
|
||||
uint16x8_t diff2 = veorq_u16(abs_coefs2, sign_coefs2);
|
||||
|
||||
/* Store transformed coefficients and diff values. */
|
||||
vst1q_s16(values_ptr, coefs1);
|
||||
vst1q_s16(values_ptr + DCTSIZE, coefs2);
|
||||
vst1q_s16(diff_values_ptr, diff1);
|
||||
vst1q_s16(diff_values_ptr + DCTSIZE, diff2);
|
||||
vst1q_u16(values_ptr, abs_coefs1);
|
||||
vst1q_u16(values_ptr + DCTSIZE, abs_coefs2);
|
||||
vst1q_u16(diff_values_ptr, diff1);
|
||||
vst1q_u16(diff_values_ptr + DCTSIZE, diff2);
|
||||
values_ptr += 16;
|
||||
diff_values_ptr += 16;
|
||||
jpeg_natural_order_start += 16;
|
||||
|
|
@ -130,23 +131,23 @@ void jsimd_encode_mcu_AC_first_prepare_neon
|
|||
}
|
||||
|
||||
/* Isolate sign of coefficients. */
|
||||
int16x8_t sign_coefs1 = vshrq_n_s16(coefs1, 15);
|
||||
int16x8_t sign_coefs2 = vshrq_n_s16(coefs2, 15);
|
||||
uint16x8_t sign_coefs1 = vreinterpretq_u16_s16(vshrq_n_s16(coefs1, 15));
|
||||
uint16x8_t sign_coefs2 = vreinterpretq_u16_s16(vshrq_n_s16(coefs2, 15));
|
||||
/* Compute absolute value of coefficients and apply point transform Al. */
|
||||
int16x8_t abs_coefs1 = vabsq_s16(coefs1);
|
||||
int16x8_t abs_coefs2 = vabsq_s16(coefs2);
|
||||
coefs1 = vshlq_s16(abs_coefs1, vdupq_n_s16(-Al));
|
||||
coefs2 = vshlq_s16(abs_coefs2, vdupq_n_s16(-Al));
|
||||
uint16x8_t abs_coefs1 = vreinterpretq_u16_s16(vabsq_s16(coefs1));
|
||||
uint16x8_t abs_coefs2 = vreinterpretq_u16_s16(vabsq_s16(coefs2));
|
||||
abs_coefs1 = vshlq_u16(abs_coefs1, vdupq_n_s16(-Al));
|
||||
abs_coefs2 = vshlq_u16(abs_coefs2, vdupq_n_s16(-Al));
|
||||
|
||||
/* Compute diff values. */
|
||||
int16x8_t diff1 = veorq_s16(coefs1, sign_coefs1);
|
||||
int16x8_t diff2 = veorq_s16(coefs2, sign_coefs2);
|
||||
uint16x8_t diff1 = veorq_u16(abs_coefs1, sign_coefs1);
|
||||
uint16x8_t diff2 = veorq_u16(abs_coefs2, sign_coefs2);
|
||||
|
||||
/* Store transformed coefficients and diff values. */
|
||||
vst1q_s16(values_ptr, coefs1);
|
||||
vst1q_s16(values_ptr + DCTSIZE, coefs2);
|
||||
vst1q_s16(diff_values_ptr, diff1);
|
||||
vst1q_s16(diff_values_ptr + DCTSIZE, diff2);
|
||||
vst1q_u16(values_ptr, abs_coefs1);
|
||||
vst1q_u16(values_ptr + DCTSIZE, abs_coefs2);
|
||||
vst1q_u16(diff_values_ptr, diff1);
|
||||
vst1q_u16(diff_values_ptr + DCTSIZE, diff2);
|
||||
values_ptr += 16;
|
||||
diff_values_ptr += 16;
|
||||
rows_to_zero -= 2;
|
||||
|
|
@ -184,17 +185,17 @@ void jsimd_encode_mcu_AC_first_prepare_neon
|
|||
}
|
||||
|
||||
/* Isolate sign of coefficients. */
|
||||
int16x8_t sign_coefs = vshrq_n_s16(coefs, 15);
|
||||
uint16x8_t sign_coefs = vreinterpretq_u16_s16(vshrq_n_s16(coefs, 15));
|
||||
/* Compute absolute value of coefficients and apply point transform Al. */
|
||||
int16x8_t abs_coefs = vabsq_s16(coefs);
|
||||
coefs = vshlq_s16(abs_coefs, vdupq_n_s16(-Al));
|
||||
uint16x8_t abs_coefs = vreinterpretq_u16_s16(vabsq_s16(coefs));
|
||||
abs_coefs = vshlq_u16(abs_coefs, vdupq_n_s16(-Al));
|
||||
|
||||
/* Compute diff values. */
|
||||
int16x8_t diff = veorq_s16(coefs, sign_coefs);
|
||||
uint16x8_t diff = veorq_u16(abs_coefs, sign_coefs);
|
||||
|
||||
/* Store transformed coefficients and diff values. */
|
||||
vst1q_s16(values_ptr, coefs);
|
||||
vst1q_s16(diff_values_ptr, diff);
|
||||
vst1q_u16(values_ptr, abs_coefs);
|
||||
vst1q_u16(diff_values_ptr, diff);
|
||||
values_ptr += 8;
|
||||
diff_values_ptr += 8;
|
||||
rows_to_zero--;
|
||||
|
|
@ -202,8 +203,8 @@ void jsimd_encode_mcu_AC_first_prepare_neon
|
|||
|
||||
/* Zero remaining memory in the values and diff_values blocks. */
|
||||
for (i = 0; i < rows_to_zero; i++) {
|
||||
vst1q_s16(values_ptr, vdupq_n_s16(0));
|
||||
vst1q_s16(diff_values_ptr, vdupq_n_s16(0));
|
||||
vst1q_u16(values_ptr, vdupq_n_u16(0));
|
||||
vst1q_u16(diff_values_ptr, vdupq_n_u16(0));
|
||||
values_ptr += 8;
|
||||
diff_values_ptr += 8;
|
||||
}
|
||||
|
|
@ -211,23 +212,23 @@ void jsimd_encode_mcu_AC_first_prepare_neon
|
|||
/* Construct zerobits bitmap. A set bit means that the corresponding
|
||||
* coefficient != 0.
|
||||
*/
|
||||
int16x8_t row0 = vld1q_s16(values + 0 * DCTSIZE);
|
||||
int16x8_t row1 = vld1q_s16(values + 1 * DCTSIZE);
|
||||
int16x8_t row2 = vld1q_s16(values + 2 * DCTSIZE);
|
||||
int16x8_t row3 = vld1q_s16(values + 3 * DCTSIZE);
|
||||
int16x8_t row4 = vld1q_s16(values + 4 * DCTSIZE);
|
||||
int16x8_t row5 = vld1q_s16(values + 5 * DCTSIZE);
|
||||
int16x8_t row6 = vld1q_s16(values + 6 * DCTSIZE);
|
||||
int16x8_t row7 = vld1q_s16(values + 7 * DCTSIZE);
|
||||
uint16x8_t row0 = vld1q_u16(values + 0 * DCTSIZE);
|
||||
uint16x8_t row1 = vld1q_u16(values + 1 * DCTSIZE);
|
||||
uint16x8_t row2 = vld1q_u16(values + 2 * DCTSIZE);
|
||||
uint16x8_t row3 = vld1q_u16(values + 3 * DCTSIZE);
|
||||
uint16x8_t row4 = vld1q_u16(values + 4 * DCTSIZE);
|
||||
uint16x8_t row5 = vld1q_u16(values + 5 * DCTSIZE);
|
||||
uint16x8_t row6 = vld1q_u16(values + 6 * DCTSIZE);
|
||||
uint16x8_t row7 = vld1q_u16(values + 7 * DCTSIZE);
|
||||
|
||||
uint8x8_t row0_eq0 = vmovn_u16(vceqq_s16(row0, vdupq_n_s16(0)));
|
||||
uint8x8_t row1_eq0 = vmovn_u16(vceqq_s16(row1, vdupq_n_s16(0)));
|
||||
uint8x8_t row2_eq0 = vmovn_u16(vceqq_s16(row2, vdupq_n_s16(0)));
|
||||
uint8x8_t row3_eq0 = vmovn_u16(vceqq_s16(row3, vdupq_n_s16(0)));
|
||||
uint8x8_t row4_eq0 = vmovn_u16(vceqq_s16(row4, vdupq_n_s16(0)));
|
||||
uint8x8_t row5_eq0 = vmovn_u16(vceqq_s16(row5, vdupq_n_s16(0)));
|
||||
uint8x8_t row6_eq0 = vmovn_u16(vceqq_s16(row6, vdupq_n_s16(0)));
|
||||
uint8x8_t row7_eq0 = vmovn_u16(vceqq_s16(row7, vdupq_n_s16(0)));
|
||||
uint8x8_t row0_eq0 = vmovn_u16(vceqq_u16(row0, vdupq_n_u16(0)));
|
||||
uint8x8_t row1_eq0 = vmovn_u16(vceqq_u16(row1, vdupq_n_u16(0)));
|
||||
uint8x8_t row2_eq0 = vmovn_u16(vceqq_u16(row2, vdupq_n_u16(0)));
|
||||
uint8x8_t row3_eq0 = vmovn_u16(vceqq_u16(row3, vdupq_n_u16(0)));
|
||||
uint8x8_t row4_eq0 = vmovn_u16(vceqq_u16(row4, vdupq_n_u16(0)));
|
||||
uint8x8_t row5_eq0 = vmovn_u16(vceqq_u16(row5, vdupq_n_u16(0)));
|
||||
uint8x8_t row6_eq0 = vmovn_u16(vceqq_u16(row6, vdupq_n_u16(0)));
|
||||
uint8x8_t row7_eq0 = vmovn_u16(vceqq_u16(row7, vdupq_n_u16(0)));
|
||||
|
||||
/* { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 } */
|
||||
const uint8x8_t bitmap_mask =
|
||||
|
|
@ -274,7 +275,7 @@ void jsimd_encode_mcu_AC_first_prepare_neon
|
|||
|
||||
int jsimd_encode_mcu_AC_refine_prepare_neon
|
||||
(const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al,
|
||||
JCOEF *absvalues, size_t *bits)
|
||||
UJCOEF *absvalues, size_t *bits)
|
||||
{
|
||||
/* Temporary storage buffers for data used to compute the signbits bitmap and
|
||||
* the end-of-block (EOB) position
|
||||
|
|
@ -282,7 +283,7 @@ int jsimd_encode_mcu_AC_refine_prepare_neon
|
|||
uint8_t coef_sign_bits[64];
|
||||
uint8_t coef_eq1_bits[64];
|
||||
|
||||
JCOEF *absvalues_ptr = absvalues;
|
||||
UJCOEF *absvalues_ptr = absvalues;
|
||||
uint8_t *coef_sign_bits_ptr = coef_sign_bits;
|
||||
uint8_t *eq1_bits_ptr = coef_eq1_bits;
|
||||
|
||||
|
|
@ -316,18 +317,18 @@ int jsimd_encode_mcu_AC_refine_prepare_neon
|
|||
vst1_u8(coef_sign_bits_ptr + DCTSIZE, sign_coefs2);
|
||||
|
||||
/* Compute absolute value of coefficients and apply point transform Al. */
|
||||
int16x8_t abs_coefs1 = vabsq_s16(coefs1);
|
||||
int16x8_t abs_coefs2 = vabsq_s16(coefs2);
|
||||
coefs1 = vshlq_s16(abs_coefs1, vdupq_n_s16(-Al));
|
||||
coefs2 = vshlq_s16(abs_coefs2, vdupq_n_s16(-Al));
|
||||
vst1q_s16(absvalues_ptr, coefs1);
|
||||
vst1q_s16(absvalues_ptr + DCTSIZE, coefs2);
|
||||
uint16x8_t abs_coefs1 = vreinterpretq_u16_s16(vabsq_s16(coefs1));
|
||||
uint16x8_t abs_coefs2 = vreinterpretq_u16_s16(vabsq_s16(coefs2));
|
||||
abs_coefs1 = vshlq_u16(abs_coefs1, vdupq_n_s16(-Al));
|
||||
abs_coefs2 = vshlq_u16(abs_coefs2, vdupq_n_s16(-Al));
|
||||
vst1q_u16(absvalues_ptr, abs_coefs1);
|
||||
vst1q_u16(absvalues_ptr + DCTSIZE, abs_coefs2);
|
||||
|
||||
/* Test whether transformed coefficient values == 1 (used to find EOB
|
||||
* position.)
|
||||
*/
|
||||
uint8x8_t coefs_eq11 = vmovn_u16(vceqq_s16(coefs1, vdupq_n_s16(1)));
|
||||
uint8x8_t coefs_eq12 = vmovn_u16(vceqq_s16(coefs2, vdupq_n_s16(1)));
|
||||
uint8x8_t coefs_eq11 = vmovn_u16(vceqq_u16(abs_coefs1, vdupq_n_u16(1)));
|
||||
uint8x8_t coefs_eq12 = vmovn_u16(vceqq_u16(abs_coefs2, vdupq_n_u16(1)));
|
||||
vst1_u8(eq1_bits_ptr, coefs_eq11);
|
||||
vst1_u8(eq1_bits_ptr + DCTSIZE, coefs_eq12);
|
||||
|
||||
|
|
@ -385,18 +386,18 @@ int jsimd_encode_mcu_AC_refine_prepare_neon
|
|||
vst1_u8(coef_sign_bits_ptr + DCTSIZE, sign_coefs2);
|
||||
|
||||
/* Compute absolute value of coefficients and apply point transform Al. */
|
||||
int16x8_t abs_coefs1 = vabsq_s16(coefs1);
|
||||
int16x8_t abs_coefs2 = vabsq_s16(coefs2);
|
||||
coefs1 = vshlq_s16(abs_coefs1, vdupq_n_s16(-Al));
|
||||
coefs2 = vshlq_s16(abs_coefs2, vdupq_n_s16(-Al));
|
||||
vst1q_s16(absvalues_ptr, coefs1);
|
||||
vst1q_s16(absvalues_ptr + DCTSIZE, coefs2);
|
||||
uint16x8_t abs_coefs1 = vreinterpretq_u16_s16(vabsq_s16(coefs1));
|
||||
uint16x8_t abs_coefs2 = vreinterpretq_u16_s16(vabsq_s16(coefs2));
|
||||
abs_coefs1 = vshlq_u16(abs_coefs1, vdupq_n_s16(-Al));
|
||||
abs_coefs2 = vshlq_u16(abs_coefs2, vdupq_n_s16(-Al));
|
||||
vst1q_u16(absvalues_ptr, abs_coefs1);
|
||||
vst1q_u16(absvalues_ptr + DCTSIZE, abs_coefs2);
|
||||
|
||||
/* Test whether transformed coefficient values == 1 (used to find EOB
|
||||
* position.)
|
||||
*/
|
||||
uint8x8_t coefs_eq11 = vmovn_u16(vceqq_s16(coefs1, vdupq_n_s16(1)));
|
||||
uint8x8_t coefs_eq12 = vmovn_u16(vceqq_s16(coefs2, vdupq_n_s16(1)));
|
||||
uint8x8_t coefs_eq11 = vmovn_u16(vceqq_u16(abs_coefs1, vdupq_n_u16(1)));
|
||||
uint8x8_t coefs_eq12 = vmovn_u16(vceqq_u16(abs_coefs2, vdupq_n_u16(1)));
|
||||
vst1_u8(eq1_bits_ptr, coefs_eq11);
|
||||
vst1_u8(eq1_bits_ptr + DCTSIZE, coefs_eq12);
|
||||
|
||||
|
|
@ -444,14 +445,14 @@ int jsimd_encode_mcu_AC_refine_prepare_neon
|
|||
vst1_u8(coef_sign_bits_ptr, sign_coefs);
|
||||
|
||||
/* Compute absolute value of coefficients and apply point transform Al. */
|
||||
int16x8_t abs_coefs = vabsq_s16(coefs);
|
||||
coefs = vshlq_s16(abs_coefs, vdupq_n_s16(-Al));
|
||||
vst1q_s16(absvalues_ptr, coefs);
|
||||
uint16x8_t abs_coefs = vreinterpretq_u16_s16(vabsq_s16(coefs));
|
||||
abs_coefs = vshlq_u16(abs_coefs, vdupq_n_s16(-Al));
|
||||
vst1q_u16(absvalues_ptr, abs_coefs);
|
||||
|
||||
/* Test whether transformed coefficient values == 1 (used to find EOB
|
||||
* position.)
|
||||
*/
|
||||
uint8x8_t coefs_eq1 = vmovn_u16(vceqq_s16(coefs, vdupq_n_s16(1)));
|
||||
uint8x8_t coefs_eq1 = vmovn_u16(vceqq_u16(abs_coefs, vdupq_n_u16(1)));
|
||||
vst1_u8(eq1_bits_ptr, coefs_eq1);
|
||||
|
||||
absvalues_ptr += 8;
|
||||
|
|
@ -462,7 +463,7 @@ int jsimd_encode_mcu_AC_refine_prepare_neon
|
|||
|
||||
/* Zero remaining memory in blocks. */
|
||||
for (i = 0; i < rows_to_zero; i++) {
|
||||
vst1q_s16(absvalues_ptr, vdupq_n_s16(0));
|
||||
vst1q_u16(absvalues_ptr, vdupq_n_u16(0));
|
||||
vst1_u8(coef_sign_bits_ptr, vdup_n_u8(0));
|
||||
vst1_u8(eq1_bits_ptr, vdup_n_u8(0));
|
||||
absvalues_ptr += 8;
|
||||
|
|
@ -471,23 +472,23 @@ int jsimd_encode_mcu_AC_refine_prepare_neon
|
|||
}
|
||||
|
||||
/* Construct zerobits bitmap. */
|
||||
int16x8_t abs_row0 = vld1q_s16(absvalues + 0 * DCTSIZE);
|
||||
int16x8_t abs_row1 = vld1q_s16(absvalues + 1 * DCTSIZE);
|
||||
int16x8_t abs_row2 = vld1q_s16(absvalues + 2 * DCTSIZE);
|
||||
int16x8_t abs_row3 = vld1q_s16(absvalues + 3 * DCTSIZE);
|
||||
int16x8_t abs_row4 = vld1q_s16(absvalues + 4 * DCTSIZE);
|
||||
int16x8_t abs_row5 = vld1q_s16(absvalues + 5 * DCTSIZE);
|
||||
int16x8_t abs_row6 = vld1q_s16(absvalues + 6 * DCTSIZE);
|
||||
int16x8_t abs_row7 = vld1q_s16(absvalues + 7 * DCTSIZE);
|
||||
uint16x8_t abs_row0 = vld1q_u16(absvalues + 0 * DCTSIZE);
|
||||
uint16x8_t abs_row1 = vld1q_u16(absvalues + 1 * DCTSIZE);
|
||||
uint16x8_t abs_row2 = vld1q_u16(absvalues + 2 * DCTSIZE);
|
||||
uint16x8_t abs_row3 = vld1q_u16(absvalues + 3 * DCTSIZE);
|
||||
uint16x8_t abs_row4 = vld1q_u16(absvalues + 4 * DCTSIZE);
|
||||
uint16x8_t abs_row5 = vld1q_u16(absvalues + 5 * DCTSIZE);
|
||||
uint16x8_t abs_row6 = vld1q_u16(absvalues + 6 * DCTSIZE);
|
||||
uint16x8_t abs_row7 = vld1q_u16(absvalues + 7 * DCTSIZE);
|
||||
|
||||
uint8x8_t abs_row0_eq0 = vmovn_u16(vceqq_s16(abs_row0, vdupq_n_s16(0)));
|
||||
uint8x8_t abs_row1_eq0 = vmovn_u16(vceqq_s16(abs_row1, vdupq_n_s16(0)));
|
||||
uint8x8_t abs_row2_eq0 = vmovn_u16(vceqq_s16(abs_row2, vdupq_n_s16(0)));
|
||||
uint8x8_t abs_row3_eq0 = vmovn_u16(vceqq_s16(abs_row3, vdupq_n_s16(0)));
|
||||
uint8x8_t abs_row4_eq0 = vmovn_u16(vceqq_s16(abs_row4, vdupq_n_s16(0)));
|
||||
uint8x8_t abs_row5_eq0 = vmovn_u16(vceqq_s16(abs_row5, vdupq_n_s16(0)));
|
||||
uint8x8_t abs_row6_eq0 = vmovn_u16(vceqq_s16(abs_row6, vdupq_n_s16(0)));
|
||||
uint8x8_t abs_row7_eq0 = vmovn_u16(vceqq_s16(abs_row7, vdupq_n_s16(0)));
|
||||
uint8x8_t abs_row0_eq0 = vmovn_u16(vceqq_u16(abs_row0, vdupq_n_u16(0)));
|
||||
uint8x8_t abs_row1_eq0 = vmovn_u16(vceqq_u16(abs_row1, vdupq_n_u16(0)));
|
||||
uint8x8_t abs_row2_eq0 = vmovn_u16(vceqq_u16(abs_row2, vdupq_n_u16(0)));
|
||||
uint8x8_t abs_row3_eq0 = vmovn_u16(vceqq_u16(abs_row3, vdupq_n_u16(0)));
|
||||
uint8x8_t abs_row4_eq0 = vmovn_u16(vceqq_u16(abs_row4, vdupq_n_u16(0)));
|
||||
uint8x8_t abs_row5_eq0 = vmovn_u16(vceqq_u16(abs_row5, vdupq_n_u16(0)));
|
||||
uint8x8_t abs_row6_eq0 = vmovn_u16(vceqq_u16(abs_row6, vdupq_n_u16(0)));
|
||||
uint8x8_t abs_row7_eq0 = vmovn_u16(vceqq_u16(abs_row7, vdupq_n_u16(0)));
|
||||
|
||||
/* { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 } */
|
||||
const uint8x8_t bitmap_mask =
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
*/
|
||||
|
||||
#define JPEG_INTERNALS
|
||||
#include "jconfigint.h"
|
||||
#include "../../jinclude.h"
|
||||
#include "../../jpeglib.h"
|
||||
#include "../../jsimd.h"
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
*/
|
||||
|
||||
#define JPEG_INTERNALS
|
||||
#include "jconfigint.h"
|
||||
#include "../../jinclude.h"
|
||||
#include "../../jpeglib.h"
|
||||
#include "../../jsimd.h"
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@
|
|||
*/
|
||||
|
||||
#define JPEG_INTERNALS
|
||||
#include "jconfigint.h"
|
||||
#include "../../jinclude.h"
|
||||
#include "../../jpeglib.h"
|
||||
#include "../../jsimd.h"
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jcolsamp.inc"
|
||||
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jcolsamp.inc"
|
||||
|
||||
|
|
|
|||
|
|
@ -7,11 +7,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jcolsamp.inc"
|
||||
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jsimdext.inc"
|
||||
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jsimdext.inc"
|
||||
|
||||
|
|
|
|||
|
|
@ -7,11 +7,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jsimdext.inc"
|
||||
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jsimdext.inc"
|
||||
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jsimdext.inc"
|
||||
|
||||
|
|
|
|||
|
|
@ -7,11 +7,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jsimdext.inc"
|
||||
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jcolsamp.inc"
|
||||
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jcolsamp.inc"
|
||||
|
||||
|
|
|
|||
|
|
@ -7,11 +7,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jcolsamp.inc"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
;
|
||||
; jchuff-sse2.asm - Huffman entropy encoding (SSE2)
|
||||
;
|
||||
; Copyright (C) 2009-2011, 2014-2017, 2019, D. R. Commander.
|
||||
; Copyright (C) 2009-2011, 2014-2017, 2019, 2024, D. R. Commander.
|
||||
; Copyright (C) 2015, Matthieu Darbois.
|
||||
; Copyright (C) 2018, Matthias Räncker.
|
||||
;
|
||||
|
|
@ -9,11 +9,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
;
|
||||
; This file contains an SSE2 implementation for Huffman coding of one block.
|
||||
; The following code is based on jchuff.c; see jchuff.c for more details.
|
||||
|
|
@ -65,7 +61,8 @@ times 1 << 2 db 3
|
|||
times 1 << 1 db 2
|
||||
times 1 << 0 db 1
|
||||
times 1 db 0
|
||||
jpeg_nbits_table:
|
||||
GLOBAL_DATA(jpeg_nbits_table)
|
||||
EXTN(jpeg_nbits_table):
|
||||
times 1 db 0
|
||||
times 1 << 0 db 1
|
||||
times 1 << 1 db 2
|
||||
|
|
@ -88,9 +85,9 @@ times 1 << 14 db 15
|
|||
%ifdef PIC
|
||||
%define NBITS(x) nbits_base + x
|
||||
%else
|
||||
%define NBITS(x) jpeg_nbits_table + x
|
||||
%define NBITS(x) EXTN(jpeg_nbits_table) + x
|
||||
%endif
|
||||
%define MASK_BITS(x) NBITS((x) * 8) + (jpeg_mask_bits - jpeg_nbits_table)
|
||||
%define MASK_BITS(x) NBITS((x) * 8) + (jpeg_mask_bits - EXTN(jpeg_nbits_table))
|
||||
|
||||
; --------------------------------------------------------------------------
|
||||
SECTION SEG_TEXT
|
||||
|
|
@ -469,7 +466,7 @@ EXTN(jsimd_huff_encode_one_block_sse2):
|
|||
pcmpeqw mm_all_0xff, mm_all_0xff ;Z: all_0xff[i] = 0xFF;
|
||||
%endmacro
|
||||
|
||||
GET_SYM nbits_base, jpeg_nbits_table, GET_SYM_BEFORE, GET_SYM_AFTER
|
||||
GET_SYM nbits_base, EXTN(jpeg_nbits_table), GET_SYM_BEFORE, GET_SYM_AFTER
|
||||
|
||||
psrldq xmm4, 1 * SIZEOF_WORD ;G: w4 = 37 44 45 38 39 46 47 --
|
||||
shufpd xmm1, xmm5, 10b ;F: w1 = 36 37 44 45 50 51 58 59
|
||||
|
|
|
|||
|
|
@ -7,11 +7,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
;
|
||||
; This file contains an SSE2 implementation of data preparation for progressive
|
||||
; Huffman encoding. See jcphuff.c for more details.
|
||||
|
|
|
|||
|
|
@ -9,11 +9,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jsimdext.inc"
|
||||
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jsimdext.inc"
|
||||
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jsimdext.inc"
|
||||
|
||||
|
|
|
|||
|
|
@ -9,11 +9,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jcolsamp.inc"
|
||||
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jcolsamp.inc"
|
||||
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jcolsamp.inc"
|
||||
|
||||
|
|
|
|||
|
|
@ -9,11 +9,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jsimdext.inc"
|
||||
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jsimdext.inc"
|
||||
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jsimdext.inc"
|
||||
|
||||
|
|
|
|||
|
|
@ -9,11 +9,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jsimdext.inc"
|
||||
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jsimdext.inc"
|
||||
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jsimdext.inc"
|
||||
|
||||
|
|
|
|||
|
|
@ -9,11 +9,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jcolsamp.inc"
|
||||
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jcolsamp.inc"
|
||||
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jcolsamp.inc"
|
||||
|
||||
|
|
|
|||
|
|
@ -9,11 +9,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jsimdext.inc"
|
||||
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jsimdext.inc"
|
||||
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jsimdext.inc"
|
||||
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
;
|
||||
; This file contains a floating-point implementation of the forward DCT
|
||||
; (Discrete Cosine Transform). The following code is based directly on
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
;
|
||||
; This file contains a floating-point implementation of the forward DCT
|
||||
; (Discrete Cosine Transform). The following code is based directly on
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
;
|
||||
; This file contains a fast, not so accurate integer implementation of
|
||||
; the forward DCT (Discrete Cosine Transform). The following code is
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
;
|
||||
; This file contains a fast, not so accurate integer implementation of
|
||||
; the forward DCT (Discrete Cosine Transform). The following code is
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
;
|
||||
; This file contains a slower but more accurate integer implementation of the
|
||||
; forward DCT (Discrete Cosine Transform). The following code is based
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
;
|
||||
; This file contains a slower but more accurate integer implementation of the
|
||||
; forward DCT (Discrete Cosine Transform). The following code is based
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
;
|
||||
; This file contains a slower but more accurate integer implementation of the
|
||||
; forward DCT (Discrete Cosine Transform). The following code is based
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
;
|
||||
; This file contains a floating-point implementation of the inverse DCT
|
||||
; (Discrete Cosine Transform). The following code is based directly on
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
;
|
||||
; This file contains a floating-point implementation of the inverse DCT
|
||||
; (Discrete Cosine Transform). The following code is based directly on
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
;
|
||||
; This file contains a floating-point implementation of the inverse DCT
|
||||
; (Discrete Cosine Transform). The following code is based directly on
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
;
|
||||
; This file contains a fast, not so accurate integer implementation of
|
||||
; the inverse DCT (Discrete Cosine Transform). The following code is
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
;
|
||||
; This file contains a fast, not so accurate integer implementation of
|
||||
; the inverse DCT (Discrete Cosine Transform). The following code is
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
;
|
||||
; This file contains a slower but more accurate integer implementation of the
|
||||
; inverse DCT (Discrete Cosine Transform). The following code is based
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
;
|
||||
; This file contains a slower but more accurate integer implementation of the
|
||||
; inverse DCT (Discrete Cosine Transform). The following code is based
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
;
|
||||
; This file contains a slower but more accurate integer implementation of the
|
||||
; inverse DCT (Discrete Cosine Transform). The following code is based
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
;
|
||||
; This file contains inverse-DCT routines that produce reduced-size
|
||||
; output: either 4x4 or 2x2 pixels from an 8x8 DCT block.
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
;
|
||||
; This file contains inverse-DCT routines that produce reduced-size
|
||||
; output: either 4x4 or 2x2 pixels from an 8x8 DCT block.
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jsimdext.inc"
|
||||
%include "jdct.inc"
|
||||
|
|
|
|||
|
|
@ -2,17 +2,13 @@
|
|||
; jquant.asm - sample data conversion and quantization (MMX)
|
||||
;
|
||||
; Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
; Copyright (C) 2016, D. R. Commander.
|
||||
; Copyright (C) 2016, 2024, D. R. Commander.
|
||||
;
|
||||
; Based on the x86 SIMD extension for IJG JPEG library
|
||||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jsimdext.inc"
|
||||
%include "jdct.inc"
|
||||
|
|
@ -120,8 +116,8 @@ EXTN(jsimd_convsamp_mmx):
|
|||
; Quantize/descale the coefficients, and store into coef_block
|
||||
;
|
||||
; This implementation is based on an algorithm described in
|
||||
; "How to optimize for the Pentium family of microprocessors"
|
||||
; (http://www.agner.org/assem/).
|
||||
; "Optimizing subroutines in assembly language:
|
||||
; An optimization guide for x86 platforms" (https://agner.org/optimize).
|
||||
;
|
||||
; GLOBAL(void)
|
||||
; jsimd_quantize_mmx(JCOEFPTR coef_block, DCTELEM *divisors,
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jsimdext.inc"
|
||||
%include "jdct.inc"
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jsimdext.inc"
|
||||
%include "jdct.inc"
|
||||
|
|
|
|||
|
|
@ -2,18 +2,14 @@
|
|||
; jquanti.asm - sample data conversion and quantization (AVX2)
|
||||
;
|
||||
; Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
; Copyright (C) 2016, 2018, D. R. Commander.
|
||||
; Copyright (C) 2016, 2018, 2024, D. R. Commander.
|
||||
; Copyright (C) 2016, Matthieu Darbois.
|
||||
;
|
||||
; Based on the x86 SIMD extension for IJG JPEG library
|
||||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jsimdext.inc"
|
||||
%include "jdct.inc"
|
||||
|
|
@ -107,8 +103,8 @@ EXTN(jsimd_convsamp_avx2):
|
|||
; Quantize/descale the coefficients, and store into coef_block
|
||||
;
|
||||
; This implementation is based on an algorithm described in
|
||||
; "How to optimize for the Pentium family of microprocessors"
|
||||
; (http://www.agner.org/assem/).
|
||||
; "Optimizing subroutines in assembly language:
|
||||
; An optimization guide for x86 platforms" (https://agner.org/optimize).
|
||||
;
|
||||
; GLOBAL(void)
|
||||
; jsimd_quantize_avx2(JCOEFPTR coef_block, DCTELEM *divisors,
|
||||
|
|
|
|||
|
|
@ -2,17 +2,13 @@
|
|||
; jquanti.asm - sample data conversion and quantization (SSE2)
|
||||
;
|
||||
; Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
; Copyright (C) 2016, D. R. Commander.
|
||||
; Copyright (C) 2016, 2024, D. R. Commander.
|
||||
;
|
||||
; Based on the x86 SIMD extension for IJG JPEG library
|
||||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jsimdext.inc"
|
||||
%include "jdct.inc"
|
||||
|
|
@ -98,8 +94,8 @@ EXTN(jsimd_convsamp_sse2):
|
|||
; Quantize/descale the coefficients, and store into coef_block
|
||||
;
|
||||
; This implementation is based on an algorithm described in
|
||||
; "How to optimize for the Pentium family of microprocessors"
|
||||
; (http://www.agner.org/assem/).
|
||||
; "Optimizing subroutines in assembly language:
|
||||
; An optimization guide for x86 platforms" (https://agner.org/optimize).
|
||||
;
|
||||
; GLOBAL(void)
|
||||
; jsimd_quantize_sse2(JCOEFPTR coef_block, DCTELEM *divisors,
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
* jsimd_i386.c
|
||||
*
|
||||
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
* Copyright (C) 2009-2011, 2013-2014, 2016, 2018, 2022, D. R. Commander.
|
||||
* Copyright (C) 2015-2016, 2018, Matthieu Darbois.
|
||||
* Copyright (C) 2009-2011, 2013-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)
|
||||
|
|
@ -161,6 +158,9 @@ jsimd_rgb_ycc_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
|
|||
void (*sse2fct) (JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
|
||||
void (*mmxfct) (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;
|
||||
|
|
@ -220,6 +220,9 @@ jsimd_rgb_gray_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
|
|||
void (*sse2fct) (JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
|
||||
void (*mmxfct) (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;
|
||||
|
|
@ -279,6 +282,9 @@ jsimd_ycc_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
|||
void (*sse2fct) (JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
|
||||
void (*mmxfct) (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;
|
||||
|
|
@ -382,6 +388,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,
|
||||
|
|
@ -402,6 +411,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,
|
||||
|
|
@ -464,6 +476,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);
|
||||
|
|
@ -479,6 +494,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);
|
||||
|
|
@ -540,6 +558,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,
|
||||
|
|
@ -558,6 +579,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,
|
||||
|
|
@ -626,6 +650,9 @@ jsimd_h2v2_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
|||
void (*sse2fct) (JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY);
|
||||
void (*mmxfct) (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;
|
||||
|
|
@ -684,6 +711,9 @@ jsimd_h2v1_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
|||
void (*sse2fct) (JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY);
|
||||
void (*mmxfct) (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;
|
||||
|
|
@ -788,6 +818,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 if (simd_support & JSIMD_SSE2)
|
||||
|
|
@ -800,6 +833,9 @@ GLOBAL(void)
|
|||
jsimd_convsamp_float(JSAMPARRAY sample_data, JDIMENSION start_col,
|
||||
FAST_FLOAT *workspace)
|
||||
{
|
||||
if (simd_support == ~0U)
|
||||
init_simd();
|
||||
|
||||
if (simd_support & JSIMD_SSE2)
|
||||
jsimd_convsamp_float_sse2(sample_data, start_col, workspace);
|
||||
else if (simd_support & JSIMD_SSE)
|
||||
|
|
@ -870,6 +906,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 if (simd_support & JSIMD_SSE2)
|
||||
|
|
@ -881,6 +920,9 @@ jsimd_fdct_islow(DCTELEM *data)
|
|||
GLOBAL(void)
|
||||
jsimd_fdct_ifast(DCTELEM *data)
|
||||
{
|
||||
if (simd_support == ~0U)
|
||||
init_simd();
|
||||
|
||||
if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fdct_islow_sse2))
|
||||
jsimd_fdct_ifast_sse2(data);
|
||||
else
|
||||
|
|
@ -890,6 +932,9 @@ jsimd_fdct_ifast(DCTELEM *data)
|
|||
GLOBAL(void)
|
||||
jsimd_fdct_float(FAST_FLOAT *data)
|
||||
{
|
||||
if (simd_support == ~0U)
|
||||
init_simd();
|
||||
|
||||
if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_fdct_float_sse))
|
||||
jsimd_fdct_float_sse(data);
|
||||
else if (simd_support & JSIMD_3DNOW)
|
||||
|
|
@ -945,6 +990,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 if (simd_support & JSIMD_SSE2)
|
||||
|
|
@ -957,6 +1005,9 @@ GLOBAL(void)
|
|||
jsimd_quantize_float(JCOEFPTR coef_block, FAST_FLOAT *divisors,
|
||||
FAST_FLOAT *workspace)
|
||||
{
|
||||
if (simd_support == ~0U)
|
||||
init_simd();
|
||||
|
||||
if (simd_support & JSIMD_SSE2)
|
||||
jsimd_quantize_float_sse2(coef_block, divisors, workspace);
|
||||
else if (simd_support & JSIMD_SSE)
|
||||
|
|
@ -1020,6 +1071,9 @@ jsimd_idct_2x2(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_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2))
|
||||
jsimd_idct_2x2_sse2(compptr->dct_table, coef_block, output_buf,
|
||||
output_col);
|
||||
|
|
@ -1032,6 +1086,9 @@ jsimd_idct_4x4(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_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2))
|
||||
jsimd_idct_4x4_sse2(compptr->dct_table, coef_block, output_buf,
|
||||
output_col);
|
||||
|
|
@ -1126,6 +1183,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);
|
||||
|
|
@ -1142,6 +1202,9 @@ jsimd_idct_ifast(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_SSE2) && IS_ALIGNED_SSE(jconst_idct_ifast_sse2))
|
||||
jsimd_idct_ifast_sse2(compptr->dct_table, coef_block, output_buf,
|
||||
output_col);
|
||||
|
|
@ -1155,6 +1218,9 @@ jsimd_idct_float(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_SSE2) && IS_ALIGNED_SSE(jconst_idct_float_sse2))
|
||||
jsimd_idct_float_sse2(compptr->dct_table, coef_block, output_buf,
|
||||
output_col);
|
||||
|
|
@ -1212,7 +1278,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);
|
||||
|
|
@ -1238,7 +1304,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,
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
||||
;
|
||||
; This file should be assembled with NASM (Netwide Assembler),
|
||||
; can *not* be assembled with Microsoft's MASM or any compatible
|
||||
; assembler (including Borland's Turbo Assembler).
|
||||
; NASM is available from http://nasm.sourceforge.net/ or
|
||||
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
||||
; This file should be assembled with NASM (Netwide Assembler) or Yasm.
|
||||
|
||||
%include "jsimdext.inc"
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
* simd/jsimd.h
|
||||
*
|
||||
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
* Copyright (C) 2011, 2014-2016, 2018, 2020, D. R. Commander.
|
||||
* Copyright (C) 2011, 2014-2016, 2018, 2020, 2022, D. R. Commander.
|
||||
* Copyright (C) 2013-2014, MIPS Technologies, Inc., California.
|
||||
* Copyright (C) 2014, Linaro Limited.
|
||||
* Copyright (C) 2015-2016, 2018, Matthieu Darbois.
|
||||
* Copyright (C) 2015-2016, 2018, 2022, Matthieu Darbois.
|
||||
* Copyright (C) 2016-2018, Loongson Technology Corporation Limited, BeiJing.
|
||||
* Copyright (C) 2020, Arm Limited.
|
||||
*
|
||||
|
|
@ -1243,16 +1243,16 @@ EXTERN(JOCTET *) jsimd_huff_encode_one_block_neon_slowtbl
|
|||
/* Progressive Huffman encoding */
|
||||
EXTERN(void) jsimd_encode_mcu_AC_first_prepare_sse2
|
||||
(const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al,
|
||||
JCOEF *values, size_t *zerobits);
|
||||
UJCOEF *values, size_t *zerobits);
|
||||
|
||||
EXTERN(void) jsimd_encode_mcu_AC_first_prepare_neon
|
||||
(const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al,
|
||||
JCOEF *values, size_t *zerobits);
|
||||
UJCOEF *values, size_t *zerobits);
|
||||
|
||||
EXTERN(int) jsimd_encode_mcu_AC_refine_prepare_sse2
|
||||
(const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al,
|
||||
JCOEF *absvalues, size_t *bits);
|
||||
UJCOEF *absvalues, size_t *bits);
|
||||
|
||||
EXTERN(int) jsimd_encode_mcu_AC_refine_prepare_neon
|
||||
(const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al,
|
||||
JCOEF *absvalues, size_t *bits);
|
||||
UJCOEF *absvalues, size_t *bits);
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue