问题描述
我将这个 Tiny JPEG Decompressor 用于我在 STM32F4 中的嵌入式项目。我意识到我需要进一步缩小我的图像,但 Tiny JPEG Decompressor 仅支持 (1/2)^N (N = 0 到 3) 缩小。
我查看了它的 C 源代码,但不确定在哪里编辑它,以便我可以将除垢因子增加到 N=4 和 N=5。
这是除垢的部分:
JRESULT jd_decomp (JDEC* jd,uint16_t (*outfunc)(JDEC*,void*,JRECT*),uint8_t scale){
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;}
C 文件也可以在这里下载:JPEG Decompressor Source Code
如果有人能帮忙,我非常感谢。
问候, 提姆
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)