Sign in to follow this  

Porting hq4x to 24 bit color

Recommended Posts

I've been trying to port hq4x code to work with 24 bit color bitmaps. The original code converts the bitmap to 16 bit before applying the hq4x algorithm. Here is the original code and its result And my attempt at making it 24 bit with this result. Entire source code here What I don't get is the original version converts the 16 bit color to 32 bit before it starts writing to the destination (lines 313-314). As far as I can tell it only uses the 16 bit color to convert from RGB to YUV (actually its YCbCr). So I replaced that the conversion to go from 24 bit RGB to YUV (per YUV - RGB Color Format Conversion). Thinking the fault may have been the chance of RGBtoYUV code. I tried converting the 24 bit to 16 bit color on the fly and using the original RGB to YUV code. Still produced the same result. So I'm thinking the problem is that the Interp functions don't work across the whole range of 24 bit color values. Whereas in the original code the conversion to 16 bit then to 32 bit reduces the possible values and hence it works. But if that is the case I don't understand why or how I could fix them to work with all 24 bit color values.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this