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 /cjpeg.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 'cjpeg.c')
-rw-r--r-- | cjpeg.c | 38 |
1 files changed, 19 insertions, 19 deletions
@@ -5,7 +5,7 @@ * Copyright (C) 1991-1998, Thomas G. Lane. * Modified 2003-2011 by Guido Vollbeding. * libjpeg-turbo Modifications: - * Copyright (C) 2010, 2013-2014, 2017, D. R. Commander. + * Copyright (C) 2010, 2013-2014, 2017, 2019-2020, D. R. Commander. * For conditions of distribution and use, see the accompanying README.ijg * file. * @@ -69,9 +69,9 @@ static const char * const cdjpeg_message_table[] = { * 2) assume we can push back more than one character (works in * some C implementations, but unportable); * 3) provide our own buffering (breaks input readers that want to use - * stdio directly, such as the RLE library); + * stdio directly); * or 4) don't put back the data, and modify the input_init methods to assume - * they start reading after the start of file (also breaks RLE library). + * they start reading after the start of file. * #1 is attractive for MS-DOS but is untenable on Unix. * * The most portable solution for file types that can't be identified by their @@ -117,10 +117,6 @@ select_file_type(j_compress_ptr cinfo, FILE *infile) case 'P': return jinit_read_ppm(cinfo); #endif -#ifdef RLE_SUPPORTED - case 'R': - return jinit_read_rle(cinfo); -#endif #ifdef TARGA_SUPPORTED case 0x00: return jinit_read_targa(cinfo); @@ -146,7 +142,8 @@ select_file_type(j_compress_ptr cinfo, FILE *infile) static const char *progname; /* program name for error messages */ static char *icc_filename; /* for -icc switch */ static char *outfilename; /* for -outfile switch */ -boolean memdst; /* for -memdst switch */ +static boolean memdst; /* for -memdst switch */ +static boolean report; /* for -report switch */ LOCAL(void) @@ -179,15 +176,15 @@ usage(void) fprintf(stderr, " -arithmetic Use arithmetic coding\n"); #endif #ifdef DCT_ISLOW_SUPPORTED - fprintf(stderr, " -dct int Use integer DCT method%s\n", + fprintf(stderr, " -dct int Use accurate integer DCT method%s\n", (JDCT_DEFAULT == JDCT_ISLOW ? " (default)" : "")); #endif #ifdef DCT_IFAST_SUPPORTED - fprintf(stderr, " -dct fast Use fast integer DCT (less accurate)%s\n", + fprintf(stderr, " -dct fast Use less accurate integer DCT method [legacy feature]%s\n", (JDCT_DEFAULT == JDCT_IFAST ? " (default)" : "")); #endif #ifdef DCT_FLOAT_SUPPORTED - fprintf(stderr, " -dct float Use floating-point DCT method%s\n", + fprintf(stderr, " -dct float Use floating-point DCT method [legacy feature]%s\n", (JDCT_DEFAULT == JDCT_FLOAT ? " (default)" : "")); #endif fprintf(stderr, " -icc FILE Embed ICC profile contained in FILE\n"); @@ -200,6 +197,7 @@ usage(void) #if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED) fprintf(stderr, " -memdst Compress to memory instead of file (useful for benchmarking)\n"); #endif + fprintf(stderr, " -report Report compression progress\n"); fprintf(stderr, " -verbose or -debug Emit debug output\n"); fprintf(stderr, " -version Print version information and exit\n"); fprintf(stderr, "Switches for wizards:\n"); @@ -244,6 +242,7 @@ parse_switches(j_compress_ptr cinfo, int argc, char **argv, icc_filename = NULL; outfilename = NULL; memdst = FALSE; + report = FALSE; cinfo->err->trace_level = 0; /* Scan command line options, adjust parameters */ @@ -395,6 +394,9 @@ parse_switches(j_compress_ptr cinfo, int argc, char **argv, qtablefile = argv[argn]; /* We postpone actually reading the file in case -quality comes later. */ + } else if (keymatch(arg, "report", 3)) { + report = TRUE; + } else if (keymatch(arg, "restart", 1)) { /* Restart interval in MCU rows (or in MCUs with 'b'). */ long lval; @@ -509,9 +511,7 @@ main(int argc, char **argv) { struct jpeg_compress_struct cinfo; struct jpeg_error_mgr jerr; -#ifdef PROGRESS_REPORT struct cdjpeg_progress_mgr progress; -#endif int file_index; cjpeg_source_ptr src_mgr; FILE *input_file; @@ -632,9 +632,10 @@ main(int argc, char **argv) fclose(icc_file); } -#ifdef PROGRESS_REPORT - start_progress_monitor((j_common_ptr)&cinfo, &progress); -#endif + if (report) { + start_progress_monitor((j_common_ptr)&cinfo, &progress); + progress.report = report; + } /* Figure out the input file format, and set up to read it. */ src_mgr = select_file_type(&cinfo, input_file); @@ -680,9 +681,8 @@ main(int argc, char **argv) if (output_file != stdout && output_file != NULL) fclose(output_file); -#ifdef PROGRESS_REPORT - end_progress_monitor((j_common_ptr)&cinfo); -#endif + if (report) + end_progress_monitor((j_common_ptr)&cinfo); if (memdst) { fprintf(stderr, "Compressed size: %lu bytes\n", outsize); |