Bug 1759324 - update libvpx to v1.11.0 r=bryce

Differential Revision: https://phabricator.services.mozilla.com/D140925
This commit is contained in:
Johann 2022-04-11 08:54:39 +00:00
Родитель 548e9a881d
Коммит 1a131bad22
331 изменённых файлов: 21159 добавлений и 20136 удалений

Просмотреть файл

@ -22,4 +22,4 @@
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
# don't change CLOBBER for WebIDL changes any more.
Bug 1763783 - Update to ICU 71 requires clobber
Bug 1759324 - update libvpx to v1.11.0

Просмотреть файл

@ -8,4 +8,4 @@ The libvpx git repository is:
https://chromium.googlesource.com/webm/libvpx
The git commit ID used was 7ec7a33a081aeeb53fed1a8d87e4cbd189152527
The git commit ID used was v1.11.0

Просмотреть файл

@ -1,8 +1,8 @@
// This file is generated. Do not edit.
#define VERSION_MAJOR 1
#define VERSION_MINOR 8
#define VERSION_PATCH 2
#define VERSION_MINOR 11
#define VERSION_PATCH 0
#define VERSION_EXTRA ""
#define VERSION_PACKED ((VERSION_MAJOR<<16)|(VERSION_MINOR<<8)|(VERSION_PATCH))
#define VERSION_STRING_NOSP "v1.8.2"
#define VERSION_STRING " v1.8.2"
#define VERSION_STRING_NOSP "v1.11.0"
#define VERSION_STRING " v1.11.0"

Просмотреть файл

@ -12,6 +12,8 @@ Deb Mukherjee <debargha@google.com>
Elliott Karpilovsky <elliottk@google.com>
Erik Niemeyer <erik.a.niemeyer@intel.com> <erik.a.niemeyer@gmail.com>
Fyodor Kyslov <kyslov@google.com>
Gregor Jasny <gjasny@gmail.com>
Gregor Jasny <gjasny@gmail.com> <gjasny@googlemail.com>
Guillaume Martres <gmartres@google.com> <smarter3@gmail.com>
Hangyu Kuang <hkuang@google.com>
Hui Su <huisu@google.com>

Просмотреть файл

@ -3,6 +3,7 @@
Aaron Watry <awatry@gmail.com>
Abo Talib Mahfoodh <ab.mahfoodh@gmail.com>
Adam B. Goode <adam.mckee84@gmail.com>
Adrian Grange <agrange@google.com>
Ahmad Sharif <asharif@google.com>
Aidan Welch <aidansw@yahoo.com>
@ -25,6 +26,8 @@ Angie Chiang <angiebird@google.com>
Aron Rosenberg <arosenberg@logitech.com>
Attila Nagy <attilanagy@google.com>
Birk Magnussen <birk.magnussen@googlemail.com>
Bohan Li <bohanli@google.com>
Brian Foley <bpfoley@google.com>
Brion Vibber <bvibber@wikimedia.org>
changjun.yang <changjun.yang@intel.com>
Charles 'Buck' Krasic <ckrasic@google.com>
@ -33,8 +36,11 @@ Chi Yo Tsai <chiyotsai@google.com>
chm <chm@rock-chips.com>
Chris Cunningham <chcunningham@chromium.org>
Christian Duvivier <cduvivier@google.com>
Chunbo Hua <chunbo.hua@intel.com>
Clement Courbet <courbet@google.com>
Daniele Castagna <dcastagna@chromium.org>
Daniel Kang <ddkang@google.com>
Daniel Sommermann <dcsommer@gmail.com>
Dan Zhu <zxdan@google.com>
Deb Mukherjee <debargha@google.com>
Deepa K G <deepa.kg@ittiam.com>
@ -65,12 +71,14 @@ Han Shen <shenhan@google.com>
Harish Mahendrakar <harish.mahendrakar@ittiam.com>
Henrik Lundin <hlundin@google.com>
Hien Ho <hienho@google.com>
Hirokazu Honda <hiroh@chromium.org>
Hui Su <huisu@google.com>
Ivan Krasin <krasin@chromium.org>
Ivan Maltz <ivanmaltz@google.com>
Jacek Caban <cjacek@gmail.com>
Jacky Chen <jackychen@google.com>
James Berry <jamesberry@google.com>
James Touton <bekenn@gmail.com>
James Yu <james.yu@linaro.org>
James Zern <jzern@google.com>
Jan Gerber <j@mailb.org>
@ -80,17 +88,22 @@ Jean-Yves Avenard <jyavenard@mozilla.com>
Jeff Faust <jfaust@google.com>
Jeff Muizelaar <jmuizelaar@mozilla.com>
Jeff Petkau <jpet@chromium.org>
Jeremy Leconte <jleconte@google.com>
Jerome Jiang <jianj@google.com>
Jia Jia <jia.jia@linaro.org>
Jian Zhou <zhoujian@google.com>
Jim Bankoski <jimbankoski@google.com>
jinbo <jinbo-hf@loongson.cn>
Jingning Han <jingning@google.com>
Joel Fernandes <joelaf@google.com>
Joey Parrish <joeyparrish@google.com>
Johann Koenig <johannkoenig@google.com>
John Koleszar <jkoleszar@google.com>
Johnny Klonaris <google@jawknee.com>
John Stark <jhnstrk@gmail.com>
Jonathan Wright <jonathan.wright@arm.com>
Jon Kunkee <jkunkee@microsoft.com>
Jorge E. Moreira <jemoreira@google.com>
Joshua Bleecher Snyder <josh@treelinelabs.com>
Joshua Litt <joshualitt@google.com>
Julia Robson <juliamrobson@gmail.com>
@ -125,6 +138,7 @@ Mirko Bonadei <mbonadei@google.com>
Moriyoshi Koizumi <mozo@mozo.jp>
Morton Jonuschat <yabawock@gmail.com>
Nathan E. Egge <negge@mozilla.com>
Neil Birkbeck <neil.birkbeck@gmail.com>
Nico Weber <thakis@chromium.org>
Niveditha Rau <niveditha.rau@gmail.com>
Parag Salasakar <img.mips1@gmail.com>
@ -137,6 +151,7 @@ Pengchong Jin <pengchong@google.com>
Peter Boström <pbos@chromium.org>
Peter Collingbourne <pcc@chromium.org>
Peter de Rivaz <peter.derivaz@gmail.com>
Peter Kasting <pkasting@chromium.org>
Philip Jägenstedt <philipj@opera.com>
Priit Laes <plaes@plaes.org>
Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
@ -165,6 +180,7 @@ Shimon Doodkin <helpmepro1@gmail.com>
Shiyou Yin <yinshiyou-hf@loongson.cn>
Shubham Tandle <shubham.tandle@ittiam.com>
Shunyao Li <shunyaoli@google.com>
Sreerenj Balachandran <bsreerenj@gmail.com>
Stefan Holmer <holmer@google.com>
Suman Sunkara <sunkaras@google.com>
Supradeep T R <supradeep.tr@ittiam.com>
@ -185,6 +201,7 @@ Vignesh Venkatasubramanian <vigneshv@google.com>
Vitaly Buka <vitalybuka@chromium.org>
Vlad Tsyrklevich <vtsyrklevich@chromium.org>
Wan-Teh Chang <wtc@google.com>
Wonkap Jang <wonkap@google.com>
xiwei gu <guxiwei-hf@loongson.cn>
Yaowu Xu <yaowu@google.com>
Yi Luo <luoyi@google.com>

Просмотреть файл

@ -1,3 +1,83 @@
2021-09-27 v1.11.0 "Smew Duck"
This maintenance release adds support for VBR mode in VP9 rate control
interface, new codec controls to get quantization parameters and loop filter
levels, and includes several improvements to NEON and numerous bug fixes.
- Upgrading:
New codec control is added to get quantization parameters and loop filter
levels.
VBR mode is supported in VP9 rate control library.
- Enhancement:
Numerous improvements for Neon optimizations.
Code clean-up and refactoring.
Calculation of rd multiplier is changed with BDRATE gains.
- Bug fixes:
Fix to overflow on duration.
Fix to several instances of -Wunused-but-set-variable.
Fix to avoid chroma resampling for 420mpeg2 input.
Fix to overflow in calc_iframe_target_size.
Fix to disallow skipping transform and quantization.
Fix some -Wsign-compare warnings in simple_encode.
Fix input file path in simple_encode_test.
Fix valid range for under/over_shoot pct.
2021-03-09 v1.10.0 "Ruddy Duck"
This maintenance release adds support for darwin20 and new codec controls, as
well as numerous bug fixes.
- Upgrading:
New codec control is added to disable loopfilter for VP9.
New encoder control is added to disable feature to increase Q on overshoot
detection for CBR.
Configure support for darwin20 is added.
New codec control is added for VP9 rate control. The control ID of this
interface is VP9E_SET_EXTERNAL_RATE_CONTROL. To make VP9 use a customized
external rate control model, users will have to implement each callback
function in vpx_rc_funcs_t and register them using libvpx API
vpx_codec_control_() with the control ID.
- Enhancement:
Use -std=gnu++11 instead of -std=c++11 for c++ files.
- Bug fixes:
Override assembler with --as option of configure for MSVS.
Fix several compilation issues with gcc 4.8.5.
Fix to resetting rate control for temporal layers.
Fix to the rate control stats of SVC example encoder when number of spatial
layers is 1.
Fix to reusing motion vectors from the base spatial layer in SVC.
2 pass related flags removed from SVC example encoder.
2020-07-29 v1.9.0 "Quacking Duck"
This release adds support for NV12, a separate library for rate control, as
well as incremental improvements.
- Upgrading:
NV12 support is added to this release.
A new interface is added for VP9 rate control. The new library libvp9rc.a
must be linked by applications.
Googletest is updated to v1.10.0.
simple_encode.cc is compiled into a new library libsimple_encode.a with
CONFIG_RATE_CTRL.
- Enhancement:
Various changes to improve VP9 SVC, rate control, quality and speed to real
time encoding.
- Bug fixes:
Fix key frame update refresh simulcast flexible svc.
Fix to disable_16x16part speed feature for real time encoding.
Fix some signed integer overflows for VP9 rate control.
Fix initialization of delta_q_uv.
Fix condition in regulate_q for cyclic refresh.
Various fixes to dynamic resizing for VP9 SVC.
2019-12-09 v1.8.2 "Pekin Duck"
This release collects incremental improvements to many aspects of the library.
@ -362,7 +442,7 @@
of particular interest to real time streaming applications.
Temporal scalability allows the encoder to produce a stream that can
be decimated to different frame rates, with independent rate targetting
be decimated to different frame rates, with independent rate targeting
for each substream.
Multiframe quality enhancement postprocessing can make visual quality

Просмотреть файл

@ -0,0 +1,29 @@
# How to Contribute
We'd love to accept your patches and contributions to this project. There are
just a few small guidelines you need to follow.
## Contributor License Agreement
Contributions to this project must be accompanied by a Contributor License
Agreement. You (or your employer) retain the copyright to your contribution;
this simply gives us permission to use and redistribute your contributions as
part of the project. Head over to <https://cla.developers.google.com/> to see
your current agreements on file or to sign a new one.
You generally only need to submit a CLA once, so if you've already submitted one
(even if it was for a different project), you probably don't need to do it
again.
## Code reviews
All submissions, including submissions by project members, require review. We
use a [Gerrit](https://www.gerritcodereview.com) instance hosted at
https://chromium-review.googlesource.com for this purpose. See the
[WebM Project page](https://www.webmproject.org/code/contribute/submitting-patches/)
for additional details.
## Community Guidelines
This project follows
[Google's Open Source Community Guidelines](https://opensource.google.com/conduct/).

Просмотреть файл

@ -1,4 +1,4 @@
README - 9 December 2019
README - 08 March 2021
Welcome to the WebM VP8/VP9 Codec SDK!
@ -10,14 +10,14 @@ COMPILING THE APPLICATIONS/LIBRARIES:
1. Prerequisites
* All x86 targets require the Yasm[1] assembler be installed[2].
* All Windows builds require that Cygwin[3] be installed.
* Building the documentation requires Doxygen[4]. If you do not
* All Windows builds require that Cygwin[3] or MSYS2[4] be installed.
* Building the documentation requires Doxygen[5]. If you do not
have this package, the install-docs option will be disabled.
* Downloading the data for the unit tests requires curl[5] and sha1sum.
* Downloading the data for the unit tests requires curl[6] and sha1sum.
sha1sum is provided via the GNU coreutils, installed by default on
many *nix platforms, as well as MinGW and Cygwin. If coreutils is not
available, a compatible version of sha1sum can be built from
source[6]. These requirements are optional if not running the unit
source[7]. These requirements are optional if not running the unit
tests.
[1]: http://www.tortall.net/projects/yasm
@ -26,9 +26,10 @@ COMPILING THE APPLICATIONS/LIBRARIES:
yasm-<version>-<arch>.exe to yasm.exe and place it in:
Program Files (x86)/Microsoft Visual Studio/2017/<level>/Common7/Tools/
[3]: http://www.cygwin.com
[4]: http://www.doxygen.org
[5]: http://curl.haxx.se
[6]: http://www.microbrew.org/tools/md5sha1sum/
[4]: http://www.msys2.org/
[5]: http://www.doxygen.org
[6]: http://curl.haxx.se
[7]: http://www.microbrew.org/tools/md5sha1sum/
2. Out-of-tree builds
Out of tree builds are a supported method of building the application. For
@ -62,6 +63,7 @@ COMPILING THE APPLICATIONS/LIBRARIES:
arm64-android-gcc
arm64-darwin-gcc
arm64-darwin20-gcc
arm64-linux-gcc
arm64-win64-gcc
arm64-win64-vs15
@ -112,6 +114,8 @@ COMPILING THE APPLICATIONS/LIBRARIES:
x86_64-darwin16-gcc
x86_64-darwin17-gcc
x86_64-darwin18-gcc
x86_64-darwin19-gcc
x86_64-darwin20-gcc
x86_64-iphonesimulator-gcc
x86_64-linux-gcc
x86_64-linux-icc

Просмотреть файл

@ -16,8 +16,10 @@
#include "vpx/vpx_integer.h"
#include "vpx_ports/msvc.h"
#if defined(__GNUC__) && __GNUC__
extern void die(const char *fmt, ...) __attribute__((noreturn));
#if defined(__GNUC__)
__attribute__((noreturn)) extern void die(const char *fmt, ...);
#elif defined(_MSC_VER)
__declspec(noreturn) extern void die(const char *fmt, ...);
#else
extern void die(const char *fmt, ...);
#endif

Просмотреть файл

@ -147,6 +147,10 @@ $(BUILD_PFX)%_avx512.c.o: CFLAGS += -mavx512f -mavx512cd -mavx512bw -mavx512dq -
$(BUILD_PFX)%_vsx.c.d: CFLAGS += -maltivec -mvsx
$(BUILD_PFX)%_vsx.c.o: CFLAGS += -maltivec -mvsx
# MIPS
$(BUILD_PFX)%_msa.c.d: CFLAGS += -mmsa
$(BUILD_PFX)%_msa.c.o: CFLAGS += -mmsa
$(BUILD_PFX)%.c.d: %.c
$(if $(quiet),@echo " [DEP] $@")
$(qexec)mkdir -p $(dir $@)

Просмотреть файл

@ -262,6 +262,9 @@ if [ -z "$source_path" ] || [ "$source_path" = "." ]; then
source_path="`pwd`"
disable_feature source_path_used
fi
# Makefiles greedily process the '#' character as a comment, even if it is
# inside quotes. So, this character must be escaped in all paths in Makefiles.
source_path_mk=$(echo $source_path | sed -e 's;\#;\\\#;g')
if test ! -z "$TMPDIR" ; then
TMPDIRx="${TMPDIR}"
@ -481,11 +484,11 @@ write_common_target_config_mk() {
cat >> $1 << EOF
# This file automatically generated by configure. Do not edit!
SRC_PATH="$source_path"
SRC_PATH_BARE=$source_path
SRC_PATH="$source_path_mk"
SRC_PATH_BARE=$source_path_mk
BUILD_PFX=${BUILD_PFX}
TOOLCHAIN=${toolchain}
ASM_CONVERSION=${asm_conversion_cmd:-${source_path}/build/make/ads2gas.pl}
ASM_CONVERSION=${asm_conversion_cmd:-${source_path_mk}/build/make/ads2gas.pl}
GEN_VCPROJ=${gen_vcproj_cmd}
MSVS_ARCH_DIR=${msvs_arch_dir}
@ -767,9 +770,13 @@ process_common_toolchain() {
# detect tgt_os
case "$gcctarget" in
*darwin1[0-8]*)
*darwin1[0-9]*)
tgt_isa=x86_64
tgt_os=`echo $gcctarget | sed 's/.*\(darwin1[0-8]\).*/\1/'`
tgt_os=`echo $gcctarget | sed 's/.*\(darwin1[0-9]\).*/\1/'`
;;
*darwin20*)
tgt_isa=`uname -m`
tgt_os=`echo $gcctarget | sed 's/.*\(darwin2[0-9]\).*/\1/'`
;;
x86_64*mingw32*)
tgt_os=win64
@ -845,7 +852,7 @@ process_common_toolchain() {
# Handle darwin variants. Newer SDKs allow targeting older
# platforms, so use the newest one available.
case ${toolchain} in
arm*-darwin*)
arm*-darwin-*)
add_cflags "-miphoneos-version-min=${IOS_VERSION_MIN}"
iphoneos_sdk_dir="$(show_darwin_sdk_path iphoneos)"
if [ -d "${iphoneos_sdk_dir}" ]; then
@ -853,7 +860,7 @@ process_common_toolchain() {
add_ldflags "-isysroot ${iphoneos_sdk_dir}"
fi
;;
x86*-darwin*)
*-darwin*)
osx_sdk_dir="$(show_darwin_sdk_path macosx)"
if [ -d "${osx_sdk_dir}" ]; then
add_cflags "-isysroot ${osx_sdk_dir}"
@ -907,6 +914,14 @@ process_common_toolchain() {
add_cflags "-mmacosx-version-min=10.14"
add_ldflags "-mmacosx-version-min=10.14"
;;
*-darwin19-*)
add_cflags "-mmacosx-version-min=10.15"
add_ldflags "-mmacosx-version-min=10.15"
;;
*-darwin20-*)
add_cflags "-mmacosx-version-min=10.16 -arch ${toolchain%%-*}"
add_ldflags "-mmacosx-version-min=10.16 -arch ${toolchain%%-*}"
;;
*-iphonesimulator-*)
add_cflags "-miphoneos-version-min=${IOS_VERSION_MIN}"
add_ldflags "-miphoneos-version-min=${IOS_VERSION_MIN}"
@ -980,7 +995,7 @@ EOF
fi
enabled debug && add_asflags -g
asm_conversion_cmd="${source_path}/build/make/ads2gas.pl"
asm_conversion_cmd="${source_path_mk}/build/make/ads2gas.pl"
case ${tgt_os} in
win*)
@ -1002,7 +1017,7 @@ EOF
# respective SDKs' limitations. Fortunately, these are all 32-bit ABIs
# and so can be selected as 'win32'.
if [ ${tgt_os} = "win32" ]; then
asm_conversion_cmd="${source_path}/build/make/ads2armasm_ms.pl"
asm_conversion_cmd="${source_path_mk}/build/make/ads2armasm_ms.pl"
AS_SFX=.S
msvs_arch_dir=arm-msvs
disable_feature multithread
@ -1080,7 +1095,7 @@ EOF
soft_enable unit_tests
;;
darwin*)
darwin)
if ! enabled external_build; then
XCRUN_FIND="xcrun --sdk iphoneos --find"
CXX="$(${XCRUN_FIND} clang++)"
@ -1137,7 +1152,7 @@ EOF
fi
fi
asm_conversion_cmd="${source_path}/build/make/ads2gas_apple.pl"
asm_conversion_cmd="${source_path_mk}/build/make/ads2gas_apple.pl"
;;
linux*)
@ -1191,25 +1206,27 @@ EOF
check_add_asflags -mips64r6 -mabi=64 -mhard-float -mfp64
check_add_ldflags -mips64r6 -mabi=64 -mfp64
;;
loongson3*)
check_cflags -march=loongson3a && soft_enable mmi \
|| disable_feature mmi
check_cflags -mmsa && soft_enable msa \
|| disable_feature msa
tgt_isa=loongson3a
;;
esac
if enabled mmi || enabled msa; then
soft_enable runtime_cpu_detect
fi
if enabled msa; then
# TODO(libyuv:793)
# The new mips functions in libyuv do not build
# with the toolchains we currently use for testing.
soft_disable libyuv
add_cflags -mmsa
add_asflags -mmsa
add_ldflags -mmsa
fi
fi
if enabled mmi; then
tgt_isa=loongson3a
check_add_ldflags -march=loongson3a
fi
check_add_cflags -march=${tgt_isa}
check_add_asflags -march=${tgt_isa}
check_add_asflags -KPIC
@ -1279,10 +1296,6 @@ EOF
enabled optimizations && disabled gprof && check_add_cflags -fomit-frame-pointer
;;
vs*)
# When building with Microsoft Visual Studio the assembler is
# invoked directly. Checking at configure time is unnecessary.
# Skip the check by setting AS arbitrarily
AS=msvs
msvs_arch_dir=x86-msvs
case ${tgt_cc##vs} in
14)

Просмотреть файл

@ -157,6 +157,8 @@ for opt in "$@"; do
;;
--lib) proj_kind="lib"
;;
--as=*) as="${optval}"
;;
--src-path-bare=*)
src_path_bare=$(fix_path "$optval")
src_path_bare=${src_path_bare%/}
@ -247,13 +249,13 @@ libs=${libs// /;}
case "$target" in
x86_64*)
platforms[0]="x64"
asm_Debug_cmdline="yasm -Xvc -g cv8 -f win64 ${yasmincs} &quot;%(FullPath)&quot;"
asm_Release_cmdline="yasm -Xvc -f win64 ${yasmincs} &quot;%(FullPath)&quot;"
asm_Debug_cmdline="${as} -Xvc -gcv8 -f win64 ${yasmincs} &quot;%(FullPath)&quot;"
asm_Release_cmdline="${as} -Xvc -f win64 ${yasmincs} &quot;%(FullPath)&quot;"
;;
x86*)
platforms[0]="Win32"
asm_Debug_cmdline="yasm -Xvc -g cv8 -f win32 ${yasmincs} &quot;%(FullPath)&quot;"
asm_Release_cmdline="yasm -Xvc -f win32 ${yasmincs} &quot;%(FullPath)&quot;"
asm_Debug_cmdline="${as} -Xvc -gcv8 -f win32 ${yasmincs} &quot;%(FullPath)&quot;"
asm_Release_cmdline="${as} -Xvc -f win32 ${yasmincs} &quot;%(FullPath)&quot;"
;;
arm64*)
platforms[0]="ARM64"

Просмотреть файл

@ -9,7 +9,8 @@
## be found in the AUTHORS file in the root of the source tree.
##
if [ "$(uname -o 2>/dev/null)" = "Cygwin" ] \
shell_name="$(uname -o 2>/dev/null)"
if [[ "$shell_name" = "Cygwin" || "$shell_name" = "Msys" ]] \
&& cygpath --help >/dev/null 2>&1; then
FIXPATH='cygpath -m'
else

Просмотреть файл

@ -315,14 +315,26 @@ EOF
sub mips() {
determine_indirection("c", @ALL_ARCHS);
# Assign the helper variable for each enabled extension
foreach my $opt (@ALL_ARCHS) {
my $opt_uc = uc $opt;
eval "\$have_${opt}=\"flags & HAS_${opt_uc}\"";
}
common_top;
print <<EOF;
#include "vpx_config.h"
#ifdef RTCD_C
#include "vpx_ports/mips.h"
static void setup_rtcd_internal(void)
{
int flags = mips_cpu_caps();
(void)flags;
EOF
set_function_pointers("c", @ALL_ARCHS);
@ -410,24 +422,35 @@ if ($opts{arch} eq 'x86') {
&require(@REQUIRES);
x86;
} elsif ($opts{arch} eq 'mips32' || $opts{arch} eq 'mips64') {
my $have_dspr2 = 0;
my $have_msa = 0;
my $have_mmi = 0;
@ALL_ARCHS = filter("$opts{arch}");
open CONFIG_FILE, $opts{config} or
die "Error opening config file '$opts{config}': $!\n";
while (<CONFIG_FILE>) {
if (/HAVE_DSPR2=yes/) {
@ALL_ARCHS = filter("$opts{arch}", qw/dspr2/);
last;
$have_dspr2 = 1;
}
if (/HAVE_MSA=yes/) {
@ALL_ARCHS = filter("$opts{arch}", qw/msa/);
last;
$have_msa = 1;
}
if (/HAVE_MMI=yes/) {
@ALL_ARCHS = filter("$opts{arch}", qw/mmi/);
last;
$have_mmi = 1;
}
}
close CONFIG_FILE;
if ($have_dspr2 == 1) {
@ALL_ARCHS = filter("$opts{arch}", qw/dspr2/);
} elsif ($have_msa == 1 && $have_mmi == 1) {
@ALL_ARCHS = filter("$opts{arch}", qw/mmi msa/);
} elsif ($have_msa == 1) {
@ALL_ARCHS = filter("$opts{arch}", qw/msa/);
} elsif ($have_mmi == 1) {
@ALL_ARCHS = filter("$opts{arch}", qw/mmi/);
} else {
unoptimized;
}
mips;
} elsif ($opts{arch} =~ /armv7\w?/) {
@ALL_ARCHS = filter(qw/neon_asm neon/);

15
media/libvpx/libvpx/configure поставляемый
Просмотреть файл

@ -99,6 +99,7 @@ EOF
# alphabetically by architecture, generic-gnu last.
all_platforms="${all_platforms} arm64-android-gcc"
all_platforms="${all_platforms} arm64-darwin-gcc"
all_platforms="${all_platforms} arm64-darwin20-gcc"
all_platforms="${all_platforms} arm64-linux-gcc"
all_platforms="${all_platforms} arm64-win64-gcc"
all_platforms="${all_platforms} arm64-win64-vs15"
@ -149,6 +150,8 @@ all_platforms="${all_platforms} x86_64-darwin15-gcc"
all_platforms="${all_platforms} x86_64-darwin16-gcc"
all_platforms="${all_platforms} x86_64-darwin17-gcc"
all_platforms="${all_platforms} x86_64-darwin18-gcc"
all_platforms="${all_platforms} x86_64-darwin19-gcc"
all_platforms="${all_platforms} x86_64-darwin20-gcc"
all_platforms="${all_platforms} x86_64-iphonesimulator-gcc"
all_platforms="${all_platforms} x86_64-linux-gcc"
all_platforms="${all_platforms} x86_64-linux-icc"
@ -627,6 +630,7 @@ process_toolchain() {
check_add_cflags -Wmissing-declarations
check_add_cflags -Wmissing-prototypes
check_add_cflags -Wuninitialized
check_add_cflags -Wunreachable-code-loop-increment
check_add_cflags -Wunused
check_add_cflags -Wextra
# check_add_cflags also adds to cxxflags. gtest does not do well with
@ -727,32 +731,33 @@ process_toolchain() {
soft_enable libyuv
;;
*-android-*)
check_add_cxxflags -std=c++11 && soft_enable webm_io
check_add_cxxflags -std=gnu++11 && soft_enable webm_io
soft_enable libyuv
# GTestLog must be modified to use Android logging utilities.
;;
*-darwin-*)
check_add_cxxflags -std=gnu++11
# iOS/ARM builds do not work with gtest. This does not match
# x86 targets.
;;
*-iphonesimulator-*)
check_add_cxxflags -std=c++11 && soft_enable webm_io
check_add_cxxflags -std=gnu++11 && soft_enable webm_io
soft_enable libyuv
;;
*-win*)
# Some mingw toolchains don't have pthread available by default.
# Treat these more like visual studio where threading in gtest
# would be disabled for the same reason.
check_add_cxxflags -std=c++11 && soft_enable unit_tests \
check_add_cxxflags -std=gnu++11 && soft_enable unit_tests \
&& soft_enable webm_io
check_cxx "$@" <<EOF && soft_enable libyuv
int z;
EOF
;;
*)
enabled pthread_h && check_add_cxxflags -std=c++11 \
enabled pthread_h && check_add_cxxflags -std=gnu++11 \
&& soft_enable unit_tests
check_add_cxxflags -std=c++11 && soft_enable webm_io
check_add_cxxflags -std=gnu++11 && soft_enable webm_io
check_cxx "$@" <<EOF && soft_enable libyuv
int z;
EOF

Просмотреть файл

@ -65,6 +65,7 @@ endif
# while EXAMPLES demonstrate specific portions of the API.
UTILS-$(CONFIG_DECODERS) += vpxdec.c
vpxdec.SRCS += md5_utils.c md5_utils.h
vpxdec.SRCS += vpx_ports/compiler_attributes.h
vpxdec.SRCS += vpx_ports/mem_ops.h
vpxdec.SRCS += vpx_ports/mem_ops_aligned.h
vpxdec.SRCS += vpx_ports/msvc.h
@ -167,6 +168,7 @@ decode_to_md5.SRCS += y4minput.c y4minput.h
decode_to_md5.SRCS += tools_common.h tools_common.c
decode_to_md5.SRCS += video_common.h
decode_to_md5.SRCS += video_reader.h video_reader.c
decode_to_md5.SRCS += vpx_ports/compiler_attributes.h
decode_to_md5.SRCS += vpx_ports/mem_ops.h
decode_to_md5.SRCS += vpx_ports/mem_ops_aligned.h
decode_to_md5.SRCS += vpx_ports/msvc.h
@ -374,6 +376,7 @@ $(1): $($(1:.$(VCPROJ_SFX)=).SRCS) vpx.$(VCPROJ_SFX)
--ver=$$(CONFIG_VS_VERSION)\
--proj-guid=$$($$(@:.$(VCPROJ_SFX)=).GUID)\
--src-path-bare="$(SRC_PATH_BARE)" \
--as=$$(AS) \
$$(if $$(CONFIG_STATIC_MSVCRT),--static-crt) \
--out=$$@ $$(INTERNAL_CFLAGS) $$(CFLAGS) \
$$(INTERNAL_LDFLAGS) $$(LDFLAGS) -l$$(CODEC_LIB) $$^

Просмотреть файл

@ -106,7 +106,7 @@ int main(int argc, char **argv) {
printf("Using %s\n", vpx_codec_iface_name(decoder->codec_interface()));
if (vpx_codec_dec_init(&codec, decoder->codec_interface(), NULL, 0))
die_codec(&codec, "Failed to initialize decoder.");
die("Failed to initialize decoder.");
while (vpx_video_reader_read_frame(reader)) {
vpx_codec_iter_t iter = NULL;

Просмотреть файл

@ -86,9 +86,9 @@ int main(int argc, char **argv) {
res = vpx_codec_dec_init(&codec, decoder->codec_interface(), NULL,
VPX_CODEC_USE_POSTPROC);
if (res == VPX_CODEC_INCAPABLE)
die_codec(&codec, "Postproc not supported by this decoder.");
die("Postproc not supported by this decoder.");
if (res) die_codec(&codec, "Failed to initialize decoder.");
if (res) die("Failed to initialize decoder.");
while (vpx_video_reader_read_frame(reader)) {
vpx_codec_iter_t iter = NULL;

Просмотреть файл

@ -209,7 +209,7 @@ int main(int argc, char **argv) {
die("Failed to open %s for reading.", argv[4]);
if (vpx_codec_enc_init(&codec, encoder->codec_interface(), &cfg, 0))
die_codec(&codec, "Failed to initialize encoder");
die("Failed to initialize encoder");
// Encode frames.
while (vpx_img_read(&raw, infile)) {

Просмотреть файл

@ -118,7 +118,7 @@ int main(int argc, char **argv) {
printf("Using %s\n", vpx_codec_iface_name(decoder->codec_interface()));
if (vpx_codec_dec_init(&codec, decoder->codec_interface(), NULL, 0))
die_codec(&codec, "Failed to initialize decoder.");
die("Failed to initialize decoder.");
while (vpx_video_reader_read_frame(reader)) {
vpx_codec_iter_t iter = NULL;

Просмотреть файл

@ -218,7 +218,7 @@ int main(int argc, char **argv) {
die("Failed to open %s for reading.", infile_arg);
if (vpx_codec_enc_init(&codec, encoder->codec_interface(), &cfg, 0))
die_codec(&codec, "Failed to initialize encoder");
die("Failed to initialize encoder");
// Encode frames.
while (vpx_img_read(&raw, infile)) {

Просмотреть файл

@ -128,7 +128,7 @@ static vpx_fixed_buf_t pass0(vpx_image_t *raw, FILE *infile,
vpx_fixed_buf_t stats = { NULL, 0 };
if (vpx_codec_enc_init(&codec, encoder->codec_interface(), cfg, 0))
die_codec(&codec, "Failed to initialize encoder");
die("Failed to initialize encoder");
// Calculate frame statistics.
while (vpx_img_read(raw, infile)) {
@ -164,7 +164,7 @@ static void pass1(vpx_image_t *raw, FILE *infile, const char *outfile_name,
if (!writer) die("Failed to open %s for writing", outfile_name);
if (vpx_codec_enc_init(&codec, encoder->codec_interface(), cfg, 0))
die_codec(&codec, "Failed to initialize encoder");
die("Failed to initialize encoder");
// Encode frames.
while (vpx_img_read(raw, infile)) {

Просмотреть файл

@ -155,7 +155,7 @@ int main(int argc, char **argv) {
die("Failed to open %s for reading.", argv[3]);
if (vpx_codec_enc_init(&codec, encoder->codec_interface(), &cfg, 0))
die_codec(&codec, "Failed to initialize encoder");
die("Failed to initialize encoder");
// Encode frames.
while (vpx_img_read(&raw, infile)) {

Просмотреть файл

@ -110,7 +110,7 @@ int main(int argc, char **argv) {
die("Failed to open %s for reading.", argv[3]);
if (vpx_codec_enc_init(&codec, encoder->codec_interface(), &cfg, 0))
die_codec(&codec, "Failed to initialize encoder");
die("Failed to initialize encoder");
if (vpx_codec_control_(&codec, VP9E_SET_LOSSLESS, 1))
die_codec(&codec, "Failed to use lossless mode");

Просмотреть файл

@ -66,12 +66,6 @@ static const arg_def_t kf_dist_arg =
ARG_DEF("k", "kf-dist", 1, "number of frames between keyframes");
static const arg_def_t scale_factors_arg =
ARG_DEF("r", "scale-factors", 1, "scale factors (lowest to highest layer)");
static const arg_def_t passes_arg =
ARG_DEF("p", "passes", 1, "Number of passes (1/2)");
static const arg_def_t pass_arg =
ARG_DEF(NULL, "pass", 1, "Pass to execute (1/2)");
static const arg_def_t fpf_name_arg =
ARG_DEF(NULL, "fpf", 1, "First pass statistics file name");
static const arg_def_t min_q_arg =
ARG_DEF(NULL, "min-q", 1, "Minimum quantizer");
static const arg_def_t max_q_arg =
@ -125,9 +119,6 @@ static const arg_def_t *svc_args[] = { &frames_arg,
&spatial_layers_arg,
&kf_dist_arg,
&scale_factors_arg,
&passes_arg,
&pass_arg,
&fpf_name_arg,
&min_q_arg,
&max_q_arg,
&min_bitrate_arg,
@ -173,8 +164,6 @@ typedef struct {
uint32_t frames_to_skip;
struct VpxInputContext input_ctx;
stats_io_t rc_stats;
int passes;
int pass;
int tune_content;
int inter_layer_pred;
} AppInput;
@ -197,9 +186,6 @@ static void parse_command_line(int argc, const char **argv_,
char **argi = NULL;
char **argj = NULL;
vpx_codec_err_t res;
int passes = 0;
int pass = 0;
const char *fpf_file_name = NULL;
unsigned int min_bitrate = 0;
unsigned int max_bitrate = 0;
char string_options[1024] = { 0 };
@ -289,18 +275,6 @@ static void parse_command_line(int argc, const char **argv_,
sizeof(string_options) - strlen(string_options) - 1);
strncat(string_options, arg.val,
sizeof(string_options) - strlen(string_options) - 1);
} else if (arg_match(&arg, &passes_arg, argi)) {
passes = arg_parse_uint(&arg);
if (passes < 1 || passes > 2) {
die("Error: Invalid number of passes (%d)\n", passes);
}
} else if (arg_match(&arg, &pass_arg, argi)) {
pass = arg_parse_uint(&arg);
if (pass < 1 || pass > 2) {
die("Error: Invalid pass selected (%d)\n", pass);
}
} else if (arg_match(&arg, &fpf_name_arg, argi)) {
fpf_file_name = arg.val;
} else if (arg_match(&arg, &min_q_arg, argi)) {
strncat(string_options, " min-quantizers=",
sizeof(string_options) - strlen(string_options) - 1);
@ -355,35 +329,7 @@ static void parse_command_line(int argc, const char **argv_,
if (strlen(string_options) > 0)
vpx_svc_set_options(svc_ctx, string_options + 1);
if (passes == 0 || passes == 1) {
if (pass) {
fprintf(stderr, "pass is ignored since there's only one pass\n");
}
enc_cfg->g_pass = VPX_RC_ONE_PASS;
} else {
if (pass == 0) {
die("pass must be specified when passes is 2\n");
}
if (fpf_file_name == NULL) {
die("fpf must be specified when passes is 2\n");
}
if (pass == 1) {
enc_cfg->g_pass = VPX_RC_FIRST_PASS;
if (!stats_open_file(&app_input->rc_stats, fpf_file_name, 0)) {
fatal("Failed to open statistics store");
}
} else {
enc_cfg->g_pass = VPX_RC_LAST_PASS;
if (!stats_open_file(&app_input->rc_stats, fpf_file_name, 1)) {
fatal("Failed to open statistics store");
}
enc_cfg->rc_twopass_stats_in = stats_get(&app_input->rc_stats);
}
app_input->passes = passes;
app_input->pass = pass;
}
enc_cfg->g_pass = VPX_RC_ONE_PASS;
if (enc_cfg->rc_target_bitrate > 0) {
if (min_bitrate > 0) {
@ -828,12 +774,15 @@ static void svc_output_rc_stats(
vpx_codec_control(codec, VP9E_GET_SVC_LAYER_ID, layer_id);
parse_superframe_index(cx_pkt->data.frame.buf, cx_pkt->data.frame.sz,
sizes_parsed, &count);
if (enc_cfg->ss_number_layers == 1) sizes[0] = cx_pkt->data.frame.sz;
for (sl = 0; sl < enc_cfg->ss_number_layers; ++sl) {
sizes[sl] = 0;
if (cx_pkt->data.frame.spatial_layer_encoded[sl]) {
sizes[sl] = sizes_parsed[num_layers_encoded];
num_layers_encoded++;
if (enc_cfg->ss_number_layers == 1) {
sizes[0] = cx_pkt->data.frame.sz;
} else {
for (sl = 0; sl < enc_cfg->ss_number_layers; ++sl) {
sizes[sl] = 0;
if (cx_pkt->data.frame.spatial_layer_encoded[sl]) {
sizes[sl] = sizes_parsed[num_layers_encoded];
num_layers_encoded++;
}
}
}
for (sl = 0; sl < enc_cfg->ss_number_layers; ++sl) {
@ -1001,13 +950,11 @@ int main(int argc, const char **argv) {
info.time_base.numerator = enc_cfg.g_timebase.num;
info.time_base.denominator = enc_cfg.g_timebase.den;
if (!(app_input.passes == 2 && app_input.pass == 1)) {
// We don't save the bitstream for the 1st pass on two pass rate control
writer =
vpx_video_writer_open(app_input.output_filename, kContainerIVF, &info);
if (!writer)
die("Failed to open %s for writing\n", app_input.output_filename);
}
writer =
vpx_video_writer_open(app_input.output_filename, kContainerIVF, &info);
if (!writer)
die("Failed to open %s for writing\n", app_input.output_filename);
#if OUTPUT_RC_STATS
// Write out spatial layer stream.
// TODO(marpan/jianj): allow for writing each spatial and temporal stream.
@ -1050,6 +997,9 @@ int main(int argc, const char **argv) {
vpx_codec_control(&encoder, VP9E_SET_TUNE_CONTENT, app_input.tune_content);
vpx_codec_control(&encoder, VP9E_SET_DISABLE_OVERSHOOT_MAXQ_CBR, 0);
vpx_codec_control(&encoder, VP9E_SET_DISABLE_LOOPFILTER, 0);
svc_drop_frame.framedrop_mode = FULL_SUPERFRAME_DROP;
for (sl = 0; sl < (unsigned int)svc_ctx.spatial_layers; ++sl)
svc_drop_frame.framedrop_thresh[sl] = enc_cfg.rc_dropframe_thresh;
@ -1224,7 +1174,6 @@ int main(int argc, const char **argv) {
#endif
if (vpx_codec_destroy(&encoder))
die_codec(&encoder, "Failed to destroy codec");
if (app_input.passes == 2) stats_close(&app_input.rc_stats, 1);
if (writer) {
vpx_video_writer_close(writer);
}

Просмотреть файл

@ -251,7 +251,7 @@ int main(int argc, char **argv) {
die("Failed to open %s for reading.", infile_arg);
if (vpx_codec_enc_init(&ecodec, encoder->codec_interface(), &cfg, 0))
die_codec(&ecodec, "Failed to initialize encoder");
die("Failed to initialize encoder");
// Disable alt_ref.
if (vpx_codec_control(&ecodec, VP8E_SET_ENABLEAUTOALTREF, 0))

Просмотреть файл

@ -41,7 +41,7 @@
$make -j32
* Build vp9 fuzzer
$ $CXX $CXXFLAGS -std=c++11 -DDECODER=vp9 \
$ $CXX $CXXFLAGS -std=gnu++11 -DDECODER=vp9 \
-fsanitize=fuzzer -I../libvpx -I. -Wl,--start-group \
../libvpx/examples/vpx_dec_fuzzer.cc -o ./vpx_dec_fuzzer_vp9 \
./libvpx.a -Wl,--end-group
@ -94,6 +94,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
return 0;
}
if (threads > 1) {
const int enable = (data[IVF_FILE_HDR_SZ] & 0xa0) != 0;
const vpx_codec_err_t err =
vpx_codec_control(&codec, VP9D_SET_LOOP_FILTER_OPT, enable);
static_cast<void>(err);
}
data += IVF_FILE_HDR_SZ;
size -= IVF_FILE_HDR_SZ;

Просмотреть файл

@ -815,7 +815,7 @@ int main(int argc, char **argv) {
#else
if (vpx_codec_enc_init(&codec, encoder->codec_interface(), &cfg, 0))
#endif // CONFIG_VP9_HIGHBITDEPTH
die_codec(&codec, "Failed to initialize encoder");
die("Failed to initialize encoder");
if (strncmp(encoder->name, "vp8", 3) == 0) {
vpx_codec_control(&codec, VP8E_SET_CPUUSED, -speed);
@ -831,6 +831,8 @@ int main(int argc, char **argv) {
} else if (strncmp(encoder->name, "vp9", 3) == 0) {
vpx_svc_extra_cfg_t svc_params;
memset(&svc_params, 0, sizeof(svc_params));
vpx_codec_control(&codec, VP9E_SET_POSTENCODE_DROP, 0);
vpx_codec_control(&codec, VP9E_SET_DISABLE_OVERSHOOT_MAXQ_CBR, 0);
vpx_codec_control(&codec, VP8E_SET_CPUUSED, speed);
vpx_codec_control(&codec, VP9E_SET_AQ_MODE, 3);
vpx_codec_control(&codec, VP9E_SET_GF_CBR_BOOST_PCT, 0);
@ -840,6 +842,7 @@ int main(int argc, char **argv) {
vpx_codec_control(&codec, VP8E_SET_STATIC_THRESHOLD, 1);
vpx_codec_control(&codec, VP9E_SET_TUNE_CONTENT, 0);
vpx_codec_control(&codec, VP9E_SET_TILE_COLUMNS, get_msb(cfg.g_threads));
vpx_codec_control(&codec, VP9E_SET_DISABLE_LOOPFILTER, 0);
#if ROI_MAP
set_roi_map(encoder->name, &cfg, &roi);
if (vpx_codec_control(&codec, VP9E_SET_ROI_MAP, &roi))
@ -928,6 +931,7 @@ int main(int argc, char **argv) {
// Update for short-time encoding bitrate states, for moving window
// of size rc->window, shifted by rc->window / 2.
// Ignore first window segment, due to key frame.
if (rc.window_size == 0) rc.window_size = 15;
if (frame_cnt > rc.window_size) {
sum_bitrate += 0.001 * 8.0 * pkt->data.frame.sz * framerate;
if (frame_cnt % rc.window_size == 0) {

Просмотреть файл

@ -13,27 +13,35 @@
#include "vpx/vpx_encoder.h"
#include "vpx_ports/mem_ops.h"
void ivf_write_file_header(FILE *outfile, const struct vpx_codec_enc_cfg *cfg,
unsigned int fourcc, int frame_cnt) {
void ivf_write_file_header_with_video_info(FILE *outfile, unsigned int fourcc,
int frame_cnt, int frame_width,
int frame_height,
vpx_rational_t timebase) {
char header[32];
header[0] = 'D';
header[1] = 'K';
header[2] = 'I';
header[3] = 'F';
mem_put_le16(header + 4, 0); // version
mem_put_le16(header + 6, 32); // header size
mem_put_le32(header + 8, fourcc); // fourcc
mem_put_le16(header + 12, cfg->g_w); // width
mem_put_le16(header + 14, cfg->g_h); // height
mem_put_le32(header + 16, cfg->g_timebase.den); // rate
mem_put_le32(header + 20, cfg->g_timebase.num); // scale
mem_put_le32(header + 24, frame_cnt); // length
mem_put_le32(header + 28, 0); // unused
mem_put_le16(header + 4, 0); // version
mem_put_le16(header + 6, 32); // header size
mem_put_le32(header + 8, fourcc); // fourcc
mem_put_le16(header + 12, frame_width); // width
mem_put_le16(header + 14, frame_height); // height
mem_put_le32(header + 16, timebase.den); // rate
mem_put_le32(header + 20, timebase.num); // scale
mem_put_le32(header + 24, frame_cnt); // length
mem_put_le32(header + 28, 0); // unused
fwrite(header, 1, 32, outfile);
}
void ivf_write_file_header(FILE *outfile, const struct vpx_codec_enc_cfg *cfg,
unsigned int fourcc, int frame_cnt) {
ivf_write_file_header_with_video_info(outfile, fourcc, frame_cnt, cfg->g_w,
cfg->g_h, cfg->g_timebase);
}
void ivf_write_frame_header(FILE *outfile, int64_t pts, size_t frame_size) {
char header[12];

Просмотреть файл

@ -12,6 +12,8 @@
#include "./tools_common.h"
#include "vpx/vpx_encoder.h"
struct vpx_codec_enc_cfg;
struct vpx_codec_cx_pkt;
@ -19,6 +21,11 @@ struct vpx_codec_cx_pkt;
extern "C" {
#endif
void ivf_write_file_header_with_video_info(FILE *outfile, unsigned int fourcc,
int frame_cnt, int frame_width,
int frame_height,
vpx_rational_t timebase);
void ivf_write_file_header(FILE *outfile, const struct vpx_codec_enc_cfg *cfg,
uint32_t fourcc, int frame_cnt);

Просмотреть файл

@ -63,6 +63,7 @@ ifeq ($(CONFIG_VP8_ENCODER),yes)
CODEC_SRCS-yes += $(addprefix $(VP8_PREFIX),$(call enabled,VP8_CX_SRCS))
CODEC_EXPORTS-yes += $(addprefix $(VP8_PREFIX),$(VP8_CX_EXPORTS))
INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8cx.h
INSTALL-LIBS-yes += include/vpx/vpx_ext_ratectrl.h
INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP8_PREFIX)/%
CODEC_DOC_SECTIONS += vp8 vp8_encoder
endif
@ -87,10 +88,20 @@ ifeq ($(CONFIG_VP9_ENCODER),yes)
CODEC_SRCS-yes += $(addprefix $(VP9_PREFIX),$(call enabled,VP9_CX_SRCS))
CODEC_EXPORTS-yes += $(addprefix $(VP9_PREFIX),$(VP9_CX_EXPORTS))
CODEC_SRCS-yes += $(VP9_PREFIX)vp9cx.mk vpx/vp8.h vpx/vp8cx.h
CODEC_SRCS-yes += vpx/vpx_ext_ratectrl.h
INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8cx.h
INSTALL-LIBS-yes += include/vpx/vpx_ext_ratectrl.h
INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP9_PREFIX)/%
CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8cx.h
CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8cx.h vpx/vpx_ext_ratectrl.h
CODEC_DOC_SECTIONS += vp9 vp9_encoder
RC_RTC_SRCS := $(addprefix $(VP9_PREFIX),$(call enabled,VP9_CX_SRCS))
RC_RTC_SRCS += $(VP9_PREFIX)vp9cx.mk vpx/vp8.h vpx/vp8cx.h
RC_RTC_SRCS += vpx/vpx_ext_ratectrl.h
RC_RTC_SRCS += $(VP9_PREFIX)ratectrl_rtc.cc
RC_RTC_SRCS += $(VP9_PREFIX)ratectrl_rtc.h
INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(VP9_PREFIX)ratectrl_rtc.cc
INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(VP9_PREFIX)ratectrl_rtc.h
endif
ifeq ($(CONFIG_VP9_DECODER),yes)
@ -115,6 +126,7 @@ endif
ifeq ($(CONFIG_MSVS),yes)
CODEC_LIB=$(if $(CONFIG_STATIC_MSVCRT),vpxmt,vpxmd)
GTEST_LIB=$(if $(CONFIG_STATIC_MSVCRT),gtestmt,gtestmd)
RC_RTC_LIB=$(if $(CONFIG_STATIC_MSVCRT),vp9rcmt,vp9rcmd)
# This variable uses deferred expansion intentionally, since the results of
# $(wildcard) may change during the course of the Make.
VS_PLATFORMS = $(foreach d,$(wildcard */Release/$(CODEC_LIB).lib),$(word 1,$(subst /, ,$(d))))
@ -165,7 +177,18 @@ INSTALL-LIBS-$(CONFIG_STATIC) += $(LIBSUBDIR)/libvpx.a
INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(LIBSUBDIR)/libvpx_g.a
endif
ifeq ($(CONFIG_VP9_ENCODER)$(CONFIG_RATE_CTRL),yesyes)
SIMPLE_ENCODE_SRCS := $(call enabled,CODEC_SRCS)
SIMPLE_ENCODE_SRCS += $(VP9_PREFIX)simple_encode.cc
SIMPLE_ENCODE_SRCS += $(VP9_PREFIX)simple_encode.h
SIMPLE_ENCODE_SRCS += ivfenc.h
SIMPLE_ENCODE_SRCS += ivfenc.c
INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(VP9_PREFIX)simple_encode.cc
INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(VP9_PREFIX)simple_encode.h
endif
CODEC_SRCS=$(call enabled,CODEC_SRCS)
INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(CODEC_SRCS)
INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(call enabled,CODEC_EXPORTS)
@ -209,6 +232,7 @@ vpx.$(VCPROJ_SFX): $(CODEC_SRCS) vpx.def
--ver=$(CONFIG_VS_VERSION) \
--src-path-bare="$(SRC_PATH_BARE)" \
--out=$@ $(CFLAGS) \
--as=$(AS) \
$(filter $(SRC_PATH_BARE)/vp8/%.c, $(VCPROJ_SRCS)) \
$(filter $(SRC_PATH_BARE)/vp8/%.h, $(VCPROJ_SRCS)) \
$(filter $(SRC_PATH_BARE)/vp9/%.c, $(VCPROJ_SRCS)) \
@ -225,15 +249,58 @@ PROJECTS-yes += vpx.$(VCPROJ_SFX)
vpx.$(VCPROJ_SFX): vpx_config.asm
vpx.$(VCPROJ_SFX): $(RTCD)
endif
else
vp9rc.$(VCPROJ_SFX): \
VCPROJ_SRCS=$(filter-out $(addprefix %, $(ASM_INCLUDES)), $^)
vp9rc.$(VCPROJ_SFX): $(RC_RTC_SRCS)
@echo " [CREATE] $@"
$(qexec)$(GEN_VCPROJ) \
$(if $(CONFIG_SHARED),--dll,--lib) \
--target=$(TOOLCHAIN) \
$(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
--name=vp9rc \
--proj-guid=C26FF952-9494-4838-9A3F-7F3D4F613385 \
--ver=$(CONFIG_VS_VERSION) \
--src-path-bare="$(SRC_PATH_BARE)" \
--out=$@ $(CFLAGS) \
--as=$(AS) \
$(filter $(SRC_PATH_BARE)/vp9/%.c, $(VCPROJ_SRCS)) \
$(filter $(SRC_PATH_BARE)/vp9/%.cc, $(VCPROJ_SRCS)) \
$(filter $(SRC_PATH_BARE)/vp9/%.h, $(VCPROJ_SRCS)) \
$(filter $(SRC_PATH_BARE)/vpx/%, $(VCPROJ_SRCS)) \
$(filter $(SRC_PATH_BARE)/vpx_dsp/%, $(VCPROJ_SRCS)) \
$(filter-out $(addprefix $(SRC_PATH_BARE)/, \
vp8/%.c vp8/%.h vp9/%.c vp9/%.cc vp9/%.h vpx/% \
vpx_dsp/%), \
$(VCPROJ_SRCS)) \
--src-path-bare="$(SRC_PATH_BARE)" \
PROJECTS-yes += vp9rc.$(VCPROJ_SFX)
vp9rc.$(VCPROJ_SFX): vpx_config.asm
vp9rc.$(VCPROJ_SFX): $(RTCD)
endif # ifeq ($(CONFIG_MSVS),yes)
else # ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
LIBVPX_OBJS=$(call objs, $(filter-out $(ASM_INCLUDES), $(CODEC_SRCS)))
OBJS-yes += $(LIBVPX_OBJS)
LIBS-$(if yes,$(CONFIG_STATIC)) += $(BUILD_PFX)libvpx.a $(BUILD_PFX)libvpx_g.a
$(BUILD_PFX)libvpx_g.a: $(LIBVPX_OBJS)
SO_VERSION_MAJOR := 6
SO_VERSION_MINOR := 2
# Updating version info.
# https://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
# For libtool: c=<current>, a=<age>, r=<revision>
# libtool generates .so file as .so.[c-a].a.r, while -version-info c:r:a is
# passed to libtool.
#
# libvpx library file is generated as libvpx.so.<MAJOR>.<MINOR>.<PATCH>
# MAJOR = c-a, MINOR = a, PATCH = r
#
# To determine SO_VERSION_{MAJOR,MINOR,PATCH}, calculate c,a,r with current
# SO_VERSION_* then follow the rules in the link to detemine the new version
# (c1, a1, r1) and set MAJOR to [c1-a1], MINOR to a1 and PATCH to r1
SO_VERSION_MAJOR := 7
SO_VERSION_MINOR := 0
SO_VERSION_PATCH := 0
ifeq ($(filter darwin%,$(TGT_OS)),$(TGT_OS))
LIBVPX_SO := libvpx.$(SO_VERSION_MAJOR).dylib
@ -330,8 +397,24 @@ endif
INSTALL-LIBS-yes += $(LIBSUBDIR)/pkgconfig/vpx.pc
INSTALL_MAPS += $(LIBSUBDIR)/pkgconfig/%.pc %.pc
CLEAN-OBJS += vpx.pc
ifeq ($(CONFIG_VP9_ENCODER),yes)
RC_RTC_OBJS=$(call objs,$(RC_RTC_SRCS))
RC_RTC_OBJS=$(call objs,$(RC_RTC_SRCS))
OBJS-yes += $(RC_RTC_OBJS)
LIBS-yes += $(BUILD_PFX)libvp9rc.a $(BUILD_PFX)libvp9rc_g.a
$(BUILD_PFX)libvp9rc_g.a: $(RC_RTC_OBJS)
endif
ifeq ($(CONFIG_VP9_ENCODER)$(CONFIG_RATE_CTRL),yesyes)
SIMPLE_ENCODE_OBJS=$(call objs,$(SIMPLE_ENCODE_SRCS))
OBJS-yes += $(SIMPLE_ENCODE_OBJS)
LIBS-yes += $(BUILD_PFX)libsimple_encode.a $(BUILD_PFX)libsimple_encode_g.a
$(BUILD_PFX)libsimple_encode_g.a: $(SIMPLE_ENCODE_OBJS)
endif
endif # ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
libvpx.ver: $(call enabled,CODEC_EXPORTS)
@echo " [CREATE] $@"
$(qexec)echo "{ global:" > $@
@ -351,13 +434,13 @@ ifeq ($(VPX_ARCH_X86)$(VPX_ARCH_X86_64),yes)
# YASM
$(BUILD_PFX)vpx_config.asm: $(BUILD_PFX)vpx_config.h
@echo " [CREATE] $@"
@egrep "#define [A-Z0-9_]+ [01]" $< \
@LC_ALL=C egrep "#define [A-Z0-9_]+ [01]" $< \
| awk '{print $$2 " equ " $$3}' > $@
else
ADS2GAS=$(if $(filter yes,$(CONFIG_GCC)),| $(ASM_CONVERSION))
$(BUILD_PFX)vpx_config.asm: $(BUILD_PFX)vpx_config.h
@echo " [CREATE] $@"
@egrep "#define [A-Z0-9_]+ [01]" $< \
@LC_ALL=C egrep "#define [A-Z0-9_]+ [01]" $< \
| awk '{print $$2 " EQU " $$3}' $(ADS2GAS) > $@
@echo " END" $(ADS2GAS) >> $@
CLEAN-OBJS += $(BUILD_PFX)vpx_config.asm
@ -387,31 +470,57 @@ ifeq ($(CONFIG_UNIT_TESTS),yes)
LIBVPX_TEST_DATA_PATH ?= .
include $(SRC_PATH_BARE)/test/test.mk
LIBVPX_TEST_SRCS=$(addprefix test/,$(call enabled,LIBVPX_TEST_SRCS))
# addprefix_clean behaves like addprefix if the target doesn't start with "../"
# However, if the target starts with "../", instead of adding prefix,
# it will remove "../".
# Using addprefix_clean, we can avoid two different targets building the
# same file, i.e.
# test/../ivfenc.c.d: ivfenc.o
# ivfenc.c.d: ivfenc.o
# Note that the other way to solve this problem is using "realpath".
# The "realpath" is supported by make 3.81 or later.
addprefix_clean=$(patsubst $(1)../%,%,$(addprefix $(1), $(2)))
LIBVPX_TEST_SRCS=$(call addprefix_clean,test/,$(call enabled,LIBVPX_TEST_SRCS))
LIBVPX_TEST_BIN=./test_libvpx$(EXE_SFX)
LIBVPX_TEST_DATA=$(addprefix $(LIBVPX_TEST_DATA_PATH)/,\
$(call enabled,LIBVPX_TEST_DATA))
libvpx_test_data_url=https://storage.googleapis.com/downloads.webmproject.org/test_data/libvpx/$(1)
TEST_INTRA_PRED_SPEED_BIN=./test_intra_pred_speed$(EXE_SFX)
TEST_INTRA_PRED_SPEED_SRCS=$(addprefix test/,$(call enabled,TEST_INTRA_PRED_SPEED_SRCS))
TEST_INTRA_PRED_SPEED_SRCS=$(call addprefix_clean,test/,\
$(call enabled,TEST_INTRA_PRED_SPEED_SRCS))
TEST_INTRA_PRED_SPEED_OBJS := $(sort $(call objs,$(TEST_INTRA_PRED_SPEED_SRCS)))
ifeq ($(CONFIG_VP9_ENCODER),yes)
RC_INTERFACE_TEST_BIN=./test_rc_interface$(EXE_SFX)
RC_INTERFACE_TEST_SRCS=$(call addprefix_clean,test/,\
$(call enabled,RC_INTERFACE_TEST_SRCS))
RC_INTERFACE_TEST_OBJS := $(sort $(call objs,$(RC_INTERFACE_TEST_SRCS)))
endif
SIMPLE_ENCODE_TEST_BIN=./test_simple_encode$(EXE_SFX)
SIMPLE_ENCODE_TEST_SRCS=$(call addprefix_clean,test/,\
$(call enabled,SIMPLE_ENCODE_TEST_SRCS))
SIMPLE_ENCODE_TEST_OBJS := $(sort $(call objs,$(SIMPLE_ENCODE_TEST_SRCS)))
libvpx_test_srcs.txt:
@echo " [CREATE] $@"
@echo $(LIBVPX_TEST_SRCS) | xargs -n1 echo | LC_ALL=C sort -u > $@
CLEAN-OBJS += libvpx_test_srcs.txt
# Attempt to download the file using curl, retrying once if it fails for a
# partial file (18).
$(LIBVPX_TEST_DATA): $(SRC_PATH_BARE)/test/test-data.sha1
@echo " [DOWNLOAD] $@"
# Attempt to download the file using curl, retrying once if it fails for a
# partial file (18).
$(qexec)( \
trap 'rm -f $@' INT TERM; \
curl="curl --retry 1 -L -o $@ $(call libvpx_test_data_url,$(@F))"; \
$$curl; \
case "$$?" in \
18) $$curl -C -;; \
curl="curl -S -s --retry 1 -L -o $@ $(call libvpx_test_data_url,$(@F))"; \
$$curl; ret=$$?; \
case "$$ret" in \
18) $$curl -C - ;; \
*) exit $$ret ;; \
esac \
)
@ -443,6 +552,7 @@ gtest.$(VCPROJ_SFX): $(SRC_PATH_BARE)/third_party/googletest/src/src/gtest-all.c
--proj-guid=EC00E1EC-AF68-4D92-A255-181690D1C9B1 \
--ver=$(CONFIG_VS_VERSION) \
--src-path-bare="$(SRC_PATH_BARE)" \
--as=$(AS) \
-D_VARIADIC_MAX=10 \
--out=gtest.$(VCPROJ_SFX) $(SRC_PATH_BARE)/third_party/googletest/src/src/gtest-all.cc \
-I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/include" -I"$(SRC_PATH_BARE)/third_party/googletest/src"
@ -459,6 +569,7 @@ test_libvpx.$(VCPROJ_SFX): $(LIBVPX_TEST_SRCS) vpx.$(VCPROJ_SFX) gtest.$(VCPROJ_
--proj-guid=CD837F5F-52D8-4314-A370-895D614166A7 \
--ver=$(CONFIG_VS_VERSION) \
--src-path-bare="$(SRC_PATH_BARE)" \
--as=$(AS) \
$(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
--out=$@ $(INTERNAL_CFLAGS) $(CFLAGS) \
-I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/include" \
@ -481,11 +592,34 @@ test_intra_pred_speed.$(VCPROJ_SFX): $(TEST_INTRA_PRED_SPEED_SRCS) vpx.$(VCPROJ_
--proj-guid=CD837F5F-52D8-4314-A370-895D614166A7 \
--ver=$(CONFIG_VS_VERSION) \
--src-path-bare="$(SRC_PATH_BARE)" \
--as=$(AS) \
$(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
--out=$@ $(INTERNAL_CFLAGS) $(CFLAGS) \
-I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/include" \
-L. -l$(CODEC_LIB) -l$(GTEST_LIB) $^
endif # TEST_INTRA_PRED_SPEED
ifeq ($(CONFIG_VP9_ENCODER),yes)
ifneq ($(strip $(RC_INTERFACE_TEST_OBJS)),)
PROJECTS-$(CONFIG_MSVS) += test_rc_interface.$(VCPROJ_SFX)
test_rc_interface.$(VCPROJ_SFX): $(RC_INTERFACE_TEST_SRCS) vpx.$(VCPROJ_SFX) \
vp9rc.$(VCPROJ_SFX) gtest.$(VCPROJ_SFX)
@echo " [CREATE] $@"
$(qexec)$(GEN_VCPROJ) \
--exe \
--target=$(TOOLCHAIN) \
--name=test_rc_interface \
-D_VARIADIC_MAX=10 \
--proj-guid=30458F88-1BC6-4689-B41C-50F3737AAB27 \
--ver=$(CONFIG_VS_VERSION) \
--as=$(AS) \
--src-path-bare="$(SRC_PATH_BARE)" \
$(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
--out=$@ $(INTERNAL_CFLAGS) $(CFLAGS) \
-I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/include" \
-L. -l$(CODEC_LIB) -l$(RC_RTC_LIB) -l$(GTEST_LIB) $^
endif # RC_INTERFACE_TEST
endif # CONFIG_VP9_ENCODER
endif
else
@ -527,6 +661,32 @@ $(eval $(call linkerxx_template,$(TEST_INTRA_PRED_SPEED_BIN), \
-L. -lvpx -lgtest $(extralibs) -lm))
endif # TEST_INTRA_PRED_SPEED
ifeq ($(CONFIG_VP9_ENCODER),yes)
ifneq ($(strip $(RC_INTERFACE_TEST_OBJS)),)
$(RC_INTERFACE_TEST_OBJS) $(RC_INTERFACE_TEST_OBJS:.o=.d): \
CXXFLAGS += $(GTEST_INCLUDES)
OBJS-yes += $(RC_INTERFACE_TEST_OBJS)
BINS-yes += $(RC_INTERFACE_TEST_BIN)
$(RC_INTERFACE_TEST_BIN): $(TEST_LIBS) libvp9rc.a
$(eval $(call linkerxx_template,$(RC_INTERFACE_TEST_BIN), \
$(RC_INTERFACE_TEST_OBJS) \
-L. -lvpx -lgtest -lvp9rc $(extralibs) -lm))
endif # RC_INTERFACE_TEST
endif # CONFIG_VP9_ENCODER
ifneq ($(strip $(SIMPLE_ENCODE_TEST_OBJS)),)
$(SIMPLE_ENCODE_TEST_OBJS) $(SIMPLE_ENCODE_TEST_OBJS:.o=.d): \
CXXFLAGS += $(GTEST_INCLUDES)
OBJS-yes += $(SIMPLE_ENCODE_TEST_OBJS)
BINS-yes += $(SIMPLE_ENCODE_TEST_BIN)
$(SIMPLE_ENCODE_TEST_BIN): $(TEST_LIBS) libsimple_encode.a
$(eval $(call linkerxx_template,$(SIMPLE_ENCODE_TEST_BIN), \
$(SIMPLE_ENCODE_TEST_OBJS) \
-L. -lsimple_encode -lvpx -lgtest $(extralibs) -lm))
endif # SIMPLE_ENCODE_TEST
endif # CONFIG_UNIT_TESTS
# Install test sources only if codec source is included
@ -534,6 +694,7 @@ INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(patsubst $(SRC_PATH_BARE)/%,%,\
$(shell find $(SRC_PATH_BARE)/third_party/googletest -type f))
INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(LIBVPX_TEST_SRCS)
INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(TEST_INTRA_PRED_SPEED_SRCS)
INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(RC_INTERFACE_TEST_SRCS)
define test_shard_template
test:: test_shard.$(1)
@ -574,6 +735,7 @@ endif
## Update the global src list
SRCS += $(CODEC_SRCS) $(LIBVPX_TEST_SRCS) $(GTEST_SRCS)
SRCS += $(RC_INTERFACE_TEST_SRCS)
##
## vpxdec/vpxenc tests.

Просмотреть файл

@ -23,6 +23,7 @@
#include <string.h> /* for memcpy() */
#include "md5_utils.h"
#include "vpx_ports/compiler_attributes.h"
static void byteSwap(UWORD32 *buf, unsigned words) {
md5byte *p;
@ -145,17 +146,6 @@ void MD5Final(md5byte digest[16], struct MD5Context *ctx) {
#define MD5STEP(f, w, x, y, z, in, s) \
(w += f(x, y, z) + in, w = (w << s | w >> (32 - s)) + x)
#if defined(__clang__) && defined(__has_attribute)
#if __has_attribute(no_sanitize)
#define VPX_NO_UNSIGNED_OVERFLOW_CHECK \
__attribute__((no_sanitize("unsigned-integer-overflow")))
#endif
#endif
#ifndef VPX_NO_UNSIGNED_OVERFLOW_CHECK
#define VPX_NO_UNSIGNED_OVERFLOW_CHECK
#endif
/*
* The core of the MD5 algorithm, this alters an existing MD5 hash to
* reflect the addition of 16 longwords of new data. MD5Update blocks
@ -244,6 +234,4 @@ VPX_NO_UNSIGNED_OVERFLOW_CHECK void MD5Transform(UWORD32 buf[4],
buf[3] += d;
}
#undef VPX_NO_UNSIGNED_OVERFLOW_CHECK
#endif

Просмотреть файл

@ -80,7 +80,7 @@ class ActiveMapRefreshTest
} else if (video->frame() >= 2 && video->img()) {
vpx_image_t *current = video->img();
vpx_image_t *previous = y4m_holder_->img();
ASSERT_TRUE(previous != NULL);
ASSERT_NE(previous, nullptr);
vpx_active_map_t map = vpx_active_map_t();
const int width = static_cast<int>(current->d_w);
const int height = static_cast<int>(current->d_h);
@ -122,7 +122,7 @@ TEST_P(ActiveMapRefreshTest, Test) {
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
}
VP9_INSTANTIATE_TEST_CASE(ActiveMapRefreshTest,
::testing::Values(::libvpx_test::kRealTime),
::testing::Range(5, 6));
VP9_INSTANTIATE_TEST_SUITE(ActiveMapRefreshTest,
::testing::Values(::libvpx_test::kRealTime),
::testing::Range(5, 6));
} // namespace

Просмотреть файл

@ -62,7 +62,7 @@ class ActiveMapTest
vpx_active_map_t map = vpx_active_map_t();
map.cols = (kWidth + 15) / 16;
map.rows = (kHeight + 15) / 16;
map.active_map = NULL;
map.active_map = nullptr;
encoder->Control(VP8E_SET_ACTIVEMAP, &map);
}
}
@ -85,7 +85,7 @@ TEST_P(ActiveMapTest, Test) {
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
}
VP9_INSTANTIATE_TEST_CASE(ActiveMapTest,
::testing::Values(::libvpx_test::kRealTime),
::testing::Range(0, 9));
VP9_INSTANTIATE_TEST_SUITE(ActiveMapTest,
::testing::Values(::libvpx_test::kRealTime),
::testing::Range(0, 9));
} // namespace

Просмотреть файл

@ -53,7 +53,7 @@ TEST_P(AddNoiseTest, CheckNoiseAdded) {
const int clamp = vpx_setup_noise(GET_PARAM(0), noise, kNoiseSize);
uint8_t *const s =
reinterpret_cast<uint8_t *>(vpx_calloc(image_size, sizeof(*s)));
ASSERT_TRUE(s != NULL);
ASSERT_NE(s, nullptr);
memset(s, 99, image_size * sizeof(*s));
ASM_REGISTER_STATE_CHECK(
@ -106,8 +106,8 @@ TEST_P(AddNoiseTest, CheckCvsAssembly) {
uint8_t *const s = reinterpret_cast<uint8_t *>(vpx_calloc(image_size, 1));
uint8_t *const d = reinterpret_cast<uint8_t *>(vpx_calloc(image_size, 1));
ASSERT_TRUE(s != NULL);
ASSERT_TRUE(d != NULL);
ASSERT_NE(s, nullptr);
ASSERT_NE(d, nullptr);
memset(s, 99, image_size);
memset(d, 99, image_size);
@ -129,20 +129,20 @@ TEST_P(AddNoiseTest, CheckCvsAssembly) {
using std::make_tuple;
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
C, AddNoiseTest,
::testing::Values(make_tuple(3.25, vpx_plane_add_noise_c),
make_tuple(4.4, vpx_plane_add_noise_c)));
#if HAVE_SSE2
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSE2, AddNoiseTest,
::testing::Values(make_tuple(3.25, vpx_plane_add_noise_sse2),
make_tuple(4.4, vpx_plane_add_noise_sse2)));
#endif
#if HAVE_MSA
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
MSA, AddNoiseTest,
::testing::Values(make_tuple(3.25, vpx_plane_add_noise_msa),
make_tuple(4.4, vpx_plane_add_noise_msa)));

Просмотреть файл

@ -150,8 +150,8 @@ TEST_P(AltRefAqSegmentTest, TestNoMisMatchAltRefAQ4) {
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
}
VP9_INSTANTIATE_TEST_CASE(AltRefAqSegmentTest,
::testing::Values(::libvpx_test::kOnePassGood,
::libvpx_test::kTwoPassGood),
::testing::Range(2, 5));
VP9_INSTANTIATE_TEST_SUITE(AltRefAqSegmentTest,
::testing::Values(::libvpx_test::kOnePassGood,
::libvpx_test::kTwoPassGood),
::testing::Range(2, 5));
} // namespace

Просмотреть файл

@ -63,8 +63,8 @@ TEST_P(AltRefTest, MonotonicTimestamps) {
EXPECT_GE(altref_count(), 1);
}
VP8_INSTANTIATE_TEST_CASE(AltRefTest,
::testing::Range(kLookAheadMin, kLookAheadMax));
VP8_INSTANTIATE_TEST_SUITE(AltRefTest,
::testing::Range(kLookAheadMin, kLookAheadMax));
#endif // CONFIG_VP8_ENCODER
@ -142,11 +142,11 @@ TEST_P(AltRefForcedKeyTestLarge, ForcedFrameIsKey) {
}
}
VP8_INSTANTIATE_TEST_CASE(AltRefForcedKeyTestLarge,
::testing::Values(::libvpx_test::kOnePassGood),
::testing::Range(0, 9));
VP8_INSTANTIATE_TEST_SUITE(AltRefForcedKeyTestLarge,
::testing::Values(::libvpx_test::kOnePassGood),
::testing::Range(0, 9));
VP9_INSTANTIATE_TEST_CASE(AltRefForcedKeyTestLarge,
::testing::Values(::libvpx_test::kOnePassGood),
::testing::Range(0, 9));
VP9_INSTANTIATE_TEST_SUITE(AltRefForcedKeyTestLarge,
::testing::Values(::libvpx_test::kOnePassGood),
::testing::Range(0, 9));
} // namespace

Просмотреть файл

@ -16,7 +16,7 @@ Note: Both adb and ndk-build are available at:
3) Run get_files.py to download the test files:
python get_files.py -i /path/to/test-data.sha1 -o /path/to/put/files \
-u http://downloads.webmproject.org/test_data/libvpx
-u https://storage.googleapis.com/downloads.webmproject.org/test_data/libvpx
4) Transfer files to device using adb. Ensure you have proper permissions for
the target

Просмотреть файл

@ -102,8 +102,8 @@ TEST_P(AqSegmentTest, TestNoMisMatchAQ3) {
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
}
VP9_INSTANTIATE_TEST_CASE(AqSegmentTest,
::testing::Values(::libvpx_test::kRealTime,
::libvpx_test::kOnePassGood),
::testing::Range(3, 9));
VP9_INSTANTIATE_TEST_SUITE(AqSegmentTest,
::testing::Values(::libvpx_test::kRealTime,
::libvpx_test::kOnePassGood),
::testing::Range(3, 9));
} // namespace

Просмотреть файл

@ -35,12 +35,12 @@ template <typename Pixel>
class AverageTestBase : public ::testing::Test {
public:
AverageTestBase(int width, int height)
: width_(width), height_(height), source_data_(NULL), source_stride_(0),
bit_depth_(8) {}
: width_(width), height_(height), source_data_(nullptr),
source_stride_(0), bit_depth_(8) {}
virtual void TearDown() {
vpx_free(source_data_);
source_data_ = NULL;
source_data_ = nullptr;
libvpx_test::ClearSystemState();
}
@ -52,7 +52,7 @@ class AverageTestBase : public ::testing::Test {
virtual void SetUp() {
source_data_ = reinterpret_cast<Pixel *>(
vpx_memalign(kDataAlignment, kDataBlockSize * sizeof(source_data_[0])));
ASSERT_TRUE(source_data_ != NULL);
ASSERT_NE(source_data_, nullptr);
source_stride_ = (width_ + 31) & ~31;
bit_depth_ = 8;
rnd_.Reset(ACMRandom::DeterministicSeed());
@ -152,6 +152,7 @@ class AverageTestHBD : public AverageTestBase<uint16_t>,
};
#endif // CONFIG_VP9_HIGHBITDEPTH
#if HAVE_NEON || HAVE_SSE2 || HAVE_MSA
typedef void (*IntProRowFunc)(int16_t hbuf[16], uint8_t const *ref,
const int ref_stride, const int height);
@ -161,7 +162,8 @@ class IntProRowTest : public AverageTestBase<uint8_t>,
public ::testing::WithParamInterface<IntProRowParam> {
public:
IntProRowTest()
: AverageTestBase(16, GET_PARAM(0)), hbuf_asm_(NULL), hbuf_c_(NULL) {
: AverageTestBase(16, GET_PARAM(0)), hbuf_asm_(nullptr),
hbuf_c_(nullptr) {
asm_func_ = GET_PARAM(1);
c_func_ = GET_PARAM(2);
}
@ -170,7 +172,7 @@ class IntProRowTest : public AverageTestBase<uint8_t>,
virtual void SetUp() {
source_data_ = reinterpret_cast<uint8_t *>(
vpx_memalign(kDataAlignment, kDataBlockSize * sizeof(source_data_[0])));
ASSERT_TRUE(source_data_ != NULL);
ASSERT_NE(source_data_, nullptr);
hbuf_asm_ = reinterpret_cast<int16_t *>(
vpx_memalign(kDataAlignment, sizeof(*hbuf_asm_) * 16));
@ -180,11 +182,11 @@ class IntProRowTest : public AverageTestBase<uint8_t>,
virtual void TearDown() {
vpx_free(source_data_);
source_data_ = NULL;
source_data_ = nullptr;
vpx_free(hbuf_c_);
hbuf_c_ = NULL;
hbuf_c_ = nullptr;
vpx_free(hbuf_asm_);
hbuf_asm_ = NULL;
hbuf_asm_ = nullptr;
}
void RunComparison() {
@ -200,6 +202,7 @@ class IntProRowTest : public AverageTestBase<uint8_t>,
int16_t *hbuf_asm_;
int16_t *hbuf_c_;
};
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(IntProRowTest);
typedef int16_t (*IntProColFunc)(uint8_t const *ref, const int width);
@ -226,6 +229,8 @@ class IntProColTest : public AverageTestBase<uint8_t>,
int16_t sum_asm_;
int16_t sum_c_;
};
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(IntProColTest);
#endif // HAVE_NEON || HAVE_SSE2 || HAVE_MSA
typedef int (*SatdFunc)(const tran_low_t *coeffs, int length);
typedef std::tuple<int, SatdFunc> SatdTestParam;
@ -239,7 +244,7 @@ class SatdTest : public ::testing::Test,
rnd_.Reset(ACMRandom::DeterministicSeed());
src_ = reinterpret_cast<tran_low_t *>(
vpx_memalign(16, sizeof(*src_) * satd_size_));
ASSERT_TRUE(src_ != NULL);
ASSERT_NE(src_, nullptr);
}
virtual void TearDown() {
@ -295,8 +300,8 @@ class BlockErrorTestFP
vpx_memalign(16, sizeof(*coeff_) * txfm_size_));
dqcoeff_ = reinterpret_cast<tran_low_t *>(
vpx_memalign(16, sizeof(*dqcoeff_) * txfm_size_));
ASSERT_TRUE(coeff_ != NULL);
ASSERT_TRUE(dqcoeff_ != NULL);
ASSERT_NE(coeff_, nullptr);
ASSERT_NE(dqcoeff_, nullptr);
}
virtual void TearDown() {
@ -378,6 +383,7 @@ TEST_P(AverageTestHBD, Random) {
}
#endif // CONFIG_VP9_HIGHBITDEPTH
#if HAVE_NEON || HAVE_SSE2 || HAVE_MSA
TEST_P(IntProRowTest, MinValue) {
FillConstant(0);
RunComparison();
@ -407,6 +413,7 @@ TEST_P(IntProColTest, Random) {
FillRandom();
RunComparison();
}
#endif
TEST_P(SatdLowbdTest, MinValue) {
const int kMin = -32640;
@ -557,38 +564,38 @@ TEST_P(BlockErrorTestFP, DISABLED_Speed) {
using std::make_tuple;
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
C, AverageTest,
::testing::Values(make_tuple(16, 16, 1, 8, &vpx_avg_8x8_c),
make_tuple(16, 16, 1, 4, &vpx_avg_4x4_c)));
#if CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
C, AverageTestHBD,
::testing::Values(make_tuple(16, 16, 1, 8, &vpx_highbd_avg_8x8_c),
make_tuple(16, 16, 1, 4, &vpx_highbd_avg_4x4_c)));
#if HAVE_SSE2
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSE2, AverageTestHBD,
::testing::Values(make_tuple(16, 16, 1, 8, &vpx_highbd_avg_8x8_sse2),
make_tuple(16, 16, 1, 4, &vpx_highbd_avg_4x4_sse2)));
#endif // HAVE_SSE2
INSTANTIATE_TEST_CASE_P(C, SatdHighbdTest,
::testing::Values(make_tuple(16, &vpx_satd_c),
make_tuple(64, &vpx_satd_c),
make_tuple(256, &vpx_satd_c),
make_tuple(1024, &vpx_satd_c)));
INSTANTIATE_TEST_SUITE_P(C, SatdHighbdTest,
::testing::Values(make_tuple(16, &vpx_satd_c),
make_tuple(64, &vpx_satd_c),
make_tuple(256, &vpx_satd_c),
make_tuple(1024, &vpx_satd_c)));
#endif // CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P(C, SatdLowbdTest,
::testing::Values(make_tuple(16, &vpx_satd_c),
make_tuple(64, &vpx_satd_c),
make_tuple(256, &vpx_satd_c),
make_tuple(1024, &vpx_satd_c)));
INSTANTIATE_TEST_SUITE_P(C, SatdLowbdTest,
::testing::Values(make_tuple(16, &vpx_satd_c),
make_tuple(64, &vpx_satd_c),
make_tuple(256, &vpx_satd_c),
make_tuple(1024, &vpx_satd_c)));
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
C, BlockErrorTestFP,
::testing::Values(make_tuple(16, &vp9_block_error_fp_c),
make_tuple(64, &vp9_block_error_fp_c),
@ -596,7 +603,7 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(1024, &vp9_block_error_fp_c)));
#if HAVE_SSE2
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSE2, AverageTest,
::testing::Values(make_tuple(16, 16, 0, 8, &vpx_avg_8x8_sse2),
make_tuple(16, 16, 5, 8, &vpx_avg_8x8_sse2),
@ -605,27 +612,27 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(16, 16, 5, 4, &vpx_avg_4x4_sse2),
make_tuple(32, 32, 15, 4, &vpx_avg_4x4_sse2)));
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSE2, IntProRowTest,
::testing::Values(make_tuple(16, &vpx_int_pro_row_sse2, &vpx_int_pro_row_c),
make_tuple(32, &vpx_int_pro_row_sse2, &vpx_int_pro_row_c),
make_tuple(64, &vpx_int_pro_row_sse2,
&vpx_int_pro_row_c)));
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSE2, IntProColTest,
::testing::Values(make_tuple(16, &vpx_int_pro_col_sse2, &vpx_int_pro_col_c),
make_tuple(32, &vpx_int_pro_col_sse2, &vpx_int_pro_col_c),
make_tuple(64, &vpx_int_pro_col_sse2,
&vpx_int_pro_col_c)));
INSTANTIATE_TEST_CASE_P(SSE2, SatdLowbdTest,
::testing::Values(make_tuple(16, &vpx_satd_sse2),
make_tuple(64, &vpx_satd_sse2),
make_tuple(256, &vpx_satd_sse2),
make_tuple(1024, &vpx_satd_sse2)));
INSTANTIATE_TEST_SUITE_P(SSE2, SatdLowbdTest,
::testing::Values(make_tuple(16, &vpx_satd_sse2),
make_tuple(64, &vpx_satd_sse2),
make_tuple(256, &vpx_satd_sse2),
make_tuple(1024, &vpx_satd_sse2)));
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSE2, BlockErrorTestFP,
::testing::Values(make_tuple(16, &vp9_block_error_fp_sse2),
make_tuple(64, &vp9_block_error_fp_sse2),
@ -634,14 +641,14 @@ INSTANTIATE_TEST_CASE_P(
#endif // HAVE_SSE2
#if HAVE_AVX2
INSTANTIATE_TEST_CASE_P(AVX2, SatdLowbdTest,
::testing::Values(make_tuple(16, &vpx_satd_avx2),
make_tuple(64, &vpx_satd_avx2),
make_tuple(256, &vpx_satd_avx2),
make_tuple(1024, &vpx_satd_avx2)));
INSTANTIATE_TEST_SUITE_P(AVX2, SatdLowbdTest,
::testing::Values(make_tuple(16, &vpx_satd_avx2),
make_tuple(64, &vpx_satd_avx2),
make_tuple(256, &vpx_satd_avx2),
make_tuple(1024, &vpx_satd_avx2)));
#if CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
AVX2, SatdHighbdTest,
::testing::Values(make_tuple(16, &vpx_highbd_satd_avx2),
make_tuple(64, &vpx_highbd_satd_avx2),
@ -649,7 +656,7 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(1024, &vpx_highbd_satd_avx2)));
#endif // CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
AVX2, BlockErrorTestFP,
::testing::Values(make_tuple(16, &vp9_block_error_fp_avx2),
make_tuple(64, &vp9_block_error_fp_avx2),
@ -658,7 +665,7 @@ INSTANTIATE_TEST_CASE_P(
#endif
#if HAVE_NEON
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
NEON, AverageTest,
::testing::Values(make_tuple(16, 16, 0, 8, &vpx_avg_8x8_neon),
make_tuple(16, 16, 5, 8, &vpx_avg_8x8_neon),
@ -667,30 +674,30 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(16, 16, 5, 4, &vpx_avg_4x4_neon),
make_tuple(32, 32, 15, 4, &vpx_avg_4x4_neon)));
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
NEON, IntProRowTest,
::testing::Values(make_tuple(16, &vpx_int_pro_row_neon, &vpx_int_pro_row_c),
make_tuple(32, &vpx_int_pro_row_neon, &vpx_int_pro_row_c),
make_tuple(64, &vpx_int_pro_row_neon,
&vpx_int_pro_row_c)));
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
NEON, IntProColTest,
::testing::Values(make_tuple(16, &vpx_int_pro_col_neon, &vpx_int_pro_col_c),
make_tuple(32, &vpx_int_pro_col_neon, &vpx_int_pro_col_c),
make_tuple(64, &vpx_int_pro_col_neon,
&vpx_int_pro_col_c)));
INSTANTIATE_TEST_CASE_P(NEON, SatdLowbdTest,
::testing::Values(make_tuple(16, &vpx_satd_neon),
make_tuple(64, &vpx_satd_neon),
make_tuple(256, &vpx_satd_neon),
make_tuple(1024, &vpx_satd_neon)));
INSTANTIATE_TEST_SUITE_P(NEON, SatdLowbdTest,
::testing::Values(make_tuple(16, &vpx_satd_neon),
make_tuple(64, &vpx_satd_neon),
make_tuple(256, &vpx_satd_neon),
make_tuple(1024, &vpx_satd_neon)));
// TODO(jianj): Remove the highbitdepth flag once the SIMD functions are
// in place.
#if !CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
NEON, BlockErrorTestFP,
::testing::Values(make_tuple(16, &vp9_block_error_fp_neon),
make_tuple(64, &vp9_block_error_fp_neon),
@ -700,7 +707,7 @@ INSTANTIATE_TEST_CASE_P(
#endif // HAVE_NEON
#if HAVE_MSA
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
MSA, AverageTest,
::testing::Values(make_tuple(16, 16, 0, 8, &vpx_avg_8x8_msa),
make_tuple(16, 16, 5, 8, &vpx_avg_8x8_msa),
@ -709,14 +716,14 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(16, 16, 5, 4, &vpx_avg_4x4_msa),
make_tuple(32, 32, 15, 4, &vpx_avg_4x4_msa)));
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
MSA, IntProRowTest,
::testing::Values(make_tuple(16, &vpx_int_pro_row_msa, &vpx_int_pro_row_c),
make_tuple(32, &vpx_int_pro_row_msa, &vpx_int_pro_row_c),
make_tuple(64, &vpx_int_pro_row_msa,
&vpx_int_pro_row_c)));
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
MSA, IntProColTest,
::testing::Values(make_tuple(16, &vpx_int_pro_col_msa, &vpx_int_pro_col_c),
make_tuple(32, &vpx_int_pro_col_msa, &vpx_int_pro_col_c),
@ -726,11 +733,11 @@ INSTANTIATE_TEST_CASE_P(
// TODO(jingning): Remove the highbitdepth flag once the SIMD functions are
// in place.
#if !CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P(MSA, SatdLowbdTest,
::testing::Values(make_tuple(16, &vpx_satd_msa),
make_tuple(64, &vpx_satd_msa),
make_tuple(256, &vpx_satd_msa),
make_tuple(1024, &vpx_satd_msa)));
INSTANTIATE_TEST_SUITE_P(MSA, SatdLowbdTest,
::testing::Values(make_tuple(16, &vpx_satd_msa),
make_tuple(64, &vpx_satd_msa),
make_tuple(256, &vpx_satd_msa),
make_tuple(1024, &vpx_satd_msa)));
#endif // !CONFIG_VP9_HIGHBITDEPTH
#endif // HAVE_MSA

Просмотреть файл

@ -35,18 +35,18 @@ class BlockinessTestBase : public ::testing::Test {
public:
BlockinessTestBase(int width, int height) : width_(width), height_(height) {}
static void SetUpTestCase() {
static void SetUpTestSuite() {
source_data_ = reinterpret_cast<uint8_t *>(
vpx_memalign(kDataAlignment, kDataBufferSize));
reference_data_ = reinterpret_cast<uint8_t *>(
vpx_memalign(kDataAlignment, kDataBufferSize));
}
static void TearDownTestCase() {
static void TearDownTestSuite() {
vpx_free(source_data_);
source_data_ = NULL;
source_data_ = nullptr;
vpx_free(reference_data_);
reference_data_ = NULL;
reference_data_ = nullptr;
}
virtual void TearDown() { libvpx_test::ClearSystemState(); }
@ -154,8 +154,8 @@ class BlockinessVP9Test
};
#endif // CONFIG_VP9_ENCODER
uint8_t *BlockinessTestBase::source_data_ = NULL;
uint8_t *BlockinessTestBase::reference_data_ = NULL;
uint8_t *BlockinessTestBase::source_data_ = nullptr;
uint8_t *BlockinessTestBase::reference_data_ = nullptr;
#if CONFIG_VP9_ENCODER
TEST_P(BlockinessVP9Test, SourceBlockierThanReference) {
@ -215,7 +215,8 @@ using std::make_tuple;
const BlockinessParam c_vp9_tests[] = { make_tuple(320, 240),
make_tuple(318, 242),
make_tuple(318, 238) };
INSTANTIATE_TEST_CASE_P(C, BlockinessVP9Test, ::testing::ValuesIn(c_vp9_tests));
INSTANTIATE_TEST_SUITE_P(C, BlockinessVP9Test,
::testing::ValuesIn(c_vp9_tests));
#endif
} // namespace

Просмотреть файл

@ -79,6 +79,6 @@ TEST_P(BordersTest, TestLowBitrate) {
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
}
VP9_INSTANTIATE_TEST_CASE(BordersTest,
::testing::Values(::libvpx_test::kTwoPassGood));
VP9_INSTANTIATE_TEST_SUITE(BordersTest,
::testing::Values(::libvpx_test::kTwoPassGood));
} // namespace

Просмотреть файл

@ -55,23 +55,24 @@ const ByteAlignmentTestParam kBaTestParams[] = {
class ByteAlignmentTest
: public ::testing::TestWithParam<ByteAlignmentTestParam> {
protected:
ByteAlignmentTest() : video_(NULL), decoder_(NULL), md5_file_(NULL) {}
ByteAlignmentTest()
: video_(nullptr), decoder_(nullptr), md5_file_(nullptr) {}
virtual void SetUp() {
video_ = new libvpx_test::WebMVideoSource(kVP9TestFile);
ASSERT_TRUE(video_ != NULL);
ASSERT_NE(video_, nullptr);
video_->Init();
video_->Begin();
const vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
decoder_ = new libvpx_test::VP9Decoder(cfg, 0);
ASSERT_TRUE(decoder_ != NULL);
ASSERT_NE(decoder_, nullptr);
OpenMd5File(kVP9Md5File);
}
virtual void TearDown() {
if (md5_file_ != NULL) fclose(md5_file_);
if (md5_file_ != nullptr) fclose(md5_file_);
delete decoder_;
delete video_;
@ -90,7 +91,7 @@ class ByteAlignmentTest
}
vpx_codec_err_t DecodeRemainingFrames(int byte_alignment_to_check) {
for (; video_->cxdata() != NULL; video_->Next()) {
for (; video_->cxdata() != nullptr; video_->Next()) {
const vpx_codec_err_t res =
decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
if (res != VPX_CODEC_OK) return res;
@ -113,7 +114,7 @@ class ByteAlignmentTest
const vpx_image_t *img;
// Get decompressed data
while ((img = dec_iter.Next()) != NULL) {
while ((img = dec_iter.Next()) != nullptr) {
if (byte_alignment_to_check == kLegacyByteAlignment) {
CheckByteAlignment(img->planes[0], kLegacyYPlaneByteAlignment);
} else {
@ -128,12 +129,12 @@ class ByteAlignmentTest
// TODO(fgalligan): Move the MD5 testing code into another class.
void OpenMd5File(const std::string &md5_file_name_) {
md5_file_ = libvpx_test::OpenTestDataFile(md5_file_name_);
ASSERT_TRUE(md5_file_ != NULL)
ASSERT_NE(md5_file_, nullptr)
<< "MD5 file open failed. Filename: " << md5_file_name_;
}
void CheckMd5(const vpx_image_t &img) {
ASSERT_TRUE(md5_file_ != NULL);
ASSERT_NE(md5_file_, nullptr);
char expected_md5[33];
char junk[128];
@ -176,8 +177,8 @@ TEST_P(ByteAlignmentTest, TestAlignment) {
}
}
INSTANTIATE_TEST_CASE_P(Alignments, ByteAlignmentTest,
::testing::ValuesIn(kBaTestParams));
INSTANTIATE_TEST_SUITE_P(Alignments, ByteAlignmentTest,
::testing::ValuesIn(kBaTestParams));
#endif // CONFIG_WEBM_IO

Просмотреть файл

@ -157,15 +157,15 @@ class VP8CodecFactory : public CodecFactory {
const libvpx_test::VP8CodecFactory kVP8;
#define VP8_INSTANTIATE_TEST_CASE(test, ...) \
INSTANTIATE_TEST_CASE_P( \
#define VP8_INSTANTIATE_TEST_SUITE(test, ...) \
INSTANTIATE_TEST_SUITE_P( \
VP8, test, \
::testing::Combine( \
::testing::Values(static_cast<const libvpx_test::CodecFactory *>( \
&libvpx_test::kVP8)), \
__VA_ARGS__))
#else
#define VP8_INSTANTIATE_TEST_CASE(test, ...)
#define VP8_INSTANTIATE_TEST_SUITE(test, ...)
#endif // CONFIG_VP8
/*
@ -253,15 +253,15 @@ class VP9CodecFactory : public CodecFactory {
const libvpx_test::VP9CodecFactory kVP9;
#define VP9_INSTANTIATE_TEST_CASE(test, ...) \
INSTANTIATE_TEST_CASE_P( \
#define VP9_INSTANTIATE_TEST_SUITE(test, ...) \
INSTANTIATE_TEST_SUITE_P( \
VP9, test, \
::testing::Combine( \
::testing::Values(static_cast<const libvpx_test::CodecFactory *>( \
&libvpx_test::kVP9)), \
__VA_ARGS__))
#else
#define VP9_INSTANTIATE_TEST_CASE(test, ...)
#define VP9_INSTANTIATE_TEST_SUITE(test, ...)
#endif // CONFIG_VP9
} // namespace libvpx_test

Просмотреть файл

@ -29,9 +29,9 @@ uint8_t avg_with_rounding(uint8_t a, uint8_t b) { return (a + b + 1) >> 1; }
void reference_pred(const Buffer<uint8_t> &pred, const Buffer<uint8_t> &ref,
int width, int height, Buffer<uint8_t> *avg) {
ASSERT_TRUE(avg->TopLeftPixel() != NULL);
ASSERT_TRUE(pred.TopLeftPixel() != NULL);
ASSERT_TRUE(ref.TopLeftPixel() != NULL);
ASSERT_NE(avg->TopLeftPixel(), nullptr);
ASSERT_NE(pred.TopLeftPixel(), nullptr);
ASSERT_NE(ref.TopLeftPixel(), nullptr);
for (int y = 0; y < height; ++y) {
for (int x = 0; x < width; ++x) {
@ -166,21 +166,21 @@ TEST_P(AvgPredTest, DISABLED_Speed) {
}
}
INSTANTIATE_TEST_CASE_P(C, AvgPredTest,
::testing::Values(&vpx_comp_avg_pred_c));
INSTANTIATE_TEST_SUITE_P(C, AvgPredTest,
::testing::Values(&vpx_comp_avg_pred_c));
#if HAVE_SSE2
INSTANTIATE_TEST_CASE_P(SSE2, AvgPredTest,
::testing::Values(&vpx_comp_avg_pred_sse2));
INSTANTIATE_TEST_SUITE_P(SSE2, AvgPredTest,
::testing::Values(&vpx_comp_avg_pred_sse2));
#endif // HAVE_SSE2
#if HAVE_NEON
INSTANTIATE_TEST_CASE_P(NEON, AvgPredTest,
::testing::Values(&vpx_comp_avg_pred_neon));
INSTANTIATE_TEST_SUITE_P(NEON, AvgPredTest,
::testing::Values(&vpx_comp_avg_pred_neon));
#endif // HAVE_NEON
#if HAVE_VSX
INSTANTIATE_TEST_CASE_P(VSX, AvgPredTest,
::testing::Values(&vpx_comp_avg_pred_vsx));
INSTANTIATE_TEST_SUITE_P(VSX, AvgPredTest,
::testing::Values(&vpx_comp_avg_pred_vsx));
#endif // HAVE_VSX
} // namespace

Просмотреть файл

@ -58,5 +58,5 @@ TEST_P(ConfigTest, LagIsDisabled) {
EXPECT_EQ(frame_count_in_, frame_count_out_);
}
VP8_INSTANTIATE_TEST_CASE(ConfigTest, ONE_PASS_TEST_MODES);
VP8_INSTANTIATE_TEST_SUITE(ConfigTest, ONE_PASS_TEST_MODES);
} // namespace

Просмотреть файл

@ -39,7 +39,7 @@ class ConsistencyTestBase : public ::testing::Test {
public:
ConsistencyTestBase(int width, int height) : width_(width), height_(height) {}
static void SetUpTestCase() {
static void SetUpTestSuite() {
source_data_[0] = reinterpret_cast<uint8_t *>(
vpx_memalign(kDataAlignment, kDataBufferSize));
reference_data_[0] = reinterpret_cast<uint8_t *>(
@ -52,15 +52,15 @@ class ConsistencyTestBase : public ::testing::Test {
}
static void ClearSsim() { memset(ssim_array_, 0, kDataBufferSize / 16); }
static void TearDownTestCase() {
static void TearDownTestSuite() {
vpx_free(source_data_[0]);
source_data_[0] = NULL;
source_data_[0] = nullptr;
vpx_free(reference_data_[0]);
reference_data_[0] = NULL;
reference_data_[0] = nullptr;
vpx_free(source_data_[1]);
source_data_[1] = NULL;
source_data_[1] = nullptr;
vpx_free(reference_data_[1]);
reference_data_[1] = NULL;
reference_data_[1] = nullptr;
delete[] ssim_array_;
}
@ -145,9 +145,9 @@ class ConsistencyVP9Test
};
#endif // CONFIG_VP9_ENCODER
uint8_t *ConsistencyTestBase::source_data_[2] = { NULL, NULL };
uint8_t *ConsistencyTestBase::reference_data_[2] = { NULL, NULL };
Ssimv *ConsistencyTestBase::ssim_array_ = NULL;
uint8_t *ConsistencyTestBase::source_data_[2] = { nullptr, nullptr };
uint8_t *ConsistencyTestBase::reference_data_[2] = { nullptr, nullptr };
Ssimv *ConsistencyTestBase::ssim_array_ = nullptr;
#if CONFIG_VP9_ENCODER
TEST_P(ConsistencyVP9Test, ConsistencyIsZero) {
@ -208,8 +208,8 @@ using std::make_tuple;
const ConsistencyParam c_vp9_tests[] = { make_tuple(320, 240),
make_tuple(318, 242),
make_tuple(318, 238) };
INSTANTIATE_TEST_CASE_P(C, ConsistencyVP9Test,
::testing::ValuesIn(c_vp9_tests));
INSTANTIATE_TEST_SUITE_P(C, ConsistencyVP9Test,
::testing::ValuesIn(c_vp9_tests));
#endif
} // namespace

Просмотреть файл

@ -341,7 +341,7 @@ void wrapper_filter_block2d_8_c(const uint8_t *src_ptr,
class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
public:
static void SetUpTestCase() {
static void SetUpTestSuite() {
// Force input_ to be unaligned, output to be 16 byte aligned.
input_ = reinterpret_cast<uint8_t *>(
vpx_memalign(kDataAlignment, kInputBufferSize + 1)) +
@ -363,20 +363,20 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
virtual void TearDown() { libvpx_test::ClearSystemState(); }
static void TearDownTestCase() {
static void TearDownTestSuite() {
vpx_free(input_ - 1);
input_ = NULL;
input_ = nullptr;
vpx_free(output_);
output_ = NULL;
output_ = nullptr;
vpx_free(output_ref_);
output_ref_ = NULL;
output_ref_ = nullptr;
#if CONFIG_VP9_HIGHBITDEPTH
vpx_free(input16_ - 1);
input16_ = NULL;
input16_ = nullptr;
vpx_free(output16_);
output16_ = NULL;
output16_ = nullptr;
vpx_free(output16_ref_);
output16_ref_ = NULL;
output16_ref_ = nullptr;
#endif
}
@ -541,13 +541,13 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
#endif
};
uint8_t *ConvolveTest::input_ = NULL;
uint8_t *ConvolveTest::output_ = NULL;
uint8_t *ConvolveTest::output_ref_ = NULL;
uint8_t *ConvolveTest::input_ = nullptr;
uint8_t *ConvolveTest::output_ = nullptr;
uint8_t *ConvolveTest::output_ref_ = nullptr;
#if CONFIG_VP9_HIGHBITDEPTH
uint16_t *ConvolveTest::input16_ = NULL;
uint16_t *ConvolveTest::output16_ = NULL;
uint16_t *ConvolveTest::output16_ref_ = NULL;
uint16_t *ConvolveTest::input16_ = nullptr;
uint16_t *ConvolveTest::output16_ = nullptr;
uint16_t *ConvolveTest::output16_ref_ = nullptr;
#endif
TEST_P(ConvolveTest, GuardBlocks) { CheckGuardBlocks(); }
@ -562,7 +562,7 @@ TEST_P(ConvolveTest, DISABLED_Copy_Speed) {
vpx_usec_timer_start(&timer);
for (int n = 0; n < kNumTests; ++n) {
UUT_->copy_[0](in, kInputStride, out, kOutputStride, NULL, 0, 0, 0, 0,
UUT_->copy_[0](in, kInputStride, out, kOutputStride, nullptr, 0, 0, 0, 0,
width, height);
}
vpx_usec_timer_mark(&timer);
@ -582,7 +582,7 @@ TEST_P(ConvolveTest, DISABLED_Avg_Speed) {
vpx_usec_timer_start(&timer);
for (int n = 0; n < kNumTests; ++n) {
UUT_->copy_[1](in, kInputStride, out, kOutputStride, NULL, 0, 0, 0, 0,
UUT_->copy_[1](in, kInputStride, out, kOutputStride, nullptr, 0, 0, 0, 0,
width, height);
}
vpx_usec_timer_mark(&timer);
@ -780,7 +780,8 @@ TEST_P(ConvolveTest, Copy) {
uint8_t *const out = output();
ASM_REGISTER_STATE_CHECK(UUT_->copy_[0](in, kInputStride, out, kOutputStride,
NULL, 0, 0, 0, 0, Width(), Height()));
nullptr, 0, 0, 0, 0, Width(),
Height()));
CheckGuardBlocks();
@ -799,7 +800,8 @@ TEST_P(ConvolveTest, Avg) {
CopyOutputToRef();
ASM_REGISTER_STATE_CHECK(UUT_->copy_[1](in, kInputStride, out, kOutputStride,
NULL, 0, 0, 0, 0, Width(), Height()));
nullptr, 0, 0, 0, 0, Width(),
Height()));
CheckGuardBlocks();
@ -955,9 +957,9 @@ TEST_P(ConvolveTest, MatchesReferenceSubpixelFilter) {
UUT_->h8_[i](in, kInputStride, out, kOutputStride, filters,
filter_x, 16, 0, 16, Width(), Height()));
else
ASM_REGISTER_STATE_CHECK(UUT_->copy_[i](in, kInputStride, out,
kOutputStride, NULL, 0, 0,
0, 0, Width(), Height()));
ASM_REGISTER_STATE_CHECK(
UUT_->copy_[i](in, kInputStride, out, kOutputStride, nullptr, 0,
0, 0, 0, Width(), Height()));
CheckGuardBlocks();
@ -1053,9 +1055,9 @@ TEST_P(ConvolveTest, FilterExtremes) {
UUT_->h8_[0](in, kInputStride, out, kOutputStride, filters,
filter_x, 16, 0, 16, Width(), Height()));
else
ASM_REGISTER_STATE_CHECK(UUT_->copy_[0](in, kInputStride, out,
kOutputStride, NULL, 0, 0,
0, 0, Width(), Height()));
ASM_REGISTER_STATE_CHECK(
UUT_->copy_[0](in, kInputStride, out, kOutputStride, nullptr,
0, 0, 0, 0, Width(), Height()));
for (int y = 0; y < Height(); ++y) {
for (int x = 0; x < Width(); ++x)
@ -1276,7 +1278,8 @@ const ConvolveFunctions convolve8_c(
vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
const ConvolveParam kArrayConvolve_c[] = { ALL_SIZES(convolve8_c) };
#endif
INSTANTIATE_TEST_CASE_P(C, ConvolveTest, ::testing::ValuesIn(kArrayConvolve_c));
INSTANTIATE_TEST_SUITE_P(C, ConvolveTest,
::testing::ValuesIn(kArrayConvolve_c));
#if HAVE_SSE2 && VPX_ARCH_X86_64
#if CONFIG_VP9_HIGHBITDEPTH
@ -1317,8 +1320,8 @@ const ConvolveFunctions convolve8_sse2(
const ConvolveParam kArrayConvolve_sse2[] = { ALL_SIZES(convolve8_sse2) };
#endif // CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P(SSE2, ConvolveTest,
::testing::ValuesIn(kArrayConvolve_sse2));
INSTANTIATE_TEST_SUITE_P(SSE2, ConvolveTest,
::testing::ValuesIn(kArrayConvolve_sse2));
#endif
#if HAVE_SSSE3
@ -1330,8 +1333,8 @@ const ConvolveFunctions convolve8_ssse3(
vpx_scaled_avg_vert_c, vpx_scaled_2d_ssse3, vpx_scaled_avg_2d_c, 0);
const ConvolveParam kArrayConvolve8_ssse3[] = { ALL_SIZES(convolve8_ssse3) };
INSTANTIATE_TEST_CASE_P(SSSE3, ConvolveTest,
::testing::ValuesIn(kArrayConvolve8_ssse3));
INSTANTIATE_TEST_SUITE_P(SSSE3, ConvolveTest,
::testing::ValuesIn(kArrayConvolve8_ssse3));
#endif
#if HAVE_AVX2
@ -1362,8 +1365,8 @@ const ConvolveFunctions convolve12_avx2(
const ConvolveParam kArrayConvolve8_avx2[] = { ALL_SIZES(convolve8_avx2),
ALL_SIZES(convolve10_avx2),
ALL_SIZES(convolve12_avx2) };
INSTANTIATE_TEST_CASE_P(AVX2, ConvolveTest,
::testing::ValuesIn(kArrayConvolve8_avx2));
INSTANTIATE_TEST_SUITE_P(AVX2, ConvolveTest,
::testing::ValuesIn(kArrayConvolve8_avx2));
#else // !CONFIG_VP9_HIGHBITDEPTH
const ConvolveFunctions convolve8_avx2(
vpx_convolve_copy_c, vpx_convolve_avg_c, vpx_convolve8_horiz_avx2,
@ -1372,8 +1375,8 @@ const ConvolveFunctions convolve8_avx2(
vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c, vpx_scaled_vert_c,
vpx_scaled_avg_vert_c, vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
const ConvolveParam kArrayConvolve8_avx2[] = { ALL_SIZES(convolve8_avx2) };
INSTANTIATE_TEST_CASE_P(AVX2, ConvolveTest,
::testing::ValuesIn(kArrayConvolve8_avx2));
INSTANTIATE_TEST_SUITE_P(AVX2, ConvolveTest,
::testing::ValuesIn(kArrayConvolve8_avx2));
#endif // CONFIG_VP9_HIGHBITDEPTH
#endif // HAVE_AVX2
@ -1416,8 +1419,8 @@ const ConvolveFunctions convolve8_neon(
const ConvolveParam kArrayConvolve_neon[] = { ALL_SIZES(convolve8_neon) };
#endif // CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P(NEON, ConvolveTest,
::testing::ValuesIn(kArrayConvolve_neon));
INSTANTIATE_TEST_SUITE_P(NEON, ConvolveTest,
::testing::ValuesIn(kArrayConvolve_neon));
#endif // HAVE_NEON
#if HAVE_DSPR2
@ -1429,8 +1432,8 @@ const ConvolveFunctions convolve8_dspr2(
vpx_scaled_avg_vert_c, vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
const ConvolveParam kArrayConvolve8_dspr2[] = { ALL_SIZES(convolve8_dspr2) };
INSTANTIATE_TEST_CASE_P(DSPR2, ConvolveTest,
::testing::ValuesIn(kArrayConvolve8_dspr2));
INSTANTIATE_TEST_SUITE_P(DSPR2, ConvolveTest,
::testing::ValuesIn(kArrayConvolve8_dspr2));
#endif // HAVE_DSPR2
#if HAVE_MSA
@ -1442,8 +1445,8 @@ const ConvolveFunctions convolve8_msa(
vpx_scaled_avg_vert_c, vpx_scaled_2d_msa, vpx_scaled_avg_2d_c, 0);
const ConvolveParam kArrayConvolve8_msa[] = { ALL_SIZES(convolve8_msa) };
INSTANTIATE_TEST_CASE_P(MSA, ConvolveTest,
::testing::ValuesIn(kArrayConvolve8_msa));
INSTANTIATE_TEST_SUITE_P(MSA, ConvolveTest,
::testing::ValuesIn(kArrayConvolve8_msa));
#endif // HAVE_MSA
#if HAVE_VSX
@ -1454,8 +1457,8 @@ const ConvolveFunctions convolve8_vsx(
vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c, vpx_scaled_vert_c,
vpx_scaled_avg_vert_c, vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
const ConvolveParam kArrayConvolve_vsx[] = { ALL_SIZES(convolve8_vsx) };
INSTANTIATE_TEST_CASE_P(VSX, ConvolveTest,
::testing::ValuesIn(kArrayConvolve_vsx));
INSTANTIATE_TEST_SUITE_P(VSX, ConvolveTest,
::testing::ValuesIn(kArrayConvolve_vsx));
#endif // HAVE_VSX
#if HAVE_MMI
@ -1466,7 +1469,7 @@ const ConvolveFunctions convolve8_mmi(
vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c, vpx_scaled_vert_c,
vpx_scaled_avg_vert_c, vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
const ConvolveParam kArrayConvolve_mmi[] = { ALL_SIZES(convolve8_mmi) };
INSTANTIATE_TEST_CASE_P(MMI, ConvolveTest,
::testing::ValuesIn(kArrayConvolve_mmi));
INSTANTIATE_TEST_SUITE_P(MMI, ConvolveTest,
::testing::ValuesIn(kArrayConvolve_mmi));
#endif // HAVE_MMI
} // namespace

Просмотреть файл

@ -148,9 +148,9 @@ TEST_P(CpuSpeedTest, TestLowBitrate) {
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
}
VP9_INSTANTIATE_TEST_CASE(CpuSpeedTest,
::testing::Values(::libvpx_test::kTwoPassGood,
::libvpx_test::kOnePassGood,
::libvpx_test::kRealTime),
::testing::Range(0, 10));
VP9_INSTANTIATE_TEST_SUITE(CpuSpeedTest,
::testing::Values(::libvpx_test::kTwoPassGood,
::libvpx_test::kOnePassGood,
::libvpx_test::kRealTime),
::testing::Range(0, 10));
} // namespace

Просмотреть файл

@ -29,9 +29,9 @@ class CQTest : public ::libvpx_test::EncoderTest,
// maps the cqlevel to the bitrate produced.
typedef std::map<int, uint32_t> BitrateMap;
static void SetUpTestCase() { bitrates_.clear(); }
static void SetUpTestSuite() { bitrates_.clear(); }
static void TearDownTestCase() {
static void TearDownTestSuite() {
ASSERT_TRUE(!HasFailure())
<< "skipping bitrate validation due to earlier failure.";
uint32_t prev_actual_bitrate = kCQTargetBitrate;
@ -126,6 +126,6 @@ TEST_P(CQTest, LinearPSNRIsHigherForCQLevel) {
EXPECT_GE(cq_psnr_lin, vbr_psnr_lin);
}
VP8_INSTANTIATE_TEST_CASE(CQTest, ::testing::Range(kCQLevelMin, kCQLevelMax,
kCQLevelStep));
VP8_INSTANTIATE_TEST_SUITE(CQTest, ::testing::Range(kCQLevelMin, kCQLevelMax,
kCQLevelStep));
} // namespace

Просмотреть файл

@ -38,7 +38,7 @@ vpx_set_ref() {
eval "${VPX_TEST_PREFIX}" "${encoder}" "${YUV_RAW_INPUT_WIDTH}" \
"${YUV_RAW_INPUT_HEIGHT}" "${YUV_RAW_INPUT}" "${output_file}" \
"${ref_frame_num}" ${devnull}
"${ref_frame_num}" ${devnull} || return 1
[ -e "${output_file}" ] || return 1
}

Просмотреть файл

@ -714,6 +714,7 @@ TEST_P(Trans16x16HT, QuantCheck) {
RunQuantCheck(429, 729);
}
#if HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
class InvTrans16x16DCT : public Trans16x16TestBase,
public ::testing::TestWithParam<Idct16x16Param> {
public:
@ -739,29 +740,31 @@ class InvTrans16x16DCT : public Trans16x16TestBase,
IdctFunc inv_txfm_;
int thresh_;
};
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(InvTrans16x16DCT);
TEST_P(InvTrans16x16DCT, CompareReference) {
CompareInvReference(ref_txfm_, thresh_);
}
#endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
using std::make_tuple;
#if CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
C, Trans16x16DCT,
::testing::Values(
make_tuple(&vpx_highbd_fdct16x16_c, &idct16x16_10, 0, VPX_BITS_10),
make_tuple(&vpx_highbd_fdct16x16_c, &idct16x16_12, 0, VPX_BITS_12),
make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c, 0, VPX_BITS_8)));
#else
INSTANTIATE_TEST_CASE_P(C, Trans16x16DCT,
::testing::Values(make_tuple(&vpx_fdct16x16_c,
&vpx_idct16x16_256_add_c,
0, VPX_BITS_8)));
INSTANTIATE_TEST_SUITE_P(C, Trans16x16DCT,
::testing::Values(make_tuple(&vpx_fdct16x16_c,
&vpx_idct16x16_256_add_c,
0, VPX_BITS_8)));
#endif // CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
C, Trans16x16HT,
::testing::Values(
make_tuple(&vp9_highbd_fht16x16_c, &iht16x16_10, 0, VPX_BITS_10),
@ -777,7 +780,7 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 2, VPX_BITS_8),
make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 3, VPX_BITS_8)));
#else
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
C, Trans16x16HT,
::testing::Values(
make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 0, VPX_BITS_8),
@ -787,18 +790,18 @@ INSTANTIATE_TEST_CASE_P(
#endif // CONFIG_VP9_HIGHBITDEPTH
#if HAVE_NEON && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
NEON, Trans16x16DCT,
::testing::Values(make_tuple(&vpx_fdct16x16_neon,
&vpx_idct16x16_256_add_neon, 0, VPX_BITS_8)));
#endif // HAVE_NEON && !CONFIG_EMULATE_HARDWARE
#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSE2, Trans16x16DCT,
::testing::Values(make_tuple(&vpx_fdct16x16_sse2,
&vpx_idct16x16_256_add_sse2, 0, VPX_BITS_8)));
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSE2, Trans16x16HT,
::testing::Values(make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2,
0, VPX_BITS_8),
@ -811,7 +814,7 @@ INSTANTIATE_TEST_CASE_P(
#endif // HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
#if HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSE2, Trans16x16DCT,
::testing::Values(
make_tuple(&vpx_highbd_fdct16x16_sse2, &idct16x16_10, 0, VPX_BITS_10),
@ -822,7 +825,7 @@ INSTANTIATE_TEST_CASE_P(
VPX_BITS_12),
make_tuple(&vpx_fdct16x16_sse2, &vpx_idct16x16_256_add_c, 0,
VPX_BITS_8)));
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSE2, Trans16x16HT,
::testing::Values(
make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_c, 0, VPX_BITS_8),
@ -832,7 +835,7 @@ INSTANTIATE_TEST_CASE_P(
VPX_BITS_8)));
// Optimizations take effect at a threshold of 3155, so we use a value close to
// that to test both branches.
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSE2, InvTrans16x16DCT,
::testing::Values(make_tuple(&idct16x16_10_add_10_c,
&idct16x16_10_add_10_sse2, 3167, VPX_BITS_10),
@ -845,11 +848,11 @@ INSTANTIATE_TEST_CASE_P(
#endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P(MSA, Trans16x16DCT,
::testing::Values(make_tuple(&vpx_fdct16x16_msa,
&vpx_idct16x16_256_add_msa,
0, VPX_BITS_8)));
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
MSA, Trans16x16DCT,
::testing::Values(make_tuple(&vpx_fdct16x16_msa, &vpx_idct16x16_256_add_msa,
0, VPX_BITS_8)));
INSTANTIATE_TEST_SUITE_P(
MSA, Trans16x16HT,
::testing::Values(
make_tuple(&vp9_fht16x16_msa, &vp9_iht16x16_256_add_msa, 0, VPX_BITS_8),
@ -860,9 +863,9 @@ INSTANTIATE_TEST_CASE_P(
#endif // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
#if HAVE_VSX && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P(VSX, Trans16x16DCT,
::testing::Values(make_tuple(&vpx_fdct16x16_c,
&vpx_idct16x16_256_add_vsx,
0, VPX_BITS_8)));
INSTANTIATE_TEST_SUITE_P(
VSX, Trans16x16DCT,
::testing::Values(make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_vsx,
0, VPX_BITS_8)));
#endif // HAVE_VSX && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
} // namespace

Просмотреть файл

@ -317,7 +317,7 @@ TEST_P(Trans32x32Test, InverseAccuracy) {
using std::make_tuple;
#if CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
C, Trans32x32Test,
::testing::Values(
make_tuple(&vpx_highbd_fdct32x32_c, &idct32x32_10, 0, VPX_BITS_10),
@ -328,7 +328,7 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(&vpx_fdct32x32_rd_c, &vpx_idct32x32_1024_add_c, 1,
VPX_BITS_8)));
#else
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
C, Trans32x32Test,
::testing::Values(make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_c, 0,
VPX_BITS_8),
@ -337,7 +337,7 @@ INSTANTIATE_TEST_CASE_P(
#endif // CONFIG_VP9_HIGHBITDEPTH
#if HAVE_NEON && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
NEON, Trans32x32Test,
::testing::Values(make_tuple(&vpx_fdct32x32_neon,
&vpx_idct32x32_1024_add_neon, 0, VPX_BITS_8),
@ -346,7 +346,7 @@ INSTANTIATE_TEST_CASE_P(
#endif // HAVE_NEON && !CONFIG_EMULATE_HARDWARE
#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSE2, Trans32x32Test,
::testing::Values(make_tuple(&vpx_fdct32x32_sse2,
&vpx_idct32x32_1024_add_sse2, 0, VPX_BITS_8),
@ -355,7 +355,7 @@ INSTANTIATE_TEST_CASE_P(
#endif // HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
#if HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSE2, Trans32x32Test,
::testing::Values(
make_tuple(&vpx_highbd_fdct32x32_sse2, &idct32x32_10, 0, VPX_BITS_10),
@ -371,7 +371,7 @@ INSTANTIATE_TEST_CASE_P(
#endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
#if HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
AVX2, Trans32x32Test,
::testing::Values(make_tuple(&vpx_fdct32x32_avx2,
&vpx_idct32x32_1024_add_sse2, 0, VPX_BITS_8),
@ -380,7 +380,7 @@ INSTANTIATE_TEST_CASE_P(
#endif // HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
MSA, Trans32x32Test,
::testing::Values(make_tuple(&vpx_fdct32x32_msa,
&vpx_idct32x32_1024_add_msa, 0, VPX_BITS_8),
@ -389,7 +389,7 @@ INSTANTIATE_TEST_CASE_P(
#endif // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
#if HAVE_VSX && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
VSX, Trans32x32Test,
::testing::Values(make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_vsx,
0, VPX_BITS_8),

Просмотреть файл

@ -39,7 +39,7 @@ typedef tuple<PartialFdctFunc, int /* size */, vpx_bit_depth_t>
tran_low_t partial_fdct_ref(const Buffer<int16_t> &in, int size) {
int64_t sum = 0;
if (in.TopLeftPixel() != NULL) {
if (in.TopLeftPixel() != nullptr) {
for (int y = 0; y < size; ++y) {
for (int x = 0; x < size; ++x) {
sum += in.TopLeftPixel()[y * in.stride() + x];
@ -81,7 +81,7 @@ class PartialFdctTest : public ::testing::TestWithParam<PartialFdctParam> {
Buffer<tran_low_t> output_block = Buffer<tran_low_t>(size_, size_, 0, 16);
ASSERT_TRUE(output_block.Init());
if (output_block.TopLeftPixel() != NULL) {
if (output_block.TopLeftPixel() != nullptr) {
for (int i = 0; i < 100; ++i) {
if (i == 0) {
input_block.Set(maxvalue);
@ -111,7 +111,7 @@ class PartialFdctTest : public ::testing::TestWithParam<PartialFdctParam> {
TEST_P(PartialFdctTest, PartialFdctTest) { RunTest(); }
#if CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
C, PartialFdctTest,
::testing::Values(make_tuple(&vpx_highbd_fdct32x32_1_c, 32, VPX_BITS_12),
make_tuple(&vpx_highbd_fdct32x32_1_c, 32, VPX_BITS_10),
@ -124,7 +124,7 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(&vpx_fdct8x8_1_c, 8, VPX_BITS_8),
make_tuple(&vpx_fdct4x4_1_c, 4, VPX_BITS_8)));
#else
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
C, PartialFdctTest,
::testing::Values(make_tuple(&vpx_fdct32x32_1_c, 32, VPX_BITS_8),
make_tuple(&vpx_fdct16x16_1_c, 16, VPX_BITS_8),
@ -133,7 +133,7 @@ INSTANTIATE_TEST_CASE_P(
#endif // CONFIG_VP9_HIGHBITDEPTH
#if HAVE_SSE2
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSE2, PartialFdctTest,
::testing::Values(make_tuple(&vpx_fdct32x32_1_sse2, 32, VPX_BITS_8),
make_tuple(&vpx_fdct16x16_1_sse2, 16, VPX_BITS_8),
@ -143,7 +143,7 @@ INSTANTIATE_TEST_CASE_P(
#if HAVE_NEON
#if CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
NEON, PartialFdctTest,
::testing::Values(make_tuple(&vpx_fdct32x32_1_neon, 32, VPX_BITS_8),
make_tuple(&vpx_fdct16x16_1_neon, 16, VPX_BITS_8),
@ -152,7 +152,7 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(&vpx_fdct8x8_1_neon, 8, VPX_BITS_8),
make_tuple(&vpx_fdct4x4_1_neon, 4, VPX_BITS_8)));
#else
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
NEON, PartialFdctTest,
::testing::Values(make_tuple(&vpx_fdct32x32_1_neon, 32, VPX_BITS_8),
make_tuple(&vpx_fdct16x16_1_neon, 16, VPX_BITS_8),
@ -163,11 +163,11 @@ INSTANTIATE_TEST_CASE_P(
#if HAVE_MSA
#if CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P(MSA, PartialFdctTest,
::testing::Values(make_tuple(&vpx_fdct8x8_1_msa, 8,
VPX_BITS_8)));
INSTANTIATE_TEST_SUITE_P(MSA, PartialFdctTest,
::testing::Values(make_tuple(&vpx_fdct8x8_1_msa, 8,
VPX_BITS_8)));
#else // !CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
MSA, PartialFdctTest,
::testing::Values(make_tuple(&vpx_fdct32x32_1_msa, 32, VPX_BITS_8),
make_tuple(&vpx_fdct16x16_1_msa, 16, VPX_BITS_8),

Просмотреть файл

@ -160,17 +160,17 @@ class TransTestBase : public ::testing::TestWithParam<DctParam> {
src_ = reinterpret_cast<uint8_t *>(
vpx_memalign(16, pixel_size_ * block_size_));
ASSERT_TRUE(src_ != NULL);
ASSERT_NE(src_, nullptr);
dst_ = reinterpret_cast<uint8_t *>(
vpx_memalign(16, pixel_size_ * block_size_));
ASSERT_TRUE(dst_ != NULL);
ASSERT_NE(dst_, nullptr);
}
virtual void TearDown() {
vpx_free(src_);
src_ = NULL;
src_ = nullptr;
vpx_free(dst_);
dst_ = NULL;
dst_ = nullptr;
libvpx_test::ClearSystemState();
}
@ -211,7 +211,7 @@ class TransTestBase : public ::testing::TestWithParam<DctParam> {
Buffer<int16_t> test_input_block =
Buffer<int16_t>(size_, size_, 8, size_ == 4 ? 0 : 16);
ASSERT_TRUE(test_input_block.Init());
ASSERT_TRUE(test_input_block.TopLeftPixel() != NULL);
ASSERT_NE(test_input_block.TopLeftPixel(), nullptr);
Buffer<tran_low_t> test_temp_block =
Buffer<tran_low_t>(size_, size_, 0, 16);
ASSERT_TRUE(test_temp_block.Init());
@ -316,7 +316,7 @@ class TransTestBase : public ::testing::TestWithParam<DctParam> {
} else if (i == 1) {
input_extreme_block.Set(-max_pixel_value_);
} else {
ASSERT_TRUE(input_extreme_block.TopLeftPixel() != NULL);
ASSERT_NE(input_extreme_block.TopLeftPixel(), nullptr);
for (int h = 0; h < size_; ++h) {
for (int w = 0; w < size_; ++w) {
input_extreme_block
@ -331,7 +331,7 @@ class TransTestBase : public ::testing::TestWithParam<DctParam> {
// The minimum quant value is 4.
EXPECT_TRUE(output_block.CheckValues(output_ref_block));
ASSERT_TRUE(output_block.TopLeftPixel() != NULL);
ASSERT_NE(output_block.TopLeftPixel(), nullptr);
for (int h = 0; h < size_; ++h) {
for (int w = 0; w < size_; ++w) {
EXPECT_GE(
@ -369,7 +369,7 @@ class TransTestBase : public ::testing::TestWithParam<DctParam> {
for (int i = 0; i < count_test_block; ++i) {
InitMem();
ASSERT_TRUE(in.TopLeftPixel() != NULL);
ASSERT_NE(in.TopLeftPixel(), nullptr);
// Initialize a test block with input range [-max_pixel_value_,
// max_pixel_value_].
for (int h = 0; h < size_; ++h) {
@ -473,7 +473,7 @@ static const FuncInfo dct_c_func_info[] = {
1 }
};
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
C, TransDCT,
::testing::Combine(
::testing::Range(0, static_cast<int>(sizeof(dct_c_func_info) /
@ -505,7 +505,7 @@ static const FuncInfo dct_sse2_func_info[] = {
&idct_wrapper<vpx_idct32x32_1024_add_sse2>, 32, 1 }
};
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSE2, TransDCT,
::testing::Combine(
::testing::Range(0, static_cast<int>(sizeof(dct_sse2_func_info) /
@ -521,9 +521,9 @@ static const FuncInfo dct_ssse3_func_info = {
};
// TODO(johannkoenig): high bit depth fdct8x8.
INSTANTIATE_TEST_CASE_P(SSSE3, TransDCT,
::testing::Values(make_tuple(0, &dct_ssse3_func_info, 0,
VPX_BITS_8)));
INSTANTIATE_TEST_SUITE_P(SSSE3, TransDCT,
::testing::Values(make_tuple(0, &dct_ssse3_func_info,
0, VPX_BITS_8)));
#endif // HAVE_SSSE3 && !CONFIG_VP9_HIGHBITDEPTH && VPX_ARCH_X86_64
#if HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH
@ -533,9 +533,9 @@ static const FuncInfo dct_avx2_func_info = {
};
// TODO(johannkoenig): high bit depth fdct32x32.
INSTANTIATE_TEST_CASE_P(AVX2, TransDCT,
::testing::Values(make_tuple(0, &dct_avx2_func_info, 0,
VPX_BITS_8)));
INSTANTIATE_TEST_SUITE_P(AVX2, TransDCT,
::testing::Values(make_tuple(0, &dct_avx2_func_info, 0,
VPX_BITS_8)));
#endif // HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH
#if HAVE_NEON
@ -550,7 +550,7 @@ static const FuncInfo dct_neon_func_info[4] = {
&idct_wrapper<vpx_idct32x32_1024_add_neon>, 32, 1 }
};
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
NEON, TransDCT,
::testing::Combine(::testing::Range(0, 4),
::testing::Values(dct_neon_func_info),
@ -569,11 +569,11 @@ static const FuncInfo dct_msa_func_info[4] = {
32, 1 }
};
INSTANTIATE_TEST_CASE_P(MSA, TransDCT,
::testing::Combine(::testing::Range(0, 4),
::testing::Values(dct_msa_func_info),
::testing::Values(0),
::testing::Values(VPX_BITS_8)));
INSTANTIATE_TEST_SUITE_P(
MSA, TransDCT,
::testing::Combine(::testing::Range(0, 4),
::testing::Values(dct_msa_func_info),
::testing::Values(0), ::testing::Values(VPX_BITS_8)));
#endif // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH
#if HAVE_VSX && !CONFIG_VP9_HIGHBITDEPTH
@ -581,9 +581,9 @@ static const FuncInfo dct_vsx_func_info = {
&fdct_wrapper<vpx_fdct4x4_c>, &idct_wrapper<vpx_idct4x4_16_add_vsx>, 4, 1
};
INSTANTIATE_TEST_CASE_P(VSX, TransDCT,
::testing::Values(make_tuple(0, &dct_vsx_func_info, 0,
VPX_BITS_8)));
INSTANTIATE_TEST_SUITE_P(VSX, TransDCT,
::testing::Values(make_tuple(0, &dct_vsx_func_info, 0,
VPX_BITS_8)));
#endif // HAVE_VSX && !CONFIG_VP9_HIGHBITDEPTH &&
#endif // !CONFIG_EMULATE_HARDWARE
@ -619,7 +619,7 @@ static const FuncInfo ht_c_func_info[] = {
{ &vp9_fht16x16_c, &iht_wrapper<vp9_iht16x16_256_add_c>, 16, 1 }
};
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
C, TransHT,
::testing::Combine(
::testing::Range(0, static_cast<int>(sizeof(ht_c_func_info) /
@ -645,7 +645,7 @@ static const FuncInfo ht_neon_func_info[] = {
{ &vp9_fht16x16_c, &iht_wrapper<vp9_iht16x16_256_add_neon>, 16, 1 }
};
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
NEON, TransHT,
::testing::Combine(
::testing::Range(0, static_cast<int>(sizeof(ht_neon_func_info) /
@ -662,11 +662,11 @@ static const FuncInfo ht_sse2_func_info[3] = {
{ &vp9_fht16x16_sse2, &iht_wrapper<vp9_iht16x16_256_add_sse2>, 16, 1 }
};
INSTANTIATE_TEST_CASE_P(SSE2, TransHT,
::testing::Combine(::testing::Range(0, 3),
::testing::Values(ht_sse2_func_info),
::testing::Range(0, 4),
::testing::Values(VPX_BITS_8)));
INSTANTIATE_TEST_SUITE_P(
SSE2, TransHT,
::testing::Combine(::testing::Range(0, 3),
::testing::Values(ht_sse2_func_info),
::testing::Range(0, 4), ::testing::Values(VPX_BITS_8)));
#endif // HAVE_SSE2
#if HAVE_SSE4_1 && CONFIG_VP9_HIGHBITDEPTH
@ -679,7 +679,7 @@ static const FuncInfo ht_sse4_1_func_info[3] = {
&highbd_iht_wrapper<vp9_highbd_iht16x16_256_add_sse4_1>, 16, 2 }
};
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSE4_1, TransHT,
::testing::Combine(::testing::Range(0, 3),
::testing::Values(ht_sse4_1_func_info),
@ -695,11 +695,11 @@ static const FuncInfo ht_vsx_func_info[3] = {
{ &vp9_fht16x16_c, &iht_wrapper<vp9_iht16x16_256_add_vsx>, 16, 1 }
};
INSTANTIATE_TEST_CASE_P(VSX, TransHT,
::testing::Combine(::testing::Range(0, 3),
::testing::Values(ht_vsx_func_info),
::testing::Range(0, 4),
::testing::Values(VPX_BITS_8)));
INSTANTIATE_TEST_SUITE_P(VSX, TransHT,
::testing::Combine(::testing::Range(0, 3),
::testing::Values(ht_vsx_func_info),
::testing::Range(0, 4),
::testing::Values(VPX_BITS_8)));
#endif // HAVE_VSX
#endif // !CONFIG_EMULATE_HARDWARE
@ -726,7 +726,7 @@ static const FuncInfo wht_c_func_info[] = {
{ &fdct_wrapper<vp9_fwht4x4_c>, &idct_wrapper<vpx_iwht4x4_16_add_c>, 4, 1 }
};
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
C, TransWHT,
::testing::Combine(
::testing::Range(0, static_cast<int>(sizeof(wht_c_func_info) /
@ -739,9 +739,9 @@ static const FuncInfo wht_sse2_func_info = {
&fdct_wrapper<vp9_fwht4x4_sse2>, &idct_wrapper<vpx_iwht4x4_16_add_sse2>, 4, 1
};
INSTANTIATE_TEST_CASE_P(SSE2, TransWHT,
::testing::Values(make_tuple(0, &wht_sse2_func_info, 0,
VPX_BITS_8)));
INSTANTIATE_TEST_SUITE_P(SSE2, TransWHT,
::testing::Values(make_tuple(0, &wht_sse2_func_info, 0,
VPX_BITS_8)));
#endif // HAVE_SSE2 && !CONFIG_EMULATE_HARDWARE
#if HAVE_VSX && !CONFIG_EMULATE_HARDWARE && !CONFIG_VP9_HIGHBITDEPTH
@ -749,8 +749,8 @@ static const FuncInfo wht_vsx_func_info = {
&fdct_wrapper<vp9_fwht4x4_c>, &idct_wrapper<vpx_iwht4x4_16_add_vsx>, 4, 1
};
INSTANTIATE_TEST_CASE_P(VSX, TransWHT,
::testing::Values(make_tuple(0, &wht_vsx_func_info, 0,
VPX_BITS_8)));
INSTANTIATE_TEST_SUITE_P(VSX, TransWHT,
::testing::Values(make_tuple(0, &wht_vsx_func_info, 0,
VPX_BITS_8)));
#endif // HAVE_VSX && !CONFIG_EMULATE_HARDWARE
} // namespace

Просмотреть файл

@ -31,27 +31,33 @@ TEST(DecodeAPI, InvalidParams) {
uint8_t buf[1] = { 0 };
vpx_codec_ctx_t dec;
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, vpx_codec_dec_init(NULL, NULL, NULL, 0));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, vpx_codec_dec_init(&dec, NULL, NULL, 0));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, vpx_codec_decode(NULL, NULL, 0, NULL, 0));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, vpx_codec_decode(NULL, buf, 0, NULL, 0));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
vpx_codec_decode(NULL, buf, NELEMENTS(buf), NULL, 0));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
vpx_codec_decode(NULL, NULL, NELEMENTS(buf), NULL, 0));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, vpx_codec_destroy(NULL));
EXPECT_TRUE(vpx_codec_error(NULL) != NULL);
EXPECT_EQ(vpx_codec_dec_init(nullptr, nullptr, nullptr, 0),
VPX_CODEC_INVALID_PARAM);
EXPECT_EQ(vpx_codec_dec_init(&dec, nullptr, nullptr, 0),
VPX_CODEC_INVALID_PARAM);
EXPECT_EQ(vpx_codec_decode(nullptr, nullptr, 0, nullptr, 0),
VPX_CODEC_INVALID_PARAM);
EXPECT_EQ(vpx_codec_decode(nullptr, buf, 0, nullptr, 0),
VPX_CODEC_INVALID_PARAM);
EXPECT_EQ(vpx_codec_decode(nullptr, buf, NELEMENTS(buf), nullptr, 0),
VPX_CODEC_INVALID_PARAM);
EXPECT_EQ(vpx_codec_decode(nullptr, nullptr, NELEMENTS(buf), nullptr, 0),
VPX_CODEC_INVALID_PARAM);
EXPECT_EQ(vpx_codec_destroy(nullptr), VPX_CODEC_INVALID_PARAM);
EXPECT_NE(vpx_codec_error(nullptr), nullptr);
EXPECT_EQ(vpx_codec_error_detail(nullptr), nullptr);
for (int i = 0; i < NELEMENTS(kCodecs); ++i) {
EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
vpx_codec_dec_init(NULL, kCodecs[i], NULL, 0));
vpx_codec_dec_init(nullptr, kCodecs[i], nullptr, 0));
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_dec_init(&dec, kCodecs[i], NULL, 0));
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_dec_init(&dec, kCodecs[i], nullptr, 0));
EXPECT_EQ(VPX_CODEC_UNSUP_BITSTREAM,
vpx_codec_decode(&dec, buf, NELEMENTS(buf), NULL, 0));
vpx_codec_decode(&dec, buf, NELEMENTS(buf), nullptr, 0));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
vpx_codec_decode(&dec, NULL, NELEMENTS(buf), NULL, 0));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, vpx_codec_decode(&dec, buf, 0, NULL, 0));
vpx_codec_decode(&dec, nullptr, NELEMENTS(buf), nullptr, 0));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
vpx_codec_decode(&dec, buf, 0, nullptr, 0));
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&dec));
}
@ -62,11 +68,12 @@ TEST(DecodeAPI, OptionalParams) {
vpx_codec_ctx_t dec;
#if CONFIG_ERROR_CONCEALMENT
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_dec_init(&dec, &vpx_codec_vp8_dx_algo, NULL,
VPX_CODEC_USE_ERROR_CONCEALMENT));
EXPECT_EQ(VPX_CODEC_OK,
vpx_codec_dec_init(&dec, &vpx_codec_vp8_dx_algo, nullptr,
VPX_CODEC_USE_ERROR_CONCEALMENT));
#else
EXPECT_EQ(VPX_CODEC_INCAPABLE,
vpx_codec_dec_init(&dec, &vpx_codec_vp8_dx_algo, NULL,
vpx_codec_dec_init(&dec, &vpx_codec_vp8_dx_algo, nullptr,
VPX_CODEC_USE_ERROR_CONCEALMENT));
#endif // CONFIG_ERROR_CONCEALMENT
}
@ -90,25 +97,25 @@ void TestVp9Controls(vpx_codec_ctx_t *dec) {
default: EXPECT_EQ(VPX_CODEC_OK, res) << kControls[i]; break;
}
EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
vpx_codec_control_(dec, kControls[i], NULL));
vpx_codec_control_(dec, kControls[i], nullptr));
}
vp9_ref_frame_t ref;
ref.idx = 0;
EXPECT_EQ(VPX_CODEC_ERROR, vpx_codec_control(dec, VP9_GET_REFERENCE, &ref));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
vpx_codec_control(dec, VP9_GET_REFERENCE, NULL));
vpx_codec_control(dec, VP9_GET_REFERENCE, nullptr));
vpx_ref_frame_t ref_copy;
const int width = 352;
const int height = 288;
ASSERT_TRUE(
vpx_img_alloc(&ref_copy.img, VPX_IMG_FMT_I420, width, height, 1) != NULL);
EXPECT_NE(vpx_img_alloc(&ref_copy.img, VPX_IMG_FMT_I420, width, height, 1),
nullptr);
ref_copy.frame_type = VP8_LAST_FRAME;
EXPECT_EQ(VPX_CODEC_ERROR,
vpx_codec_control(dec, VP8_COPY_REFERENCE, &ref_copy));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
vpx_codec_control(dec, VP8_COPY_REFERENCE, NULL));
vpx_codec_control(dec, VP8_COPY_REFERENCE, nullptr));
vpx_img_free(&ref_copy.img);
}
@ -122,17 +129,17 @@ TEST(DecodeAPI, Vp9InvalidDecode) {
ASSERT_TRUE(!HasFailure());
vpx_codec_ctx_t dec;
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_dec_init(&dec, codec, NULL, 0));
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_dec_init(&dec, codec, nullptr, 0));
const uint32_t frame_size = static_cast<uint32_t>(video.frame_size());
#if CONFIG_VP9_HIGHBITDEPTH
EXPECT_EQ(VPX_CODEC_MEM_ERROR,
vpx_codec_decode(&dec, video.cxdata(), frame_size, NULL, 0));
vpx_codec_decode(&dec, video.cxdata(), frame_size, nullptr, 0));
#else
EXPECT_EQ(VPX_CODEC_UNSUP_BITSTREAM,
vpx_codec_decode(&dec, video.cxdata(), frame_size, NULL, 0));
vpx_codec_decode(&dec, video.cxdata(), frame_size, nullptr, 0));
#endif
vpx_codec_iter_t iter = NULL;
EXPECT_EQ(NULL, vpx_codec_get_frame(&dec, &iter));
vpx_codec_iter_t iter = nullptr;
EXPECT_EQ(nullptr, vpx_codec_get_frame(&dec, &iter));
TestVp9Controls(&dec);
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&dec));
@ -145,12 +152,12 @@ void TestPeekInfo(const uint8_t *const data, uint32_t data_sz,
// to decoder_peek_si_internal on frames of size < 8.
if (data_sz >= 8) {
vpx_codec_ctx_t dec;
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_dec_init(&dec, codec, NULL, 0));
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_dec_init(&dec, codec, nullptr, 0));
EXPECT_EQ((data_sz < peek_size) ? VPX_CODEC_UNSUP_BITSTREAM
: VPX_CODEC_CORRUPT_FRAME,
vpx_codec_decode(&dec, data, data_sz, NULL, 0));
vpx_codec_iter_t iter = NULL;
EXPECT_EQ(NULL, vpx_codec_get_frame(&dec, &iter));
vpx_codec_decode(&dec, data, data_sz, nullptr, 0));
vpx_codec_iter_t iter = nullptr;
EXPECT_EQ(nullptr, vpx_codec_get_frame(&dec, &iter));
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&dec));
}

Просмотреть файл

@ -87,14 +87,14 @@ TEST_P(DecodeCorruptedFrameTest, DecodeCorruptedFrame) {
}
#if CONFIG_VP9
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
VP9, DecodeCorruptedFrameTest,
::testing::Values(
static_cast<const libvpx_test::CodecFactory *>(&libvpx_test::kVP9)));
#endif // CONFIG_VP9
#if CONFIG_VP8
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
VP8, DecodeCorruptedFrameTest,
::testing::Values(
static_cast<const libvpx_test::CodecFactory *>(&libvpx_test::kVP8)));

Просмотреть файл

@ -87,7 +87,7 @@ TEST_P(DecodePerfTest, PerfTest) {
vpx_usec_timer t;
vpx_usec_timer_start(&t);
for (video.Begin(); video.cxdata() != NULL; video.Next()) {
for (video.Begin(); video.cxdata() != nullptr; video.Next()) {
decoder.DecodeFrame(video.cxdata(), video.frame_size());
}
@ -107,8 +107,8 @@ TEST_P(DecodePerfTest, PerfTest) {
printf("}\n");
}
INSTANTIATE_TEST_CASE_P(VP9, DecodePerfTest,
::testing::ValuesIn(kVP9DecodePerfVectors));
INSTANTIATE_TEST_SUITE_P(VP9, DecodePerfTest,
::testing::ValuesIn(kVP9DecodePerfVectors));
class VP9NewEncodeDecodePerfTest
: public ::libvpx_test::EncoderTest,
@ -150,16 +150,16 @@ class VP9NewEncodeDecodePerfTest
const std::string data_path = getenv("LIBVPX_TEST_DATA_PATH");
const std::string path_to_source = data_path + "/" + kNewEncodeOutputFile;
outfile_ = fopen(path_to_source.c_str(), "wb");
ASSERT_TRUE(outfile_ != NULL);
ASSERT_NE(outfile_, nullptr);
}
virtual void EndPassHook() {
if (outfile_ != NULL) {
if (outfile_ != nullptr) {
if (!fseek(outfile_, 0, SEEK_SET)) {
ivf_write_file_header(outfile_, &cfg_, VP9_FOURCC, out_frames_);
}
fclose(outfile_);
outfile_ = NULL;
outfile_ = nullptr;
}
}
@ -236,7 +236,7 @@ TEST_P(VP9NewEncodeDecodePerfTest, PerfTest) {
vpx_usec_timer t;
vpx_usec_timer_start(&t);
for (decode_video.Begin(); decode_video.cxdata() != NULL;
for (decode_video.Begin(); decode_video.cxdata() != nullptr;
decode_video.Next()) {
decoder.DecodeFrame(decode_video.cxdata(), decode_video.frame_size());
}
@ -258,6 +258,6 @@ TEST_P(VP9NewEncodeDecodePerfTest, PerfTest) {
printf("}\n");
}
VP9_INSTANTIATE_TEST_CASE(VP9NewEncodeDecodePerfTest,
::testing::Values(::libvpx_test::kTwoPassGood));
VP9_INSTANTIATE_TEST_SUITE(VP9NewEncodeDecodePerfTest,
::testing::Values(::libvpx_test::kTwoPassGood));
} // namespace

Просмотреть файл

@ -56,7 +56,7 @@ TEST_P(DecodeSvcTest, DecodeSvcTestUpToSpatialLayer0) {
const std::string filename = GET_PARAM(1);
std::unique_ptr<libvpx_test::CompressedVideoSource> video;
video.reset(new libvpx_test::IVFVideoSource(filename));
ASSERT_TRUE(video.get() != NULL);
ASSERT_NE(video.get(), nullptr);
video->Init();
total_frames_ = 0;
spatial_layer_ = 0;
@ -73,7 +73,7 @@ TEST_P(DecodeSvcTest, DecodeSvcTestUpToSpatialLayer1) {
const std::string filename = GET_PARAM(1);
std::unique_ptr<libvpx_test::CompressedVideoSource> video;
video.reset(new libvpx_test::IVFVideoSource(filename));
ASSERT_TRUE(video.get() != NULL);
ASSERT_NE(video.get(), nullptr);
video->Init();
total_frames_ = 0;
spatial_layer_ = 1;
@ -90,7 +90,7 @@ TEST_P(DecodeSvcTest, DecodeSvcTestUpToSpatialLayer2) {
const std::string filename = GET_PARAM(1);
std::unique_ptr<libvpx_test::CompressedVideoSource> video;
video.reset(new libvpx_test::IVFVideoSource(filename));
ASSERT_TRUE(video.get() != NULL);
ASSERT_NE(video.get(), nullptr);
video->Init();
total_frames_ = 0;
spatial_layer_ = 2;
@ -108,7 +108,7 @@ TEST_P(DecodeSvcTest, DecodeSvcTestUpToSpatialLayer10) {
const std::string filename = GET_PARAM(1);
std::unique_ptr<libvpx_test::CompressedVideoSource> video;
video.reset(new libvpx_test::IVFVideoSource(filename));
ASSERT_TRUE(video.get() != NULL);
ASSERT_NE(video.get(), nullptr);
video->Init();
total_frames_ = 0;
spatial_layer_ = 10;
@ -118,7 +118,7 @@ TEST_P(DecodeSvcTest, DecodeSvcTestUpToSpatialLayer10) {
ASSERT_EQ(total_frames_, kNumFrames);
}
VP9_INSTANTIATE_TEST_CASE(
VP9_INSTANTIATE_TEST_SUITE(
DecodeSvcTest, ::testing::ValuesIn(libvpx_test::kVP9TestVectorsSvc,
libvpx_test::kVP9TestVectorsSvc +
libvpx_test::kNumVP9TestVectorsSvc));

Просмотреть файл

@ -26,7 +26,7 @@ vpx_codec_err_t Decoder::PeekStream(const uint8_t *cxdata, size_t size,
}
vpx_codec_err_t Decoder::DecodeFrame(const uint8_t *cxdata, size_t size) {
return DecodeFrame(cxdata, size, NULL);
return DecodeFrame(cxdata, size, nullptr);
}
vpx_codec_err_t Decoder::DecodeFrame(const uint8_t *cxdata, size_t size,
@ -67,7 +67,7 @@ void DecoderTest::HandlePeekResult(Decoder *const decoder,
void DecoderTest::RunLoop(CompressedVideoSource *video,
const vpx_codec_dec_cfg_t &dec_cfg) {
Decoder *const decoder = codec_->CreateDecoder(dec_cfg, flags_);
ASSERT_TRUE(decoder != NULL);
ASSERT_NE(decoder, nullptr);
bool end_of_file = false;
// Decode frames.
@ -78,7 +78,7 @@ void DecoderTest::RunLoop(CompressedVideoSource *video,
vpx_codec_stream_info_t stream_info;
stream_info.sz = sizeof(stream_info);
if (video->cxdata() != NULL) {
if (video->cxdata() != nullptr) {
const vpx_codec_err_t res_peek = decoder->PeekStream(
video->cxdata(), video->frame_size(), &stream_info);
HandlePeekResult(decoder, video, res_peek);
@ -89,13 +89,13 @@ void DecoderTest::RunLoop(CompressedVideoSource *video,
if (!HandleDecodeResult(res_dec, *video, decoder)) break;
} else {
// Signal end of the file to the decoder.
const vpx_codec_err_t res_dec = decoder->DecodeFrame(NULL, 0);
const vpx_codec_err_t res_dec = decoder->DecodeFrame(nullptr, 0);
ASSERT_EQ(VPX_CODEC_OK, res_dec) << decoder->DecodeError();
end_of_file = true;
}
DxDataIterator dec_iter = decoder->GetDxData();
const vpx_image_t *img = NULL;
const vpx_image_t *img = nullptr;
// Get decompressed data
while (!::testing::Test::HasFailure() && (img = dec_iter.Next())) {

Просмотреть файл

@ -40,7 +40,7 @@ decode_to_md5() {
fi
eval "${VPX_TEST_PREFIX}" "${decoder}" "${input_file}" "${output_file}" \
${devnull}
${devnull} || return 1
[ -e "${output_file}" ] || return 1

Просмотреть файл

@ -40,7 +40,7 @@ decode_with_drops() {
fi
eval "${VPX_TEST_PREFIX}" "${decoder}" "${input_file}" "${output_file}" \
"${drop_mode}" ${devnull}
"${drop_mode}" ${devnull} || return 1
[ -e "${output_file}" ] || return 1
}
@ -52,10 +52,10 @@ decode_with_drops() {
decode_with_drops_vp8() {
if [ "$(vp8_decode_available)" = "yes" ]; then
# Test sequence mode: Drop frames 2-28.
decode_with_drops "${VP8_IVF_FILE}" "vp8" "2-28"
decode_with_drops "${VP8_IVF_FILE}" "vp8" "2-28" || return 1
# Test pattern mode: Drop 3 of every 4 frames.
decode_with_drops "${VP8_IVF_FILE}" "vp8" "3/4"
decode_with_drops "${VP8_IVF_FILE}" "vp8" "3/4" || return 1
fi
}
@ -66,10 +66,10 @@ decode_with_drops_vp8() {
decode_with_drops_vp9() {
if [ "$(vp9_decode_available)" = "yes" ]; then
# Test sequence mode: Drop frames 2-28.
decode_with_drops "${VP9_IVF_FILE}" "vp9" "2-19"
decode_with_drops "${VP9_IVF_FILE}" "vp9" "2-19" || return 1
# Test pattern mode: Drop 3 of every 4 frames.
decode_with_drops "${VP9_IVF_FILE}" "vp9" "3/4"
decode_with_drops "${VP9_IVF_FILE}" "vp9" "3/4" || return 1
fi
}

Просмотреть файл

@ -8,6 +8,9 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <climits>
#include <cstring>
#include "third_party/googletest/src/include/gtest/gtest.h"
#include "./vpx_config.h"
@ -18,6 +21,12 @@ namespace {
#define NELEMENTS(x) static_cast<int>(sizeof(x) / sizeof(x[0]))
bool IsVP9(const vpx_codec_iface_t *iface) {
static const char kVP9Name[] = "WebM Project VP9";
return strncmp(kVP9Name, vpx_codec_iface_name(iface), sizeof(kVP9Name) - 1) ==
0;
}
TEST(EncodeAPI, InvalidParams) {
static const vpx_codec_iface_t *kCodecs[] = {
#if CONFIG_VP8_ENCODER
@ -34,29 +43,33 @@ TEST(EncodeAPI, InvalidParams) {
EXPECT_EQ(&img, vpx_img_wrap(&img, VPX_IMG_FMT_I420, 1, 1, 1, buf));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, vpx_codec_enc_init(NULL, NULL, NULL, 0));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, vpx_codec_enc_init(&enc, NULL, NULL, 0));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, vpx_codec_encode(NULL, NULL, 0, 0, 0, 0));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, vpx_codec_encode(NULL, &img, 0, 0, 0, 0));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, vpx_codec_destroy(NULL));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
vpx_codec_enc_config_default(NULL, NULL, 0));
vpx_codec_enc_init(nullptr, nullptr, nullptr, 0));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
vpx_codec_enc_config_default(NULL, &cfg, 0));
EXPECT_TRUE(vpx_codec_error(NULL) != NULL);
vpx_codec_enc_init(&enc, nullptr, nullptr, 0));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
vpx_codec_encode(nullptr, nullptr, 0, 0, 0, 0));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
vpx_codec_encode(nullptr, &img, 0, 0, 0, 0));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, vpx_codec_destroy(nullptr));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
vpx_codec_enc_config_default(nullptr, nullptr, 0));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
vpx_codec_enc_config_default(nullptr, &cfg, 0));
EXPECT_NE(vpx_codec_error(nullptr), nullptr);
for (int i = 0; i < NELEMENTS(kCodecs); ++i) {
SCOPED_TRACE(vpx_codec_iface_name(kCodecs[i]));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
vpx_codec_enc_init(NULL, kCodecs[i], NULL, 0));
vpx_codec_enc_init(nullptr, kCodecs[i], nullptr, 0));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
vpx_codec_enc_init(&enc, kCodecs[i], NULL, 0));
vpx_codec_enc_init(&enc, kCodecs[i], nullptr, 0));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
vpx_codec_enc_config_default(kCodecs[i], &cfg, 1));
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_enc_config_default(kCodecs[i], &cfg, 0));
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_enc_init(&enc, kCodecs[i], &cfg, 0));
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_encode(&enc, NULL, 0, 0, 0, 0));
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_encode(&enc, nullptr, 0, 0, 0, 0));
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&enc));
}
@ -180,10 +193,7 @@ TEST(EncodeAPI, MultiResEncode) {
}
// VP9 should report incapable, VP8 invalid for all configurations.
const char kVP9Name[] = "WebM Project VP9";
const bool is_vp9 = strncmp(kVP9Name, vpx_codec_iface_name(iface),
sizeof(kVP9Name) - 1) == 0;
EXPECT_EQ(is_vp9 ? VPX_CODEC_INCAPABLE : VPX_CODEC_INVALID_PARAM,
EXPECT_EQ(IsVP9(iface) ? VPX_CODEC_INCAPABLE : VPX_CODEC_INVALID_PARAM,
vpx_codec_enc_init_multi(&enc[0], iface, &cfg[0], 2, 0, &dsf[0]));
for (int i = 0; i < 2; i++) {
@ -192,4 +202,112 @@ TEST(EncodeAPI, MultiResEncode) {
}
}
TEST(EncodeAPI, SetRoi) {
static struct {
const vpx_codec_iface_t *iface;
int ctrl_id;
} kCodecs[] = {
#if CONFIG_VP8_ENCODER
{ &vpx_codec_vp8_cx_algo, VP8E_SET_ROI_MAP },
#endif
#if CONFIG_VP9_ENCODER
{ &vpx_codec_vp9_cx_algo, VP9E_SET_ROI_MAP },
#endif
};
constexpr int kWidth = 64;
constexpr int kHeight = 64;
for (const auto &codec : kCodecs) {
SCOPED_TRACE(vpx_codec_iface_name(codec.iface));
vpx_codec_ctx_t enc;
vpx_codec_enc_cfg_t cfg;
EXPECT_EQ(vpx_codec_enc_config_default(codec.iface, &cfg, 0), VPX_CODEC_OK);
cfg.g_w = kWidth;
cfg.g_h = kHeight;
EXPECT_EQ(vpx_codec_enc_init(&enc, codec.iface, &cfg, 0), VPX_CODEC_OK);
vpx_roi_map_t roi = {};
uint8_t roi_map[kWidth * kHeight] = {};
if (IsVP9(codec.iface)) {
roi.rows = (cfg.g_w + 7) >> 3;
roi.cols = (cfg.g_h + 7) >> 3;
} else {
roi.rows = (cfg.g_w + 15) >> 4;
roi.cols = (cfg.g_h + 15) >> 4;
}
EXPECT_EQ(vpx_codec_control_(&enc, codec.ctrl_id, &roi), VPX_CODEC_OK);
roi.roi_map = roi_map;
// VP8 only. This value isn't range checked.
roi.static_threshold[1] = 1000;
roi.static_threshold[2] = INT_MIN;
roi.static_threshold[3] = INT_MAX;
for (const auto delta : { -63, -1, 0, 1, 63 }) {
for (int i = 0; i < 8; ++i) {
roi.delta_q[i] = delta;
roi.delta_lf[i] = delta;
// VP9 only.
roi.skip[i] ^= 1;
roi.ref_frame[i] = (roi.ref_frame[i] + 1) % 4;
EXPECT_EQ(vpx_codec_control_(&enc, codec.ctrl_id, &roi), VPX_CODEC_OK);
}
}
vpx_codec_err_t expected_error;
for (const auto delta : { -64, 64, INT_MIN, INT_MAX }) {
expected_error = VPX_CODEC_INVALID_PARAM;
for (int i = 0; i < 8; ++i) {
roi.delta_q[i] = delta;
// The max segment count for VP8 is 4, the remainder of the entries are
// ignored.
if (i >= 4 && !IsVP9(codec.iface)) expected_error = VPX_CODEC_OK;
EXPECT_EQ(vpx_codec_control_(&enc, codec.ctrl_id, &roi), expected_error)
<< "delta_q[" << i << "]: " << delta;
roi.delta_q[i] = 0;
roi.delta_lf[i] = delta;
EXPECT_EQ(vpx_codec_control_(&enc, codec.ctrl_id, &roi), expected_error)
<< "delta_lf[" << i << "]: " << delta;
roi.delta_lf[i] = 0;
}
}
// VP8 should ignore skip[] and ref_frame[] values.
expected_error =
IsVP9(codec.iface) ? VPX_CODEC_INVALID_PARAM : VPX_CODEC_OK;
for (const auto skip : { -2, 2, INT_MIN, INT_MAX }) {
for (int i = 0; i < 8; ++i) {
roi.skip[i] = skip;
EXPECT_EQ(vpx_codec_control_(&enc, codec.ctrl_id, &roi), expected_error)
<< "skip[" << i << "]: " << skip;
roi.skip[i] = 0;
}
}
// VP9 allows negative values to be used to disable segmentation.
for (int ref_frame = -3; ref_frame < 0; ++ref_frame) {
for (int i = 0; i < 8; ++i) {
roi.ref_frame[i] = ref_frame;
EXPECT_EQ(vpx_codec_control_(&enc, codec.ctrl_id, &roi), VPX_CODEC_OK)
<< "ref_frame[" << i << "]: " << ref_frame;
roi.ref_frame[i] = 0;
}
}
for (const auto ref_frame : { 4, INT_MIN, INT_MAX }) {
for (int i = 0; i < 8; ++i) {
roi.ref_frame[i] = ref_frame;
EXPECT_EQ(vpx_codec_control_(&enc, codec.ctrl_id, &roi), expected_error)
<< "ref_frame[" << i << "]: " << ref_frame;
roi.ref_frame[i] = 0;
}
}
EXPECT_EQ(vpx_codec_destroy(&enc), VPX_CODEC_OK);
}
}
} // namespace

Просмотреть файл

@ -183,6 +183,6 @@ TEST_P(VP9EncodePerfTest, PerfTest) {
}
}
VP9_INSTANTIATE_TEST_CASE(VP9EncodePerfTest,
::testing::Values(::libvpx_test::kRealTime));
VP9_INSTANTIATE_TEST_SUITE(VP9EncodePerfTest,
::testing::Values(::libvpx_test::kRealTime));
} // namespace

Просмотреть файл

@ -91,7 +91,7 @@ void Encoder::EncodeFrameInternal(const VideoSource &video,
void Encoder::Flush() {
const vpx_codec_err_t res =
vpx_codec_encode(&encoder_, NULL, 0, 0, 0, deadline_);
vpx_codec_encode(&encoder_, nullptr, 0, 0, 0, deadline_);
if (!encoder_.priv)
ASSERT_EQ(VPX_CODEC_ERROR, res) << EncoderError();
else
@ -182,7 +182,7 @@ void EncoderTest::RunLoop(VideoSource *video) {
BeginPassHook(pass);
std::unique_ptr<Encoder> encoder(
codec_->CreateEncoder(cfg_, deadline_, init_flags_, &stats_));
ASSERT_TRUE(encoder.get() != NULL);
ASSERT_NE(encoder.get(), nullptr);
ASSERT_NO_FATAL_FAILURE(video->Begin());
encoder->InitEncoder(video);
@ -198,7 +198,7 @@ void EncoderTest::RunLoop(VideoSource *video) {
codec_->CreateDecoder(dec_cfg, dec_init_flags));
bool again;
for (again = true; again; video->Next()) {
again = (video->img() != NULL);
again = (video->img() != nullptr);
PreEncodeFrameHook(video);
PreEncodeFrameHook(video, encoder.get());
@ -216,7 +216,7 @@ void EncoderTest::RunLoop(VideoSource *video) {
switch (pkt->kind) {
case VPX_CODEC_CX_FRAME_PKT:
has_cxdata = true;
if (decoder.get() != NULL && DoDecode()) {
if (decoder != nullptr && DoDecode()) {
PreDecodeFrameHook(video, decoder.get());
vpx_codec_err_t res_dec = decoder->DecodeFrame(
(const uint8_t *)pkt->data.frame.buf, pkt->data.frame.sz);
@ -240,7 +240,7 @@ void EncoderTest::RunLoop(VideoSource *video) {
// Flush the decoder when there are no more fragments.
if ((init_flags_ & VPX_CODEC_USE_OUTPUT_PARTITION) && has_dxdata) {
const vpx_codec_err_t res_dec = decoder->DecodeFrame(NULL, 0);
const vpx_codec_err_t res_dec = decoder->DecodeFrame(nullptr, 0);
if (!HandleDecodeResult(res_dec, *video, decoder.get())) break;
}

Просмотреть файл

@ -148,6 +148,13 @@ class Encoder {
ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
}
#if CONFIG_VP9_ENCODER
void Control(int ctrl_id, vpx_rc_funcs_t *arg) {
const vpx_codec_err_t res = vpx_codec_control_(&encoder_, ctrl_id, arg);
ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
}
#endif // CONFIG_VP9_ENCODER
#if CONFIG_VP8_ENCODER || CONFIG_VP9_ENCODER
void Control(int ctrl_id, vpx_active_map_t *arg) {
const vpx_codec_err_t res = vpx_codec_control_(&encoder_, ctrl_id, arg);

Просмотреть файл

@ -573,10 +573,10 @@ TEST_P(ErrorResilienceTestLargeCodecControls, CodecControl3TemporalLayers) {
}
}
VP8_INSTANTIATE_TEST_CASE(ErrorResilienceTestLarge, ONE_PASS_TEST_MODES,
::testing::Values(true));
VP8_INSTANTIATE_TEST_CASE(ErrorResilienceTestLargeCodecControls,
ONE_PASS_TEST_MODES);
VP9_INSTANTIATE_TEST_CASE(ErrorResilienceTestLarge, ONE_PASS_TEST_MODES,
::testing::Values(true));
VP8_INSTANTIATE_TEST_SUITE(ErrorResilienceTestLarge, ONE_PASS_TEST_MODES,
::testing::Values(true));
VP8_INSTANTIATE_TEST_SUITE(ErrorResilienceTestLargeCodecControls,
ONE_PASS_TEST_MODES);
VP9_INSTANTIATE_TEST_SUITE(ErrorResilienceTestLarge, ONE_PASS_TEST_MODES,
::testing::Values(true));
} // namespace

Просмотреть файл

@ -36,7 +36,7 @@ struct ExternalFrameBuffer {
class ExternalFrameBufferList {
public:
ExternalFrameBufferList()
: num_buffers_(0), num_used_buffers_(0), ext_fb_list_(NULL) {}
: num_buffers_(0), num_used_buffers_(0), ext_fb_list_(nullptr) {}
virtual ~ExternalFrameBufferList() {
for (int i = 0; i < num_buffers_; ++i) {
@ -51,7 +51,7 @@ class ExternalFrameBufferList {
num_buffers_ = num_buffers;
ext_fb_list_ = new ExternalFrameBuffer[num_buffers_];
EXPECT_TRUE(ext_fb_list_ != NULL);
EXPECT_NE(ext_fb_list_, nullptr);
memset(ext_fb_list_, 0, sizeof(ext_fb_list_[0]) * num_buffers_);
return true;
}
@ -61,7 +61,7 @@ class ExternalFrameBufferList {
// frame buffer is in use by libvpx. Finally sets |fb| to point to the
// external frame buffer. Returns < 0 on an error.
int GetFreeFrameBuffer(size_t min_size, vpx_codec_frame_buffer_t *fb) {
EXPECT_TRUE(fb != NULL);
EXPECT_NE(fb, nullptr);
const int idx = FindFreeBufferIndex();
if (idx == num_buffers_) return -1;
@ -81,13 +81,13 @@ class ExternalFrameBufferList {
// Test function that will not allocate any data for the frame buffer.
// Returns < 0 on an error.
int GetZeroFrameBuffer(size_t min_size, vpx_codec_frame_buffer_t *fb) {
EXPECT_TRUE(fb != NULL);
EXPECT_NE(fb, nullptr);
const int idx = FindFreeBufferIndex();
if (idx == num_buffers_) return -1;
if (ext_fb_list_[idx].size < min_size) {
delete[] ext_fb_list_[idx].data;
ext_fb_list_[idx].data = NULL;
ext_fb_list_[idx].data = nullptr;
ext_fb_list_[idx].size = min_size;
}
@ -98,14 +98,14 @@ class ExternalFrameBufferList {
// Marks the external frame buffer that |fb| is pointing to as free.
// Returns < 0 on an error.
int ReturnFrameBuffer(vpx_codec_frame_buffer_t *fb) {
if (fb == NULL) {
EXPECT_TRUE(fb != NULL);
if (fb == nullptr) {
EXPECT_NE(fb, nullptr);
return -1;
}
ExternalFrameBuffer *const ext_fb =
reinterpret_cast<ExternalFrameBuffer *>(fb->priv);
if (ext_fb == NULL) {
EXPECT_TRUE(ext_fb != NULL);
if (ext_fb == nullptr) {
EXPECT_NE(ext_fb, nullptr);
return -1;
}
EXPECT_EQ(1, ext_fb->in_use);
@ -117,7 +117,7 @@ class ExternalFrameBufferList {
// Checks that the vpx_image_t data is contained within the external frame
// buffer private data passed back in the vpx_image_t.
void CheckImageFrameBuffer(const vpx_image_t *img) {
if (img->fb_priv != NULL) {
if (img->fb_priv != nullptr) {
const struct ExternalFrameBuffer *const ext_fb =
reinterpret_cast<ExternalFrameBuffer *>(img->fb_priv);
@ -143,7 +143,7 @@ class ExternalFrameBufferList {
// Sets |fb| to an external frame buffer. idx is the index into the frame
// buffer list.
void SetFrameBuffer(int idx, vpx_codec_frame_buffer_t *fb) {
ASSERT_TRUE(fb != NULL);
ASSERT_NE(fb, nullptr);
fb->data = ext_fb_list_[idx].data;
fb->size = ext_fb_list_[idx].size;
ASSERT_EQ(0, ext_fb_list_[idx].in_use);
@ -208,10 +208,10 @@ class ExternalFrameBufferMD5Test
protected:
ExternalFrameBufferMD5Test()
: DecoderTest(GET_PARAM(::libvpx_test::kCodecFactoryParam)),
md5_file_(NULL), num_buffers_(0) {}
md5_file_(nullptr), num_buffers_(0) {}
virtual ~ExternalFrameBufferMD5Test() {
if (md5_file_ != NULL) fclose(md5_file_);
if (md5_file_ != nullptr) fclose(md5_file_);
}
virtual void PreDecodeFrameHook(
@ -228,13 +228,13 @@ class ExternalFrameBufferMD5Test
void OpenMD5File(const std::string &md5_file_name_) {
md5_file_ = libvpx_test::OpenTestDataFile(md5_file_name_);
ASSERT_TRUE(md5_file_ != NULL)
ASSERT_NE(md5_file_, nullptr)
<< "Md5 file open failed. Filename: " << md5_file_name_;
}
virtual void DecompressedFrameHook(const vpx_image_t &img,
const unsigned int frame_number) {
ASSERT_TRUE(md5_file_ != NULL);
ASSERT_NE(md5_file_, nullptr);
char expected_md5[33];
char junk[128];
@ -286,24 +286,25 @@ const char kVP9NonRefTestFile[] = "vp90-2-22-svc_1280x720_1.webm";
// Class for testing passing in external frame buffers to libvpx.
class ExternalFrameBufferTest : public ::testing::Test {
protected:
ExternalFrameBufferTest() : video_(NULL), decoder_(NULL), num_buffers_(0) {}
ExternalFrameBufferTest()
: video_(nullptr), decoder_(nullptr), num_buffers_(0) {}
virtual void SetUp() {
video_ = new libvpx_test::WebMVideoSource(kVP9TestFile);
ASSERT_TRUE(video_ != NULL);
ASSERT_NE(video_, nullptr);
video_->Init();
video_->Begin();
vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
decoder_ = new libvpx_test::VP9Decoder(cfg, 0);
ASSERT_TRUE(decoder_ != NULL);
ASSERT_NE(decoder_, nullptr);
}
virtual void TearDown() {
delete decoder_;
decoder_ = NULL;
decoder_ = nullptr;
delete video_;
video_ = NULL;
video_ = nullptr;
}
// Passes the external frame buffer information to libvpx.
@ -327,7 +328,7 @@ class ExternalFrameBufferTest : public ::testing::Test {
}
vpx_codec_err_t DecodeRemainingFrames() {
for (; video_->cxdata() != NULL; video_->Next()) {
for (; video_->cxdata() != nullptr; video_->Next()) {
const vpx_codec_err_t res =
decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
if (res != VPX_CODEC_OK) return res;
@ -338,10 +339,10 @@ class ExternalFrameBufferTest : public ::testing::Test {
void CheckDecodedFrames() {
libvpx_test::DxDataIterator dec_iter = decoder_->GetDxData();
const vpx_image_t *img = NULL;
const vpx_image_t *img = nullptr;
// Get decompressed data
while ((img = dec_iter.Next()) != NULL) {
while ((img = dec_iter.Next()) != nullptr) {
fb_list_.CheckImageFrameBuffer(img);
}
}
@ -356,13 +357,13 @@ class ExternalFrameBufferNonRefTest : public ExternalFrameBufferTest {
protected:
virtual void SetUp() {
video_ = new libvpx_test::WebMVideoSource(kVP9NonRefTestFile);
ASSERT_TRUE(video_ != NULL);
ASSERT_NE(video_, nullptr);
video_->Init();
video_->Begin();
vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
decoder_ = new libvpx_test::VP9Decoder(cfg, 0);
ASSERT_TRUE(decoder_ != NULL);
ASSERT_NE(decoder_, nullptr);
}
virtual void CheckFrameBufferRelease() {
@ -405,7 +406,7 @@ TEST_P(ExternalFrameBufferMD5Test, ExtFBMD5Match) {
return;
#endif
}
ASSERT_TRUE(video.get() != NULL);
ASSERT_NE(video.get(), nullptr);
video->Init();
// Construct md5 file name.
@ -482,13 +483,14 @@ TEST_F(ExternalFrameBufferTest, NullGetFunction) {
const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
ASSERT_EQ(
VPX_CODEC_INVALID_PARAM,
SetFrameBufferFunctions(num_buffers, NULL, release_vp9_frame_buffer));
SetFrameBufferFunctions(num_buffers, nullptr, release_vp9_frame_buffer));
}
TEST_F(ExternalFrameBufferTest, NullReleaseFunction) {
const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
ASSERT_EQ(VPX_CODEC_INVALID_PARAM,
SetFrameBufferFunctions(num_buffers, get_vp9_frame_buffer, NULL));
ASSERT_EQ(
VPX_CODEC_INVALID_PARAM,
SetFrameBufferFunctions(num_buffers, get_vp9_frame_buffer, nullptr));
}
TEST_F(ExternalFrameBufferTest, SetAfterDecode) {
@ -509,7 +511,7 @@ TEST_F(ExternalFrameBufferNonRefTest, ReleaseNonRefFrameBuffer) {
}
#endif // CONFIG_WEBM_IO
VP9_INSTANTIATE_TEST_CASE(
VP9_INSTANTIATE_TEST_SUITE(
ExternalFrameBufferMD5Test,
::testing::ValuesIn(libvpx_test::kVP9TestVectors,
libvpx_test::kVP9TestVectors +

Просмотреть файл

@ -598,6 +598,7 @@ TEST_P(FwdTrans8x8HT, RoundTripErrorCheck) { RunRoundTripErrorCheck(); }
TEST_P(FwdTrans8x8HT, ExtremalCheck) { RunExtremalCheck(); }
#if HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
class InvTrans8x8DCT : public FwdTrans8x8TestBase,
public ::testing::TestWithParam<Idct8x8Param> {
public:
@ -624,29 +625,31 @@ class InvTrans8x8DCT : public FwdTrans8x8TestBase,
IdctFunc inv_txfm_;
int thresh_;
};
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(InvTrans8x8DCT);
TEST_P(InvTrans8x8DCT, CompareReference) {
CompareInvReference(ref_txfm_, thresh_);
}
#endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
using std::make_tuple;
#if CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
C, FwdTrans8x8DCT,
::testing::Values(
make_tuple(&vpx_fdct8x8_c, &vpx_idct8x8_64_add_c, 0, VPX_BITS_8),
make_tuple(&vpx_highbd_fdct8x8_c, &idct8x8_10, 0, VPX_BITS_10),
make_tuple(&vpx_highbd_fdct8x8_c, &idct8x8_12, 0, VPX_BITS_12)));
#else
INSTANTIATE_TEST_CASE_P(C, FwdTrans8x8DCT,
::testing::Values(make_tuple(&vpx_fdct8x8_c,
&vpx_idct8x8_64_add_c, 0,
VPX_BITS_8)));
INSTANTIATE_TEST_SUITE_P(C, FwdTrans8x8DCT,
::testing::Values(make_tuple(&vpx_fdct8x8_c,
&vpx_idct8x8_64_add_c, 0,
VPX_BITS_8)));
#endif // CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
C, FwdTrans8x8HT,
::testing::Values(
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 0, VPX_BITS_8),
@ -662,7 +665,7 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 2, VPX_BITS_8),
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 3, VPX_BITS_8)));
#else
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
C, FwdTrans8x8HT,
::testing::Values(
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 0, VPX_BITS_8),
@ -672,13 +675,13 @@ INSTANTIATE_TEST_CASE_P(
#endif // CONFIG_VP9_HIGHBITDEPTH
#if HAVE_NEON && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P(NEON, FwdTrans8x8DCT,
::testing::Values(make_tuple(&vpx_fdct8x8_neon,
&vpx_idct8x8_64_add_neon,
0, VPX_BITS_8)));
INSTANTIATE_TEST_SUITE_P(NEON, FwdTrans8x8DCT,
::testing::Values(make_tuple(&vpx_fdct8x8_neon,
&vpx_idct8x8_64_add_neon,
0, VPX_BITS_8)));
#if !CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
NEON, FwdTrans8x8HT,
::testing::Values(
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_neon, 0, VPX_BITS_8),
@ -689,11 +692,11 @@ INSTANTIATE_TEST_CASE_P(
#endif // HAVE_NEON && !CONFIG_EMULATE_HARDWARE
#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P(SSE2, FwdTrans8x8DCT,
::testing::Values(make_tuple(&vpx_fdct8x8_sse2,
&vpx_idct8x8_64_add_sse2,
0, VPX_BITS_8)));
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(SSE2, FwdTrans8x8DCT,
::testing::Values(make_tuple(&vpx_fdct8x8_sse2,
&vpx_idct8x8_64_add_sse2,
0, VPX_BITS_8)));
INSTANTIATE_TEST_SUITE_P(
SSE2, FwdTrans8x8HT,
::testing::Values(
make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_sse2, 0, VPX_BITS_8),
@ -703,7 +706,7 @@ INSTANTIATE_TEST_CASE_P(
#endif // HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
#if HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSE2, FwdTrans8x8DCT,
::testing::Values(make_tuple(&vpx_fdct8x8_sse2, &vpx_idct8x8_64_add_c, 0,
VPX_BITS_8),
@ -716,7 +719,7 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(&vpx_highbd_fdct8x8_sse2,
&idct8x8_64_add_12_sse2, 12, VPX_BITS_12)));
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSE2, FwdTrans8x8HT,
::testing::Values(
make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_c, 0, VPX_BITS_8),
@ -726,7 +729,7 @@ INSTANTIATE_TEST_CASE_P(
// Optimizations take effect at a threshold of 6201, so we use a value close to
// that to test both branches.
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSE2, InvTrans8x8DCT,
::testing::Values(
make_tuple(&idct8x8_12_add_10_c, &idct8x8_12_add_10_sse2, 6225,
@ -739,18 +742,18 @@ INSTANTIATE_TEST_CASE_P(
#if HAVE_SSSE3 && VPX_ARCH_X86_64 && !CONFIG_VP9_HIGHBITDEPTH && \
!CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P(SSSE3, FwdTrans8x8DCT,
::testing::Values(make_tuple(&vpx_fdct8x8_ssse3,
&vpx_idct8x8_64_add_sse2,
0, VPX_BITS_8)));
INSTANTIATE_TEST_SUITE_P(SSSE3, FwdTrans8x8DCT,
::testing::Values(make_tuple(&vpx_fdct8x8_ssse3,
&vpx_idct8x8_64_add_sse2,
0, VPX_BITS_8)));
#endif
#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P(MSA, FwdTrans8x8DCT,
::testing::Values(make_tuple(&vpx_fdct8x8_msa,
&vpx_idct8x8_64_add_msa, 0,
VPX_BITS_8)));
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(MSA, FwdTrans8x8DCT,
::testing::Values(make_tuple(&vpx_fdct8x8_msa,
&vpx_idct8x8_64_add_msa,
0, VPX_BITS_8)));
INSTANTIATE_TEST_SUITE_P(
MSA, FwdTrans8x8HT,
::testing::Values(
make_tuple(&vp9_fht8x8_msa, &vp9_iht8x8_64_add_msa, 0, VPX_BITS_8),
@ -760,9 +763,9 @@ INSTANTIATE_TEST_CASE_P(
#endif // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
#if HAVE_VSX && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P(VSX, FwdTrans8x8DCT,
::testing::Values(make_tuple(&vpx_fdct8x8_c,
&vpx_idct8x8_64_add_vsx, 0,
VPX_BITS_8)));
INSTANTIATE_TEST_SUITE_P(VSX, FwdTrans8x8DCT,
::testing::Values(make_tuple(&vpx_fdct8x8_c,
&vpx_idct8x8_64_add_vsx,
0, VPX_BITS_8)));
#endif // HAVE_VSX && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
} // namespace

Просмотреть файл

@ -7,12 +7,73 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include <memory>
#include "third_party/googletest/src/include/gtest/gtest.h"
#include "test/codec_factory.h"
#include "test/register_state_check.h"
#include "test/video_source.h"
namespace {
class EncoderWithExpectedError : public ::libvpx_test::Encoder {
public:
EncoderWithExpectedError(vpx_codec_enc_cfg_t cfg,
unsigned long deadline, // NOLINT
const unsigned long init_flags, // NOLINT
::libvpx_test::TwopassStatsStore *stats)
: ::libvpx_test::Encoder(cfg, deadline, init_flags, stats) {}
// This overrides with expected error code.
void EncodeFrame(::libvpx_test::VideoSource *video,
const unsigned long frame_flags, // NOLINT
const vpx_codec_err_t expected_err) {
if (video->img()) {
EncodeFrameInternal(*video, frame_flags, expected_err);
} else {
Flush();
}
// Handle twopass stats
::libvpx_test::CxDataIterator iter = GetCxData();
while (const vpx_codec_cx_pkt_t *pkt = iter.Next()) {
if (pkt->kind != VPX_CODEC_STATS_PKT) continue;
stats_->Append(*pkt);
}
}
protected:
void EncodeFrameInternal(const ::libvpx_test::VideoSource &video,
const unsigned long frame_flags, // NOLINT
const vpx_codec_err_t expected_err) {
vpx_codec_err_t res;
const vpx_image_t *img = video.img();
// Handle frame resizing
if (cfg_.g_w != img->d_w || cfg_.g_h != img->d_h) {
cfg_.g_w = img->d_w;
cfg_.g_h = img->d_h;
res = vpx_codec_enc_config_set(&encoder_, &cfg_);
ASSERT_EQ(res, VPX_CODEC_OK) << EncoderError();
}
// Encode the frame
API_REGISTER_STATE_CHECK(res = vpx_codec_encode(&encoder_, img, video.pts(),
video.duration(),
frame_flags, deadline_));
ASSERT_EQ(expected_err, res) << EncoderError();
}
virtual vpx_codec_iface_t *CodecInterface() const {
#if CONFIG_VP9_ENCODER
return &vpx_codec_vp9_cx_algo;
#else
return nullptr;
#endif
}
};
class VP9FrameSizeTestsLarge : public ::libvpx_test::EncoderTest,
public ::testing::Test {
protected:
@ -43,7 +104,67 @@ class VP9FrameSizeTestsLarge : public ::libvpx_test::EncoderTest,
}
}
int expected_res_;
using ::libvpx_test::EncoderTest::RunLoop;
virtual void RunLoop(::libvpx_test::VideoSource *video,
const vpx_codec_err_t expected_err) {
stats_.Reset();
ASSERT_TRUE(passes_ == 1 || passes_ == 2);
for (unsigned int pass = 0; pass < passes_; pass++) {
last_pts_ = 0;
if (passes_ == 1) {
cfg_.g_pass = VPX_RC_ONE_PASS;
} else if (pass == 0) {
cfg_.g_pass = VPX_RC_FIRST_PASS;
} else {
cfg_.g_pass = VPX_RC_LAST_PASS;
}
BeginPassHook(pass);
std::unique_ptr<EncoderWithExpectedError> encoder(
new EncoderWithExpectedError(cfg_, deadline_, init_flags_, &stats_));
ASSERT_NE(encoder.get(), nullptr);
ASSERT_NO_FATAL_FAILURE(video->Begin());
encoder->InitEncoder(video);
ASSERT_FALSE(::testing::Test::HasFatalFailure());
for (bool again = true; again; video->Next()) {
again = (video->img() != nullptr);
PreEncodeFrameHook(video, encoder.get());
encoder->EncodeFrame(video, frame_flags_, expected_err);
PostEncodeFrameHook(encoder.get());
::libvpx_test::CxDataIterator iter = encoder->GetCxData();
while (const vpx_codec_cx_pkt_t *pkt = iter.Next()) {
pkt = MutateEncoderOutputHook(pkt);
again = true;
switch (pkt->kind) {
case VPX_CODEC_CX_FRAME_PKT:
ASSERT_GE(pkt->data.frame.pts, last_pts_);
last_pts_ = pkt->data.frame.pts;
FramePktHook(pkt);
break;
case VPX_CODEC_PSNR_PKT: PSNRPktHook(pkt); break;
case VPX_CODEC_STATS_PKT: StatsPktHook(pkt); break;
default: break;
}
}
if (!Continue()) break;
}
EndPassHook();
if (!Continue()) break;
}
}
vpx_codec_err_t expected_res_;
};
TEST_F(VP9FrameSizeTestsLarge, TestInvalidSizes) {
@ -52,8 +173,8 @@ TEST_F(VP9FrameSizeTestsLarge, TestInvalidSizes) {
#if CONFIG_SIZE_LIMIT
video.SetSize(DECODE_WIDTH_LIMIT + 16, DECODE_HEIGHT_LIMIT + 16);
video.set_limit(2);
expected_res_ = VPX_CODEC_CORRUPT_FRAME;
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
expected_res_ = VPX_CODEC_MEM_ERROR;
ASSERT_NO_FATAL_FAILURE(RunLoop(&video, expected_res_));
#endif
}
@ -64,7 +185,7 @@ TEST_F(VP9FrameSizeTestsLarge, ValidSizes) {
video.SetSize(DECODE_WIDTH_LIMIT, DECODE_HEIGHT_LIMIT);
video.set_limit(2);
expected_res_ = VPX_CODEC_OK;
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
ASSERT_NO_FATAL_FAILURE(::libvpx_test::EncoderTest::RunLoop(&video));
#else
// This test produces a pretty large single frame allocation, (roughly
// 25 megabits). The encoder allocates a good number of these frames
@ -80,7 +201,7 @@ TEST_F(VP9FrameSizeTestsLarge, ValidSizes) {
#endif
video.set_limit(2);
expected_res_ = VPX_CODEC_OK;
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
ASSERT_NO_FATAL_FAILURE(::libvpx_test::EncoderTest::RunLoop(&video));
#endif
}
@ -90,6 +211,6 @@ TEST_F(VP9FrameSizeTestsLarge, OneByOneVideo) {
video.SetSize(1, 1);
video.set_limit(2);
expected_res_ = VPX_CODEC_OK;
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
ASSERT_NO_FATAL_FAILURE(::libvpx_test::EncoderTest::RunLoop(&video));
}
} // namespace

Просмотреть файл

@ -233,14 +233,14 @@ TEST_P(HadamardLowbdTest, DISABLED_Speed) {
SpeedTest(10000000);
}
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
C, HadamardLowbdTest,
::testing::Values(HadamardFuncWithSize(&vpx_hadamard_8x8_c, 8),
HadamardFuncWithSize(&vpx_hadamard_16x16_c, 16),
HadamardFuncWithSize(&vpx_hadamard_32x32_c, 32)));
#if HAVE_SSE2
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSE2, HadamardLowbdTest,
::testing::Values(HadamardFuncWithSize(&vpx_hadamard_8x8_sse2, 8),
HadamardFuncWithSize(&vpx_hadamard_16x16_sse2, 16),
@ -248,20 +248,20 @@ INSTANTIATE_TEST_CASE_P(
#endif // HAVE_SSE2
#if HAVE_AVX2
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
AVX2, HadamardLowbdTest,
::testing::Values(HadamardFuncWithSize(&vpx_hadamard_16x16_avx2, 16),
HadamardFuncWithSize(&vpx_hadamard_32x32_avx2, 32)));
#endif // HAVE_AVX2
#if HAVE_SSSE3 && VPX_ARCH_X86_64
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSSE3, HadamardLowbdTest,
::testing::Values(HadamardFuncWithSize(&vpx_hadamard_8x8_ssse3, 8)));
#endif // HAVE_SSSE3 && VPX_ARCH_X86_64
#if HAVE_NEON
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
NEON, HadamardLowbdTest,
::testing::Values(HadamardFuncWithSize(&vpx_hadamard_8x8_neon, 8),
HadamardFuncWithSize(&vpx_hadamard_16x16_neon, 16)));
@ -271,7 +271,7 @@ INSTANTIATE_TEST_CASE_P(
// in place and turn on the unit test.
#if !CONFIG_VP9_HIGHBITDEPTH
#if HAVE_MSA
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
MSA, HadamardLowbdTest,
::testing::Values(HadamardFuncWithSize(&vpx_hadamard_8x8_msa, 8),
HadamardFuncWithSize(&vpx_hadamard_16x16_msa, 16)));
@ -279,7 +279,7 @@ INSTANTIATE_TEST_CASE_P(
#endif // !CONFIG_VP9_HIGHBITDEPTH
#if HAVE_VSX
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
VSX, HadamardLowbdTest,
::testing::Values(HadamardFuncWithSize(&vpx_hadamard_8x8_vsx, 8),
HadamardFuncWithSize(&vpx_hadamard_16x16_vsx, 16)));
@ -301,14 +301,14 @@ TEST_P(HadamardHighbdTest, DISABLED_Speed) {
SpeedTest(10000000);
}
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
C, HadamardHighbdTest,
::testing::Values(HadamardFuncWithSize(&vpx_highbd_hadamard_8x8_c, 8),
HadamardFuncWithSize(&vpx_highbd_hadamard_16x16_c, 16),
HadamardFuncWithSize(&vpx_highbd_hadamard_32x32_c, 32)));
#if HAVE_AVX2
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
AVX2, HadamardHighbdTest,
::testing::Values(HadamardFuncWithSize(&vpx_highbd_hadamard_8x8_avx2, 8),
HadamardFuncWithSize(&vpx_highbd_hadamard_16x16_avx2, 16),

Просмотреть файл

@ -31,13 +31,13 @@ class IDCTTest : public ::testing::TestWithParam<IdctFunc> {
UUT = GetParam();
input = new Buffer<int16_t>(4, 4, 0);
ASSERT_TRUE(input != NULL);
ASSERT_NE(input, nullptr);
ASSERT_TRUE(input->Init());
predict = new Buffer<uint8_t>(4, 4, 3);
ASSERT_TRUE(predict != NULL);
ASSERT_NE(predict, nullptr);
ASSERT_TRUE(predict->Init());
output = new Buffer<uint8_t>(4, 4, 3);
ASSERT_TRUE(output != NULL);
ASSERT_NE(output, nullptr);
ASSERT_TRUE(output->Init());
}
@ -72,7 +72,7 @@ TEST_P(IDCTTest, TestAllZeros) {
TEST_P(IDCTTest, TestAllOnes) {
input->Set(0);
ASSERT_TRUE(input->TopLeftPixel() != NULL);
ASSERT_NE(input->TopLeftPixel(), nullptr);
// When the first element is '4' it will fill the output buffer with '1'.
input->TopLeftPixel()[0] = 4;
predict->Set(0);
@ -90,7 +90,7 @@ TEST_P(IDCTTest, TestAddOne) {
// Set the transform output to '1' and make sure it gets added to the
// prediction buffer.
input->Set(0);
ASSERT_TRUE(input->TopLeftPixel() != NULL);
ASSERT_NE(input->TopLeftPixel(), nullptr);
input->TopLeftPixel()[0] = 4;
output->Set(0);
@ -155,25 +155,26 @@ TEST_P(IDCTTest, TestWithData) {
ASSERT_TRUE(output->CheckPadding());
}
INSTANTIATE_TEST_CASE_P(C, IDCTTest, ::testing::Values(vp8_short_idct4x4llm_c));
INSTANTIATE_TEST_SUITE_P(C, IDCTTest,
::testing::Values(vp8_short_idct4x4llm_c));
#if HAVE_NEON
INSTANTIATE_TEST_CASE_P(NEON, IDCTTest,
::testing::Values(vp8_short_idct4x4llm_neon));
INSTANTIATE_TEST_SUITE_P(NEON, IDCTTest,
::testing::Values(vp8_short_idct4x4llm_neon));
#endif // HAVE_NEON
#if HAVE_MMX
INSTANTIATE_TEST_CASE_P(MMX, IDCTTest,
::testing::Values(vp8_short_idct4x4llm_mmx));
INSTANTIATE_TEST_SUITE_P(MMX, IDCTTest,
::testing::Values(vp8_short_idct4x4llm_mmx));
#endif // HAVE_MMX
#if HAVE_MSA
INSTANTIATE_TEST_CASE_P(MSA, IDCTTest,
::testing::Values(vp8_short_idct4x4llm_msa));
INSTANTIATE_TEST_SUITE_P(MSA, IDCTTest,
::testing::Values(vp8_short_idct4x4llm_msa));
#endif // HAVE_MSA
#if HAVE_MMI
INSTANTIATE_TEST_CASE_P(MMI, IDCTTest,
::testing::Values(vp8_short_idct4x4llm_mmi));
INSTANTIATE_TEST_SUITE_P(MMI, IDCTTest,
::testing::Values(vp8_short_idct4x4llm_mmi));
#endif // HAVE_MMI
} // namespace

Просмотреть файл

@ -38,15 +38,15 @@ std::ostream &operator<<(std::ostream &os, const DecodeParam &dp) {
class InvalidFileTest : public ::libvpx_test::DecoderTest,
public ::libvpx_test::CodecTestWithParam<DecodeParam> {
protected:
InvalidFileTest() : DecoderTest(GET_PARAM(0)), res_file_(NULL) {}
InvalidFileTest() : DecoderTest(GET_PARAM(0)), res_file_(nullptr) {}
virtual ~InvalidFileTest() {
if (res_file_ != NULL) fclose(res_file_);
if (res_file_ != nullptr) fclose(res_file_);
}
void OpenResFile(const std::string &res_file_name_) {
res_file_ = libvpx_test::OpenTestDataFile(res_file_name_);
ASSERT_TRUE(res_file_ != NULL)
ASSERT_NE(res_file_, nullptr)
<< "Result file open failed. Filename: " << res_file_name_;
}
@ -54,7 +54,7 @@ class InvalidFileTest : public ::libvpx_test::DecoderTest,
const vpx_codec_err_t res_dec,
const libvpx_test::CompressedVideoSource &video,
libvpx_test::Decoder *decoder) {
EXPECT_TRUE(res_file_ != NULL);
EXPECT_NE(res_file_, nullptr);
int expected_res_dec;
// Read integer result.
@ -102,7 +102,7 @@ class InvalidFileTest : public ::libvpx_test::DecoderTest,
return;
#endif
}
ASSERT_TRUE(video.get() != NULL);
ASSERT_NE(video.get(), nullptr);
video->Init();
// Construct result file name. The file holds a list of expected integer
@ -124,12 +124,13 @@ TEST_P(InvalidFileTest, ReturnCode) { RunTest(); }
#if CONFIG_VP8_DECODER
const DecodeParam kVP8InvalidFileTests[] = {
{ 1, "invalid-bug-1443.ivf" },
{ 1, "invalid-bug-148271109.ivf" },
{ 1, "invalid-token-partition.ivf" },
{ 1, "invalid-vp80-00-comprehensive-s17661_r01-05_b6-.ivf" },
};
VP8_INSTANTIATE_TEST_CASE(InvalidFileTest,
::testing::ValuesIn(kVP8InvalidFileTests));
VP8_INSTANTIATE_TEST_SUITE(InvalidFileTest,
::testing::ValuesIn(kVP8InvalidFileTests));
#endif // CONFIG_VP8_DECODER
#if CONFIG_VP9_DECODER
@ -162,8 +163,8 @@ const DecodeParam kVP9InvalidFileTests[] = {
{ 1, "invalid-crbug-667044.webm" },
};
VP9_INSTANTIATE_TEST_CASE(InvalidFileTest,
::testing::ValuesIn(kVP9InvalidFileTests));
VP9_INSTANTIATE_TEST_SUITE(InvalidFileTest,
::testing::ValuesIn(kVP9InvalidFileTests));
#endif // CONFIG_VP9_DECODER
// This class will include test vectors that are expected to fail
@ -183,8 +184,8 @@ const DecodeParam kVP8InvalidPeekTests[] = {
{ 1, "invalid-vp80-00-comprehensive-018.ivf.2kf_0x6.ivf" },
};
VP8_INSTANTIATE_TEST_CASE(InvalidFileInvalidPeekTest,
::testing::ValuesIn(kVP8InvalidPeekTests));
VP8_INSTANTIATE_TEST_SUITE(InvalidFileInvalidPeekTest,
::testing::ValuesIn(kVP8InvalidPeekTests));
#endif // CONFIG_VP8_DECODER
#if CONFIG_VP9_DECODER
@ -192,8 +193,9 @@ const DecodeParam kVP9InvalidFileInvalidPeekTests[] = {
{ 1, "invalid-vp90-01-v3.webm" },
};
VP9_INSTANTIATE_TEST_CASE(InvalidFileInvalidPeekTest,
::testing::ValuesIn(kVP9InvalidFileInvalidPeekTests));
VP9_INSTANTIATE_TEST_SUITE(
InvalidFileInvalidPeekTest,
::testing::ValuesIn(kVP9InvalidFileInvalidPeekTests));
const DecodeParam kMultiThreadedVP9InvalidFileTests[] = {
{ 4, "invalid-vp90-2-08-tile_1x4_frame_parallel_all_key.webm" },
@ -209,7 +211,7 @@ const DecodeParam kMultiThreadedVP9InvalidFileTests[] = {
{ 4, "invalid-crbug-1562.ivf" },
};
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
VP9MultiThreaded, InvalidFileTest,
::testing::Combine(
::testing::Values(

Просмотреть файл

@ -145,5 +145,5 @@ TEST_P(KeyframeTest, TestAutoKeyframe) {
}
}
VP8_INSTANTIATE_TEST_CASE(KeyframeTest, ALL_TEST_MODES);
VP8_INSTANTIATE_TEST_SUITE(KeyframeTest, ALL_TEST_MODES);
} // namespace

Просмотреть файл

@ -140,8 +140,8 @@ TEST_P(LevelTest, TestTargetLevelApi) {
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&enc));
}
VP9_INSTANTIATE_TEST_CASE(LevelTest,
::testing::Values(::libvpx_test::kTwoPassGood,
::libvpx_test::kOnePassGood),
::testing::Range(0, 9));
VP9_INSTANTIATE_TEST_SUITE(LevelTest,
::testing::Values(::libvpx_test::kTwoPassGood,
::libvpx_test::kOnePassGood),
::testing::Range(0, 9));
} // namespace

Просмотреть файл

@ -145,7 +145,10 @@ class Loop8Test6Param : public ::testing::TestWithParam<loop8_param_t> {
loop_op_t loopfilter_op_;
loop_op_t ref_loopfilter_op_;
};
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(Loop8Test6Param);
#if HAVE_NEON || HAVE_SSE2 || \
(HAVE_DSPR2 || HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH)
class Loop8Test9Param : public ::testing::TestWithParam<dualloop8_param_t> {
public:
virtual ~Loop8Test9Param() {}
@ -164,6 +167,9 @@ class Loop8Test9Param : public ::testing::TestWithParam<dualloop8_param_t> {
dual_loop_op_t loopfilter_op_;
dual_loop_op_t ref_loopfilter_op_;
};
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(Loop8Test9Param);
#endif // HAVE_NEON || HAVE_SSE2 || (HAVE_DSPR2 || HAVE_MSA &&
// (!CONFIG_VP9_HIGHBITDEPTH))
TEST_P(Loop8Test6Param, OperationCheck) {
ACMRandom rnd(ACMRandom::DeterministicSeed());
@ -275,6 +281,8 @@ TEST_P(Loop8Test6Param, ValueCheck) {
<< "First failed at test case " << first_failure;
}
#if HAVE_NEON || HAVE_SSE2 || \
(HAVE_DSPR2 || HAVE_MSA && (!CONFIG_VP9_HIGHBITDEPTH))
TEST_P(Loop8Test9Param, OperationCheck) {
ACMRandom rnd(ACMRandom::DeterministicSeed());
const int count_test_block = number_of_iterations;
@ -402,12 +410,14 @@ TEST_P(Loop8Test9Param, ValueCheck) {
"loopfilter output. "
<< "First failed at test case " << first_failure;
}
#endif // HAVE_NEON || HAVE_SSE2 || (HAVE_DSPR2 || HAVE_MSA &&
// (!CONFIG_VP9_HIGHBITDEPTH))
using std::make_tuple;
#if HAVE_SSE2
#if CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSE2, Loop8Test6Param,
::testing::Values(make_tuple(&vpx_highbd_lpf_horizontal_4_sse2,
&vpx_highbd_lpf_horizontal_4_c, 8),
@ -458,7 +468,7 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(&vpx_highbd_lpf_vertical_16_dual_sse2,
&vpx_highbd_lpf_vertical_16_dual_c, 12)));
#else
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSE2, Loop8Test6Param,
::testing::Values(
make_tuple(&vpx_lpf_horizontal_4_sse2, &vpx_lpf_horizontal_4_c, 8),
@ -475,7 +485,7 @@ INSTANTIATE_TEST_CASE_P(
#endif
#if HAVE_AVX2 && (!CONFIG_VP9_HIGHBITDEPTH)
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
AVX2, Loop8Test6Param,
::testing::Values(make_tuple(&vpx_lpf_horizontal_16_avx2,
&vpx_lpf_horizontal_16_c, 8),
@ -485,7 +495,7 @@ INSTANTIATE_TEST_CASE_P(
#if HAVE_SSE2
#if CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSE2, Loop8Test9Param,
::testing::Values(make_tuple(&vpx_highbd_lpf_horizontal_4_dual_sse2,
&vpx_highbd_lpf_horizontal_4_dual_c, 8),
@ -512,7 +522,7 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(&vpx_highbd_lpf_vertical_8_dual_sse2,
&vpx_highbd_lpf_vertical_8_dual_c, 12)));
#else
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSE2, Loop8Test9Param,
::testing::Values(make_tuple(&vpx_lpf_horizontal_4_dual_sse2,
&vpx_lpf_horizontal_4_dual_c, 8),
@ -527,7 +537,7 @@ INSTANTIATE_TEST_CASE_P(
#if HAVE_NEON
#if CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
NEON, Loop8Test6Param,
::testing::Values(make_tuple(&vpx_highbd_lpf_horizontal_4_neon,
&vpx_highbd_lpf_horizontal_4_c, 8),
@ -577,7 +587,7 @@ INSTANTIATE_TEST_CASE_P(
&vpx_highbd_lpf_vertical_16_dual_c, 10),
make_tuple(&vpx_highbd_lpf_vertical_16_dual_neon,
&vpx_highbd_lpf_vertical_16_dual_c, 12)));
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
NEON, Loop8Test9Param,
::testing::Values(make_tuple(&vpx_highbd_lpf_horizontal_4_dual_neon,
&vpx_highbd_lpf_horizontal_4_dual_c, 8),
@ -604,7 +614,7 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(&vpx_highbd_lpf_vertical_8_dual_neon,
&vpx_highbd_lpf_vertical_8_dual_c, 12)));
#else
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
NEON, Loop8Test6Param,
::testing::Values(
make_tuple(&vpx_lpf_horizontal_16_neon, &vpx_lpf_horizontal_16_c, 8),
@ -617,7 +627,7 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(&vpx_lpf_vertical_8_neon, &vpx_lpf_vertical_8_c, 8),
make_tuple(&vpx_lpf_horizontal_4_neon, &vpx_lpf_horizontal_4_c, 8),
make_tuple(&vpx_lpf_vertical_4_neon, &vpx_lpf_vertical_4_c, 8)));
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
NEON, Loop8Test9Param,
::testing::Values(make_tuple(&vpx_lpf_horizontal_8_dual_neon,
&vpx_lpf_horizontal_8_dual_c, 8),
@ -631,7 +641,7 @@ INSTANTIATE_TEST_CASE_P(
#endif // HAVE_NEON
#if HAVE_DSPR2 && !CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
DSPR2, Loop8Test6Param,
::testing::Values(
make_tuple(&vpx_lpf_horizontal_4_dspr2, &vpx_lpf_horizontal_4_c, 8),
@ -645,7 +655,7 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(&vpx_lpf_vertical_16_dual_dspr2, &vpx_lpf_vertical_16_dual_c,
8)));
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
DSPR2, Loop8Test9Param,
::testing::Values(make_tuple(&vpx_lpf_horizontal_4_dual_dspr2,
&vpx_lpf_horizontal_4_dual_c, 8),
@ -658,7 +668,7 @@ INSTANTIATE_TEST_CASE_P(
#endif // HAVE_DSPR2 && !CONFIG_VP9_HIGHBITDEPTH
#if HAVE_MSA && (!CONFIG_VP9_HIGHBITDEPTH)
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
MSA, Loop8Test6Param,
::testing::Values(
make_tuple(&vpx_lpf_horizontal_4_msa, &vpx_lpf_horizontal_4_c, 8),
@ -670,7 +680,7 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(&vpx_lpf_vertical_8_msa, &vpx_lpf_vertical_8_c, 8),
make_tuple(&vpx_lpf_vertical_16_msa, &vpx_lpf_vertical_16_c, 8)));
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
MSA, Loop8Test9Param,
::testing::Values(make_tuple(&vpx_lpf_horizontal_4_dual_msa,
&vpx_lpf_horizontal_4_dual_c, 8),

Просмотреть файл

@ -115,21 +115,21 @@ TEST_P(MinMaxTest, CompareReferenceAndVaryStride) {
}
}
INSTANTIATE_TEST_CASE_P(C, MinMaxTest, ::testing::Values(&vpx_minmax_8x8_c));
INSTANTIATE_TEST_SUITE_P(C, MinMaxTest, ::testing::Values(&vpx_minmax_8x8_c));
#if HAVE_SSE2
INSTANTIATE_TEST_CASE_P(SSE2, MinMaxTest,
::testing::Values(&vpx_minmax_8x8_sse2));
INSTANTIATE_TEST_SUITE_P(SSE2, MinMaxTest,
::testing::Values(&vpx_minmax_8x8_sse2));
#endif
#if HAVE_NEON
INSTANTIATE_TEST_CASE_P(NEON, MinMaxTest,
::testing::Values(&vpx_minmax_8x8_neon));
INSTANTIATE_TEST_SUITE_P(NEON, MinMaxTest,
::testing::Values(&vpx_minmax_8x8_neon));
#endif
#if HAVE_MSA
INSTANTIATE_TEST_CASE_P(MSA, MinMaxTest,
::testing::Values(&vpx_minmax_8x8_msa));
INSTANTIATE_TEST_SUITE_P(MSA, MinMaxTest,
::testing::Values(&vpx_minmax_8x8_msa));
#endif
} // namespace

Просмотреть файл

@ -129,11 +129,11 @@ TEST(non_greedy_mv, smooth_mf) {
const char *ground_truth_file =
"non_greedy_mv_test_files/ground_truth_16x16.txt";
BLOCK_SIZE bsize = BLOCK_32X32;
MV *search_mf = NULL;
MV *smooth_mf = NULL;
MV *estimation = NULL;
MV *ground_truth = NULL;
int(*local_var)[MF_LOCAL_STRUCTURE_SIZE] = NULL;
MV *search_mf = nullptr;
MV *smooth_mf = nullptr;
MV *estimation = nullptr;
MV *ground_truth = nullptr;
int(*local_var)[MF_LOCAL_STRUCTURE_SIZE] = nullptr;
int rows = 0, cols = 0;
int alpha = 100, max_iter = 100;
@ -169,8 +169,8 @@ TEST(non_greedy_mv, local_var) {
const char *gt_local_var_file = "non_greedy_mv_test_files/localVar_16x16.txt";
const char *search_mf_file = "non_greedy_mv_test_files/exhaust_16x16.txt";
BLOCK_SIZE bsize = BLOCK_16X16;
int(*gt_local_var)[MF_LOCAL_STRUCTURE_SIZE] = NULL;
int(*est_local_var)[MF_LOCAL_STRUCTURE_SIZE] = NULL;
int(*gt_local_var)[MF_LOCAL_STRUCTURE_SIZE] = nullptr;
int(*est_local_var)[MF_LOCAL_STRUCTURE_SIZE] = nullptr;
YV12_BUFFER_CONFIG ref_frame, cur_frame;
int rows, cols;
MV *search_mf;

Просмотреть файл

@ -102,11 +102,11 @@ class PartialIDctTest : public ::testing::TestWithParam<PartialInvTxfmParam> {
virtual void TearDown() {
vpx_free(input_block_);
input_block_ = NULL;
input_block_ = nullptr;
vpx_free(output_block_);
output_block_ = NULL;
output_block_ = nullptr;
vpx_free(output_block_ref_);
output_block_ref_ = NULL;
output_block_ref_ = nullptr;
libvpx_test::ClearSystemState();
}
@ -474,8 +474,8 @@ const PartialInvTxfmParam c_partial_idct_tests[] = {
&wrapper<vpx_idct4x4_1_add_c>, TX_4X4, 1, 8, 1)
};
INSTANTIATE_TEST_CASE_P(C, PartialIDctTest,
::testing::ValuesIn(c_partial_idct_tests));
INSTANTIATE_TEST_SUITE_P(C, PartialIDctTest,
::testing::ValuesIn(c_partial_idct_tests));
#if !CONFIG_EMULATE_HARDWARE
@ -625,8 +625,8 @@ const PartialInvTxfmParam neon_partial_idct_tests[] = {
&wrapper<vpx_idct4x4_1_add_neon>, TX_4X4, 1, 8, 1)
};
INSTANTIATE_TEST_CASE_P(NEON, PartialIDctTest,
::testing::ValuesIn(neon_partial_idct_tests));
INSTANTIATE_TEST_SUITE_P(NEON, PartialIDctTest,
::testing::ValuesIn(neon_partial_idct_tests));
#endif // HAVE_NEON
#if HAVE_SSE2
@ -776,8 +776,8 @@ const PartialInvTxfmParam sse2_partial_idct_tests[] = {
&wrapper<vpx_idct4x4_1_add_sse2>, TX_4X4, 1, 8, 1)
};
INSTANTIATE_TEST_CASE_P(SSE2, PartialIDctTest,
::testing::ValuesIn(sse2_partial_idct_tests));
INSTANTIATE_TEST_SUITE_P(SSE2, PartialIDctTest,
::testing::ValuesIn(sse2_partial_idct_tests));
#endif // HAVE_SSE2
@ -791,8 +791,8 @@ const PartialInvTxfmParam ssse3_partial_idct_tests[] = {
&wrapper<vpx_idct8x8_12_add_ssse3>, TX_8X8, 12, 8, 1)
};
INSTANTIATE_TEST_CASE_P(SSSE3, PartialIDctTest,
::testing::ValuesIn(ssse3_partial_idct_tests));
INSTANTIATE_TEST_SUITE_P(SSSE3, PartialIDctTest,
::testing::ValuesIn(ssse3_partial_idct_tests));
#endif // HAVE_SSSE3
#if HAVE_SSE4_1 && CONFIG_VP9_HIGHBITDEPTH
@ -889,8 +889,8 @@ const PartialInvTxfmParam sse4_1_partial_idct_tests[] = {
&highbd_wrapper<vpx_highbd_idct4x4_16_add_sse4_1>, TX_4X4, 16, 12, 2)
};
INSTANTIATE_TEST_CASE_P(SSE4_1, PartialIDctTest,
::testing::ValuesIn(sse4_1_partial_idct_tests));
INSTANTIATE_TEST_SUITE_P(SSE4_1, PartialIDctTest,
::testing::ValuesIn(sse4_1_partial_idct_tests));
#endif // HAVE_SSE4_1 && CONFIG_VP9_HIGHBITDEPTH
#if HAVE_DSPR2 && !CONFIG_VP9_HIGHBITDEPTH
@ -919,8 +919,8 @@ const PartialInvTxfmParam dspr2_partial_idct_tests[] = {
&wrapper<vpx_idct4x4_1_add_dspr2>, TX_4X4, 1, 8, 1)
};
INSTANTIATE_TEST_CASE_P(DSPR2, PartialIDctTest,
::testing::ValuesIn(dspr2_partial_idct_tests));
INSTANTIATE_TEST_SUITE_P(DSPR2, PartialIDctTest,
::testing::ValuesIn(dspr2_partial_idct_tests));
#endif // HAVE_DSPR2 && !CONFIG_VP9_HIGHBITDEPTH
#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH
@ -950,8 +950,8 @@ const PartialInvTxfmParam msa_partial_idct_tests[] = {
&wrapper<vpx_idct4x4_1_add_msa>, TX_4X4, 1, 8, 1)
};
INSTANTIATE_TEST_CASE_P(MSA, PartialIDctTest,
::testing::ValuesIn(msa_partial_idct_tests));
INSTANTIATE_TEST_SUITE_P(MSA, PartialIDctTest,
::testing::ValuesIn(msa_partial_idct_tests));
#endif // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH
#endif // !CONFIG_EMULATE_HARDWARE

Просмотреть файл

@ -38,7 +38,7 @@ postproc() {
fi
eval "${VPX_TEST_PREFIX}" "${decoder}" "${input_file}" "${output_file}" \
${devnull}
${devnull} || return 1
[ -e "${output_file}" ] || return 1
}

Просмотреть файл

@ -459,7 +459,7 @@ TEST_P(VpxMbPostProcDownTest, CheckLowFilterOutput) {
SetRows(src_c_.TopLeftPixel(), rows_, cols_, src_c_.stride());
unsigned char *expected_output = new unsigned char[rows_ * cols_];
ASSERT_TRUE(expected_output != NULL);
ASSERT_NE(expected_output, nullptr);
SetRows(expected_output, rows_, cols_, cols_);
RunFilterLevel(src_c_.TopLeftPixel(), rows_, cols_, src_c_.stride(), q2mbl(0),
@ -511,62 +511,62 @@ TEST_P(VpxMbPostProcDownTest, DISABLED_Speed) {
PrintMedian("16x16");
}
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
C, VpxPostProcDownAndAcrossMbRowTest,
::testing::Values(vpx_post_proc_down_and_across_mb_row_c));
INSTANTIATE_TEST_CASE_P(C, VpxMbPostProcAcrossIpTest,
::testing::Values(vpx_mbpost_proc_across_ip_c));
INSTANTIATE_TEST_SUITE_P(C, VpxMbPostProcAcrossIpTest,
::testing::Values(vpx_mbpost_proc_across_ip_c));
INSTANTIATE_TEST_CASE_P(C, VpxMbPostProcDownTest,
::testing::Values(vpx_mbpost_proc_down_c));
INSTANTIATE_TEST_SUITE_P(C, VpxMbPostProcDownTest,
::testing::Values(vpx_mbpost_proc_down_c));
#if HAVE_SSE2
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSE2, VpxPostProcDownAndAcrossMbRowTest,
::testing::Values(vpx_post_proc_down_and_across_mb_row_sse2));
INSTANTIATE_TEST_CASE_P(SSE2, VpxMbPostProcAcrossIpTest,
::testing::Values(vpx_mbpost_proc_across_ip_sse2));
INSTANTIATE_TEST_SUITE_P(SSE2, VpxMbPostProcAcrossIpTest,
::testing::Values(vpx_mbpost_proc_across_ip_sse2));
INSTANTIATE_TEST_CASE_P(SSE2, VpxMbPostProcDownTest,
::testing::Values(vpx_mbpost_proc_down_sse2));
INSTANTIATE_TEST_SUITE_P(SSE2, VpxMbPostProcDownTest,
::testing::Values(vpx_mbpost_proc_down_sse2));
#endif // HAVE_SSE2
#if HAVE_NEON
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
NEON, VpxPostProcDownAndAcrossMbRowTest,
::testing::Values(vpx_post_proc_down_and_across_mb_row_neon));
INSTANTIATE_TEST_CASE_P(NEON, VpxMbPostProcAcrossIpTest,
::testing::Values(vpx_mbpost_proc_across_ip_neon));
INSTANTIATE_TEST_SUITE_P(NEON, VpxMbPostProcAcrossIpTest,
::testing::Values(vpx_mbpost_proc_across_ip_neon));
INSTANTIATE_TEST_CASE_P(NEON, VpxMbPostProcDownTest,
::testing::Values(vpx_mbpost_proc_down_neon));
INSTANTIATE_TEST_SUITE_P(NEON, VpxMbPostProcDownTest,
::testing::Values(vpx_mbpost_proc_down_neon));
#endif // HAVE_NEON
#if HAVE_MSA
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
MSA, VpxPostProcDownAndAcrossMbRowTest,
::testing::Values(vpx_post_proc_down_and_across_mb_row_msa));
INSTANTIATE_TEST_CASE_P(MSA, VpxMbPostProcAcrossIpTest,
::testing::Values(vpx_mbpost_proc_across_ip_msa));
INSTANTIATE_TEST_SUITE_P(MSA, VpxMbPostProcAcrossIpTest,
::testing::Values(vpx_mbpost_proc_across_ip_msa));
INSTANTIATE_TEST_CASE_P(MSA, VpxMbPostProcDownTest,
::testing::Values(vpx_mbpost_proc_down_msa));
INSTANTIATE_TEST_SUITE_P(MSA, VpxMbPostProcDownTest,
::testing::Values(vpx_mbpost_proc_down_msa));
#endif // HAVE_MSA
#if HAVE_VSX
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
VSX, VpxPostProcDownAndAcrossMbRowTest,
::testing::Values(vpx_post_proc_down_and_across_mb_row_vsx));
INSTANTIATE_TEST_CASE_P(VSX, VpxMbPostProcAcrossIpTest,
::testing::Values(vpx_mbpost_proc_across_ip_vsx));
INSTANTIATE_TEST_SUITE_P(VSX, VpxMbPostProcAcrossIpTest,
::testing::Values(vpx_mbpost_proc_across_ip_vsx));
INSTANTIATE_TEST_CASE_P(VSX, VpxMbPostProcDownTest,
::testing::Values(vpx_mbpost_proc_down_vsx));
INSTANTIATE_TEST_SUITE_P(VSX, VpxMbPostProcDownTest,
::testing::Values(vpx_mbpost_proc_down_vsx));
#endif // HAVE_VSX
} // namespace

Просмотреть файл

@ -41,11 +41,11 @@ class PredictTestBase : public AbstractBench,
public:
PredictTestBase()
: width_(GET_PARAM(0)), height_(GET_PARAM(1)), predict_(GET_PARAM(2)),
src_(NULL), padded_dst_(NULL), dst_(NULL), dst_c_(NULL) {}
src_(nullptr), padded_dst_(nullptr), dst_(nullptr), dst_c_(nullptr) {}
virtual void SetUp() {
src_ = new uint8_t[kSrcSize];
ASSERT_TRUE(src_ != NULL);
ASSERT_NE(src_, nullptr);
// padded_dst_ provides a buffer of kBorderSize around the destination
// memory to facilitate detecting out of bounds writes.
@ -53,11 +53,11 @@ class PredictTestBase : public AbstractBench,
padded_dst_size_ = dst_stride_ * (kBorderSize + height_ + kBorderSize);
padded_dst_ =
reinterpret_cast<uint8_t *>(vpx_memalign(16, padded_dst_size_));
ASSERT_TRUE(padded_dst_ != NULL);
ASSERT_NE(padded_dst_, nullptr);
dst_ = padded_dst_ + (kBorderSize * dst_stride_) + kBorderSize;
dst_c_ = new uint8_t[16 * 16];
ASSERT_TRUE(dst_c_ != NULL);
ASSERT_NE(dst_c_, nullptr);
memset(src_, 0, kSrcSize);
memset(padded_dst_, 128, padded_dst_size_);
@ -66,12 +66,12 @@ class PredictTestBase : public AbstractBench,
virtual void TearDown() {
delete[] src_;
src_ = NULL;
src_ = nullptr;
vpx_free(padded_dst_);
padded_dst_ = NULL;
dst_ = NULL;
padded_dst_ = nullptr;
dst_ = nullptr;
delete[] dst_c_;
dst_c_ = NULL;
dst_c_ = nullptr;
libvpx_test::ClearSystemState();
}
@ -298,14 +298,14 @@ TEST_P(SixtapPredictTest, TestWithPresetData) {
CompareBuffers(kExpectedDst, kExpectedDstStride, dst_, dst_stride_));
}
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
C, SixtapPredictTest,
::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_c),
make_tuple(8, 8, &vp8_sixtap_predict8x8_c),
make_tuple(8, 4, &vp8_sixtap_predict8x4_c),
make_tuple(4, 4, &vp8_sixtap_predict4x4_c)));
#if HAVE_NEON
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
NEON, SixtapPredictTest,
::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_neon),
make_tuple(8, 8, &vp8_sixtap_predict8x8_neon),
@ -313,19 +313,19 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(4, 4, &vp8_sixtap_predict4x4_neon)));
#endif
#if HAVE_MMX
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
MMX, SixtapPredictTest,
::testing::Values(make_tuple(4, 4, &vp8_sixtap_predict4x4_mmx)));
#endif
#if HAVE_SSE2
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSE2, SixtapPredictTest,
::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_sse2),
make_tuple(8, 8, &vp8_sixtap_predict8x8_sse2),
make_tuple(8, 4, &vp8_sixtap_predict8x4_sse2)));
#endif
#if HAVE_SSSE3
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSSE3, SixtapPredictTest,
::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_ssse3),
make_tuple(8, 8, &vp8_sixtap_predict8x8_ssse3),
@ -333,7 +333,7 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(4, 4, &vp8_sixtap_predict4x4_ssse3)));
#endif
#if HAVE_MSA
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
MSA, SixtapPredictTest,
::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_msa),
make_tuple(8, 8, &vp8_sixtap_predict8x8_msa),
@ -342,7 +342,7 @@ INSTANTIATE_TEST_CASE_P(
#endif
#if HAVE_MMI
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
MMI, SixtapPredictTest,
::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_mmi),
make_tuple(8, 8, &vp8_sixtap_predict8x8_mmi),
@ -367,14 +367,14 @@ TEST_P(BilinearPredictTest, DISABLED_Speed) {
PrintMedian(title);
}
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
C, BilinearPredictTest,
::testing::Values(make_tuple(16, 16, &vp8_bilinear_predict16x16_c),
make_tuple(8, 8, &vp8_bilinear_predict8x8_c),
make_tuple(8, 4, &vp8_bilinear_predict8x4_c),
make_tuple(4, 4, &vp8_bilinear_predict4x4_c)));
#if HAVE_NEON
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
NEON, BilinearPredictTest,
::testing::Values(make_tuple(16, 16, &vp8_bilinear_predict16x16_neon),
make_tuple(8, 8, &vp8_bilinear_predict8x8_neon),
@ -382,7 +382,7 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(4, 4, &vp8_bilinear_predict4x4_neon)));
#endif
#if HAVE_SSE2
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSE2, BilinearPredictTest,
::testing::Values(make_tuple(16, 16, &vp8_bilinear_predict16x16_sse2),
make_tuple(8, 8, &vp8_bilinear_predict8x8_sse2),
@ -390,13 +390,13 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(4, 4, &vp8_bilinear_predict4x4_sse2)));
#endif
#if HAVE_SSSE3
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSSE3, BilinearPredictTest,
::testing::Values(make_tuple(16, 16, &vp8_bilinear_predict16x16_ssse3),
make_tuple(8, 8, &vp8_bilinear_predict8x8_ssse3)));
#endif
#if HAVE_MSA
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
MSA, BilinearPredictTest,
::testing::Values(make_tuple(16, 16, &vp8_bilinear_predict16x16_msa),
make_tuple(8, 8, &vp8_bilinear_predict8x8_msa),

Просмотреть файл

@ -46,9 +46,9 @@ class QuantizeTestBase {
public:
virtual ~QuantizeTestBase() {
vp8_remove_compressor(&vp8_comp_);
vp8_comp_ = NULL;
vp8_comp_ = nullptr;
vpx_free(macroblockd_dst_);
macroblockd_dst_ = NULL;
macroblockd_dst_ = nullptr;
libvpx_test::ClearSystemState();
}
@ -146,6 +146,7 @@ class QuantizeTest : public QuantizeTestBase,
VP8Quantize asm_quant_;
VP8Quantize c_quant_;
};
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(QuantizeTest);
TEST_P(QuantizeTest, TestZeroInput) {
FillCoeffConstant(0);
@ -181,7 +182,7 @@ TEST_P(QuantizeTest, DISABLED_Speed) {
}
#if HAVE_SSE2
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSE2, QuantizeTest,
::testing::Values(
make_tuple(&vp8_fast_quantize_b_sse2, &vp8_fast_quantize_b_c),
@ -189,26 +190,27 @@ INSTANTIATE_TEST_CASE_P(
#endif // HAVE_SSE2
#if HAVE_SSSE3
INSTANTIATE_TEST_CASE_P(SSSE3, QuantizeTest,
::testing::Values(make_tuple(&vp8_fast_quantize_b_ssse3,
&vp8_fast_quantize_b_c)));
INSTANTIATE_TEST_SUITE_P(
SSSE3, QuantizeTest,
::testing::Values(make_tuple(&vp8_fast_quantize_b_ssse3,
&vp8_fast_quantize_b_c)));
#endif // HAVE_SSSE3
#if HAVE_SSE4_1
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSE4_1, QuantizeTest,
::testing::Values(make_tuple(&vp8_regular_quantize_b_sse4_1,
&vp8_regular_quantize_b_c)));
#endif // HAVE_SSE4_1
#if HAVE_NEON
INSTANTIATE_TEST_CASE_P(NEON, QuantizeTest,
::testing::Values(make_tuple(&vp8_fast_quantize_b_neon,
&vp8_fast_quantize_b_c)));
INSTANTIATE_TEST_SUITE_P(NEON, QuantizeTest,
::testing::Values(make_tuple(&vp8_fast_quantize_b_neon,
&vp8_fast_quantize_b_c)));
#endif // HAVE_NEON
#if HAVE_MSA
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
MSA, QuantizeTest,
::testing::Values(
make_tuple(&vp8_fast_quantize_b_msa, &vp8_fast_quantize_b_c),
@ -216,7 +218,7 @@ INSTANTIATE_TEST_CASE_P(
#endif // HAVE_MSA
#if HAVE_MMI
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
MMI, QuantizeTest,
::testing::Values(
make_tuple(&vp8_fast_quantize_b_mmi, &vp8_fast_quantize_b_c),

Просмотреть файл

@ -0,0 +1,376 @@
/*
* Copyright (c) 2020 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "vp9/ratectrl_rtc.h"
#include <fstream> // NOLINT
#include <string>
#include "./vpx_config.h"
#include "third_party/googletest/src/include/gtest/gtest.h"
#include "test/codec_factory.h"
#include "test/encode_test_driver.h"
#include "test/i420_video_source.h"
#include "test/util.h"
#include "test/video_source.h"
#include "vpx/vpx_codec.h"
#include "vpx_ports/bitops.h"
namespace {
const size_t kNumFrames = 300;
const int kTemporalId[4] = { 0, 2, 1, 2 };
class RcInterfaceTest
: public ::libvpx_test::EncoderTest,
public ::libvpx_test::CodecTestWith2Params<int, vpx_rc_mode> {
public:
RcInterfaceTest()
: EncoderTest(GET_PARAM(0)), aq_mode_(GET_PARAM(1)), key_interval_(3000),
encoder_exit_(false) {}
virtual ~RcInterfaceTest() {}
protected:
virtual void SetUp() {
InitializeConfig();
SetMode(::libvpx_test::kRealTime);
}
virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
libvpx_test::Encoder *encoder) {
if (video->frame() == 0) {
encoder->Control(VP8E_SET_CPUUSED, 7);
encoder->Control(VP9E_SET_AQ_MODE, aq_mode_);
encoder->Control(VP9E_SET_TUNE_CONTENT, 0);
encoder->Control(VP8E_SET_MAX_INTRA_BITRATE_PCT, 1000);
encoder->Control(VP9E_SET_RTC_EXTERNAL_RATECTRL, 1);
}
frame_params_.frame_type =
video->frame() % key_interval_ == 0 ? KEY_FRAME : INTER_FRAME;
if (rc_cfg_.rc_mode == VPX_CBR && frame_params_.frame_type == INTER_FRAME) {
// Disable golden frame update.
frame_flags_ |= VP8_EFLAG_NO_UPD_GF;
frame_flags_ |= VP8_EFLAG_NO_UPD_ARF;
}
encoder_exit_ = video->frame() == kNumFrames;
}
virtual void PostEncodeFrameHook(::libvpx_test::Encoder *encoder) {
if (encoder_exit_) {
return;
}
int loopfilter_level, qp;
encoder->Control(VP9E_GET_LOOPFILTER_LEVEL, &loopfilter_level);
encoder->Control(VP8E_GET_LAST_QUANTIZER, &qp);
rc_api_->ComputeQP(frame_params_);
ASSERT_EQ(rc_api_->GetQP(), qp);
ASSERT_EQ(rc_api_->GetLoopfilterLevel(), loopfilter_level);
}
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
rc_api_->PostEncodeUpdate(pkt->data.frame.sz);
}
void RunOneLayer() {
SetConfig(GET_PARAM(2));
rc_api_ = libvpx::VP9RateControlRTC::Create(rc_cfg_);
frame_params_.spatial_layer_id = 0;
frame_params_.temporal_layer_id = 0;
::libvpx_test::I420VideoSource video("desktop_office1.1280_720-020.yuv",
1280, 720, 30, 1, 0, kNumFrames);
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
}
void RunOneLayerVBRPeriodicKey() {
if (GET_PARAM(2) != VPX_VBR) return;
key_interval_ = 100;
SetConfig(VPX_VBR);
rc_api_ = libvpx::VP9RateControlRTC::Create(rc_cfg_);
frame_params_.spatial_layer_id = 0;
frame_params_.temporal_layer_id = 0;
::libvpx_test::I420VideoSource video("desktop_office1.1280_720-020.yuv",
1280, 720, 30, 1, 0, kNumFrames);
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
}
private:
void SetConfig(vpx_rc_mode rc_mode) {
rc_cfg_.width = 1280;
rc_cfg_.height = 720;
rc_cfg_.max_quantizer = 52;
rc_cfg_.min_quantizer = 2;
rc_cfg_.target_bandwidth = 1000;
rc_cfg_.buf_initial_sz = 600;
rc_cfg_.buf_optimal_sz = 600;
rc_cfg_.buf_sz = 1000;
rc_cfg_.undershoot_pct = 50;
rc_cfg_.overshoot_pct = 50;
rc_cfg_.max_intra_bitrate_pct = 1000;
rc_cfg_.framerate = 30.0;
rc_cfg_.ss_number_layers = 1;
rc_cfg_.ts_number_layers = 1;
rc_cfg_.scaling_factor_num[0] = 1;
rc_cfg_.scaling_factor_den[0] = 1;
rc_cfg_.layer_target_bitrate[0] = 1000;
rc_cfg_.max_quantizers[0] = 52;
rc_cfg_.min_quantizers[0] = 2;
rc_cfg_.rc_mode = rc_mode;
rc_cfg_.aq_mode = aq_mode_;
// Encoder settings for ground truth.
cfg_.g_w = 1280;
cfg_.g_h = 720;
cfg_.rc_undershoot_pct = 50;
cfg_.rc_overshoot_pct = 50;
cfg_.rc_buf_initial_sz = 600;
cfg_.rc_buf_optimal_sz = 600;
cfg_.rc_buf_sz = 1000;
cfg_.rc_dropframe_thresh = 0;
cfg_.rc_min_quantizer = 2;
cfg_.rc_max_quantizer = 52;
cfg_.rc_end_usage = rc_mode;
cfg_.g_lag_in_frames = 0;
cfg_.g_error_resilient = 0;
cfg_.rc_target_bitrate = 1000;
cfg_.kf_min_dist = key_interval_;
cfg_.kf_max_dist = key_interval_;
}
std::unique_ptr<libvpx::VP9RateControlRTC> rc_api_;
libvpx::VP9RateControlRtcConfig rc_cfg_;
int aq_mode_;
int key_interval_;
libvpx::VP9FrameParamsQpRTC frame_params_;
bool encoder_exit_;
};
class RcInterfaceSvcTest : public ::libvpx_test::EncoderTest,
public ::libvpx_test::CodecTestWithParam<int> {
public:
RcInterfaceSvcTest() : EncoderTest(GET_PARAM(0)), aq_mode_(GET_PARAM(1)) {}
virtual ~RcInterfaceSvcTest() {}
protected:
virtual void SetUp() {
InitializeConfig();
SetMode(::libvpx_test::kRealTime);
}
virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
::libvpx_test::Encoder *encoder) {
if (video->frame() == 0) {
encoder->Control(VP8E_SET_CPUUSED, 7);
encoder->Control(VP9E_SET_AQ_MODE, aq_mode_);
encoder->Control(VP9E_SET_TUNE_CONTENT, 0);
encoder->Control(VP8E_SET_MAX_INTRA_BITRATE_PCT, 900);
encoder->Control(VP9E_SET_RTC_EXTERNAL_RATECTRL, 1);
encoder->Control(VP9E_SET_SVC, 1);
encoder->Control(VP9E_SET_SVC_PARAMETERS, &svc_params_);
}
frame_params_.frame_type = video->frame() == 0 ? KEY_FRAME : INTER_FRAME;
if (rc_cfg_.rc_mode == VPX_CBR && frame_params_.frame_type == INTER_FRAME) {
// Disable golden frame update.
frame_flags_ |= VP8_EFLAG_NO_UPD_GF;
frame_flags_ |= VP8_EFLAG_NO_UPD_ARF;
}
encoder_exit_ = video->frame() == kNumFrames;
current_superframe_ = video->frame();
}
virtual void PostEncodeFrameHook(::libvpx_test::Encoder *encoder) {
::libvpx_test::CxDataIterator iter = encoder->GetCxData();
while (const vpx_codec_cx_pkt_t *pkt = iter.Next()) {
ParseSuperframeSizes(static_cast<const uint8_t *>(pkt->data.frame.buf),
pkt->data.frame.sz);
for (int sl = 0; sl < rc_cfg_.ss_number_layers; sl++) {
frame_params_.spatial_layer_id = sl;
frame_params_.temporal_layer_id = kTemporalId[current_superframe_ % 4];
rc_api_->ComputeQP(frame_params_);
frame_params_.frame_type = INTER_FRAME;
rc_api_->PostEncodeUpdate(sizes_[sl]);
}
}
if (!encoder_exit_) {
int loopfilter_level, qp;
encoder->Control(VP9E_GET_LOOPFILTER_LEVEL, &loopfilter_level);
encoder->Control(VP8E_GET_LAST_QUANTIZER, &qp);
ASSERT_EQ(rc_api_->GetQP(), qp);
ASSERT_EQ(rc_api_->GetLoopfilterLevel(), loopfilter_level);
}
}
// This method needs to be overridden because non-reference frames are
// expected to be mismatched frames as the encoder will avoid loopfilter on
// these frames.
virtual void MismatchHook(const vpx_image_t * /*img1*/,
const vpx_image_t * /*img2*/) {}
void RunSvc() {
SetConfigSvc();
rc_api_ = libvpx::VP9RateControlRTC::Create(rc_cfg_);
SetEncoderSvc();
::libvpx_test::I420VideoSource video("desktop_office1.1280_720-020.yuv",
1280, 720, 30, 1, 0, kNumFrames);
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
}
private:
vpx_codec_err_t ParseSuperframeSizes(const uint8_t *data, size_t data_sz) {
uint8_t marker = *(data + data_sz - 1);
if ((marker & 0xe0) == 0xc0) {
const uint32_t frames = (marker & 0x7) + 1;
const uint32_t mag = ((marker >> 3) & 0x3) + 1;
const size_t index_sz = 2 + mag * frames;
// This chunk is marked as having a superframe index but doesn't have
// enough data for it, thus it's an invalid superframe index.
if (data_sz < index_sz) return VPX_CODEC_CORRUPT_FRAME;
{
const uint8_t marker2 = *(data + data_sz - index_sz);
// This chunk is marked as having a superframe index but doesn't have
// the matching marker byte at the front of the index therefore it's an
// invalid chunk.
if (marker != marker2) return VPX_CODEC_CORRUPT_FRAME;
}
const uint8_t *x = &data[data_sz - index_sz + 1];
for (uint32_t i = 0; i < frames; ++i) {
uint32_t this_sz = 0;
for (uint32_t j = 0; j < mag; ++j) this_sz |= (*x++) << (j * 8);
sizes_[i] = this_sz;
}
}
return VPX_CODEC_OK;
}
void SetEncoderSvc() {
cfg_.ss_number_layers = 3;
cfg_.ts_number_layers = 3;
cfg_.g_timebase.num = 1;
cfg_.g_timebase.den = 30;
svc_params_.scaling_factor_num[0] = 72;
svc_params_.scaling_factor_den[0] = 288;
svc_params_.scaling_factor_num[1] = 144;
svc_params_.scaling_factor_den[1] = 288;
svc_params_.scaling_factor_num[2] = 288;
svc_params_.scaling_factor_den[2] = 288;
for (int i = 0; i < VPX_MAX_LAYERS; ++i) {
svc_params_.max_quantizers[i] = 56;
svc_params_.min_quantizers[i] = 2;
}
cfg_.rc_end_usage = VPX_CBR;
cfg_.g_lag_in_frames = 0;
cfg_.g_error_resilient = 0;
// 3 temporal layers
cfg_.ts_rate_decimator[0] = 4;
cfg_.ts_rate_decimator[1] = 2;
cfg_.ts_rate_decimator[2] = 1;
cfg_.temporal_layering_mode = 3;
cfg_.rc_buf_initial_sz = 500;
cfg_.rc_buf_optimal_sz = 600;
cfg_.rc_buf_sz = 1000;
cfg_.rc_min_quantizer = 2;
cfg_.rc_max_quantizer = 56;
cfg_.g_threads = 1;
cfg_.kf_max_dist = 9999;
cfg_.rc_target_bitrate = 1600;
cfg_.rc_overshoot_pct = 50;
cfg_.rc_undershoot_pct = 50;
cfg_.layer_target_bitrate[0] = 100;
cfg_.layer_target_bitrate[1] = 140;
cfg_.layer_target_bitrate[2] = 200;
cfg_.layer_target_bitrate[3] = 250;
cfg_.layer_target_bitrate[4] = 350;
cfg_.layer_target_bitrate[5] = 500;
cfg_.layer_target_bitrate[6] = 450;
cfg_.layer_target_bitrate[7] = 630;
cfg_.layer_target_bitrate[8] = 900;
}
void SetConfigSvc() {
rc_cfg_.width = 1280;
rc_cfg_.height = 720;
rc_cfg_.max_quantizer = 56;
rc_cfg_.min_quantizer = 2;
rc_cfg_.target_bandwidth = 1600;
rc_cfg_.buf_initial_sz = 500;
rc_cfg_.buf_optimal_sz = 600;
rc_cfg_.buf_sz = 1000;
rc_cfg_.undershoot_pct = 50;
rc_cfg_.overshoot_pct = 50;
rc_cfg_.max_intra_bitrate_pct = 900;
rc_cfg_.framerate = 30.0;
rc_cfg_.ss_number_layers = 3;
rc_cfg_.ts_number_layers = 3;
rc_cfg_.rc_mode = VPX_CBR;
rc_cfg_.scaling_factor_num[0] = 1;
rc_cfg_.scaling_factor_den[0] = 4;
rc_cfg_.scaling_factor_num[1] = 2;
rc_cfg_.scaling_factor_den[1] = 4;
rc_cfg_.scaling_factor_num[2] = 4;
rc_cfg_.scaling_factor_den[2] = 4;
rc_cfg_.ts_rate_decimator[0] = 4;
rc_cfg_.ts_rate_decimator[1] = 2;
rc_cfg_.ts_rate_decimator[2] = 1;
rc_cfg_.layer_target_bitrate[0] = 100;
rc_cfg_.layer_target_bitrate[1] = 140;
rc_cfg_.layer_target_bitrate[2] = 200;
rc_cfg_.layer_target_bitrate[3] = 250;
rc_cfg_.layer_target_bitrate[4] = 350;
rc_cfg_.layer_target_bitrate[5] = 500;
rc_cfg_.layer_target_bitrate[6] = 450;
rc_cfg_.layer_target_bitrate[7] = 630;
rc_cfg_.layer_target_bitrate[8] = 900;
for (int sl = 0; sl < rc_cfg_.ss_number_layers; ++sl) {
for (int tl = 0; tl < rc_cfg_.ts_number_layers; ++tl) {
const int i = sl * rc_cfg_.ts_number_layers + tl;
rc_cfg_.max_quantizers[i] = 56;
rc_cfg_.min_quantizers[i] = 2;
}
}
}
int aq_mode_;
std::unique_ptr<libvpx::VP9RateControlRTC> rc_api_;
libvpx::VP9RateControlRtcConfig rc_cfg_;
vpx_svc_extra_cfg_t svc_params_;
libvpx::VP9FrameParamsQpRTC frame_params_;
bool encoder_exit_;
int current_superframe_;
uint32_t sizes_[8];
};
TEST_P(RcInterfaceTest, OneLayer) { RunOneLayer(); }
TEST_P(RcInterfaceTest, OneLayerVBRPeriodicKey) { RunOneLayerVBRPeriodicKey(); }
TEST_P(RcInterfaceSvcTest, Svc) { RunSvc(); }
VP9_INSTANTIATE_TEST_SUITE(RcInterfaceTest, ::testing::Values(0, 3),
::testing::Values(VPX_CBR, VPX_VBR));
VP9_INSTANTIATE_TEST_SUITE(RcInterfaceSvcTest, ::testing::Values(0));
} // namespace
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}

Просмотреть файл

@ -24,15 +24,15 @@ class RealtimeTest
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
protected:
RealtimeTest() : EncoderTest(GET_PARAM(0)), frame_packets_(0) {}
virtual ~RealtimeTest() {}
~RealtimeTest() override {}
virtual void SetUp() {
void SetUp() override {
InitializeConfig();
cfg_.g_lag_in_frames = 0;
SetMode(::libvpx_test::kRealTime);
}
virtual void BeginPassHook(unsigned int /*pass*/) {
void BeginPassHook(unsigned int /*pass*/) override {
// TODO(tomfinegan): We're changing the pass value here to make sure
// we get frames when real time mode is combined with |g_pass| set to
// VPX_RC_FIRST_PASS. This is necessary because EncoderTest::RunLoop() sets
@ -40,7 +40,15 @@ class RealtimeTest
// which overrides the one specified in SetUp() above.
cfg_.g_pass = VPX_RC_FIRST_PASS;
}
virtual void FramePktHook(const vpx_codec_cx_pkt_t * /*pkt*/) {
void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
::libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) {
encoder->Control(VP8E_SET_CPUUSED, 8);
}
}
void FramePktHook(const vpx_codec_cx_pkt_t * /*pkt*/) override {
frame_packets_++;
}
@ -55,9 +63,17 @@ TEST_P(RealtimeTest, RealtimeFirstPassProducesFrames) {
EXPECT_EQ(kFramesToEncode, frame_packets_);
}
VP8_INSTANTIATE_TEST_CASE(RealtimeTest,
::testing::Values(::libvpx_test::kRealTime));
VP9_INSTANTIATE_TEST_CASE(RealtimeTest,
::testing::Values(::libvpx_test::kRealTime));
TEST_P(RealtimeTest, IntegerOverflow) {
::libvpx_test::RandomVideoSource video;
video.SetSize(800, 480);
video.set_limit(20);
cfg_.rc_target_bitrate = 140000000;
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
}
VP8_INSTANTIATE_TEST_SUITE(RealtimeTest,
::testing::Values(::libvpx_test::kRealTime));
VP9_INSTANTIATE_TEST_SUITE(RealtimeTest,
::testing::Values(::libvpx_test::kRealTime));
} // namespace

Просмотреть файл

@ -271,8 +271,8 @@ class ResizingVideoSource : public ::libvpx_test::DummyVideoSource {
protected:
virtual void Next() {
++frame_;
unsigned int width;
unsigned int height;
unsigned int width = 0;
unsigned int height = 0;
ScaleForFrameNumber(frame_, kInitialWidth, kInitialHeight, &width, &height,
flag_codec_, smaller_width_larger_size_);
SetSize(width, height);
@ -350,7 +350,7 @@ class ResizeInternalTest : public ResizeTest {
protected:
#if WRITE_COMPRESSED_STREAM
ResizeInternalTest()
: ResizeTest(), frame0_psnr_(0.0), outfile_(NULL), out_frames_(0) {}
: ResizeTest(), frame0_psnr_(0.0), outfile_(nullptr), out_frames_(0) {}
#else
ResizeInternalTest() : ResizeTest(), frame0_psnr_(0.0) {}
#endif
@ -369,7 +369,7 @@ class ResizeInternalTest : public ResizeTest {
if (!fseek(outfile_, 0, SEEK_SET))
write_ivf_file_header(&cfg_, out_frames_, outfile_);
fclose(outfile_);
outfile_ = NULL;
outfile_ = nullptr;
}
#endif
}
@ -610,11 +610,11 @@ TEST_P(ResizeRealtimeTest, DISABLED_TestExternalResizeSmallerWidthBiggerSize) {
// Run at low bitrate, with resize_allowed = 1, and verify that we get
// one resize down event.
TEST_P(ResizeRealtimeTest, TestInternalResizeDown) {
::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
30, 1, 0, 299);
::libvpx_test::I420VideoSource video("niklas_640_480_30.yuv", 640, 480, 30, 1,
0, 299);
DefaultConfig();
cfg_.g_w = 352;
cfg_.g_h = 288;
cfg_.g_w = 640;
cfg_.g_h = 480;
change_bitrate_ = false;
mismatch_psnr_ = 0.0;
mismatch_nframes_ = 0;
@ -648,11 +648,11 @@ TEST_P(ResizeRealtimeTest, TestInternalResizeDown) {
// Start at low target bitrate, raise the bitrate in the middle of the clip,
// scaling-up should occur after bitrate changed.
TEST_P(ResizeRealtimeTest, TestInternalResizeDownUpChangeBitRate) {
::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
30, 1, 0, 359);
::libvpx_test::I420VideoSource video("niklas_640_480_30.yuv", 640, 480, 30, 1,
0, 400);
DefaultConfig();
cfg_.g_w = 352;
cfg_.g_h = 288;
cfg_.g_w = 640;
cfg_.g_h = 480;
change_bitrate_ = true;
mismatch_psnr_ = 0.0;
mismatch_nframes_ = 0;
@ -672,11 +672,11 @@ TEST_P(ResizeRealtimeTest, TestInternalResizeDownUpChangeBitRate) {
ASSERT_EQ(info->h, GetFrameHeight(idx));
if (info->w != last_w || info->h != last_h) {
resize_count++;
if (resize_count == 1) {
if (resize_count <= 2) {
// Verify that resize down occurs.
ASSERT_LT(info->w, last_w);
ASSERT_LT(info->h, last_h);
} else if (resize_count == 2) {
} else if (resize_count > 2) {
// Verify that resize up occurs.
ASSERT_GT(info->w, last_w);
ASSERT_GT(info->h, last_h);
@ -687,8 +687,8 @@ TEST_P(ResizeRealtimeTest, TestInternalResizeDownUpChangeBitRate) {
}
#if CONFIG_VP9_DECODER
// Verify that we get 2 resize events in this test.
ASSERT_EQ(resize_count, 2) << "Resizing should occur twice.";
// Verify that we get 4 resize events in this test.
ASSERT_EQ(resize_count, 4) << "Resizing should occur twice.";
EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());
#else
printf("Warning: VP9 decoder unavailable, unable to check resize count!\n");
@ -705,7 +705,7 @@ class ResizeCspTest : public ResizeTest {
protected:
#if WRITE_COMPRESSED_STREAM
ResizeCspTest()
: ResizeTest(), frame0_psnr_(0.0), outfile_(NULL), out_frames_(0) {}
: ResizeTest(), frame0_psnr_(0.0), outfile_(nullptr), out_frames_(0) {}
#else
ResizeCspTest() : ResizeTest(), frame0_psnr_(0.0) {}
#endif
@ -724,7 +724,7 @@ class ResizeCspTest : public ResizeTest {
if (!fseek(outfile_, 0, SEEK_SET))
write_ivf_file_header(&cfg_, out_frames_, outfile_);
fclose(outfile_);
outfile_ = NULL;
outfile_ = nullptr;
}
#endif
}
@ -793,14 +793,14 @@ TEST_P(ResizeCspTest, TestResizeCspWorks) {
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
}
VP8_INSTANTIATE_TEST_CASE(ResizeTest, ONE_PASS_TEST_MODES);
VP9_INSTANTIATE_TEST_CASE(ResizeTest,
::testing::Values(::libvpx_test::kRealTime));
VP9_INSTANTIATE_TEST_CASE(ResizeInternalTest,
::testing::Values(::libvpx_test::kOnePassBest));
VP9_INSTANTIATE_TEST_CASE(ResizeRealtimeTest,
::testing::Values(::libvpx_test::kRealTime),
::testing::Range(5, 9));
VP9_INSTANTIATE_TEST_CASE(ResizeCspTest,
::testing::Values(::libvpx_test::kRealTime));
VP8_INSTANTIATE_TEST_SUITE(ResizeTest, ONE_PASS_TEST_MODES);
VP9_INSTANTIATE_TEST_SUITE(ResizeTest,
::testing::Values(::libvpx_test::kRealTime));
VP9_INSTANTIATE_TEST_SUITE(ResizeInternalTest,
::testing::Values(::libvpx_test::kOnePassBest));
VP9_INSTANTIATE_TEST_SUITE(ResizeRealtimeTest,
::testing::Values(::libvpx_test::kRealTime),
::testing::Range(5, 9));
VP9_INSTANTIATE_TEST_SUITE(ResizeCspTest,
::testing::Values(::libvpx_test::kRealTime));
} // namespace

Просмотреть файл

@ -41,7 +41,7 @@ resize_util() {
eval "${VPX_TEST_PREFIX}" "${resizer}" "${YUV_RAW_INPUT}" \
"${YUV_RAW_INPUT_WIDTH}x${YUV_RAW_INPUT_HEIGHT}" \
"${target_dimensions}" "${output_file}" ${frames_to_resize} \
${devnull}
${devnull} || return 1
[ -e "${output_file}" ] || return 1
fi

Просмотреть файл

@ -26,6 +26,10 @@
#include "vpx_ports/msvc.h"
#include "vpx_ports/vpx_timer.h"
// const[expr] should be sufficient for DECLARE_ALIGNED but early
// implementations of c++11 appear to have some issues with it.
#define kDataAlignment 32
template <typename Function>
struct TestParams {
TestParams(int w, int h, Function f, int bd = -1)
@ -99,17 +103,17 @@ class SADTestBase : public ::testing::TestWithParam<ParamType> {
virtual void TearDown() {
vpx_free(source_data8_);
source_data8_ = NULL;
source_data8_ = nullptr;
vpx_free(reference_data8_);
reference_data8_ = NULL;
reference_data8_ = nullptr;
vpx_free(second_pred8_);
second_pred8_ = NULL;
second_pred8_ = nullptr;
vpx_free(source_data16_);
source_data16_ = NULL;
source_data16_ = nullptr;
vpx_free(reference_data16_);
reference_data16_ = NULL;
reference_data16_ = nullptr;
vpx_free(second_pred16_);
second_pred16_ = NULL;
second_pred16_ = nullptr;
libvpx_test::ClearSystemState();
}
@ -117,9 +121,6 @@ class SADTestBase : public ::testing::TestWithParam<ParamType> {
protected:
// Handle blocks up to 4 blocks 64x64 with stride up to 128
// crbug.com/webm/1660
// const[expr] should be sufficient for DECLARE_ALIGNED but early
// implementations of c++11 appear to have some issues with it.
enum { kDataAlignment = 32 };
static const int kDataBlockSize = 64 * 128;
static const int kDataBufferSize = 4 * kDataBlockSize;
@ -628,7 +629,7 @@ const SadMxNParam c_tests[] = {
SadMxNParam(4, 4, &vpx_highbd_sad4x4_c, 12),
#endif // CONFIG_VP9_HIGHBITDEPTH
};
INSTANTIATE_TEST_CASE_P(C, SADTest, ::testing::ValuesIn(c_tests));
INSTANTIATE_TEST_SUITE_P(C, SADTest, ::testing::ValuesIn(c_tests));
const SadMxNAvgParam avg_c_tests[] = {
SadMxNAvgParam(64, 64, &vpx_sad64x64_avg_c),
@ -686,7 +687,7 @@ const SadMxNAvgParam avg_c_tests[] = {
SadMxNAvgParam(4, 4, &vpx_highbd_sad4x4_avg_c, 12),
#endif // CONFIG_VP9_HIGHBITDEPTH
};
INSTANTIATE_TEST_CASE_P(C, SADavgTest, ::testing::ValuesIn(avg_c_tests));
INSTANTIATE_TEST_SUITE_P(C, SADavgTest, ::testing::ValuesIn(avg_c_tests));
const SadMxNx4Param x4d_c_tests[] = {
SadMxNx4Param(64, 64, &vpx_sad64x64x4d_c),
@ -744,7 +745,7 @@ const SadMxNx4Param x4d_c_tests[] = {
SadMxNx4Param(4, 4, &vpx_highbd_sad4x4x4d_c, 12),
#endif // CONFIG_VP9_HIGHBITDEPTH
};
INSTANTIATE_TEST_CASE_P(C, SADx4Test, ::testing::ValuesIn(x4d_c_tests));
INSTANTIATE_TEST_SUITE_P(C, SADx4Test, ::testing::ValuesIn(x4d_c_tests));
// TODO(angiebird): implement the marked-down sad functions
const SadMxNx8Param x8_c_tests[] = {
@ -762,7 +763,7 @@ const SadMxNx8Param x8_c_tests[] = {
// SadMxNx8Param(4, 8, &vpx_sad4x8x8_c),
SadMxNx8Param(4, 4, &vpx_sad4x4x8_c),
};
INSTANTIATE_TEST_CASE_P(C, SADx8Test, ::testing::ValuesIn(x8_c_tests));
INSTANTIATE_TEST_SUITE_P(C, SADx8Test, ::testing::ValuesIn(x8_c_tests));
//------------------------------------------------------------------------------
// ARM functions
@ -780,7 +781,7 @@ const SadMxNParam neon_tests[] = {
SadMxNParam(4, 8, &vpx_sad4x8_neon),
SadMxNParam(4, 4, &vpx_sad4x4_neon),
};
INSTANTIATE_TEST_CASE_P(NEON, SADTest, ::testing::ValuesIn(neon_tests));
INSTANTIATE_TEST_SUITE_P(NEON, SADTest, ::testing::ValuesIn(neon_tests));
const SadMxNAvgParam avg_neon_tests[] = {
SadMxNAvgParam(64, 64, &vpx_sad64x64_avg_neon),
@ -797,7 +798,7 @@ const SadMxNAvgParam avg_neon_tests[] = {
SadMxNAvgParam(4, 8, &vpx_sad4x8_avg_neon),
SadMxNAvgParam(4, 4, &vpx_sad4x4_avg_neon),
};
INSTANTIATE_TEST_CASE_P(NEON, SADavgTest, ::testing::ValuesIn(avg_neon_tests));
INSTANTIATE_TEST_SUITE_P(NEON, SADavgTest, ::testing::ValuesIn(avg_neon_tests));
const SadMxNx4Param x4d_neon_tests[] = {
SadMxNx4Param(64, 64, &vpx_sad64x64x4d_neon),
@ -814,7 +815,7 @@ const SadMxNx4Param x4d_neon_tests[] = {
SadMxNx4Param(4, 8, &vpx_sad4x8x4d_neon),
SadMxNx4Param(4, 4, &vpx_sad4x4x4d_neon),
};
INSTANTIATE_TEST_CASE_P(NEON, SADx4Test, ::testing::ValuesIn(x4d_neon_tests));
INSTANTIATE_TEST_SUITE_P(NEON, SADx4Test, ::testing::ValuesIn(x4d_neon_tests));
#endif // HAVE_NEON
//------------------------------------------------------------------------------
@ -870,7 +871,7 @@ const SadMxNParam sse2_tests[] = {
SadMxNParam(8, 4, &vpx_highbd_sad8x4_sse2, 12),
#endif // CONFIG_VP9_HIGHBITDEPTH
};
INSTANTIATE_TEST_CASE_P(SSE2, SADTest, ::testing::ValuesIn(sse2_tests));
INSTANTIATE_TEST_SUITE_P(SSE2, SADTest, ::testing::ValuesIn(sse2_tests));
const SadMxNAvgParam avg_sse2_tests[] = {
SadMxNAvgParam(64, 64, &vpx_sad64x64_avg_sse2),
@ -922,7 +923,7 @@ const SadMxNAvgParam avg_sse2_tests[] = {
SadMxNAvgParam(8, 4, &vpx_highbd_sad8x4_avg_sse2, 12),
#endif // CONFIG_VP9_HIGHBITDEPTH
};
INSTANTIATE_TEST_CASE_P(SSE2, SADavgTest, ::testing::ValuesIn(avg_sse2_tests));
INSTANTIATE_TEST_SUITE_P(SSE2, SADavgTest, ::testing::ValuesIn(avg_sse2_tests));
const SadMxNx4Param x4d_sse2_tests[] = {
SadMxNx4Param(64, 64, &vpx_sad64x64x4d_sse2),
@ -980,7 +981,7 @@ const SadMxNx4Param x4d_sse2_tests[] = {
SadMxNx4Param(4, 4, &vpx_highbd_sad4x4x4d_sse2, 12),
#endif // CONFIG_VP9_HIGHBITDEPTH
};
INSTANTIATE_TEST_CASE_P(SSE2, SADx4Test, ::testing::ValuesIn(x4d_sse2_tests));
INSTANTIATE_TEST_SUITE_P(SSE2, SADx4Test, ::testing::ValuesIn(x4d_sse2_tests));
#endif // HAVE_SSE2
#if HAVE_SSE3
@ -999,8 +1000,8 @@ const SadMxNx8Param x8_sse4_1_tests[] = {
SadMxNx8Param(8, 8, &vpx_sad8x8x8_sse4_1),
SadMxNx8Param(4, 4, &vpx_sad4x4x8_sse4_1),
};
INSTANTIATE_TEST_CASE_P(SSE4_1, SADx8Test,
::testing::ValuesIn(x8_sse4_1_tests));
INSTANTIATE_TEST_SUITE_P(SSE4_1, SADx8Test,
::testing::ValuesIn(x8_sse4_1_tests));
#endif // HAVE_SSE4_1
#if HAVE_AVX2
@ -1011,7 +1012,7 @@ const SadMxNParam avx2_tests[] = {
SadMxNParam(32, 32, &vpx_sad32x32_avx2),
SadMxNParam(32, 16, &vpx_sad32x16_avx2),
};
INSTANTIATE_TEST_CASE_P(AVX2, SADTest, ::testing::ValuesIn(avx2_tests));
INSTANTIATE_TEST_SUITE_P(AVX2, SADTest, ::testing::ValuesIn(avx2_tests));
const SadMxNAvgParam avg_avx2_tests[] = {
SadMxNAvgParam(64, 64, &vpx_sad64x64_avg_avx2),
@ -1020,27 +1021,27 @@ const SadMxNAvgParam avg_avx2_tests[] = {
SadMxNAvgParam(32, 32, &vpx_sad32x32_avg_avx2),
SadMxNAvgParam(32, 16, &vpx_sad32x16_avg_avx2),
};
INSTANTIATE_TEST_CASE_P(AVX2, SADavgTest, ::testing::ValuesIn(avg_avx2_tests));
INSTANTIATE_TEST_SUITE_P(AVX2, SADavgTest, ::testing::ValuesIn(avg_avx2_tests));
const SadMxNx4Param x4d_avx2_tests[] = {
SadMxNx4Param(64, 64, &vpx_sad64x64x4d_avx2),
SadMxNx4Param(32, 32, &vpx_sad32x32x4d_avx2),
};
INSTANTIATE_TEST_CASE_P(AVX2, SADx4Test, ::testing::ValuesIn(x4d_avx2_tests));
INSTANTIATE_TEST_SUITE_P(AVX2, SADx4Test, ::testing::ValuesIn(x4d_avx2_tests));
const SadMxNx8Param x8_avx2_tests[] = {
// SadMxNx8Param(64, 64, &vpx_sad64x64x8_c),
SadMxNx8Param(32, 32, &vpx_sad32x32x8_avx2),
};
INSTANTIATE_TEST_CASE_P(AVX2, SADx8Test, ::testing::ValuesIn(x8_avx2_tests));
INSTANTIATE_TEST_SUITE_P(AVX2, SADx8Test, ::testing::ValuesIn(x8_avx2_tests));
#endif // HAVE_AVX2
#if HAVE_AVX512
const SadMxNx4Param x4d_avx512_tests[] = {
SadMxNx4Param(64, 64, &vpx_sad64x64x4d_avx512),
};
INSTANTIATE_TEST_CASE_P(AVX512, SADx4Test,
::testing::ValuesIn(x4d_avx512_tests));
INSTANTIATE_TEST_SUITE_P(AVX512, SADx4Test,
::testing::ValuesIn(x4d_avx512_tests));
#endif // HAVE_AVX512
//------------------------------------------------------------------------------
@ -1061,7 +1062,7 @@ const SadMxNParam msa_tests[] = {
SadMxNParam(4, 8, &vpx_sad4x8_msa),
SadMxNParam(4, 4, &vpx_sad4x4_msa),
};
INSTANTIATE_TEST_CASE_P(MSA, SADTest, ::testing::ValuesIn(msa_tests));
INSTANTIATE_TEST_SUITE_P(MSA, SADTest, ::testing::ValuesIn(msa_tests));
const SadMxNAvgParam avg_msa_tests[] = {
SadMxNAvgParam(64, 64, &vpx_sad64x64_avg_msa),
@ -1078,7 +1079,7 @@ const SadMxNAvgParam avg_msa_tests[] = {
SadMxNAvgParam(4, 8, &vpx_sad4x8_avg_msa),
SadMxNAvgParam(4, 4, &vpx_sad4x4_avg_msa),
};
INSTANTIATE_TEST_CASE_P(MSA, SADavgTest, ::testing::ValuesIn(avg_msa_tests));
INSTANTIATE_TEST_SUITE_P(MSA, SADavgTest, ::testing::ValuesIn(avg_msa_tests));
const SadMxNx4Param x4d_msa_tests[] = {
SadMxNx4Param(64, 64, &vpx_sad64x64x4d_msa),
@ -1095,7 +1096,7 @@ const SadMxNx4Param x4d_msa_tests[] = {
SadMxNx4Param(4, 8, &vpx_sad4x8x4d_msa),
SadMxNx4Param(4, 4, &vpx_sad4x4x4d_msa),
};
INSTANTIATE_TEST_CASE_P(MSA, SADx4Test, ::testing::ValuesIn(x4d_msa_tests));
INSTANTIATE_TEST_SUITE_P(MSA, SADx4Test, ::testing::ValuesIn(x4d_msa_tests));
#endif // HAVE_MSA
//------------------------------------------------------------------------------
@ -1114,7 +1115,7 @@ const SadMxNParam vsx_tests[] = {
SadMxNParam(8, 8, &vpx_sad8x8_vsx),
SadMxNParam(8, 4, &vpx_sad8x4_vsx),
};
INSTANTIATE_TEST_CASE_P(VSX, SADTest, ::testing::ValuesIn(vsx_tests));
INSTANTIATE_TEST_SUITE_P(VSX, SADTest, ::testing::ValuesIn(vsx_tests));
const SadMxNAvgParam avg_vsx_tests[] = {
SadMxNAvgParam(64, 64, &vpx_sad64x64_avg_vsx),
@ -1126,7 +1127,7 @@ const SadMxNAvgParam avg_vsx_tests[] = {
SadMxNAvgParam(16, 16, &vpx_sad16x16_avg_vsx),
SadMxNAvgParam(16, 8, &vpx_sad16x8_avg_vsx),
};
INSTANTIATE_TEST_CASE_P(VSX, SADavgTest, ::testing::ValuesIn(avg_vsx_tests));
INSTANTIATE_TEST_SUITE_P(VSX, SADavgTest, ::testing::ValuesIn(avg_vsx_tests));
const SadMxNx4Param x4d_vsx_tests[] = {
SadMxNx4Param(64, 64, &vpx_sad64x64x4d_vsx),
@ -1138,7 +1139,7 @@ const SadMxNx4Param x4d_vsx_tests[] = {
SadMxNx4Param(16, 16, &vpx_sad16x16x4d_vsx),
SadMxNx4Param(16, 8, &vpx_sad16x8x4d_vsx),
};
INSTANTIATE_TEST_CASE_P(VSX, SADx4Test, ::testing::ValuesIn(x4d_vsx_tests));
INSTANTIATE_TEST_SUITE_P(VSX, SADx4Test, ::testing::ValuesIn(x4d_vsx_tests));
#endif // HAVE_VSX
//------------------------------------------------------------------------------
@ -1159,7 +1160,7 @@ const SadMxNParam mmi_tests[] = {
SadMxNParam(4, 8, &vpx_sad4x8_mmi),
SadMxNParam(4, 4, &vpx_sad4x4_mmi),
};
INSTANTIATE_TEST_CASE_P(MMI, SADTest, ::testing::ValuesIn(mmi_tests));
INSTANTIATE_TEST_SUITE_P(MMI, SADTest, ::testing::ValuesIn(mmi_tests));
const SadMxNAvgParam avg_mmi_tests[] = {
SadMxNAvgParam(64, 64, &vpx_sad64x64_avg_mmi),
@ -1176,7 +1177,7 @@ const SadMxNAvgParam avg_mmi_tests[] = {
SadMxNAvgParam(4, 8, &vpx_sad4x8_avg_mmi),
SadMxNAvgParam(4, 4, &vpx_sad4x4_avg_mmi),
};
INSTANTIATE_TEST_CASE_P(MMI, SADavgTest, ::testing::ValuesIn(avg_mmi_tests));
INSTANTIATE_TEST_SUITE_P(MMI, SADavgTest, ::testing::ValuesIn(avg_mmi_tests));
const SadMxNx4Param x4d_mmi_tests[] = {
SadMxNx4Param(64, 64, &vpx_sad64x64x4d_mmi),
@ -1193,6 +1194,6 @@ const SadMxNx4Param x4d_mmi_tests[] = {
SadMxNx4Param(4, 8, &vpx_sad4x8x4d_mmi),
SadMxNx4Param(4, 4, &vpx_sad4x4x4d_mmi),
};
INSTANTIATE_TEST_CASE_P(MMI, SADx4Test, ::testing::ValuesIn(x4d_mmi_tests));
INSTANTIATE_TEST_SUITE_P(MMI, SADx4Test, ::testing::ValuesIn(x4d_mmi_tests));
#endif // HAVE_MMI
} // namespace

Просмотреть файл

@ -36,7 +36,7 @@ set_maps() {
eval "${VPX_TEST_PREFIX}" "${encoder}" "${codec}" "${YUV_RAW_INPUT_WIDTH}" \
"${YUV_RAW_INPUT_HEIGHT}" "${YUV_RAW_INPUT}" "${output_file}" \
${devnull}
${devnull} || return 1
[ -e "${output_file}" ] || return 1
}

Просмотреть файл

@ -38,7 +38,7 @@ simple_decoder() {
fi
eval "${VPX_TEST_PREFIX}" "${decoder}" "${input_file}" "${output_file}" \
${devnull}
${devnull} || return 1
[ -e "${output_file}" ] || return 1
}

Просмотреть файл

@ -1,35 +1,55 @@
/*
* Copyright (c) 2019 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include <math.h>
#include <memory>
#include <string>
#include <vector>
#include "third_party/googletest/src/include/gtest/gtest.h"
#include "test/video_source.h"
#include "vp9/simple_encode.h"
namespace vp9 {
namespace {
// TODO(angirbid): Find a better way to construct encode info
const int w = 352;
const int h = 288;
const int frame_rate_num = 30;
const int frame_rate_den = 1;
const int target_bitrate = 1000;
const int num_frames = 17;
const char infile_path[] = "bus_352x288_420_f20_b8.yuv";
double GetBitrateInKbps(size_t bit_size, int num_frames, int frame_rate_num,
int frame_rate_den) {
return static_cast<double>(bit_size) / num_frames * frame_rate_num /
frame_rate_den / 1000.0;
}
TEST(SimpleEncode, ComputeFirstPassStats) {
SimpleEncode simple_encode(w, h, frame_rate_num, frame_rate_den,
target_bitrate, num_frames, infile_path);
// Returns the number of unit in size of 4.
// For example, if size is 7, return 2.
int GetNumUnit4x4(int size) { return (size + 3) >> 2; }
class SimpleEncodeTest : public ::testing::Test {
protected:
const int width_ = 352;
const int height_ = 288;
const int frame_rate_num_ = 30;
const int frame_rate_den_ = 1;
const int target_bitrate_ = 1000;
const int num_frames_ = 17;
const std::string in_file_path_str_ =
libvpx_test::GetDataPath() + "/bus_352x288_420_f20_b8.yuv";
};
TEST_F(SimpleEncodeTest, ComputeFirstPassStats) {
SimpleEncode simple_encode(width_, height_, frame_rate_num_, frame_rate_den_,
target_bitrate_, num_frames_,
in_file_path_str_.c_str());
simple_encode.ComputeFirstPassStats();
std::vector<std::vector<double>> frame_stats =
simple_encode.ObserveFirstPassStats();
EXPECT_EQ(frame_stats.size(), static_cast<size_t>(num_frames));
size_t data_num = frame_stats[0].size();
EXPECT_EQ(frame_stats.size(), static_cast<size_t>(num_frames_));
const size_t data_num = frame_stats[0].size();
// Read ObserveFirstPassStats before changing FIRSTPASS_STATS.
EXPECT_EQ(data_num, static_cast<size_t>(25));
for (size_t i = 0; i < frame_stats.size(); ++i) {
@ -42,61 +62,153 @@ TEST(SimpleEncode, ComputeFirstPassStats) {
}
}
TEST(SimpleEncode, GetCodingFrameNum) {
SimpleEncode simple_encode(w, h, frame_rate_num, frame_rate_den,
target_bitrate, num_frames, infile_path);
TEST_F(SimpleEncodeTest, ObserveFirstPassMotionVectors) {
SimpleEncode simple_encode(width_, height_, frame_rate_num_, frame_rate_den_,
target_bitrate_, num_frames_,
in_file_path_str_.c_str());
simple_encode.ComputeFirstPassStats();
int num_coding_frames = simple_encode.GetCodingFrameNum();
std::vector<std::vector<MotionVectorInfo>> fps_motion_vectors =
simple_encode.ObserveFirstPassMotionVectors();
EXPECT_EQ(fps_motion_vectors.size(), static_cast<size_t>(num_frames_));
const size_t num_blocks = ((width_ + 15) >> 4) * ((height_ + 15) >> 4);
EXPECT_EQ(num_blocks, fps_motion_vectors[0].size());
for (size_t i = 0; i < fps_motion_vectors.size(); ++i) {
EXPECT_EQ(num_blocks, fps_motion_vectors[i].size());
for (size_t j = 0; j < num_blocks; ++j) {
const int mv_count = fps_motion_vectors[i][j].mv_count;
const int ref_count =
(fps_motion_vectors[i][j].ref_frame[0] != kRefFrameTypeNone) +
(fps_motion_vectors[i][j].ref_frame[1] != kRefFrameTypeNone);
EXPECT_EQ(mv_count, ref_count);
}
}
}
TEST_F(SimpleEncodeTest, GetCodingFrameNum) {
SimpleEncode simple_encode(width_, height_, frame_rate_num_, frame_rate_den_,
target_bitrate_, num_frames_,
in_file_path_str_.c_str());
simple_encode.ComputeFirstPassStats();
const int num_coding_frames = simple_encode.GetCodingFrameNum();
EXPECT_EQ(num_coding_frames, 19);
}
TEST(SimpleEncode, EncodeFrame) {
SimpleEncode simple_encode(w, h, frame_rate_num, frame_rate_den,
target_bitrate, num_frames, infile_path);
TEST_F(SimpleEncodeTest, EncodeFrame) {
SimpleEncode simple_encode(width_, height_, frame_rate_num_, frame_rate_den_,
target_bitrate_, num_frames_,
in_file_path_str_.c_str());
simple_encode.ComputeFirstPassStats();
int num_coding_frames = simple_encode.GetCodingFrameNum();
EXPECT_GE(num_coding_frames, num_frames);
// The coding frames include actual show frames and alternate reference
// frames, i.e. no show frame.
int ref_num_alternate_refereces = num_coding_frames - num_frames;
int num_alternate_refereces = 0;
EXPECT_GE(num_coding_frames, num_frames_);
simple_encode.StartEncode();
size_t total_data_bit_size = 0;
for (int i = 0; i < num_coding_frames; ++i) {
EncodeFrameResult encode_frame_result;
simple_encode.EncodeFrame(&encode_frame_result);
if (i == 0) {
EXPECT_EQ(encode_frame_result.show_idx, 0);
EXPECT_EQ(encode_frame_result.frame_type, kKeyFrame)
<< "The first coding frame should be key frame";
int coded_show_frame_count = 0;
int frame_coding_index = 0;
while (coded_show_frame_count < num_frames_) {
const GroupOfPicture group_of_picture =
simple_encode.ObserveGroupOfPicture();
const std::vector<EncodeFrameInfo> &encode_frame_list =
group_of_picture.encode_frame_list;
for (size_t group_index = 0; group_index < encode_frame_list.size();
++group_index) {
EncodeFrameResult encode_frame_result;
simple_encode.EncodeFrame(&encode_frame_result);
EXPECT_EQ(encode_frame_result.show_idx,
encode_frame_list[group_index].show_idx);
EXPECT_EQ(encode_frame_result.frame_type,
encode_frame_list[group_index].frame_type);
EXPECT_EQ(encode_frame_list[group_index].coding_index,
frame_coding_index);
EXPECT_GE(encode_frame_result.psnr, 34)
<< "The psnr is supposed to be greater than 34 given the "
"target_bitrate 1000 kbps";
EXPECT_EQ(encode_frame_result.ref_frame_info,
encode_frame_list[group_index].ref_frame_info);
total_data_bit_size += encode_frame_result.coding_data_bit_size;
++frame_coding_index;
}
if (encode_frame_result.frame_type == kAlternateReference) {
++num_alternate_refereces;
}
EXPECT_GE(encode_frame_result.show_idx, 0);
EXPECT_LT(encode_frame_result.show_idx, num_frames);
if (i == num_coding_frames - 1) {
EXPECT_EQ(encode_frame_result.show_idx, num_frames - 1)
<< "The last coding frame should be the last display order";
}
EXPECT_GE(encode_frame_result.psnr, 34)
<< "The psnr is supposed to be greater than 34 given the "
"target_bitrate 1000 kbps";
total_data_bit_size += encode_frame_result.coding_data_bit_size;
coded_show_frame_count += group_of_picture.show_frame_count;
}
EXPECT_EQ(num_alternate_refereces, ref_num_alternate_refereces);
const double bitrate = GetBitrateInKbps(total_data_bit_size, num_frames,
frame_rate_num, frame_rate_den);
const double bitrate = GetBitrateInKbps(total_data_bit_size, num_frames_,
frame_rate_num_, frame_rate_den_);
const double off_target_threshold = 150;
EXPECT_LE(fabs(target_bitrate - bitrate), off_target_threshold);
EXPECT_LE(fabs(target_bitrate_ - bitrate), off_target_threshold);
simple_encode.EndEncode();
}
TEST(SimpleEncode, EncodeFrameWithQuantizeIndex) {
SimpleEncode simple_encode(w, h, frame_rate_num, frame_rate_den,
target_bitrate, num_frames, infile_path);
TEST_F(SimpleEncodeTest, ObserveKeyFrameMap) {
SimpleEncode simple_encode(width_, height_, frame_rate_num_, frame_rate_den_,
target_bitrate_, num_frames_,
in_file_path_str_.c_str());
simple_encode.ComputeFirstPassStats();
int num_coding_frames = simple_encode.GetCodingFrameNum();
std::vector<int> key_frame_map = simple_encode.ObserveKeyFrameMap();
EXPECT_EQ(key_frame_map.size(), static_cast<size_t>(num_frames_));
simple_encode.StartEncode();
int coded_show_frame_count = 0;
while (coded_show_frame_count < num_frames_) {
const GroupOfPicture group_of_picture =
simple_encode.ObserveGroupOfPicture();
const std::vector<EncodeFrameInfo> &encode_frame_list =
group_of_picture.encode_frame_list;
for (size_t group_index = 0; group_index < encode_frame_list.size();
++group_index) {
EncodeFrameResult encode_frame_result;
simple_encode.EncodeFrame(&encode_frame_result);
if (encode_frame_result.frame_type == kFrameTypeKey) {
EXPECT_EQ(key_frame_map[encode_frame_result.show_idx], 1);
} else {
EXPECT_EQ(key_frame_map[encode_frame_result.show_idx], 0);
}
}
coded_show_frame_count += group_of_picture.show_frame_count;
}
simple_encode.EndEncode();
}
TEST_F(SimpleEncodeTest, EncodeFrameWithTargetFrameBits) {
SimpleEncode simple_encode(width_, height_, frame_rate_num_, frame_rate_den_,
target_bitrate_, num_frames_,
in_file_path_str_.c_str());
simple_encode.ComputeFirstPassStats();
const int num_coding_frames = simple_encode.GetCodingFrameNum();
simple_encode.StartEncode();
for (int i = 0; i < num_coding_frames; ++i) {
EncodeFrameInfo encode_frame_info = simple_encode.GetNextEncodeFrameInfo();
int target_frame_bits;
switch (encode_frame_info.frame_type) {
case kFrameTypeInter: target_frame_bits = 20000; break;
case kFrameTypeKey:
case kFrameTypeAltRef:
case kFrameTypeGolden: target_frame_bits = 100000; break;
case kFrameTypeOverlay: target_frame_bits = 2000; break;
default: target_frame_bits = 20000;
}
double percent_diff = 15;
if (encode_frame_info.frame_type == kFrameTypeOverlay) {
percent_diff = 100;
}
EncodeFrameResult encode_frame_result;
simple_encode.EncodeFrameWithTargetFrameBits(
&encode_frame_result, target_frame_bits, percent_diff);
const int recode_count = encode_frame_result.recode_count;
// TODO(angiebird): Replace 7 by RATE_CTRL_MAX_RECODE_NUM
EXPECT_LE(recode_count, 7);
EXPECT_GE(recode_count, 1);
const double diff = fabs((double)encode_frame_result.coding_data_bit_size -
target_frame_bits);
EXPECT_LE(diff * 100 / target_frame_bits, percent_diff);
}
simple_encode.EndEncode();
}
TEST_F(SimpleEncodeTest, EncodeFrameWithQuantizeIndex) {
SimpleEncode simple_encode(width_, height_, frame_rate_num_, frame_rate_den_,
target_bitrate_, num_frames_,
in_file_path_str_.c_str());
simple_encode.ComputeFirstPassStats();
const int num_coding_frames = simple_encode.GetCodingFrameNum();
simple_encode.StartEncode();
for (int i = 0; i < num_coding_frames; ++i) {
const int assigned_quantize_index = 100 + i;
@ -108,14 +220,24 @@ TEST(SimpleEncode, EncodeFrameWithQuantizeIndex) {
simple_encode.EndEncode();
}
TEST(SimpleEncode, EncodeConsistencyTest) {
// This test encodes the video using EncodeFrame(), where quantize indexes
// are selected by vp9 rate control.
// Encode stats and the quantize_indexes are collected.
// Then the test encodes the video again using EncodeFrameWithQuantizeIndex()
// using the quantize indexes collected from the first run.
// Then test whether the encode stats of the two encoding runs match.
TEST_F(SimpleEncodeTest, EncodeConsistencyTest) {
std::vector<int> quantize_index_list;
std::vector<uint64_t> ref_sse_list;
std::vector<double> ref_psnr_list;
std::vector<size_t> ref_bit_size_list;
std::vector<FrameType> ref_frame_type_list;
std::vector<int> ref_show_idx_list;
{
SimpleEncode simple_encode(w, h, frame_rate_num, frame_rate_den,
target_bitrate, num_frames, infile_path);
// The first encode.
SimpleEncode simple_encode(width_, height_, frame_rate_num_,
frame_rate_den_, target_bitrate_, num_frames_,
in_file_path_str_.c_str());
simple_encode.ComputeFirstPassStats();
const int num_coding_frames = simple_encode.GetCodingFrameNum();
simple_encode.StartEncode();
@ -126,17 +248,214 @@ TEST(SimpleEncode, EncodeConsistencyTest) {
ref_sse_list.push_back(encode_frame_result.sse);
ref_psnr_list.push_back(encode_frame_result.psnr);
ref_bit_size_list.push_back(encode_frame_result.coding_data_bit_size);
ref_frame_type_list.push_back(encode_frame_result.frame_type);
ref_show_idx_list.push_back(encode_frame_result.show_idx);
}
simple_encode.EndEncode();
}
{
SimpleEncode simple_encode(w, h, frame_rate_num, frame_rate_den,
target_bitrate, num_frames, infile_path);
// The second encode with quantize index got from the first encode.
SimpleEncode simple_encode(width_, height_, frame_rate_num_,
frame_rate_den_, target_bitrate_, num_frames_,
in_file_path_str_.c_str());
simple_encode.ComputeFirstPassStats();
const int num_coding_frames = simple_encode.GetCodingFrameNum();
EXPECT_EQ(static_cast<size_t>(num_coding_frames),
quantize_index_list.size());
simple_encode.StartEncode();
for (int i = 0; i < num_coding_frames; ++i) {
EncodeFrameResult encode_frame_result;
simple_encode.EncodeFrameWithQuantizeIndex(&encode_frame_result,
quantize_index_list[i]);
EXPECT_EQ(encode_frame_result.quantize_index, quantize_index_list[i]);
EXPECT_EQ(encode_frame_result.sse, ref_sse_list[i]);
EXPECT_DOUBLE_EQ(encode_frame_result.psnr, ref_psnr_list[i]);
EXPECT_EQ(encode_frame_result.coding_data_bit_size, ref_bit_size_list[i]);
EXPECT_EQ(encode_frame_result.frame_type, ref_frame_type_list[i]);
EXPECT_EQ(encode_frame_result.show_idx, ref_show_idx_list[i]);
}
simple_encode.EndEncode();
}
}
// Test the information (partition info and motion vector info) stored in
// encoder is the same between two encode runs.
TEST_F(SimpleEncodeTest, EncodeConsistencyTest2) {
const int num_rows_4x4 = GetNumUnit4x4(width_);
const int num_cols_4x4 = GetNumUnit4x4(height_);
const int num_units_4x4 = num_rows_4x4 * num_cols_4x4;
// The first encode.
SimpleEncode simple_encode(width_, height_, frame_rate_num_, frame_rate_den_,
target_bitrate_, num_frames_,
in_file_path_str_.c_str());
simple_encode.ComputeFirstPassStats();
const int num_coding_frames = simple_encode.GetCodingFrameNum();
std::vector<PartitionInfo> partition_info_list(num_units_4x4 *
num_coding_frames);
std::vector<MotionVectorInfo> motion_vector_info_list(num_units_4x4 *
num_coding_frames);
simple_encode.StartEncode();
for (int i = 0; i < num_coding_frames; ++i) {
EncodeFrameResult encode_frame_result;
simple_encode.EncodeFrame(&encode_frame_result);
for (int j = 0; j < num_rows_4x4 * num_cols_4x4; ++j) {
partition_info_list[i * num_units_4x4 + j] =
encode_frame_result.partition_info[j];
motion_vector_info_list[i * num_units_4x4 + j] =
encode_frame_result.motion_vector_info[j];
}
}
simple_encode.EndEncode();
// The second encode.
SimpleEncode simple_encode_2(width_, height_, frame_rate_num_,
frame_rate_den_, target_bitrate_, num_frames_,
in_file_path_str_.c_str());
simple_encode_2.ComputeFirstPassStats();
const int num_coding_frames_2 = simple_encode_2.GetCodingFrameNum();
simple_encode_2.StartEncode();
for (int i = 0; i < num_coding_frames_2; ++i) {
EncodeFrameResult encode_frame_result;
simple_encode_2.EncodeFrame(&encode_frame_result);
for (int j = 0; j < num_rows_4x4 * num_cols_4x4; ++j) {
EXPECT_EQ(encode_frame_result.partition_info[j].row,
partition_info_list[i * num_units_4x4 + j].row);
EXPECT_EQ(encode_frame_result.partition_info[j].column,
partition_info_list[i * num_units_4x4 + j].column);
EXPECT_EQ(encode_frame_result.partition_info[j].row_start,
partition_info_list[i * num_units_4x4 + j].row_start);
EXPECT_EQ(encode_frame_result.partition_info[j].column_start,
partition_info_list[i * num_units_4x4 + j].column_start);
EXPECT_EQ(encode_frame_result.partition_info[j].width,
partition_info_list[i * num_units_4x4 + j].width);
EXPECT_EQ(encode_frame_result.partition_info[j].height,
partition_info_list[i * num_units_4x4 + j].height);
EXPECT_EQ(encode_frame_result.motion_vector_info[j].mv_count,
motion_vector_info_list[i * num_units_4x4 + j].mv_count);
EXPECT_EQ(encode_frame_result.motion_vector_info[j].ref_frame[0],
motion_vector_info_list[i * num_units_4x4 + j].ref_frame[0]);
EXPECT_EQ(encode_frame_result.motion_vector_info[j].ref_frame[1],
motion_vector_info_list[i * num_units_4x4 + j].ref_frame[1]);
EXPECT_EQ(encode_frame_result.motion_vector_info[j].mv_row[0],
motion_vector_info_list[i * num_units_4x4 + j].mv_row[0]);
EXPECT_EQ(encode_frame_result.motion_vector_info[j].mv_column[0],
motion_vector_info_list[i * num_units_4x4 + j].mv_column[0]);
EXPECT_EQ(encode_frame_result.motion_vector_info[j].mv_row[1],
motion_vector_info_list[i * num_units_4x4 + j].mv_row[1]);
EXPECT_EQ(encode_frame_result.motion_vector_info[j].mv_column[1],
motion_vector_info_list[i * num_units_4x4 + j].mv_column[1]);
}
}
simple_encode_2.EndEncode();
}
// Test the information stored in encoder is the same between two encode runs.
TEST_F(SimpleEncodeTest, EncodeConsistencyTest3) {
std::vector<int> quantize_index_list;
const int num_rows_4x4 = GetNumUnit4x4(width_);
const int num_cols_4x4 = GetNumUnit4x4(height_);
const int num_units_4x4 = num_rows_4x4 * num_cols_4x4;
// The first encode.
SimpleEncode simple_encode(width_, height_, frame_rate_num_, frame_rate_den_,
target_bitrate_, num_frames_,
in_file_path_str_.c_str());
simple_encode.ComputeFirstPassStats();
const int num_coding_frames = simple_encode.GetCodingFrameNum();
std::vector<PartitionInfo> partition_info_list(num_units_4x4 *
num_coding_frames);
simple_encode.StartEncode();
for (int i = 0; i < num_coding_frames; ++i) {
EncodeFrameResult encode_frame_result;
simple_encode.EncodeFrame(&encode_frame_result);
quantize_index_list.push_back(encode_frame_result.quantize_index);
for (int j = 0; j < num_rows_4x4 * num_cols_4x4; ++j) {
partition_info_list[i * num_units_4x4 + j] =
encode_frame_result.partition_info[j];
}
}
simple_encode.EndEncode();
// The second encode.
SimpleEncode simple_encode_2(width_, height_, frame_rate_num_,
frame_rate_den_, target_bitrate_, num_frames_,
in_file_path_str_.c_str());
simple_encode_2.ComputeFirstPassStats();
const int num_coding_frames_2 = simple_encode_2.GetCodingFrameNum();
simple_encode_2.StartEncode();
for (int i = 0; i < num_coding_frames_2; ++i) {
EncodeFrameResult encode_frame_result;
simple_encode_2.EncodeFrameWithQuantizeIndex(&encode_frame_result,
quantize_index_list[i]);
for (int j = 0; j < num_rows_4x4 * num_cols_4x4; ++j) {
EXPECT_EQ(encode_frame_result.partition_info[j].row,
partition_info_list[i * num_units_4x4 + j].row);
EXPECT_EQ(encode_frame_result.partition_info[j].column,
partition_info_list[i * num_units_4x4 + j].column);
EXPECT_EQ(encode_frame_result.partition_info[j].row_start,
partition_info_list[i * num_units_4x4 + j].row_start);
EXPECT_EQ(encode_frame_result.partition_info[j].column_start,
partition_info_list[i * num_units_4x4 + j].column_start);
EXPECT_EQ(encode_frame_result.partition_info[j].width,
partition_info_list[i * num_units_4x4 + j].width);
EXPECT_EQ(encode_frame_result.partition_info[j].height,
partition_info_list[i * num_units_4x4 + j].height);
}
}
simple_encode_2.EndEncode();
}
// Encode with default VP9 decision first.
// Get QPs and arf locations from the first encode.
// Set external arfs and QPs for the second encode.
// Expect to get matched results.
TEST_F(SimpleEncodeTest, EncodeConsistencySetExternalGroupOfPicturesMap) {
std::vector<int> quantize_index_list;
std::vector<uint64_t> ref_sse_list;
std::vector<double> ref_psnr_list;
std::vector<size_t> ref_bit_size_list;
std::vector<int> gop_map(num_frames_, 0);
{
// The first encode.
SimpleEncode simple_encode(width_, height_, frame_rate_num_,
frame_rate_den_, target_bitrate_, num_frames_,
in_file_path_str_.c_str());
simple_encode.ComputeFirstPassStats();
simple_encode.StartEncode();
int coded_show_frame_count = 0;
while (coded_show_frame_count < num_frames_) {
const GroupOfPicture group_of_picture =
simple_encode.ObserveGroupOfPicture();
gop_map[coded_show_frame_count] |= kGopMapFlagStart;
if (group_of_picture.use_alt_ref) {
gop_map[coded_show_frame_count] |= kGopMapFlagUseAltRef;
}
const std::vector<EncodeFrameInfo> &encode_frame_list =
group_of_picture.encode_frame_list;
for (size_t group_index = 0; group_index < encode_frame_list.size();
++group_index) {
EncodeFrameResult encode_frame_result;
simple_encode.EncodeFrame(&encode_frame_result);
quantize_index_list.push_back(encode_frame_result.quantize_index);
ref_sse_list.push_back(encode_frame_result.sse);
ref_psnr_list.push_back(encode_frame_result.psnr);
ref_bit_size_list.push_back(encode_frame_result.coding_data_bit_size);
}
coded_show_frame_count += group_of_picture.show_frame_count;
}
simple_encode.EndEncode();
}
{
// The second encode with quantize index got from the first encode.
// The external arfs are the same as the first encode.
SimpleEncode simple_encode(width_, height_, frame_rate_num_,
frame_rate_den_, target_bitrate_, num_frames_,
in_file_path_str_.c_str());
simple_encode.ComputeFirstPassStats();
simple_encode.SetExternalGroupOfPicturesMap(gop_map.data(), gop_map.size());
const int num_coding_frames = simple_encode.GetCodingFrameNum();
EXPECT_EQ(static_cast<size_t>(num_coding_frames),
quantize_index_list.size());
simple_encode.StartEncode();
for (int i = 0; i < num_coding_frames; ++i) {
EncodeFrameResult encode_frame_result;
simple_encode.EncodeFrameWithQuantizeIndex(&encode_frame_result,
@ -149,6 +468,106 @@ TEST(SimpleEncode, EncodeConsistencyTest) {
simple_encode.EndEncode();
}
}
} // namespace
TEST_F(SimpleEncodeTest, SetExternalGroupOfPicturesMap) {
SimpleEncode simple_encode(width_, height_, frame_rate_num_, frame_rate_den_,
target_bitrate_, num_frames_,
in_file_path_str_.c_str());
simple_encode.ComputeFirstPassStats();
std::vector<int> gop_map(num_frames_, 0);
// Should be the first gop group.
gop_map[0] = 0;
// Second gop group with an alt ref.
gop_map[5] |= kGopMapFlagStart | kGopMapFlagUseAltRef;
// Third gop group without an alt ref.
gop_map[10] |= kGopMapFlagStart;
// Last gop group.
gop_map[14] |= kGopMapFlagStart | kGopMapFlagUseAltRef;
simple_encode.SetExternalGroupOfPicturesMap(gop_map.data(), gop_map.size());
std::vector<int> observed_gop_map =
simple_encode.ObserveExternalGroupOfPicturesMap();
// First gop group.
// There is always a key frame at show_idx 0 and key frame should always be
// the start of a gop. We expect ObserveExternalGroupOfPicturesMap() will
// insert an extra gop start here.
EXPECT_EQ(observed_gop_map[0], kGopMapFlagStart | kGopMapFlagUseAltRef);
// Second gop group with an alt ref.
EXPECT_EQ(observed_gop_map[5], kGopMapFlagStart | kGopMapFlagUseAltRef);
// Third gop group without an alt ref.
EXPECT_EQ(observed_gop_map[10], kGopMapFlagStart);
// Last gop group. The last gop is not supposed to use an alt ref. We expect
// ObserveExternalGroupOfPicturesMap() will remove the alt ref flag here.
EXPECT_EQ(observed_gop_map[14], kGopMapFlagStart);
int ref_gop_show_frame_count_list[4] = { 5, 5, 4, 3 };
size_t ref_gop_coded_frame_count_list[4] = { 6, 6, 4, 3 };
int gop_count = 0;
simple_encode.StartEncode();
int coded_show_frame_count = 0;
while (coded_show_frame_count < num_frames_) {
const GroupOfPicture group_of_picture =
simple_encode.ObserveGroupOfPicture();
const std::vector<EncodeFrameInfo> &encode_frame_list =
group_of_picture.encode_frame_list;
EXPECT_EQ(encode_frame_list.size(),
ref_gop_coded_frame_count_list[gop_count]);
EXPECT_EQ(group_of_picture.show_frame_count,
ref_gop_show_frame_count_list[gop_count]);
for (size_t group_index = 0; group_index < encode_frame_list.size();
++group_index) {
EncodeFrameResult encode_frame_result;
simple_encode.EncodeFrame(&encode_frame_result);
}
coded_show_frame_count += group_of_picture.show_frame_count;
++gop_count;
}
EXPECT_EQ(gop_count, 4);
simple_encode.EndEncode();
}
TEST_F(SimpleEncodeTest, GetEncodeFrameInfo) {
// Makes sure that the encode_frame_info obtained from GetEncodeFrameInfo()
// matches the counterpart in encode_frame_result obtained from EncodeFrame()
SimpleEncode simple_encode(width_, height_, frame_rate_num_, frame_rate_den_,
target_bitrate_, num_frames_,
in_file_path_str_.c_str());
simple_encode.ComputeFirstPassStats();
const int num_coding_frames = simple_encode.GetCodingFrameNum();
simple_encode.StartEncode();
for (int i = 0; i < num_coding_frames; ++i) {
EncodeFrameInfo encode_frame_info = simple_encode.GetNextEncodeFrameInfo();
EncodeFrameResult encode_frame_result;
simple_encode.EncodeFrame(&encode_frame_result);
EXPECT_EQ(encode_frame_info.show_idx, encode_frame_result.show_idx);
EXPECT_EQ(encode_frame_info.frame_type, encode_frame_result.frame_type);
}
simple_encode.EndEncode();
}
TEST_F(SimpleEncodeTest, GetFramePixelCount) {
SimpleEncode simple_encode(width_, height_, frame_rate_num_, frame_rate_den_,
target_bitrate_, num_frames_,
in_file_path_str_.c_str());
EXPECT_EQ(simple_encode.GetFramePixelCount(),
static_cast<uint64_t>(width_ * height_ * 3 / 2));
}
} // namespace
} // namespace vp9
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}

Просмотреть файл

@ -36,7 +36,7 @@ simple_encoder() {
eval "${VPX_TEST_PREFIX}" "${encoder}" "${codec}" "${YUV_RAW_INPUT_WIDTH}" \
"${YUV_RAW_INPUT_HEIGHT}" "${YUV_RAW_INPUT}" "${output_file}" 9999 0 100 \
${devnull}
${devnull} || return 1
[ -e "${output_file}" ] || return 1
}

Просмотреть файл

@ -18,7 +18,7 @@
YUV="${LIBVPX_TEST_DATA_PATH}/niklas_1280_720_30.yuv"
VP8="${LIBVPX_TEST_DATA_PATH}/tos_vp8.webm"
VP9="${LIBVPX_TEST_DATA_PATH}/vp90-2-sintel_1920x818_tile_1x4_fpm_2279kbps.webm"
DATA_URL="http://downloads.webmproject.org/test_data/libvpx/"
DATA_URL="https://storage.googleapis.com/downloads.webmproject.org/test_data/libvpx/"
SHA1_FILE="$(dirname $0)/test-data.sha1"
# Set sha1sum to proper sha program (sha1sum, shasum, sha1). This code is
@ -52,7 +52,7 @@ stress_verify_environment() {
fi
for file in "${YUV}" "${VP8}" "${VP9}"; do
if [ ! -e "${file}" ] ; then
download_and_check_file "${file}"
download_and_check_file "${file}" || return 1
fi
done
if [ ! -e "${YUV}" ] || [ ! -e "${VP8}" ] || [ ! -e "${VP9}" ] ; then

Просмотреть файл

@ -45,6 +45,7 @@ class SumSquaresTest : public ::testing::TestWithParam<SumSquaresParam> {
SSI16Func ref_func_;
SSI16Func tst_func_;
};
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(SumSquaresTest);
TEST_P(SumSquaresTest, OperationCheck) {
ACMRandom rnd(ACMRandom::DeterministicSeed());
@ -106,21 +107,21 @@ TEST_P(SumSquaresTest, ExtremeValues) {
using std::make_tuple;
#if HAVE_NEON
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
NEON, SumSquaresTest,
::testing::Values(make_tuple(&vpx_sum_squares_2d_i16_c,
&vpx_sum_squares_2d_i16_neon)));
#endif // HAVE_NEON
#if HAVE_SSE2
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SSE2, SumSquaresTest,
::testing::Values(make_tuple(&vpx_sum_squares_2d_i16_c,
&vpx_sum_squares_2d_i16_sse2)));
#endif // HAVE_SSE2
#if HAVE_MSA
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
MSA, SumSquaresTest,
::testing::Values(make_tuple(&vpx_sum_squares_2d_i16_c,
&vpx_sum_squares_2d_i16_msa)));

Просмотреть файл

@ -27,7 +27,7 @@ class SuperframeTest
public ::libvpx_test::CodecTestWithParam<SuperframeTestParam> {
protected:
SuperframeTest()
: EncoderTest(GET_PARAM(0)), modified_buf_(NULL), last_sf_pts_(0) {}
: EncoderTest(GET_PARAM(0)), modified_buf_(nullptr), last_sf_pts_(0) {}
virtual ~SuperframeTest() {}
virtual void SetUp() {
@ -95,7 +95,7 @@ TEST_P(SuperframeTest, TestSuperframeIndexIsOptional) {
EXPECT_EQ(sf_count_, 1);
}
VP9_INSTANTIATE_TEST_CASE(
VP9_INSTANTIATE_TEST_SUITE(
SuperframeTest,
::testing::Combine(::testing::Values(::libvpx_test::kTwoPassGood),
::testing::Values(0)));

Просмотреть файл

@ -60,6 +60,7 @@ class DatarateOnePassCbrSvc : public OnePassCbrSvc {
memset(bits_total_, 0, sizeof(bits_total_));
memset(layer_target_avg_bandwidth_, 0, sizeof(layer_target_avg_bandwidth_));
dynamic_drop_layer_ = false;
single_layer_resize_ = false;
change_bitrate_ = false;
last_pts_ref_ = 0;
middle_bitrate_ = 0;
@ -77,6 +78,13 @@ class DatarateOnePassCbrSvc : public OnePassCbrSvc {
use_post_encode_drop_ = 0;
denoiser_off_on_ = false;
denoiser_enable_layers_ = false;
num_resize_down_ = 0;
num_resize_up_ = 0;
for (int i = 0; i < VPX_MAX_LAYERS; i++) {
prev_frame_width[i] = 320;
prev_frame_height[i] = 240;
}
ksvc_flex_noupd_tlenh_ = false;
}
virtual void BeginPassHook(unsigned int /*pass*/) {}
@ -84,9 +92,10 @@ class DatarateOnePassCbrSvc : public OnePassCbrSvc {
// bypass/flexible mode. The pattern corresponds to the pattern
// VP9E_TEMPORAL_LAYERING_MODE_0101 (temporal_layering_mode == 2) used in
// non-flexible mode, except that we disable inter-layer prediction.
void set_frame_flags_bypass_mode(
int tl, int num_spatial_layers, int is_key_frame,
vpx_svc_ref_frame_config_t *ref_frame_config) {
void set_frame_flags_bypass_mode(int tl, int num_spatial_layers,
int is_key_frame,
vpx_svc_ref_frame_config_t *ref_frame_config,
int noupdate_tlenh) {
for (int sl = 0; sl < num_spatial_layers; ++sl)
ref_frame_config->update_buffer_slot[sl] = 0;
@ -144,9 +153,12 @@ class DatarateOnePassCbrSvc : public OnePassCbrSvc {
ref_frame_config->reference_last[sl] = 1;
ref_frame_config->reference_golden[sl] = 0;
ref_frame_config->reference_alt_ref[sl] = 0;
ref_frame_config->update_buffer_slot[sl] |=
1 << ref_frame_config->alt_fb_idx[sl];
// Non reference frame on top temporal top spatial.
ref_frame_config->update_buffer_slot[sl] = 0;
}
// Force no update on all spatial layers for temporal enhancement layer
// frames.
if (noupdate_tlenh) ref_frame_config->update_buffer_slot[sl] = 0;
}
}
}
@ -237,6 +249,22 @@ class DatarateOnePassCbrSvc : public OnePassCbrSvc {
}
}
if (ksvc_flex_noupd_tlenh_) {
vpx_svc_layer_id_t layer_id;
layer_id.spatial_layer_id = 0;
layer_id.temporal_layer_id = (video->frame() % 2 != 0);
temporal_layer_id_ = layer_id.temporal_layer_id;
for (int i = 0; i < number_spatial_layers_; i++) {
layer_id.temporal_layer_id_per_spatial[i] = temporal_layer_id_;
ref_frame_config.duration[i] = 1;
}
encoder->Control(VP9E_SET_SVC_LAYER_ID, &layer_id);
set_frame_flags_bypass_mode(layer_id.temporal_layer_id,
number_spatial_layers_, 0, &ref_frame_config,
1);
encoder->Control(VP9E_SET_SVC_REF_FRAME_CONFIG, &ref_frame_config);
}
if (update_pattern_ && video->frame() >= 100) {
vpx_svc_layer_id_t layer_id;
if (video->frame() == 100) {
@ -247,11 +275,14 @@ class DatarateOnePassCbrSvc : public OnePassCbrSvc {
layer_id.spatial_layer_id = 0;
layer_id.temporal_layer_id = (video->frame() % 2 != 0);
temporal_layer_id_ = layer_id.temporal_layer_id;
for (int i = 0; i < number_spatial_layers_; i++)
for (int i = 0; i < number_spatial_layers_; i++) {
layer_id.temporal_layer_id_per_spatial[i] = temporal_layer_id_;
ref_frame_config.duration[i] = 1;
}
encoder->Control(VP9E_SET_SVC_LAYER_ID, &layer_id);
set_frame_flags_bypass_mode(layer_id.temporal_layer_id,
number_spatial_layers_, 0, &ref_frame_config);
number_spatial_layers_, 0, &ref_frame_config,
0);
encoder->Control(VP9E_SET_SVC_REF_FRAME_CONFIG, &ref_frame_config);
}
@ -285,9 +316,7 @@ class DatarateOnePassCbrSvc : public OnePassCbrSvc {
encoder->Config(&cfg_);
}
if (dynamic_drop_layer_) {
// TODO(jian): Disable AQ Mode for this test for now.
encoder->Control(VP9E_SET_AQ_MODE, 0);
if (dynamic_drop_layer_ && !single_layer_resize_) {
if (video->frame() == 0) {
// Change layer bitrates to set top layers to 0. This will trigger skip
// encoding/dropping of top two spatial layers.
@ -329,8 +358,41 @@ class DatarateOnePassCbrSvc : public OnePassCbrSvc {
cfg_.rc_target_bitrate += cfg_.layer_target_bitrate[2];
encoder->Config(&cfg_);
}
} else if (dynamic_drop_layer_ && single_layer_resize_) {
// Change layer bitrates to set top layers to 0. This will trigger skip
// encoding/dropping of top spatial layers.
if (video->frame() == 2) {
cfg_.rc_target_bitrate -=
(cfg_.layer_target_bitrate[1] + cfg_.layer_target_bitrate[2]);
middle_bitrate_ = cfg_.layer_target_bitrate[1];
top_bitrate_ = cfg_.layer_target_bitrate[2];
cfg_.layer_target_bitrate[1] = 0;
cfg_.layer_target_bitrate[2] = 0;
// Set spatial layer 0 to a very low bitrate to trigger resize.
cfg_.layer_target_bitrate[0] = 30;
cfg_.rc_target_bitrate = cfg_.layer_target_bitrate[0];
encoder->Config(&cfg_);
} else if (video->frame() == 100) {
// Set base spatial layer to very high to go back up to original size.
cfg_.layer_target_bitrate[0] = 400;
cfg_.rc_target_bitrate = cfg_.layer_target_bitrate[0];
encoder->Config(&cfg_);
}
} else if (!dynamic_drop_layer_ && single_layer_resize_) {
if (video->frame() == 2) {
cfg_.layer_target_bitrate[0] = 30;
cfg_.layer_target_bitrate[1] = 50;
cfg_.rc_target_bitrate =
(cfg_.layer_target_bitrate[0] + cfg_.layer_target_bitrate[1]);
encoder->Config(&cfg_);
} else if (video->frame() == 160) {
cfg_.layer_target_bitrate[0] = 1500;
cfg_.layer_target_bitrate[1] = 2000;
cfg_.rc_target_bitrate =
(cfg_.layer_target_bitrate[0] + cfg_.layer_target_bitrate[1]);
encoder->Config(&cfg_);
}
}
if (force_key_test_ && force_key_) frame_flags_ = VPX_EFLAG_FORCE_KF;
if (insert_layer_sync_) {
@ -428,10 +490,12 @@ class DatarateOnePassCbrSvc : public OnePassCbrSvc {
parse_superframe_index(static_cast<const uint8_t *>(pkt->data.frame.buf),
pkt->data.frame.sz, sizes_parsed, &count);
// Count may be less than number of spatial layers because of frame drops.
for (int sl = 0; sl < number_spatial_layers_; ++sl) {
if (pkt->data.frame.spatial_layer_encoded[sl]) {
sizes[sl] = sizes_parsed[num_layers_encoded];
num_layers_encoded++;
if (number_spatial_layers_ > 1) {
for (int sl = 0; sl < number_spatial_layers_; ++sl) {
if (pkt->data.frame.spatial_layer_encoded[sl]) {
sizes[sl] = sizes_parsed[num_layers_encoded];
num_layers_encoded++;
}
}
}
// For superframe with Intra-only count will be +1 larger
@ -483,13 +547,24 @@ class DatarateOnePassCbrSvc : public OnePassCbrSvc {
}
}
ASSERT_EQ(pkt->data.frame.width[sl],
top_sl_width_ * svc_params_.scaling_factor_num[sl] /
svc_params_.scaling_factor_den[sl]);
if (!single_layer_resize_) {
ASSERT_EQ(pkt->data.frame.width[sl],
top_sl_width_ * svc_params_.scaling_factor_num[sl] /
svc_params_.scaling_factor_den[sl]);
ASSERT_EQ(pkt->data.frame.height[sl],
top_sl_height_ * svc_params_.scaling_factor_num[sl] /
svc_params_.scaling_factor_den[sl]);
ASSERT_EQ(pkt->data.frame.height[sl],
top_sl_height_ * svc_params_.scaling_factor_num[sl] /
svc_params_.scaling_factor_den[sl]);
} else if (superframe_count_ > 0) {
if (pkt->data.frame.width[sl] < prev_frame_width[sl] &&
pkt->data.frame.height[sl] < prev_frame_height[sl])
num_resize_down_ += 1;
if (pkt->data.frame.width[sl] > prev_frame_width[sl] &&
pkt->data.frame.height[sl] > prev_frame_height[sl])
num_resize_up_ += 1;
}
prev_frame_width[sl] = pkt->data.frame.width[sl];
prev_frame_height[sl] = pkt->data.frame.height[sl];
}
}
@ -506,9 +581,14 @@ class DatarateOnePassCbrSvc : public OnePassCbrSvc {
}
virtual void MismatchHook(const vpx_image_t *img1, const vpx_image_t *img2) {
double mismatch_psnr = compute_psnr(img1, img2);
mismatch_psnr_ += mismatch_psnr;
++mismatch_nframes_;
// TODO(marpan): Look into why an assert is triggered in compute_psnr
// for mismatch frames for the special test case: ksvc_flex_noupd_tlenh.
// Has to do with dropped frames in bypass/flexible svc mode.
if (!ksvc_flex_noupd_tlenh_) {
double mismatch_psnr = compute_psnr(img1, img2);
mismatch_psnr_ += mismatch_psnr;
++mismatch_nframes_;
}
}
unsigned int GetMismatchFrames() { return mismatch_nframes_; }
@ -525,6 +605,7 @@ class DatarateOnePassCbrSvc : public OnePassCbrSvc {
int tune_content_;
int spatial_layer_id_;
bool dynamic_drop_layer_;
bool single_layer_resize_;
unsigned int top_sl_width_;
unsigned int top_sl_height_;
vpx_svc_ref_frame_config_t ref_frame_config;
@ -548,6 +629,11 @@ class DatarateOnePassCbrSvc : public OnePassCbrSvc {
bool denoiser_off_on_;
// Top layer enabled on the fly.
bool denoiser_enable_layers_;
int num_resize_up_;
int num_resize_down_;
unsigned int prev_frame_width[VPX_MAX_LAYERS];
unsigned int prev_frame_height[VPX_MAX_LAYERS];
bool ksvc_flex_noupd_tlenh_;
private:
virtual void SetConfig(const int num_temporal_layer) {
@ -666,14 +752,14 @@ TEST_P(DatarateOnePassCbrSvcSingleBR, OnePassCbrSvc3SL2TLDynamicPatternChange) {
cfg_.g_threads = 1;
cfg_.rc_dropframe_thresh = 30;
cfg_.kf_max_dist = 9999;
// Change SVC pattern on the fly.
update_pattern_ = 1;
::libvpx_test::I420VideoSource video("niklas_640_480_30.yuv", 640, 480, 30, 1,
0, 400);
top_sl_width_ = 640;
top_sl_height_ = 480;
cfg_.rc_target_bitrate = 800;
ResetModel();
// Change SVC pattern on the fly.
update_pattern_ = 1;
AssignLayerBitrates();
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
CheckLayerRateTargeting(number_spatial_layers_, number_temporal_layers_, 0.78,
@ -794,6 +880,79 @@ TEST_P(DatarateOnePassCbrSvcSingleBR, OnePassCbrSvc3SL_DisableEnableLayers) {
#endif
}
// Check basic rate targeting for 1 pass CBR SVC with 2 spatial layers and on
// the fly switching to 1 spatial layer with dynamic resize enabled.
// The resizer will resize the single layer down and back up again, as the
// bitrate goes back up.
TEST_P(DatarateOnePassCbrSvcSingleBR, OnePassCbrSvc2SL_SingleLayerResize) {
SetSvcConfig(2, 1);
cfg_.rc_buf_initial_sz = 500;
cfg_.rc_buf_optimal_sz = 500;
cfg_.rc_buf_sz = 1000;
cfg_.rc_min_quantizer = 0;
cfg_.rc_max_quantizer = 63;
cfg_.g_threads = 1;
cfg_.temporal_layering_mode = 0;
cfg_.rc_dropframe_thresh = 30;
cfg_.kf_max_dist = 9999;
cfg_.rc_resize_allowed = 1;
::libvpx_test::I420VideoSource video("desktop_office1.1280_720-020.yuv", 1280,
720, 15, 1, 0, 300);
top_sl_width_ = 1280;
top_sl_height_ = 720;
cfg_.rc_target_bitrate = 800;
ResetModel();
dynamic_drop_layer_ = true;
single_layer_resize_ = true;
base_speed_setting_ = speed_setting_;
AssignLayerBitrates();
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
// Expect at least one resize down and at least one resize back up.
EXPECT_GE(num_resize_down_, 1);
EXPECT_GE(num_resize_up_, 1);
// Don't check rate targeting on two top spatial layer since they will be
// skipped for part of the sequence.
CheckLayerRateTargeting(number_spatial_layers_ - 2, number_temporal_layers_,
0.78, 1.15);
#if CONFIG_VP9_DECODER
// The non-reference frames are expected to be mismatched frames as the
// encoder will avoid loopfilter on these frames.
EXPECT_EQ(GetNonRefFrames(), GetMismatchFrames());
#endif
}
// For pass CBR SVC with 1 spatial and 2 temporal layers with dynamic resize
// and denoiser enabled. The resizer will resize the single layer down and back
// up again, as the bitrate goes back up.
TEST_P(DatarateOnePassCbrSvcSingleBR, OnePassCbrSvc1SL2TL_DenoiseResize) {
SetSvcConfig(1, 2);
cfg_.rc_buf_initial_sz = 500;
cfg_.rc_buf_optimal_sz = 500;
cfg_.rc_buf_sz = 1000;
cfg_.rc_min_quantizer = 0;
cfg_.rc_max_quantizer = 63;
cfg_.g_threads = 1;
cfg_.temporal_layering_mode = 2;
cfg_.rc_dropframe_thresh = 30;
cfg_.kf_max_dist = 9999;
cfg_.rc_resize_allowed = 1;
::libvpx_test::I420VideoSource video("desktop_office1.1280_720-020.yuv", 1280,
720, 12, 1, 0, 300);
top_sl_width_ = 1280;
top_sl_height_ = 720;
cfg_.rc_target_bitrate = 800;
ResetModel();
dynamic_drop_layer_ = false;
single_layer_resize_ = true;
denoiser_on_ = 1;
base_speed_setting_ = speed_setting_;
AssignLayerBitrates();
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
// Expect at least one resize down and at least one resize back up.
EXPECT_GE(num_resize_down_, 1);
EXPECT_GE(num_resize_up_, 1);
}
// Run SVC encoder for 1 temporal layer, 2 spatial layers, with spatial
// downscale 5x5.
TEST_P(DatarateOnePassCbrSvcSingleBR, OnePassCbrSvc2SL1TL5x5MultipleRuns) {
@ -977,6 +1136,36 @@ TEST_P(DatarateOnePassCbrSvcFrameDropMultiBR, OnePassCbrSvc3SL3TL4Threads) {
#endif
}
// Check basic rate targeting for 1 pass CBR SVC: 3 spatial layers and
// 2 temporal layers, for KSVC in flexible mode with no update of reference
// frames for all spatial layers on TL > 0 superframes.
// Run HD clip with 4 threads.
TEST_P(DatarateOnePassCbrSvcFrameDropMultiBR, OnePassCbrSvc3SL2TL4ThKSVCFlex) {
SetSvcConfig(3, 2);
cfg_.rc_buf_initial_sz = 500;
cfg_.rc_buf_optimal_sz = 500;
cfg_.rc_buf_sz = 1000;
cfg_.rc_min_quantizer = 0;
cfg_.rc_max_quantizer = 63;
cfg_.g_threads = 4;
cfg_.rc_dropframe_thresh = 30;
cfg_.kf_max_dist = 9999;
::libvpx_test::Y4mVideoSource video("niklas_1280_720_30.y4m", 0, 60);
top_sl_width_ = 1280;
top_sl_height_ = 720;
layer_framedrop_ = 0;
const int bitrates[3] = { 200, 400, 600 };
cfg_.rc_target_bitrate = bitrates[GET_PARAM(3)];
ResetModel();
layer_framedrop_ = GET_PARAM(2);
AssignLayerBitrates();
ksvc_flex_noupd_tlenh_ = true;
cfg_.temporal_layering_mode = VP9E_TEMPORAL_LAYERING_MODE_BYPASS;
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
CheckLayerRateTargeting(number_spatial_layers_, number_temporal_layers_, 0.58,
1.2);
}
// Params: speed setting, inter-layer prediction mode.
class DatarateOnePassCbrSvcInterLayerPredSingleBR
: public DatarateOnePassCbrSvc,
@ -1400,29 +1589,29 @@ TEST_P(DatarateOnePassCbrSvcPostencodeDrop, OnePassCbrSvc2QL1TLScreen) {
#endif
}
VP9_INSTANTIATE_TEST_CASE(DatarateOnePassCbrSvcSingleBR,
::testing::Range(5, 10));
VP9_INSTANTIATE_TEST_SUITE(DatarateOnePassCbrSvcSingleBR,
::testing::Range(5, 10));
VP9_INSTANTIATE_TEST_CASE(DatarateOnePassCbrSvcPostencodeDrop,
::testing::Range(5, 6));
VP9_INSTANTIATE_TEST_SUITE(DatarateOnePassCbrSvcPostencodeDrop,
::testing::Range(5, 6));
VP9_INSTANTIATE_TEST_CASE(DatarateOnePassCbrSvcInterLayerPredSingleBR,
::testing::Range(5, 10), ::testing::Range(0, 3));
VP9_INSTANTIATE_TEST_SUITE(DatarateOnePassCbrSvcInterLayerPredSingleBR,
::testing::Range(5, 10), ::testing::Range(0, 3));
VP9_INSTANTIATE_TEST_CASE(DatarateOnePassCbrSvcMultiBR, ::testing::Range(5, 10),
::testing::Range(0, 3));
VP9_INSTANTIATE_TEST_SUITE(DatarateOnePassCbrSvcMultiBR,
::testing::Range(5, 10), ::testing::Range(0, 3));
VP9_INSTANTIATE_TEST_CASE(DatarateOnePassCbrSvcFrameDropMultiBR,
::testing::Range(5, 10), ::testing::Range(0, 2),
::testing::Range(0, 3));
VP9_INSTANTIATE_TEST_SUITE(DatarateOnePassCbrSvcFrameDropMultiBR,
::testing::Range(5, 10), ::testing::Range(0, 2),
::testing::Range(0, 3));
#if CONFIG_VP9_TEMPORAL_DENOISING
VP9_INSTANTIATE_TEST_CASE(DatarateOnePassCbrSvcDenoiser,
::testing::Range(5, 10), ::testing::Range(1, 3),
::testing::Range(0, 3), ::testing::Range(0, 4));
VP9_INSTANTIATE_TEST_SUITE(DatarateOnePassCbrSvcDenoiser,
::testing::Range(5, 10), ::testing::Range(1, 3),
::testing::Range(0, 3), ::testing::Range(0, 4));
#endif
VP9_INSTANTIATE_TEST_CASE(DatarateOnePassCbrSvcSmallKF, ::testing::Range(5, 10),
::testing::Range(32, 36));
VP9_INSTANTIATE_TEST_SUITE(DatarateOnePassCbrSvcSmallKF,
::testing::Range(5, 10), ::testing::Range(32, 36));
} // namespace
} // namespace svc_test

Просмотреть файл

@ -121,7 +121,8 @@ class SyncFrameOnePassCbrSvc : public OnePassCbrSvc,
frame_to_start_decode_(0), frame_to_sync_(0),
inter_layer_pred_mode_(GET_PARAM(1)), decode_to_layer_before_sync_(-1),
decode_to_layer_after_sync_(-1), denoiser_on_(0),
intra_only_test_(false), mismatch_nframes_(0), num_nonref_frames_(0) {
intra_only_test_(false), loopfilter_off_(0), mismatch_nframes_(0),
num_nonref_frames_(0) {
SetMode(::libvpx_test::kRealTime);
memset(&svc_layer_sync_, 0, sizeof(svc_layer_sync_));
}
@ -154,6 +155,8 @@ class SyncFrameOnePassCbrSvc : public OnePassCbrSvc,
// So set it here in these tess to avoid encoder-decoder
// mismatch check on color space setting.
encoder->Control(VP9E_SET_COLOR_SPACE, VPX_CS_BT_601);
encoder->Control(VP9E_SET_DISABLE_LOOPFILTER, loopfilter_off_);
}
if (video->frame() == frame_to_sync_) {
encoder->Control(VP9E_SET_SVC_SPATIAL_LAYER_SYNC, &svc_layer_sync_);
@ -214,7 +217,10 @@ class SyncFrameOnePassCbrSvc : public OnePassCbrSvc,
int decode_to_layer_after_sync_;
int denoiser_on_;
bool intra_only_test_;
int loopfilter_off_;
vpx_svc_spatial_layer_sync_t svc_layer_sync_;
unsigned int mismatch_nframes_;
unsigned int num_nonref_frames_;
private:
virtual void SetConfig(const int num_temporal_layer) {
@ -243,9 +249,6 @@ class SyncFrameOnePassCbrSvc : public OnePassCbrSvc,
cfg_.temporal_layering_mode = 1;
}
}
unsigned int mismatch_nframes_;
unsigned int num_nonref_frames_;
};
// Test for sync layer for 1 pass CBR SVC: 3 spatial layers and
@ -470,9 +473,177 @@ TEST_P(SyncFrameOnePassCbrSvc, OnePassCbrSvc1SL3TLSyncFrameIntraOnlyQVGA) {
#endif
}
VP9_INSTANTIATE_TEST_CASE(SyncFrameOnePassCbrSvc, ::testing::Range(0, 3));
// Params: Loopfilter modes.
class LoopfilterOnePassCbrSvc : public OnePassCbrSvc,
public ::libvpx_test::CodecTestWithParam<int> {
public:
LoopfilterOnePassCbrSvc()
: OnePassCbrSvc(GET_PARAM(0)), loopfilter_off_(GET_PARAM(1)),
mismatch_nframes_(0), num_nonref_frames_(0) {
SetMode(::libvpx_test::kRealTime);
}
INSTANTIATE_TEST_CASE_P(
protected:
virtual ~LoopfilterOnePassCbrSvc() {}
virtual void SetUp() {
InitializeConfig();
speed_setting_ = 7;
}
virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
::libvpx_test::Encoder *encoder) {
PreEncodeFrameHookSetup(video, encoder);
if (number_temporal_layers_ > 1 || number_spatial_layers_ > 1) {
// Consider 3 cases:
if (loopfilter_off_ == 0) {
// loopfilter is on for all spatial layers on every superrframe.
for (int i = 0; i < VPX_SS_MAX_LAYERS; ++i) {
svc_params_.loopfilter_ctrl[i] = 0;
}
} else if (loopfilter_off_ == 1) {
// loopfilter is off for non-reference frames for all spatial layers.
for (int i = 0; i < VPX_SS_MAX_LAYERS; ++i) {
svc_params_.loopfilter_ctrl[i] = 1;
}
} else {
// loopfilter is off for all SL0 frames, and off only for non-reference
// frames for SL > 0.
svc_params_.loopfilter_ctrl[0] = 2;
for (int i = 1; i < VPX_SS_MAX_LAYERS; ++i) {
svc_params_.loopfilter_ctrl[i] = 1;
}
}
encoder->Control(VP9E_SET_SVC_PARAMETERS, &svc_params_);
} else if (number_temporal_layers_ == 1 && number_spatial_layers_ == 1) {
// For non-SVC mode use the single layer control.
encoder->Control(VP9E_SET_DISABLE_LOOPFILTER, loopfilter_off_);
}
}
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
// Keep track of number of non-reference frames, needed for mismatch check.
// Non-reference frames are top spatial and temporal layer frames,
// for TL > 0.
if (temporal_layer_id_ == number_temporal_layers_ - 1 &&
temporal_layer_id_ > 0 &&
pkt->data.frame.spatial_layer_encoded[number_spatial_layers_ - 1])
num_nonref_frames_++;
}
virtual void MismatchHook(const vpx_image_t * /*img1*/,
const vpx_image_t * /*img2*/) {
++mismatch_nframes_;
}
virtual void SetConfig(const int /*num_temporal_layer*/) {}
int GetMismatchFrames() const { return mismatch_nframes_; }
int GetNonRefFrames() const { return num_nonref_frames_; }
int loopfilter_off_;
private:
int mismatch_nframes_;
int num_nonref_frames_;
};
TEST_P(LoopfilterOnePassCbrSvc, OnePassCbrSvc1SL1TLLoopfilterOff) {
SetSvcConfig(1, 1);
cfg_.rc_buf_initial_sz = 500;
cfg_.rc_buf_optimal_sz = 500;
cfg_.rc_buf_sz = 1000;
cfg_.rc_min_quantizer = 0;
cfg_.rc_max_quantizer = 63;
cfg_.g_threads = 1;
cfg_.rc_dropframe_thresh = 0;
cfg_.rc_target_bitrate = 800;
cfg_.kf_max_dist = 9999;
cfg_.rc_end_usage = VPX_CBR;
cfg_.g_lag_in_frames = 0;
cfg_.g_error_resilient = 1;
cfg_.ts_rate_decimator[0] = 1;
cfg_.temporal_layering_mode = 0;
::libvpx_test::I420VideoSource video("niklas_640_480_30.yuv", 640, 480, 30, 1,
0, 400);
cfg_.rc_target_bitrate = 600;
AssignLayerBitrates();
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
#if CONFIG_VP9_DECODER
if (loopfilter_off_ == 0)
EXPECT_EQ(GetNonRefFrames(), GetMismatchFrames());
else
EXPECT_EQ(GetMismatchFrames(), 0);
#endif
}
TEST_P(LoopfilterOnePassCbrSvc, OnePassCbrSvc1SL3TLLoopfilterOff) {
SetSvcConfig(1, 3);
cfg_.rc_buf_initial_sz = 500;
cfg_.rc_buf_optimal_sz = 500;
cfg_.rc_buf_sz = 1000;
cfg_.rc_min_quantizer = 0;
cfg_.rc_max_quantizer = 63;
cfg_.g_threads = 1;
cfg_.rc_dropframe_thresh = 0;
cfg_.rc_target_bitrate = 800;
cfg_.kf_max_dist = 9999;
cfg_.rc_end_usage = VPX_CBR;
cfg_.g_lag_in_frames = 0;
cfg_.g_error_resilient = 1;
cfg_.ts_rate_decimator[0] = 4;
cfg_.ts_rate_decimator[1] = 2;
cfg_.ts_rate_decimator[2] = 1;
cfg_.temporal_layering_mode = 3;
::libvpx_test::I420VideoSource video("niklas_640_480_30.yuv", 640, 480, 30, 1,
0, 400);
cfg_.rc_target_bitrate = 600;
AssignLayerBitrates();
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
#if CONFIG_VP9_DECODER
if (loopfilter_off_ == 0)
EXPECT_EQ(GetNonRefFrames(), GetMismatchFrames());
else
EXPECT_EQ(GetMismatchFrames(), 0);
#endif
}
TEST_P(LoopfilterOnePassCbrSvc, OnePassCbrSvc3SL3TLLoopfilterOff) {
SetSvcConfig(3, 3);
cfg_.rc_buf_initial_sz = 500;
cfg_.rc_buf_optimal_sz = 500;
cfg_.rc_buf_sz = 1000;
cfg_.rc_min_quantizer = 0;
cfg_.rc_max_quantizer = 63;
cfg_.g_threads = 1;
cfg_.rc_dropframe_thresh = 0;
cfg_.rc_target_bitrate = 800;
cfg_.kf_max_dist = 9999;
cfg_.rc_end_usage = VPX_CBR;
cfg_.g_lag_in_frames = 0;
cfg_.g_error_resilient = 1;
cfg_.ts_rate_decimator[0] = 4;
cfg_.ts_rate_decimator[1] = 2;
cfg_.ts_rate_decimator[2] = 1;
cfg_.temporal_layering_mode = 3;
::libvpx_test::I420VideoSource video("niklas_640_480_30.yuv", 640, 480, 30, 1,
0, 400);
cfg_.rc_target_bitrate = 600;
AssignLayerBitrates();
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
#if CONFIG_VP9_DECODER
if (loopfilter_off_ == 0)
EXPECT_EQ(GetNonRefFrames(), GetMismatchFrames());
else
EXPECT_EQ(GetMismatchFrames(), 0);
#endif
}
VP9_INSTANTIATE_TEST_SUITE(SyncFrameOnePassCbrSvc, ::testing::Range(0, 3));
VP9_INSTANTIATE_TEST_SUITE(LoopfilterOnePassCbrSvc, ::testing::Range(0, 3));
INSTANTIATE_TEST_SUITE_P(
VP9, ScalePartitionOnePassCbrSvc,
::testing::Values(
static_cast<const libvpx_test::CodecFactory *>(&libvpx_test::kVP9)));

Просмотреть файл

@ -43,13 +43,14 @@ void OnePassCbrSvc::PreEncodeFrameHookSetup(::libvpx_test::VideoSource *video,
svc_params_.max_quantizers[i] = 63;
svc_params_.min_quantizers[i] = 0;
}
svc_params_.speed_per_layer[0] = base_speed_setting_;
for (int i = 1; i < VPX_SS_MAX_LAYERS; ++i) {
svc_params_.speed_per_layer[i] = speed_setting_;
if (number_temporal_layers_ > 1 || number_spatial_layers_ > 1) {
svc_params_.speed_per_layer[0] = base_speed_setting_;
for (int i = 1; i < VPX_SS_MAX_LAYERS; ++i) {
svc_params_.speed_per_layer[i] = speed_setting_;
}
encoder->Control(VP9E_SET_SVC, 1);
encoder->Control(VP9E_SET_SVC_PARAMETERS, &svc_params_);
}
encoder->Control(VP9E_SET_SVC, 1);
encoder->Control(VP9E_SET_SVC_PARAMETERS, &svc_params_);
encoder->Control(VP8E_SET_CPUUSED, speed_setting_);
encoder->Control(VP9E_SET_AQ_MODE, 3);
encoder->Control(VP8E_SET_MAX_INTRA_BITRATE_PCT, 300);

Просмотреть файл

@ -2,6 +2,7 @@ LIBVPX_TEST_SRCS-yes += test-data.mk
# Encoder test source
LIBVPX_TEST_DATA-$(CONFIG_ENCODERS) += hantro_collage_w352h288.yuv
LIBVPX_TEST_DATA-$(CONFIG_ENCODERS) += hantro_collage_w352h288_nv12.yuv
LIBVPX_TEST_DATA-$(CONFIG_ENCODERS) += hantro_odd.yuv
LIBVPX_TEST_DATA-$(CONFIG_ENCODERS) += desktop_office1.1280_720-020.yuv
LIBVPX_TEST_DATA-$(CONFIG_ENCODERS) += slides_code_term_web_plot.1920_1080.yuv
@ -26,7 +27,7 @@ LIBVPX_TEST_DATA-$(CONFIG_VP9_ENCODER) += noisy_clip_640_360.y4m
LIBVPX_TEST_DATA-$(CONFIG_VP9_ENCODER) += rush_hour_444.y4m
LIBVPX_TEST_DATA-$(CONFIG_VP9_ENCODER) += screendata.y4m
LIBVPX_TEST_DATA-$(CONFIG_VP9_ENCODER) += niklas_640_480_30.yuv
LIBVPX_TEST_DATA-$(CONFIG_RATE_CTRL) += bus_352x288_420_f20_b8.yuv
LIBVPX_TEST_DATA-$(CONFIG_VP9_ENCODER) += bus_352x288_420_f20_b8.yuv
# Test vectors
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-001.ivf
@ -737,6 +738,8 @@ endif # CONFIG_VP9_HIGHBITDEPTH
# Invalid files for testing libvpx error checking.
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += invalid-bug-1443.ivf
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += invalid-bug-1443.ivf.res
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += invalid-bug-148271109.ivf
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += invalid-bug-148271109.ivf.res
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += invalid-token-partition.ivf
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += invalid-token-partition.ivf.res
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += invalid-vp80-00-comprehensive-018.ivf.2kf_0x6.ivf

Просмотреть файл

@ -866,3 +866,6 @@ c62b005a9fd32c36a1b3f67de6840330f9915e34 *invalid-crbug-1562.ivf
f0cd8389948ad16085714d96567612136f6a46c5 *invalid-crbug-1562.ivf.res
bac455906360b45338a16dd626ac5f19bc36a307 *desktop_office1.1280_720-020.yuv
094be4b80fa30bd227149ea16ab6476d549ea092 *slides_code_term_web_plot.1920_1080.yuv
518a0be998afece76d3df76047d51e256c591ff2 *invalid-bug-148271109.ivf
d3964f9dad9f60363c81b688324d95b4ec7c8038 *invalid-bug-148271109.ivf.res
ad18ca16f0a249fb3b7c38de0d9b327fed273f96 *hantro_collage_w352h288_nv12.yuv

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше