Re: Slow converting index color to RGB
Re: Slow converting index color to RGB
- Subject: Re: Slow converting index color to RGB
- From: "Alastair J.Houghton" <email@hidden>
- Date: Wed, 27 Aug 2003 15:50:26 +0100
On Wednesday, August 27, 2003, at 11:20 am, Alastair J.Houghton wrote:
On Wednesday, August 27, 2003, at 04:47 am, Lance Pysher wrote:
while (i < [[[self dicomObject]
objectWithDescription:@"PixelData"] length]){
*pointer++ = red[(unsigned char)*pixelData];
*pointer++ = green[(unsigned char)*pixelData];
*pointer++ = blue[(unsigned char)*pixelData++];
i++;
}
Reading this again, it occurs to me that DICOM images are often >8-bit
per pixel, but you've cast your input pixel data to unsigned char; if
you are indeed expecting 8bpp images then I take back what I said about
the cache (the tables will fit just fine), although I would have
thought there were probably better ways to approach the problem in the
8bpp case (for example, by using Quartz with an indexed colour space...
look up CGColorSpaceCreateIndexed() and CGImageCreate() if you're
interested).
I also had another idea; why not store a single table of pixel values
(32-bit words), rather than building them up on the fly from three
separate tables. That would make it a single look-up, rather than
three separate look-ups per loop.
Kind regards,
Alastair.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.