bitbank2/JPEGDEC

Seeing artifacts when using new cropping feature.

andrewleek-droplab opened this issue · 8 comments

Describe the bug
Im attempting to utilized the new cropping feature but am getting artifacts on the right side of the lcd. The image size is 400x296, and I am trying to crop it down to 320x240.

To Reproduce
Here is the code i am using:
if (jpeg.openRAM((uint8_t *)fb->buf, fb->len, drawMCUs))
{
jpeg.setPixelType(RGB565_BIG_ENDIAN); // The SPI LCD wants the 16-bit pixels in big-endian order
jpeg.setCropArea(0,0,320,240);
jpeg.decode(0,0,0);
jpeg.close();
}

Expected behavior
It should show a clean image without artifacting.

Image file you're having trouble with
Attached is an image of what i am seeing.
cropping_artifacts

Additional context
Additionally I have set the crop area to (80,56,320,240) and the image displayed correctly, without artifacting.

Can you share your whole test program?

Never mind; I'm able to reproduce it. Will have a fix soon.

ok, I pushed a fix; please give it a try.

Well that fixed the artifacting, but now the fps has dropped from around 17 to 10.

Well that fixed the artifacting, but now the fps has dropped from around 17 to 10.

The cropping + variable number of MCUs per JPEGDraw call becomes quite complex, so I changed it to output a single MCU at a time. This feature was tested for full framebuffer output, that's why I missed the problem with JPEGDraw. I can take another pass to try to improve the speed again.

ok, I added some more logic to maximize the number of MCUs emitted per JPEGDraw call even when cropping. Please give it a try.

I'm calling this fixed

Pardon the delay. Yes I can confirm this is fixed.

Thank you so much!