kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Write all offset calibration debug to a single file on gl843
rodzic
36bc194405
commit
988a91aec4
|
@ -3369,6 +3369,11 @@ gl843_offset_calibration (Genesys_Device * dev)
|
||||||
|
|
||||||
pass = 0;
|
pass = 0;
|
||||||
|
|
||||||
|
// FIXME: we'll leak debug image if we encounter errors below
|
||||||
|
Genesys_Vector debug_image = sanei_gl_vector_create(1);
|
||||||
|
size_t debug_image_lines = 0;
|
||||||
|
Genesys_Vector debug_image_info = sanei_gl_vector_create(1);
|
||||||
|
|
||||||
/* loop until acceptable level */
|
/* loop until acceptable level */
|
||||||
while ((pass < 32)
|
while ((pass < 32)
|
||||||
&& ((top[0] - bottom[0] > 1)
|
&& ((top[0] - bottom[0] > 1)
|
||||||
|
@ -3394,10 +3399,13 @@ gl843_offset_calibration (Genesys_Device * dev)
|
||||||
|
|
||||||
if (DBG_LEVEL >= DBG_data)
|
if (DBG_LEVEL >= DBG_data)
|
||||||
{
|
{
|
||||||
char fn[30];
|
char title[100];
|
||||||
snprintf(fn, 30, "gl843_offset_%03d_%03d_%03d.pnm", dev->frontend.offset[0],
|
snprintf(title, 100, "lines: %d pixels_per_line: %d offsets[0..2]: %d %d %d\n",
|
||||||
dev->frontend.offset[1], dev->frontend.offset[2]);
|
lines, pixels,
|
||||||
sanei_genesys_write_pnm_file(fn, second_line, bpp, channels, pixels, lines);
|
dev->frontend.offset[0], dev->frontend.offset[1], dev->frontend.offset[2]);
|
||||||
|
sanei_gl_vector_append(&debug_image_info, title, strlen(title));
|
||||||
|
sanei_gl_vector_append(&debug_image, second_line, total_size);
|
||||||
|
debug_image_lines += lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
|
@ -3421,6 +3429,18 @@ gl843_offset_calibration (Genesys_Device * dev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (DBG_LEVEL >= DBG_data)
|
||||||
|
{
|
||||||
|
sanei_genesys_write_file("gl843_offset_all_desc.txt",
|
||||||
|
(uint8_t*)debug_image_info.data, debug_image_info.size);
|
||||||
|
sanei_genesys_write_pnm_file("gl843_offset_all.pnm",
|
||||||
|
(uint8_t*)debug_image.data, bpp, channels, pixels, debug_image_lines);
|
||||||
|
}
|
||||||
|
|
||||||
|
sanei_gl_vector_destroy(&debug_image);
|
||||||
|
sanei_gl_vector_destroy(&debug_image_info);
|
||||||
|
|
||||||
DBG(DBG_info, "%s: offset=(%d,%d,%d)\n", __func__, dev->frontend.offset[0],
|
DBG(DBG_info, "%s: offset=(%d,%d,%d)\n", __func__, dev->frontend.offset[0],
|
||||||
dev->frontend.offset[1], dev->frontend.offset[2]);
|
dev->frontend.offset[1], dev->frontend.offset[2]);
|
||||||
|
|
||||||
|
|
|
@ -83,6 +83,23 @@ sanei_genesys_init_cmd_set (Genesys_Device * dev)
|
||||||
/* General IO and debugging functions */
|
/* General IO and debugging functions */
|
||||||
/* ------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
SANE_Status sanei_genesys_write_file(char *filename, uint8_t * data, size_t length)
|
||||||
|
{
|
||||||
|
FILE *out;
|
||||||
|
|
||||||
|
out = fopen (filename, "w");
|
||||||
|
if (!out) {
|
||||||
|
DBG(DBG_error, "%s: could nor open %s for writing: %s\n", __func__, filename,
|
||||||
|
strerror(errno));
|
||||||
|
return SANE_STATUS_INVAL;
|
||||||
|
}
|
||||||
|
fwrite(data, 1, length, out);
|
||||||
|
fclose(out);
|
||||||
|
|
||||||
|
DBG(DBG_proc, "%s: finished\n", __func__);
|
||||||
|
return SANE_STATUS_GOOD;
|
||||||
|
}
|
||||||
|
|
||||||
/* Write data to a pnm file (e.g. calibration). For debugging only */
|
/* Write data to a pnm file (e.g. calibration). For debugging only */
|
||||||
/* data is RGB or grey, with little endian byte order */
|
/* data is RGB or grey, with little endian byte order */
|
||||||
SANE_Status
|
SANE_Status
|
||||||
|
|
|
@ -1108,6 +1108,8 @@ sanei_genesys_search_reference_point (Genesys_Device * dev, uint8_t * data,
|
||||||
int start_pixel, int dpi, int width,
|
int start_pixel, int dpi, int width,
|
||||||
int height);
|
int height);
|
||||||
|
|
||||||
|
extern SANE_Status sanei_genesys_write_file(char *filename, uint8_t* data, size_t length);
|
||||||
|
|
||||||
extern SANE_Status
|
extern SANE_Status
|
||||||
sanei_genesys_write_pnm_file (const char *filename, uint8_t * data, int depth,
|
sanei_genesys_write_pnm_file (const char *filename, uint8_t * data, int depth,
|
||||||
int channels, int pixels_per_line, int lines);
|
int channels, int pixels_per_line, int lines);
|
||||||
|
|
Ładowanie…
Reference in New Issue