Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: jdtrans.c

Issue 1934113002: Update libjpeg_turbo to 1.4.90 from https://github.com/libjpeg-turbo/ (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * jdtrans.c 2 * jdtrans.c
3 * 3 *
4 * This file was part of the Independent JPEG Group's software:
4 * Copyright (C) 1995-1997, Thomas G. Lane. 5 * Copyright (C) 1995-1997, Thomas G. Lane.
5 * This file is part of the Independent JPEG Group's software. 6 * It was modified by The libjpeg-turbo Project to include only code relevant
6 * For conditions of distribution and use, see the accompanying README file. 7 * to libjpeg-turbo.
8 * For conditions of distribution and use, see the accompanying README.ijg
9 * file.
7 * 10 *
8 * This file contains library routines for transcoding decompression, 11 * This file contains library routines for transcoding decompression,
9 * that is, reading raw DCT coefficient arrays from an input JPEG file. 12 * that is, reading raw DCT coefficient arrays from an input JPEG file.
10 * The routines in jdapimin.c will also be needed by a transcoder. 13 * The routines in jdapimin.c will also be needed by a transcoder.
11 */ 14 */
12 15
13 #define JPEG_INTERNALS 16 #define JPEG_INTERNALS
14 #include "jinclude.h" 17 #include "jinclude.h"
15 #include "jpeglib.h" 18 #include "jpeglib.h"
16 19
17 20
18 /* Forward declarations */ 21 /* Forward declarations */
19 LOCAL(void) transdecode_master_selection JPP((j_decompress_ptr cinfo)); 22 LOCAL(void) transdecode_master_selection (j_decompress_ptr cinfo);
20 23
21 24
22 /* 25 /*
23 * Read the coefficient arrays from a JPEG file. 26 * Read the coefficient arrays from a JPEG file.
24 * jpeg_read_header must be completed before calling this. 27 * jpeg_read_header must be completed before calling this.
25 * 28 *
26 * The entire image is read into a set of virtual coefficient-block arrays, 29 * The entire image is read into a set of virtual coefficient-block arrays,
27 * one per component. The return value is a pointer to the array of 30 * one per component. The return value is a pointer to the array of
28 * virtual-array descriptors. These can be manipulated directly via the 31 * virtual-array descriptors. These can be manipulated directly via the
29 * JPEG memory manager, or handed off to jpeg_write_coefficients(). 32 * JPEG memory manager, or handed off to jpeg_write_coefficients().
(...skipping 18 matching lines...) Expand all
48 /* First call: initialize active modules */ 51 /* First call: initialize active modules */
49 transdecode_master_selection(cinfo); 52 transdecode_master_selection(cinfo);
50 cinfo->global_state = DSTATE_RDCOEFS; 53 cinfo->global_state = DSTATE_RDCOEFS;
51 } 54 }
52 if (cinfo->global_state == DSTATE_RDCOEFS) { 55 if (cinfo->global_state == DSTATE_RDCOEFS) {
53 /* Absorb whole file into the coef buffer */ 56 /* Absorb whole file into the coef buffer */
54 for (;;) { 57 for (;;) {
55 int retcode; 58 int retcode;
56 /* Call progress monitor hook if present */ 59 /* Call progress monitor hook if present */
57 if (cinfo->progress != NULL) 60 if (cinfo->progress != NULL)
58 » (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); 61 (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
59 /* Absorb some more input */ 62 /* Absorb some more input */
60 retcode = (*cinfo->inputctl->consume_input) (cinfo); 63 retcode = (*cinfo->inputctl->consume_input) (cinfo);
61 if (retcode == JPEG_SUSPENDED) 64 if (retcode == JPEG_SUSPENDED)
62 » return NULL; 65 return NULL;
63 if (retcode == JPEG_REACHED_EOI) 66 if (retcode == JPEG_REACHED_EOI)
64 » break; 67 break;
65 /* Advance progress counter if appropriate */ 68 /* Advance progress counter if appropriate */
66 if (cinfo->progress != NULL && 69 if (cinfo->progress != NULL &&
67 » (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) { 70 (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
68 » if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) { 71 if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) {
69 » /* startup underestimated number of scans; ratchet up one scan */ 72 /* startup underestimated number of scans; ratchet up one scan */
70 » cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows; 73 cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows;
71 » } 74 }
72 } 75 }
73 } 76 }
74 /* Set state so that jpeg_finish_decompress does the right thing */ 77 /* Set state so that jpeg_finish_decompress does the right thing */
75 cinfo->global_state = DSTATE_STOPPING; 78 cinfo->global_state = DSTATE_STOPPING;
76 } 79 }
77 /* At this point we should be in state DSTATE_STOPPING if being used 80 /* At this point we should be in state DSTATE_STOPPING if being used
78 * standalone, or in state DSTATE_BUFIMAGE if being invoked to get access 81 * standalone, or in state DSTATE_BUFIMAGE if being invoked to get access
79 * to the coefficients during a full buffered-image-mode decompression. 82 * to the coefficients during a full buffered-image-mode decompression.
80 */ 83 */
81 if ((cinfo->global_state == DSTATE_STOPPING || 84 if ((cinfo->global_state == DSTATE_STOPPING ||
82 cinfo->global_state == DSTATE_BUFIMAGE) && cinfo->buffered_image) { 85 cinfo->global_state == DSTATE_BUFIMAGE) && cinfo->buffered_image) {
83 return cinfo->coef->coef_arrays; 86 return cinfo->coef->coef_arrays;
84 } 87 }
85 /* Oops, improper usage */ 88 /* Oops, improper usage */
86 ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); 89 ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
87 return NULL;» » » /* keep compiler happy */ 90 return NULL; /* keep compiler happy */
88 } 91 }
89 92
90 93
91 /* 94 /*
92 * Master selection of decompression modules for transcoding. 95 * Master selection of decompression modules for transcoding.
93 * This substitutes for jdmaster.c's initialization of the full decompressor. 96 * This substitutes for jdmaster.c's initialization of the full decompressor.
94 */ 97 */
95 98
96 LOCAL(void) 99 LOCAL(void)
97 transdecode_master_selection (j_decompress_ptr cinfo) 100 transdecode_master_selection (j_decompress_ptr cinfo)
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 nscans = cinfo->num_components; 146 nscans = cinfo->num_components;
144 } else { 147 } else {
145 nscans = 1; 148 nscans = 1;
146 } 149 }
147 cinfo->progress->pass_counter = 0L; 150 cinfo->progress->pass_counter = 0L;
148 cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows * nscans; 151 cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows * nscans;
149 cinfo->progress->completed_passes = 0; 152 cinfo->progress->completed_passes = 0;
150 cinfo->progress->total_passes = 1; 153 cinfo->progress->total_passes = 1;
151 } 154 }
152 } 155 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698