高于300dpi改为文件缓存模式

This commit is contained in:
masayume_ht 2021-08-05 19:03:07 +08:00
parent 043aba521c
commit 2d276cd03b
3 changed files with 49 additions and 6 deletions

View File

@ -458,10 +458,20 @@ void GScanO1003399::usb_run()
else {
while (!scanner_read_reg(m_usb, SR_GET_IMAGEPROCESSDONE))
this_thread::sleep_for(chrono::microseconds(30));
if (scanner_read_reg(m_usb, SR_GET_KEEP_LAST_PAPER))
{
this_thread::sleep_for(chrono::milliseconds(100));
im_rx();
if (m_param.is_duplex)
pop_dev_im();
pop_dev_im();
}
else
{
keeplastimg = false;
im_rx();
}
}
scanflag = false;
if ((devState != DEV_WRONG) && (get_ErrorCode()<=0))
devState = DEV_STOP;
@ -569,9 +579,39 @@ void GScanO1003399::im_rx()
else
image++;
UpdateScanInfo(countNReaded(), get_imgTransfered());
if (m_param.resolution_dst > 200.0f || m_param.papertype == 52 || m_param.papertype == 54 || m_param.papertype == 131)
{
auto path = cv::tempfile();
auto fd = fopen(path.c_str(), "wr+");
if (fd)
{
fwrite(buffi->data(), buffi->size(), 1, fd);
fclose(fd);
m_paths.push(path);
}
else {
FileTools::writelog(log_ERROR, "img temp file save error flie name =" + path);
}
}
else {
imgs.Put(buffi);
}
fu_imgpro.push(m_imgprocthread.enqueue([this] {
if (m_param.resolution_dst > 200.0f || m_param.papertype == 52 || m_param.papertype == 54 || m_param.papertype == 131)
{
if (m_imagedata.Size() > 1)
{
this_thread::sleep_for(chrono::milliseconds(10));
}
else
{
}
}
else
{
imgproce(imgs.Take());
}
}));
while (fu_imgpro.size()>1)
{

View File

@ -85,6 +85,8 @@ private:
ThreadPool m_imgprocthread;
std::shared_ptr<std::thread> m_usbthread;
std::shared_ptr<std::vector<char>> im_data;
std::queue<std::string> m_paths;
BlockingQueue<std::shared_ptr<std::vector<unsigned char>>> m_imagedata;
std::atomic_int image;
void* huagods;

View File

@ -179,6 +179,7 @@ enum Scanner_Reg_Defs
SR_GET_SLEEPTIME,
SR_GET_SLEEP_STAUTUS,
SR_GET_IMAGEPROCESSDONE,
SR_GET_KEEP_LAST_PAPER,
SR_GET_CUO_ERROR = 0x50,
SR_GET_DOU_ERROR,
SR_GET_JAM_ERROR,