   compression RAM buffer that take little time
  Hi all,i have application that each frame take video buffer about 2MB compress itto RAM buffer about 33KB(JPEG)  and save to file. it take alot of time(about50ms) to do that.anybody have any ideas and technical can share me to reduce time compressionand write to file??? thanks very much.David,   
  What's the specs for the machine you're testing on?  Are you using your own implementation of JPEG compression or a prebuilt library?  Are you running in release mode (ie. with optimisations on)?While you can do better, 20fps while doing JPEG compression and disk writing isn't too bad.  Unless the implementation is your own you probably can't do much to improve the compression speed, however you should see some improvement by moving the disk writing into a separate thread so that you aren't wasting CPU time waiting for the disk writes.   ;  Also, if the JPEG library has a quality setting, changes in quality should modify your speed quite a bit. Problems using other settings might be image quality or total output size. I guess you should play with it to balance quality to speed.   ;  thanksi had try anything that you say and achieve 25fps, can have algorithm compress better(take little time), not need optimize file size(about < 100kb is accepted)???Thanks very muchDavid,   ;  i want achieve about 30fps   ;  I'm assuming you're trying to make a video of a 3D rendering application.  One thing that may be slowing down your app is repeatedly stalling the GPU.  For example, it's likely that you do this:Draw, Lock backbuffer, Compress, Unlock, SaveDraw, Lock backbuffer, Compress, Unlock, SaveDraw, Lock backbuffer, Compress, Unlock, SaveEach time you lock the backbuffer, the CPU sits idle waiting for the GPU to finish drawing.  While compressing and saving the GPU is idle.You could try increasing the number of backbuffers, and using GetBackBuffer(1,...) or GetBackBuffer(2,...) for your lock.  This would allow the GPU to do more work as you won't be locking the buffer you just finished trying to draw on.Another option along the same lines would be to copy the backbuffer to another surface, using a method that performs the copy via the GPU.  StretchRect requires surfaces in the default pool, so it will be using the GPU.  You can then render another frame or two (and copy those to other surfaces) then lock the surface that's oldest.Both of these techniques are attempting to let the GPU finish rendering before you attempt to lock, and to allow the GPU to continue rendering while you hold the lock and compress data.   ;  Put on a separate low priority thread, or just leave it cached to memory and write to a file at a later time.   ;  If you want to capture a movie of your game, instead of trying tooptimize the diskwrites, maybe another approach might help you.Usually you will have one place from where you do updates withthe time since last frame... now instead of taking the realtime, cheat and feed a constant value (eg dt = 1s / 30 frames).The game will be sluggish when you start capturing - butyour movie will be _smooth_ - and you don't have problemsof the capturing/writing to disk influencing your framerate.This way we made some ingame movies for our last title (ofcourse it's useless if you want the end-user to be able tocapture movies)   ;  thanks very much   