chandlerbing65nm
Member level 5
Hello folks,
I am using this Tiny JPEG Decompressor for my embedded project in STM32F4. I realized that I needed my images to be further descaled down but the Tiny JPEG Decompressor only supports (1/2)^N (N = 0 to 3) descaling.
I've looked into its C source code but not sure where to edit it such that I can increase the descaling factor to N=4 and N=5.
This is the part where descaling takes place:
The C file can also be downloadable here: JPEG Decompressor Source Code
If someone can help, I'm very much thankful.
Regards,
Tim
I am using this Tiny JPEG Decompressor for my embedded project in STM32F4. I realized that I needed my images to be further descaled down but the Tiny JPEG Decompressor only supports (1/2)^N (N = 0 to 3) descaling.
I've looked into its C source code but not sure where to edit it such that I can increase the descaling factor to N=4 and N=5.
This is the part where descaling takes place:
C:
/*-----------------------------------------------------------------------*/
/* Start to decompress the JPEG picture */
/*-----------------------------------------------------------------------*/
JRESULT jd_decomp (
JDEC* jd, /* Initialized decompression object */
uint16_t (*outfunc)(JDEC*, void*, JRECT*), /* RGB output function */
uint8_t scale /* Output de-scaling factor (0 to 3) */
)
{
uint16_t x, y, mx, my;
uint16_t rst, rsc;
JRESULT rc;
if (scale > (JD_USE_SCALE ? 3 : 0)) return JDR_PAR;
jd->scale = scale;
mx = jd->msx * 8; my = jd->msy * 8; /* Size of the MCU (pixel) */
jd->dcv[2] = jd->dcv[1] = jd->dcv[0] = 0; /* Initialize DC values */
rst = rsc = 0;
rc = JDR_OK;
for (y = 0; y < jd->height; y += my) { /* Vertical loop of MCUs */
for (x = 0; x < jd->width; x += mx) { /* Horizontal loop of MCUs */
if (jd->nrst && rst++ == jd->nrst) { /* Process restart interval if enabled */
rc = restart(jd, rsc++);
if (rc != JDR_OK) return rc;
rst = 1;
}
rc = mcu_load(jd); /* Load an MCU (decompress huffman coded stream and apply IDCT) */
if (rc != JDR_OK) return rc;
rc = mcu_output(jd, outfunc, x, y); /* Output the MCU (color space conversion, scaling and output) */
if (rc != JDR_OK) return rc;
}
}
return rc;
}
The C file can also be downloadable here: JPEG Decompressor Source Code
If someone can help, I'm very much thankful.
Regards,
Tim