| View previous topic :: View next topic |
| Author |
Message |
re-sublimity
Joined: 09 Jun 2007 Posts: 5
|
Posted: Sat Jun 09, 2007 10:27 pm Post subject: 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 ??? |
|
| Back to top |
|
 |
rapso
Joined: 28 Mar 2005 Posts: 147
|
Posted: Sat Jun 09, 2007 11:08 pm Post subject: |
|
|
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. |
|
| Back to top |
|
 |
re-sublimity
Joined: 09 Jun 2007 Posts: 5
|
Posted: Sat Jun 09, 2007 11:49 pm Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
rapso
Joined: 28 Mar 2005 Posts: 147
|
Posted: Sun Jun 10, 2007 12:02 am Post subject: |
|
|
| 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 ;) |
|
| Back to top |
|
 |
re-sublimity
Joined: 09 Jun 2007 Posts: 5
|
Posted: Sun Jun 10, 2007 12:25 am Post subject: |
|
|
| 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>_< |
|
| Back to top |
|
 |
dot_blank

Joined: 28 Sep 2005 Posts: 498 Location: Brasil
|
Posted: Sun Jun 10, 2007 1:54 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
re-sublimity
Joined: 09 Jun 2007 Posts: 5
|
Posted: Sun Jun 10, 2007 3:52 pm Post subject: |
|
|
| 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? |
|
| Back to top |
|
 |
rapso
Joined: 28 Mar 2005 Posts: 147
|
Posted: Sun Jun 10, 2007 6:26 pm Post subject: |
|
|
| 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 ;) |
|
| Back to top |
|
 |
re-sublimity
Joined: 09 Jun 2007 Posts: 5
|
Posted: Sun Jun 10, 2007 6:58 pm Post subject: |
|
|
| 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 ;) |
|
| Back to top |
|
 |
dot_blank

Joined: 28 Sep 2005 Posts: 498 Location: Brasil
|
Posted: Sun Jun 10, 2007 8:10 pm Post subject: |
|
|
very good _________________ 10011011 00101010 11010111 10001001 10111010 |
|
| Back to top |
|
 |
|