Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, Quad, 1 invisible), 721 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Loading a lot really small BMP files. -> Memory problems #399113
04/11/12 13:15
04/11/12 13:15
Joined: Jan 2007
Posts: 2,247
Deutsch Niedersachsen
Puppeteer Offline OP
Expert
Puppeteer  Offline OP
Expert

Joined: Jan 2007
Posts: 2,247
Deutsch Niedersachsen
Hi!

In my current project I use BMPs to read vectors from them in context of the bitmaps. I currently use 5.5k bitmaps and it is going to be like ~20k when the project is done.
Those 5.5k bitmaps swallow ~400mb of my nexus but only 20mb on my harddrive. The data encoded in the bitmaps is already 4x compressed so reducing this any further will not help, i guess and i think this is not the issue.

The bitmaps have variable sizes and i need the data pretty much all the time. They will never be shown, their only purpose is just to get the data from them.

Is there a way to reduce the memory usage, like encoding the data in a struct? Or reading the files not as a bitmap but as pure data? What would be a good way to do this?

Oh, and if anyone can explain to me why they swallow up so much space i would be happy to know the reason =)

Thanks in advance.


Formally known as Omega
Avatar randomness by Quadraxas & Blade
http://omegapuppeteer.mybrute.com
Re: Loading a lot really small BMP files. -> Memory problems [Re: Puppeteer] #399118
04/11/12 13:39
04/11/12 13:39
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
you could store the data in a file, by file_var_write/read, and store your vectores in the memory at runtime as an array of VECTOR*, allocating memory by sys_malloc, or if dynamic array size is needed by malloc/realloc. of course an array of a struct also can be used if not only vectors are needed to be stored.


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: Loading a lot really small BMP files. -> Memory problems [Re: sivan] #399139
04/11/12 15:12
04/11/12 15:12
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Or you could store them as BMP's, but read them into memory using 'file_load'
and just pull the data straight from the memory block...


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Loading a lot really small BMP files. -> Memory problems [Re: EvilSOB] #399144
04/11/12 15:51
04/11/12 15:51
Joined: Jan 2003
Posts: 4,305
Damocles Offline
Expert
Damocles  Offline
Expert

Joined: Jan 2003
Posts: 4,305
In Java I would load the images raw into a bytearray, attaching each bitmap after each other.
Then read them out and recreate them when needed.

(a custom Run-Lenght-Encoding could help compressing it if the bitmaps are relatively plain)

You could do the same in Lite-C:

look into the following points

#1 way to load data into an bytearray
#2 recreating a usable bitmap from an bytearray
#3 a sufficiently fast way to access the bitmaps (offsettable)


Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1