| OLD | NEW |
| 1 /* | 1 /* |
| 2 * jdmrgext.c | 2 * jdmrgext.c |
| 3 * | 3 * |
| 4 * Copyright (C) 1994-1996, Thomas G. Lane. | 4 * Copyright (C) 1994-1996, Thomas G. Lane. |
| 5 * Copyright (C) 2011, D. R. Commander. |
| 5 * This file is part of the Independent JPEG Group's software. | 6 * This file is part of the Independent JPEG Group's software. |
| 6 * For conditions of distribution and use, see the accompanying README file. | 7 * For conditions of distribution and use, see the accompanying README file. |
| 7 * | 8 * |
| 8 * This file contains code for merged upsampling/color conversion. | 9 * This file contains code for merged upsampling/color conversion. |
| 9 */ | 10 */ |
| 10 | 11 |
| 11 | 12 |
| 12 /* This file is included by jdmerge.c */ | 13 /* This file is included by jdmerge.c */ |
| 13 | 14 |
| 14 | 15 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 cb = GETJSAMPLE(*inptr1++); | 48 cb = GETJSAMPLE(*inptr1++); |
| 48 cr = GETJSAMPLE(*inptr2++); | 49 cr = GETJSAMPLE(*inptr2++); |
| 49 cred = Crrtab[cr]; | 50 cred = Crrtab[cr]; |
| 50 cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); | 51 cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); |
| 51 cblue = Cbbtab[cb]; | 52 cblue = Cbbtab[cb]; |
| 52 /* Fetch 2 Y values and emit 2 pixels */ | 53 /* Fetch 2 Y values and emit 2 pixels */ |
| 53 y = GETJSAMPLE(*inptr0++); | 54 y = GETJSAMPLE(*inptr0++); |
| 54 outptr[RGB_RED] = range_limit[y + cred]; | 55 outptr[RGB_RED] = range_limit[y + cred]; |
| 55 outptr[RGB_GREEN] = range_limit[y + cgreen]; | 56 outptr[RGB_GREEN] = range_limit[y + cgreen]; |
| 56 outptr[RGB_BLUE] = range_limit[y + cblue]; | 57 outptr[RGB_BLUE] = range_limit[y + cblue]; |
| 58 #ifdef RGB_ALPHA |
| 59 outptr[RGB_ALPHA] = 0xFF; |
| 60 #endif |
| 57 outptr += RGB_PIXELSIZE; | 61 outptr += RGB_PIXELSIZE; |
| 58 y = GETJSAMPLE(*inptr0++); | 62 y = GETJSAMPLE(*inptr0++); |
| 59 outptr[RGB_RED] = range_limit[y + cred]; | 63 outptr[RGB_RED] = range_limit[y + cred]; |
| 60 outptr[RGB_GREEN] = range_limit[y + cgreen]; | 64 outptr[RGB_GREEN] = range_limit[y + cgreen]; |
| 61 outptr[RGB_BLUE] = range_limit[y + cblue]; | 65 outptr[RGB_BLUE] = range_limit[y + cblue]; |
| 66 #ifdef RGB_ALPHA |
| 67 outptr[RGB_ALPHA] = 0xFF; |
| 68 #endif |
| 62 outptr += RGB_PIXELSIZE; | 69 outptr += RGB_PIXELSIZE; |
| 63 } | 70 } |
| 64 /* If image width is odd, do the last output column separately */ | 71 /* If image width is odd, do the last output column separately */ |
| 65 if (cinfo->output_width & 1) { | 72 if (cinfo->output_width & 1) { |
| 66 cb = GETJSAMPLE(*inptr1); | 73 cb = GETJSAMPLE(*inptr1); |
| 67 cr = GETJSAMPLE(*inptr2); | 74 cr = GETJSAMPLE(*inptr2); |
| 68 cred = Crrtab[cr]; | 75 cred = Crrtab[cr]; |
| 69 cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); | 76 cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); |
| 70 cblue = Cbbtab[cb]; | 77 cblue = Cbbtab[cb]; |
| 71 y = GETJSAMPLE(*inptr0); | 78 y = GETJSAMPLE(*inptr0); |
| 72 outptr[RGB_RED] = range_limit[y + cred]; | 79 outptr[RGB_RED] = range_limit[y + cred]; |
| 73 outptr[RGB_GREEN] = range_limit[y + cgreen]; | 80 outptr[RGB_GREEN] = range_limit[y + cgreen]; |
| 74 outptr[RGB_BLUE] = range_limit[y + cblue]; | 81 outptr[RGB_BLUE] = range_limit[y + cblue]; |
| 82 #ifdef RGB_ALPHA |
| 83 outptr[RGB_ALPHA] = 0xFF; |
| 84 #endif |
| 75 } | 85 } |
| 76 } | 86 } |
| 77 | 87 |
| 78 | 88 |
| 79 /* | 89 /* |
| 80 * Upsample and color convert for the case of 2:1 horizontal and 2:1 vertical. | 90 * Upsample and color convert for the case of 2:1 horizontal and 2:1 vertical. |
| 81 */ | 91 */ |
| 82 | 92 |
| 83 INLINE | 93 INLINE |
| 84 LOCAL(void) | 94 LOCAL(void) |
| (...skipping 28 matching lines...) Expand all Loading... |
| 113 cb = GETJSAMPLE(*inptr1++); | 123 cb = GETJSAMPLE(*inptr1++); |
| 114 cr = GETJSAMPLE(*inptr2++); | 124 cr = GETJSAMPLE(*inptr2++); |
| 115 cred = Crrtab[cr]; | 125 cred = Crrtab[cr]; |
| 116 cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); | 126 cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); |
| 117 cblue = Cbbtab[cb]; | 127 cblue = Cbbtab[cb]; |
| 118 /* Fetch 4 Y values and emit 4 pixels */ | 128 /* Fetch 4 Y values and emit 4 pixels */ |
| 119 y = GETJSAMPLE(*inptr00++); | 129 y = GETJSAMPLE(*inptr00++); |
| 120 outptr0[RGB_RED] = range_limit[y + cred]; | 130 outptr0[RGB_RED] = range_limit[y + cred]; |
| 121 outptr0[RGB_GREEN] = range_limit[y + cgreen]; | 131 outptr0[RGB_GREEN] = range_limit[y + cgreen]; |
| 122 outptr0[RGB_BLUE] = range_limit[y + cblue]; | 132 outptr0[RGB_BLUE] = range_limit[y + cblue]; |
| 133 #ifdef RGB_ALPHA |
| 134 outptr0[RGB_ALPHA] = 0xFF; |
| 135 #endif |
| 123 outptr0 += RGB_PIXELSIZE; | 136 outptr0 += RGB_PIXELSIZE; |
| 124 y = GETJSAMPLE(*inptr00++); | 137 y = GETJSAMPLE(*inptr00++); |
| 125 outptr0[RGB_RED] = range_limit[y + cred]; | 138 outptr0[RGB_RED] = range_limit[y + cred]; |
| 126 outptr0[RGB_GREEN] = range_limit[y + cgreen]; | 139 outptr0[RGB_GREEN] = range_limit[y + cgreen]; |
| 127 outptr0[RGB_BLUE] = range_limit[y + cblue]; | 140 outptr0[RGB_BLUE] = range_limit[y + cblue]; |
| 141 #ifdef RGB_ALPHA |
| 142 outptr0[RGB_ALPHA] = 0xFF; |
| 143 #endif |
| 128 outptr0 += RGB_PIXELSIZE; | 144 outptr0 += RGB_PIXELSIZE; |
| 129 y = GETJSAMPLE(*inptr01++); | 145 y = GETJSAMPLE(*inptr01++); |
| 130 outptr1[RGB_RED] = range_limit[y + cred]; | 146 outptr1[RGB_RED] = range_limit[y + cred]; |
| 131 outptr1[RGB_GREEN] = range_limit[y + cgreen]; | 147 outptr1[RGB_GREEN] = range_limit[y + cgreen]; |
| 132 outptr1[RGB_BLUE] = range_limit[y + cblue]; | 148 outptr1[RGB_BLUE] = range_limit[y + cblue]; |
| 149 #ifdef RGB_ALPHA |
| 150 outptr1[RGB_ALPHA] = 0xFF; |
| 151 #endif |
| 133 outptr1 += RGB_PIXELSIZE; | 152 outptr1 += RGB_PIXELSIZE; |
| 134 y = GETJSAMPLE(*inptr01++); | 153 y = GETJSAMPLE(*inptr01++); |
| 135 outptr1[RGB_RED] = range_limit[y + cred]; | 154 outptr1[RGB_RED] = range_limit[y + cred]; |
| 136 outptr1[RGB_GREEN] = range_limit[y + cgreen]; | 155 outptr1[RGB_GREEN] = range_limit[y + cgreen]; |
| 137 outptr1[RGB_BLUE] = range_limit[y + cblue]; | 156 outptr1[RGB_BLUE] = range_limit[y + cblue]; |
| 157 #ifdef RGB_ALPHA |
| 158 outptr1[RGB_ALPHA] = 0xFF; |
| 159 #endif |
| 138 outptr1 += RGB_PIXELSIZE; | 160 outptr1 += RGB_PIXELSIZE; |
| 139 } | 161 } |
| 140 /* If image width is odd, do the last output column separately */ | 162 /* If image width is odd, do the last output column separately */ |
| 141 if (cinfo->output_width & 1) { | 163 if (cinfo->output_width & 1) { |
| 142 cb = GETJSAMPLE(*inptr1); | 164 cb = GETJSAMPLE(*inptr1); |
| 143 cr = GETJSAMPLE(*inptr2); | 165 cr = GETJSAMPLE(*inptr2); |
| 144 cred = Crrtab[cr]; | 166 cred = Crrtab[cr]; |
| 145 cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); | 167 cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); |
| 146 cblue = Cbbtab[cb]; | 168 cblue = Cbbtab[cb]; |
| 147 y = GETJSAMPLE(*inptr00); | 169 y = GETJSAMPLE(*inptr00); |
| 148 outptr0[RGB_RED] = range_limit[y + cred]; | 170 outptr0[RGB_RED] = range_limit[y + cred]; |
| 149 outptr0[RGB_GREEN] = range_limit[y + cgreen]; | 171 outptr0[RGB_GREEN] = range_limit[y + cgreen]; |
| 150 outptr0[RGB_BLUE] = range_limit[y + cblue]; | 172 outptr0[RGB_BLUE] = range_limit[y + cblue]; |
| 173 #ifdef RGB_ALPHA |
| 174 outptr0[RGB_ALPHA] = 0xFF; |
| 175 #endif |
| 151 y = GETJSAMPLE(*inptr01); | 176 y = GETJSAMPLE(*inptr01); |
| 152 outptr1[RGB_RED] = range_limit[y + cred]; | 177 outptr1[RGB_RED] = range_limit[y + cred]; |
| 153 outptr1[RGB_GREEN] = range_limit[y + cgreen]; | 178 outptr1[RGB_GREEN] = range_limit[y + cgreen]; |
| 154 outptr1[RGB_BLUE] = range_limit[y + cblue]; | 179 outptr1[RGB_BLUE] = range_limit[y + cblue]; |
| 180 #ifdef RGB_ALPHA |
| 181 outptr1[RGB_ALPHA] = 0xFF; |
| 182 #endif |
| 155 } | 183 } |
| 156 } | 184 } |
| OLD | NEW |