summaryrefslogtreecommitdiff
path: root/wrtarga.c
diff options
context:
space:
mode:
authorJonathan Wright <jonathan.wright@arm.com>2020-11-25 13:36:43 +0000
committerJonathan Wright <jonathan.wright@arm.com>2020-11-30 12:08:32 +0000
commitbbb828223e9c8f83f0e84db1e98b116029e62765 (patch)
treed2467975e2bf1442216d2c779054102ee37f599c /wrtarga.c
parentd5148db386ceb4a608058320071cbed890bd6ad2 (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 'wrtarga.c')
-rw-r--r--wrtarga.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/wrtarga.c b/wrtarga.c
index 9dfa920..7a654ff 100644
--- a/wrtarga.c
+++ b/wrtarga.c
@@ -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) 2017, D. R. Commander.
+ * Copyright (C) 2017, 2019, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@@ -102,9 +102,9 @@ put_pixel_rows(j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
inptr = dest->pub.buffer[0];
outptr = dest->iobuffer;
for (col = cinfo->output_width; col > 0; col--) {
- outptr[0] = (char)GETJSAMPLE(inptr[2]); /* RGB to BGR order */
- outptr[1] = (char)GETJSAMPLE(inptr[1]);
- outptr[2] = (char)GETJSAMPLE(inptr[0]);
+ outptr[0] = inptr[2]; /* RGB to BGR order */
+ outptr[1] = inptr[1];
+ outptr[2] = inptr[0];
inptr += 3, outptr += 3;
}
(void)JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width);
@@ -118,13 +118,10 @@ put_gray_rows(j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
tga_dest_ptr dest = (tga_dest_ptr)dinfo;
register JSAMPROW inptr;
register char *outptr;
- register JDIMENSION col;
inptr = dest->pub.buffer[0];
outptr = dest->iobuffer;
- for (col = cinfo->output_width; col > 0; col--) {
- *outptr++ = (char)GETJSAMPLE(*inptr++);
- }
+ MEMCOPY(outptr, inptr, cinfo->output_width);
(void)JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width);
}
@@ -147,7 +144,7 @@ put_demapped_gray(j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
inptr = dest->pub.buffer[0];
outptr = dest->iobuffer;
for (col = cinfo->output_width; col > 0; col--) {
- *outptr++ = (char)GETJSAMPLE(color_map0[GETJSAMPLE(*inptr++)]);
+ *outptr++ = color_map0[*inptr++];
}
(void)JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width);
}
@@ -182,9 +179,9 @@ start_output_tga(j_decompress_ptr cinfo, djpeg_dest_ptr dinfo)
/* Write the colormap. Note Targa uses BGR byte order */
outfile = dest->pub.output_file;
for (i = 0; i < num_colors; i++) {
- putc(GETJSAMPLE(cinfo->colormap[2][i]), outfile);
- putc(GETJSAMPLE(cinfo->colormap[1][i]), outfile);
- putc(GETJSAMPLE(cinfo->colormap[0][i]), outfile);
+ putc(cinfo->colormap[2][i], outfile);
+ putc(cinfo->colormap[1][i], outfile);
+ putc(cinfo->colormap[0][i], outfile);
}
dest->pub.put_pixel_rows = put_gray_rows;
} else {