Memory issues to load a png image - any ideas?

Ulisses <[email protected]> Wed, 3 Jul 2019 09:36:03 -0300
Newsgroups gmane.comp.graphics.png.devel
Message-ID <CAGEwmk6FznzKNRMFvtNntkOVuErCCOYfxxWo25DC5UgOXy_D=g@mail.gmail.com>
Good day,

I've been working on displaying a png image in a 480w x 272h display. The
project I'm working on have 8Mbit external SRAM, being 512k for
LCD_LAYER0_FRAME_BUFFER (which is the unique layer being used) and 128k for
audio buffer.

I have then 384kg left to work with png images, but I'm having "not enough
memory" errors though. The image I'm trying to display have 1440 RowBytes
and 272 Height (as stated before). A total of 391680 (image only) bytes, if
the math is correct.

I mapped the memory allocations, and got this:

------------------------------------------
Bytes - Memory Addr - Description
------------------------------------------
600   - 0x600A034C  - png_ptr
2048  - 0x600A05B0  - png_ptr->zbuf
9520  - 0x600A0E60  - z_streamp strm
116   - 0x600A339C  - info_ptr
1508  - 0x600A341C  - png_ptr->big_row_buf
1441  - 0x600A3A0C  - png_ptr->prev_row
-------------------------------------------
Total allocated so far:
15233  bytes

----- NOT ALLOCATED DUE TO OVERFLOW:  -----

Memory to store the image:
391680 bytes (overflow)

Memory to allocate the array of row-pointers:
272    bytes

Total allocation needed:
407185 bytes

Total memory available:
393216 bytes
-------------------------------------------

As shown, the memory overflows when the allocation function tries to
allocate the 391680 (image) bytes.

Once it's the first time I'm working with compressed images, I'm a little
lost:

 - Is there a way to display this image, even if I have no enough memory to
allocate it "at once"? (I mean, any buffering tricks or something like that
to work around this?)

 - If there is, could anyone shed some light on me and show me some
implementation example for me to follow?

Thank you.

[]'s

_______________________________________________
png-mng-implement mailing list
png-mng-implement-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/png-mng-implement