diff options
author | Jonathan Wright <jonathan.wright@arm.com> | 2020-11-25 13:36:43 +0000 |
---|---|---|
committer | Jonathan Wright <jonathan.wright@arm.com> | 2020-11-30 12:08:32 +0000 |
commit | bbb828223e9c8f83f0e84db1e98b116029e62765 (patch) | |
tree | d2467975e2bf1442216d2c779054102ee37f599c /turbojpeg.c | |
parent | d5148db386ceb4a608058320071cbed890bd6ad2 (diff) |
Update libjpeg-turbo to v2.0.90 (2.1 beta1)
Update Chromium's copy of libjpeg-turbo to the latest upstream
release (v2.0.90) and re-apply our local changes documented in
README.chromium.
Cherry-pick two additional changes from upstream to fix bugs found
by fuzzers:
1) https://github.com/libjpeg-turbo/libjpeg-turbo/commit/ccaba5d7894ecfb5a8f11e48d3f86e1f14d5a469
2) https://github.com/libjpeg-turbo/libjpeg-turbo/commit/c7ca521bc85b57d41d3ad4963c13fc0100481084
Significant changes provided by this update:
1) A large performance boost to JPEG encoding due to an improved
Huffman encoding implementation.
2) The complete removal of Arm Neon assembly code. This allows Arm's
control-flow integrity security features (Armv8.3-A Pointer
Authentication and Armv8.5-A Branch Target Identification) to be
switched on with the appropriate compiler flags.
Bug: 922430
Bug: b/135180511
Bug: 919548, 1145581
Change-Id: I319fcdc55b3fd5b219425c07a4e4a03587f4e06d
Diffstat (limited to 'turbojpeg.c')
-rw-r--r-- | turbojpeg.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/turbojpeg.c b/turbojpeg.c index e63d113..8260555 100644 --- a/turbojpeg.c +++ b/turbojpeg.c @@ -234,10 +234,10 @@ static int getPixelFormat(int pixelSize, int flags) return -1; } -static int setCompDefaults(struct jpeg_compress_struct *cinfo, int pixelFormat, - int subsamp, int jpegQual, int flags) +static void setCompDefaults(struct jpeg_compress_struct *cinfo, + int pixelFormat, int subsamp, int jpegQual, + int flags) { - int retval = 0; #ifndef NO_GETENV char *env = NULL; #endif @@ -300,8 +300,6 @@ static int setCompDefaults(struct jpeg_compress_struct *cinfo, int pixelFormat, cinfo->comp_info[2].v_samp_factor = 1; if (cinfo->num_components > 3) cinfo->comp_info[3].v_samp_factor = tjMCUHeight[subsamp] / 8; - - return retval; } @@ -676,8 +674,7 @@ DLLEXPORT int tjCompress2(tjhandle handle, const unsigned char *srcBuf, alloc = 0; *jpegSize = tjBufSize(width, height, jpegSubsamp); } jpeg_mem_dest_tj(cinfo, jpegBuf, jpegSize, alloc); - if (setCompDefaults(cinfo, pixelFormat, jpegSubsamp, jpegQual, flags) == -1) - return -1; + setCompDefaults(cinfo, pixelFormat, jpegSubsamp, jpegQual, flags); jpeg_start_compress(cinfo, TRUE); for (i = 0; i < height; i++) { @@ -772,7 +769,7 @@ DLLEXPORT int tjEncodeYUVPlanes(tjhandle handle, const unsigned char *srcBuf, else if (flags & TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1"); #endif - if (setCompDefaults(cinfo, pixelFormat, subsamp, -1, flags) == -1) return -1; + setCompDefaults(cinfo, pixelFormat, subsamp, -1, flags); /* Execute only the parts of jpeg_start_compress() that we need. If we were to call the whole jpeg_start_compress() function, then it would try @@ -986,8 +983,7 @@ DLLEXPORT int tjCompressFromYUVPlanes(tjhandle handle, alloc = 0; *jpegSize = tjBufSize(width, height, subsamp); } jpeg_mem_dest_tj(cinfo, jpegBuf, jpegSize, alloc); - if (setCompDefaults(cinfo, TJPF_RGB, subsamp, jpegQual, flags) == -1) - return -1; + setCompDefaults(cinfo, TJPF_RGB, subsamp, jpegQual, flags); cinfo->raw_data_in = TRUE; jpeg_start_compress(cinfo, TRUE); |