GFXprim
2D bitmap graphics library with emphasis on speed and correctness
Loading...
Searching...
No Matches
gp_gamma_correction.gen.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.1-or-later
2/*
3 * gp_gamma_correction.gen.h
4 *
5 * GENERATED on 2024 06 04 21:38:34 from gp_gamma_correction.gen.h.t
6 *
7 * DO NOT MODIFY THIS FILE DIRECTLY!
8 */
9#ifndef GP_GAMMA_CORRECTION_GEN_H
10#define GP_GAMMA_CORRECTION_GEN_H
11
16/*
17 * Copyright (C) 2012-2024 Cyril Hrubis <metan@ucw.cz>
18 */
19
35#define GP_PIXEL_CREATE_RGB101010_ENC(R, G, B, R_gamma_enc, G_gamma_enc, B_gamma_enc) \
36 (0\
37 + ((R_gamma_enc ? R_gamma_enc[(R)] : R) << 20) \
38 + ((G_gamma_enc ? G_gamma_enc[(G)] : G) << 10) \
39 + ((B_gamma_enc ? B_gamma_enc[(B)] : B) << 0) \
40 )
50#define GP_PIXEL_GET_R_RGB101010_LIN(p, gamma_lin) ( \
51 gamma_lin ? gamma_lin[GP_PIXEL_GET_R_RGB101010(p)] : \
52 GP_PIXEL_GET_R_RGB101010(p) \
53)
54
61#define GP_CHAN_TO_LIN_TBL_RGB101010_R(pixmap) \
62 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? (pixmap)->gamma->lin[0]->u16 : NULL)
63
72#define GP_CHAN_LIN_MAX_VAL_RGB101010_R(pixmap) \
73 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? 4095 : 1023)
74
81#define GP_CHAN_TO_ENC_TBL_RGB101010_R(pixmap) \
82 (((pixmap)->gamma && (pixmap)->gamma->enc[0]) ? (pixmap)->gamma->enc[0]->u16 : NULL)
83
93#define GP_PIXEL_GET_G_RGB101010_LIN(p, gamma_lin) ( \
94 gamma_lin ? gamma_lin[GP_PIXEL_GET_G_RGB101010(p)] : \
95 GP_PIXEL_GET_G_RGB101010(p) \
96)
97
104#define GP_CHAN_TO_LIN_TBL_RGB101010_G(pixmap) \
105 (((pixmap)->gamma && (pixmap)->gamma->lin[1]) ? (pixmap)->gamma->lin[1]->u16 : NULL)
106
115#define GP_CHAN_LIN_MAX_VAL_RGB101010_G(pixmap) \
116 (((pixmap)->gamma && (pixmap)->gamma->lin[1]) ? 4095 : 1023)
117
124#define GP_CHAN_TO_ENC_TBL_RGB101010_G(pixmap) \
125 (((pixmap)->gamma && (pixmap)->gamma->enc[1]) ? (pixmap)->gamma->enc[1]->u16 : NULL)
126
136#define GP_PIXEL_GET_B_RGB101010_LIN(p, gamma_lin) ( \
137 gamma_lin ? gamma_lin[GP_PIXEL_GET_B_RGB101010(p)] : \
138 GP_PIXEL_GET_B_RGB101010(p) \
139)
140
147#define GP_CHAN_TO_LIN_TBL_RGB101010_B(pixmap) \
148 (((pixmap)->gamma && (pixmap)->gamma->lin[2]) ? (pixmap)->gamma->lin[2]->u16 : NULL)
149
158#define GP_CHAN_LIN_MAX_VAL_RGB101010_B(pixmap) \
159 (((pixmap)->gamma && (pixmap)->gamma->lin[2]) ? 4095 : 1023)
160
167#define GP_CHAN_TO_ENC_TBL_RGB101010_B(pixmap) \
168 (((pixmap)->gamma && (pixmap)->gamma->enc[2]) ? (pixmap)->gamma->enc[2]->u16 : NULL)
169
185#define GP_PIXEL_CREATE_xRGB8888_ENC(R, G, B, R_gamma_enc, G_gamma_enc, B_gamma_enc) \
186 (0\
187 + ((R_gamma_enc ? R_gamma_enc[(R)] : R) << 16) \
188 + ((G_gamma_enc ? G_gamma_enc[(G)] : G) << 8) \
189 + ((B_gamma_enc ? B_gamma_enc[(B)] : B) << 0) \
190 )
200#define GP_PIXEL_GET_R_xRGB8888_LIN(p, gamma_lin) ( \
201 gamma_lin ? gamma_lin[GP_PIXEL_GET_R_xRGB8888(p)] : \
202 GP_PIXEL_GET_R_xRGB8888(p) \
203)
204
211#define GP_CHAN_TO_LIN_TBL_xRGB8888_R(pixmap) \
212 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? (pixmap)->gamma->lin[0]->u16 : NULL)
213
222#define GP_CHAN_LIN_MAX_VAL_xRGB8888_R(pixmap) \
223 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? 1023 : 255)
224
231#define GP_CHAN_TO_ENC_TBL_xRGB8888_R(pixmap) \
232 (((pixmap)->gamma && (pixmap)->gamma->enc[0]) ? (pixmap)->gamma->enc[0]->u8 : NULL)
233
243#define GP_PIXEL_GET_G_xRGB8888_LIN(p, gamma_lin) ( \
244 gamma_lin ? gamma_lin[GP_PIXEL_GET_G_xRGB8888(p)] : \
245 GP_PIXEL_GET_G_xRGB8888(p) \
246)
247
254#define GP_CHAN_TO_LIN_TBL_xRGB8888_G(pixmap) \
255 (((pixmap)->gamma && (pixmap)->gamma->lin[1]) ? (pixmap)->gamma->lin[1]->u16 : NULL)
256
265#define GP_CHAN_LIN_MAX_VAL_xRGB8888_G(pixmap) \
266 (((pixmap)->gamma && (pixmap)->gamma->lin[1]) ? 1023 : 255)
267
274#define GP_CHAN_TO_ENC_TBL_xRGB8888_G(pixmap) \
275 (((pixmap)->gamma && (pixmap)->gamma->enc[1]) ? (pixmap)->gamma->enc[1]->u8 : NULL)
276
286#define GP_PIXEL_GET_B_xRGB8888_LIN(p, gamma_lin) ( \
287 gamma_lin ? gamma_lin[GP_PIXEL_GET_B_xRGB8888(p)] : \
288 GP_PIXEL_GET_B_xRGB8888(p) \
289)
290
297#define GP_CHAN_TO_LIN_TBL_xRGB8888_B(pixmap) \
298 (((pixmap)->gamma && (pixmap)->gamma->lin[2]) ? (pixmap)->gamma->lin[2]->u16 : NULL)
299
308#define GP_CHAN_LIN_MAX_VAL_xRGB8888_B(pixmap) \
309 (((pixmap)->gamma && (pixmap)->gamma->lin[2]) ? 1023 : 255)
310
317#define GP_CHAN_TO_ENC_TBL_xRGB8888_B(pixmap) \
318 (((pixmap)->gamma && (pixmap)->gamma->enc[2]) ? (pixmap)->gamma->enc[2]->u8 : NULL)
319
338#define GP_PIXEL_CREATE_RGBA8888_ENC(R, G, B, A, R_gamma_enc, G_gamma_enc, B_gamma_enc, A_gamma_enc) \
339 (0\
340 + ((R_gamma_enc ? R_gamma_enc[(R)] : R) << 24) \
341 + ((G_gamma_enc ? G_gamma_enc[(G)] : G) << 16) \
342 + ((B_gamma_enc ? B_gamma_enc[(B)] : B) << 8) \
343 + ((A_gamma_enc ? A_gamma_enc[(A)] : A) << 0) \
344 )
354#define GP_PIXEL_GET_R_RGBA8888_LIN(p, gamma_lin) ( \
355 gamma_lin ? gamma_lin[GP_PIXEL_GET_R_RGBA8888(p)] : \
356 GP_PIXEL_GET_R_RGBA8888(p) \
357)
358
365#define GP_CHAN_TO_LIN_TBL_RGBA8888_R(pixmap) \
366 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? (pixmap)->gamma->lin[0]->u16 : NULL)
367
376#define GP_CHAN_LIN_MAX_VAL_RGBA8888_R(pixmap) \
377 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? 1023 : 255)
378
385#define GP_CHAN_TO_ENC_TBL_RGBA8888_R(pixmap) \
386 (((pixmap)->gamma && (pixmap)->gamma->enc[0]) ? (pixmap)->gamma->enc[0]->u8 : NULL)
387
397#define GP_PIXEL_GET_G_RGBA8888_LIN(p, gamma_lin) ( \
398 gamma_lin ? gamma_lin[GP_PIXEL_GET_G_RGBA8888(p)] : \
399 GP_PIXEL_GET_G_RGBA8888(p) \
400)
401
408#define GP_CHAN_TO_LIN_TBL_RGBA8888_G(pixmap) \
409 (((pixmap)->gamma && (pixmap)->gamma->lin[1]) ? (pixmap)->gamma->lin[1]->u16 : NULL)
410
419#define GP_CHAN_LIN_MAX_VAL_RGBA8888_G(pixmap) \
420 (((pixmap)->gamma && (pixmap)->gamma->lin[1]) ? 1023 : 255)
421
428#define GP_CHAN_TO_ENC_TBL_RGBA8888_G(pixmap) \
429 (((pixmap)->gamma && (pixmap)->gamma->enc[1]) ? (pixmap)->gamma->enc[1]->u8 : NULL)
430
440#define GP_PIXEL_GET_B_RGBA8888_LIN(p, gamma_lin) ( \
441 gamma_lin ? gamma_lin[GP_PIXEL_GET_B_RGBA8888(p)] : \
442 GP_PIXEL_GET_B_RGBA8888(p) \
443)
444
451#define GP_CHAN_TO_LIN_TBL_RGBA8888_B(pixmap) \
452 (((pixmap)->gamma && (pixmap)->gamma->lin[2]) ? (pixmap)->gamma->lin[2]->u16 : NULL)
453
462#define GP_CHAN_LIN_MAX_VAL_RGBA8888_B(pixmap) \
463 (((pixmap)->gamma && (pixmap)->gamma->lin[2]) ? 1023 : 255)
464
471#define GP_CHAN_TO_ENC_TBL_RGBA8888_B(pixmap) \
472 (((pixmap)->gamma && (pixmap)->gamma->enc[2]) ? (pixmap)->gamma->enc[2]->u8 : NULL)
473
483#define GP_PIXEL_GET_A_RGBA8888_LIN(p, gamma_lin) ( \
484 gamma_lin ? gamma_lin[GP_PIXEL_GET_A_RGBA8888(p)] : \
485 GP_PIXEL_GET_A_RGBA8888(p) \
486)
487
494#define GP_CHAN_TO_LIN_TBL_RGBA8888_A(pixmap) \
495 (((pixmap)->gamma && (pixmap)->gamma->lin[3]) ? (pixmap)->gamma->lin[3]->u8 : NULL)
496
505#define GP_CHAN_LIN_MAX_VAL_RGBA8888_A(pixmap) \
506 (((pixmap)->gamma && (pixmap)->gamma->lin[3]) ? 255 : 255)
507
514#define GP_CHAN_TO_ENC_TBL_RGBA8888_A(pixmap) \
515 (((pixmap)->gamma && (pixmap)->gamma->enc[3]) ? (pixmap)->gamma->enc[3]->u8 : NULL)
516
532#define GP_PIXEL_CREATE_RGB888_ENC(R, G, B, R_gamma_enc, G_gamma_enc, B_gamma_enc) \
533 (0\
534 + ((R_gamma_enc ? R_gamma_enc[(R)] : R) << 16) \
535 + ((G_gamma_enc ? G_gamma_enc[(G)] : G) << 8) \
536 + ((B_gamma_enc ? B_gamma_enc[(B)] : B) << 0) \
537 )
547#define GP_PIXEL_GET_R_RGB888_LIN(p, gamma_lin) ( \
548 gamma_lin ? gamma_lin[GP_PIXEL_GET_R_RGB888(p)] : \
549 GP_PIXEL_GET_R_RGB888(p) \
550)
551
558#define GP_CHAN_TO_LIN_TBL_RGB888_R(pixmap) \
559 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? (pixmap)->gamma->lin[0]->u16 : NULL)
560
569#define GP_CHAN_LIN_MAX_VAL_RGB888_R(pixmap) \
570 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? 1023 : 255)
571
578#define GP_CHAN_TO_ENC_TBL_RGB888_R(pixmap) \
579 (((pixmap)->gamma && (pixmap)->gamma->enc[0]) ? (pixmap)->gamma->enc[0]->u8 : NULL)
580
590#define GP_PIXEL_GET_G_RGB888_LIN(p, gamma_lin) ( \
591 gamma_lin ? gamma_lin[GP_PIXEL_GET_G_RGB888(p)] : \
592 GP_PIXEL_GET_G_RGB888(p) \
593)
594
601#define GP_CHAN_TO_LIN_TBL_RGB888_G(pixmap) \
602 (((pixmap)->gamma && (pixmap)->gamma->lin[1]) ? (pixmap)->gamma->lin[1]->u16 : NULL)
603
612#define GP_CHAN_LIN_MAX_VAL_RGB888_G(pixmap) \
613 (((pixmap)->gamma && (pixmap)->gamma->lin[1]) ? 1023 : 255)
614
621#define GP_CHAN_TO_ENC_TBL_RGB888_G(pixmap) \
622 (((pixmap)->gamma && (pixmap)->gamma->enc[1]) ? (pixmap)->gamma->enc[1]->u8 : NULL)
623
633#define GP_PIXEL_GET_B_RGB888_LIN(p, gamma_lin) ( \
634 gamma_lin ? gamma_lin[GP_PIXEL_GET_B_RGB888(p)] : \
635 GP_PIXEL_GET_B_RGB888(p) \
636)
637
644#define GP_CHAN_TO_LIN_TBL_RGB888_B(pixmap) \
645 (((pixmap)->gamma && (pixmap)->gamma->lin[2]) ? (pixmap)->gamma->lin[2]->u16 : NULL)
646
655#define GP_CHAN_LIN_MAX_VAL_RGB888_B(pixmap) \
656 (((pixmap)->gamma && (pixmap)->gamma->lin[2]) ? 1023 : 255)
657
664#define GP_CHAN_TO_ENC_TBL_RGB888_B(pixmap) \
665 (((pixmap)->gamma && (pixmap)->gamma->enc[2]) ? (pixmap)->gamma->enc[2]->u8 : NULL)
666
682#define GP_PIXEL_CREATE_BGR888_ENC(B, G, R, B_gamma_enc, G_gamma_enc, R_gamma_enc) \
683 (0\
684 + ((B_gamma_enc ? B_gamma_enc[(B)] : B) << 16) \
685 + ((G_gamma_enc ? G_gamma_enc[(G)] : G) << 8) \
686 + ((R_gamma_enc ? R_gamma_enc[(R)] : R) << 0) \
687 )
697#define GP_PIXEL_GET_B_BGR888_LIN(p, gamma_lin) ( \
698 gamma_lin ? gamma_lin[GP_PIXEL_GET_B_BGR888(p)] : \
699 GP_PIXEL_GET_B_BGR888(p) \
700)
701
708#define GP_CHAN_TO_LIN_TBL_BGR888_B(pixmap) \
709 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? (pixmap)->gamma->lin[0]->u16 : NULL)
710
719#define GP_CHAN_LIN_MAX_VAL_BGR888_B(pixmap) \
720 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? 1023 : 255)
721
728#define GP_CHAN_TO_ENC_TBL_BGR888_B(pixmap) \
729 (((pixmap)->gamma && (pixmap)->gamma->enc[0]) ? (pixmap)->gamma->enc[0]->u8 : NULL)
730
740#define GP_PIXEL_GET_G_BGR888_LIN(p, gamma_lin) ( \
741 gamma_lin ? gamma_lin[GP_PIXEL_GET_G_BGR888(p)] : \
742 GP_PIXEL_GET_G_BGR888(p) \
743)
744
751#define GP_CHAN_TO_LIN_TBL_BGR888_G(pixmap) \
752 (((pixmap)->gamma && (pixmap)->gamma->lin[1]) ? (pixmap)->gamma->lin[1]->u16 : NULL)
753
762#define GP_CHAN_LIN_MAX_VAL_BGR888_G(pixmap) \
763 (((pixmap)->gamma && (pixmap)->gamma->lin[1]) ? 1023 : 255)
764
771#define GP_CHAN_TO_ENC_TBL_BGR888_G(pixmap) \
772 (((pixmap)->gamma && (pixmap)->gamma->enc[1]) ? (pixmap)->gamma->enc[1]->u8 : NULL)
773
783#define GP_PIXEL_GET_R_BGR888_LIN(p, gamma_lin) ( \
784 gamma_lin ? gamma_lin[GP_PIXEL_GET_R_BGR888(p)] : \
785 GP_PIXEL_GET_R_BGR888(p) \
786)
787
794#define GP_CHAN_TO_LIN_TBL_BGR888_R(pixmap) \
795 (((pixmap)->gamma && (pixmap)->gamma->lin[2]) ? (pixmap)->gamma->lin[2]->u16 : NULL)
796
805#define GP_CHAN_LIN_MAX_VAL_BGR888_R(pixmap) \
806 (((pixmap)->gamma && (pixmap)->gamma->lin[2]) ? 1023 : 255)
807
814#define GP_CHAN_TO_ENC_TBL_BGR888_R(pixmap) \
815 (((pixmap)->gamma && (pixmap)->gamma->enc[2]) ? (pixmap)->gamma->enc[2]->u8 : NULL)
816
832#define GP_PIXEL_CREATE_RGB555_ENC(R, G, B, R_gamma_enc, G_gamma_enc, B_gamma_enc) \
833 (0\
834 + ((R_gamma_enc ? R_gamma_enc[(R)] : R) << 10) \
835 + ((G_gamma_enc ? G_gamma_enc[(G)] : G) << 5) \
836 + ((B_gamma_enc ? B_gamma_enc[(B)] : B) << 0) \
837 )
847#define GP_PIXEL_GET_R_RGB555_LIN(p, gamma_lin) ( \
848 gamma_lin ? gamma_lin[GP_PIXEL_GET_R_RGB555(p)] : \
849 GP_PIXEL_GET_R_RGB555(p) \
850)
851
858#define GP_CHAN_TO_LIN_TBL_RGB555_R(pixmap) \
859 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? (pixmap)->gamma->lin[0]->u8 : NULL)
860
869#define GP_CHAN_LIN_MAX_VAL_RGB555_R(pixmap) \
870 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? 127 : 31)
871
878#define GP_CHAN_TO_ENC_TBL_RGB555_R(pixmap) \
879 (((pixmap)->gamma && (pixmap)->gamma->enc[0]) ? (pixmap)->gamma->enc[0]->u8 : NULL)
880
890#define GP_PIXEL_GET_G_RGB555_LIN(p, gamma_lin) ( \
891 gamma_lin ? gamma_lin[GP_PIXEL_GET_G_RGB555(p)] : \
892 GP_PIXEL_GET_G_RGB555(p) \
893)
894
901#define GP_CHAN_TO_LIN_TBL_RGB555_G(pixmap) \
902 (((pixmap)->gamma && (pixmap)->gamma->lin[1]) ? (pixmap)->gamma->lin[1]->u8 : NULL)
903
912#define GP_CHAN_LIN_MAX_VAL_RGB555_G(pixmap) \
913 (((pixmap)->gamma && (pixmap)->gamma->lin[1]) ? 127 : 31)
914
921#define GP_CHAN_TO_ENC_TBL_RGB555_G(pixmap) \
922 (((pixmap)->gamma && (pixmap)->gamma->enc[1]) ? (pixmap)->gamma->enc[1]->u8 : NULL)
923
933#define GP_PIXEL_GET_B_RGB555_LIN(p, gamma_lin) ( \
934 gamma_lin ? gamma_lin[GP_PIXEL_GET_B_RGB555(p)] : \
935 GP_PIXEL_GET_B_RGB555(p) \
936)
937
944#define GP_CHAN_TO_LIN_TBL_RGB555_B(pixmap) \
945 (((pixmap)->gamma && (pixmap)->gamma->lin[2]) ? (pixmap)->gamma->lin[2]->u8 : NULL)
946
955#define GP_CHAN_LIN_MAX_VAL_RGB555_B(pixmap) \
956 (((pixmap)->gamma && (pixmap)->gamma->lin[2]) ? 127 : 31)
957
964#define GP_CHAN_TO_ENC_TBL_RGB555_B(pixmap) \
965 (((pixmap)->gamma && (pixmap)->gamma->enc[2]) ? (pixmap)->gamma->enc[2]->u8 : NULL)
966
982#define GP_PIXEL_CREATE_RGB565_ENC(R, G, B, R_gamma_enc, G_gamma_enc, B_gamma_enc) \
983 (0\
984 + ((R_gamma_enc ? R_gamma_enc[(R)] : R) << 11) \
985 + ((G_gamma_enc ? G_gamma_enc[(G)] : G) << 5) \
986 + ((B_gamma_enc ? B_gamma_enc[(B)] : B) << 0) \
987 )
997#define GP_PIXEL_GET_R_RGB565_LIN(p, gamma_lin) ( \
998 gamma_lin ? gamma_lin[GP_PIXEL_GET_R_RGB565(p)] : \
999 GP_PIXEL_GET_R_RGB565(p) \
1000)
1001
1008#define GP_CHAN_TO_LIN_TBL_RGB565_R(pixmap) \
1009 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? (pixmap)->gamma->lin[0]->u8 : NULL)
1010
1019#define GP_CHAN_LIN_MAX_VAL_RGB565_R(pixmap) \
1020 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? 127 : 31)
1021
1028#define GP_CHAN_TO_ENC_TBL_RGB565_R(pixmap) \
1029 (((pixmap)->gamma && (pixmap)->gamma->enc[0]) ? (pixmap)->gamma->enc[0]->u8 : NULL)
1030
1040#define GP_PIXEL_GET_G_RGB565_LIN(p, gamma_lin) ( \
1041 gamma_lin ? gamma_lin[GP_PIXEL_GET_G_RGB565(p)] : \
1042 GP_PIXEL_GET_G_RGB565(p) \
1043)
1044
1051#define GP_CHAN_TO_LIN_TBL_RGB565_G(pixmap) \
1052 (((pixmap)->gamma && (pixmap)->gamma->lin[1]) ? (pixmap)->gamma->lin[1]->u8 : NULL)
1053
1062#define GP_CHAN_LIN_MAX_VAL_RGB565_G(pixmap) \
1063 (((pixmap)->gamma && (pixmap)->gamma->lin[1]) ? 255 : 63)
1064
1071#define GP_CHAN_TO_ENC_TBL_RGB565_G(pixmap) \
1072 (((pixmap)->gamma && (pixmap)->gamma->enc[1]) ? (pixmap)->gamma->enc[1]->u8 : NULL)
1073
1083#define GP_PIXEL_GET_B_RGB565_LIN(p, gamma_lin) ( \
1084 gamma_lin ? gamma_lin[GP_PIXEL_GET_B_RGB565(p)] : \
1085 GP_PIXEL_GET_B_RGB565(p) \
1086)
1087
1094#define GP_CHAN_TO_LIN_TBL_RGB565_B(pixmap) \
1095 (((pixmap)->gamma && (pixmap)->gamma->lin[2]) ? (pixmap)->gamma->lin[2]->u8 : NULL)
1096
1105#define GP_CHAN_LIN_MAX_VAL_RGB565_B(pixmap) \
1106 (((pixmap)->gamma && (pixmap)->gamma->lin[2]) ? 127 : 31)
1107
1114#define GP_CHAN_TO_ENC_TBL_RGB565_B(pixmap) \
1115 (((pixmap)->gamma && (pixmap)->gamma->enc[2]) ? (pixmap)->gamma->enc[2]->u8 : NULL)
1116
1132#define GP_PIXEL_CREATE_RGB666_ENC(R, G, B, R_gamma_enc, G_gamma_enc, B_gamma_enc) \
1133 (0\
1134 + ((R_gamma_enc ? R_gamma_enc[(R)] : R) << 12) \
1135 + ((G_gamma_enc ? G_gamma_enc[(G)] : G) << 6) \
1136 + ((B_gamma_enc ? B_gamma_enc[(B)] : B) << 0) \
1137 )
1147#define GP_PIXEL_GET_R_RGB666_LIN(p, gamma_lin) ( \
1148 gamma_lin ? gamma_lin[GP_PIXEL_GET_R_RGB666(p)] : \
1149 GP_PIXEL_GET_R_RGB666(p) \
1150)
1151
1158#define GP_CHAN_TO_LIN_TBL_RGB666_R(pixmap) \
1159 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? (pixmap)->gamma->lin[0]->u8 : NULL)
1160
1169#define GP_CHAN_LIN_MAX_VAL_RGB666_R(pixmap) \
1170 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? 255 : 63)
1171
1178#define GP_CHAN_TO_ENC_TBL_RGB666_R(pixmap) \
1179 (((pixmap)->gamma && (pixmap)->gamma->enc[0]) ? (pixmap)->gamma->enc[0]->u8 : NULL)
1180
1190#define GP_PIXEL_GET_G_RGB666_LIN(p, gamma_lin) ( \
1191 gamma_lin ? gamma_lin[GP_PIXEL_GET_G_RGB666(p)] : \
1192 GP_PIXEL_GET_G_RGB666(p) \
1193)
1194
1201#define GP_CHAN_TO_LIN_TBL_RGB666_G(pixmap) \
1202 (((pixmap)->gamma && (pixmap)->gamma->lin[1]) ? (pixmap)->gamma->lin[1]->u8 : NULL)
1203
1212#define GP_CHAN_LIN_MAX_VAL_RGB666_G(pixmap) \
1213 (((pixmap)->gamma && (pixmap)->gamma->lin[1]) ? 255 : 63)
1214
1221#define GP_CHAN_TO_ENC_TBL_RGB666_G(pixmap) \
1222 (((pixmap)->gamma && (pixmap)->gamma->enc[1]) ? (pixmap)->gamma->enc[1]->u8 : NULL)
1223
1233#define GP_PIXEL_GET_B_RGB666_LIN(p, gamma_lin) ( \
1234 gamma_lin ? gamma_lin[GP_PIXEL_GET_B_RGB666(p)] : \
1235 GP_PIXEL_GET_B_RGB666(p) \
1236)
1237
1244#define GP_CHAN_TO_LIN_TBL_RGB666_B(pixmap) \
1245 (((pixmap)->gamma && (pixmap)->gamma->lin[2]) ? (pixmap)->gamma->lin[2]->u8 : NULL)
1246
1255#define GP_CHAN_LIN_MAX_VAL_RGB666_B(pixmap) \
1256 (((pixmap)->gamma && (pixmap)->gamma->lin[2]) ? 255 : 63)
1257
1264#define GP_CHAN_TO_ENC_TBL_RGB666_B(pixmap) \
1265 (((pixmap)->gamma && (pixmap)->gamma->enc[2]) ? (pixmap)->gamma->enc[2]->u8 : NULL)
1266
1282#define GP_PIXEL_CREATE_RGB332_ENC(R, G, B, R_gamma_enc, G_gamma_enc, B_gamma_enc) \
1283 (0\
1284 + ((R_gamma_enc ? R_gamma_enc[(R)] : R) << 5) \
1285 + ((G_gamma_enc ? G_gamma_enc[(G)] : G) << 2) \
1286 + ((B_gamma_enc ? B_gamma_enc[(B)] : B) << 0) \
1287 )
1297#define GP_PIXEL_GET_R_RGB332_LIN(p, gamma_lin) ( \
1298 gamma_lin ? gamma_lin[GP_PIXEL_GET_R_RGB332(p)] : \
1299 GP_PIXEL_GET_R_RGB332(p) \
1300)
1301
1308#define GP_CHAN_TO_LIN_TBL_RGB332_R(pixmap) \
1309 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? (pixmap)->gamma->lin[0]->u8 : NULL)
1310
1319#define GP_CHAN_LIN_MAX_VAL_RGB332_R(pixmap) \
1320 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? 31 : 7)
1321
1328#define GP_CHAN_TO_ENC_TBL_RGB332_R(pixmap) \
1329 (((pixmap)->gamma && (pixmap)->gamma->enc[0]) ? (pixmap)->gamma->enc[0]->u8 : NULL)
1330
1340#define GP_PIXEL_GET_G_RGB332_LIN(p, gamma_lin) ( \
1341 gamma_lin ? gamma_lin[GP_PIXEL_GET_G_RGB332(p)] : \
1342 GP_PIXEL_GET_G_RGB332(p) \
1343)
1344
1351#define GP_CHAN_TO_LIN_TBL_RGB332_G(pixmap) \
1352 (((pixmap)->gamma && (pixmap)->gamma->lin[1]) ? (pixmap)->gamma->lin[1]->u8 : NULL)
1353
1362#define GP_CHAN_LIN_MAX_VAL_RGB332_G(pixmap) \
1363 (((pixmap)->gamma && (pixmap)->gamma->lin[1]) ? 31 : 7)
1364
1371#define GP_CHAN_TO_ENC_TBL_RGB332_G(pixmap) \
1372 (((pixmap)->gamma && (pixmap)->gamma->enc[1]) ? (pixmap)->gamma->enc[1]->u8 : NULL)
1373
1383#define GP_PIXEL_GET_B_RGB332_LIN(p, gamma_lin) ( \
1384 gamma_lin ? gamma_lin[GP_PIXEL_GET_B_RGB332(p)] : \
1385 GP_PIXEL_GET_B_RGB332(p) \
1386)
1387
1394#define GP_CHAN_TO_LIN_TBL_RGB332_B(pixmap) \
1395 (((pixmap)->gamma && (pixmap)->gamma->lin[2]) ? (pixmap)->gamma->lin[2]->u8 : NULL)
1396
1405#define GP_CHAN_LIN_MAX_VAL_RGB332_B(pixmap) \
1406 (((pixmap)->gamma && (pixmap)->gamma->lin[2]) ? 15 : 3)
1407
1414#define GP_CHAN_TO_ENC_TBL_RGB332_B(pixmap) \
1415 (((pixmap)->gamma && (pixmap)->gamma->enc[2]) ? (pixmap)->gamma->enc[2]->u8 : NULL)
1416
1435#define GP_PIXEL_CREATE_CMYK8888_ENC(K, Y, M, C, K_gamma_enc, Y_gamma_enc, M_gamma_enc, C_gamma_enc) \
1436 (0\
1437 + ((K_gamma_enc ? K_gamma_enc[(K)] : K) << 24) \
1438 + ((Y_gamma_enc ? Y_gamma_enc[(Y)] : Y) << 16) \
1439 + ((M_gamma_enc ? M_gamma_enc[(M)] : M) << 8) \
1440 + ((C_gamma_enc ? C_gamma_enc[(C)] : C) << 0) \
1441 )
1451#define GP_PIXEL_GET_K_CMYK8888_LIN(p, gamma_lin) ( \
1452 gamma_lin ? gamma_lin[GP_PIXEL_GET_K_CMYK8888(p)] : \
1453 GP_PIXEL_GET_K_CMYK8888(p) \
1454)
1455
1462#define GP_CHAN_TO_LIN_TBL_CMYK8888_K(pixmap) \
1463 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? (pixmap)->gamma->lin[0]->u8 : NULL)
1464
1473#define GP_CHAN_LIN_MAX_VAL_CMYK8888_K(pixmap) \
1474 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? 255 : 255)
1475
1482#define GP_CHAN_TO_ENC_TBL_CMYK8888_K(pixmap) \
1483 (((pixmap)->gamma && (pixmap)->gamma->enc[0]) ? (pixmap)->gamma->enc[0]->u8 : NULL)
1484
1494#define GP_PIXEL_GET_Y_CMYK8888_LIN(p, gamma_lin) ( \
1495 gamma_lin ? gamma_lin[GP_PIXEL_GET_Y_CMYK8888(p)] : \
1496 GP_PIXEL_GET_Y_CMYK8888(p) \
1497)
1498
1505#define GP_CHAN_TO_LIN_TBL_CMYK8888_Y(pixmap) \
1506 (((pixmap)->gamma && (pixmap)->gamma->lin[1]) ? (pixmap)->gamma->lin[1]->u8 : NULL)
1507
1516#define GP_CHAN_LIN_MAX_VAL_CMYK8888_Y(pixmap) \
1517 (((pixmap)->gamma && (pixmap)->gamma->lin[1]) ? 255 : 255)
1518
1525#define GP_CHAN_TO_ENC_TBL_CMYK8888_Y(pixmap) \
1526 (((pixmap)->gamma && (pixmap)->gamma->enc[1]) ? (pixmap)->gamma->enc[1]->u8 : NULL)
1527
1537#define GP_PIXEL_GET_M_CMYK8888_LIN(p, gamma_lin) ( \
1538 gamma_lin ? gamma_lin[GP_PIXEL_GET_M_CMYK8888(p)] : \
1539 GP_PIXEL_GET_M_CMYK8888(p) \
1540)
1541
1548#define GP_CHAN_TO_LIN_TBL_CMYK8888_M(pixmap) \
1549 (((pixmap)->gamma && (pixmap)->gamma->lin[2]) ? (pixmap)->gamma->lin[2]->u8 : NULL)
1550
1559#define GP_CHAN_LIN_MAX_VAL_CMYK8888_M(pixmap) \
1560 (((pixmap)->gamma && (pixmap)->gamma->lin[2]) ? 255 : 255)
1561
1568#define GP_CHAN_TO_ENC_TBL_CMYK8888_M(pixmap) \
1569 (((pixmap)->gamma && (pixmap)->gamma->enc[2]) ? (pixmap)->gamma->enc[2]->u8 : NULL)
1570
1580#define GP_PIXEL_GET_C_CMYK8888_LIN(p, gamma_lin) ( \
1581 gamma_lin ? gamma_lin[GP_PIXEL_GET_C_CMYK8888(p)] : \
1582 GP_PIXEL_GET_C_CMYK8888(p) \
1583)
1584
1591#define GP_CHAN_TO_LIN_TBL_CMYK8888_C(pixmap) \
1592 (((pixmap)->gamma && (pixmap)->gamma->lin[3]) ? (pixmap)->gamma->lin[3]->u8 : NULL)
1593
1602#define GP_CHAN_LIN_MAX_VAL_CMYK8888_C(pixmap) \
1603 (((pixmap)->gamma && (pixmap)->gamma->lin[3]) ? 255 : 255)
1604
1611#define GP_CHAN_TO_ENC_TBL_CMYK8888_C(pixmap) \
1612 (((pixmap)->gamma && (pixmap)->gamma->enc[3]) ? (pixmap)->gamma->enc[3]->u8 : NULL)
1613
1623#define GP_PIXEL_CREATE_G1_DB_ENC(V, V_gamma_enc) \
1624 (0\
1625 + ((V_gamma_enc ? V_gamma_enc[(V)] : V) << 0) \
1626 )
1636#define GP_PIXEL_GET_V_G1_DB_LIN(p, gamma_lin) ( \
1637 gamma_lin ? gamma_lin[GP_PIXEL_GET_V_G1_DB(p)] : \
1638 GP_PIXEL_GET_V_G1_DB(p) \
1639)
1640
1647#define GP_CHAN_TO_LIN_TBL_G1_DB_V(pixmap) \
1648 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? (pixmap)->gamma->lin[0]->u8 : NULL)
1649
1658#define GP_CHAN_LIN_MAX_VAL_G1_DB_V(pixmap) \
1659 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? 1 : 1)
1660
1667#define GP_CHAN_TO_ENC_TBL_G1_DB_V(pixmap) \
1668 (((pixmap)->gamma && (pixmap)->gamma->enc[0]) ? (pixmap)->gamma->enc[0]->u8 : NULL)
1669
1679#define GP_PIXEL_CREATE_G2_DB_ENC(V, V_gamma_enc) \
1680 (0\
1681 + ((V_gamma_enc ? V_gamma_enc[(V)] : V) << 0) \
1682 )
1692#define GP_PIXEL_GET_V_G2_DB_LIN(p, gamma_lin) ( \
1693 gamma_lin ? gamma_lin[GP_PIXEL_GET_V_G2_DB(p)] : \
1694 GP_PIXEL_GET_V_G2_DB(p) \
1695)
1696
1703#define GP_CHAN_TO_LIN_TBL_G2_DB_V(pixmap) \
1704 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? (pixmap)->gamma->lin[0]->u8 : NULL)
1705
1714#define GP_CHAN_LIN_MAX_VAL_G2_DB_V(pixmap) \
1715 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? 15 : 3)
1716
1723#define GP_CHAN_TO_ENC_TBL_G2_DB_V(pixmap) \
1724 (((pixmap)->gamma && (pixmap)->gamma->enc[0]) ? (pixmap)->gamma->enc[0]->u8 : NULL)
1725
1735#define GP_PIXEL_CREATE_G4_DB_ENC(V, V_gamma_enc) \
1736 (0\
1737 + ((V_gamma_enc ? V_gamma_enc[(V)] : V) << 0) \
1738 )
1748#define GP_PIXEL_GET_V_G4_DB_LIN(p, gamma_lin) ( \
1749 gamma_lin ? gamma_lin[GP_PIXEL_GET_V_G4_DB(p)] : \
1750 GP_PIXEL_GET_V_G4_DB(p) \
1751)
1752
1759#define GP_CHAN_TO_LIN_TBL_G4_DB_V(pixmap) \
1760 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? (pixmap)->gamma->lin[0]->u8 : NULL)
1761
1770#define GP_CHAN_LIN_MAX_VAL_G4_DB_V(pixmap) \
1771 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? 63 : 15)
1772
1779#define GP_CHAN_TO_ENC_TBL_G4_DB_V(pixmap) \
1780 (((pixmap)->gamma && (pixmap)->gamma->enc[0]) ? (pixmap)->gamma->enc[0]->u8 : NULL)
1781
1791#define GP_PIXEL_CREATE_G1_UB_ENC(V, V_gamma_enc) \
1792 (0\
1793 + ((V_gamma_enc ? V_gamma_enc[(V)] : V) << 0) \
1794 )
1804#define GP_PIXEL_GET_V_G1_UB_LIN(p, gamma_lin) ( \
1805 gamma_lin ? gamma_lin[GP_PIXEL_GET_V_G1_UB(p)] : \
1806 GP_PIXEL_GET_V_G1_UB(p) \
1807)
1808
1815#define GP_CHAN_TO_LIN_TBL_G1_UB_V(pixmap) \
1816 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? (pixmap)->gamma->lin[0]->u8 : NULL)
1817
1826#define GP_CHAN_LIN_MAX_VAL_G1_UB_V(pixmap) \
1827 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? 1 : 1)
1828
1835#define GP_CHAN_TO_ENC_TBL_G1_UB_V(pixmap) \
1836 (((pixmap)->gamma && (pixmap)->gamma->enc[0]) ? (pixmap)->gamma->enc[0]->u8 : NULL)
1837
1847#define GP_PIXEL_CREATE_G2_UB_ENC(V, V_gamma_enc) \
1848 (0\
1849 + ((V_gamma_enc ? V_gamma_enc[(V)] : V) << 0) \
1850 )
1860#define GP_PIXEL_GET_V_G2_UB_LIN(p, gamma_lin) ( \
1861 gamma_lin ? gamma_lin[GP_PIXEL_GET_V_G2_UB(p)] : \
1862 GP_PIXEL_GET_V_G2_UB(p) \
1863)
1864
1871#define GP_CHAN_TO_LIN_TBL_G2_UB_V(pixmap) \
1872 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? (pixmap)->gamma->lin[0]->u8 : NULL)
1873
1882#define GP_CHAN_LIN_MAX_VAL_G2_UB_V(pixmap) \
1883 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? 15 : 3)
1884
1891#define GP_CHAN_TO_ENC_TBL_G2_UB_V(pixmap) \
1892 (((pixmap)->gamma && (pixmap)->gamma->enc[0]) ? (pixmap)->gamma->enc[0]->u8 : NULL)
1893
1903#define GP_PIXEL_CREATE_G4_UB_ENC(V, V_gamma_enc) \
1904 (0\
1905 + ((V_gamma_enc ? V_gamma_enc[(V)] : V) << 0) \
1906 )
1916#define GP_PIXEL_GET_V_G4_UB_LIN(p, gamma_lin) ( \
1917 gamma_lin ? gamma_lin[GP_PIXEL_GET_V_G4_UB(p)] : \
1918 GP_PIXEL_GET_V_G4_UB(p) \
1919)
1920
1927#define GP_CHAN_TO_LIN_TBL_G4_UB_V(pixmap) \
1928 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? (pixmap)->gamma->lin[0]->u8 : NULL)
1929
1938#define GP_CHAN_LIN_MAX_VAL_G4_UB_V(pixmap) \
1939 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? 63 : 15)
1940
1947#define GP_CHAN_TO_ENC_TBL_G4_UB_V(pixmap) \
1948 (((pixmap)->gamma && (pixmap)->gamma->enc[0]) ? (pixmap)->gamma->enc[0]->u8 : NULL)
1949
1959#define GP_PIXEL_CREATE_G8_ENC(V, V_gamma_enc) \
1960 (0\
1961 + ((V_gamma_enc ? V_gamma_enc[(V)] : V) << 0) \
1962 )
1972#define GP_PIXEL_GET_V_G8_LIN(p, gamma_lin) ( \
1973 gamma_lin ? gamma_lin[GP_PIXEL_GET_V_G8(p)] : \
1974 GP_PIXEL_GET_V_G8(p) \
1975)
1976
1983#define GP_CHAN_TO_LIN_TBL_G8_V(pixmap) \
1984 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? (pixmap)->gamma->lin[0]->u16 : NULL)
1985
1994#define GP_CHAN_LIN_MAX_VAL_G8_V(pixmap) \
1995 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? 1023 : 255)
1996
2003#define GP_CHAN_TO_ENC_TBL_G8_V(pixmap) \
2004 (((pixmap)->gamma && (pixmap)->gamma->enc[0]) ? (pixmap)->gamma->enc[0]->u8 : NULL)
2005
2018#define GP_PIXEL_CREATE_GA88_ENC(V, A, V_gamma_enc, A_gamma_enc) \
2019 (0\
2020 + ((V_gamma_enc ? V_gamma_enc[(V)] : V) << 0) \
2021 + ((A_gamma_enc ? A_gamma_enc[(A)] : A) << 8) \
2022 )
2032#define GP_PIXEL_GET_V_GA88_LIN(p, gamma_lin) ( \
2033 gamma_lin ? gamma_lin[GP_PIXEL_GET_V_GA88(p)] : \
2034 GP_PIXEL_GET_V_GA88(p) \
2035)
2036
2043#define GP_CHAN_TO_LIN_TBL_GA88_V(pixmap) \
2044 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? (pixmap)->gamma->lin[0]->u16 : NULL)
2045
2054#define GP_CHAN_LIN_MAX_VAL_GA88_V(pixmap) \
2055 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? 1023 : 255)
2056
2063#define GP_CHAN_TO_ENC_TBL_GA88_V(pixmap) \
2064 (((pixmap)->gamma && (pixmap)->gamma->enc[0]) ? (pixmap)->gamma->enc[0]->u8 : NULL)
2065
2075#define GP_PIXEL_GET_A_GA88_LIN(p, gamma_lin) ( \
2076 gamma_lin ? gamma_lin[GP_PIXEL_GET_A_GA88(p)] : \
2077 GP_PIXEL_GET_A_GA88(p) \
2078)
2079
2086#define GP_CHAN_TO_LIN_TBL_GA88_A(pixmap) \
2087 (((pixmap)->gamma && (pixmap)->gamma->lin[1]) ? (pixmap)->gamma->lin[1]->u8 : NULL)
2088
2097#define GP_CHAN_LIN_MAX_VAL_GA88_A(pixmap) \
2098 (((pixmap)->gamma && (pixmap)->gamma->lin[1]) ? 255 : 255)
2099
2106#define GP_CHAN_TO_ENC_TBL_GA88_A(pixmap) \
2107 (((pixmap)->gamma && (pixmap)->gamma->enc[1]) ? (pixmap)->gamma->enc[1]->u8 : NULL)
2108
2118#define GP_PIXEL_CREATE_G16_ENC(V, V_gamma_enc) \
2119 (0\
2120 + ((V_gamma_enc ? V_gamma_enc[(V)] : V) << 0) \
2121 )
2131#define GP_PIXEL_GET_V_G16_LIN(p, gamma_lin) ( \
2132 gamma_lin ? gamma_lin[GP_PIXEL_GET_V_G16(p)] : \
2133 GP_PIXEL_GET_V_G16(p) \
2134)
2135
2142#define GP_CHAN_TO_LIN_TBL_G16_V(pixmap) \
2143 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? (pixmap)->gamma->lin[0]->u16 : NULL)
2144
2153#define GP_CHAN_LIN_MAX_VAL_G16_V(pixmap) \
2154 (((pixmap)->gamma && (pixmap)->gamma->lin[0]) ? 262143 : 65535)
2155
2162#define GP_CHAN_TO_ENC_TBL_G16_V(pixmap) \
2163 (((pixmap)->gamma && (pixmap)->gamma->enc[0]) ? (pixmap)->gamma->enc[0]->u16 : NULL)
2164
2165#endif /* GP_GAMMA_CORRECTION_GEN_H */