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

Side by Side Diff: jccolext.c

Issue 1953443002: Update to libjpeg_turbo 1.4.90 (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
« no previous file with comments | « jccoefct.c ('k') | jccolor.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * jccolext.c 2 * jccolext.c
3 * 3 *
4 * This file was part of the Independent JPEG Group's software: 4 * This file was part of the Independent JPEG Group's software:
5 * Copyright (C) 1991-1996, Thomas G. Lane. 5 * Copyright (C) 1991-1996, Thomas G. Lane.
6 * libjpeg-turbo Modifications: 6 * libjpeg-turbo Modifications:
7 * Copyright (C) 2009-2012, D. R. Commander. 7 * Copyright (C) 2009-2012, 2015, D. R. Commander.
8 * For conditions of distribution and use, see the accompanying README file. 8 * For conditions of distribution and use, see the accompanying README.ijg
9 * file.
9 * 10 *
10 * This file contains input colorspace conversion routines. 11 * This file contains input colorspace conversion routines.
11 */ 12 */
12 13
13 14
14 /* This file is included by jccolor.c */ 15 /* This file is included by jccolor.c */
15 16
16 17
17 /* 18 /*
18 * Convert some rows of samples to the JPEG colorspace. 19 * Convert some rows of samples to the JPEG colorspace.
19 * 20 *
20 * Note that we change from the application's interleaved-pixel format 21 * Note that we change from the application's interleaved-pixel format
21 * to our internal noninterleaved, one-plane-per-component format. 22 * to our internal noninterleaved, one-plane-per-component format.
22 * The input buffer is therefore three times as wide as the output buffer. 23 * The input buffer is therefore three times as wide as the output buffer.
23 * 24 *
24 * A starting row offset is provided only for the output buffer. The caller 25 * A starting row offset is provided only for the output buffer. The caller
25 * can easily adjust the passed input_buf value to accommodate any row 26 * can easily adjust the passed input_buf value to accommodate any row
26 * offset required on that side. 27 * offset required on that side.
27 */ 28 */
28 29
29 INLINE 30 INLINE
30 LOCAL(void) 31 LOCAL(void)
31 rgb_ycc_convert_internal (j_compress_ptr cinfo, 32 rgb_ycc_convert_internal (j_compress_ptr cinfo,
32 JSAMPARRAY input_buf, JSAMPIMAGE output_buf, 33 JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
33 JDIMENSION output_row, int num_rows) 34 JDIMENSION output_row, int num_rows)
34 { 35 {
35 my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; 36 my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
36 register int r, g, b; 37 register int r, g, b;
37 register INT32 * ctab = cconvert->rgb_ycc_tab; 38 register JLONG * ctab = cconvert->rgb_ycc_tab;
38 register JSAMPROW inptr; 39 register JSAMPROW inptr;
39 register JSAMPROW outptr0, outptr1, outptr2; 40 register JSAMPROW outptr0, outptr1, outptr2;
40 register JDIMENSION col; 41 register JDIMENSION col;
41 JDIMENSION num_cols = cinfo->image_width; 42 JDIMENSION num_cols = cinfo->image_width;
42 43
43 while (--num_rows >= 0) { 44 while (--num_rows >= 0) {
44 inptr = *input_buf++; 45 inptr = *input_buf++;
45 outptr0 = output_buf[0][output_row]; 46 outptr0 = output_buf[0][output_row];
46 outptr1 = output_buf[1][output_row]; 47 outptr1 = output_buf[1][output_row];
47 outptr2 = output_buf[2][output_row]; 48 outptr2 = output_buf[2][output_row];
48 output_row++; 49 output_row++;
49 for (col = 0; col < num_cols; col++) { 50 for (col = 0; col < num_cols; col++) {
50 r = GETJSAMPLE(inptr[RGB_RED]); 51 r = GETJSAMPLE(inptr[RGB_RED]);
51 g = GETJSAMPLE(inptr[RGB_GREEN]); 52 g = GETJSAMPLE(inptr[RGB_GREEN]);
52 b = GETJSAMPLE(inptr[RGB_BLUE]); 53 b = GETJSAMPLE(inptr[RGB_BLUE]);
53 inptr += RGB_PIXELSIZE; 54 inptr += RGB_PIXELSIZE;
54 /* If the inputs are 0..MAXJSAMPLE, the outputs of these equations 55 /* If the inputs are 0..MAXJSAMPLE, the outputs of these equations
55 * must be too; we do not need an explicit range-limiting operation. 56 * must be too; we do not need an explicit range-limiting operation.
56 * Hence the value being shifted is never negative, and we don't 57 * Hence the value being shifted is never negative, and we don't
57 * need the general RIGHT_SHIFT macro. 58 * need the general RIGHT_SHIFT macro.
58 */ 59 */
59 /* Y */ 60 /* Y */
60 outptr0[col] = (JSAMPLE) 61 outptr0[col] = (JSAMPLE)
61 » » ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) 62 ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
62 » » >> SCALEBITS); 63 >> SCALEBITS);
63 /* Cb */ 64 /* Cb */
64 outptr1[col] = (JSAMPLE) 65 outptr1[col] = (JSAMPLE)
65 » » ((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF]) 66 ((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF])
66 » » >> SCALEBITS); 67 >> SCALEBITS);
67 /* Cr */ 68 /* Cr */
68 outptr2[col] = (JSAMPLE) 69 outptr2[col] = (JSAMPLE)
69 » » ((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF]) 70 ((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF])
70 » » >> SCALEBITS); 71 >> SCALEBITS);
71 } 72 }
72 } 73 }
73 } 74 }
74 75
75 76
76 /**************** Cases other than RGB -> YCbCr **************/ 77 /**************** Cases other than RGB -> YCbCr **************/
77 78
78 79
79 /* 80 /*
80 * Convert some rows of samples to the JPEG colorspace. 81 * Convert some rows of samples to the JPEG colorspace.
81 * This version handles RGB->grayscale conversion, which is the same 82 * This version handles RGB->grayscale conversion, which is the same
82 * as the RGB->Y portion of RGB->YCbCr. 83 * as the RGB->Y portion of RGB->YCbCr.
83 * We assume rgb_ycc_start has been called (we only use the Y tables). 84 * We assume rgb_ycc_start has been called (we only use the Y tables).
84 */ 85 */
85 86
86 INLINE 87 INLINE
87 LOCAL(void) 88 LOCAL(void)
88 rgb_gray_convert_internal (j_compress_ptr cinfo, 89 rgb_gray_convert_internal (j_compress_ptr cinfo,
89 JSAMPARRAY input_buf, JSAMPIMAGE output_buf, 90 JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
90 JDIMENSION output_row, int num_rows) 91 JDIMENSION output_row, int num_rows)
91 { 92 {
92 my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; 93 my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
93 register int r, g, b; 94 register int r, g, b;
94 register INT32 * ctab = cconvert->rgb_ycc_tab; 95 register JLONG * ctab = cconvert->rgb_ycc_tab;
95 register JSAMPROW inptr; 96 register JSAMPROW inptr;
96 register JSAMPROW outptr; 97 register JSAMPROW outptr;
97 register JDIMENSION col; 98 register JDIMENSION col;
98 JDIMENSION num_cols = cinfo->image_width; 99 JDIMENSION num_cols = cinfo->image_width;
99 100
100 while (--num_rows >= 0) { 101 while (--num_rows >= 0) {
101 inptr = *input_buf++; 102 inptr = *input_buf++;
102 outptr = output_buf[0][output_row]; 103 outptr = output_buf[0][output_row];
103 output_row++; 104 output_row++;
104 for (col = 0; col < num_cols; col++) { 105 for (col = 0; col < num_cols; col++) {
105 r = GETJSAMPLE(inptr[RGB_RED]); 106 r = GETJSAMPLE(inptr[RGB_RED]);
106 g = GETJSAMPLE(inptr[RGB_GREEN]); 107 g = GETJSAMPLE(inptr[RGB_GREEN]);
107 b = GETJSAMPLE(inptr[RGB_BLUE]); 108 b = GETJSAMPLE(inptr[RGB_BLUE]);
108 inptr += RGB_PIXELSIZE; 109 inptr += RGB_PIXELSIZE;
109 /* Y */ 110 /* Y */
110 outptr[col] = (JSAMPLE) 111 outptr[col] = (JSAMPLE)
111 » » ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) 112 ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
112 » » >> SCALEBITS); 113 >> SCALEBITS);
113 } 114 }
114 } 115 }
115 } 116 }
116 117
117 118
118 /* 119 /*
119 * Convert some rows of samples to the JPEG colorspace. 120 * Convert some rows of samples to the JPEG colorspace.
120 * This version handles extended RGB->plain RGB conversion 121 * This version handles extended RGB->plain RGB conversion
121 */ 122 */
122 123
(...skipping 15 matching lines...) Expand all
138 outptr2 = output_buf[2][output_row]; 139 outptr2 = output_buf[2][output_row];
139 output_row++; 140 output_row++;
140 for (col = 0; col < num_cols; col++) { 141 for (col = 0; col < num_cols; col++) {
141 outptr0[col] = GETJSAMPLE(inptr[RGB_RED]); 142 outptr0[col] = GETJSAMPLE(inptr[RGB_RED]);
142 outptr1[col] = GETJSAMPLE(inptr[RGB_GREEN]); 143 outptr1[col] = GETJSAMPLE(inptr[RGB_GREEN]);
143 outptr2[col] = GETJSAMPLE(inptr[RGB_BLUE]); 144 outptr2[col] = GETJSAMPLE(inptr[RGB_BLUE]);
144 inptr += RGB_PIXELSIZE; 145 inptr += RGB_PIXELSIZE;
145 } 146 }
146 } 147 }
147 } 148 }
OLDNEW
« no previous file with comments | « jccoefct.c ('k') | jccolor.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698