The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> C Programming
|
Reading in Files HELP!!!!
Discuss Reading in Files HELP!!!! in the C Programming forum on Dev Shed. Reading in Files HELP!!!! C programming forum discussing all C derivatives, including C#, C++, Object-C, and even plain old vanilla C. These languages are low level languages, and used on projects such as device drivers, compilers, and even whole computer operating systems.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

June 4th, 2003, 10:10 AM
|
|
Junior Member
|
|
Join Date: Jun 2003
Posts: 6
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
Reading in Files HELP!!!!
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 ****//
|

June 4th, 2003, 12:32 PM
|
|
Contributing User
|
|
Join Date: Oct 2000
Location: Back in the real world.
|
|
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...
|

June 4th, 2003, 12:56 PM
|
|
Junior Member
|
|
Join Date: Jun 2003
Posts: 6
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
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.
|

June 5th, 2003, 03:54 PM
|
|
Junior Member
|
|
Join Date: Jun 2003
Posts: 6
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
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.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|