Click here to Skip to main content
15,886,873 members
Home / Discussions / C#
   

C#

 
AnswerRe: Retrieve array items to use in NUnit Test Pin
AspDotNetDev22-Sep-10 16:07
protectorAspDotNetDev22-Sep-10 16:07 
GeneralRe: Retrieve array items to use in NUnit Test Pin
mtn*rain22-Sep-10 16:12
mtn*rain22-Sep-10 16:12 
GeneralRe: Retrieve array items to use in NUnit Test Pin
Paul Michalik22-Sep-10 20:47
Paul Michalik22-Sep-10 20:47 
Question3 way byte merge Pin
jkohler22-Sep-10 4:01
jkohler22-Sep-10 4:01 
AnswerRe: 3 way byte merge Pin
OriginalGriff22-Sep-10 4:19
mveOriginalGriff22-Sep-10 4:19 
GeneralRe: 3 way byte merge Pin
jkohler22-Sep-10 4:28
jkohler22-Sep-10 4:28 
AnswerRe: 3 way byte merge Pin
Ennis Ray Lynch, Jr.22-Sep-10 5:07
Ennis Ray Lynch, Jr.22-Sep-10 5:07 
GeneralRe: 3 way byte merge Pin
jkohler22-Sep-10 5:15
jkohler22-Sep-10 5:15 
Ennis Ray Lynch, Jr. wrote:
About as fast as C# will get. C++ is must faster.


Ther's nothing like horsepower to cover lazy programmers.
For giggles I tried this:
Parallel.For( 0, bmp.Height, row => {
    //
    // establish pointer into the three source color planes, each based on the the row this
    // task is to process
    byte* b = (byte*)_b + ( row * bmp.Width );
    byte* g = (byte*)_g + ( row * bmp.Width );
    byte* r = (byte*)_r + ( row * bmp.Width );
    //
    // calc the starting position in the destination bitmap for the first byte of this row
    byte* dst = row <= 0 ? (byte*)bmp.Scan0 : (byte*)bmp.Scan0 + ( ( bmp.Width * 3 ) * row ) + ( ( bmp.Stride / 3 ) - bmp.Width ) * 3;
    //
    // copy the bytes from the three sources into the bitmap row
    for ( int col = 0; col < bmp.Width; col++ ) {
        *dst++ = *b++;
        *dst++ = *g++;
        *dst++ = *r++;
    }
} );

On my dual I9 it's pretty fast (well, reallllyyyy fast). Unfortunately that's not the production target.
Subvert The Dominant Paradigm

GeneralRe: 3 way byte merge Pin
harold aptroot22-Sep-10 5:40
harold aptroot22-Sep-10 5:40 
GeneralRe: 3 way byte merge Pin
jkohler22-Sep-10 6:00
jkohler22-Sep-10 6:00 
GeneralRe: 3 way byte merge Pin
harold aptroot22-Sep-10 6:11
harold aptroot22-Sep-10 6:11 
AnswerRe: 3 way byte merge Pin
Chris Trelawny-Ross22-Sep-10 9:19
Chris Trelawny-Ross22-Sep-10 9:19 
GeneralRe: 3 way byte merge Pin
jkohler22-Sep-10 9:35
jkohler22-Sep-10 9:35 
GeneralRe: 3 way byte merge Pin
Michael B. Hansen23-Sep-10 2:27
Michael B. Hansen23-Sep-10 2:27 
GeneralRe: 3 way byte merge Pin
ely_bob23-Sep-10 8:25
professionalely_bob23-Sep-10 8:25 
GeneralRe: 3 way byte merge Pin
JonHarrison23-Sep-10 2:27
professionalJonHarrison23-Sep-10 2:27 
GeneralRe: 3 way byte merge Pin
jkohler23-Sep-10 3:24
jkohler23-Sep-10 3:24 
GeneralRe: 3 way byte merge Pin
JonHarrison23-Sep-10 3:34
professionalJonHarrison23-Sep-10 3:34 
GeneralRe: 3 way byte merge Pin
harold aptroot22-Sep-10 9:51
harold aptroot22-Sep-10 9:51 
GeneralRe: 3 way byte merge Pin
Chris Trelawny-Ross22-Sep-10 11:04
Chris Trelawny-Ross22-Sep-10 11:04 
GeneralRe: 3 way byte merge Pin
harold aptroot22-Sep-10 11:42
harold aptroot22-Sep-10 11:42 
GeneralRe: 3 way byte merge Pin
Chris Trelawny-Ross22-Sep-10 12:02
Chris Trelawny-Ross22-Sep-10 12:02 
GeneralRe: 3 way byte merge Pin
harold aptroot22-Sep-10 12:25
harold aptroot22-Sep-10 12:25 
GeneralRe: 3 way byte merge Pin
Chris Trelawny-Ross22-Sep-10 12:33
Chris Trelawny-Ross22-Sep-10 12:33 
AnswerRe: 3 way byte merge Pin
philpalk23-Sep-10 3:10
philpalk23-Sep-10 3:10 

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.