Click here to Skip to main content
15,927,344 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generaltemplate class member function - returing pointer to the class Pin
Beau Skinner25-Jun-04 1:33
Beau Skinner25-Jun-04 1:33 
GeneralRe: template class member function - returing pointer to the class Pin
Beau Skinner25-Jun-04 20:20
Beau Skinner25-Jun-04 20:20 
QuestionMore than 30ms for very basic img proc operations? Why? Pin
redmop25-Jun-04 1:17
redmop25-Jun-04 1:17 
AnswerRe: More than 30ms for very basic img proc operations? Why? Pin
Beau Skinner25-Jun-04 1:41
Beau Skinner25-Jun-04 1:41 
AnswerRe: More than 30ms for very basic img proc operations? Why? Pin
LittleYellowBird25-Jun-04 2:37
LittleYellowBird25-Jun-04 2:37 
AnswerRe: More than 30ms for very basic img proc operations? Why? Pin
Rick York25-Jun-04 6:26
mveRick York25-Jun-04 6:26 
AnswerRe: More than 30ms for very basic img proc operations? Why? Pin
vladfein25-Jun-04 8:08
vladfein25-Jun-04 8:08 
AnswerRe: More than 30ms for very basic img proc operations? Why? Pin
Christopher Lloyd25-Jun-04 8:51
Christopher Lloyd25-Jun-04 8:51 
Real-time image processing is really processor intensive. As someone mentioned, your timings aren't so unreasonable when you consider what you're actually trying to do (although I agree that you should be able to improve on 30ms). Anyhow, here are a few tips:

Reduce the amount of data you need to process
=============================================
1. Do you really need to work with 24 bit images. If you can get away with 16 bit or, better still, 8 bit then you'll reduce your timings by 33% or 66%.

2. Do you really need to use such large images - reducing image size to 640 x 480, for example, would reduce timings by 25%

3. Do you really need to process 30 frames per second. 24 frames per second is almost indistinguishable from 30 and again speeds things up.

So, for example, using 640x480, 16 bit images at 24 fps would reduce the amount of processing by about 60%.

You may find that your code is 'data bound'. This means that the processor is actually spending more time getting data than processing - remember the CPU might run at 1.2GHz but the memory doesn't. I know you've got cache but your images are 1.6MB.

Coding
======
1. If possible use MMX instructions. These process 8 bytes or 4 words in parallel - they offer dramatic improvements over processing images a pixel at a time.
2. As mentioned by someone else, optimise your loops - process as much as you can outside the loop.
3. Check out the Intel optimisation manuals - they're a free download from intel's site. They contains lots of tips on optimising your code.

By the way, what are you actually trying to achieve by multiplying your pixels by one value and then dividing them by some other value?

If you want some specific advice then send me some details of the project.

Good luck

Chris.
PS: If you've got come money to spend then the Intel Performance Primitives library ($199.00) contains great image processing routines covering most needs.




AnswerRe: More than 30ms for very basic img proc operations? Why? Pin
redmop27-Jun-04 4:25
redmop27-Jun-04 4:25 
GeneralRe: More than 30ms for very basic img proc operations? Why? Pin
LittleYellowBird27-Jun-04 23:53
LittleYellowBird27-Jun-04 23:53 
AnswerRe: More than 30ms for very basic img proc operations? Why? Pin
pavanbabut28-Jun-04 8:01
pavanbabut28-Jun-04 8:01 
General[Microsoft][ODBC Microsoft Access Driver] Couldn't use '(unknown)'; file already in use. Pin
si_6925-Jun-04 1:14
si_6925-Jun-04 1:14 
Generallarge arrays, stack overflow, MFC Pin
hdaly25-Jun-04 0:30
hdaly25-Jun-04 0:30 
GeneralRe: large arrays, stack overflow, MFC Pin
User 665825-Jun-04 0:40
User 665825-Jun-04 0:40 
GeneralRe: large arrays, stack overflow, MFC Pin
hdaly25-Jun-04 0:56
hdaly25-Jun-04 0:56 
GeneralRe: large arrays, stack overflow, MFC Pin
David Crow25-Jun-04 2:27
David Crow25-Jun-04 2:27 
GeneralStupid question Pin
Jonathan [Darka]25-Jun-04 0:30
professionalJonathan [Darka]25-Jun-04 0:30 
GeneralRe: Stupid question Pin
V.25-Jun-04 1:46
professionalV.25-Jun-04 1:46 
GeneralRe: Stupid question Pin
Henry miller25-Jun-04 3:25
Henry miller25-Jun-04 3:25 
GeneralRe: Stupid question Pin
Jonathan [Darka]25-Jun-04 4:22
professionalJonathan [Darka]25-Jun-04 4:22 
GeneralCoUninitialize Problem Pin
ITMan24-Jun-04 22:42
ITMan24-Jun-04 22:42 
QuestionHow to call a dialog box on Help button on a property sheet.? Pin
Rajesh_K_Sharma24-Jun-04 21:17
Rajesh_K_Sharma24-Jun-04 21:17 
AnswerRe: How to call a dialog box on Help button on a property sheet.? Pin
V.24-Jun-04 21:21
professionalV.24-Jun-04 21:21 
AnswerRe: How to call a dialog box on Help button on a property sheet.? Pin
David Crow25-Jun-04 2:33
David Crow25-Jun-04 2:33 
GeneralProblem in release mode Pin
nnvidya24-Jun-04 20:23
nnvidya24-Jun-04 20:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.