VideoHelp Forum

Our website is made possible by displaying online advertisements to our visitors. Consider supporting us by disable your adblocker or Try ConvertXtoDVD and convert all your movies to DVD. Free trial ! :)
+ Reply to Thread
Page 3 of 3
FirstFirst 1 2 3
Results 61 to 71 of 71
Thread
  1. Originally Posted by chris319 View Post
    My code uses unsigned bytes. This would be hard to catch unless you've worked with PureBasic before. The ".a" declaration signifies an unsigned byte. What happens with your code if you make those bytes unsigned?
    The unsigned [EDIT: signed] bytes I am used to (aka __int8, char) have a range from -128 to +127.
    https://msdn.microsoft.com/en-us/library/s3f49ktz.aspx
    Not real good for video work.
    Last edited by raffriff42; 20th Feb 2017 at 01:42.
    Quote Quote  
  2. Originally Posted by raffriff42 View Post
    The unsigned bytes I am used to (aka __int8, char) have a range from -128 to +127.
    Those are signed bytes ("char" in C). Unsigned bytes, "unsigned char" in C, range from 0 to 255. They are often typdef'd as "uchar", "__uint8", etc.
    Last edited by jagabo; 19th Feb 2017 at 19:12.
    Quote Quote  
  3. Oops, signed bytes is what I meant.
    Quote Quote  
  4. So raffriff, would you be willing to re-run your code using unsigned bytes (0 to 255)?
    Quote Quote  
  5. The test was run with unsigned bytes. I edited post #61 above to clarify.

    In post #55, BYTE is a typedef (alternate name) for unsigned char; see Windows Data Types.

    By the way I added a count of total errors to see how many colors were out by 1 or more. The answer was four.
    Last edited by raffriff42; 20th Feb 2017 at 02:13.
    Quote Quote  
  6. Originally Posted by raffriff42 View Post
    By the way I added a count of total errors to see how many colors were out by 1 or more. The answer was four.
    That's simply not possible. Look at the RGB cube inside the rec.601 YUV cube in post #10. On average, 6 different RGB colors map to each YUV color. You expect about 14 million errors on a round trip from 8 bit RGB to 8 bit rec.601 YUV and back to 8 bit RGB.
    Quote Quote  
  7. Originally Posted by jagabo View Post
    Originally Posted by raffriff42 View Post
    By the way I added a count of total errors to see how many colors were out by 1 or more. The answer was four.
    That's simply not possible. Look at the RGB cube inside the rec.601 YUV cube in post #10. On average, 6 different RGB colors map to each YUV color. You expect about 14 million errors on a round trip from 8 bit RGB to 8 bit rec.601 YUV and back to 8 bit RGB.
    Agreed.
    Quote Quote  
  8. I compiled riffraff42's code from post #55 and added an error count and got:

    Code:
    Colors tested: 16387064
    Errors: 13821768
    Maximum red error:  1
    Maximum green error:  2
    Maximum blue error:  1
    And why are you guys testing from 1 to 254 instead of 0 to 255?
    Quote Quote  
  9. If the error can be held to +/- 1 no matter how frequently it occurs, that's good enough for me. You're going to have that error when you use division with integers.

    why are you guys testing from 1 to 254 instead of 0 to 255?
    ISTR I was having trouble testing from 0 to 255 so I used 1 to 254 with no trouble. My rationalization was that in video, 0 and 255 are sync and are off limits. You can test from 0 to 255 if it works for you.
    Quote Quote  
  10. Yeah, yer right jagabo. Logic error on my part.
    Quote Quote  
  11. Originally Posted by chris319 View Post
    why are you guys testing from 1 to 254 instead of 0 to 255?
    ISTR I was having trouble testing from 0 to 255 so I used 1 to 254
    Ah, think I see what your problem was. If you ran a loop like:

    Code:
            unsigned char R1;
    
    	for (R1=0; R1<=255; R1++) 
    	{
                // blah
            }
    the ending condition will never evaluate as true -- because when R1 increments from 255 it will wrap around to 0 rather than changing to 256. To get around that you need to do something like this instead:

    Code:
            unsigned char R1;
            unsigned char r;
    
    	for (int r=0; r<=255; r++) 
    	{
                    R1 = r;
                    // blah
             }
    Quote Quote  



Similar Threads