Closed Bug 1841624 Opened 3 years ago Closed 3 years ago

Update dav1d to new version 616bfd1506a8a75c6a358e578cbec9ca11931502 from 2023-07-01 11:36:39

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
117 Branch
Tracking Status
firefox117 --- fixed

People

(Reporter: update-bot, Assigned: chunmin)

Details

(Whiteboard: [3pl-filed][task_id: EJstw2wPToOHW-S2zNPx5w])

Attachments

(1 file)

This update covers 24 commits.. Here are the overall diff statistics, and then the commit information.


media/libdav1d/moz.yaml | 4 +-
media/libdav1d/vcs_version.h | 2 +-
media/libdav1d/version.h | 4 +-
third_party/dav1d/include/common/validate.h | 14 +-
third_party/dav1d/include/dav1d/dav1d.h | 9 +
third_party/dav1d/include/dav1d/headers.h | 239 ++--
third_party/dav1d/include/dav1d/picture.h | 2 +-
third_party/dav1d/include/dav1d/version.h.in | 8 +
third_party/dav1d/meson.build | 14 +-
third_party/dav1d/src/arm/32/refmvs.S | 206 ++++
third_party/dav1d/src/arm/64/looprestoration.S | 379 +++----
third_party/dav1d/src/arm/64/looprestoration16.S | 565 +++++------
third_party/dav1d/src/arm/64/looprestoration_common.S | 590 ++++-------
third_party/dav1d/src/arm/64/looprestoration_tmpl.S | 690 ++++++++-----
third_party/dav1d/src/arm/64/refmvs.S | 201 ++++
third_party/dav1d/src/arm/looprestoration.h | 848 ++++++++++++++++++
third_party/dav1d/src/arm/refmvs.h | 2 +
third_party/dav1d/src/data.c | 15 +-
third_party/dav1d/src/decode.c | 71 +-
third_party/dav1d/src/lib.c | 71 +-
third_party/dav1d/src/log.c | 2 +-
third_party/dav1d/src/mem.c | 217 ++++-
third_party/dav1d/src/mem.h | 86 +-
third_party/dav1d/src/obu.c | 27 +-
third_party/dav1d/src/picture.c | 22 +-
third_party/dav1d/src/ref.c | 6 +-
third_party/dav1d/src/ref.h | 6 +-
third_party/dav1d/src/refmvs.c | 4 +-
third_party/dav1d/src/thread.h | 1 +
third_party/dav1d/src/thread_task.c | 8 +-
third_party/dav1d/src/x86/refmvs.asm | 224 ++++
third_party/dav1d/src/x86/refmvs.h | 5 +
third_party/dav1d/tests/checkasm/refmvs.c | 185 +++
33 files changed, 3304 insertions(+), 1423 deletions(-)


616bfd1506a8a75c6a358e578cbec9ca11931502 by Martin Storsjö

https://code.videolan.org/videolan/dav1d/commit/616bfd1506a8a75c6a358e578cbec9ca11931502
Authored: 2023-07-01 11:36:39 +0300
Committed: 2023-07-01 11:36:39 +0300

arm32: refmvs: Fix building with MS armasm

Add an explicit align before the jump table; this avoids armasm bugs
in how label differences are calculated. This matches how all other
jump tables are written in our 32 bit arm assembly.

Files Modified:

  • src/arm/32/refmvs.S

a500abb75002f913d604f1d36a2bd302ed7cd824 by Victorien Le Couviour--Tuffet

https://code.videolan.org/videolan/dav1d/commit/a500abb75002f913d604f1d36a2bd302ed7cd824
Authored: 2023-06-05 12:30:20 +0200
Committed: 2023-06-30 21:34:31 +0200

x86: Add refmvs.load_tmvs asm

Files Modified:

  • src/x86/refmvs.asm
  • src/x86/refmvs.h
  • tests/checkasm/refmvs.c

b33d77f90347d66edd6823ef2dc52e7b3e05ef83 by Martin Storsjö

https://code.videolan.org/videolan/dav1d/commit/b33d77f90347d66edd6823ef2dc52e7b3e05ef83
Authored: 2023-06-29 00:10:32 +0300
Committed: 2023-06-30 11:44:17 +0300

arm32: refmvs: Add NEON implementation of save_tmvs

Relative speedup compared to C:
Cortex A7 A8 A9 A53 A72 A73
save_tmvs_neon: 1.20 1.42 1.25 1.58 1.26 1.99

Files Modified:

  • src/arm/32/refmvs.S
  • src/arm/refmvs.h

a1d7763f7bd1ec98e7f52f35055cf293c7cb72d0 by Martin Storsjö

https://code.videolan.org/videolan/dav1d/commit/a1d7763f7bd1ec98e7f52f35055cf293c7cb72d0
Authored: 2023-06-30 09:27:54 +0300
Committed: 2023-06-30 11:42:33 +0300

arm64: refmvs: Use addp instead of trn2+add

Also improve scheduling in the prologue and fix a few cases of
inconsistent indentation.

Before: Cortex A53 A55 A72 A73 A76 Apple M1
save_tmvs_neon: 73657.2 74470.9 72238.1 56095.4 34135.7 207.9
After:
save_tmvs_neon: 72187.2 74434.6 71068.9 56043.9 33237.4 201.0

(The changes to the M1 numbers are mostly measurement noise though.)

Files Modified:

  • src/arm/64/refmvs.S

189d47c2fa2bcb0ea7bc18c8e3f0e6cbaa1cea14 by Martin Storsjö

https://code.videolan.org/videolan/dav1d/commit/189d47c2fa2bcb0ea7bc18c8e3f0e6cbaa1cea14
Authored: 2023-06-28 15:37:09 +0300
Committed: 2023-06-28 15:37:09 +0300

arm64: refmvs: Fix building with MSVC

Binutils and LLVM assemblers can infer that this str instruction must
be stur (and implicitly assemble it into that instruction), while MS
armasm64 errored out with this message:

src\libdav1d.a.p\refmvs.obj.asm(673) : error A2518: operand 2: Memory offset must be aligned
str q2, [x3, #(8*5-16)]

Files Modified:

  • src/arm/64/refmvs.S

c39779f4740724dd20b590c69d98e744d5c2d56f by Martin Storsjö

https://code.videolan.org/videolan/dav1d/commit/c39779f4740724dd20b590c69d98e744d5c2d56f
Authored: 2023-06-22 23:09:06 +0300
Committed: 2023-06-27 00:10:21 +0300

arm64: refmvs: Process two blocks at a time in save_tmvs

Before: Cortex A53 A55 A72 A73 A76 Apple M1
save_tmvs_neon: 79184.7 79889.9 54720.2 54522.6 29919.6 216.4
After:
save_tmvs_neon: 73780.0 74339.2 70414.1 59102.0 35028.4 213.9

The benefit from this is marginal on Cortex A53 and A55, and Apple
M1, while this change actually makes the code notably slower on
Cortex A72, A73 and A76.

Files Modified:

  • src/arm/64/refmvs.S

6aa37aec8f309aaae3f0a41dd7a3b667d3072945 by Martin Storsjö

https://code.videolan.org/videolan/dav1d/commit/6aa37aec8f309aaae3f0a41dd7a3b667d3072945
Authored: 2023-06-22 13:54:42 +0300
Committed: 2023-06-27 00:10:21 +0300

arm64: refmvs: Add NEON implementation of save_tmvs

           Cortex A53       A55      A72      A73      A76  Apple M1

save_tmvs_c: 116768.4 122653.1 82587.7 90445.0 45386.8 242.1
save_tmvs_neon: 79184.7 79889.9 54720.2 54522.6 29919.6 216.4

Relative speedup compared with C:
Cortex A53 A55 A72 A73 A76 Apple M1
save_tmvs_neon: 1.47 1.54 1.51 1.66 1.52 1.12

Files Modified:

  • src/arm/64/refmvs.S
  • src/arm/refmvs.h

c121b831e251d185b1f9829efb6ba5c68fdc9567 by Martin Storsjö

https://code.videolan.org/videolan/dav1d/commit/c121b831e251d185b1f9829efb6ba5c68fdc9567
Authored: 2023-06-07 15:31:36 +0300
Committed: 2023-06-22 13:57:17 +0300

arm64: looprestoration: Rewrite the SGR functions

Make them operate in a more cache friendly manner, interleaving the
various passes, and merging some of the functions that operate on
data in similar patterns.

This reduces the amount of stack used from 207 KB to 14 KB for sgr_3x3,
from 207 KB to 16 KB for sgr_5x5 and from 255 KB to 33 KB for sgr_mix.

This does however increase the size of the binary by about 12 KB. (The
executable code generated from assembly actually shrinks by a little,
but the higher level logic in C is quite nontrivial.)

This is somewhat similar to what was done for x86 in
fe2bb774243bc734f39d94d2519e23c1eabb7b35.

Benchmarks from checkasm:

Before: Cortex A53 A55 A72 A73 A76 Apple M1
sgr_3x3_8bpc_neon: 493005.0 483133.2 365056.3 345197.9 202819.1 537.3
sgr_5x5_8bpc_neon: 353152.6 349614.3 268962.2 248431.8 142302.4 385.9
sgr_mix_8bpc_neon: 829903.9 815910.9 622858.5 577238.0 333362.9 881.7
sgr_3x3_10bpc_neon: 504778.6 499851.6 379203.1 346695.2 199738.7 537.0
sgr_5x5_10bpc_neon: 363111.9 362489.7 267903.1 247506.5 138417.2 351.3
sgr_mix_10bpc_neon: 853053.7 846768.8 628349.6 584553.8 328399.5 843.6

After:
sgr_3x3_8bpc_neon: 387949.9 384216.4 294423.7 301968.2 184643.1 492.4
sgr_5x5_8bpc_neon: 259854.7 257233.2 193983.7 198388.4 128497.0 341.2
sgr_mix_8bpc_neon: 606401.5 595661.3 457209.7 462721.8 281906.7 738.6
sgr_3x3_10bpc_neon: 392472.7 394100.5 296048.1 304339.4 184271.4 471.3
sgr_5x5_10bpc_neon: 257248.3 257651.1 197552.5 199655.1 130739.7 322.9
sgr_mix_10bpc_neon: 605263.3 611197.4 441789.3 461339.2 286320.1 721.4

Speedup vs before:
27-41% 25-40% 23-42% 13-26% 5-18% 8-19%

Files Modified:

  • src/arm/64/looprestoration.S
  • src/arm/64/looprestoration16.S
  • src/arm/64/looprestoration_common.S
  • src/arm/64/looprestoration_tmpl.S
  • src/arm/looprestoration.h

3c2f2087d81a19b4ea15bc9dcad11b8a7c4e4d20 by Martin Storsjö

https://code.videolan.org/videolan/dav1d/commit/3c2f2087d81a19b4ea15bc9dcad11b8a7c4e4d20
Authored: 2023-06-19 14:02:33 +0300
Committed: 2023-06-22 11:03:35 +0300

arm64: looprestoration: Properly use 32 bit registers for 32 bit parameters

This issue isn't caught by checkasm, since these functions are
internal to the SGR implementation, and checkasm only affects
the parameters on the external DSP function interface.

This could potentially trigger errors with future compilers.

Files Modified:

  • src/arm/64/looprestoration_common.S
  • src/arm/64/looprestoration_tmpl.S

2373fda303d46489c1ec269dc66369a31663cb25 by James Almer

https://code.videolan.org/videolan/dav1d/commit/2373fda303d46489c1ec269dc66369a31663cb25
Authored: 2023-06-08 23:40:02 -0300
Committed: 2023-06-12 12:22:54 -0300

tools/dav1d: use the new version macros

Signed-off-by: James Almer <jamrial@gmail.com>

Files Modified:

  • tools/dav1d.c

ccb88afa858afb65a4fd7a9b39bca0c02cf8a768 by James Almer

https://code.videolan.org/videolan/dav1d/commit/ccb88afa858afb65a4fd7a9b39bca0c02cf8a768
Authored: 2023-06-08 23:37:43 -0300
Committed: 2023-06-12 12:22:29 -0300

version.h: add macros to extract version components

Signed-off-by: James Almer <jamrial@gmail.com>

Files Modified:

  • include/dav1d/dav1d.h
  • include/dav1d/version.h.in

fd1a5836450d486b8331bde2d32c6e74c5ebd365 by James Almer

https://code.videolan.org/videolan/dav1d/commit/fd1a5836450d486b8331bde2d32c6e74c5ebd365
Authored: 2023-06-08 23:24:47 -0300
Committed: 2023-06-08 23:25:38 -0300

log: replace validate_input() with assert()

Missed in 31de9d5093500cda8e355003ade780a1a11bd06e.

Files Modified:

  • src/log.c

31de9d5093500cda8e355003ade780a1a11bd06e by Henrik Gramner

https://code.videolan.org/videolan/dav1d/commit/31de9d5093500cda8e355003ade780a1a11bd06e
Authored: 2023-06-07 13:35:07 +0200
Committed: 2023-06-07 13:35:07 +0200

Replace validate_input() with assert() in internal functions

Always-enabled basic sanity checks in API functions is reasonable,
but within internal functions assert() is more appropriate when
it comes to checking for "should never happen" conditions.

Files Modified:

  • src/data.c
  • src/picture.c

47e2e672d15bff861f8590f90249a51c928e57f0 by Henrik Gramner

https://code.videolan.org/videolan/dav1d/commit/47e2e672d15bff861f8590f90249a51c928e57f0
Authored: 2023-06-07 13:35:06 +0200
Committed: 2023-06-07 13:35:06 +0200

Eliminate validate_input() printf calls in release mode

Files Modified:

  • include/common/validate.h

682fb1ba144720659aa575ac8028e05e2e2362c4 by Henrik Gramner

https://code.videolan.org/videolan/dav1d/commit/682fb1ba144720659aa575ac8028e05e2e2362c4
Authored: 2023-06-07 13:35:04 +0200
Committed: 2023-06-07 13:35:04 +0200

Add a SIZE_MAX/2 validation check in dav1d_parse_sequence_header()

Files Modified:

  • src/obu.c

77d0cbaf0e5bfc5e997b9b983591fb91abf09bbb by Martin Storsjö

https://code.videolan.org/videolan/dav1d/commit/77d0cbaf0e5bfc5e997b9b983591fb91abf09bbb
Authored: 2023-06-07 13:20:47 +0300
Committed: 2023-06-07 11:04:37 +0000

Avoid an MSVC warning about conversion to smaller data types

After 8f320d59585501ea1406f443e220891696e157ec, MSVC started
producing this warning:

[63/123] Compiling C object src/libdav1d.a.p/obu.c.obj
../src/obu.c(708): warning C4244: '=': conversion from 'uint16_t' to 'uint8_t',
possible loss of data

Files Modified:

  • src/obu.c

517777270c4bd1d3a434fba902faa32df695f94b by Henrik Gramner

https://code.videolan.org/videolan/dav1d/commit/517777270c4bd1d3a434fba902faa32df695f94b
Authored: 2023-05-30 17:15:41 +0200
Committed: 2023-06-07 12:18:34 +0200

Add a debug feature for tracking heap memory usage

Files Modified:

  • src/data.c
  • src/decode.c
  • src/lib.c
  • src/mem.c
  • src/mem.h
  • src/obu.c
  • src/picture.c
  • src/ref.c
  • src/ref.h
  • src/refmvs.c
  • src/thread.h
  • src/thread_task.c

ed22e23d9a28036c32c34a5c7f8ba3871cb2feab by Henrik Gramner

https://code.videolan.org/videolan/dav1d/commit/ed22e23d9a28036c32c34a5c7f8ba3871cb2feab
Authored: 2023-05-30 17:15:40 +0200
Committed: 2023-06-06 22:10:57 +0200

build: Simplify malloc handling

Files Modified:

  • meson.build
  • src/mem.h

4ce4a50d311af30f8e56462d8ab2725e5e5852d8 by James Almer

https://code.videolan.org/videolan/dav1d/commit/4ce4a50d311af30f8e56462d8ab2725e5e5852d8
Authored: 2023-06-02 17:59:18 -0300
Committed: 2023-06-06 14:36:35 +0000

tools/dav1d: check for mismatching API version and not build version

There's no reason to be so strict by ensuring the tool only works with a
library built from the exact same git snapshot, when the only thing that
matters is API availability and ABI compatibility.

Signed-off-by: James Almer <jamrial@gmail.com>

Files Modified:

  • tools/dav1d.c

81126bd02036d9da4cd964136adc3a95cf4d6dc8 by James Almer

https://code.videolan.org/videolan/dav1d/commit/81126bd02036d9da4cd964136adc3a95cf4d6dc8
Authored: 2023-05-14 15:10:46 -0300
Committed: 2023-06-06 14:36:35 +0000

lib: add a function to return the runtime API version

Signed-off-by: James Almer <jamrial@gmail.com>

Files Modified:

  • include/dav1d/dav1d.h
  • src/lib.c

ca84bc22e3d67131aa5f7313543f3bfdb32085ad by James Almer

https://code.videolan.org/videolan/dav1d/commit/ca84bc22e3d67131aa5f7313543f3bfdb32085ad
Authored: 2023-06-01 21:50:54 -0300
Committed: 2023-06-02 19:02:40 -0300

headers: reduce the size of Dav1dContentLightLevel

Signed-off-by: James Almer <jamrial@gmail.com>

Files Modified:

  • include/dav1d/headers.h

8f320d59585501ea1406f443e220891696e157ec by James Almer

https://code.videolan.org/videolan/dav1d/commit/8f320d59585501ea1406f443e220891696e157ec
Authored: 2023-06-01 18:28:46 -0300
Committed: 2023-06-02 19:02:33 -0300

headers: reduce the size of Dav1dFrameHeader

Signed-off-by: James Almer <jamrial@gmail.com>

Files Modified:

  • include/dav1d/headers.h
  • src/obu.c

79c3e30252280ff4170eeb092a5860692721e8fa by James Almer

https://code.videolan.org/videolan/dav1d/commit/79c3e30252280ff4170eeb092a5860692721e8fa
Authored: 2023-06-01 14:27:01 -0300
Committed: 2023-06-01 19:58:39 -0300

headers: reduce the size of Dav1dSequenceHeader

Signed-off-by: James Almer <jamrial@gmail.com>

Files Modified:

  • include/dav1d/headers.h

f195fc1899143189001a0ea825adbeb02972bcd5 by James Almer

https://code.videolan.org/videolan/dav1d/commit/f195fc1899143189001a0ea825adbeb02972bcd5
Authored: 2023-06-01 08:54:36 -0300
Committed: 2023-06-01 19:55:36 -0300

headers: make num_units_in_tick, time_scale and num_units_in_decoding_tick unsigned

All of them are 32 bits values that shall be > 0

Signed-off-by: James Almer <jamrial@gmail.com>

Files Modified:

  • include/dav1d/headers.h
  • include/dav1d/picture.h
  • meson.build

The try push is done, we found jobs with unclassified failures.

Known Issues (From Push Health):

  • browser/components/extensions/test/browser/browser_ext_windows_create_tabId.js

    • 1 of 1 failed on the same (retriggered) task
      - test-linux1804-64-qr/opt-mochitest-browser-chrome-swr-7 (MV3rBooVRtqd0cq14NgS9A)
  • devtools/client/styleeditor/test/browser_toolbox_styleeditor.js

    • 1 of 1 failed on the same (retriggered) task
      - test-linux1804-64-qr/opt-mochitest-devtools-chrome-dt-no-eft-nofis-2 (albrfQGwT522oHnABpeHXw)
  • toolkit/components/extensions/test/browser/browser_ext_extension_page_tab_navigated.js

    • 1 of 4 failed on the same (retriggered) task
      - test-linux1804-64-qr/opt-mochitest-browser-chrome-swr-3 (BvtEm0UwSQu90iSvf6OrWw)

Known Issues (From Taskcluster):

  • test-linux1804-64-qr/opt-mochitest-browser-chrome-swr-7 (MV3rBooVRtqd0cq14NgS9A) - new failure not classified

Needs Investigation (From Push Health):

  • toolkit/components/pictureinpicture/tests/browser_fontSize_change.js
    • 1 of 4 failed on the same (retriggered) task
      - test-linux1804-64-qr/opt-mochitest-browser-chrome-spi-nw-6 (HSWwSiA_QISX5OgPjt68LQ)

These failures could mean that the library update changed something and caused
tests to fail. You'll need to review them yourself and decide where to go from here.

In either event, I have done all I can and you will need to take it from here. If you
don't want to land my patch, you can replicate it locally for editing with
./mach vendor media/libdav1d/moz.yaml

When reviewing, please note that this is external code, which needs a full and
careful inspection - not a rubberstamp.

Assignee: nobody → cchang
Flags: needinfo?(cchang)
Pushed by cchang@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f236ad3b61e5 Update dav1d to 616bfd1506a8a75c6a358e578cbec9ca11931502 r=chunmin
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 117 Branch
Flags: needinfo?(cchang)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: