i was googling around for any info i could find on "true" sepia equations that i hoping to resuse in one of my filters when i came across this c/c++ code snipplet. i think they refer to this as short-curcuiting though the page use the term, 'vectorized' as an alternate method than the longer 7 or so coded lines.
note, the code does not relate to sepia but was on the same page, found here:PHP Code:
float3 FindMedian(float3 RGB, float3 RGB2, float3 RGB3)
{
return (RGB < RGB2) ? ((RGB2 < RGB3) ? RGB2 : max(RGB,RGB3) ) : ((RGB < RGB3) ? RGB : max(RGB2,RGB3));
}
http://wiki.gamedev.net/index.php/D3DBook:Useful_Effect_Snippets
so my question, is there something similar in pascal (delphi) or is this unique to c/c++ ?
i'm using version 6, i suppose borland made changes in later versions, but i don't know since i don't use it, yet, thank you.
edit: i don't know what the garbage in the findMedian() filter, so i appologies. even the wepage (see link) has it, so i'm not sure what's suppose to go in there.
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 2 of 2
Thread
-
Last edited by vhelp; 17th Apr 2011 at 14:47.
-
float3/4 data types are vector data types (as opposed to scalar types) and are usually used within the context of an open cl or cuda program as a way of using the gpu's simd array. considering you found this code snippet in a site that deals with d3d programming, it looks like they are showing you how to rearrange code meant to run on a cpu so that it runs on a gpu using the dx9 api, specifically d3d surfaces.
i believe that it is possible to use the dx9 api from within pascal/delphi, i'm failry certain some libraries have been ported to allow this functionality, but it's going to be a major pain in the ass.
you may just have to stick with pure cpu executed code if you wish to use pascal.