Bodmer / TJpg_Decoder

Jpeg decoder library based on Tiny JPEG Decompressor
Other
222 stars 42 forks source link

Image is not fully rendered #62

Closed Blueforcer closed 1 year ago

Blueforcer commented 1 year ago

I have a very strange phenomenon. I am rendering an image on a 32x8 WS2812 RGB matrix with this lib and RGB565 output format . Rendering 8x8 works great. but as soon as i try a 32x8 image only 16x8 is rendered.

I have already tried to debug something: While struct JDEC in jd_prepare recognizes 32 as image width, JRECT in mcu_output has only a "right" of 15. Accordingly, the image is rendered only half in width.

Is there a possible limitation of the aspect ratio?

Bodmer commented 1 year ago

There is no width or height restriction in the library for this case.

The problem is likely to be in the sketch. Note that the image will be rendered as a series of MCU blocks, typically 8x8 or 16x16 pixels.

Post the rendering sketch.

Blueforcer commented 1 year ago

Complete sketch?

here is only the rendering from the callback. the width parameter is 16 instead of 32

bool jpg_output(int16_t x, int16_t y, uint16_t w, uint16_t h, uint16_t *bitmap)  
{  
    uint16_t bitmapIndex = 0;  
    for (uint16_t row = 0; row < h; row++)  
    {  
        for (uint16_t col = 0; col < w; col++)  
        {  
            matrix->drawPixel(x + col, y + row, bitmap[bitmapIndex++]);  
        }  
    }  
    return 0;  
}  
Bodmer commented 1 year ago

A complete sketch helps as in some cases the problem is not where it is thought to be.

Maybe the display is configured to be 8 x 32 instead of 32 x 8?

Some simple test code could verify this.

Bodmer commented 1 year ago

Assumed resolved.