Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
|
|
Thread Tools | Search this Thread | Display Modes |
1st July 2011, 13:49 | #1 | Link |
Registered User
Join Date: Mar 2010
Posts: 98
|
ManualColorMatrix - Can perform any matrix-based color conversion
This plug-in can perform any matrix-based color conversion (if you know how to use it ):
Code:
Out Add Matrix In / \ / \ / \ / \ | Y | | yadd | | yy yu yv | | Y | | U | = | uadd | + | uy uu uv | * | U | | V | | vadd | | vy vu vv | | V | \ / \ / \ / \ / Examples: Convert YCgCo to RGB32: ManualColorMatrix(2, 1.0, -1.0, 1.0, 1.0, 1.0, 0.0, 1.0, -1.0, -1.0, 0.0, -128.0, 256.0) Convert RGB to YV24 (bt601 matrix, range 16-235): ManualColorMatrix(0, 0.255785, 0.504129, 0.097906, -0.148223, -0.290992, 0.439215, 0.439215, -0.367789, -0.071426, 16.0, 128.0, 128.0) Convert YCgCo to YUY2 (bt601 matrix, range 16-235): ManualColorMatrix(3, 0.85782, 0.150438, 0.157879, 0.0, -0.581984, -0.587438, 0.0, -0.735578, 0.510641, -23.4645, 277.686, 156.792) http://www.mediafire.com/?9yyj1uepe5ir5w7 |
1st July 2011, 23:52 | #3 | Link |
Registered User
Join Date: Mar 2010
Posts: 98
|
Even for YV12->YV12 or YUY2->YUY2 transform I would have to convert it internally to YV24 first, there is no way to do the color conversion with chroma subsampled material. That would mean I would do it the same way I did with YUY2/YV12 output, calling a resizer and upsample chroma.
For interlaced material I cannot use a resizer, but you could just do SeperateFields().ManualColorMatrix(...).Weave() |
2nd July 2011, 08:41 | #4 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
You could do the equivalent of my YV12ToYUY2i_26 function in this post. Note that if ManualColorMatrix did support YV12 input, SeperateFields().ManualColorMatrix(...).Weave() would give incorrect results, since separated YV12 fields have a different chroma placement. |
|
2nd July 2011, 14:57 | #5 | Link |
Registered User
Join Date: Mar 2010
Posts: 98
|
Your script only works with AviSynth 2.6, in Avisynth 2.6 you can just convert to YV24 and convert back to YV12 afterwards, no reason to double that functionality in this plugin.
Could you please explain the problem with SeperateFields and Weave, I could do that internally and use different chroma offsets, but I do not see what chroma offset I should use at the moment (you can use the nice image on page 381 in H.264 standard to explain: http://www.itu.int/rec/T-REC-H.264-201003-I/en ) |
2nd July 2011, 17:11 | #6 | Link | ||
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
Quote:
See http://avisynth.org/mediawiki/Sampli...2_color_format. |
||
2nd July 2011, 17:58 | #7 | Link |
Registered User
Join Date: Mar 2010
Posts: 98
|
Thatīs the same for MPEG-2 / MPEG-1 subsampling (type 0 and 1 in H.264 spec) if I see that correct? For type 2/3 subsampling (as in H.264 spec) it should be +0.25 for top field and 0 for bottom field, for type 4/5 itīs 0 for top field and -0.25 for bottom field?
|
2nd July 2011, 18:52 | #8 | Link |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Yes, all correct.
And conversely for output (downsampling from YV24), all those offsets get multiplied by -2. I think I'll have to lie down for a while - my eyes and brain are still recovering from viewing that funky diagram Figure E-1 in the H.264 spec. |
11th July 2011, 19:22 | #9 | Link |
Registered User
Join Date: Jan 2006
Posts: 1,867
|
There's still stuff missing, I wish it could do this
http://www.brucelindbloom.com/index....YZ_to_Lab.html That would make it a lot more complicated though, I might have to script it myself.. or get back into figuring out how to make a plugin. Man, if I could make plugins, I would be one of the most prolific ones here |
14th October 2018, 17:16 | #10 | Link |
Registered User
Join Date: Jan 2017
Location: Germany
Posts: 21
|
What happens if you for example convert from RGB REC2020 to RGB rec709 with the correct conversion matrix?
All the color outside REC709 will have illegal values. Are the illegal RGB value left "untouched", negative etc... or are they getting clipped to the nearest legal value? Thank you! |
Thread Tools | Search this Thread |
Display Modes | |
|
|