[FFmpeg-devel] [PATCH] avfilter/vf_scale: fix interlaced chroma for other formats

Michael Niedermayer michael at niedermayer.cc
Sat Oct 14 02:15:07 EEST 2023


On Sat, Oct 14, 2023 at 01:00:50AM +0200, Niklas Haas wrote:
> On Sat, 14 Oct 2023 00:52:23 +0200 Michael Niedermayer <michael at niedermayer.cc> wrote:
> > On Fri, Oct 13, 2023 at 04:22:05PM +0200, Niklas Haas wrote:
> > > From: Niklas Haas <git at haasn.dev>
> > > 
> > > This logic only covers the case of yuv420p. Extend this logic to cover
> > > *all* vertically subsampled YUV formats, which require the same
> > > interlaced scaling logic.
> > > 
> > > Fortunately, we can get away with re-using the same code for both JPEG
> > > and MPEG range YUV, because the only difference here is the horizontal
> > > alignment. (To be fixed in a separate commit)
> > > ---
> > >  libavfilter/vf_scale.c | 12 +++++++-----
> > >  1 file changed, 7 insertions(+), 5 deletions(-)
> > 
> > the patches from H4JO.txt
> > cause several fate tests to worsen in their stddev. like:
> 
> I investigated these regressions and came to the conclusion that the raw
> input to those tests use mpeg1/jpeg/center-aligned chroma, but the
> rawvideo demuxer does not tag them as such.
> 
> So this change in logic (i.e. treating unspecified yuv as mpeg2/mpeg4
> chroma loc instead of mpeg1/jpeg chroma loc) regresses those tests by
> design.
> 

> A solution would either to continue treating unspecified yuv as
> mpeg1/jpeg chroma loc (status quo), or change the FATE test to
> explicitly mark the rawvideo source as center chroma.

do we even have fate tests for all chroma locs ?
when you are already working on tuning these. Maybe some quick test
could cycle through the cases and test all


> 
> That said, if the status quo for the past decades is to for vf_scale
> treat unspecified chroma loc as center-aligned, I am no longer sure if
> suddenly changing this behavior is a good idea. At the same time, this
> is also terribly inconsistent across implementations. For example, VLC
> treats all chroma as center-aligned (ignoring tags), mpv treats untagged
> *limited range* yuv as mpeg2/left-aligned (and full range as
> mpeg1/jpeg/center), while libplacebo treats all untagged yuv as
> mpeg2/left-aligned. There really is no consistent standard here across
> software, and I haven't even looked at what proprietary players do.

I dont have a good awnser here either. I liked the result you get from
taking the samples in the middle of rectangles and tiling the whole
continuous image with a plane of rectangles for each luma and chroma plane
I felt long ago that was the simplest and most logic way to position
chroma in relation to luma.

but, some chroma loc autodetection filter that uses correlation or such
would be interresting given this mess.

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you fake or manipulate statistics in a paper in physics you will never
get a job again.
If you fake or manipulate statistics in a paper in medicin you will get
a job for life at the pharma industry.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20231014/302a7c4d/attachment.sig>


More information about the ffmpeg-devel mailing list