Marco Paniconi [Fri, 26 Jun 2020 22:34:35 +0000 (15:34 -0700)]
vp9-svc: Fix to setting frame size for dynamic resize
For svc with dynamic resize (only for single_layer_svc mode),
add flag to indicate resized width/height has already been set,
otherwise on the resized/trigger frame (resize_pending=1), the
wrong resolution may be set if oxcf->width/height is different
than layer width/height in single_layer_svc mode.
angiebird [Wed, 27 May 2020 07:30:11 +0000 (00:30 -0700)]
Add extra check / unit test to SetExternalGroupOfPicturesMap()
Let SetExternalGroupOfPicturesMap() modify the gop_map_ to satisfy
the following constraints.
1) Each key frame position should be at the start of a gop.
2) The last gop should not use an alt ref.
angiebird [Sat, 23 May 2020 23:28:40 +0000 (16:28 -0700)]
Add GOP_COMMAND
Send GOP_COMMAND to vp9 for setting gop decisions on the fly.
GOP_COMMAND has three members.
use: use this command to set gop or use vp9's gop decision.
show_frame_count: number of show frames in this gop.
use_alt_ref: use alt ref frame or not.
Move the logic of processing external_arf_indexes_ from
get_gop_coding_frame_num() to GetGopCommand() and
GetCodingFrameNumFromGopMap().
In the vp8_cost_branch function a couple of unsigned int are being
multiplied by integer coefficients and added to later be divided by
256. While the end result most likely fits an unsigned int, the
intermediary result of multiplying and adding sometimes doesn't (I was
able to reproduce it by leaving the encoder running at 60 fps for a
while). To avoid the multiplication overflow (which is undefined
behavior and causes a wrong result anyways) the calculation is
performed using unsigned long long instead and cast to unsigned int
for return.
Bug: b/154172422
Test: run cuttlefish with webrtc enabled for an hour
Change-Id: If7ebbda38b2450a59ed3c99ffbb59dc62431a324
When the encoder is run continuously for a few minutes at 60 fps, the
total_target_vs_actual field overflows. Since this field is a signed
integer that's considered undefined behavior in C++, which causes an
abort when used in an android binary (those run with ubsan enabled)
Bug: b/154172422
Test: run cuttelfish with webrtc enabled for an hour
Change-Id: I8f7d9d0884311a6338bdcdec76348b8cc3ce8c69
James Zern [Wed, 6 May 2020 20:01:57 +0000 (13:01 -0700)]
examples: use die() on dec/enc_init() failure
rather than die_codec(). calling any api functions with an uninitialized
codec context is undefined. this avoids a crash in a call to
vpx_codec_error_detail().
James Zern [Thu, 30 Apr 2020 17:28:43 +0000 (10:28 -0700)]
libs.mk,msvc: add missing vp9rc project
+ fix some test_rc_interface issues:
add a space before $^ in the vcproj rule to add sources to the target,
one between the -I's, and make the guid unique; fixes build / link
errors.
Wan-Teh Chang [Mon, 4 May 2020 18:18:22 +0000 (11:18 -0700)]
Remove unneeded null check for entry in for loop
In vpx_codec_control_(), before we enter the for loop, we have already
checked if ctx->iface->ctrl_maps is null and handle that as an error. So
the for loop can assume ctx->iface->ctrl_maps is not null, which implies
'entry' is not null (both initially and after entry++).
James Zern [Wed, 29 Apr 2020 01:51:01 +0000 (18:51 -0700)]
test/*.sh: add explicit error checks/returns
there was an assumption that function calls would terminate early with
an error given 'set -e' was being used. this is true, but only when the
function is part of a simple command otherwise it won't inherit the
behavior. many of the call sites use 'func || return 1' syntax meaning
the function would continue to completion return with the status of the
last command executed. this hid errors with e.g., eval statements. inner
calls within the functions are now explicitly tested for failure.
Neil Birkbeck [Sat, 25 Apr 2020 15:28:24 +0000 (08:28 -0700)]
vp9_firstpass.c: limit mv_limits with MV_MAX in motion_search
Currently, in rare cases on big videos (> 5K), best_mv may differ from ref_mv by more than the allowable MV_MAX. Intersect mv_limits with those bound by MV_MAX before diamond search.
We could use vp9_set_mv_search_range, but that seems a bit more constrained than the bug I encountered (e.g., MAX_FULL_PEL_VAL < MV_MAX / 8).
James Zern [Tue, 21 Apr 2020 02:30:24 +0000 (19:30 -0700)]
realtime_test: add IntegerOverflow test
use an extreme bitrate to cover rate control calculations.
this is disabled by default as there are a mix of
-fsanitize=undefined/integer warnings for vp9 and -fsanitize=integer
warnings for vp8.
this is a follow-up to: 5e065cf9d vp8/{ratectrl,onyx_if}: fix some signed integer overflows 5eab093a7 vp9_ratectrl: fix some signed integer overflows
Marco Paniconi [Fri, 17 Apr 2020 18:58:01 +0000 (11:58 -0700)]
vp9-rtc: Some speedups to speed 5 real-time mode
Enable use_source_sad at speed 5 and use it to
condition min_partition_size in nonrd_select_partition.
Also disable checking rectangular partitions in
nonrd_pick_partition for speed >= 5.
~5-8% speedup for HD clip on x86.
bdrate loss of ~1% on rtc set.
Marco Paniconi [Thu, 9 Apr 2020 01:39:41 +0000 (18:39 -0700)]
vp9-rtc: Disable nonrd_keyframe for SVC, speed >=8
For speed >= 8: disable nonrd_keyframe SVC with
spatial_layers > 1. In this case having base
spatial layer key frame with higher quality
(hybrid mode search) is beneficial, without too
much cpu cost (since its on lowest spatial layer).
Johann [Mon, 6 Apr 2020 07:06:45 +0000 (16:06 +0900)]
x86_abi_support: do not decorate coff functions
:private_extern only applies to macho. Match x86inc.asm logic:
%if FORMAT_ELF
global %2:function hidden
%elif FORMAT_MACHO
global %2:private_extern
%else
global %2
%endif
May fix a build issue on windows:
vp8/encoder/x86/block_error_sse2.asm:18: error:
COFF format does not support any special symbol types
* changes:
x86inc.asm: update to 3e5aed95c
x86inc.asm: namespace ARCH_* defines
x86inc.asm: only set visibility for chromium builds
x86inc.asm: do not align .text for aout
x86inc.asm: use .text on march32
x86inc.asm: copy PIC macros from x86_abi_support.asm
x86inc.asm: set PREFIX from libvpx defines
x86inc.asm: pull settings from libvpx
x86inc.asm: update to 3e5aed95
Johann [Thu, 2 Apr 2020 01:59:01 +0000 (10:59 +0900)]
x86inc.asm: only set visibility for chromium builds
Reapply and update a4b47b89f. This restores the previous version's
behavior avoiding issues with builds that may split sources on
directory boundaries; protected visibility may work in this case.
Clement Courbet [Fri, 20 Mar 2020 08:22:55 +0000 (09:22 +0100)]
Optimize vp9_get_sub_block_energy.
Because energy scaling is non-decreasing, we can work on the variance
and scale after the loop. This avoids costly computations (in
particular, log()) within the loop.
We've measured that we spend 0.8% of our total time computing the log.
* changes:
Correct time_base of ivf header in SimpleEncode
Add detail comments on valid_list in SimpleEncode
Add missing Copyright to python files
Move member functions up in simple_encode.h