What`s the fastest way to split RGBA buffer into 3(R,G,B) ?

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
re-sublimity
Posts: 5
Joined: Sat Jun 09, 2007 3:43 am

What`s the fastest way to split RGBA buffer into 3(R,G,B) ?

Post by re-sublimity »

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 ???
rapso
Posts: 140
Joined: Mon Mar 28, 2005 6:35 am

Post by rapso »

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.
re-sublimity
Posts: 5
Joined: Sat Jun 09, 2007 3:43 am

Post by re-sublimity »

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.
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
Posts: 140
Joined: Mon Mar 28, 2005 6:35 am

Post by rapso »

re-sublimity wrote:
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.
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.
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
Posts: 5
Joined: Sat Jun 09, 2007 3:43 am

Post by re-sublimity »

rapso wrote:
re-sublimity wrote:
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.
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.
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 ;)
16bit palette is OK,but I think 16bit indexed texture does not exist,
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>_<
User avatar
dot_blank
Posts: 498
Joined: Wed Sep 28, 2005 8:47 am
Location: Brasil

Post by dot_blank »

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
10011011 00101010 11010111 10001001 10111010
re-sublimity
Posts: 5
Joined: Sat Jun 09, 2007 3:43 am

Post by re-sublimity »

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
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.

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?
rapso
Posts: 140
Joined: Mon Mar 28, 2005 6:35 am

Post by rapso »

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?
a lot of memory you'd waste for this palette, maybe 16bit would be sufficient ;)
re-sublimity
Posts: 5
Joined: Sat Jun 09, 2007 3:43 am

Post by re-sublimity »

rapso wrote:
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?
a lot of memory you'd waste for this palette, maybe 16bit would be sufficient ;)
After some experiments I`ve found how to use the 32bit index buffer.
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 ;)
User avatar
dot_blank
Posts: 498
Joined: Wed Sep 28, 2005 8:47 am
Location: Brasil

Post by dot_blank »

very good
10011011 00101010 11010111 10001001 10111010
Post Reply