D90 Stair-Stepping Removal

ok, so here it is for fcp. it renders in realtime. it's also part of my tmts plugin pack.

http://www.mattias.nu/

/matt

Code:
// Copyright 2008 Matt Sandström/Too Much Too Soon
// Magic Numbers courtesy of Lee Wilson and DC Gear
// [URL]http://www.dc-gear.com/d90/[/URL]
// This script is freeware, meaning you may copy and
// distribute it free of charge, as long as it's kept intact,
// including this message. Feel free to use the code as
// inspiration for your own scripts, but don't steal.
// Email me at [EMAIL="mattias@beauty.se"]mattias@beauty.se[/EMAIL] if you have any questions.
// Thank you. Have fun. 

filter "D90 Rescaler"
group "TMTS Video"
FullFrame

InformationFlag("YUVaware")

code
float i;
float kern[3][3];
point sp[4], dp[4]
image buf1[1280][802],buf2[1280][802]

float magicnumbers[82];
float srcy=0, desty=0;
float w,h;
dimensionsof(dest,w,h);

magicnumbers = {7,9,9,8,9,9,9,9,9,8,9,9,9,9,8,9,9,9,9,9,8,9,9,9,9,9,8,9,9,9,9,9,8,9,9,9,9,9,8,9,9,9,9,8,9,9,9,9,9,8,9,9,9,9,9,8,9,9,9,9,9,8,9,9,9,9,9,8,9,9,9,9,8,9,9,9,9,9,8,9,9,7}

channelfill(buf1,0,255,255,255);

if w == 1280 && h == 720 then;
    for i = 0 to 81
        MakeRect(dp, -640, desty-401, 1280, magicnumbers[i])
        MakeRect(sp, -640, srcy-360, 1280, magicnumbers[i])
        blitrect(src1,sp,buf1,dp);
        srcy = srcy + magicnumbers[i];
        desty = desty + magicnumbers[i] + 1;
    next;

    kern = { 0,1,0,0,0,0,0,1,0 };
    convolve(buf1,buf2,kern,2,0);
    
    matte(buf1, buf2, buf2, 1, kalpha);
    
    MakeRect(dp, -640, -360, 1280, 720)
    MakeRect(sp, -640, -401, 1280, 802)
    blitrect(buf2,sp,dest,dp);
else
    dest = src1;
end if;

Love seeing my name in code, the smell of grease paint, the tap of the qwerty keyboard . . . . :crybaby::)
 
Rolly -- That Merlin is sick with the d90.

Thanks Kholi!



Originally Posted by BandanaDan
Hey guys, I'm using Adobe Premiere Pro CS3 to do my editing and I'm unsure how to export my completed edit into a lossless/ideal format for Adobe After Effects to stair step fix it.

What do I do?
Do I go into File\ Export\ Adobe Media Encoder?
And what settings?


Thanks alot :)

Like mattsand said, better work with the original footage if you want to use replacement map filter, I tried to work with editing footage from Premiere CS3 without succes.
 
Oops, small error. The last interpolated line shouldn't be copied back of course. Change the 802 to 801. I'm making the change in the download later today. (still can't quite figure out why it's 801 and not 800, but if the magic numbers are correct that's how it works out)

EDIT: done. not that it matters quality-wise but it's more "transparent", the image tended to move upwards a bit before and sometimes the last line would be corrupt. now all it does is fix the stairstepping. :)

/matt
 
Last edited:
Oops, small error. The last interpolated line shouldn't be copied back of course. Change the 802 to 801. I'm making the change in the download later today. (still can't quite figure out why it's 801 and not 800, but if the magic numbers are correct that's how it works out)

EDIT: done. not that it matters quality-wise but it's more "transparent", the image tended to move upwards a bit before and sometimes the last line would be corrupt. now all it does is fix the stairstepping. :)

/matt

hey matt can u post the updated file for fcp? thanks!
 
i use the prores 1280x720 24p template and change the timebase from 23.976 to 24. i also change the motion quality to high and set all effects to render in "high quality" which means 16-bit float with extra superwhites and all that.

/matt
 
It's updated on my website. If you're using the script here just replace 802 with 801 near the end.

http://www.mattias.nu

/matt

Matt:

Just now discovering your work and the plug-in. Have to re-configure my drive set-up before installing my new copy of FCP. Excellent work on the plug-in--really look forward to trying it out. Thanks for all your contributions here!
 
I'm currently trying to get this wonderful fix incorporated in a batch job proces in virtual dub mod. I seem to run into a problem and was hoping someone could help me. in short:

I created a batch job list; for example:
....
/ $job "Auto-Job 11"
// $input "D:\DSC_0081.AVI"
// $output "D:\DSC_0081 - 0.AVI"
// $script
VirtualDub.Open("D:\\DSC_0081.AVI","",0);
VirtualDub.Open("D:\\zooi directory\\vidx.avs","",0);
VirtualDub.RemoveInputStreams();
VirtualDub.stream[0].SetSource(0x73647561,0);
VirtualDub.stream[0].DeleteComments(1);
VirtualDub.stream[0].AdjustChapters(1);
...... (followed by a lot of jobs ;)

As you can see it opens the needed .AVI from within the joblist
the vidx.avs is Mr. Lee's scriptfile. Now my question is about this part:

##############################################
## SET THE PATH TO YOUR D90 MOVIE FILE HERE ##
##############################################
video = "d:\DSC_0081.avi"

How can I set this line so it automatically selects the .AVI named in the current job list? In my current joblist I have to create a separate .avs script for every .avi in my joblist. I was wondering if someone would know a differnt sentence for this part:

video = "d:\DSC_0081.avi"

for example: video = "SetSource(0x73647561) or *.avi or VirtualDub.stream[0] or whatever needed to only need one .AVS script to process all my .avi files.

I hope you understand my question.
 
ok, "d90 upscaler" uploaded to my homepage. it scales the image to 1080p instead, which doesn't mean that you get 1080p but you retain the 800p created in the process instead of scaling it back down. actually you can scale it to any size, even down, just change your sequence settings, but if your target res is 720p the former plugin is easier to use and renders a bit faster.

/matt
 
ok, "d90 upscaler" uploaded to my homepage. it scales the image to 1080p instead, which doesn't mean that you get 1080p but you retain the 800p created in the process instead of scaling it back down. actually you can scale it to any size, even down, just change your sequence settings, but if your target res is 720p the former plugin is easier to use and renders a bit faster.

/matt

legend.

would you recommend this compared to your last rescaler/upscaler?
 
If you're mastering to 720p the previous one is better, the result is the same but it renders faster. If you're going to some other format the new one is better, if you're doing 1080p or sd for example. Good luck. /matt
 
Since I'm new to all this...

Since I'm new to all this...

OK, I'm new to FCP, but if I understand correctly once the plugins are installed:

- I import the D90 footage in FCP;
- apply the [FONT=verdana,arial,helvetica][FONT=verdana,arial,helvetica]Rescaler filter to each AVI files in the viewer before adding them to the timeline;
- when the files are on the timeline, I can edit all of them as I wish;
- when my project is finished, I can export them with Compressor using, for example, the Apple TV presets;

and everything will be as nice as it can be?
[/FONT]
[/FONT]
 
You can apply the filter at any time even on the timeline as long as you place it above any filters that alter the geometry or pixel distribution of the image, like stabilizers, diffusion, noise reduction, rotation and so on. Filters are always applied before the motion tab though so don't worry about that. /matt
 
A while back, I wrote a linux/ffmpeg based program to fix the stairstepping problem in individual videos. If I knew how to write a cinelerra plugin I'm sure that would be far better, but in the mean time I'm releasing this in case there's other linux people out there who are as bothered by the stairstepping in their d90 videos as I am.

Beware that by default the new video files will be lackluster because of the ffmpeg encoding settings in the shell script, even though they balloon up maybe 10% larger than the original files. If someone uses this as part of their actual workflow, please let me know what ffmpeg settings you use to retain all the detail in the reconstructed movies without creating 10x larger files... I haven't found any satisfactory settings yet.

The upside is the transformation is done by a C program so it works much faster than ffmpeg can do the reencoding.

http://www.epsilonic.com/d90fix/
 
cool. i went through your code very quickly and it seems like you shuffle a lot of data for no reason between the from and to pixmaps. the only data that needs to be generated is the interpolated lines, the rest can be written to the output stream directly from the source. i'd create a one row pixmap and add a to parameter to the interpolate function. or maybe create a pixmap struct that has its own data pointer for each row and then just change the pointer to "copy" the entire rows? that would preserve your current app flow although it would be really really ugly (which i like when i code in c, it's a language that invites you to cheat and write horrible code). :)

/matt
 
Back
Top