mask file
Opened this issue · 0 comments
Hi @trufanov-nok and @plzombie .
Собственно, jpeg кодер. Возникла задача дополнительной фильтрации по маске. Саму задачу изложил здесь: wfus/jpeg-compressor@839ca29#commitcomment-120504770 . Продублирую:
This encoder is specific and ideal for comic book material. It is more suitable for such material than mozjpeg (IMHO).
For certain purposes (https://github.com/ImageProcessing-ElectronicPublications/imthreshold/blob/master/bash/pdf/mfbpdf-jbig2jpge.sh), I would like to have an additional optional quantizer in this encoder, set by the mask file:
jpge [options] <source_file> <dest_file> <quality_factor> [mask_file]
Where for each 8x8 block mask_file
, the average brightness value is calculated: qmask=sum(area8x8)/count(area8x8)
. And with the help of these values, additional filtering is performed:
/* DCT = qmask_back(qmask_forward(DCT)) */
DCT[blokid][i][j] = (int) (DCT[blockid][i][j] * (qmask[blockid] + 1) / 256); // forward
DCT[blokid][i][j] = (int) (DCT[blockid][i][j] * 256 / (qmask[blockid] + 1)); // back
Сам явно не потяну. Или потяну, но не сейчас и криво.
Буду рад любой помощи. Не буду ни капли не против приглашения людей "со стороны".
См. также ImageProcessing-ElectronicPublications/jpegquant@287610c