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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 17th January 2005, 20:51   #41  |  Link
Steve56
Registered User
 
Join Date: Jun 2002
Posts: 38
Quote:
Yes that's true, I noticed that too late. His plugin contains optimization code, so it might be faster. (btw, hdtv isn't always Rec.709 as suggested in his docs ...) [/B]
ah, good to know ;-) I did now try to check with GSpot, if a certain MPEG-2 HDTV 1080i stream (Astra 1080 Konzert1), is encodet with the BT709 or BT601 matrix. But I don't know where to read this information from?!

Steve56
Steve56 is offline   Reply With Quote
Old 17th January 2005, 21:23   #42  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Hollola, Finland
Posts: 4,299
Open the clip in GSpot v2.52b01.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 17th January 2005, 21:31   #43  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,294
1) That info is also available in 'DGMPEGDec 1.0.13 beta 11'. Using


mpeg2source(info=true)

2) Use latest beta of GSpot and look in the upper right corner. In the video section, the five boxes next to NVOP. The fives boxes are from left to right:

1) I709 (= Rec.709 coefficients)
2) FCC (almost the same as Rec.601)
3) I470 (= Rec.601 coefficients [an updated version of Rec.470-6, but coefficients are exactly the same])
4) S170 (= SMPTE 170M; exactly the same as Rec.601)
5) S240 (= SMPTE 240M; almost the same as Rec.709)

see table 6-9 page 56 of http://le-hacker.org/hacks/mpeg-drafts/is138182.pdf

If the boxes remain "black" then the used coefficients are not present in the header, and the default (which is Rec.709) should be assumed.

I hope it's clear now

Last edited by Wilbert; 17th January 2005 at 21:33.
Wilbert is offline   Reply With Quote
Old 18th January 2005, 11:56   #44  |  Link
Steve56
Registered User
 
Join Date: Jun 2002
Posts: 38
Wilbert: Thanks for the comprehensive answer!

Before that, I just did a color conversion judged by the look of it, when turned on or off. ;-)
Steve56 is offline   Reply With Quote
Old 28th January 2005, 20:03   #45  |  Link
tritical
Registered User
 
Join Date: Dec 2003
Location: MO, US
Posts: 999
Wilbert, is the source included in the zip linked to at the beginning of this thread the latest? I tried doing some simple optimization and got it running about 40% faster (about 210fps vs 145fps in YV12 on my comp) still with plain c code, but I'm wondering about a few things looking through it... in the constructor it checks mode against "Rec.709->Rec.601" and "Rec.601->Rec.709", yet in the main part it checks mode against "mpeg2->mpeg1" is this intended? In the YV12 mpeg1->mpeg2 it uses the "21" conversions and not the "12" conversions, but in the YUY2 code the mpeg1->mpeg2 does use the "12" conversions? Also, could you tell me or point me to a source that has the numbers for how the coefficients used were derived? I'm just curious, I tried to calculate them myself using coefficients from a few different websites, but they never work out to be exactly the same (usually off by 20-40 after multiplying by 65536). Thanks in advance.

Hm, must be because:

mpeg2source()
clip1 = last.colormatrix(mode="rec.601->rec.709")
clip2 = last.colormatrix(mode="rec.709->rec.601")
subtract(clip1,clip2)
coloryuv(analyze=true)

shows both clips to be identical .

Last edited by tritical; 28th January 2005 at 20:15.
tritical is offline   Reply With Quote
Old 29th January 2005, 14:25   #46  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,294
Quote:
in the constructor it checks mode against "Rec.709->Rec.601" and "Rec.601->Rec.709", yet in the main part it checks mode against "mpeg2->mpeg1" is this intended? In the YV12 mpeg1->mpeg2 it uses the "21" conversions and not the "12" conversions, but in the YUY2 code the mpeg1->mpeg2 does use the "12" conversions?
I corrected all that (v1.6). Thx very much. It's a bit stupid that I didn't notice this

Quote:
Also, could you tell me or point me to a source that has the numbers for how the coefficients used were derived? I'm just curious, I tried to calculate them myself using coefficients from a few different websites, but they never work out to be exactly the same (usually off by 20-40 after multiplying by 65536).
I included a text file (coefficients.txt) which contains all calculations (if you know maple i can send you the worksheet). I hope that's clear enough.

Btw, some websites use slightly different coefficients, perhaps that could be the problem.

Quote:
I tried doing some simple optimization and got it running about 40% faster (about 210fps vs 145fps in YV12 on my comp) still with plain c code
Great! Could you add those changes to v1.6?
Wilbert is offline   Reply With Quote
Old 29th January 2005, 15:34   #47  |  Link
North2Polaris
Registered User
 
North2Polaris's Avatar
 
Join Date: Jul 2003
Location: Connecticut
Posts: 99
Quote:
Originally posted by Wilbert
Yes that's true, I noticed that too late. His plugin contains optimization code, so it might be faster. (btw, hdtv isn't always Rec.709 as suggested in his docs ...)
@Wilbert,

Other than speed, any advantage to using ColorMatrix over BT709ToBT601?

North
North2Polaris is offline   Reply With Quote
Old 29th January 2005, 17:00   #48  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,294
Quote:
Other than speed, any advantage to using ColorMatrix over BT709ToBT601?
Rec.601->Rec.709 conversion (useful for capping -> mpeg2) is possible in ColorMatrix
Wilbert is offline   Reply With Quote
Old 29th January 2005, 17:53   #49  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Hollola, Finland
Posts: 4,299
Quote:
Originally posted by Wilbert
Rec.601->Rec.709 conversion (useful for capping -> mpeg2) is possible in ColorMatrix
However, if you use CCE for encoding, no need to use ColorMatrix as it doesn't specify any coefficients for the encoded file for some reason?
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 29th January 2005, 20:21   #50  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,294
Quote:
However, if you use CCE for encoding, no need to use ColorMatrix as it doesn't specify any coefficients for the encoded file for some reason?
Only if you use CCE Remember pal/ntsc uses Rec.601 coefficients. TMPGEnc/QuEnc add fcc (approx Rec.709) coefficients to the mpeg-2 header.
Wilbert is offline   Reply With Quote
Old 30th January 2005, 02:09   #51  |  Link
tritical
Registered User
 
Join Date: Dec 2003
Location: MO, US
Posts: 999
Quote:
I included a text file (coefficients.txt) which contains all calculations (if you know maple i can send you the worksheet). I hope that's clear enough.
That was exactly what I was looking for , thanks.

Quote:
Great! Could you add those changes to v1.6?
Yep, here: [link removed]... most the changes required rearranging things a good bit. You can just skim through it and see if you want to use anything from it. I also made mmx routines for the YV12 conversions (mainly stolen from tom's filter, with some minor changes). On my system the YV12 c code runs around 210-220fps, the mmx versions average somewhere around 350fps). However, due to rounding differences, the mmx and c output are not exactly the same. The maximum difference on the Y plane is +-2 and for UV its +-1. I included an mmx parameter to disable using mmx if you want to though (mmx=false).

Last edited by tritical; 30th January 2005 at 20:45.
tritical is offline   Reply With Quote
Old 30th January 2005, 14:25   #52  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,294
Great! I updated the first post. Thanks very much
Wilbert is offline   Reply With Quote
Old 30th January 2005, 14:47   #53  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,390
Quote:
However, due to rounding differences, the mmx and c output are not exactly the same. The maximum difference on the Y plane is +-2 and for UV its +-1.[/B]
So, which one is closer to the "exact" value? With the actual performance the filter has reached by now, I don't care for the remaining speed difference (you know my scripts ) - but the value differences could be of importance (ask jorel ... BTW, what happened to him?)

edit: forgot to say: Great work, thank you!
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 30th January 2005, 16:01   #54  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,294
Quote:
So, which one is closer to the "exact" value? With the actual performance the filter has reached by now, I don't care for the remaining speed difference
The c output, thus ColorMatrix(..., mmx=false).
Wilbert is offline   Reply With Quote
Old 30th January 2005, 21:57   #55  |  Link
Dhampir
Guest
 
Posts: n/a
I've done a screenshot using mmx and without mmx and I can't spot any difference between using mmx and not using mmx. Are the rounding errors just insignificant? Here are two screenshots.

MMX=false



MMX

  Reply With Quote
Old 30th January 2005, 22:29   #56  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,294
Quote:
The maximum difference on the Y plane is +-2 and for UV its +-1.
The difference is minor, you won't see it by visual inspection
Wilbert is offline   Reply With Quote
Old 30th January 2005, 23:15   #57  |  Link
len0x
I'm afraid we've to stop
 
len0x's Avatar
 
Join Date: Mar 2003
Location: Amongst mad people
Posts: 5,400
Can this filter safely be used after resizing (for speed reasons) or better to put it before?
__________________
Gordian Knot Family:
Gordian Knot: website, download
Auto Gordian Knot: Website and download, tutorial, FAQ
len0x is offline   Reply With Quote
Old 30th January 2005, 23:41   #58  |  Link
len0x
I'm afraid we've to stop
 
len0x's Avatar
 
Join Date: Mar 2003
Location: Amongst mad people
Posts: 5,400
I just grabbed a bunch of DVDs I have at hand and actually only 50% of them are using default mpeg2 coefficients. There are considerable number of them that uses s170 and i470. Also I had one that uses FCC. So I guess its no good to just apply this filter to any DVD you have.

P.S. Is it possible to write a filter that returns coefficient type, so that conditional usage of ColorMatrix is possible?
__________________
Gordian Knot Family:
Gordian Knot: website, download
Auto Gordian Knot: Website and download, tutorial, FAQ

Last edited by len0x; 30th January 2005 at 23:45.
len0x is offline   Reply With Quote
Old 30th January 2005, 23:55   #59  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,390
Quote:
Originally posted by Wilbert
The difference is minor, you won't see it by visual inspection
OOOoooohh. Yes you will.

interleave(last.colormatrix(mmx=false),last.colormatrix(mmx=true))

Step back and forth, and tell me you see no difference.


edited stupidity ... grrr!
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)

Last edited by Didée; 31st January 2005 at 00:23.
Didée is offline   Reply With Quote
Old 31st January 2005, 00:04   #60  |  Link
tritical
Registered User
 
Join Date: Dec 2003
Location: MO, US
Posts: 999
What about having dgdecode set a global variable colormatrix could read? To make it multi instance compatible the name would need to depend on the d2v file, so colormatrix would need the name of the d2v file as input as well. Good or bad idea?

Wouldn't it be:

interleave(last.colormatrix(mmx=false),last.colormatrix(mmx=true))

for Wilbert's point .

Last edited by tritical; 31st January 2005 at 00:09.
tritical is offline   Reply With Quote
Reply

Tags
colormatrix

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:21.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2017, vBulletin Solutions Inc.