PDA

View Full Version : Reconstruct 24fps Progressive From Blended Telecine


Xenoproctologist
24th October 2002, 04:12
Most raw anime source which leaves Japan is, unfortunately, blended telecined video. VirtualDub's "reconstruct from blurred fields - manual" works fairly well at restoring these to progressive source, so long as the telecining pattern holds steady and a scene change doesn't occur during a blurred frame.

Telecine pattern changes aren't much of a concern, as there are generally only one or two per episode, and I have no problem breaking an episode into two or three pieces to match the pattern. Scene changes are a bit more of a problem, as there is a 20-40% chance that any given scene change will occur on a blended frame. In the course of a 24 minute episode containing 100+ scenechanges, the number of single-frame splices gets more than a little tedious. These errors, however, do leave a rather distinctive signature: a single-frame-long drastic change in brightness.

In the end, I'm asking about the feasibility of this:

Notation:
[a|b|c|d|e] = Telecined NTSC
[A|B|C|D] = Progressive Film
a b c d e
AA AB BC CC DD

A = a
B = 2b-a = 2c-d = (2b+2c-a-d)/2
C = d
D = e


Really Clunky Pseudocode:

grab5frames(a,b,c,d,e);

bFirst = 2b-a;
bSecond = 2c-d;
if ( | bFirst-bSecond | > luma_threshold ) {
bFirst_luma_difference = | bFirst-A | + | bFirst-C |;
bSecond_luma_difference = | bSecond-A | + | bSecond-C |;
if (bFirst_luma_difference > bSecond_luma_difference) {
B = bSecond;
}
else {
B = bFirst;
}
}
else {
B = (bFirst+bSecond)/2;
}

return4frames(A,B,C,D);

I'd try to write it myself, if not for the fact that I really don't know C. I can modify some code if I spend four times as long looking at reference manuals as I do the actual code, but I can't write it from scratch.

So, at the risk of sounding utterly lame, anyone feel the inclination to take this anywhere? Is it worth taking anywhere?

Xenoproctologist
27th October 2002, 02:43
Well, since nobody has spoken up on this, I've decided to try to take a whack at it myself. Last night I managed--very slowly--to get it to a point approximately analogous to vdub's reconstruct from blurred fields. (...with the exception of a goofy bug in setting the pattern offset. I swear, this damned offset counter is turning out more difficult than the actual unblending.)

So now, before I start to code the faulty unblend detection, I need to know whether my previous plan of using the absolute difference in luminance is viable. Is there a better way? If there is a better way, can you point me toward a non-assembly-non-mmx-optimized example of it?