|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi, I am currently using hmmio to read in data for a multimedia player. When I run my program is starts off fast but then starts to slow down. I pin pointed the problem to the part where i read in the data. I read in about 15 megs at a time, about 30 frames.
It starts off at about 500ms per read but then slowly goes to an occsillating effect where it takes 500 ms to read then it takes 4 sec to read and so on. Does anyone know why this is happening? here is my code(short version) char * fileBuffer=(char *)malloc(15552000); byte* YP=(char *)malloc(15552000); /****other stuff****/ void OpenFile() { hmmio = mmioOpen("C:\\Documents and Settings\\mliu\\Desktop\\YUVPLAYER\\pond.yuv", NULL, MMIO_READ ); mmioSetBuffer(hmmio,fileBuffer,15552000,0); mmioRead(hmmio,(char *)YP,15552000); } //***calculation and direct draw functions ****// |
|
#2
|
|||
|
|||
|
You want to read15 megs in 500ms, i.e. 30MB/s constantly. What media are you reading from?
If it is a single hard disk, the difference in speed is probably due to fragmentation of the file. It would also be affected by - Hard disk cache - Controller cache - OS cache / efficiency of this - available memory / swapping / memory fragmentation - interrupt sharing between the controller and another card that is frequently accessed (common: graphics card) - driver efficiency / bugs - [ ... ] I donīt know these libraries you are using, but it looks like a Windows program - Windows was not made for high-performance apps like yours ![]() Some tweaking in the OS settings could eliminate your problem, but maybe not...
__________________
-- Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more. |
|
#3
|
|||
|
|||
|
I'm reading in a video file in YUV 4:1:1 format. its about 300 megs for 600 frames. Its reading off a local harddrive(7200 rpm).
I have also tried using fread functions and ReadFile functions and they also resulted in the same problem. I don't need to read at 30megs/s, I only need to read in at about 15meg/s(30 frames per sec). I know it can't be a hardware problem since a similar program developed by a software company can play this file smoothly. Please help me out and let me know there is any way to stablize to read in. Last edited by azntekkan : June 4th, 2003 at 12:59 PM. |
|
#4
|
|||
|
|||
|
Problem Fixed, for anyone who cares or has the same problem. Use CreateFile instead of hmmio. The when using ReadFile specify
dwFlagsAndAttributes as FILE_FLAG_NO_BUFFERING and FILE_FLAG_OVERLAPPED. That will make it much faster and stable. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > C Programming > Reading in Files HELP!!!! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|