PDA

View Full Version : Help me recover a brutalized HD tape transfer


Blue_MiSfit
15th January 2009, 21:37
Hey guys,

I've got a nasty source today, looks like it was point-resized at some point because it's got heavy aliasing throughout.

For the record, it's YUY2 MPEG-2, @ 30mbps CBR.

I can't get it perfectly nailed down.

Here's the sample:
http://www.mediafire.com/?sharekey=a39a60e9a5a71ac1d2db6fb9a8902bda

I initially tried a brutal

reduceby2.spline36resize(1920,1080)


That fixed the aliasing, but also killed too much detail, obviously!

Then, I noticed it's mostly horizontal, so I tried

horizontalreduceby2.spline36resize(1920,1080)


That looks quite a bit better, but I still see remnants of some aliasing. Replacing spline36 with turnright.nnedi.turnleft didn't make any difference.

Any ideas??

Thanks!

~MiSfit

Nightshiver
15th January 2009, 22:23
Try using the different aa= functions of animeivtc. I'm only suggesting this because I know that it has 4 different ways of doing aa, so one of them might actually do what you want.

Blue_MiSfit
15th January 2009, 22:51
Interesting idea, but can you use AnimeIVTC without actually performing an IVTC? :)

The source is true 24p.

~MiSfit

Nightshiver
16th January 2009, 00:25
Yes. You can call the functions seperately:

aa=1 >>> eedi2aa()
aa=2 >>> daa()
aa=3 >>> maa()
aa=4 >>> SharpAAMCmod()

It's all in the docs if you read them...

Blue_MiSfit
16th January 2009, 00:33
Fair enough ;)

*.mp4 guy
16th January 2009, 03:17
After the 40YOV you had me worried, but nothing unfixable was done to this.

On the sample you gave me, this fixes everything.
mt_convolution(horizontal= " 0.353677651315323 0 -0.454728408833987 0 0.636619772367581 0 -1.06103295394597 0 3.18309886183791 5.00000000000000 3.18309886183791 0 -1.06103295394597 0 0.636619772367581 0 -0.454728408833987 0 0.353677651315323 ", vertical= " 0.353677651315323 0 -0.454728408833987 0 0.636619772367581 0 -1.06103295394597 0 3.18309886183791 5.00000000000000 3.18309886183791 0 -1.06103295394597 0 0.636619772367581 0 -0.454728408833987 0 0.353677651315323 ", u=3, v=3)
I would post a screenshot, but my internet is slow, and I'm lazy.
[edit] changed u=2, v=2 to u=3, v=3 to be safe
[edit2] changed vertical convolution to remove very low level residual vertical aliasing, sharpness apears almost entirely unharmed

Blue_MiSfit
16th January 2009, 03:41
*.mp4guy:

How did you decide to use MT_Convolution to fix the issue? Also, what do these coefficients represent?

~MiSfit

*.mp4 guy
16th January 2009, 03:56
The numbers represent a fairly high quality lowpass filter. I chose to use a lowpass filter because the aliasing was isolated to the upper frequency bands, and thus removing the upper frequency bands would remove the aliasing. The horizontal aliasing is almost completely consistent with a 2x enlargment by pixel duplication (but its a little off) the vertical aliasing is consistent with 2x enlargement via a low tap linear filter (bicubic, etc.), though it is dificult to be certain. Subsampling the picture then reinterpolating would unavoidably introduce either extra blurring or aliasing, and may even loose additional detail this is because the aliasing is not the result of a simple 2X pixel duplication enlargement, so using a FIR lowpass filter via mt_convolution made the most sense.

Blue_MiSfit
16th January 2009, 05:41
Interesting! this is the stuff I don't quite understand yet :)

How did you determine the aliasing was isolated to upper frequency bands?

~MiSfit

*.mp4 guy
16th January 2009, 06:43
To a certain degree, lowpass filter and interpolators are the same thing. If you have aliasing that looks similar to pointresize(width*2, height*2), then its a good bet that all of the aliasing is in the upper "half" of the frequencies of the image, because that is where they would be after the aformentioned pointresize call. generaly speaking the "smaller" (not in intensity, but in spatial size) a feature is, the higher frequency it is, some aliasing can be spread all over the frequency spectrum, and the pattern of such aliasing will take up a much larger spatial footprint before repeating then higher frequency aliasing would.


so, if you had aliasing that looked like small blocks, as in your example, that is semi high frequency aliasing, if you had really big pixels/blocks, like when things are censored on television, that would be relatively low frequency aliasing, and you would have to lowpass away most of the image to remove it. if you have unpredictable "nonlinear" aliasing, such as that caused by pointresizing by a non-integer factor, this can pollute the entire frequency spectrum, and FIR filters will no longer be usefull. Essentially the entire image would have to be lowpassed away, which would remove a large amount of actual image data, unlike if you have aliasing such as that largely present in your source, where the aliasing is in a range of the frequency spectrum where there is actually no image data whatsoever, and thus removing said range is an almost perfect solution.

When aliasing has been introduced by interpolating an image to a larger size, assuming the interpolator is functioning normally, all of the aliasing will be in upper frequency ranges unused by the image, because it was introduced when data was invented to fill those frequency ranges (or the spatial equivelent, it was introduced when pixels were duplicated to fill up the empty spaces between pixels created when enlarging the image).

Blue_MiSfit
16th January 2009, 07:07
Quite informative!

I'll try your example at work tomorrow and see how it looks.

Thanks so much for taking the time to spell it all out :)

~MiSfit

hanfrunz
16th January 2009, 10:04
Does anybody knows if there is a good tool to create/calculate FIR-coefficients for video, maybe with live preview and some nice sliders and spectrum-analyse-tools etc.?

Comatose
16th January 2009, 10:52
Very interesting and impressive :P
Thanks for sharing, *.mp4 guy

Blue_MiSfit
16th January 2009, 20:40
Wowsers! Thanks *.MP4guy!

I took a look today at work, and was very impressed by the total annhilation of aliasing, while maintaining fine texture detail much better than simply killing half the horizontal resolution. The re-encodes I make will look much better than what I currently have on the service!!

Thanks!!!

~MiSfit

Blue_MiSfit
16th January 2009, 22:04
I figured I'd post a couple screenshots for any interested parties:

Forgive the JPGs.. imageshack and 1080p PNGs is a no-go.. The actual fixed version has a bit more fine grain.

The source:
http://img186.imageshack.us/my.php?image=sourcezv8.jpg

The fixed version:
http://img223.imageshack.us/my.php?image=fixedyh7.jpg

Here's the script I used:

mt_convolution(horizontal= " 0.353677651315323 0 -0.454728408833987 0 0.636619772367581 0 -1.06103295394597 0 3.18309886183791 5.00000000000000 3.18309886183791 0 -1.06103295394597 0 0.636619772367581 0 -0.454728408833987 0 0.353677651315323 ", vertical= " 0.353677651315323 0 -0.454728408833987 0 0.636619772367581 0 -1.06103295394597 0 3.18309886183791 5.00000000000000 3.18309886183791 0 -1.06103295394597 0 0.636619772367581 0 -0.454728408833987 0 0.353677651315323 ", u=3, v=3)
fft3dgpu(plane=4, sigma=1, sigma2=2, sigma3=2, sigma4=1)
seesaw
gradfunkmirror(1.51)
grainfactory3(g1str=7, g2str=7, g3str=15)


Stoked!!

~MiSfit

mikeytown2
16th January 2009, 23:09
:eek: wow thats quite good

Comatose
17th January 2009, 04:53
One thing I noticed is the mt_convolution line causes some discoloring (as a result of the luma change).
Look at black shirts.

*.mp4 guy
17th January 2009, 07:30
Its a bug in mt convolution, it does that when fed float values, if you use mergechroma to replace its chroma (even when mt convolution is set to not process chroma), it should fix the problem. For some reason, It didn't look like an issue to me on this video, but I guess I was wrong.

thetoof
17th January 2009, 07:41
Does anybody knows if there is a good tool to create/calculate FIR-coefficients for video, maybe with live preview and some nice sliders and spectrum-analyse-tools etc.?
Request #2

It would be great to have a how-to-mt_convolution. Or at least references to some material since mt_masktools' guide is not that helpful for newbies.

*.mp4 guy
17th January 2009, 08:25
This (http://www.cellsoft.de/windows/winfirsupport.htm) is the program I used. I have posted links to it before on doom9. I have tried to explain FIR filters before, there are a lot of ways to model and explain them, and I don't think I did a very good job. just google them, and look around for informative sites, I can't remeber any off the top of my head.

The bottum line is that the easiest way to understand them is to just experiment with different combinations until you have a feel for what does what.

thetoof
17th January 2009, 08:52
Thanks. Hopefully all this'll get into my head one day :p

Comatose
17th January 2009, 16:32
Its a bug in mt convolution, it does that when fed float values, if you use mergechroma to replace its chroma (even when mt convolution is set to not process chroma), it should fix the problem. For some reason, It didn't look like an issue to me on this video, but I guess I was wrong.
Oh, I thought the luma was a bit brighter/darker in some areas, I should probably check more carefully next time :P

scharfis_brain
18th January 2009, 01:09
input=mpeg2source("F:\forum\Blue_MiSfit\ShineALight_2008_178.demuxed.d2v")

input
turnleft()
nnedi(field=-2)
e=selecteven() #.converttorgb24(matrix="PC.601").crop(0,1,0,0).addborders(0,0,0,1).converttoyuy2(matrix="PC.601")
o=selectodd()

o
#merge(e,o)

turnright()
mergechroma(input)

it is 960x1080.
so after turnleft() and separatefields() one gets two identical images.
both can bee nnedi'd back to full size in order to completely remove the stairstepping without blurring the image at all.

the script above only uses the 'odd' vertical lines to interpolate the full image back.
if you want to use the even AND odd lines to suppress noise a bit, just uncomment the stuff I commented out.

Mug Funky
20th January 2009, 03:59
does the colour shift happen with int values? cause you could always just multiple each value by 256 and truncate... the output may not even be any different in precision.

i'd like to know the provenance of this clip - what it was shot on, what it was mastered to, what it came to you as... some of the "not quite point sampled" appearance may be due to HDCAM whackness with it's 1440 at 3:1:1 horizontal sampling, then upping to 1920 @ 4:2:2 with sharpening on playback.

*.mp4 guy
20th January 2009, 05:11
The aliasing extended well below the 1440 horizontal resolution.

Yes, I could do something similar to what you said, but it would be fairly time consuming, and chroma does fine with more mediocre treatment.

Blue_MiSfit
20th January 2009, 05:23
The source was delivered to me as-is.

I don't know the original source, it's anyone's guess :)

The content is Shine a Light, the Martin Scorcesse documentary about the Rolling Stones concert.

I haven't seen the BluRay disc, but this is directly from Paramount via an encoding house (Ascent?)

~MiSfit

R3Z
20th January 2009, 05:53
Amazing *.mp4 guy :) That script is very impressive. I have used FIR filters before in crude attempts to remove analogue hiss (audio not video). It didnt occur to me that they could be used on videos, though lets be honest a lot doesnt occur to me haha :D

Wilbert
23rd January 2009, 23:25
This is the program I used. I have posted links to it before on doom9. I have tried to explain FIR filters before, there are a lot of ways to model and explain them, and I don't think I did a very good job. just google them, and look around for informative sites, I can't remeber any off the top of my head.

The bottum line is that the easiest way to understand them is to just experiment with different combinations until you have a feel for what does what.
Which filter/settings did you choose to get your fir numbers?

*.mp4 guy
24th January 2009, 22:13
It's a windowed FIR filter.

lowpass
19 tap
rectanglular window
cut-off frequency (in hertz relative to the reolution independant nyquist limit, which is 0.5 hz) 0.25

Its a windowed FIR because they are quick and easy to make.

Its 19 taps because imo, 19 taps works well on video for relatively sharp cut-off filters, such as the rectangular windowed one used here.

Its a rectangular window because it has the sharpest cut-off transition of any windowed FIR filter (though also the most ringing)

The cut off frequency was chosen after I had tried less agressive lowpass filters, which failed to remove all of the aliasing, the cut-off frequency used also matches what would be used for a 2x enlargement of each image dimension.

I also wrote (with quite a bit of help) an 8 band (functionally 6) frequency adjuster (http://forum.doom9.org/showthread.php?t=141547) that can perform as a relatively fast, easily adjustable low tap FIR filter.

Its much quicker and easier to use then writing a FIR filter, though its functionality is limited.

Comatose
10th February 2009, 18:37
Hum, I just looked at this again and I really don't see much difference between the convolution and lanczosresize to 1024x576 then back up, all with taps=10.
mpeg2source()
interleave(last,lanczosresize(1024,576,taps=10).lanczosresize(1920,1080,taps=10),MergeLuma(mt_convolution(...)))

There is a little detail loss at frame 21 on the guitar facing the camera, but not really. I think overall it looks better, and the detail loss is not serious - nothing you can't fix with some sharpening.

McCauley
14th March 2009, 06:11
Hi,

i think i have a problem similar (though not as severe) to the one from Blue_Misfit. It is a HDDVD i want to back up to the target resolution of 1280x720. Obviously i would like to keep as much detail as possible.

SAMPLE (http://www.mediafire.com/?sharekey=eaafa805e8f484d1931c7453395df0250df44dbf432b0461c95965eaa7bc68bc)

I tried the mt_convolution(...) from *.mp4 guy, the NNEDI approach from sharfis_brain (with turnright->turnleft) and something i just found here. (http://forum.doom9.org/showthread.php?p=1261263#post1261263)
BilinearResize(1280, 1080) #also 1920,720
Spline16Resize(1280, 720) #and 1280,720Everything with and without (re-)sharpening through LSFmod().

Does someone recognize what kind of problem my stream exactly has and how to fix it? I am a bit lost in all the possibilities.

Regards and thanks in advance
McCauley

Lyris
14th March 2009, 12:26
MP4 Guy: that is amazing! :eek:

I've seen HD DVD and BD releases (a lot of early Warner Home Video titles) that have this same problem. Does anyone know what's causing it? I'm shocked that it appears in masters.

McCauley
17th March 2009, 18:44
Does someone recognize what kind of problem my stream exactly has and how to fix it? I am a bit lost in all the possibilities. Anyone?

Regards and thanks in advance
McCauley

Blue_MiSfit
17th March 2009, 23:56
@McCauley -

I'd suggest posting a new thread :)

~MiSfit

McCauley
18th March 2009, 00:46
I'd suggest posting a new thread Wouldn't that violate Rule #8?
I didn't open a new thread, because i had/have the feeling that the problem i have is very similar to yours, but if i would know it exactly i wouldn't have to ask. :)

Regards
McCauley

Blue_MiSfit
18th March 2009, 09:13
Okay, I'll bite :)

Your sample looks similar to mine. On casual inspection it's fine, but when I look closer, severe horizontal aliasing is easily visible.

turnright.nnedi.turnleft seems to work very well (according to my eyes).

So, I'd do this:


spline36resize(1920,720)
turneight.nnedi.turnleft
spline36resize(1280,720)


You could also be really evil and do this:

HorizontalReduceBy2
Spline36Resize(1280,720)


It's much faster, but loses a lot more detail compared to gorgeous NNEDI :D

~Misfit

McCauley
18th March 2009, 19:26
Hi Blue_MiSfit,

thanks for you suggestion!
The first one works like a charm.

The second one, uhm...yeah... :D

Regards
McCauley

Blue_MiSfit
19th March 2009, 02:23
Hey, c'mon it's not *that* bad! :p

At least it gets rid of the aliasing! And it's very fast versus NNEDI

~MiSfit