Log in

View Full Version : Repairing Temporal Scanline Blending in Kare Kano DVDs


kriNon
21st November 2017, 08:46
Hey,
So I am working on trying to repair the KanoKare DVDs, and one of the biggest issues it has is that when the film was converted to NTSC blending occured within the individual fields.

I have tried a variety of deblending filters and nothing has really had any positive effect on the source.

If anyone has any insight on the nature of the blending, or has any ideas about how it could potentially be repaired, that would be much appreciated.

According to m1el: The blending pattern repeats itself approximately every 1000 frames, the line of the blending frames moves "up" across the whole field in a course of ~500 frames.
However this pattern is reset after any digital cuts that occured during editing.

An example of the same kind of blending can be seen here:
https://i.imgur.com/fudsK7M.png
Here is a clip from my source:https://mega.nz/#!OctCCYjL!Yk56soJj87s8KIC5aES2sgSOIulPPeFgDUTa7Y2CyWk
(EDIT) Here's a better clip:
https://mega.nz/#!3Al2XLTS!Ek7tOvw1C4N12zoavCbwfL5zkl56JcVgq-c5xijlD2I

kriNon
21st November 2017, 12:08
So I started thinking about how I can attempt to tackle this problem, and currently my plan of attack is to first find a way of creating a mask that targets problem areas, then generate some statistics that can help the filter determine how to unblend the area.

So far I have made a start on making the mask, it hasn't quite been finalized, however it is already looking fairly accurate. Only issue is that it's picking up a fair amount of noise.

Here's my progress so far:https://i.imgur.com/65udw14.png

EDIT:
So I have made some progress on the mask, it seems to work fairly well now. The only issue with the mask is that it tends to mask edges too (especially horizontal edges). This isn't too surprising due to how the mask works though.

Here's an updated image of the mask: https://i.imgur.com/6wfW174.png

I have a few ideas about what I can do now that I have a mask of blended areas. Currently, my plan is to separate fields and then compare to the two frames behind and two frames in front for each field. If I can measure how similar each frame is, I believe that I should be able to find out which frame is the one being blended with the current frame, and ideally I should be able to estimate how much blending is occurring. Then I should be able to deblend it.

EDIT 2:
So I've been doing some further research into how I can fix the blending, and something I've noticed is that when blending does occur, it will be stronger in one field than it is in the other. My current plan for deblending is to interpolate both fields to full frame height using nnedi3, and then assuming I can create a detection method that detects which field is more blended, I should then possibly be able to linearly interpolate the deblending required based off of the difference int the fields.

real.finder
22nd November 2017, 23:56
that annoying problem, I see it before here https://forum.doom9.org/showthread.php?t=169892

and in GTO anime too, right now I didn't get anything better than what I did in mode22 in modded animeivtc

kriNon
24th November 2017, 16:53
Thanks for the response real.finder!

I gave mode22 a go using modded animeivtc and I was surprised by how well it works, although the blending is still significant, it is one of the only things to have had a noticeably improved my source.

I do however want to be able to be able to get something even more blend-free than what I was able to achieve with animeivtc, and so I spent some time messing around with different filters to get the best result that I could achieve.

So far I have been very surprised to see how well QTGMC has worked for my source. I have used QTGMC in the past, however I have never been able to get results I was happy with, however this is looking promising.

Currently I am thinking that I could potentially use QTGMC interpolate both fields (double framerate), and then write a filter to decimate by a factor of two, based upon which frame has more blending.

I am thinking that I could use my blending mask, and then measure similarity with previous/next frame within the masked area. I'm gonna give it a go, however it's looking like I might be able to get a fairly good result. From what I have seen, the blending almost never occurs in both fields at once, and so it should be possible to achieve an almost blend free clip if I can decimate it correctly.

I'm pretty excited, this is looking like it might work!

kriNon
25th November 2017, 17:30
Alright, so I have had a chance to look into fixing the blending after QTGMC, and I believe that a good result is possible, however I am stuck at the moment on trying to figure out what metrics I can use to determine which frame has less blending.

As a summary, what I have found from the QTGMC'd clip is:
Any even numbered frame (top field) can only be blended with the previous odd numbered frame (bottom field).

The blending pattern is very similar to a blend IVTC, where we have 3 unblended frames followed by 2 blended frames. Although this pattern is very inconsistent.

To remove the blending I will need to create a metric that measures the degree of blending in a frame.

The information I believe would be useful for measuring the blending would be both fields in the current frame, the bottom field of the previous frame, and the top field of the next frame.

Ideally I would like the filter to always attempt to keep whichever frame has less blending, even if only by a small margin. I also would prefer that the filter not use any thresholding using arbitrary numbers to determine which frames are clean, because in frames where there has been very little movement, the frame might not reach the threshold.

kriNon
26th November 2017, 16:11
So in the end I ended up moving to vapoursynth to solve my problem, however my solution could fairly easily be achieved in avisynth if required.

I have managed to rather decently perform the decimation, I ended up doing a comparison of the two fields passed through a edge detection filter, and then comparing the two edge masks, as the more blended frame should have more edges. I'm going to further improve upon this script though, firstly I would like to take into account chroma ghosting for frames where the difference in the edgemasks is negligable. I also want to try to find a way of improving the improvement of the filter when blending of a line occurs, however the line is shifted very slightly. This is hard to detect because the two line edgemasks will extend past the actual line, and they will often have a decent amount of overlap. I would like to try to improve how well the decimation works for small differences.