View Full Version : reinterpolate420 - eliminate chroma jaggyness of PAL-DV
scharfis_brain
22nd September 2004, 22:44
function reinterpolate420(clip x)
{
u=x.utoy()
v=x.vtoy()
u=u.separatefields().separatefields().selectevery(4,1,2).tomsmocomp(1,-1,0).assumefieldbased().weave()
v=v.separatefields().separatefields().selectevery(4,1,2).tomsmocomp(1,-1,0).assumefieldbased().weave()
ytouv(u,v,x)
}
this function will only work properly, if your DV-Decoder upsamples the interplaced YUV420 (YV12) Chroma to yuy2 using point-sampling!
the results are IMO very good:
http://home.arcor.de/scharfis_brain/samples/reinterpolate420.png
It becomes quite useful, if you intend to deinterlace your PALDV for achieving some kind of Film-Look, for deshaking-pre-processing further filtering etc.
Wilbert
22nd September 2004, 23:30
Which DV codec did you use here?
scharfis_brain
23rd September 2004, 05:14
the VDub- File Info tells me, it is using the Mainconcept-DV-CoDec for decoding.
I'll test some other codecs after work.
dionisos
23rd September 2004, 16:19
the results were AMAZING!
i never thought that reinterpolate would do such a miracle!
Wilbert
23rd September 2004, 22:36
Could you try the following plugin
http://www.geocities.com/wilbertdijkhof/ReInterpolate420_v1.zip
and add a screenshot. Progressive only (for now). Syntax
AviSource(...)
ReInterpolate420()
ADLANCAS
24th September 2004, 03:06
In theory, should work also in NTSC DV ?
Video Dude
24th September 2004, 03:37
Originally posted by ADLANCAS
In theory, should work also in NTSC DV ?
NTSC DV is 4:1:1
PAL DV is 4:2:0
So the answer is no.
There is an AviSynth filter called ReInterpolate411 by trbarry that has been around for some time.
Wilbert
24th September 2004, 23:35
Added interlaced support
http://www.geocities.com/wilbertdijkhof/ReInterpolate420_v2.zip
syntax
AviSource(..)
ReInterpolate420(interlaced=true) # false by default
@scharfis_brain,
Could you compare it to your script?
scharfis_brain
25th September 2004, 10:12
jep, it works!
You're using simple lineare interpolation, aren't you?
my method using edge directed interpolation using tomsmocomp (tdeint(mode=1) should work, too) has a better chroma definition on diagonales.
smok3
25th September 2004, 10:43
scharfis_brain: cool, do you think this will work (as preproc) in favor of a 'better' chroma key?
scharfis_brain
25th September 2004, 10:58
of course!
my reinterpolate420 tries to find diagonal edge to enhance the chroma resolution. but currently something seems to be slight weird. the chroma is shifted by about 1 or two pixels upwards (wilberts plugin, too!)
but, try some comparisions of your chroma-keying with and without reinterpolate420, and report your results!
scharfis_brain
26th September 2004, 10:29
according to this: http://www.mir.com/DMG/chroma.html
(SMPTE PAL-DV)
Cb & Cr are spatially displaced by one line per field.
Do we need to include this weirdness in our reinterpolation?
I tend to say, that there is always a slight chroma-shift in PAL-DV depending on the color.
arggggghhhhhhhhhhhhh!
I hate this crappy YUV420. I will never step behind the thoughts of those engineers.
All they did was causing confusion........
Wilbert
26th September 2004, 13:34
You're using simple lineare interpolation, aren't you?
Yup.
my method using edge directed interpolation using tomsmocomp (tdeint(mode=1) should work, too) has a better chroma definition on diagonales.
If I would know how that works, I can try to implement it :)
Cb & Cr are spatially displaced by one line per field.
Do we need to include this weirdness in our reinterpolation?
I did. Let me tell you how I interpolate:
1) Assume clip is interlaced. The layout of the *frame* is as follows
YV1 ...
YV2 ...
YU3 ...
YU4 ...
YV5 ...
YV6 ...
YU7 ...
YU8 ...
when converting to YUY2 by the codec, the existing chroma is untouched. The missing chroma is either duplicated or point sampled (not sure which one it is).
ReInterpolate creates the missing chroma (the existing chroma is left untouched) as follows:
YV1 ... U1 = as done by codec
YV2 ... U2 = as done by codec
YU3 ... V3 = 0.5*( V1 + V5 )
YU4 ... V4 = 0.5*( V2 + V6 )
YV5 ... U5 = 0.5*( U3 + U7 )
YV6 ... U6 = 0.5*( U4 + U8 )
YU7 ...
YU8 ...
2) Assume clip is progressive. I assume that the conversion is always field-based (so codec always upsamples assuming interlaced). Perhaps this is false?
The layout of the *frame* is as follows
ReInterpolate creates the missing chroma (the existing chroma is left untouched) as follows:
YV1 ... U1 = as done by codec
YV2 ... U2 = as done by codec
YU3 ... V3 = 0.666*V2 + 0.333*V5
YU4 ... V4 = 0.333*V2 + 0.666*V5
YV5 ... U5 = 0.666*U4 + 0.333*U7
YV6 ... U6 = 0.333*U4 + 0.666*U7
YU7 ...
YU8 ...
Should I do it differently? Btw, I assume your made your YV12 test clip correctly (feeding the codec with interlaced/progressive YUY2).
Last question :)
my reinterpolate420 tries to find diagonal edge to enhance the chroma resolution. but currently something seems to be slight weird. the chroma is shifted by about 1 or two pixels upwards (wilberts plugin, too!)
Could you post some screenshots of this?
scharfis_brain
26th September 2004, 13:48
thanks for your explantation!
Could you post some screenshots of this?
the screenshot above has this issue!
but, I am not sure, whether the Codec places the chroma correctly, or reinterpolate420 does ?!?
MGRip
26th September 2004, 18:31
Where to add this code in the avisynth script? (I'm newbie with avisynth)
scharfis_brain
27th September 2004, 14:10
to use this function, you need to place it at the top of your script:
[code]
function reinterpolate420(clip x)
{
u=x.utoy()
v=x.vtoy()
u=u.separatefields().separatefields().selectevery(4,1,2).tomsmocomp(1,-1,0).assumefieldbased().weave()
v=v.separatefields().separatefields().selectevery(4,1,2).tomsmocomp(1,-1,0).assumefieldbased().weave()
ytouv(u,v,x)
}
loadplugin("drive:\path\tomsmocomp.dll")
avisource("dv-video-pal.avi")
reinterpolate420()
MGRip
27th September 2004, 18:27
Thanks,
I've just added ConvertToYUY2() before the reinterpolate420() (because there was an error without this)
scharfis_brain
27th September 2004, 18:30
if your source is RGB, this should be okay, but if the source is YV12
(check with avisource("ccc").info())
then, you should not use reinterpolate420 jet.
MGRip
27th September 2004, 19:01
Somehow it says that even my captured footage is RGB24, how can it be? I captured it with adobe premiere.
communist
27th September 2004, 19:31
Are you using the PanasonicDV codec? It accepts and outputs only RGB ;)
Try ffdshows DV decoder and set it to output YV12. Also you cant have a DV file with RGB color space - DV is stored in YV12 and I dont know of any encoder (codec) that employs RGB colorspace in DV streams - but than again these wouldn be DV streams anymore ;)
MGRip
27th September 2004, 19:57
Thanks,
I have really used Panasonic's codec. Where can I find the lastest ffdshow? Do I need to uninstall the panasonic codec?
scharfis_brain
27th September 2004, 20:05
reinterpolate420() only works with the rgb or yuy2 output of commonly used DV-Codecs.
for YV12, I'll try to make another YUY2-upsampling function
(motion adaptive & edge directed)
MGRip
28th September 2004, 15:08
So how can it be that I had chroma jaggies (in text that was done in Adobe AE - full saturated) with the pana's codec (RGB24 only)?
communist
28th September 2004, 16:41
Because its DV = YV12 - no matter what your codec accepts as input and whatever it outputs after upsampling the chroma from YV12 :rolleyes:
MGRip
28th September 2004, 17:41
So why I can't reduce chroma jaggies when its the Panasonic codec?
Or maybe if I will write ConvertToYUY2() will it be the same effect as YV12?
scharfis_brain
28th September 2004, 17:49
1) DV is stored as YV12. period.
2) the codec can output the video in those ways:
2a) leave it as it is: -> YV12 -> use converttoyuy2(interlaced=true) for a first aid to remove chroma-jaggyness.
YV12 output is one of the rare cases. ffdshow can do so.
2b) the codec upsamples to YUY2. (canopus)
but this is done in a very stupid way: pixel doubling.
this causes to the mentioned jaggyness, reinterpolate420() tries to eliminate
2c) the codec delivers YV12 upsampled to RGB24 (panasonic).
this upsampling is as stupid as the YUY2 one.
here you might use converttoyuy2() to get back to yuy2 and then apply reinterpolate420().
3) conclusion:
start with:
avisource("dv.avi").info()
if it is yv12, use converttoyuy2(interlaced=true), but do NOT use reinterpolate420()
if it is yuy2, just use reinterpooate420()
if it is rgb, then use
converttoyuy2().reinterpolate420()
got it now? :devil:
MGRip
28th September 2004, 19:04
Thanks for spending the time on me, I highly appreciate your help :)
This script very helped me :D
Wilbert
29th September 2004, 10:53
@scharfis,
if it is yv12, use converttoyuy2(interlaced=true), but do NOT use reinterpolate420()
You can do that, but it might be better to use 1/2-1/2 upsampling instead of the 3/4-1/4. I will change my plugin so that you can compare it.
About PAL DV YV12:
PAL always merges two chroma lines together within the PAL-Decoder for better chroma stability -> similar to interlaced YV12
The advantage is that PAL DV doesn't have this weird chroma placement. It occured to me that this implies that the conversion YV12->YUY2->YV12 (interlaced stuff) is lossless (which is not the case for mpeg1/mpeg2 4:2:0 as we all know).
smok3
29th September 2004, 12:48
i wonder what kind of colormagic stuff does the new experimental vdub (1.6.0) - with internal dv decoder?:
http://somestuff.org/images/galleries/site/dv_compare.png
(note:this is not exactly the same frame, maybe it is not visible on this snapshot, but the internal vdub decoder produces much nicer pic)
edit2: another comparision:
http://somestuff.org/images/galleries/site/dv_compare_vdub_vs_le.png
edit3: i just noticed, the vdub pixels in this 2nd example are 1:1 while liquid uses pal ar, but that does not affect chroma jaggies.
edit1: this is pal.
--------------------------------
scharfis_brain: actually i dont do chroma key very often, so i dont have any cool material to try at hand right now.
KF
12th October 2004, 13:23
I've a DV500 analog and DV firewire card. I've noticed the same artefacts and avisource(...).info() reports rgb32 and Pinnacle DV...
for the codec information. My source is PAL interlaced. I tend to edit in Premiere with a final target being a DVD.
What's the final conclusion from your thread? Should I use Wilbert's plugin or scharfis_brain's function? Which is faster and which one keeps all of the original data intact? Is ffdshow a better approach to decompressing? How good is it in terms of quality? I'm sorry if you think I should have gathered all this info from the thread, but I just need some kind of finalising statement to say what the best final method should be.:confused:
TIA
Wilbert
12th October 2004, 13:51
Should I use Wilbert's plugin or scharfis_brain's function?
I principle you can use both. But, scharfis said his one gives more pleasing results:
my method using edge directed interpolation using tomsmocomp (tdeint(mode=1) should work, too) has a better chroma definition on diagonales.
Which is faster?
Why don't you test this for us?
which one keeps all of the original data intact?
Both.
Is ffdshow a better approach to decompressing? How good is it in terms of quality?
Nope. The idea with ffdshow was that you could let it deliver YV12. You shouldn't do that in case of NTSC (cause DV 4:1:1 is not supported in AviSynth). For PAL, we should change ConvertToYUY2, because DV-YV12 is different as MPEG2-YV12 (the one AviSynth uses). I guess I can add that in my plugin.
So, no benefits if you use ffdshow.
KF
12th October 2004, 20:01
Wilbert, this was just a quick test
scripts used:
Wilbert's
=========
loadplugin("C:\Program Files\AviSynth 2.5\plugins\ReInterpolate420.dll")
avisource("myfile.avi").info()
ConvertToYUY2()
ReInterpolate420(interlaced=true)
Scharfis_Brain's
================
function reinterpolate420(clip x)
{
u=x.utoy()
v=x.vtoy()
u=u.separatefields().separatefields().selectevery(4,1,2).tomsmocomp(1,-1,0).assumefieldbased().weave()
v=v.separatefields().separatefields().selectevery(4,1,2).tomsmocomp(1,-1,0).assumefieldbased().weave()
ytouv(u,v,x)
}
loadplugin("C:\Program Files\AviSynth 2.5\plugins\tomsmocomp.dll")
avisource("myfile.avi").info()
ConvertToYUY2()
reinterpolate420()
************************************************
time take by cce 2.67
time taken: 1:59:36 scharfis_brain
time taken: 1:53:43 wilbert
Original File size 96,503,820 bytes
Attached zipfile contains snapshots of the same frame.
Strange observations if you examine the yellow text.
Scharfis_Brain's method causes the colour of the text to be less by one pixel whilst Wilbert's method causes the colour to extend out of the text boundaries by one pixel.
I've had to crop the images in order to meet the upload file size restrictions.
But the portion shows what I mean.
scharfis_brain
12th October 2004, 20:07
the att. does not work
KF
12th October 2004, 20:16
Having problems uploading zip file. When I edit the post it shows the attached file but I can't see any link:confused:
Wilbert
12th October 2004, 20:19
Attachments work again. But bb has to approve them.
KF
13th October 2004, 18:43
As I can't see my attachment yet, I've managed to upload the full snapshots here.
http://www.raikmo.demon.co.uk/scharfis_brain.bmp
http://www.raikmo.demon.co.uk/wilbert.bmp
If you zoom 300% in photoshop and examine the yellow text you'll know what I meant in my earlier post.
Scharfis method produces chroma that doesn't fill the full text characters, i.e. less by 1 pixel. Whilst Wilbert's method produces bleeding by 1 pixel.
scharfis_brain
13th October 2004, 19:09
Do NOT use the overlaid text as reference!
it is created using common chroma sampling, but DV uses another kind of chroma sampling!
wilberts method seems to has the correct chroma - placing, while my method seems to introduce a chroma upshift.
I'll try to correct this.
KF
14th October 2004, 09:21
Thanks Scharfis!:)
KF
14th October 2004, 13:48
Since the Pinnacle DV codec produces only RGB output is there any mileage in installing one of the other codecs, such as MainConcept's DV codec? Bearing in mind that I need to edit the avi files in Premiere prior to encoding in MPEG2.
KF
18th October 2004, 15:13
Are the Mainconcept's codec or Canopus's codec better in terms of quality and speed of rendering, compared to Pinnacle's DV codec?
abraxxa
25th November 2004, 00:38
I tried your plugin Wilbert but it doesn't really help.
The video looks like pixel-doubled after inserting 'ConvertToYUY2(interlaced=true)' (what is needed because DirectShowSource gives me YV12).
The source is PAL DV interlaced BUT edited with Adobe Premiere by a friend (who isn't very experienced with video codecs...).
This is my avisynth script:
loadplugin("C:\Programme\AviSynth 2.5\plugins\kerneldeint140.dll")
DirectShowSource("E:\DVDRIP\TSC_DVD_#1\gtech3-raw-big.avi")
ConvertToYUY2(interlaced=true)
#ReInterpolate420(interlaced=true)
KernelDeint(order=0,threshold=6,sharp=true,map=false
Any suggestions?
I search the whole doom9 forum and tried out different things for hours but I just don't get the quality of your screenshots :(
Wilbert
25th November 2004, 21:50
You shouldn't load it via ffdshow. The problem is that DV-YV12 and MPEG2-YV12 is sampled differently. This implies that the conversions DV-YV12 -> YUY2 and MPEG2-YV12 -> YUY2 (the latter is what avs does) should be done differently.
I will add 'DV-YV12 -> YUY2' one day to my filter, but don't have time now.
Bottom line, load your dv with avisource :)
abraxxa
25th November 2004, 23:47
THANKS!
I knew that there is a difference but not which and i thought that 'eliminate chroma jaggyness of PAL-DV' is related to PAL-DV cam footage.
I used DirectShowSource() cause i have no vfw codec for AviSource() and DirectShowSource().info() shows me that its YV12 so I thought its ok.
I installed Sony DV codec 2.23 which outputs RGB24.
Quality is still bad :(
Now I found out that I have Canopus DV codec installed. (i don't know the version, it's the one shipped with Procoder 2.0).
But quality is still bad :(
Mainly the edges have a 'rainbow' effect :confused:
loadplugin("E:\Install\Video\AviSynth\ReInterpolate420\Release\ReInterpolate420.dll")
loadplugin("E:\Install\Video\AviSynth\KernelDeint_1.5.2\kerneldeint.dll")
AviSource("E:\DVDRIP\TSC_DVD_#1\gtech3-raw-big.avi", true, "YUY2", fourCC="CDVC").info()
#ConvertToYUY2(interlaced=true)
ReInterpolate420(interlaced=true)
#KernelDeint(order=0,threshold=6,sharp=true,map=false)
It also seems that ReInterpolate420 doesn't do/change anything...
What are I'm missing? :confused:
Wilbert
26th November 2004, 13:00
Could you upload a small clip (of about 25 frames)?
abraxxa
26th November 2004, 15:35
No problem!
25 frames snip (http://abraxxa.zorro.at/temp/gtech3_snip.avi)
You can see the effect on the edge of the roof of the halls in the background.
Is this a deinterlacing problem OR a choma problem?
Try it with this avisynth script:
loadplugin("c:\Install\Video\AviSynth\KernelDeint_1.5.2\kerneldeint.dll")
AviSource("c:\temp\gtech3_snip.avi", false, "YUY2", fourCC="CDVC")
KernelDeint(order=0,threshold=5,sharp=true,map=false)
I tried also with order=1 but that doesn't help either...
abraxxa
8th December 2004, 21:12
*bump*
Had you time to look into my problem Wilbert?
Wilbert
8th December 2004, 23:52
Sorry, I forgot about it :) I will look at it tomorrow.
abraxxa
9th December 2004, 00:44
Thanks! ;)
henryho_hk
11th December 2004, 14:12
I have a Sony DSR-PD150P (PAL edition) and the Canopus playback-only codec installed. I want to rip the DV on the tape using WinDV, mark the avi as cdvc and then convert it to XviD.
I suppose I should do the following, right?
avisource("input.avi",pixel_type="YUY2",audio=true)
FixBrokenChromaUpsampling()
ReInterpolate420(interlaced=true)
ConvertToYV12(interlaced=true)
kerneldeint(order=0,sharp=true)
removegrain(mode=2)
Or should I remove "ReInterpolate420()" for the reason that I will convert it to YV12 later?
scharfis_brain
11th December 2004, 14:22
@abraxxa: I found nothing special with your clip.
The stairstepping is a very normal thing with interlacing.
Either use tdeint(mode=1, tryweave=false) instead of kernelbob() or start experimenting with mvbob()...
@henryho_hk: what do you intend to gain by the usage of:
ReInterpolate420(interlaced=true)
ConvertToYV12(interlaced=true)
your YV12 chroma will only be blurred unnesesary.
if you need YV12 out of an DV-AVI, open it via directshowsource() and enable ffdshow as DV-Decoder.
it will give you much better chroma...
henryho_hk
11th December 2004, 15:40
Originally posted by scharfis_brain
if you need YV12 out of an DV-AVI, open it via directshowsource() and enable ffdshow as DV-Decoder. it will give you much better chroma...
I see. Does it mean that the YV12 output of the ffdshow decoder is free of these chroma glitches (even fixchromaupsampling)?
If I uninstall all other DV codecs, can I use the following instead of DirectshowSource?
AVISource("input.avi",audio=true,pixel_type="YV12",fourcc="DSVD")
scharfis_brain
11th December 2004, 15:48
this won't work.
henryho_hk
11th December 2004, 15:58
Originally posted by scharfis_brain
this won't work.
Too bad.... DirectshowSource does not always work in my computer, esp. on those big DV dumps.
scharfis_brain
11th December 2004, 16:14
maybe this function:
function reducetoyv12(clip x)
{
u=x.utoy().separatefields().separatefields().selecteven().converttoyv12().weave()
v=x.vtoy().separatefields().separatefields().selecteven().converttoyv12().weave()
x=x.converttoyv12()
ytouv(u,v)
x.mergechroma(last)
}
avisource("dv.avi")
reducetoyv12()
kerneldeint(order=0,sharp=true)
removegrain(mode=2)
is good for your purposes.
the funmction reducetoyv12 reduces the YUY2 chroma to YV12 chroma using pointsampling insted of weighted blending, like converttoyv12(interlaced=true) would do.
Wilbert
11th December 2004, 16:53
if you need YV12 out of an DV-AVI, open it via directshowsource() and enable ffdshow as DV-Decoder. it will give you much better chroma...
Nope, it won't. Like I said several times in this thread, DV-YV12 (pal) and MPEG2-YV12 are sampled differently. If you import it using DirectShowSource, and you either convert to another color format, or you just leave it as YV12 (and play it after encoding), your chroma will be messed up.
scharfis_brain
11th December 2004, 18:25
I found out, that U and V of DV-YV12 seems to be stored as normal YV12 ?!?
at least, the processing as normal YV12 won't suffer from chroma misalignement in my tests..
Wilbert
11th December 2004, 22:50
I found out, that U and V of DV-YV12 seems to be stored as normal YV12 ?!?
The storage is the same (Y plane, V plane followed by U plane), but the sampling is different. You posted a link in the first thread, so you should know :)
YUY2 layout:
frame:
YC Y YC Y line 1
YC Y YC Y line 2
YC Y YC Y line 3
YC Y YC Y line 4
MPEG-2
YUY2 -> YV12 (interlaced subsampling)
frame:
Y_Y_Y_Y line 1t
C___C__ chroma of YUY2_lines (0.75)*1t + (0.25)*3t
Y_Y_Y_Y line 2b
Y_Y_Y_Y line 3t
C___C__ chroma of YUY2_lines (0.25)*2b + (0.75)*4b
Y_Y_Y_Y line 4b
DV-PAL
YUY2 -> YV12 (interlaced subsampling)
It think it's just point-sampled (ie chroma removed):
frame:
YV1_Y_YV1_Y line 1t; V of YUY2_line 1t
YV2_Y_YV2_Y line 2b; V of YUY2_line 2b
YU3_Y_YU3_Y line 3t; U of YUY2_line 3t
YU4_Y_YU4_Y line 4b; U of YUY2_line 4b
YV5_Y_YV5_Y line 5t; V of YUY2_line 5t
YV6_Y_YV6_Y line 6b; V of YUY2_line 6b
I'm not sure, if have to look that up.
Suppose you upsample that using ConvertToYUY2(interlaced=true) (thus MPEG-2) sampling. What happens?
Consider line 5t. The chroma will be recreated as
chroma of YV12_lines (0.25)*1t + (0.75)*5t
Thus V5 = (0.25)*V1 + (0.75)*V5 and U5 = (0.25)*U3 + (0.75)*U7.
While it should be
Thus V5 = V5 and U5 = (0.5)*U3 + (0.5)*U7. I think ...
see http://www.avisynth.org/Sampling
scharfis_brain
11th December 2004, 23:31
Hey Wilbert. It is not, that I don't know about this sampling stuff
(After I learned a lot while being in this forums :) )
but it seems, that reality and theory differ (like the 1.066 and 1.094 PAR for the PAL-Stuff)
after examining some videos (two different cams),
I think that the chroma is sampled like conventional YV12.
Knows the devil why.
If you own an DV-Cam (I do not. I am only the person, who processes the videos...)
You may print out an image containing pure blue background with pure red diagonal objects on it (lines, blocks or circles). then you make a short still standing video of this (well lightened) picture.
This would be IMO the only possibility to check, whether the Cameras follow the standard or not.
Natural video is not that suited for checking for half pel chroma displacements, I think.
So I came to that (probably wrong) conclusion that DV Cams are building conventional YV12.
I also want to mention, that the canopus DV-Codec samples a RGB-Input with standard YV12.
Also its point-upsampling is in the grid of standard YV12.
Which (the point upsampling) is NOT a bad thing, after doing some tests!
Most MPEG-2 Encoders need RGB (TMPGenc) or YUY2 (CCE etc..) input, which gets downsampled to YV12 again by averaging nearby pixels (not 100% correct, I know...).
With IDENTICAL nearby pixels like it is the case with point-upsamples DV, the chroma won't bleed.
but if the DV-decoder would to a proper visual (with averaging) upsampling to YUY2 and the encoder the downsampling to YUY2 the chroma is bleeded like hell....
reinterpolate420() is only needed, if heaviy image manipulation (destroying pixel structure) is wished (deshaking, resizing...)
for linear editing it is completely obsolete, IMO.
when I need to deinterlace the stuff, I am currently not 100% sure, whether I shall use
reducetoyv12().YV12deinterlacer()
(gives lowest chroma manipulation as possible!)
or
reinterpolate420().YUY2deinterlacer()
(chroma-artifacts of the deinterlacer are not that visible, chrom is slightly bleeded)
Wilbert, what do you think?
abraxxa
12th December 2004, 02:50
@Wilbert: What deinterlaced did you use for the posted pictures in this thread? I just don't get those stair-steps away...
henryho_hk
12th December 2004, 07:04
Originally posted by scharfis_brain
maybe this function:
avisource("dv.avi")
reducetoyv12()
kerneldeint(order=0,sharp=true)
removegrain(mode=2)
is good for your purposes.
Thank you. As I will be using the Canopus codec, should I put
"FixBrokenChromaUpsampling()" back? Or is it unnecessary because of the YV12 point-sampling?
In addition, does "FixBrokenChromaUpsampling()" work for both NTSC and PAL DV?
scharfis_brain
12th December 2004, 07:54
no! you should have read the AVISynth documentation.
FixBrokenChromaUpsampling() will correct a progressively upsampled to interlaced upsampling. But that is NOT the case with the canopus decoder. it upsamples correctly in relation with interlacing.
henryho_hk
12th December 2004, 10:28
Originally posted by scharfis_brain
But that is NOT the case with the canopus decoder. it upsamples correctly in relation with interlacing.
I am referring to ScrollLock's sticky thread DV decoder differences (http://forum.doom9.org/showthread.php?s=&threadid=33526).
From your advice, as my target is YV12 (MPEG1 or WMV actually), I think I should either:
1) grab the YVY2 output of Canopus and then point-sample (reducetoyv12) it to YV12; or
2) try the YV12 output of ffdshow's VFW module.
I am particularly interested if ffdshow will deliver both PAL and NTSC outputs correctly.
scharfis_brain
12th December 2004, 14:56
if your chroma look coarse interlaced instead of being fine combed, you will need fixbrokenchromaupsampling().
otherwise you won't need it.
my canopus decoder is working correctly!
PAL can be used with ffdshow's YV12 output.
but for NTSC it is a mess, cause it puts out the 4:1:1 samples chroma as YV12 data, which is handled by AVISynth as 4:2:0 sampled chroma.
Just use normal NTSC-DV decoding as it is.
maybe use reinterpolate411() afterwards.
you will not gain anything by working with YV12 output here.
Wilbert
12th December 2004, 15:54
@scharfis_brain
Natural video is not that suited for checking for half pel chroma displacements, I think.
So I came to that (probably wrong) conclusion that DV Cams are building conventional YV12.
I disagree. But, perhaps it differs by DV codec. Let's consider MainConcept, and look at the following script
function translation(clip clip, clip "LClip", int "start_frame", int "beginX", int "beginY", int "end_frame",
\ int "endX", int "endY") {
return Animate(start_frame, end_frame, "layer", clip, LClip, "Add", 255, beginX, beginY,
\ clip, LClip, "Add", 255, endX, endY)
}
c = BlankClip(width=720,height=576,pixel_type="YUY2")
c2 = ImageSource("F:\411_vs_420\1-720-pal.bmp",0,250,25,false).ConvertToYUY2()
ct = translation(c, c2, 0, 0, 0, 99, 720, 288)
cf = ct.SeparateFields.SelectEven
cf.Weave
AssumeFPS(25)
c1 = last.KillAudio
c2 = DirectShowSource("F:\411_vs_420\mc_int.avi", fps=25) # interlaced YV12
#ConvertToYUY2(interlaced=true)
c1 = c1.ConvertToYV12(interlaced=true)
#Subtract(c1,c2)
StackVertical(c1,c2)
1) picture: http://www.geocities.com/wilbertdijkhof/pal.zip
2) mc_int.avi is the script (forming the clip "c1") encoded with MainConcept (also in pal.zip).
If mc_int.avi would have been upsampled to YV12 using MPEG-2 sampling, the clips c1 and c2 would be identical. As you can see, they are not.
ixpi2001
13th December 2004, 17:59
sorry to intefere in your discussion.. i wonder if there is a possibility to only display one of the color channels a time. not in interpolated fullscreened size, but with ie the red pixels in just the position they are stored:
l1:x x x
l2: blank
l3:x x x
would be interesting to see, dont you think?
henryho_hk
14th December 2004, 01:07
Originally posted by ixpi2001
i wonder if there is a possibility to only display one of the color channels a time.
I have a shot that a man in a grey suit is moving in front of a red background. I think it help beginners like me to see how interpolate420() and fixbrokenchromaupsampling() works.
Is the following script correct?
<<deleted>>
Video Dude
23rd June 2005, 19:57
Sorry for the late reply, but better late then never.
Its not a question of which better, but which format you use, PAL or NTSC, which depends on what county you live in.
Yes, I would recommend using the ReInterpolate411 filter if you are encoding NTSC DV into MPEG-2. It does a great job.
FredThompson
27th August 2005, 17:24
I have a shot that a man in a grey suit is moving in front of a red background. I think it help beginners like me to see how interpolate420() and fixbrokenchromaupsampling() works.Post your screenshots.
Wilbert
6th September 2005, 11:17
Still waiting for your screenshots :)
edit: oops sorry :)
# ffdshow
m_dvsd_yuy2=avisource("p3.avi",pixel_type="YUY2",fourcc="dvsd")
m_dvsd_yv12=avisource("p3.avi",pixel_type="YV12",fourcc="dvsd")
This can't be the DV codec which comes with ffdshow. The latter is a DirectShow based codec which can only be accessed by DirectShowSource. But perhaps i'm missing something :)
henryho_hk
6th September 2005, 12:57
This can't be the DV codec which comes with ffdshow. The latter is a DirectShow based codec which can only be accessed by DirectShowSource.
There is no vidc.dvsd setting in my registry but I've enabled ffdshow's DV decoding in its VFW & DS decoder. I do have a set of png files made by directshowsource but the forum does not allow me to post them (since they are identical to the dvsd vfw files).
FredThompson
6th September 2005, 17:23
You might also want to test the MainConcept and Ulead (Sony) codecs.
henryho_hk
8th September 2005, 07:05
Still waiting for your screenshots :)
They seem a bit off-topic. I have moved them to the thread "DV decoder differences - update". ;)
Fizick
21st July 2006, 23:44
I updated ReInterpolate420 plugin a little:
v3, 22 July 2006 -
color tint decreasing in progressive mode;
speed increasing in both modes by integer processing
romangal
21st June 2021, 17:03
So, now i m trying to use Canopus Dv codec 4.60 from Grass Valley Codec Option package. And im confused about necessary of using Reinterpolate420. Because last testing was done for Canopus DV 1.0.0.0. I made testing by myself with last canopus version but cant understand if its needed...sorry.
P.S. So for now i see. With new version of canopud DV (4.60) You dont need to use FixBrokenChromaUpsampling, but its preferable to use Reinterpolate420. Correct me please if i made wrong conclusion.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.