ReactOS 0.4.16-dev-2613-g9533ad7
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))
 

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)
 
 cmyk_yk_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

◆ FIX

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

Definition at line 101 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 100 of file jdcolor.c.

◆ SCALEBITS

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

Definition at line 99 of file jdcolor.c.

Typedef Documentation

◆ my_cconvert_ptr

Definition at line 40 of file jdcolor.c.

Function Documentation

◆ build_bg_ycc_rgb_table()

build_bg_ycc_rgb_table ( j_decompress_ptr  cinfo)

Definition at line 143 of file jdcolor.c.

145{
146 my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
147 int i;
148 INT32 x;
150
151 cconvert->Cr_r_tab = (int *) (*cinfo->mem->alloc_small)
152 ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(int));
153 cconvert->Cb_b_tab = (int *) (*cinfo->mem->alloc_small)
154 ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(int));
155 cconvert->Cr_g_tab = (INT32 *) (*cinfo->mem->alloc_small)
157 cconvert->Cb_g_tab = (INT32 *) (*cinfo->mem->alloc_small)
159
160 for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) {
161 /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */
162 /* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */
163 /* Cr=>R value is nearest int to 2.804 * x */
164 cconvert->Cr_r_tab[i] = (int) DESCALE(FIX(2.804) * x, SCALEBITS);
165 /* Cb=>B value is nearest int to 3.544 * x */
166 cconvert->Cb_b_tab[i] = (int) DESCALE(FIX(3.544) * x, SCALEBITS);
167 /* Cr=>G value is scaled-up -1.428272572 * x */
168 cconvert->Cr_g_tab[i] = (- FIX(1.428272572)) * x;
169 /* Cb=>G value is scaled-up -0.688272572 * x */
170 /* We also add in ONE_HALF so that need not do it in inner loop */
171 cconvert->Cb_g_tab[i] = (- FIX(0.688272572)) * x + ONE_HALF;
172 }
173}
#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:99
#define FIX(x)
Definition: jdcolor.c:101
my_color_deconverter * my_cconvert_ptr
Definition: jdcolor.c:40
#define ONE_HALF
Definition: jdcolor.c:100
#define MAXJSAMPLE
Definition: jmorecfg.h:119
#define CENTERJSAMPLE
Definition: jmorecfg.h:120
#define SHIFT_TEMPS
Definition: jpegint.h:300
#define DESCALE(x, n)
Definition: jpegint.h:309
struct jpeg_common_struct * j_common_ptr
Definition: jpeglib.h:284
#define JPOOL_IMAGE
Definition: jpeglib.h:810
struct jpeg_color_deconverter * cconvert
Definition: jpeglib.h:689
int32_t INT32
Definition: typedefs.h:58

Referenced by jinit_color_deconverter().

◆ build_rgb_y_table()

build_rgb_y_table ( j_decompress_ptr  cinfo)

Definition at line 239 of file jdcolor.c.

240{
241 my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
242 INT32 i;
243
244 cconvert->R_y_tab = (INT32 *) (*cinfo->mem->alloc_small)
246 cconvert->G_y_tab = (INT32 *) (*cinfo->mem->alloc_small)
248 cconvert->B_y_tab = (INT32 *) (*cinfo->mem->alloc_small)
250
251 for (i = 0; i <= MAXJSAMPLE; i++) {
252 cconvert->R_y_tab[i] = FIX(0.299) * i;
253 cconvert->G_y_tab[i] = FIX(0.587) * i;
254 cconvert->B_y_tab[i] = FIX(0.114) * i + ONE_HALF;
255 }
256}

Referenced by jinit_color_deconverter().

◆ build_ycc_rgb_table()

build_ycc_rgb_table ( j_decompress_ptr  cinfo)

Definition at line 109 of file jdcolor.c.

111{
112 my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
113 int i;
114 INT32 x;
116
117 cconvert->Cr_r_tab = (int *) (*cinfo->mem->alloc_small)
118 ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(int));
119 cconvert->Cb_b_tab = (int *) (*cinfo->mem->alloc_small)
120 ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(int));
121 cconvert->Cr_g_tab = (INT32 *) (*cinfo->mem->alloc_small)
123 cconvert->Cb_g_tab = (INT32 *) (*cinfo->mem->alloc_small)
125
126 for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) {
127 /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */
128 /* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */
129 /* Cr=>R value is nearest int to 1.402 * x */
130 cconvert->Cr_r_tab[i] = (int) DESCALE(FIX(1.402) * x, SCALEBITS);
131 /* Cb=>B value is nearest int to 1.772 * x */
132 cconvert->Cb_b_tab[i] = (int) DESCALE(FIX(1.772) * x, SCALEBITS);
133 /* Cr=>G value is scaled-up -0.714136286 * x */
134 cconvert->Cr_g_tab[i] = (- FIX(0.714136286)) * x;
135 /* Cb=>G value is scaled-up -0.344136286 * x */
136 /* We also add in ONE_HALF so that need not do it in inner loop */
137 cconvert->Cb_g_tab[i] = (- FIX(0.344136286)) * x + ONE_HALF;
138 }
139}

Referenced by jinit_color_deconverter().

◆ cmyk_yk_convert()

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

Definition at line 555 of file jdcolor.c.

558{
559 my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
560 register INT32 y;
561 register INT32 * Rytab = cconvert->R_y_tab;
562 register INT32 * Gytab = cconvert->G_y_tab;
563 register INT32 * Bytab = cconvert->B_y_tab;
564 register JSAMPROW outptr;
565 register JSAMPROW inptr0, inptr1, inptr2, inptr3;
566 register JDIMENSION col;
568
569 while (--num_rows >= 0) {
570 inptr0 = input_buf[0][input_row];
571 inptr1 = input_buf[1][input_row];
572 inptr2 = input_buf[2][input_row];
573 inptr3 = input_buf[3][input_row];
574 input_row++;
575 outptr = *output_buf++;
576 for (col = 0; col < num_cols; col++) {
577 y = Rytab[MAXJSAMPLE - GETJSAMPLE(inptr0[col])];
578 y += Gytab[MAXJSAMPLE - GETJSAMPLE(inptr1[col])];
579 y += Bytab[MAXJSAMPLE - GETJSAMPLE(inptr2[col])];
580 outptr[0] = (JSAMPLE) (y >> SCALEBITS);
581 /* K passes through unchanged */
582 outptr[1] = inptr3[col]; /* don't need GETJSAMPLE here */
583 outptr += 2;
584 }
585 }
586}
while(CdLookupNextInitialFileDirent(IrpContext, Fcb, FileContext))
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
jpeg_component_info JCOEFPTR JSAMPARRAY output_buf
Definition: jdct.h:253
unsigned int JDIMENSION
Definition: jmorecfg.h:265
char JSAMPLE
Definition: jmorecfg.h:110
#define GETJSAMPLE(value)
Definition: jmorecfg.h:114
JSAMPARRAY int JDIMENSION num_cols
Definition: jpegint.h:420
JSAMPARRAY int num_rows
Definition: jpegint.h:420
JSAMPLE FAR * JSAMPROW
Definition: jpeglib.h:75
JDIMENSION output_width
Definition: jpeglib.h:508

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 474 of file jdcolor.c.

477{
478 register JSAMPROW outptr;
479 register JSAMPROW inptr;
480 register JDIMENSION col;
482
483 while (--num_rows >= 0) {
484 inptr = input_buf[0][input_row++];
485 outptr = *output_buf++;
486 for (col = 0; col < num_cols; col++) {
487 /* We can dispense with GETJSAMPLE() here */
488 outptr[RGB_RED] = outptr[RGB_GREEN] = outptr[RGB_BLUE] = inptr[col];
489 outptr += RGB_PIXELSIZE;
490 }
491 }
492}

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 458 of file jdcolor.c.

461{
462 jcopy_sample_rows(input_buf[0] + input_row, output_buf,
463 num_rows, cinfo->output_width);
464}
jcopy_sample_rows(JSAMPARRAY input_array, JSAMPARRAY output_array, 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 605 of file jdcolor.c.

606{
607 my_cconvert_ptr cconvert;
608 int ci, i;
609
610 cconvert = (my_cconvert_ptr) (*cinfo->mem->alloc_small)
612 cinfo->cconvert = &cconvert->pub;
613 cconvert->pub.start_pass = start_pass_dcolor;
614
615 /* Make sure num_components agrees with jpeg_color_space */
616 switch (cinfo->jpeg_color_space) {
617 case JCS_GRAYSCALE:
618 if (cinfo->num_components != 1)
619 ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
620 break;
621
622 case JCS_RGB:
623 case JCS_YCbCr:
624 case JCS_BG_RGB:
625 case JCS_BG_YCC:
626 if (cinfo->num_components != 3)
627 ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
628 break;
629
630 case JCS_CMYK:
631 case JCS_YCCK:
632 if (cinfo->num_components != 4)
633 ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
634 break;
635
636 default: /* JCS_UNKNOWN can be anything */
637 if (cinfo->num_components < 1)
638 ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
639 }
640
641 /* Support color transform only for RGB colorspaces */
642 if (cinfo->color_transform &&
643 (cinfo->LSE_maxtrans != MAXJSAMPLE ||
644 (cinfo->jpeg_color_space != JCS_RGB &&
645 cinfo->jpeg_color_space != JCS_BG_RGB)))
646 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
647
648 /* Set out_color_components and conversion method based on requested space.
649 * Also adjust the component_needed flags for any unused components,
650 * so that earlier pipeline stages can avoid useless computation.
651 */
652
653 switch (cinfo->out_color_space) {
654 case JCS_GRAYSCALE:
655 cinfo->out_color_components = 1;
656 switch (cinfo->jpeg_color_space) {
657 case JCS_GRAYSCALE:
658 case JCS_YCbCr:
659 case JCS_BG_YCC:
660 cconvert->pub.color_convert = grayscale_convert;
661 /* For color->grayscale conversion, only the Y (0) component is needed */
662 for (ci = 1; ci < cinfo->num_components; ci++)
663 cinfo->comp_info[ci].component_needed = FALSE;
664 break;
665 case JCS_RGB:
666 switch (cinfo->color_transform) {
667 case JCT_NONE:
668 cconvert->pub.color_convert = rgb_gray_convert;
669 break;
671 cconvert->pub.color_convert = rgb1_gray_convert;
672 break;
673 default:
674 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
675 }
676 build_rgb_y_table(cinfo);
677 break;
678 default:
679 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
680 }
681 break;
682
683 case JCS_RGB:
684 cinfo->out_color_components = RGB_PIXELSIZE;
685 switch (cinfo->jpeg_color_space) {
686 case JCS_GRAYSCALE:
687 cconvert->pub.color_convert = gray_rgb_convert;
688 break;
689 case JCS_YCbCr:
690 cconvert->pub.color_convert = ycc_rgb_convert;
691 build_ycc_rgb_table(cinfo);
692 break;
693 case JCS_BG_YCC:
694 cconvert->pub.color_convert = ycc_rgb_convert;
696 break;
697 case JCS_RGB:
698 switch (cinfo->color_transform) {
699 case JCT_NONE:
700 cconvert->pub.color_convert = rgb_convert;
701 break;
703 cconvert->pub.color_convert = rgb1_rgb_convert;
704 break;
705 default:
706 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
707 }
708 break;
709 default:
710 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
711 }
712 break;
713
714 case JCS_BG_RGB:
715 if (cinfo->jpeg_color_space != JCS_BG_RGB)
716 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
717 cinfo->out_color_components = RGB_PIXELSIZE;
718 switch (cinfo->color_transform) {
719 case JCT_NONE:
720 cconvert->pub.color_convert = rgb_convert;
721 break;
723 cconvert->pub.color_convert = rgb1_rgb_convert;
724 break;
725 default:
726 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
727 }
728 break;
729
730 case JCS_CMYK:
731 if (cinfo->jpeg_color_space != JCS_YCCK)
732 goto def_label;
733 cinfo->out_color_components = 4;
734 cconvert->pub.color_convert = ycck_cmyk_convert;
735 build_ycc_rgb_table(cinfo);
736 break;
737
738 case JCS_YCCK:
739 if (cinfo->jpeg_color_space != JCS_CMYK ||
740 /* Support only YK part of YCCK for colorless output */
741 ! cinfo->comp_info[0].component_needed ||
742 cinfo->comp_info[1].component_needed ||
743 cinfo->comp_info[2].component_needed ||
744 ! cinfo->comp_info[3].component_needed)
745 goto def_label;
746 cinfo->out_color_components = 2;
747 /* Need all components on input side */
748 cinfo->comp_info[1].component_needed = TRUE;
749 cinfo->comp_info[2].component_needed = TRUE;
750 cconvert->pub.color_convert = cmyk_yk_convert;
751 build_rgb_y_table(cinfo);
752 break;
753
754 default: def_label: /* permit null conversion to same output space */
755 if (cinfo->out_color_space != cinfo->jpeg_color_space)
756 /* unsupported non-null conversion */
757 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
758 i = 0;
759 for (ci = 0; ci < cinfo->num_components; ci++)
760 if (cinfo->comp_info[ci].component_needed)
761 i++; /* count output color components */
762 cinfo->out_color_components = i;
763 cconvert->pub.color_convert = null_convert;
764 }
765
766 if (cinfo->quantize_colors)
767 cinfo->output_components = 1; /* single colormapped output component */
768 else
770}
#define TRUE
Definition: types.h:120
#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:386
gray_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
Definition: jdcolor.c:474
ycck_cmyk_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
Definition: jdcolor.c:504
ycc_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
Definition: jdcolor.c:189
rgb_gray_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
Definition: jdcolor.c:264
grayscale_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
Definition: jdcolor.c:458
rgb1_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
Definition: jdcolor.c:304
rgb1_gray_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
Definition: jdcolor.c:342
build_rgb_y_table(j_decompress_ptr cinfo)
Definition: jdcolor.c:239
null_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
Definition: jdcolor.c:419
build_ycc_rgb_table(j_decompress_ptr cinfo)
Definition: jdcolor.c:109
build_bg_ycc_rgb_table(j_decompress_ptr cinfo)
Definition: jdcolor.c:143
cmyk_yk_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
Definition: jdcolor.c:555
start_pass_dcolor(j_decompress_ptr cinfo)
Definition: jdcolor.c:594
@ 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:492
J_COLOR_SPACE out_color_space
Definition: jpeglib.h:479
J_COLOR_TRANSFORM color_transform
Definition: jpeglib.h:611
J_COLOR_SPACE jpeg_color_space
Definition: jpeglib.h:472
jpeg_component_info * comp_info
Definition: jpeglib.h:584
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 419 of file jdcolor.c.

422{
423 register JSAMPROW outptr;
424 register JSAMPROW inptr;
425 register JDIMENSION count;
426 register int out_comps = cinfo->out_color_components;
428 JSAMPROW startptr;
429 int ci;
431
432 while (--num_rows >= 0) {
433 /* It seems fastest to make a separate pass for each component. */
434 startptr = *output_buf++;
435 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
436 ci++, compptr++) {
438 continue; /* skip uninteresting component */
439 inptr = input_buf[ci][input_row];
440 outptr = startptr++;
441 for (count = num_cols; count > 0; count--) {
442 *outptr = *inptr++; /* don't need GETJSAMPLE() here */
443 outptr += out_comps;
444 }
445 }
446 input_row++;
447 }
448}
GLuint GLuint GLsizei count
Definition: gl.h:1545
jpeg_component_info * compptr
Definition: jdct.h:252

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 342 of file jdcolor.c.

345{
346 my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
347 register int r, g, b;
348 register INT32 y;
349 register INT32 * Rytab = cconvert->R_y_tab;
350 register INT32 * Gytab = cconvert->G_y_tab;
351 register INT32 * Bytab = cconvert->B_y_tab;
352 register JSAMPROW outptr;
353 register JSAMPROW inptr0, inptr1, inptr2;
354 register JDIMENSION col;
356
357 while (--num_rows >= 0) {
358 inptr0 = input_buf[0][input_row];
359 inptr1 = input_buf[1][input_row];
360 inptr2 = input_buf[2][input_row];
361 input_row++;
362 outptr = *output_buf++;
363 for (col = 0; col < num_cols; col++) {
364 r = GETJSAMPLE(inptr0[col]);
365 g = GETJSAMPLE(inptr1[col]);
366 b = GETJSAMPLE(inptr2[col]);
367 /* Assume that MAXJSAMPLE+1 is a power of 2, so that the MOD
368 * (modulo) operator is equivalent to the bitmask operator AND.
369 */
370 y = Rytab[(r + g - CENTERJSAMPLE) & MAXJSAMPLE];
371 y += Gytab[g];
372 y += Bytab[(b + g - CENTERJSAMPLE) & MAXJSAMPLE];
373 outptr[col] = (JSAMPLE) (y >> SCALEBITS);
374 }
375 }
376}
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean g
Definition: glext.h:6204

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 304 of file jdcolor.c.

307{
308 register int r, g, b;
309 register JSAMPROW outptr;
310 register JSAMPROW inptr0, inptr1, inptr2;
311 register JDIMENSION col;
313
314 while (--num_rows >= 0) {
315 inptr0 = input_buf[0][input_row];
316 inptr1 = input_buf[1][input_row];
317 inptr2 = input_buf[2][input_row];
318 input_row++;
319 outptr = *output_buf++;
320 for (col = 0; col < num_cols; col++) {
321 r = GETJSAMPLE(inptr0[col]);
322 g = GETJSAMPLE(inptr1[col]);
323 b = GETJSAMPLE(inptr2[col]);
324 /* Assume that MAXJSAMPLE+1 is a power of 2, so that the MOD
325 * (modulo) operator is equivalent to the bitmask operator AND.
326 */
327 outptr[RGB_RED] = (JSAMPLE) ((r + g - CENTERJSAMPLE) & MAXJSAMPLE);
328 outptr[RGB_GREEN] = (JSAMPLE) g;
329 outptr[RGB_BLUE] = (JSAMPLE) ((b + g - CENTERJSAMPLE) & MAXJSAMPLE);
330 outptr += RGB_PIXELSIZE;
331 }
332 }
333}
#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 386 of file jdcolor.c.

389{
390 register JSAMPROW outptr;
391 register JSAMPROW inptr0, inptr1, inptr2;
392 register JDIMENSION col;
394
395 while (--num_rows >= 0) {
396 inptr0 = input_buf[0][input_row];
397 inptr1 = input_buf[1][input_row];
398 inptr2 = input_buf[2][input_row];
399 input_row++;
400 outptr = *output_buf++;
401 for (col = 0; col < num_cols; col++) {
402 /* We can dispense with GETJSAMPLE() here */
403 outptr[RGB_RED] = inptr0[col];
404 outptr[RGB_GREEN] = inptr1[col];
405 outptr[RGB_BLUE] = inptr2[col];
406 outptr += RGB_PIXELSIZE;
407 }
408 }
409}

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 264 of file jdcolor.c.

267{
268 my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
269 register INT32 y;
270 register INT32 * Rytab = cconvert->R_y_tab;
271 register INT32 * Gytab = cconvert->G_y_tab;
272 register INT32 * Bytab = cconvert->B_y_tab;
273 register JSAMPROW outptr;
274 register JSAMPROW inptr0, inptr1, inptr2;
275 register JDIMENSION col;
277
278 while (--num_rows >= 0) {
279 inptr0 = input_buf[0][input_row];
280 inptr1 = input_buf[1][input_row];
281 inptr2 = input_buf[2][input_row];
282 input_row++;
283 outptr = *output_buf++;
284 for (col = 0; col < num_cols; col++) {
285 y = Rytab[GETJSAMPLE(inptr0[col])];
286 y += Gytab[GETJSAMPLE(inptr1[col])];
287 y += Bytab[GETJSAMPLE(inptr2[col])];
288 outptr[col] = (JSAMPLE) (y >> SCALEBITS);
289 }
290 }
291}

Referenced by jinit_color_deconverter().

◆ start_pass_dcolor()

start_pass_dcolor ( j_decompress_ptr  cinfo)

Definition at line 594 of file jdcolor.c.

595{
596 /* no work needed */
597}

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 189 of file jdcolor.c.

192{
193 my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
194 register int y, cb, cr;
195 register JSAMPROW outptr;
196 register JSAMPROW inptr0, inptr1, inptr2;
197 register JDIMENSION col;
199 /* copy these pointers into registers if possible */
200 register JSAMPLE * range_limit = cinfo->sample_range_limit;
201 register int * Crrtab = cconvert->Cr_r_tab;
202 register int * Cbbtab = cconvert->Cb_b_tab;
203 register INT32 * Crgtab = cconvert->Cr_g_tab;
204 register INT32 * Cbgtab = cconvert->Cb_g_tab;
206
207 while (--num_rows >= 0) {
208 inptr0 = input_buf[0][input_row];
209 inptr1 = input_buf[1][input_row];
210 inptr2 = input_buf[2][input_row];
211 input_row++;
212 outptr = *output_buf++;
213 for (col = 0; col < num_cols; col++) {
214 y = GETJSAMPLE(inptr0[col]);
215 cb = GETJSAMPLE(inptr1[col]);
216 cr = GETJSAMPLE(inptr2[col]);
217 /* Range-limiting is essential due to noise introduced by DCT losses,
218 * for extended gamut (sYCC) and wide gamut (bg-sYCC) encodings.
219 */
220 outptr[RGB_RED] = range_limit[y + Crrtab[cr]];
221 outptr[RGB_GREEN] = range_limit[y +
222 ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
223 SCALEBITS))];
224 outptr[RGB_BLUE] = range_limit[y + Cbbtab[cb]];
225 outptr += RGB_PIXELSIZE;
226 }
227 }
228}
static MonoProfilerRuntimeShutdownBeginCallback cb
Definition: metahost.c:118
#define RIGHT_SHIFT(x, shft)
Definition: jpegint.h:301
JSAMPLE * sample_range_limit
Definition: jpeglib.h:644

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 504 of file jdcolor.c.

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

Referenced by jinit_color_deconverter().

Variable Documentation

◆ Sorry

Sorry

Definition at line 19 of file jdcolor.c.