mitsu70x: Bundle the library and rearrange a few things.

The backend still doesn't dynamically load it yet, but that's next.
This commit is contained in:
Solomon Peachy 2016-10-05 09:48:29 -04:00
parent 8b99dda63d
commit 8d54da9ded
30 changed files with 1425 additions and 17 deletions

View file

@ -68,12 +68,6 @@ install:
$(INSTALL) -o root -m 700 $(EXEC_NAME) $(CUPS_BACKEND_DIR)/$(BACKEND_NAME)
$(MKDIR) -p $(CUPS_DATA_DIR)/usb
$(INSTALL) -o root -m 644 blacklist $(CUPS_DATA_DIR)/usb/net.sf.gimp-print.usb-quirks
ifneq ($(BACKEND_DATA_DIR),)
$(MKDIR) -p $(BACKEND_DATA_DIR)
$(INSTALL) -o root -m 644 D70/*raw $(BACKEND_DATA_DIR)
$(INSTALL) -o root -m 644 D70/*lut $(BACKEND_DATA_DIR)
$(INSTALL) -o root -m 644 D70/*cpc $(BACKEND_DATA_DIR)
endif
clean:
$(RM) -f $(EXEC_NAME) $(BACKENDS) $(SOURCES:.c=.o)

35
README
View file

@ -541,19 +541,32 @@
*** VERY IMPORTANT ***
This family of printers all utilize an engine that requires the
host system to process the image data, converting color data and
performing thermal compensation via unknown algorithms.
In order to generate usable output, this family of printers require
the input data to be transformed using specific image processing
algorithms.
While Mitsibishi's proprietary Windows drivers include data tables
used by the image processing algorithms, the algorithms themselves
are unknown. So, while the printers are demonstratably functional,
the quality of the output is quite poor, and not suitable for
photographic output.
The library that implements this processing is dynamically loaded
at runtime. There is currently only one option:
Work is slowly underway to reverse-engineer this algorithm, but
there is no expectation that this effort will succeed in a reasonable
timeline.
* libMitsuD70ImageReProcess -- GPL'd re-implementation of the
Mitsubishi algorithms, available as source. No guaranteees are
made about its output quality as compared to Mitsubishi's
proprietary drivers, but it is generally considered quite good.
DISCLAIMER: Mitsubishi was not involved in the creation of
libMitsuD70ImageReProcess and is not responsible in any way for
any deficiencies in its output. They will provide no support if
it is used.
Do *NOT* contact Mitsubishi for support if you are using
any combination of gutenprint, selphy_print or
libMitsuD80ImageReProcess.
(Please see the full disclaimer in libMitsuD70ImageReProcess.c)
* If the above library is not found, the backend will fall back to
a very crude algorithm that generates low-quality results not
suitable for photographic output.
Valid commands:

View file

@ -16,6 +16,7 @@ RM ?= rm
CFLAGS += -Wall -Wextra -g -Os -std=c99 -fPIC --no-strict-overflow # -Wconversion
#LDFLAGS +=
#CPPFLAGS +=
CFLAGS += -funit-at-a-time
# Build stuff
SOURCES = libS6145ImageReProcess.c
@ -29,6 +30,7 @@ cppcheck:
$(CPPCHECK) -q -v --std=c99 --enable=all -I/usr/include $(CPPFLAGS) $(SOURCES)
install:
$(MKDIR) -p $(LIBDIR)
$(INSTALL) -o root -m 755 lib$(LIBS6145_NAME).so $(LIBDIR)
clean:
$(RM) -f lib$(LIBS6145_NAME).so *.o

48
lib70x/Makefile Normal file
View file

@ -0,0 +1,48 @@
# Basic stuff
LIBMITSUD70_NAME ?= MitsuD70ImageReProcess
# Destination directories
DESTDIR ?=
LIBDIR ?= $(DESTDIR)/usr/local/lib
BACKEND_DATA_DIR ?= $(PREFIX)/usr/share/gutenprint/backend_data
# Tools
CC ?= $(CROSS_COMPILE)gcc
CPPCHECK ?= cppcheck
MKDIR ?= mkdir
INSTALL ?= install
RM ?= rm
# Flags
CFLAGS += -Wall -Wextra -g -Os -std=c99 -fPIC --no-strict-overflow # -Wconversion
#LDFLAGS +=
#CPPFLAGS +=
CFLAGS += -funit-at-a-time
# Build stuff
SOURCES = libMitsuD70ImageReProcess.c
# And now the rules!
.PHONY: clean all install cppcheck
all: lib$(LIBMITSUD70_NAME).so
cppcheck:
$(CPPCHECK) -q -v --std=c99 --enable=all -I/usr/include $(CPPFLAGS) $(SOURCES)
install:
$(MKDIR) -p $(LIBDIR)
$(INSTALL) -o root -m 755 lib$(LIBMITSUD70_NAME).so $(LIBDIR)
$(MKDIR) -p $(BACKEND_DATA_DIR)
$(INSTALL) -o root -m 644 data/*raw $(BACKEND_DATA_DIR)
$(INSTALL) -o root -m 644 data/*lut $(BACKEND_DATA_DIR)
$(INSTALL) -o root -m 644 data/*cpc $(BACKEND_DATA_DIR)
clean:
$(RM) -f lib$(LIBMITSUD70_NAME).so *.o
lib$(LIBMITSUD70_NAME).so: $(SOURCES:.c=.o)
$(CC) $(LDFLAGS) -g -shared -o $@ $^
%.o: %.c
$(CC) -c $(CFLAGS) -o $@ $<

43
lib70x/README Normal file
View file

@ -0,0 +1,43 @@
LibMitsuD70ImageReProcess -- Re-implemented image processing library for
the Mitsubishi CP-D70 family of printers
Copyright (c) 2016 Solomon Peachy <pizza@shaftnet.org>
** ** ** ** Do NOT contact Mitsubishi about this library! ** ** ** **
This library is a platform-independent reimplementation of the image
processing algorithms that are necessary to utilize the Mitsubishi
CP-D70 family of printers.
Mitsubishi was *NOT* involved in the creation of this library, and is
not responsible in any way for the library or any deficiencies in its
output. They will provide no support if it is used.
However, without this library, it is nearly impossible to utilize the
D70 family of printers under Linux and similar operating systems.
The following printers are known (or expected) to function with this
library:
* Mitsubishi CP-D70DW
* Mitsubishi CP-D707DW
* Mitsubishi CP-K60DW-S
* Mitsubishi CP-D80DW
* Kodak 305
* Fuji ASK-300
** ** ** **
This library is released under the GNU GPL version 3. Unfortunately
this means that it cannot be bundled with Gutenprint.
In order to utilize this library with Gutenprint, you will need:
* Gutenprint 5.2.12-pre4 or newer
* Current selphy_print backend
* This library
To build this library:
make
make install

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,105 @@
/* LibMitsuD70ImageReProcess -- Re-implemented image processing library for
the Mitsubishi CP-D70 family of printers
Copyright (c) 2016 Solomon Peachy <pizza@shaftnet.org>
** ** ** ** Do NOT contact Mitsubishi about this library! ** ** ** **
This library is a platform-independent reimplementation of the image
processing algorithms that are necessary to utilize the Mitsubishi
CP-D70 family of printers.
Mitsubishi was *NOT* involved in the creation of this library, and is
not responsible in any way for the library or any deficiencies in its
output. They will provide no support if it is used.
However, without this library, it is nearly impossible to utilize the
D70 family of printers under Linux and similar operating systems.
The following printers are known (or expected) to function with this
library:
* Mitsubishi CP-D70DW
* Mitsubishi CP-D707DW
* Mitsubishi CP-K60DW-S
* Mitsubishi CP-D80DW
* Kodak 305
* Fuji ASK-300
** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
[http://www.gnu.org/licenses/gpl-3.0.html]
*/
#ifndef __MITSU_D70_H
#define __MITSU_D70_H
#include <stdint.h>
/* Defines an image. Note that origin_cols/origin_rows should always = 0 */
struct BandImage {
void *imgbuf; // @0
int32_t bytes_per_row;// @4 bytes per row (respect 8bpp and 16bpp!)
uint16_t origin_cols; // @8 origin_cols
uint16_t origin_rows; // @12 origin_rows
uint16_t cols; // @16 cols
uint16_t rows; // @20 rows
// @24
};
/* Forward-declaration */
struct CPCData;
/* Load and parse CPC data. */
struct CPCData *get_CPCData(const char *filename);
/* Destroy the CPC data */
void destroy_CPCData(struct CPCData *data);
/* Perform all processing on the 8bpp packed BGR input image, and generate a
fully-corrected 16bpp YMC packed output image.
Returns 0 if successful, non-zero for error */
int do_image_effect(struct CPCData *cpc, struct BandImage *input, struct BandImage *output,
int sharpen);
/* Converts the packed 16bpp YMC image into 16bpp YMC planes, with
proper padding after each plane. Calls the callback function for each
block. */
int send_image_data(struct BandImage *out, void *context,
int (*callback_fn)(void *context, void *buffer, uint32_t len));
/* 3D Color Look-Up-Table */
#define COLORCONV_RGB 0
#define COLORCONV_BGR 1
#define LUT_LEN 14739
/* Forward-Declaration */
struct CColorConv3D;
/* Read the LUT off of disk */
int CColorConv3D_Get3DColorTable(uint8_t *buf, const char *filename);
/* Parse the LUT from disk */
struct CColorConv3D *CColorConv3D_Load3DColorTable(const uint8_t *ptr);
/* Destroy the LUT */
void CColorConv3D_Destroy3DColorTable(struct CColorConv3D *this);
/* Run a packed 8bpp rgb or bgr image through the LUT */
void CColorConv3D_DoColorConv(struct CColorConv3D *this, uint8_t *data, uint16_t cols, uint16_t rows, uint32_t bytes_per_row, int rgb_bgr);
#endif /* __MITSU_D70_H */