JRESULT jd_decomp (
JDEC* jd, /* Initialized decompression object */
UINT (*outfunc)(JDEC*, void*, JRECT*), /* RGB output function */
BYTE scale /* Output de-scaling factor (0 to 3) */
)
{
UINT x, y, mx, my;
WORD 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;
}
这是.jpg图像解码函数,在执行这个函数时,若发生串口中断,程序则会跑飞。
这是为什么呢???? |