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

Side by Side Diff: jdmrg565.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 * jdmrg565.c 2 * jdmrg565.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) 1994-1996, Thomas G. Lane. 5 * Copyright (C) 1994-1996, Thomas G. Lane.
6 * libjpeg-turbo Modifications: 6 * libjpeg-turbo Modifications:
7 * Copyright (C) 2013, Linaro Limited. 7 * Copyright (C) 2013, Linaro Limited.
8 * Copyright (C) 2014, D. R. Commander. 8 * Copyright (C) 2014-2015, D. R. Commander.
9 * For conditions of distribution and use, see the accompanying README file. 9 * For conditions of distribution and use, see the accompanying README.ijg
10 * file.
10 * 11 *
11 * This file contains code for merged upsampling/color conversion. 12 * This file contains code for merged upsampling/color conversion.
12 */ 13 */
13 14
14 15
15 INLINE 16 INLINE
16 LOCAL(void) 17 LOCAL(void)
17 h2v1_merged_upsample_565_internal (j_decompress_ptr cinfo, 18 h2v1_merged_upsample_565_internal (j_decompress_ptr cinfo,
18 JSAMPIMAGE input_buf, 19 JSAMPIMAGE input_buf,
19 JDIMENSION in_row_group_ctr, 20 JDIMENSION in_row_group_ctr,
20 JSAMPARRAY output_buf) 21 JSAMPARRAY output_buf)
21 { 22 {
22 my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; 23 my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
23 register int y, cred, cgreen, cblue; 24 register int y, cred, cgreen, cblue;
24 int cb, cr; 25 int cb, cr;
25 register JSAMPROW outptr; 26 register JSAMPROW outptr;
26 JSAMPROW inptr0, inptr1, inptr2; 27 JSAMPROW inptr0, inptr1, inptr2;
27 JDIMENSION col; 28 JDIMENSION col;
28 /* copy these pointers into registers if possible */ 29 /* copy these pointers into registers if possible */
29 register JSAMPLE * range_limit = cinfo->sample_range_limit; 30 register JSAMPLE * range_limit = cinfo->sample_range_limit;
30 int * Crrtab = upsample->Cr_r_tab; 31 int * Crrtab = upsample->Cr_r_tab;
31 int * Cbbtab = upsample->Cb_b_tab; 32 int * Cbbtab = upsample->Cb_b_tab;
32 INT32 * Crgtab = upsample->Cr_g_tab; 33 JLONG * Crgtab = upsample->Cr_g_tab;
33 INT32 * Cbgtab = upsample->Cb_g_tab; 34 JLONG * Cbgtab = upsample->Cb_g_tab;
34 unsigned int r, g, b; 35 unsigned int r, g, b;
35 INT32 rgb; 36 JLONG rgb;
36 SHIFT_TEMPS 37 SHIFT_TEMPS
37 38
38 inptr0 = input_buf[0][in_row_group_ctr]; 39 inptr0 = input_buf[0][in_row_group_ctr];
39 inptr1 = input_buf[1][in_row_group_ctr]; 40 inptr1 = input_buf[1][in_row_group_ctr];
40 inptr2 = input_buf[2][in_row_group_ctr]; 41 inptr2 = input_buf[2][in_row_group_ctr];
41 outptr = output_buf[0]; 42 outptr = output_buf[0];
42 43
43 /* Loop for each pair of output pixels */ 44 /* Loop for each pair of output pixels */
44 for (col = cinfo->output_width >> 1; col > 0; col--) { 45 for (col = cinfo->output_width >> 1; col > 0; col--) {
45 /* Do the chroma part of the calculation */ 46 /* Do the chroma part of the calculation */
(...skipping 25 matching lines...) Expand all
71 cb = GETJSAMPLE(*inptr1); 72 cb = GETJSAMPLE(*inptr1);
72 cr = GETJSAMPLE(*inptr2); 73 cr = GETJSAMPLE(*inptr2);
73 cred = Crrtab[cr]; 74 cred = Crrtab[cr];
74 cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); 75 cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
75 cblue = Cbbtab[cb]; 76 cblue = Cbbtab[cb];
76 y = GETJSAMPLE(*inptr0); 77 y = GETJSAMPLE(*inptr0);
77 r = range_limit[y + cred]; 78 r = range_limit[y + cred];
78 g = range_limit[y + cgreen]; 79 g = range_limit[y + cgreen];
79 b = range_limit[y + cblue]; 80 b = range_limit[y + cblue];
80 rgb = PACK_SHORT_565(r, g, b); 81 rgb = PACK_SHORT_565(r, g, b);
81 *(INT16*)outptr = rgb; 82 *(INT16*)outptr = (INT16)rgb;
82 } 83 }
83 } 84 }
84 85
85 86
86 INLINE 87 INLINE
87 LOCAL(void) 88 LOCAL(void)
88 h2v1_merged_upsample_565D_internal (j_decompress_ptr cinfo, 89 h2v1_merged_upsample_565D_internal (j_decompress_ptr cinfo,
89 JSAMPIMAGE input_buf, 90 JSAMPIMAGE input_buf,
90 JDIMENSION in_row_group_ctr, 91 JDIMENSION in_row_group_ctr,
91 JSAMPARRAY output_buf) 92 JSAMPARRAY output_buf)
92 { 93 {
93 my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; 94 my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
94 register int y, cred, cgreen, cblue; 95 register int y, cred, cgreen, cblue;
95 int cb, cr; 96 int cb, cr;
96 register JSAMPROW outptr; 97 register JSAMPROW outptr;
97 JSAMPROW inptr0, inptr1, inptr2; 98 JSAMPROW inptr0, inptr1, inptr2;
98 JDIMENSION col; 99 JDIMENSION col;
99 /* copy these pointers into registers if possible */ 100 /* copy these pointers into registers if possible */
100 register JSAMPLE * range_limit = cinfo->sample_range_limit; 101 register JSAMPLE * range_limit = cinfo->sample_range_limit;
101 int * Crrtab = upsample->Cr_r_tab; 102 int * Crrtab = upsample->Cr_r_tab;
102 int * Cbbtab = upsample->Cb_b_tab; 103 int * Cbbtab = upsample->Cb_b_tab;
103 INT32 * Crgtab = upsample->Cr_g_tab; 104 JLONG * Crgtab = upsample->Cr_g_tab;
104 INT32 * Cbgtab = upsample->Cb_g_tab; 105 JLONG * Cbgtab = upsample->Cb_g_tab;
105 INT32 d0 = dither_matrix[cinfo->output_scanline & DITHER_MASK]; 106 JLONG d0 = dither_matrix[cinfo->output_scanline & DITHER_MASK];
106 unsigned int r, g, b; 107 unsigned int r, g, b;
107 INT32 rgb; 108 JLONG rgb;
108 SHIFT_TEMPS 109 SHIFT_TEMPS
109 110
110 inptr0 = input_buf[0][in_row_group_ctr]; 111 inptr0 = input_buf[0][in_row_group_ctr];
111 inptr1 = input_buf[1][in_row_group_ctr]; 112 inptr1 = input_buf[1][in_row_group_ctr];
112 inptr2 = input_buf[2][in_row_group_ctr]; 113 inptr2 = input_buf[2][in_row_group_ctr];
113 outptr = output_buf[0]; 114 outptr = output_buf[0];
114 115
115 /* Loop for each pair of output pixels */ 116 /* Loop for each pair of output pixels */
116 for (col = cinfo->output_width >> 1; col > 0; col--) { 117 for (col = cinfo->output_width >> 1; col > 0; col--) {
117 /* Do the chroma part of the calculation */ 118 /* Do the chroma part of the calculation */
(...skipping 27 matching lines...) Expand all
145 cb = GETJSAMPLE(*inptr1); 146 cb = GETJSAMPLE(*inptr1);
146 cr = GETJSAMPLE(*inptr2); 147 cr = GETJSAMPLE(*inptr2);
147 cred = Crrtab[cr]; 148 cred = Crrtab[cr];
148 cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); 149 cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
149 cblue = Cbbtab[cb]; 150 cblue = Cbbtab[cb];
150 y = GETJSAMPLE(*inptr0); 151 y = GETJSAMPLE(*inptr0);
151 r = range_limit[DITHER_565_R(y + cred, d0)]; 152 r = range_limit[DITHER_565_R(y + cred, d0)];
152 g = range_limit[DITHER_565_G(y + cgreen, d0)]; 153 g = range_limit[DITHER_565_G(y + cgreen, d0)];
153 b = range_limit[DITHER_565_B(y + cblue, d0)]; 154 b = range_limit[DITHER_565_B(y + cblue, d0)];
154 rgb = PACK_SHORT_565(r, g, b); 155 rgb = PACK_SHORT_565(r, g, b);
155 *(INT16*)outptr = rgb; 156 *(INT16*)outptr = (INT16)rgb;
156 } 157 }
157 } 158 }
158 159
159 160
160 INLINE 161 INLINE
161 LOCAL(void) 162 LOCAL(void)
162 h2v2_merged_upsample_565_internal (j_decompress_ptr cinfo, 163 h2v2_merged_upsample_565_internal (j_decompress_ptr cinfo,
163 JSAMPIMAGE input_buf, 164 JSAMPIMAGE input_buf,
164 JDIMENSION in_row_group_ctr, 165 JDIMENSION in_row_group_ctr,
165 JSAMPARRAY output_buf) 166 JSAMPARRAY output_buf)
166 { 167 {
167 my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; 168 my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
168 register int y, cred, cgreen, cblue; 169 register int y, cred, cgreen, cblue;
169 int cb, cr; 170 int cb, cr;
170 register JSAMPROW outptr0, outptr1; 171 register JSAMPROW outptr0, outptr1;
171 JSAMPROW inptr00, inptr01, inptr1, inptr2; 172 JSAMPROW inptr00, inptr01, inptr1, inptr2;
172 JDIMENSION col; 173 JDIMENSION col;
173 /* copy these pointers into registers if possible */ 174 /* copy these pointers into registers if possible */
174 register JSAMPLE * range_limit = cinfo->sample_range_limit; 175 register JSAMPLE * range_limit = cinfo->sample_range_limit;
175 int * Crrtab = upsample->Cr_r_tab; 176 int * Crrtab = upsample->Cr_r_tab;
176 int * Cbbtab = upsample->Cb_b_tab; 177 int * Cbbtab = upsample->Cb_b_tab;
177 INT32 * Crgtab = upsample->Cr_g_tab; 178 JLONG * Crgtab = upsample->Cr_g_tab;
178 INT32 * Cbgtab = upsample->Cb_g_tab; 179 JLONG * Cbgtab = upsample->Cb_g_tab;
179 unsigned int r, g, b; 180 unsigned int r, g, b;
180 INT32 rgb; 181 JLONG rgb;
181 SHIFT_TEMPS 182 SHIFT_TEMPS
182 183
183 inptr00 = input_buf[0][in_row_group_ctr * 2]; 184 inptr00 = input_buf[0][in_row_group_ctr * 2];
184 inptr01 = input_buf[0][in_row_group_ctr * 2 + 1]; 185 inptr01 = input_buf[0][in_row_group_ctr * 2 + 1];
185 inptr1 = input_buf[1][in_row_group_ctr]; 186 inptr1 = input_buf[1][in_row_group_ctr];
186 inptr2 = input_buf[2][in_row_group_ctr]; 187 inptr2 = input_buf[2][in_row_group_ctr];
187 outptr0 = output_buf[0]; 188 outptr0 = output_buf[0];
188 outptr1 = output_buf[1]; 189 outptr1 = output_buf[1];
189 190
190 /* Loop for each group of output pixels */ 191 /* Loop for each group of output pixels */
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 cr = GETJSAMPLE(*inptr2); 235 cr = GETJSAMPLE(*inptr2);
235 cred = Crrtab[cr]; 236 cred = Crrtab[cr];
236 cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); 237 cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
237 cblue = Cbbtab[cb]; 238 cblue = Cbbtab[cb];
238 239
239 y = GETJSAMPLE(*inptr00); 240 y = GETJSAMPLE(*inptr00);
240 r = range_limit[y + cred]; 241 r = range_limit[y + cred];
241 g = range_limit[y + cgreen]; 242 g = range_limit[y + cgreen];
242 b = range_limit[y + cblue]; 243 b = range_limit[y + cblue];
243 rgb = PACK_SHORT_565(r, g, b); 244 rgb = PACK_SHORT_565(r, g, b);
244 *(INT16*)outptr0 = rgb; 245 *(INT16*)outptr0 = (INT16)rgb;
245 246
246 y = GETJSAMPLE(*inptr01); 247 y = GETJSAMPLE(*inptr01);
247 r = range_limit[y + cred]; 248 r = range_limit[y + cred];
248 g = range_limit[y + cgreen]; 249 g = range_limit[y + cgreen];
249 b = range_limit[y + cblue]; 250 b = range_limit[y + cblue];
250 rgb = PACK_SHORT_565(r, g, b); 251 rgb = PACK_SHORT_565(r, g, b);
251 *(INT16*)outptr1 = rgb; 252 *(INT16*)outptr1 = (INT16)rgb;
252 } 253 }
253 } 254 }
254 255
255 256
256 INLINE 257 INLINE
257 LOCAL(void) 258 LOCAL(void)
258 h2v2_merged_upsample_565D_internal (j_decompress_ptr cinfo, 259 h2v2_merged_upsample_565D_internal (j_decompress_ptr cinfo,
259 JSAMPIMAGE input_buf, 260 JSAMPIMAGE input_buf,
260 JDIMENSION in_row_group_ctr, 261 JDIMENSION in_row_group_ctr,
261 JSAMPARRAY output_buf) 262 JSAMPARRAY output_buf)
262 { 263 {
263 my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; 264 my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
264 register int y, cred, cgreen, cblue; 265 register int y, cred, cgreen, cblue;
265 int cb, cr; 266 int cb, cr;
266 register JSAMPROW outptr0, outptr1; 267 register JSAMPROW outptr0, outptr1;
267 JSAMPROW inptr00, inptr01, inptr1, inptr2; 268 JSAMPROW inptr00, inptr01, inptr1, inptr2;
268 JDIMENSION col; 269 JDIMENSION col;
269 /* copy these pointers into registers if possible */ 270 /* copy these pointers into registers if possible */
270 register JSAMPLE * range_limit = cinfo->sample_range_limit; 271 register JSAMPLE * range_limit = cinfo->sample_range_limit;
271 int * Crrtab = upsample->Cr_r_tab; 272 int * Crrtab = upsample->Cr_r_tab;
272 int * Cbbtab = upsample->Cb_b_tab; 273 int * Cbbtab = upsample->Cb_b_tab;
273 INT32 * Crgtab = upsample->Cr_g_tab; 274 JLONG * Crgtab = upsample->Cr_g_tab;
274 INT32 * Cbgtab = upsample->Cb_g_tab; 275 JLONG * Cbgtab = upsample->Cb_g_tab;
275 INT32 d0 = dither_matrix[cinfo->output_scanline & DITHER_MASK]; 276 JLONG d0 = dither_matrix[cinfo->output_scanline & DITHER_MASK];
276 INT32 d1 = dither_matrix[(cinfo->output_scanline+1) & DITHER_MASK]; 277 JLONG d1 = dither_matrix[(cinfo->output_scanline+1) & DITHER_MASK];
277 unsigned int r, g, b; 278 unsigned int r, g, b;
278 INT32 rgb; 279 JLONG rgb;
279 SHIFT_TEMPS 280 SHIFT_TEMPS
280 281
281 inptr00 = input_buf[0][in_row_group_ctr*2]; 282 inptr00 = input_buf[0][in_row_group_ctr*2];
282 inptr01 = input_buf[0][in_row_group_ctr*2 + 1]; 283 inptr01 = input_buf[0][in_row_group_ctr*2 + 1];
283 inptr1 = input_buf[1][in_row_group_ctr]; 284 inptr1 = input_buf[1][in_row_group_ctr];
284 inptr2 = input_buf[2][in_row_group_ctr]; 285 inptr2 = input_buf[2][in_row_group_ctr];
285 outptr0 = output_buf[0]; 286 outptr0 = output_buf[0];
286 outptr1 = output_buf[1]; 287 outptr1 = output_buf[1];
287 288
288 /* Loop for each group of output pixels */ 289 /* Loop for each group of output pixels */
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 cr = GETJSAMPLE(*inptr2); 337 cr = GETJSAMPLE(*inptr2);
337 cred = Crrtab[cr]; 338 cred = Crrtab[cr];
338 cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); 339 cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
339 cblue = Cbbtab[cb]; 340 cblue = Cbbtab[cb];
340 341
341 y = GETJSAMPLE(*inptr00); 342 y = GETJSAMPLE(*inptr00);
342 r = range_limit[DITHER_565_R(y + cred, d0)]; 343 r = range_limit[DITHER_565_R(y + cred, d0)];
343 g = range_limit[DITHER_565_G(y + cgreen, d0)]; 344 g = range_limit[DITHER_565_G(y + cgreen, d0)];
344 b = range_limit[DITHER_565_B(y + cblue, d0)]; 345 b = range_limit[DITHER_565_B(y + cblue, d0)];
345 rgb = PACK_SHORT_565(r, g, b); 346 rgb = PACK_SHORT_565(r, g, b);
346 *(INT16*)outptr0 = rgb; 347 *(INT16*)outptr0 = (INT16)rgb;
347 348
348 y = GETJSAMPLE(*inptr01); 349 y = GETJSAMPLE(*inptr01);
349 r = range_limit[DITHER_565_R(y + cred, d1)]; 350 r = range_limit[DITHER_565_R(y + cred, d1)];
350 g = range_limit[DITHER_565_G(y + cgreen, d1)]; 351 g = range_limit[DITHER_565_G(y + cgreen, d1)];
351 b = range_limit[DITHER_565_B(y + cblue, d1)]; 352 b = range_limit[DITHER_565_B(y + cblue, d1)];
352 rgb = PACK_SHORT_565(r, g, b); 353 rgb = PACK_SHORT_565(r, g, b);
353 *(INT16*)outptr1 = rgb; 354 *(INT16*)outptr1 = (INT16)rgb;
354 } 355 }
355 } 356 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698