|
__erfan__ wrote: if you find that please let me know
I found it (you've to go a bit deep inside the source code): The library uses the SSE2 for integer arithmetic operations (see [^]), in particular _mm_subs_epu8 for cvSub .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Have you tried disabling the printf command while measuring the performance? I reckon it takes a bit of time.
You could store all those values to be printed into a vector or something and print it all together at the end (of course don't count that as execution time).
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
thanks for your help. but printf is out of timming block and is present in both methods
|
|
|
|
|
You could consider doing 4 double operations in each for-loop. This would allow modern CPU's to perform the operation in parallel.
Taken from Software Optimization Guide for AMD64 Processors[^]:
Rationale and Examples
This is especially important to break long dependency chains into smaller executing units in floating-point code, whether it is mapped to x87, SSE, or SSE2 instructions, because of the longer latency of
floating-point operations. Because most languages (including ANSI C) guarantee that floating-point expressions are not reordered, compilers cannot usually perform such optimizations unless they offer a switch to allow noncompliant reordering of floating-point expressions according to algebraic rules.
Reordered code that is algebraically identical to the original code does not necessarily produce identical computational results due to the lack of associativity of floating-point operations. There are
well-known numerical considerations in applying these optimizations (consult a book on numerical analysis). In some cases, these optimizations may lead to unexpected results. In the vast majority of
cases, the final result differs only in the least-significant bits.
Listing 10. Avoid
double a[100], sum;
int i;
sum = 0.0f;
for (i = 0; i < 100; i++) {
sum += a[i];
}
Listing 11. Preferred
double a[100], sum1, sum2, sum3, sum4, sum;
int i;
sum1 = 0.0;
sum2 = 0.0;
sum3 = 0.0;
sum4 = 0.0;
for (i = 0; i < 100; i + 4) {
sum1 += a[i];
sum2 += a[i+1];
sum3 += a[i+2];
sum4 += a[i+3];
}
sum = (sum4 + sum3) + (sum1 + sum2);
Notice that the four-way unrolling is chosen to exploit the four-stage fully pipelined floating-point adder. Each stage of the floating-point adder is occupied on every clock cycle, ensuring maximum sustained utilization.
|
|
|
|
|
Snakefoot wrote: Notice that the four-way unrolling is chosen to exploit the four-stage fully pipelined floating-point adder.
Notice the four-way unrolling will eat up all the CPU time (and block the application) just to perform the first four operations
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
thank you guys.
my brain is telling me go to sleep
i am on my computer for 24 hours and ...
|
|
|
|
|
Hi All
How can i use Stored Procedure?I am using MySql and ODBC.in the code i am create table andinsert the data.It's take too much time.So i want to do through Stored Procedure.Plz help me
|
|
|
|
|
If you have a database query, post it in the database forum.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
|
Hi,
I'd like to know how to caputre screen including movie play which runs on Media player or GOM Player.
for example, Media player run on cetner of screen...
I can caputre screen with WindowDC() function... but Media player play.
Media player area is captured with whole black screen...
Could Someone advice me ... or some example soource ...
how to capute whole screen includeing movie play...
Thansk.
|
|
|
|
|
Hi,
CamStudio[^] does precisely that and is open source (written in C++). You could use it as a reference project to build your application.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
I use the free jing, from the TechSmith (Snagit) people.
After you have captured the swf, you can share it online using the free (2GB storage and 2GB monthly bandwidth) screencast.com service.
Highly recommended.
|
|
|
|
|
Simply use DX native functions.
C++ Code is in MS SDK.
|
|
|
|
|
Hi,
I want to wait for all the event to finish and only then continue my program and im looking for the command in c++,
I have the command in c "g_main_context_iteration" and im looking for something similar in c++.
thank you for any help
|
|
|
|
|
You should provide some g_main_context_iteration to your question.
Since g_main_context_iteration (of the GLib library) is a C function , you are free to use it in your C++ application.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
the command is - while (g_main_context_iteration(NULL, false) == TRUE) {}
and i have problems using glib and i search for alternative
|
|
|
|
|
Well, GLib (I guess) has its own programming model that you won't find in other frameworks (or in bare Win32 development). What kind of application do you intend to develop?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Im Develop on Linux with QT IDE
im sorry i gave only a few details its only because its seems so clear to me
|
|
|
|
|
shiranraviv wrote: I want to wait for all the event to finish and only then continue my program
What's your query about? Some sort of a guessing contest?
I'd hazard a guess that WaitForSingleObject[^] is what you may be after...
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Hi to All,
Could anyone please tell me, how to implement the divide operation by using shift operator....
I know that, if we right shift by n..number will be divide by (2 to the power n)....But, what about other numbers?...(say 2*3)...please help me out
thanks in advance
-----------------------------
I am a beginner
|
|
|
|
|
If the divisor is not a power of two, the shift operator alone can't do the trick. You may, for instance mimic the divide operation you perform manually, porting it from base 10 to base 2 .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Oh Ok...thank you for your reply
-----------------------------
I am a beginner
|
|
|
|
|
Hi,
I'm trying to create a driver, for which I use WinDDK 7600.16385.0
But when I add a *.lib file, the linker still gives "unresolved external symbol" errors the same as if I haven't added it at all. I know the linker looks for the *.lib file, because I checked - I renamed the lib file to something else and the linker immediately complained that it can't find it. Does anyone here know what might be the problem?
I've referenced the lib file and the include files' dir in the sources file of the driver:
TARGETNAME=driver_drv
TARGETPATH=obj
TARGETTYPE=DYNLINK
TARGETLIBS=$(SDK_LIB_PATH)\winspool.lib \
$(SDK_LIB_PATH)\user32.lib \
$(SDK_LIB_PATH)\kernel32.lib \
$(SDK_LIB_PATH)\advapi32.lib \
$(DDK_LIB_PATH)\umpdddi.lib \
$(SDK_LIB_PATH)\comdlg32.lib \
$(SDK_LIB_PATH)\ntdll.lib \
$(SDK_LIB_PATH)\win32k.lib \
$(SDK_LIB_PATH)\gdi32.lib \
----> C:\MYLIB.LIB <---------------------------------------------- See here
USE_MSVCRT=1
USE_STL=1
USER_C_FLAGS=/EHsc
DLLDEF=driver.def
DLLORDER=driver.prf
DLLENTRY=_DllMainCRTStartup
INCLUDES=C:\MYLIB\Include <---------------------------------------------- See here
C_DEFINES=$(C_DEFINES) -DSTRICT -DUNICODE -D_UNICODE -DUMODE -DUSERMODE_DRIVER
C_DEFINES=$(C_DEFINES) -DWIN32 -D_CONSOLE -D_VISUALC_ -DNeedFunctionPrototypes -D_DLL
NTPROFILEINPUT=yes
MSC_WARNING_LEVEL=$(MSC_WARNING_LEVEL) /WX /W3
SOURCES=driver.cpp \
driver.rc
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Did you ever figure out how to use the WinDDK with MFC? If yes, I'd so much appreciate it if you could tell me your project settings!
|
|
|
|
|
Can't you just use win32 for whatever dialogs you need to show? You usually shouldn't embed any gui code inside a driver anyway. It works in XP but wait till you see how it behaves on Win7. There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|