Thursday 31 December 2009

Nikon D90 Breakthrough! Part III - The solution by us

As soon as we discovered that the other methods for destepping were wrong. All we had to do was compare the two methods, find where they had the wrong splits and make a correct split template.
The theory proposed by a friend was that Nikon scales the footage using the nearest neighbor method to go from a resolution of about 800 lines to 720 lines. This was why some lines were discarded.
So all we had to do was find the exact scaling factor of Nikon's method and then reverse it so we could go from 720lines to about 800. The result would leave us with duplicate lines (because we would use the nearest neighbor method again) which would then be discarded and inerpolated.
After counting (by hand!) all the pixels and found the repetitive segments we were able to calculate the scale factor. The magic number is 1.113281 .
It was all downhill from there. And as you can see below the flow is very compact with minimal nodes. It is also very fast to render.
Of course in Fusion you can do all of this in a macro so it is as easy as adding a node to your footage.

I suppose a similar method can be used with After Effects. As long as scaling is done in draft mode and rendered as it is and NOT with best settings. If someone makes it for AFX, please let us know.

UPDATE: It seems that fusion has trouble with some of the Nikon AVIs possibly to a bug in the Nikon avi packager. You can use ffmpeg (free) with the script below to remux them in new fixed avi files. Just make a dos batch file (.bat) with a text editor like notepad and paste the code below

::-----------------------------------------------------------------
for /f %%f in ('dir *.avi /b /a:-d-s-h') do call :Convert "%%f"
echo Finished
PAUSE
goto :EOF
:Convert
echo FIxing %1
ffmpeg -i %1 -vcodec copy fix_%1
goto :EOF
::-----------------------------------------------------------------

5 comments:

  1. And here it is:
    http://rapidshare.com/files/330212577/D90_Destepper.rar.html
    Macro for Fusion 6

    ReplyDelete
  2. hey guys, great work. using this division results in the exact same pattern of 8's and 9's that most other algorithms use though. the difference is just at the edges and as far as i can tell from eyeballing it lee's table seems to handle it correctly. using nearest neighbor rounding and your factor i get 4 pixels at the edges and using truncation/floor rounding i get 8, neither gives me the correct results, which 7 does, as eyeballed by lee wilson and dc gear. if you don't want to share what you're doing can you please at least let me know what i'm doing wrong? :-)

    ReplyDelete
  3. actually now that i downloaded your files the *only* difference between your sclices and mine are that you start with 6 lines and get 800 total and i start with 7 and get 801. i tried 6 in mine but it gives me the wrong results. i think we're actually doing the exact same thing and the different is just an artifact of implementation.

    ReplyDelete
  4. Oh, man! Sorry, I just saw this.
    Well the most difficult part was figuring out the center of the scaling and then the number to use for scaling. I've never seen a method before that does not cut the image to slices and move them. All I use to move the pixels is scaling with nearest neighbor interpolation. Then, get rid of the duplicate lines and interpolate them.
    I'm just content that it finds every missing line and recovers it as much as it can and don't think more about it. :)

    ReplyDelete
  5. Oh! And I just uploaded a version of this method for After Effects. This is where I feel more comfortable working. I'm not so much a Fusion user myself and I had a lot of help making it for Fusion.
    Again, no masking/cutting/moving/recomposing tons of slices. Clean and fast I hope.

    ReplyDelete