skaven65536
8th July 2005, 14:59
Hello!
Now I am working on video application, which will support .avi, .yuv and .avs files as input files.
To test it's work with .avs I've created such script:
script.avs
clip1 = Avisource("bus.avi")
clip1 = clip1.ConvertToYUY2()
return clip1
(I've also tried ConvertToYV12).
As I understand, there is no any losses in Y component during YUV->YUY2.
bus.avi - is an uncompressed RGB24 sequence.
After it I've add a code in my application, which will open these two files (bus.avi and script.avs), convert frames from "bus.avi" to YUV colorspace and perfom an Y-PSNR convertion between them (correspondent frames from these two sequences).
In theory, the result must be near 100 :), but it was only about 30 :(
Before it I've used such rgb<->yuv matrix
y = (0.299 * r + 0.587 * g + 0.114 * b);
u = ((-0.147) * r -0.289 * g + 0.436 * b);
v = (0.615 * r -0.515 * g -0.100 * b);
r = (y + 1.14 * v);
g = (y - 0.395 * u - 0.581 * v);
b = (y + 2.032 * u) ;
I know, that it is also a variety of this matrix, when you add 128 to u and v to make them positive, but it doesn't affect on Y component.
After it I've tried matrix from fourcc.org site (http://www.fourcc.org/fccyvrgb.php).
The PSNR was about 60, it is really better :), but I think that it is too much for just a round-up mistake.
So, the question is: what RGB<->AVS matrix is used in AVISynth?
Thanks.
Now I am working on video application, which will support .avi, .yuv and .avs files as input files.
To test it's work with .avs I've created such script:
script.avs
clip1 = Avisource("bus.avi")
clip1 = clip1.ConvertToYUY2()
return clip1
(I've also tried ConvertToYV12).
As I understand, there is no any losses in Y component during YUV->YUY2.
bus.avi - is an uncompressed RGB24 sequence.
After it I've add a code in my application, which will open these two files (bus.avi and script.avs), convert frames from "bus.avi" to YUV colorspace and perfom an Y-PSNR convertion between them (correspondent frames from these two sequences).
In theory, the result must be near 100 :), but it was only about 30 :(
Before it I've used such rgb<->yuv matrix
y = (0.299 * r + 0.587 * g + 0.114 * b);
u = ((-0.147) * r -0.289 * g + 0.436 * b);
v = (0.615 * r -0.515 * g -0.100 * b);
r = (y + 1.14 * v);
g = (y - 0.395 * u - 0.581 * v);
b = (y + 2.032 * u) ;
I know, that it is also a variety of this matrix, when you add 128 to u and v to make them positive, but it doesn't affect on Y component.
After it I've tried matrix from fourcc.org site (http://www.fourcc.org/fccyvrgb.php).
The PSNR was about 60, it is really better :), but I think that it is too much for just a round-up mistake.
So, the question is: what RGB<->AVS matrix is used in AVISynth?
Thanks.