platform/upstream/libvpx.git
2 years agoMerge "vp9 encoder: fix integer overflows" into main
Fyodor Kyslov [Wed, 15 Dec 2021 02:51:31 +0000 (02:51 +0000)]
Merge "vp9 encoder: fix integer overflows" into main

2 years agovp9 encoder: fix integer overflows
Fyodor Kyslov [Tue, 14 Dec 2021 17:59:17 +0000 (09:59 -0800)]
vp9 encoder: fix integer overflows

fixing integer overflow with 16K content and enabling the test

Bug: webm:1750
Fixed: webm:1750
Change-Id: I76eebd915bcae55bc755613251a98e1716dea4c0

2 years agoMerge "vp9_diamond_search_sad_avx: quiet -Wmaybe-uninitialized warning" into main
James Zern [Fri, 10 Dec 2021 19:42:06 +0000 (19:42 +0000)]
Merge "vp9_diamond_search_sad_avx: quiet -Wmaybe-uninitialized warning" into main

2 years agoMerge "vp[89]_initalize_enc(): protect against multiple invocations" into main
James Zern [Fri, 10 Dec 2021 18:32:44 +0000 (18:32 +0000)]
Merge "vp[89]_initalize_enc(): protect against multiple invocations" into main

2 years agovp[89]_initalize_enc(): protect against multiple invocations
James Zern [Fri, 10 Dec 2021 02:34:18 +0000 (18:34 -0800)]
vp[89]_initalize_enc(): protect against multiple invocations

this removes the burden from callers; the rtcd functions are left with a
mostly redundant (outside of tests) once() as top-level functions should
ensure their constraints are met

Change-Id: I5bdbcfa4671c6a1492cfe9c7d886c361c26caaa9

2 years agovp9_diamond_search_sad_avx: quiet -Wmaybe-uninitialized warning
James Zern [Fri, 10 Dec 2021 02:02:30 +0000 (18:02 -0800)]
vp9_diamond_search_sad_avx: quiet -Wmaybe-uninitialized warning

w/gcc-11

v_these_mv_w is always initialized in this block with _mm_add_epi16();
converting this to a _mm_storeu_si32(tmp) call also works, but
introduces more stack usage

|| ../vp9/encoder/x86/vp9_diamond_search_sad_avx.c: In function
‘vp9_diamond_search_sad_avx’:
vp9/encoder/x86/vp9_diamond_search_sad_avx.c|285 col 19| warning:
‘v_these_mv_w’ may be used uninitialized [-Wmaybe-uninitialized]
||   285 |           new_bmv = ((const int_mv *)&v_these_mv_w)[local_best_idx];
||       |           ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vp9/encoder/x86/vp9_diamond_search_sad_avx.c|149 col 21| note:
‘v_these_mv_w’ declared here
||   149 |       const __m128i v_these_mv_w = _mm_add_epi16(v_bmv_w, v_ss_mv_w);
||       |                     ^~~~~~~~~~~~

Change-Id: I1cd2fcb41030db16f51c94f3a70eb8eb2a526401

2 years agovp9_bitstream.c: quiet -Wstringop-overflow warning
James Zern [Fri, 10 Dec 2021 01:32:30 +0000 (17:32 -0800)]
vp9_bitstream.c: quiet -Wstringop-overflow warning

w/gcc-11

as noted in
the size of interp_filter_selected[][]'s first dimension varies between
VP9_COMP and VP9BitstreamWorkerData as noted in the latter's definition:
  // The size of interp_filter_selected in VP9_COMP is actually
  // MAX_REFERENCE_FRAMES x SWITCHABLE. But when encoding tiles, all we ever do
  // is increment the very first index (index 0) for the first dimension. Hence
  // this is sufficient.
  int interp_filter_selected[1][SWITCHABLE];

normalize the function signatures of write_modes*(), etc. to take this
into account.

vp9/encoder/vp9_bitstream.c|948 col 3| warning: ‘write_modes’ accessing
64 bytes in a region of size 16 [-Wstringop-overflow=]
||   948 |   write_modes(cpi, xd, &cpi->tile_data[data->tile_idx].tile_info,
||       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
||   949 |               &data->bit_writer, tile_row, data->tile_idx,
||       |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
||   950 |               &data->max_mv_magnitude, data->interp_filter_selected);
||       |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vp9/encoder/vp9_bitstream.c|948 col 3| note: referencing argument 8 of
type ‘int (*)[4]’
vp9/encoder/vp9_bitstream.c|488 col 13| note: in a call to function
‘write_modes’

Change-Id: I0898cd7c3431633c382a0c3a1be2f0a0bea8d0f9

2 years agoquiet -Warray-parameter warnings
James Zern [Thu, 9 Dec 2021 05:42:28 +0000 (21:42 -0800)]
quiet -Warray-parameter warnings

w/gcc-11
this matches the definition of the function with the declaration

Change-Id: I757b731b9560cb0b0ceec4ec258ec5af5a183b3d

2 years agoMerge "test_intra_pred_speed: match above ext w/reconintra" into main
James Zern [Thu, 9 Dec 2021 18:03:55 +0000 (18:03 +0000)]
Merge "test_intra_pred_speed: match above ext w/reconintra" into main

2 years agotest_intra_pred_speed: match above ext w/reconintra
James Zern [Thu, 9 Dec 2021 05:35:26 +0000 (21:35 -0800)]
test_intra_pred_speed: match above ext w/reconintra

only 2 x block_size is needed

+ remove a related TODO; C & assembly rely on this extension

Change-Id: Iea430267624251cccbbdaec8045eb81d01ae1db1

2 years agovp9_thread_test.cc: remove incorrect TODO
James Zern [Thu, 9 Dec 2021 03:34:47 +0000 (19:34 -0800)]
vp9_thread_test.cc: remove incorrect TODO

the row-based loop filter is ok (and being used) in this case; since
it's serialized the previous row will always be done

Change-Id: I024a0c78e7488178956cc22a4c4680a00dc6eade

2 years agoclear -Wextra-semi/-Wextra-semi-stmt warnings x2
James Zern [Tue, 7 Dec 2021 21:11:46 +0000 (13:11 -0800)]
clear -Wextra-semi/-Wextra-semi-stmt warnings x2

some additional neon file updates after:
31b954deb clear -Wextra-semi/-Wextra-semi-stmt warnings

Bug: chromium:1257449
Change-Id: I3e2664f2bd8f6f7328ec91bf6595ba5fc09862bd

2 years agoclear -Wextra-semi/-Wextra-semi-stmt warnings
James Zern [Thu, 2 Dec 2021 21:11:56 +0000 (13:11 -0800)]
clear -Wextra-semi/-Wextra-semi-stmt warnings

Bug: chromium:1257449
Change-Id: Ia9aafccc09b611521d4a7aedfe3723393a840c62

3 years agoMerge "vp9 encoder: fix row-mt crash w/thread config change" into main
James Zern [Fri, 19 Nov 2021 03:06:17 +0000 (03:06 +0000)]
Merge "vp9 encoder: fix row-mt crash w/thread config change" into main

3 years agovp9 encoder: fix row-mt crash w/thread config change
James Zern [Wed, 17 Nov 2021 02:21:34 +0000 (18:21 -0800)]
vp9 encoder: fix row-mt crash w/thread config change

previously row-mt would allocate thread data once, so increasing the
number of threads with a config change would cause a heap overflow.

Bug: chromium:1261415
Bug: chromium:1270689
Change-Id: I3c5ec8444ae91964fa34a19dd780bd2cbb0368bf

3 years agoMerge "vp9 encoder: fix some integer overflows" into main
James Zern [Thu, 18 Nov 2021 22:35:20 +0000 (22:35 +0000)]
Merge "vp9 encoder: fix some integer overflows" into main

3 years agoMerge "replaced bsr() with get_msb() from bitops.h" into main
Johann Koenig [Thu, 18 Nov 2021 07:13:09 +0000 (07:13 +0000)]
Merge "replaced bsr() with get_msb() from bitops.h" into main

3 years agovp9 encoder: fix some integer overflows
Fyodor Kyslov [Wed, 17 Nov 2021 21:15:00 +0000 (13:15 -0800)]
vp9 encoder: fix some integer overflows

cap bitrate to 1000Mbps, change bitsaving budget to int64_t

this make test coverage for 2048x2048 - same as for vp8

Bug: webm:1749
Fixed: webm:1749
Change-Id: Ic58d73cb7529b0826d1f501ad09af8e80f706a6e

3 years agoMerge "faster vp8_regular_quantize_b_sse4_1" into main
Johann Koenig [Thu, 18 Nov 2021 04:41:58 +0000 (04:41 +0000)]
Merge "faster vp8_regular_quantize_b_sse4_1" into main

3 years agoreplaced bsr() with get_msb() from bitops.h
Ilya Kurdyukov [Wed, 17 Nov 2021 07:16:02 +0000 (14:16 +0700)]
replaced bsr() with get_msb() from bitops.h

The modified line should now compile into two instructions instead of four.

Change-Id: Ie2eb6b13ff1e29b3107cb9e76f37ff9065504316

3 years agofaster vp8_regular_quantize_b_sse4_1
Ilya Kurdyukov [Sat, 13 Nov 2021 11:22:14 +0000 (18:22 +0700)]
faster vp8_regular_quantize_b_sse4_1

Gives 10% faster VP8 encoding in simple tests.
This patch requires testing on wider datasets and encoder
settings to see if this speedup is achieved on most data.

Change-Id: If8e04819623e78fff126c413db66c964c0b4c11a

3 years agoencode_api_test.cc: unify kCodecs[] definitions
James Zern [Tue, 16 Nov 2021 03:20:36 +0000 (19:20 -0800)]
encode_api_test.cc: unify kCodecs[] definitions

and rename the table to kCodecIfaces[] to be a little more specific and
avoid shadowing kCodecs[] in SetRoi()

Change-Id: I64905f48d8bf76e812bdba8374b82e3f7654686f

3 years agoMerge "MacOS 12 is darwin21" into main
Johann Koenig [Wed, 17 Nov 2021 03:35:50 +0000 (03:35 +0000)]
Merge "MacOS 12 is darwin21" into main

3 years agoMerge "test/DummyVideoSource::ReallocImage: check img_ alloc" into main
Yunqing Wang [Tue, 16 Nov 2021 21:47:09 +0000 (21:47 +0000)]
Merge "test/DummyVideoSource::ReallocImage: check img_ alloc" into main

3 years agoMacOS 12 is darwin21
Johann [Tue, 16 Nov 2021 21:02:15 +0000 (06:02 +0900)]
MacOS 12 is darwin21

Remove -mmacosx-version-min. The library does not use
any calls which are affected by the platform version.
There is also no version 10.16 as it went from 10.15
to 11 and now to 12.

At some point it may be good to clarify that the bare
-darwin- target is for iOS and the -darwinN- targets
are for macOS.

Change-Id: I2fd5f7cae2637905acf3ab77bfddfbe367abbb68

3 years agovp9: Fix multiplication overflow
Mikko Koivisto [Mon, 15 Nov 2021 18:47:05 +0000 (18:47 +0000)]
vp9: Fix multiplication overflow

Fix UBSan error reported from aosp Cuttlefish device:
/vp9/encoder/vp9_ratectrl.c:238:33: unsigned integer overflow:
2500000 * 1800 cannot be represented in type 'unsigned int'

...by casting the operand and the result of multiplication
to 64bit integer.

Test: vp9 webrtc streaming with Cuttlefish
Change-Id: Id5bb3d4071a96179caffae0829d3cc4e48c7614b

3 years agotest/DummyVideoSource::ReallocImage: check img_ alloc
James Zern [Thu, 11 Nov 2021 21:42:35 +0000 (13:42 -0800)]
test/DummyVideoSource::ReallocImage: check img_ alloc

prevents a crash on the next line accessing img_ members

Bug: aomedia:3191
Change-Id: I430fb4ee662b0001629096eb8b554f8a2b30cce0

3 years agoMerge "update libwebm to libwebm-1.0.0.28-20-g206d268" into main
James Zern [Thu, 11 Nov 2021 21:09:38 +0000 (21:09 +0000)]
Merge "update libwebm to libwebm-1.0.0.28-20-g206d268" into main

3 years agoMerge changes I1425f12d,I1e9e9ffa,I6d8f676b,I92013086 into main
James Zern [Wed, 10 Nov 2021 21:30:07 +0000 (21:30 +0000)]
Merge changes I1425f12d,I1e9e9ffa,I6d8f676b,I92013086 into main

* changes:
  mem_sse2.h: loadu_uint32 -> loadu_int32
  mem_sse2.h: storeu_uint32 -> storeu_int32
  vp8: fix some implicit signed -> unsigned conv warnings
  video_source.h,ReallocImage: quiet implicit conv warning

3 years agovp8 encoder: fix some integer overflows
James Zern [Sat, 6 Nov 2021 17:42:46 +0000 (10:42 -0700)]
vp8 encoder: fix some integer overflows

cap the bitrate to 1000Mbps to avoid many instances of bitrate * 3 / 2
overflowing.

this adds coverage for 2048x2048 in the default test for VP8 with TODOs
for issues at that resolution for VP9 and at max resolution for both.

Bug: b/189602769
Bug: chromium:1264506
Bug: webm:1748
Bug: webm:1749
Bug: webm:1750
Bug: webm:1751
Change-Id: Iedee4dd8d3609c2504271f94d22433dfcd828429

3 years agomem_sse2.h: loadu_uint32 -> loadu_int32
James Zern [Sat, 6 Nov 2021 23:48:13 +0000 (16:48 -0700)]
mem_sse2.h: loadu_uint32 -> loadu_int32

this changes the return to int32_t which matches the type with usage
of this call as input to _mm_cvtsi32_si128(), _mm_set_epi32(), etc.
fixes implicit conversion warning with clang-11 -fsanitize=undefined

Change-Id: I1425f12d4f79155dd5d7af0eb00fbdb9f1940544

3 years agomem_sse2.h: storeu_uint32 -> storeu_int32
James Zern [Sat, 6 Nov 2021 23:43:11 +0000 (16:43 -0700)]
mem_sse2.h: storeu_uint32 -> storeu_int32

this changes the parameter to int32_t which matches the type with usage
of this call using _mm_cvtsi128_si32() as a parameter. quiets an
implicit conversion warning with clang-11 -fsanitize=undefined

Change-Id: I1e9e9ffac5d2996962d29611458311221eca8ea0

3 years agovp8: fix some implicit signed -> unsigned conv warnings
James Zern [Sat, 6 Nov 2021 23:33:00 +0000 (16:33 -0700)]
vp8: fix some implicit signed -> unsigned conv warnings

and vice-versa mostly when dealing with bitmasks

w/clang-11 -fsanitize=undefined

Change-Id: I6d8f676bf87679ba1dad9cb7f55eea172103d9d3

3 years agovideo_source.h,ReallocImage: quiet implicit conv warning
James Zern [Sat, 6 Nov 2021 17:42:37 +0000 (10:42 -0700)]
video_source.h,ReallocImage: quiet implicit conv warning

with -fsanitize=undefined

test/video_source.h:194:33: runtime error: implicit conversion from type
'int' of value -32 (32-bit, signed) to type 'unsigned int' changed the
value to 4294967264 (32-bit, unsigned)

Change-Id: I92013086d517fecf01c9e4cdfe6737b8ce733a1f

3 years agovp8,calc_pframe_target_size: fix integer overflow
James Zern [Mon, 8 Nov 2021 20:57:12 +0000 (12:57 -0800)]
vp8,calc_pframe_target_size: fix integer overflow

this is similar to the fix for calc_iframe_target_size:
5f345a924 Avoid overflow in calc_iframe_target_size

Bug: chromium:1264506
Change-Id: I2f0e161cf9da59ca0724692d581f1594c8098ebb

3 years agovp8_update_rate_correction_factors: fix integer overflow
James Zern [Sat, 6 Nov 2021 17:42:46 +0000 (10:42 -0700)]
vp8_update_rate_correction_factors: fix integer overflow

the intermediate value in the correction_factor calculation may exceed
integer bounds

Bug: b/189602769
Change-Id: I75726b12f3095663911d78333f3ea26eb6dee21e

3 years agoupdate libwebm to libwebm-1.0.0.28-20-g206d268
James Zern [Wed, 27 Oct 2021 17:05:19 +0000 (10:05 -0700)]
update libwebm to libwebm-1.0.0.28-20-g206d268

picks up Android.mk license updates from AOSP and fixes as part of the
1.0.0.28 release

changelog:
https://chromium.googlesource.com/webm/libwebm/+log/37d9b86..206d268

Change-Id: I18d5238f7d1aff2678d903018929da952410fa0e

3 years agoMerge "update tools/cpplint.py" into main
James Zern [Thu, 4 Nov 2021 20:01:01 +0000 (20:01 +0000)]
Merge "update tools/cpplint.py" into main

3 years agoupdate tools/cpplint.py
James Zern [Wed, 3 Nov 2021 23:23:06 +0000 (16:23 -0700)]
update tools/cpplint.py

https://github.com/google/styleguide.git
100755 blob 4a82bde4f95cef8103520bc2c019483397ec51f4    cpplint/cpplint.py

Bug: aomedia:3178
Change-Id: I9e11d647096fc2082b18d74731026dabb52639bb

3 years agotools_common.h: add VPX_TOOLS_FORMAT_PRINTF
James Zern [Wed, 3 Nov 2021 00:19:10 +0000 (17:19 -0700)]
tools_common.h: add VPX_TOOLS_FORMAT_PRINTF

and use it to set the format attribute for printf like functions. this
allows the examples to be built with -Wformat-nonliteral without
producing warnings.

Bug: webm:1744
Change-Id: I26b4c41c9a42790053b1ae0e4a678af8f2cd1d82
Fixed: webm:1744

3 years agovpx_codec_internal.h: add LIBVPX_FORMAT_PRINTF
James Zern [Tue, 2 Nov 2021 23:29:52 +0000 (16:29 -0700)]
vpx_codec_internal.h: add LIBVPX_FORMAT_PRINTF

and use it to set the format attribute for the printf like function
vpx_internal_error(). this allows the main library to be built with
-Wformat-nonliteral without producing warnings; the examples will be
handled in a followup.

Bug: webm:1744
Change-Id: Iebc322e24db35d902c5a2b1ed767d2e10e9c91b9

3 years agoMerge "vp8_yv12_realloc_frame_buffer: move allocation check" into main
James Zern [Fri, 15 Oct 2021 20:08:58 +0000 (20:08 +0000)]
Merge "vp8_yv12_realloc_frame_buffer: move allocation check" into main

3 years agotest/Android.mk: import LICENSE indicators from AOSP
James Zern [Tue, 12 Oct 2021 18:57:39 +0000 (11:57 -0700)]
test/Android.mk: import LICENSE indicators from AOSP

https://android-review.googlesource.com/c/platform/external/libvpx/+/1853628
https://android.googlesource.com/platform/external/libvpx/+/e40f8afb1e51d3bd13d662c1881e3cfb616fa2b8

Change-Id: I15f185ab7c7661f4456c4ad7296fdda01dfb8d53

3 years agoMerge "Android.mk: import LICENSE indicators from AOSP" into main
James Zern [Mon, 11 Oct 2021 20:32:51 +0000 (20:32 +0000)]
Merge "Android.mk: import LICENSE indicators from AOSP" into main

3 years agoAndroid.mk: import LICENSE indicators from AOSP
James Zern [Sat, 9 Oct 2021 17:33:37 +0000 (10:33 -0700)]
Android.mk: import LICENSE indicators from AOSP

https://android-review.googlesource.com/c/platform/external/libvpx/+/1588942
https://android.googlesource.com/platform/external/libvpx/+/099828b5c770ef8630741721be4b6c25a8394204

Change-Id: Ieca1c882f82bcbc7546944b43af7fab358f925d2

3 years agovp8_yv12_realloc_frame_buffer: move allocation check
James Zern [Fri, 8 Oct 2021 23:24:23 +0000 (16:24 -0700)]
vp8_yv12_realloc_frame_buffer: move allocation check

to before the memset used under msan to avoid any spurious reports in
OOM conditions

Change-Id: I0c4ee92829bbcb356e94f503a4615caf891bb49d

3 years agoMerge branch 'smew' into main
Jerome Jiang [Thu, 7 Oct 2021 17:47:25 +0000 (10:47 -0700)]
Merge branch 'smew' into main

Bug: webm:1732

Change-Id: Id782a897d8005d316dc5b72859657c219edabf30

3 years agoUpdate AUTHORS and version info in libs.mk v1.11.0
Jerome Jiang [Tue, 5 Oct 2021 22:57:34 +0000 (15:57 -0700)]
Update AUTHORS and version info in libs.mk

Bug: webm:1732
Change-Id: I29ce77c7d02bd2f5cb0ef8412333df032744b668

3 years ago{vp8,vp9}_set_roi_map: fix validation with INT_MIN
James Zern [Fri, 1 Oct 2021 20:46:02 +0000 (13:46 -0700)]
{vp8,vp9}_set_roi_map: fix validation with INT_MIN

previously ranges were checked with abs() whose behavior is undefined
with INT_MIN. this fixes a crash when the original value is returned and
it later used as and offset into a table.

Bug: webm:1742
Change-Id: I345970b75c46699587a4fbc4a059e59277f4c2c8

3 years agoMerge changes If2ef4400,I345970b7 into main
Jerome Jiang [Mon, 4 Oct 2021 17:43:28 +0000 (17:43 +0000)]
Merge changes If2ef4400,I345970b7 into main

* changes:
  vpx_roi_map: add delta range info
  {vp8,vp9}_set_roi_map: fix validation with INT_MIN

3 years agovpx_roi_map: add delta range info
James Zern [Fri, 1 Oct 2021 22:42:50 +0000 (15:42 -0700)]
vpx_roi_map: add delta range info

Change-Id: If2ef4400562075b4e7abadc01638a46c0c7f1859

3 years ago{vp8,vp9}_set_roi_map: fix validation with INT_MIN
James Zern [Fri, 1 Oct 2021 20:46:02 +0000 (13:46 -0700)]
{vp8,vp9}_set_roi_map: fix validation with INT_MIN

previously ranges were checked with abs() whose behavior is undefined
with INT_MIN. this fixes a crash when the original value is returned and
it later used as and offset into a table.

Bug: webm:1742
Change-Id: I345970b75c46699587a4fbc4a059e59277f4c2c8

3 years agoMerge "vp8: Condition decimation drop logic on drop_frames_allowed" into main
Marco Paniconi [Fri, 1 Oct 2021 22:25:12 +0000 (22:25 +0000)]
Merge "vp8: Condition decimation drop logic on drop_frames_allowed" into main

3 years agovp8: Condition decimation drop logic on drop_frames_allowed
Marco Paniconi [Fri, 1 Oct 2021 20:16:56 +0000 (13:16 -0700)]
vp8: Condition decimation drop logic on drop_frames_allowed

This allows user to make sure frame will be encoded
when drop_frames is set off (on the fly), no matter
the state of the buffer.

Change-Id: Ia7b39b93fe3721dd586bdbede72c525db87b6890

3 years agovp8: For screen mode: clip buffer from below
Marco Paniconi [Fri, 1 Oct 2021 18:54:53 +0000 (11:54 -0700)]
vp8: For screen mode: clip buffer from below

Condition already existed for screen content mode,
but only when frame-dropper was off. Remove the
frame drop condition.

Change-Id: Ie7357041f5ca05b01e78b4bd3b40da060382591b

3 years agoCHANGELOG for Smew v1.11.0 v1.11.0-rc1
Jerome Jiang [Mon, 27 Sep 2021 22:52:53 +0000 (15:52 -0700)]
CHANGELOG for Smew v1.11.0

Bug: webm:1732
Change-Id: I6038f401cf1dfdcaca85b81d0b8b2c04967b44dd

3 years agoCap duration to avoid overflow
Jerome Jiang [Mon, 20 Sep 2021 20:37:43 +0000 (13:37 -0700)]
Cap duration to avoid overflow

Bug: webm:1728
Change-Id: Id13475660fa921e8ddcc89847e978da4c8d85886
(cherry picked from commit 09775194ffdb84b4979f3988e7ef301575b661df)

3 years agoDefine the VPX_NO_RETURN macro for MSVC
Wan-Teh Chang [Fri, 10 Sep 2021 22:54:51 +0000 (15:54 -0700)]
Define the VPX_NO_RETURN macro for MSVC

Define VPX_NO_RETURN as __declspec(noreturn) for MSVC. See
https://docs.microsoft.com/en-us/cpp/cpp/noreturn?view=msvc-160

This requires moving VPX_NO_RETURN before function declarations because
__declspec(noreturn) must be placed there. Fortunately GCC's
__attribute__((noreturn)) can be placed either before or after function
declarations.

Change-Id: Id9bb0077e2a4f16ec2ca9c913dd93673a0e385cf
(cherry picked from commit 8a6fbc0b4eb8538e213782bcdc3969a08b44e73b)

3 years agovp8 rc: Clear system state at the end of calls
Jerome Jiang [Fri, 24 Sep 2021 21:56:00 +0000 (14:56 -0700)]
vp8 rc: Clear system state at the end of calls

Clear system state at the end of rc calls to make sure the state is
consistent before and after

Change-Id: I59fe9c99485b1a8603c20db37961339b7575455f

3 years agoMerge "vp8 rc: support temporal layers" into main
Jerome Jiang [Thu, 23 Sep 2021 22:10:57 +0000 (22:10 +0000)]
Merge "vp8 rc: support temporal layers" into main

3 years agovp8 rc: support temporal layers
Jerome Jiang [Thu, 16 Sep 2021 17:16:44 +0000 (10:16 -0700)]
vp8 rc: support temporal layers

Change-Id: I2c7d5de0e17b072cb763f1659b1badce4fe0b82b

3 years agoMerge "Cap duration to avoid overflow" into main
Jerome Jiang [Wed, 22 Sep 2021 17:27:26 +0000 (17:27 +0000)]
Merge "Cap duration to avoid overflow" into main

3 years agoCap duration to avoid overflow
Jerome Jiang [Mon, 20 Sep 2021 20:37:43 +0000 (13:37 -0700)]
Cap duration to avoid overflow

Bug: webm:1728
Change-Id: Id13475660fa921e8ddcc89847e978da4c8d85886

3 years agovp8 rc: explicit cast to avoid VS build failure
Jerome Jiang [Thu, 16 Sep 2021 17:19:09 +0000 (10:19 -0700)]
vp8 rc: explicit cast to avoid VS build failure

Change-Id: I6a4daca12b79cf996964661e1af85aa6e258b446

3 years agoDefine the VPX_NO_RETURN macro for MSVC
Wan-Teh Chang [Fri, 10 Sep 2021 22:54:51 +0000 (15:54 -0700)]
Define the VPX_NO_RETURN macro for MSVC

Define VPX_NO_RETURN as __declspec(noreturn) for MSVC. See
https://docs.microsoft.com/en-us/cpp/cpp/noreturn?view=msvc-160

This requires moving VPX_NO_RETURN before function declarations because
__declspec(noreturn) must be placed there. Fortunately GCC's
__attribute__((noreturn)) can be placed either before or after function
declarations.

Change-Id: Id9bb0077e2a4f16ec2ca9c913dd93673a0e385cf

3 years agoAdd vp8 support to rc lib
Jerome Jiang [Tue, 31 Aug 2021 17:22:22 +0000 (10:22 -0700)]
Add vp8 support to rc lib

For 1 layer CBR only.
Support for temporal layers comes later.

Rename the library to libvpxrc

Bug: b/188853141

Change-Id: Ib7f977b64c05b1a0596870cb7f8e6768cb483850

3 years agovp8 rc: always update correction factor
Jerome Jiang [Wed, 8 Sep 2021 23:52:51 +0000 (16:52 -0700)]
vp8 rc: always update correction factor

Change-Id: Id40b9cb5a85a15fb313a2a93f14f6768259f7c15

3 years agoAdd codec control for vp8 external rc
Jerome Jiang [Thu, 2 Sep 2021 23:15:13 +0000 (16:15 -0700)]
Add codec control for vp8 external rc

disable cyclic refresh

Change-Id: I7905602919d5780831fad840577e97730ce0afc2

3 years agovp9 rc lib: Allow aq 3 to work for SVC with unit test
Jerome Jiang [Tue, 24 Aug 2021 21:30:54 +0000 (14:30 -0700)]
vp9 rc lib: Allow aq 3 to work for SVC with unit test

Also use round to cast float to int with more accurate calculation to
avoid error accumulation which causes qp to be different after ~290
frames.

Change-Id: Iff65a8fdc67401814fd253dbf148afe9887df97f

3 years agoMerge "vpx_ports/x86.h: sync with aom_ports/x86.h" into main
James Zern [Fri, 30 Jul 2021 00:48:08 +0000 (00:48 +0000)]
Merge "vpx_ports/x86.h: sync with aom_ports/x86.h" into main

3 years agovp9 rc: Fills VP9_COMP zero at initialization
Hirokazu Honda [Thu, 29 Jul 2021 17:42:35 +0000 (02:42 +0900)]
vp9 rc: Fills VP9_COMP zero at initialization

Change-Id: Ib1a544ce87e8fdbe23c0e54b6426ee228011b126

3 years agovpx_ports/x86.h: sync with aom_ports/x86.h
James Zern [Mon, 26 Jul 2021 23:52:56 +0000 (16:52 -0700)]
vpx_ports/x86.h: sync with aom_ports/x86.h

adds a few comments and makes the file ascii:
854b2766a Replace non-ASCII characters

Change-Id: I6c2d76b293158bcad9f1ded7a91a81bda1e700fb

3 years agoFix some instances of -Wunused-but-set-variable.
Peter Kasting [Mon, 26 Jul 2021 10:57:55 +0000 (03:57 -0700)]
Fix some instances of -Wunused-but-set-variable.

Bug: chromium:1203071
Change-Id: Ieb628f95d676ba3814b5caf8a02a884330928c77

3 years agoMerge "Remove unused old FP_MB_STATS code" into main
Yunqing Wang [Mon, 26 Jul 2021 20:13:38 +0000 (20:13 +0000)]
Merge "Remove unused old FP_MB_STATS code" into main

3 years agoMerge "Clean up allow_partition_search_skip code" into main
Yunqing Wang [Mon, 26 Jul 2021 19:19:02 +0000 (19:19 +0000)]
Merge "Clean up allow_partition_search_skip code" into main

3 years agoMerge "Disable allow_partition_search_skip feature" into main
Yunqing Wang [Sun, 25 Jul 2021 22:42:59 +0000 (22:42 +0000)]
Merge "Disable allow_partition_search_skip feature" into main

3 years agoRemove unused old FP_MB_STATS code
Yunqing Wang [Sat, 24 Jul 2021 05:45:45 +0000 (22:45 -0700)]
Remove unused old FP_MB_STATS code

Change-Id: I78ac1f8ce1598de295efd2ac1fe8244072d9b501

3 years agoClean up allow_partition_search_skip code
Yunqing Wang [Sat, 24 Jul 2021 05:34:01 +0000 (22:34 -0700)]
Clean up allow_partition_search_skip code

Change-Id: Ia05157fc3e613d93f10df5abddd77a740a0005ca

3 years agoDisable allow_partition_search_skip feature
Yunqing Wang [Fri, 23 Jul 2021 17:55:10 +0000 (10:55 -0700)]
Disable allow_partition_search_skip feature

This feature was added to help speed up still images and slideshows.
It didn't work anymore, and thus was disabled. Code cleanup will
follow.

This had negligible impact to regular test sets. Borg test result
on ugc360p set at speed 3.
  avg_psnr:  ovr_psnr:  ssim:    speed:
   -0.244    -0.278    -0.153    -0.973

Change-Id: If74edabce0c93be1361e645ffd2eec063c2db76b

3 years agoMerge "Add control to get QP for all spatial layers" into main
Jerome Jiang [Fri, 23 Jul 2021 18:20:39 +0000 (18:20 +0000)]
Merge "Add control to get QP for all spatial layers" into main

3 years agoAdd control to get QP for all spatial layers
Jerome Jiang [Wed, 21 Jul 2021 21:32:27 +0000 (14:32 -0700)]
Add control to get QP for all spatial layers

Change-Id: I77a9884351e71649c8f8632293d9515c60f6adbc

3 years agoMerge "Use round to be more accurate casting float to int" into main
Jerome Jiang [Thu, 22 Jul 2021 17:07:58 +0000 (17:07 +0000)]
Merge "Use round to be more accurate casting float to int" into main

3 years agoAdd cyclic refresh to vp9 rtc external ratecontrol
Jerome Jiang [Tue, 29 Jun 2021 21:48:35 +0000 (14:48 -0700)]
Add cyclic refresh to vp9 rtc external ratecontrol

Change-Id: Ia2a881399aa31ca0f34481b975362ddd4ad87f1c

3 years agoUse round to be more accurate casting float to int
Jerome Jiang [Thu, 15 Jul 2021 23:05:16 +0000 (16:05 -0700)]
Use round to be more accurate casting float to int

Change-Id: Ifd5961917831752b176dd75d39d6b2cba6ce72fa

3 years agoMerge "Refactor rtc rate control test" into main
Jerome Jiang [Mon, 19 Jul 2021 21:00:35 +0000 (21:00 +0000)]
Merge "Refactor rtc rate control test" into main

3 years agoRefactor rtc rate control test
Jerome Jiang [Mon, 12 Jul 2021 21:04:12 +0000 (14:04 -0700)]
Refactor rtc rate control test

Remove golden files. Run actual encoding as the ground truth.

Change-Id: I1cea001278c1e9409bb02d33823cf69192c790a4

3 years agoAvoid chroma resampling for 420mpeg2 input
Bohan Li [Thu, 15 Jul 2021 20:21:35 +0000 (13:21 -0700)]
Avoid chroma resampling for 420mpeg2 input

BUG=aomedia:3080

Change-Id: I4ed81abf4b799224085485560f675c10c318cde6

3 years agoAdd codec control for rtc external ratectrl lib
Jerome Jiang [Tue, 13 Jul 2021 18:54:34 +0000 (11:54 -0700)]
Add codec control for rtc external ratectrl lib

This will do 3 things:

Turn off low motion computation
Turn off gf update constrain on key frame frequency
turn off content mode for cyclic refresh

Those are used to verify the external ratectrl lib works as expected.

Change-Id: Ic6e61498de82d6b3973e58df246cf5e05f838680

3 years agoCheck for addition overflows in vpx_img_set_rect()
Wan-Teh Chang [Thu, 8 Jul 2021 22:17:48 +0000 (15:17 -0700)]
Check for addition overflows in vpx_img_set_rect()

Check for x + w and y + h overflows in vpx_img_set_rect().

Move the declaration of the local variable 'data' to the block it is
used in.

Change-Id: I6bda875e1853c03135ec6ce29015bcc78bb8b7ba

3 years agoDocument vpx_img_set_rect() more precisely
Wan-Teh Chang [Thu, 8 Jul 2021 22:08:05 +0000 (15:08 -0700)]
Document vpx_img_set_rect() more precisely

Document the side effects and return value of vpx_img_set_rect() more
precisely.

Change-Id: Id1120bc478ff090a70b4ddd23c4798026bbefe10

3 years agoMerge "Avoid overflow in calc_iframe_target_size" into main
Yaowu Xu [Thu, 8 Jul 2021 19:59:34 +0000 (19:59 +0000)]
Merge "Avoid overflow in calc_iframe_target_size" into main

3 years agoMerge "Add codec control to get loopfilter level" into main
Jerome Jiang [Fri, 2 Jul 2021 22:59:08 +0000 (22:59 +0000)]
Merge "Add codec control to get loopfilter level" into main

3 years agoAdd codec control to get loopfilter level
Jerome Jiang [Fri, 2 Jul 2021 18:28:48 +0000 (11:28 -0700)]
Add codec control to get loopfilter level

Change-Id: I70d417da900082160e7ba53315af98eceede257c

3 years agoratectrl_rtc.h: quiet MSVC int64_t->int conv warning
James Zern [Fri, 2 Jul 2021 05:16:42 +0000 (22:16 -0700)]
ratectrl_rtc.h: quiet MSVC int64_t->int conv warning

target_bandwidth is int64_t, but layer_target_bitrate[0] is an int. this
is safe in the only place it's set because target_bandwidth defaults to
1000. target_bandwidth is later used to populate the cpi's target, which
is an unsigned int so there may be further fixes/cleanups that can be
done.

Change-Id: I35dbaa2e55a0fca22e0e2680dcac9ea4c6b2815a

3 years agoAvoid overflow in calc_iframe_target_size
Jorge E. Moreira [Wed, 30 Jun 2021 18:33:51 +0000 (11:33 -0700)]
Avoid overflow in calc_iframe_target_size

The changed product was observed to attempt to multiply 1800 by 2500000,
which overflows unsigned 32 bits. Converting to unsigned 64 bits first
and testing whether the final result fits in 32 bits solves the problem.

BUG=b:179686142

Change-Id: I5d27317bf14b0311b739144c451d8e172db01945

3 years agoMerge "vp9-rtc: Extract content dependency in cyclic refresh" into main
Marco Paniconi [Tue, 29 Jun 2021 18:34:46 +0000 (18:34 +0000)]
Merge "vp9-rtc: Extract content dependency in cyclic refresh" into main

3 years agoMerge "Disallow skipping transform and quantization" into main
Cheng Chen [Tue, 29 Jun 2021 16:48:29 +0000 (16:48 +0000)]
Merge "Disallow skipping transform and quantization" into main

3 years agoDisallow skipping transform and quantization
Cheng Chen [Thu, 17 Jun 2021 22:36:18 +0000 (15:36 -0700)]
Disallow skipping transform and quantization

The encoder has a feature to skip transform and quantization based
on model rd analysis. It could happen that the model
based analysis lets the encoder skips transform and quantization, while
a bad prediction occurs, leading to bad reconstructed blocks, which
are intrusive and apparently coding errors.

We add a speed feature to guard the skipping feature.
Due to the risk of bad perceptual quality, we disallow such skipping
by default.

On hdres test set, speed 2, the coding performance difference is 0.025%,
speed difference is 1.2%, which can be considered non significant.

BUG=webm:1729

Change-Id: I48af01ae8dcc7a76c05c695f3f3e68b866c89574

3 years agovp9-rtc: Extract content dependency in cyclic refresh
Marco Paniconi [Fri, 25 Jun 2021 06:34:36 +0000 (23:34 -0700)]
vp9-rtc: Extract content dependency in cyclic refresh

For usage in the external RC. When content_mode = 0,
the cyclic refresh has no dependency on the content
(motion, spatial variance, motion vectors, etc,).

The content_mode = 0, when compared to content_mode = 1,
on rtc set for speed 7: has some regression on some
clips (~3-5%), but overall/average bdrate loss is
about ~1-2%.

Comparing aq_mode=3 with content_mode = 0, vs aq_mode=3:
about ~14% avg/overall bdrate gain, but has ~3-7% regression
on some hard motion clip (e.g.m street).

Change-Id: I93117fabb8f7f89032c15baf1292b201e8c07362

3 years agoAdd constructor to VP9RateControlRtcConfig
Jerome Jiang [Thu, 24 Jun 2021 20:13:50 +0000 (13:13 -0700)]
Add constructor to VP9RateControlRtcConfig

Also add max_inter_bitrate_pct

Change-Id: Ie2c0e7f1397ca0bb55214251906412cdf24e42e2