Closed Bug 1737116 Opened 3 years ago Closed 3 years ago

Consider adding vaapi_h264.c to ffvpx (most Decoded picture buffer patents expire 2023)

Categories

(Core :: Audio/Video: Playback, enhancement, P3)

x86_64
Linux
enhancement

Tracking

()

RESOLVED WONTFIX

People

(Reporter: jan, Unassigned)

References

(Blocks 2 open bugs)

Details

(Keywords: nightly-community)

Is it possible to include h264 hardware decoding without including h264 software decoding?
https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/vaapi_h264.c

H264 patents: https://www.mpegla.com/wp-content/uploads/avc-att1.pdf

  • Graphics cards that offer H264 hw decoding have paid the license fee.
  • Cisco pays the capped license fee for slow openh264 software decoding.
Blocks: media-triage
Severity: -- → N/A
Priority: -- → P3

We can't ship h264 - the problem is that the license fee has to pay who ships is. For instance Fedora provides only dnf repo and openh264 is downloaded from cisco directly by dnf update.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → WONTFIX

(In reply to Martin Stránský [:stransky] (ni? me) from comment #2)

We can't ship h264 - the problem is that the license fee has to pay who ships is.

hardware decoding: The graphics card ships a licensed hardware decoder. Everyone has paid the fee as part of their graphics card.
That's why Firefox can already use H264 hardware decoding on Windows and MacOS without problem.

software decoding: Microsoft ships a licensed software decoder. Linux distributions don't, but Cisco provides openh264 for download.

For instance Fedora provides only dnf repo and

VAAPI driver/API - already required for VP8+VP9:
Fedora doesn't want to install https://packages.debian.org/stable/intel-media-va-driver-non-free because it includes non-free parts for hardware encoding on older Intel chips,
but Fedora could package https://packages.debian.org/stable/intel-media-va-driver to simply talk to the hardware without doing fancy stuff in software:

https://github.com/intel/media-driver/

Media driver supports two build types as below

  • Full Feature Build is default driver build, which supports all feature by hardware accelerator and close source shaders(media kernel binaries). Ubuntu intel-media-va-driver-non-free package is generated from this build type.
  • Free Kernel Build, enables fully open source shaders(media kernels) and hardware features but the features would be limited. Ubuntu intel-media-va-driver package is generated from this build type.
Status: RESOLVED → REOPENED
Resolution: WONTFIX → ---

(In reply to Darkspirit from comment #3)

because it includes non-free parts for hardware encoding on older Intel chips

Well, you do lose compliant film grain synthesis from AV1 decoding.

The video processing pipeline is also stripped of some features on newer chips (de-noise, some color grading, HDR tone mapping) and completely absent on chips older than Ice Lake.

On the encoding side there's lack of MPEG-2 and some HEVC formats. The only encoding missing from some "older" chips (Ice Lake, Kaby Lake, Coffee Lake, Whiskey Lake, Comet Lake and Amber Lake) is VP8, but that was phased out from newer chips for decoding as well.

(In reply to Jan Alexander Steffens [:heftig] from comment #4)
I filed this bug because removal of slow openh264 (I remember it as barely usable) was considered in bug 1737113.

Only relevant for Linux distributions:
The MIT-licensed Intel media driver provides the VAAPI interface to talk to the licensed H264/VP8/VP9/AV1 Intel hardware decoder.
The full variant has additional non-free shaders.
The free variant provides basic/sufficient decoding features. It would be nice if Fedora could install it by default if it doesn't already.

  • Irrelevant: The free variant can't do any encoding on my Macbook Pro (Intel Iris Graphics 6100 (BDW GT3)), but the full (partly-non-free) variant could.
  • Only relevant for bug 1652958: "AV1 film grain kernel is not open source yet which doesn't necessarily match the libaom algorithm or film grain synthesis." Users who need this could install the full (partly-non-free) variant.
  • Irrelevant: MPEG2
  • Irrelevant: VP8 is not used by YouTube anymore, Firefox' internal VP8 software decoder is sufficient on such newer hardware.
  • non-free 10-bit VP9/HEVC tone mapping seems to be an optional feature that must be manually called.
  • Firefox doesn't seem to use the optional VAAPI denoise filter.

I understand you. The question is if Mozilla can ship the vaapi_h264.c file and if that file doesn't violate any h264 patent. For instanace does radeon ship h264 decoder interface in open source drivers?

(let's skip the fact that shipping HW only h264 decoder may be confusing)

  • Vendors need to have a license to sell/provide a h264 decoder to users. If an entity provides/sells a h264 decoder to more than 100,000 users per year, it must pay license fees.
    https://www.mpegla.com/wp-content/uploads/avcweb.pdf#page=10 (for comparison: https://www.mpegla.com/wp-content/uploads/m4vweb.pdf#page=7)

    Includes right to manufacture and sell AVC encoders and decoders with the right of End Users to use them for personal and consumer (including internal business) purposes without remuneration but not for other use

  • On Raspberry Pi, the Video4Linux2 kernel interface is able to talk to the unlocked/licensed h264 hardware decoder.
    Users can additionally buy an MPEG2 or VC1 license key to unlock those hardware decoders as well.
    You give their decoder a stream of h264 and get images via dmabuf back (ffmpeg h264_v4l2m2m). The hardware decoder vendor, Raspberry Pi trading Ltd., has not negotiated with patent holders separately, but uses the MPEG-LA service to get their license. Otherwise they would not be allowed to sell an unlocked h264 hardware decoder to users.

(In reply to Martin Stránský [:stransky] (ni? me) from comment #7)

I understand you. The question is if Mozilla can ship the vaapi_h264.c file and if that file doesn't violate any h264 patent.

  • If a h264 software or hardware decoder is found, Firefox already talks to it:
    • On Windows and Mac, Firefox already puts H264 data into an API that talks to the unlocked/licensed hardware decoder.
      Firefox, Windows and MacOS are not decoding the h264 video, but the unlocked hardware decoder is.
      Microsoft Windows offers fallback to an internal licensed h264 software decoder they provide. One can additionally buy a HEVC software decoder as Windows plugin.
    • If the openh264 software decoder of a Cisco customer is present on Linux, Firefox already uses it.
      Firefox already contains the code to be able to talk to openh264.
    • If FFmpeg (an API bundled with a possibly unlicensed H264 software decoder) is available on Linux, Firefox already uses it (media.ffmpeg.enabled == true).
    • Linux distributions usually can't install an FFmpeg h264 software decoder package by default, Firefox thus can't rely on it.
    • vaapi_h264.c is not a decoder, but talks to the VAAPI API. Firefox contains code that talks to similar APIs on other platforms.

For instanace does radeon ship h264 decoder interface in open source drivers?

  • Yes, H.264/libva-mesa-driver: https://wiki.archlinux.org/title/Hardware_video_acceleration#VA-API_drivers
    https://packages.debian.org/stable/mesa-va-drivers is the VAAPI interface to talk to the unlocked h264 hardware decoder sold as part of AMD Radeon graphics cards.
    You fear that Fedora might become responsible for letting its users talk to their hardware by installing VAAPI drivers?
    Fedora already installs the Radeon VAAPI driver (debian: mesa-va-drivers) by default, but apparently not the free variant of the Intel VAAPI driver (debian: intel-media-va-driver):
    https://mastransky.wordpress.com/2020/06/03/firefox-on-fedora-finally-gets-va-api-on-wayland/

    AMD open source drivers decode video with radeonsi_drv_video.so library which is provided by mesa-dri-drivers package and it comes with Fedora by default.

    Internal hardware and software technologies of graphics cards that provide OpenGL, HDMI, etc. are most likely patent-protected.
    Fedora already provides Mesa to let its users talk to OpenGL/HDMI graphics hardware with internal proprietary firmware and patent-protected hardware.
    Even if Fedora would choose to not install VAAPI drivers (mesa-va-drivers/intel-media-va-driver) by default, users would only need to install the VAAPI driver then.
    At the moment, Firefox users additionally need to install FFmpeg - which contains unneeded parts like a probably unlicensed h264 software decoder - to be able to talk to the VAAPI driver (mesa-va-drivers/intel-media-va-driver) to talk to the h264 hardware decoder inside the graphics card.

  • The interesting question is if Intel and AMD are licensed to sell an h264 hardware decoder to users or if they might violate patent rights. If they are not licensed, they must have some kind of non-disclosure agreement of h264 hardware decoder technology with their distributors, so that those are obliged to be licensed before publishing/selling an unlocked h264 hardware decoder to users. If they have such a legal construct, then it might even be that each online or retail shop that sells this hardware decoder to users might be the one who needs to pay the license fee because it publishes the unlocked/unrestricted patent-protected technology to a user. Then it would already affect Linux laptop makers with their own online shop.

(In reply to Darkspirit from comment #9)

...

I think the best would be to talk to some Mozilla legal team (assuming there's one). We'd need their ack anyway (or from some other official Mozilla devs).

(In reply to Martin Stránský [:stransky] (ni? me) from comment #7)

<...> The question is if Mozilla can ship the vaapi_h264.c file and if that file doesn't violate any h264 patent. <...>

Any software that uses VA-API for H.264 decoding, have to manage Decoded Picture Buffer, as VA-API expects already sorted lists of reference frames. There is at least one active patent, US7206347, which mentions DPB.

Here is a cross-chart from MPEGLA regarding H.264 patent pool: https://www.mpegla.com/wp-content/uploads/avcCrossRefChart.pdf which you may find interesting.

No longer blocks: media-triage
Status: REOPENED → RESOLVED
Closed: 3 years ago3 years ago
Resolution: --- → WONTFIX
Summary: Consider adding vaapi_h264.c to ffvpx → Consider adding vaapi_h264.c to ffvpx (Decoded picture buffer patent US7206347 expires 2023-07-07)

I took all "Decoded picture buffer" patents from https://www.mpegla.com/wp-content/uploads/avcCrossRefChart.pdf,
sorted by them patent holder (https://www.mpegla.com/wp-content/uploads/avc-att1.pdf),
grouped EP patents and added expiration dates where possible (https://patents.google.com).
I haven't grouped patent families (that's when patents have the same content).

US+EU patents seem to have a maximum lifetime of 20 years.

Patent no. Description patent holder Anticipated expiration
EP 1,742,479 = BE,CH,DK,ES,FR,GB,IT,LI,NL,PT,SI, DE 60329427.8, ES 2,317,444 Decoded picture buffer Panasonic Corporation 2023-07-07
EP 1,742,480 = BE,CH,CZ,FI,FR,GB,HU,LI,NL,RO,SE, AT 413,067 , DE 60324480.7, ES 2,420,583 Decoded picture buffer Panasonic Corporation 2023-07-07
EP 2,278,816 = BE,CH,DK,FI,FR,GB,LI,NL,PT,SE, AT E 609,216, DE 60343922.5 Decoded picture buffer Panasonic Corporation 2023-07-07
GR 3,067,753 Decoded picture buffer Panasonic Corporation
IT 25962/BE/2013 Decoded picture buffer Panasonic Corporation
IT MI2009B019817 Decoded picture buffer Panasonic Corporation
JP 4,562,999 Decoded picture buffer Panasonic Corporation 2023-06-17
JP 4,651,685 Decoded picture buffer Panasonic Corporation 2028-02-20
JP 4,914,459 Decoded picture buffer Panasonic Corporation 2023-06-17
JP 4,914,515 Decoded picture buffer Panasonic Corporation 2023-06-17
JP 5,037,657 Decoded picture buffer Panasonic Corporation 2023-06-17
JP 5,412,538 Decoded picture buffer Panasonic Corporation 2023-06-17
JP 5,602,294 Decoded picture buffer Panasonic Corporation 2023-06-17
JP 5,647,718 Decoded picture buffer Panasonic Corporation 2023-06-17
JP 5,647,719 Decoded picture buffer Panasonic Corporation 2023-06-17
KR 959,969 Decoded picture buffer Panasonic Corporation
KR 961,036 Decoded picture buffer Panasonic Corporation
KR 961,037 Decoded picture buffer Panasonic Corporation
TR 200808725 Decoded picture buffer Panasonic Corporation
US 7,206,347 Decoded picture buffer Panasonic Corporation 2023-07-07
US 7,782,936 Decoded picture buffer Panasonic Corporation 2025-01-26
US 7,995,658 Decoded picture buffer Panasonic Corporation 2026-12-04
US 8,189,680 Decoded picture buffer Panasonic Corporation 2026-10-28
US 8,660,192 Decoded picture buffer Panasonic Corporation 2023-07-25
US 9,088,781 Decoded picture buffer Panasonic Corporation 2023-07-07
US 9,088,782 Decoded picture buffer Panasonic Corporation 2023-07-07
US 9,088,783 Decoded picture buffer Panasonic Corporation 2023-07-07
US 9,094,666 Decoded picture buffer Panasonic Corporation 2023-07-07
US 9,390,512 Decoded picture buffer Panasonic Corporation 2023-07-07
US 9,412,177 Decoded picture buffer Panasonic Corporation 2023-07-07
EP 2,268,035 = AT,BE,CH,CZ,DK,EE,ES,FI,FR,GB,GR,IE,IT,LI,LU,MC,NL,PT,SE,TR, DE 603 50 172.9 Decoded picture buffer NTT DOCOMO, INC. 2023-09-26
EP 2,271,114 = AT,BE,CZ,DK,EE,ES,FI,FR,GB,GR,IE,IT,MC,NL,PT,SE,TR, DE 603 49 864.7 Decoded picture buffer NTT DOCOMO, INC. 2023-09-22
EP 1,408,698 = BE,EE,ES,FR,GB,IT,PT,SE,TR, DE 603 49 302.5 Decoded picture buffer NTT DOCOMO, INC. 2023-09-22
EP 2,268,037 = BE,CH,CZ,ES,FR,GB,IT,LI,NL,NO,PL,PT,RO,SE,SK,TR Decoded picture buffer NTT DOCOMO, INC. 2023-09-22
EP 3,200,462 = BE,CH,CZ,ES,FR,GB,IT,LI,NL,NO,PL,PT,RO,SE,SK,TR, DE 603 51 267.4 Decoded picture buffer NTT DOCOMO, INC. 2023-09-26
EP 3,355,584 = BE,CH,CZ,ES,FR,GB,IT,LI,NL,PT,RO,SE,SK,TR, DE 603 51 990.3 Decoded picture buffer NTT DOCOMO, INC. 2023-09-26
EP 2,268,036 = EE,ES,FI,FR,GB,IT,SE,TR, DE 603 47 079.3 Decoded picture buffer NTT DOCOMO, INC. 2023-09-26
US 7,346,216 Decoded picture buffer NTT DOCOMO, INC. 2025-10-09
US 7,596,178 Decoded picture buffer NTT DOCOMO, INC. 2027-01-29
US 8,842,728 Decoded picture buffer NTT DOCOMO, INC. 2023-09-29
US 9,686,563 Decoded picture buffer NTT DOCOMO, INC. 2023-09-10
US 9,826,228 Decoded picture buffer NTT DOCOMO, INC. 2023-09-29
US 10,009,627 Decoded picture buffer NTT DOCOMO, INC. 2023-09-10
JP 4,859,936 Decoded picture buffer Godo Kaisha IP Bridge1 2023-01-31
KR 943,563 Decoded picture buffer Godo Kaisha IP Bridge1
KR 950,388 Decoded picture buffer Godo Kaisha IP Bridge1
US 7,760,803 Decoded picture buffer Godo Kaisha IP Bridge1 2026-09-08
US 8,139,637 Decoded picture buffer Godo Kaisha IP Bridge1 2023-07-15
US 8,989,264 Decoded picture buffer Godo Kaisha IP Bridge1 2025-01-16
US 9,001,891 Decoded picture buffer Godo Kaisha IP Bridge1 2025-01-04
US 9,398,305 Decoded picture buffer Godo Kaisha IP Bridge1 2023-07-15
US 9,402,081 Decoded picture buffer Godo Kaisha IP Bridge1 2023-07-15
US 9,473,781 Decoded picture buffer Godo Kaisha IP Bridge1 2023-08-20
US 9,479,790 Decoded picture buffer Godo Kaisha IP Bridge1 2023-09-05
US 9,906,806 Decoded picture buffer Godo Kaisha IP Bridge1 2023-07-15
US 9,942,561 Decoded picture buffer Godo Kaisha IP Bridge1 2023-09-26
US 10,230,971 Decoded picture buffer Godo Kaisha IP Bridge1 2023-07-15
CH 1,209,915 NAL unit, Decoded picture buffer The Trustees of Columbia University in the City of New York Expired Feb 13, 2018
FI 1,209,915 NAL unit, Decoded picture buffer The Trustees of Columbia University in the City of New York Expired Feb 13, 2018
FR 1,209,915 NAL unit, Decoded picture buffer The Trustees of Columbia University in the City of New York Expired Feb 13, 2018
GB 1,209,915 NAL unit, Decoded picture buffer The Trustees of Columbia University in the City of New York Expired Feb 13, 2018
IT 1,209,915 NAL unit, Decoded picture buffer The Trustees of Columbia University in the City of New York Expired Feb 13, 2018
LI 1,209,915 NAL unit, Decoded picture buffer The Trustees of Columbia University in the City of New York Expired Feb 13, 2018
SE 1,209,915 NAL unit, Decoded picture buffer The Trustees of Columbia University in the City of New York Expired Feb 13, 2018
DE 69835039.1 NAL unit, Decoded picture buffer The Trustees of Columbia University in the City of New York Expired Feb 13, 2018
ES 2266396 NAL unit, Decoded picture buffer The Trustees of Columbia University in the City of New York Expired Feb 13, 2018
Summary: Consider adding vaapi_h264.c to ffvpx (Decoded picture buffer patent US7206347 expires 2023-07-07) → Consider adding vaapi_h264.c to ffvpx (most Decoded picture buffer patents expire 2023)

Thanks Jan, so looks like we have to wait to 2028-02-20, right?

(In reply to Darkspirit from comment #13)

I took all "Decoded picture buffer" patents <...>

If there is a legal team at Mozilla, please go ask them instead. Discussing patent applicability details in public may be harmful.

Summary of the bugreport is highly misleading. In its current form it strongly implies that DPB is the only affected aspect of H.264, which may not be the case.

You need to log in before you can comment on or make changes to this bug.