35 #define JPEG_INTERNALS 39 #ifdef UPSAMPLE_MERGING_SUPPORTED 73 #define ONE_HALF ((INT32) 1 << (SCALEBITS-1)) 74 #define FIX(x) ((INT32) ((x) * (1L<<SCALEBITS) + 0.5)) 90 upsample->Cr_r_tab = (
int *)
93 upsample->Cb_b_tab = (
int *)
94 (*cinfo->mem->alloc_small) ((
j_common_ptr) cinfo, JPOOL_IMAGE,
96 upsample->Cr_g_tab = (
INT32 *)
97 (*cinfo->mem->alloc_small) ((
j_common_ptr) cinfo, JPOOL_IMAGE,
99 upsample->Cb_g_tab = (
INT32 *)
100 (*cinfo->mem->alloc_small) ((
j_common_ptr) cinfo, JPOOL_IMAGE,
107 upsample->Cr_r_tab[
i] = (
int)
110 upsample->Cb_b_tab[
i] = (
int)
113 upsample->Cr_g_tab[
i] = (-
FIX(0.71414)) *
x;
116 upsample->Cb_g_tab[
i] = (-
FIX(0.34414)) *
x + ONE_HALF;
131 upsample->spare_full =
FALSE;
133 upsample->rows_to_go = cinfo->output_height;
155 if (upsample->spare_full) {
158 1, upsample->out_row_width);
160 upsample->spare_full =
FALSE;
165 if (
num_rows > upsample->rows_to_go)
168 out_rows_avail -= *out_row_ctr;
172 work_ptrs[0] = output_buf[*out_row_ctr];
174 work_ptrs[1] = output_buf[*out_row_ctr + 1];
176 work_ptrs[1] = upsample->spare_row;
177 upsample->spare_full =
TRUE;
180 (*upsample->upmethod) (cinfo, input_buf, *in_row_group_ctr, work_ptrs);
187 if (! upsample->spare_full)
188 (*in_row_group_ctr)++;
203 (*upsample->upmethod) (cinfo, input_buf, *in_row_group_ctr,
207 (*in_row_group_ctr)++;
231 register int y, cred, cgreen, cblue;
237 register JSAMPLE * range_limit = cinfo->sample_range_limit;
238 int * Crrtab = upsample->Cr_r_tab;
239 int * Cbbtab = upsample->Cb_b_tab;
240 INT32 * Crgtab = upsample->Cr_g_tab;
241 INT32 * Cbgtab = upsample->Cb_g_tab;
244 inptr0 = input_buf[0][in_row_group_ctr];
245 inptr1 = input_buf[1][in_row_group_ctr];
246 inptr2 = input_buf[2][in_row_group_ctr];
249 for (col = cinfo->output_width >> 1; col > 0; col--) {
258 outptr[RGB_RED] = range_limit[
y + cred];
259 outptr[RGB_GREEN] = range_limit[
y + cgreen];
260 outptr[RGB_BLUE] = range_limit[
y + cblue];
261 outptr += RGB_PIXELSIZE;
263 outptr[RGB_RED] = range_limit[
y + cred];
264 outptr[RGB_GREEN] = range_limit[
y + cgreen];
265 outptr[RGB_BLUE] = range_limit[
y + cblue];
266 outptr += RGB_PIXELSIZE;
269 if (cinfo->output_width & 1) {
276 outptr[RGB_RED] = range_limit[
y + cred];
277 outptr[RGB_GREEN] = range_limit[
y + cgreen];
278 outptr[RGB_BLUE] = range_limit[
y + cblue];
293 register int y, cred, cgreen, cblue;
296 JSAMPROW inptr00, inptr01, inptr1, inptr2;
299 register JSAMPLE * range_limit = cinfo->sample_range_limit;
300 int * Crrtab = upsample->Cr_r_tab;
301 int * Cbbtab = upsample->Cb_b_tab;
302 INT32 * Crgtab = upsample->Cr_g_tab;
303 INT32 * Cbgtab = upsample->Cb_g_tab;
306 inptr00 = input_buf[0][in_row_group_ctr*2];
307 inptr01 = input_buf[0][in_row_group_ctr*2 + 1];
308 inptr1 = input_buf[1][in_row_group_ctr];
309 inptr2 = input_buf[2][in_row_group_ctr];
313 for (col = cinfo->output_width >> 1; col > 0; col--) {
322 outptr0[RGB_RED] = range_limit[
y + cred];
323 outptr0[RGB_GREEN] = range_limit[
y + cgreen];
324 outptr0[RGB_BLUE] = range_limit[
y + cblue];
325 outptr0 += RGB_PIXELSIZE;
327 outptr0[RGB_RED] = range_limit[
y + cred];
328 outptr0[RGB_GREEN] = range_limit[
y + cgreen];
329 outptr0[RGB_BLUE] = range_limit[
y + cblue];
330 outptr0 += RGB_PIXELSIZE;
332 outptr1[RGB_RED] = range_limit[
y + cred];
333 outptr1[RGB_GREEN] = range_limit[
y + cgreen];
334 outptr1[RGB_BLUE] = range_limit[
y + cblue];
335 outptr1 += RGB_PIXELSIZE;
337 outptr1[RGB_RED] = range_limit[
y + cred];
338 outptr1[RGB_GREEN] = range_limit[
y + cgreen];
339 outptr1[RGB_BLUE] = range_limit[
y + cblue];
340 outptr1 += RGB_PIXELSIZE;
343 if (cinfo->output_width & 1) {
350 outptr0[RGB_RED] = range_limit[
y + cred];
351 outptr0[RGB_GREEN] = range_limit[
y + cgreen];
352 outptr0[RGB_BLUE] = range_limit[
y + cblue];
354 outptr1[RGB_RED] = range_limit[
y + cred];
355 outptr1[RGB_GREEN] = range_limit[
y + cgreen];
356 outptr1[RGB_BLUE] = range_limit[
y + cblue];
379 upsample->pub.need_context_rows =
FALSE;
381 upsample->out_row_width = cinfo->output_width * cinfo->out_color_components;
383 if (cinfo->max_v_samp_factor == 2) {
394 upsample->spare_row =
NULL;
merged_2v_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
for(n=1;n< outline->n_points;n++)
GLint GLint GLint GLint GLint GLint y
struct jpeg_common_struct * j_common_ptr
#define GETJSAMPLE(value)
JMETHOD(void, prepare_for_output_pass,(j_decompress_ptr cinfo))
GLint GLint GLint GLint GLint x
my_upsampler * my_upsample_ptr
h2v1_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
build_ycc_rgb_table(j_decompress_ptr cinfo)
int JSAMPARRAY int int num_rows
jinit_merged_upsampler(j_decompress_ptr cinfo)
h2v2_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
if(!abbox) return FT_THROW(Invalid_Argument)
#define RIGHT_SHIFT(x, shft)
jpeg_component_info JCOEFPTR JSAMPARRAY output_buf
jcopy_sample_rows(JSAMPARRAY input_array, int source_row, JSAMPARRAY output_array, int dest_row, int num_rows, JDIMENSION num_cols)
start_pass_merged_upsample(j_decompress_ptr cinfo)
merged_1v_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)