Pull image processing announcement blurbs into the main program

This commit is contained in:
Solomon Peachy 2020-08-11 13:18:49 -04:00
parent c096b741a3
commit 1bd14cff80
7 changed files with 44 additions and 29 deletions

View File

@ -52,6 +52,7 @@ int mitsu_loadlib(struct mitsu_lib *lib, int type)
lib->dl_handle = NULL;
return CUPS_BACKEND_FAILED;
}
lib->DumpAnnounce = DL_SYM(lib->dl_handle, "dump_announce");
lib->Get3DColorTable = DL_SYM(lib->dl_handle, "CColorConv3D_Get3DColorTable");
lib->Load3DColorTable = DL_SYM(lib->dl_handle, "CColorConv3D_Load3DColorTable");
@ -91,6 +92,8 @@ int mitsu_loadlib(struct mitsu_lib *lib, int type)
return CUPS_BACKEND_FAILED;
} else {
DEBUG("Image processing library successfully loaded\n");
if (lib->DumpAnnounce)
lib->DumpAnnounce(logger);
}
}

View File

@ -49,6 +49,7 @@ struct mitsu98xx_data; /* Forward declaration */
struct M1CPCData;
#endif
typedef void (*dump_announceFN)(FILE *fp);
typedef int (*lib70x_getapiversionFN)(void);
typedef int (*Get3DColorTableFN)(uint8_t *buf, const char *filename);
typedef struct CColorConv3D *(*Load3DColorTableFN)(const uint8_t *ptr);
@ -83,7 +84,7 @@ typedef uint8_t (*M1_CalcOpRateGlossFN)(uint16_t rows, uint16_t cols);
#warning "No dynamic loading support!"
#endif
#define REQUIRED_LIB_APIVERSION 6
#define REQUIRED_LIB_APIVERSION 7
#define LIBMITSU_VER "0.06"
@ -93,6 +94,7 @@ typedef uint8_t (*M1_CalcOpRateGlossFN)(uint16_t rows, uint16_t cols);
struct mitsu_lib {
void *dl_handle;
lib70x_getapiversionFN GetAPIVersion;
dump_announceFN DumpAnnounce;
Get3DColorTableFN Get3DColorTable;
Load3DColorTableFN Load3DColorTable;
Destroy3DColorTableFN Destroy3DColorTable;

View File

@ -47,6 +47,8 @@
#endif
/* Image processing library function prototypes */
typedef void (*dump_announceFN)(FILE *fp);
typedef int (*ImageProcessingFN)(unsigned char *, unsigned short *, void *);
typedef int (*ImageAvrCalcFN)(unsigned char *, unsigned short, unsigned short, unsigned char *);
@ -691,6 +693,7 @@ struct shinkos6145_ctx {
void *dl_handle;
dump_announceFN DumpAnnounce;
ImageProcessingFN ImageProcessing;
ImageAvrCalcFN ImageAvrCalc;
@ -1270,6 +1273,7 @@ static int shinkos6145_attach(void *vctx, struct libusb_device_handle *dev, int
if (!ctx->dl_handle)
ctx->dl_handle = DL_OPEN(LIB2245_NAME_RE); /* Then the RE one */
if (ctx->dl_handle) {
ctx->DumpAnnounce = DL_SYM(ctx->dl_handle, "dump_announce");
ctx->ip_imageProc = DL_SYM(ctx->dl_handle, "ip_imageProc");
ctx->ip_checkIpp = DL_SYM(ctx->dl_handle, "ip_checkIpp");
ctx->ip_getMemorySize = DL_SYM(ctx->dl_handle, "ip_getMemorySize");
@ -1279,6 +1283,8 @@ static int shinkos6145_attach(void *vctx, struct libusb_device_handle *dev, int
ctx->dl_handle = NULL;
} else {
INFO("Image processing library successfully loaded\n");
if (ctx->DumpAnnounce)
ctx->DumpAnnounce(logger);
}
}
#endif
@ -1294,6 +1300,7 @@ static int shinkos6145_attach(void *vctx, struct libusb_device_handle *dev, int
if (!ctx->dl_handle)
ctx->dl_handle = DL_OPEN(LIB6145_NAME_RE); /* Then the RE one */
if (ctx->dl_handle) {
ctx->DumpAnnounce = DL_SYM(ctx->dl_handle, "dump_announce");
ctx->ImageProcessing = DL_SYM(ctx->dl_handle, "ImageProcessing");
ctx->ImageAvrCalc = DL_SYM(ctx->dl_handle, "ImageAvrCalc");
if (!ctx->ImageProcessing || !ctx->ImageAvrCalc) {
@ -1302,6 +1309,8 @@ static int shinkos6145_attach(void *vctx, struct libusb_device_handle *dev, int
ctx->dl_handle = NULL;
} else {
INFO("Image processing library successfully loaded\n");
if (ctx->DumpAnnounce)
ctx->DumpAnnounce(logger);
}
}
#endif

View File

@ -1648,6 +1648,15 @@ done:
//-------------------------------------------------------------------------
// Exported Functions
void dump_announce(FILE *fp)
{
fprintf(fp, "INFO: libS2245ImageReProcess version '%s'\n", LIB_VERSION);
fprintf(fp, "INFO: Copyright (c) 2020 Solomon Peachy\n");
fprintf(fp, "INFO: This free software comes with ABSOLUTELY NO WARRANTY!\n");
fprintf(fp, "INFO: Licensed under the GNU GPLv3.\n");
fprintf(fp, "INFO: *** This code is NOT supported or endorsed by Sinfonia! ***\n");
}
bool ip_imageProc(uint16_t *destData, uint8_t *srcInRgb,
uint16_t width, uint16_t height, void *srcIpp)
{
@ -1655,12 +1664,6 @@ bool ip_imageProc(uint16_t *destData, uint8_t *srcInRgb,
struct CIppMng ippMng;
struct CImageProc imageProc;
fprintf(stderr, "INFO: libS2245ImageReProcess version '%s'\n", LIB_VERSION);
fprintf(stderr, "INFO: Copyright (c) 2020 Solomon Peachy\n");
fprintf(stderr, "INFO: This free software comes with ABSOLUTELY NO WARRANTY!\n");
fprintf(stderr, "INFO: Licensed under the GNU GPLv3.\n");
fprintf(stderr, "INFO: *** This code is NOT supported or endorsed by Sinfonia! ***\n");
CIppMng_Init(&ippMng);
CImageProc_Init(&imageProc, &ippMng);

View File

@ -439,16 +439,21 @@ int ImageAvrCalc(uint8_t *input, uint16_t cols, uint16_t rows, uint8_t *avg)
return 0;
}
void dump_announce(FILE *fp)
{
fprintf(fp, "INFO: libS6145ImageReProcess version '%s'\n", LIB_VERSION);
fprintf(fp, "INFO: Copyright (c) 2015-2020 Solomon Peachy\n");
fprintf(fp, "INFO: This free software comes with ABSOLUTELY NO WARRANTY!\n");
fprintf(fp, "INFO: Licensed under the GNU GPLv3.\n");
fprintf(fp, "INFO: *** This code is NOT supported or endorsed by Sinfonia! ***\n");
}
int ImageProcessing(unsigned char *in, unsigned short *out, void *corrdata)
{
uint8_t i;
struct lib6145_ctx *ctx;
fprintf(stderr, "INFO: libS6145ImageReProcess version '%s'\n", LIB_VERSION);
fprintf(stderr, "INFO: Copyright (c) 2015-2020 Solomon Peachy\n");
fprintf(stderr, "INFO: This free software comes with ABSOLUTELY NO WARRANTY!\n");
fprintf(stderr, "INFO: Licensed under the GNU GPLv3.\n");
fprintf(stderr, "INFO: *** This code is NOT supported or endorsed by Sinfonia! ***\n");
if (!in)
return 1;

View File

@ -1190,21 +1190,19 @@ static void CImageEffect70_DoGamma(struct CImageEffect70 *data, struct BandImage
}
}
static void dump_announce(void)
void dump_announce(FILE *fp)
{
fprintf(stderr, "INFO: libMitsuD70ImageReProcess version '%s' API %d\n", LIB_VERSION, LIB_APIVERSION);
fprintf(stderr, "INFO: Copyright (c) 2016-2020 Solomon Peachy\n");
fprintf(stderr, "INFO: This free software comes with ABSOLUTELY NO WARRANTY!\n");
fprintf(stderr, "INFO: Licensed under the GNU GPLv3.\n");
fprintf(stderr, "INFO: *** This code is NOT supported or endorsed by Mitsubishi! ***\n");
fprintf(fp, "INFO: libMitsuD70ImageReProcess version '%s' API %d\n", LIB_VERSION, LIB_APIVERSION);
fprintf(fp, "INFO: Copyright (c) 2016-2020 Solomon Peachy\n");
fprintf(fp, "INFO: This free software comes with ABSOLUTELY NO WARRANTY!\n");
fprintf(fp, "INFO: Licensed under the GNU GPLv3.\n");
fprintf(fp, "INFO: *** This code is NOT supported or endorsed by Mitsubishi! ***\n");
}
int do_image_effect80(struct CPCData *cpc, struct CPCData *ecpc, struct BandImage *input, struct BandImage *output, int sharpen, int reverse, uint8_t rew[2])
{
struct CImageEffect70 *data;
dump_announce();
data = CImageEffect70_Create(cpc);
if (!data)
return -1;
@ -1254,8 +1252,6 @@ int do_image_effect60(struct CPCData *cpc, struct CPCData *ecpc, struct BandImag
UNUSED(ecpc);
dump_announce();
data = CImageEffect70_Create(cpc);
if (!data)
return -1;
@ -1291,8 +1287,6 @@ int do_image_effect70(struct CPCData *cpc, struct CPCData *ecpc, struct BandImag
UNUSED(ecpc);
UNUSED(rew);
dump_announce();
data = CImageEffect70_Create(cpc);
if (!data)
return -1;
@ -2281,8 +2275,6 @@ int CP98xx_DoConvert(const struct mitsu98xx_data *table,
{
uint32_t i;
dump_announce();
/* Figure out which table to use */
switch (type) {
case 0x80:
@ -2732,8 +2724,6 @@ void M1_Gamma8to14(const struct M1CPCData *cpc,
const uint8_t *inp;
uint16_t *outp;
dump_announce();
rows = in->rows - in->origin_rows;
cols = in->cols - in->origin_cols;

View File

@ -62,7 +62,7 @@
#ifndef __MITSU_D70_H
#define __MITSU_D70_H
#define LIB_APIVERSION 6
#define LIB_APIVERSION 7
#include <stdint.h>
@ -80,6 +80,9 @@ struct BandImage {
/* Get version */
int lib70x_getapiversion(void);
/* print annoucement blurb */
void dump_announce(FILE *fp);
/* Forward-declaration */
struct CPCData;