Filter for detecting field type 

Newsgroups: gmane.comp.video.transcode.devel
Date: 2004-08-09

Hi folks!

I have another patch for you that adds a filter for detecting the field type of potentially interlaced video. Some of its parameters may need a little tweaking, and of course it cannot determine the field type on static scenes. It also is not extremely fast, but it is fast enough for me :-P .

There has been the filter 32detect (which is an odd name as it only detects interlaced video as well), but my analysis filter knows of more different field types and seems to have more stable algorithms. It also detects field shifted progressive video, though it currently identifies too many frames as shifted-progressive for truly interlaced video.

Due to the past issues with *_memcpy, I stick to libc memcpy right now, but there is already plenty of #if 0/#endif 'd code in there, if somebody has the nerve to test this with different architectures.

An example output looks as following:

# transcode -V -i Rammstein_Engel.mpv -J fieldanalysis -c 200-1000
[...]
[filter_fieldanalysis.so] v1.0 (2004-08-09) Field analysis for detecting interlace and telecine
[filter_fieldanalysis.so] interlacediff 1.10,  unknowndiff 1.50, progressivediff 8.00
[filter_fieldanalysis.so] progressivechange 0.20, changedifmore 10.00
[filter_fieldanalysis.so] forcetelecinedetect False, verbose 0, outdiff 0
[...]
encoding frame [999],  70.21 fps, 100.0%, ETA: 0:00:00, ( 0| 0| 0)
[filter_fieldanalysis.so] RESULTS: Frames:      800 (100%)  Unknown:      398 (49.8%)
[filter_fieldanalysis.so] RESULTS: Progressive: 399 (49.9%)  Interlaced:   2 (0.25%)
[filter_fieldanalysis.so] RESULTS: FieldShift:  0 (0%)  Telecined:    0 (0%)
[filter_fieldanalysis.so] RESULTS: MajorField: TopFirst 2 (100%)  BottomFirst 0 (0%)
lter_fieldanalysis.so] CONCLUSION: progressive video.
With verbose=1 the filter tells you what he thinks about the individual
frames (more info about the shortcuts in the help section):
[filter_fieldanalysis.so] frame 331: low change       [         stsb]
[filter_fieldanalysis.so] frame 332: interlaced   T   [       t     ]
[filter_fieldanalysis.so] frame 333: unknown          [ptPb c t     ]
[filter_fieldanalysis.so] frame 334: interlaced   T   [  pb   t     ]
[filter_fieldanalysis.so] frame 335: unknown          [             ]
[filter_fieldanalysis.so] frame 336: unknown          [             ]
[filter_fieldanalysis.so] frame 337: unknown          [             ]
[filter_fieldanalysis.so] frame 338: unknown          [             ]
[filter_fieldanalysis.so] frame 339: unknown          [ptpb         ]
[filter_fieldanalysis.so] frame 340: progressive      [PtPb c       ]
[filter_fieldanalysis.so] frame 341: progressive      [PtPb c       ]
[filter_fieldanalysis.so] frame 342: progressive      [PtPb c       ]

Hoping that this is as usefull to others as it is to me :^)

Matthias Hopf