Log in

View Full Version : Help with Babylon 5 scaling


Pages : [1] 2

Buck746
3rd August 2010, 05:30
I'm trying to get the best picture I can out of the dvd's for babylon 5. On any shots with cgi in them they have been poorly scaled from the original 4:3 broadcast masters. Seeing how I don't have the Laserdiscs for the show i'm trying to correct the problem with avisynth. I found a website here: http://www.modeemi.fi/~leopold/Babylon5/DVD/DVDTransfer.html#030421proof that demonstrates a form of correcting the problem. I have tried to figure out a way to do this in avisynth and have come up short handed so far.

I have tried searching the forums here with no luck. Maybe I just haven't used the right search terms. Thanks in advance for any help anyone can provide.

Guest
3rd August 2010, 13:12
Post a link to an unprocessed sample showing the problem.

*.mp4 guy
3rd August 2010, 13:17
Well, really fixing this isn't possible. What he did is a pretty simple linear filter of some kind, which corrects about half of the problem.

In avisynth it probably looks something like this:
In = assumeframebased()
odd = In.separatefields().selectodd.spline36resize(width, 360).pointresize(width, 180)
even = In.separatefields.selecteven.spline36resize(width, 360).pointresize(width, 180)
out = interleave(odd, even).weave().spline36resize(width, 480)
out

Though he probably did it with FIR's, which in avisynth would probably be slower.

You still have to figure out how to apply this to the correct parts of a frame. Or the correct frames, depending on how the compositing was done.

Also, linear filters cannot adequately correct for previous linear filters, to really fix this problem completely you would need a specialty strong nonlinear filter of some kind. Not that your going to get any more detail from this, but to kill the remaining artifacts without removing detail would require some sort of pseudo deconvolution.

Didée
3rd August 2010, 13:29
Is it really that complicated? Isn't it a rather simple case of misaligned fields, due to field separated resizing without correction?

Since I own the German R2 version, I can't reproduce the problem. The bad thing about R2 is that the CGI sections are ... fieldblended! :devil:

*.mp4 guy
3rd August 2010, 14:35
Is it really that complicated?
The complication is that if you have an improperly sampled signal (such as interlacing) linear filters do very poorly. A lot of the ugliness is from the signal leakage of the aliasing into other parts of the signal. If you look at the example he linked to, you can see some residual problems, and this is most likely the cause.

Isn't it a rather simple case of misaligned fields, due to field separated resizing without correction?
It probably is, but I didn't find the correct offsets when I took a few minutes to check. Offsets didn't appear to work aswell as pointresizing, so it could be a bit more complicated. Though its quite possible I just made a mistake looking for the offsets.

Buck746
4th August 2010, 00:27
To be honest i'm not shure how to post a sample video clip on here. On the R1 Dvd's every shot that had a visual effect suffers from the same problem. Even tho it means taking apart every episode to find all of these shots I don't mind the work, I just want the best I can get from the source material I have. I have been using TemporalDegrain to filter the film sections. The intent is to calm down the grain a bit, not remove it all together.

Guest
4th August 2010, 00:34
You want a complex solution to fix this issue, but you can't figure out how to post a sample.

That's rich.

Buck746
4th August 2010, 01:11
I'm just not sure what file hosting sites are out there. It's not something I do.

poisondeathray
4th August 2010, 01:20
I'm just not sure what file hosting sites are out there. It's not something I do.

free hosting sites
eg. mediafire.com , sendspace.com

you could cut a sample with dgindex, for example

Buck746
4th August 2010, 01:29
Assuming file hosting works correctly a sample should be at this address http://www.mediafire.com/?tcau3c8fgsouch4

I just haven't done a post like this before. Been using avisynth for years. I remember dvd ripping when it was done by running a program to take a screenshot from powerdvd for every frame, it was always a pain to get the audio to sync exactly. I realise some of the posters on here are a lot smarter with scripting than I am, that's why i'm asking for help. I don't post becuase every problem I have wanted a solution for has already been discussed here before. This is the first time I have come across something worth asking about.

I've tried finding a way to align the image correctly in photoshop but can't find a way of making it work as well as on the website I mentioned in the original post. Processing time isn't a big problem. Besides on a show like B5 there are a bunch of stock shots that get used so it's really just editing them into several episodes as they were in the original version.

Guest
4th August 2010, 02:59
You posted to ask about restoring the CGI portions:

"On any shots with cgi in them they have been poorly scaled from the original 4:3 broadcast masters."

So why, instead of posting such a CGI section, did you post a sample with no CGI and which appears to be simple, unproblematic hard telecine?

And does that disk really only have one audio track? Or did you get the source from somewhere other than the original disk?

Buck746
4th August 2010, 03:24
It was from the original R1 Disc. The scaling problem is present in every shot that had a digital matte and the pure cgi shots. I think it's becuase they scaled those shots from the 4:3 master tapes to 1080 to match the Telecine that Sci-Fi funded when they started airing the episodes so they could show them in widescreen. The 1080 masters that got made were then downscaled to NTSC and PAL for the dvd releases.

When the show was being made it was always assumed that re-rendering the effects would be easy when hdtv got hammered down in spec. Over time tho all the elements got lost so the only options were to scale the 4:3 material up and use new film scans of everything without some kind of composite or cgi work. The other option of course would be to do what paramount did with Star Trek and generate new effects to replace the old ones. Seeing how B5 is the red headed stepchild of warner brothers they went with the former option.

Here's a file with pure cgi http://www.mediafire.com/?iqx9fzk7bln8pgj
And a file of pure film http://www.mediafire.com/?rpm2rgpnr6q5n9t

The 3:2 pulldown is hard coded into the file. Mainly due to some of the computer graphics sequences are a mix of 24 and 30fps with the occasional 60 fields content thrown in. I figured that it made sense to just clip the raw vob files down for a sample rather than a avi with deinterlacing already done.

2Bdecided
4th August 2010, 12:40
I couldn't unpick the broken resizing, so I cheated...


mpeg2source("B5_clip2.d2v")

a=last

o = last
o.NNEDI2(field=-2)
dbl = Merge(SelectEven(),SelectOdd())
dblD = mt_MakeDiff(o,dbl,U=3,V=3)
shrpD = mt_MakeDiff(dbl,dbl.RemoveGrain(11),U=3,V=3)
DD = shrpD.Repair(dblD,13)

dbl.mt_AddDiff(DD,U=3,V=3)

limitedsharpenfaster()

stackhorizontal(last,a)

That's Didée's trick, but it's not really meant for this problem - unpicking it properly would be better.

Cheers,
David.

Didée
4th August 2010, 13:20
I'll have a look, too, but it may take a little. (BTW, the B5 saga is my all-time favorite.)

From which episode are these samples? I'd like to compare with my R2 DVDs.

scharfis_brain
4th August 2010, 18:03
the creators of the 16x9 anamorphic masters basically b0rked all CGI scenes.
they simply cropped the 4x3 fullscreen (480 lines) cgi scenes
to 16x9 letterboxed (360lines) and
then applied a linear fieldbased upscale to 16x9 anamorphic (480 lines again).

The result is image artifact seen in the sample video.
You can basically undo it with this code:

mpeg2source("B5_clip2.d2v")
bob(0,1) #do a dumb bob (don't scale with bob, it doesn't look the same as bicubicresize does)
bicubicresize(width,360) #downscale the image
assumetff().separatefields().selectevery(4,0,3).weave() #re-interlace the image
bicubicresize(width,480) #do a proper progressive upscale

This code simply reverts the fieldbased upscale by doing a fieldbased downscale.
The problem is, that this code only will make the center of the image look better. The top and bottom parts of the image are still very blurred,
because the scaling offsets do NOT match.
You have to try and error of the amount of scaling (360 +/- 2 pixels) as well as for the vertical offset.

I really haven't got the time to do so.
Maybe Didée or someone else has a quick shot for it.

Buck746
4th August 2010, 23:19
I just got home from work so i'll have a bit of time to run thru and try the suggested scripts. Didée the clips were taken from a S2 disc, the episode would be either (The Coming of Shadows) or (GROPOS). I ripped just the first chapter from the episodes because I wanted to take the opening credits and average them all together from all the different dvd's. When I started doing stuff with tv shows I usually captured the original airing and as many repeats as I could so I could get the cleanest image possible.

*.mp4 guy
5th August 2010, 03:15
Well I figured out why offsets don't work, there isn't a universal offset for the entire frame (duh). Luckily, since the ratio between the two sizes can be simplified to 3:4 (if the information on the source is correct) the offsets repeat every 16 interlaced frame lines (or every 8 field progressive lines). Which is still a massive PITA. I haven't coded any of this up yet, but it might be a while before I have the time, so I figured I should post what I figured out so far. Hopefully I'm wrong and someone else will figure out how to do this much more easily, but I doubt it :(.

scharfis_brain
5th August 2010, 07:46
I think, I've got it:


mpeg2source("B5_clip2.d2v") #source filter
bob(0,1) #bob the source
#scale down the video to its original resolution with the correct offsets
bicubicresize(width,360,0,1,0,-1,0,482) #(might benefit from some further finetuning)
assumetff().separatefields().selectevery(4,0,3).weave() #reinterlace
nnedi2(dh=true,field=0).bicubicresize(width,480,0,1) #upscale using nnedi2 to supress stairstepping
subtract(last,subtract(deen("a2d",3,7,0),last)) #enhance texture details a bit
http://home.arcor.de/scharfis_brain/B5-sample.jpg

2Bdecided
5th August 2010, 15:43
scharfis_brain - Magic!

I think there must be a correct set of offsets (possibly different for top field vs bottom field) to use without doing a bob first. This might be sharper (might not be!). Not sure about correct chroma processing in that case (might be fine as-is, might be some other nastiness to fix).

Cheers,
David.

scharfis_brain
5th August 2010, 17:43
you might try reverse scalingg without using bob().
but I don't see any real benefit doing so except of getting to hassle with scripting.

sghpunk
25th March 2013, 21:44
scharfis_brain, Thank you very much!


bob(c,0,1) #bob the source
#scale down the video to its original resolution with the correct offsets
# LanczosResize(width,344,0,-3,0,481) # S2 better results
# LanczosResize(width,344,0,-3,0,481) # S1 most opening better results
# LanczosResize(width,344,0,0,0,482) # S1 other opening better results
LanczosResize(width,344,0,-2,0,481) # S1 other better results
assumetff().separatefields().selectevery(4,0,3).weave() #reinterlace
nnedi2(dh=true,field=0).LanczosResize(width,480) #texture details a bit
mfRainbow("slow", 1, 220, false)
Tweak(sat=1.2) #Restore colors after derainbow


I has modified your algo a bit.
LanczosResize give a much clear picture for me.

Now I is able to restore quality of my lovely series.
Thanks again!

Katie Boundary
11th February 2017, 05:52
you might try reverse scalingg without using bob().
but I don't see any real benefit doing so except of getting to hassle with scripting.

I tried both of the following scripts...

Obvious "reverse what was originally done" approach:

mpeg2source("116.d2v")

separatefields().lanczos4resize(720,180).doubleweave().lanczosresize(720,480)

Not-obvious, bobbing-based approach:

mpeg2source("116.d2v")

bob(0,1).lanczos4resize(720,360).separatefields().selectevery(4,0,3).doubleweave().lanczosresize(720,480)

Between these two, the bobbing approach yielded better-looking images. However, the first approach might work better if lanczos4 is replaced with "debilinear" for downscaling.

EDIT: yes, debilinear yields better results than either of the above scripts.

Katie Boundary
5th August 2019, 19:14
So, over on Facebook, in one of the Babylon 5 groups, a rather curious phenomenon is brewing. An argument is breaking out over the frame rate at which the CGI and composite shots were rendered. On one side are people claiming that everything was done at 24 progressive frames per second, and on the other side are people pointing to the DVDs as proof to the contrary. Now here's a twist: the people claiming that everything was done at 24 include people who actually did the CGI and composite shots for that show back in the '90s.

For those of you who have the Region 1 Babylon 5 DVDs, where do you stand on this? What explanations are there for this discrepancy?

voivod
5th November 2019, 16:31
I did a 640x427 resize for my demo, as it appears to be the original resolution of the NTSC frames.
https://youtu.be/eQYcx0rwtVQ

I didn't use the signal chain provided here, cause it either gave some problems or worse pictures. I will try once again as this was half a year ago.

dadix
19th January 2020, 10:47
I did a 640x427 resize for my demo, as it appears to be the original resolution of the NTSC frames.
https://youtu.be/eQYcx0rwtVQ

I didn't use the signal chain provided here, cause it either gave some problems or worse pictures. I will try once again as this was half a year ago.

You can use maybe the new filter "warp" to copy colors from one dvd to another . Look here : https://www.youtube.com/watch?v=SG1eex7HmLM (is not my filter , I just find it ) . I am also a B5 fan .

flossy_cake
25th February 2023, 09:54
Hello

This issue continues to rear its ugly head with the most recent DVD release of Sliders. The show probably isn't going to get remastered so Avisynth is probably our best option at reverse engineering some decent image quality.

I have tried the suggestions in this thread and others summarised here: http://avisynth.nl/index.php/Field_misalignment

Here is my test clip, perfect clip for debugging this imo as it has lots of 1px thin fonts in the end credits: https://drive.google.com/file/d/13IwOh5dv1fNLPnWGLddCArxN8VibEUA0/view?usp=sharing

https://i.lensdump.com/i/TQloPv.png

I've tried offsetting the vertical field downscaling amount by 2px at a time (240, 238, 236...170) without success. Can't get it to "snap" into the correct alignment.

Also tried downscaling one field only.

The more I think about it the less I understand why downscaling the fields in the source file would bring the original fields back into alignment. Because the original fields seem to exist across more than 1px vertically in the source file. So their alignment isn't really related to the fields in the source file.

I also seem to think it makes more sense to IVTC first and then try to "pick out" the original fields from the progressive frames.

Any help appreciated :thanks:

poisondeathray
26th February 2023, 02:05
Because the original fields seem to exist across more than 1px vertically in the source file. So their alignment isn't really related to the fields in the source file.


Yes it seems a bigger problem than just shifting fields, or even subpixel resampling



For text or animation, there is an ESRGAN model SwatKatsLite by SaurusX. I believe the underlying problem is similar
https://slow.pics/c/F4ilU8PM

I don't know how well it would work on live action content; I suspect not well. But if you could get some info from SaurusX on how he degraded and trained the model, you might be able to get some insight into "reversing" the procedure in general terms, or even train one on similar content

This was TFM(pp=0).BicubicResize(720,540) => 1x_SwatKatsLite_360000_G => ResampleHQ(720,480) on your source
https://imgsli.com/MTU3ODc3

flossy_cake
26th February 2023, 08:32
Wow thanks, the result looks really good. But like you said it might not work so well on live action. I'd like to have a play around with it - can you point me in the right direction? I found a 1x_SwatKatsLite_360000_G.pth file but not sure how to use it.

Here are a couple of short live action clips with the issue (3:2 hard telecine BFF)

https://drive.google.com/file/d/1_zcflVVh734NpKIfQPs83_EpeTzO-HbY/view?usp=sharing
https://drive.google.com/file/d/1RNIf7ECilj4XT6pIW8FYqNv4NOewi0sp/view?usp=sharing


https://i3.lensdump.com/i/TVrts5.png
https://i.lensdump.com/i/TVr1Dz.png
https://i3.lensdump.com/i/TVrTWT.png

flossy_cake
26th February 2023, 09:04
This is a mod of Didee's solution by blending with the pixel above/below, kind of like a CRT deflicker filter

TFM(PP=0).TDecimate()
nnedi3(field=-2)
Merge(SelectEven, SelectOdd)

Result
https://imgsli.com/MTU3OTQz
https://imgsli.com/MTU3OTQ0
https://imgsli.com/MTU3OTQ1
https://imgsli.com/MTU3OTQ2

Of course this smudges a lot of the details (but in a nostalgic kind of way, and it can be sharpened as well if desired).

But I think the implementation is suboptimal as it's blending original px with nnedi3 px when it could be blending original with original. But I don't think that will look much better anyway. edit: yep tried it by blending with PointResizeBobbed frames instead of nnedi3 frames, and the result is actually blurrier. But this only blends with either the pixel above or the pixel below, but not both, and I think CRT deflicker filter blends with both above+below.

edit: I believe this would blend the current px with original above + original below:

strength = 0.5 # range 0.0 - 0.5
orig = last
shift_up = PointResize(orig.width, orig.height, 0.0, 1.0, orig.width, orig.height)
shift_down = PointResize(orig.width, orig.height, 0.0, -1.0, orig.width, orig.height)
blend_up = Merge(orig, shift_down, strength)
blend_down = Merge(orig, shift_up, strength)
Merge(blend_up, blend_down, 0.5)

Off vs mid strength (0.25): https://imgsli.com/MTU3OTc1
Off vs max strength (0.5): https://imgsli.com/MTU3OTcy
Mid vs max: https://imgsli.com/MTU3OTcz

These were upscaled 200% nearest neighbour otherwise it interferes with the contrast between 1px white-black lines. Also you'll probably have to go into full screen browser mode as they are probably getting downscaled slightly to fit in browser window. Source video: https://drive.google.com/file/d/1WfW3yXmGhIvUCiexQGYD18gSiXRe2bze/view?usp=share_link

Also I found that blending only with the line above/below is suboptimal as it shifts the whole image 1px and can create 1px colour bleeding artefacts at the edges of colours. Blending with above+below seems better.

edit: I see there is also SpatialSoften (http://avisynth.nl/index.php/SpatialSoften) which allows luma thresholding which might be useful.
edit: it seems SpatialSoften's thresholding only allows softening pixels BELOW a luma threshold, but I want to soften only ABOVE a luma threshold, i.e to soften high contrast edges only, which are most noticeable with this problem.

poisondeathray
26th February 2023, 16:34
I found a 1x_SwatKatsLite_360000_G.pth file but not sure how to use it.


That is a machine learning model that uses ESRGAN. Most of them are pytorch and could be used in vapoursynth vsgan, or GUI's like chainner

But - it's possible in avisynth directly now , with the model converted to onnx, and using avs-mlrt . See this thread -
http://forum.doom9.org/showthread.php?t=184768
https://github.com/Asd-g/avs-mlrt

There is a repository of links to various models at
https://upscale.wiki/wiki/Model_Database

flossy_cake
26th February 2023, 17:00
Fantastic, thank you. Can't seem to find this kind of stuff through Google anymore.

flossy_cake
26th February 2023, 17:23
That is a machine learning model that uses ESRGAN. Most of them are pytorch and could be used in vapoursynth vsgan, or GUI's like chainner

But - it's possible in avisynth directly now , with the model converted to onnx, and using avs-mlrt . See this thread -
http://forum.doom9.org/showthread.php?t=184768
https://github.com/Asd-g/avs-mlrt

There is a repository of links to various models at
https://upscale.wiki/wiki/Model_Database

I couldn't get ChaiNNer to load - something about kernel32.dll (I don't think my system is supported). If you already have the SwatKatsLite ONNX model, could you upload it somewhere?

poisondeathray
26th February 2023, 17:30
If you already have the SwatKatsLite ONNX model, could you upload it somewhere?

I just converted it in chainner the way RD demonstrated. I haven't tested this onnx version yet

https://www.mediafire.com/file/m9bqxu9topm191l/1x_SwatKatsLite_360000_G_onnx.7z/file

flossy_cake
26th February 2023, 18:37
I just converted it in chainner the way RD demonstrated. I haven't tested this onnx version yet

https://www.mediafire.com/file/m9bqxu9topm191l/1x_SwatKatsLite_360000_G_onnx.7z/file

Cheers, got it working but it just renders like 1 frame and then freezes my system at 100% GPU, and it looks nothing like the screenshot you posted. Some of the other onnx models worked... at about 1fps.

Maybe I need to just brute force it and write 480 lines of avisynth - 1 for each line in the raster to discreetly mark it as field1 or field2 :devil:

poisondeathray
26th February 2023, 18:59
Cheers, got it working but it just renders like 1 frame and then freezes my system at 100% GPU, and it looks nothing like the screenshot you posted. Some of the other onnx models worked... at about 1fps.


How different ?

If it's freezing for you , maybe not enough GPU memory? You can try the tiling and overlap options.

onnx version in avs, works ok . Some parts of live action image are improved, some worsened on that source

https://imgsli.com/MTU4MDM0

There is a slight color shift, and you sometimes get that with ML models

I confirmed results are very similar to pytorch version (basically 99.999% the same)

flossy_cake
26th February 2023, 19:43
How different ?

Image looks way oversharpened and none of the artefacts are removed.

https://i1.lensdump.com/i/TVsPNT.png

That is the only frame I can visually see before it grinds my system to a halt at 100% GPU and my PC becomes unstable.

I did upscale to 540p first as the author demands. Anyway it's a moot point as it's probably too slow for real time use unlike nnedi3 which is blazingly fast.



https://imgsli.com/MTU4MDM0


Wow that looks very good & I'm jealous. How many fps do you get? Is it viable for real time usage?

poisondeathray
26th February 2023, 19:51
Image looks way oversharpened and none of the artefacts are removed.


That's quite different than what I'm getting; did you field match first ? I posted the steps I used above (that was using pytorch earlier), but I'll try it in avs completely


Is it viable for real time usage?
No ; very few of the modern machine learning algorithms are suitable for real time . Some exceptions are the "compact" models if you have a fast enough GPU

flossy_cake
26th February 2023, 19:56
That's quite different than what I'm getting; did you field match first ?

Yeah...


FFMS2()
TFM(PP=0).TDecimate()
LanczosResize(720, 540)

ConvertBits(32)
ConvertToPlanarRGB()
mlrt_ncnn(network_path="C:\1x_SwatKatsLite_360000_G_onnx.onnx", builtin=false)


Maybe my GPU not doing something correctly in the driver. I did install the C++ runtimes and latest build of Avisynth like the git said to. Or maybe cause it's grinding to a halt it doesn't get a chance to process frames in the correct order.

poisondeathray
26th February 2023, 20:11
Not sure why... onnx converted model works ok here


DGSource("PATH\misaligned fields 720x480i29 BFF.dgi")
TFM(pp=0).TDecimate()
z_convertformat(pixel_type="RGBPS", width=720, height=540)
mlrt_ncnn(network_path="PATH\1x_SwatKatsLite_360000_G_onnx.onnx", builtin=false)
z_convertformat(pixel_type="RGBP", width=720, height=480) #for the screenshot


https://imgsli.com/MTU4MDQ1




Maybe my GPU not doing something correctly in the driver. I did install the C++ runtimes and latest build of Avisynth like the git said to. Or maybe cause it's grinding to a halt it doesn't get a chance to process frames in the correct order.

It's spatial (single frame), so I doubt it's a frame in correct order issue

If it's running (at all), it should work

Reel.Deel
26th February 2023, 20:14
Not sure why... onnx converted model works ok here


Same here. I didn't even resize it and it works.

flossy_cake
26th February 2023, 20:28
I think it must be my system. Have gotten memory access violation crash, something about trying to read address 0x41 inside C:\Windows\System32\Avisynth.dll

Probably cause I'm running Windows 7 and haven't updated my GPU driver in a while. Tried on the other PC with i7-4790k & GTX 1070, got that memory access violation crash.

Out of interest how many fps do you get with say tilesize_w=32, tilesize_h=32?

poisondeathray
26th February 2023, 20:38
I think it must be my system. Have gotten memory access violation crash, something about trying to read address 0x41 inside C:\Windows\System32\Avisynth.dll

Probably cause I'm running Windows 7 and haven't updated my GPU driver in a while. Tried on the other PC with i7-4790k & GTX 1070, got that memory access violation crash.

Out of interest how many fps do you get with say tilesize_w=32, tilesize_h=32?


Do you have the required avs+ version or newer ?

I didn't measure the speed, but you're not going to get realtime because that is an ESRGAN (classic) model, not a "compact" model

I didn't use tiles, but the more tiles you use, the slower it is - and it's not addtively slower (e.g. 4 tiles is going to be more than 4x slower) . You shouldn't need any tiles with the GTX 1070 for SD input. When using tiles, you usually want to make it evenly divisible by the input image. I tend to use 32 for the overlap (not just ESRGAN, other ML architectures too)

Also, the NCNN/ONNX versions tend to be slower than Nvidia pytorch, or TensorRT versions

flossy_cake
26th February 2023, 20:48
Do you have the required avs+ version or newer ?

Yeah and I tried both the CLang and Intel builds. I think it's just my GPU driver is too old for whatever fancy functions are being called on the GPU.

I'd still be curious to know how many fps you can get because if it's something decent I could at least do a transcode for a few problematic episodes in this series. But if it's like 5fps or something then I won't bother.

ffmpeg command line reports the fps as its encoding: ffmpeg -i "c:\myscript.avs" -f null NUL

poisondeathray
26th February 2023, 21:03
I'd still be curious to know how many fps you can get because if it's something decent I could at least do a transcode for a few problematic episodes in this series. But if it's like 5fps or something then I won't bother.


Don't bother... :)

flossy_cake
26th February 2023, 21:27
Don't bother... :)

Well, I got it to work on the 1070. With GPU pegged at 100% max clocks and temps rising steadily, I'm getting about 0.3fps. So about 5 minutes to make this 3 second clip: https://drive.google.com/file/d/1hHmccHhRbRPmszYM0XasusqL_dIlsApx/view?usp=sharing

That would take about 3 days to do a single 42 minute episode.

poisondeathray
26th February 2023, 21:49
pytorch version (e.g. vapoursynth vsgan) would be slightly faster; but what would make it much faster is if someone converted it to a "compact" model. Probably 5-20x faster, maybe 99% of the quality

flossy_cake
28th February 2023, 12:26
I saw this filter vinverse (http://avisynth.nl/index.php/Vinverse) which is intended for removing residual combing artefacts after detelecining.

The result is very similar to the nnedi3 solution though: https://imgsli.com/MTU4MzIx

Another issue is that the more I sharpen the image afterwards, the more apparent the discrepancy becomes between lines that have good field alignment and those that don't. To try and work around that I tried blurring the image a bit first, to make everything appear at similar blur level, but then so much resolution is lost at that point and resolution is only around 240p.

SaurusX
3rd March 2023, 22:53
I noticed this thread today, but I don't know what more I can add to the conversation that hasn't already been said. Although it seems to me that the artifact in question is created by resizing each field independently and then the full frame being woven back together. The offsets of the fields then no longer match. Just a theory, though.

flossy_cake
4th March 2023, 01:04
I noticed this thread today, but I don't know what more I can add to the conversation that hasn't already been said. Although it seems to me that the artifact in question is created by resizing each field independently and then the full frame being woven back together. The offsets of the fields then no longer match. Just a theory, though.

Yep, that's exactly what's happening, wiki page here: http://avisynth.nl/index.php/Field_misalignment

The best solution I've got so far is to blend pixels vertically like a CRT deflicker filter but using nnedi3 pixels instead: https://imgsli.com/MTU3OTQ2

But the softening is still ugly.

Another idea I had was to add black letterbox bars above and below the video in 2px increments, before downscaling in the vertical resolution in 2px increments. But field alignment never "snapped".

SaurusX
4th March 2023, 15:27
Another idea I had was to add black letterbox bars above and below the video in 2px increments, before downscaling in the vertical resolution in 2px increments. But field alignment never "snapped".
I tried everything you probably did including 1px increments by first converting to 4:4:4 and then sizing up the results before reweaving and then downscaling back. I was actually able to get the best results with that using conventional AVISynth means. This has all been tried before, though.

lwlibavvideosource("E:\Media\Video Editing Tools\MeGUI-2913-64\scripts\clip 2 - misaligned fields 720x480i29 BFF.mkv")
tfm()
tdecimate()

separatefields()
bicubicresize(720,236,b=-0.5,c=0.25)
lanczos4resize(720,472)
assumefieldbased()
weave()
lanczos4resize(720,540)
sharpen(.2)

The best results are still from 1xSwatKatsLite, which is surprising given that the model was trained for animation.

https://mega.nz/file/mGZTATZY#2BOdRzxnNN2pig5tl5rzbZxeKEvbn8fUZM8cSnDLnYo
https://mega.nz/file/3a4yUJpB#6vDDDVZE1sEr2dq9b7l8p7Ww-1cFA-sAwHIBbqrH7cQ