| 1 | /* |
| 2 | * Mitsubishi Photo Printer Comon Code |
| 3 | * |
| 4 | * (c) 2013-2024 Solomon Peachy <[email protected]> |
| 5 | * |
| 6 | * The latest version of this program can be found at: |
| 7 | * |
| 8 | * https://git.shaftnet.org/gitea/slp/selphy_print.git |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify it |
| 11 | * under the terms of the GNU General Public License as published by the Free |
| 12 | * Software Foundation; either version 2 of the License, or (at your option) |
| 13 | * any later version. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, but |
| 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 17 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 18 | * for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU General Public License |
| 21 | * along with this program; if not, see <https://www.gnu.org/licenses/>. |
| 22 | * |
| 23 | * SPDX-License-Identifier: GPL-2.0+ |
| 24 | * |
| 25 | */ |
| 26 | |
| 27 | #include "backend_common.h"cxx . . $ `<file>/src/cups/backend_common.h`/ |
| 28 | |
| 29 | //#include "lib70x/libMitsuD70ImageReProcess.h" |
| 30 | |
| 31 | /* If we don't have the libMitsu header */ |
| 32 | #ifndef LUT_LEN |
| 33 | #define COLORCONV_RGBcxx . . $ `src/cups/backend_mitsu.h:33:9`! 0 |
| 34 | #define COLORCONV_BGRcxx . . $ `src/cups/backend_mitsu.h:34:9`! 1 |
| 35 | |
| 36 | #define LUT_LENcxx . . $ `src/cups/backend_mitsu.h:36:9`! 14739 |
| 37 | |
| 38 | struct BandImagecxx . . $ BandImage# { |
| 39 | void *imgbufcxx . . $ BandImage#imgbuf.; // @ 0 |
| 40 | int32_tcxx . . $ int32_t# bytes_per_rowcxx . . $ BandImage#bytes_per_row.;// @ 4 (respect 8bpp and 16bpp!) |
| 41 | uint16_tcxx . . $ uint16_t# origin_colscxx . . $ BandImage#origin_cols.; // @ 8 (left) |
| 42 | uint16_tcxx . . $ uint16_t# origin_rowscxx . . $ BandImage#origin_rows.; // @12 (top) |
| 43 | uint16_tcxx . . $ uint16_t# colscxx . . $ BandImage#cols.; // @16 (right) |
| 44 | uint16_tcxx . . $ uint16_t# rowscxx . . $ BandImage#rows.; // @20 (bottom) |
| 45 | // @24 |
| 46 | }; |
| 47 | |
| 48 | /* Forward declarations */ |
| 49 | struct mitsu98xx_datacxx . . $ mitsu98xx_data#; |
| 50 | struct M1CPCDatacxx . . $ M1CPCData#; |
| 51 | struct mitsu_cpd30_datacxx . . $ mitsu_cpd30_data#; |
| 52 | #endif |
| 53 | |
| 54 | typedef void (*dump_announceFNcxx . . $ dump_announceFN#)(FILEcxx . . $ FILE# *fp); |
| 55 | typedef int (*lib70x_getapiversionFNcxx . . $ lib70x_getapiversionFN#)(void); |
| 56 | typedef int (*Get3DColorTableFNcxx . . $ Get3DColorTableFN#)(uint8_tcxx . . $ uint8_t# *buf, const char *filename); |
| 57 | typedef struct CColorConv3Dcxx . . $ CColorConv3D# *(*Load3DColorTableFNcxx . . $ Load3DColorTableFN#)(const uint8_tcxx . . $ uint8_t# *ptr); |
| 58 | typedef void (*Destroy3DColorTableFNcxx . . $ Destroy3DColorTableFN#)(struct CColorConv3Dcxx . . $ CColorConv3D# *this); |
| 59 | typedef void (*DoColorConvFNcxx . . $ DoColorConvFN#)(struct CColorConv3Dcxx . . $ CColorConv3D# *this, uint8_tcxx . . $ uint8_t# *data, uint16_tcxx . . $ uint16_t# cols, uint16_tcxx . . $ uint16_t# rows, uint32_tcxx . . $ uint32_t# bytes_per_row, int rgb_bgr); |
| 60 | typedef void (*DoColorConvPlaneFNcxx . . $ DoColorConvPlaneFN#)(struct CColorConv3Dcxx . . $ CColorConv3D# *this, uint8_tcxx . . $ uint8_t# *data_r, uint8_tcxx . . $ uint8_t# *data_g, uint8_tcxx . . $ uint8_t# *data_b, uint32_tcxx . . $ uint32_t# planelen); |
| 61 | typedef struct CPCDatacxx . . $ CPCData# *(*get_CPCDataFNcxx . . $ get_CPCDataFN#)(const char *filename); |
| 62 | typedef void (*destroy_CPCDataFNcxx . . $ destroy_CPCDataFN#)(struct CPCDatacxx . . $ CPCData# *data); |
| 63 | typedef int (*do_image_effectFNcxx . . $ do_image_effectFN#)(struct CPCDatacxx . . $ CPCData# *cpc, struct CPCDatacxx . . $ CPCData# *ecpc, struct BandImagecxx . . $ BandImage# *input, struct BandImagecxx . . $ BandImage# *output, int sharpen, int reverse, uint8_tcxx . . $ uint8_t# rew[3]); |
| 64 | typedef int (*send_image_dataFNcxx . . $ send_image_dataFN#)(struct BandImagecxx . . $ BandImage# *out, void *context, |
| 65 | int (*callback_fn)(void *context, void *buffer, uint32_tcxx . . $ uint32_t# len)); |
| 66 | |
| 67 | typedef int (*CP98xx_DoConvertFNcxx . . $ CP98xx_DoConvertFN#)(const struct mitsu98xx_datacxx . . $ mitsu98xx_data# *table, |
| 68 | const struct BandImagecxx . . $ BandImage# *input, |
| 69 | struct BandImagecxx . . $ BandImage# *output, |
| 70 | uint8_tcxx . . $ uint8_t# type, int sharpness, int reversed); |
| 71 | typedef struct mitsu98xx_datacxx . . $ mitsu98xx_data# *(*CP98xx_GetDataFNcxx . . $ CP98xx_GetDataFN#)(const char *filename); |
| 72 | typedef void (*CP98xx_DestroyDataFNcxx . . $ CP98xx_DestroyDataFN#)(const struct mitsu98xx_datacxx . . $ mitsu98xx_data# *data); |
| 73 | |
| 74 | typedef struct M1CPCDatacxx . . $ M1CPCData# *(*M1_GetCPCDataFNcxx . . $ M1_GetCPCDataFN#)(const char *corrtable_path, |
| 75 | const char *filename, |
| 76 | const char *gammafilename); |
| 77 | typedef void (*M1_DestroyCPCDataFNcxx . . $ M1_DestroyCPCDataFN#)(struct M1CPCDatacxx . . $ M1CPCData# *dat); |
| 78 | typedef void (*M1_Gamma8to14FNcxx . . $ M1_Gamma8to14FN#)(const struct M1CPCDatacxx . . $ M1CPCData# *cpc, |
| 79 | const struct BandImagecxx . . $ BandImage# *in, struct BandImagecxx . . $ BandImage# *out); |
| 80 | typedef int (*M1_CLocalEnhancerFNcxx . . $ M1_CLocalEnhancerFN#)(const struct M1CPCDatacxx . . $ M1CPCData# *cpc, |
| 81 | int sharp, struct BandImagecxx . . $ BandImage# *img); |
| 82 | typedef int (*M1_CalcRGBRateFNcxx . . $ M1_CalcRGBRateFN#)(uint16_tcxx . . $ uint16_t# rows, uint16_tcxx . . $ uint16_t# cols, uint8_tcxx . . $ uint8_t# *data); |
| 83 | typedef uint8_tcxx . . $ uint8_t# (*M1_CalcOpRateMatteFNcxx . . $ M1_CalcOpRateMatteFN#)(uint16_tcxx . . $ uint16_t# rows, uint16_tcxx . . $ uint16_t# cols, const uint8_tcxx . . $ uint8_t# *data); |
| 84 | typedef uint8_tcxx . . $ uint8_t# (*M1_CalcOpRateGlossFNcxx . . $ M1_CalcOpRateGlossFN#)(uint16_tcxx . . $ uint16_t# rows, uint16_tcxx . . $ uint16_t# cols); |
| 85 | |
| 86 | typedef struct mitsu_cpd30_datacxx . . $ mitsu_cpd30_data# *(*CPD30_GetDataFNcxx . . $ CPD30_GetDataFN#)(const char *filename); |
| 87 | typedef void (*CPD30_DestroyDataFNcxx . . $ CPD30_DestroyDataFN#)(const struct mitsu_cpd30_datacxx . . $ mitsu_cpd30_data# *data); |
| 88 | typedef int (*CPD30_DoConvertFNcxx . . $ CPD30_DoConvertFN#)(const struct mitsu_cpd30_datacxx . . $ mitsu_cpd30_data# *table, |
| 89 | const struct BandImagecxx . . $ BandImage# *input, |
| 90 | struct BandImagecxx . . $ BandImage# *output, |
| 91 | uint8_tcxx . . $ uint8_t# type, int sharpness); |
| 92 | |
| 93 | #ifndef WITH_DYNAMICcxx . . $ `src/cups/backend_common.h:404:9`! |
| 94 | #warning "No dynamic loading support!" |
| 95 | #endif |
| 96 | |
| 97 | #define REQUIRED_LIB_APIVERSIONcxx . . $ `src/cups/backend_mitsu.h:97:9`! 10 |
| 98 | |
| 99 | #define LIBMITSU_VERcxx . . $ `src/cups/backend_mitsu.h:99:9`! "0.13" |
| 100 | |
| 101 | /* Image processing library function prototypes */ |
| 102 | #define LIB_NAME_REcxx . . $ `src/cups/backend_mitsu.h:102:9`! "libMitsuD70ImageReProcess" DLL_SUFFIXcxx . . $ `src/cups/backend_common.h:429:9`! |
| 103 | |
| 104 | struct mitsu_libcxx . . $ mitsu_lib# { |
| 105 | void *dl_handlecxx . . $ mitsu_lib#dl_handle.; |
| 106 | lib70x_getapiversionFNcxx . . $ lib70x_getapiversionFN# GetAPIVersioncxx . . $ mitsu_lib#GetAPIVersion.; |
| 107 | dump_announceFNcxx . . $ dump_announceFN# DumpAnnouncecxx . . $ mitsu_lib#DumpAnnounce.; |
| 108 | Get3DColorTableFNcxx . . $ Get3DColorTableFN# Get3DColorTablecxx . . $ mitsu_lib#Get3DColorTable.; |
| 109 | Load3DColorTableFNcxx . . $ Load3DColorTableFN# Load3DColorTablecxx . . $ mitsu_lib#Load3DColorTable.; |
| 110 | Destroy3DColorTableFNcxx . . $ Destroy3DColorTableFN# Destroy3DColorTablecxx . . $ mitsu_lib#Destroy3DColorTable.; |
| 111 | DoColorConvFNcxx . . $ DoColorConvFN# DoColorConvcxx . . $ mitsu_lib#DoColorConv.; |
| 112 | DoColorConvPlaneFNcxx . . $ DoColorConvPlaneFN# DoColorConvPlanecxx . . $ mitsu_lib#DoColorConvPlane.; |
| 113 | get_CPCDataFNcxx . . $ get_CPCDataFN# GetCPCDatacxx . . $ mitsu_lib#GetCPCData.; |
| 114 | destroy_CPCDataFNcxx . . $ destroy_CPCDataFN# DestroyCPCDatacxx . . $ mitsu_lib#DestroyCPCData.; |
| 115 | do_image_effectFNcxx . . $ do_image_effectFN# DoImageEffect60cxx . . $ mitsu_lib#DoImageEffect60.; |
| 116 | do_image_effectFNcxx . . $ do_image_effectFN# DoImageEffect70cxx . . $ mitsu_lib#DoImageEffect70.; |
| 117 | do_image_effectFNcxx . . $ do_image_effectFN# DoImageEffect80cxx . . $ mitsu_lib#DoImageEffect80.; |
| 118 | do_image_effectFNcxx . . $ do_image_effectFN# DoImageEffectcxx . . $ mitsu_lib#DoImageEffect.; |
| 119 | send_image_dataFNcxx . . $ send_image_dataFN# SendImageDatacxx . . $ mitsu_lib#SendImageData.; |
| 120 | CP98xx_DoConvertFNcxx . . $ CP98xx_DoConvertFN# CP98xx_DoConvertcxx . . $ mitsu_lib#CP98xx_DoConvert.; |
| 121 | CP98xx_GetDataFNcxx . . $ CP98xx_GetDataFN# CP98xx_GetDatacxx . . $ mitsu_lib#CP98xx_GetData.; |
| 122 | CP98xx_DestroyDataFNcxx . . $ CP98xx_DestroyDataFN# CP98xx_DestroyDatacxx . . $ mitsu_lib#CP98xx_DestroyData.; |
| 123 | M1_GetCPCDataFNcxx . . $ M1_GetCPCDataFN# M1_GetCPCDatacxx . . $ mitsu_lib#M1_GetCPCData.; |
| 124 | M1_DestroyCPCDataFNcxx . . $ M1_DestroyCPCDataFN# M1_DestroyCPCDatacxx . . $ mitsu_lib#M1_DestroyCPCData.; |
| 125 | M1_CLocalEnhancerFNcxx . . $ M1_CLocalEnhancerFN# M1_CLocalEnhancercxx . . $ mitsu_lib#M1_CLocalEnhancer.; |
| 126 | M1_Gamma8to14FNcxx . . $ M1_Gamma8to14FN# M1_Gamma8to14cxx . . $ mitsu_lib#M1_Gamma8to14.; |
| 127 | M1_CalcRGBRateFNcxx . . $ M1_CalcRGBRateFN# M1_CalcRGBRatecxx . . $ mitsu_lib#M1_CalcRGBRate.; |
| 128 | M1_CalcOpRateGlossFNcxx . . $ M1_CalcOpRateGlossFN# M1_CalcOpRateGlosscxx . . $ mitsu_lib#M1_CalcOpRateGloss.; |
| 129 | M1_CalcOpRateMatteFNcxx . . $ M1_CalcOpRateMatteFN# M1_CalcOpRateMattecxx . . $ mitsu_lib#M1_CalcOpRateMatte.; |
| 130 | CPD30_GetDataFNcxx . . $ CPD30_GetDataFN# CPD30_GetDatacxx . . $ mitsu_lib#CPD30_GetData.; |
| 131 | CPD30_DestroyDataFNcxx . . $ CPD30_DestroyDataFN# CPD30_DestroyDatacxx . . $ mitsu_lib#CPD30_DestroyData.; |
| 132 | CPD30_DoConvertFNcxx . . $ CPD30_DoConvertFN# CPD30_DoConvertcxx . . $ mitsu_lib#CPD30_DoConvert.; |
| 133 | struct CColorConv3Dcxx . . $ CColorConv3D# *lutcxx . . $ mitsu_lib#lut.; |
| 134 | struct CPCDatacxx . . $ CPCData# *cpcdatacxx . . $ mitsu_lib#cpcdata.; |
| 135 | struct CPCDatacxx . . $ CPCData# *ecpcdatacxx . . $ mitsu_lib#ecpcdata.; |
| 136 | }; |
| 137 | |
| 138 | int mitsu_loadlibcxx . . $ mitsu_loadlib(9c3d640f682a40b7).(struct mitsu_libcxx . . $ mitsu_lib# *lib, int type); |
| 139 | int mitsu_destroylibcxx . . $ mitsu_destroylib(9b3b7107c7f9892a).(struct mitsu_libcxx . . $ mitsu_lib# *lib); |
| 140 | int mitsu_apply3dlut_packedcxx . . $ mitsu_apply3dlut_packed(fdcb6ac18ff06d28).(struct mitsu_libcxx . . $ mitsu_lib# *lib, const char *lutfname, uint8_tcxx . . $ uint8_t# *databuf, |
| 141 | uint16_tcxx . . $ uint16_t# cols, uint16_tcxx . . $ uint16_t# rows, uint16_tcxx . . $ uint16_t# stride, |
| 142 | int rgb_bgr); |
| 143 | int mitsu_apply3dlut_planecxx . . $ mitsu_apply3dlut_plane(360a1387484245d8).(struct mitsu_libcxx . . $ mitsu_lib# *lib, const char *lutfname, |
| 144 | uint8_tcxx . . $ uint8_t# *data_r, uint8_tcxx . . $ uint8_t# *data_g, uint8_tcxx . . $ uint8_t# *data_b, |
| 145 | uint16_tcxx . . $ uint16_t# cols, uint16_tcxx . . $ uint16_t# rows); |
| 146 | int mitsu_readlamdatacxx . . $ mitsu_readlamdata(9e68d7da9333b61d).(const char *fname, uint16_tcxx . . $ uint16_t# lamstride, |
| 147 | uint8_tcxx . . $ uint8_t# *databuf, uint32_tcxx . . $ uint32_t# *datalen, |
| 148 | uint16_tcxx . . $ uint16_t# rows, uint16_tcxx . . $ uint16_t# cols, uint8_tcxx . . $ uint8_t# bpp); |
| 149 | |
| 150 | #define TEMPERATURE_NORMALcxx . . $ `src/cups/backend_mitsu.h:150:9`! 0x00 |
| 151 | #define TEMPERATURE_PREHEATcxx . . $ `src/cups/backend_mitsu.h:151:9`! 0x40 |
| 152 | #define TEMPERATURE_COOLINGcxx . . $ `src/cups/backend_mitsu.h:152:9`! 0x80 |
| 153 | |
| 154 | const char *mitsu_temperaturescxx . . $ mitsu_temperatures(42624c5f3be67010).(uint8_tcxx . . $ uint8_t# temp); |
| 155 | const char *mitsu_media_typescxx . . $ mitsu_media_types(c1683707af617231).(int printer, uint8_tcxx . . $ uint8_t# brand, uint8_tcxx . . $ uint8_t# type); |