MagicEngine
Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Japanese English 

PC-FX RGB to YUV conversion?

 
Post new topic   Reply to topic    MagicEngine Forum Index -> General
View previous topic :: View next topic  
Author Message
cdoty
Member
Member


Joined: 02 Feb 2005
Posts: 73
Location: Houston, TX

PostPosted: Sun Jul 25, 2010 9:17 pm    Post subject: PC-FX RGB to YUV conversion? Reply with quote

What is the exact conversion from RGB to YUV used on the PC-FX?

I've tried the YUV - RGB Color Format Conversion from http://www.equasys.de/colorconversion.html (with the U/V scaled to 4 bit). It's pretty close, except the that Y and the green are a bit high.

I initially attempted some of the other values, but the green was way off. I though it was an error in my code until I noticed Hage (http://homepage1.nifty.com/hyperclub/download/Alpha/index.html) did the same thing.
_________________
Visit RasterSoft on facebook or visit the website.
Back to top
View user's profile Send private message Visit poster's website AIM Address
dmichel
Admin
Admin


Joined: 04 Apr 2002
Posts: 1166
Location: France

PostPosted: Mon Jul 26, 2010 1:17 pm    Post subject: Reply with quote

Good question!

For patching some images of Pia Carrot I needed a RGB to YUV converter too, I tried many formulas but none of them was exact, there was always a little glitch, so in the end I used a brute force method.

I simply used the YUV to RGB converter over the whole range of possible YUV values to fill a RGB array, something like that :

Code:
for(i = 0; i <= 0xFFFF; i++) {
   data = YUV_to_RGB(i);
   rgb[i][0] = data >> 16;
   rgb[i][1] = data >> 8;
   rgb[i][2] = data;
}


And then to convert a RGB value to YUV I was simply searching for the closest match in the RGB array to get the corresponding YUV value. It's a bit slow and memory hungry though, if you need it for some real-time calculation on the PCFX this probably won't work, but for batch conversion of some images that did the trick for me.
_________________
David Michel
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    MagicEngine Forum Index -> General All times are GMT + 1 Hour
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