platform/upstream/libvpx.git
23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months agoVPX: Add vpx_highbd_quantize_b_32x32_avx2().
Scott LaVarnway [Mon, 25 Jul 2022 12:52:27 +0000 (05:52 -0700)]
VPX: Add vpx_highbd_quantize_b_32x32_avx2().

Up to 11.78x faster than vpx_quantize_b_32x32_sse2() for full
calculations.

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

Bug: b/237714063

Change-Id: Ib759056db94d3487239cb2748ffef1184a89ae18

23 months agoVPX: Add vpx_highbd_quantize_b_avx2().
Scott LaVarnway [Wed, 20 Jul 2022 16:51:56 +0000 (09:51 -0700)]
VPX: Add vpx_highbd_quantize_b_avx2().

Up to 3.61x faster than vpx_highbd_quantize_b_sse2() for full
calculations.

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

Bug: b/237714063
Change-Id: I23f88d2a7f96aaa4103778372f4f552207f73cee

23 months agoMerge "VPX: Add vpx_quantize_b_32x32_avx2()." into main
Scott LaVarnway [Mon, 25 Jul 2022 11:38:13 +0000 (11:38 +0000)]
Merge "VPX: Add vpx_quantize_b_32x32_avx2()." into main

2 years agoMerge "L2E: Add more unit tests for GOP API" into main
Cheng Chen [Fri, 22 Jul 2022 20:27:51 +0000 (20:27 +0000)]
Merge "L2E: Add more unit tests for GOP API" into main

2 years agoL2E: Add more unit tests for GOP API
Cheng Chen [Wed, 20 Jul 2022 22:35:33 +0000 (15:35 -0700)]
L2E: Add more unit tests for GOP API

Add unit tests for a 4 frame video, which could be considered as a
corner case.

Three different GOP settings are tested and verified as valid.
(1). The first GOP has 3 coding frames, no alt ref.
     The second GOP has 1 coding frame, no alt ref.
     The numer of coding frames is 4.
     Their frame types are: keyframe, inter_frame, inter_frame,
     golden_frame.

(2). The first GOP has 4 coding frames, use alt ref.
     The second GOP has 1 coding frame, which is the overlay of
     the first GOP's alt ref frame.
     The numer of coding frames is 5.
     Their types are: keyframe, alt_ref, inter_frame, inter_frame,
     overlay_frame.

(3). Only one GOP with 4 coding frames, do not use alt ref.
     The numer of coding frames is 4.
     Their types are: keyframe, inter_frame, inter_frame, inter_frame.

Change-Id: I4079ff5065da79834b363b1e1976f65efed3f91f

2 years agoavg_intrin_avx2: rm dead store in highbd_hadamard_8x8
James Zern [Wed, 20 Jul 2022 00:16:05 +0000 (17:16 -0700)]
avg_intrin_avx2: rm dead store in highbd_hadamard_8x8

missed in:
53dd1e8e7 avg_intrin_{sse2,avg2}: rm dead store in hadamard_8x8

Change-Id: I378e4a388ceb193a4cfee4d9d317fc62fcc4b39e

2 years agopp_filter_test: quiet static analysis warning
James Zern [Tue, 19 Jul 2022 23:32:30 +0000 (16:32 -0700)]
pp_filter_test: quiet static analysis warning

in CheckLowFilterOutput(); use std::unique_ptr to avoid spurious memory
leak warning:

test/pp_filter_test.cc|466 col 3| warning: Potential leak of memory
pointed to by 'expected_output' [cplusplus.NewDeleteLeaks]
  ASSERT_NE(expected_output, nullptr);

Bug: b/229626362
Change-Id: Ie9e06c9b9442ffa134e514d2aee70841d19c8ecb

2 years agoencode_api_test: quiet static analysis warning
James Zern [Tue, 19 Jul 2022 23:30:59 +0000 (16:30 -0700)]
encode_api_test: quiet static analysis warning

in ConfigChangeThreadCount(); initialize cfg as the static analyzer can
assume AlwaysTrue() within EXPECT_NO_FATAL_FAILURE may return false
causing InitCodec() not to be called.

test/encode_api_test.cc|321 col 3| warning: 1st function call argument
is an uninitialized value [core.CallAndMessage]
  video.SetSize(cfg.g_w, cfg.g_h);

Bug: b/229626362
Change-Id: I54899ed0a207ca685416bed3a0e9c9644668e163

2 years agoVPX: Add vpx_quantize_b_32x32_avx2().
Scott LaVarnway [Tue, 12 Jul 2022 20:22:35 +0000 (13:22 -0700)]
VPX: Add vpx_quantize_b_32x32_avx2().

Up to 1.36x faster than vpx_quantize_b_32x32_avx() for full
calculations. Up to 1.29x faster for VP9_HIGHBITDEPTH builds.

Bug: b/237714063

Change-Id: I97aa6a18d4dc2f3187b76800f91bbba7be447ef1

2 years agoavg_intrin_{sse2,avg2}: rm dead store in hadamard_8x8
James Zern [Tue, 19 Jul 2022 02:00:49 +0000 (19:00 -0700)]
avg_intrin_{sse2,avg2}: rm dead store in hadamard_8x8

this quiets a couple static analysis warnings with clang 11:

vpx_dsp/x86/avg_intrin_sse2.c:278:45: warning: Although the value stored
to 'src_diff' is used in the enclosing expression, the value is never
actually read from 'src_diff' [deadcode.DeadStores]
  src[7] = _mm_load_si128((const __m128i *)(src_diff += src_stride));
                                            ^           ~~~~~~~~~~
vpx_dsp/x86/avg_intrin_avx2.c:307:49: warning: Although the value stored
to 'src_diff' is used in the enclosing expression, the value is never
actually read from 'src_diff' [deadcode.DeadStores]
  src[7] = _mm256_loadu_si256((const __m256i *)(src_diff += src_stride));
                                                ^           ~~~~~~~~~~

Bug: b/229626362
Change-Id: I4b0201bd39775885df0afc03fa5da70910b9dad6

2 years agovpx_int_pro_row_c: add an assert for height
James Zern [Tue, 19 Jul 2022 01:56:03 +0000 (18:56 -0700)]
vpx_int_pro_row_c: add an assert for height

this quiets a static analysis warning with clang 11:

vpx_dsp/avg.c:353:15: warning: Assigned value is garbage or undefined
[core.uninitialized.Assign]
    hbuf[idx] /= norm_factor;
              ^  ~~~~~~~~~~~

the same fix was applied in libaom:
1ad0889bc aom_int_pro_row_c: add an assert for height

Bug: b/229626362
Change-Id: Ic8a249f866b33b02ec9f378581e51ac104d97169

2 years agoL2E: Update the description of allow_alt_ref
Cheng Chen [Thu, 14 Jul 2022 18:41:11 +0000 (11:41 -0700)]
L2E: Update the description of allow_alt_ref

It is fixed per each encoding and can not be changed per GOP.

Change-Id: I5905b712437142f2274bfa674ceef6093495457f

2 years agovpxenc: fix --disable-loopfilter help alignment
James Zern [Thu, 14 Jul 2022 04:54:22 +0000 (21:54 -0700)]
vpxenc: fix --disable-loopfilter help alignment

Change-Id: I34444e6437ca0e735d6db07bf98bfa4741ad2c01

2 years agoActually include the fix for commit 8f4d1890c.
Konstantinos Margaritis [Wed, 13 Jul 2022 16:54:30 +0000 (16:54 +0000)]
Actually include the fix for commit 8f4d1890c.

Change-Id: I6780f610151f2e092da525ff064d4b69f74fa61b

2 years agoMerge "VPX: Add vpx_quantize_b_avx2()." into main
Scott LaVarnway [Mon, 11 Jul 2022 21:48:55 +0000 (21:48 +0000)]
Merge "VPX: Add vpx_quantize_b_avx2()." into main

2 years agoMerge "vp8_macros_msa.h: avoid shadowing variables in defines" into main
James Zern [Mon, 11 Jul 2022 20:23:28 +0000 (20:23 +0000)]
Merge "vp8_macros_msa.h: avoid shadowing variables in defines" into main

2 years agoVPX: Add vpx_quantize_b_avx2().
Scott LaVarnway [Wed, 6 Jul 2022 15:51:52 +0000 (08:51 -0700)]
VPX: Add vpx_quantize_b_avx2().

Up to 1.58x faster than vpx_quantize_b_avx() depending
on the size.

Bug: b/237714063

Change-Id: I595a6bb32ebee63f69f27b5a15322fdeae1bf70e

2 years agoMerge "Revert "Revert "[NEON] Optimize vp9_diamond_search_sad() for NEON""" into...
James Zern [Mon, 11 Jul 2022 19:58:21 +0000 (19:58 +0000)]
Merge "Revert "Revert "[NEON] Optimize vp9_diamond_search_sad() for NEON""" into main

2 years agovp8_macros_msa.h: avoid shadowing variables in defines
James Zern [Sat, 9 Jul 2022 21:49:54 +0000 (14:49 -0700)]
vp8_macros_msa.h: avoid shadowing variables in defines

this avoids a warning with certain versions of gcc; observed with:
mipsisa32r6el-linux-gnu-gcc (Debian 10.2.1-6) 10.2.1 20210110

Change-Id: I8999f487a79a9d53133816d572054b2423330bcf

2 years agoRevert "Revert "[NEON] Optimize vp9_diamond_search_sad() for NEON""
Konstantinos Margaritis [Wed, 6 Jul 2022 08:42:54 +0000 (08:42 +0000)]
Revert "Revert "[NEON] Optimize vp9_diamond_search_sad() for NEON""

This reverts commit 9f1329f8ac88ea5d7c6ae5d6a57221c36cf85ac8
and fixes a dumb mistake in evaluation of vfcmv. Used vdupq_n_s16,
instead of vdupq_n_s32.

Change-Id: Ie236c878c166405c49bc0f93f6d63a6715534a0a

2 years agoMerge "VPX: Add quantize speed test for ref vs opt." into main
Scott LaVarnway [Thu, 7 Jul 2022 22:15:45 +0000 (22:15 +0000)]
Merge "VPX: Add quantize speed test for ref vs opt." into main

2 years agoVPX: Add quantize speed test for ref vs opt.
Scott LaVarnway [Thu, 7 Jul 2022 13:34:11 +0000 (06:34 -0700)]
VPX: Add quantize speed test for ref vs opt.

Bug: b/237714063

Change-Id: I4304ba8d976fed3613e28442983b04a9cfc15b79

2 years agoRevert "Fix bug with smaller width bigger size"
James Zern [Wed, 6 Jul 2022 22:06:51 +0000 (15:06 -0700)]
Revert "Fix bug with smaller width bigger size"

This reverts commit 5b530fc962bcb8a51bbf03f5fbc2912f21b86e70.

This fixes memory related fuzzer failures in the decoder.

Bug: webm:1642
Bug: oss-fuzz:48609
Bug: oss-fuzz:48629
Bug: oss-fuzz:48632
Bug: oss-fuzz:48638
Bug: oss-fuzz:48639
Bug: oss-fuzz:48651
Bug: oss-fuzz:48657
Bug: oss-fuzz:48659
Bug: oss-fuzz:48660
Bug: oss-fuzz:48661
Bug: oss-fuzz:48680
Bug: oss-fuzz:48686
Bug: oss-fuzz:48697
Bug: oss-fuzz:48706
Bug: oss-fuzz:48712
Bug: oss-fuzz:48717
Bug: oss-fuzz:48728
Bug: oss-fuzz:48732
Bug: oss-fuzz:48780
Bug: oss-fuzz:48781
Bug: oss-fuzz:48782
Bug: oss-fuzz:48785
Change-Id: I67a8539a3083f00eec1164fef5c6a8bc209f91fc

2 years agoMerge "Fix bug with smaller width bigger size" into main
Jerome Jiang [Fri, 1 Jul 2022 14:37:32 +0000 (14:37 +0000)]
Merge "Fix bug with smaller width bigger size" into main

2 years 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

Bug: webm:1642

Change-Id: I831b7701495eebeeff6bdc0b570f737bb6d536c6

2 years agoABI compatibility to CHANGELOG for prev releases.
Jerome Jiang [Thu, 30 Jun 2022 14:53:15 +0000 (10:53 -0400)]
ABI compatibility to CHANGELOG for prev releases.

Bug: webm:1757
Change-Id: I19576aa0bc065045dcb0eaf770ae5b0d9ac9d684

2 years agortc: Add svc test for profile 2 10/12 bit
Marco Paniconi [Wed, 29 Jun 2022 17:35:36 +0000 (10:35 -0700)]
rtc: Add svc test for profile 2 10/12 bit

Add TODO to fix the superframe parser
for 10/12 bit.

Change-Id: Ib76c4daa0ff2f516510829ead6a397c89abba2f3

2 years agortc-svc: Fix to make SVC work for Profile 1
Marco Paniconi [Tue, 28 Jun 2022 18:22:48 +0000 (11:22 -0700)]
rtc-svc: Fix to make SVC work for Profile 1

Added datarate unittest for 4:4:4 and 4:2:2 input,
for spatial and temporal layers.

Fix is needed in vp9_set_literal_size():
the sampling_x/y should be passed into update_inital_width(),
othewise sampling_x/y = 1/1 (4:2:0) was forced.
vp9_set_literal_size() is only called by the svc and
on dynamic resize.

Fix issue with the normative optimized scaler:
UV width/height was assumed to be 1/2 of Y, for
the ssse and neon code.

Also fix to assert for the scaled width/height:
in case scaled width/height is odd it should be
incremented by 1 (make it even).

Change-Id: I3a2e40effa53c505f44ef05aaa3132e1b7f57dd5

2 years agoMerge "Merge tag 'v1.12.0' into main" into main
Jerome Jiang [Tue, 28 Jun 2022 22:59:24 +0000 (22:59 +0000)]
Merge "Merge tag 'v1.12.0' into main" into main

2 years agoAdd vp8_ prefix for quantize_lsx.c
Jerome Jiang [Tue, 28 Jun 2022 14:24:57 +0000 (10:24 -0400)]
Add vp8_ prefix for quantize_lsx.c

Duplicate name as vpx_dsp/loongarch/quantize_lsx.c
Chromium update script fails.

Bug: webm:1755
Change-Id: Ifb956c2292d909496eb2b9e1833993f1b021b07e

2 years agoMerge tag 'v1.12.0' into main
Jerome Jiang [Tue, 28 Jun 2022 21:07:31 +0000 (17:07 -0400)]
Merge tag 'v1.12.0' into main

Release v1.12.0 Torrent Duck

2022-06-17 v1.12.0 "Torrent Duck"

  This release adds optimizations for Loongarch, adds support for vp8 in the
  real-time rate control library, upgrades GoogleTest to v1.11.0, updates
  libwebm to libwebm-1.0.0.28-20-g206d268, and includes numerous bug fixes.

- Upgrading:
    This release is ABI compatible with the previous release.
    vp8 support in the real-time rate control library.
    New codec control VP8E_SET_RTC_EXTERNAL_RATECTRL is added.
    Configure support for darwin21 is added.
    GoogleTest is upgraded to v1.11.0.
    libwebm is updated to libwebm-1.0.0.28-20-g206d268.

- Enhancement:
    Numerous improvements on checking memory allocations.
    Optimizations for Loongarch.
    Code clean-up.

- Bug fixes:
    Fix to a crash related to {vp8/vp9}_set_roi_map.
    Fix to compiling failure with -Wformat-nonliteral.
    Fix to integer overflow with vp9 with high resolution content.
    Fix to AddNoiseTest failure with ARMv7.
    Fix to libvpx Null-dereference READ in vp8.

Change-Id: I6964e96bccf016f977cc6e83dc0a192d66a19618

2 years agoReplace date with version and release from README upstream/torrent v1.12.0
Jerome Jiang [Tue, 28 Jun 2022 18:38:49 +0000 (14:38 -0400)]
Replace date with version and release from README

CHANGELOG has the date.

Bug: webm:1752
Change-Id: I2888ce2afed8619f043eee1e9ca23bdf9d75e607

2 years agoL2E: Distinguish fixed and active gf_interval
Cheng Chen [Fri, 24 Jun 2022 18:57:42 +0000 (11:57 -0700)]
L2E: Distinguish fixed and active gf_interval

min/max_gf_interval is fixed and can be passed from the command line.
It must satisfy the level constraints.

active_min/max_gf_interval might be changing based on
min/max_gf_interval. It is determined per GOP.

Change-Id: If456c691c97a8b4c946859c05cedd39ca7defa9c

2 years agovp9_encode_sb_row: remove a branch w/CONFIG_REALTIME_ONLY
James Zern [Fri, 17 Jun 2022 01:43:44 +0000 (18:43 -0700)]
vp9_encode_sb_row: remove a branch w/CONFIG_REALTIME_ONLY

replace the check on use_nonrd_pick_mode with an assert. this is only a
start, there are many branches that could be removed that check mode ==
REALTIME, etc. with this configuration.

Bug: webm:1773
Change-Id: I38cf9f83e7c085eb8e87d5cf6db7dc75359b611b
(cherry picked from commit 08b86d76224453ef9cbab4b10a48617715d9a14e)

2 years agovp9_cx_iface: set default cpu_used=5 w/CONFIG_REALTIME_ONLY
James Zern [Fri, 17 Jun 2022 01:22:52 +0000 (18:22 -0700)]
vp9_cx_iface: set default cpu_used=5 w/CONFIG_REALTIME_ONLY

this avoids a crash if cpu-used is not explicitly set as there are some
(unnecessary) checks against use_nonrd_pick_mode which would cause
encoding to be skipped if the old default of 0 were used

Bug: webm:1773
Change-Id: I62fba5fb51d8afa422689b7de3f03e8f7570e50b
Fixed: webm:1773
(cherry picked from commit 95d196fdf45edf57015cc18635c52b30a93522fd)

2 years agoUpdate CHANGELOG for L2E
Jerome Jiang [Tue, 21 Jun 2022 18:54:16 +0000 (14:54 -0400)]
Update CHANGELOG for L2E

Bug: webm:1752
Change-Id: I5335e0360501503d5c162be4bbdef3ad73151e9f

2 years agoUpdate CHANGELOG and version info v1.12.0-rc1
Jerome Jiang [Fri, 17 Jun 2022 18:14:10 +0000 (14:14 -0400)]
Update CHANGELOG and version info

A stale codec control was removed, but compatibility was restored.

New codec control was added.

Bump *current* and *age*, and keep *revision* as 0.

Bug: webm:1752
Bug: webm:1757

Change-Id: I76179f129a10c06d897b5c62462808ed9b9c2923

2 years agovp9_encode_sb_row: remove a branch w/CONFIG_REALTIME_ONLY
James Zern [Fri, 17 Jun 2022 01:43:44 +0000 (18:43 -0700)]
vp9_encode_sb_row: remove a branch w/CONFIG_REALTIME_ONLY

replace the check on use_nonrd_pick_mode with an assert. this is only a
start, there are many branches that could be removed that check mode ==
REALTIME, etc. with this configuration.

Bug: webm:1773
Change-Id: I38cf9f83e7c085eb8e87d5cf6db7dc75359b611b

2 years agovp9_cx_iface: set default cpu_used=5 w/CONFIG_REALTIME_ONLY
James Zern [Fri, 17 Jun 2022 01:22:52 +0000 (18:22 -0700)]
vp9_cx_iface: set default cpu_used=5 w/CONFIG_REALTIME_ONLY

this avoids a crash if cpu-used is not explicitly set as there are some
(unnecessary) checks against use_nonrd_pick_mode which would cause
encoding to be skipped if the old default of 0 were used

Bug: webm:1773
Change-Id: I62fba5fb51d8afa422689b7de3f03e8f7570e50b
Fixed: webm:1773

2 years agoMerge "vp9,encoder: fix some integer sanitizer warnings" into main
James Zern [Tue, 14 Jun 2022 01:24:23 +0000 (01:24 +0000)]
Merge "vp9,encoder: fix some integer sanitizer warnings" into main

2 years agoRestore backward compatibility
Jerome Jiang [Mon, 13 Jun 2022 20:29:31 +0000 (16:29 -0400)]
Restore backward compatibility

This CL breaks the backward compatibility:

1365e7e1a vp9-svc: Remove VP9E_SET_TEMPORAL_LAYERING_MODE

Forcing the value of the next element

Bug: webm:1752
Change-Id: I83c774b3aa6cca25f2f14995590fb20c0a1668d4
(cherry picked from commit 013ec5722ce88bebcdcf32b1496fcca413199336)

2 years agoUpdate AUTHORS
Jerome Jiang [Mon, 13 Jun 2022 20:36:07 +0000 (16:36 -0400)]
Update AUTHORS

Bug: webm:1752
Change-Id: I08b4100a0e8c003cd9a7bdaf72926c268e02d53c

2 years agoRestore backward compatibility
Jerome Jiang [Mon, 13 Jun 2022 20:29:31 +0000 (16:29 -0400)]
Restore backward compatibility

This CL breaks the backward compatibility:

1365e7e1a vp9-svc: Remove VP9E_SET_TEMPORAL_LAYERING_MODE

Forcing the value of the next element

Bug: webm:1752
Change-Id: I83c774b3aa6cca25f2f14995590fb20c0a1668d4

2 years agoConvert EncoderTest::last_pts_ to a local variable
Wan-Teh Chang [Fri, 10 Jun 2022 20:52:31 +0000 (13:52 -0700)]
Convert EncoderTest::last_pts_ to a local variable

Convert the data member EncoderTest::last_pts_ to a local variable in
the EncoderTest::RunLoop() and VP9FrameSizeTestsLarge::RunLoop()
methods. EncoderTest::last_pts_ is only used in these two methods, and
these two methods first set EncoderTest::last_pts_ to 0 before using it.
So EncoderTest::last_pts_ is effectively a local variable in these two
methods.

Note that several subclasses of EncoderTest declare their own last_pts_
data member and use it to calculate the data rate. Apparently their own
last_pts_ data member hides the same-named data member in the base
class. Although this is allowed by C++, this is very confusing.

Change-Id: I55ce1cf8cc62e07333d8a902d65b46343a3d5881

2 years agoL2E: Use libvpx's default q in case of invalid external value
Cheng Chen [Mon, 6 Jun 2022 23:46:55 +0000 (16:46 -0700)]
L2E: Use libvpx's default q in case of invalid external value

If the external model recommends an invalid q value, we use the
default q selected by libvpx's rate control strategy.

We update the test so that when the external model wants to control
GOP decision, it could get per frame information and just recommend
an invalid q.

Change-Id: I69be4b0ee0800e7ab0706d305242bb87f001b1f7

2 years agoL2E: rename 'gop_index' to 'gop_global_index'
Cheng Chen [Mon, 6 Jun 2022 22:46:41 +0000 (15:46 -0700)]
L2E: rename 'gop_index' to 'gop_global_index'

'gop_index' has already been used in vpx_rc_encodeframe_info_t,
which represents the frame index inside the current
group of picture (gop).

We therefore use 'gop_global_index' to represent the index of
the current gop to avoid duplicate names.

Change-Id: I3eb8987dd878f650649b013e0036e23d0846b5f0

2 years agoL2E: send first pass stats before gop decisions
Cheng Chen [Mon, 6 Jun 2022 21:53:46 +0000 (14:53 -0700)]
L2E: send first pass stats before gop decisions

This change let the encoder send first pass stats before gop
decisioins so that external models could make use of it.

Change-Id: Iafc7eddab93aa77ceaf8e1f7663a52b27d94af80

2 years agoL2E: Use bit mask to represent control type
Cheng Chen [Fri, 3 Jun 2022 22:08:48 +0000 (15:08 -0700)]
L2E: Use bit mask to represent control type

The bit mask allows us to easily add an additional control mode
which both the QP and GOP are controlled by an external model.

Change-Id: I49f676f622a6e70feb2a39dc97a4e5050b7f4760

2 years agoMerge "libs.mk,build/make/Makefile: make test targets ordinary rules" into main
James Zern [Fri, 3 Jun 2022 17:39:48 +0000 (17:39 +0000)]
Merge "libs.mk,build/make/Makefile: make test targets ordinary rules" into main

2 years agovp9_change_config: check vp9_alloc_loop_filter return
James Zern [Sat, 28 May 2022 22:24:37 +0000 (15:24 -0700)]
vp9_change_config: check vp9_alloc_loop_filter return

Change-Id: I4cba67a5ab192d1cf1dbfb5c039a93a4952b071e
(cherry picked from commit 6549e76307631de7e37459fceb23b4eee4573620)

2 years agovp9e_set_config: setjmp before calling vp9_change_config
James Zern [Sat, 28 May 2022 04:50:11 +0000 (21:50 -0700)]
vp9e_set_config: setjmp before calling vp9_change_config

vp9_change_config may call functions that perform allocations which
expect failures detected by CHECK_MEM_ERROR to not return.

Change-Id: I1dd1eca9c661ed157d51b4a6a77fc9f88236d794
(cherry picked from commit 3997d9bc6286ba075879353b87678986cdbfa347)

2 years agovp8e_set_config: setjmp before calling vp8_change_config
James Zern [Sat, 28 May 2022 04:50:11 +0000 (21:50 -0700)]
vp8e_set_config: setjmp before calling vp8_change_config

vp8_change_config may call vp8_alloc_compressor_data which expects
failures detected by CHECK_MEM_ERROR to not return.

Change-Id: Ib7fbf4af904bd9b539402bb61c8f87855eef2ad6
(cherry picked from commit 365eebc147627ae83ec8b36077198d8cfb5e0128)

2 years agolibs.mk,build/make/Makefile: make test targets ordinary rules
James Zern [Fri, 3 Jun 2022 02:38:03 +0000 (19:38 -0700)]
libs.mk,build/make/Makefile: make test targets ordinary rules

this fixes a regression in make 4.2 and still present in 4.3 causing
double colon rules to be serialized which breaks sharding done by the
test and test-no-data-check rules. these targets only define one set of
rules so ordinary rules work unlike clean. install may be another
candidate, but that's left for a follow up.

Change-Id: I9f074eca2ad266eeca6e31aae2e9f31eec8680e0
Tested: make 3.81, 4.1, 4.2, 4.2.1, 4.3

2 years agoMerge ".gitignore: add android studio / vscode folders" into main
James Zern [Fri, 3 Jun 2022 00:49:18 +0000 (00:49 +0000)]
Merge ".gitignore: add android studio / vscode folders" into main

2 years agoMerge changes I4cba67a5,I1dd1eca9,Ib7fbf4af into main
James Zern [Thu, 2 Jun 2022 23:44:29 +0000 (23:44 +0000)]
Merge changes I4cba67a5,I1dd1eca9,Ib7fbf4af into main

* changes:
  vp9_change_config: check vp9_alloc_loop_filter return
  vp9e_set_config: setjmp before calling vp9_change_config
  vp8e_set_config: setjmp before calling vp8_change_config

2 years agotest/*: normalize use of nullptr
James Zern [Sat, 28 May 2022 02:36:47 +0000 (19:36 -0700)]
test/*: normalize use of nullptr

this is preferred over NULL in C++11

Change-Id: Ic48ddcc6dfb8975a57f6713549ad04d93db21415
(cherry picked from commit c304ec38d05040b74de4aacada62c4a336714341)

2 years ago.gitignore: add android studio / vscode folders
James Zern [Thu, 2 Jun 2022 23:34:21 +0000 (16:34 -0700)]
.gitignore: add android studio / vscode folders

Change-Id: I039a96bc33f55d9ba8bca9f9f6b69135659d2351

2 years agoMerge "L2E: Return error when GOP model is not set" into main
Cheng Chen [Thu, 2 Jun 2022 20:38:43 +0000 (20:38 +0000)]
Merge "L2E: Return error when GOP model is not set" into main

2 years agoL2E: Return error when GOP model is not set
Cheng Chen [Tue, 31 May 2022 18:07:15 +0000 (11:07 -0700)]
L2E: Return error when GOP model is not set

- Return error instead of OK when GOP model is not set.
- Update descriptions for a few variables.

Change-Id: I213f6b7085c487507c3935e7ce615e807f4474cc

2 years agovp9,encoder: fix some integer sanitizer warnings
James Zern [Thu, 2 Jun 2022 01:55:10 +0000 (18:55 -0700)]
vp9,encoder: fix some integer sanitizer warnings

the issues fixed in this change are related to implicit conversions
between int / unsigned int:
vp9/encoder/vp9_segmentation.c:42:36: runtime error: implicit conversion
  from type 'int' of value -9 (32-bit, signed) to type 'unsigned int'
  changed the value to 4294967287 (32-bit, unsigned)
vpx_dsp/x86/sum_squares_sse2.c:36:52: 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)
vpx_dsp/x86/sum_squares_sse2.c:36:67: 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)
vp9/encoder/x86/vp9_diamond_search_sad_avx.c:81:45: runtime error:
  implicit conversion from type 'uint32_t' (aka 'unsigned int') of value
  4290576316 (32-bit, unsigned) to type 'int' changed the value to
  -4390980 (32-bit, signed)
vp9/encoder/vp9_rdopt.c:3472:31: runtime error: implicit conversion from
  type 'int' of value -1024 (32-bit, signed) to type 'uint16_t' (aka
  'unsigned short') changed the value to 64512 (16-bit, unsigned)

unsigned is forced for masks and int is used with intel intrinsics

Bug: webm:1767
Change-Id: Icfa4179e13bc98a36ac29586b60d65819d3ce9ee
Fixed: webm:1767

2 years agovp9_change_config: check vp9_alloc_loop_filter return
James Zern [Sat, 28 May 2022 22:24:37 +0000 (15:24 -0700)]
vp9_change_config: check vp9_alloc_loop_filter return

Change-Id: I4cba67a5ab192d1cf1dbfb5c039a93a4952b071e

2 years agovp9e_set_config: setjmp before calling vp9_change_config
James Zern [Sat, 28 May 2022 04:50:11 +0000 (21:50 -0700)]
vp9e_set_config: setjmp before calling vp9_change_config

vp9_change_config may call functions that perform allocations which
expect failures detected by CHECK_MEM_ERROR to not return.

Change-Id: I1dd1eca9c661ed157d51b4a6a77fc9f88236d794

2 years agovp8e_set_config: setjmp before calling vp8_change_config
James Zern [Sat, 28 May 2022 04:50:11 +0000 (21:50 -0700)]
vp8e_set_config: setjmp before calling vp8_change_config

vp8_change_config may call vp8_alloc_compressor_data which expects
failures detected by CHECK_MEM_ERROR to not return.

Change-Id: Ib7fbf4af904bd9b539402bb61c8f87855eef2ad6

2 years agoresize_test: add TODO for ResizeTest instantiation for VP9
James Zern [Sat, 28 May 2022 22:25:49 +0000 (15:25 -0700)]
resize_test: add TODO for ResizeTest instantiation for VP9

this should match VP8 and use ONE_PASS_TEST_MODES, but currently the
code will produce integer sanitizer warnings and may segfault under
certain conditions

Bug: webm:1767,webm:1768
Change-Id: I6482ff1862f19716fde3d57522591bc61d76a84f

2 years agoresize_test: add TODO for test failure
James Zern [Sat, 28 May 2022 22:26:29 +0000 (15:26 -0700)]
resize_test: add TODO for test failure

DISABLED_TestExternalResizeSmallerWidthBiggerSize was added for
webm:1642, but never fixed

Bug: webm:1642
Change-Id: I0fa368a44dda550241ea997068c58eaff551233c

2 years agolibs.doxy_template: remove some obsolete variables
James Zern [Fri, 27 May 2022 02:38:01 +0000 (19:38 -0700)]
libs.doxy_template: remove some obsolete variables

- COLS_IN_ALPHA_INDEX
  this was unused given ALPHABETICAL_INDEX = NO
- PERL_PATH / MSCGEN_PATH
  these were unused

quiets warnings with doxygen 1.9.1:
warning: Tag 'COLS_IN_ALPHA_INDEX' at line 1110 of file 'doxyfile' has
become obsolete.
warning: Tag 'PERL_PATH' at line 1105 of file 'doxyfile' has become
obsolete.
warning: Tag 'MSCGEN_PATH' at line 1126 of file 'doxyfile' has become
obsolete

Change-Id: I6229311afaa3318a3f9bcaf40fafcc5ea71ae271

2 years agoMerge "L2E: Add vp9 GOP decision helper function" into main
Cheng Chen [Tue, 31 May 2022 17:30:48 +0000 (17:30 +0000)]
Merge "L2E: Add vp9 GOP decision helper function" into main

2 years agoMerge "L2E: Add control type for the external rate control API" into main
Cheng Chen [Tue, 31 May 2022 17:30:31 +0000 (17:30 +0000)]
Merge "L2E: Add control type for the external rate control API" into main

2 years agotest/*: normalize use of nullptr
James Zern [Sat, 28 May 2022 02:36:47 +0000 (19:36 -0700)]
test/*: normalize use of nullptr

this is preferred over NULL in C++11

Change-Id: Ic48ddcc6dfb8975a57f6713549ad04d93db21415

2 years agoL2E: Add vp9 GOP decision helper function
Cheng Chen [Fri, 13 May 2022 20:42:28 +0000 (13:42 -0700)]
L2E: Add vp9 GOP decision helper function

Add a helper function to call the external rate control model.

The helper function is placed in the function where vp9 determines
GOP decisions.

The helper function passes frame information, including current
frame show index, coding index, etc to the external rate control
model, and then receives GOP decisions.

The received GOP decisions overwrites the default GOP decision, only
when the external rate control model is set to be active via
the codec control.

The decision should satisfy a few constraints, for example, larger
than min_gf_interval; smaller than max_gf_interval. Otherwise,
return error.

Unit tests are added to test the new functionality.

Change-Id: Id129b4e1a91c844ee5c356a7801c862b1130a3d8

2 years agoL2E: Add control type for the external rate control API
Cheng Chen [Fri, 13 May 2022 17:59:06 +0000 (10:59 -0700)]
L2E: Add control type for the external rate control API

Two control types are defined: QP and GOP control.
Now the API only supports the QP model.

Change-Id: Ib3a712964b9d2282c93993ee56e0558e4795fb46

2 years agoRevert "[NEON] Optimize vp9_diamond_search_sad() for NEON"
Jerome Jiang [Wed, 25 May 2022 23:39:42 +0000 (23:39 +0000)]
Revert "[NEON] Optimize vp9_diamond_search_sad() for NEON"

This reverts commit 258affdeab68ed59e181368baa46e2f1d077b0ab.

Reason for revert:

Not bitexact with C version

Original change's description:
> [NEON] Optimize vp9_diamond_search_sad() for NEON
>
> About 50% improvement in comparison to the C function.
> I have followed the AVX version with some simplifications.
>
> Change-Id: I72ddbdb2fbc5ed8a7f0210703fe05523a37db1c9

Change-Id: I5c210b3dfe1f6dec525da857dd8c83946be566fc

2 years agoMerge changes Iecb26f38,Ib3ee9b59 into main
James Zern [Thu, 26 May 2022 05:03:17 +0000 (05:03 +0000)]
Merge changes Iecb26f38,Ib3ee9b59 into main

* changes:
  GetTempOutFile(): use testing::TempDir()
  y4m_test: check temp file ptr

2 years agoGetTempOutFile(): use testing::TempDir()
James Zern [Sat, 21 May 2022 02:15:47 +0000 (19:15 -0700)]
GetTempOutFile(): use testing::TempDir()

rather than tmpfile(). this allows for setting the path with TEST_TMPDIR
and provides a valid default for android.

Change-Id: Iecb26f381b6a6ec97da62cfa0b7200f427440a2f

2 years agoloongarch: Remove redundant code
yuanhecai [Wed, 25 May 2022 01:42:35 +0000 (09:42 +0800)]
loongarch: Remove redundant code

Simplify architecture support code and remove redundant code
to improve efficiency.

Bug: webm:1755

Change-Id: I03bc251aca115b0379fe19907abd165e0876355b

2 years agoy4m_test: check temp file ptr
James Zern [Thu, 19 May 2022 02:00:56 +0000 (19:00 -0700)]
y4m_test: check temp file ptr

GetTempOutFile() and TempOutFile::file() may return null if the open
fails

Change-Id: Ib3ee9b592140d30d12aecefa7dfc5f569fa28a34

2 years agotools/*.py: update to python3
James Zern [Sun, 15 May 2022 22:39:15 +0000 (15:39 -0700)]
tools/*.py: update to python3

only lint-hunks.py is tested as part of the presubmit; the rest may
need further changes as they're used.

Bug: b/229626362
Change-Id: I2fd6e96deab8d892d34527e484ea65e3df86d162

2 years agoloongarch: Modify the representation of macros
yuanhecai [Tue, 17 May 2022 11:06:04 +0000 (19:06 +0800)]
loongarch: Modify the representation of macros

Some macros have been changed to "#define do {...} While (0)",
change the rest to "static INLINE ..."

Bug: webm:1755

Change-Id: I445ac0c543f12df38f086b479394b111058367d0

2 years agoloongarch: Reduce the number of instructions
yuanhecai [Mon, 9 May 2022 06:39:05 +0000 (14:39 +0800)]
loongarch: Reduce the number of instructions

Replace some redundant instructions to improve the efficiency
of the program.

1. txfm_macros_lsx.h
2. vpx_convolve8_avg_lsx.c
3. vpx_convolve8_horiz_lsx.c
4. vpx_convolve8_lsx.c
5. vpx_convolve8_vert_lsx.c
6. vpx_convolve_copy_lsx.c
7. vpx_convolve_lsx.h

Bug: webm:1755

Change-Id: I9b7fdf6900338a26f9b1775609ad387648684f3d