What`s the fastest way to split RGBA buffer into 3(R,G,B) ?
-
- Posts: 5
- Joined: Sat Jun 09, 2007 3:43 am
What`s the fastest way to split RGBA buffer into 3(R,G,B) ?
The original buffer RGBA(32bit) was located in the VRAM, and I want to do some post-process with the image ,so I need three R,G,B channel buffer(8bit) respectively, but to fill the buffer using cpu loop does not meet the need of real-time performance. It`s really inefficient.
I was wondering if there is a faster way to handle it ???
I was wondering if there is a faster way to handle it ???
you can render the screen into another buffer setting masks for the color-channels, but this wouldn't make those buffers 8bit, but just split the screen into 32bit buffers with two channels ==0;
that's a lot of copy-work, maybe you could do postprocessing using the GU and without splitting the colorchannels.
that's a lot of copy-work, maybe you could do postprocessing using the GU and without splitting the colorchannels.
-
- Posts: 5
- Joined: Sat Jun 09, 2007 3:43 am
Acutally what am doing was RGB->YUV color space convention,this could use a texture look-up on GU (The idea was from PMP mod 2.02, and the palette was an array of precalculated values), but it needs 8bit indexed texture(GU_PSM_T8) for the texture look-up. So 32bit buffers will not help.rapso wrote:you can render the screen into another buffer setting masks for the color-channels, but this wouldn't make those buffers 8bit, but just split the screen into 32bit buffers with two channels ==0;
that's a lot of copy-work, maybe you could do postprocessing using the GU and without splitting the colorchannels.
you could use 16bit buffers and a 16bit palett (I think there was no limit for the palett size as long as it's power of two and at least 16entries) but I cannot promise that this would be fast ;)re-sublimity wrote:Acutally what am doing was RGB->YUV color space convention,this could use a texture look-up on GU (The idea was from PMP mod 2.02, and the palette was an array of precalculated values), but it needs 8bit indexed texture(GU_PSM_T8) for the texture look-up. So 32bit buffers will not help.rapso wrote:you can render the screen into another buffer setting masks for the color-channels, but this wouldn't make those buffers 8bit, but just split the screen into 32bit buffers with two channels ==0;
that's a lot of copy-work, maybe you could do postprocessing using the GU and without splitting the colorchannels.
-
- Posts: 5
- Joined: Sat Jun 09, 2007 3:43 am
16bit palette is OK,but I think 16bit indexed texture does not exist,rapso wrote:you could use 16bit buffers and a 16bit palett (I think there was no limit for the palett size as long as it's power of two and at least 16entries) but I cannot promise that this would be fast ;)re-sublimity wrote:Acutally what am doing was RGB->YUV color space convention,this could use a texture look-up on GU (The idea was from PMP mod 2.02, and the palette was an array of precalculated values), but it needs 8bit indexed texture(GU_PSM_T8) for the texture look-up. So 32bit buffers will not help.rapso wrote:you can render the screen into another buffer setting masks for the color-channels, but this wouldn't make those buffers 8bit, but just split the screen into 32bit buffers with two channels ==0;
that's a lot of copy-work, maybe you could do postprocessing using the GU and without splitting the colorchannels.
for I`ve only found GU_PSM_T4 & T8 format in the SDK.
There would be no use unless 32bit indexed buffer can be directly used for texture look-up. Otherwise I still have to fill the new buffer from the previous 32bit buffer>_<
-
- Posts: 5
- Joined: Sat Jun 09, 2007 3:43 am
The operation I need to do is the texture look-up, and this is done with The GU which only needs texture buffer, so COLOR structure is not suitable.dot_blank wrote:its simple ...before you convert the RGB member variables
in your COLOR structure just use those r.g.b channels and do
as you please with them ...simplest form is just to use memcpy to
a buffer that will hold the outcome
However, I`ve found that there do exist GU_PSM_T16 & 32(but not mentioned in the usual SDK), and the key to use 32bit indexed buffer is the sceGuClutMode function, the second & the third parameter is said to be used for offset & mask, searched the previous discussion still I don`t have a definite answer... ... seems I have to do some experiments.
I was wondering has any one used 32bit indexed buffer successfully until now?
a lot of memory you'd waste for this palette, maybe 16bit would be sufficient ;)re-sublimity wrote: However, I`ve found that there do exist GU_PSM_T16 & 32(but not mentioned in the usual SDK), and the key to use 32bit indexed buffer is the sceGuClutMode function, the second & the third parameter is said to be used for offset & mask, searched the previous discussion still I don`t have a definite answer... ... seems I have to do some experiments.
I was wondering has any one used 32bit indexed buffer successfully until now?
-
- Posts: 5
- Joined: Sat Jun 09, 2007 3:43 am
After some experiments I`ve found how to use the 32bit index buffer.rapso wrote:a lot of memory you'd waste for this palette, maybe 16bit would be sufficient ;)re-sublimity wrote: However, I`ve found that there do exist GU_PSM_T16 & 32(but not mentioned in the usual SDK), and the key to use 32bit indexed buffer is the sceGuClutMode function, the second & the third parameter is said to be used for offset & mask, searched the previous discussion still I don`t have a definite answer... ... seems I have to do some experiments.
I was wondering has any one used 32bit indexed buffer successfully until now?
e.g: sceGuClutMode(GU_PSM_8888, 8, 0xff, 0); was to select the green channel of the index buffer.
ps:The only bits wasted in palette were those in alpha channel I think ;)