platform/upstream/libvpx.git
2 years agoMerge "quantize: test lowbd in highbd builds" into main
Johann Koenig [Tue, 20 Sep 2022 00:12:13 +0000 (00:12 +0000)]
Merge "quantize: test lowbd in highbd builds" into main

2 years agoquantize: test lowbd in highbd builds
Johann [Sun, 18 Sep 2022 01:26:00 +0000 (10:26 +0900)]
quantize: test lowbd in highbd builds

Change-Id: I7af273e979415a8b8cafb7494728d2736862f4a5

2 years agofwd_txfm: remove avx2 file from non-hbd
Johann [Fri, 16 Sep 2022 22:54:40 +0000 (07:54 +0900)]
fwd_txfm: remove avx2 file from non-hbd

Resolves warning on OS X:
file: libvpx_g.a(fwd_txfm_avx2.c.o) has no symbols

Change-Id: Ie8b290bb3ed329656beb883d552c98353f1ed5e5

2 years agoAdd vpx_highbd_sad64x{64,32}x4d_avx2.
Scott LaVarnway [Wed, 14 Sep 2022 10:36:46 +0000 (03:36 -0700)]
Add vpx_highbd_sad64x{64,32}x4d_avx2.

~2x faster than the sse2 version.

Bug: b/245917257

Change-Id: I4742950ab7b90d7f09e8d4687e1e967138acee39

2 years agoAdd vpx_highbd_sad32x{64,32,16}x4d_avx2.
Scott LaVarnway [Mon, 12 Sep 2022 14:40:39 +0000 (07:40 -0700)]
Add vpx_highbd_sad32x{64,32,16}x4d_avx2.

~2.4x faster than the sse2 version.

Bug: b/245917257

Change-Id: I6df2bd62b46e5e175c8ad80daa6de3a1c313db0f

2 years agoMerge "Add vpx_highbd_sad16x{32,16,8}x4d_avx2." into main
Scott LaVarnway [Mon, 12 Sep 2022 12:18:19 +0000 (12:18 +0000)]
Merge "Add vpx_highbd_sad16x{32,16,8}x4d_avx2." into main

2 years agoUpdate third_party/googletest to v1.12.1
Wan-Teh Chang [Thu, 8 Sep 2022 22:35:13 +0000 (15:35 -0700)]
Update third_party/googletest to v1.12.1

See https://github.com/google/googletest/releases/tag/release-1.12.1.

Modeled after https://aomedia-review.googlesource.com/c/aom/+/162601.

Change-Id: If0ced3097b4c8490985e3381aaac9b3266d52ae7

2 years agoAdd vpx_highbd_sad16x{32,16,8}x4d_avx2.
Scott LaVarnway [Thu, 8 Sep 2022 20:05:55 +0000 (13:05 -0700)]
Add vpx_highbd_sad16x{32,16,8}x4d_avx2.

1.98x to 2.3x faster than the sse2 version.

Bug: b/245917257

Change-Id: Ie4f9bb942ffaf4af7d395fb5a5978b41aabfc93c

2 years agovp8_decode: declare 2 variables volatile
James Zern [Thu, 8 Sep 2022 01:41:13 +0000 (18:41 -0700)]
vp8_decode: declare 2 variables volatile

fixes -Wclobbered warnings with gcc 12.1.0:
vp8/vp8_dx_iface.c|278 col 16| warning: variable 'w' might be clobbered
by 'longjmp' or 'vfork' [-Wclobbered]
vp8/vp8_dx_iface.c|278 col 19| warning: variable 'h' might be clobbered
by 'longjmp' or 'vfork' [-Wclobbered]

Change-Id: Ib2c606a3450188d7869c066cacaf5615d9746181

2 years agoMerge "x86,cosmetics: prefer _mm_setzero_si128/_mm256_setzero_si256" into main
James Zern [Tue, 6 Sep 2022 22:23:30 +0000 (22:23 +0000)]
Merge "x86,cosmetics: prefer _mm_setzero_si128/_mm256_setzero_si256" into main

2 years agosad_neon: enable UDOT implementation w/aarch32
James Zern [Fri, 2 Sep 2022 23:55:43 +0000 (16:55 -0700)]
sad_neon: enable UDOT implementation w/aarch32

Change-Id: Ia28305ec5c61518b732cbacbd102acd2cb7f9d82

2 years agovariance_neon.cc: simplify __ARM_FEATURE_DOTPROD check
James Zern [Fri, 2 Sep 2022 23:44:14 +0000 (16:44 -0700)]
variance_neon.cc: simplify __ARM_FEATURE_DOTPROD check

missed in
447e27588 vpx_dsp,neon: simplify __ARM_FEATURE_DOTPROD check

+ fix #if comments

only check that the macro is defined, the value doesn't have any effect.

from https://arm-software.github.io/acle/main/acle.html:

5.5.7.7.  Dot Product extension
  __ARM_FEATURE_DOTPROD is defined if the dot product data manipulation
  instructions are supported and the vector intrinsics are available.
  Note that this implies:
    - __ARM_NEON == 1

Change-Id: I098b96421b7de5928bb3b11612ca1f32e7b6cbc4

2 years agox86,cosmetics: prefer _mm_setzero_si128/_mm256_setzero_si256
James Zern [Fri, 2 Sep 2022 23:17:52 +0000 (16:17 -0700)]
x86,cosmetics: prefer _mm_setzero_si128/_mm256_setzero_si256

over *_set1_*(0)

Change-Id: I136e1798a2ce286480ebb9418db67a2f1e92b9a2

2 years agovpx_dsp,neon: simplify __ARM_FEATURE_DOTPROD check
James Zern [Fri, 2 Sep 2022 19:17:20 +0000 (12:17 -0700)]
vpx_dsp,neon: simplify __ARM_FEATURE_DOTPROD check

only check that the macro is defined, the value doesn't have any effect.

from https://arm-software.github.io/acle/main/acle.html:

5.5.7.7.  Dot Product extension
  __ARM_FEATURE_DOTPROD is defined if the dot product data manipulation
  instructions are supported and the vector intrinsics are available.
  Note that this implies:
    - __ARM_NEON == 1

Change-Id: I164fe121ccefda99050a9b6a99738a2b518520f3

2 years agoneon,load_unaligned_*: use dup for lane 0
James Zern [Fri, 2 Sep 2022 01:47:50 +0000 (18:47 -0700)]
neon,load_unaligned_*: use dup for lane 0

this produces better assembly with gcc (11.3.0-3); no change in assembly
using clang from the r24 android sdk (Android (8075178, based on
r437112b) clang version 14.0.1
(https://android.googlesource.com/toolchain/llvm-project
8671348b81b95fc603505dfc881b45103bee1731)

Change-Id: Ifec252d4f499f23be1cd94aa8516caf6b3fbbc11

2 years agotest/*,cosmetics: normalize void parameter lists
James Zern [Wed, 31 Aug 2022 23:35:08 +0000 (16:35 -0700)]
test/*,cosmetics: normalize void parameter lists

replace (void) with (); use of this synonym is more common in C++ code.

Change-Id: I9813e82234dc9caa7115918a0491b0040f6afaf4

2 years agoRemove const for pass-by-value parameters
Yaowu Xu [Tue, 30 Aug 2022 16:04:58 +0000 (09:04 -0700)]
Remove const for pass-by-value parameters

This also fixes MSVC compiler warnings.

Change-Id: I20dc9ac821275ba95598f3016fc6b23e884e13b7

2 years agoMerge "L2E: Add gop size and ARF existence to frame info" into main
Cheng Chen [Tue, 30 Aug 2022 04:25:33 +0000 (04:25 +0000)]
Merge "L2E: Add gop size and ARF existence to frame info" into main

2 years agohighbd_variance_neon,cosmetics: reorder a few lines
James Zern [Sat, 27 Aug 2022 05:12:44 +0000 (22:12 -0700)]
highbd_variance_neon,cosmetics: reorder a few lines

Change-Id: Ia6fa54652d7f94687e64108482bb0f28ca06cf49

2 years agoL2E: Add gop size and ARF existence to frame info
Cheng Chen [Fri, 26 Aug 2022 21:29:32 +0000 (14:29 -0700)]
L2E: Add gop size and ARF existence to frame info

Pass the encode frame info to external ml model, with the information
of gop size and whether alt ref is used.

Change-Id: I55be2d3de83d7182c1a1a174e44ead7e19045c9d

2 years agoMerge "[NEON] Add highbd *variance* functions" into main
James Zern [Fri, 26 Aug 2022 02:07:34 +0000 (02:07 +0000)]
Merge "[NEON] Add highbd *variance* functions" into main

2 years agoMerge "vpx_encoder.h: note VPX_ERROR_RESILIENT_PARTITIONS is VP8-only" into main
James Zern [Fri, 26 Aug 2022 02:01:55 +0000 (02:01 +0000)]
Merge "vpx_encoder.h: note VPX_ERROR_RESILIENT_PARTITIONS is VP8-only" into main

2 years ago[NEON] Add highbd *variance* functions
Konstantinos Margaritis [Wed, 24 Aug 2022 12:28:43 +0000 (12:28 +0000)]
[NEON] Add highbd *variance* functions

        Total gain for 12-bit encoding:
        * ~7.2% for best profile
        * ~5.8% for rt profile

Change-Id: I5b70415fb89d1bbb02a0c139eb317ba6b08adede

2 years agoMerge "vp9: fix ubsan sub-overflows" into main
James Zern [Thu, 25 Aug 2022 20:44:41 +0000 (20:44 +0000)]
Merge "vp9: fix ubsan sub-overflows" into main

2 years agovpx_encoder.h: note VPX_ERROR_RESILIENT_PARTITIONS is VP8-only
James Zern [Thu, 25 Aug 2022 17:50:16 +0000 (10:50 -0700)]
vpx_encoder.h: note VPX_ERROR_RESILIENT_PARTITIONS is VP8-only

Change-Id: If71b2ec766f9f41253ce5a34987ffd208f9c8381

2 years agoMerge "vp8_ratectrl_rtc_test.cc: ensure frame_type is initialized" into main
James Zern [Thu, 25 Aug 2022 16:55:42 +0000 (16:55 +0000)]
Merge "vp8_ratectrl_rtc_test.cc: ensure frame_type is initialized" into main

2 years agolibs.doxy_template: remove obsolete CLASS_DIAGRAMS
James Zern [Thu, 25 Aug 2022 01:50:10 +0000 (18:50 -0700)]
libs.doxy_template: remove obsolete CLASS_DIAGRAMS

This was reported with doxygen 1.9.4.

Also update the comment for CLASS_GRAPH by running "doxygen -u" because
the original comment for CLASS_GRAPH mentions the obsolete tag
'CLASS_DIAGRAMS',

Change-Id: I3bca547201f794d363bd814b7c7f7c9d7088797a

2 years agovp8_ratectrl_rtc_test.cc: ensure frame_type is initialized
James Zern [Wed, 24 Aug 2022 22:48:24 +0000 (15:48 -0700)]
vp8_ratectrl_rtc_test.cc: ensure frame_type is initialized

this fixes a valgrind failure:
==1095597== Conditional jump or move depends on uninitialised value(s)
==1095597==    at 0x12E0CC: (anonymous
namespace)::Vp8RcInterfaceTest::PreEncodeFrameHook(libvpx_test::VideoSource*,
libvpx_test::  > Encoder*) (vp8_ratectrl_rtc_test.cc:131)
==1095597==    by 0x1255A9:
libvpx_test::EncoderTest::RunLoop(libvpx_test::VideoSource*)
(encode_test_driver.cc:205)

Bug: webm:1776
Change-Id: Id3b40f62573ee513e79c74b6315c71b6ecd22c9a
Fixed: webm:1776

2 years agoMerge "[NEON] Improve vpx_quantize_b* functions" into main
James Zern [Wed, 24 Aug 2022 19:18:25 +0000 (19:18 +0000)]
Merge "[NEON] Improve vpx_quantize_b* functions" into main

2 years ago.clang-format: update to clang-format-11
clang-format [Sat, 13 Aug 2022 17:33:56 +0000 (10:33 -0700)]
.clang-format: update to clang-format-11

only store the deltas from --style Google in the file and reapply using
Debian clang-format version 11.1.0-6+build1

Bug: b/229626362
Change-Id: I3e18a2e7c17a90a48405b3cf1b37ebc652aba0db

2 years ago[NEON] Improve vpx_quantize_b* functions
Konstantinos Margaritis [Sat, 20 Aug 2022 19:02:15 +0000 (19:02 +0000)]
[NEON] Improve vpx_quantize_b* functions

Slight optimization, prefetch gives a 1% improvement in 1st pass

Change-Id: Iba4664964664234666406ab53893e02d481fbe61

2 years agovp9_ratectrl_rtc_test: initialize loopfilter_ctrl[]
James Zern [Tue, 23 Aug 2022 02:33:26 +0000 (19:33 -0700)]
vp9_ratectrl_rtc_test: initialize loopfilter_ctrl[]

this was added in:
  7beafefd1 vp9: Allow for disabling loopfilter per spatial layer
but the test doesn't zero initialize its svc_params_ member.

fixes the use of an uninitialized value, reported by valgrind and
integer sanitizer:
[ RUN      ] VP9/RcInterfaceSvcTest.Svc/0
==1064682== Conditional jump or move depends on uninitialised value(s)
==1064682==    at 0x1C5624: loopfilter_frame (vp9_encoder.c:3285)
==1064682==    by 0x1C9B54: encode_frame_to_data_rate (vp9_encoder.c:5595)
==1064682==    by 0x1CA2EE: SvcEncode (vp9_encoder.c:5789)
==1064682==    by 0x1CEA01: vp9_get_compressed_data (vp9_encoder.c:7891)
==1064682==    by 0x185F0E: encoder_encode (vp9_cx_iface.c:1437)
==1064682==    by 0x1503BB: vpx_codec_encode (vpx_encoder.c:208)

vp9/encoder/vp9_svc_layercontext.c:362:26: runtime error: implicit
conversion from type 'int' of value -1 (32-bit, signed) to type
'LOOPFILTER_CONTROL' changed the value to 4294967295 (32-bit, unsigned)
    #0 0x558925f45377 in vp9_restore_layer_context vp9/encoder/vp9_svc_layercontext.c:362:26
    #1 0x558925ef89fd in vp9_get_compressed_data vp9/encoder/vp9_encoder.c:7781:5
    #2 0x558925e3ef3e in encoder_encode vp9/vp9_cx_iface.c:1437:20

Bug: b/229626362
Change-Id: I33d244be7752c68b71efa9c62ca45d6b202ec761

2 years agoMerge "vp9.read_inter_block_mode_info: return on corruption" into main
James Zern [Mon, 22 Aug 2022 22:36:09 +0000 (22:36 +0000)]
Merge "vp9.read_inter_block_mode_info: return on corruption" into main

2 years agoMerge "highbd_quantize_neon.c: remove unneeded assert.h" into main
James Zern [Mon, 22 Aug 2022 22:21:46 +0000 (22:21 +0000)]
Merge "highbd_quantize_neon.c: remove unneeded assert.h" into main

2 years agoMerge "vp9,search_new_mv: descale rather than scale sse" into main
James Zern [Mon, 22 Aug 2022 22:21:28 +0000 (22:21 +0000)]
Merge "vp9,search_new_mv: descale rather than scale sse" into main

2 years agoMerge changes Iabed118b,I60a384b2 into main
James Zern [Mon, 22 Aug 2022 22:21:00 +0000 (22:21 +0000)]
Merge changes Iabed118b,I60a384b2 into main

* changes:
  use VPX_NO_UNSIGNED_SHIFT_CHECK with entropy functions
  compiler_attributes.h: add VPX_NO_UNSIGNED_SHIFT_CHECK

2 years ago[NEON] Add vpx_highbd_subtract_block function
Konstantinos Margaritis [Mon, 22 Aug 2022 19:46:50 +0000 (19:46 +0000)]
[NEON] Add vpx_highbd_subtract_block function

    Total gain for 12-bit encoding:
    * ~1% for best and rt profile

Change-Id: I4039120dc570baab1ae519a5e38b1acff38d81f0

2 years ago[NEON] Added vpx_highbd_sad* functions
Konstantinos Margaritis [Fri, 19 Aug 2022 22:00:42 +0000 (22:00 +0000)]
[NEON] Added vpx_highbd_sad* functions

    Total gain for 12-bit encoding:
    * ~7.8% for best profile
    * ~10% for rt profile

Change-Id: I89eda5c4372a5b628c9df84cdeb4c8486fc44789

2 years agohighbd_quantize_neon.c: remove unneeded assert.h
James Zern [Mon, 22 Aug 2022 17:48:40 +0000 (10:48 -0700)]
highbd_quantize_neon.c: remove unneeded assert.h

Change-Id: I041f5fb23b856a2b519669b5bf8a40d3772b4a6e

2 years agoMerge "[NEON] Added vpx_highbd_quantize_b* functions" into main
James Zern [Mon, 22 Aug 2022 17:45:52 +0000 (17:45 +0000)]
Merge "[NEON] Added vpx_highbd_quantize_b* functions" into main

2 years agoMerge "Fix TEST_P(SADx4Test, DISABLED_Speed)" into main
Scott LaVarnway [Mon, 22 Aug 2022 10:36:09 +0000 (10:36 +0000)]
Merge "Fix TEST_P(SADx4Test, DISABLED_Speed)" into main

2 years ago[NEON] Added vpx_highbd_quantize_b* functions
Konstantinos Margaritis [Fri, 12 Aug 2022 17:41:11 +0000 (17:41 +0000)]
[NEON] Added vpx_highbd_quantize_b* functions

    Total gain for 12-bit encoding:
    * ~4.8% for best profile
    * ~6.2% for rt profile

Change-Id: I61e646ab7aedf06a25db1365d6d1cf7b05101c21

2 years agoMerge "loopfilter.c: normalize flat func param type" into main
James Zern [Sat, 20 Aug 2022 00:00:06 +0000 (00:00 +0000)]
Merge "loopfilter.c: normalize flat func param type" into main

2 years agovp9.read_inter_block_mode_info: return on corruption
James Zern [Fri, 19 Aug 2022 00:51:19 +0000 (17:51 -0700)]
vp9.read_inter_block_mode_info: return on corruption

with block sizes < 8x8 previously only the inner loop was aborted. this
could cause propagation of invalid motion vectors to scale_mv().

this quiets integer sanitizer warnings of the form:
vp9/common/vp9_mvref_common.h:239:18: runtime error: implicit conversion
from type 'int' of value 32768 (32-bit, signed) to type 'int16_t' (aka
'short') changed the value to -32768 (16-bit, signed)

Bug: b/229626362
Change-Id: I58b5a425adf21542cbf4cc4dd5ab3cc5ed008264

2 years agouse VPX_NO_UNSIGNED_SHIFT_CHECK with entropy functions
James Zern [Thu, 18 Aug 2022 18:35:06 +0000 (11:35 -0700)]
use VPX_NO_UNSIGNED_SHIFT_CHECK with entropy functions

these shift values off the most significant bit as part of the process;
vp8_regular_quantize_b_sse4_1 is included here for a special case of
mask creation

quiets warnings of the form:
vp8/decoder/dboolhuff.h:81:11: runtime error: left shift of
2373679303235599696 by 3 places cannot be represented in type
'VP8_BD_VALUE' (aka 'unsigned long')

vp8/encoder/bitstream.c:257:18: runtime error: left shift of 2147493041
by 1 places cannot be represented in type 'unsigned int'

vp8/encoder/x86/quantize_sse4.c:114:18: runtime error: left shift of
4294967294 by 1 places cannot be represented in type 'unsigned int'

vp9/encoder/vp9_pickmode.c:1632:41: runtime error: left shift of
4294967295 by 1 places cannot be represented in type 'unsigned int'

Bug: b/229626362
Change-Id: Iabed118b2a094232783e5ad0e586596d874103ca

2 years agocompiler_attributes.h: add VPX_NO_UNSIGNED_SHIFT_CHECK
James Zern [Thu, 18 Aug 2022 02:20:25 +0000 (19:20 -0700)]
compiler_attributes.h: add VPX_NO_UNSIGNED_SHIFT_CHECK

and use it on MD5Transform(); this behavior is well defined and is only
a warning with -fsanitize=integer, not -fsanitize=undefined.

quiets warnings of the form:
md5_utils.c:163:3: runtime error: left shift of 143704723 by 7 places
cannot be represented in type 'unsigned int'

Bug: b/229626362
Change-Id: I60a384b2c2556f5ce71ad8ebce050329aba0b4e4

2 years agovp9,search_new_mv: descale rather than scale sse
James Zern [Thu, 18 Aug 2022 18:57:32 +0000 (11:57 -0700)]
vp9,search_new_mv: descale rather than scale sse

this changes from scaling best sse to downscaling base sse in
comparisons.

this quiets an integer sanitizer warning of the form:
vp9/encoder/vp9_pickmode.c:1632:41: runtime error: left shift of
4294967295 by 1 places cannot be represented in type 'unsigned int'

Bug: b/229626362
Change-Id: Iee2920474ba700a46177d4514ba6ef7691958069

2 years agoupdate_thresh_freq_fact_row_mt: normalize param types
James Zern [Thu, 18 Aug 2022 18:56:25 +0000 (11:56 -0700)]
update_thresh_freq_fact_row_mt: normalize param types

make source_variance unsigned; this matches update_thresh_freq_fact()
and the type of the MACROBLOCK member.

quiets integer sanitizer warnings of the form:
vp9/encoder/vp9_pickmode.c:2710:58: runtime error: implicit conversion
from type 'unsigned int' of value 4294967295 (32-bit, unsigned) to type
'int' changed the value to -1 (32-bit, signed)

Bug: b/229626362
Change-Id: I812c6ca914507bf25cad323dea3d91a3a2ea4f1d

2 years agoloopfilter.c: normalize flat func param type
James Zern [Thu, 18 Aug 2022 18:45:49 +0000 (11:45 -0700)]
loopfilter.c: normalize flat func param type

flat/flat2 are stored as int8_t as returned by the filter_mask*
functions.

this quiets integer sanitizer warnings of the form:
vpx_dsp/loopfilter.c:197:28: runtime error: implicit conversion from
type 'int8_t' (aka 'signed char') of value -1 (8-bit, signed) to type
'uint8_t' (aka 'unsigned char') changed the value to 255 (8-bit,
unsigned)

Bug: b/229626362
Change-Id: Iacb6ae052d4cb2b6e0ebccbacf59ece9501d3b5f

2 years agoMerge changes Icfc59932,I3d1ca618,Id3966912,I56f74981,Ia9a5dc5e, ... into main
James Zern [Thu, 18 Aug 2022 23:16:33 +0000 (23:16 +0000)]
Merge changes Icfc59932,I3d1ca618,Id3966912,I56f74981,Ia9a5dc5e, ... into main

* changes:
  vpx_encoder.h: make flag constants unsigned
  vp8,VP8_COMP: normalize segment_encode_breakout type
  webmdec,WebmInputContext: make timestamp_ns signed
  highbd_quantize_intrin_sse2: quiet int sanitizer warnings
  load_unaligned_u32: use an int w/_mm_cvtsi32_si128
  variance_sse2.c: add some missing casts

2 years agoFix TEST_P(SADx4Test, DISABLED_Speed)
Scott LaVarnway [Thu, 18 Aug 2022 19:19:08 +0000 (12:19 -0700)]
Fix TEST_P(SADx4Test, DISABLED_Speed)

The reference code was being timed instead of the optimized code.

Change-Id: I67eb08dcda80e20eaa075dc2c91b7e8ef5c0cdfb

2 years agoMerge "Add vp9_highbd_quantize_fp_32x32_neon()." into main
Scott LaVarnway [Wed, 17 Aug 2022 10:59:57 +0000 (10:59 +0000)]
Merge "Add vp9_highbd_quantize_fp_32x32_neon()." into main

2 years agovpx_encoder.h: make flag constants unsigned
James Zern [Wed, 17 Aug 2022 04:59:20 +0000 (21:59 -0700)]
vpx_encoder.h: make flag constants unsigned

this matches the type for vpx_codec_frame_flags_t and
vpx_codec_er_flags_t and quiets int sanitizer warnings of the form:

implicit conversion from type 'int' of value -9 (32-bit, signed) to type
'unsigned int' changed the value to 4294967287 (32-bit, unsigned)

Bug: b/229626362
Change-Id: Icfc5993250f37cedb300c7032cab28ce4bec1f86

2 years agovp8,VP8_COMP: normalize segment_encode_breakout type
James Zern [Wed, 17 Aug 2022 00:46:24 +0000 (17:46 -0700)]
vp8,VP8_COMP: normalize segment_encode_breakout type

use unsigned int as the API value is of this type; this quiets some
integer sanitizer warnings of the form:
implicit conversion from type 'unsigned int' of value 2147483648
(32-bit, unsigned) to type 'int' changed the value to -2147483648
(32-bit, signed)

Bug: b/229626362
Change-Id: I3d1ca618bf1b3cd57a5dca65a3067f351c1473f8

2 years agowebmdec,WebmInputContext: make timestamp_ns signed
James Zern [Wed, 17 Aug 2022 00:54:14 +0000 (17:54 -0700)]
webmdec,WebmInputContext: make timestamp_ns signed

this matches the type returned from libwebm, which uses -1 as an error;
quiets integer sanitizer warnings of the form:
implicit conversion from type 'long long' of value -1 (64-bit, signed)
to type 'uint64_t' (aka 'unsigned long') changed the value to
18446744073709551615 (64-bit, unsigned)

Bug: b/229626362
Change-Id: Id3966912f802aee3c0f7852225b55f3057c3e76a

2 years agohighbd_quantize_intrin_sse2: quiet int sanitizer warnings
James Zern [Wed, 17 Aug 2022 00:28:08 +0000 (17:28 -0700)]
highbd_quantize_intrin_sse2: quiet int sanitizer warnings

add a missing cast in ^ operations; quiets warnings of the form:
implicit conversion from type 'int' of value -1 (32-bit, signed) to type
'unsigned int' changed the value to 4294967295 (32-bit, unsigned)

Bug: b/229626362
Change-Id: I56f74981050b2c9d00bad20e68f1b73ce7454729

2 years agoload_unaligned_u32: use an int w/_mm_cvtsi32_si128
James Zern [Tue, 16 Aug 2022 23:52:06 +0000 (16:52 -0700)]
load_unaligned_u32: use an int w/_mm_cvtsi32_si128

this matches the type of the function parameter; quiets integer
sanitizer warnings of the form:
implicit conversion from type 'uint32_t' (aka 'unsigned int') of value
3215646151 (32-bit, unsigned) to type 'int' changed the value to
-1079321145 (32-bit, signed)

Bug: b/229626362
Change-Id: Ia9a5dc5e1f57cbf4f8f8fa457bb674ef43369d37

2 years agovariance_sse2.c: add some missing casts
James Zern [Tue, 16 Aug 2022 23:48:00 +0000 (16:48 -0700)]
variance_sse2.c: add some missing casts

quiets integer sanitizer warnings of the form:
../vpx_dsp/x86/variance_sse2.c:100:10: runtime error: implicit
conversion from type 'unsigned int' of value 4294966272 (32-bit,
unsigned) to type 'int' changed the value to -1024 (32-bit, signed)

Bug: b/229626362
Change-Id: I150cc0a6a6b85143c3bf96886686fe3a40897db5

2 years agoconfigure: add -Wno-pass-failed for libyuv
James Zern [Tue, 16 Aug 2022 20:57:25 +0000 (13:57 -0700)]
configure: add -Wno-pass-failed for libyuv

with certain optimization flags or sanitizers enabled some code may fail
to vectorize:
third_party/libyuv/source/row_common.cc:3178:7: warning: loop not
vectorized: the optimizer was unable to perform the requested
transformation; the transformation might be disabled or specified as
part of an unsupported transformation ordering
[-Wpass-failed=transform-warning]

this was observed with integer/undefined sanitizers using clang 11/13

Bug: b/229626362
Change-Id: I01595c641763c4cd4242e02f2cc5cbabfe69d03e

2 years agoMerge "configure: add -Wc++{14,17,20}-extensions" into main
James Zern [Tue, 16 Aug 2022 20:04:09 +0000 (20:04 +0000)]
Merge "configure: add -Wc++{14,17,20}-extensions" into main

2 years agoAdd vp9_highbd_quantize_fp_32x32_neon().
Scott LaVarnway [Tue, 16 Aug 2022 13:12:21 +0000 (06:12 -0700)]
Add vp9_highbd_quantize_fp_32x32_neon().

Up to 2.6x faster than vp9_highbd_quantize_fp_32x32_c() for full
calculations.

Bug: b/237714063

Change-Id: Icfeff2ad4dcd57d0ceb47fe04789710807b9cbad

2 years agosimple_encode.cc: clear -Wextra-semi-stmt warnings
James Zern [Tue, 16 Aug 2022 00:26:41 +0000 (17:26 -0700)]
simple_encode.cc: clear -Wextra-semi-stmt warnings

fixes warnings of the form:
../vp9/simple_encode.cc:755:48: warning: empty expression statement has
no effect; remove unnecessary ';' to silence this warning
[-Wextra-semi-stmt]
  SET_STRUCT_VALUE(config, oxcf, ret, key_freq);

Bug: b/229626362
Change-Id: I1c9b0ae9927cdd7c31da000633bcb6e2b8242cd4

2 years agoMerge "examples/svc_encodeframe.c: rm empty {}s in switch" into main
James Zern [Mon, 15 Aug 2022 23:21:53 +0000 (23:21 +0000)]
Merge "examples/svc_encodeframe.c: rm empty {}s in switch" into main

2 years agoMerge "VPX: Add vp9_highbd_quantize_fp_neon()." into main
Scott LaVarnway [Mon, 15 Aug 2022 21:34:42 +0000 (21:34 +0000)]
Merge "VPX: Add vp9_highbd_quantize_fp_neon()." into main

2 years agovp9_quantize_fp_32x32_neon() cleanup.
Scott LaVarnway [Fri, 12 Aug 2022 14:15:33 +0000 (07:15 -0700)]
vp9_quantize_fp_32x32_neon() cleanup.

No change in performance.

Bug: b/237714063

Change-Id: If6ad5fc27de4babe0bfff3fdbb4b7fd99a0544ab

2 years agoVPX: Add vp9_highbd_quantize_fp_neon().
Scott LaVarnway [Mon, 15 Aug 2022 13:14:49 +0000 (06:14 -0700)]
VPX: Add vp9_highbd_quantize_fp_neon().

Up to 4.1x faster than vp9_highbd_quantize_fp_c() for full
calculations.

~1.3% overall encoder improvement for the test clip used.

Bug: b/237714063

Change-Id: I8c6466bdbcf1c398b1d8b03cab4165c1d8556b0c

2 years agoexamples/svc_encodeframe.c: rm empty {}s in switch
James Zern [Sun, 14 Aug 2022 22:43:36 +0000 (15:43 -0700)]
examples/svc_encodeframe.c: rm empty {}s in switch

these have been unnecessary since:
0e97e7049 remove spatial svc experiment

Bug: b/229626362
Change-Id: I57528af4dcb9092b752161c8eaba2e2808c29c5f

2 years agoconfigure: add -Wc++{14,17,20}-extensions
James Zern [Sat, 13 Aug 2022 05:24:39 +0000 (22:24 -0700)]
configure: add -Wc++{14,17,20}-extensions

the snapshot of googletest and the test files themselves are targeting
c++11 currently; these warnings are supported by recent versions of
clang

Change-Id: I5d36b3bd4058ba1610f0c8b27cad27aadee85939

2 years agoMerge "VPX: vp9_quantize_fp_neon() cleanup." into main
Scott LaVarnway [Fri, 12 Aug 2022 00:27:02 +0000 (00:27 +0000)]
Merge "VPX: vp9_quantize_fp_neon() cleanup." into main

2 years agoVPX: vp9_quantize_fp_neon() cleanup.
Scott LaVarnway [Wed, 10 Aug 2022 12:29:50 +0000 (05:29 -0700)]
VPX: vp9_quantize_fp_neon() cleanup.

No change in performance.

Bug: b/237714063

Change-Id: I868cda7acb0de840fbc85b23f3e36c50b39c331b

2 years agoMerge "vp9_cx_iface,encoder_encode: only calc ts when img!=NULL" into main
James Zern [Wed, 10 Aug 2022 22:38:45 +0000 (22:38 +0000)]
Merge "vp9_cx_iface,encoder_encode: only calc ts when img!=NULL" into main

2 years agoMerge "VPX: Fix vp9_quantize_fp_avx2() VS build error." into main
Scott LaVarnway [Tue, 9 Aug 2022 20:20:52 +0000 (20:20 +0000)]
Merge "VPX: Fix vp9_quantize_fp_avx2() VS build error." into main

2 years agoVPX: Fix vp9_quantize_fp_avx2() VS build error.
Scott LaVarnway [Mon, 8 Aug 2022 22:09:32 +0000 (15:09 -0700)]
VPX: Fix vp9_quantize_fp_avx2() VS build error.

Add build fix for _mm256_extract_epi16() being undefined.

Bug: b/237714063

Change-Id: I855b1828ce1b6b2b2f063fe097999481881bf074

2 years agoUse level defined min gf interval
Cheng Chen [Mon, 8 Aug 2022 17:12:39 +0000 (10:12 -0700)]
Use level defined min gf interval

Assume the level definition of min_gf_interval is the minimum allowed
gf_interval. We take this level comformant min_gf_interval instead of
+1.

Change-Id: I9c7e62f210c95b356e9716579ee4c19638de8e35

2 years agoL2E: Add target level in GOP unit tests
Cheng Chen [Sat, 6 Aug 2022 01:06:08 +0000 (18:06 -0700)]
L2E: Add target level in GOP unit tests

Change-Id: Icecc3031e1052bb5a94f6c5957ec5190aae990ba

2 years agoMerge "Fix VP9 auto level" into main
Cheng Chen [Tue, 9 Aug 2022 00:33:51 +0000 (00:33 +0000)]
Merge "Fix VP9 auto level" into main

2 years agovp9_cx_iface,encoder_encode: only calc ts when img!=NULL
James Zern [Mon, 8 Aug 2022 18:28:27 +0000 (11:28 -0700)]
vp9_cx_iface,encoder_encode: only calc ts when img!=NULL

avoid calculating the end timestamp when performing a flush to prevent
an implicit conversion warning when applying a non-zero offset to a 0
pts used in that case:
vp9/vp9_cx_iface.c:1361:50: runtime error: implicit conversion from type
'vpx_codec_pts_t' (aka 'long') of value -15 (64-bit, signed) to type
'unsigned long' changed the value to 18446744073709551601 (64-bit,
unsigned)

Bug: b/229626362
Change-Id: I68ba19b7d6de35cc185707dfb6b43406b7165035

2 years agoFix VP9 auto level
Cheng Chen [Sat, 6 Aug 2022 00:32:12 +0000 (17:32 -0700)]
Fix VP9 auto level

The iteration index is wrong, causing the starting level to be chosen
is "LEVEL_5_2", which is intended for videos of a large resolution.

Change-Id: Id88836981bdcbd7494bd06193d6a433ac75a6d2e

2 years agoVPX: Add vpx_subtract_block_avx2().
Scott LaVarnway [Fri, 5 Aug 2022 14:40:26 +0000 (07:40 -0700)]
VPX: Add vpx_subtract_block_avx2().

~1.3x faster than vpx_subtract_block_sse2().

Based on aom_subtract_block_avx2().

Bug: b/241580104

Change-Id: I17da036363f213d53c6546c3e858e4c3cba44a5b

2 years agoMerge "vp9_active_[hv]_edge: add missing vpx_clear_system_state" into main
James Zern [Thu, 4 Aug 2022 18:09:02 +0000 (18:09 +0000)]
Merge "vp9_active_[hv]_edge: add missing vpx_clear_system_state" into main

2 years agoVPX: Add vp9_highbd_quantize_fp_32x32_avx2().
Scott LaVarnway [Wed, 3 Aug 2022 15:01:25 +0000 (08:01 -0700)]
VPX: Add vp9_highbd_quantize_fp_32x32_avx2().

~4x faster than vp9_highbd_quantize_fp_32x32_c() for full
calculations.

Bug: b/237714063

Change-Id: Iff2182b8e7b1ac79811e33080d1f6cac6679382d

2 years agoVPX: Add vp9_highbd_quantize_fp_avx2().
Scott LaVarnway [Tue, 2 Aug 2022 18:22:04 +0000 (11:22 -0700)]
VPX: Add vp9_highbd_quantize_fp_avx2().

Up to 5.37x faster than vp9_highbd_quantize_fp_c() for full
calculations.

~1.6% overall encoder improvement for the test clip used.

Bug: b/237714063

Change-Id: I584fd1f60a3e02f1ded092de98970725fc66c5b8

2 years agoMerge "VPX: Add vp9_quantize_fp_32x32_avx2()." into main
Scott LaVarnway [Tue, 2 Aug 2022 15:09:40 +0000 (15:09 +0000)]
Merge "VPX: Add vp9_quantize_fp_32x32_avx2()." into main

2 years agoMerge "Provide Arm SDOT optimizations for SAD functions" into main
James Zern [Mon, 1 Aug 2022 18:21:32 +0000 (18:21 +0000)]
Merge "Provide Arm SDOT optimizations for SAD functions" into main

2 years agoVPX: Add vp9_quantize_fp_32x32_avx2().
Scott LaVarnway [Wed, 27 Jul 2022 14:37:44 +0000 (07:37 -0700)]
VPX: Add vp9_quantize_fp_32x32_avx2().

Up to 1.80x faster than vp9_quantize_fp_32x32_ssse3() for full
calculations.

Bug: b/237714063

Change-Id: Ic4ae4724fce7ac85c7a089535b16a999e02f0a10

2 years agoFix off-by-one error of max w/h in validate_config
Wan-Teh Chang [Fri, 29 Jul 2022 22:42:15 +0000 (15:42 -0700)]
Fix off-by-one error of max w/h in validate_config

Fix the off-by-one errors of maximum g_w and g_h in validate_config().

Bug: webm:1774
Change-Id: I343783d06c1f53222be2366be79171b214486201

2 years agoProvide Arm SDOT optimizations for SAD functions
Konstantinos Margaritis [Fri, 29 Jul 2022 09:40:53 +0000 (09:40 +0000)]
Provide Arm SDOT optimizations for SAD functions

Change-Id: I497ee1c45d1fc4d643cefad7d87e5aaacd77869c

2 years agoMerge changes I0c6604ef,Id7e13b3d,I7291d9bd,Ic7c0a2e7,Ic7ce0fd9, ... into main
James Zern [Fri, 29 Jul 2022 02:05:22 +0000 (02:05 +0000)]
Merge changes I0c6604ef,Id7e13b3d,I7291d9bd,Ic7c0a2e7,Ic7ce0fd9, ... into main

* changes:
  x86: normalize type with _mm_cvtsi128_si32
  vp9_filter_block_plane_non420: fix implicit conversion warnings
  variance_avx2.c: fix implicit conversion warnings
  vp8,read_mb_modes_mv: fix implicit conversion warnings
  vp8_find_near_mvs: fix implicit conversion warnings
  encode_test_driver: normalize frame_flags type
  vp9,decoder_decode: fix ubsan null/zero offset warning
  y4m_input_fetch_frame: fix ubsan null/zero offset warning

2 years agovp9_active_[hv]_edge: add missing vpx_clear_system_state
James Zern [Thu, 28 Jul 2022 01:56:22 +0000 (18:56 -0700)]
vp9_active_[hv]_edge: add missing vpx_clear_system_state

this fixes runtime errors with clang -fsanitize=integer in x86 builds:

../vp9/encoder/vp9_rdopt.c:3250:17: runtime error: signed integer
  overflow: 18 - -2147483648 cannot be represented in type 'int'
../vp9/encoder/vp9_rdopt.c:3277:16: runtime error: signed integer
  overflow: 26 - -2147483648 cannot be represented in type 'int'

Bug: b/229626362
Change-Id: Ic9a5063c840b4fce7056f61362234721add056a6

2 years agox86: normalize type with _mm_cvtsi128_si32
James Zern [Wed, 27 Jul 2022 22:22:37 +0000 (15:22 -0700)]
x86: normalize type with _mm_cvtsi128_si32

prefer int in most cases

w/clang -fsanitize=integer fixes warnings of the form:
implicit conversion from type 'int' of value -809931979 (32-bit, signed)
to type 'uint32_t' (aka 'unsigned int') changed the value to 3485035317
(32-bit, unsigned)

Bug: b/229626362
Change-Id: I0c6604efc188f2660c531eddfc7aa10060637813

2 years agovp9_filter_block_plane_non420: fix implicit conversion warnings
James Zern [Wed, 27 Jul 2022 22:48:24 +0000 (15:48 -0700)]
vp9_filter_block_plane_non420: fix implicit conversion warnings

w/clang -fsanitize=integer fixes warnings of the form:
implicit conversion from type 'int' of value -2 (32-bit, signed) to type
'unsigned int' changed the value to 4294967294 (32-bit, unsigned)

Bug: b/229626362
Change-Id: Id7e13b3d494ccd1a2351db8fab6fdb6a9a771d51

2 years agovariance_avx2.c: fix implicit conversion warnings
James Zern [Wed, 27 Jul 2022 22:41:00 +0000 (15:41 -0700)]
variance_avx2.c: fix implicit conversion warnings

w/clang -fsanitize=integer fixes warnings of the form:
implicit conversion from type 'int' of value -1323 (32-bit, signed) to
type 'unsigned int' changed the value to 4294965973 (32-bit, unsigned)

Bug: b/229626362
Change-Id: I7291d9bd5cacea0d88d9f4c4624c096764f4a472

2 years agovp8,read_mb_modes_mv: fix implicit conversion warnings
James Zern [Wed, 27 Jul 2022 22:31:00 +0000 (15:31 -0700)]
vp8,read_mb_modes_mv: fix implicit conversion warnings

w/clang -fsanitize=integer fixes warnings of the form:
implicit conversion from type 'uint32_t' (aka 'unsigned int') of value
4294443008 (32-bit, unsigned) to type 'int' changed the value to -524288
(32-bit, signed)

Bug: b/229626362
Change-Id: Ic7c0a2e7b64a1dd6fd5cc64adcd5765318c2a956

2 years agovp8_find_near_mvs: fix implicit conversion warnings
James Zern [Wed, 27 Jul 2022 22:15:25 +0000 (15:15 -0700)]
vp8_find_near_mvs: fix implicit conversion warnings

unsigned -> int and vice versa

reported by clang -fsanitize=integer

vp8/common/findnearmv.c:108:11: runtime error: implicit conversion from
type 'uint32_t' (aka 'unsigned int') of value 4294443008 (32-bit,
unsigned) to type 'int' changed the value to -524288 (32-bit, signed)
vp8/common/findnearmv.c:110:33: runtime error: implicit conversion from
type 'int' of value -524288 (32-bit, signed) to type 'uint32_t' (aka
'unsigned int') changed the value to 4294443008 (32-bit, unsigned)

Bug: b/229626362
Change-Id: Ic7ce0fd98255ccf9307ac73e9fb6a8189b268214

2 years agoencode_test_driver: normalize frame_flags type
James Zern [Wed, 27 Jul 2022 20:29:41 +0000 (13:29 -0700)]
encode_test_driver: normalize frame_flags type

use vpx_enc_frame_flags_t; this avoids int -> unsigned conversion
warnings; reported w/clang -fsanitize=integer:

test/error_resilience_test.cc:95:9: runtime error: implicit conversion
from type 'int' of value -12845057 (32-bit, signed) to type 'unsigned
long' changed the value to 4282122239 (32-bit, unsigned)

Bug: b/229626362
Change-Id: I0fc1dbe44a258f397cf1a05347d8cb86ee70b1b8

2 years agovp9,decoder_decode: fix ubsan null/zero offset warning
James Zern [Wed, 27 Jul 2022 02:26:23 +0000 (19:26 -0700)]
vp9,decoder_decode: fix ubsan null/zero offset warning

reported under clang-13. null data may be passed as a flush; move
data_end after that check

vp9/vp9_dx_iface.c:337:40: runtime error: applying zero offset to null
pointer

Bug: b/229626362
Change-Id: I845726fd6eb6ac7a776e49272c6477a5ad30ffdf

2 years agoy4m_input_fetch_frame: fix ubsan null/zero offset warning
James Zern [Wed, 27 Jul 2022 02:08:40 +0000 (19:08 -0700)]
y4m_input_fetch_frame: fix ubsan null/zero offset warning

reported under clang-13; use a while loop in file_read() to force a size
check before attempting to read. buf (aux_buf) may be may be null when
no conversion is necessary.

y4minput.c:29:43: runtime error: applying zero offset to null pointer

Bug: b/229626362
Change-Id: Ia3250d6ff9c325faf48eaa31f4399e20837f8f7b

2 years agoVPX: vp9_quantize_fp_avx2() cleanup.
Scott LaVarnway [Mon, 25 Jul 2022 17:58:44 +0000 (10:58 -0700)]
VPX: vp9_quantize_fp_avx2() cleanup.

No change in performance.

Bug: b/237714063

Change-Id: I8ea42759cc4dc57be6a29c23784997cb90ad4090

2 years agoMerge "VPX: Add vpx_highbd_quantize_b_32x32_avx2()." into main
Scott LaVarnway [Wed, 27 Jul 2022 12:54:09 +0000 (12:54 +0000)]
Merge "VPX: Add vpx_highbd_quantize_b_32x32_avx2()." into main

2 years agohighbd_temporal_filter_sse4: remove unused function params
James Zern [Wed, 27 Jul 2022 01:17:22 +0000 (18:17 -0700)]
highbd_temporal_filter_sse4: remove unused function params

this clears warnings under clang-13 of the form:
vp9/encoder/x86/highbd_temporal_filter_sse4.c|196 col 63| warning:
parameter 'v_pre' set but not used [-Wunused-but-set-parameter]

this is the high-bitdepth version of:
73b8aade8 temporal_filter_sse4: remove unused function params

Change-Id: I9b2c9bf27c16975e4855df6a2c967da4c8c63a3a