| OLD | NEW |
| 1 /* | 1 /* |
| 2 * jdmrgext.c | 2 * jdmrgext.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) 2011, D. R. Commander. | 7 * Copyright (C) 2011, 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 code for merged upsampling/color conversion. | 11 * This file contains code for merged upsampling/color conversion. |
| 11 */ | 12 */ |
| 12 | 13 |
| 13 | 14 |
| 14 /* This file is included by jdmerge.c */ | 15 /* This file is included by jdmerge.c */ |
| 15 | 16 |
| 16 | 17 |
| 17 /* | 18 /* |
| 18 * Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical. | 19 * Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical. |
| 19 */ | 20 */ |
| 20 | 21 |
| 21 INLINE | 22 INLINE |
| 22 LOCAL(void) | 23 LOCAL(void) |
| 23 h2v1_merged_upsample_internal (j_decompress_ptr cinfo, | 24 h2v1_merged_upsample_internal (j_decompress_ptr cinfo, |
| 24 JSAMPIMAGE input_buf, | 25 JSAMPIMAGE input_buf, |
| 25 JDIMENSION in_row_group_ctr, | 26 JDIMENSION in_row_group_ctr, |
| 26 JSAMPARRAY output_buf) | 27 JSAMPARRAY output_buf) |
| 27 { | 28 { |
| 28 my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; | 29 my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; |
| 29 register int y, cred, cgreen, cblue; | 30 register int y, cred, cgreen, cblue; |
| 30 int cb, cr; | 31 int cb, cr; |
| 31 register JSAMPROW outptr; | 32 register JSAMPROW outptr; |
| 32 JSAMPROW inptr0, inptr1, inptr2; | 33 JSAMPROW inptr0, inptr1, inptr2; |
| 33 JDIMENSION col; | 34 JDIMENSION col; |
| 34 /* copy these pointers into registers if possible */ | 35 /* copy these pointers into registers if possible */ |
| 35 register JSAMPLE * range_limit = cinfo->sample_range_limit; | 36 register JSAMPLE * range_limit = cinfo->sample_range_limit; |
| 36 int * Crrtab = upsample->Cr_r_tab; | 37 int * Crrtab = upsample->Cr_r_tab; |
| 37 int * Cbbtab = upsample->Cb_b_tab; | 38 int * Cbbtab = upsample->Cb_b_tab; |
| 38 INT32 * Crgtab = upsample->Cr_g_tab; | 39 JLONG * Crgtab = upsample->Cr_g_tab; |
| 39 INT32 * Cbgtab = upsample->Cb_g_tab; | 40 JLONG * Cbgtab = upsample->Cb_g_tab; |
| 40 SHIFT_TEMPS | 41 SHIFT_TEMPS |
| 41 | 42 |
| 42 inptr0 = input_buf[0][in_row_group_ctr]; | 43 inptr0 = input_buf[0][in_row_group_ctr]; |
| 43 inptr1 = input_buf[1][in_row_group_ctr]; | 44 inptr1 = input_buf[1][in_row_group_ctr]; |
| 44 inptr2 = input_buf[2][in_row_group_ctr]; | 45 inptr2 = input_buf[2][in_row_group_ctr]; |
| 45 outptr = output_buf[0]; | 46 outptr = output_buf[0]; |
| 46 /* Loop for each pair of output pixels */ | 47 /* Loop for each pair of output pixels */ |
| 47 for (col = cinfo->output_width >> 1; col > 0; col--) { | 48 for (col = cinfo->output_width >> 1; col > 0; col--) { |
| 48 /* Do the chroma part of the calculation */ | 49 /* Do the chroma part of the calculation */ |
| 49 cb = GETJSAMPLE(*inptr1++); | 50 cb = GETJSAMPLE(*inptr1++); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; | 102 my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; |
| 102 register int y, cred, cgreen, cblue; | 103 register int y, cred, cgreen, cblue; |
| 103 int cb, cr; | 104 int cb, cr; |
| 104 register JSAMPROW outptr0, outptr1; | 105 register JSAMPROW outptr0, outptr1; |
| 105 JSAMPROW inptr00, inptr01, inptr1, inptr2; | 106 JSAMPROW inptr00, inptr01, inptr1, inptr2; |
| 106 JDIMENSION col; | 107 JDIMENSION col; |
| 107 /* copy these pointers into registers if possible */ | 108 /* copy these pointers into registers if possible */ |
| 108 register JSAMPLE * range_limit = cinfo->sample_range_limit; | 109 register JSAMPLE * range_limit = cinfo->sample_range_limit; |
| 109 int * Crrtab = upsample->Cr_r_tab; | 110 int * Crrtab = upsample->Cr_r_tab; |
| 110 int * Cbbtab = upsample->Cb_b_tab; | 111 int * Cbbtab = upsample->Cb_b_tab; |
| 111 INT32 * Crgtab = upsample->Cr_g_tab; | 112 JLONG * Crgtab = upsample->Cr_g_tab; |
| 112 INT32 * Cbgtab = upsample->Cb_g_tab; | 113 JLONG * Cbgtab = upsample->Cb_g_tab; |
| 113 SHIFT_TEMPS | 114 SHIFT_TEMPS |
| 114 | 115 |
| 115 inptr00 = input_buf[0][in_row_group_ctr*2]; | 116 inptr00 = input_buf[0][in_row_group_ctr*2]; |
| 116 inptr01 = input_buf[0][in_row_group_ctr*2 + 1]; | 117 inptr01 = input_buf[0][in_row_group_ctr*2 + 1]; |
| 117 inptr1 = input_buf[1][in_row_group_ctr]; | 118 inptr1 = input_buf[1][in_row_group_ctr]; |
| 118 inptr2 = input_buf[2][in_row_group_ctr]; | 119 inptr2 = input_buf[2][in_row_group_ctr]; |
| 119 outptr0 = output_buf[0]; | 120 outptr0 = output_buf[0]; |
| 120 outptr1 = output_buf[1]; | 121 outptr1 = output_buf[1]; |
| 121 /* Loop for each group of output pixels */ | 122 /* Loop for each group of output pixels */ |
| 122 for (col = cinfo->output_width >> 1; col > 0; col--) { | 123 for (col = cinfo->output_width >> 1; col > 0; col--) { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 #endif | 177 #endif |
| 177 y = GETJSAMPLE(*inptr01); | 178 y = GETJSAMPLE(*inptr01); |
| 178 outptr1[RGB_RED] = range_limit[y + cred]; | 179 outptr1[RGB_RED] = range_limit[y + cred]; |
| 179 outptr1[RGB_GREEN] = range_limit[y + cgreen]; | 180 outptr1[RGB_GREEN] = range_limit[y + cgreen]; |
| 180 outptr1[RGB_BLUE] = range_limit[y + cblue]; | 181 outptr1[RGB_BLUE] = range_limit[y + cblue]; |
| 181 #ifdef RGB_ALPHA | 182 #ifdef RGB_ALPHA |
| 182 outptr1[RGB_ALPHA] = 0xFF; | 183 outptr1[RGB_ALPHA] = 0xFF; |
| 183 #endif | 184 #endif |
| 184 } | 185 } |
| 185 } | 186 } |
| OLD | NEW |