OSDev.org

The Place to Start for Operating System Developers
It is currently Wed May 01, 2024 11:57 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Allocating huge memory
PostPosted: Sun Mar 21, 2004 1:27 pm 
Hi, in c++ I am blindly used to malloc and I am definitely unaware of win32 api and its superior memory management functions, now I need to have some more functionality. Can somebody tell me how these mp3 players or video players allocate that much memory? I mean for instance when you watch a movie with windows media player you are unaware of memory loading stuff, how can windows media player load these 100s of mbytes of movie and does not give a sign of insufficient memory? Only one thing that comes to my mind to solve this problem is by simply dividing movie file into parts and then load each part time by time? But that cannot be really a case since movie file is an encoded file that cannot be decoded part by part... Anyway, can that be a way to handle this situation? Any guru or non guru ideas are welcome.


Top
  
 
 Post subject: Re:Allocating huge memory
PostPosted: Sun Mar 21, 2004 4:04 pm 
An audio or video player only needs to load a small portion of the file into memory at once, enough to keep the sound card buffers full (for audio) or one frame (for video). So it's enough to have a loop which reads data from the file, then sends it to the sound card/screen.


Top
  
 
 Post subject: Re:Allocating huge memory
PostPosted: Sun Mar 21, 2004 11:43 pm 
Ozgunh82 wrote:
Only one thing that comes to my mind to solve this problem is by simply dividing movie file into parts and then load each part time by time? But that cannot be really a case since movie file is an encoded file that cannot be decoded part by part...


Actually, most practical audio or motion-video formats can be decoded from a partial file image; otherwise, streaming would be impossible.


Top
  
 
 Post subject: Re:Allocating huge memory
PostPosted: Mon Mar 22, 2004 4:58 am 
Well I understand that files can should be divided into parts so that streaming can be done but I meant that you need to divide the file at correct positions so that decoding can be done, anyway... You can actually have one frame in video memory but then loading the frames becomes a very time critical task I mean playing a video is a real time task (a soft one) so for getting a good frames/sec (min of 25) your decoder should be able to stabilize the byte stream from file and also should be able to handle the very huge computational load of decoding the file. Well I think the trick is not using good memory functions but making use of capable devices like mmx fpu, directx video drivers and etc. so that we do not load all load on cpu.


Top
  
 
 Post subject: Re:Allocating huge memory
PostPosted: Mon Mar 22, 2004 5:07 am 
Offline
Member
Member
User avatar

Joined: Tue Oct 17, 2006 11:33 pm
Posts: 3882
Location: Eindhoven
Schol-R-LEA wrote:
Actually, most practical audio or motion-video formats can be decoded from a partial file image; otherwise, streaming would be impossible.

Nearly impossible. A 640*480*24-bit stream at 25 fps is 200mbit/s which CAN be done over GBIT ethernet. It's not efficient though :).


Top
 Profile  
 
 Post subject: Re:Allocating huge memory
PostPosted: Mon Mar 22, 2004 7:10 am 
Hi,
[electrical engineer]
Well, firstly the length of bits needed to dcode a frame is not always (in fact in an mpeg is nearly never) 640x480x24, I am not talking about 640x480 size but the theory of coding is solely based on decreasing bit-rate of data so that we can both decrease its size and also decrease the needed bit rate (or speed) to decode the data. In jpeg 1:20-30 compression is possible by some quality sacrifice and mpeg which is some more efficient by getting rid of interframe redundancy compresses much better than jpeg or mjpeg. So that we do not really need a gbit ethernet link to watch movies on computer. :)
[/electrical engineer]


Top
  
 
 Post subject: Re:Allocating huge memory
PostPosted: Tue Mar 23, 2004 2:18 am 
Offline
Member
Member
User avatar

Joined: Sat Oct 23, 2004 11:00 pm
Posts: 1223
Location: Sweden
movies are often like: 300x300 or something in 100% size. but u can enlarge them to full screen..

_________________
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group