Log in

View Full Version : Bug in dgmpegdec? (Bad Color upsample)


Malcolm
26th May 2004, 09:46
Hi,
i hope that i'm not wrong and the bug really is because of dgmpegdec and not avisynth (or me :D ).
I have 3 snapshots to illustrate the problem; they are from a PAL DVB-capture:
http://img12.imageshack.us/img12/3140/1_crop_bad.pnghttp://img16.imageshack.us/img16/6796/1_crop_good.pnghttp://img20.imageshack.us/img20/3829/1_crop_difference.png
The left one is opened in avisynth with the following line:
orig = mpeg2source("test.d2v", cpu2="xxxxox", idct=2, iPP=true)
The one in the middle is opened and processed with a more complex script:
mpeg2source("test.d2v", cpu2="xxxxox", idct=2, iPP=true)
crop(16,16,-16,-16)
SeparateFields()
converttoyuy2()
faerydust()
Weave()
addBorders(16,16,16,16)
Limiter()

The right one is just the difference (subtract(...).levels(...))

Looking at the 3 snapshots, i would say that the color in the left one is upsampled incorrectly.
I don't know how or why, but after processing it with the more complex script in the middle (converttoyuy2() + faerydust()) the video looks o.k. for me!
You can see the difference between them in the right snapshot.

Any idea?? :confused: :confused: :confused:

Greetings,
Malcolm

scharfis_brain
26th May 2004, 11:10
dgmpeg does its job correctly.

its the displaying application (VDub?), that doesn't do the correct upsampling, because there is no per frame flag, that identifies progressive or interlaced YV12.

As far as I know, neuron2 is working on a solution.

Bogalvator
26th May 2004, 11:26
from Avisynth Docu
Since v2.51/v2.52 an optional interlaced parameter is added (interlaced=false is the default operation). When set to false it is assumed that clip is progressive, when set to true it is assumed that clip is interlaced. This option is added because for example (assuming clip is interlaced YV12):

SeparateFields(clip)
ConvertToYUY2()
Weave()

is upsampled incorrectly. Instead it is better use:

ConvertToYUY2(clip, interlaced=true)

So maybe using:

converttoyuy2(interlaced=true)
SeparateFields()
faerydust()
Weave()

will solve the issue?

Guest
26th May 2004, 12:11
You didn't say where you are viewing this so I'll assume VirtualDub. When you deliver YV12 to VirtualDub, it has to upsample it for display using whatever YV12 codec you have installed. Usually it is DivX or Xvid. These assume progressive upsampling, but your video is chroma sampled using interlaced sampling. The result is that you get these artifacts when viewing in VirtualDub.

The reason your ConvertToYUY2() call appears to work is because you (strangely) do it after SeparateFields(). The default for ConvertToYUY2() is interlaced=false, so things appear OK because when you separated the fields you effectively made a progressively sampled clip. But it is still strictly incorrect, although it would get very technical to explain why.

The correct thing to do is apply ConvertToYUY2(interlaced=true) before the SeparateFields(), just as Bogalvator said.

Note that all versions and derivatives of MPEG2DEC3 behave like this. When using YV12, you really have to know exactly what you are doing throughout your production chain. As scharfis_brain says, I am working on changes to improve matters, but YV12 will remain problematic in some regards.

Malcolm
26th May 2004, 12:15
@scharfis_brain, Bogalvator and neuron2

Thank you all very much. i wasn't aware of that!

Greetings,
Malcolm