platform/upstream/libvpx.git
9 months agoUse correct include guards for init_vpx_test.h
Jerome Jiang [Wed, 4 Oct 2023 02:00:02 +0000 (22:00 -0400)]
Use correct include guards for init_vpx_test.h

Bug: b/303112617
Change-Id: Ie18df33b2bcab91c18e920825f4ed3a29e18373b

9 months agoInclude vpx_config.h for macros
Jerome Jiang [Tue, 3 Oct 2023 14:14:43 +0000 (10:14 -0400)]
Include vpx_config.h for macros

Clear some clang-tidy complaints

Change-Id: I6690428d336c81709befd19a33e11c1367275df3

9 months agoFactor out common code used in test binaries
Jerome Jiang [Tue, 3 Oct 2023 13:58:23 +0000 (09:58 -0400)]
Factor out common code used in test binaries

Bug: b/303112617
Change-Id: Icbe16e95ff334a9578a692cc51b4773393ad0005

9 months agoUse big cfg.g_w in ConfigResizeChangeThreadCount
Wan-Teh Chang [Sun, 1 Oct 2023 02:45:35 +0000 (19:45 -0700)]
Use big cfg.g_w in ConfigResizeChangeThreadCount

vp8cx_create_encoder_threads() caps the thread count at
(cm->mb_cols / cpi->mt_sync_range) - 1. If cfg.g_w is 16, cm->mb_cols is
only 1 (see vp8_alloc_frame_buffers: mb_cols = width >> 4), so we won't
be using multiple threads. To reproduce bug chromium:1486441, the test
just needs to increase cfg.g_h sufficiently.

Bug: chromium:1486441
Change-Id: Ie6b2da2e31cfa1717a481f55eebc8c875db94d87

9 months agoMerge "Merge tag 'v1.13.1'" into main
James Zern [Mon, 2 Oct 2023 19:11:51 +0000 (19:11 +0000)]
Merge "Merge tag 'v1.13.1'" into main

9 months agoDisable vpx_highbd_8_mse16x16_neon_dotprod, etc.
Wan-Teh Chang [Fri, 29 Sep 2023 23:58:26 +0000 (16:58 -0700)]
Disable vpx_highbd_8_mse16x16_neon_dotprod, etc.

These functions assume the uint16_t samples are <= 255 (bit depth 8),
but vpx_highbd_8_mse16x16() is called for any bit depth, not just 8.

A better fix is to port the libaom CL
https://aomedia-review.googlesource.com/c/aom/+/175063 to libvpx, but
that requires porting aom_sse() and aom_highbd_sse() to libvpx, which is
quite involved. So disable vpx_highbd_8_mse16x16_neon_dotprod, etc.
first.

Bug: webm:1819
Change-Id: If495a5dedc58d9981317b9993c9fbb81ff3ab50c

9 months agoMerge tag 'v1.13.1'
James Zern [Fri, 29 Sep 2023 23:33:29 +0000 (16:33 -0700)]
Merge tag 'v1.13.1'

libvpx 1.13.1

2023-09-29 v1.13.1 "Ugly Duckling"
  This release contains two security related fixes. One each for VP8 and VP9.

  - Upgrading:
    This release is ABI compatible with the previous release.

  - Bug fixes:
    https://crbug.com/1486441 (CVE-2023-5217)
    Fix to a crash related to VP9 encoding (#1642)

* tag 'v1.13.1':
  update CHANGELOG
  update version to 1.13.1
  Fix bug with smaller width bigger size
  vp9_alloccommon: clear allocation sizes on free
  VP8: disallow thread count changes
  encode_api_test: add ConfigResizeChangeThreadCount
  README: update release version to 1.13.0

Bug: webm:1818
Change-Id: I732e2423f635d4115890f00fd63f9886e31f39a6

9 months agoupdate CHANGELOG
James Zern [Fri, 29 Sep 2023 18:32:27 +0000 (11:32 -0700)]
update CHANGELOG

Bug: webm:1818
Change-Id: Ic0a943b5d1c69a3621ad3f91012fb5308a0c11f1

9 months agoupdate version to 1.13.1
James Zern [Fri, 29 Sep 2023 18:21:35 +0000 (11:21 -0700)]
update version to 1.13.1

SO_VERSION_MAJOR = 8
SO_VERSION_MINOR = 0
SO_VERSION_PATCH = 1

The increase of the patch number corresponds to the revision number in
the libtool text.

3. If the library source code has changed at all since the last update,
then increment revision (‘c:r:a’ becomes ‘c:r+1:a’).

Bug: webm:1818
Change-Id: Ia114368e9fd7a908e7fcf6e4d3142f142770e3f4

9 months agoFix bug with smaller width bigger size
Jerome Jiang [Thu, 30 Jun 2022 17:48:56 +0000 (13:48 -0400)]
Fix bug with smaller width bigger size

Fixed previous patch that clusterfuzz failed on.

Local fuzzing passing overnight.

Bug: webm:1642
Change-Id: If0e08e72abd2e042efe4dcfac21e4cc51afdfdb9
(cherry picked from commit 263682c9a29395055f3b3afe2d97be1828a6223f)

9 months agovp9_alloccommon: clear allocation sizes on free
James Zern [Tue, 27 Jun 2023 02:06:51 +0000 (19:06 -0700)]
vp9_alloccommon: clear allocation sizes on free

This fixes reallocations (and avoids potential crashes) if any
allocations fails and the application continues to call
vpx_codec_decode().

Found with vpx_dec_fuzzer_vp9 & Nallocfuzz
(https://github.com/catenacyber/nallocfuzz).

Bug: webm:1807
Change-Id: If5dc96b73c02efc94ec84c25eb50d10ad6b645a6
(cherry picked from commit 02ab555e992c191e5c509ed87b3cc48ed915b447)

9 months agoUpdate 32-bit version of horizontal_add_uint32x2
Wan-Teh Chang [Fri, 29 Sep 2023 17:35:20 +0000 (10:35 -0700)]
Update 32-bit version of horizontal_add_uint32x2

The code was originally added in
https://aomedia-review.googlesource.com/c/aom/+/162267
by Jonathan Wright.

Change-Id: Iafd9e31d82abe22387e0d68f02c7ab81e85367ed

9 months agoProperly determine end of sequence
Cheng Chen [Fri, 29 Sep 2023 00:47:54 +0000 (17:47 -0700)]
Properly determine end of sequence

When the next frame is null and the current frame is an overlay
frame, which is equivalent to there is an active alt ref frame,
we call this an end of sequence.

Change-Id: I49c2cf7a001df98aff8b62ba034317e408274bd4

9 months agoMerge "vp9_c_vs_simd_encode: Restore cwd at end of test" into main
Wan-Teh Chang [Thu, 28 Sep 2023 17:52:22 +0000 (17:52 +0000)]
Merge "vp9_c_vs_simd_encode: Restore cwd at end of test" into main

9 months agoMerge "Fix bug with smaller width bigger size" into main
Jerome Jiang [Thu, 28 Sep 2023 17:39:23 +0000 (17:39 +0000)]
Merge "Fix bug with smaller width bigger size" into main

9 months agovp9_c_vs_simd_encode: Restore cwd at end of test
Wan-Teh Chang [Thu, 28 Sep 2023 15:58:36 +0000 (08:58 -0700)]
vp9_c_vs_simd_encode: Restore cwd at end of test

Restore the original current directory at the end of
vp9_c_vs_simd_enc_test().

Bug: webm:1800
Change-Id: Iad64848a231e3c900149cc2b248055b02dda80a6

9 months agoSkip the y4m_360p_10bit_input clip for armv8
Wan-Teh Chang [Wed, 27 Sep 2023 23:12:12 +0000 (16:12 -0700)]
Skip the y4m_360p_10bit_input clip for armv8

It is a known mismatch.

Bug: webm:1819
Change-Id: Ieb707a6f53ddf6c7b0d1202c6520599d3e45da76

9 months agoMerge "Modify vp9_c_vs_simd_enc_test script" into main
Yunqing Wang [Wed, 27 Sep 2023 20:33:39 +0000 (20:33 +0000)]
Merge "Modify vp9_c_vs_simd_enc_test script" into main

9 months agoFix bug with smaller width bigger size
Jerome Jiang [Thu, 30 Jun 2022 17:48:56 +0000 (13:48 -0400)]
Fix bug with smaller width bigger size

Fixed previous patch that clusterfuzz failed on.

Bug: webm:1642
Change-Id: If0e08e72abd2e042efe4dcfac21e4cc51afdfdb9

9 months agoVP8: disallow thread count changes
James Zern [Tue, 26 Sep 2023 01:55:59 +0000 (18:55 -0700)]
VP8: disallow thread count changes

Currently allocations are done at encoder creation time. Going from
threaded to non-threaded would cause a crash.

Bug: chromium:1486441
Change-Id: Ie301c2a70847dff2f0daae408fbef1e4d42e73d4
(cherry picked from commit 3fbd1dca6a4d2dad332a2110d646e4ffef36d590)

9 months agoencode_api_test: add ConfigResizeChangeThreadCount
James Zern [Tue, 26 Sep 2023 01:53:41 +0000 (18:53 -0700)]
encode_api_test: add ConfigResizeChangeThreadCount

Update thread counts and resolution to ensure allocations are updated
correctly. VP8 is disabled to avoid a crash.

Bug: chromium:1486441
Change-Id: Ie89776d9818d27dc351eff298a44c699e850761b
(cherry picked from commit af6dedd715f4307669366944cca6e0417b290282)

9 months agoModify vp9_c_vs_simd_enc_test script
Yunqing Wang [Thu, 21 Sep 2023 20:49:09 +0000 (13:49 -0700)]
Modify vp9_c_vs_simd_enc_test script

Applied James' change to the script. Enabled the test:
vp9_c_vs_simd_enc_test

BUG=webm:1800

Change-Id: If1e33e5ccb6ca9315004f3e3f5b910f8a8255317

9 months agoVP8: disallow thread count changes
James Zern [Tue, 26 Sep 2023 01:55:59 +0000 (18:55 -0700)]
VP8: disallow thread count changes

Currently allocations are done at encoder creation time. Going from
threaded to non-threaded would cause a crash.

Bug: chromium:1486441
Change-Id: Ie301c2a70847dff2f0daae408fbef1e4d42e73d4

9 months agoencode_api_test: add ConfigResizeChangeThreadCount
James Zern [Tue, 26 Sep 2023 01:53:41 +0000 (18:53 -0700)]
encode_api_test: add ConfigResizeChangeThreadCount

Update thread counts and resolution to ensure allocations are updated
correctly. VP8 is disabled to avoid a crash.

Bug: chromium:1486441
Change-Id: Ie89776d9818d27dc351eff298a44c699e850761b

10 months agoDo not call WebM RC for new GOP at the end of seq
Jerome Jiang [Thu, 21 Sep 2023 19:26:01 +0000 (15:26 -0400)]
Do not call WebM RC for new GOP at the end of seq

define_gf_group is called at the last frame of each GOP to get GOP size
for next one, which means it'll also be called at the last GOP of the
sequence, when calling WebM RC will be returned with error since WebM RC
does not have any more GOP to return.

When gop_coding_frames from the encoder is 1, it means it's running out
of firstpass stats, which means end of sequence.

Bug: b/299610956
Change-Id: I30e077a28fe41593ebabbc1dc0c2915a4bcbece3

10 months agoaarch64: Generalize Windows cpu detection to any Windows variant
Martin Storsjo [Fri, 15 Sep 2023 09:29:32 +0000 (12:29 +0300)]
aarch64: Generalize Windows cpu detection to any Windows variant

This cpu detection implementation doesn't do anything MSVC specific,
it just calls the IsProcessorFeaturePresent function. This can be
compiled with mingw compilers just as well.

Change-Id: I55e607a47c8f5b70d9f707ef96b2fa7553f2f79f

10 months agoAdd max/min_gf_interval to vpx_rc_config_t
Jerome Jiang [Thu, 14 Sep 2023 20:04:19 +0000 (16:04 -0400)]
Add max/min_gf_interval to vpx_rc_config_t

Bug: b/300499738
Change-Id: Id32cb5e3ce667539c0d1efe1ff5fcc7a49e35329

10 months agoFix ref frame buffer in TPL stats for RC
Jerome Jiang [Thu, 14 Sep 2023 17:27:39 +0000 (13:27 -0400)]
Fix ref frame buffer in TPL stats for RC

The original ref frame index was the index in the GF group; RC expects
the index to be the one for ref frame buffer.

Change-Id: I9a2b0e72b6332023fb2e8da131b557f82db02e39

10 months agoSet frame width height for 1st TPL GOP frame
Jerome Jiang [Thu, 14 Sep 2023 15:59:57 +0000 (11:59 -0400)]
Set frame width height for 1st TPL GOP frame

Change-Id: Ic92dfd232bf90e8cbe6c6233af523ed40d12097a

10 months agoloongarch: Fix bugs from vp8_sixtap_predict4x4/16x16_lsx
yuanhecai [Tue, 12 Sep 2023 02:30:38 +0000 (10:30 +0800)]
loongarch: Fix bugs from vp8_sixtap_predict4x4/16x16_lsx

Bug: webm:1755

Change-Id: I7295e0f9a1551b8a418d5b65a2b7351df1fdc063

10 months agoloongarch: simplify vpx_quantize_b/b_32x32_lsx args
yuanhecai [Sat, 15 Apr 2023 03:11:16 +0000 (11:11 +0800)]
loongarch: simplify vpx_quantize_b/b_32x32_lsx args

Bug: webm:1755

Change-Id: I42fdb1c34f959dd1204b343b8192e3d9b49821b4

10 months agoAdd missing headers for clang-tidy warnings
Jerome Jiang [Tue, 12 Sep 2023 19:28:06 +0000 (15:28 -0400)]
Add missing headers for clang-tidy warnings

Change-Id: I97edec8ecffdcc79b8f3528deb60a3a0332ea0cc

10 months agoUse run-time feature detection for Neon DotProd HBD MSE
Jonathan Wright [Sat, 19 Aug 2023 22:41:09 +0000 (23:41 +0100)]
Use run-time feature detection for Neon DotProd HBD MSE

Arm Neon DotProd implementations of vpx_highbd_8_mse<w>x<h> currently
need to be enabled at compile time since they're guarded by #ifdef
feature macros. Now that run-time feature detection has been enabled
for Arm platforms, expose these implementations with distinct
*neon_dotprod names in a separate file and wire them up to the build
system and rtcd.pl. Also add new test cases for the new functions.

Change-Id: I26be6fb587258c8fa9fbf03509b7602358a001a8

10 months agoUse run-time feature detection for Neon DotProd specialty var.
Jonathan Wright [Sat, 19 Aug 2023 22:25:01 +0000 (23:25 +0100)]
Use run-time feature detection for Neon DotProd specialty var.

Enable Arm Neon DotProd implementations of vpx_get_var_sse_sum*
specialty variance functions via run-time feature detection, wiring
up the new *neon_dotprod names to rtcd.pl. Also add new test cases.

Change-Id: I04ac3db87d32ee7f94702b6c0360254e5688f713

10 months agoUse run-time feature detection for Neon DotProd variance
Jonathan Wright [Sat, 19 Aug 2023 22:09:07 +0000 (23:09 +0100)]
Use run-time feature detection for Neon DotProd variance

Arm Neon DotProd implementations of vpx_variance<w>x<h> currently
need to be enabled at compile time since they're guarded by #ifdef
feature macros. Now that run-time feature detection has been enabled
for Arm platforms, expose these implementations with distinct
*neon_dotprod names in a separate file and wire them up to the build
system and rtcd.pl. Also add new test cases for the new functions.

Remove the _neon suffix in functions making reference to
vpx_variance<w>x<h>_neon() (e.g. sub-pixel variance) - enabling use
of the appropriate *neon or *neon_dotprod version at run time.

Similar changes for the specialty variance and MSE functions will be
made in a subsequent commit.

Change-Id: I69a0ef0d622ecb2d15bd90b4ace53273a32ed22d

10 months agoUse run-time CPU feature detection for Neon DotProd SAD4D
Jonathan Wright [Sat, 19 Aug 2023 19:59:40 +0000 (20:59 +0100)]
Use run-time CPU feature detection for Neon DotProd SAD4D

Arm Neon DotProd implementations of vpx_sad*4d currently need to be
enabled at compile time since they're guarded by ifdef feature
macros. Now that run-time feature detection has been enabled for Arm
platforms, expose these implementations with distinct *neon_dotprod
names in separate files and wire them up to the build system and
rtcd.pl. Also add new test cases for the new DotProd functions.

Change-Id: Ie99ee0b03ec488626f52c3f13e4111fe26cc5619

10 months agoUse run-time CPU feature detection for Neon DotProd SAD
Jonathan Wright [Sat, 19 Aug 2023 19:21:24 +0000 (20:21 +0100)]
Use run-time CPU feature detection for Neon DotProd SAD

Arm Neon DotProd implementations of vpx_sad* currently need to be
enabled at compile time since they're guarded by ifdef feature
macros. Now that run-time feature detection has been enabled for Arm
platforms, expose these implementations with distinct *neon_dotprod
names in separate files and wire them up to the build system and
rtcd.pl. Also add new test cases for the new DotProd functions.

Change-Id: Ic6906c28240276ba89787eadbc9393a232374f95

10 months agoUse run-time CPU feature detection for vpx_convolve8_neon
Jonathan Wright [Sat, 19 Aug 2023 14:24:12 +0000 (15:24 +0100)]
Use run-time CPU feature detection for vpx_convolve8_neon

Arm Neon DotProd and I8MM implementations of vpx_convolve8* currently
need to be enabled at compile time since they're guarded by ifdef
feature macros. Now that run-time feature detection has been enabled
for Arm platforms, expose these implementations with distinct
*neon_dotprod/*neon_i8mm names in separate files and wire them up to
the build system and rtcd.pl. Also add new test cases for the new
DotProd and I8MM functions.

Change-Id: I3db3cd62e8596099d9fec7805ca3ee86b2a01c74

10 months agoRefactor and extend run-time CPU feature detection on Arm
Jonathan Wright [Sat, 19 Aug 2023 11:45:36 +0000 (12:45 +0100)]
Refactor and extend run-time CPU feature detection on Arm

1) Overhaul the Arm CPU feature detection code, taking inspiration
   from similar recent changes in libaom.
2) Add neon_dotprod and neon_i8mm arch options in the configure,
   build and unit test files, adding appropriate conditional options
   where necessary.
3) Soft-enable run-time CPU feature detection by default for both 32-
   bit and 64-bit Arm platforms.

Change-Id: I3f13317d88324acc5753394351188baa8d18a261

10 months agoSimplify Neon MSE helper function params/return values
Jonathan Wright [Thu, 31 Aug 2023 13:21:01 +0000 (14:21 +0100)]
Simplify Neon MSE helper function params/return values

Simplify the parameters and return values of the Neon MSE helper
functions for both standard and high bitdepth - avoiding unused
return values.

Change-Id: I6f9208f9ce890fbe58346d9c7d9d701f28f2f90f

10 months agovp9 svc: fix interger overflow
Marco Paniconi [Mon, 28 Aug 2023 19:09:30 +0000 (12:09 -0700)]
vp9 svc: fix interger overflow

Overflow was happening in two places:
one in set_encoder_config(), where the input
layer_target_bitrates are converted from kbps to bps,
the other in vp9_calc_pframe_target_size_one_pass_vbr(),
where target is scaled by kf_ratio.

vp9_ratectrl.c:2039: runtime error: signed integer overflow:
-137438983 * 25 cannot be represented in type 'int'

Bug: chromium:1475943

Change-Id: I1ab0980862548c8827fae461df9a7a74425209ff

10 months agoDo not call ext rc functions when they're null
Jerome Jiang [Fri, 25 Aug 2023 14:56:23 +0000 (10:56 -0400)]
Do not call ext rc functions when they're null

Change-Id: Ie78afadd4ad5845e42bd4d5412703369f8d5e0f5

11 months agoMerge "vp9_calc_pframe_target_size_one_pass_cbr: fix int overflow" into main
James Zern [Mon, 21 Aug 2023 22:46:42 +0000 (22:46 +0000)]
Merge "vp9_calc_pframe_target_size_one_pass_cbr: fix int overflow" into main

11 months agoMerge "vp8,ratectrl.c: fix integer overflow" into main
James Zern [Mon, 21 Aug 2023 22:46:25 +0000 (22:46 +0000)]
Merge "vp8,ratectrl.c: fix integer overflow" into main

11 months agoMerge "fdct4x4_neon: fix compile w/cl" into main
James Zern [Mon, 21 Aug 2023 19:05:49 +0000 (19:05 +0000)]
Merge "fdct4x4_neon: fix compile w/cl" into main

11 months agovp9 ext rc: copy under/overshoot% for all RC modes
Jerome Jiang [Thu, 17 Aug 2023 18:56:35 +0000 (14:56 -0400)]
vp9 ext rc: copy under/overshoot% for all RC modes

Bug: b/295507002
Change-Id: Ie4b302b82fa2d83e0be450cea60c59907b37f954

11 months agovp9_calc_pframe_target_size_one_pass_cbr: fix int overflow
James Zern [Fri, 18 Aug 2023 21:04:33 +0000 (14:04 -0700)]
vp9_calc_pframe_target_size_one_pass_cbr: fix int overflow

vp9/encoder/vp9_ratectrl.c:2171:23: runtime error: signed integer
overflow: 103079280 * -22 cannot be represented in type 'int'

Bug: chromium:1473268
Change-Id: Ic1de7d48e74d94c2a992e53ec4382b5b44dba7af

11 months agovp8,ratectrl.c: fix integer overflow
James Zern [Fri, 18 Aug 2023 19:36:45 +0000 (12:36 -0700)]
vp8,ratectrl.c: fix integer overflow

in calc_iframe_target_size():
vp8/encoder/ratectrl.c:349:31: runtime error: signed integer overflow:
38 * 343597280 cannot be represented in type 'int'

Bug: chromium:1473473
Change-Id: Ie8f7b147efb27c92314df09837b66f7d97046883

11 months agovp9_cx_iface: fix code compatibility
James Zern [Fri, 18 Aug 2023 16:10:00 +0000 (09:10 -0700)]
vp9_cx_iface: fix code compatibility

Remove '= {}' (C23 [1]) and use memset to clear a vpx_rc_config_t
instance.

after:
6e2c3b9b3 Add RC mode to vpx external RC interface

Fixes compile with -pedantic and Microsoft's cl compiler.

[1] https://en.cppreference.com/w/c/language/initialization

Change-Id: I2019cdf0c42103cfc80b1e58c68b7596e497007f

11 months agoMerge "vp9 ext rc: Assign over/undershoot % for CQ mode" into main
Jerome Jiang [Thu, 17 Aug 2023 17:47:50 +0000 (17:47 +0000)]
Merge "vp9 ext rc: Assign over/undershoot % for CQ mode" into main

11 months agovp9 ext rc: Assign over/undershoot % for CQ mode
Jerome Jiang [Thu, 17 Aug 2023 16:34:48 +0000 (12:34 -0400)]
vp9 ext rc: Assign over/undershoot % for CQ mode

Bug: b/295507002
Change-Id: Ie5b4dabc620f6d17c4039f186e0709d8e9479b47

11 months agoMerge "Extend ext RC mode to have CQ mode" into main
Jerome Jiang [Thu, 17 Aug 2023 15:11:48 +0000 (15:11 +0000)]
Merge "Extend ext RC mode to have CQ mode" into main

11 months agoExtend ext RC mode to have CQ mode
Jerome Jiang [Wed, 16 Aug 2023 20:05:01 +0000 (16:05 -0400)]
Extend ext RC mode to have CQ mode

Also do not return error if it's not specified.

Bug: b/295507002
Change-Id: Ib1f83551272bdde1bceff03554abc4c02d95ca09

11 months agoMerge "tools_common,die_codec(): output to stderr" into main
James Zern [Wed, 16 Aug 2023 19:41:23 +0000 (19:41 +0000)]
Merge "tools_common,die_codec(): output to stderr" into main

11 months agotools_common,die_codec(): output to stderr
James Zern [Wed, 16 Aug 2023 18:15:55 +0000 (11:15 -0700)]
tools_common,die_codec(): output to stderr

This function is used to report a failure, messages of this type should
go to stderr.

Change-Id: I0dee246dddc886a3278b247a770a356446658864

11 months agoAdd RC mode to vpx external RC interface
Jerome Jiang [Tue, 15 Aug 2023 18:39:16 +0000 (14:39 -0400)]
Add RC mode to vpx external RC interface

Bug: b/295507002
Change-Id: Id2dd21482828ec64eef9abdf6a1cca83100d21ba

11 months agofdct4x4_neon: fix compile w/cl
James Zern [Fri, 11 Aug 2023 22:48:19 +0000 (15:48 -0700)]
fdct4x4_neon: fix compile w/cl

Use an array for constant initialization rather than array syntax which
assumes the underlying type is a vector. Fixes compile error with
cl targeting Windows Arm64:

vpx_dsp\arm\fdct4x4_neon.c(55,52): error C2078: too many initializers

No change in assembly with gcc 12.2.0 & clang 14.

Bug: b/277255390
Bug: webm:1810
Fixed: webm:1810

Change-Id: Ia30edcdbb45067dfe865b9958a5eecf1fd9ddfc8

11 months ago*quantize*.c: fix visual studio warnings
James Zern [Fri, 11 Aug 2023 20:40:07 +0000 (13:40 -0700)]
*quantize*.c: fix visual studio warnings

after:
22818907d normalize *const in rtcd

fixes warnings of the form:
vpx_dsp\x86\quantize_avx.c(145): warning C4028: formal parameter 2
different from declaration

Change-Id: I4dc423f11ec4a9171e18bdb6be2fa8dfb65ee61a

11 months agoFix bug and re-enable vpx_int_pro_row/col_neon
Jonathan Wright [Thu, 10 Aug 2023 14:33:54 +0000 (15:33 +0100)]
Fix bug and re-enable vpx_int_pro_row/col_neon

Fix a bug in vpx_int_pro_row_neon (increment pointer after peeled
first loop iteration) and re-enable both vpx_int_pro_row/col_neon
paths.

Also fix IntProRowTest to use width_ (instead of 0) as the src_stride
for the input data block. The test's use of 0 for src_stride is the
reason the tests passed with the buggy Neon implementation noted in
the listed bugs. (The old buggy Neon implementation fails the
adjusted unit tests.)

BUG=webm:1800
BUG=webm:1809

Change-Id: I1f4572ee155653a7596fe2c10b5938ea7a3f63ae

11 months agoMerge "Enable arm test in c vs SIMD bit-exactness test" into main
Yunqing Wang [Tue, 8 Aug 2023 20:32:52 +0000 (20:32 +0000)]
Merge "Enable arm test in c vs SIMD bit-exactness test" into main

11 months agoMerge "Disable vpx_int_pro_row/col neon SIMD functions" into main
Yunqing Wang [Tue, 8 Aug 2023 20:32:41 +0000 (20:32 +0000)]
Merge "Disable vpx_int_pro_row/col neon SIMD functions" into main

11 months agoEnable arm test in c vs SIMD bit-exactness test
Yunqing Wang [Mon, 7 Aug 2023 21:54:30 +0000 (14:54 -0700)]
Enable arm test in c vs SIMD bit-exactness test

Arm SIMD testing was enabled in c vs SIMD bit-exactness test after
arm SIMD mismatch was resolved.

BUG=webm:1800

Change-Id: Id60127313a0955f4a5c8468281fd5a441668fddb

11 months agoDisable vpx_int_pro_row/col neon SIMD functions
Yunqing Wang [Mon, 7 Aug 2023 20:10:41 +0000 (13:10 -0700)]
Disable vpx_int_pro_row/col neon SIMD functions

The vpx_int_pro_row/col neon SIMD version caused a mismatch between
neon encoding vs c encoding. Disabled them for now to ensure the
correctness of VP9 encoding on the arm platform. Since these 2
functions were not used much, so this wouldn't affect the overall
encoder speed much.

BUG=webm:1800
BUG=webm:1809

Change-Id: Id1a7d542fc03d4cf9fa1039a49832abf35fb722f

11 months agoVP9 RC: Add pixel row/col of a TPL block
Jerome Jiang [Mon, 7 Aug 2023 20:42:43 +0000 (16:42 -0400)]
VP9 RC: Add pixel row/col of a TPL block

Bug: b/294049605
Change-Id: I383a88a037a2a48a5fc1b9def6f991278c3665a8

11 months agoFix more clang-tidy warnings
Jerome Jiang [Mon, 7 Aug 2023 14:28:46 +0000 (10:28 -0400)]
Fix more clang-tidy warnings

 - Include vpx/vpx_ext_ratectrl.h in vp9_ext_ratectrl.c
 - Include vpx/internal/vpx_codec_internal.h
 - Include <stddef.h> for NULL

Bug: b/294049605
Change-Id: Iedd8b3864da27fde1678bfa6606e6fc5630a7a09

11 months agoFix some clang-tidy warnings
Jerome Jiang [Fri, 4 Aug 2023 20:12:29 +0000 (16:12 -0400)]
Fix some clang-tidy warnings

 - Use zero initializer instead of memset to avoid including <cstring>
 - Include vpx_codec.h for vpx_codec_err_t and error codes
 - Include vpx_tpl.h for VpxTplGopStats

Change-Id: Iac5837ce2173bd945bfe8eeb401ff4dfd04fd2e1

11 months agoFix include path fpr vpx_tpl.h,vpx_ext_ratectrl.h
Jerome Jiang [Fri, 4 Aug 2023 18:18:33 +0000 (14:18 -0400)]
Fix include path fpr vpx_tpl.h,vpx_ext_ratectrl.h

Bug: b/294049605
Change-Id: I6422fc4250c2192f985cce2e296a19a05934969b

11 months agoMerge "vp9_quantize_fp_neon: Same params name as in decl" into main
Jerome Jiang [Thu, 3 Aug 2023 19:28:44 +0000 (19:28 +0000)]
Merge "vp9_quantize_fp_neon: Same params name as in decl" into main

11 months agoMerge "vp9 ext rc: Add callback for tpl stats" into main
Jerome Jiang [Thu, 3 Aug 2023 18:33:32 +0000 (18:33 +0000)]
Merge "vp9 ext rc: Add callback for tpl stats" into main

11 months agovp9_quantize_fp_neon: Same params name as in decl
Jerome Jiang [Thu, 3 Aug 2023 18:07:55 +0000 (14:07 -0400)]
vp9_quantize_fp_neon: Same params name as in decl

Clear some clang-tidy warnings

Change-Id: Iea4c4e77b3d515ec6384bd34875a0002ab13c14c

11 months agovp9 ext rc: Add callback for tpl stats
Jerome Jiang [Tue, 1 Aug 2023 15:00:20 +0000 (11:00 -0400)]
vp9 ext rc: Add callback for tpl stats

Added test

Bug: b/294049605
Change-Id: I3967a0f915e1a6e7a0d34d04732c33e1ca6f35e7

11 months agoAdd test to check bit exactness of C and SIMD in VP9 encoder
Anupam Pandey [Tue, 13 Jun 2023 10:32:58 +0000 (16:02 +0530)]
Add test to check bit exactness of C and SIMD in VP9 encoder

This CL adds a shell script to test bit exactness of C and SIMD
VP9 encoder for x86 platform.

As C Vs NEON encoding outputs are not bit-exact (BUG=webm:1809),
ARM tests are currently disabled.

BUG=webm:1800

Change-Id: Iffcc70863e8cf83ccb5bc5be73e8866165697358

11 months agoAdd a 10-bit test file
Yunqing Wang [Wed, 2 Aug 2023 03:58:18 +0000 (20:58 -0700)]
Add a 10-bit test file

Added a 10-bit test file for VP9 end-to-end c vs SIMD bit-
exactness test.

BUG=webm:1800

Change-Id: I4a864f1a740abee27049d68231adf2ec308f9a96

11 months agonormalize *const in rtcd
Johann [Fri, 28 Jul 2023 20:44:56 +0000 (05:44 +0900)]
normalize *const in rtcd

Change-Id: Iece50143b43263c0c8f90299bedd7d2a5b9aa56b

11 months agoremove incorrect (void)
Johann [Fri, 28 Jul 2023 11:21:31 +0000 (20:21 +0900)]
remove incorrect (void)

n_coeffs is used in this function

Change-Id: I5f5d2933304bb636a33e0fa294b4526edb65a08d

11 months agoquantize_fp: reduce parameters
Johann [Fri, 28 Jul 2023 10:37:48 +0000 (19:37 +0900)]
quantize_fp: reduce parameters

apply similar steps as to the other quantize functions to switch to
macroblock_plane and ScanOrder

Change-Id: I486d653326aaf52ffd3beafd2e891ba6a5d57ef3

11 months agoquantize: reduce parameters
Johann [Mon, 14 Nov 2022 07:47:33 +0000 (16:47 +0900)]
quantize: reduce parameters

Pass macroblock_plane and ScanOrder instead of looking up the values
beforehand. Avoids pushing arguments to the stack.

Change-Id: I22df6f645eb1a1d89ba5a4d9bc58acb77af51aa9

11 months agoresize_test: prefer 'override' to 'virtual'
James Zern [Thu, 27 Jul 2023 02:03:04 +0000 (19:03 -0700)]
resize_test: prefer 'override' to 'virtual'

Update functions in WRITE_COMPRESSED_STREAM blocks, which are disabled
by default. This caused them to be missed in:
84e6b7ab0 test/*.cc: prefer 'override' to 'virtual'

Change-Id: I0e462263f19c15eb0a30d0c0f4e145062f789489

11 months agotest/*.h: prefer 'override' to 'virtual'
James Zern [Wed, 26 Jul 2023 22:29:40 +0000 (15:29 -0700)]
test/*.h: prefer 'override' to 'virtual'

created with clang-tidy --fix --checks=-*,modernize-use-override

Change-Id: I53412f35590799574edb573ae417a4a004cccd1e

11 months agoencode_test_driver.h: use bool literal
James Zern [Wed, 26 Jul 2023 22:38:36 +0000 (15:38 -0700)]
encode_test_driver.h: use bool literal

Change-Id: If47be9ca0daa18d92cb849484f9e139e65e3560e

11 months agotest/**.cc: use bool literals
James Zern [Tue, 25 Jul 2023 19:18:03 +0000 (12:18 -0700)]
test/**.cc: use bool literals

created with clang-tidy --fix --checks=-*,modernize-use-bool-literals

Change-Id: Ifaed8ca824676555acaf1053b2a5a52c51a70638

11 months agotest/decode_perf_test.cc: use nullptr
James Zern [Tue, 25 Jul 2023 19:10:21 +0000 (12:10 -0700)]
test/decode_perf_test.cc: use nullptr

created with clang-tidy --fix --checks=-*,modernize-use-nullptr

Change-Id: Ibf4a80fa00e9b59d471c92788ec4c7c72e4662e5

11 months agotest/*.cc: use '= default'
James Zern [Tue, 25 Jul 2023 19:04:57 +0000 (12:04 -0700)]
test/*.cc: use '= default'

created with clang-tidy --fix --checks=-*,modernize-use-equals-default

Change-Id: Ie373fb5501491fce53479d20f3a6d908c4b7c535

11 months agoMerge changes I71e1b442,Ibbfb949b into main
James Zern [Tue, 25 Jul 2023 18:27:34 +0000 (18:27 +0000)]
Merge changes I71e1b442,Ibbfb949b into main

* changes:
  test/*.cc: prefer 'override' to 'virtual'
  test,AbstractBench: fix -Wnon-virtual-dtor

11 months agotest/*.cc: prefer 'override' to 'virtual'
James Zern [Tue, 25 Jul 2023 00:23:23 +0000 (17:23 -0700)]
test/*.cc: prefer 'override' to 'virtual'

created with clang-tidy --fix --checks=-*,modernize-use-override

Change-Id: I71e1b4423c143b3e47fe90929ee110b307cdb565

11 months agotest,AbstractBench: fix -Wnon-virtual-dtor
James Zern [Sat, 8 Jul 2023 02:14:59 +0000 (19:14 -0700)]
test,AbstractBench: fix -Wnon-virtual-dtor

In file included from ../test/bench.cc:14:
../test/bench.h:17:7: warning: 'AbstractBench' has virtual functions but
non-virtual destructor [-Wnon-virtual-dtor]
class AbstractBench {

Change-Id: Ibbfb949b63c8dff936c7ed4f2d056dea0343377b

11 months agoAdd new_mv_count to ext rate control interface
Jerome Jiang [Mon, 24 Jul 2023 22:04:58 +0000 (18:04 -0400)]
Add new_mv_count to ext rate control interface

Bug: b/290385227
Change-Id: Ia87c4bf1e9315bf1134c998f88e9d5548c497777

11 months agocleanup: _pt -> _ptr in vp9 external RC interface
Jerome Jiang [Mon, 24 Jul 2023 17:08:05 +0000 (13:08 -0400)]
cleanup: _pt -> _ptr in vp9 external RC interface

Change-Id: Ic483488f8f6273e8977cfc324466bda41f1e47a7

12 months agovp9_rdopt,handle_inter_mode: fix -Wmaybe-uninitialized warning
James Zern [Thu, 13 Jul 2023 16:49:30 +0000 (09:49 -0700)]
vp9_rdopt,handle_inter_mode: fix -Wmaybe-uninitialized warning

With gcc 13.1.1

In function ‘handle_inter_mode’,
inlined from ‘vp9_rd_pick_inter_mode_sb’ at
    ../vp9/encoder/vp9_rdopt.c:3872:17:
../vp9/encoder/vp9_rdopt.c:3142:8: warning: ‘tmp_rd’ may be used
    uninitialized [-Wmaybe-uninitialized]
 3142 |     rd = tmp_rd + RDCOST(x->rdmult, x->rddiv, rs, 0);
../vp9/encoder/vp9_rdopt.c: In function ‘vp9_rd_pick_inter_mode_sb’:
../vp9/encoder/vp9_rdopt.c:2846:15: note: ‘tmp_rd’ was declared here
 2846 |   int64_t rd, tmp_rd, best_rd = INT64_MAX;

Change-Id: I8608957cc8bbeb1ae525f3c3dad6fe9785b2a9b4

12 months agoMerge "vp8: remove missing prototypes from the rtcd header" into main
James Zern [Tue, 11 Jul 2023 00:55:30 +0000 (00:55 +0000)]
Merge "vp8: remove missing prototypes from the rtcd header" into main

12 months agovp8: remove missing prototypes from the rtcd header
L. E. Segovia [Sat, 8 Jul 2023 23:30:49 +0000 (20:30 -0300)]
vp8: remove missing prototypes from the rtcd header

These were removed in If7a49e920e12f7fca0541190b87e6dae510df05c but
the leftovers can cause a build to fail if the code isn't optimized out.
I just found this out in the Meson port of libvpx for GStreamer.

BUG=webm:1584

Change-Id: I1c953720a2cbec3796200d4ec4020dca0b672bfb

12 months agovpx_free_tpl_gop_stats: normalize param name
James Zern [Mon, 10 Jul 2023 17:06:13 +0000 (10:06 -0700)]
vpx_free_tpl_gop_stats: normalize param name

this fixes a clang-tidy warning

Change-Id: I13f4750c15b7d6a395494c8dbcb896bde125b3c4

12 months agoMerge "delete some dead code" into main
James Zern [Thu, 6 Jul 2023 17:10:37 +0000 (17:10 +0000)]
Merge "delete some dead code" into main

12 months agomfqe_partition: fix -Wunreachable-code
James Zern [Thu, 29 Jun 2023 16:52:26 +0000 (09:52 -0700)]
mfqe_partition: fix -Wunreachable-code

vp9/common/vp9_mfqe.c|240 col 16| warning: code will never be executed
[-Wunreachable-code]
 BLOCK_SIZE mfqe_bs, bs_tmp;
            ^~~~~~~

Change-Id: I566b20d8c294e19bc4b90b57b730f933048e71a5

12 months agoFix a bug in vpx_highbd_hadamard_32x32_neon().
Wan-Teh Chang [Wed, 28 Jun 2023 23:09:36 +0000 (16:09 -0700)]
Fix a bug in vpx_highbd_hadamard_32x32_neon().

This CL is the highbd version of
https://chromium-review.googlesource.com/c/webm/libvpx/+/4646573.

The bug is caused by the incorrect assumption that
(a / 2) + (b / 2) == (a + b) / 2 and (a / 2) - (b / 2) == (a - b) / 2.

Also fix the Rand() inputs to Hadamard functions in unit tests.

This CL ports the following libaom CLs to libvpx:
https://aomedia-review.googlesource.com/c/aom/+/177101
https://aomedia-review.googlesource.com/c/aom/+/177241

Change-Id: Ic20e7684eab5d6507417fa2b75e572064d37ad2c

12 months agodelete some dead code
James Zern [Wed, 28 Jun 2023 19:26:32 +0000 (12:26 -0700)]
delete some dead code

follow-up to:
3ecba3980 Fix Clang -Wunreachable-code-aggressive warnings

Change-Id: I364312987bc838c69c010cce024bd3d62a918417

12 months agoMerge "Fix Clang -Wunreachable-code-aggressive warnings" into main
James Zern [Wed, 28 Jun 2023 19:21:40 +0000 (19:21 +0000)]
Merge "Fix Clang -Wunreachable-code-aggressive warnings" into main

12 months agoFix Clang -Wunreachable-code-aggressive warnings
James Zern [Sat, 3 Jun 2023 01:49:00 +0000 (18:49 -0700)]
Fix Clang -Wunreachable-code-aggressive warnings

Based on the change in libaom:
fe36011455 Fix Clang -Wunreachable-code-aggressive warnings

Clang's -Wunreachable-code-aggressive flag enables several warning flags
such as -Wunreachable-code-break and -Wunreachable-code-return. Chrome's
build system enables -Wunreachable-code-aggressive (in
build/config/compiler/BUILD.gn), so it would be good if libvpx could be
compiled without -Wunreachable-code-aggressive warnings.

This requires the VPX_NO_RETURN macro be defined correctly for all the
compilers we support, otherwise some compilers may warn about missing
return statements after a die() or fatal() call (which does not return).

Change-Id: I0c069133af45a7a61759538b6d74c681ea087dcd

12 months agovp9 firstpass stats in a separate header
Jerome Jiang [Wed, 28 Jun 2023 14:04:21 +0000 (10:04 -0400)]
vp9 firstpass stats in a separate header

Change-Id: If91c5c74c71affc48eb858beb314a6c194b14023

12 months agoMerge changes I1c17302f,Ic084894b,I9867f5fc,Ie3faf7b3,If5dc96b7, ... into main
James Zern [Wed, 28 Jun 2023 00:02:47 +0000 (00:02 +0000)]
Merge changes I1c17302f,Ic084894b,I9867f5fc,Ie3faf7b3,If5dc96b7, ... into main

* changes:
  vp8_decode: fix keyframe resync after decode error
  vp8_decode: only remove threads on thread create failure
  vp8_decode: clear stream info on decoder create failure
  vp9_decodeframe,init_mt: free tile_workers on alloc failure
  vp9_alloccommon: clear allocation sizes on free
  vp9_dx_iface: fix leaks on init_decoder() failure