forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

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

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
re-sublimity



Joined: 09 Jun 2007
Posts: 5

PostPosted: Sat Jun 09, 2007 10:27 pm    Post subject: What`s the fastest way to split RGBA buffer into 3(R,G,B) ? Reply with quote

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
View user's profile Send private message
rapso



Joined: 28 Mar 2005
Posts: 147

PostPosted: Sat Jun 09, 2007 11:08 pm    Post subject: Reply with quote

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
View user's profile Send private message
re-sublimity



Joined: 09 Jun 2007
Posts: 5

PostPosted: Sat Jun 09, 2007 11:49 pm    Post subject: Reply with quote

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
View user's profile Send private message
rapso



Joined: 28 Mar 2005
Posts: 147

PostPosted: Sun Jun 10, 2007 12:02 am    Post subject: Reply with quote

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
View user's profile Send private message
re-sublimity



Joined: 09 Jun 2007
Posts: 5

PostPosted: Sun Jun 10, 2007 12:25 am    Post subject: Reply with quote

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
View user's profile Send private message
dot_blank



Joined: 28 Sep 2005
Posts: 498
Location: Brasil

PostPosted: Sun Jun 10, 2007 1:54 pm    Post subject: Reply with quote

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
View user's profile Send private message
re-sublimity



Joined: 09 Jun 2007
Posts: 5

PostPosted: Sun Jun 10, 2007 3:52 pm    Post subject: Reply with quote

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
View user's profile Send private message
rapso



Joined: 28 Mar 2005
Posts: 147

PostPosted: Sun Jun 10, 2007 6:26 pm    Post subject: Reply with quote

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
View user's profile Send private message
re-sublimity



Joined: 09 Jun 2007
Posts: 5

PostPosted: Sun Jun 10, 2007 6:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
dot_blank



Joined: 28 Sep 2005
Posts: 498
Location: Brasil

PostPosted: Sun Jun 10, 2007 8:10 pm    Post subject: Reply with quote

very good
_________________
10011011 00101010 11010111 10001001 10111010
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group