Log in

View Full Version : Colour space conversion+fields


OUTPinged_
11th May 2003, 20:29
It all begun when i wanted to apply field-based CNR to a clip in avs 2.5. I was outputting it to CCE so the script looked like this:

SegmentedAVISource("c:\cap.avi").resampleaudio(44100).ConvertToYV12()

SeparateFields()
CNR2()
Weave()

ConvertToYUY2()



Now it looks like fields are weaved incorrectly(one field is delayed and it gets bumped up 1 pixel). Alright, that was expected. But even if i change script to look like that:

SeparateFields()
ConvertToYV12()
CNR2()
ConvertToYUY2()
Weave()

It still comes out broken. Of course, if i change it like that, it works:

ConvertToRGB24()
SeparateFields()
ConvertToYV12()
CNR2()
ConvertToRGB24()
Weave()
ConvertToYUY2()


Any ideas what is going on? Is it possible to apply a filter to a SeparateFields() chain in YV12 color space?

sh0dan
11th May 2003, 20:41
I dont have interlaced material to test on here, but one things I spotted:
SegmentedAVISource("c:\cap.avi").resampleaudio(44100).ConvertToYV12()

should probably be:

SegmentedAVISource("c:\cap.avi").resampleaudio(44100).ConvertToYV12(interlaced=true)

(assuming your source is interlaced).

Another thing is, that AFAIR CNR2 works ok on interlaced material - I might be wrong though.

OUTPinged_
11th May 2003, 21:23
1. "interlaced" flag solves problems.

2. clips, made with applying CNR to frames and fields, dont match, and i liked later one more - VHS noise was field-based.

Guest
12th May 2003, 02:50
It should be OK as long as the YV12 chroma sampling is interlaced. Applying SeparateFields() to progressive sampled YV12 mangles the chroma assignments. They are restored if you Weave() right away, but if you try to filter on the mangled representation you get into trouble. This is the technical reason why sh0dan is correct that you need the interlaced=true on your chroma downsampling.

CNR2 supports YUY2. You should use it in that color space for best results.

CNR2 does not support interlaced material directly.