Log in

View Full Version : numerical oddity? (undoing PAL->NTSC)


plugh
27th January 2008, 01:00
Background:

Trying to extract something useful from a film->PAL->NTSC DVD with blended fields (yuck). Been reading about and experimenting with some of the tools and thinking about the problem in the context of this particular DVD.

Stepping through it with VDM and viewfields() I could track the basic cadence of the PAL->NTSC conversion. ie with bottom field first, '#' being PAL field and 'b' being blended field

1 3 5 7 9 b
0 2 b 4 6 8

Of course thing are never that simple. What with 25/50 vs 29.97/59.94 that pattern both "drifts" and isn't always in a group of twelve fields.

The numerical oddity:

As part of my experimentation, I wanted an expression that would tell me where (what NTSC field) I could find, say, that first blend. (Keep in mind that it 'drifts' and a 'group' won't always be twelve fields long). For this case (ie PAL->NTSC) it seems to be (all integer math)

N*2400/199

where N indicates the Nth occurrance.

I've tested this a couple differant ways, both with synthetic data and against my DVD and it _does_ seem to track the same feature of the conversion cadence.

But it also bugs the hell out of me because I can't find a numerical derivation or justification for it (I derived it through experimentation and inspiration). The only semi interesting observation I can make is 2400/199 equals 12 + 12/199

Beats me... perhaps it fails for very large values of N, or perhaps the numerical error is sufficiently small that it simply falls outside the bounds of the ratio(s) involved with PAL->NTSC (eg 1200/1001), given integer truncation of the result.

scharfis_brain
27th January 2008, 03:12
my very simple process for undoing CONSTANT patterns even with non-integral framerates is like this:

xxxsource("blah.xxx")
any_bob()
changefps(?*10) # set ? to the real framerate of the underlying content
selectevery(10, ?) # set ? to a value between 0...9 until motion is smooth and all blends are gone.
resize(width,?) # set ? to 576 for PAL output and to 480 for NTSC output

An example for the pack-conversion of PAL-to-NTSC converted video to 25p:

MPEG2source("NTSC.d2v")
yadif(mode=1)
changefps(25*10)
selectevery(10, 6)
bicubicresize(width, 576)

plugh
27th January 2008, 08:01
Interesting approach, but that is not why I went looking for the expression I found.

mpeg2source(...)
bob()
WriteFile("data.log", "current_frame", """ " " """, "YDifferenceFromPrevious()")
writefilestart("data.log",""" "TYPE float" """)

gives me a collection of data. In that data is a 'signal' - a regular repeating occurrance (in this case I'm interested in a 'low' value); the 'period' for this signal is the above expression (I think).

Of course there are plenty of other occurrances of a 'low value' in this data set, and I don't know for sure where the data set begins with respect to the signal. But basically, since I know the signal is present and I know it's relative locations (plug in values for N), I can perform analyses that finds the best correlation in the dataset to the signal and thus synchronize later processing with it.

Anyway, back on topic, it just bugged me that I couldn't figure a way to derive that expression from the parameters, and amazed me that it seemed to generate the correct stream of values...

Perhaps some math guru will comment (or not - no big deal), or perhaps the (non-obvious) expression itself will be of some use to someone else down the road...