Welcome Guest ( Log In | Register )


Important

The forums will be closing permanently the weekend of March 15th. Please see the notice in the announcements forum for details.

 
Fcchandler's Mpeg2 Filter - 4:2:2?
« Next Oldest | Next Newest » Track this topic | Email this topic | Print this topic
FredThompson
Posted: Jun 21 2008, 03:30 AM


Member


Group: Members
Posts: 11
Member No.: 23753
Joined: 21-June 08



I have not been successful loading MPEG-2 4:2:2 into VirtualDub 1.8.1 using fccHandler's MPEG-2 plugin for VirtualDub 2.6. Luma looks fine, chroma is almost all gone with splotches of odd chroma.

fccHandler, does it not include 4:2:2 support?
 
     Top
fccHandler
Posted: Jun 21 2008, 04:11 PM


Administrator n00b


Group: Moderators
Posts: 3961
Member No.: 280
Joined: 13-September 02



It supports 4:2:2, but I never actually tested it.

I can confirm that the chroma is b0rked when video "color depth" is set to Autoselect, YV12, or YVU9. I'll try to fix that this weekend. In the meantime, try setting decompression color depth to YUY2 to work around it.

--------------------
May the FOURCC be with you...
 
     Top
fccHandler
Posted: Jun 22 2008, 04:25 AM


Administrator n00b


Group: Moderators
Posts: 3961
Member No.: 280
Joined: 13-September 02



I've uploaded MPEG-2 plugin version 2.7, which should fix the 4:2:2 chroma problem:

http://fcchandler.home.comcast.net/Plugins/MPEG2

I had hard-coded "Autoselect" to return YV12 by default, which is perfect for VOBs (and most other MPEG files) but it's a terrible choice for 4:2:2 profile. Version 2.7 now chooses YUY2 if it detects 4:2:2 profile.

I hacked a new downsampling function just in case some clueless person deliberately chooses to decompress 4:2:2 to YV12. It does preserve interlacing as specified in ISO/IEC 13818-2. Unfortunately VirtualDub doesn't support interlaced YV12 so you'll end up with CUE in the preview. Mind you, that isn't the fault of VirtualDub or the plugin. It's simply because there's no standard for transport of interlaced YV12 in VFW.

--------------------
May the FOURCC be with you...
 
     Top
phaeron
Posted: Jun 22 2008, 06:58 PM


Virtualdub Developer


Group: Administrator
Posts: 7773
Member No.: 61
Joined: 30-July 02



Nitpick: YV12 is a FOURCC for a format defined as having a progressive chroma layout. There is no such thing as "interlaced YV12." It's interlaced 4:2:0.
 
    Top
FredThompson
Posted: Jun 23 2008, 01:05 AM


Member


Group: Members
Posts: 11
Member No.: 23753
Joined: 21-June 08



Thanks for the quick reply. I'll give the updated filter a whirl. (Edit: Works like a charm. Thanks a bunch!)

The source files are 4:2:2 interlaced MPEG-2 as claimed by TMPGEnc. Are they creating standard-incompliant files or what?
 
     Top
fccHandler
Posted: Jun 24 2008, 09:58 AM


Administrator n00b


Group: Moderators
Posts: 3961
Member No.: 280
Joined: 13-September 02



No, TMPGEnc is perfectly compliant AFAIK.

The point I was making is that MPEG-2 4:2:2 profile should be decoded as 4:2:2. If one converts it to interlaced 4:2:0, there isn't a standard way to transport it in VFW/AVI. As phaeron said, the 'YV12' format isn't the same thing as MPEG-2 interlaced 4:2:0. For that matter, I don't think the 'YUY2' format is the same as MPEG-2 4:2:2 either...

I might have to reconsider that downsampling function, because I know phaeron is correct. It isn't giving what VirtualDub is asking for.

--------------------
May the FOURCC be with you...
 
     Top
phaeron
Posted: Jun 25 2008, 05:08 AM


Virtualdub Developer


Group: Administrator
Posts: 7773
Member No.: 61
Joined: 30-July 02



YUY2 is 4:2:2 with coaligned chroma, so it's at least very close to MPEG-2. The color space might not be exactly the same. VirtualDub encodes and decodes it as Rec. 601, and more importantly, that's what kPixFormat_YUV422_YUYV in the plugin API specifies.

I could add interlaced 4:2:0 to the plugin API, even though there's no FOURCC for it... although it may take quite a bit of work in the blitter library. I added centered 4:2:2 and 4:2:0 to the dev tree recently and that was a royal pain. It's not going to be that useful, though, if it turns out the color matrix is wrong anyway for MPEG-2.

I wonder, what do DirectShow DVD decoders do? They can't all just resample to progressive chroma in software, that'd be stupid.
 
    Top
fccHandler
Posted: Jun 26 2008, 10:12 AM


Administrator n00b


Group: Moderators
Posts: 3961
Member No.: 280
Joined: 13-September 02



MPEG-2 allows the encoder to select from four different matrices to specify the coefficients it used to convert from RGB to YCbCr. Ideally the decoder can use the inverse to convert back to RGB, but it seems that many encoders don't bother to set this value correctly so I used to get a lot of complaints about washed-out colors. Because of that I set the default to Rec. 601, but you can still force it to honor the stream's matrix coefficients in MPEG preferences (VirtualDub-MPEG2) or extended open options (MPEG-2 plugin).

Just as a point of interest, my DirectShow decoder (CyberLink) can't decode a 4:2:2 profile MPEG. dry.gif

--------------------
May the FOURCC be with you...
 
     Top
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:
7 replies since Jun 21 2008, 03:30 AM Track this topic | Email this topic | Print this topic

<< Back to VirtualDub Filters and Filter Development