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
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)
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'
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'
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)
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)
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
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)
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)
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)
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)
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)
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
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);
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)
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'
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)
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)
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)
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)
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)
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)
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
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
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.
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);
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);
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));
^ ~~~~~~~~~~
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).