[FFmpeg-user] Rewriting 'fieldmatch' using the State Machine Method

Rob Hallam ffmpeg at roberthallam.com
Thu Jun 12 00:30:52 EEST 2025


(another off-list reply, redirecting back to list- all included below
for context)

On Wed, 11 Jun 2025 at 20:59, Mark Filipak <markfilipak.imdb at gmail.com> wrote:
>
> On 11/06/2025 14.57, Rob Hallam wrote:
> > On Wed, 11 Jun 2025 at 19:35, Mark Filipak <markfilipak.imdb at gmail.com> wrote:
> >> On 11/06/2025 14.08, Rob Hallam wrote:
> >>> Bearing in mind the audience: what can we concretely do, in your view?
> >>
> >> Help me with 'C'. Conduct design reviews of what I write.
> >
> > I see from your other reply; interesting. What is the objective of
> > that rewrite? ...
>
> I live in the USA, so a lot of my DVDs are 'NTSC'. Deteleince is important of course.
> 'fieldmatch,yadif,decimate' is the preferred method. Over the last few years, several people have
> reported trouble with fieldmatch. I've never had problems. But I have seen professionally mastered
> DVDs that had bad tail- _and_ head-cuts at splices. I know that players have code to work past that
> (or they drop frames). FFmpeg shouldn't break on such things, but it does.
>
> FFmpeg should never drop frames or duplicate frames, but it does.
>
> I looked at fieldmatch.c and didn't like what I saw.
>
> There are 4 cases of good telecines: 2:3:2:3 v 2"3"3"2 and tff v bff. There are 112 cases of bad
> telecines. I want to rewrite fieldmatch to cover all 116 cases. I also want to create a good example
> of state machine design in software. I know it. My programmers have done it. I think it would profit
> the FFmpeg project. A successful example goes a long way toward winning hearts and minds.
>
> Look, let me be frank with you. The FOSS codesmiths I've seen wouldn't make it in industry -- you
> know, refrigerators, microwave ovens, nuclear weapons. They'd start their trail-n-error programming
> and get tossed out on their keisters. I want to show them a better way, a provably correct way, by
> example, not by preaching. Plus, I want to have a reliable fieldmatch.
>
> >... Not that it needs one, it's fine to do things for fun or
> > as a learning exercise.
>
> I'm already having way too much fun. I do need some learning, though.
>

Genuine suggestion given all of the above:

There is a free course on embedded systems design which includes a C
component [0]. Given your background you can take as read the
microcontroller parts and will have no need to review the FSM bit, but
those will contextualise the accompanying C for you.

> I want to show them a better way, (...) not by preaching

Yet you prefixed it with sanctimonious swipes again. Since you must be
aware there are rather a lot of programmers in industry -- FOSS or
otherwise, working with embedded devices or otherwise -- this appears
deliberately provocative; and I cannot reconcile doing that while in
the same breath asking the same people to be your personal C tutor.
Perhaps reflect on that.

Cheers,
Rob

[0]: https://www.edx.org/learn/embedded-systems/the-university-of-texas-at-austin-embedded-systems-shape-the-world-microcontroller-input-output


More information about the ffmpeg-user mailing list