[libvpx] Update to v1.12.0

This commit is contained in:
Andrey Volk
2022-08-10 23:10:49 +03:00
parent 287a71dc66
commit b5046d2a76
572 changed files with 52900 additions and 29493 deletions
+55
View File
@@ -0,0 +1,55 @@
Adrian Grange <agrange@google.com>
Aex Converse <alexconv@twitch.tv>
Aex Converse <alexconv@twitch.tv> <aconverse@google.com>
Aex Converse <alexconv@twitch.tv> <alex.converse@gmail.com>
Alexis Ballier <aballier@gentoo.org> <alexis.ballier@gmail.com>
Alpha Lam <hclam@google.com> <hclam@chromium.org>
Angie Chiang <angiebird@google.com>
Chris Cunningham <chcunningham@chromium.org>
Chi Yo Tsai <chiyotsai@google.com>
Daniele Castagna <dcastagna@chromium.org> <dcastagna@google.com>
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>
Jacky Chen <jackychen@google.com>
Jim Bankoski <jimbankoski@google.com>
Johann Koenig <johannkoenig@google.com>
Johann Koenig <johannkoenig@google.com> <johann.koenig@duck.com>
Johann Koenig <johannkoenig@google.com> <johann.koenig@gmail.com>
Johann Koenig <johannkoenig@google.com> <johannkoenig@chromium.org>
John Koleszar <jkoleszar@google.com>
Joshua Litt <joshualitt@google.com> <joshualitt@chromium.org>
Marco Paniconi <marpan@google.com>
Marco Paniconi <marpan@google.com> <marpan@chromium.org>
Martin Storsjö <martin@martin.st>
Michael Horowitz <mhoro@webrtc.org> <mhoro@google.com>
Pascal Massimino <pascal.massimino@gmail.com>
Paul Wilkins <paulwilkins@google.com>
Peter Boström <pbos@chromium.org> <pbos@google.com>
Peter de Rivaz <peter.derivaz@gmail.com>
Peter de Rivaz <peter.derivaz@gmail.com> <peter.derivaz@argondesign.com>
Ralph Giles <giles@xiph.org> <giles@entropywave.com>
Ralph Giles <giles@xiph.org> <giles@mozilla.com>
Ronald S. Bultje <rsbultje@gmail.com> <rbultje@google.com>
Sai Deng <sdeng@google.com>
Sami Pietilä <samipietila@google.com>
Shiyou Yin <yinshiyou-hf@loongson.cn>
Tamar Levy <tamar.levy@intel.com>
Tamar Levy <tamar.levy@intel.com> <levytamar82@gmail.com>
Tero Rintaluoma <teror@google.com> <tero.rintaluoma@on2.com>
Timothy B. Terriberry <tterribe@xiph.org> <tterriberry@mozilla.com>
Tom Finegan <tomfinegan@google.com>
Tom Finegan <tomfinegan@google.com> <tomfinegan@chromium.org>
Urvang Joshi <urvang@google.com> <urvang@chromium.org>
Yaowu Xu <yaowu@google.com> <adam@xuyaowu.com>
Yaowu Xu <yaowu@google.com> <yaowu@xuyaowu.com>
Yaowu Xu <yaowu@google.com> <Yaowu Xu>
Venkatarama NG. Avadhani <venkatarama.avadhani@ittiam.com>
Vitaly Buka <vitalybuka@chromium.org> <vitlaybuka@chromium.org>
xiwei gu <guxiwei-hf@loongson.cn>
+1 -1
View File
@@ -1 +1 @@
Thu Mar 19 03:08:11 UTC 2020 Mon Jul 06 01:46:10 UTC 2026
+30 -1
View File
@@ -3,6 +3,7 @@
Aaron Watry <awatry@gmail.com> Aaron Watry <awatry@gmail.com>
Abo Talib Mahfoodh <ab.mahfoodh@gmail.com> Abo Talib Mahfoodh <ab.mahfoodh@gmail.com>
Adam B. Goode <adam.mckee84@gmail.com>
Adrian Grange <agrange@google.com> Adrian Grange <agrange@google.com>
Ahmad Sharif <asharif@google.com> Ahmad Sharif <asharif@google.com>
Aidan Welch <aidansw@yahoo.com> Aidan Welch <aidansw@yahoo.com>
@@ -10,7 +11,7 @@ Aleksey Vasenev <margtu-fivt@ya.ru>
Alexander Potapenko <glider@google.com> Alexander Potapenko <glider@google.com>
Alexander Voronov <avoronov@graphics.cs.msu.ru> Alexander Voronov <avoronov@graphics.cs.msu.ru>
Alexandra Hájková <alexandra.khirnova@gmail.com> Alexandra Hájková <alexandra.khirnova@gmail.com>
Aex Converse <aconverse@google.com> Aex Converse <alexconv@twitch.tv>
Alexis Ballier <aballier@gentoo.org> Alexis Ballier <aballier@gentoo.org>
Alok Ahuja <waveletcoeff@gmail.com> Alok Ahuja <waveletcoeff@gmail.com>
Alpha Lam <hclam@google.com> Alpha Lam <hclam@google.com>
@@ -20,9 +21,13 @@ Andoni Morales Alastruey <ylatuya@gmail.com>
Andres Mejia <mcitadel@gmail.com> Andres Mejia <mcitadel@gmail.com>
Andrew Lewis <andrewlewis@google.com> Andrew Lewis <andrewlewis@google.com>
Andrew Russell <anrussell@google.com> Andrew Russell <anrussell@google.com>
Angie Chen <yunqi@google.com>
Angie Chiang <angiebird@google.com> Angie Chiang <angiebird@google.com>
Aron Rosenberg <arosenberg@logitech.com> Aron Rosenberg <arosenberg@logitech.com>
Attila Nagy <attilanagy@google.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> Brion Vibber <bvibber@wikimedia.org>
changjun.yang <changjun.yang@intel.com> changjun.yang <changjun.yang@intel.com>
Charles 'Buck' Krasic <ckrasic@google.com> Charles 'Buck' Krasic <ckrasic@google.com>
@@ -31,8 +36,11 @@ Chi Yo Tsai <chiyotsai@google.com>
chm <chm@rock-chips.com> chm <chm@rock-chips.com>
Chris Cunningham <chcunningham@chromium.org> Chris Cunningham <chcunningham@chromium.org>
Christian Duvivier <cduvivier@google.com> Christian Duvivier <cduvivier@google.com>
Chunbo Hua <chunbo.hua@intel.com>
Clement Courbet <courbet@google.com>
Daniele Castagna <dcastagna@chromium.org> Daniele Castagna <dcastagna@chromium.org>
Daniel Kang <ddkang@google.com> Daniel Kang <ddkang@google.com>
Daniel Sommermann <dcsommer@gmail.com>
Dan Zhu <zxdan@google.com> Dan Zhu <zxdan@google.com>
Deb Mukherjee <debargha@google.com> Deb Mukherjee <debargha@google.com>
Deepa K G <deepa.kg@ittiam.com> Deepa K G <deepa.kg@ittiam.com>
@@ -60,15 +68,19 @@ Guillermo Ballester Valor <gbvalor@gmail.com>
Hangyu Kuang <hkuang@google.com> Hangyu Kuang <hkuang@google.com>
Hanno Böck <hanno@hboeck.de> Hanno Böck <hanno@hboeck.de>
Han Shen <shenhan@google.com> Han Shen <shenhan@google.com>
Hao Chen <chenhao@loongson.cn>
Harish Mahendrakar <harish.mahendrakar@ittiam.com> Harish Mahendrakar <harish.mahendrakar@ittiam.com>
Henrik Lundin <hlundin@google.com> Henrik Lundin <hlundin@google.com>
Hien Ho <hienho@google.com> Hien Ho <hienho@google.com>
Hirokazu Honda <hiroh@chromium.org>
Hui Su <huisu@google.com> Hui Su <huisu@google.com>
Ilya Kurdyukov <jpegqs@gmail.com>
Ivan Krasin <krasin@chromium.org> Ivan Krasin <krasin@chromium.org>
Ivan Maltz <ivanmaltz@google.com> Ivan Maltz <ivanmaltz@google.com>
Jacek Caban <cjacek@gmail.com> Jacek Caban <cjacek@gmail.com>
Jacky Chen <jackychen@google.com> Jacky Chen <jackychen@google.com>
James Berry <jamesberry@google.com> James Berry <jamesberry@google.com>
James Touton <bekenn@gmail.com>
James Yu <james.yu@linaro.org> James Yu <james.yu@linaro.org>
James Zern <jzern@google.com> James Zern <jzern@google.com>
Jan Gerber <j@mailb.org> Jan Gerber <j@mailb.org>
@@ -78,17 +90,24 @@ Jean-Yves Avenard <jyavenard@mozilla.com>
Jeff Faust <jfaust@google.com> Jeff Faust <jfaust@google.com>
Jeff Muizelaar <jmuizelaar@mozilla.com> Jeff Muizelaar <jmuizelaar@mozilla.com>
Jeff Petkau <jpet@chromium.org> Jeff Petkau <jpet@chromium.org>
Jeremy Leconte <jleconte@google.com>
Jerome Jiang <jianj@google.com> Jerome Jiang <jianj@google.com>
Jia Jia <jia.jia@linaro.org> Jia Jia <jia.jia@linaro.org>
Jianhui Dai <jianhui.j.dai@intel.com>
Jian Zhou <zhoujian@google.com> Jian Zhou <zhoujian@google.com>
Jim Bankoski <jimbankoski@google.com> Jim Bankoski <jimbankoski@google.com>
jinbo <jinbo-hf@loongson.cn>
Jin Bo <jinbo@loongson.cn>
Jingning Han <jingning@google.com> Jingning Han <jingning@google.com>
Joel Fernandes <joelaf@google.com>
Joey Parrish <joeyparrish@google.com> Joey Parrish <joeyparrish@google.com>
Johann Koenig <johannkoenig@google.com> Johann Koenig <johannkoenig@google.com>
John Koleszar <jkoleszar@google.com> John Koleszar <jkoleszar@google.com>
Johnny Klonaris <google@jawknee.com> Johnny Klonaris <google@jawknee.com>
John Stark <jhnstrk@gmail.com> John Stark <jhnstrk@gmail.com>
Jonathan Wright <jonathan.wright@arm.com>
Jon Kunkee <jkunkee@microsoft.com> Jon Kunkee <jkunkee@microsoft.com>
Jorge E. Moreira <jemoreira@google.com>
Joshua Bleecher Snyder <josh@treelinelabs.com> Joshua Bleecher Snyder <josh@treelinelabs.com>
Joshua Litt <joshualitt@google.com> Joshua Litt <joshualitt@google.com>
Julia Robson <juliamrobson@gmail.com> Julia Robson <juliamrobson@gmail.com>
@@ -96,6 +115,7 @@ Justin Clift <justin@salasaga.org>
Justin Lebar <justin.lebar@gmail.com> Justin Lebar <justin.lebar@gmail.com>
Kaustubh Raste <kaustubh.raste@imgtec.com> Kaustubh Raste <kaustubh.raste@imgtec.com>
KO Myung-Hun <komh@chollian.net> KO Myung-Hun <komh@chollian.net>
Konstantinos Margaritis <konma@vectorcamp.gr>
Kyle Siefring <kylesiefring@gmail.com> Kyle Siefring <kylesiefring@gmail.com>
Lawrence Velázquez <larryv@macports.org> Lawrence Velázquez <larryv@macports.org>
Linfeng Zhang <linfengz@google.com> Linfeng Zhang <linfengz@google.com>
@@ -103,6 +123,7 @@ Liu Peng <pengliu.mail@gmail.com>
Lou Quillio <louquillio@google.com> Lou Quillio <louquillio@google.com>
Luca Barbato <lu_zero@gentoo.org> Luca Barbato <lu_zero@gentoo.org>
Luc Trudeau <luc@trud.ca> Luc Trudeau <luc@trud.ca>
Lu Wang <wanglu@loongson.cn>
Makoto Kato <makoto.kt@gmail.com> Makoto Kato <makoto.kt@gmail.com>
Mans Rullgard <mans@mansr.com> Mans Rullgard <mans@mansr.com>
Marco Paniconi <marpan@google.com> Marco Paniconi <marpan@google.com>
@@ -116,6 +137,7 @@ Michael Kohler <michaelkohler@live.com>
Mike Frysinger <vapier@chromium.org> Mike Frysinger <vapier@chromium.org>
Mike Hommey <mhommey@mozilla.com> Mike Hommey <mhommey@mozilla.com>
Mikhal Shemer <mikhal@google.com> Mikhal Shemer <mikhal@google.com>
Mikko Koivisto <mikko.koivisto@unikie.com>
Min Chen <chenm003@gmail.com> Min Chen <chenm003@gmail.com>
Minghai Shang <minghai@google.com> Minghai Shang <minghai@google.com>
Min Ye <yeemmi@google.com> Min Ye <yeemmi@google.com>
@@ -123,6 +145,7 @@ Mirko Bonadei <mbonadei@google.com>
Moriyoshi Koizumi <mozo@mozo.jp> Moriyoshi Koizumi <mozo@mozo.jp>
Morton Jonuschat <yabawock@gmail.com> Morton Jonuschat <yabawock@gmail.com>
Nathan E. Egge <negge@mozilla.com> Nathan E. Egge <negge@mozilla.com>
Neil Birkbeck <neil.birkbeck@gmail.com>
Nico Weber <thakis@chromium.org> Nico Weber <thakis@chromium.org>
Niveditha Rau <niveditha.rau@gmail.com> Niveditha Rau <niveditha.rau@gmail.com>
Parag Salasakar <img.mips1@gmail.com> Parag Salasakar <img.mips1@gmail.com>
@@ -135,6 +158,7 @@ Pengchong Jin <pengchong@google.com>
Peter Boström <pbos@chromium.org> Peter Boström <pbos@chromium.org>
Peter Collingbourne <pcc@chromium.org> Peter Collingbourne <pcc@chromium.org>
Peter de Rivaz <peter.derivaz@gmail.com> Peter de Rivaz <peter.derivaz@gmail.com>
Peter Kasting <pkasting@chromium.org>
Philip Jägenstedt <philipj@opera.com> Philip Jägenstedt <philipj@opera.com>
Priit Laes <plaes@plaes.org> Priit Laes <plaes@plaes.org>
Rafael Ávila de Espíndola <rafael.espindola@gmail.com> Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
@@ -163,6 +187,7 @@ Shimon Doodkin <helpmepro1@gmail.com>
Shiyou Yin <yinshiyou-hf@loongson.cn> Shiyou Yin <yinshiyou-hf@loongson.cn>
Shubham Tandle <shubham.tandle@ittiam.com> Shubham Tandle <shubham.tandle@ittiam.com>
Shunyao Li <shunyaoli@google.com> Shunyao Li <shunyaoli@google.com>
Sreerenj Balachandran <bsreerenj@gmail.com>
Stefan Holmer <holmer@google.com> Stefan Holmer <holmer@google.com>
Suman Sunkara <sunkaras@google.com> Suman Sunkara <sunkaras@google.com>
Supradeep T R <supradeep.tr@ittiam.com> Supradeep T R <supradeep.tr@ittiam.com>
@@ -180,13 +205,17 @@ Tristan Matthews <le.businessman@gmail.com>
Urvang Joshi <urvang@google.com> Urvang Joshi <urvang@google.com>
Venkatarama NG. Avadhani <venkatarama.avadhani@ittiam.com> Venkatarama NG. Avadhani <venkatarama.avadhani@ittiam.com>
Vignesh Venkatasubramanian <vigneshv@google.com> Vignesh Venkatasubramanian <vigneshv@google.com>
Vitaly Buka <vitalybuka@chromium.org>
Vlad Tsyrklevich <vtsyrklevich@chromium.org> Vlad Tsyrklevich <vtsyrklevich@chromium.org>
Wan-Teh Chang <wtc@google.com> Wan-Teh Chang <wtc@google.com>
Wonkap Jang <wonkap@google.com>
xiwei gu <guxiwei-hf@loongson.cn> xiwei gu <guxiwei-hf@loongson.cn>
Yaowu Xu <yaowu@google.com> Yaowu Xu <yaowu@google.com>
Yi Luo <luoyi@google.com> Yi Luo <luoyi@google.com>
Yongzhe Wang <yongzhe@google.com> Yongzhe Wang <yongzhe@google.com>
yuanhecai <yuanhecai@loongson.cn>
Yue Chen <yuec@google.com> Yue Chen <yuec@google.com>
Yun Liu <yliuyliu@google.com>
Yunqing Wang <yunqingwang@google.com> Yunqing Wang <yunqingwang@google.com>
Yury Gitman <yuryg@google.com> Yury Gitman <yuryg@google.com>
Zoe Liu <zoeliu@google.com> Zoe Liu <zoeliu@google.com>
+119 -1
View File
@@ -1,3 +1,121 @@
2022-06-17 v1.12.0 "Torrent Duck"
This release adds optimizations for Loongarch, adds support for vp8 in the
real-time rate control library, upgrades GoogleTest to v1.11.0, updates
libwebm to libwebm-1.0.0.28-20-g206d268, and includes numerous bug fixes.
- Upgrading:
This release is ABI compatible with the previous release.
vp8 support in the real-time rate control library.
New codec control VP8E_SET_RTC_EXTERNAL_RATECTRL is added.
Configure support for darwin21 is added.
GoogleTest is upgraded to v1.11.0.
libwebm is updated to libwebm-1.0.0.28-20-g206d268.
Allow SimpleEncode environment to take target level as input to match
the level conformance in vp9.
- Enhancement:
Numerous improvements on checking memory allocations.
Optimizations for Loongarch.
Code clean-up.
- Bug fixes:
Fix to a crash related to {vp8/vp9}_set_roi_map.
Fix to compiling failure with -Wformat-nonliteral.
Fix to integer overflow with vp9 with high resolution content.
Fix to AddNoiseTest failure with ARMv7.
Fix to libvpx Null-dereference READ in vp8.
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.
- Upgrading:
ARCH_* defines have been removed in favor of VPX_ARCH_*.
2019-07-15 v1.8.1 "Orpington Duck" 2019-07-15 v1.8.1 "Orpington Duck"
This release collects incremental improvements to many aspects of the library. This release collects incremental improvements to many aspects of the library.
@@ -356,7 +474,7 @@
of particular interest to real time streaming applications. of particular interest to real time streaming applications.
Temporal scalability allows the encoder to produce a stream that can 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. for each substream.
Multiframe quality enhancement postprocessing can make visual quality Multiframe quality enhancement postprocessing can make visual quality
+29
View File
@@ -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/).
+17 -8
View File
@@ -1,4 +1,4 @@
README - 15 July 2019 v1.12.0 Torrent Duck
Welcome to the WebM VP8/VP9 Codec SDK! Welcome to the WebM VP8/VP9 Codec SDK!
@@ -10,14 +10,14 @@ COMPILING THE APPLICATIONS/LIBRARIES:
1. Prerequisites 1. Prerequisites
* All x86 targets require the Yasm[1] assembler be installed[2]. * All x86 targets require the Yasm[1] assembler be installed[2].
* All Windows builds require that Cygwin[3] be installed. * All Windows builds require that Cygwin[3] or MSYS2[4] be installed.
* Building the documentation requires Doxygen[4]. If you do not * Building the documentation requires Doxygen[5]. If you do not
have this package, the install-docs option will be disabled. 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 sha1sum is provided via the GNU coreutils, installed by default on
many *nix platforms, as well as MinGW and Cygwin. If coreutils is not many *nix platforms, as well as MinGW and Cygwin. If coreutils is not
available, a compatible version of sha1sum can be built from 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. tests.
[1]: http://www.tortall.net/projects/yasm [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: yasm-<version>-<arch>.exe to yasm.exe and place it in:
Program Files (x86)/Microsoft Visual Studio/2017/<level>/Common7/Tools/ Program Files (x86)/Microsoft Visual Studio/2017/<level>/Common7/Tools/
[3]: http://www.cygwin.com [3]: http://www.cygwin.com
[4]: http://www.doxygen.org [4]: http://www.msys2.org/
[5]: http://curl.haxx.se [5]: http://www.doxygen.org
[6]: http://www.microbrew.org/tools/md5sha1sum/ [6]: http://curl.haxx.se
[7]: http://www.microbrew.org/tools/md5sha1sum/
2. Out-of-tree builds 2. Out-of-tree builds
Out of tree builds are a supported method of building the application. For 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-android-gcc
arm64-darwin-gcc arm64-darwin-gcc
arm64-darwin20-gcc
arm64-linux-gcc arm64-linux-gcc
arm64-win64-gcc arm64-win64-gcc
arm64-win64-vs15 arm64-win64-vs15
@@ -100,6 +102,8 @@ COMPILING THE APPLICATIONS/LIBRARIES:
x86-win32-gcc x86-win32-gcc
x86-win32-vs14 x86-win32-vs14
x86-win32-vs15 x86-win32-vs15
x86-win32-vs16
x86-win32-vs17
x86_64-android-gcc x86_64-android-gcc
x86_64-darwin9-gcc x86_64-darwin9-gcc
x86_64-darwin10-gcc x86_64-darwin10-gcc
@@ -110,6 +114,9 @@ COMPILING THE APPLICATIONS/LIBRARIES:
x86_64-darwin15-gcc x86_64-darwin15-gcc
x86_64-darwin16-gcc x86_64-darwin16-gcc
x86_64-darwin17-gcc x86_64-darwin17-gcc
x86_64-darwin18-gcc
x86_64-darwin19-gcc
x86_64-darwin20-gcc
x86_64-iphonesimulator-gcc x86_64-iphonesimulator-gcc
x86_64-linux-gcc x86_64-linux-gcc
x86_64-linux-icc x86_64-linux-icc
@@ -117,6 +124,8 @@ COMPILING THE APPLICATIONS/LIBRARIES:
x86_64-win64-gcc x86_64-win64-gcc
x86_64-win64-vs14 x86_64-win64-vs14
x86_64-win64-vs15 x86_64-win64-vs15
x86_64-win64-vs16
x86_64-win64-vs17
generic-gnu generic-gnu
The generic-gnu target, in conjunction with the CROSS environment variable, The generic-gnu target, in conjunction with the CROSS environment variable,
+5 -2
View File
@@ -16,8 +16,10 @@
#include "vpx/vpx_integer.h" #include "vpx/vpx_integer.h"
#include "vpx_ports/msvc.h" #include "vpx_ports/msvc.h"
#if defined(__GNUC__) && __GNUC__ #if defined(__GNUC__)
extern void die(const char *fmt, ...) __attribute__((noreturn)); __attribute__((noreturn)) extern void die(const char *fmt, ...);
#elif defined(_MSC_VER)
__declspec(noreturn) extern void die(const char *fmt, ...);
#else #else
extern void die(const char *fmt, ...); extern void die(const char *fmt, ...);
#endif #endif
@@ -81,6 +83,7 @@ const char *arg_next(struct arg *arg) {
char **argv_dup(int argc, const char **argv) { char **argv_dup(int argc, const char **argv) {
char **new_argv = malloc((argc + 1) * sizeof(*argv)); char **new_argv = malloc((argc + 1) * sizeof(*argv));
if (!new_argv) return NULL;
memcpy(new_argv, argv, argc * sizeof(*argv)); memcpy(new_argv, argv, argc * sizeof(*argv));
new_argv[argc] = NULL; new_argv[argc] = NULL;
+3
View File
@@ -166,6 +166,9 @@ LOCAL_CFLAGS += \
-I$(ASM_CNV_PATH)/libvpx -I$(ASM_CNV_PATH)/libvpx
LOCAL_MODULE := libvpx LOCAL_MODULE := libvpx
LOCAL_LICENSE_KINDS := SPDX-license-identifier-BSD
LOCAL_LICENSE_CONDITIONS := notice
LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../LICENSE $(LOCAL_PATH)/../../PATENTS
ifeq ($(CONFIG_RUNTIME_CPU_DETECT),yes) ifeq ($(CONFIG_RUNTIME_CPU_DETECT),yes)
LOCAL_STATIC_LIBRARIES := cpufeatures LOCAL_STATIC_LIBRARIES := cpufeatures
+14 -4
View File
@@ -147,6 +147,16 @@ $(BUILD_PFX)%_avx512.c.o: CFLAGS += -mavx512f -mavx512cd -mavx512bw -mavx512dq -
$(BUILD_PFX)%_vsx.c.d: CFLAGS += -maltivec -mvsx $(BUILD_PFX)%_vsx.c.d: CFLAGS += -maltivec -mvsx
$(BUILD_PFX)%_vsx.c.o: 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
# LOONGARCH
$(BUILD_PFX)%_lsx.c.d: CFLAGS += -mlsx
$(BUILD_PFX)%_lsx.c.o: CFLAGS += -mlsx
$(BUILD_PFX)%_lasx.c.d: CFLAGS += -mlasx
$(BUILD_PFX)%_lasx.c.o: CFLAGS += -mlasx
$(BUILD_PFX)%.c.d: %.c $(BUILD_PFX)%.c.d: %.c
$(if $(quiet),@echo " [DEP] $@") $(if $(quiet),@echo " [DEP] $@")
$(qexec)mkdir -p $(dir $@) $(qexec)mkdir -p $(dir $@)
@@ -430,10 +440,10 @@ ifneq ($(call enabled,DIST-SRCS),)
DIST-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_vcxproj.sh DIST-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_vcxproj.sh
DIST-SRCS-$(CONFIG_MSVS) += build/make/msvs_common.sh DIST-SRCS-$(CONFIG_MSVS) += build/make/msvs_common.sh
DIST-SRCS-$(CONFIG_RVCT) += build/make/armlink_adapter.sh DIST-SRCS-$(CONFIG_RVCT) += build/make/armlink_adapter.sh
DIST-SRCS-$(ARCH_ARM) += build/make/ads2gas.pl DIST-SRCS-$(VPX_ARCH_ARM) += build/make/ads2gas.pl
DIST-SRCS-$(ARCH_ARM) += build/make/ads2gas_apple.pl DIST-SRCS-$(VPX_ARCH_ARM) += build/make/ads2gas_apple.pl
DIST-SRCS-$(ARCH_ARM) += build/make/ads2armasm_ms.pl DIST-SRCS-$(VPX_ARCH_ARM) += build/make/ads2armasm_ms.pl
DIST-SRCS-$(ARCH_ARM) += build/make/thumb.pm DIST-SRCS-$(VPX_ARCH_ARM) += build/make/thumb.pm
DIST-SRCS-yes += $(target:-$(TOOLCHAIN)=).mk DIST-SRCS-yes += $(target:-$(TOOLCHAIN)=).mk
endif endif
INSTALL-SRCS := $(call cond_enabled,CONFIG_INSTALL_SRCS,INSTALL-SRCS) INSTALL-SRCS := $(call cond_enabled,CONFIG_INSTALL_SRCS,INSTALL-SRCS)
+1 -1
View File
@@ -28,7 +28,7 @@ while (<STDIN>)
s/qsubaddx/qsax/i; s/qsubaddx/qsax/i;
s/qaddsubx/qasx/i; s/qaddsubx/qasx/i;
thumb::FixThumbInstructions($_, 1); thumb::FixThumbInstructions($_);
s/ldrneb/ldrbne/i; s/ldrneb/ldrbne/i;
s/ldrneh/ldrhne/i; s/ldrneh/ldrhne/i;
+35 -116
View File
@@ -32,7 +32,7 @@ foreach my $arg (@ARGV) {
print "@ This file was created from a .asm file\n"; print "@ This file was created from a .asm file\n";
print "@ using the ads2gas.pl script.\n"; print "@ using the ads2gas.pl script.\n";
print "\t.syntax unified\n"; print ".syntax unified\n";
if ($thumb) { if ($thumb) {
print "\t.thumb\n"; print "\t.thumb\n";
} }
@@ -42,39 +42,11 @@ if ($thumb) {
while (<STDIN>) while (<STDIN>)
{ {
undef $comment;
undef $line;
$comment_char = ";";
$comment_sub = "@";
# Handle comments.
if (/$comment_char/)
{
$comment = "";
($line, $comment) = /(.*?)$comment_char(.*)/;
$_ = $line;
}
# Load and store alignment # Load and store alignment
s/@/,:/g; s/@/,:/g;
# Hexadecimal constants prefaced by 0x # Comment character
s/#&/#0x/g; s/;/@/;
# Convert :OR: to |
s/:OR:/ | /g;
# Convert :AND: to &
s/:AND:/ & /g;
# Convert :NOT: to ~
s/:NOT:/ ~ /g;
# Convert :SHL: to <<
s/:SHL:/ << /g;
# Convert :SHR: to >>
s/:SHR:/ >> /g;
# Convert ELSE to .else # Convert ELSE to .else
s/\bELSE\b/.else/g; s/\bELSE\b/.else/g;
@@ -82,105 +54,51 @@ while (<STDIN>)
# Convert ENDIF to .endif # Convert ENDIF to .endif
s/\bENDIF\b/.endif/g; s/\bENDIF\b/.endif/g;
# Convert ELSEIF to .elseif
s/\bELSEIF\b/.elseif/g;
# Convert LTORG to .ltorg
s/\bLTORG\b/.ltorg/g;
# Convert endfunc to nothing.
s/\bendfunc\b//ig;
# Convert FUNCTION to nothing.
s/\bFUNCTION\b//g;
s/\bfunction\b//g;
s/\bENTRY\b//g;
s/\bMSARMASM\b/0/g;
s/^\s+end\s+$//g;
# Convert IF :DEF:to .if
# gcc doesn't have the ability to do a conditional
# if defined variable that is set by IF :DEF: on
# armasm, so convert it to a normal .if and then
# make sure to define a value elesewhere
if (s/\bIF :DEF:\b/.if /g)
{
s/=/==/g;
}
# Convert IF to .if # Convert IF to .if
if (s/\bIF\b/.if/g) if (s/\bIF\b/.if/g) {
{
s/=+/==/g; s/=+/==/g;
} }
# Convert INCLUDE to .INCLUDE "file" # Convert INCLUDE to .INCLUDE "file"
s/INCLUDE(\s*)(.*)$/.include $1\"$2\"/; s/INCLUDE\s?(.*)$/.include \"$1\"/;
# Code directive (ARM vs Thumb)
s/CODE([0-9][0-9])/.code $1/;
# No AREA required # No AREA required
# But ALIGNs in AREA must be obeyed # But ALIGNs in AREA must be obeyed
s/^\s*AREA.*ALIGN=([0-9])$/.text\n.p2align $1/; s/^(\s*)\bAREA\b.*ALIGN=([0-9])$/$1.text\n$1.p2align $2/;
# If no ALIGN, strip the AREA and align to 4 bytes # If no ALIGN, strip the AREA and align to 4 bytes
s/^\s*AREA.*$/.text\n.p2align 2/; s/^(\s*)\bAREA\b.*$/$1.text\n$1.p2align 2/;
# DCD to .word # Make function visible to linker.
# This one is for incoming symbols
s/DCD\s+\|(\w*)\|/.long $1/;
# DCW to .short
s/DCW\s+\|(\w*)\|/.short $1/;
s/DCW(.*)/.short $1/;
# Constants defined in scope
s/DCD(.*)/.long $1/;
s/DCB(.*)/.byte $1/;
# Make function visible to linker, and make additional symbol with
# prepended underscore
if ($elf) { if ($elf) {
s/EXPORT\s+\|([\$\w]*)\|/.global $1 \n\t.type $1, function/; s/(\s*)EXPORT\s+\|([\$\w]*)\|/$1.global $2\n$1.type $2, function/;
} else { } else {
s/EXPORT\s+\|([\$\w]*)\|/.global $1/; s/(\s*)EXPORT\s+\|([\$\w]*)\|/$1.global $2/;
} }
s/IMPORT\s+\|([\$\w]*)\|/.global $1/;
s/EXPORT\s+([\$\w]*)/.global $1/; # No vertical bars on function names
s/export\s+([\$\w]*)/.global $1/; s/^\|(\$?\w+)\|/$1/g;
# No vertical bars required; make additional symbol with prepended
# underscore
s/^\|(\$?\w+)\|/_$1\n\t$1:/g;
# Labels need trailing colon # Labels need trailing colon
# s/^(\w+)/$1:/ if !/EQU/;
# put the colon at the end of the line in the macro
s/^([a-zA-Z_0-9\$]+)/$1:/ if !/EQU/; s/^([a-zA-Z_0-9\$]+)/$1:/ if !/EQU/;
# ALIGN directive # ALIGN directive
s/\bALIGN\b/.balign/g; s/\bALIGN\b/.balign/g;
if ($thumb) { if ($thumb) {
# ARM code - we force everything to thumb with the declaration in the header # ARM code - we force everything to thumb with the declaration in the
s/\sARM//g; # header
s/\bARM\b//g;
} else { } else {
# ARM code # ARM code
s/\sARM/.arm/g; s/\bARM\b/.arm/g;
} }
# push/pop # push/pop
s/(push\s+)(r\d+)/stmdb sp\!, \{$2\}/g; s/(push\s+)(r\d+)/stmdb sp\!, \{$2\}/g;
s/(pop\s+)(r\d+)/ldmia sp\!, \{$2\}/g; s/(pop\s+)(r\d+)/ldmia sp\!, \{$2\}/g;
# NEON code
s/(vld1.\d+\s+)(q\d+)/$1\{$2\}/g;
s/(vtbl.\d+\s+[^,]+),([^,]+)/$1,\{$2\}/g;
if ($thumb) { if ($thumb) {
thumb::FixThumbInstructions($_, 0); thumb::FixThumbInstructions($_);
} }
# eabi_attributes numerical equivalents can be found in the # eabi_attributes numerical equivalents can be found in the
@@ -188,31 +106,31 @@ while (<STDIN>)
if ($elf) { if ($elf) {
# REQUIRE8 Stack is required to be 8-byte aligned # REQUIRE8 Stack is required to be 8-byte aligned
s/\sREQUIRE8/.eabi_attribute 24, 1 \@Tag_ABI_align_needed/g; s/\bREQUIRE8\b/.eabi_attribute 24, 1 \@Tag_ABI_align_needed/g;
# PRESERVE8 Stack 8-byte align is preserved # PRESERVE8 Stack 8-byte align is preserved
s/\sPRESERVE8/.eabi_attribute 25, 1 \@Tag_ABI_align_preserved/g; s/\bPRESERVE8\b/.eabi_attribute 25, 1 \@Tag_ABI_align_preserved/g;
} else { } else {
s/\sREQUIRE8//; s/\bREQUIRE8\b//;
s/\sPRESERVE8//; s/\bPRESERVE8\b//;
} }
# Use PROC and ENDP to give the symbols a .size directive. # Use PROC and ENDP to give the symbols a .size directive.
# This makes them show up properly in debugging tools like gdb and valgrind. # This makes them show up properly in debugging tools like gdb and valgrind.
if (/\bPROC\b/) if (/\bPROC\b/) {
{
my $proc; my $proc;
/^_([\.0-9A-Z_a-z]\w+)\b/; # Match the function name so it can be stored in $proc
/^([\.0-9A-Z_a-z]\w+)\b/;
$proc = $1; $proc = $1;
push(@proc_stack, $proc) if ($proc); push(@proc_stack, $proc) if ($proc);
s/\bPROC\b/@ $&/; s/\bPROC\b/@ $&/;
} }
if (/\bENDP\b/)
{ if (/\bENDP\b/) {
my $proc; my $proc;
s/\bENDP\b/@ $&/; s/\bENDP\b/@ $&/;
$proc = pop(@proc_stack); $proc = pop(@proc_stack);
$_ = "\t.size $proc, .-$proc".$_ if ($proc and $elf); $_ = ".size $proc, .-$proc".$_ if ($proc and $elf);
} }
# EQU directive # EQU directive
@@ -220,19 +138,20 @@ while (<STDIN>)
# Begin macro definition # Begin macro definition
if (/\bMACRO\b/) { if (/\bMACRO\b/) {
# Process next line down, which will be the macro definition
$_ = <STDIN>; $_ = <STDIN>;
s/^/.macro/; s/^/.macro/;
s/\$//g; # remove formal param reference s/\$//g; # Remove $ from the variables in the declaration
s/;/@/g; # change comment characters
} }
# For macros, use \ to reference formal params s/\$/\\/g; # Use \ to reference formal parameters
s/\$/\\/g; # End macro definition # End macro definition
s/\bMEND\b/.endm/; # No need to tell it where to stop assembling
s/\bMEND\b/.endm/; # No need to tell it where to stop assembling
next if /^\s*END\s*$/; next if /^\s*END\s*$/;
s/[ \t]+$//;
print; print;
print "$comment_sub$comment\n" if defined $comment;
} }
# Mark that this object doesn't need an executable stack. # Mark that this object doesn't need an executable stack.
printf ("\t.section\t.note.GNU-stack,\"\",\%\%progbits\n") if $elf; printf (" .section .note.GNU-stack,\"\",\%\%progbits\n") if $elf;
+28 -116
View File
@@ -20,17 +20,14 @@
print "@ This file was created from a .asm file\n"; print "@ This file was created from a .asm file\n";
print "@ using the ads2gas_apple.pl script.\n\n"; print "@ using the ads2gas_apple.pl script.\n\n";
print "\t.syntax unified\n"; print ".syntax unified\n";
my %register_aliases;
my %macro_aliases; my %macro_aliases;
my @mapping_list = ("\$0", "\$1", "\$2", "\$3", "\$4", "\$5", "\$6", "\$7", "\$8", "\$9"); my @mapping_list = ("\$0", "\$1", "\$2", "\$3", "\$4", "\$5", "\$6", "\$7", "\$8", "\$9");
my @incoming_array; my @incoming_array;
my @imported_functions;
# Perl trim function to remove whitespace from the start and end of the string # Perl trim function to remove whitespace from the start and end of the string
sub trim($) sub trim($)
{ {
@@ -46,25 +43,7 @@ while (<STDIN>)
s/@/,:/g; s/@/,:/g;
# Comment character # Comment character
s/;/ @/g; s/;/@/;
# Hexadecimal constants prefaced by 0x
s/#&/#0x/g;
# Convert :OR: to |
s/:OR:/ | /g;
# Convert :AND: to &
s/:AND:/ & /g;
# Convert :NOT: to ~
s/:NOT:/ ~ /g;
# Convert :SHL: to <<
s/:SHL:/ << /g;
# Convert :SHR: to >>
s/:SHR:/ >> /g;
# Convert ELSE to .else # Convert ELSE to .else
s/\bELSE\b/.else/g; s/\bELSE\b/.else/g;
@@ -72,131 +51,64 @@ while (<STDIN>)
# Convert ENDIF to .endif # Convert ENDIF to .endif
s/\bENDIF\b/.endif/g; s/\bENDIF\b/.endif/g;
# Convert ELSEIF to .elseif
s/\bELSEIF\b/.elseif/g;
# Convert LTORG to .ltorg
s/\bLTORG\b/.ltorg/g;
# Convert IF :DEF:to .if
# gcc doesn't have the ability to do a conditional
# if defined variable that is set by IF :DEF: on
# armasm, so convert it to a normal .if and then
# make sure to define a value elesewhere
if (s/\bIF :DEF:\b/.if /g)
{
s/=/==/g;
}
# Convert IF to .if # Convert IF to .if
if (s/\bIF\b/.if/g) if (s/\bIF\b/.if/g) {
{ s/=+/==/g;
s/=/==/g;
} }
# Convert INCLUDE to .INCLUDE "file" # Convert INCLUDE to .INCLUDE "file"
s/INCLUDE(\s*)(.*)$/.include $1\"$2\"/; s/INCLUDE\s?(.*)$/.include \"$1\"/;
# Code directive (ARM vs Thumb)
s/CODE([0-9][0-9])/.code $1/;
# No AREA required # No AREA required
# But ALIGNs in AREA must be obeyed # But ALIGNs in AREA must be obeyed
s/^\s*AREA.*ALIGN=([0-9])$/.text\n.p2align $1/; s/^(\s*)\bAREA\b.*ALIGN=([0-9])$/$1.text\n$1.p2align $2/;
# If no ALIGN, strip the AREA and align to 4 bytes # If no ALIGN, strip the AREA and align to 4 bytes
s/^\s*AREA.*$/.text\n.p2align 2/; s/^(\s*)\bAREA\b.*$/$1.text\n$1.p2align 2/;
# DCD to .word # Make function visible to linker.
# This one is for incoming symbols s/EXPORT\s+\|([\$\w]*)\|/.globl _$1/;
s/DCD\s+\|(\w*)\|/.long $1/;
# DCW to .short # No vertical bars on function names
s/DCW\s+\|(\w*)\|/.short $1/; s/^\|(\$?\w+)\|/$1/g;
s/DCW(.*)/.short $1/;
# Constants defined in scope # Labels and functions need a leading underscore and trailing colon
s/DCD(.*)/.long $1/; s/^([a-zA-Z_0-9\$]+)/_$1:/ if !/EQU/;
s/DCB(.*)/.byte $1/;
# Make function visible to linker, and make additional symbol with # Branches need to call the correct, underscored, function
# prepended underscore s/^(\s+b[egln]?[teq]?\s+)([a-zA-Z_0-9\$]+)/$1 _$2/ if !/EQU/;
s/EXPORT\s+\|([\$\w]*)\|/.globl _$1\n\t.globl $1/;
# Prepend imported functions with _
if (s/IMPORT\s+\|([\$\w]*)\|/.globl $1/)
{
$function = trim($1);
push(@imported_functions, $function);
}
foreach $function (@imported_functions)
{
s/$function/_$function/;
}
# No vertical bars required; make additional symbol with prepended
# underscore
s/^\|(\$?\w+)\|/_$1\n\t$1:/g;
# Labels need trailing colon
# s/^(\w+)/$1:/ if !/EQU/;
# put the colon at the end of the line in the macro
s/^([a-zA-Z_0-9\$]+)/$1:/ if !/EQU/;
# ALIGN directive # ALIGN directive
s/\bALIGN\b/.balign/g; s/\bALIGN\b/.balign/g;
# Strip ARM # Strip ARM
s/\sARM/@ ARM/g; s/\s+ARM//;
# Strip REQUIRE8 # Strip REQUIRE8
#s/\sREQUIRE8/@ REQUIRE8/g; s/\s+REQUIRE8//;
s/\sREQUIRE8/@ /g;
# Strip PRESERVE8 # Strip PRESERVE8
s/\sPRESERVE8/@ PRESERVE8/g; s/\s+PRESERVE8//;
# Strip PROC and ENDPROC # Strip PROC and ENDPROC
s/\bPROC\b/@/g; s/\bPROC\b//g;
s/\bENDP\b/@/g; s/\bENDP\b//g;
# EQU directive # EQU directive
s/(.*)EQU(.*)/.set $1, $2/; s/(\S+\s+)EQU(\s+\S+)/.equ $1, $2/;
# Begin macro definition # Begin macro definition
if (/\bMACRO\b/) if (/\bMACRO\b/) {
{
# Process next line down, which will be the macro definition # Process next line down, which will be the macro definition
$_ = <STDIN>; $_ = <STDIN>;
s/^/.macro/;
$trimmed = trim($_); s/\$//g; # Remove $ from the variables in the declaration
# remove commas that are separating list
$trimmed =~ s/,//g;
# string to array
@incoming_array = split(/\s+/, $trimmed);
print ".macro @incoming_array[0]\n";
# remove the first element, as that is the name of the macro
shift (@incoming_array);
@macro_aliases{@incoming_array} = @mapping_list;
next;
} }
while (($key, $value) = each(%macro_aliases)) s/\$/\\/g; # Use \ to reference formal parameters
{ # End macro definition
$key =~ s/\$/\\\$/;
s/$key\b/$value/g;
}
# For macros, use \ to reference formal params s/\bMEND\b/.endm/; # No need to tell it where to stop assembling
# s/\$/\\/g; # End macro definition
s/\bMEND\b/.endm/; # No need to tell it where to stop assembling
next if /^\s*END\s*$/; next if /^\s*END\s*$/;
s/[ \t]+$//;
print; print;
} }
+190 -98
View File
@@ -262,6 +262,9 @@ if [ -z "$source_path" ] || [ "$source_path" = "." ]; then
source_path="`pwd`" source_path="`pwd`"
disable_feature source_path_used disable_feature source_path_used
fi 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 if test ! -z "$TMPDIR" ; then
TMPDIRx="${TMPDIR}" TMPDIRx="${TMPDIR}"
@@ -439,11 +442,24 @@ void f(void) {
} }
EOF EOF
compile_result=$? compile_result=$?
if [ ${compile_result} -ne 0 ]; then #
log_echo " disabling avx512: not supported by compiler" # if [ ${compile_result} -ne 0 ]; then
disable_feature avx512 # log_echo " disabling avx512: not supported by compiler"
RTCD_OPTIONS="${RTCD_OPTIONS}--disable-avx512 " # disable_feature avx512
fi # RTCD_OPTIONS="${RTCD_OPTIONS}--disable-avx512 "
# fi
#*/
}
check_inline_asm() {
log check_inline_asm "$@"
name="$1"
code="$2"
shift 2
disable_feature $name
check_cc "$@" <<EOF && enable_feature $name
void foo(void) { __asm__ volatile($code); }
EOF
} }
write_common_config_banner() { write_common_config_banner() {
@@ -481,11 +497,11 @@ write_common_target_config_mk() {
cat >> $1 << EOF cat >> $1 << EOF
# This file automatically generated by configure. Do not edit! # This file automatically generated by configure. Do not edit!
SRC_PATH="$source_path" SRC_PATH="$source_path_mk"
SRC_PATH_BARE=$source_path SRC_PATH_BARE=$source_path_mk
BUILD_PFX=${BUILD_PFX} BUILD_PFX=${BUILD_PFX}
TOOLCHAIN=${toolchain} 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} GEN_VCPROJ=${gen_vcproj_cmd}
MSVS_ARCH_DIR=${msvs_arch_dir} MSVS_ARCH_DIR=${msvs_arch_dir}
@@ -518,10 +534,10 @@ fmt_deps = sed -e 's;^\([a-zA-Z0-9_]*\)\.o;\${@:.d=.o} \$@;'
EOF EOF
fi fi
print_config_mk ARCH "${1}" ${ARCH_LIST} print_config_mk VPX_ARCH "${1}" ${ARCH_LIST}
print_config_mk HAVE "${1}" ${HAVE_LIST} print_config_mk HAVE "${1}" ${HAVE_LIST}
print_config_mk CONFIG "${1}" ${CONFIG_LIST} print_config_mk CONFIG "${1}" ${CONFIG_LIST}
print_config_mk HAVE "${1}" gnu_strip print_config_mk HAVE "${1}" gnu_strip
enabled msvs && echo "CONFIG_VS_VERSION=${vs_version}" >> "${1}" enabled msvs && echo "CONFIG_VS_VERSION=${vs_version}" >> "${1}"
@@ -538,10 +554,10 @@ write_common_target_config_h() {
#define RESTRICT ${RESTRICT} #define RESTRICT ${RESTRICT}
#define INLINE ${INLINE} #define INLINE ${INLINE}
EOF EOF
print_config_h ARCH "${TMP_H}" ${ARCH_LIST} print_config_h VPX_ARCH "${TMP_H}" ${ARCH_LIST}
print_config_h HAVE "${TMP_H}" ${HAVE_LIST} print_config_h HAVE "${TMP_H}" ${HAVE_LIST}
print_config_h CONFIG "${TMP_H}" ${CONFIG_LIST} print_config_h CONFIG "${TMP_H}" ${CONFIG_LIST}
print_config_vars_h "${TMP_H}" ${VAR_LIST} print_config_vars_h "${TMP_H}" ${VAR_LIST}
echo "#endif /* VPX_CONFIG_H */" >> ${TMP_H} echo "#endif /* VPX_CONFIG_H */" >> ${TMP_H}
mkdir -p `dirname "$1"` mkdir -p `dirname "$1"`
cmp "$1" ${TMP_H} >/dev/null 2>&1 || mv ${TMP_H} "$1" cmp "$1" ${TMP_H} >/dev/null 2>&1 || mv ${TMP_H} "$1"
@@ -763,17 +779,23 @@ process_common_toolchain() {
*mips32el*) *mips32el*)
tgt_isa=mips32 tgt_isa=mips32
;; ;;
loongarch32*)
tgt_isa=loongarch32
;;
loongarch64*)
tgt_isa=loongarch64
;;
esac esac
# detect tgt_os # detect tgt_os
case "$gcctarget" in case "$gcctarget" in
arm64-apple-darwin*) *darwin1[0-9]*)
tgt_isa=arm64
tgt_os=darwin
;;
*darwin*)
tgt_isa=x86_64 tgt_isa=x86_64
tgt_os=darwin tgt_os=`echo $gcctarget | sed 's/.*\(darwin1[0-9]\).*/\1/'`
;;
*darwin2[0-1]*)
tgt_isa=`uname -m`
tgt_os=`echo $gcctarget | sed 's/.*\(darwin2[0-9]\).*/\1/'`
;; ;;
x86_64*mingw32*) x86_64*mingw32*)
tgt_os=win64 tgt_os=win64
@@ -831,6 +853,11 @@ process_common_toolchain() {
ppc*) ppc*)
enable_feature ppc enable_feature ppc
;; ;;
loongarch*)
soft_enable lsx
soft_enable lasx
enable_feature loongarch
;;
esac esac
# PIC is probably what we want when building shared libs # PIC is probably what we want when building shared libs
@@ -849,7 +876,7 @@ process_common_toolchain() {
# Handle darwin variants. Newer SDKs allow targeting older # Handle darwin variants. Newer SDKs allow targeting older
# platforms, so use the newest one available. # platforms, so use the newest one available.
case ${toolchain} in case ${toolchain} in
DISABLE-arm*-darwin*) arm*-darwin-*)
add_cflags "-miphoneos-version-min=${IOS_VERSION_MIN}" add_cflags "-miphoneos-version-min=${IOS_VERSION_MIN}"
iphoneos_sdk_dir="$(show_darwin_sdk_path iphoneos)" iphoneos_sdk_dir="$(show_darwin_sdk_path iphoneos)"
if [ -d "${iphoneos_sdk_dir}" ]; then if [ -d "${iphoneos_sdk_dir}" ]; then
@@ -857,7 +884,7 @@ process_common_toolchain() {
add_ldflags "-isysroot ${iphoneos_sdk_dir}" add_ldflags "-isysroot ${iphoneos_sdk_dir}"
fi fi
;; ;;
x86*-darwin*) *-darwin*)
osx_sdk_dir="$(show_darwin_sdk_path macosx)" osx_sdk_dir="$(show_darwin_sdk_path macosx)"
if [ -d "${osx_sdk_dir}" ]; then if [ -d "${osx_sdk_dir}" ]; then
add_cflags "-isysroot ${osx_sdk_dir}" add_cflags "-isysroot ${osx_sdk_dir}"
@@ -867,15 +894,57 @@ process_common_toolchain() {
esac esac
case ${toolchain} in case ${toolchain} in
*-darwin-*) *-darwin8-*)
mvmin=$(sw_vers -productVersion) add_cflags "-mmacosx-version-min=10.4"
if [[ $mvmin == 10.* ]]; then add_ldflags "-mmacosx-version-min=10.4"
mvmin="-mmacosx-version-min=""${mvmin%.*}" ;;
else *-darwin9-*)
mvmin="-mmacosx-version-min=""${mvmin%%.*}" add_cflags "-mmacosx-version-min=10.5"
fi add_ldflags "-mmacosx-version-min=10.5"
add_cflags $mvmin ;;
add_ldflags $mvmin *-darwin10-*)
add_cflags "-mmacosx-version-min=10.6"
add_ldflags "-mmacosx-version-min=10.6"
;;
*-darwin11-*)
add_cflags "-mmacosx-version-min=10.7"
add_ldflags "-mmacosx-version-min=10.7"
;;
*-darwin12-*)
add_cflags "-mmacosx-version-min=10.8"
add_ldflags "-mmacosx-version-min=10.8"
;;
*-darwin13-*)
add_cflags "-mmacosx-version-min=10.9"
add_ldflags "-mmacosx-version-min=10.9"
;;
*-darwin14-*)
add_cflags "-mmacosx-version-min=10.10"
add_ldflags "-mmacosx-version-min=10.10"
;;
*-darwin15-*)
add_cflags "-mmacosx-version-min=10.11"
add_ldflags "-mmacosx-version-min=10.11"
;;
*-darwin16-*)
add_cflags "-mmacosx-version-min=10.12"
add_ldflags "-mmacosx-version-min=10.12"
;;
*-darwin17-*)
add_cflags "-mmacosx-version-min=10.13"
add_ldflags "-mmacosx-version-min=10.13"
;;
*-darwin18-*)
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"
;;
*-darwin2[0-1]-*)
add_cflags "-arch ${toolchain%%-*}"
add_ldflags "-arch ${toolchain%%-*}"
;; ;;
*-iphonesimulator-*) *-iphonesimulator-*)
add_cflags "-miphoneos-version-min=${IOS_VERSION_MIN}" add_cflags "-miphoneos-version-min=${IOS_VERSION_MIN}"
@@ -950,7 +1019,7 @@ EOF
fi fi
enabled debug && add_asflags -g 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 case ${tgt_os} in
win*) win*)
@@ -972,7 +1041,7 @@ EOF
# respective SDKs' limitations. Fortunately, these are all 32-bit ABIs # respective SDKs' limitations. Fortunately, these are all 32-bit ABIs
# and so can be selected as 'win32'. # and so can be selected as 'win32'.
if [ ${tgt_os} = "win32" ]; then 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 AS_SFX=.S
msvs_arch_dir=arm-msvs msvs_arch_dir=arm-msvs
disable_feature multithread disable_feature multithread
@@ -1050,62 +1119,64 @@ EOF
soft_enable unit_tests soft_enable unit_tests
;; ;;
DISABLE-darwin*) darwin)
XCRUN_FIND="xcrun --sdk iphoneos --find" if ! enabled external_build; then
CXX="$(${XCRUN_FIND} clang++)" XCRUN_FIND="xcrun --sdk iphoneos --find"
CC="$(${XCRUN_FIND} clang)" CXX="$(${XCRUN_FIND} clang++)"
AR="$(${XCRUN_FIND} ar)" CC="$(${XCRUN_FIND} clang)"
AS="$(${XCRUN_FIND} as)" AR="$(${XCRUN_FIND} ar)"
STRIP="$(${XCRUN_FIND} strip)" AS="$(${XCRUN_FIND} as)"
NM="$(${XCRUN_FIND} nm)" STRIP="$(${XCRUN_FIND} strip)"
RANLIB="$(${XCRUN_FIND} ranlib)" NM="$(${XCRUN_FIND} nm)"
AS_SFX=.S RANLIB="$(${XCRUN_FIND} ranlib)"
LD="${CXX:-$(${XCRUN_FIND} ld)}" AS_SFX=.S
LD="${CXX:-$(${XCRUN_FIND} ld)}"
# ASFLAGS is written here instead of using check_add_asflags # ASFLAGS is written here instead of using check_add_asflags
# because we need to overwrite all of ASFLAGS and purge the # because we need to overwrite all of ASFLAGS and purge the
# options that were put in above # options that were put in above
ASFLAGS="-arch ${tgt_isa} -g" ASFLAGS="-arch ${tgt_isa} -g"
add_cflags -arch ${tgt_isa} add_cflags -arch ${tgt_isa}
add_ldflags -arch ${tgt_isa} add_ldflags -arch ${tgt_isa}
alt_libc="$(show_darwin_sdk_path iphoneos)" alt_libc="$(show_darwin_sdk_path iphoneos)"
if [ -d "${alt_libc}" ]; then if [ -d "${alt_libc}" ]; then
add_cflags -isysroot ${alt_libc} add_cflags -isysroot ${alt_libc}
fi fi
if [ "${LD}" = "${CXX}" ]; then if [ "${LD}" = "${CXX}" ]; then
add_ldflags -miphoneos-version-min="${IOS_VERSION_MIN}" add_ldflags -miphoneos-version-min="${IOS_VERSION_MIN}"
else else
add_ldflags -ios_version_min "${IOS_VERSION_MIN}" add_ldflags -ios_version_min "${IOS_VERSION_MIN}"
fi fi
for d in lib usr/lib usr/lib/system; do for d in lib usr/lib usr/lib/system; do
try_dir="${alt_libc}/${d}" try_dir="${alt_libc}/${d}"
[ -d "${try_dir}" ] && add_ldflags -L"${try_dir}" [ -d "${try_dir}" ] && add_ldflags -L"${try_dir}"
done done
case ${tgt_isa} in case ${tgt_isa} in
armv7|armv7s|armv8|arm64) armv7|armv7s|armv8|arm64)
if enabled neon && ! check_xcode_minimum_version; then if enabled neon && ! check_xcode_minimum_version; then
soft_disable neon soft_disable neon
log_echo " neon disabled: upgrade Xcode (need v6.3+)." log_echo " neon disabled: upgrade Xcode (need v6.3+)."
if enabled neon_asm; then if enabled neon_asm; then
soft_disable neon_asm soft_disable neon_asm
log_echo " neon_asm disabled: upgrade Xcode (need v6.3+)." log_echo " neon_asm disabled: upgrade Xcode (need v6.3+)."
fi
fi fi
fi ;;
;; esac
esac
asm_conversion_cmd="${source_path}/build/make/ads2gas_apple.pl" if [ "$(show_darwin_sdk_major_version iphoneos)" -gt 8 ]; then
check_add_cflags -fembed-bitcode
if [ "$(show_darwin_sdk_major_version iphoneos)" -gt 8 ]; then check_add_asflags -fembed-bitcode
check_add_cflags -fembed-bitcode check_add_ldflags -fembed-bitcode
check_add_asflags -fembed-bitcode fi
check_add_ldflags -fembed-bitcode
fi fi
asm_conversion_cmd="${source_path_mk}/build/make/ads2gas_apple.pl"
;; ;;
linux*) linux*)
@@ -1159,25 +1230,27 @@ EOF
check_add_asflags -mips64r6 -mabi=64 -mhard-float -mfp64 check_add_asflags -mips64r6 -mabi=64 -mhard-float -mfp64
check_add_ldflags -mips64r6 -mabi=64 -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 esac
if enabled mmi || enabled msa; then
soft_enable runtime_cpu_detect
fi
if enabled msa; then if enabled msa; then
# TODO(libyuv:793) # TODO(libyuv:793)
# The new mips functions in libyuv do not build # The new mips functions in libyuv do not build
# with the toolchains we currently use for testing. # with the toolchains we currently use for testing.
soft_disable libyuv soft_disable libyuv
add_cflags -mmsa
add_asflags -mmsa
add_ldflags -mmsa
fi fi
fi fi
if enabled mmi; then
tgt_isa=loongson3a
check_add_ldflags -march=loongson3a
fi
check_add_cflags -march=${tgt_isa} check_add_cflags -march=${tgt_isa}
check_add_asflags -march=${tgt_isa} check_add_asflags -march=${tgt_isa}
check_add_asflags -KPIC check_add_asflags -KPIC
@@ -1247,10 +1320,6 @@ EOF
enabled optimizations && disabled gprof && check_add_cflags -fomit-frame-pointer enabled optimizations && disabled gprof && check_add_cflags -fomit-frame-pointer
;; ;;
vs*) 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 msvs_arch_dir=x86-msvs
case ${tgt_cc##vs} in case ${tgt_cc##vs} in
14) 14)
@@ -1374,6 +1443,15 @@ EOF
;; ;;
esac esac
;; ;;
loongarch*)
link_with_cc=gcc
setup_gnu_toolchain
enabled lsx && check_inline_asm lsx '"vadd.b $vr0, $vr1, $vr1"'
enabled lsx && soft_enable runtime_cpu_detect
enabled lasx && check_inline_asm lasx '"xvadd.b $xr0, $xr1, $xr1"'
enabled lasx && soft_enable runtime_cpu_detect
;;
*-gcc|generic-gnu) *-gcc|generic-gnu)
link_with_cc=gcc link_with_cc=gcc
enable_feature gcc enable_feature gcc
@@ -1450,9 +1528,7 @@ EOF
check_header pthread.h && check_lib -lpthread <<EOF && add_extralibs -lpthread || disable_feature pthread_h check_header pthread.h && check_lib -lpthread <<EOF && add_extralibs -lpthread || disable_feature pthread_h
#include <pthread.h> #include <pthread.h>
#include <stddef.h> #include <stddef.h>
void *thread_check (void *); int main(void) { return pthread_create(NULL, NULL, NULL, NULL); }
void *thread_check (void *obj){ return obj;};
int main(void) { pthread_t thread_id; return pthread_create(&thread_id, NULL, thread_check, NULL); }
EOF EOF
;; ;;
esac esac
@@ -1478,6 +1554,22 @@ EOF
;; ;;
esac esac
# only for LOONGARCH platforms
case ${toolchain} in
loongarch*)
if enabled big_endian; then
if enabled lsx; then
echo "lsx optimizations are available only for little endian platforms"
disable_feature lsx
fi
if enabled lasx; then
echo "lasx optimizations are available only for little endian platforms"
disable_feature lasx
fi
fi
;;
esac
# glibc needs these # glibc needs these
if enabled linux; then if enabled linux; then
add_cflags -D_LARGEFILE_SOURCE add_cflags -D_LARGEFILE_SOURCE
+15 -23
View File
@@ -25,7 +25,7 @@ files.
Options: Options:
--help Print this message --help Print this message
--out=outfile Redirect output to a file --out=outfile Redirect output to a file
--ver=version Version (7,8,9,10,11,12,14,15) of visual studio to generate for --ver=version Version (14-17) of visual studio to generate for
--target=isa-os-cc Target specifier --target=isa-os-cc Target specifier
EOF EOF
exit 1 exit 1
@@ -213,13 +213,15 @@ for opt in "$@"; do
;; ;;
--dep=*) eval "${optval%%:*}_deps=\"\${${optval%%:*}_deps} ${optval##*:}\"" --dep=*) eval "${optval%%:*}_deps=\"\${${optval%%:*}_deps} ${optval##*:}\""
;; ;;
--ver=*) vs_ver="$optval" --ver=*)
case $optval in vs_ver="$optval"
10|11|12|14|15) case $optval in
;; 14) vs_year=2015 ;;
*) die Unrecognized Visual Studio Version in $opt 15) vs_year=2017 ;;
;; 16) vs_year=2019 ;;
esac 17) vs_year=2022 ;;
*) die Unrecognized Visual Studio Version in $opt ;;
esac
;; ;;
--target=*) target="${optval}" --target=*) target="${optval}"
;; ;;
@@ -230,21 +232,11 @@ for opt in "$@"; do
done done
outfile=${outfile:-/dev/stdout} outfile=${outfile:-/dev/stdout}
mkoutfile=${mkoutfile:-/dev/stdout} mkoutfile=${mkoutfile:-/dev/stdout}
case "${vs_ver:-10}" in case "${vs_ver}" in
10) sln_vers="11.00" 1[4-7])
sln_vers_str="Visual Studio 2010" # VS has used Format Version 12.00 continuously since vs11.
;; sln_vers="12.00"
11) sln_vers="12.00" sln_vers_str="Visual Studio ${vs_year}"
sln_vers_str="Visual Studio 2012"
;;
12) sln_vers="12.00"
sln_vers_str="Visual Studio 2013"
;;
14) sln_vers="12.00"
sln_vers_str="Visual Studio 2015"
;;
15) sln_vers="12.00"
sln_vers_str="Visual Studio 2017"
;; ;;
esac esac
sfx=vcxproj sfx=vcxproj
+15 -33
View File
@@ -34,7 +34,7 @@ Options:
--name=project_name Name of the project (required) --name=project_name Name of the project (required)
--proj-guid=GUID GUID to use for the project --proj-guid=GUID GUID to use for the project
--module-def=filename File containing export definitions (for DLLs) --module-def=filename File containing export definitions (for DLLs)
--ver=version Version (10,11,12,14,15) of visual studio to generate for --ver=version Version (14-16) of visual studio to generate for
--src-path-bare=dir Path to root of source tree --src-path-bare=dir Path to root of source tree
-Ipath/to/include Additional include directories -Ipath/to/include Additional include directories
-DFLAG[=value] Preprocessor macros to define -DFLAG[=value] Preprocessor macros to define
@@ -82,7 +82,7 @@ generate_filter() {
| sed -e "s,$src_path_bare,," \ | sed -e "s,$src_path_bare,," \
-e 's/^[\./]\+//g' -e 's,[:/ ],_,g') -e 's/^[\./]\+//g' -e 's,[:/ ],_,g')
if ([ "$pat" == "asm" ] || [ "$pat" == "s" ] || [ "$pat" == "S" ]) && $asm_use_custom_step; then if ([ "$pat" == "asm" ] || [ "$pat" == "s" ] || [ "$pat" == "S" ]) && $uses_asm; then
# Avoid object file name collisions, i.e. vpx_config.c and # Avoid object file name collisions, i.e. vpx_config.c and
# vpx_config.asm produce the same object file without # vpx_config.asm produce the same object file without
# this additional suffix. # this additional suffix.
@@ -157,6 +157,8 @@ for opt in "$@"; do
;; ;;
--lib) proj_kind="lib" --lib) proj_kind="lib"
;; ;;
--as=*) as="${optval}"
;;
--src-path-bare=*) --src-path-bare=*)
src_path_bare=$(fix_path "$optval") src_path_bare=$(fix_path "$optval")
src_path_bare=${src_path_bare%/} src_path_bare=${src_path_bare%/}
@@ -168,7 +170,7 @@ for opt in "$@"; do
--ver=*) --ver=*)
vs_ver="$optval" vs_ver="$optval"
case "$optval" in case "$optval" in
10|11|12|14|15) 1[4-7])
;; ;;
*) die Unrecognized Visual Studio Version in $opt *) die Unrecognized Visual Studio Version in $opt
;; ;;
@@ -215,13 +217,7 @@ fix_file_list file_list
outfile=${outfile:-/dev/stdout} outfile=${outfile:-/dev/stdout}
guid=${guid:-`generate_uuid`} guid=${guid:-`generate_uuid`}
asm_use_custom_step=false
uses_asm=${uses_asm:-false} uses_asm=${uses_asm:-false}
case "${vs_ver:-11}" in
10|11|12|14|15)
asm_use_custom_step=$uses_asm
;;
esac
[ -n "$name" ] || die "Project name (--name) must be specified!" [ -n "$name" ] || die "Project name (--name) must be specified!"
[ -n "$target" ] || die "Target (--target) must be specified!" [ -n "$target" ] || die "Target (--target) must be specified!"
@@ -253,13 +249,13 @@ libs=${libs// /;}
case "$target" in case "$target" in
x86_64*) x86_64*)
platforms[0]="x64" platforms[0]="x64"
asm_Debug_cmdline="yasm -Xvc -g cv8 -f win64 ${yasmincs} &quot;%(FullPath)&quot;" asm_Debug_cmdline="${as} -Xvc -gcv8 -f win64 ${yasmincs} &quot;%(FullPath)&quot;"
asm_Release_cmdline="yasm -Xvc -f win64 ${yasmincs} &quot;%(FullPath)&quot;" asm_Release_cmdline="${as} -Xvc -f win64 ${yasmincs} &quot;%(FullPath)&quot;"
;; ;;
x86*) x86*)
platforms[0]="Win32" platforms[0]="Win32"
asm_Debug_cmdline="yasm -Xvc -g cv8 -f win32 ${yasmincs} &quot;%(FullPath)&quot;" asm_Debug_cmdline="${as} -Xvc -gcv8 -f win32 ${yasmincs} &quot;%(FullPath)&quot;"
asm_Release_cmdline="yasm -Xvc -f win32 ${yasmincs} &quot;%(FullPath)&quot;" asm_Release_cmdline="${as} -Xvc -f win32 ${yasmincs} &quot;%(FullPath)&quot;"
;; ;;
arm64*) arm64*)
platforms[0]="ARM64" platforms[0]="ARM64"
@@ -339,32 +335,18 @@ generate_vcxproj() {
else else
tag_content ConfigurationType StaticLibrary tag_content ConfigurationType StaticLibrary
fi fi
if [ "$vs_ver" = "11" ]; then
if [ "$plat" = "ARM" ]; then
# Setting the wp80 toolchain automatically sets the
# WINAPI_FAMILY define, which is required for building
# code for arm with the windows headers. Alternatively,
# one could add AppContainerApplication=true in the Globals
# section and add PrecompiledHeader=NotUsing and
# CompileAsWinRT=false in ClCompile and SubSystem=Console
# in Link.
tag_content PlatformToolset v110_wp80
else
tag_content PlatformToolset v110
fi
fi
if [ "$vs_ver" = "12" ]; then
# Setting a PlatformToolset indicating windows phone isn't
# enough to build code for arm with MSVC 2013, one strictly
# has to enable AppContainerApplication as well.
tag_content PlatformToolset v120
fi
if [ "$vs_ver" = "14" ]; then if [ "$vs_ver" = "14" ]; then
tag_content PlatformToolset v140 tag_content PlatformToolset v140
fi fi
if [ "$vs_ver" = "15" ]; then if [ "$vs_ver" = "15" ]; then
tag_content PlatformToolset v141 tag_content PlatformToolset v141
fi fi
if [ "$vs_ver" = "16" ]; then
tag_content PlatformToolset v142
fi
if [ "$vs_ver" = "17" ]; then
tag_content PlatformToolset v143
fi
tag_content CharacterSet Unicode tag_content CharacterSet Unicode
if [ "$config" = "Release" ]; then if [ "$config" = "Release" ]; then
tag_content WholeProgramOptimization true tag_content WholeProgramOptimization true
+3 -3
View File
@@ -35,8 +35,8 @@ ARM_TARGETS="arm64-darwin-gcc
armv7s-darwin-gcc" armv7s-darwin-gcc"
SIM_TARGETS="x86-iphonesimulator-gcc SIM_TARGETS="x86-iphonesimulator-gcc
x86_64-iphonesimulator-gcc" x86_64-iphonesimulator-gcc"
OSX_TARGETS="x86-darwin20-gcc OSX_TARGETS="x86-darwin16-gcc
x86_64-darwin20-gcc" x86_64-darwin16-gcc"
TARGETS="${ARM_TARGETS} ${SIM_TARGETS}" TARGETS="${ARM_TARGETS} ${SIM_TARGETS}"
# Configures for the target specified by $1, and invokes make with the dist # Configures for the target specified by $1, and invokes make with the dist
@@ -272,7 +272,7 @@ cat << EOF
--help: Display this message and exit. --help: Display this message and exit.
--enable-shared: Build a dynamic framework for use on iOS 8 or later. --enable-shared: Build a dynamic framework for use on iOS 8 or later.
--extra-configure-args <args>: Extra args to pass when configuring libvpx. --extra-configure-args <args>: Extra args to pass when configuring libvpx.
--macosx: Uses darwin20 targets instead of iphonesimulator targets for x86 --macosx: Uses darwin16 targets instead of iphonesimulator targets for x86
and x86_64. Allows linking to framework when builds target MacOSX and x86_64. Allows linking to framework when builds target MacOSX
instead of iOS. instead of iOS.
--preserve-build-output: Do not delete the build directory. --preserve-build-output: Do not delete the build directory.
+2 -1
View File
@@ -9,7 +9,8 @@
## be found in the AUTHORS file in the root of the source tree. ## 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 && cygpath --help >/dev/null 2>&1; then
FIXPATH='cygpath -m' FIXPATH='cygpath -m'
else else
+63 -6
View File
@@ -315,14 +315,26 @@ EOF
sub mips() { sub mips() {
determine_indirection("c", @ALL_ARCHS); 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; common_top;
print <<EOF; print <<EOF;
#include "vpx_config.h" #include "vpx_config.h"
#ifdef RTCD_C #ifdef RTCD_C
#include "vpx_ports/mips.h"
static void setup_rtcd_internal(void) static void setup_rtcd_internal(void)
{ {
int flags = mips_cpu_caps();
(void)flags;
EOF EOF
set_function_pointers("c", @ALL_ARCHS); set_function_pointers("c", @ALL_ARCHS);
@@ -375,6 +387,37 @@ EOF
common_bottom; common_bottom;
} }
sub loongarch() {
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/loongarch.h"
static void setup_rtcd_internal(void)
{
int flags = loongarch_cpu_caps();
(void)flags;
EOF
set_function_pointers("c", @ALL_ARCHS);
print <<EOF;
}
#endif
EOF
common_bottom;
}
sub unoptimized() { sub unoptimized() {
determine_indirection "c"; determine_indirection "c";
common_top; common_top;
@@ -410,24 +453,35 @@ if ($opts{arch} eq 'x86') {
&require(@REQUIRES); &require(@REQUIRES);
x86; x86;
} elsif ($opts{arch} eq 'mips32' || $opts{arch} eq 'mips64') { } 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}"); @ALL_ARCHS = filter("$opts{arch}");
open CONFIG_FILE, $opts{config} or open CONFIG_FILE, $opts{config} or
die "Error opening config file '$opts{config}': $!\n"; die "Error opening config file '$opts{config}': $!\n";
while (<CONFIG_FILE>) { while (<CONFIG_FILE>) {
if (/HAVE_DSPR2=yes/) { if (/HAVE_DSPR2=yes/) {
@ALL_ARCHS = filter("$opts{arch}", qw/dspr2/); $have_dspr2 = 1;
last;
} }
if (/HAVE_MSA=yes/) { if (/HAVE_MSA=yes/) {
@ALL_ARCHS = filter("$opts{arch}", qw/msa/); $have_msa = 1;
last;
} }
if (/HAVE_MMI=yes/) { if (/HAVE_MMI=yes/) {
@ALL_ARCHS = filter("$opts{arch}", qw/mmi/); $have_mmi = 1;
last;
} }
} }
close CONFIG_FILE; 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; mips;
} elsif ($opts{arch} =~ /armv7\w?/) { } elsif ($opts{arch} =~ /armv7\w?/) {
@ALL_ARCHS = filter(qw/neon_asm neon/); @ALL_ARCHS = filter(qw/neon_asm neon/);
@@ -439,6 +493,9 @@ if ($opts{arch} eq 'x86') {
} elsif ($opts{arch} =~ /^ppc/ ) { } elsif ($opts{arch} =~ /^ppc/ ) {
@ALL_ARCHS = filter(qw/vsx/); @ALL_ARCHS = filter(qw/vsx/);
ppc; ppc;
} elsif ($opts{arch} =~ /loongarch/ ) {
@ALL_ARCHS = filter(qw/lsx lasx/);
loongarch;
} else { } else {
unoptimized; unoptimized;
} }
+1 -4
View File
@@ -11,11 +11,8 @@
package thumb; package thumb;
sub FixThumbInstructions($$) sub FixThumbInstructions($)
{ {
my $short_branches = $_[1];
my $branch_shift_offset = $short_branches ? 1 : 0;
# Write additions with shifts, such as "add r10, r11, lsl #8", # Write additions with shifts, such as "add r10, r11, lsl #8",
# in three operand form, "add r10, r10, r11, lsl #8". # in three operand form, "add r10, r10, r11, lsl #8".
s/(add\s+)(r\d+),\s*(r\d+),\s*(lsl #\d+)/$1$2, $2, $3, $4/g; s/(add\s+)(r\d+),\s*(r\d+),\s*(lsl #\d+)/$1$2, $2, $3, $4/g;
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.

After

Width:  |  Height:  |  Size: 646 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 898 KiB

File diff suppressed because one or more lines are too long
+48 -10
View File
@@ -99,6 +99,8 @@ EOF
# alphabetically by architecture, generic-gnu last. # alphabetically by architecture, generic-gnu last.
all_platforms="${all_platforms} arm64-android-gcc" all_platforms="${all_platforms} arm64-android-gcc"
all_platforms="${all_platforms} arm64-darwin-gcc" all_platforms="${all_platforms} arm64-darwin-gcc"
all_platforms="${all_platforms} arm64-darwin20-gcc"
all_platforms="${all_platforms} arm64-darwin21-gcc"
all_platforms="${all_platforms} arm64-linux-gcc" all_platforms="${all_platforms} arm64-linux-gcc"
all_platforms="${all_platforms} arm64-win64-gcc" all_platforms="${all_platforms} arm64-win64-gcc"
all_platforms="${all_platforms} arm64-win64-vs15" all_platforms="${all_platforms} arm64-win64-vs15"
@@ -112,12 +114,25 @@ all_platforms="${all_platforms} armv7-win32-vs14"
all_platforms="${all_platforms} armv7-win32-vs15" all_platforms="${all_platforms} armv7-win32-vs15"
all_platforms="${all_platforms} armv7s-darwin-gcc" all_platforms="${all_platforms} armv7s-darwin-gcc"
all_platforms="${all_platforms} armv8-linux-gcc" all_platforms="${all_platforms} armv8-linux-gcc"
all_platforms="${all_platforms} loongarch32-linux-gcc"
all_platforms="${all_platforms} loongarch64-linux-gcc"
all_platforms="${all_platforms} mips32-linux-gcc" all_platforms="${all_platforms} mips32-linux-gcc"
all_platforms="${all_platforms} mips64-linux-gcc" all_platforms="${all_platforms} mips64-linux-gcc"
all_platforms="${all_platforms} ppc64le-linux-gcc" all_platforms="${all_platforms} ppc64le-linux-gcc"
all_platforms="${all_platforms} sparc-solaris-gcc" all_platforms="${all_platforms} sparc-solaris-gcc"
all_platforms="${all_platforms} x86-android-gcc" all_platforms="${all_platforms} x86-android-gcc"
all_platforms="${all_platforms} x86-darwin-gcc" all_platforms="${all_platforms} x86-darwin8-gcc"
all_platforms="${all_platforms} x86-darwin8-icc"
all_platforms="${all_platforms} x86-darwin9-gcc"
all_platforms="${all_platforms} x86-darwin9-icc"
all_platforms="${all_platforms} x86-darwin10-gcc"
all_platforms="${all_platforms} x86-darwin11-gcc"
all_platforms="${all_platforms} x86-darwin12-gcc"
all_platforms="${all_platforms} x86-darwin13-gcc"
all_platforms="${all_platforms} x86-darwin14-gcc"
all_platforms="${all_platforms} x86-darwin15-gcc"
all_platforms="${all_platforms} x86-darwin16-gcc"
all_platforms="${all_platforms} x86-darwin17-gcc"
all_platforms="${all_platforms} x86-iphonesimulator-gcc" all_platforms="${all_platforms} x86-iphonesimulator-gcc"
all_platforms="${all_platforms} x86-linux-gcc" all_platforms="${all_platforms} x86-linux-gcc"
all_platforms="${all_platforms} x86-linux-icc" all_platforms="${all_platforms} x86-linux-icc"
@@ -126,8 +141,22 @@ all_platforms="${all_platforms} x86-solaris-gcc"
all_platforms="${all_platforms} x86-win32-gcc" all_platforms="${all_platforms} x86-win32-gcc"
all_platforms="${all_platforms} x86-win32-vs14" all_platforms="${all_platforms} x86-win32-vs14"
all_platforms="${all_platforms} x86-win32-vs15" all_platforms="${all_platforms} x86-win32-vs15"
all_platforms="${all_platforms} x86-win32-vs16"
all_platforms="${all_platforms} x86-win32-vs17"
all_platforms="${all_platforms} x86_64-android-gcc" all_platforms="${all_platforms} x86_64-android-gcc"
all_platforms="${all_platforms} x86_64-darwin-gcc" all_platforms="${all_platforms} x86_64-darwin9-gcc"
all_platforms="${all_platforms} x86_64-darwin10-gcc"
all_platforms="${all_platforms} x86_64-darwin11-gcc"
all_platforms="${all_platforms} x86_64-darwin12-gcc"
all_platforms="${all_platforms} x86_64-darwin13-gcc"
all_platforms="${all_platforms} x86_64-darwin14-gcc"
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-darwin21-gcc"
all_platforms="${all_platforms} x86_64-iphonesimulator-gcc" all_platforms="${all_platforms} x86_64-iphonesimulator-gcc"
all_platforms="${all_platforms} x86_64-linux-gcc" all_platforms="${all_platforms} x86_64-linux-gcc"
all_platforms="${all_platforms} x86_64-linux-icc" all_platforms="${all_platforms} x86_64-linux-icc"
@@ -135,6 +164,8 @@ all_platforms="${all_platforms} x86_64-solaris-gcc"
all_platforms="${all_platforms} x86_64-win64-gcc" all_platforms="${all_platforms} x86_64-win64-gcc"
all_platforms="${all_platforms} x86_64-win64-vs14" all_platforms="${all_platforms} x86_64-win64-vs14"
all_platforms="${all_platforms} x86_64-win64-vs15" all_platforms="${all_platforms} x86_64-win64-vs15"
all_platforms="${all_platforms} x86_64-win64-vs16"
all_platforms="${all_platforms} x86_64-win64-vs17"
all_platforms="${all_platforms} generic-gnu" all_platforms="${all_platforms} generic-gnu"
# all_targets is a list of all targets that can be configured # all_targets is a list of all targets that can be configured
@@ -210,6 +241,7 @@ ARCH_LIST="
x86 x86
x86_64 x86_64
ppc ppc
loongarch
" "
ARCH_EXT_LIST_X86=" ARCH_EXT_LIST_X86="
mmx mmx
@@ -225,6 +257,8 @@ ARCH_EXT_LIST_X86="
ARCH_EXT_LIST_LOONGSON=" ARCH_EXT_LIST_LOONGSON="
mmi mmi
lsx
lasx
" "
ARCH_EXT_LIST=" ARCH_EXT_LIST="
@@ -252,6 +286,7 @@ EXPERIMENT_LIST="
fp_mb_stats fp_mb_stats
emulate_hardware emulate_hardware
non_greedy_mv non_greedy_mv
rate_ctrl
" "
CONFIG_LIST=" CONFIG_LIST="
dependency_tracking dependency_tracking
@@ -574,9 +609,7 @@ EOF
check_header pthread.h && check_lib -lpthread <<EOF || disable_feature pthread_h check_header pthread.h && check_lib -lpthread <<EOF || disable_feature pthread_h
#include <pthread.h> #include <pthread.h>
#include <stddef.h> #include <stddef.h>
void *thread_check (void *); int main(void) { return pthread_create(NULL, NULL, NULL, NULL); }
void *thread_check (void *obj){ return obj;};
int main(void) { pthread_t thread_id; return pthread_create(&thread_id, NULL, thread_check, NULL); }
EOF EOF
check_header unistd.h # for sysconf(3) and friends. check_header unistd.h # for sysconf(3) and friends.
@@ -596,7 +629,10 @@ process_toolchain() {
check_add_cflags -Wall check_add_cflags -Wall
check_add_cflags -Wdeclaration-after-statement check_add_cflags -Wdeclaration-after-statement
check_add_cflags -Wdisabled-optimization check_add_cflags -Wdisabled-optimization
check_add_cflags -Wextra-semi
check_add_cflags -Wextra-semi-stmt
check_add_cflags -Wfloat-conversion check_add_cflags -Wfloat-conversion
check_add_cflags -Wformat=2
check_add_cflags -Wparentheses-equality check_add_cflags -Wparentheses-equality
check_add_cflags -Wpointer-arith check_add_cflags -Wpointer-arith
check_add_cflags -Wtype-limits check_add_cflags -Wtype-limits
@@ -606,6 +642,7 @@ process_toolchain() {
check_add_cflags -Wmissing-declarations check_add_cflags -Wmissing-declarations
check_add_cflags -Wmissing-prototypes check_add_cflags -Wmissing-prototypes
check_add_cflags -Wuninitialized check_add_cflags -Wuninitialized
check_add_cflags -Wunreachable-code-loop-increment
check_add_cflags -Wunused check_add_cflags -Wunused
check_add_cflags -Wextra check_add_cflags -Wextra
# check_add_cflags also adds to cxxflags. gtest does not do well with # check_add_cflags also adds to cxxflags. gtest does not do well with
@@ -706,32 +743,33 @@ process_toolchain() {
soft_enable libyuv soft_enable libyuv
;; ;;
*-android-*) *-android-*)
check_add_cxxflags -std=c++11 && soft_enable webm_io check_add_cxxflags -std=gnu++11 && soft_enable webm_io
soft_enable libyuv soft_enable libyuv
# GTestLog must be modified to use Android logging utilities. # GTestLog must be modified to use Android logging utilities.
;; ;;
*-darwin-*) *-darwin-*)
check_add_cxxflags -std=gnu++11
# iOS/ARM builds do not work with gtest. This does not match # iOS/ARM builds do not work with gtest. This does not match
# x86 targets. # x86 targets.
;; ;;
*-iphonesimulator-*) *-iphonesimulator-*)
check_add_cxxflags -std=c++11 && soft_enable webm_io check_add_cxxflags -std=gnu++11 && soft_enable webm_io
soft_enable libyuv soft_enable libyuv
;; ;;
*-win*) *-win*)
# Some mingw toolchains don't have pthread available by default. # Some mingw toolchains don't have pthread available by default.
# Treat these more like visual studio where threading in gtest # Treat these more like visual studio where threading in gtest
# would be disabled for the same reason. # 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 && soft_enable webm_io
check_cxx "$@" <<EOF && soft_enable libyuv check_cxx "$@" <<EOF && soft_enable libyuv
int z; int z;
EOF EOF
;; ;;
*) *)
enabled pthread_h && check_add_cxxflags -std=c++11 \ enabled pthread_h && check_add_cxxflags -std=gnu++11 \
&& soft_enable unit_tests && 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 check_cxx "$@" <<EOF && soft_enable libyuv
int z; int z;
EOF EOF
+3
View File
@@ -65,6 +65,7 @@ endif
# while EXAMPLES demonstrate specific portions of the API. # while EXAMPLES demonstrate specific portions of the API.
UTILS-$(CONFIG_DECODERS) += vpxdec.c UTILS-$(CONFIG_DECODERS) += vpxdec.c
vpxdec.SRCS += md5_utils.c md5_utils.h 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.h
vpxdec.SRCS += vpx_ports/mem_ops_aligned.h vpxdec.SRCS += vpx_ports/mem_ops_aligned.h
vpxdec.SRCS += vpx_ports/msvc.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 += tools_common.h tools_common.c
decode_to_md5.SRCS += video_common.h decode_to_md5.SRCS += video_common.h
decode_to_md5.SRCS += video_reader.h video_reader.c 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.h
decode_to_md5.SRCS += vpx_ports/mem_ops_aligned.h decode_to_md5.SRCS += vpx_ports/mem_ops_aligned.h
decode_to_md5.SRCS += vpx_ports/msvc.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)\ --ver=$$(CONFIG_VS_VERSION)\
--proj-guid=$$($$(@:.$(VCPROJ_SFX)=).GUID)\ --proj-guid=$$($$(@:.$(VCPROJ_SFX)=).GUID)\
--src-path-bare="$(SRC_PATH_BARE)" \ --src-path-bare="$(SRC_PATH_BARE)" \
--as=$$(AS) \
$$(if $$(CONFIG_STATIC_MSVCRT),--static-crt) \ $$(if $$(CONFIG_STATIC_MSVCRT),--static-crt) \
--out=$$@ $$(INTERNAL_CFLAGS) $$(CFLAGS) \ --out=$$@ $$(INTERNAL_CFLAGS) $$(CFLAGS) \
$$(INTERNAL_LDFLAGS) $$(LDFLAGS) -l$$(CODEC_LIB) $$^ $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -l$$(CODEC_LIB) $$^
+1 -1
View File
@@ -106,7 +106,7 @@ int main(int argc, char **argv) {
printf("Using %s\n", vpx_codec_iface_name(decoder->codec_interface())); printf("Using %s\n", vpx_codec_iface_name(decoder->codec_interface()));
if (vpx_codec_dec_init(&codec, decoder->codec_interface(), NULL, 0)) 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)) { while (vpx_video_reader_read_frame(reader)) {
vpx_codec_iter_t iter = NULL; vpx_codec_iter_t iter = NULL;
+3 -3
View File
@@ -86,9 +86,9 @@ int main(int argc, char **argv) {
res = vpx_codec_dec_init(&codec, decoder->codec_interface(), NULL, res = vpx_codec_dec_init(&codec, decoder->codec_interface(), NULL,
VPX_CODEC_USE_POSTPROC); VPX_CODEC_USE_POSTPROC);
if (res == VPX_CODEC_INCAPABLE) 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)) { while (vpx_video_reader_read_frame(reader)) {
vpx_codec_iter_t iter = NULL; vpx_codec_iter_t iter = NULL;
@@ -109,7 +109,7 @@ int main(int argc, char **argv) {
0 }; 0 };
if (vpx_codec_control(&codec, VP8_SET_POSTPROC, &pp)) if (vpx_codec_control(&codec, VP8_SET_POSTPROC, &pp))
die_codec(&codec, "Failed to turn on postproc."); die_codec(&codec, "Failed to turn on postproc.");
}; }
// Decode the frame with 15ms deadline // Decode the frame with 15ms deadline
if (vpx_codec_decode(&codec, frame, (unsigned int)frame_size, NULL, 15000)) if (vpx_codec_decode(&codec, frame, (unsigned int)frame_size, NULL, 15000))
+1 -1
View File
@@ -209,7 +209,7 @@ int main(int argc, char **argv) {
die("Failed to open %s for reading.", argv[4]); die("Failed to open %s for reading.", argv[4]);
if (vpx_codec_enc_init(&codec, encoder->codec_interface(), &cfg, 0)) 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. // Encode frames.
while (vpx_img_read(&raw, infile)) { while (vpx_img_read(&raw, infile)) {
+1 -1
View File
@@ -118,7 +118,7 @@ int main(int argc, char **argv) {
printf("Using %s\n", vpx_codec_iface_name(decoder->codec_interface())); printf("Using %s\n", vpx_codec_iface_name(decoder->codec_interface()));
if (vpx_codec_dec_init(&codec, decoder->codec_interface(), NULL, 0)) 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)) { while (vpx_video_reader_read_frame(reader)) {
vpx_codec_iter_t iter = NULL; vpx_codec_iter_t iter = NULL;
+1 -1
View File
@@ -218,7 +218,7 @@ int main(int argc, char **argv) {
die("Failed to open %s for reading.", infile_arg); die("Failed to open %s for reading.", infile_arg);
if (vpx_codec_enc_init(&codec, encoder->codec_interface(), &cfg, 0)) 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. // Encode frames.
while (vpx_img_read(&raw, infile)) { while (vpx_img_read(&raw, infile)) {
+10 -7
View File
@@ -21,6 +21,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#define VPX_DISABLE_CTRL_TYPECHECKS 1 #define VPX_DISABLE_CTRL_TYPECHECKS 1
#include "../tools_common.h"
#include "./vpx_config.h" #include "./vpx_config.h"
#include "./svc_context.h" #include "./svc_context.h"
#include "vpx/vp8cx.h" #include "vpx/vp8cx.h"
@@ -95,8 +96,9 @@ static const SvcInternal_t *get_const_svc_internal(const SvcContext *svc_ctx) {
return (const SvcInternal_t *)svc_ctx->internal; return (const SvcInternal_t *)svc_ctx->internal;
} }
static int svc_log(SvcContext *svc_ctx, SVC_LOG_LEVEL level, const char *fmt, static VPX_TOOLS_FORMAT_PRINTF(3, 4) int svc_log(SvcContext *svc_ctx,
...) { SVC_LOG_LEVEL level,
const char *fmt, ...) {
char buf[512]; char buf[512];
int retval = 0; int retval = 0;
va_list ap; va_list ap;
@@ -264,7 +266,7 @@ static vpx_codec_err_t parse_options(SvcContext *svc_ctx, const char *options) {
if (alt_ref_enabled > REF_FRAMES - svc_ctx->spatial_layers) { if (alt_ref_enabled > REF_FRAMES - svc_ctx->spatial_layers) {
svc_log(svc_ctx, SVC_LOG_ERROR, svc_log(svc_ctx, SVC_LOG_ERROR,
"svc: auto alt ref: Maxinum %d(REF_FRAMES - layers) layers could" "svc: auto alt ref: Maxinum %d(REF_FRAMES - layers) layers could"
"enabled auto alt reference frame, but % layers are enabled\n", "enabled auto alt reference frame, but %d layers are enabled\n",
REF_FRAMES - svc_ctx->spatial_layers, alt_ref_enabled); REF_FRAMES - svc_ctx->spatial_layers, alt_ref_enabled);
res = VPX_CODEC_INVALID_PARAM; res = VPX_CODEC_INVALID_PARAM;
} }
@@ -456,10 +458,11 @@ vpx_codec_err_t vpx_svc_init(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
svc_ctx->temporal_layers = VPX_TS_MAX_LAYERS; svc_ctx->temporal_layers = VPX_TS_MAX_LAYERS;
if (svc_ctx->temporal_layers * svc_ctx->spatial_layers > VPX_MAX_LAYERS) { if (svc_ctx->temporal_layers * svc_ctx->spatial_layers > VPX_MAX_LAYERS) {
svc_log(svc_ctx, SVC_LOG_ERROR, svc_log(
"spatial layers * temporal layers exceeds the maximum number of " svc_ctx, SVC_LOG_ERROR,
"allowed layers of %d\n", "spatial layers * temporal layers (%d) exceeds the maximum number of "
svc_ctx->spatial_layers * svc_ctx->temporal_layers, VPX_MAX_LAYERS); "allowed layers of %d\n",
svc_ctx->spatial_layers * svc_ctx->temporal_layers, VPX_MAX_LAYERS);
return VPX_CODEC_INVALID_PARAM; return VPX_CODEC_INVALID_PARAM;
} }
res = assign_layer_bitrates(svc_ctx, enc_cfg); res = assign_layer_bitrates(svc_ctx, enc_cfg);
+4 -3
View File
@@ -84,6 +84,7 @@ static int get_frame_stats(vpx_codec_ctx_t *ctx, const vpx_image_t *img,
const uint8_t *const pkt_buf = pkt->data.twopass_stats.buf; const uint8_t *const pkt_buf = pkt->data.twopass_stats.buf;
const size_t pkt_size = pkt->data.twopass_stats.sz; const size_t pkt_size = pkt->data.twopass_stats.sz;
stats->buf = realloc(stats->buf, stats->sz + pkt_size); stats->buf = realloc(stats->buf, stats->sz + pkt_size);
if (!stats->buf) die("Failed to reallocate stats buffer.");
memcpy((uint8_t *)stats->buf + stats->sz, pkt_buf, pkt_size); memcpy((uint8_t *)stats->buf + stats->sz, pkt_buf, pkt_size);
stats->sz += pkt_size; stats->sz += pkt_size;
} }
@@ -128,7 +129,7 @@ static vpx_fixed_buf_t pass0(vpx_image_t *raw, FILE *infile,
vpx_fixed_buf_t stats = { NULL, 0 }; vpx_fixed_buf_t stats = { NULL, 0 };
if (vpx_codec_enc_init(&codec, encoder->codec_interface(), cfg, 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. // Calculate frame statistics.
while (vpx_img_read(raw, infile)) { while (vpx_img_read(raw, infile)) {
@@ -164,7 +165,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 (!writer) die("Failed to open %s for writing", outfile_name);
if (vpx_codec_enc_init(&codec, encoder->codec_interface(), cfg, 0)) 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. // Encode frames.
while (vpx_img_read(raw, infile)) { while (vpx_img_read(raw, infile)) {
@@ -221,7 +222,7 @@ int main(int argc, char **argv) {
die("Invalid frame size: %dx%d", w, h); die("Invalid frame size: %dx%d", w, h);
if (!vpx_img_alloc(&raw, VPX_IMG_FMT_I420, w, h, 1)) if (!vpx_img_alloc(&raw, VPX_IMG_FMT_I420, w, h, 1))
die("Failed to allocate image", w, h); die("Failed to allocate image (%dx%d)", w, h);
printf("Using %s\n", vpx_codec_iface_name(encoder->codec_interface())); printf("Using %s\n", vpx_codec_iface_name(encoder->codec_interface()));
@@ -352,7 +352,7 @@ int main(int argc, char **argv) {
framerate = (int)strtol(argv[3], NULL, 0); framerate = (int)strtol(argv[3], NULL, 0);
if (width < 16 || width % 2 || height < 16 || height % 2) if (width < 16 || width % 2 || height < 16 || height % 2)
die("Invalid resolution: %ldx%ld", width, height); die("Invalid resolution: %dx%d", width, height);
/* Open input video file for encoding */ /* Open input video file for encoding */
if (!(infile = fopen(argv[4], "rb"))) if (!(infile = fopen(argv[4], "rb")))
@@ -380,7 +380,7 @@ int main(int argc, char **argv) {
(int)strtol(argv[2 * NUM_ENCODERS + 5 + i], NULL, 0); (int)strtol(argv[2 * NUM_ENCODERS + 5 + i], NULL, 0);
if (num_temporal_layers[i] < 1 || num_temporal_layers[i] > 3) if (num_temporal_layers[i] < 1 || num_temporal_layers[i] > 3)
die("Invalid temporal layers: %d, Must be 1, 2, or 3. \n", die("Invalid temporal layers: %d, Must be 1, 2, or 3. \n",
num_temporal_layers); num_temporal_layers[i]);
} }
/* Open file to write out each spatially downsampled input stream. */ /* Open file to write out each spatially downsampled input stream. */
@@ -468,7 +468,7 @@ int main(int argc, char **argv) {
/* Allocate image for each encoder */ /* Allocate image for each encoder */
for (i = 0; i < NUM_ENCODERS; i++) for (i = 0; i < NUM_ENCODERS; i++)
if (!vpx_img_alloc(&raw[i], VPX_IMG_FMT_I420, cfg[i].g_w, cfg[i].g_h, 32)) if (!vpx_img_alloc(&raw[i], VPX_IMG_FMT_I420, cfg[i].g_w, cfg[i].g_h, 32))
die("Failed to allocate image", cfg[i].g_w, cfg[i].g_h); die("Failed to allocate image (%dx%d)", cfg[i].g_w, cfg[i].g_h);
if (raw[0].stride[VPX_PLANE_Y] == (int)raw[0].d_w) if (raw[0].stride[VPX_PLANE_Y] == (int)raw[0].d_w)
read_frame_p = mulres_read_frame; read_frame_p = mulres_read_frame;
+1 -1
View File
@@ -155,7 +155,7 @@ int main(int argc, char **argv) {
die("Failed to open %s for reading.", argv[3]); die("Failed to open %s for reading.", argv[3]);
if (vpx_codec_enc_init(&codec, encoder->codec_interface(), &cfg, 0)) 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. // Encode frames.
while (vpx_img_read(&raw, infile)) { while (vpx_img_read(&raw, infile)) {
+1 -1
View File
@@ -110,7 +110,7 @@ int main(int argc, char **argv) {
die("Failed to open %s for reading.", argv[3]); die("Failed to open %s for reading.", argv[3]);
if (vpx_codec_enc_init(&codec, encoder->codec_interface(), &cfg, 0)) 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)) if (vpx_codec_control_(&codec, VP9E_SET_LOSSLESS, 1))
die_codec(&codec, "Failed to use lossless mode"); die_codec(&codec, "Failed to use lossless mode");
+26 -70
View File
@@ -66,12 +66,6 @@ static const arg_def_t kf_dist_arg =
ARG_DEF("k", "kf-dist", 1, "number of frames between keyframes"); ARG_DEF("k", "kf-dist", 1, "number of frames between keyframes");
static const arg_def_t scale_factors_arg = static const arg_def_t scale_factors_arg =
ARG_DEF("r", "scale-factors", 1, "scale factors (lowest to highest layer)"); 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 = static const arg_def_t min_q_arg =
ARG_DEF(NULL, "min-q", 1, "Minimum quantizer"); ARG_DEF(NULL, "min-q", 1, "Minimum quantizer");
static const arg_def_t max_q_arg = static const arg_def_t max_q_arg =
@@ -125,9 +119,6 @@ static const arg_def_t *svc_args[] = { &frames_arg,
&spatial_layers_arg, &spatial_layers_arg,
&kf_dist_arg, &kf_dist_arg,
&scale_factors_arg, &scale_factors_arg,
&passes_arg,
&pass_arg,
&fpf_name_arg,
&min_q_arg, &min_q_arg,
&max_q_arg, &max_q_arg,
&min_bitrate_arg, &min_bitrate_arg,
@@ -173,8 +164,6 @@ typedef struct {
uint32_t frames_to_skip; uint32_t frames_to_skip;
struct VpxInputContext input_ctx; struct VpxInputContext input_ctx;
stats_io_t rc_stats; stats_io_t rc_stats;
int passes;
int pass;
int tune_content; int tune_content;
int inter_layer_pred; int inter_layer_pred;
} AppInput; } AppInput;
@@ -197,9 +186,6 @@ static void parse_command_line(int argc, const char **argv_,
char **argi = NULL; char **argi = NULL;
char **argj = NULL; char **argj = NULL;
vpx_codec_err_t res; vpx_codec_err_t res;
int passes = 0;
int pass = 0;
const char *fpf_file_name = NULL;
unsigned int min_bitrate = 0; unsigned int min_bitrate = 0;
unsigned int max_bitrate = 0; unsigned int max_bitrate = 0;
char string_options[1024] = { 0 }; char string_options[1024] = { 0 };
@@ -236,6 +222,10 @@ static void parse_command_line(int argc, const char **argv_,
// process command line options // process command line options
argv = argv_dup(argc - 1, argv_ + 1); argv = argv_dup(argc - 1, argv_ + 1);
if (!argv) {
fprintf(stderr, "Error allocating argument list\n");
exit(EXIT_FAILURE);
}
for (argi = argj = argv; (*argj = *argi); argi += arg.argv_step) { for (argi = argj = argv; (*argj = *argi); argi += arg.argv_step) {
arg.argv_step = 1; arg.argv_step = 1;
@@ -289,18 +279,6 @@ static void parse_command_line(int argc, const char **argv_,
sizeof(string_options) - strlen(string_options) - 1); sizeof(string_options) - strlen(string_options) - 1);
strncat(string_options, arg.val, strncat(string_options, arg.val,
sizeof(string_options) - strlen(string_options) - 1); 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)) { } else if (arg_match(&arg, &min_q_arg, argi)) {
strncat(string_options, " min-quantizers=", strncat(string_options, " min-quantizers=",
sizeof(string_options) - strlen(string_options) - 1); sizeof(string_options) - strlen(string_options) - 1);
@@ -355,35 +333,7 @@ static void parse_command_line(int argc, const char **argv_,
if (strlen(string_options) > 0) if (strlen(string_options) > 0)
vpx_svc_set_options(svc_ctx, string_options + 1); vpx_svc_set_options(svc_ctx, string_options + 1);
if (passes == 0 || passes == 1) { enc_cfg->g_pass = VPX_RC_ONE_PASS;
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;
}
if (enc_cfg->rc_target_bitrate > 0) { if (enc_cfg->rc_target_bitrate > 0) {
if (min_bitrate > 0) { if (min_bitrate > 0) {
@@ -411,6 +361,8 @@ static void parse_command_line(int argc, const char **argv_,
if (app_input->input_ctx.file_type == FILE_TYPE_Y4M) { if (app_input->input_ctx.file_type == FILE_TYPE_Y4M) {
enc_cfg->g_w = app_input->input_ctx.width; enc_cfg->g_w = app_input->input_ctx.width;
enc_cfg->g_h = app_input->input_ctx.height; enc_cfg->g_h = app_input->input_ctx.height;
enc_cfg->g_timebase.den = app_input->input_ctx.framerate.numerator;
enc_cfg->g_timebase.num = app_input->input_ctx.framerate.denominator;
} }
if (enc_cfg->g_w < 16 || enc_cfg->g_w % 2 || enc_cfg->g_h < 16 || if (enc_cfg->g_w < 16 || enc_cfg->g_w % 2 || enc_cfg->g_h < 16 ||
@@ -633,7 +585,8 @@ static void set_frame_flags_bypass_mode_ex0(
ref_frame_config->alt_fb_idx[sl] = 0; ref_frame_config->alt_fb_idx[sl] = 0;
} else if (tl == 1) { } else if (tl == 1) {
ref_frame_config->lst_fb_idx[sl] = sl; ref_frame_config->lst_fb_idx[sl] = sl;
ref_frame_config->gld_fb_idx[sl] = num_spatial_layers + sl - 1; ref_frame_config->gld_fb_idx[sl] =
(sl == 0) ? 0 : num_spatial_layers + sl - 1;
ref_frame_config->alt_fb_idx[sl] = num_spatial_layers + sl; ref_frame_config->alt_fb_idx[sl] = num_spatial_layers + sl;
} }
// Set the reference and update flags. // Set the reference and update flags.
@@ -828,12 +781,15 @@ static void svc_output_rc_stats(
vpx_codec_control(codec, VP9E_GET_SVC_LAYER_ID, layer_id); vpx_codec_control(codec, VP9E_GET_SVC_LAYER_ID, layer_id);
parse_superframe_index(cx_pkt->data.frame.buf, cx_pkt->data.frame.sz, parse_superframe_index(cx_pkt->data.frame.buf, cx_pkt->data.frame.sz,
sizes_parsed, &count); sizes_parsed, &count);
if (enc_cfg->ss_number_layers == 1) sizes[0] = cx_pkt->data.frame.sz; if (enc_cfg->ss_number_layers == 1) {
for (sl = 0; sl < enc_cfg->ss_number_layers; ++sl) { sizes[0] = cx_pkt->data.frame.sz;
sizes[sl] = 0; } else {
if (cx_pkt->data.frame.spatial_layer_encoded[sl]) { for (sl = 0; sl < enc_cfg->ss_number_layers; ++sl) {
sizes[sl] = sizes_parsed[num_layers_encoded]; sizes[sl] = 0;
num_layers_encoded++; 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) { for (sl = 0; sl < enc_cfg->ss_number_layers; ++sl) {
@@ -1001,13 +957,11 @@ int main(int argc, const char **argv) {
info.time_base.numerator = enc_cfg.g_timebase.num; info.time_base.numerator = enc_cfg.g_timebase.num;
info.time_base.denominator = enc_cfg.g_timebase.den; info.time_base.denominator = enc_cfg.g_timebase.den;
if (!(app_input.passes == 2 && app_input.pass == 1)) { writer =
// We don't save the bitstream for the 1st pass on two pass rate control vpx_video_writer_open(app_input.output_filename, kContainerIVF, &info);
writer = if (!writer)
vpx_video_writer_open(app_input.output_filename, kContainerIVF, &info); die("Failed to open %s for writing\n", app_input.output_filename);
if (!writer)
die("Failed to open %s for writing\n", app_input.output_filename);
}
#if OUTPUT_RC_STATS #if OUTPUT_RC_STATS
// Write out spatial layer stream. // Write out spatial layer stream.
// TODO(marpan/jianj): allow for writing each spatial and temporal stream. // TODO(marpan/jianj): allow for writing each spatial and temporal stream.
@@ -1050,6 +1004,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_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; svc_drop_frame.framedrop_mode = FULL_SUPERFRAME_DROP;
for (sl = 0; sl < (unsigned int)svc_ctx.spatial_layers; ++sl) for (sl = 0; sl < (unsigned int)svc_ctx.spatial_layers; ++sl)
svc_drop_frame.framedrop_thresh[sl] = enc_cfg.rc_dropframe_thresh; svc_drop_frame.framedrop_thresh[sl] = enc_cfg.rc_dropframe_thresh;
@@ -1224,7 +1181,6 @@ int main(int argc, const char **argv) {
#endif #endif
if (vpx_codec_destroy(&encoder)) if (vpx_codec_destroy(&encoder))
die_codec(&encoder, "Failed to destroy codec"); die_codec(&encoder, "Failed to destroy codec");
if (app_input.passes == 2) stats_close(&app_input.rc_stats, 1);
if (writer) { if (writer) {
vpx_video_writer_close(writer); vpx_video_writer_close(writer);
} }
+1 -1
View File
@@ -251,7 +251,7 @@ int main(int argc, char **argv) {
die("Failed to open %s for reading.", infile_arg); die("Failed to open %s for reading.", infile_arg);
if (vpx_codec_enc_init(&ecodec, encoder->codec_interface(), &cfg, 0)) 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. // Disable alt_ref.
if (vpx_codec_control(&ecodec, VP8E_SET_ENABLEAUTOALTREF, 0)) if (vpx_codec_control(&ecodec, VP8E_SET_ENABLEAUTOALTREF, 0))
+8 -1
View File
@@ -41,7 +41,7 @@
$make -j32 $make -j32
* Build vp9 fuzzer * 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 \ -fsanitize=fuzzer -I../libvpx -I. -Wl,--start-group \
../libvpx/examples/vpx_dec_fuzzer.cc -o ./vpx_dec_fuzzer_vp9 \ ../libvpx/examples/vpx_dec_fuzzer.cc -o ./vpx_dec_fuzzer_vp9 \
./libvpx.a -Wl,--end-group ./libvpx.a -Wl,--end-group
@@ -94,6 +94,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
return 0; 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; data += IVF_FILE_HDR_SZ;
size -= IVF_FILE_HDR_SZ; size -= IVF_FILE_HDR_SZ;
+100 -15
View File
@@ -30,7 +30,7 @@
#define ROI_MAP 0 #define ROI_MAP 0
#define zero(Dest) memset(&(Dest), 0, sizeof(Dest)); #define zero(Dest) memset(&(Dest), 0, sizeof(Dest))
static const char *exec_name; static const char *exec_name;
@@ -240,6 +240,38 @@ static void set_roi_map(const char *enc_name, vpx_codec_enc_cfg_t *cfg,
} }
} }
} }
static void set_roi_skip_map(vpx_codec_enc_cfg_t *cfg, vpx_roi_map_t *roi,
int *skip_map, int *prev_mask_map, int frame_num) {
const int block_size = 8;
unsigned int i, j;
roi->rows = (cfg->g_h + block_size - 1) / block_size;
roi->cols = (cfg->g_w + block_size - 1) / block_size;
zero(roi->skip);
zero(roi->delta_q);
zero(roi->delta_lf);
memset(roi->ref_frame, -1, sizeof(roi->ref_frame));
roi->ref_frame[1] = 1;
// Use segment 3 for skip.
roi->skip[3] = 1;
roi->roi_map =
(uint8_t *)calloc(roi->rows * roi->cols, sizeof(*roi->roi_map));
for (i = 0; i < roi->rows; ++i) {
for (j = 0; j < roi->cols; ++j) {
const int idx = i * roi->cols + j;
// Use segment 3 for skip.
// prev_mask_map keeps track of blocks that have been stably on segment 3
// for the past 10 frames. Only skip when the block is on segment 3 in
// both current map and prev_mask_map.
if (skip_map[idx] == 1 && prev_mask_map[idx] == 1) roi->roi_map[idx] = 3;
// Reset it every 10 frames so it doesn't propagate for too many frames.
if (frame_num % 10 == 0)
prev_mask_map[idx] = skip_map[idx];
else if (prev_mask_map[idx] == 1 && skip_map[idx] == 0)
prev_mask_map[idx] = 0;
}
}
}
#endif #endif
// Temporal scaling parameters: // Temporal scaling parameters:
@@ -574,6 +606,23 @@ static void set_temporal_layer_pattern(int layering_mode,
} }
} }
#if ROI_MAP
static void read_mask(FILE *mask_file, int *seg_map) {
int mask_rows, mask_cols, i, j;
int *map_start = seg_map;
fscanf(mask_file, "%d %d\n", &mask_cols, &mask_rows);
for (i = 0; i < mask_rows; i++) {
for (j = 0; j < mask_cols; j++) {
fscanf(mask_file, "%d ", &seg_map[j]);
// reverse the bit
seg_map[j] = 1 - seg_map[j];
}
seg_map += mask_cols;
}
seg_map = map_start;
}
#endif
int main(int argc, char **argv) { int main(int argc, char **argv) {
VpxVideoWriter *outfile[VPX_TS_MAX_LAYERS] = { NULL }; VpxVideoWriter *outfile[VPX_TS_MAX_LAYERS] = { NULL };
vpx_codec_ctx_t codec; vpx_codec_ctx_t codec;
@@ -613,7 +662,14 @@ int main(int argc, char **argv) {
double sum_bitrate = 0.0; double sum_bitrate = 0.0;
double sum_bitrate2 = 0.0; double sum_bitrate2 = 0.0;
double framerate = 30.0; double framerate = 30.0;
#if ROI_MAP
FILE *mask_file = NULL;
int block_size = 8;
int mask_rows = 0;
int mask_cols = 0;
int *mask_map;
int *prev_mask_map;
#endif
zero(rc.layer_target_bitrate); zero(rc.layer_target_bitrate);
memset(&layer_id, 0, sizeof(vpx_svc_layer_id_t)); memset(&layer_id, 0, sizeof(vpx_svc_layer_id_t));
memset(&input_ctx, 0, sizeof(input_ctx)); memset(&input_ctx, 0, sizeof(input_ctx));
@@ -657,9 +713,15 @@ int main(int argc, char **argv) {
die("Invalid layering mode (0..12) %s", argv[12]); die("Invalid layering mode (0..12) %s", argv[12]);
} }
#if ROI_MAP
if (argc != min_args + mode_to_num_layers[layering_mode] + 1) {
die("Invalid number of arguments");
}
#else
if (argc != min_args + mode_to_num_layers[layering_mode]) { if (argc != min_args + mode_to_num_layers[layering_mode]) {
die("Invalid number of arguments"); die("Invalid number of arguments");
} }
#endif
input_ctx.filename = argv[1]; input_ctx.filename = argv[1];
open_input_file(&input_ctx); open_input_file(&input_ctx);
@@ -687,14 +749,14 @@ int main(int argc, char **argv) {
&raw, &raw,
bit_depth == VPX_BITS_8 ? VPX_IMG_FMT_I420 : VPX_IMG_FMT_I42016, bit_depth == VPX_BITS_8 ? VPX_IMG_FMT_I420 : VPX_IMG_FMT_I42016,
width, height, 32)) { width, height, 32)) {
die("Failed to allocate image", width, height); die("Failed to allocate image (%dx%d)", width, height);
} }
} }
#else #else
// Y4M reader has its own allocation. // Y4M reader has its own allocation.
if (input_ctx.file_type != FILE_TYPE_Y4M) { if (input_ctx.file_type != FILE_TYPE_Y4M) {
if (!vpx_img_alloc(&raw, VPX_IMG_FMT_I420, width, height, 32)) { if (!vpx_img_alloc(&raw, VPX_IMG_FMT_I420, width, height, 32)) {
die("Failed to allocate image", width, height); die("Failed to allocate image (%dx%d)", width, height);
} }
} }
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
@@ -815,7 +877,14 @@ int main(int argc, char **argv) {
#else #else
if (vpx_codec_enc_init(&codec, encoder->codec_interface(), &cfg, 0)) if (vpx_codec_enc_init(&codec, encoder->codec_interface(), &cfg, 0))
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
die_codec(&codec, "Failed to initialize encoder"); die("Failed to initialize encoder");
#if ROI_MAP
mask_rows = (cfg.g_h + block_size - 1) / block_size;
mask_cols = (cfg.g_w + block_size - 1) / block_size;
mask_map = (int *)calloc(mask_rows * mask_cols, sizeof(*mask_map));
prev_mask_map = (int *)calloc(mask_rows * mask_cols, sizeof(*mask_map));
#endif
if (strncmp(encoder->name, "vp8", 3) == 0) { if (strncmp(encoder->name, "vp8", 3) == 0) {
vpx_codec_control(&codec, VP8E_SET_CPUUSED, -speed); vpx_codec_control(&codec, VP8E_SET_CPUUSED, -speed);
@@ -827,10 +896,11 @@ int main(int argc, char **argv) {
if (vpx_codec_control(&codec, VP8E_SET_ROI_MAP, &roi)) if (vpx_codec_control(&codec, VP8E_SET_ROI_MAP, &roi))
die_codec(&codec, "Failed to set ROI map"); die_codec(&codec, "Failed to set ROI map");
#endif #endif
} else if (strncmp(encoder->name, "vp9", 3) == 0) { } else if (strncmp(encoder->name, "vp9", 3) == 0) {
vpx_svc_extra_cfg_t svc_params; vpx_svc_extra_cfg_t svc_params;
memset(&svc_params, 0, sizeof(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, VP8E_SET_CPUUSED, speed);
vpx_codec_control(&codec, VP9E_SET_AQ_MODE, 3); vpx_codec_control(&codec, VP9E_SET_AQ_MODE, 3);
vpx_codec_control(&codec, VP9E_SET_GF_CBR_BOOST_PCT, 0); vpx_codec_control(&codec, VP9E_SET_GF_CBR_BOOST_PCT, 0);
@@ -840,15 +910,9 @@ int main(int argc, char **argv) {
vpx_codec_control(&codec, VP8E_SET_STATIC_THRESHOLD, 1); vpx_codec_control(&codec, VP8E_SET_STATIC_THRESHOLD, 1);
vpx_codec_control(&codec, VP9E_SET_TUNE_CONTENT, 0); 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_TILE_COLUMNS, get_msb(cfg.g_threads));
#if ROI_MAP vpx_codec_control(&codec, VP9E_SET_DISABLE_LOOPFILTER, 0);
set_roi_map(encoder->name, &cfg, &roi);
if (vpx_codec_control(&codec, VP9E_SET_ROI_MAP, &roi)) if (cfg.g_threads > 1)
die_codec(&codec, "Failed to set ROI map");
vpx_codec_control(&codec, VP9E_SET_AQ_MODE, 0);
#endif
// TODO(marpan/jianj): There is an issue with row-mt for low resolutons at
// high speed settings, disable its use for those cases for now.
if (cfg.g_threads > 1 && ((cfg.g_w > 320 && cfg.g_h > 240) || speed < 7))
vpx_codec_control(&codec, VP9E_SET_ROW_MT, 1); vpx_codec_control(&codec, VP9E_SET_ROW_MT, 1);
else else
vpx_codec_control(&codec, VP9E_SET_ROW_MT, 0); vpx_codec_control(&codec, VP9E_SET_ROW_MT, 0);
@@ -880,6 +944,9 @@ int main(int argc, char **argv) {
struct vpx_usec_timer timer; struct vpx_usec_timer timer;
vpx_codec_iter_t iter = NULL; vpx_codec_iter_t iter = NULL;
const vpx_codec_cx_pkt_t *pkt; const vpx_codec_cx_pkt_t *pkt;
#if ROI_MAP
char mask_file_name[255];
#endif
// Update the temporal layer_id. No spatial layers in this test. // Update the temporal layer_id. No spatial layers in this test.
layer_id.spatial_layer_id = 0; layer_id.spatial_layer_id = 0;
layer_id.temporal_layer_id = layer_id.temporal_layer_id =
@@ -893,6 +960,19 @@ int main(int argc, char **argv) {
} }
flags = layer_flags[frame_cnt % flag_periodicity]; flags = layer_flags[frame_cnt % flag_periodicity];
if (layering_mode == 0) flags = 0; if (layering_mode == 0) flags = 0;
#if ROI_MAP
snprintf(mask_file_name, sizeof(mask_file_name), "%s%05d.txt",
argv[argc - 1], frame_cnt);
mask_file = fopen(mask_file_name, "r");
if (mask_file != NULL) {
read_mask(mask_file, mask_map);
fclose(mask_file);
// set_roi_map(encoder->name, &cfg, &roi);
set_roi_skip_map(&cfg, &roi, mask_map, prev_mask_map, frame_cnt);
if (vpx_codec_control(&codec, VP9E_SET_ROI_MAP, &roi))
die_codec(&codec, "Failed to set ROI map");
}
#endif
frame_avail = read_frame(&input_ctx, &raw); frame_avail = read_frame(&input_ctx, &raw);
if (frame_avail) ++rc.layer_input_frames[layer_id.temporal_layer_id]; if (frame_avail) ++rc.layer_input_frames[layer_id.temporal_layer_id];
vpx_usec_timer_start(&timer); vpx_usec_timer_start(&timer);
@@ -930,6 +1010,7 @@ int main(int argc, char **argv) {
// Update for short-time encoding bitrate states, for moving window // Update for short-time encoding bitrate states, for moving window
// of size rc->window, shifted by rc->window / 2. // of size rc->window, shifted by rc->window / 2.
// Ignore first window segment, due to key frame. // Ignore first window segment, due to key frame.
if (rc.window_size == 0) rc.window_size = 15;
if (frame_cnt > rc.window_size) { if (frame_cnt > rc.window_size) {
sum_bitrate += 0.001 * 8.0 * pkt->data.frame.sz * framerate; sum_bitrate += 0.001 * 8.0 * pkt->data.frame.sz * framerate;
if (frame_cnt % rc.window_size == 0) { if (frame_cnt % rc.window_size == 0) {
@@ -961,6 +1042,10 @@ int main(int argc, char **argv) {
++frame_cnt; ++frame_cnt;
pts += frame_duration; pts += frame_duration;
} }
#if ROI_MAP
free(mask_map);
free(prev_mask_map);
#endif
close_input_file(&input_ctx); close_input_file(&input_ctx);
printout_rate_control_summary(&rc, &cfg, frame_cnt); printout_rate_control_summary(&rc, &cfg, frame_cnt);
printf("\n"); printf("\n");
+19 -11
View File
@@ -13,27 +13,35 @@
#include "vpx/vpx_encoder.h" #include "vpx/vpx_encoder.h"
#include "vpx_ports/mem_ops.h" #include "vpx_ports/mem_ops.h"
void ivf_write_file_header(FILE *outfile, const struct vpx_codec_enc_cfg *cfg, void ivf_write_file_header_with_video_info(FILE *outfile, unsigned int fourcc,
unsigned int fourcc, int frame_cnt) { int frame_cnt, int frame_width,
int frame_height,
vpx_rational_t timebase) {
char header[32]; char header[32];
header[0] = 'D'; header[0] = 'D';
header[1] = 'K'; header[1] = 'K';
header[2] = 'I'; header[2] = 'I';
header[3] = 'F'; header[3] = 'F';
mem_put_le16(header + 4, 0); // version mem_put_le16(header + 4, 0); // version
mem_put_le16(header + 6, 32); // header size mem_put_le16(header + 6, 32); // header size
mem_put_le32(header + 8, fourcc); // fourcc mem_put_le32(header + 8, fourcc); // fourcc
mem_put_le16(header + 12, cfg->g_w); // width mem_put_le16(header + 12, frame_width); // width
mem_put_le16(header + 14, cfg->g_h); // height mem_put_le16(header + 14, frame_height); // height
mem_put_le32(header + 16, cfg->g_timebase.den); // rate mem_put_le32(header + 16, timebase.den); // rate
mem_put_le32(header + 20, cfg->g_timebase.num); // scale mem_put_le32(header + 20, timebase.num); // scale
mem_put_le32(header + 24, frame_cnt); // length mem_put_le32(header + 24, frame_cnt); // length
mem_put_le32(header + 28, 0); // unused mem_put_le32(header + 28, 0); // unused
fwrite(header, 1, 32, outfile); 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) { void ivf_write_frame_header(FILE *outfile, int64_t pts, size_t frame_size) {
char header[12]; char header[12];
+7
View File
@@ -12,6 +12,8 @@
#include "./tools_common.h" #include "./tools_common.h"
#include "vpx/vpx_encoder.h"
struct vpx_codec_enc_cfg; struct vpx_codec_enc_cfg;
struct vpx_codec_cx_pkt; struct vpx_codec_cx_pkt;
@@ -19,6 +21,11 @@ struct vpx_codec_cx_pkt;
extern "C" { extern "C" {
#endif #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, void ivf_write_file_header(FILE *outfile, const struct vpx_codec_enc_cfg *cfg,
uint32_t fourcc, int frame_cnt); uint32_t fourcc, int frame_cnt);
+191 -17
View File
@@ -11,7 +11,7 @@
# ARM assembly files are written in RVCT-style. We use some make magic to # ARM assembly files are written in RVCT-style. We use some make magic to
# filter those files to allow GCC compilation # filter those files to allow GCC compilation
ifeq ($(ARCH_ARM),yes) ifeq ($(VPX_ARCH_ARM),yes)
ASM:=$(if $(filter yes,$(CONFIG_GCC)$(CONFIG_MSVS)),.asm.S,.asm) ASM:=$(if $(filter yes,$(CONFIG_GCC)$(CONFIG_MSVS)),.asm.S,.asm)
else else
ASM:=.asm ASM:=.asm
@@ -63,6 +63,7 @@ ifeq ($(CONFIG_VP8_ENCODER),yes)
CODEC_SRCS-yes += $(addprefix $(VP8_PREFIX),$(call enabled,VP8_CX_SRCS)) CODEC_SRCS-yes += $(addprefix $(VP8_PREFIX),$(call enabled,VP8_CX_SRCS))
CODEC_EXPORTS-yes += $(addprefix $(VP8_PREFIX),$(VP8_CX_EXPORTS)) 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/vp8.h include/vpx/vp8cx.h
INSTALL-LIBS-yes += include/vpx/vpx_ext_ratectrl.h
INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP8_PREFIX)/% INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP8_PREFIX)/%
CODEC_DOC_SECTIONS += vp8 vp8_encoder CODEC_DOC_SECTIONS += vp8 vp8_encoder
endif endif
@@ -87,12 +88,35 @@ ifeq ($(CONFIG_VP9_ENCODER),yes)
CODEC_SRCS-yes += $(addprefix $(VP9_PREFIX),$(call enabled,VP9_CX_SRCS)) CODEC_SRCS-yes += $(addprefix $(VP9_PREFIX),$(call enabled,VP9_CX_SRCS))
CODEC_EXPORTS-yes += $(addprefix $(VP9_PREFIX),$(VP9_CX_EXPORTS)) 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 += $(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/vp8.h include/vpx/vp8cx.h
INSTALL-LIBS-yes += include/vpx/vpx_ext_ratectrl.h
INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP9_PREFIX)/% 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 CODEC_DOC_SECTIONS += vp9 vp9_encoder
endif endif
RC_RTC_SRCS := vpx/vp8.h vpx/vp8cx.h
RC_RTC_SRCS += vpx/vpx_ext_ratectrl.h
RC_RTC_SRCS += vpx/internal/vpx_ratectrl_rtc.h
ifeq ($(CONFIG_VP9_ENCODER),yes)
VP9_PREFIX=vp9/
RC_RTC_SRCS += $(addprefix $(VP9_PREFIX),$(call enabled,VP9_CX_SRCS))
RC_RTC_SRCS += $(VP9_PREFIX)vp9cx.mk
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_VP8_ENCODER),yes)
VP8_PREFIX=vp8/
RC_RTC_SRCS += $(addprefix $(VP8_PREFIX),$(call enabled,VP8_CX_SRCS))
RC_RTC_SRCS += $(VP8_PREFIX)vp8_ratectrl_rtc.cc
RC_RTC_SRCS += $(VP8_PREFIX)vp8_ratectrl_rtc.h
INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(VP8_PREFIX)vp8_ratectrl_rtc.cc
INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(VP8_PREFIX)vp8_ratectrl_rtc.h
endif
ifeq ($(CONFIG_VP9_DECODER),yes) ifeq ($(CONFIG_VP9_DECODER),yes)
VP9_PREFIX=vp9/ VP9_PREFIX=vp9/
include $(SRC_PATH_BARE)/$(VP9_PREFIX)vp9dx.mk include $(SRC_PATH_BARE)/$(VP9_PREFIX)vp9dx.mk
@@ -115,6 +139,7 @@ endif
ifeq ($(CONFIG_MSVS),yes) ifeq ($(CONFIG_MSVS),yes)
CODEC_LIB=$(if $(CONFIG_STATIC_MSVCRT),vpxmt,vpxmd) CODEC_LIB=$(if $(CONFIG_STATIC_MSVCRT),vpxmt,vpxmd)
GTEST_LIB=$(if $(CONFIG_STATIC_MSVCRT),gtestmt,gtestmd) GTEST_LIB=$(if $(CONFIG_STATIC_MSVCRT),gtestmt,gtestmd)
RC_RTC_LIB=$(if $(CONFIG_STATIC_MSVCRT),vpxrcmt,vpxrcmd)
# This variable uses deferred expansion intentionally, since the results of # This variable uses deferred expansion intentionally, since the results of
# $(wildcard) may change during the course of the Make. # $(wildcard) may change during the course of the Make.
VS_PLATFORMS = $(foreach d,$(wildcard */Release/$(CODEC_LIB).lib),$(word 1,$(subst /, ,$(d)))) VS_PLATFORMS = $(foreach d,$(wildcard */Release/$(CODEC_LIB).lib),$(word 1,$(subst /, ,$(d))))
@@ -139,7 +164,7 @@ CODEC_SRCS-yes += vpx_ports/mem_ops_aligned.h
CODEC_SRCS-yes += vpx_ports/vpx_once.h CODEC_SRCS-yes += vpx_ports/vpx_once.h
CODEC_SRCS-yes += $(BUILD_PFX)vpx_config.c CODEC_SRCS-yes += $(BUILD_PFX)vpx_config.c
INSTALL-SRCS-no += $(BUILD_PFX)vpx_config.c INSTALL-SRCS-no += $(BUILD_PFX)vpx_config.c
ifeq ($(ARCH_X86)$(ARCH_X86_64),yes) ifeq ($(VPX_ARCH_X86)$(VPX_ARCH_X86_64),yes)
INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += third_party/x86inc/x86inc.asm INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += third_party/x86inc/x86inc.asm
INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += vpx_dsp/x86/bitdepth_conversion_sse2.asm INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += vpx_dsp/x86/bitdepth_conversion_sse2.asm
endif endif
@@ -165,7 +190,18 @@ INSTALL-LIBS-$(CONFIG_STATIC) += $(LIBSUBDIR)/libvpx.a
INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(LIBSUBDIR)/libvpx_g.a INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(LIBSUBDIR)/libvpx_g.a
endif 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) CODEC_SRCS=$(call enabled,CODEC_SRCS)
INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(CODEC_SRCS) INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(CODEC_SRCS)
INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(call enabled,CODEC_EXPORTS) INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(call enabled,CODEC_EXPORTS)
@@ -209,6 +245,7 @@ vpx.$(VCPROJ_SFX): $(CODEC_SRCS) vpx.def
--ver=$(CONFIG_VS_VERSION) \ --ver=$(CONFIG_VS_VERSION) \
--src-path-bare="$(SRC_PATH_BARE)" \ --src-path-bare="$(SRC_PATH_BARE)" \
--out=$@ $(CFLAGS) \ --out=$@ $(CFLAGS) \
--as=$(AS) \
$(filter $(SRC_PATH_BARE)/vp8/%.c, $(VCPROJ_SRCS)) \ $(filter $(SRC_PATH_BARE)/vp8/%.c, $(VCPROJ_SRCS)) \
$(filter $(SRC_PATH_BARE)/vp8/%.h, $(VCPROJ_SRCS)) \ $(filter $(SRC_PATH_BARE)/vp8/%.h, $(VCPROJ_SRCS)) \
$(filter $(SRC_PATH_BARE)/vp9/%.c, $(VCPROJ_SRCS)) \ $(filter $(SRC_PATH_BARE)/vp9/%.c, $(VCPROJ_SRCS)) \
@@ -225,14 +262,57 @@ PROJECTS-yes += vpx.$(VCPROJ_SFX)
vpx.$(VCPROJ_SFX): vpx_config.asm vpx.$(VCPROJ_SFX): vpx_config.asm
vpx.$(VCPROJ_SFX): $(RTCD) vpx.$(VCPROJ_SFX): $(RTCD)
endif vpxrc.$(VCPROJ_SFX): \
else VCPROJ_SRCS=$(filter-out $(addprefix %, $(ASM_INCLUDES)), $^)
vpxrc.$(VCPROJ_SFX): $(RC_RTC_SRCS)
@echo " [CREATE] $@"
$(qexec)$(GEN_VCPROJ) \
$(if $(CONFIG_SHARED),--dll,--lib) \
--target=$(TOOLCHAIN) \
$(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
--name=vpxrc \
--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 += vpxrc.$(VCPROJ_SFX)
vpxrc.$(VCPROJ_SFX): vpx_config.asm
vpxrc.$(VCPROJ_SFX): $(RTCD)
endif # ifeq ($(CONFIG_MSVS),yes)
else # ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
LIBVPX_OBJS=$(call objs, $(filter-out $(ASM_INCLUDES), $(CODEC_SRCS))) LIBVPX_OBJS=$(call objs, $(filter-out $(ASM_INCLUDES), $(CODEC_SRCS)))
OBJS-yes += $(LIBVPX_OBJS) OBJS-yes += $(LIBVPX_OBJS)
LIBS-$(if yes,$(CONFIG_STATIC)) += $(BUILD_PFX)libvpx.a $(BUILD_PFX)libvpx_g.a LIBS-$(if yes,$(CONFIG_STATIC)) += $(BUILD_PFX)libvpx.a $(BUILD_PFX)libvpx_g.a
$(BUILD_PFX)libvpx_g.a: $(LIBVPX_OBJS) $(BUILD_PFX)libvpx_g.a: $(LIBVPX_OBJS)
SO_VERSION_MAJOR := 6 # 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 := 1 SO_VERSION_MINOR := 1
SO_VERSION_PATCH := 0 SO_VERSION_PATCH := 0
ifeq ($(filter darwin%,$(TGT_OS)),$(TGT_OS)) ifeq ($(filter darwin%,$(TGT_OS)),$(TGT_OS))
@@ -330,8 +410,23 @@ endif
INSTALL-LIBS-yes += $(LIBSUBDIR)/pkgconfig/vpx.pc INSTALL-LIBS-yes += $(LIBSUBDIR)/pkgconfig/vpx.pc
INSTALL_MAPS += $(LIBSUBDIR)/pkgconfig/%.pc %.pc INSTALL_MAPS += $(LIBSUBDIR)/pkgconfig/%.pc %.pc
CLEAN-OBJS += vpx.pc CLEAN-OBJS += vpx.pc
ifeq ($(CONFIG_ENCODERS),yes)
RC_RTC_OBJS=$(call objs,$(RC_RTC_SRCS))
OBJS-yes += $(RC_RTC_OBJS)
LIBS-yes += $(BUILD_PFX)libvpxrc.a $(BUILD_PFX)libvpxrc_g.a
$(BUILD_PFX)libvpxrc_g.a: $(RC_RTC_OBJS)
endif 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) libvpx.ver: $(call enabled,CODEC_EXPORTS)
@echo " [CREATE] $@" @echo " [CREATE] $@"
$(qexec)echo "{ global:" > $@ $(qexec)echo "{ global:" > $@
@@ -347,17 +442,17 @@ CLEAN-OBJS += libvpx.syms
# #
# Rule to make assembler configuration file from C configuration file # Rule to make assembler configuration file from C configuration file
# #
ifeq ($(ARCH_X86)$(ARCH_X86_64),yes) ifeq ($(VPX_ARCH_X86)$(VPX_ARCH_X86_64),yes)
# YASM # YASM
$(BUILD_PFX)vpx_config.asm: $(BUILD_PFX)vpx_config.h $(BUILD_PFX)vpx_config.asm: $(BUILD_PFX)vpx_config.h
@echo " [CREATE] $@" @echo " [CREATE] $@"
@egrep "#define [A-Z0-9_]+ [01]" $< \ @LC_ALL=C egrep "#define [A-Z0-9_]+ [01]" $< \
| awk '{print $$2 " equ " $$3}' > $@ | awk '{print $$2 " equ " $$3}' > $@
else else
ADS2GAS=$(if $(filter yes,$(CONFIG_GCC)),| $(ASM_CONVERSION)) ADS2GAS=$(if $(filter yes,$(CONFIG_GCC)),| $(ASM_CONVERSION))
$(BUILD_PFX)vpx_config.asm: $(BUILD_PFX)vpx_config.h $(BUILD_PFX)vpx_config.asm: $(BUILD_PFX)vpx_config.h
@echo " [CREATE] $@" @echo " [CREATE] $@"
@egrep "#define [A-Z0-9_]+ [01]" $< \ @LC_ALL=C egrep "#define [A-Z0-9_]+ [01]" $< \
| awk '{print $$2 " EQU " $$3}' $(ADS2GAS) > $@ | awk '{print $$2 " EQU " $$3}' $(ADS2GAS) > $@
@echo " END" $(ADS2GAS) >> $@ @echo " END" $(ADS2GAS) >> $@
CLEAN-OBJS += $(BUILD_PFX)vpx_config.asm CLEAN-OBJS += $(BUILD_PFX)vpx_config.asm
@@ -387,31 +482,57 @@ ifeq ($(CONFIG_UNIT_TESTS),yes)
LIBVPX_TEST_DATA_PATH ?= . LIBVPX_TEST_DATA_PATH ?= .
include $(SRC_PATH_BARE)/test/test.mk 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_BIN=./test_libvpx$(EXE_SFX)
LIBVPX_TEST_DATA=$(addprefix $(LIBVPX_TEST_DATA_PATH)/,\ LIBVPX_TEST_DATA=$(addprefix $(LIBVPX_TEST_DATA_PATH)/,\
$(call enabled,LIBVPX_TEST_DATA)) $(call enabled,LIBVPX_TEST_DATA))
libvpx_test_data_url=https://storage.googleapis.com/downloads.webmproject.org/test_data/libvpx/$(1) 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_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))) TEST_INTRA_PRED_SPEED_OBJS := $(sort $(call objs,$(TEST_INTRA_PRED_SPEED_SRCS)))
ifeq ($(CONFIG_ENCODERS),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: libvpx_test_srcs.txt:
@echo " [CREATE] $@" @echo " [CREATE] $@"
@echo $(LIBVPX_TEST_SRCS) | xargs -n1 echo | LC_ALL=C sort -u > $@ @echo $(LIBVPX_TEST_SRCS) | xargs -n1 echo | LC_ALL=C sort -u > $@
CLEAN-OBJS += libvpx_test_srcs.txt 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 $(LIBVPX_TEST_DATA): $(SRC_PATH_BARE)/test/test-data.sha1
@echo " [DOWNLOAD] $@" @echo " [DOWNLOAD] $@"
# Attempt to download the file using curl, retrying once if it fails for a
# partial file (18).
$(qexec)( \ $(qexec)( \
trap 'rm -f $@' INT TERM; \ trap 'rm -f $@' INT TERM; \
curl="curl --retry 1 -L -o $@ $(call libvpx_test_data_url,$(@F))"; \ curl="curl -S -s --retry 1 -L -o $@ $(call libvpx_test_data_url,$(@F))"; \
$$curl; \ $$curl; ret=$$?; \
case "$$?" in \ case "$$ret" in \
18) $$curl -C -;; \ 18) $$curl -C - ;; \
*) exit $$ret ;; \
esac \ esac \
) )
@@ -443,6 +564,7 @@ gtest.$(VCPROJ_SFX): $(SRC_PATH_BARE)/third_party/googletest/src/src/gtest-all.c
--proj-guid=EC00E1EC-AF68-4D92-A255-181690D1C9B1 \ --proj-guid=EC00E1EC-AF68-4D92-A255-181690D1C9B1 \
--ver=$(CONFIG_VS_VERSION) \ --ver=$(CONFIG_VS_VERSION) \
--src-path-bare="$(SRC_PATH_BARE)" \ --src-path-bare="$(SRC_PATH_BARE)" \
--as=$(AS) \
-D_VARIADIC_MAX=10 \ -D_VARIADIC_MAX=10 \
--out=gtest.$(VCPROJ_SFX) $(SRC_PATH_BARE)/third_party/googletest/src/src/gtest-all.cc \ --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" -I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/include" -I"$(SRC_PATH_BARE)/third_party/googletest/src"
@@ -459,6 +581,7 @@ test_libvpx.$(VCPROJ_SFX): $(LIBVPX_TEST_SRCS) vpx.$(VCPROJ_SFX) gtest.$(VCPROJ_
--proj-guid=CD837F5F-52D8-4314-A370-895D614166A7 \ --proj-guid=CD837F5F-52D8-4314-A370-895D614166A7 \
--ver=$(CONFIG_VS_VERSION) \ --ver=$(CONFIG_VS_VERSION) \
--src-path-bare="$(SRC_PATH_BARE)" \ --src-path-bare="$(SRC_PATH_BARE)" \
--as=$(AS) \
$(if $(CONFIG_STATIC_MSVCRT),--static-crt) \ $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
--out=$@ $(INTERNAL_CFLAGS) $(CFLAGS) \ --out=$@ $(INTERNAL_CFLAGS) $(CFLAGS) \
-I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/include" \ -I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/include" \
@@ -481,11 +604,34 @@ test_intra_pred_speed.$(VCPROJ_SFX): $(TEST_INTRA_PRED_SPEED_SRCS) vpx.$(VCPROJ_
--proj-guid=CD837F5F-52D8-4314-A370-895D614166A7 \ --proj-guid=CD837F5F-52D8-4314-A370-895D614166A7 \
--ver=$(CONFIG_VS_VERSION) \ --ver=$(CONFIG_VS_VERSION) \
--src-path-bare="$(SRC_PATH_BARE)" \ --src-path-bare="$(SRC_PATH_BARE)" \
--as=$(AS) \
$(if $(CONFIG_STATIC_MSVCRT),--static-crt) \ $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
--out=$@ $(INTERNAL_CFLAGS) $(CFLAGS) \ --out=$@ $(INTERNAL_CFLAGS) $(CFLAGS) \
-I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/include" \ -I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/include" \
-L. -l$(CODEC_LIB) -l$(GTEST_LIB) $^ -L. -l$(CODEC_LIB) -l$(GTEST_LIB) $^
endif # TEST_INTRA_PRED_SPEED endif # TEST_INTRA_PRED_SPEED
ifeq ($(CONFIG_ENCODERS),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) \
vpxrc.$(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 endif
else else
@@ -527,6 +673,32 @@ $(eval $(call linkerxx_template,$(TEST_INTRA_PRED_SPEED_BIN), \
-L. -lvpx -lgtest $(extralibs) -lm)) -L. -lvpx -lgtest $(extralibs) -lm))
endif # TEST_INTRA_PRED_SPEED endif # TEST_INTRA_PRED_SPEED
ifeq ($(CONFIG_ENCODERS),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) libvpxrc.a
$(eval $(call linkerxx_template,$(RC_INTERFACE_TEST_BIN), \
$(RC_INTERFACE_TEST_OBJS) \
-L. -lvpx -lgtest -lvpxrc $(extralibs) -lm))
endif # RC_INTERFACE_TEST
endif # CONFIG_ENCODERS
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 endif # CONFIG_UNIT_TESTS
# Install test sources only if codec source is included # Install test sources only if codec source is included
@@ -534,6 +706,7 @@ INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(patsubst $(SRC_PATH_BARE)/%,%,\
$(shell find $(SRC_PATH_BARE)/third_party/googletest -type f)) $(shell find $(SRC_PATH_BARE)/third_party/googletest -type f))
INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(LIBVPX_TEST_SRCS) INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(LIBVPX_TEST_SRCS)
INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(TEST_INTRA_PRED_SPEED_SRCS) INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(TEST_INTRA_PRED_SPEED_SRCS)
INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(RC_INTERFACE_TEST_SRCS)
define test_shard_template define test_shard_template
test:: test_shard.$(1) test:: test_shard.$(1)
@@ -574,6 +747,7 @@ endif
## Update the global src list ## Update the global src list
SRCS += $(CODEC_SRCS) $(LIBVPX_TEST_SRCS) $(GTEST_SRCS) SRCS += $(CODEC_SRCS) $(LIBVPX_TEST_SRCS) $(GTEST_SRCS)
SRCS += $(RC_INTERFACE_TEST_SRCS)
## ##
## vpxdec/vpxenc tests. ## vpxdec/vpxenc tests.
+1 -13
View File
@@ -23,6 +23,7 @@
#include <string.h> /* for memcpy() */ #include <string.h> /* for memcpy() */
#include "md5_utils.h" #include "md5_utils.h"
#include "vpx_ports/compiler_attributes.h"
static void byteSwap(UWORD32 *buf, unsigned words) { static void byteSwap(UWORD32 *buf, unsigned words) {
md5byte *p; md5byte *p;
@@ -145,17 +146,6 @@ void MD5Final(md5byte digest[16], struct MD5Context *ctx) {
#define MD5STEP(f, w, x, y, z, in, s) \ #define MD5STEP(f, w, x, y, z, in, s) \
(w += f(x, y, z) + in, w = (w << s | w >> (32 - s)) + x) (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 * The core of the MD5 algorithm, this alters an existing MD5 hash to
* reflect the addition of 16 longwords of new data. MD5Update blocks * 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; buf[3] += d;
} }
#undef VPX_NO_UNSIGNED_OVERFLOW_CHECK
#endif #endif
+20 -17
View File
@@ -193,40 +193,42 @@ static int merge_hist_buckets(struct hist_bucket *bucket, int max_buckets,
static void show_histogram(const struct hist_bucket *bucket, int buckets, static void show_histogram(const struct hist_bucket *bucket, int buckets,
int total, int scale) { int total, int scale) {
const char *pat1, *pat2; int width1, width2;
int i; int i;
if (!buckets) return;
assert(bucket != NULL); assert(bucket != NULL);
assert(buckets > 0);
switch ((int)(log(bucket[buckets - 1].high) / log(10)) + 1) { switch ((int)(log(bucket[buckets - 1].high) / log(10)) + 1) {
case 1: case 1:
case 2: case 2:
pat1 = "%4d %2s: "; width1 = 4;
pat2 = "%4d-%2d: "; width2 = 2;
break; break;
case 3: case 3:
pat1 = "%5d %3s: "; width1 = 5;
pat2 = "%5d-%3d: "; width2 = 3;
break; break;
case 4: case 4:
pat1 = "%6d %4s: "; width1 = 6;
pat2 = "%6d-%4d: "; width2 = 4;
break; break;
case 5: case 5:
pat1 = "%7d %5s: "; width1 = 7;
pat2 = "%7d-%5d: "; width2 = 5;
break; break;
case 6: case 6:
pat1 = "%8d %6s: "; width1 = 8;
pat2 = "%8d-%6d: "; width2 = 6;
break; break;
case 7: case 7:
pat1 = "%9d %7s: "; width1 = 9;
pat2 = "%9d-%7d: "; width2 = 7;
break; break;
default: default:
pat1 = "%12d %10s: "; width1 = 12;
pat2 = "%12d-%10d: "; width2 = 10;
break; break;
} }
@@ -241,9 +243,10 @@ static void show_histogram(const struct hist_bucket *bucket, int buckets,
assert(len <= HIST_BAR_MAX); assert(len <= HIST_BAR_MAX);
if (bucket[i].low == bucket[i].high) if (bucket[i].low == bucket[i].high)
fprintf(stderr, pat1, bucket[i].low, ""); fprintf(stderr, "%*d %*s: ", width1, bucket[i].low, width2, "");
else else
fprintf(stderr, pat2, bucket[i].low, bucket[i].high); fprintf(stderr, "%*d-%*d: ", width1, bucket[i].low, width2,
bucket[i].high);
for (j = 0; j < HIST_BAR_MAX; j++) fprintf(stderr, j < len ? "=" : " "); for (j = 0; j < HIST_BAR_MAX; j++) fprintf(stderr, j < len ? "=" : " ");
fprintf(stderr, "\t%5d (%6.2f%%)\n", bucket[i].count, pct); fprintf(stderr, "\t%5d (%6.2f%%)\n", bucket[i].count, pct);
+2 -3
View File
@@ -42,8 +42,7 @@ class ACMRandom {
int16_t Rand16Signed(void) { int16_t Rand16Signed(void) {
// Use 16 bits: values between 32767 and -32768. // Use 16 bits: values between 32767 and -32768.
const uint32_t value = random_.Generate(65536); return static_cast<int16_t>(random_.Generate(65536));
return static_cast<int16_t>(value) - 32768;
} }
int16_t Rand13Signed(void) { int16_t Rand13Signed(void) {
@@ -69,7 +68,7 @@ class ACMRandom {
// Returns a random value near 0 or near 255, to better exercise // Returns a random value near 0 or near 255, to better exercise
// saturation behavior. // saturation behavior.
const uint8_t r = Rand8(); const uint8_t r = Rand8();
return r < 128 ? r << 4 : r >> 4; return static_cast<uint8_t>((r < 128) ? r << 4 : r >> 4);
} }
uint32_t RandRange(const uint32_t range) { uint32_t RandRange(const uint32_t range) {
+4 -4
View File
@@ -80,7 +80,7 @@ class ActiveMapRefreshTest
} else if (video->frame() >= 2 && video->img()) { } else if (video->frame() >= 2 && video->img()) {
vpx_image_t *current = video->img(); vpx_image_t *current = video->img();
vpx_image_t *previous = y4m_holder_->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(); vpx_active_map_t map = vpx_active_map_t();
const int width = static_cast<int>(current->d_w); const int width = static_cast<int>(current->d_w);
const int height = static_cast<int>(current->d_h); const int height = static_cast<int>(current->d_h);
@@ -122,7 +122,7 @@ TEST_P(ActiveMapRefreshTest, Test) {
ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
} }
VP9_INSTANTIATE_TEST_CASE(ActiveMapRefreshTest, VP9_INSTANTIATE_TEST_SUITE(ActiveMapRefreshTest,
::testing::Values(::libvpx_test::kRealTime), ::testing::Values(::libvpx_test::kRealTime),
::testing::Range(5, 6)); ::testing::Range(5, 6));
} // namespace } // namespace
+7 -5
View File
@@ -19,7 +19,8 @@ namespace {
class ActiveMapTest class ActiveMapTest
: public ::libvpx_test::EncoderTest, : public ::libvpx_test::EncoderTest,
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> { public ::libvpx_test::CodecTestWith3Params<libvpx_test::TestMode, int,
int> {
protected: protected:
static const int kWidth = 208; static const int kWidth = 208;
static const int kHeight = 144; static const int kHeight = 144;
@@ -37,6 +38,7 @@ class ActiveMapTest
::libvpx_test::Encoder *encoder) { ::libvpx_test::Encoder *encoder) {
if (video->frame() == 0) { if (video->frame() == 0) {
encoder->Control(VP8E_SET_CPUUSED, cpu_used_); encoder->Control(VP8E_SET_CPUUSED, cpu_used_);
encoder->Control(VP9E_SET_AQ_MODE, GET_PARAM(3));
} else if (video->frame() == 3) { } else if (video->frame() == 3) {
vpx_active_map_t map = vpx_active_map_t(); vpx_active_map_t map = vpx_active_map_t();
/* clang-format off */ /* clang-format off */
@@ -62,7 +64,7 @@ class ActiveMapTest
vpx_active_map_t map = vpx_active_map_t(); vpx_active_map_t map = vpx_active_map_t();
map.cols = (kWidth + 15) / 16; map.cols = (kWidth + 15) / 16;
map.rows = (kHeight + 15) / 16; map.rows = (kHeight + 15) / 16;
map.active_map = NULL; map.active_map = nullptr;
encoder->Control(VP8E_SET_ACTIVEMAP, &map); encoder->Control(VP8E_SET_ACTIVEMAP, &map);
} }
} }
@@ -85,7 +87,7 @@ TEST_P(ActiveMapTest, Test) {
ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
} }
VP9_INSTANTIATE_TEST_CASE(ActiveMapTest, VP9_INSTANTIATE_TEST_SUITE(ActiveMapTest,
::testing::Values(::libvpx_test::kRealTime), ::testing::Values(::libvpx_test::kRealTime),
::testing::Range(0, 9)); ::testing::Range(5, 10), ::testing::Values(0, 3));
} // namespace } // namespace
+6 -7
View File
@@ -23,7 +23,6 @@ namespace {
static const int kNoiseSize = 3072; static const int kNoiseSize = 3072;
// TODO(jimbankoski): make width and height integers not unsigned.
typedef void (*AddNoiseFunc)(uint8_t *start, const int8_t *noise, typedef void (*AddNoiseFunc)(uint8_t *start, const int8_t *noise,
int blackclamp, int whiteclamp, int width, int blackclamp, int whiteclamp, int width,
int height, int pitch); int height, int pitch);
@@ -53,7 +52,7 @@ TEST_P(AddNoiseTest, CheckNoiseAdded) {
const int clamp = vpx_setup_noise(GET_PARAM(0), noise, kNoiseSize); const int clamp = vpx_setup_noise(GET_PARAM(0), noise, kNoiseSize);
uint8_t *const s = uint8_t *const s =
reinterpret_cast<uint8_t *>(vpx_calloc(image_size, sizeof(*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)); memset(s, 99, image_size * sizeof(*s));
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(
@@ -106,8 +105,8 @@ TEST_P(AddNoiseTest, CheckCvsAssembly) {
uint8_t *const s = reinterpret_cast<uint8_t *>(vpx_calloc(image_size, 1)); 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)); uint8_t *const d = reinterpret_cast<uint8_t *>(vpx_calloc(image_size, 1));
ASSERT_TRUE(s != NULL); ASSERT_NE(s, nullptr);
ASSERT_TRUE(d != NULL); ASSERT_NE(d, nullptr);
memset(s, 99, image_size); memset(s, 99, image_size);
memset(d, 99, image_size); memset(d, 99, image_size);
@@ -129,20 +128,20 @@ TEST_P(AddNoiseTest, CheckCvsAssembly) {
using std::make_tuple; using std::make_tuple;
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
C, AddNoiseTest, C, AddNoiseTest,
::testing::Values(make_tuple(3.25, vpx_plane_add_noise_c), ::testing::Values(make_tuple(3.25, vpx_plane_add_noise_c),
make_tuple(4.4, vpx_plane_add_noise_c))); make_tuple(4.4, vpx_plane_add_noise_c)));
#if HAVE_SSE2 #if HAVE_SSE2
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
SSE2, AddNoiseTest, SSE2, AddNoiseTest,
::testing::Values(make_tuple(3.25, vpx_plane_add_noise_sse2), ::testing::Values(make_tuple(3.25, vpx_plane_add_noise_sse2),
make_tuple(4.4, vpx_plane_add_noise_sse2))); make_tuple(4.4, vpx_plane_add_noise_sse2)));
#endif #endif
#if HAVE_MSA #if HAVE_MSA
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
MSA, AddNoiseTest, MSA, AddNoiseTest,
::testing::Values(make_tuple(3.25, vpx_plane_add_noise_msa), ::testing::Values(make_tuple(3.25, vpx_plane_add_noise_msa),
make_tuple(4.4, vpx_plane_add_noise_msa))); make_tuple(4.4, vpx_plane_add_noise_msa)));
+4 -4
View File
@@ -150,8 +150,8 @@ TEST_P(AltRefAqSegmentTest, TestNoMisMatchAltRefAQ4) {
ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
} }
VP9_INSTANTIATE_TEST_CASE(AltRefAqSegmentTest, VP9_INSTANTIATE_TEST_SUITE(AltRefAqSegmentTest,
::testing::Values(::libvpx_test::kOnePassGood, ::testing::Values(::libvpx_test::kOnePassGood,
::libvpx_test::kTwoPassGood), ::libvpx_test::kTwoPassGood),
::testing::Range(2, 5)); ::testing::Range(2, 5));
} // namespace } // namespace
+8 -8
View File
@@ -63,8 +63,8 @@ TEST_P(AltRefTest, MonotonicTimestamps) {
EXPECT_GE(altref_count(), 1); EXPECT_GE(altref_count(), 1);
} }
VP8_INSTANTIATE_TEST_CASE(AltRefTest, VP8_INSTANTIATE_TEST_SUITE(AltRefTest,
::testing::Range(kLookAheadMin, kLookAheadMax)); ::testing::Range(kLookAheadMin, kLookAheadMax));
#endif // CONFIG_VP8_ENCODER #endif // CONFIG_VP8_ENCODER
@@ -142,11 +142,11 @@ TEST_P(AltRefForcedKeyTestLarge, ForcedFrameIsKey) {
} }
} }
VP8_INSTANTIATE_TEST_CASE(AltRefForcedKeyTestLarge, VP8_INSTANTIATE_TEST_SUITE(AltRefForcedKeyTestLarge,
::testing::Values(::libvpx_test::kOnePassGood), ::testing::Values(::libvpx_test::kOnePassGood),
::testing::Range(0, 9)); ::testing::Range(0, 9));
VP9_INSTANTIATE_TEST_CASE(AltRefForcedKeyTestLarge, VP9_INSTANTIATE_TEST_SUITE(AltRefForcedKeyTestLarge,
::testing::Values(::libvpx_test::kOnePassGood), ::testing::Values(::libvpx_test::kOnePassGood),
::testing::Range(0, 9)); ::testing::Range(0, 9));
} // namespace } // namespace
+6
View File
@@ -34,6 +34,9 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/third_party/googletest/src/
LOCAL_C_INCLUDES += $(LOCAL_PATH)/third_party/googletest/src/include/ LOCAL_C_INCLUDES += $(LOCAL_PATH)/third_party/googletest/src/include/
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/third_party/googletest/src/include/ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/third_party/googletest/src/include/
LOCAL_SRC_FILES := ./third_party/googletest/src/src/gtest-all.cc LOCAL_SRC_FILES := ./third_party/googletest/src/src/gtest-all.cc
LOCAL_LICENSE_KINDS := SPDX-license-identifier-BSD
LOCAL_LICENSE_CONDITIONS := notice
LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../LICENSE $(LOCAL_PATH)/../../PATENTS
include $(BUILD_STATIC_LIBRARY) include $(BUILD_STATIC_LIBRARY)
#libvpx_test #libvpx_test
@@ -48,6 +51,9 @@ else
LOCAL_STATIC_LIBRARIES += vpx LOCAL_STATIC_LIBRARIES += vpx
endif endif
LOCAL_LICENSE_KINDS := SPDX-license-identifier-BSD
LOCAL_LICENSE_CONDITIONS := notice
LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../LICENSE $(LOCAL_PATH)/../../PATENTS
include $(LOCAL_PATH)/test/test.mk include $(LOCAL_PATH)/test/test.mk
LOCAL_C_INCLUDES := $(BINDINGS_DIR) LOCAL_C_INCLUDES := $(BINDINGS_DIR)
FILTERED_SRC := $(sort $(filter %.cc %.c, $(LIBVPX_TEST_SRCS-yes))) FILTERED_SRC := $(sort $(filter %.cc %.c, $(LIBVPX_TEST_SRCS-yes)))
+4 -3
View File
@@ -10,12 +10,13 @@ NDK_PROJECT_PATH=. ndk-build APP_BUILD_SCRIPT=./libvpx/test/android/Android.mk \
APP_ABI=armeabi-v7a APP_PLATFORM=android-18 APP_OPTIM=release \ APP_ABI=armeabi-v7a APP_PLATFORM=android-18 APP_OPTIM=release \
APP_STL=c++_static APP_STL=c++_static
Note: Both adb and ndk-build are available prebuilt at: Note: Both adb and ndk-build are available at:
https://chromium.googlesource.com/android_tools https://developer.android.com/studio#downloads
https://developer.android.com/ndk/downloads
3) Run get_files.py to download the test files: 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 \ 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 4) Transfer files to device using adb. Ensure you have proper permissions for
the target the target
+4 -4
View File
@@ -102,8 +102,8 @@ TEST_P(AqSegmentTest, TestNoMisMatchAQ3) {
ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
} }
VP9_INSTANTIATE_TEST_CASE(AqSegmentTest, VP9_INSTANTIATE_TEST_SUITE(AqSegmentTest,
::testing::Values(::libvpx_test::kRealTime, ::testing::Values(::libvpx_test::kRealTime,
::libvpx_test::kOnePassGood), ::libvpx_test::kOnePassGood),
::testing::Range(3, 9)); ::testing::Range(3, 9));
} // namespace } // namespace
+70 -63
View File
@@ -35,12 +35,12 @@ template <typename Pixel>
class AverageTestBase : public ::testing::Test { class AverageTestBase : public ::testing::Test {
public: public:
AverageTestBase(int width, int height) AverageTestBase(int width, int height)
: width_(width), height_(height), source_data_(NULL), source_stride_(0), : width_(width), height_(height), source_data_(nullptr),
bit_depth_(8) {} source_stride_(0), bit_depth_(8) {}
virtual void TearDown() { virtual void TearDown() {
vpx_free(source_data_); vpx_free(source_data_);
source_data_ = NULL; source_data_ = nullptr;
libvpx_test::ClearSystemState(); libvpx_test::ClearSystemState();
} }
@@ -52,7 +52,7 @@ class AverageTestBase : public ::testing::Test {
virtual void SetUp() { virtual void SetUp() {
source_data_ = reinterpret_cast<Pixel *>( source_data_ = reinterpret_cast<Pixel *>(
vpx_memalign(kDataAlignment, kDataBlockSize * sizeof(source_data_[0]))); vpx_memalign(kDataAlignment, kDataBlockSize * sizeof(source_data_[0])));
ASSERT_TRUE(source_data_ != NULL); ASSERT_NE(source_data_, nullptr);
source_stride_ = (width_ + 31) & ~31; source_stride_ = (width_ + 31) & ~31;
bit_depth_ = 8; bit_depth_ = 8;
rnd_.Reset(ACMRandom::DeterministicSeed()); rnd_.Reset(ACMRandom::DeterministicSeed());
@@ -152,6 +152,7 @@ class AverageTestHBD : public AverageTestBase<uint16_t>,
}; };
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
#if HAVE_NEON || HAVE_SSE2 || HAVE_MSA
typedef void (*IntProRowFunc)(int16_t hbuf[16], uint8_t const *ref, typedef void (*IntProRowFunc)(int16_t hbuf[16], uint8_t const *ref,
const int ref_stride, const int height); const int ref_stride, const int height);
@@ -161,7 +162,8 @@ class IntProRowTest : public AverageTestBase<uint8_t>,
public ::testing::WithParamInterface<IntProRowParam> { public ::testing::WithParamInterface<IntProRowParam> {
public: public:
IntProRowTest() 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); asm_func_ = GET_PARAM(1);
c_func_ = GET_PARAM(2); c_func_ = GET_PARAM(2);
} }
@@ -170,7 +172,7 @@ class IntProRowTest : public AverageTestBase<uint8_t>,
virtual void SetUp() { virtual void SetUp() {
source_data_ = reinterpret_cast<uint8_t *>( source_data_ = reinterpret_cast<uint8_t *>(
vpx_memalign(kDataAlignment, kDataBlockSize * sizeof(source_data_[0]))); vpx_memalign(kDataAlignment, kDataBlockSize * sizeof(source_data_[0])));
ASSERT_TRUE(source_data_ != NULL); ASSERT_NE(source_data_, nullptr);
hbuf_asm_ = reinterpret_cast<int16_t *>( hbuf_asm_ = reinterpret_cast<int16_t *>(
vpx_memalign(kDataAlignment, sizeof(*hbuf_asm_) * 16)); vpx_memalign(kDataAlignment, sizeof(*hbuf_asm_) * 16));
@@ -180,11 +182,11 @@ class IntProRowTest : public AverageTestBase<uint8_t>,
virtual void TearDown() { virtual void TearDown() {
vpx_free(source_data_); vpx_free(source_data_);
source_data_ = NULL; source_data_ = nullptr;
vpx_free(hbuf_c_); vpx_free(hbuf_c_);
hbuf_c_ = NULL; hbuf_c_ = nullptr;
vpx_free(hbuf_asm_); vpx_free(hbuf_asm_);
hbuf_asm_ = NULL; hbuf_asm_ = nullptr;
} }
void RunComparison() { void RunComparison() {
@@ -200,6 +202,7 @@ class IntProRowTest : public AverageTestBase<uint8_t>,
int16_t *hbuf_asm_; int16_t *hbuf_asm_;
int16_t *hbuf_c_; int16_t *hbuf_c_;
}; };
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(IntProRowTest);
typedef int16_t (*IntProColFunc)(uint8_t const *ref, const int width); 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_asm_;
int16_t sum_c_; 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 int (*SatdFunc)(const tran_low_t *coeffs, int length);
typedef std::tuple<int, SatdFunc> SatdTestParam; typedef std::tuple<int, SatdFunc> SatdTestParam;
@@ -239,7 +244,7 @@ class SatdTest : public ::testing::Test,
rnd_.Reset(ACMRandom::DeterministicSeed()); rnd_.Reset(ACMRandom::DeterministicSeed());
src_ = reinterpret_cast<tran_low_t *>( src_ = reinterpret_cast<tran_low_t *>(
vpx_memalign(16, sizeof(*src_) * satd_size_)); vpx_memalign(16, sizeof(*src_) * satd_size_));
ASSERT_TRUE(src_ != NULL); ASSERT_NE(src_, nullptr);
} }
virtual void TearDown() { virtual void TearDown() {
@@ -295,8 +300,8 @@ class BlockErrorTestFP
vpx_memalign(16, sizeof(*coeff_) * txfm_size_)); vpx_memalign(16, sizeof(*coeff_) * txfm_size_));
dqcoeff_ = reinterpret_cast<tran_low_t *>( dqcoeff_ = reinterpret_cast<tran_low_t *>(
vpx_memalign(16, sizeof(*dqcoeff_) * txfm_size_)); vpx_memalign(16, sizeof(*dqcoeff_) * txfm_size_));
ASSERT_TRUE(coeff_ != NULL); ASSERT_NE(coeff_, nullptr);
ASSERT_TRUE(dqcoeff_ != NULL); ASSERT_NE(dqcoeff_, nullptr);
} }
virtual void TearDown() { virtual void TearDown() {
@@ -378,6 +383,7 @@ TEST_P(AverageTestHBD, Random) {
} }
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
#if HAVE_NEON || HAVE_SSE2 || HAVE_MSA
TEST_P(IntProRowTest, MinValue) { TEST_P(IntProRowTest, MinValue) {
FillConstant(0); FillConstant(0);
RunComparison(); RunComparison();
@@ -407,6 +413,7 @@ TEST_P(IntProColTest, Random) {
FillRandom(); FillRandom();
RunComparison(); RunComparison();
} }
#endif
TEST_P(SatdLowbdTest, MinValue) { TEST_P(SatdLowbdTest, MinValue) {
const int kMin = -32640; const int kMin = -32640;
@@ -425,10 +432,10 @@ TEST_P(SatdLowbdTest, MaxValue) {
TEST_P(SatdLowbdTest, Random) { TEST_P(SatdLowbdTest, Random) {
int expected; int expected;
switch (satd_size_) { switch (satd_size_) {
case 16: expected = 263252; break; case 16: expected = 261036; break;
case 64: expected = 1105420; break; case 64: expected = 991732; break;
case 256: expected = 4252250; break; case 256: expected = 4136358; break;
case 1024: expected = 16876840; break; case 1024: expected = 16677592; break;
default: default:
FAIL() << "Invalid satd size (" << satd_size_ FAIL() << "Invalid satd size (" << satd_size_
<< ") valid: 16/64/256/1024"; << ") valid: 16/64/256/1024";
@@ -557,38 +564,38 @@ TEST_P(BlockErrorTestFP, DISABLED_Speed) {
using std::make_tuple; using std::make_tuple;
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
C, AverageTest, C, AverageTest,
::testing::Values(make_tuple(16, 16, 1, 8, &vpx_avg_8x8_c), ::testing::Values(make_tuple(16, 16, 1, 8, &vpx_avg_8x8_c),
make_tuple(16, 16, 1, 4, &vpx_avg_4x4_c))); make_tuple(16, 16, 1, 4, &vpx_avg_4x4_c)));
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
C, AverageTestHBD, C, AverageTestHBD,
::testing::Values(make_tuple(16, 16, 1, 8, &vpx_highbd_avg_8x8_c), ::testing::Values(make_tuple(16, 16, 1, 8, &vpx_highbd_avg_8x8_c),
make_tuple(16, 16, 1, 4, &vpx_highbd_avg_4x4_c))); make_tuple(16, 16, 1, 4, &vpx_highbd_avg_4x4_c)));
#if HAVE_SSE2 #if HAVE_SSE2
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
SSE2, AverageTestHBD, SSE2, AverageTestHBD,
::testing::Values(make_tuple(16, 16, 1, 8, &vpx_highbd_avg_8x8_sse2), ::testing::Values(make_tuple(16, 16, 1, 8, &vpx_highbd_avg_8x8_sse2),
make_tuple(16, 16, 1, 4, &vpx_highbd_avg_4x4_sse2))); make_tuple(16, 16, 1, 4, &vpx_highbd_avg_4x4_sse2)));
#endif // HAVE_SSE2 #endif // HAVE_SSE2
INSTANTIATE_TEST_CASE_P(C, SatdHighbdTest, INSTANTIATE_TEST_SUITE_P(C, SatdHighbdTest,
::testing::Values(make_tuple(16, &vpx_satd_c), ::testing::Values(make_tuple(16, &vpx_satd_c),
make_tuple(64, &vpx_satd_c), make_tuple(64, &vpx_satd_c),
make_tuple(256, &vpx_satd_c), make_tuple(256, &vpx_satd_c),
make_tuple(1024, &vpx_satd_c))); make_tuple(1024, &vpx_satd_c)));
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P(C, SatdLowbdTest, INSTANTIATE_TEST_SUITE_P(C, SatdLowbdTest,
::testing::Values(make_tuple(16, &vpx_satd_c), ::testing::Values(make_tuple(16, &vpx_satd_c),
make_tuple(64, &vpx_satd_c), make_tuple(64, &vpx_satd_c),
make_tuple(256, &vpx_satd_c), make_tuple(256, &vpx_satd_c),
make_tuple(1024, &vpx_satd_c))); make_tuple(1024, &vpx_satd_c)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
C, BlockErrorTestFP, C, BlockErrorTestFP,
::testing::Values(make_tuple(16, &vp9_block_error_fp_c), ::testing::Values(make_tuple(16, &vp9_block_error_fp_c),
make_tuple(64, &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))); make_tuple(1024, &vp9_block_error_fp_c)));
#if HAVE_SSE2 #if HAVE_SSE2
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
SSE2, AverageTest, SSE2, AverageTest,
::testing::Values(make_tuple(16, 16, 0, 8, &vpx_avg_8x8_sse2), ::testing::Values(make_tuple(16, 16, 0, 8, &vpx_avg_8x8_sse2),
make_tuple(16, 16, 5, 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(16, 16, 5, 4, &vpx_avg_4x4_sse2),
make_tuple(32, 32, 15, 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, SSE2, IntProRowTest,
::testing::Values(make_tuple(16, &vpx_int_pro_row_sse2, &vpx_int_pro_row_c), ::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(32, &vpx_int_pro_row_sse2, &vpx_int_pro_row_c),
make_tuple(64, &vpx_int_pro_row_sse2, make_tuple(64, &vpx_int_pro_row_sse2,
&vpx_int_pro_row_c))); &vpx_int_pro_row_c)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
SSE2, IntProColTest, SSE2, IntProColTest,
::testing::Values(make_tuple(16, &vpx_int_pro_col_sse2, &vpx_int_pro_col_c), ::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(32, &vpx_int_pro_col_sse2, &vpx_int_pro_col_c),
make_tuple(64, &vpx_int_pro_col_sse2, make_tuple(64, &vpx_int_pro_col_sse2,
&vpx_int_pro_col_c))); &vpx_int_pro_col_c)));
INSTANTIATE_TEST_CASE_P(SSE2, SatdLowbdTest, INSTANTIATE_TEST_SUITE_P(SSE2, SatdLowbdTest,
::testing::Values(make_tuple(16, &vpx_satd_sse2), ::testing::Values(make_tuple(16, &vpx_satd_sse2),
make_tuple(64, &vpx_satd_sse2), make_tuple(64, &vpx_satd_sse2),
make_tuple(256, &vpx_satd_sse2), make_tuple(256, &vpx_satd_sse2),
make_tuple(1024, &vpx_satd_sse2))); make_tuple(1024, &vpx_satd_sse2)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
SSE2, BlockErrorTestFP, SSE2, BlockErrorTestFP,
::testing::Values(make_tuple(16, &vp9_block_error_fp_sse2), ::testing::Values(make_tuple(16, &vp9_block_error_fp_sse2),
make_tuple(64, &vp9_block_error_fp_sse2), make_tuple(64, &vp9_block_error_fp_sse2),
@@ -634,14 +641,14 @@ INSTANTIATE_TEST_CASE_P(
#endif // HAVE_SSE2 #endif // HAVE_SSE2
#if HAVE_AVX2 #if HAVE_AVX2
INSTANTIATE_TEST_CASE_P(AVX2, SatdLowbdTest, INSTANTIATE_TEST_SUITE_P(AVX2, SatdLowbdTest,
::testing::Values(make_tuple(16, &vpx_satd_avx2), ::testing::Values(make_tuple(16, &vpx_satd_avx2),
make_tuple(64, &vpx_satd_avx2), make_tuple(64, &vpx_satd_avx2),
make_tuple(256, &vpx_satd_avx2), make_tuple(256, &vpx_satd_avx2),
make_tuple(1024, &vpx_satd_avx2))); make_tuple(1024, &vpx_satd_avx2)));
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
AVX2, SatdHighbdTest, AVX2, SatdHighbdTest,
::testing::Values(make_tuple(16, &vpx_highbd_satd_avx2), ::testing::Values(make_tuple(16, &vpx_highbd_satd_avx2),
make_tuple(64, &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))); make_tuple(1024, &vpx_highbd_satd_avx2)));
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
AVX2, BlockErrorTestFP, AVX2, BlockErrorTestFP,
::testing::Values(make_tuple(16, &vp9_block_error_fp_avx2), ::testing::Values(make_tuple(16, &vp9_block_error_fp_avx2),
make_tuple(64, &vp9_block_error_fp_avx2), make_tuple(64, &vp9_block_error_fp_avx2),
@@ -658,7 +665,7 @@ INSTANTIATE_TEST_CASE_P(
#endif #endif
#if HAVE_NEON #if HAVE_NEON
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
NEON, AverageTest, NEON, AverageTest,
::testing::Values(make_tuple(16, 16, 0, 8, &vpx_avg_8x8_neon), ::testing::Values(make_tuple(16, 16, 0, 8, &vpx_avg_8x8_neon),
make_tuple(16, 16, 5, 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(16, 16, 5, 4, &vpx_avg_4x4_neon),
make_tuple(32, 32, 15, 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, NEON, IntProRowTest,
::testing::Values(make_tuple(16, &vpx_int_pro_row_neon, &vpx_int_pro_row_c), ::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(32, &vpx_int_pro_row_neon, &vpx_int_pro_row_c),
make_tuple(64, &vpx_int_pro_row_neon, make_tuple(64, &vpx_int_pro_row_neon,
&vpx_int_pro_row_c))); &vpx_int_pro_row_c)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
NEON, IntProColTest, NEON, IntProColTest,
::testing::Values(make_tuple(16, &vpx_int_pro_col_neon, &vpx_int_pro_col_c), ::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(32, &vpx_int_pro_col_neon, &vpx_int_pro_col_c),
make_tuple(64, &vpx_int_pro_col_neon, make_tuple(64, &vpx_int_pro_col_neon,
&vpx_int_pro_col_c))); &vpx_int_pro_col_c)));
INSTANTIATE_TEST_CASE_P(NEON, SatdLowbdTest, INSTANTIATE_TEST_SUITE_P(NEON, SatdLowbdTest,
::testing::Values(make_tuple(16, &vpx_satd_neon), ::testing::Values(make_tuple(16, &vpx_satd_neon),
make_tuple(64, &vpx_satd_neon), make_tuple(64, &vpx_satd_neon),
make_tuple(256, &vpx_satd_neon), make_tuple(256, &vpx_satd_neon),
make_tuple(1024, &vpx_satd_neon))); make_tuple(1024, &vpx_satd_neon)));
// TODO(jianj): Remove the highbitdepth flag once the SIMD functions are // TODO(jianj): Remove the highbitdepth flag once the SIMD functions are
// in place. // in place.
#if !CONFIG_VP9_HIGHBITDEPTH #if !CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
NEON, BlockErrorTestFP, NEON, BlockErrorTestFP,
::testing::Values(make_tuple(16, &vp9_block_error_fp_neon), ::testing::Values(make_tuple(16, &vp9_block_error_fp_neon),
make_tuple(64, &vp9_block_error_fp_neon), make_tuple(64, &vp9_block_error_fp_neon),
@@ -700,7 +707,7 @@ INSTANTIATE_TEST_CASE_P(
#endif // HAVE_NEON #endif // HAVE_NEON
#if HAVE_MSA #if HAVE_MSA
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
MSA, AverageTest, MSA, AverageTest,
::testing::Values(make_tuple(16, 16, 0, 8, &vpx_avg_8x8_msa), ::testing::Values(make_tuple(16, 16, 0, 8, &vpx_avg_8x8_msa),
make_tuple(16, 16, 5, 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(16, 16, 5, 4, &vpx_avg_4x4_msa),
make_tuple(32, 32, 15, 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, MSA, IntProRowTest,
::testing::Values(make_tuple(16, &vpx_int_pro_row_msa, &vpx_int_pro_row_c), ::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(32, &vpx_int_pro_row_msa, &vpx_int_pro_row_c),
make_tuple(64, &vpx_int_pro_row_msa, make_tuple(64, &vpx_int_pro_row_msa,
&vpx_int_pro_row_c))); &vpx_int_pro_row_c)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
MSA, IntProColTest, MSA, IntProColTest,
::testing::Values(make_tuple(16, &vpx_int_pro_col_msa, &vpx_int_pro_col_c), ::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), 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 // TODO(jingning): Remove the highbitdepth flag once the SIMD functions are
// in place. // in place.
#if !CONFIG_VP9_HIGHBITDEPTH #if !CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P(MSA, SatdLowbdTest, INSTANTIATE_TEST_SUITE_P(MSA, SatdLowbdTest,
::testing::Values(make_tuple(16, &vpx_satd_msa), ::testing::Values(make_tuple(16, &vpx_satd_msa),
make_tuple(64, &vpx_satd_msa), make_tuple(64, &vpx_satd_msa),
make_tuple(256, &vpx_satd_msa), make_tuple(256, &vpx_satd_msa),
make_tuple(1024, &vpx_satd_msa))); make_tuple(1024, &vpx_satd_msa)));
#endif // !CONFIG_VP9_HIGHBITDEPTH #endif // !CONFIG_VP9_HIGHBITDEPTH
#endif // HAVE_MSA #endif // HAVE_MSA
+8 -7
View File
@@ -35,18 +35,18 @@ class BlockinessTestBase : public ::testing::Test {
public: public:
BlockinessTestBase(int width, int height) : width_(width), height_(height) {} BlockinessTestBase(int width, int height) : width_(width), height_(height) {}
static void SetUpTestCase() { static void SetUpTestSuite() {
source_data_ = reinterpret_cast<uint8_t *>( source_data_ = reinterpret_cast<uint8_t *>(
vpx_memalign(kDataAlignment, kDataBufferSize)); vpx_memalign(kDataAlignment, kDataBufferSize));
reference_data_ = reinterpret_cast<uint8_t *>( reference_data_ = reinterpret_cast<uint8_t *>(
vpx_memalign(kDataAlignment, kDataBufferSize)); vpx_memalign(kDataAlignment, kDataBufferSize));
} }
static void TearDownTestCase() { static void TearDownTestSuite() {
vpx_free(source_data_); vpx_free(source_data_);
source_data_ = NULL; source_data_ = nullptr;
vpx_free(reference_data_); vpx_free(reference_data_);
reference_data_ = NULL; reference_data_ = nullptr;
} }
virtual void TearDown() { libvpx_test::ClearSystemState(); } virtual void TearDown() { libvpx_test::ClearSystemState(); }
@@ -154,8 +154,8 @@ class BlockinessVP9Test
}; };
#endif // CONFIG_VP9_ENCODER #endif // CONFIG_VP9_ENCODER
uint8_t *BlockinessTestBase::source_data_ = NULL; uint8_t *BlockinessTestBase::source_data_ = nullptr;
uint8_t *BlockinessTestBase::reference_data_ = NULL; uint8_t *BlockinessTestBase::reference_data_ = nullptr;
#if CONFIG_VP9_ENCODER #if CONFIG_VP9_ENCODER
TEST_P(BlockinessVP9Test, SourceBlockierThanReference) { TEST_P(BlockinessVP9Test, SourceBlockierThanReference) {
@@ -215,7 +215,8 @@ using std::make_tuple;
const BlockinessParam c_vp9_tests[] = { make_tuple(320, 240), const BlockinessParam c_vp9_tests[] = { make_tuple(320, 240),
make_tuple(318, 242), make_tuple(318, 242),
make_tuple(318, 238) }; 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 #endif
} // namespace } // namespace
+2 -2
View File
@@ -79,6 +79,6 @@ TEST_P(BordersTest, TestLowBitrate) {
ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
} }
VP9_INSTANTIATE_TEST_CASE(BordersTest, VP9_INSTANTIATE_TEST_SUITE(BordersTest,
::testing::Values(::libvpx_test::kTwoPassGood)); ::testing::Values(::libvpx_test::kTwoPassGood));
} // namespace } // namespace
+7 -7
View File
@@ -31,7 +31,7 @@ class Buffer {
: width_(width), height_(height), top_padding_(top_padding), : width_(width), height_(height), top_padding_(top_padding),
left_padding_(left_padding), right_padding_(right_padding), left_padding_(left_padding), right_padding_(right_padding),
bottom_padding_(bottom_padding), alignment_(0), padding_value_(0), bottom_padding_(bottom_padding), alignment_(0), padding_value_(0),
stride_(0), raw_size_(0), num_elements_(0), raw_buffer_(NULL) {} stride_(0), raw_size_(0), num_elements_(0), raw_buffer_(nullptr) {}
Buffer(int width, int height, int top_padding, int left_padding, Buffer(int width, int height, int top_padding, int left_padding,
int right_padding, int bottom_padding, unsigned int alignment) int right_padding, int bottom_padding, unsigned int alignment)
@@ -39,19 +39,19 @@ class Buffer {
left_padding_(left_padding), right_padding_(right_padding), left_padding_(left_padding), right_padding_(right_padding),
bottom_padding_(bottom_padding), alignment_(alignment), bottom_padding_(bottom_padding), alignment_(alignment),
padding_value_(0), stride_(0), raw_size_(0), num_elements_(0), padding_value_(0), stride_(0), raw_size_(0), num_elements_(0),
raw_buffer_(NULL) {} raw_buffer_(nullptr) {}
Buffer(int width, int height, int padding) Buffer(int width, int height, int padding)
: width_(width), height_(height), top_padding_(padding), : width_(width), height_(height), top_padding_(padding),
left_padding_(padding), right_padding_(padding), left_padding_(padding), right_padding_(padding),
bottom_padding_(padding), alignment_(0), padding_value_(0), stride_(0), bottom_padding_(padding), alignment_(0), padding_value_(0), stride_(0),
raw_size_(0), num_elements_(0), raw_buffer_(NULL) {} raw_size_(0), num_elements_(0), raw_buffer_(nullptr) {}
Buffer(int width, int height, int padding, unsigned int alignment) Buffer(int width, int height, int padding, unsigned int alignment)
: width_(width), height_(height), top_padding_(padding), : width_(width), height_(height), top_padding_(padding),
left_padding_(padding), right_padding_(padding), left_padding_(padding), right_padding_(padding),
bottom_padding_(padding), alignment_(alignment), padding_value_(0), bottom_padding_(padding), alignment_(alignment), padding_value_(0),
stride_(0), raw_size_(0), num_elements_(0), raw_buffer_(NULL) {} stride_(0), raw_size_(0), num_elements_(0), raw_buffer_(nullptr) {}
~Buffer() { ~Buffer() {
if (alignment_) { if (alignment_) {
@@ -103,7 +103,7 @@ class Buffer {
bool CheckValues(const Buffer<T> &a) const; bool CheckValues(const Buffer<T> &a) const;
bool Init() { bool Init() {
if (raw_buffer_ != NULL) return false; if (raw_buffer_ != nullptr) return false;
EXPECT_GT(width_, 0); EXPECT_GT(width_, 0);
EXPECT_GT(height_, 0); EXPECT_GT(height_, 0);
EXPECT_GE(top_padding_, 0); EXPECT_GE(top_padding_, 0);
@@ -126,7 +126,7 @@ class Buffer {
} else { } else {
raw_buffer_ = new (std::nothrow) T[num_elements_]; raw_buffer_ = new (std::nothrow) T[num_elements_];
} }
EXPECT_TRUE(raw_buffer_ != NULL); EXPECT_NE(raw_buffer_, nullptr);
SetPadding(std::numeric_limits<T>::max()); SetPadding(std::numeric_limits<T>::max());
return !::testing::Test::HasFailure(); return !::testing::Test::HasFailure();
} }
@@ -150,7 +150,7 @@ class Buffer {
template <typename T> template <typename T>
T *Buffer<T>::TopLeftPixel() const { T *Buffer<T>::TopLeftPixel() const {
if (!raw_buffer_) return NULL; if (!raw_buffer_) return nullptr;
return raw_buffer_ + (top_padding_ * stride_) + left_padding_; return raw_buffer_ + (top_padding_ * stride_) + left_padding_;
} }
+11 -10
View File
@@ -55,23 +55,24 @@ const ByteAlignmentTestParam kBaTestParams[] = {
class ByteAlignmentTest class ByteAlignmentTest
: public ::testing::TestWithParam<ByteAlignmentTestParam> { : public ::testing::TestWithParam<ByteAlignmentTestParam> {
protected: protected:
ByteAlignmentTest() : video_(NULL), decoder_(NULL), md5_file_(NULL) {} ByteAlignmentTest()
: video_(nullptr), decoder_(nullptr), md5_file_(nullptr) {}
virtual void SetUp() { virtual void SetUp() {
video_ = new libvpx_test::WebMVideoSource(kVP9TestFile); video_ = new libvpx_test::WebMVideoSource(kVP9TestFile);
ASSERT_TRUE(video_ != NULL); ASSERT_NE(video_, nullptr);
video_->Init(); video_->Init();
video_->Begin(); video_->Begin();
const vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t(); const vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
decoder_ = new libvpx_test::VP9Decoder(cfg, 0); decoder_ = new libvpx_test::VP9Decoder(cfg, 0);
ASSERT_TRUE(decoder_ != NULL); ASSERT_NE(decoder_, nullptr);
OpenMd5File(kVP9Md5File); OpenMd5File(kVP9Md5File);
} }
virtual void TearDown() { virtual void TearDown() {
if (md5_file_ != NULL) fclose(md5_file_); if (md5_file_ != nullptr) fclose(md5_file_);
delete decoder_; delete decoder_;
delete video_; delete video_;
@@ -90,7 +91,7 @@ class ByteAlignmentTest
} }
vpx_codec_err_t DecodeRemainingFrames(int byte_alignment_to_check) { 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 = const vpx_codec_err_t res =
decoder_->DecodeFrame(video_->cxdata(), video_->frame_size()); decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
if (res != VPX_CODEC_OK) return res; if (res != VPX_CODEC_OK) return res;
@@ -113,7 +114,7 @@ class ByteAlignmentTest
const vpx_image_t *img; const vpx_image_t *img;
// Get decompressed data // Get decompressed data
while ((img = dec_iter.Next()) != NULL) { while ((img = dec_iter.Next()) != nullptr) {
if (byte_alignment_to_check == kLegacyByteAlignment) { if (byte_alignment_to_check == kLegacyByteAlignment) {
CheckByteAlignment(img->planes[0], kLegacyYPlaneByteAlignment); CheckByteAlignment(img->planes[0], kLegacyYPlaneByteAlignment);
} else { } else {
@@ -128,12 +129,12 @@ class ByteAlignmentTest
// TODO(fgalligan): Move the MD5 testing code into another class. // TODO(fgalligan): Move the MD5 testing code into another class.
void OpenMd5File(const std::string &md5_file_name_) { void OpenMd5File(const std::string &md5_file_name_) {
md5_file_ = libvpx_test::OpenTestDataFile(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_; << "MD5 file open failed. Filename: " << md5_file_name_;
} }
void CheckMd5(const vpx_image_t &img) { void CheckMd5(const vpx_image_t &img) {
ASSERT_TRUE(md5_file_ != NULL); ASSERT_NE(md5_file_, nullptr);
char expected_md5[33]; char expected_md5[33];
char junk[128]; char junk[128];
@@ -176,8 +177,8 @@ TEST_P(ByteAlignmentTest, TestAlignment) {
} }
} }
INSTANTIATE_TEST_CASE_P(Alignments, ByteAlignmentTest, INSTANTIATE_TEST_SUITE_P(Alignments, ByteAlignmentTest,
::testing::ValuesIn(kBaTestParams)); ::testing::ValuesIn(kBaTestParams));
#endif // CONFIG_WEBM_IO #endif // CONFIG_WEBM_IO
+14 -14
View File
@@ -88,7 +88,7 @@ class VP8Decoder : public Decoder {
#if CONFIG_VP8_DECODER #if CONFIG_VP8_DECODER
return &vpx_codec_vp8_dx_algo; return &vpx_codec_vp8_dx_algo;
#else #else
return NULL; return nullptr;
#endif #endif
} }
}; };
@@ -104,7 +104,7 @@ class VP8Encoder : public Encoder {
#if CONFIG_VP8_ENCODER #if CONFIG_VP8_ENCODER
return &vpx_codec_vp8_cx_algo; return &vpx_codec_vp8_cx_algo;
#else #else
return NULL; return nullptr;
#endif #endif
} }
}; };
@@ -124,7 +124,7 @@ class VP8CodecFactory : public CodecFactory {
#else #else
(void)cfg; (void)cfg;
(void)flags; (void)flags;
return NULL; return nullptr;
#endif #endif
} }
@@ -139,7 +139,7 @@ class VP8CodecFactory : public CodecFactory {
(void)deadline; (void)deadline;
(void)init_flags; (void)init_flags;
(void)stats; (void)stats;
return NULL; return nullptr;
#endif #endif
} }
@@ -157,15 +157,15 @@ class VP8CodecFactory : public CodecFactory {
const libvpx_test::VP8CodecFactory kVP8; const libvpx_test::VP8CodecFactory kVP8;
#define VP8_INSTANTIATE_TEST_CASE(test, ...) \ #define VP8_INSTANTIATE_TEST_SUITE(test, ...) \
INSTANTIATE_TEST_CASE_P( \ INSTANTIATE_TEST_SUITE_P( \
VP8, test, \ VP8, test, \
::testing::Combine( \ ::testing::Combine( \
::testing::Values(static_cast<const libvpx_test::CodecFactory *>( \ ::testing::Values(static_cast<const libvpx_test::CodecFactory *>( \
&libvpx_test::kVP8)), \ &libvpx_test::kVP8)), \
__VA_ARGS__)) __VA_ARGS__))
#else #else
#define VP8_INSTANTIATE_TEST_CASE(test, ...) #define VP8_INSTANTIATE_TEST_SUITE(test, ...)
#endif // CONFIG_VP8 #endif // CONFIG_VP8
/* /*
@@ -184,7 +184,7 @@ class VP9Decoder : public Decoder {
#if CONFIG_VP9_DECODER #if CONFIG_VP9_DECODER
return &vpx_codec_vp9_dx_algo; return &vpx_codec_vp9_dx_algo;
#else #else
return NULL; return nullptr;
#endif #endif
} }
}; };
@@ -200,7 +200,7 @@ class VP9Encoder : public Encoder {
#if CONFIG_VP9_ENCODER #if CONFIG_VP9_ENCODER
return &vpx_codec_vp9_cx_algo; return &vpx_codec_vp9_cx_algo;
#else #else
return NULL; return nullptr;
#endif #endif
} }
}; };
@@ -220,7 +220,7 @@ class VP9CodecFactory : public CodecFactory {
#else #else
(void)cfg; (void)cfg;
(void)flags; (void)flags;
return NULL; return nullptr;
#endif #endif
} }
@@ -235,7 +235,7 @@ class VP9CodecFactory : public CodecFactory {
(void)deadline; (void)deadline;
(void)init_flags; (void)init_flags;
(void)stats; (void)stats;
return NULL; return nullptr;
#endif #endif
} }
@@ -253,15 +253,15 @@ class VP9CodecFactory : public CodecFactory {
const libvpx_test::VP9CodecFactory kVP9; const libvpx_test::VP9CodecFactory kVP9;
#define VP9_INSTANTIATE_TEST_CASE(test, ...) \ #define VP9_INSTANTIATE_TEST_SUITE(test, ...) \
INSTANTIATE_TEST_CASE_P( \ INSTANTIATE_TEST_SUITE_P( \
VP9, test, \ VP9, test, \
::testing::Combine( \ ::testing::Combine( \
::testing::Values(static_cast<const libvpx_test::CodecFactory *>( \ ::testing::Values(static_cast<const libvpx_test::CodecFactory *>( \
&libvpx_test::kVP9)), \ &libvpx_test::kVP9)), \
__VA_ARGS__)) __VA_ARGS__))
#else #else
#define VP9_INSTANTIATE_TEST_CASE(test, ...) #define VP9_INSTANTIATE_TEST_SUITE(test, ...)
#endif // CONFIG_VP9 #endif // CONFIG_VP9
} // namespace libvpx_test } // namespace libvpx_test
+16 -11
View File
@@ -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, void reference_pred(const Buffer<uint8_t> &pred, const Buffer<uint8_t> &ref,
int width, int height, Buffer<uint8_t> *avg) { int width, int height, Buffer<uint8_t> *avg) {
ASSERT_TRUE(avg->TopLeftPixel() != NULL); ASSERT_NE(avg->TopLeftPixel(), nullptr);
ASSERT_TRUE(pred.TopLeftPixel() != NULL); ASSERT_NE(pred.TopLeftPixel(), nullptr);
ASSERT_TRUE(ref.TopLeftPixel() != NULL); ASSERT_NE(ref.TopLeftPixel(), nullptr);
for (int y = 0; y < height; ++y) { for (int y = 0; y < height; ++y) {
for (int x = 0; x < width; ++x) { for (int x = 0; x < width; ++x) {
@@ -166,21 +166,26 @@ TEST_P(AvgPredTest, DISABLED_Speed) {
} }
} }
INSTANTIATE_TEST_CASE_P(C, AvgPredTest, INSTANTIATE_TEST_SUITE_P(C, AvgPredTest,
::testing::Values(&vpx_comp_avg_pred_c)); ::testing::Values(&vpx_comp_avg_pred_c));
#if HAVE_SSE2 #if HAVE_SSE2
INSTANTIATE_TEST_CASE_P(SSE2, AvgPredTest, INSTANTIATE_TEST_SUITE_P(SSE2, AvgPredTest,
::testing::Values(&vpx_comp_avg_pred_sse2)); ::testing::Values(&vpx_comp_avg_pred_sse2));
#endif // HAVE_SSE2 #endif // HAVE_SSE2
#if HAVE_NEON #if HAVE_NEON
INSTANTIATE_TEST_CASE_P(NEON, AvgPredTest, INSTANTIATE_TEST_SUITE_P(NEON, AvgPredTest,
::testing::Values(&vpx_comp_avg_pred_neon)); ::testing::Values(&vpx_comp_avg_pred_neon));
#endif // HAVE_NEON #endif // HAVE_NEON
#if HAVE_VSX #if HAVE_VSX
INSTANTIATE_TEST_CASE_P(VSX, AvgPredTest, INSTANTIATE_TEST_SUITE_P(VSX, AvgPredTest,
::testing::Values(&vpx_comp_avg_pred_vsx)); ::testing::Values(&vpx_comp_avg_pred_vsx));
#endif // HAVE_VSX #endif // HAVE_VSX
#if HAVE_LSX
INSTANTIATE_TEST_SUITE_P(LSX, AvgPredTest,
::testing::Values(&vpx_comp_avg_pred_lsx));
#endif // HAVE_LSX
} // namespace } // namespace
+1 -1
View File
@@ -58,5 +58,5 @@ TEST_P(ConfigTest, LagIsDisabled) {
EXPECT_EQ(frame_count_in_, frame_count_out_); 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 } // namespace
+11 -11
View File
@@ -39,7 +39,7 @@ class ConsistencyTestBase : public ::testing::Test {
public: public:
ConsistencyTestBase(int width, int height) : width_(width), height_(height) {} ConsistencyTestBase(int width, int height) : width_(width), height_(height) {}
static void SetUpTestCase() { static void SetUpTestSuite() {
source_data_[0] = reinterpret_cast<uint8_t *>( source_data_[0] = reinterpret_cast<uint8_t *>(
vpx_memalign(kDataAlignment, kDataBufferSize)); vpx_memalign(kDataAlignment, kDataBufferSize));
reference_data_[0] = reinterpret_cast<uint8_t *>( 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 ClearSsim() { memset(ssim_array_, 0, kDataBufferSize / 16); }
static void TearDownTestCase() { static void TearDownTestSuite() {
vpx_free(source_data_[0]); vpx_free(source_data_[0]);
source_data_[0] = NULL; source_data_[0] = nullptr;
vpx_free(reference_data_[0]); vpx_free(reference_data_[0]);
reference_data_[0] = NULL; reference_data_[0] = nullptr;
vpx_free(source_data_[1]); vpx_free(source_data_[1]);
source_data_[1] = NULL; source_data_[1] = nullptr;
vpx_free(reference_data_[1]); vpx_free(reference_data_[1]);
reference_data_[1] = NULL; reference_data_[1] = nullptr;
delete[] ssim_array_; delete[] ssim_array_;
} }
@@ -145,9 +145,9 @@ class ConsistencyVP9Test
}; };
#endif // CONFIG_VP9_ENCODER #endif // CONFIG_VP9_ENCODER
uint8_t *ConsistencyTestBase::source_data_[2] = { NULL, NULL }; uint8_t *ConsistencyTestBase::source_data_[2] = { nullptr, nullptr };
uint8_t *ConsistencyTestBase::reference_data_[2] = { NULL, NULL }; uint8_t *ConsistencyTestBase::reference_data_[2] = { nullptr, nullptr };
Ssimv *ConsistencyTestBase::ssim_array_ = NULL; Ssimv *ConsistencyTestBase::ssim_array_ = nullptr;
#if CONFIG_VP9_ENCODER #if CONFIG_VP9_ENCODER
TEST_P(ConsistencyVP9Test, ConsistencyIsZero) { TEST_P(ConsistencyVP9Test, ConsistencyIsZero) {
@@ -208,8 +208,8 @@ using std::make_tuple;
const ConsistencyParam c_vp9_tests[] = { make_tuple(320, 240), const ConsistencyParam c_vp9_tests[] = { make_tuple(320, 240),
make_tuple(318, 242), make_tuple(318, 242),
make_tuple(318, 238) }; make_tuple(318, 238) };
INSTANTIATE_TEST_CASE_P(C, ConsistencyVP9Test, INSTANTIATE_TEST_SUITE_P(C, ConsistencyVP9Test,
::testing::ValuesIn(c_vp9_tests)); ::testing::ValuesIn(c_vp9_tests));
#endif #endif
} // namespace } // namespace
+62 -46
View File
@@ -341,7 +341,7 @@ void wrapper_filter_block2d_8_c(const uint8_t *src_ptr,
class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> { class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
public: public:
static void SetUpTestCase() { static void SetUpTestSuite() {
// Force input_ to be unaligned, output to be 16 byte aligned. // Force input_ to be unaligned, output to be 16 byte aligned.
input_ = reinterpret_cast<uint8_t *>( input_ = reinterpret_cast<uint8_t *>(
vpx_memalign(kDataAlignment, kInputBufferSize + 1)) + vpx_memalign(kDataAlignment, kInputBufferSize + 1)) +
@@ -363,20 +363,20 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
virtual void TearDown() { libvpx_test::ClearSystemState(); } virtual void TearDown() { libvpx_test::ClearSystemState(); }
static void TearDownTestCase() { static void TearDownTestSuite() {
vpx_free(input_ - 1); vpx_free(input_ - 1);
input_ = NULL; input_ = nullptr;
vpx_free(output_); vpx_free(output_);
output_ = NULL; output_ = nullptr;
vpx_free(output_ref_); vpx_free(output_ref_);
output_ref_ = NULL; output_ref_ = nullptr;
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
vpx_free(input16_ - 1); vpx_free(input16_ - 1);
input16_ = NULL; input16_ = nullptr;
vpx_free(output16_); vpx_free(output16_);
output16_ = NULL; output16_ = nullptr;
vpx_free(output16_ref_); vpx_free(output16_ref_);
output16_ref_ = NULL; output16_ref_ = nullptr;
#endif #endif
} }
@@ -541,13 +541,13 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
#endif #endif
}; };
uint8_t *ConvolveTest::input_ = NULL; uint8_t *ConvolveTest::input_ = nullptr;
uint8_t *ConvolveTest::output_ = NULL; uint8_t *ConvolveTest::output_ = nullptr;
uint8_t *ConvolveTest::output_ref_ = NULL; uint8_t *ConvolveTest::output_ref_ = nullptr;
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
uint16_t *ConvolveTest::input16_ = NULL; uint16_t *ConvolveTest::input16_ = nullptr;
uint16_t *ConvolveTest::output16_ = NULL; uint16_t *ConvolveTest::output16_ = nullptr;
uint16_t *ConvolveTest::output16_ref_ = NULL; uint16_t *ConvolveTest::output16_ref_ = nullptr;
#endif #endif
TEST_P(ConvolveTest, GuardBlocks) { CheckGuardBlocks(); } TEST_P(ConvolveTest, GuardBlocks) { CheckGuardBlocks(); }
@@ -562,7 +562,7 @@ TEST_P(ConvolveTest, DISABLED_Copy_Speed) {
vpx_usec_timer_start(&timer); vpx_usec_timer_start(&timer);
for (int n = 0; n < kNumTests; ++n) { 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); width, height);
} }
vpx_usec_timer_mark(&timer); vpx_usec_timer_mark(&timer);
@@ -582,7 +582,7 @@ TEST_P(ConvolveTest, DISABLED_Avg_Speed) {
vpx_usec_timer_start(&timer); vpx_usec_timer_start(&timer);
for (int n = 0; n < kNumTests; ++n) { 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); width, height);
} }
vpx_usec_timer_mark(&timer); vpx_usec_timer_mark(&timer);
@@ -780,7 +780,8 @@ TEST_P(ConvolveTest, Copy) {
uint8_t *const out = output(); uint8_t *const out = output();
ASM_REGISTER_STATE_CHECK(UUT_->copy_[0](in, kInputStride, out, kOutputStride, 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(); CheckGuardBlocks();
@@ -799,7 +800,8 @@ TEST_P(ConvolveTest, Avg) {
CopyOutputToRef(); CopyOutputToRef();
ASM_REGISTER_STATE_CHECK(UUT_->copy_[1](in, kInputStride, out, kOutputStride, 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(); CheckGuardBlocks();
@@ -955,9 +957,9 @@ TEST_P(ConvolveTest, MatchesReferenceSubpixelFilter) {
UUT_->h8_[i](in, kInputStride, out, kOutputStride, filters, UUT_->h8_[i](in, kInputStride, out, kOutputStride, filters,
filter_x, 16, 0, 16, Width(), Height())); filter_x, 16, 0, 16, Width(), Height()));
else else
ASM_REGISTER_STATE_CHECK(UUT_->copy_[i](in, kInputStride, out, ASM_REGISTER_STATE_CHECK(
kOutputStride, NULL, 0, 0, UUT_->copy_[i](in, kInputStride, out, kOutputStride, nullptr, 0,
0, 0, Width(), Height())); 0, 0, 0, Width(), Height()));
CheckGuardBlocks(); CheckGuardBlocks();
@@ -1053,9 +1055,9 @@ TEST_P(ConvolveTest, FilterExtremes) {
UUT_->h8_[0](in, kInputStride, out, kOutputStride, filters, UUT_->h8_[0](in, kInputStride, out, kOutputStride, filters,
filter_x, 16, 0, 16, Width(), Height())); filter_x, 16, 0, 16, Width(), Height()));
else else
ASM_REGISTER_STATE_CHECK(UUT_->copy_[0](in, kInputStride, out, ASM_REGISTER_STATE_CHECK(
kOutputStride, NULL, 0, 0, UUT_->copy_[0](in, kInputStride, out, kOutputStride, nullptr,
0, 0, Width(), Height())); 0, 0, 0, 0, Width(), Height()));
for (int y = 0; y < Height(); ++y) { for (int y = 0; y < Height(); ++y) {
for (int x = 0; x < Width(); ++x) for (int x = 0; x < Width(); ++x)
@@ -1133,7 +1135,7 @@ using std::make_tuple;
x0_q4, x_step_q4, y0_q4, y_step_q4, w, h, bd); \ x0_q4, x_step_q4, y0_q4, y_step_q4, w, h, bd); \
} }
#if HAVE_SSE2 && ARCH_X86_64 #if HAVE_SSE2 && VPX_ARCH_X86_64
WRAP(convolve_copy_sse2, 8) WRAP(convolve_copy_sse2, 8)
WRAP(convolve_avg_sse2, 8) WRAP(convolve_avg_sse2, 8)
WRAP(convolve_copy_sse2, 10) WRAP(convolve_copy_sse2, 10)
@@ -1158,7 +1160,7 @@ WRAP(convolve8_vert_sse2, 12)
WRAP(convolve8_avg_vert_sse2, 12) WRAP(convolve8_avg_vert_sse2, 12)
WRAP(convolve8_sse2, 12) WRAP(convolve8_sse2, 12)
WRAP(convolve8_avg_sse2, 12) WRAP(convolve8_avg_sse2, 12)
#endif // HAVE_SSE2 && ARCH_X86_64 #endif // HAVE_SSE2 && VPX_ARCH_X86_64
#if HAVE_AVX2 #if HAVE_AVX2
WRAP(convolve_copy_avx2, 8) WRAP(convolve_copy_avx2, 8)
@@ -1276,9 +1278,10 @@ const ConvolveFunctions convolve8_c(
vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0); vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
const ConvolveParam kArrayConvolve_c[] = { ALL_SIZES(convolve8_c) }; const ConvolveParam kArrayConvolve_c[] = { ALL_SIZES(convolve8_c) };
#endif #endif
INSTANTIATE_TEST_CASE_P(C, ConvolveTest, ::testing::ValuesIn(kArrayConvolve_c)); INSTANTIATE_TEST_SUITE_P(C, ConvolveTest,
::testing::ValuesIn(kArrayConvolve_c));
#if HAVE_SSE2 && ARCH_X86_64 #if HAVE_SSE2 && VPX_ARCH_X86_64
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
const ConvolveFunctions convolve8_sse2( const ConvolveFunctions convolve8_sse2(
wrap_convolve_copy_sse2_8, wrap_convolve_avg_sse2_8, wrap_convolve_copy_sse2_8, wrap_convolve_avg_sse2_8,
@@ -1317,8 +1320,8 @@ const ConvolveFunctions convolve8_sse2(
const ConvolveParam kArrayConvolve_sse2[] = { ALL_SIZES(convolve8_sse2) }; const ConvolveParam kArrayConvolve_sse2[] = { ALL_SIZES(convolve8_sse2) };
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P(SSE2, ConvolveTest, INSTANTIATE_TEST_SUITE_P(SSE2, ConvolveTest,
::testing::ValuesIn(kArrayConvolve_sse2)); ::testing::ValuesIn(kArrayConvolve_sse2));
#endif #endif
#if HAVE_SSSE3 #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); vpx_scaled_avg_vert_c, vpx_scaled_2d_ssse3, vpx_scaled_avg_2d_c, 0);
const ConvolveParam kArrayConvolve8_ssse3[] = { ALL_SIZES(convolve8_ssse3) }; const ConvolveParam kArrayConvolve8_ssse3[] = { ALL_SIZES(convolve8_ssse3) };
INSTANTIATE_TEST_CASE_P(SSSE3, ConvolveTest, INSTANTIATE_TEST_SUITE_P(SSSE3, ConvolveTest,
::testing::ValuesIn(kArrayConvolve8_ssse3)); ::testing::ValuesIn(kArrayConvolve8_ssse3));
#endif #endif
#if HAVE_AVX2 #if HAVE_AVX2
@@ -1362,8 +1365,8 @@ const ConvolveFunctions convolve12_avx2(
const ConvolveParam kArrayConvolve8_avx2[] = { ALL_SIZES(convolve8_avx2), const ConvolveParam kArrayConvolve8_avx2[] = { ALL_SIZES(convolve8_avx2),
ALL_SIZES(convolve10_avx2), ALL_SIZES(convolve10_avx2),
ALL_SIZES(convolve12_avx2) }; ALL_SIZES(convolve12_avx2) };
INSTANTIATE_TEST_CASE_P(AVX2, ConvolveTest, INSTANTIATE_TEST_SUITE_P(AVX2, ConvolveTest,
::testing::ValuesIn(kArrayConvolve8_avx2)); ::testing::ValuesIn(kArrayConvolve8_avx2));
#else // !CONFIG_VP9_HIGHBITDEPTH #else // !CONFIG_VP9_HIGHBITDEPTH
const ConvolveFunctions convolve8_avx2( const ConvolveFunctions convolve8_avx2(
vpx_convolve_copy_c, vpx_convolve_avg_c, vpx_convolve8_horiz_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_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); vpx_scaled_avg_vert_c, vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
const ConvolveParam kArrayConvolve8_avx2[] = { ALL_SIZES(convolve8_avx2) }; const ConvolveParam kArrayConvolve8_avx2[] = { ALL_SIZES(convolve8_avx2) };
INSTANTIATE_TEST_CASE_P(AVX2, ConvolveTest, INSTANTIATE_TEST_SUITE_P(AVX2, ConvolveTest,
::testing::ValuesIn(kArrayConvolve8_avx2)); ::testing::ValuesIn(kArrayConvolve8_avx2));
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
#endif // HAVE_AVX2 #endif // HAVE_AVX2
@@ -1416,8 +1419,8 @@ const ConvolveFunctions convolve8_neon(
const ConvolveParam kArrayConvolve_neon[] = { ALL_SIZES(convolve8_neon) }; const ConvolveParam kArrayConvolve_neon[] = { ALL_SIZES(convolve8_neon) };
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P(NEON, ConvolveTest, INSTANTIATE_TEST_SUITE_P(NEON, ConvolveTest,
::testing::ValuesIn(kArrayConvolve_neon)); ::testing::ValuesIn(kArrayConvolve_neon));
#endif // HAVE_NEON #endif // HAVE_NEON
#if HAVE_DSPR2 #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); vpx_scaled_avg_vert_c, vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
const ConvolveParam kArrayConvolve8_dspr2[] = { ALL_SIZES(convolve8_dspr2) }; const ConvolveParam kArrayConvolve8_dspr2[] = { ALL_SIZES(convolve8_dspr2) };
INSTANTIATE_TEST_CASE_P(DSPR2, ConvolveTest, INSTANTIATE_TEST_SUITE_P(DSPR2, ConvolveTest,
::testing::ValuesIn(kArrayConvolve8_dspr2)); ::testing::ValuesIn(kArrayConvolve8_dspr2));
#endif // HAVE_DSPR2 #endif // HAVE_DSPR2
#if HAVE_MSA #if HAVE_MSA
@@ -1442,10 +1445,23 @@ const ConvolveFunctions convolve8_msa(
vpx_scaled_avg_vert_c, vpx_scaled_2d_msa, vpx_scaled_avg_2d_c, 0); vpx_scaled_avg_vert_c, vpx_scaled_2d_msa, vpx_scaled_avg_2d_c, 0);
const ConvolveParam kArrayConvolve8_msa[] = { ALL_SIZES(convolve8_msa) }; const ConvolveParam kArrayConvolve8_msa[] = { ALL_SIZES(convolve8_msa) };
INSTANTIATE_TEST_CASE_P(MSA, ConvolveTest, INSTANTIATE_TEST_SUITE_P(MSA, ConvolveTest,
::testing::ValuesIn(kArrayConvolve8_msa)); ::testing::ValuesIn(kArrayConvolve8_msa));
#endif // HAVE_MSA #endif // HAVE_MSA
#if HAVE_LSX
const ConvolveFunctions convolve8_lsx(
vpx_convolve_copy_lsx, vpx_convolve_avg_lsx, vpx_convolve8_horiz_lsx,
vpx_convolve8_avg_horiz_lsx, vpx_convolve8_vert_lsx,
vpx_convolve8_avg_vert_lsx, vpx_convolve8_lsx, vpx_convolve8_avg_lsx,
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_lsx[] = { ALL_SIZES(convolve8_lsx) };
INSTANTIATE_TEST_SUITE_P(LSX, ConvolveTest,
::testing::ValuesIn(kArrayConvolve8_lsx));
#endif // HAVE_LSX
#if HAVE_VSX #if HAVE_VSX
const ConvolveFunctions convolve8_vsx( const ConvolveFunctions convolve8_vsx(
vpx_convolve_copy_vsx, vpx_convolve_avg_vsx, vpx_convolve8_horiz_vsx, vpx_convolve_copy_vsx, vpx_convolve_avg_vsx, vpx_convolve8_horiz_vsx,
@@ -1454,8 +1470,8 @@ const ConvolveFunctions convolve8_vsx(
vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c, vpx_scaled_vert_c, 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); vpx_scaled_avg_vert_c, vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
const ConvolveParam kArrayConvolve_vsx[] = { ALL_SIZES(convolve8_vsx) }; const ConvolveParam kArrayConvolve_vsx[] = { ALL_SIZES(convolve8_vsx) };
INSTANTIATE_TEST_CASE_P(VSX, ConvolveTest, INSTANTIATE_TEST_SUITE_P(VSX, ConvolveTest,
::testing::ValuesIn(kArrayConvolve_vsx)); ::testing::ValuesIn(kArrayConvolve_vsx));
#endif // HAVE_VSX #endif // HAVE_VSX
#if HAVE_MMI #if HAVE_MMI
@@ -1466,7 +1482,7 @@ const ConvolveFunctions convolve8_mmi(
vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c, vpx_scaled_vert_c, 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); vpx_scaled_avg_vert_c, vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
const ConvolveParam kArrayConvolve_mmi[] = { ALL_SIZES(convolve8_mmi) }; const ConvolveParam kArrayConvolve_mmi[] = { ALL_SIZES(convolve8_mmi) };
INSTANTIATE_TEST_CASE_P(MMI, ConvolveTest, INSTANTIATE_TEST_SUITE_P(MMI, ConvolveTest,
::testing::ValuesIn(kArrayConvolve_mmi)); ::testing::ValuesIn(kArrayConvolve_mmi));
#endif // HAVE_MMI #endif // HAVE_MMI
} // namespace } // namespace
+5 -5
View File
@@ -148,9 +148,9 @@ TEST_P(CpuSpeedTest, TestLowBitrate) {
ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
} }
VP9_INSTANTIATE_TEST_CASE(CpuSpeedTest, VP9_INSTANTIATE_TEST_SUITE(CpuSpeedTest,
::testing::Values(::libvpx_test::kTwoPassGood, ::testing::Values(::libvpx_test::kTwoPassGood,
::libvpx_test::kOnePassGood, ::libvpx_test::kOnePassGood,
::libvpx_test::kRealTime), ::libvpx_test::kRealTime),
::testing::Range(0, 10)); ::testing::Range(0, 10));
} // namespace } // namespace
+4 -4
View File
@@ -29,9 +29,9 @@ class CQTest : public ::libvpx_test::EncoderTest,
// maps the cqlevel to the bitrate produced. // maps the cqlevel to the bitrate produced.
typedef std::map<int, uint32_t> BitrateMap; 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()) ASSERT_TRUE(!HasFailure())
<< "skipping bitrate validation due to earlier failure."; << "skipping bitrate validation due to earlier failure.";
uint32_t prev_actual_bitrate = kCQTargetBitrate; uint32_t prev_actual_bitrate = kCQTargetBitrate;
@@ -126,6 +126,6 @@ TEST_P(CQTest, LinearPSNRIsHigherForCQLevel) {
EXPECT_GE(cq_psnr_lin, vbr_psnr_lin); EXPECT_GE(cq_psnr_lin, vbr_psnr_lin);
} }
VP8_INSTANTIATE_TEST_CASE(CQTest, ::testing::Range(kCQLevelMin, kCQLevelMax, VP8_INSTANTIATE_TEST_SUITE(CQTest, ::testing::Range(kCQLevelMin, kCQLevelMax,
kCQLevelStep)); kCQLevelStep));
} // namespace } // namespace
+1 -1
View File
@@ -38,7 +38,7 @@ vpx_set_ref() {
eval "${VPX_TEST_PREFIX}" "${encoder}" "${YUV_RAW_INPUT_WIDTH}" \ eval "${VPX_TEST_PREFIX}" "${encoder}" "${YUV_RAW_INPUT_WIDTH}" \
"${YUV_RAW_INPUT_HEIGHT}" "${YUV_RAW_INPUT}" "${output_file}" \ "${YUV_RAW_INPUT_HEIGHT}" "${YUV_RAW_INPUT}" "${output_file}" \
"${ref_frame_num}" ${devnull} "${ref_frame_num}" ${devnull} || return 1
[ -e "${output_file}" ] || return 1 [ -e "${output_file}" ] || return 1
} }
+32 -22
View File
@@ -714,6 +714,7 @@ TEST_P(Trans16x16HT, QuantCheck) {
RunQuantCheck(429, 729); RunQuantCheck(429, 729);
} }
#if HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
class InvTrans16x16DCT : public Trans16x16TestBase, class InvTrans16x16DCT : public Trans16x16TestBase,
public ::testing::TestWithParam<Idct16x16Param> { public ::testing::TestWithParam<Idct16x16Param> {
public: public:
@@ -739,29 +740,31 @@ class InvTrans16x16DCT : public Trans16x16TestBase,
IdctFunc inv_txfm_; IdctFunc inv_txfm_;
int thresh_; int thresh_;
}; };
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(InvTrans16x16DCT);
TEST_P(InvTrans16x16DCT, CompareReference) { TEST_P(InvTrans16x16DCT, CompareReference) {
CompareInvReference(ref_txfm_, thresh_); CompareInvReference(ref_txfm_, thresh_);
} }
#endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
using std::make_tuple; using std::make_tuple;
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
C, Trans16x16DCT, C, Trans16x16DCT,
::testing::Values( ::testing::Values(
make_tuple(&vpx_highbd_fdct16x16_c, &idct16x16_10, 0, VPX_BITS_10), 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_highbd_fdct16x16_c, &idct16x16_12, 0, VPX_BITS_12),
make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c, 0, VPX_BITS_8))); make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c, 0, VPX_BITS_8)));
#else #else
INSTANTIATE_TEST_CASE_P(C, Trans16x16DCT, INSTANTIATE_TEST_SUITE_P(C, Trans16x16DCT,
::testing::Values(make_tuple(&vpx_fdct16x16_c, ::testing::Values(make_tuple(&vpx_fdct16x16_c,
&vpx_idct16x16_256_add_c, &vpx_idct16x16_256_add_c,
0, VPX_BITS_8))); 0, VPX_BITS_8)));
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
C, Trans16x16HT, C, Trans16x16HT,
::testing::Values( ::testing::Values(
make_tuple(&vp9_highbd_fht16x16_c, &iht16x16_10, 0, VPX_BITS_10), 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, 2, VPX_BITS_8),
make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 3, VPX_BITS_8))); make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 3, VPX_BITS_8)));
#else #else
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
C, Trans16x16HT, C, Trans16x16HT,
::testing::Values( ::testing::Values(
make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 0, VPX_BITS_8), 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 #endif // CONFIG_VP9_HIGHBITDEPTH
#if HAVE_NEON && !CONFIG_EMULATE_HARDWARE #if HAVE_NEON && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
NEON, Trans16x16DCT, NEON, Trans16x16DCT,
::testing::Values(make_tuple(&vpx_fdct16x16_neon, ::testing::Values(make_tuple(&vpx_fdct16x16_neon,
&vpx_idct16x16_256_add_neon, 0, VPX_BITS_8))); &vpx_idct16x16_256_add_neon, 0, VPX_BITS_8)));
#endif // HAVE_NEON && !CONFIG_EMULATE_HARDWARE #endif // HAVE_NEON && !CONFIG_EMULATE_HARDWARE
#if 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, SSE2, Trans16x16DCT,
::testing::Values(make_tuple(&vpx_fdct16x16_sse2, ::testing::Values(make_tuple(&vpx_fdct16x16_sse2,
&vpx_idct16x16_256_add_sse2, 0, VPX_BITS_8))); &vpx_idct16x16_256_add_sse2, 0, VPX_BITS_8)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
SSE2, Trans16x16HT, SSE2, Trans16x16HT,
::testing::Values(make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, ::testing::Values(make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2,
0, VPX_BITS_8), 0, VPX_BITS_8),
@@ -811,7 +814,7 @@ INSTANTIATE_TEST_CASE_P(
#endif // HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #endif // HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
#if 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, SSE2, Trans16x16DCT,
::testing::Values( ::testing::Values(
make_tuple(&vpx_highbd_fdct16x16_sse2, &idct16x16_10, 0, VPX_BITS_10), make_tuple(&vpx_highbd_fdct16x16_sse2, &idct16x16_10, 0, VPX_BITS_10),
@@ -822,7 +825,7 @@ INSTANTIATE_TEST_CASE_P(
VPX_BITS_12), VPX_BITS_12),
make_tuple(&vpx_fdct16x16_sse2, &vpx_idct16x16_256_add_c, 0, make_tuple(&vpx_fdct16x16_sse2, &vpx_idct16x16_256_add_c, 0,
VPX_BITS_8))); VPX_BITS_8)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
SSE2, Trans16x16HT, SSE2, Trans16x16HT,
::testing::Values( ::testing::Values(
make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_c, 0, VPX_BITS_8), 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))); VPX_BITS_8)));
// Optimizations take effect at a threshold of 3155, so we use a value close to // Optimizations take effect at a threshold of 3155, so we use a value close to
// that to test both branches. // that to test both branches.
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
SSE2, InvTrans16x16DCT, SSE2, InvTrans16x16DCT,
::testing::Values(make_tuple(&idct16x16_10_add_10_c, ::testing::Values(make_tuple(&idct16x16_10_add_10_c,
&idct16x16_10_add_10_sse2, 3167, VPX_BITS_10), &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 #endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P(MSA, Trans16x16DCT, INSTANTIATE_TEST_SUITE_P(
::testing::Values(make_tuple(&vpx_fdct16x16_msa, MSA, Trans16x16DCT,
&vpx_idct16x16_256_add_msa, ::testing::Values(make_tuple(&vpx_fdct16x16_msa, &vpx_idct16x16_256_add_msa,
0, VPX_BITS_8))); 0, VPX_BITS_8)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
MSA, Trans16x16HT, MSA, Trans16x16HT,
::testing::Values( ::testing::Values(
make_tuple(&vp9_fht16x16_msa, &vp9_iht16x16_256_add_msa, 0, VPX_BITS_8), make_tuple(&vp9_fht16x16_msa, &vp9_iht16x16_256_add_msa, 0, VPX_BITS_8),
@@ -860,9 +863,16 @@ INSTANTIATE_TEST_CASE_P(
#endif // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #endif // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
#if HAVE_VSX && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #if HAVE_VSX && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P(VSX, Trans16x16DCT, INSTANTIATE_TEST_SUITE_P(
::testing::Values(make_tuple(&vpx_fdct16x16_c, VSX, Trans16x16DCT,
&vpx_idct16x16_256_add_vsx, ::testing::Values(make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_vsx,
0, VPX_BITS_8))); 0, VPX_BITS_8)));
#endif // HAVE_VSX && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #endif // HAVE_VSX && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
#if HAVE_LSX && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_SUITE_P(LSX, Trans16x16DCT,
::testing::Values(make_tuple(&vpx_fdct16x16_lsx,
&vpx_idct16x16_256_add_c,
0, VPX_BITS_8)));
#endif // HAVE_LSX && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
} // namespace } // namespace
+17 -8
View File
@@ -317,7 +317,7 @@ TEST_P(Trans32x32Test, InverseAccuracy) {
using std::make_tuple; using std::make_tuple;
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
C, Trans32x32Test, C, Trans32x32Test,
::testing::Values( ::testing::Values(
make_tuple(&vpx_highbd_fdct32x32_c, &idct32x32_10, 0, VPX_BITS_10), 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, make_tuple(&vpx_fdct32x32_rd_c, &vpx_idct32x32_1024_add_c, 1,
VPX_BITS_8))); VPX_BITS_8)));
#else #else
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
C, Trans32x32Test, C, Trans32x32Test,
::testing::Values(make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_c, 0, ::testing::Values(make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_c, 0,
VPX_BITS_8), VPX_BITS_8),
@@ -337,7 +337,7 @@ INSTANTIATE_TEST_CASE_P(
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
#if HAVE_NEON && !CONFIG_EMULATE_HARDWARE #if HAVE_NEON && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
NEON, Trans32x32Test, NEON, Trans32x32Test,
::testing::Values(make_tuple(&vpx_fdct32x32_neon, ::testing::Values(make_tuple(&vpx_fdct32x32_neon,
&vpx_idct32x32_1024_add_neon, 0, VPX_BITS_8), &vpx_idct32x32_1024_add_neon, 0, VPX_BITS_8),
@@ -346,7 +346,7 @@ INSTANTIATE_TEST_CASE_P(
#endif // HAVE_NEON && !CONFIG_EMULATE_HARDWARE #endif // HAVE_NEON && !CONFIG_EMULATE_HARDWARE
#if 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, SSE2, Trans32x32Test,
::testing::Values(make_tuple(&vpx_fdct32x32_sse2, ::testing::Values(make_tuple(&vpx_fdct32x32_sse2,
&vpx_idct32x32_1024_add_sse2, 0, VPX_BITS_8), &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 #endif // HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
#if 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, SSE2, Trans32x32Test,
::testing::Values( ::testing::Values(
make_tuple(&vpx_highbd_fdct32x32_sse2, &idct32x32_10, 0, VPX_BITS_10), 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 #endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
#if HAVE_AVX2 && !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, AVX2, Trans32x32Test,
::testing::Values(make_tuple(&vpx_fdct32x32_avx2, ::testing::Values(make_tuple(&vpx_fdct32x32_avx2,
&vpx_idct32x32_1024_add_sse2, 0, VPX_BITS_8), &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 #endif // HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
#if HAVE_MSA && !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, MSA, Trans32x32Test,
::testing::Values(make_tuple(&vpx_fdct32x32_msa, ::testing::Values(make_tuple(&vpx_fdct32x32_msa,
&vpx_idct32x32_1024_add_msa, 0, VPX_BITS_8), &vpx_idct32x32_1024_add_msa, 0, VPX_BITS_8),
@@ -389,11 +389,20 @@ INSTANTIATE_TEST_CASE_P(
#endif // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #endif // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
#if HAVE_VSX && !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, VSX, Trans32x32Test,
::testing::Values(make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_vsx, ::testing::Values(make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_vsx,
0, VPX_BITS_8), 0, VPX_BITS_8),
make_tuple(&vpx_fdct32x32_rd_vsx, make_tuple(&vpx_fdct32x32_rd_vsx,
&vpx_idct32x32_1024_add_vsx, 1, VPX_BITS_8))); &vpx_idct32x32_1024_add_vsx, 1, VPX_BITS_8)));
#endif // HAVE_VSX && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #endif // HAVE_VSX && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
#if HAVE_LSX && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_SUITE_P(
LSX, Trans32x32Test,
::testing::Values(make_tuple(&vpx_fdct32x32_lsx,
&vpx_idct32x32_1024_add_lsx, 0, VPX_BITS_8),
make_tuple(&vpx_fdct32x32_rd_lsx,
&vpx_idct32x32_1024_add_lsx, 1, VPX_BITS_8)));
#endif // HAVE_LSX && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
} // namespace } // namespace
+11 -11
View File
@@ -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) { tran_low_t partial_fdct_ref(const Buffer<int16_t> &in, int size) {
int64_t sum = 0; int64_t sum = 0;
if (in.TopLeftPixel() != NULL) { if (in.TopLeftPixel() != nullptr) {
for (int y = 0; y < size; ++y) { for (int y = 0; y < size; ++y) {
for (int x = 0; x < size; ++x) { for (int x = 0; x < size; ++x) {
sum += in.TopLeftPixel()[y * in.stride() + 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); Buffer<tran_low_t> output_block = Buffer<tran_low_t>(size_, size_, 0, 16);
ASSERT_TRUE(output_block.Init()); ASSERT_TRUE(output_block.Init());
if (output_block.TopLeftPixel() != NULL) { if (output_block.TopLeftPixel() != nullptr) {
for (int i = 0; i < 100; ++i) { for (int i = 0; i < 100; ++i) {
if (i == 0) { if (i == 0) {
input_block.Set(maxvalue); input_block.Set(maxvalue);
@@ -111,7 +111,7 @@ class PartialFdctTest : public ::testing::TestWithParam<PartialFdctParam> {
TEST_P(PartialFdctTest, PartialFdctTest) { RunTest(); } TEST_P(PartialFdctTest, PartialFdctTest) { RunTest(); }
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
C, PartialFdctTest, C, PartialFdctTest,
::testing::Values(make_tuple(&vpx_highbd_fdct32x32_1_c, 32, VPX_BITS_12), ::testing::Values(make_tuple(&vpx_highbd_fdct32x32_1_c, 32, VPX_BITS_12),
make_tuple(&vpx_highbd_fdct32x32_1_c, 32, VPX_BITS_10), 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_fdct8x8_1_c, 8, VPX_BITS_8),
make_tuple(&vpx_fdct4x4_1_c, 4, VPX_BITS_8))); make_tuple(&vpx_fdct4x4_1_c, 4, VPX_BITS_8)));
#else #else
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
C, PartialFdctTest, C, PartialFdctTest,
::testing::Values(make_tuple(&vpx_fdct32x32_1_c, 32, VPX_BITS_8), ::testing::Values(make_tuple(&vpx_fdct32x32_1_c, 32, VPX_BITS_8),
make_tuple(&vpx_fdct16x16_1_c, 16, 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 #endif // CONFIG_VP9_HIGHBITDEPTH
#if HAVE_SSE2 #if HAVE_SSE2
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
SSE2, PartialFdctTest, SSE2, PartialFdctTest,
::testing::Values(make_tuple(&vpx_fdct32x32_1_sse2, 32, VPX_BITS_8), ::testing::Values(make_tuple(&vpx_fdct32x32_1_sse2, 32, VPX_BITS_8),
make_tuple(&vpx_fdct16x16_1_sse2, 16, 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 HAVE_NEON
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
NEON, PartialFdctTest, NEON, PartialFdctTest,
::testing::Values(make_tuple(&vpx_fdct32x32_1_neon, 32, VPX_BITS_8), ::testing::Values(make_tuple(&vpx_fdct32x32_1_neon, 32, VPX_BITS_8),
make_tuple(&vpx_fdct16x16_1_neon, 16, 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_fdct8x8_1_neon, 8, VPX_BITS_8),
make_tuple(&vpx_fdct4x4_1_neon, 4, VPX_BITS_8))); make_tuple(&vpx_fdct4x4_1_neon, 4, VPX_BITS_8)));
#else #else
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
NEON, PartialFdctTest, NEON, PartialFdctTest,
::testing::Values(make_tuple(&vpx_fdct32x32_1_neon, 32, VPX_BITS_8), ::testing::Values(make_tuple(&vpx_fdct32x32_1_neon, 32, VPX_BITS_8),
make_tuple(&vpx_fdct16x16_1_neon, 16, 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 HAVE_MSA
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P(MSA, PartialFdctTest, INSTANTIATE_TEST_SUITE_P(MSA, PartialFdctTest,
::testing::Values(make_tuple(&vpx_fdct8x8_1_msa, 8, ::testing::Values(make_tuple(&vpx_fdct8x8_1_msa, 8,
VPX_BITS_8))); VPX_BITS_8)));
#else // !CONFIG_VP9_HIGHBITDEPTH #else // !CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
MSA, PartialFdctTest, MSA, PartialFdctTest,
::testing::Values(make_tuple(&vpx_fdct32x32_1_msa, 32, VPX_BITS_8), ::testing::Values(make_tuple(&vpx_fdct32x32_1_msa, 32, VPX_BITS_8),
make_tuple(&vpx_fdct16x16_1_msa, 16, VPX_BITS_8), make_tuple(&vpx_fdct16x16_1_msa, 16, VPX_BITS_8),
+69 -48
View File
@@ -160,17 +160,17 @@ class TransTestBase : public ::testing::TestWithParam<DctParam> {
src_ = reinterpret_cast<uint8_t *>( src_ = reinterpret_cast<uint8_t *>(
vpx_memalign(16, pixel_size_ * block_size_)); vpx_memalign(16, pixel_size_ * block_size_));
ASSERT_TRUE(src_ != NULL); ASSERT_NE(src_, nullptr);
dst_ = reinterpret_cast<uint8_t *>( dst_ = reinterpret_cast<uint8_t *>(
vpx_memalign(16, pixel_size_ * block_size_)); vpx_memalign(16, pixel_size_ * block_size_));
ASSERT_TRUE(dst_ != NULL); ASSERT_NE(dst_, nullptr);
} }
virtual void TearDown() { virtual void TearDown() {
vpx_free(src_); vpx_free(src_);
src_ = NULL; src_ = nullptr;
vpx_free(dst_); vpx_free(dst_);
dst_ = NULL; dst_ = nullptr;
libvpx_test::ClearSystemState(); libvpx_test::ClearSystemState();
} }
@@ -211,7 +211,7 @@ class TransTestBase : public ::testing::TestWithParam<DctParam> {
Buffer<int16_t> test_input_block = Buffer<int16_t> test_input_block =
Buffer<int16_t>(size_, size_, 8, size_ == 4 ? 0 : 16); Buffer<int16_t>(size_, size_, 8, size_ == 4 ? 0 : 16);
ASSERT_TRUE(test_input_block.Init()); 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> test_temp_block =
Buffer<tran_low_t>(size_, size_, 0, 16); Buffer<tran_low_t>(size_, size_, 0, 16);
ASSERT_TRUE(test_temp_block.Init()); ASSERT_TRUE(test_temp_block.Init());
@@ -316,7 +316,7 @@ class TransTestBase : public ::testing::TestWithParam<DctParam> {
} else if (i == 1) { } else if (i == 1) {
input_extreme_block.Set(-max_pixel_value_); input_extreme_block.Set(-max_pixel_value_);
} else { } else {
ASSERT_TRUE(input_extreme_block.TopLeftPixel() != NULL); ASSERT_NE(input_extreme_block.TopLeftPixel(), nullptr);
for (int h = 0; h < size_; ++h) { for (int h = 0; h < size_; ++h) {
for (int w = 0; w < size_; ++w) { for (int w = 0; w < size_; ++w) {
input_extreme_block input_extreme_block
@@ -331,7 +331,7 @@ class TransTestBase : public ::testing::TestWithParam<DctParam> {
// The minimum quant value is 4. // The minimum quant value is 4.
EXPECT_TRUE(output_block.CheckValues(output_ref_block)); 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 h = 0; h < size_; ++h) {
for (int w = 0; w < size_; ++w) { for (int w = 0; w < size_; ++w) {
EXPECT_GE( EXPECT_GE(
@@ -369,7 +369,7 @@ class TransTestBase : public ::testing::TestWithParam<DctParam> {
for (int i = 0; i < count_test_block; ++i) { for (int i = 0; i < count_test_block; ++i) {
InitMem(); InitMem();
ASSERT_TRUE(in.TopLeftPixel() != NULL); ASSERT_NE(in.TopLeftPixel(), nullptr);
// Initialize a test block with input range [-max_pixel_value_, // Initialize a test block with input range [-max_pixel_value_,
// max_pixel_value_]. // max_pixel_value_].
for (int h = 0; h < size_; ++h) { for (int h = 0; h < size_; ++h) {
@@ -473,7 +473,7 @@ static const FuncInfo dct_c_func_info[] = {
1 } 1 }
}; };
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
C, TransDCT, C, TransDCT,
::testing::Combine( ::testing::Combine(
::testing::Range(0, static_cast<int>(sizeof(dct_c_func_info) / ::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 } &idct_wrapper<vpx_idct32x32_1024_add_sse2>, 32, 1 }
}; };
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
SSE2, TransDCT, SSE2, TransDCT,
::testing::Combine( ::testing::Combine(
::testing::Range(0, static_cast<int>(sizeof(dct_sse2_func_info) / ::testing::Range(0, static_cast<int>(sizeof(dct_sse2_func_info) /
@@ -514,17 +514,17 @@ INSTANTIATE_TEST_CASE_P(
::testing::Values(VPX_BITS_8, VPX_BITS_10, VPX_BITS_12))); ::testing::Values(VPX_BITS_8, VPX_BITS_10, VPX_BITS_12)));
#endif // HAVE_SSE2 #endif // HAVE_SSE2
#if HAVE_SSSE3 && !CONFIG_VP9_HIGHBITDEPTH && ARCH_X86_64 #if HAVE_SSSE3 && !CONFIG_VP9_HIGHBITDEPTH && VPX_ARCH_X86_64
// vpx_fdct8x8_ssse3 is only available in 64 bit builds. // vpx_fdct8x8_ssse3 is only available in 64 bit builds.
static const FuncInfo dct_ssse3_func_info = { static const FuncInfo dct_ssse3_func_info = {
&fdct_wrapper<vpx_fdct8x8_ssse3>, &idct_wrapper<vpx_idct8x8_64_add_sse2>, 8, 1 &fdct_wrapper<vpx_fdct8x8_ssse3>, &idct_wrapper<vpx_idct8x8_64_add_sse2>, 8, 1
}; };
// TODO(johannkoenig): high bit depth fdct8x8. // TODO(johannkoenig): high bit depth fdct8x8.
INSTANTIATE_TEST_CASE_P(SSSE3, TransDCT, INSTANTIATE_TEST_SUITE_P(SSSE3, TransDCT,
::testing::Values(make_tuple(0, &dct_ssse3_func_info, 0, ::testing::Values(make_tuple(0, &dct_ssse3_func_info,
VPX_BITS_8))); 0, VPX_BITS_8)));
#endif // HAVE_SSSE3 && !CONFIG_VP9_HIGHBITDEPTH && ARCH_X86_64 #endif // HAVE_SSSE3 && !CONFIG_VP9_HIGHBITDEPTH && VPX_ARCH_X86_64
#if HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH #if HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH
static const FuncInfo dct_avx2_func_info = { static const FuncInfo dct_avx2_func_info = {
@@ -533,9 +533,9 @@ static const FuncInfo dct_avx2_func_info = {
}; };
// TODO(johannkoenig): high bit depth fdct32x32. // TODO(johannkoenig): high bit depth fdct32x32.
INSTANTIATE_TEST_CASE_P(AVX2, TransDCT, INSTANTIATE_TEST_SUITE_P(AVX2, TransDCT,
::testing::Values(make_tuple(0, &dct_avx2_func_info, 0, ::testing::Values(make_tuple(0, &dct_avx2_func_info, 0,
VPX_BITS_8))); VPX_BITS_8)));
#endif // HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH #endif // HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH
#if HAVE_NEON #if HAVE_NEON
@@ -550,7 +550,7 @@ static const FuncInfo dct_neon_func_info[4] = {
&idct_wrapper<vpx_idct32x32_1024_add_neon>, 32, 1 } &idct_wrapper<vpx_idct32x32_1024_add_neon>, 32, 1 }
}; };
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
NEON, TransDCT, NEON, TransDCT,
::testing::Combine(::testing::Range(0, 4), ::testing::Combine(::testing::Range(0, 4),
::testing::Values(dct_neon_func_info), ::testing::Values(dct_neon_func_info),
@@ -569,11 +569,11 @@ static const FuncInfo dct_msa_func_info[4] = {
32, 1 } 32, 1 }
}; };
INSTANTIATE_TEST_CASE_P(MSA, TransDCT, INSTANTIATE_TEST_SUITE_P(
::testing::Combine(::testing::Range(0, 4), MSA, TransDCT,
::testing::Values(dct_msa_func_info), ::testing::Combine(::testing::Range(0, 4),
::testing::Values(0), ::testing::Values(dct_msa_func_info),
::testing::Values(VPX_BITS_8))); ::testing::Values(0), ::testing::Values(VPX_BITS_8)));
#endif // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH #endif // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH
#if HAVE_VSX && !CONFIG_VP9_HIGHBITDEPTH #if HAVE_VSX && !CONFIG_VP9_HIGHBITDEPTH
@@ -581,11 +581,28 @@ static const FuncInfo dct_vsx_func_info = {
&fdct_wrapper<vpx_fdct4x4_c>, &idct_wrapper<vpx_idct4x4_16_add_vsx>, 4, 1 &fdct_wrapper<vpx_fdct4x4_c>, &idct_wrapper<vpx_idct4x4_16_add_vsx>, 4, 1
}; };
INSTANTIATE_TEST_CASE_P(VSX, TransDCT, INSTANTIATE_TEST_SUITE_P(VSX, TransDCT,
::testing::Values(make_tuple(0, &dct_vsx_func_info, 0, ::testing::Values(make_tuple(0, &dct_vsx_func_info, 0,
VPX_BITS_8))); VPX_BITS_8)));
#endif // HAVE_VSX && !CONFIG_VP9_HIGHBITDEPTH && #endif // HAVE_VSX && !CONFIG_VP9_HIGHBITDEPTH &&
#if HAVE_LSX && !CONFIG_VP9_HIGHBITDEPTH
static const FuncInfo dct_lsx_func_info[4] = {
{ &fdct_wrapper<vpx_fdct4x4_lsx>, &idct_wrapper<vpx_idct4x4_16_add_c>, 4, 1 },
{ &fdct_wrapper<vpx_fdct8x8_lsx>, &idct_wrapper<vpx_idct8x8_64_add_c>, 8, 1 },
{ &fdct_wrapper<vpx_fdct16x16_lsx>, &idct_wrapper<vpx_idct16x16_256_add_c>,
16, 1 },
{ &fdct_wrapper<vpx_fdct32x32_lsx>, &idct_wrapper<vpx_idct32x32_1024_add_lsx>,
32, 1 }
};
INSTANTIATE_TEST_SUITE_P(
LSX, TransDCT,
::testing::Combine(::testing::Range(0, 4),
::testing::Values(dct_lsx_func_info),
::testing::Values(0), ::testing::Values(VPX_BITS_8)));
#endif // HAVE_LSX && !CONFIG_VP9_HIGHBITDEPTH
#endif // !CONFIG_EMULATE_HARDWARE #endif // !CONFIG_EMULATE_HARDWARE
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
@@ -619,7 +636,7 @@ static const FuncInfo ht_c_func_info[] = {
{ &vp9_fht16x16_c, &iht_wrapper<vp9_iht16x16_256_add_c>, 16, 1 } { &vp9_fht16x16_c, &iht_wrapper<vp9_iht16x16_256_add_c>, 16, 1 }
}; };
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
C, TransHT, C, TransHT,
::testing::Combine( ::testing::Combine(
::testing::Range(0, static_cast<int>(sizeof(ht_c_func_info) / ::testing::Range(0, static_cast<int>(sizeof(ht_c_func_info) /
@@ -641,11 +658,14 @@ static const FuncInfo ht_neon_func_info[] = {
&highbd_iht_wrapper<vp9_highbd_iht16x16_256_add_neon>, 16, 2 }, &highbd_iht_wrapper<vp9_highbd_iht16x16_256_add_neon>, 16, 2 },
#endif #endif
{ &vp9_fht4x4_c, &iht_wrapper<vp9_iht4x4_16_add_neon>, 4, 1 }, { &vp9_fht4x4_c, &iht_wrapper<vp9_iht4x4_16_add_neon>, 4, 1 },
{ &vp9_fht4x4_neon, &iht_wrapper<vp9_iht4x4_16_add_neon>, 4, 1 },
{ &vp9_fht8x8_c, &iht_wrapper<vp9_iht8x8_64_add_neon>, 8, 1 }, { &vp9_fht8x8_c, &iht_wrapper<vp9_iht8x8_64_add_neon>, 8, 1 },
{ &vp9_fht16x16_c, &iht_wrapper<vp9_iht16x16_256_add_neon>, 16, 1 } { &vp9_fht8x8_neon, &iht_wrapper<vp9_iht8x8_64_add_neon>, 8, 1 },
{ &vp9_fht16x16_c, &iht_wrapper<vp9_iht16x16_256_add_neon>, 16, 1 },
{ &vp9_fht16x16_neon, &iht_wrapper<vp9_iht16x16_256_add_neon>, 16, 1 }
}; };
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
NEON, TransHT, NEON, TransHT,
::testing::Combine( ::testing::Combine(
::testing::Range(0, static_cast<int>(sizeof(ht_neon_func_info) / ::testing::Range(0, static_cast<int>(sizeof(ht_neon_func_info) /
@@ -662,11 +682,11 @@ static const FuncInfo ht_sse2_func_info[3] = {
{ &vp9_fht16x16_sse2, &iht_wrapper<vp9_iht16x16_256_add_sse2>, 16, 1 } { &vp9_fht16x16_sse2, &iht_wrapper<vp9_iht16x16_256_add_sse2>, 16, 1 }
}; };
INSTANTIATE_TEST_CASE_P(SSE2, TransHT, INSTANTIATE_TEST_SUITE_P(
::testing::Combine(::testing::Range(0, 3), SSE2, TransHT,
::testing::Values(ht_sse2_func_info), ::testing::Combine(::testing::Range(0, 3),
::testing::Range(0, 4), ::testing::Values(ht_sse2_func_info),
::testing::Values(VPX_BITS_8))); ::testing::Range(0, 4), ::testing::Values(VPX_BITS_8)));
#endif // HAVE_SSE2 #endif // HAVE_SSE2
#if HAVE_SSE4_1 && CONFIG_VP9_HIGHBITDEPTH #if HAVE_SSE4_1 && CONFIG_VP9_HIGHBITDEPTH
@@ -679,7 +699,7 @@ static const FuncInfo ht_sse4_1_func_info[3] = {
&highbd_iht_wrapper<vp9_highbd_iht16x16_256_add_sse4_1>, 16, 2 } &highbd_iht_wrapper<vp9_highbd_iht16x16_256_add_sse4_1>, 16, 2 }
}; };
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
SSE4_1, TransHT, SSE4_1, TransHT,
::testing::Combine(::testing::Range(0, 3), ::testing::Combine(::testing::Range(0, 3),
::testing::Values(ht_sse4_1_func_info), ::testing::Values(ht_sse4_1_func_info),
@@ -695,11 +715,11 @@ static const FuncInfo ht_vsx_func_info[3] = {
{ &vp9_fht16x16_c, &iht_wrapper<vp9_iht16x16_256_add_vsx>, 16, 1 } { &vp9_fht16x16_c, &iht_wrapper<vp9_iht16x16_256_add_vsx>, 16, 1 }
}; };
INSTANTIATE_TEST_CASE_P(VSX, TransHT, INSTANTIATE_TEST_SUITE_P(VSX, TransHT,
::testing::Combine(::testing::Range(0, 3), ::testing::Combine(::testing::Range(0, 3),
::testing::Values(ht_vsx_func_info), ::testing::Values(ht_vsx_func_info),
::testing::Range(0, 4), ::testing::Range(0, 4),
::testing::Values(VPX_BITS_8))); ::testing::Values(VPX_BITS_8)));
#endif // HAVE_VSX #endif // HAVE_VSX
#endif // !CONFIG_EMULATE_HARDWARE #endif // !CONFIG_EMULATE_HARDWARE
@@ -726,7 +746,7 @@ static const FuncInfo wht_c_func_info[] = {
{ &fdct_wrapper<vp9_fwht4x4_c>, &idct_wrapper<vpx_iwht4x4_16_add_c>, 4, 1 } { &fdct_wrapper<vp9_fwht4x4_c>, &idct_wrapper<vpx_iwht4x4_16_add_c>, 4, 1 }
}; };
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
C, TransWHT, C, TransWHT,
::testing::Combine( ::testing::Combine(
::testing::Range(0, static_cast<int>(sizeof(wht_c_func_info) / ::testing::Range(0, static_cast<int>(sizeof(wht_c_func_info) /
@@ -739,9 +759,9 @@ static const FuncInfo wht_sse2_func_info = {
&fdct_wrapper<vp9_fwht4x4_sse2>, &idct_wrapper<vpx_iwht4x4_16_add_sse2>, 4, 1 &fdct_wrapper<vp9_fwht4x4_sse2>, &idct_wrapper<vpx_iwht4x4_16_add_sse2>, 4, 1
}; };
INSTANTIATE_TEST_CASE_P(SSE2, TransWHT, INSTANTIATE_TEST_SUITE_P(SSE2, TransWHT,
::testing::Values(make_tuple(0, &wht_sse2_func_info, 0, ::testing::Values(make_tuple(0, &wht_sse2_func_info, 0,
VPX_BITS_8))); VPX_BITS_8)));
#endif // HAVE_SSE2 && !CONFIG_EMULATE_HARDWARE #endif // HAVE_SSE2 && !CONFIG_EMULATE_HARDWARE
#if HAVE_VSX && !CONFIG_EMULATE_HARDWARE && !CONFIG_VP9_HIGHBITDEPTH #if HAVE_VSX && !CONFIG_EMULATE_HARDWARE && !CONFIG_VP9_HIGHBITDEPTH
@@ -749,8 +769,9 @@ static const FuncInfo wht_vsx_func_info = {
&fdct_wrapper<vp9_fwht4x4_c>, &idct_wrapper<vpx_iwht4x4_16_add_vsx>, 4, 1 &fdct_wrapper<vp9_fwht4x4_c>, &idct_wrapper<vpx_iwht4x4_16_add_vsx>, 4, 1
}; };
INSTANTIATE_TEST_CASE_P(VSX, TransWHT, INSTANTIATE_TEST_SUITE_P(VSX, TransWHT,
::testing::Values(make_tuple(0, &wht_vsx_func_info, 0, ::testing::Values(make_tuple(0, &wht_vsx_func_info, 0,
VPX_BITS_8))); VPX_BITS_8)));
#endif // HAVE_VSX && !CONFIG_EMULATE_HARDWARE #endif // HAVE_VSX && !CONFIG_EMULATE_HARDWARE
} // namespace } // namespace
+39 -32
View File
@@ -31,27 +31,33 @@ TEST(DecodeAPI, InvalidParams) {
uint8_t buf[1] = { 0 }; uint8_t buf[1] = { 0 };
vpx_codec_ctx_t dec; vpx_codec_ctx_t dec;
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, vpx_codec_dec_init(NULL, NULL, NULL, 0)); EXPECT_EQ(vpx_codec_dec_init(nullptr, nullptr, nullptr, 0),
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, vpx_codec_dec_init(&dec, NULL, NULL, 0)); VPX_CODEC_INVALID_PARAM);
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, vpx_codec_decode(NULL, NULL, 0, NULL, 0)); EXPECT_EQ(vpx_codec_dec_init(&dec, nullptr, nullptr, 0),
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, vpx_codec_decode(NULL, buf, 0, NULL, 0)); VPX_CODEC_INVALID_PARAM);
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, EXPECT_EQ(vpx_codec_decode(nullptr, nullptr, 0, nullptr, 0),
vpx_codec_decode(NULL, buf, NELEMENTS(buf), NULL, 0)); VPX_CODEC_INVALID_PARAM);
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, EXPECT_EQ(vpx_codec_decode(nullptr, buf, 0, nullptr, 0),
vpx_codec_decode(NULL, NULL, NELEMENTS(buf), NULL, 0)); VPX_CODEC_INVALID_PARAM);
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, vpx_codec_destroy(NULL)); EXPECT_EQ(vpx_codec_decode(nullptr, buf, NELEMENTS(buf), nullptr, 0),
EXPECT_TRUE(vpx_codec_error(NULL) != NULL); 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) { for (int i = 0; i < NELEMENTS(kCodecs); ++i) {
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, 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, 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, EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
vpx_codec_decode(&dec, NULL, NELEMENTS(buf), NULL, 0)); vpx_codec_decode(&dec, nullptr, NELEMENTS(buf), nullptr, 0));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, vpx_codec_decode(&dec, buf, 0, NULL, 0)); EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
vpx_codec_decode(&dec, buf, 0, nullptr, 0));
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&dec)); EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&dec));
} }
@@ -62,11 +68,12 @@ TEST(DecodeAPI, OptionalParams) {
vpx_codec_ctx_t dec; vpx_codec_ctx_t dec;
#if CONFIG_ERROR_CONCEALMENT #if CONFIG_ERROR_CONCEALMENT
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_dec_init(&dec, &vpx_codec_vp8_dx_algo, NULL, EXPECT_EQ(VPX_CODEC_OK,
VPX_CODEC_USE_ERROR_CONCEALMENT)); vpx_codec_dec_init(&dec, &vpx_codec_vp8_dx_algo, nullptr,
VPX_CODEC_USE_ERROR_CONCEALMENT));
#else #else
EXPECT_EQ(VPX_CODEC_INCAPABLE, 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)); VPX_CODEC_USE_ERROR_CONCEALMENT));
#endif // CONFIG_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; default: EXPECT_EQ(VPX_CODEC_OK, res) << kControls[i]; break;
} }
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, 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; vp9_ref_frame_t ref;
ref.idx = 0; ref.idx = 0;
EXPECT_EQ(VPX_CODEC_ERROR, vpx_codec_control(dec, VP9_GET_REFERENCE, &ref)); EXPECT_EQ(VPX_CODEC_ERROR, vpx_codec_control(dec, VP9_GET_REFERENCE, &ref));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, 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; vpx_ref_frame_t ref_copy;
const int width = 352; const int width = 352;
const int height = 288; const int height = 288;
ASSERT_TRUE( EXPECT_NE(vpx_img_alloc(&ref_copy.img, VPX_IMG_FMT_I420, width, height, 1),
vpx_img_alloc(&ref_copy.img, VPX_IMG_FMT_I420, width, height, 1) != NULL); nullptr);
ref_copy.frame_type = VP8_LAST_FRAME; ref_copy.frame_type = VP8_LAST_FRAME;
EXPECT_EQ(VPX_CODEC_ERROR, EXPECT_EQ(VPX_CODEC_ERROR,
vpx_codec_control(dec, VP8_COPY_REFERENCE, &ref_copy)); vpx_codec_control(dec, VP8_COPY_REFERENCE, &ref_copy));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, 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); vpx_img_free(&ref_copy.img);
} }
@@ -122,17 +129,17 @@ TEST(DecodeAPI, Vp9InvalidDecode) {
ASSERT_TRUE(!HasFailure()); ASSERT_TRUE(!HasFailure());
vpx_codec_ctx_t dec; 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()); const uint32_t frame_size = static_cast<uint32_t>(video.frame_size());
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
EXPECT_EQ(VPX_CODEC_MEM_ERROR, 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 #else
EXPECT_EQ(VPX_CODEC_UNSUP_BITSTREAM, 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 #endif
vpx_codec_iter_t iter = NULL; vpx_codec_iter_t iter = nullptr;
EXPECT_EQ(NULL, vpx_codec_get_frame(&dec, &iter)); EXPECT_EQ(nullptr, vpx_codec_get_frame(&dec, &iter));
TestVp9Controls(&dec); TestVp9Controls(&dec);
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&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. // to decoder_peek_si_internal on frames of size < 8.
if (data_sz >= 8) { if (data_sz >= 8) {
vpx_codec_ctx_t dec; 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 EXPECT_EQ((data_sz < peek_size) ? VPX_CODEC_UNSUP_BITSTREAM
: VPX_CODEC_CORRUPT_FRAME, : VPX_CODEC_CORRUPT_FRAME,
vpx_codec_decode(&dec, data, data_sz, NULL, 0)); vpx_codec_decode(&dec, data, data_sz, nullptr, 0));
vpx_codec_iter_t iter = NULL; vpx_codec_iter_t iter = nullptr;
EXPECT_EQ(NULL, vpx_codec_get_frame(&dec, &iter)); EXPECT_EQ(nullptr, vpx_codec_get_frame(&dec, &iter));
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&dec)); EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&dec));
} }
+2 -2
View File
@@ -87,14 +87,14 @@ TEST_P(DecodeCorruptedFrameTest, DecodeCorruptedFrame) {
} }
#if CONFIG_VP9 #if CONFIG_VP9
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
VP9, DecodeCorruptedFrameTest, VP9, DecodeCorruptedFrameTest,
::testing::Values( ::testing::Values(
static_cast<const libvpx_test::CodecFactory *>(&libvpx_test::kVP9))); static_cast<const libvpx_test::CodecFactory *>(&libvpx_test::kVP9)));
#endif // CONFIG_VP9 #endif // CONFIG_VP9
#if CONFIG_VP8 #if CONFIG_VP8
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
VP8, DecodeCorruptedFrameTest, VP8, DecodeCorruptedFrameTest,
::testing::Values( ::testing::Values(
static_cast<const libvpx_test::CodecFactory *>(&libvpx_test::kVP8))); static_cast<const libvpx_test::CodecFactory *>(&libvpx_test::kVP8)));
+9 -9
View File
@@ -87,7 +87,7 @@ TEST_P(DecodePerfTest, PerfTest) {
vpx_usec_timer t; vpx_usec_timer t;
vpx_usec_timer_start(&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()); decoder.DecodeFrame(video.cxdata(), video.frame_size());
} }
@@ -107,8 +107,8 @@ TEST_P(DecodePerfTest, PerfTest) {
printf("}\n"); printf("}\n");
} }
INSTANTIATE_TEST_CASE_P(VP9, DecodePerfTest, INSTANTIATE_TEST_SUITE_P(VP9, DecodePerfTest,
::testing::ValuesIn(kVP9DecodePerfVectors)); ::testing::ValuesIn(kVP9DecodePerfVectors));
class VP9NewEncodeDecodePerfTest class VP9NewEncodeDecodePerfTest
: public ::libvpx_test::EncoderTest, : public ::libvpx_test::EncoderTest,
@@ -150,16 +150,16 @@ class VP9NewEncodeDecodePerfTest
const std::string data_path = getenv("LIBVPX_TEST_DATA_PATH"); const std::string data_path = getenv("LIBVPX_TEST_DATA_PATH");
const std::string path_to_source = data_path + "/" + kNewEncodeOutputFile; const std::string path_to_source = data_path + "/" + kNewEncodeOutputFile;
outfile_ = fopen(path_to_source.c_str(), "wb"); outfile_ = fopen(path_to_source.c_str(), "wb");
ASSERT_TRUE(outfile_ != NULL); ASSERT_NE(outfile_, nullptr);
} }
virtual void EndPassHook() { virtual void EndPassHook() {
if (outfile_ != NULL) { if (outfile_ != nullptr) {
if (!fseek(outfile_, 0, SEEK_SET)) { if (!fseek(outfile_, 0, SEEK_SET)) {
ivf_write_file_header(outfile_, &cfg_, VP9_FOURCC, out_frames_); ivf_write_file_header(outfile_, &cfg_, VP9_FOURCC, out_frames_);
} }
fclose(outfile_); fclose(outfile_);
outfile_ = NULL; outfile_ = nullptr;
} }
} }
@@ -236,7 +236,7 @@ TEST_P(VP9NewEncodeDecodePerfTest, PerfTest) {
vpx_usec_timer t; vpx_usec_timer t;
vpx_usec_timer_start(&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()) { decode_video.Next()) {
decoder.DecodeFrame(decode_video.cxdata(), decode_video.frame_size()); decoder.DecodeFrame(decode_video.cxdata(), decode_video.frame_size());
} }
@@ -258,6 +258,6 @@ TEST_P(VP9NewEncodeDecodePerfTest, PerfTest) {
printf("}\n"); printf("}\n");
} }
VP9_INSTANTIATE_TEST_CASE(VP9NewEncodeDecodePerfTest, VP9_INSTANTIATE_TEST_SUITE(VP9NewEncodeDecodePerfTest,
::testing::Values(::libvpx_test::kTwoPassGood)); ::testing::Values(::libvpx_test::kTwoPassGood));
} // namespace } // namespace
+5 -5
View File
@@ -56,7 +56,7 @@ TEST_P(DecodeSvcTest, DecodeSvcTestUpToSpatialLayer0) {
const std::string filename = GET_PARAM(1); const std::string filename = GET_PARAM(1);
std::unique_ptr<libvpx_test::CompressedVideoSource> video; std::unique_ptr<libvpx_test::CompressedVideoSource> video;
video.reset(new libvpx_test::IVFVideoSource(filename)); video.reset(new libvpx_test::IVFVideoSource(filename));
ASSERT_TRUE(video.get() != NULL); ASSERT_NE(video.get(), nullptr);
video->Init(); video->Init();
total_frames_ = 0; total_frames_ = 0;
spatial_layer_ = 0; spatial_layer_ = 0;
@@ -73,7 +73,7 @@ TEST_P(DecodeSvcTest, DecodeSvcTestUpToSpatialLayer1) {
const std::string filename = GET_PARAM(1); const std::string filename = GET_PARAM(1);
std::unique_ptr<libvpx_test::CompressedVideoSource> video; std::unique_ptr<libvpx_test::CompressedVideoSource> video;
video.reset(new libvpx_test::IVFVideoSource(filename)); video.reset(new libvpx_test::IVFVideoSource(filename));
ASSERT_TRUE(video.get() != NULL); ASSERT_NE(video.get(), nullptr);
video->Init(); video->Init();
total_frames_ = 0; total_frames_ = 0;
spatial_layer_ = 1; spatial_layer_ = 1;
@@ -90,7 +90,7 @@ TEST_P(DecodeSvcTest, DecodeSvcTestUpToSpatialLayer2) {
const std::string filename = GET_PARAM(1); const std::string filename = GET_PARAM(1);
std::unique_ptr<libvpx_test::CompressedVideoSource> video; std::unique_ptr<libvpx_test::CompressedVideoSource> video;
video.reset(new libvpx_test::IVFVideoSource(filename)); video.reset(new libvpx_test::IVFVideoSource(filename));
ASSERT_TRUE(video.get() != NULL); ASSERT_NE(video.get(), nullptr);
video->Init(); video->Init();
total_frames_ = 0; total_frames_ = 0;
spatial_layer_ = 2; spatial_layer_ = 2;
@@ -108,7 +108,7 @@ TEST_P(DecodeSvcTest, DecodeSvcTestUpToSpatialLayer10) {
const std::string filename = GET_PARAM(1); const std::string filename = GET_PARAM(1);
std::unique_ptr<libvpx_test::CompressedVideoSource> video; std::unique_ptr<libvpx_test::CompressedVideoSource> video;
video.reset(new libvpx_test::IVFVideoSource(filename)); video.reset(new libvpx_test::IVFVideoSource(filename));
ASSERT_TRUE(video.get() != NULL); ASSERT_NE(video.get(), nullptr);
video->Init(); video->Init();
total_frames_ = 0; total_frames_ = 0;
spatial_layer_ = 10; spatial_layer_ = 10;
@@ -118,7 +118,7 @@ TEST_P(DecodeSvcTest, DecodeSvcTestUpToSpatialLayer10) {
ASSERT_EQ(total_frames_, kNumFrames); ASSERT_EQ(total_frames_, kNumFrames);
} }
VP9_INSTANTIATE_TEST_CASE( VP9_INSTANTIATE_TEST_SUITE(
DecodeSvcTest, ::testing::ValuesIn(libvpx_test::kVP9TestVectorsSvc, DecodeSvcTest, ::testing::ValuesIn(libvpx_test::kVP9TestVectorsSvc,
libvpx_test::kVP9TestVectorsSvc + libvpx_test::kVP9TestVectorsSvc +
libvpx_test::kNumVP9TestVectorsSvc)); libvpx_test::kNumVP9TestVectorsSvc));
+5 -5
View File
@@ -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) { 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, 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, void DecoderTest::RunLoop(CompressedVideoSource *video,
const vpx_codec_dec_cfg_t &dec_cfg) { const vpx_codec_dec_cfg_t &dec_cfg) {
Decoder *const decoder = codec_->CreateDecoder(dec_cfg, flags_); Decoder *const decoder = codec_->CreateDecoder(dec_cfg, flags_);
ASSERT_TRUE(decoder != NULL); ASSERT_NE(decoder, nullptr);
bool end_of_file = false; bool end_of_file = false;
// Decode frames. // Decode frames.
@@ -78,7 +78,7 @@ void DecoderTest::RunLoop(CompressedVideoSource *video,
vpx_codec_stream_info_t stream_info; vpx_codec_stream_info_t stream_info;
stream_info.sz = sizeof(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( const vpx_codec_err_t res_peek = decoder->PeekStream(
video->cxdata(), video->frame_size(), &stream_info); video->cxdata(), video->frame_size(), &stream_info);
HandlePeekResult(decoder, video, res_peek); HandlePeekResult(decoder, video, res_peek);
@@ -89,13 +89,13 @@ void DecoderTest::RunLoop(CompressedVideoSource *video,
if (!HandleDecodeResult(res_dec, *video, decoder)) break; if (!HandleDecodeResult(res_dec, *video, decoder)) break;
} else { } else {
// Signal end of the file to the decoder. // 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(); ASSERT_EQ(VPX_CODEC_OK, res_dec) << decoder->DecodeError();
end_of_file = true; end_of_file = true;
} }
DxDataIterator dec_iter = decoder->GetDxData(); DxDataIterator dec_iter = decoder->GetDxData();
const vpx_image_t *img = NULL; const vpx_image_t *img = nullptr;
// Get decompressed data // Get decompressed data
while (!::testing::Test::HasFailure() && (img = dec_iter.Next())) { while (!::testing::Test::HasFailure() && (img = dec_iter.Next())) {
+1 -1
View File
@@ -24,7 +24,7 @@ class CompressedVideoSource;
class DxDataIterator { class DxDataIterator {
public: public:
explicit DxDataIterator(vpx_codec_ctx_t *decoder) explicit DxDataIterator(vpx_codec_ctx_t *decoder)
: decoder_(decoder), iter_(NULL) {} : decoder_(decoder), iter_(nullptr) {}
const vpx_image_t *Next() { return vpx_codec_get_frame(decoder_, &iter_); } const vpx_image_t *Next() { return vpx_codec_get_frame(decoder_, &iter_); }
+1 -1
View File
@@ -40,7 +40,7 @@ decode_to_md5() {
fi fi
eval "${VPX_TEST_PREFIX}" "${decoder}" "${input_file}" "${output_file}" \ eval "${VPX_TEST_PREFIX}" "${decoder}" "${input_file}" "${output_file}" \
${devnull} ${devnull} || return 1
[ -e "${output_file}" ] || return 1 [ -e "${output_file}" ] || return 1
+5 -5
View File
@@ -40,7 +40,7 @@ decode_with_drops() {
fi fi
eval "${VPX_TEST_PREFIX}" "${decoder}" "${input_file}" "${output_file}" \ eval "${VPX_TEST_PREFIX}" "${decoder}" "${input_file}" "${output_file}" \
"${drop_mode}" ${devnull} "${drop_mode}" ${devnull} || return 1
[ -e "${output_file}" ] || return 1 [ -e "${output_file}" ] || return 1
} }
@@ -52,10 +52,10 @@ decode_with_drops() {
decode_with_drops_vp8() { decode_with_drops_vp8() {
if [ "$(vp8_decode_available)" = "yes" ]; then if [ "$(vp8_decode_available)" = "yes" ]; then
# Test sequence mode: Drop frames 2-28. # 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. # 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 fi
} }
@@ -66,10 +66,10 @@ decode_with_drops_vp8() {
decode_with_drops_vp9() { decode_with_drops_vp9() {
if [ "$(vp9_decode_available)" = "yes" ]; then if [ "$(vp9_decode_available)" = "yes" ]; then
# Test sequence mode: Drop frames 2-28. # 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. # 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 fi
} }
+205 -37
View File
@@ -8,25 +8,35 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#include <climits>
#include <cstring>
#include <initializer_list>
#include "third_party/googletest/src/include/gtest/gtest.h" #include "third_party/googletest/src/include/gtest/gtest.h"
#include "./vpx_config.h" #include "./vpx_config.h"
#include "test/video_source.h"
#include "vpx/vp8cx.h" #include "vpx/vp8cx.h"
#include "vpx/vpx_encoder.h" #include "vpx/vpx_encoder.h"
namespace { namespace {
#define NELEMENTS(x) static_cast<int>(sizeof(x) / sizeof(x[0])) const vpx_codec_iface_t *kCodecIfaces[] = {
TEST(EncodeAPI, InvalidParams) {
static const vpx_codec_iface_t *kCodecs[] = {
#if CONFIG_VP8_ENCODER #if CONFIG_VP8_ENCODER
&vpx_codec_vp8_cx_algo, &vpx_codec_vp8_cx_algo,
#endif #endif
#if CONFIG_VP9_ENCODER #if CONFIG_VP9_ENCODER
&vpx_codec_vp9_cx_algo, &vpx_codec_vp9_cx_algo,
#endif #endif
}; };
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) {
uint8_t buf[1] = { 0 }; uint8_t buf[1] = { 0 };
vpx_image_t img; vpx_image_t img;
vpx_codec_ctx_t enc; vpx_codec_ctx_t enc;
@@ -34,29 +44,33 @@ TEST(EncodeAPI, InvalidParams) {
EXPECT_EQ(&img, vpx_img_wrap(&img, VPX_IMG_FMT_I420, 1, 1, 1, buf)); 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, 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, EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
vpx_codec_enc_config_default(NULL, &cfg, 0)); vpx_codec_enc_init(&enc, nullptr, nullptr, 0));
EXPECT_TRUE(vpx_codec_error(NULL) != NULL); 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) { for (const auto *iface : kCodecIfaces) {
SCOPED_TRACE(vpx_codec_iface_name(kCodecs[i])); SCOPED_TRACE(vpx_codec_iface_name(iface));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
vpx_codec_enc_init(NULL, kCodecs[i], NULL, 0)); vpx_codec_enc_init(nullptr, iface, nullptr, 0));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
vpx_codec_enc_init(&enc, kCodecs[i], NULL, 0)); vpx_codec_enc_init(&enc, iface, nullptr, 0));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
vpx_codec_enc_config_default(kCodecs[i], &cfg, 1)); vpx_codec_enc_config_default(iface, &cfg, 1));
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_enc_config_default(kCodecs[i], &cfg, 0)); EXPECT_EQ(VPX_CODEC_OK, vpx_codec_enc_config_default(iface, &cfg, 0));
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_enc_init(&enc, kCodecs[i], &cfg, 0)); EXPECT_EQ(VPX_CODEC_OK, vpx_codec_enc_init(&enc, iface, &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)); EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&enc));
} }
@@ -111,14 +125,6 @@ TEST(EncodeAPI, ImageSizeSetting) {
// (ts_target_bitrate[]) to 0 for both layers. This should fail independent of // (ts_target_bitrate[]) to 0 for both layers. This should fail independent of
// CONFIG_MULTI_RES_ENCODING. // CONFIG_MULTI_RES_ENCODING.
TEST(EncodeAPI, MultiResEncode) { TEST(EncodeAPI, MultiResEncode) {
static const vpx_codec_iface_t *kCodecs[] = {
#if CONFIG_VP8_ENCODER
&vpx_codec_vp8_cx_algo,
#endif
#if CONFIG_VP9_ENCODER
&vpx_codec_vp9_cx_algo,
#endif
};
const int width = 1280; const int width = 1280;
const int height = 720; const int height = 720;
const int width_down = width / 2; const int width_down = width / 2;
@@ -126,8 +132,7 @@ TEST(EncodeAPI, MultiResEncode) {
const int target_bitrate = 1000; const int target_bitrate = 1000;
const int framerate = 30; const int framerate = 30;
for (int c = 0; c < NELEMENTS(kCodecs); ++c) { for (const auto *iface : kCodecIfaces) {
const vpx_codec_iface_t *const iface = kCodecs[c];
vpx_codec_ctx_t enc[2]; vpx_codec_ctx_t enc[2];
vpx_codec_enc_cfg_t cfg[2]; vpx_codec_enc_cfg_t cfg[2];
vpx_rational_t dsf[2] = { { 2, 1 }, { 2, 1 } }; vpx_rational_t dsf[2] = { { 2, 1 }, { 2, 1 } };
@@ -180,10 +185,7 @@ TEST(EncodeAPI, MultiResEncode) {
} }
// VP9 should report incapable, VP8 invalid for all configurations. // VP9 should report incapable, VP8 invalid for all configurations.
const char kVP9Name[] = "WebM Project VP9"; EXPECT_EQ(IsVP9(iface) ? VPX_CODEC_INCAPABLE : VPX_CODEC_INVALID_PARAM,
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,
vpx_codec_enc_init_multi(&enc[0], iface, &cfg[0], 2, 0, &dsf[0])); vpx_codec_enc_init_multi(&enc[0], iface, &cfg[0], 2, 0, &dsf[0]));
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
@@ -192,4 +194,170 @@ 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);
}
}
void InitCodec(const vpx_codec_iface_t &iface, int width, int height,
vpx_codec_ctx_t *enc, vpx_codec_enc_cfg_t *cfg) {
ASSERT_EQ(vpx_codec_enc_config_default(&iface, cfg, 0), VPX_CODEC_OK);
cfg->g_w = width;
cfg->g_h = height;
cfg->g_lag_in_frames = 0;
cfg->g_pass = VPX_RC_ONE_PASS;
ASSERT_EQ(vpx_codec_enc_init(enc, &iface, cfg, 0), VPX_CODEC_OK);
ASSERT_EQ(vpx_codec_control_(enc, VP8E_SET_CPUUSED, 2), VPX_CODEC_OK);
}
// Encodes 1 frame of size |cfg.g_w| x |cfg.g_h| setting |enc|'s configuration
// to |cfg|.
void EncodeWithConfig(const vpx_codec_enc_cfg_t &cfg, vpx_codec_ctx_t *enc) {
libvpx_test::DummyVideoSource video;
video.SetSize(cfg.g_w, cfg.g_h);
video.Begin();
EXPECT_EQ(vpx_codec_enc_config_set(enc, &cfg), VPX_CODEC_OK)
<< vpx_codec_error_detail(enc);
EXPECT_EQ(vpx_codec_encode(enc, video.img(), video.pts(), video.duration(),
/*flags=*/0, VPX_DL_GOOD_QUALITY),
VPX_CODEC_OK)
<< vpx_codec_error_detail(enc);
}
TEST(EncodeAPI, ConfigChangeThreadCount) {
constexpr int kWidth = 1920;
constexpr int kHeight = 1080;
for (const auto *iface : kCodecIfaces) {
SCOPED_TRACE(vpx_codec_iface_name(iface));
for (int i = 0; i < (IsVP9(iface) ? 2 : 1); ++i) {
vpx_codec_enc_cfg_t cfg;
struct Encoder {
~Encoder() { EXPECT_EQ(vpx_codec_destroy(&ctx), VPX_CODEC_OK); }
vpx_codec_ctx_t ctx = {};
} enc;
EXPECT_NO_FATAL_FAILURE(
InitCodec(*iface, kWidth, kHeight, &enc.ctx, &cfg));
if (IsVP9(iface)) {
EXPECT_EQ(vpx_codec_control_(&enc.ctx, VP9E_SET_TILE_COLUMNS, 6),
VPX_CODEC_OK);
EXPECT_EQ(vpx_codec_control_(&enc.ctx, VP9E_SET_ROW_MT, i),
VPX_CODEC_OK);
}
for (const auto threads : { 1, 4, 8, 6, 2, 1 }) {
cfg.g_threads = threads;
EXPECT_NO_FATAL_FAILURE(EncodeWithConfig(cfg, &enc.ctx))
<< "iteration: " << i << " threads: " << threads;
}
}
}
}
} // namespace } // namespace
+2 -2
View File
@@ -183,6 +183,6 @@ TEST_P(VP9EncodePerfTest, PerfTest) {
} }
} }
VP9_INSTANTIATE_TEST_CASE(VP9EncodePerfTest, VP9_INSTANTIATE_TEST_SUITE(VP9EncodePerfTest,
::testing::Values(::libvpx_test::kRealTime)); ::testing::Values(::libvpx_test::kRealTime));
} // namespace } // namespace
+5 -5
View File
@@ -91,7 +91,7 @@ void Encoder::EncodeFrameInternal(const VideoSource &video,
void Encoder::Flush() { void Encoder::Flush() {
const vpx_codec_err_t res = 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) if (!encoder_.priv)
ASSERT_EQ(VPX_CODEC_ERROR, res) << EncoderError(); ASSERT_EQ(VPX_CODEC_ERROR, res) << EncoderError();
else else
@@ -182,7 +182,7 @@ void EncoderTest::RunLoop(VideoSource *video) {
BeginPassHook(pass); BeginPassHook(pass);
std::unique_ptr<Encoder> encoder( std::unique_ptr<Encoder> encoder(
codec_->CreateEncoder(cfg_, deadline_, init_flags_, &stats_)); codec_->CreateEncoder(cfg_, deadline_, init_flags_, &stats_));
ASSERT_TRUE(encoder.get() != NULL); ASSERT_NE(encoder.get(), nullptr);
ASSERT_NO_FATAL_FAILURE(video->Begin()); ASSERT_NO_FATAL_FAILURE(video->Begin());
encoder->InitEncoder(video); encoder->InitEncoder(video);
@@ -198,7 +198,7 @@ void EncoderTest::RunLoop(VideoSource *video) {
codec_->CreateDecoder(dec_cfg, dec_init_flags)); codec_->CreateDecoder(dec_cfg, dec_init_flags));
bool again; bool again;
for (again = true; again; video->Next()) { for (again = true; again; video->Next()) {
again = (video->img() != NULL); again = (video->img() != nullptr);
PreEncodeFrameHook(video); PreEncodeFrameHook(video);
PreEncodeFrameHook(video, encoder.get()); PreEncodeFrameHook(video, encoder.get());
@@ -216,7 +216,7 @@ void EncoderTest::RunLoop(VideoSource *video) {
switch (pkt->kind) { switch (pkt->kind) {
case VPX_CODEC_CX_FRAME_PKT: case VPX_CODEC_CX_FRAME_PKT:
has_cxdata = true; has_cxdata = true;
if (decoder.get() != NULL && DoDecode()) { if (decoder != nullptr && DoDecode()) {
PreDecodeFrameHook(video, decoder.get()); PreDecodeFrameHook(video, decoder.get());
vpx_codec_err_t res_dec = decoder->DecodeFrame( vpx_codec_err_t res_dec = decoder->DecodeFrame(
(const uint8_t *)pkt->data.frame.buf, pkt->data.frame.sz); (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. // Flush the decoder when there are no more fragments.
if ((init_flags_ & VPX_CODEC_USE_OUTPUT_PARTITION) && has_dxdata) { 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; if (!HandleDecodeResult(res_dec, *video, decoder.get())) break;
} }
+8 -1
View File
@@ -49,7 +49,7 @@ enum TestMode {
class CxDataIterator { class CxDataIterator {
public: public:
explicit CxDataIterator(vpx_codec_ctx_t *encoder) explicit CxDataIterator(vpx_codec_ctx_t *encoder)
: encoder_(encoder), iter_(NULL) {} : encoder_(encoder), iter_(nullptr) {}
const vpx_codec_cx_pkt_t *Next() { const vpx_codec_cx_pkt_t *Next() {
return vpx_codec_get_cx_data(encoder_, &iter_); return vpx_codec_get_cx_data(encoder_, &iter_);
@@ -148,6 +148,13 @@ class Encoder {
ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError(); 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 #if CONFIG_VP8_ENCODER || CONFIG_VP9_ENCODER
void Control(int ctrl_id, vpx_active_map_t *arg) { void Control(int ctrl_id, vpx_active_map_t *arg) {
const vpx_codec_err_t res = vpx_codec_control_(&encoder_, ctrl_id, arg); const vpx_codec_err_t res = vpx_codec_control_(&encoder_, ctrl_id, arg);
+6 -6
View File
@@ -573,10 +573,10 @@ TEST_P(ErrorResilienceTestLargeCodecControls, CodecControl3TemporalLayers) {
} }
} }
VP8_INSTANTIATE_TEST_CASE(ErrorResilienceTestLarge, ONE_PASS_TEST_MODES, VP8_INSTANTIATE_TEST_SUITE(ErrorResilienceTestLarge, ONE_PASS_TEST_MODES,
::testing::Values(true)); ::testing::Values(true));
VP8_INSTANTIATE_TEST_CASE(ErrorResilienceTestLargeCodecControls, VP8_INSTANTIATE_TEST_SUITE(ErrorResilienceTestLargeCodecControls,
ONE_PASS_TEST_MODES); ONE_PASS_TEST_MODES);
VP9_INSTANTIATE_TEST_CASE(ErrorResilienceTestLarge, ONE_PASS_TEST_MODES, VP9_INSTANTIATE_TEST_SUITE(ErrorResilienceTestLarge, ONE_PASS_TEST_MODES,
::testing::Values(true)); ::testing::Values(true));
} // namespace } // namespace
+32 -30
View File
@@ -36,7 +36,7 @@ struct ExternalFrameBuffer {
class ExternalFrameBufferList { class ExternalFrameBufferList {
public: public:
ExternalFrameBufferList() 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() { virtual ~ExternalFrameBufferList() {
for (int i = 0; i < num_buffers_; ++i) { for (int i = 0; i < num_buffers_; ++i) {
@@ -51,7 +51,7 @@ class ExternalFrameBufferList {
num_buffers_ = num_buffers; num_buffers_ = num_buffers;
ext_fb_list_ = new ExternalFrameBuffer[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_); memset(ext_fb_list_, 0, sizeof(ext_fb_list_[0]) * num_buffers_);
return true; return true;
} }
@@ -61,7 +61,7 @@ class ExternalFrameBufferList {
// frame buffer is in use by libvpx. Finally sets |fb| to point to the // frame buffer is in use by libvpx. Finally sets |fb| to point to the
// external frame buffer. Returns < 0 on an error. // external frame buffer. Returns < 0 on an error.
int GetFreeFrameBuffer(size_t min_size, vpx_codec_frame_buffer_t *fb) { int GetFreeFrameBuffer(size_t min_size, vpx_codec_frame_buffer_t *fb) {
EXPECT_TRUE(fb != NULL); EXPECT_NE(fb, nullptr);
const int idx = FindFreeBufferIndex(); const int idx = FindFreeBufferIndex();
if (idx == num_buffers_) return -1; if (idx == num_buffers_) return -1;
@@ -81,13 +81,13 @@ class ExternalFrameBufferList {
// Test function that will not allocate any data for the frame buffer. // Test function that will not allocate any data for the frame buffer.
// Returns < 0 on an error. // Returns < 0 on an error.
int GetZeroFrameBuffer(size_t min_size, vpx_codec_frame_buffer_t *fb) { int GetZeroFrameBuffer(size_t min_size, vpx_codec_frame_buffer_t *fb) {
EXPECT_TRUE(fb != NULL); EXPECT_NE(fb, nullptr);
const int idx = FindFreeBufferIndex(); const int idx = FindFreeBufferIndex();
if (idx == num_buffers_) return -1; if (idx == num_buffers_) return -1;
if (ext_fb_list_[idx].size < min_size) { if (ext_fb_list_[idx].size < min_size) {
delete[] ext_fb_list_[idx].data; 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; 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. // Marks the external frame buffer that |fb| is pointing to as free.
// Returns < 0 on an error. // Returns < 0 on an error.
int ReturnFrameBuffer(vpx_codec_frame_buffer_t *fb) { int ReturnFrameBuffer(vpx_codec_frame_buffer_t *fb) {
if (fb == NULL) { if (fb == nullptr) {
EXPECT_TRUE(fb != NULL); EXPECT_NE(fb, nullptr);
return -1; return -1;
} }
ExternalFrameBuffer *const ext_fb = ExternalFrameBuffer *const ext_fb =
reinterpret_cast<ExternalFrameBuffer *>(fb->priv); reinterpret_cast<ExternalFrameBuffer *>(fb->priv);
if (ext_fb == NULL) { if (ext_fb == nullptr) {
EXPECT_TRUE(ext_fb != NULL); EXPECT_NE(ext_fb, nullptr);
return -1; return -1;
} }
EXPECT_EQ(1, ext_fb->in_use); 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 // Checks that the vpx_image_t data is contained within the external frame
// buffer private data passed back in the vpx_image_t. // buffer private data passed back in the vpx_image_t.
void CheckImageFrameBuffer(const vpx_image_t *img) { void CheckImageFrameBuffer(const vpx_image_t *img) {
if (img->fb_priv != NULL) { if (img->fb_priv != nullptr) {
const struct ExternalFrameBuffer *const ext_fb = const struct ExternalFrameBuffer *const ext_fb =
reinterpret_cast<ExternalFrameBuffer *>(img->fb_priv); 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 // Sets |fb| to an external frame buffer. idx is the index into the frame
// buffer list. // buffer list.
void SetFrameBuffer(int idx, vpx_codec_frame_buffer_t *fb) { 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->data = ext_fb_list_[idx].data;
fb->size = ext_fb_list_[idx].size; fb->size = ext_fb_list_[idx].size;
ASSERT_EQ(0, ext_fb_list_[idx].in_use); ASSERT_EQ(0, ext_fb_list_[idx].in_use);
@@ -208,10 +208,10 @@ class ExternalFrameBufferMD5Test
protected: protected:
ExternalFrameBufferMD5Test() ExternalFrameBufferMD5Test()
: DecoderTest(GET_PARAM(::libvpx_test::kCodecFactoryParam)), : DecoderTest(GET_PARAM(::libvpx_test::kCodecFactoryParam)),
md5_file_(NULL), num_buffers_(0) {} md5_file_(nullptr), num_buffers_(0) {}
virtual ~ExternalFrameBufferMD5Test() { virtual ~ExternalFrameBufferMD5Test() {
if (md5_file_ != NULL) fclose(md5_file_); if (md5_file_ != nullptr) fclose(md5_file_);
} }
virtual void PreDecodeFrameHook( virtual void PreDecodeFrameHook(
@@ -228,13 +228,13 @@ class ExternalFrameBufferMD5Test
void OpenMD5File(const std::string &md5_file_name_) { void OpenMD5File(const std::string &md5_file_name_) {
md5_file_ = libvpx_test::OpenTestDataFile(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_; << "Md5 file open failed. Filename: " << md5_file_name_;
} }
virtual void DecompressedFrameHook(const vpx_image_t &img, virtual void DecompressedFrameHook(const vpx_image_t &img,
const unsigned int frame_number) { const unsigned int frame_number) {
ASSERT_TRUE(md5_file_ != NULL); ASSERT_NE(md5_file_, nullptr);
char expected_md5[33]; char expected_md5[33];
char junk[128]; 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 for testing passing in external frame buffers to libvpx.
class ExternalFrameBufferTest : public ::testing::Test { class ExternalFrameBufferTest : public ::testing::Test {
protected: protected:
ExternalFrameBufferTest() : video_(NULL), decoder_(NULL), num_buffers_(0) {} ExternalFrameBufferTest()
: video_(nullptr), decoder_(nullptr), num_buffers_(0) {}
virtual void SetUp() { virtual void SetUp() {
video_ = new libvpx_test::WebMVideoSource(kVP9TestFile); video_ = new libvpx_test::WebMVideoSource(kVP9TestFile);
ASSERT_TRUE(video_ != NULL); ASSERT_NE(video_, nullptr);
video_->Init(); video_->Init();
video_->Begin(); video_->Begin();
vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t(); vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
decoder_ = new libvpx_test::VP9Decoder(cfg, 0); decoder_ = new libvpx_test::VP9Decoder(cfg, 0);
ASSERT_TRUE(decoder_ != NULL); ASSERT_NE(decoder_, nullptr);
} }
virtual void TearDown() { virtual void TearDown() {
delete decoder_; delete decoder_;
decoder_ = NULL; decoder_ = nullptr;
delete video_; delete video_;
video_ = NULL; video_ = nullptr;
} }
// Passes the external frame buffer information to libvpx. // Passes the external frame buffer information to libvpx.
@@ -327,7 +328,7 @@ class ExternalFrameBufferTest : public ::testing::Test {
} }
vpx_codec_err_t DecodeRemainingFrames() { vpx_codec_err_t DecodeRemainingFrames() {
for (; video_->cxdata() != NULL; video_->Next()) { for (; video_->cxdata() != nullptr; video_->Next()) {
const vpx_codec_err_t res = const vpx_codec_err_t res =
decoder_->DecodeFrame(video_->cxdata(), video_->frame_size()); decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
if (res != VPX_CODEC_OK) return res; if (res != VPX_CODEC_OK) return res;
@@ -338,10 +339,10 @@ class ExternalFrameBufferTest : public ::testing::Test {
void CheckDecodedFrames() { void CheckDecodedFrames() {
libvpx_test::DxDataIterator dec_iter = decoder_->GetDxData(); libvpx_test::DxDataIterator dec_iter = decoder_->GetDxData();
const vpx_image_t *img = NULL; const vpx_image_t *img = nullptr;
// Get decompressed data // Get decompressed data
while ((img = dec_iter.Next()) != NULL) { while ((img = dec_iter.Next()) != nullptr) {
fb_list_.CheckImageFrameBuffer(img); fb_list_.CheckImageFrameBuffer(img);
} }
} }
@@ -356,13 +357,13 @@ class ExternalFrameBufferNonRefTest : public ExternalFrameBufferTest {
protected: protected:
virtual void SetUp() { virtual void SetUp() {
video_ = new libvpx_test::WebMVideoSource(kVP9NonRefTestFile); video_ = new libvpx_test::WebMVideoSource(kVP9NonRefTestFile);
ASSERT_TRUE(video_ != NULL); ASSERT_NE(video_, nullptr);
video_->Init(); video_->Init();
video_->Begin(); video_->Begin();
vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t(); vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
decoder_ = new libvpx_test::VP9Decoder(cfg, 0); decoder_ = new libvpx_test::VP9Decoder(cfg, 0);
ASSERT_TRUE(decoder_ != NULL); ASSERT_NE(decoder_, nullptr);
} }
virtual void CheckFrameBufferRelease() { virtual void CheckFrameBufferRelease() {
@@ -405,7 +406,7 @@ TEST_P(ExternalFrameBufferMD5Test, ExtFBMD5Match) {
return; return;
#endif #endif
} }
ASSERT_TRUE(video.get() != NULL); ASSERT_NE(video.get(), nullptr);
video->Init(); video->Init();
// Construct md5 file name. // Construct md5 file name.
@@ -482,13 +483,14 @@ TEST_F(ExternalFrameBufferTest, NullGetFunction) {
const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS; const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
ASSERT_EQ( ASSERT_EQ(
VPX_CODEC_INVALID_PARAM, VPX_CODEC_INVALID_PARAM,
SetFrameBufferFunctions(num_buffers, NULL, release_vp9_frame_buffer)); SetFrameBufferFunctions(num_buffers, nullptr, release_vp9_frame_buffer));
} }
TEST_F(ExternalFrameBufferTest, NullReleaseFunction) { TEST_F(ExternalFrameBufferTest, NullReleaseFunction) {
const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS; const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
ASSERT_EQ(VPX_CODEC_INVALID_PARAM, ASSERT_EQ(
SetFrameBufferFunctions(num_buffers, get_vp9_frame_buffer, NULL)); VPX_CODEC_INVALID_PARAM,
SetFrameBufferFunctions(num_buffers, get_vp9_frame_buffer, nullptr));
} }
TEST_F(ExternalFrameBufferTest, SetAfterDecode) { TEST_F(ExternalFrameBufferTest, SetAfterDecode) {
@@ -509,7 +511,7 @@ TEST_F(ExternalFrameBufferNonRefTest, ReleaseNonRefFrameBuffer) {
} }
#endif // CONFIG_WEBM_IO #endif // CONFIG_WEBM_IO
VP9_INSTANTIATE_TEST_CASE( VP9_INSTANTIATE_TEST_SUITE(
ExternalFrameBufferMD5Test, ExternalFrameBufferMD5Test,
::testing::ValuesIn(libvpx_test::kVP9TestVectors, ::testing::ValuesIn(libvpx_test::kVP9TestVectors,
libvpx_test::kVP9TestVectors + libvpx_test::kVP9TestVectors +
+44 -34
View File
@@ -598,6 +598,7 @@ TEST_P(FwdTrans8x8HT, RoundTripErrorCheck) { RunRoundTripErrorCheck(); }
TEST_P(FwdTrans8x8HT, ExtremalCheck) { RunExtremalCheck(); } TEST_P(FwdTrans8x8HT, ExtremalCheck) { RunExtremalCheck(); }
#if HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
class InvTrans8x8DCT : public FwdTrans8x8TestBase, class InvTrans8x8DCT : public FwdTrans8x8TestBase,
public ::testing::TestWithParam<Idct8x8Param> { public ::testing::TestWithParam<Idct8x8Param> {
public: public:
@@ -624,29 +625,31 @@ class InvTrans8x8DCT : public FwdTrans8x8TestBase,
IdctFunc inv_txfm_; IdctFunc inv_txfm_;
int thresh_; int thresh_;
}; };
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(InvTrans8x8DCT);
TEST_P(InvTrans8x8DCT, CompareReference) { TEST_P(InvTrans8x8DCT, CompareReference) {
CompareInvReference(ref_txfm_, thresh_); CompareInvReference(ref_txfm_, thresh_);
} }
#endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
using std::make_tuple; using std::make_tuple;
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
C, FwdTrans8x8DCT, C, FwdTrans8x8DCT,
::testing::Values( ::testing::Values(
make_tuple(&vpx_fdct8x8_c, &vpx_idct8x8_64_add_c, 0, VPX_BITS_8), 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_10, 0, VPX_BITS_10),
make_tuple(&vpx_highbd_fdct8x8_c, &idct8x8_12, 0, VPX_BITS_12))); make_tuple(&vpx_highbd_fdct8x8_c, &idct8x8_12, 0, VPX_BITS_12)));
#else #else
INSTANTIATE_TEST_CASE_P(C, FwdTrans8x8DCT, INSTANTIATE_TEST_SUITE_P(C, FwdTrans8x8DCT,
::testing::Values(make_tuple(&vpx_fdct8x8_c, ::testing::Values(make_tuple(&vpx_fdct8x8_c,
&vpx_idct8x8_64_add_c, 0, &vpx_idct8x8_64_add_c, 0,
VPX_BITS_8))); VPX_BITS_8)));
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
C, FwdTrans8x8HT, C, FwdTrans8x8HT,
::testing::Values( ::testing::Values(
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 0, VPX_BITS_8), 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, 2, VPX_BITS_8),
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 3, VPX_BITS_8))); make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 3, VPX_BITS_8)));
#else #else
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
C, FwdTrans8x8HT, C, FwdTrans8x8HT,
::testing::Values( ::testing::Values(
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 0, VPX_BITS_8), 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 #endif // CONFIG_VP9_HIGHBITDEPTH
#if HAVE_NEON && !CONFIG_EMULATE_HARDWARE #if HAVE_NEON && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P(NEON, FwdTrans8x8DCT, INSTANTIATE_TEST_SUITE_P(NEON, FwdTrans8x8DCT,
::testing::Values(make_tuple(&vpx_fdct8x8_neon, ::testing::Values(make_tuple(&vpx_fdct8x8_neon,
&vpx_idct8x8_64_add_neon, &vpx_idct8x8_64_add_neon,
0, VPX_BITS_8))); 0, VPX_BITS_8)));
#if !CONFIG_VP9_HIGHBITDEPTH #if !CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
NEON, FwdTrans8x8HT, NEON, FwdTrans8x8HT,
::testing::Values( ::testing::Values(
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_neon, 0, VPX_BITS_8), 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 #endif // HAVE_NEON && !CONFIG_EMULATE_HARDWARE
#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P(SSE2, FwdTrans8x8DCT, INSTANTIATE_TEST_SUITE_P(SSE2, FwdTrans8x8DCT,
::testing::Values(make_tuple(&vpx_fdct8x8_sse2, ::testing::Values(make_tuple(&vpx_fdct8x8_sse2,
&vpx_idct8x8_64_add_sse2, &vpx_idct8x8_64_add_sse2,
0, VPX_BITS_8))); 0, VPX_BITS_8)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
SSE2, FwdTrans8x8HT, SSE2, FwdTrans8x8HT,
::testing::Values( ::testing::Values(
make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_sse2, 0, VPX_BITS_8), 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 #endif // HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
#if 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, SSE2, FwdTrans8x8DCT,
::testing::Values(make_tuple(&vpx_fdct8x8_sse2, &vpx_idct8x8_64_add_c, 0, ::testing::Values(make_tuple(&vpx_fdct8x8_sse2, &vpx_idct8x8_64_add_c, 0,
VPX_BITS_8), VPX_BITS_8),
@@ -716,7 +719,7 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(&vpx_highbd_fdct8x8_sse2, make_tuple(&vpx_highbd_fdct8x8_sse2,
&idct8x8_64_add_12_sse2, 12, VPX_BITS_12))); &idct8x8_64_add_12_sse2, 12, VPX_BITS_12)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
SSE2, FwdTrans8x8HT, SSE2, FwdTrans8x8HT,
::testing::Values( ::testing::Values(
make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_c, 0, VPX_BITS_8), 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 // Optimizations take effect at a threshold of 6201, so we use a value close to
// that to test both branches. // that to test both branches.
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
SSE2, InvTrans8x8DCT, SSE2, InvTrans8x8DCT,
::testing::Values( ::testing::Values(
make_tuple(&idct8x8_12_add_10_c, &idct8x8_12_add_10_sse2, 6225, make_tuple(&idct8x8_12_add_10_c, &idct8x8_12_add_10_sse2, 6225,
@@ -737,20 +740,20 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(&idct8x8_12, &idct8x8_64_add_12_sse2, 6225, VPX_BITS_12))); make_tuple(&idct8x8_12, &idct8x8_64_add_12_sse2, 6225, VPX_BITS_12)));
#endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
#if HAVE_SSSE3 && ARCH_X86_64 && !CONFIG_VP9_HIGHBITDEPTH && \ #if HAVE_SSSE3 && VPX_ARCH_X86_64 && !CONFIG_VP9_HIGHBITDEPTH && \
!CONFIG_EMULATE_HARDWARE !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P(SSSE3, FwdTrans8x8DCT, INSTANTIATE_TEST_SUITE_P(SSSE3, FwdTrans8x8DCT,
::testing::Values(make_tuple(&vpx_fdct8x8_ssse3, ::testing::Values(make_tuple(&vpx_fdct8x8_ssse3,
&vpx_idct8x8_64_add_sse2, &vpx_idct8x8_64_add_sse2,
0, VPX_BITS_8))); 0, VPX_BITS_8)));
#endif #endif
#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P(MSA, FwdTrans8x8DCT, INSTANTIATE_TEST_SUITE_P(MSA, FwdTrans8x8DCT,
::testing::Values(make_tuple(&vpx_fdct8x8_msa, ::testing::Values(make_tuple(&vpx_fdct8x8_msa,
&vpx_idct8x8_64_add_msa, 0, &vpx_idct8x8_64_add_msa,
VPX_BITS_8))); 0, VPX_BITS_8)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
MSA, FwdTrans8x8HT, MSA, FwdTrans8x8HT,
::testing::Values( ::testing::Values(
make_tuple(&vp9_fht8x8_msa, &vp9_iht8x8_64_add_msa, 0, VPX_BITS_8), make_tuple(&vp9_fht8x8_msa, &vp9_iht8x8_64_add_msa, 0, VPX_BITS_8),
@@ -760,9 +763,16 @@ INSTANTIATE_TEST_CASE_P(
#endif // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #endif // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
#if HAVE_VSX && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #if HAVE_VSX && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P(VSX, FwdTrans8x8DCT, INSTANTIATE_TEST_SUITE_P(VSX, FwdTrans8x8DCT,
::testing::Values(make_tuple(&vpx_fdct8x8_c, ::testing::Values(make_tuple(&vpx_fdct8x8_c,
&vpx_idct8x8_64_add_vsx, 0, &vpx_idct8x8_64_add_vsx,
VPX_BITS_8))); 0, VPX_BITS_8)));
#endif // HAVE_VSX && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #endif // HAVE_VSX && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
#if HAVE_LSX && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_SUITE_P(LSX, FwdTrans8x8DCT,
::testing::Values(make_tuple(&vpx_fdct8x8_lsx,
&vpx_idct8x8_64_add_c, 0,
VPX_BITS_8)));
#endif // HAVE_LSX && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
} // namespace } // namespace
+127 -6
View File
@@ -7,12 +7,73 @@
* in the file PATENTS. All contributing project authors may * in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree. * 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 "third_party/googletest/src/include/gtest/gtest.h"
#include "test/codec_factory.h" #include "test/codec_factory.h"
#include "test/register_state_check.h"
#include "test/video_source.h" #include "test/video_source.h"
namespace { 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, class VP9FrameSizeTestsLarge : public ::libvpx_test::EncoderTest,
public ::testing::Test { public ::testing::Test {
protected: 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) { TEST_F(VP9FrameSizeTestsLarge, TestInvalidSizes) {
@@ -52,8 +173,8 @@ TEST_F(VP9FrameSizeTestsLarge, TestInvalidSizes) {
#if CONFIG_SIZE_LIMIT #if CONFIG_SIZE_LIMIT
video.SetSize(DECODE_WIDTH_LIMIT + 16, DECODE_HEIGHT_LIMIT + 16); video.SetSize(DECODE_WIDTH_LIMIT + 16, DECODE_HEIGHT_LIMIT + 16);
video.set_limit(2); video.set_limit(2);
expected_res_ = VPX_CODEC_CORRUPT_FRAME; expected_res_ = VPX_CODEC_MEM_ERROR;
ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); ASSERT_NO_FATAL_FAILURE(RunLoop(&video, expected_res_));
#endif #endif
} }
@@ -64,7 +185,7 @@ TEST_F(VP9FrameSizeTestsLarge, ValidSizes) {
video.SetSize(DECODE_WIDTH_LIMIT, DECODE_HEIGHT_LIMIT); video.SetSize(DECODE_WIDTH_LIMIT, DECODE_HEIGHT_LIMIT);
video.set_limit(2); video.set_limit(2);
expected_res_ = VPX_CODEC_OK; expected_res_ = VPX_CODEC_OK;
ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); ASSERT_NO_FATAL_FAILURE(::libvpx_test::EncoderTest::RunLoop(&video));
#else #else
// This test produces a pretty large single frame allocation, (roughly // This test produces a pretty large single frame allocation, (roughly
// 25 megabits). The encoder allocates a good number of these frames // 25 megabits). The encoder allocates a good number of these frames
@@ -80,7 +201,7 @@ TEST_F(VP9FrameSizeTestsLarge, ValidSizes) {
#endif #endif
video.set_limit(2); video.set_limit(2);
expected_res_ = VPX_CODEC_OK; expected_res_ = VPX_CODEC_OK;
ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); ASSERT_NO_FATAL_FAILURE(::libvpx_test::EncoderTest::RunLoop(&video));
#endif #endif
} }
@@ -90,6 +211,6 @@ TEST_F(VP9FrameSizeTestsLarge, OneByOneVideo) {
video.SetSize(1, 1); video.SetSize(1, 1);
video.set_limit(2); video.set_limit(2);
expected_res_ = VPX_CODEC_OK; expected_res_ = VPX_CODEC_OK;
ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); ASSERT_NO_FATAL_FAILURE(::libvpx_test::EncoderTest::RunLoop(&video));
} }
} // namespace } // namespace
+18 -11
View File
@@ -233,14 +233,14 @@ TEST_P(HadamardLowbdTest, DISABLED_Speed) {
SpeedTest(10000000); SpeedTest(10000000);
} }
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
C, HadamardLowbdTest, C, HadamardLowbdTest,
::testing::Values(HadamardFuncWithSize(&vpx_hadamard_8x8_c, 8), ::testing::Values(HadamardFuncWithSize(&vpx_hadamard_8x8_c, 8),
HadamardFuncWithSize(&vpx_hadamard_16x16_c, 16), HadamardFuncWithSize(&vpx_hadamard_16x16_c, 16),
HadamardFuncWithSize(&vpx_hadamard_32x32_c, 32))); HadamardFuncWithSize(&vpx_hadamard_32x32_c, 32)));
#if HAVE_SSE2 #if HAVE_SSE2
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
SSE2, HadamardLowbdTest, SSE2, HadamardLowbdTest,
::testing::Values(HadamardFuncWithSize(&vpx_hadamard_8x8_sse2, 8), ::testing::Values(HadamardFuncWithSize(&vpx_hadamard_8x8_sse2, 8),
HadamardFuncWithSize(&vpx_hadamard_16x16_sse2, 16), HadamardFuncWithSize(&vpx_hadamard_16x16_sse2, 16),
@@ -248,20 +248,20 @@ INSTANTIATE_TEST_CASE_P(
#endif // HAVE_SSE2 #endif // HAVE_SSE2
#if HAVE_AVX2 #if HAVE_AVX2
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
AVX2, HadamardLowbdTest, AVX2, HadamardLowbdTest,
::testing::Values(HadamardFuncWithSize(&vpx_hadamard_16x16_avx2, 16), ::testing::Values(HadamardFuncWithSize(&vpx_hadamard_16x16_avx2, 16),
HadamardFuncWithSize(&vpx_hadamard_32x32_avx2, 32))); HadamardFuncWithSize(&vpx_hadamard_32x32_avx2, 32)));
#endif // HAVE_AVX2 #endif // HAVE_AVX2
#if HAVE_SSSE3 && ARCH_X86_64 #if HAVE_SSSE3 && VPX_ARCH_X86_64
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
SSSE3, HadamardLowbdTest, SSSE3, HadamardLowbdTest,
::testing::Values(HadamardFuncWithSize(&vpx_hadamard_8x8_ssse3, 8))); ::testing::Values(HadamardFuncWithSize(&vpx_hadamard_8x8_ssse3, 8)));
#endif // HAVE_SSSE3 && ARCH_X86_64 #endif // HAVE_SSSE3 && VPX_ARCH_X86_64
#if HAVE_NEON #if HAVE_NEON
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
NEON, HadamardLowbdTest, NEON, HadamardLowbdTest,
::testing::Values(HadamardFuncWithSize(&vpx_hadamard_8x8_neon, 8), ::testing::Values(HadamardFuncWithSize(&vpx_hadamard_8x8_neon, 8),
HadamardFuncWithSize(&vpx_hadamard_16x16_neon, 16))); HadamardFuncWithSize(&vpx_hadamard_16x16_neon, 16)));
@@ -271,7 +271,7 @@ INSTANTIATE_TEST_CASE_P(
// in place and turn on the unit test. // in place and turn on the unit test.
#if !CONFIG_VP9_HIGHBITDEPTH #if !CONFIG_VP9_HIGHBITDEPTH
#if HAVE_MSA #if HAVE_MSA
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
MSA, HadamardLowbdTest, MSA, HadamardLowbdTest,
::testing::Values(HadamardFuncWithSize(&vpx_hadamard_8x8_msa, 8), ::testing::Values(HadamardFuncWithSize(&vpx_hadamard_8x8_msa, 8),
HadamardFuncWithSize(&vpx_hadamard_16x16_msa, 16))); HadamardFuncWithSize(&vpx_hadamard_16x16_msa, 16)));
@@ -279,12 +279,19 @@ INSTANTIATE_TEST_CASE_P(
#endif // !CONFIG_VP9_HIGHBITDEPTH #endif // !CONFIG_VP9_HIGHBITDEPTH
#if HAVE_VSX #if HAVE_VSX
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
VSX, HadamardLowbdTest, VSX, HadamardLowbdTest,
::testing::Values(HadamardFuncWithSize(&vpx_hadamard_8x8_vsx, 8), ::testing::Values(HadamardFuncWithSize(&vpx_hadamard_8x8_vsx, 8),
HadamardFuncWithSize(&vpx_hadamard_16x16_vsx, 16))); HadamardFuncWithSize(&vpx_hadamard_16x16_vsx, 16)));
#endif // HAVE_VSX #endif // HAVE_VSX
#if HAVE_LSX
INSTANTIATE_TEST_SUITE_P(
LSX, HadamardLowbdTest,
::testing::Values(HadamardFuncWithSize(&vpx_hadamard_8x8_lsx, 8),
HadamardFuncWithSize(&vpx_hadamard_16x16_lsx, 16)));
#endif // HAVE_LSX
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
class HadamardHighbdTest : public HadamardTestBase { class HadamardHighbdTest : public HadamardTestBase {
protected: protected:
@@ -301,14 +308,14 @@ TEST_P(HadamardHighbdTest, DISABLED_Speed) {
SpeedTest(10000000); SpeedTest(10000000);
} }
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
C, HadamardHighbdTest, C, HadamardHighbdTest,
::testing::Values(HadamardFuncWithSize(&vpx_highbd_hadamard_8x8_c, 8), ::testing::Values(HadamardFuncWithSize(&vpx_highbd_hadamard_8x8_c, 8),
HadamardFuncWithSize(&vpx_highbd_hadamard_16x16_c, 16), HadamardFuncWithSize(&vpx_highbd_hadamard_16x16_c, 16),
HadamardFuncWithSize(&vpx_highbd_hadamard_32x32_c, 32))); HadamardFuncWithSize(&vpx_highbd_hadamard_32x32_c, 32)));
#if HAVE_AVX2 #if HAVE_AVX2
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
AVX2, HadamardHighbdTest, AVX2, HadamardHighbdTest,
::testing::Values(HadamardFuncWithSize(&vpx_highbd_hadamard_8x8_avx2, 8), ::testing::Values(HadamardFuncWithSize(&vpx_highbd_hadamard_8x8_avx2, 8),
HadamardFuncWithSize(&vpx_highbd_hadamard_16x16_avx2, 16), HadamardFuncWithSize(&vpx_highbd_hadamard_16x16_avx2, 16),
+15 -14
View File
@@ -31,13 +31,13 @@ class IDCTTest : public ::testing::TestWithParam<IdctFunc> {
UUT = GetParam(); UUT = GetParam();
input = new Buffer<int16_t>(4, 4, 0); input = new Buffer<int16_t>(4, 4, 0);
ASSERT_TRUE(input != NULL); ASSERT_NE(input, nullptr);
ASSERT_TRUE(input->Init()); ASSERT_TRUE(input->Init());
predict = new Buffer<uint8_t>(4, 4, 3); predict = new Buffer<uint8_t>(4, 4, 3);
ASSERT_TRUE(predict != NULL); ASSERT_NE(predict, nullptr);
ASSERT_TRUE(predict->Init()); ASSERT_TRUE(predict->Init());
output = new Buffer<uint8_t>(4, 4, 3); output = new Buffer<uint8_t>(4, 4, 3);
ASSERT_TRUE(output != NULL); ASSERT_NE(output, nullptr);
ASSERT_TRUE(output->Init()); ASSERT_TRUE(output->Init());
} }
@@ -72,7 +72,7 @@ TEST_P(IDCTTest, TestAllZeros) {
TEST_P(IDCTTest, TestAllOnes) { TEST_P(IDCTTest, TestAllOnes) {
input->Set(0); 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'. // When the first element is '4' it will fill the output buffer with '1'.
input->TopLeftPixel()[0] = 4; input->TopLeftPixel()[0] = 4;
predict->Set(0); 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 // Set the transform output to '1' and make sure it gets added to the
// prediction buffer. // prediction buffer.
input->Set(0); input->Set(0);
ASSERT_TRUE(input->TopLeftPixel() != NULL); ASSERT_NE(input->TopLeftPixel(), nullptr);
input->TopLeftPixel()[0] = 4; input->TopLeftPixel()[0] = 4;
output->Set(0); output->Set(0);
@@ -155,25 +155,26 @@ TEST_P(IDCTTest, TestWithData) {
ASSERT_TRUE(output->CheckPadding()); 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 #if HAVE_NEON
INSTANTIATE_TEST_CASE_P(NEON, IDCTTest, INSTANTIATE_TEST_SUITE_P(NEON, IDCTTest,
::testing::Values(vp8_short_idct4x4llm_neon)); ::testing::Values(vp8_short_idct4x4llm_neon));
#endif // HAVE_NEON #endif // HAVE_NEON
#if HAVE_MMX #if HAVE_MMX
INSTANTIATE_TEST_CASE_P(MMX, IDCTTest, INSTANTIATE_TEST_SUITE_P(MMX, IDCTTest,
::testing::Values(vp8_short_idct4x4llm_mmx)); ::testing::Values(vp8_short_idct4x4llm_mmx));
#endif // HAVE_MMX #endif // HAVE_MMX
#if HAVE_MSA #if HAVE_MSA
INSTANTIATE_TEST_CASE_P(MSA, IDCTTest, INSTANTIATE_TEST_SUITE_P(MSA, IDCTTest,
::testing::Values(vp8_short_idct4x4llm_msa)); ::testing::Values(vp8_short_idct4x4llm_msa));
#endif // HAVE_MSA #endif // HAVE_MSA
#if HAVE_MMI #if HAVE_MMI
INSTANTIATE_TEST_CASE_P(MMI, IDCTTest, INSTANTIATE_TEST_SUITE_P(MMI, IDCTTest,
::testing::Values(vp8_short_idct4x4llm_mmi)); ::testing::Values(vp8_short_idct4x4llm_mmi));
#endif // HAVE_MMI #endif // HAVE_MMI
} // namespace } // namespace
+17 -15
View File
@@ -38,15 +38,15 @@ std::ostream &operator<<(std::ostream &os, const DecodeParam &dp) {
class InvalidFileTest : public ::libvpx_test::DecoderTest, class InvalidFileTest : public ::libvpx_test::DecoderTest,
public ::libvpx_test::CodecTestWithParam<DecodeParam> { public ::libvpx_test::CodecTestWithParam<DecodeParam> {
protected: protected:
InvalidFileTest() : DecoderTest(GET_PARAM(0)), res_file_(NULL) {} InvalidFileTest() : DecoderTest(GET_PARAM(0)), res_file_(nullptr) {}
virtual ~InvalidFileTest() { virtual ~InvalidFileTest() {
if (res_file_ != NULL) fclose(res_file_); if (res_file_ != nullptr) fclose(res_file_);
} }
void OpenResFile(const std::string &res_file_name_) { void OpenResFile(const std::string &res_file_name_) {
res_file_ = libvpx_test::OpenTestDataFile(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_; << "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 vpx_codec_err_t res_dec,
const libvpx_test::CompressedVideoSource &video, const libvpx_test::CompressedVideoSource &video,
libvpx_test::Decoder *decoder) { libvpx_test::Decoder *decoder) {
EXPECT_TRUE(res_file_ != NULL); EXPECT_NE(res_file_, nullptr);
int expected_res_dec; int expected_res_dec;
// Read integer result. // Read integer result.
@@ -102,7 +102,7 @@ class InvalidFileTest : public ::libvpx_test::DecoderTest,
return; return;
#endif #endif
} }
ASSERT_TRUE(video.get() != NULL); ASSERT_NE(video.get(), nullptr);
video->Init(); video->Init();
// Construct result file name. The file holds a list of expected integer // 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 #if CONFIG_VP8_DECODER
const DecodeParam kVP8InvalidFileTests[] = { const DecodeParam kVP8InvalidFileTests[] = {
{ 1, "invalid-bug-1443.ivf" }, { 1, "invalid-bug-1443.ivf" },
{ 1, "invalid-bug-148271109.ivf" },
{ 1, "invalid-token-partition.ivf" }, { 1, "invalid-token-partition.ivf" },
{ 1, "invalid-vp80-00-comprehensive-s17661_r01-05_b6-.ivf" }, { 1, "invalid-vp80-00-comprehensive-s17661_r01-05_b6-.ivf" },
}; };
VP8_INSTANTIATE_TEST_CASE(InvalidFileTest, VP8_INSTANTIATE_TEST_SUITE(InvalidFileTest,
::testing::ValuesIn(kVP8InvalidFileTests)); ::testing::ValuesIn(kVP8InvalidFileTests));
#endif // CONFIG_VP8_DECODER #endif // CONFIG_VP8_DECODER
#if CONFIG_VP9_DECODER #if CONFIG_VP9_DECODER
@@ -147,7 +148,7 @@ const DecodeParam kVP9InvalidFileTests[] = {
// This file will cause a large allocation which is expected to fail in 32-bit // This file will cause a large allocation which is expected to fail in 32-bit
// environments. Test x86 for coverage purposes as the allocation failure will // environments. Test x86 for coverage purposes as the allocation failure will
// be in platform agnostic code. // be in platform agnostic code.
#if ARCH_X86 #if VPX_ARCH_X86
{ 1, "invalid-vp90-2-00-quantizer-63.ivf.kf_65527x61446.ivf" }, { 1, "invalid-vp90-2-00-quantizer-63.ivf.kf_65527x61446.ivf" },
#endif #endif
{ 1, "invalid-vp90-2-12-droppable_1.ivf.s3676_r01-05_b6-.ivf" }, { 1, "invalid-vp90-2-12-droppable_1.ivf.s3676_r01-05_b6-.ivf" },
@@ -162,8 +163,8 @@ const DecodeParam kVP9InvalidFileTests[] = {
{ 1, "invalid-crbug-667044.webm" }, { 1, "invalid-crbug-667044.webm" },
}; };
VP9_INSTANTIATE_TEST_CASE(InvalidFileTest, VP9_INSTANTIATE_TEST_SUITE(InvalidFileTest,
::testing::ValuesIn(kVP9InvalidFileTests)); ::testing::ValuesIn(kVP9InvalidFileTests));
#endif // CONFIG_VP9_DECODER #endif // CONFIG_VP9_DECODER
// This class will include test vectors that are expected to fail // 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" }, { 1, "invalid-vp80-00-comprehensive-018.ivf.2kf_0x6.ivf" },
}; };
VP8_INSTANTIATE_TEST_CASE(InvalidFileInvalidPeekTest, VP8_INSTANTIATE_TEST_SUITE(InvalidFileInvalidPeekTest,
::testing::ValuesIn(kVP8InvalidPeekTests)); ::testing::ValuesIn(kVP8InvalidPeekTests));
#endif // CONFIG_VP8_DECODER #endif // CONFIG_VP8_DECODER
#if CONFIG_VP9_DECODER #if CONFIG_VP9_DECODER
@@ -192,8 +193,9 @@ const DecodeParam kVP9InvalidFileInvalidPeekTests[] = {
{ 1, "invalid-vp90-01-v3.webm" }, { 1, "invalid-vp90-01-v3.webm" },
}; };
VP9_INSTANTIATE_TEST_CASE(InvalidFileInvalidPeekTest, VP9_INSTANTIATE_TEST_SUITE(
::testing::ValuesIn(kVP9InvalidFileInvalidPeekTests)); InvalidFileInvalidPeekTest,
::testing::ValuesIn(kVP9InvalidFileInvalidPeekTests));
const DecodeParam kMultiThreadedVP9InvalidFileTests[] = { const DecodeParam kMultiThreadedVP9InvalidFileTests[] = {
{ 4, "invalid-vp90-2-08-tile_1x4_frame_parallel_all_key.webm" }, { 4, "invalid-vp90-2-08-tile_1x4_frame_parallel_all_key.webm" },
@@ -209,7 +211,7 @@ const DecodeParam kMultiThreadedVP9InvalidFileTests[] = {
{ 4, "invalid-crbug-1562.ivf" }, { 4, "invalid-crbug-1562.ivf" },
}; };
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
VP9MultiThreaded, InvalidFileTest, VP9MultiThreaded, InvalidFileTest,
::testing::Combine( ::testing::Combine(
::testing::Values( ::testing::Values(
+7 -7
View File
@@ -29,8 +29,9 @@ static unsigned int MemGetLe32(const uint8_t *mem) {
class IVFVideoSource : public CompressedVideoSource { class IVFVideoSource : public CompressedVideoSource {
public: public:
explicit IVFVideoSource(const std::string &file_name) explicit IVFVideoSource(const std::string &file_name)
: file_name_(file_name), input_file_(NULL), compressed_frame_buf_(NULL), : file_name_(file_name), input_file_(nullptr),
frame_sz_(0), frame_(0), end_of_file_(false) {} compressed_frame_buf_(nullptr), frame_sz_(0), frame_(0),
end_of_file_(false) {}
virtual ~IVFVideoSource() { virtual ~IVFVideoSource() {
delete[] compressed_frame_buf_; delete[] compressed_frame_buf_;
@@ -41,13 +42,12 @@ class IVFVideoSource : public CompressedVideoSource {
virtual void Init() { virtual void Init() {
// Allocate a buffer for read in the compressed video frame. // Allocate a buffer for read in the compressed video frame.
compressed_frame_buf_ = new uint8_t[libvpx_test::kCodeBufferSize]; compressed_frame_buf_ = new uint8_t[libvpx_test::kCodeBufferSize];
ASSERT_TRUE(compressed_frame_buf_ != NULL) ASSERT_NE(compressed_frame_buf_, nullptr) << "Allocate frame buffer failed";
<< "Allocate frame buffer failed";
} }
virtual void Begin() { virtual void Begin() {
input_file_ = OpenTestDataFile(file_name_); input_file_ = OpenTestDataFile(file_name_);
ASSERT_TRUE(input_file_ != NULL) ASSERT_NE(input_file_, nullptr)
<< "Input file open failed. Filename: " << file_name_; << "Input file open failed. Filename: " << file_name_;
// Read file header // Read file header
@@ -68,7 +68,7 @@ class IVFVideoSource : public CompressedVideoSource {
} }
void FillFrame() { void FillFrame() {
ASSERT_TRUE(input_file_ != NULL); ASSERT_NE(input_file_, nullptr);
uint8_t frame_hdr[kIvfFrameHdrSize]; uint8_t frame_hdr[kIvfFrameHdrSize];
// Check frame header and read a frame from input_file. // Check frame header and read a frame from input_file.
if (fread(frame_hdr, 1, kIvfFrameHdrSize, input_file_) != if (fread(frame_hdr, 1, kIvfFrameHdrSize, input_file_) !=
@@ -87,7 +87,7 @@ class IVFVideoSource : public CompressedVideoSource {
} }
virtual const uint8_t *cxdata() const { virtual const uint8_t *cxdata() const {
return end_of_file_ ? NULL : compressed_frame_buf_; return end_of_file_ ? nullptr : compressed_frame_buf_;
} }
virtual size_t frame_size() const { return frame_sz_; } virtual size_t frame_size() const { return frame_sz_; }
virtual unsigned int frame_number() const { return frame_; } virtual unsigned int frame_number() const { return frame_; }
+1 -1
View File
@@ -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 } // namespace
+4 -4
View File
@@ -140,8 +140,8 @@ TEST_P(LevelTest, TestTargetLevelApi) {
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&enc)); EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&enc));
} }
VP9_INSTANTIATE_TEST_CASE(LevelTest, VP9_INSTANTIATE_TEST_SUITE(LevelTest,
::testing::Values(::libvpx_test::kTwoPassGood, ::testing::Values(::libvpx_test::kTwoPassGood,
::libvpx_test::kOnePassGood), ::libvpx_test::kOnePassGood),
::testing::Range(0, 9)); ::testing::Range(0, 9));
} // namespace } // namespace
+55 -19
View File
@@ -75,9 +75,9 @@ void InitInput(Pixel *s, Pixel *ref_s, ACMRandom *rnd, const uint8_t limit,
if (j < 1) { if (j < 1) {
tmp_s[j] = rnd->Rand16(); tmp_s[j] = rnd->Rand16();
} else if (val & 0x20) { // Increment by a value within the limit. } else if (val & 0x20) { // Increment by a value within the limit.
tmp_s[j] = tmp_s[j - 1] + (limit - 1); tmp_s[j] = static_cast<uint16_t>(tmp_s[j - 1] + (limit - 1));
} else { // Decrement by a value within the limit. } else { // Decrement by a value within the limit.
tmp_s[j] = tmp_s[j - 1] - (limit - 1); tmp_s[j] = static_cast<uint16_t>(tmp_s[j - 1] - (limit - 1));
} }
j++; j++;
} }
@@ -94,11 +94,11 @@ void InitInput(Pixel *s, Pixel *ref_s, ACMRandom *rnd, const uint8_t limit,
if (j < 1) { if (j < 1) {
tmp_s[j] = rnd->Rand16(); tmp_s[j] = rnd->Rand16();
} else if (val & 0x20) { // Increment by a value within the limit. } else if (val & 0x20) { // Increment by a value within the limit.
tmp_s[(j % 32) * 32 + j / 32] = tmp_s[(j % 32) * 32 + j / 32] = static_cast<uint16_t>(
tmp_s[((j - 1) % 32) * 32 + (j - 1) / 32] + (limit - 1); tmp_s[((j - 1) % 32) * 32 + (j - 1) / 32] + (limit - 1));
} else { // Decrement by a value within the limit. } else { // Decrement by a value within the limit.
tmp_s[(j % 32) * 32 + j / 32] = tmp_s[(j % 32) * 32 + j / 32] = static_cast<uint16_t>(
tmp_s[((j - 1) % 32) * 32 + (j - 1) / 32] - (limit - 1); tmp_s[((j - 1) % 32) * 32 + (j - 1) / 32] - (limit - 1));
} }
j++; j++;
} }
@@ -145,7 +145,10 @@ class Loop8Test6Param : public ::testing::TestWithParam<loop8_param_t> {
loop_op_t loopfilter_op_; loop_op_t loopfilter_op_;
loop_op_t ref_loopfilter_op_; loop_op_t ref_loopfilter_op_;
}; };
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(Loop8Test6Param);
#if HAVE_NEON || HAVE_SSE2 || (HAVE_LSX && !CONFIG_VP9_HIGHBITDEPTH) || \
(HAVE_DSPR2 || HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH)
class Loop8Test9Param : public ::testing::TestWithParam<dualloop8_param_t> { class Loop8Test9Param : public ::testing::TestWithParam<dualloop8_param_t> {
public: public:
virtual ~Loop8Test9Param() {} virtual ~Loop8Test9Param() {}
@@ -164,6 +167,9 @@ class Loop8Test9Param : public ::testing::TestWithParam<dualloop8_param_t> {
dual_loop_op_t loopfilter_op_; dual_loop_op_t loopfilter_op_;
dual_loop_op_t ref_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) || (HAVE_LSX && !CONFIG_VP9_HIGHBITDEPTH))
TEST_P(Loop8Test6Param, OperationCheck) { TEST_P(Loop8Test6Param, OperationCheck) {
ACMRandom rnd(ACMRandom::DeterministicSeed()); ACMRandom rnd(ACMRandom::DeterministicSeed());
@@ -275,6 +281,8 @@ TEST_P(Loop8Test6Param, ValueCheck) {
<< "First failed at test case " << first_failure; << "First failed at test case " << first_failure;
} }
#if HAVE_NEON || HAVE_SSE2 || (HAVE_LSX && (!CONFIG_VP9_HIGHBITDEPTH)) || \
(HAVE_DSPR2 || HAVE_MSA && (!CONFIG_VP9_HIGHBITDEPTH))
TEST_P(Loop8Test9Param, OperationCheck) { TEST_P(Loop8Test9Param, OperationCheck) {
ACMRandom rnd(ACMRandom::DeterministicSeed()); ACMRandom rnd(ACMRandom::DeterministicSeed());
const int count_test_block = number_of_iterations; const int count_test_block = number_of_iterations;
@@ -402,12 +410,15 @@ TEST_P(Loop8Test9Param, ValueCheck) {
"loopfilter output. " "loopfilter output. "
<< "First failed at test case " << first_failure; << "First failed at test case " << first_failure;
} }
#endif // HAVE_NEON || HAVE_SSE2 || (HAVE_DSPR2 || HAVE_MSA &&
// (!CONFIG_VP9_HIGHBITDEPTH)) || (HAVE_LSX &&
// (!CONFIG_VP9_HIGHBITDEPTH))
using std::make_tuple; using std::make_tuple;
#if HAVE_SSE2 #if HAVE_SSE2
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
SSE2, Loop8Test6Param, SSE2, Loop8Test6Param,
::testing::Values(make_tuple(&vpx_highbd_lpf_horizontal_4_sse2, ::testing::Values(make_tuple(&vpx_highbd_lpf_horizontal_4_sse2,
&vpx_highbd_lpf_horizontal_4_c, 8), &vpx_highbd_lpf_horizontal_4_c, 8),
@@ -458,7 +469,7 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(&vpx_highbd_lpf_vertical_16_dual_sse2, make_tuple(&vpx_highbd_lpf_vertical_16_dual_sse2,
&vpx_highbd_lpf_vertical_16_dual_c, 12))); &vpx_highbd_lpf_vertical_16_dual_c, 12)));
#else #else
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
SSE2, Loop8Test6Param, SSE2, Loop8Test6Param,
::testing::Values( ::testing::Values(
make_tuple(&vpx_lpf_horizontal_4_sse2, &vpx_lpf_horizontal_4_c, 8), make_tuple(&vpx_lpf_horizontal_4_sse2, &vpx_lpf_horizontal_4_c, 8),
@@ -475,7 +486,7 @@ INSTANTIATE_TEST_CASE_P(
#endif #endif
#if HAVE_AVX2 && (!CONFIG_VP9_HIGHBITDEPTH) #if HAVE_AVX2 && (!CONFIG_VP9_HIGHBITDEPTH)
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
AVX2, Loop8Test6Param, AVX2, Loop8Test6Param,
::testing::Values(make_tuple(&vpx_lpf_horizontal_16_avx2, ::testing::Values(make_tuple(&vpx_lpf_horizontal_16_avx2,
&vpx_lpf_horizontal_16_c, 8), &vpx_lpf_horizontal_16_c, 8),
@@ -485,7 +496,7 @@ INSTANTIATE_TEST_CASE_P(
#if HAVE_SSE2 #if HAVE_SSE2
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
SSE2, Loop8Test9Param, SSE2, Loop8Test9Param,
::testing::Values(make_tuple(&vpx_highbd_lpf_horizontal_4_dual_sse2, ::testing::Values(make_tuple(&vpx_highbd_lpf_horizontal_4_dual_sse2,
&vpx_highbd_lpf_horizontal_4_dual_c, 8), &vpx_highbd_lpf_horizontal_4_dual_c, 8),
@@ -512,7 +523,7 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(&vpx_highbd_lpf_vertical_8_dual_sse2, make_tuple(&vpx_highbd_lpf_vertical_8_dual_sse2,
&vpx_highbd_lpf_vertical_8_dual_c, 12))); &vpx_highbd_lpf_vertical_8_dual_c, 12)));
#else #else
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
SSE2, Loop8Test9Param, SSE2, Loop8Test9Param,
::testing::Values(make_tuple(&vpx_lpf_horizontal_4_dual_sse2, ::testing::Values(make_tuple(&vpx_lpf_horizontal_4_dual_sse2,
&vpx_lpf_horizontal_4_dual_c, 8), &vpx_lpf_horizontal_4_dual_c, 8),
@@ -527,7 +538,7 @@ INSTANTIATE_TEST_CASE_P(
#if HAVE_NEON #if HAVE_NEON
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
NEON, Loop8Test6Param, NEON, Loop8Test6Param,
::testing::Values(make_tuple(&vpx_highbd_lpf_horizontal_4_neon, ::testing::Values(make_tuple(&vpx_highbd_lpf_horizontal_4_neon,
&vpx_highbd_lpf_horizontal_4_c, 8), &vpx_highbd_lpf_horizontal_4_c, 8),
@@ -577,7 +588,7 @@ INSTANTIATE_TEST_CASE_P(
&vpx_highbd_lpf_vertical_16_dual_c, 10), &vpx_highbd_lpf_vertical_16_dual_c, 10),
make_tuple(&vpx_highbd_lpf_vertical_16_dual_neon, make_tuple(&vpx_highbd_lpf_vertical_16_dual_neon,
&vpx_highbd_lpf_vertical_16_dual_c, 12))); &vpx_highbd_lpf_vertical_16_dual_c, 12)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
NEON, Loop8Test9Param, NEON, Loop8Test9Param,
::testing::Values(make_tuple(&vpx_highbd_lpf_horizontal_4_dual_neon, ::testing::Values(make_tuple(&vpx_highbd_lpf_horizontal_4_dual_neon,
&vpx_highbd_lpf_horizontal_4_dual_c, 8), &vpx_highbd_lpf_horizontal_4_dual_c, 8),
@@ -604,7 +615,7 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(&vpx_highbd_lpf_vertical_8_dual_neon, make_tuple(&vpx_highbd_lpf_vertical_8_dual_neon,
&vpx_highbd_lpf_vertical_8_dual_c, 12))); &vpx_highbd_lpf_vertical_8_dual_c, 12)));
#else #else
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
NEON, Loop8Test6Param, NEON, Loop8Test6Param,
::testing::Values( ::testing::Values(
make_tuple(&vpx_lpf_horizontal_16_neon, &vpx_lpf_horizontal_16_c, 8), make_tuple(&vpx_lpf_horizontal_16_neon, &vpx_lpf_horizontal_16_c, 8),
@@ -617,7 +628,7 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(&vpx_lpf_vertical_8_neon, &vpx_lpf_vertical_8_c, 8), 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_horizontal_4_neon, &vpx_lpf_horizontal_4_c, 8),
make_tuple(&vpx_lpf_vertical_4_neon, &vpx_lpf_vertical_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, NEON, Loop8Test9Param,
::testing::Values(make_tuple(&vpx_lpf_horizontal_8_dual_neon, ::testing::Values(make_tuple(&vpx_lpf_horizontal_8_dual_neon,
&vpx_lpf_horizontal_8_dual_c, 8), &vpx_lpf_horizontal_8_dual_c, 8),
@@ -631,7 +642,7 @@ INSTANTIATE_TEST_CASE_P(
#endif // HAVE_NEON #endif // HAVE_NEON
#if HAVE_DSPR2 && !CONFIG_VP9_HIGHBITDEPTH #if HAVE_DSPR2 && !CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
DSPR2, Loop8Test6Param, DSPR2, Loop8Test6Param,
::testing::Values( ::testing::Values(
make_tuple(&vpx_lpf_horizontal_4_dspr2, &vpx_lpf_horizontal_4_c, 8), make_tuple(&vpx_lpf_horizontal_4_dspr2, &vpx_lpf_horizontal_4_c, 8),
@@ -645,7 +656,7 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(&vpx_lpf_vertical_16_dual_dspr2, &vpx_lpf_vertical_16_dual_c, make_tuple(&vpx_lpf_vertical_16_dual_dspr2, &vpx_lpf_vertical_16_dual_c,
8))); 8)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
DSPR2, Loop8Test9Param, DSPR2, Loop8Test9Param,
::testing::Values(make_tuple(&vpx_lpf_horizontal_4_dual_dspr2, ::testing::Values(make_tuple(&vpx_lpf_horizontal_4_dual_dspr2,
&vpx_lpf_horizontal_4_dual_c, 8), &vpx_lpf_horizontal_4_dual_c, 8),
@@ -658,7 +669,7 @@ INSTANTIATE_TEST_CASE_P(
#endif // HAVE_DSPR2 && !CONFIG_VP9_HIGHBITDEPTH #endif // HAVE_DSPR2 && !CONFIG_VP9_HIGHBITDEPTH
#if HAVE_MSA && (!CONFIG_VP9_HIGHBITDEPTH) #if HAVE_MSA && (!CONFIG_VP9_HIGHBITDEPTH)
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
MSA, Loop8Test6Param, MSA, Loop8Test6Param,
::testing::Values( ::testing::Values(
make_tuple(&vpx_lpf_horizontal_4_msa, &vpx_lpf_horizontal_4_c, 8), make_tuple(&vpx_lpf_horizontal_4_msa, &vpx_lpf_horizontal_4_c, 8),
@@ -670,7 +681,7 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(&vpx_lpf_vertical_8_msa, &vpx_lpf_vertical_8_c, 8), 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))); make_tuple(&vpx_lpf_vertical_16_msa, &vpx_lpf_vertical_16_c, 8)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_SUITE_P(
MSA, Loop8Test9Param, MSA, Loop8Test9Param,
::testing::Values(make_tuple(&vpx_lpf_horizontal_4_dual_msa, ::testing::Values(make_tuple(&vpx_lpf_horizontal_4_dual_msa,
&vpx_lpf_horizontal_4_dual_c, 8), &vpx_lpf_horizontal_4_dual_c, 8),
@@ -682,4 +693,29 @@ INSTANTIATE_TEST_CASE_P(
&vpx_lpf_vertical_8_dual_c, 8))); &vpx_lpf_vertical_8_dual_c, 8)));
#endif // HAVE_MSA && (!CONFIG_VP9_HIGHBITDEPTH) #endif // HAVE_MSA && (!CONFIG_VP9_HIGHBITDEPTH)
#if HAVE_LSX && (!CONFIG_VP9_HIGHBITDEPTH)
INSTANTIATE_TEST_SUITE_P(
LSX, Loop8Test6Param,
::testing::Values(
make_tuple(&vpx_lpf_horizontal_4_lsx, &vpx_lpf_horizontal_4_c, 8),
make_tuple(&vpx_lpf_horizontal_8_lsx, &vpx_lpf_horizontal_8_c, 8),
make_tuple(&vpx_lpf_horizontal_16_dual_lsx,
&vpx_lpf_horizontal_16_dual_c, 8),
make_tuple(&vpx_lpf_vertical_4_lsx, &vpx_lpf_vertical_4_c, 8),
make_tuple(&vpx_lpf_vertical_8_lsx, &vpx_lpf_vertical_8_c, 8),
make_tuple(&vpx_lpf_vertical_16_dual_lsx, &vpx_lpf_vertical_16_dual_c,
8)));
INSTANTIATE_TEST_SUITE_P(
LSX, Loop8Test9Param,
::testing::Values(make_tuple(&vpx_lpf_horizontal_4_dual_lsx,
&vpx_lpf_horizontal_4_dual_c, 8),
make_tuple(&vpx_lpf_horizontal_8_dual_lsx,
&vpx_lpf_horizontal_8_dual_c, 8),
make_tuple(&vpx_lpf_vertical_4_dual_lsx,
&vpx_lpf_vertical_4_dual_c, 8),
make_tuple(&vpx_lpf_vertical_8_dual_lsx,
&vpx_lpf_vertical_8_dual_c, 8)));
#endif // HAVE_LSX && (!CONFIG_VP9_HIGHBITDEPTH)
} // namespace } // namespace
+7 -7
View File
@@ -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 #if HAVE_SSE2
INSTANTIATE_TEST_CASE_P(SSE2, MinMaxTest, INSTANTIATE_TEST_SUITE_P(SSE2, MinMaxTest,
::testing::Values(&vpx_minmax_8x8_sse2)); ::testing::Values(&vpx_minmax_8x8_sse2));
#endif #endif
#if HAVE_NEON #if HAVE_NEON
INSTANTIATE_TEST_CASE_P(NEON, MinMaxTest, INSTANTIATE_TEST_SUITE_P(NEON, MinMaxTest,
::testing::Values(&vpx_minmax_8x8_neon)); ::testing::Values(&vpx_minmax_8x8_neon));
#endif #endif
#if HAVE_MSA #if HAVE_MSA
INSTANTIATE_TEST_CASE_P(MSA, MinMaxTest, INSTANTIATE_TEST_SUITE_P(MSA, MinMaxTest,
::testing::Values(&vpx_minmax_8x8_msa)); ::testing::Values(&vpx_minmax_8x8_msa));
#endif #endif
} // namespace } // namespace
+200
View File
@@ -0,0 +1,200 @@
/*
* 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 "third_party/googletest/src/include/gtest/gtest.h"
#include "vp9/encoder/vp9_non_greedy_mv.h"
#include "./vpx_dsp_rtcd.h"
namespace {
static void read_in_mf(const char *filename, int *rows_ptr, int *cols_ptr,
MV **buffer_ptr) {
FILE *input = fopen(filename, "rb");
int row, col;
int idx;
ASSERT_NE(input, nullptr) << "Cannot open file: " << filename << std::endl;
fscanf(input, "%d,%d\n", rows_ptr, cols_ptr);
*buffer_ptr = (MV *)malloc((*rows_ptr) * (*cols_ptr) * sizeof(MV));
for (idx = 0; idx < (*rows_ptr) * (*cols_ptr); ++idx) {
fscanf(input, "%d,%d;", &row, &col);
(*buffer_ptr)[idx].row = row;
(*buffer_ptr)[idx].col = col;
}
fclose(input);
}
static void read_in_local_var(const char *filename, int *rows_ptr,
int *cols_ptr,
int (**M_ptr)[MF_LOCAL_STRUCTURE_SIZE]) {
FILE *input = fopen(filename, "rb");
int M00, M01, M10, M11;
int idx;
int int_type;
ASSERT_NE(input, nullptr) << "Cannot open file: " << filename << std::endl;
fscanf(input, "%d,%d\n", rows_ptr, cols_ptr);
*M_ptr = (int(*)[MF_LOCAL_STRUCTURE_SIZE])malloc(
(*rows_ptr) * (*cols_ptr) * MF_LOCAL_STRUCTURE_SIZE * sizeof(int_type));
for (idx = 0; idx < (*rows_ptr) * (*cols_ptr); ++idx) {
fscanf(input, "%d,%d,%d,%d;", &M00, &M01, &M10, &M11);
(*M_ptr)[idx][0] = M00;
(*M_ptr)[idx][1] = M01;
(*M_ptr)[idx][2] = M10;
(*M_ptr)[idx][3] = M11;
}
fclose(input);
}
static void compare_mf(const MV *mf1, const MV *mf2, int rows, int cols,
float *mean_ptr, float *std_ptr) {
float float_type;
float *diffs = (float *)malloc(rows * cols * sizeof(float_type));
int idx;
float accu = 0.0f;
for (idx = 0; idx < rows * cols; ++idx) {
MV mv1 = mf1[idx];
MV mv2 = mf2[idx];
float row_diff2 = (float)((mv1.row - mv2.row) * (mv1.row - mv2.row));
float col_diff2 = (float)((mv1.col - mv2.col) * (mv1.col - mv2.col));
diffs[idx] = sqrt(row_diff2 + col_diff2);
accu += diffs[idx];
}
*mean_ptr = accu / rows / cols;
*std_ptr = 0;
for (idx = 0; idx < rows * cols; ++idx) {
*std_ptr += (diffs[idx] - (*mean_ptr)) * (diffs[idx] - (*mean_ptr));
}
*std_ptr = sqrt(*std_ptr / rows / cols);
free(diffs);
}
static void load_frame_info(const char *filename,
YV12_BUFFER_CONFIG *ref_frame_ptr) {
FILE *input = fopen(filename, "rb");
int idx;
uint8_t data_type;
ASSERT_NE(input, nullptr) << "Cannot open file: " << filename << std::endl;
fscanf(input, "%d,%d\n", &(ref_frame_ptr->y_height),
&(ref_frame_ptr->y_width));
ref_frame_ptr->y_buffer = (uint8_t *)malloc(
(ref_frame_ptr->y_width) * (ref_frame_ptr->y_height) * sizeof(data_type));
for (idx = 0; idx < (ref_frame_ptr->y_width) * (ref_frame_ptr->y_height);
++idx) {
int value;
fscanf(input, "%d,", &value);
ref_frame_ptr->y_buffer[idx] = (uint8_t)value;
}
ref_frame_ptr->y_stride = ref_frame_ptr->y_width;
fclose(input);
}
static int compare_local_var(const int (*local_var1)[MF_LOCAL_STRUCTURE_SIZE],
const int (*local_var2)[MF_LOCAL_STRUCTURE_SIZE],
int rows, int cols) {
int diff = 0;
int outter_idx, inner_idx;
for (outter_idx = 0; outter_idx < rows * cols; ++outter_idx) {
for (inner_idx = 0; inner_idx < MF_LOCAL_STRUCTURE_SIZE; ++inner_idx) {
diff += abs(local_var1[outter_idx][inner_idx] -
local_var2[outter_idx][inner_idx]);
}
}
return diff / rows / cols;
}
TEST(non_greedy_mv, smooth_mf) {
const char *search_mf_file = "non_greedy_mv_test_files/exhaust_16x16.txt";
const char *local_var_file = "non_greedy_mv_test_files/localVar_16x16.txt";
const char *estimation_file = "non_greedy_mv_test_files/estimation_16x16.txt";
const char *ground_truth_file =
"non_greedy_mv_test_files/ground_truth_16x16.txt";
BLOCK_SIZE bsize = BLOCK_32X32;
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;
read_in_mf(search_mf_file, &rows, &cols, &search_mf);
read_in_local_var(local_var_file, &rows, &cols, &local_var);
read_in_mf(estimation_file, &rows, &cols, &estimation);
read_in_mf(ground_truth_file, &rows, &cols, &ground_truth);
float sm_mean, sm_std;
float est_mean, est_std;
smooth_mf = (MV *)malloc(rows * cols * sizeof(MV));
vp9_get_smooth_motion_field(search_mf, local_var, rows, cols, bsize, alpha,
max_iter, smooth_mf);
compare_mf(smooth_mf, ground_truth, rows, cols, &sm_mean, &sm_std);
compare_mf(smooth_mf, estimation, rows, cols, &est_mean, &est_std);
EXPECT_LE(sm_mean, 3);
EXPECT_LE(est_mean, 2);
free(search_mf);
free(local_var);
free(estimation);
free(ground_truth);
free(smooth_mf);
}
TEST(non_greedy_mv, local_var) {
const char *ref_frame_file = "non_greedy_mv_test_files/ref_frame_16x16.txt";
const char *cur_frame_file = "non_greedy_mv_test_files/cur_frame_16x16.txt";
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] = nullptr;
int(*est_local_var)[MF_LOCAL_STRUCTURE_SIZE] = nullptr;
YV12_BUFFER_CONFIG ref_frame, cur_frame;
int rows, cols;
MV *search_mf;
int int_type;
int local_var_diff;
vp9_variance_fn_ptr_t fn;
load_frame_info(ref_frame_file, &ref_frame);
load_frame_info(cur_frame_file, &cur_frame);
read_in_mf(search_mf_file, &rows, &cols, &search_mf);
fn.sdf = vpx_sad16x16;
est_local_var = (int(*)[MF_LOCAL_STRUCTURE_SIZE])malloc(
rows * cols * MF_LOCAL_STRUCTURE_SIZE * sizeof(int_type));
vp9_get_local_structure(&cur_frame, &ref_frame, search_mf, &fn, rows, cols,
bsize, est_local_var);
read_in_local_var(gt_local_var_file, &rows, &cols, &gt_local_var);
local_var_diff = compare_local_var(est_local_var, gt_local_var, rows, cols);
EXPECT_LE(local_var_diff, 1);
free(gt_local_var);
free(est_local_var);
free(ref_frame.y_buffer);
}
} // namespace
+31 -17
View File
@@ -102,11 +102,11 @@ class PartialIDctTest : public ::testing::TestWithParam<PartialInvTxfmParam> {
virtual void TearDown() { virtual void TearDown() {
vpx_free(input_block_); vpx_free(input_block_);
input_block_ = NULL; input_block_ = nullptr;
vpx_free(output_block_); vpx_free(output_block_);
output_block_ = NULL; output_block_ = nullptr;
vpx_free(output_block_ref_); vpx_free(output_block_ref_);
output_block_ref_ = NULL; output_block_ref_ = nullptr;
libvpx_test::ClearSystemState(); libvpx_test::ClearSystemState();
} }
@@ -474,8 +474,8 @@ const PartialInvTxfmParam c_partial_idct_tests[] = {
&wrapper<vpx_idct4x4_1_add_c>, TX_4X4, 1, 8, 1) &wrapper<vpx_idct4x4_1_add_c>, TX_4X4, 1, 8, 1)
}; };
INSTANTIATE_TEST_CASE_P(C, PartialIDctTest, INSTANTIATE_TEST_SUITE_P(C, PartialIDctTest,
::testing::ValuesIn(c_partial_idct_tests)); ::testing::ValuesIn(c_partial_idct_tests));
#if !CONFIG_EMULATE_HARDWARE #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) &wrapper<vpx_idct4x4_1_add_neon>, TX_4X4, 1, 8, 1)
}; };
INSTANTIATE_TEST_CASE_P(NEON, PartialIDctTest, INSTANTIATE_TEST_SUITE_P(NEON, PartialIDctTest,
::testing::ValuesIn(neon_partial_idct_tests)); ::testing::ValuesIn(neon_partial_idct_tests));
#endif // HAVE_NEON #endif // HAVE_NEON
#if HAVE_SSE2 #if HAVE_SSE2
@@ -776,8 +776,8 @@ const PartialInvTxfmParam sse2_partial_idct_tests[] = {
&wrapper<vpx_idct4x4_1_add_sse2>, TX_4X4, 1, 8, 1) &wrapper<vpx_idct4x4_1_add_sse2>, TX_4X4, 1, 8, 1)
}; };
INSTANTIATE_TEST_CASE_P(SSE2, PartialIDctTest, INSTANTIATE_TEST_SUITE_P(SSE2, PartialIDctTest,
::testing::ValuesIn(sse2_partial_idct_tests)); ::testing::ValuesIn(sse2_partial_idct_tests));
#endif // HAVE_SSE2 #endif // HAVE_SSE2
@@ -791,8 +791,8 @@ const PartialInvTxfmParam ssse3_partial_idct_tests[] = {
&wrapper<vpx_idct8x8_12_add_ssse3>, TX_8X8, 12, 8, 1) &wrapper<vpx_idct8x8_12_add_ssse3>, TX_8X8, 12, 8, 1)
}; };
INSTANTIATE_TEST_CASE_P(SSSE3, PartialIDctTest, INSTANTIATE_TEST_SUITE_P(SSSE3, PartialIDctTest,
::testing::ValuesIn(ssse3_partial_idct_tests)); ::testing::ValuesIn(ssse3_partial_idct_tests));
#endif // HAVE_SSSE3 #endif // HAVE_SSSE3
#if HAVE_SSE4_1 && CONFIG_VP9_HIGHBITDEPTH #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) &highbd_wrapper<vpx_highbd_idct4x4_16_add_sse4_1>, TX_4X4, 16, 12, 2)
}; };
INSTANTIATE_TEST_CASE_P(SSE4_1, PartialIDctTest, INSTANTIATE_TEST_SUITE_P(SSE4_1, PartialIDctTest,
::testing::ValuesIn(sse4_1_partial_idct_tests)); ::testing::ValuesIn(sse4_1_partial_idct_tests));
#endif // HAVE_SSE4_1 && CONFIG_VP9_HIGHBITDEPTH #endif // HAVE_SSE4_1 && CONFIG_VP9_HIGHBITDEPTH
#if HAVE_DSPR2 && !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) &wrapper<vpx_idct4x4_1_add_dspr2>, TX_4X4, 1, 8, 1)
}; };
INSTANTIATE_TEST_CASE_P(DSPR2, PartialIDctTest, INSTANTIATE_TEST_SUITE_P(DSPR2, PartialIDctTest,
::testing::ValuesIn(dspr2_partial_idct_tests)); ::testing::ValuesIn(dspr2_partial_idct_tests));
#endif // HAVE_DSPR2 && !CONFIG_VP9_HIGHBITDEPTH #endif // HAVE_DSPR2 && !CONFIG_VP9_HIGHBITDEPTH
#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH #if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH
@@ -950,10 +950,24 @@ const PartialInvTxfmParam msa_partial_idct_tests[] = {
&wrapper<vpx_idct4x4_1_add_msa>, TX_4X4, 1, 8, 1) &wrapper<vpx_idct4x4_1_add_msa>, TX_4X4, 1, 8, 1)
}; };
INSTANTIATE_TEST_CASE_P(MSA, PartialIDctTest, INSTANTIATE_TEST_SUITE_P(MSA, PartialIDctTest,
::testing::ValuesIn(msa_partial_idct_tests)); ::testing::ValuesIn(msa_partial_idct_tests));
#endif // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH #endif // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH
#if HAVE_LSX && !CONFIG_VP9_HIGHBITDEPTH
const PartialInvTxfmParam lsx_partial_idct_tests[] = {
make_tuple(&vpx_fdct32x32_c, &wrapper<vpx_idct32x32_1024_add_c>,
&wrapper<vpx_idct32x32_1024_add_lsx>, TX_32X32, 1024, 8, 1),
make_tuple(&vpx_fdct32x32_c, &wrapper<vpx_idct32x32_34_add_c>,
&wrapper<vpx_idct32x32_34_add_lsx>, TX_32X32, 34, 8, 1),
make_tuple(&vpx_fdct32x32_c, &wrapper<vpx_idct32x32_1_add_c>,
&wrapper<vpx_idct32x32_1_add_lsx>, TX_32X32, 1, 8, 1),
};
INSTANTIATE_TEST_SUITE_P(LSX, PartialIDctTest,
::testing::ValuesIn(lsx_partial_idct_tests));
#endif // HAVE_LSX && !CONFIG_VP9_HIGHBITDEPTH
#endif // !CONFIG_EMULATE_HARDWARE #endif // !CONFIG_EMULATE_HARDWARE
} // namespace } // namespace

Some files were not shown because too many files have changed in this diff Show More