mbox series

[FFmpeg-devel,v2,00/15] YUV colorspace filter negotiation

Message ID 20231213131536.10242-1-ffmpeg@haasn.xyz
Headers show
Series YUV colorspace filter negotiation | expand

Message

Niklas Haas Dec. 13, 2023, 1:11 p.m. UTC
Split off from my YUVJ removal series. This implements all of the
libavfilter changes needed to fully deprecate YUVJ, but does not yet
remove YUVJ, nor add an AVCodec API for advertising colorspace support.

Update includes all of the feedback that was brought up by Anton. the
major change from v1 is that YUV metadata configured on a link is no
longer strictly required to be consistent with the frames, simply to
avoid breaking users that don't set this link metadata. Effectively,
this allows us to have a grace period where the field functions more
like a hint than an authoritative field.

Comments

Niklas Haas Dec. 24, 2023, 6:35 p.m. UTC | #1
On Wed, 13 Dec 2023 14:11:57 +0100 Niklas Haas <ffmpeg@haasn.xyz> wrote:
> Split off from my YUVJ removal series. This implements all of the
> libavfilter changes needed to fully deprecate YUVJ, but does not yet
> remove YUVJ, nor add an AVCodec API for advertising colorspace support.
> 
> Update includes all of the feedback that was brought up by Anton. the
> major change from v1 is that YUV metadata configured on a link is no
> longer strictly required to be consistent with the frames, simply to
> avoid breaking users that don't set this link metadata. Effectively,
> this allows us to have a grace period where the field functions more
> like a hint than an authoritative field.

Ping, any further feedback? If not, I will merge this sometime after Christmas.
Niklas Haas Dec. 31, 2023, 9:50 p.m. UTC | #2
On Sun, 24 Dec 2023 10:35:22 -0800 Niklas Haas <ffmpeg@haasn.xyz> wrote:
> On Wed, 13 Dec 2023 14:11:57 +0100 Niklas Haas <ffmpeg@haasn.xyz> wrote:
> > Split off from my YUVJ removal series. This implements all of the
> > libavfilter changes needed to fully deprecate YUVJ, but does not yet
> > remove YUVJ, nor add an AVCodec API for advertising colorspace support.
> > 
> > Update includes all of the feedback that was brought up by Anton. the
> > major change from v1 is that YUV metadata configured on a link is no
> > longer strictly required to be consistent with the frames, simply to
> > avoid breaking users that don't set this link metadata. Effectively,
> > this allows us to have a grace period where the field functions more
> > like a hint than an authoritative field.
> 
> Ping, any further feedback? If not, I will merge this sometime after Christmas.

Merged as 1b0ca477..44a33fccd
Segall, Andrew via ffmpeg-devel Jan. 4, 2024, 7:32 p.m. UTC | #3
[AMD Official Use Only - General]

I found out this change caused page fault as well.
--------
8c7934f73ab6c568acaa47c821a6833f9145fdbb is the first bad commit
commit 8c7934f73ab6c568acaa47c821a6833f9145fdbb
Author: Niklas Haas <git@haasn.dev>
Date:   Sun Dec 31 13:35:03 2023 -0800

    avfilter: add negotiation API for color space/range

    Motivated by YUVJ removal. This change will allow full negotiation
    between color ranges and matrices as needed. By default, all ranges and
    matrices are marked as supported.

    Because grayscale formats are currently handled very inconsistently (and
    in particular, assumed as forced full-range by swscale), we exclude them
    from negotiation altogether for the time being, to get this API merged.

    After filter negotiation is available, we can relax the
    grayscale-is-forced-jpeg restriction again, when it will be more
    feasible to do so without breaking a million test cases.

    Note that this commit updates one FATE test as a consequence of the
    sanity fallback for non-YUV formats. In particular, the test case now
    writes rgb24(pc, gbr/unspecified/unspecified) to the matroska file,
    instead of rgb24(unspecified/unspecified/unspecified) as before.

 doc/APIchanges              |   3 +
 libavfilter/avfilter.c      |  17 ++++-
 libavfilter/avfilter.h      |  28 +++++++
 libavfilter/avfiltergraph.c | 173 +++++++++++++++++++++++++++++++++++++++++++-
 libavfilter/formats.c       | 121 +++++++++++++++++++++++++++++++
 libavfilter/formats.h       |  54 ++++++++++++++
 libavfilter/internal.h      |   6 ++
 libavfilter/vaapi_vpp.c     |   4 +
 libavfilter/version.h       |   4 +-
 libavfilter/video.c         |   2 +
 tests/ref/fate/shortest-sub |   4 +-
 11 files changed, 406 insertions(+), 10 deletions(-)


ffmpeg -v trace -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -i ./example_720p30.y4m -vf 'format=nv12|vaapi, hwupload' -c:v h264_vaapi ./out_720p30.264 -y

Successfully opened the file.
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (h264_vaapi))
[vost#0:0/h264_vaapi @ 0x55a86a145c70] Starting thread...
[vf#0:0 @ 0x55a86a104290] Starting thread...
[vist#0:0/rawvideo @ 0x55a86a105cc0] Starting thread...
[in#0/yuv4mpegpipe @ 0x55a86a11d250] Starting thread...
Press [q] to stop, [?] for help
[rawvideo @ 0x55a86a144d40] PACKET SIZE: 1382400, STRIDE: 1920
[AVFilterGraph @ 0x7fa5e0000ff0] Setting 'pix_fmts' to value 'nv12|vaapi'
detected 24 logical cores
[graph 0 input from stream 0:0 @ 0x7fa5e0003ab0] Setting 'video_size' to value '1280x720'
[graph 0 input from stream 0:0 @ 0x7fa5e0003ab0] Setting 'pix_fmt' to value '0'
[graph 0 input from stream 0:0 @ 0x7fa5e0003ab0] Setting 'time_base' to value '1/30'
[graph 0 input from stream 0:0 @ 0x7fa5e0003ab0] Setting 'pixel_aspect' to value '0/1'
[graph 0 input from stream 0:0 @ 0x7fa5e0003ab0] Setting 'colorspace' to value 'unknown'
[graph 0 input from stream 0:0 @ 0x7fa5e0003ab0] Setting 'range' to value 'unknown'
[graph 0 input from stream 0:0 @ 0x7fa5e0003ab0] Setting 'frame_rate' to value '30/1'
[rawvideo @ 0x55a86a144d40] PACKET SIZE: 1382400, STRIDE: 1920
[graph 0 input from stream 0:0 @ 0x7fa5e0003ab0] w:1280 h:720 pixfmt:yuv420p tb:1/30 fr:30/1 sar:0/1 csp:unknown range:unknown
[format @ 0x7fa5e0004390] Setting 'pix_fmts' to value 'vaapi'
[auto_scale_0 @ 0x7fa5e00055d0] w:iw h:ih flags:'' interl:0
[Parsed_format_0 @ 0x7fa5e0003450] auto-inserting filter 'auto_scale_0' between the filter 'graph 0 input from stream 0:0' and the filter 'Parsed_format_0'
[AVFilterGraph @ 0x7fa5e0000ff0] query_formats: 5 queried, 9 merged, 3 already done, 0 delayed
Segmentation fault (core dumped)
--------


-----Original Message-----
From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Niklas Haas
Sent: Sunday, December 31, 2023 4:51 PM
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH v2 00/15] YUV colorspace filter negotiation

On Sun, 24 Dec 2023 10:35:22 -0800 Niklas Haas <ffmpeg@haasn.xyz> wrote:
> On Wed, 13 Dec 2023 14:11:57 +0100 Niklas Haas <ffmpeg@haasn.xyz> wrote:
> > Split off from my YUVJ removal series. This implements all of the
> > libavfilter changes needed to fully deprecate YUVJ, but does not yet
> > remove YUVJ, nor add an AVCodec API for advertising colorspace support.
> >
> > Update includes all of the feedback that was brought up by Anton.
> > the major change from v1 is that YUV metadata configured on a link
> > is no longer strictly required to be consistent with the frames,
> > simply to avoid breaking users that don't set this link metadata.
> > Effectively, this allows us to have a grace period where the field
> > functions more like a hint than an authoritative field.
>
> Ping, any further feedback? If not, I will merge this sometime after Christmas.

Merged as 1b0ca477..44a33fccd