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 

VFPU - vt4444.q, vt5551.q, vt5650.q - color conversion

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



Joined: 10 Sep 2006
Posts: 750

PostPosted: Wed Oct 25, 2006 12:23 am    Post subject: VFPU - vt4444.q, vt5551.q, vt5650.q - color conversion Reply with quote

hi

well, i was puzzled by those instructions; there is no doubt they deal with color conversions but how to use them ?

binutils describes them as an instruction reading a 4-element register and writing a 2-element register.

well, the only logic i can see is that they probably take 4 rgba8888 pixels (fitting four 32-bit words) to transform them into 4 rgba4444 or 4 rgba5551 or 4 rgba5650 pixels (fitting two 32-bit words). So I guess they are to be used for converting large buffer of rgba8888 into one of the three colors representations.

I didn't check them but I don't see any purpose else.

Could you confirm it if it is already known ? those instruction are not decribed in the "unofficial" document of groepaz.


Last edited by hlide on Sat Oct 28, 2006 11:57 pm; edited 1 time in total
Back to top
View user's profile Send private message
hlide



Joined: 10 Sep 2006
Posts: 750

PostPosted: Wed Oct 25, 2006 7:02 pm    Post subject: Reply with quote

i did this test :
Code:

vfpu_rgba8888to4444:
    lvl.q C000.q,12(a0)
    lvr.q C000.q,0(a0)
    vt4444.q C010.p,C000.q
    svl.q C010.q,12(a1)
    jr ra
    svr.q C010.q,0(a1)


with a0 containing 4 ints { 0x000000FF, 0xFF000000, 0x01020304, 0x10203040 } and i get { 000F, F000, 0000, 1234 } which confirms the usage of those instructions :

convert 4 rgba8888 into 4 rgba4444 or 4 rgba5650 or rgba5551.

It doesn't seem there are the reverse instruction though.

I think a rgb888 to rgba8888 would have been more interesting :/




[/code]
Back to top
View user's profile Send private message
Raphael



Joined: 17 Jan 2006
Posts: 646
Location: Germany

PostPosted: Wed Oct 25, 2006 10:53 pm    Post subject: Reply with quote

hlide wrote:
i did this test :
Code:

vfpu_rgba8888to4444:
    lvl.q C000.q,12(a0)
    lvr.q C000.q,0(a0)
    vt4444.q C010.p,C000.q
    svl.q C010.q,12(a1)
    jr ra
    svr.q C010.q,0(a1)


with a0 containing 4 ints { 0x000000FF, 0xFF000000, 0x01020304, 0x10203040 } and i get { 000F, F000, 0000, 1234 } which confirms the usage of those instructions :

convert 4 rgba8888 into 4 rgba4444 or 4 rgba5650 or rgba5551.

It doesn't seem there are the reverse instruction though.

I think a rgb888 to rgba8888 would have been more interesting :/


Thanks for the confirmation. I don't get the point with rgb888 to rgba8888 though. You just need to append a 0xff byte for every pixel, that's not very time consuming (little more than a straight mem copy). Apart from that, real 24bit shouldn't be used anywhere after all. It only creates overhead and has no real advantages.
On another note, reverse conversion functions would have been nice indeed, especially for image loading functions.
_________________
<Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki

Alexander Berl
Back to top
View user's profile Send private message Visit poster's website
hlide



Joined: 10 Sep 2006
Posts: 750

PostPosted: Thu Oct 26, 2006 1:16 am    Post subject: Reply with quote

Raphael wrote:
I don't get the point with rgb888 to rgba8888 though. You just need to append a 0xff byte for every pixel, that's not very time consuming (little more than a straight mem copy). Apart from that, real 24bit shouldn't be used anywhere after all. It only creates overhead and has no real advantages.

well for PSX emulation (i'm working on a PSX dynarec right now) we could have treat 4 rgb into 4 rgba in one instruction. But well, I know that you're right.

Raphael wrote:
On another note, reverse conversion functions would have been nice indeed, especially for image loading functions.

yes strangely enough i don't see any in binutils (all the allegrex instructions are dicovered ?).
Back to top
View user's profile Send private message
Raphael



Joined: 17 Jan 2006
Posts: 646
Location: Germany

PostPosted: Thu Oct 26, 2006 1:26 am    Post subject: Reply with quote

I suppose they are complete. I could imagine sony stripped those functions because they saw not enough need versus transistor cost. After all, I don't see that much need for upscaling low-quality color codes into higher ones anyway, since there is no quality-gain whatsoever. It would only be useful if you were limited to 8888 format on PSP, but that's not the case. Still it would have been nice ;P
_________________
<Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki

Alexander Berl
Back to top
View user's profile Send private message Visit poster's website
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