Compare commits

...

2 commits

Author SHA1 Message Date
Solomon Peachy a604625ed5 mitsud80: We may need to slow print speed for some SuperFine prints
We can always rewind, but we might need to slow down to do so safely.

Requires an updated lib70x.
2024-06-03 21:59:16 -04:00
Solomon Peachy e44fbc2d0c lib70x: More fixes with respect to rewinding on the D80
* Only the EK305 uses a 10-entry REV table; the rest only use 4
 * Implement logic for 4-entry REV table lookups
 * On the D80, if we have to switch to the ECPC table, we also
   need slow from SF to UF print speeds.
2024-06-03 21:57:59 -04:00
4 changed files with 84 additions and 58 deletions

View file

@ -94,7 +94,7 @@ typedef int (*CPD30_DoConvertFN)(const struct mitsu_cpd30_data *table,
#warning "No dynamic loading support!"
#endif
#define REQUIRED_LIB_APIVERSION 9
#define REQUIRED_LIB_APIVERSION 10
#define LIBMITSU_VER "0.12"

View file

@ -1788,7 +1788,7 @@ static int mitsu70x_main_loop(void *vctx, const void *vjob, int wait_for_return)
goto bypass;
struct BandImage input;
uint8_t rew[2] = { 1, 1 }; /* 1 for rewind ok (default!) */
uint8_t rew[3] = { 1, 1, 1 }; /* 1 for rewind ok (default!) */
// XXX only allow rewinds for appropriate sizes?
/* Load in the CPC file, if needed */
@ -1847,12 +1847,16 @@ static int mitsu70x_main_loop(void *vctx, const void *vjob, int wait_for_return)
return CUPS_BACKEND_CANCEL;
}
/* We can't rewind when printing matte or on fine (fastest) speed */
if (job->matte || hdr->speed == 0)
rew[0] = 0;
/* Twiddle rewind stuff if needed */
if (ctx->conn->type != P_MITSU_D70X) {
/* We can't rewind when printing matte or on fine (fastest) speed */
if (job->matte || hdr->speed == 0)
rew[0] = 0;
/* We may need to lower the printspeed... */
if (rew[2] == 0 && hdr->speed == 3)
hdr->speed = 4;
hdr->rewind[0] = !rew[0];
hdr->rewind[1] = !rew[1];
DEBUG("Rewind Inhibit? %02x %02x\n", hdr->rewind[0], hdr->rewind[1]);
@ -2635,7 +2639,7 @@ static const struct device_id mitsu70x_devices[] = {
/* Exported */
const struct dyesub_backend mitsu70x_backend = {
.name = "Mitsubishi CP-D70 family",
.version = "0.113" " (lib " LIBMITSU_VER ")",
.version = "0.114" " (lib " LIBMITSU_VER ")",
.flags = BACKEND_FLAG_DUMMYPRINT,
.uri_prefixes = mitsu70x_prefixes,
.devices = mitsu70x_devices,

View file

@ -57,7 +57,7 @@
*/
#define LIB_VERSION "0.10.7"
#define LIB_VERSION "0.10.8"
#include <stdio.h>
#include <stdint.h>
@ -172,8 +172,9 @@ struct CPCData {
/* Used by roller mark correction (K60/D80/EK305) -- Unused! */
uint32_t ROLK[13]; // @42084
/* Used by reverse/skip logic (K60/D80/EK305) */
int32_t REV[190]; // @42136 // Actually int32_t[10][19]
int32_t REV[190]; // @42136 // Actually int32_t[10][19] EK305, or int32_t[4][19] on D80/K60
// @42440
int num_rev; // 0 or 4 or 10.
};
/*** Version ***/
@ -482,6 +483,7 @@ struct CPCData *get_CPCData(const char *filename)
if (!ptr)
continue;
data->REV[line] = strtol(ptr, NULL, 10);
data->num_rev++;
}
}
@ -1052,46 +1054,62 @@ static int CImageEffect70_JudgeReverseSkipRibbon(struct CPCData *cpc,
{
int offset = -1;
if (cols == 0x748) { // 6"
if (rows == 0x4c2) { // 6x4"
if (param1 == 1)
offset = 0; // REV[0][0] aka 6x4" p1
else if (param1 == 2)
offset = 19*2; // REV[2][0] aka 6x4" p2
} else if (rows == 0x39e ) { // 6x3"
if (param1 == 1)
offset = 19*5; // REV[5][0] aka 6x3" p1
else if (param1 == 2)
offset = 19*8; // REV[8][0] aka 6x3" p2
} else if (rows == 0x270 ) { // 6x2"
if (param1 == 1)
offset = 19*4; // REV[4][0] aka 6x2" p1
else if (param1 == 2)
offset = 19*7; // REV[7][0] aka 6x2" p2
if (cpc->num_rev == 10) { /* EK305 only */
if (cols == 0x748) { // 6"
if (rows == 0x4c2) { // 6x4"
if (param1 == 1)
offset = 0; // REV[0][0] aka 6x4" p1
else if (param1 == 2)
offset = 2; // REV[2][0] aka 6x4" p2
} else if (rows == 0x39e ) { // 6x3"
if (param1 == 1)
offset = 5; // REV[5][0] aka 6x3" p1
else if (param1 == 2)
offset = 8; // REV[8][0] aka 6x3" p2
} else if (rows == 0x270 ) { // 6x2"
if (param1 == 1)
offset = 4; // REV[4][0] aka 6x2" p1
else if (param1 == 2)
offset = 7; // REV[7][0] aka 6x2" p2
}
} else if (cols == 0x620) { // 5"
if (rows == 0x434) {
if (param1 == 1) // 5x3.5"
offset = 1; // REV[1][0] aka 5x3.5" p1
else if (param1 == 2)
offset = 3; // REV[3][0] aka 5x3.5" p2
} else if (rows == 0x39e) { // 5x3"
if (param1 == 1)
offset = 6; // REV[6][0] aka 5x3" p1
else if (param1 == 2)
offset = 9; // REV[9][0] aka 5x3" p2
}
}
} else if (cols == 0x620) { // 5"
if (rows == 0x434) {
if (param1 == 1) // 5x3.5"
offset = 19*1; // REV[1][0] aka 5x3.5" p1
else if (param1 == 2)
offset = 19*3; // REV[3][0] aka 5x3.5" p2
} else if (rows == 0x39e) { // 5x3"
if (param1 == 1)
offset = 19*6; // REV[6][0] aka 5x3" p1
else if (param1 == 2)
offset = 19*9; // REV[9][0] aka 5x3" p2
} else if (cpc->num_rev == 4) { /* All others */
// XXX D80 always seems to call this with param1 = 1, and 6" paper type
if (param1 == 1) {
if (cols == 0x748) {
offset = 0; // 6"
} else {
offset = 1; // 5"
}
} else {
if (cols == 0x748) {
offset = 2; // 6"
} else {
offset = 3; // 5"
}
}
}
/* Make sure we have a table entry; if not, no rewind for you! */
if (! cpc->REV[offset])
offset = -1;
if (offset == -1)
return 0;
if (offset != -1) {
return CImageEffect70_JudgeReverseSkipRibbon_int(img, &cpc->REV[offset], 1);
}
if (19*offset >= cpc->num_rev || !cpc->REV[19*offset])
return 0;
return 0; /* Do NOT rewind is default */
return CImageEffect70_JudgeReverseSkipRibbon_int(img, &cpc->REV[19*offset], 1);
}
static void CImageEffect70_DoConv(struct CImageEffect70 *data,
@ -1239,7 +1257,7 @@ void dump_announce(FILE *fp)
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])
int do_image_effect80(struct CPCData *cpc, struct CPCData *ecpc, struct BandImage *input, struct BandImage *output, int sharpen, int reverse, uint8_t rew[3])
{
struct CImageEffect70 *data;
@ -1249,19 +1267,23 @@ int do_image_effect80(struct CPCData *cpc, struct CPCData *ecpc, struct BandImag
CImageEffect70_DoGamma(data, input, output, reverse);
if (ecpc && (cpc->REV[0]) &&
!CImageEffect70_JudgeReverseSkipRibbon(cpc, output, input->cols, input->rows, 1)) {
/* Switch to ecpc file, and try again */
CImageEffect70_Destroy(data);
data = CImageEffect70_Create(ecpc);
if (!data)
return -1;
if (ecpc && (cpc->REV[0])) {
int result = CImageEffect70_JudgeReverseSkipRibbon(cpc, output, input->cols, input->rows, 1);
if (!result) {
/* Switch to ecpc file, and try again */
CImageEffect70_Destroy(data);
data = CImageEffect70_Create(ecpc);
if (!data)
return -1;
CImageEffect70_DoGamma(data, input, output, reverse);
CImageEffect70_DoGamma(data, input, output, reverse);
}
rew[2] = result;
}
rew[1] = 1;
// rew[0] = 1 unless speed is 0.
// rew[0] = 1;
// XXX on D80, speed == 0 seems to be the _only_ determination of rewind disable.
CImageEffect70_DoConv(data, cpc, output, output, sharpen);
@ -1270,7 +1292,7 @@ int do_image_effect80(struct CPCData *cpc, struct CPCData *ecpc, struct BandImag
return 0;
}
int do_image_effect60(struct CPCData *cpc, struct CPCData *ecpc, struct BandImage *input, struct BandImage *output, int sharpen, int reverse, uint8_t rew[2])
int do_image_effect60(struct CPCData *cpc, struct CPCData *ecpc, struct BandImage *input, struct BandImage *output, int sharpen, int reverse, uint8_t rew[3])
{
struct CImageEffect70 *data;
@ -1294,7 +1316,7 @@ int do_image_effect60(struct CPCData *cpc, struct CPCData *ecpc, struct BandImag
return 0;
}
int do_image_effect70(struct CPCData *cpc, struct CPCData *ecpc, struct BandImage *input, struct BandImage *output, int sharpen, int reverse, uint8_t rew[2])
int do_image_effect70(struct CPCData *cpc, struct CPCData *ecpc, struct BandImage *input, struct BandImage *output, int sharpen, int reverse, uint8_t rew[3])
{
struct CImageEffect70 *data;

View file

@ -67,7 +67,7 @@
#ifndef __MITSU_D70_H
#define __MITSU_D70_H
#define LIB_APIVERSION 9
#define LIB_APIVERSION 10
#include <stdint.h>
@ -102,13 +102,13 @@ void destroy_CPCData(struct CPCData *data);
Returns 0 if successful, non-zero for error */
int do_image_effect70(struct CPCData *cpc, struct CPCData *ecpc,
struct BandImage *input, struct BandImage *output,
int sharpen, int reverse, uint8_t rew[2]);
int sharpen, int reverse, uint8_t rew[3]);
int do_image_effect60(struct CPCData *cpc, struct CPCData *ecpc,
struct BandImage *input, struct BandImage *output,
int sharpen, int reverse, uint8_t rew[2]);
int sharpen, int reverse, uint8_t rew[3]);
int do_image_effect80(struct CPCData *cpc, struct CPCData *ecpc,
struct BandImage *input, struct BandImage *output,
int sharpen, int reverse, uint8_t rew[2]);
int sharpen, int reverse, uint8_t rew[3]);
/* Converts the packed 16bpp YMC image into 16bpp YMC planes, with
proper padding after each plane. Calls the callback function for each