summaryrefslogtreecommitdiff
path: root/wrbmp.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 /wrbmp.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 'wrbmp.c')
-rw-r--r--wrbmp.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/wrbmp.c b/wrbmp.c
index 239f64e..408a722 100644
--- a/wrbmp.c
+++ b/wrbmp.c
@@ -141,7 +141,6 @@ put_pixel_rows(j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
}
} else if (cinfo->out_color_space == JCS_CMYK) {
for (col = cinfo->output_width; col > 0; col--) {
- /* can omit GETJSAMPLE() safely */
JSAMPLE c = *inptr++, m = *inptr++, y = *inptr++, k = *inptr++;
cmyk_to_rgb(c, m, y, k, outptr + 2, outptr + 1, outptr);
outptr += 3;
@@ -153,7 +152,6 @@ put_pixel_rows(j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
register int ps = rgb_pixelsize[cinfo->out_color_space];
for (col = cinfo->output_width; col > 0; col--) {
- /* can omit GETJSAMPLE() safely */
outptr[0] = inptr[bindex];
outptr[1] = inptr[gindex];
outptr[2] = inptr[rindex];
@@ -372,18 +370,18 @@ write_colormap(j_decompress_ptr cinfo, bmp_dest_ptr dest, int map_colors,
if (cinfo->out_color_components == 3) {
/* Normal case with RGB colormap */
for (i = 0; i < num_colors; i++) {
- putc(GETJSAMPLE(colormap[2][i]), outfile);
- putc(GETJSAMPLE(colormap[1][i]), outfile);
- putc(GETJSAMPLE(colormap[0][i]), outfile);
+ putc(colormap[2][i], outfile);
+ putc(colormap[1][i], outfile);
+ putc(colormap[0][i], outfile);
if (map_entry_size == 4)
putc(0, outfile);
}
} else {
/* Grayscale colormap (only happens with grayscale quantization) */
for (i = 0; i < num_colors; i++) {
- putc(GETJSAMPLE(colormap[0][i]), outfile);
- putc(GETJSAMPLE(colormap[0][i]), outfile);
- putc(GETJSAMPLE(colormap[0][i]), outfile);
+ putc(colormap[0][i], outfile);
+ putc(colormap[0][i], outfile);
+ putc(colormap[0][i], outfile);
if (map_entry_size == 4)
putc(0, outfile);
}
@@ -438,7 +436,6 @@ finish_output_bmp(j_decompress_ptr cinfo, djpeg_dest_ptr dinfo)
JSAMPARRAY image_ptr;
register JSAMPROW data_ptr;
JDIMENSION row;
- register JDIMENSION col;
cd_progress_ptr progress = (cd_progress_ptr)cinfo->progress;
if (dest->use_inversion_array) {
@@ -459,10 +456,7 @@ finish_output_bmp(j_decompress_ptr cinfo, djpeg_dest_ptr dinfo)
((j_common_ptr)cinfo, dest->whole_image, row - 1, (JDIMENSION)1,
FALSE);
data_ptr = image_ptr[0];
- for (col = dest->row_width; col > 0; col--) {
- putc(GETJSAMPLE(*data_ptr), outfile);
- data_ptr++;
- }
+ (void)JFWRITE(outfile, data_ptr, dest->row_width);
}
if (progress != NULL)
progress->completed_extra_passes++;