ReactOS 0.4.15-dev-7918-g2a2556c
jdcolor.c File Reference
#include "jinclude.h"
#include "jpeglib.h"
Include dependency graph for jdcolor.c:

Go to the source code of this file.

Classes

struct  my_color_deconverter
 

Macros

#define JPEG_INTERNALS
 
#define SCALEBITS   16 /* speediest right-shift on some machines */
 
#define ONE_HALF   ((INT32) 1 << (SCALEBITS-1))
 
#define FIX(x)   ((INT32) ((x) * (1L<<SCALEBITS) + 0.5))
 
#define R_Y_OFF   0 /* offset to R => Y section */
 
#define G_Y_OFF   (1*(MAXJSAMPLE+1)) /* offset to G => Y section */
 
#define B_Y_OFF   (2*(MAXJSAMPLE+1)) /* etc. */
 
#define TABLE_SIZE   (3*(MAXJSAMPLE+1))
 

Typedefs

typedef my_color_deconvertermy_cconvert_ptr
 

Functions

 build_ycc_rgb_table (j_decompress_ptr cinfo)
 
 build_bg_ycc_rgb_table (j_decompress_ptr cinfo)
 
 ycc_rgb_convert (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
 
 build_rgb_y_table (j_decompress_ptr cinfo)
 
 rgb_gray_convert (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
 
 rgb1_rgb_convert (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
 
 rgb1_gray_convert (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
 
 rgb_convert (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
 
 null_convert (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
 
 grayscale_convert (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
 
 gray_rgb_convert (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
 
 ycck_cmyk_convert (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
 
 start_pass_dcolor (j_decompress_ptr cinfo)
 
 jinit_color_deconverter (j_decompress_ptr cinfo)
 

Variables

 Sorry
 

Macro Definition Documentation

◆ B_Y_OFF

#define B_Y_OFF   (2*(MAXJSAMPLE+1)) /* etc. */

Definition at line 110 of file jdcolor.c.

◆ FIX

#define FIX (   x)    ((INT32) ((x) * (1L<<SCALEBITS) + 0.5))

Definition at line 99 of file jdcolor.c.

◆ G_Y_OFF

#define G_Y_OFF   (1*(MAXJSAMPLE+1)) /* offset to G => Y section */

Definition at line 109 of file jdcolor.c.

◆ JPEG_INTERNALS

#define JPEG_INTERNALS

Definition at line 12 of file jdcolor.c.

◆ ONE_HALF

#define ONE_HALF   ((INT32) 1 << (SCALEBITS-1))

Definition at line 98 of file jdcolor.c.

◆ R_Y_OFF

#define R_Y_OFF   0 /* offset to R => Y section */

Definition at line 108 of file jdcolor.c.

◆ SCALEBITS

#define SCALEBITS   16 /* speediest right-shift on some machines */

Definition at line 97 of file jdcolor.c.

◆ TABLE_SIZE

#define TABLE_SIZE   (3*(MAXJSAMPLE+1))

Definition at line 111 of file jdcolor.c.

Typedef Documentation

◆ my_cconvert_ptr

Definition at line 38 of file jdcolor.c.

Function Documentation

◆ build_bg_ycc_rgb_table()

build_bg_ycc_rgb_table ( j_decompress_ptr  cinfo)

Definition at line 153 of file jdcolor.c.

155{
156 my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
157 int i;
158 INT32 x;
160
161 cconvert->Cr_r_tab = (int *) (*cinfo->mem->alloc_small)
162 ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(int));
163 cconvert->Cb_b_tab = (int *) (*cinfo->mem->alloc_small)
164 ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(int));
165 cconvert->Cr_g_tab = (INT32 *) (*cinfo->mem->alloc_small)
167 cconvert->Cb_g_tab = (INT32 *) (*cinfo->mem->alloc_small)
169
170 for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) {
171 /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */
172 /* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */
173 /* Cr=>R value is nearest int to 2.804 * x */
174 cconvert->Cr_r_tab[i] = (int) DESCALE(FIX(2.804) * x, SCALEBITS);
175 /* Cb=>B value is nearest int to 3.544 * x */
176 cconvert->Cb_b_tab[i] = (int) DESCALE(FIX(3.544) * x, SCALEBITS);
177 /* Cr=>G value is scaled-up -1.428272572 * x */
178 cconvert->Cr_g_tab[i] = (- FIX(1.428272572)) * x;
179 /* Cb=>G value is scaled-up -0.688272572 * x */
180 /* We also add in ONE_HALF so that need not do it in inner loop */
181 cconvert->Cb_g_tab[i] = (- FIX(0.688272572)) * x + ONE_HALF;
182 }
183}
signed int INT32
#define SIZEOF(_ar)
Definition: calc.h:97
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define SCALEBITS
Definition: jdcolor.c:97
#define FIX(x)
Definition: jdcolor.c:99
my_color_deconverter * my_cconvert_ptr
Definition: jdcolor.c:38
#define ONE_HALF
Definition: jdcolor.c:98
#define MAXJSAMPLE
Definition: jmorecfg.h:83
#define CENTERJSAMPLE
Definition: jmorecfg.h:84
#define SHIFT_TEMPS
Definition: jpegint.h:301
#define DESCALE(x, n)
Definition: jpegint.h:310
struct jpeg_common_struct * j_common_ptr
Definition: jpeglib.h:284
#define JPOOL_IMAGE
Definition: jpeglib.h:808
struct jpeg_color_deconverter * cconvert
Definition: jpeglib.h:687

Referenced by jinit_color_deconverter().

◆ build_rgb_y_table()

build_rgb_y_table ( j_decompress_ptr  cinfo)

Definition at line 249 of file jdcolor.c.

250{
251 my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
252 INT32 * rgb_y_tab;
253 INT32 i;
254
255 /* Allocate and fill in the conversion tables. */
256 cconvert->rgb_y_tab = rgb_y_tab = (INT32 *) (*cinfo->mem->alloc_small)
258
259 for (i = 0; i <= MAXJSAMPLE; i++) {
260 rgb_y_tab[i+R_Y_OFF] = FIX(0.299) * i;
261 rgb_y_tab[i+G_Y_OFF] = FIX(0.587) * i;
262 rgb_y_tab[i+B_Y_OFF] = FIX(0.114) * i + ONE_HALF;
263 }
264}
#define TABLE_SIZE
Definition: jdcolor.c:111
#define G_Y_OFF
Definition: jdcolor.c:109
#define R_Y_OFF
Definition: jdcolor.c:108
#define B_Y_OFF
Definition: jdcolor.c:110

Referenced by jinit_color_deconverter().

◆ build_ycc_rgb_table()

build_ycc_rgb_table ( j_decompress_ptr  cinfo)

Definition at line 119 of file jdcolor.c.

121{
122 my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
123 int i;
124 INT32 x;
126
127 cconvert->Cr_r_tab = (int *) (*cinfo->mem->alloc_small)
128 ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(int));
129 cconvert->Cb_b_tab = (int *) (*cinfo->mem->alloc_small)
130 ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(int));
131 cconvert->Cr_g_tab = (INT32 *) (*cinfo->mem->alloc_small)
133 cconvert->Cb_g_tab = (INT32 *) (*cinfo->mem->alloc_small)
135
136 for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) {
137 /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */
138 /* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */
139 /* Cr=>R value is nearest int to 1.402 * x */
140 cconvert->Cr_r_tab[i] = (int) DESCALE(FIX(1.402) * x, SCALEBITS);
141 /* Cb=>B value is nearest int to 1.772 * x */
142 cconvert->Cb_b_tab[i] = (int) DESCALE(FIX(1.772) * x, SCALEBITS);
143 /* Cr=>G value is scaled-up -0.714136286 * x */
144 cconvert->Cr_g_tab[i] = (- FIX(0.714136286)) * x;
145 /* Cb=>G value is scaled-up -0.344136286 * x */
146 /* We also add in ONE_HALF so that need not do it in inner loop */
147 cconvert->Cb_g_tab[i] = (- FIX(0.344136286)) * x + ONE_HALF;
148 }
149}

Referenced by jinit_color_deconverter().

◆ gray_rgb_convert()

gray_rgb_convert ( j_decompress_ptr  cinfo,
JSAMPIMAGE  input_buf,
JDIMENSION  input_row,
JSAMPARRAY  output_buf,
int  num_rows 
)

Definition at line 477 of file jdcolor.c.

480{
481 register JSAMPROW outptr;
482 register JSAMPROW inptr;
483 register JDIMENSION col;
485
486 while (--num_rows >= 0) {
487 inptr = input_buf[0][input_row++];
488 outptr = *output_buf++;
489 for (col = 0; col < num_cols; col++) {
490 /* We can dispense with GETJSAMPLE() here */
491 outptr[RGB_RED] = outptr[RGB_GREEN] = outptr[RGB_BLUE] = inptr[col];
492 outptr += RGB_PIXELSIZE;
493 }
494 }
495}
jpeg_component_info JCOEFPTR JSAMPARRAY output_buf
Definition: jdct.h:239
unsigned int JDIMENSION
Definition: jmorecfg.h:229
int JSAMPARRAY int int num_rows
Definition: jpegint.h:421
int JSAMPARRAY int int JDIMENSION num_cols
Definition: jpegint.h:421
JSAMPLE FAR * JSAMPROW
Definition: jpeglib.h:75
JDIMENSION output_width
Definition: jpeglib.h:507

Referenced by jinit_color_deconverter().

◆ grayscale_convert()

grayscale_convert ( j_decompress_ptr  cinfo,
JSAMPIMAGE  input_buf,
JDIMENSION  input_row,
JSAMPARRAY  output_buf,
int  num_rows 
)

Definition at line 461 of file jdcolor.c.

464{
465 jcopy_sample_rows(input_buf[0], (int) input_row, output_buf, 0,
466 num_rows, cinfo->output_width);
467}
jcopy_sample_rows(JSAMPARRAY input_array, int source_row, JSAMPARRAY output_array, int dest_row, int num_rows, JDIMENSION num_cols)
Definition: jutils.c:177

Referenced by jinit_color_deconverter().

◆ jinit_color_deconverter()

jinit_color_deconverter ( j_decompress_ptr  cinfo)

Definition at line 568 of file jdcolor.c.

569{
570 my_cconvert_ptr cconvert;
571 int ci;
572
573 cconvert = (my_cconvert_ptr) (*cinfo->mem->alloc_small)
575 cinfo->cconvert = &cconvert->pub;
576 cconvert->pub.start_pass = start_pass_dcolor;
577
578 /* Make sure num_components agrees with jpeg_color_space */
579 switch (cinfo->jpeg_color_space) {
580 case JCS_GRAYSCALE:
581 if (cinfo->num_components != 1)
582 ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
583 break;
584
585 case JCS_RGB:
586 case JCS_YCbCr:
587 case JCS_BG_RGB:
588 case JCS_BG_YCC:
589 if (cinfo->num_components != 3)
590 ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
591 break;
592
593 case JCS_CMYK:
594 case JCS_YCCK:
595 if (cinfo->num_components != 4)
596 ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
597 break;
598
599 default: /* JCS_UNKNOWN can be anything */
600 if (cinfo->num_components < 1)
601 ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
602 }
603
604 /* Support color transform only for RGB colorspaces */
605 if (cinfo->color_transform &&
606 cinfo->jpeg_color_space != JCS_RGB &&
608 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
609
610 /* Set out_color_components and conversion method based on requested space.
611 * Also clear the component_needed flags for any unused components,
612 * so that earlier pipeline stages can avoid useless computation.
613 */
614
615 switch (cinfo->out_color_space) {
616 case JCS_GRAYSCALE:
617 cinfo->out_color_components = 1;
618 switch (cinfo->jpeg_color_space) {
619 case JCS_GRAYSCALE:
620 case JCS_YCbCr:
621 case JCS_BG_YCC:
622 cconvert->pub.color_convert = grayscale_convert;
623 /* For color->grayscale conversion, only the Y (0) component is needed */
624 for (ci = 1; ci < cinfo->num_components; ci++)
625 cinfo->comp_info[ci].component_needed = FALSE;
626 break;
627 case JCS_RGB:
628 switch (cinfo->color_transform) {
629 case JCT_NONE:
630 cconvert->pub.color_convert = rgb_gray_convert;
631 break;
633 cconvert->pub.color_convert = rgb1_gray_convert;
634 break;
635 default:
636 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
637 }
638 build_rgb_y_table(cinfo);
639 break;
640 default:
641 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
642 }
643 break;
644
645 case JCS_RGB:
646 cinfo->out_color_components = RGB_PIXELSIZE;
647 switch (cinfo->jpeg_color_space) {
648 case JCS_GRAYSCALE:
649 cconvert->pub.color_convert = gray_rgb_convert;
650 break;
651 case JCS_YCbCr:
652 cconvert->pub.color_convert = ycc_rgb_convert;
653 build_ycc_rgb_table(cinfo);
654 break;
655 case JCS_BG_YCC:
656 cconvert->pub.color_convert = ycc_rgb_convert;
658 break;
659 case JCS_RGB:
660 switch (cinfo->color_transform) {
661 case JCT_NONE:
662 cconvert->pub.color_convert = rgb_convert;
663 break;
665 cconvert->pub.color_convert = rgb1_rgb_convert;
666 break;
667 default:
668 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
669 }
670 break;
671 default:
672 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
673 }
674 break;
675
676 case JCS_BG_RGB:
677 cinfo->out_color_components = RGB_PIXELSIZE;
678 if (cinfo->jpeg_color_space != JCS_BG_RGB)
679 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
680 switch (cinfo->color_transform) {
681 case JCT_NONE:
682 cconvert->pub.color_convert = rgb_convert;
683 break;
685 cconvert->pub.color_convert = rgb1_rgb_convert;
686 break;
687 default:
688 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
689 }
690 break;
691
692 case JCS_CMYK:
693 cinfo->out_color_components = 4;
694 switch (cinfo->jpeg_color_space) {
695 case JCS_YCCK:
696 cconvert->pub.color_convert = ycck_cmyk_convert;
697 build_ycc_rgb_table(cinfo);
698 break;
699 case JCS_CMYK:
700 cconvert->pub.color_convert = null_convert;
701 break;
702 default:
703 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
704 }
705 break;
706
707 default: /* permit null conversion to same output space */
708 if (cinfo->out_color_space != cinfo->jpeg_color_space)
709 /* unsupported non-null conversion */
710 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
711 cinfo->out_color_components = cinfo->num_components;
712 cconvert->pub.color_convert = null_convert;
713 }
714
715 if (cinfo->quantize_colors)
716 cinfo->output_components = 1; /* single colormapped output component */
717 else
719}
#define FALSE
Definition: types.h:117
switch(r->id)
Definition: btrfs.c:3046
rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
Definition: jdcolor.c:394
gray_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
Definition: jdcolor.c:477
ycck_cmyk_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
Definition: jdcolor.c:507
ycc_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
Definition: jdcolor.c:199
rgb_gray_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
Definition: jdcolor.c:272
grayscale_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
Definition: jdcolor.c:461
rgb1_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
Definition: jdcolor.c:313
rgb1_gray_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
Definition: jdcolor.c:351
build_rgb_y_table(j_decompress_ptr cinfo)
Definition: jdcolor.c:249
null_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
Definition: jdcolor.c:427
build_ycc_rgb_table(j_decompress_ptr cinfo)
Definition: jdcolor.c:119
build_bg_ycc_rgb_table(j_decompress_ptr cinfo)
Definition: jdcolor.c:153
start_pass_dcolor(j_decompress_ptr cinfo)
Definition: jdcolor.c:557
@ JCT_NONE
Definition: jpeglib.h:234
@ JCT_SUBTRACT_GREEN
Definition: jpeglib.h:235
@ JCS_YCCK
Definition: jpeglib.h:226
@ JCS_BG_RGB
Definition: jpeglib.h:227
@ JCS_BG_YCC
Definition: jpeglib.h:228
@ JCS_YCbCr
Definition: jpeglib.h:224
@ JCS_CMYK
Definition: jpeglib.h:225
@ JCS_GRAYSCALE
Definition: jpeglib.h:222
@ JCS_RGB
Definition: jpeglib.h:223
#define ERREXIT(msg)
Definition: rdjpgcom.c:72
boolean component_needed
Definition: jpeglib.h:174
boolean quantize_colors
Definition: jpeglib.h:491
J_COLOR_SPACE out_color_space
Definition: jpeglib.h:478
J_COLOR_TRANSFORM color_transform
Definition: jpeglib.h:609
J_COLOR_SPACE jpeg_color_space
Definition: jpeglib.h:471
jpeg_component_info * comp_info
Definition: jpeglib.h:583
struct jpeg_color_converter pub
Definition: jccolor.c:20

Referenced by master_selection().

◆ null_convert()

null_convert ( j_decompress_ptr  cinfo,
JSAMPIMAGE  input_buf,
JDIMENSION  input_row,
JSAMPARRAY  output_buf,
int  num_rows 
)

Definition at line 427 of file jdcolor.c.

430{
431 register JSAMPROW outptr;
432 register JSAMPROW inptr;
433 register JDIMENSION count;
434 register int num_comps = cinfo->num_components;
436 int ci;
437
438 while (--num_rows >= 0) {
439 /* It seems fastest to make a separate pass for each component. */
440 for (ci = 0; ci < num_comps; ci++) {
441 inptr = input_buf[ci][input_row];
442 outptr = output_buf[0] + ci;
443 for (count = num_cols; count > 0; count--) {
444 *outptr = *inptr++; /* don't need GETJSAMPLE() here */
445 outptr += num_comps;
446 }
447 }
448 input_row++;
449 output_buf++;
450 }
451}
GLuint GLuint GLsizei count
Definition: gl.h:1545

Referenced by jinit_color_deconverter().

◆ rgb1_gray_convert()

rgb1_gray_convert ( j_decompress_ptr  cinfo,
JSAMPIMAGE  input_buf,
JDIMENSION  input_row,
JSAMPARRAY  output_buf,
int  num_rows 
)

Definition at line 351 of file jdcolor.c.

354{
355 my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
356 register int r, g, b;
357 register INT32 * ctab = cconvert->rgb_y_tab;
358 register JSAMPROW outptr;
359 register JSAMPROW inptr0, inptr1, inptr2;
360 register JDIMENSION col;
362
363 while (--num_rows >= 0) {
364 inptr0 = input_buf[0][input_row];
365 inptr1 = input_buf[1][input_row];
366 inptr2 = input_buf[2][input_row];
367 input_row++;
368 outptr = *output_buf++;
369 for (col = 0; col < num_cols; col++) {
370 r = GETJSAMPLE(inptr0[col]);
371 g = GETJSAMPLE(inptr1[col]);
372 b = GETJSAMPLE(inptr2[col]);
373 /* Assume that MAXJSAMPLE+1 is a power of 2, so that the MOD
374 * (modulo) operator is equivalent to the bitmask operator AND.
375 */
376 r = (r + g - CENTERJSAMPLE) & MAXJSAMPLE;
377 b = (b + g - CENTERJSAMPLE) & MAXJSAMPLE;
378 /* Y */
379 outptr[col] = (JSAMPLE)
380 ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
381 >> SCALEBITS);
382 }
383 }
384}
while(CdLookupNextInitialFileDirent(IrpContext, Fcb, FileContext))
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean g
Definition: glext.h:6204
char JSAMPLE
Definition: jmorecfg.h:74
#define GETJSAMPLE(value)
Definition: jmorecfg.h:78

Referenced by jinit_color_deconverter().

◆ rgb1_rgb_convert()

rgb1_rgb_convert ( j_decompress_ptr  cinfo,
JSAMPIMAGE  input_buf,
JDIMENSION  input_row,
JSAMPARRAY  output_buf,
int  num_rows 
)

Definition at line 313 of file jdcolor.c.

316{
317 register int r, g, b;
318 register JSAMPROW outptr;
319 register JSAMPROW inptr0, inptr1, inptr2;
320 register JDIMENSION col;
322
323 while (--num_rows >= 0) {
324 inptr0 = input_buf[0][input_row];
325 inptr1 = input_buf[1][input_row];
326 inptr2 = input_buf[2][input_row];
327 input_row++;
328 outptr = *output_buf++;
329 for (col = 0; col < num_cols; col++) {
330 r = GETJSAMPLE(inptr0[col]);
331 g = GETJSAMPLE(inptr1[col]);
332 b = GETJSAMPLE(inptr2[col]);
333 /* Assume that MAXJSAMPLE+1 is a power of 2, so that the MOD
334 * (modulo) operator is equivalent to the bitmask operator AND.
335 */
336 outptr[RGB_RED] = (JSAMPLE) ((r + g - CENTERJSAMPLE) & MAXJSAMPLE);
337 outptr[RGB_GREEN] = (JSAMPLE) g;
338 outptr[RGB_BLUE] = (JSAMPLE) ((b + g - CENTERJSAMPLE) & MAXJSAMPLE);
339 outptr += RGB_PIXELSIZE;
340 }
341 }
342}
#define b
Definition: ke_i.h:79

Referenced by jinit_color_deconverter().

◆ rgb_convert()

rgb_convert ( j_decompress_ptr  cinfo,
JSAMPIMAGE  input_buf,
JDIMENSION  input_row,
JSAMPARRAY  output_buf,
int  num_rows 
)

Definition at line 394 of file jdcolor.c.

397{
398 register JSAMPROW outptr;
399 register JSAMPROW inptr0, inptr1, inptr2;
400 register JDIMENSION col;
402
403 while (--num_rows >= 0) {
404 inptr0 = input_buf[0][input_row];
405 inptr1 = input_buf[1][input_row];
406 inptr2 = input_buf[2][input_row];
407 input_row++;
408 outptr = *output_buf++;
409 for (col = 0; col < num_cols; col++) {
410 /* We can dispense with GETJSAMPLE() here */
411 outptr[RGB_RED] = inptr0[col];
412 outptr[RGB_GREEN] = inptr1[col];
413 outptr[RGB_BLUE] = inptr2[col];
414 outptr += RGB_PIXELSIZE;
415 }
416 }
417}

Referenced by jinit_color_deconverter().

◆ rgb_gray_convert()

rgb_gray_convert ( j_decompress_ptr  cinfo,
JSAMPIMAGE  input_buf,
JDIMENSION  input_row,
JSAMPARRAY  output_buf,
int  num_rows 
)

Definition at line 272 of file jdcolor.c.

275{
276 my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
277 register int r, g, b;
278 register INT32 * ctab = cconvert->rgb_y_tab;
279 register JSAMPROW outptr;
280 register JSAMPROW inptr0, inptr1, inptr2;
281 register JDIMENSION col;
283
284 while (--num_rows >= 0) {
285 inptr0 = input_buf[0][input_row];
286 inptr1 = input_buf[1][input_row];
287 inptr2 = input_buf[2][input_row];
288 input_row++;
289 outptr = *output_buf++;
290 for (col = 0; col < num_cols; col++) {
291 r = GETJSAMPLE(inptr0[col]);
292 g = GETJSAMPLE(inptr1[col]);
293 b = GETJSAMPLE(inptr2[col]);
294 /* Y */
295 outptr[col] = (JSAMPLE)
296 ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
297 >> SCALEBITS);
298 }
299 }
300}

Referenced by jinit_color_deconverter().

◆ start_pass_dcolor()

start_pass_dcolor ( j_decompress_ptr  cinfo)

Definition at line 557 of file jdcolor.c.

558{
559 /* no work needed */
560}

Referenced by jinit_color_deconverter().

◆ ycc_rgb_convert()

ycc_rgb_convert ( j_decompress_ptr  cinfo,
JSAMPIMAGE  input_buf,
JDIMENSION  input_row,
JSAMPARRAY  output_buf,
int  num_rows 
)

Definition at line 199 of file jdcolor.c.

202{
203 my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
204 register int y, cb, cr;
205 register JSAMPROW outptr;
206 register JSAMPROW inptr0, inptr1, inptr2;
207 register JDIMENSION col;
209 /* copy these pointers into registers if possible */
210 register JSAMPLE * range_limit = cinfo->sample_range_limit;
211 register int * Crrtab = cconvert->Cr_r_tab;
212 register int * Cbbtab = cconvert->Cb_b_tab;
213 register INT32 * Crgtab = cconvert->Cr_g_tab;
214 register INT32 * Cbgtab = cconvert->Cb_g_tab;
216
217 while (--num_rows >= 0) {
218 inptr0 = input_buf[0][input_row];
219 inptr1 = input_buf[1][input_row];
220 inptr2 = input_buf[2][input_row];
221 input_row++;
222 outptr = *output_buf++;
223 for (col = 0; col < num_cols; col++) {
224 y = GETJSAMPLE(inptr0[col]);
225 cb = GETJSAMPLE(inptr1[col]);
226 cr = GETJSAMPLE(inptr2[col]);
227 /* Range-limiting is essential due to noise introduced by DCT losses,
228 * for extended gamut (sYCC) and wide gamut (bg-sYCC) encodings.
229 */
230 outptr[RGB_RED] = range_limit[y + Crrtab[cr]];
231 outptr[RGB_GREEN] = range_limit[y +
232 ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
233 SCALEBITS))];
234 outptr[RGB_BLUE] = range_limit[y + Cbbtab[cb]];
235 outptr += RGB_PIXELSIZE;
236 }
237 }
238}
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define RIGHT_SHIFT(x, shft)
Definition: jpegint.h:302
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
JSAMPLE * sample_range_limit
Definition: jpeglib.h:642

Referenced by jinit_color_deconverter().

◆ ycck_cmyk_convert()

ycck_cmyk_convert ( j_decompress_ptr  cinfo,
JSAMPIMAGE  input_buf,
JDIMENSION  input_row,
JSAMPARRAY  output_buf,
int  num_rows 
)

Definition at line 507 of file jdcolor.c.

510{
511 my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
512 register int y, cb, cr;
513 register JSAMPROW outptr;
514 register JSAMPROW inptr0, inptr1, inptr2, inptr3;
515 register JDIMENSION col;
517 /* copy these pointers into registers if possible */
518 register JSAMPLE * range_limit = cinfo->sample_range_limit;
519 register int * Crrtab = cconvert->Cr_r_tab;
520 register int * Cbbtab = cconvert->Cb_b_tab;
521 register INT32 * Crgtab = cconvert->Cr_g_tab;
522 register INT32 * Cbgtab = cconvert->Cb_g_tab;
524
525 while (--num_rows >= 0) {
526 inptr0 = input_buf[0][input_row];
527 inptr1 = input_buf[1][input_row];
528 inptr2 = input_buf[2][input_row];
529 inptr3 = input_buf[3][input_row];
530 input_row++;
531 outptr = *output_buf++;
532 for (col = 0; col < num_cols; col++) {
533 y = GETJSAMPLE(inptr0[col]);
534 cb = GETJSAMPLE(inptr1[col]);
535 cr = GETJSAMPLE(inptr2[col]);
536 /* Range-limiting is essential due to noise introduced by DCT losses,
537 * and for extended gamut encodings (sYCC).
538 */
539 outptr[0] = range_limit[MAXJSAMPLE - (y + Crrtab[cr])]; /* red */
540 outptr[1] = range_limit[MAXJSAMPLE - (y + /* green */
541 ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
542 SCALEBITS)))];
543 outptr[2] = range_limit[MAXJSAMPLE - (y + Cbbtab[cb])]; /* blue */
544 /* K passes through unchanged */
545 outptr[3] = inptr3[col]; /* don't need GETJSAMPLE here */
546 outptr += 4;
547 }
548 }
549}

Referenced by jinit_color_deconverter().

Variable Documentation

◆ Sorry

Sorry

Definition at line 19 of file jdcolor.c.