mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-17 23:08:35 +00:00
[libvpx] Update to v1.17.0-97-gd3335af9e (#3290)
* [libvpx] Update to v1.17.0-97-gd3335af9e * [libvpx] Fix pthread configure checks: "Null pointer passed as an argument to a 'nonnull' parameter" * [libvpx] Fix threading.
This commit is contained in:
615 files changed
+68649
-28903
No files matched your search
@@ -5,6 +5,7 @@ Aℓex 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>
|
||||
Bohan Li <bohanli@google.com>
|
||||
Chris Cunningham <chcunningham@chromium.org>
|
||||
Chi Yo Tsai <chiyotsai@google.com>
|
||||
Daniele Castagna <dcastagna@chromium.org> <dcastagna@google.com>
|
||||
@@ -20,11 +21,13 @@ 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> <johannkoenig@dhcp-172-19-7-52.mtv.corp.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>
|
||||
Johann <johann@duck.com> <johann.koenig@gmail.com>
|
||||
John Koleszar <jkoleszar@google.com>
|
||||
Joshua Litt <joshualitt@google.com> <joshualitt@chromium.org>
|
||||
Konstantinos Margaritis <konma@vectorcamp.gr> <konstantinos@vectorcamp.gr>
|
||||
Marco Paniconi <marpan@google.com>
|
||||
Marco Paniconi <marpan@google.com> <marpan@chromium.org>
|
||||
Martin Storsjö <martin@martin.st>
|
||||
@@ -52,4 +55,4 @@ 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>
|
||||
Xiwei Gu <guxiwei-hf@loongson.cn>
|
||||
+1
-1
@@ -1 +1 @@
|
||||
Mon Jul 06 01:46:10 UTC 2026
|
||||
Mon 09 Nov 2026 11:33:20 PM UTC
|
||||
+40
-1
@@ -12,38 +12,53 @@ Alexander Potapenko <glider@google.com>
|
||||
Alexander Voronov <avoronov@graphics.cs.msu.ru>
|
||||
Alexandra Hájková <alexandra.khirnova@gmail.com>
|
||||
Aℓex Converse <alexconv@twitch.tv>
|
||||
Alex Davicenko <alex.davicenko@arm.com>
|
||||
Alexis Ballier <aballier@gentoo.org>
|
||||
Alok Ahuja <waveletcoeff@gmail.com>
|
||||
Alpha Lam <hclam@google.com>
|
||||
A.Mahfoodh <ab.mahfoodh@gmail.com>
|
||||
Ami Fischman <fischman@chromium.org>
|
||||
Andoni Morales Alastruey <ylatuya@gmail.com>
|
||||
Andres Calderon Jaramillo <andrescj@chromium.org>
|
||||
Andres Mejia <mcitadel@gmail.com>
|
||||
Andrew Lewis <andrewlewis@google.com>
|
||||
Andrew Russell <anrussell@google.com>
|
||||
Andrew Salkeld <andrew.salkeld@arm.com>
|
||||
Andrey Filipenkov <kambalaDecapitator@gmail.com>
|
||||
Angie Chen <yunqi@google.com>
|
||||
Angie Chiang <angiebird@google.com>
|
||||
Anton Venema <anton.venema@liveswitch.com>
|
||||
Anupam Pandey <anupam.pandey@ittiam.com>
|
||||
Aron Rosenberg <arosenberg@logitech.com>
|
||||
Attila Nagy <attilanagy@google.com>
|
||||
Birk Magnussen <birk.magnussen@googlemail.com>
|
||||
Bohan Li <bohanli@google.com>
|
||||
Brian Foley <bpfoley@google.com>
|
||||
Brion Vibber <bvibber@wikimedia.org>
|
||||
Casey Smalley <casey.smalley@arm.com>
|
||||
changjun.yang <changjun.yang@intel.com>
|
||||
Charles 'Buck' Krasic <ckrasic@google.com>
|
||||
Cheng Chen <chengchen@google.com>
|
||||
Chen Wang <wangchen20@iscas.ac.cn>
|
||||
Cherma Rajan A <cherma.rajan@ittiam.com>
|
||||
Chi Yo Tsai <chiyotsai@google.com>
|
||||
chm <chm@rock-chips.com>
|
||||
Chris Cunningham <chcunningham@chromium.org>
|
||||
Christian Duvivier <cduvivier@google.com>
|
||||
Chunbo Hua <chunbo.hua@intel.com>
|
||||
Chun-Min Chang <chun.m.chang@gmail.com>
|
||||
Clement Courbet <courbet@google.com>
|
||||
CodeByMoriarty <alacambradev@gmail.com>
|
||||
Daniel Cheng <dcheng@chromium.org>
|
||||
Daniele Castagna <dcastagna@chromium.org>
|
||||
Daniel Kang <ddkang@google.com>
|
||||
Daniel Sommermann <dcsommer@gmail.com>
|
||||
Dan Zhu <zxdan@google.com>
|
||||
Darryl Pogue <darryl@dpogue.ca>
|
||||
David Benjamin <davidben@google.com>
|
||||
Deb Mukherjee <debargha@google.com>
|
||||
Deepa K G <deepa.kg@ittiam.com>
|
||||
Diksha Singh <diksha.singh@ittiam.com>
|
||||
Dim Temp <dimtemp0@gmail.com>
|
||||
Dmitry Kovalev <dkovalev@google.com>
|
||||
Dragan Mrdjan <dmrdjan@mips.com>
|
||||
@@ -52,12 +67,16 @@ Ehsan Akhgari <ehsan.akhgari@gmail.com>
|
||||
Elliott Karpilovsky <elliottk@google.com>
|
||||
Erik Niemeyer <erik.a.niemeyer@intel.com>
|
||||
Fabio Pedretti <fabio.ped@libero.it>
|
||||
Feng, Feifei <Feifei.Feng@partner.bmw.de>
|
||||
Florian Mayer <fmayer@google.com>
|
||||
Frank Galligan <fgalligan@google.com>
|
||||
Fredrik Söderquist <fs@opera.com>
|
||||
Fritz Koenig <frkoenig@google.com>
|
||||
Fyodor Kyslov <kyslov@google.com>
|
||||
Gabriel Marin <gmx@chromium.org>
|
||||
Gaute Strokkenes <gaute.strokkenes@broadcom.com>
|
||||
George Steed <george.steed@arm.com>
|
||||
Gerda Zsejke More <gerdazsejke.more@arm.com>
|
||||
Geza Lore <gezalore@gmail.com>
|
||||
Ghislain MARY <ghislainmary2@gmail.com>
|
||||
Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
@@ -65,10 +84,12 @@ Gordana Cmiljanovic <gordana.cmiljanovic@imgtec.com>
|
||||
Gregor Jasny <gjasny@gmail.com>
|
||||
Guillaume Martres <gmartres@google.com>
|
||||
Guillermo Ballester Valor <gbvalor@gmail.com>
|
||||
Hang Nguyen <hnt@google.com>
|
||||
Hangyu Kuang <hkuang@google.com>
|
||||
Hanno Böck <hanno@hboeck.de>
|
||||
Han Shen <shenhan@google.com>
|
||||
Hao Chen <chenhao@loongson.cn>
|
||||
Hari Limaye <hari.limaye@arm.com>
|
||||
Harish Mahendrakar <harish.mahendrakar@ittiam.com>
|
||||
Henrik Lundin <hlundin@google.com>
|
||||
Hien Ho <hienho@google.com>
|
||||
@@ -84,12 +105,14 @@ James Touton <bekenn@gmail.com>
|
||||
James Yu <james.yu@linaro.org>
|
||||
James Zern <jzern@google.com>
|
||||
Jan Gerber <j@mailb.org>
|
||||
Jan-Ivar Bruaroey <jbruaroey@mozilla.com>
|
||||
Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Janne Salonen <jsalonen@google.com>
|
||||
Jean-Yves Avenard <jyavenard@mozilla.com>
|
||||
Jeff Faust <jfaust@google.com>
|
||||
Jeff Muizelaar <jmuizelaar@mozilla.com>
|
||||
Jeff Petkau <jpet@chromium.org>
|
||||
Jeremy Dorfman <jdorfman@google.com>
|
||||
Jeremy Leconte <jleconte@google.com>
|
||||
Jerome Jiang <jianj@google.com>
|
||||
Jia Jia <jia.jia@linaro.org>
|
||||
@@ -101,6 +124,7 @@ Jin Bo <jinbo@loongson.cn>
|
||||
Jingning Han <jingning@google.com>
|
||||
Joel Fernandes <joelaf@google.com>
|
||||
Joey Parrish <joeyparrish@google.com>
|
||||
Johann <johann@duck.com>
|
||||
Johann Koenig <johannkoenig@google.com>
|
||||
John Koleszar <jkoleszar@google.com>
|
||||
Johnny Klonaris <google@jawknee.com>
|
||||
@@ -114,12 +138,16 @@ Julia Robson <juliamrobson@gmail.com>
|
||||
Justin Clift <justin@salasaga.org>
|
||||
Justin Lebar <justin.lebar@gmail.com>
|
||||
Kaustubh Raste <kaustubh.raste@imgtec.com>
|
||||
Kexy Biscuit <kexybiscuit@aosc.io>
|
||||
KO Myung-Hun <komh@chollian.net>
|
||||
Konstantinos Margaritis <konma@vectorcamp.gr>
|
||||
Kyle Siefring <kylesiefring@gmail.com>
|
||||
Lawrence Velázquez <larryv@macports.org>
|
||||
L. E. Segovia <amy@amyspark.me>
|
||||
Linfeng Zhang <linfengz@google.com>
|
||||
Lin Zheng <linzhen@google.com>
|
||||
Liu Peng <pengliu.mail@gmail.com>
|
||||
Li Zhang <li.zhang2@arm.com>
|
||||
Lou Quillio <louquillio@google.com>
|
||||
Luca Barbato <lu_zero@gentoo.org>
|
||||
Luc Trudeau <luc@trud.ca>
|
||||
@@ -134,6 +162,7 @@ Matthew Heaney <matthewjheaney@chromium.org>
|
||||
Matthias Räncker <theonetruecamper@gmx.de>
|
||||
Michael Horowitz <mhoro@webrtc.org>
|
||||
Michael Kohler <michaelkohler@live.com>
|
||||
Michał Janiszewski <janisozaur@gmail.com>
|
||||
Mike Frysinger <vapier@chromium.org>
|
||||
Mike Hommey <mhommey@mozilla.com>
|
||||
Mikhal Shemer <mikhal@google.com>
|
||||
@@ -145,6 +174,7 @@ Mirko Bonadei <mbonadei@google.com>
|
||||
Moriyoshi Koizumi <mozo@mozo.jp>
|
||||
Morton Jonuschat <yabawock@gmail.com>
|
||||
Nathan E. Egge <negge@mozilla.com>
|
||||
Neeraj Gadgil <neeraj.gadgil@ittiam.com>
|
||||
Neil Birkbeck <neil.birkbeck@gmail.com>
|
||||
Nico Weber <thakis@chromium.org>
|
||||
Niveditha Rau <niveditha.rau@gmail.com>
|
||||
@@ -160,12 +190,15 @@ Peter Collingbourne <pcc@chromium.org>
|
||||
Peter de Rivaz <peter.derivaz@gmail.com>
|
||||
Peter Kasting <pkasting@chromium.org>
|
||||
Philip Jägenstedt <philipj@opera.com>
|
||||
Philippe Antoine <p.antoine@catenacyber.fr>
|
||||
Philipp Hancke <phancke@meta.com>
|
||||
Priit Laes <plaes@plaes.org>
|
||||
Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
|
||||
Rafaël Carré <funman@videolan.org>
|
||||
Rafael de Lucena Valle <rafaeldelucena@gmail.com>
|
||||
Rahul Chaudhry <rahulchaudhry@google.com>
|
||||
Ralph Giles <giles@xiph.org>
|
||||
Ram Mohan M <ram.mohan@ittiam.com>
|
||||
Ranjit Kumar Tulabandu <ranjit.tulabandu@ittiam.com>
|
||||
Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
|
||||
Ravi Chaudhary <ravi.chaudhary@ittiam.com>
|
||||
@@ -174,7 +207,9 @@ Rob Bradford <rob@linux.intel.com>
|
||||
Ronald S. Bultje <rsbultje@gmail.com>
|
||||
Rui Ueyama <ruiu@google.com>
|
||||
Sai Deng <sdeng@google.com>
|
||||
Salome Thirot <salome.thirot@arm.com>
|
||||
Sami Pietilä <samipietila@google.com>
|
||||
Sam James <sam@gentoo.org>
|
||||
Sarah Parker <sarahparker@google.com>
|
||||
Sasi Inguva <isasi@google.com>
|
||||
Scott Graham <scottmg@chromium.org>
|
||||
@@ -209,9 +244,11 @@ Vitaly Buka <vitalybuka@chromium.org>
|
||||
Vlad Tsyrklevich <vtsyrklevich@chromium.org>
|
||||
Wan-Teh Chang <wtc@google.com>
|
||||
Wonkap Jang <wonkap@google.com>
|
||||
xiwei gu <guxiwei-hf@loongson.cn>
|
||||
Xiahong Bao <xiahong.bao@nxp.com>
|
||||
Xiwei Gu <guxiwei-hf@loongson.cn>
|
||||
Yaowu Xu <yaowu@google.com>
|
||||
Yi Luo <luoyi@google.com>
|
||||
Yongseok Jeon <ysjeon741@gmail.com>
|
||||
Yongzhe Wang <yongzhe@google.com>
|
||||
yuanhecai <yuanhecai@loongson.cn>
|
||||
Yue Chen <yuec@google.com>
|
||||
@@ -219,6 +256,8 @@ Yun Liu <yliuyliu@google.com>
|
||||
Yunqing Wang <yunqingwang@google.com>
|
||||
Yury Gitman <yuryg@google.com>
|
||||
Zoe Liu <zoeliu@google.com>
|
||||
Zoltan Kuscsik <zoltan@s57.io>
|
||||
zuxy <zuxy.meng@gmail.com>
|
||||
Google Inc.
|
||||
The Mozilla Foundation
|
||||
The Xiph.Org Foundation
|
||||
+366
-1
@@ -1,3 +1,362 @@
|
||||
2026-08-07 v1.17.0 "Yellowbilled Duck"
|
||||
This release includes a new encoder control to validate high bitdepth input,
|
||||
additional Neon and AVX2/AVX512 optimizations, support for the C11 standard,
|
||||
and numerous bug fixes.
|
||||
|
||||
- Upgrading:
|
||||
This release is ABI compatible with the previous release.
|
||||
|
||||
ISO C11 standard is now enforced for C files.
|
||||
|
||||
SVC is now strictly disallowed for 2-pass encoding; enabling it will return
|
||||
VPX_CODEC_INVALID_PARAM.
|
||||
|
||||
VP9 High Bitdepth (HBD) input validation is now enabled by default. If the
|
||||
input contains values outside the valid range, the encoder will return
|
||||
VPX_CODEC_INVALID_PARAM. Use the new VP9E_SET_VALIDATE_HBD_INPUT control
|
||||
(or vpxenc --validate-hbd-input=0) to disable this validation.
|
||||
|
||||
VP9 now sets the returned image width (w) and height (h) to the actual
|
||||
width and height, rather than the stride and aligned height. This is a
|
||||
behavior change that may affect applications relying on w being equal to the
|
||||
stride or h being the aligned height.
|
||||
|
||||
Strict validation has been added to some APIs:
|
||||
- Encoders (VP8/VP9) now reject input images with unequal U and V strides.
|
||||
- vpx_img_alloc() and vpx_img_wrap() now strictly validate the image format.
|
||||
- External rate control (RTC) API now validates configuration inputs.
|
||||
- VP9 SVC now validates spatial layer ID input.
|
||||
|
||||
- Enhancement:
|
||||
Added Arm Neon DotProd subpel variance paths.
|
||||
Optimized Neon HBD sadx4d and sad_skipx4d functions.
|
||||
Added AVX2/AVX512 implementations for various vpx_highbd predictor
|
||||
functions.
|
||||
Added support for MSVC v145 (Visual Studio 2026).
|
||||
Added configure option --disable-x86-asm.
|
||||
|
||||
- Bug fixes:
|
||||
Fix to heap buffer overflow / out-of-bounds write in vp9_postproc,
|
||||
vp8-multi-res-encoding, vpx_setup_noise, set_mb_ssim_rdmult_scaling,
|
||||
vp9_change_config (resolution change), vp9_dec_alloc_row_mt_mem (decode
|
||||
coeffs), and vp8_sixtap_predict (LoongArch).
|
||||
|
||||
Fix to integer overflow in vp9-svc (layer resolution, duration),
|
||||
set_mb_ssim_rdmult_scaling, vp8_encode_frame, calc_pframe_target_size,
|
||||
y4minput buffer size calculations, and get_token_alloc.
|
||||
|
||||
Fix to VP8 decoder crash on flush with no fragments.
|
||||
Fix to VP8 decoder potential hang/slowdown with corrupt partition 0 size.
|
||||
Fix to VP9 decoder crash with invalid reference frame index.
|
||||
Fix to VP9 highbitdepth encoder format mismatch.
|
||||
Fix to VP9 float-to-int overflow in validate_config (EOS count) and with
|
||||
zero bitrate.
|
||||
|
||||
Fix to VP8 decoder multithreading corruption flag reset at start of
|
||||
frame.
|
||||
Fix to VP8 decoder accepting inter frames on resolution change before
|
||||
keyframe.
|
||||
Fix to VP8 encoder reference frame dimension validation.
|
||||
Fix to VP8 encoder temporal layer ID validation.
|
||||
Fix to VP8 encoder missing setjmp in VP8E_SET_SCALEMODE.
|
||||
|
||||
Fix to VP9 SVC encoder crash with dynamic resize and cyclic refresh
|
||||
(aq_mode=3).
|
||||
Fix to VP9 1-pass rate control last_boosted_qindex clamping and
|
||||
VP9E_SET_QUANTIZER_ONE_PASS validation.
|
||||
|
||||
Fix to NV12 x_chroma_shift calculation in vpx_image and image2yuvconfig.
|
||||
Fix to AVX-512 CPU feature detection on older x86 CPUs.
|
||||
Fix to x86_abi_support.asm placing read-only data tables in .rdata for
|
||||
Windows.
|
||||
Fix to configure disabling _FORTIFY_SOURCE on Linux.
|
||||
Fix to file leaks on error paths in vpxdec and video reader/writer
|
||||
utilities.
|
||||
|
||||
Fix to crash/undefined behavior in vpx_img_flip with formats without alpha.
|
||||
|
||||
2026-01-06 v1.16.0 "Xenonetta Duck"
|
||||
This release includes Arm SVE2 and Neon optimizations for 12-tap filters,
|
||||
AVX512 implementations for SAD, support for per-frame and per-spatial-layer
|
||||
PSNR calculation, and numerous bug fixes.
|
||||
|
||||
- Upgrading:
|
||||
This release is ABI incompatible with the previous release.
|
||||
|
||||
Unit tests require C++17 to build.
|
||||
|
||||
Support for 32-bit iOS targets (armv7, armv7s, and i386) has been removed.
|
||||
|
||||
- Enhancement:
|
||||
Optimized Arm SVE2 and Neon implementations for 12-tap convolution filters.
|
||||
Optimized Neon High Bitdepth (HBD) SAD and sad_avg functions.
|
||||
Added Arm Neon DotProd and I8MM implementations for vpx_convolve12.
|
||||
Added AVX512 implementations for SAD64 and sad_skip functions.
|
||||
Added SSSE3 and AVX2 implementations for 12-tap temporal filter prediction.
|
||||
Added support for per-frame and per-spatial-layer PSNR calculation.
|
||||
|
||||
Adjusted temporal filter strength to improve visual quality and reduce block
|
||||
artifacts.
|
||||
|
||||
Added support for darwin24 (macOS 15) and darwin25 (macOS 26).
|
||||
libwebm is upgraded to commit b4f01ea.
|
||||
|
||||
- Bug fixes:
|
||||
Fix to heap buffer overflow in vp9_deblock, vp9_post_proc_frame, and
|
||||
vp9_pack_bitstream.
|
||||
|
||||
Fix to integer overflow in vp9_highbd_post_proc, vp9_rc_regulate_q,
|
||||
tiny_ssim, and vp9_calc_pframe_target_size_one_pass_cbr.
|
||||
|
||||
Fix to use-of-uninitialized-value in vp9_highbd_post_proc, mfqe, and
|
||||
vp8_datarate_test.
|
||||
|
||||
Fix to out-of-bounds in log_tile_cols_from_picsize_level.
|
||||
Fix to double free on initialization failure in vpx_codec_enc_init_multi.
|
||||
Fix to division-by-zero crash in vpxenc with 0 FPS numerator input.
|
||||
|
||||
Fix to various build failures for Arm/SVE2, macOS cross-compilation, and
|
||||
Xcode 16.
|
||||
|
||||
2025-05-28 v1.15.2 "Wigeon Duck"
|
||||
This release fixes CVE-2025-5283 (bug webm:413411335), and is ABI compatible
|
||||
with the previous release.
|
||||
|
||||
2025-01-09 v1.15.1 "Wigeon Duck"
|
||||
This release bumps up the SO major version and fixes the language about ABI
|
||||
compatibility in the previous release changelog.
|
||||
|
||||
2024-10-22 v1.15.0 "Wigeon Duck"
|
||||
This release includes new codec control for key frame filtering, more Neon
|
||||
optimizations, improvements to RTC encoding and bug fixes.
|
||||
|
||||
- Upgrading:
|
||||
This release is ABI incompatible with the previous release.
|
||||
|
||||
It is strongly recommended to skip this release and upgrade to v1.15.1 since
|
||||
the shared object was versioned incorrectly, as shown in
|
||||
https://issues.webmproject.org/issues/384672478.
|
||||
|
||||
Temporal filtering improvement that can be turned on with the new codec
|
||||
control VP9E_SET_KEY_FRAME_FILTERING, which gives 1+% BD-rate saving with
|
||||
minimal encoder time increase.
|
||||
|
||||
libwebm is upgraded to libwebm-1.0.0.31-10-g3b63004
|
||||
|
||||
- Enhancement:
|
||||
Neon optimization speed up
|
||||
1-3% speed up across speed 5 to 10 for RTC
|
||||
3% speed up for speed 0 and 1 for VoD in standard bitdepth
|
||||
3% and 7% speed up for speed 0 and 1 respectively for VoD in high bitdepth
|
||||
Scene detection is allowed for all RTC speeds (>=5)
|
||||
Support profile guided optimizations
|
||||
|
||||
Delta quantization parameters for UV channels for vp8 is supported in RTC
|
||||
rate control library
|
||||
|
||||
Rate control parameters are reset and maximum QP is enforced on scene
|
||||
changes in SVC when there is no inter-layer prediction
|
||||
|
||||
- Bug fixes:
|
||||
Fix to Uninitialized scalar variable in `vp9_rd_pick_inter_mode_sb()`
|
||||
Fix to Integer-overflow in `resize_multistep`
|
||||
Fix to Heap-buffer-overflow in `vpx_sad64x64_avx2`
|
||||
Fix to Crash in `vpx_sad8x8_sse2`
|
||||
Fix to Assertion in `write_modes`
|
||||
Support profile guided optimizations
|
||||
Fix to Integer-overflow in `encode_frame_to_data_rate`
|
||||
Fix to Integer-overflow in `vp9_svc_check_reset_layer_rc_flag`
|
||||
Fix to core dump error from /usr/bin/tools/tiny_ssim --help
|
||||
Fix to use-of-uninitialized-value in `vp9_setup_tpl_stats`
|
||||
Fix to Undefined-shift in `vp9_cyclic_refresh_setup`
|
||||
Fix to redundant `&& __GNUC__` preproc check
|
||||
Fix to valgrind warning in EncodeAPI.OssFuzz69906
|
||||
Fix to Index-out-of-bounds in `vp8_rd_pick_inter_mode`
|
||||
Fix to Integer-overflow in `vp8_pick_frame_size`
|
||||
Fix to Use-of-uninitialized-value in `vpx_codec_peek_stream_info`
|
||||
Fix to log clutters with the message "Warning: Desired height too large"
|
||||
Fix to Integer-overflow in `vp9_svc_adjust_avg_frame_qindex`
|
||||
|
||||
Fix to integer overflows caused by huge target bitrate, frame rate, or
|
||||
g_timebase numerator or denominator
|
||||
|
||||
Fix to missing license headers
|
||||
Fix to build failure for Android Armv7
|
||||
Fix to integer overflows in image helpers
|
||||
Fix to Integer-overflow in `vp9_calc_iframe_target_size_one_pass_cbr`
|
||||
Fix to Heap-buffer-overflow in `vp9_pick_inter_mode`
|
||||
Fix to Segv in `vp9_multi_thread_tile_init`
|
||||
Fix to Use-of-uninitialized-value in `vp9_row_mt_sync_mem_dealloc`
|
||||
Fix to Crash in `mbloop_filter_vertical_edge_c`
|
||||
Fix to Check failed in CheckUnwind
|
||||
Fix to Heap-buffer-overflow in `write_modes_b` and `vpx_write`
|
||||
Fix to Possible signed integer overflow found in `vpx_codec_encode`
|
||||
Fix to build conflicts between Abseil and libaom/libvpx in Win ARM64 builds
|
||||
Fix to build failures on aarch64
|
||||
Fix to Data race in libvpx ARM NEON
|
||||
Fix to Heap-buffer-overflow in `scale_plane_1_to_2_phase_0`
|
||||
Fix to integer overflow in `encode_mb_row`
|
||||
Fix to Floating-point-exception in `vp8_pick_frame_size`
|
||||
Fix to Heap-buffer-overflow in `vp9_enc_setup_mi`
|
||||
Fix to build failure with --target=arm64-win64-vs17
|
||||
Fix to heap-buffer-overflow write in `vpx_img_read()`
|
||||
Fix to C vs armv8-linux-gcc encode mismatches for `y4m_360p_10bit_input`
|
||||
Fix to Null-dereference READ in `ml_predict_var_rd_partitioning`
|
||||
Fix to Heap-buffer-overflow in `vpx_scaled_2d_ssse3`
|
||||
Fix to Crash in `convolve_horiz`
|
||||
Fix to Ill in `vpx_scaled_2d_ssse3`
|
||||
Fix to Global-buffer-overflow in `cost_coeffs`
|
||||
|
||||
2024-05-21 v1.14.1 "Venetian Duck"
|
||||
This release includes enhancements and bug fixes.
|
||||
|
||||
- Upgrading:
|
||||
This release is ABI compatible with the previous release.
|
||||
|
||||
- Enhancement:
|
||||
Improved the detection of compiler support for AArch64 extensions,
|
||||
particularly SVE.
|
||||
|
||||
Added vpx_codec_get_global_headers() support for VP9.
|
||||
|
||||
- Bug fixes:
|
||||
Added buffer bounds checks to vpx_writer and vpx_write_bit_buffer.
|
||||
Fix to GetSegmentationData() crash in aq_mode=0 for RTC rate control.
|
||||
Fix to alloc for row_base_thresh_freq_fac.
|
||||
Free row mt memory before freeing cpi->tile_data.
|
||||
Fix to buffer alloc for vp9_bitstream_worker_data.
|
||||
Fix to VP8 race issue for multi-thread with pnsr_calc.
|
||||
Fix to uv width/height in vp9_scale_and_extend_frame_ssse3.
|
||||
Fix to integer division by zero and overflow in calc_pframe_target_size().
|
||||
Fix to integer overflow in vpx_img_alloc() & vpx_img_wrap()(CVE-2024-5197).
|
||||
Fix to UBSan error in vp9_rc_update_framerate().
|
||||
Fix to UBSan errors in vp8_new_framerate().
|
||||
Fix to integer overflow in vp8 encodeframe.c.
|
||||
Handle EINTR from sem_wait().
|
||||
|
||||
2024-01-02 v1.14.0 "Venetian Duck"
|
||||
This release drops support for old C compilers, such as Visual Studio 2012
|
||||
and older, that disallow mixing variable declarations and statements (a C99
|
||||
feature). It adds support for run-time CPU feature detection for Arm
|
||||
platforms, as well as support for darwin23 (macOS 14).
|
||||
|
||||
- Upgrading:
|
||||
This release is ABI incompatible with the previous release.
|
||||
|
||||
Various new features for rate control library for real-time: SVC parallel
|
||||
encoding, loopfilter level, support for frame dropping, and screen content.
|
||||
|
||||
New callback function send_tpl_gop_stats for vp9 external rate control
|
||||
library, which can be used to transmit TPL stats for a group of pictures. A
|
||||
public header vpx_tpl.h is added for the definition of TPL stats used in
|
||||
this callback.
|
||||
|
||||
libwebm is upgraded to libwebm-1.0.0.29-9-g1930e3c.
|
||||
|
||||
- Enhancement:
|
||||
Improvements on Neon optimizations: VoD: 12-35% speed up for bitdepth 8,
|
||||
68%-151% speed up for high bitdepth.
|
||||
|
||||
Improvements on AVX2 and SSE optimizations.
|
||||
Improvements on LSX optimizations for LoongArch.
|
||||
42-49% speedup on speed 0 VoD encoding.
|
||||
Android API level predicates.
|
||||
|
||||
- Bug fixes:
|
||||
Fix to missing prototypes from the rtcd header.
|
||||
Fix to segfault when total size is enlarged but width is smaller.
|
||||
Fix to the build for arm64ec using MSVC.
|
||||
Fix to copy BLOCK_8X8's mi to PICK_MODE_CONTEXT::mic.
|
||||
Fix to -Wshadow warnings.
|
||||
Fix to heap overflow in vpx_get4x4sse_cs_neon.
|
||||
Fix to buffer overrun in highbd Neon subpel variance filters.
|
||||
Added bitexact encode test script.
|
||||
Fix to -Wl,-z,defs with Clang's sanitizers.
|
||||
Fix to decoder stability after error & continued decoding.
|
||||
Fix to mismatch of VP9 encode with NEON intrinsics with C only version.
|
||||
Fix to Arm64 MSVC compile vpx_highbd_fdct4x4_neon.
|
||||
Fix to fragments count before use.
|
||||
Fix to a case where target bandwidth is 0 for SVC.
|
||||
Fix mask in vp9_quantize_avx2,highbd_get_max_lane_eob.
|
||||
Fix to int overflow in vp9_calc_pframe_target_size_one_pass_cbr.
|
||||
Fix to integer overflow in vp8,ratectrl.c.
|
||||
Fix to integer overflow in vp9 svc.
|
||||
Fix to avg_frame_bandwidth overflow.
|
||||
Fix to per frame qp for temporal layers.
|
||||
Fix to unsigned integer overflow in sse computation.
|
||||
Fix to uninitialized mesh feature for BEST mode.
|
||||
Fix to overflow in highbd temporal_filter.
|
||||
Fix to unaligned loads w/w==4 in vpx_convolve_copy_neon.
|
||||
Skip arm64_neon.h workaround w/VS >= 2019.
|
||||
Fix to c vs avx mismatch of diamond_search_sad().
|
||||
Fix to c vs intrinsic mismatch of vpx_hadamard_32x32() function.
|
||||
Fix to a bug in vpx_hadamard_32x32_neon().
|
||||
Fix to Clang -Wunreachable-code-aggressive warnings.
|
||||
Fix to a bug in vpx_highbd_hadamard_32x32_neon().
|
||||
Fix to -Wunreachable-code in mfqe_partition.
|
||||
Force mode search on 64x64 if no mode is selected.
|
||||
Fix to ubsan failure caused by left shift of negative.
|
||||
Fix to integer overflow in calc_pframe_target_size.
|
||||
Fix to float-cast-overflow in vp8_change_config().
|
||||
Fix to a null ptr before use.
|
||||
Conditionally skip using inter frames in speed features.
|
||||
Remove invalid reference frames.
|
||||
Disable intra mode search speed features conditionally.
|
||||
Set nonrd keyframe under dynamic change of deadline for rtc.
|
||||
Fix to scaled reference offsets.
|
||||
Set skip_recode=0 in nonrd_pick_sb_modes.
|
||||
Fix to an edge case when downsizing to one.
|
||||
Fix to a bug in frame scaling.
|
||||
Fix to pred buffer stride.
|
||||
Fix to a bug in simple motion search.
|
||||
Update frame size in actual encoding.
|
||||
|
||||
2023-09-29 v1.13.1 "Ugly Duckling"
|
||||
This release contains two security related fixes. One each for VP8 and VP9.
|
||||
|
||||
- Upgrading:
|
||||
This release is ABI compatible with the previous release.
|
||||
|
||||
- Bug fixes:
|
||||
https://crbug.com/1486441 (CVE-2023-5217)
|
||||
Fix to a crash related to VP9 encoding (#1642, CVE-2023-6349)
|
||||
|
||||
2023-01-31 v1.13.0 "Ugly Duckling"
|
||||
This release includes more Neon and AVX2 optimizations, adds a new codec
|
||||
control to set per frame QP, upgrades GoogleTest to v1.12.1, and includes
|
||||
numerous bug fixes.
|
||||
|
||||
- Upgrading:
|
||||
This release is ABI incompatible with the previous release.
|
||||
|
||||
New codec control VP9E_SET_QUANTIZER_ONE_PASS to set per frame QP.
|
||||
|
||||
GoogleTest is upgraded to v1.12.1.
|
||||
|
||||
.clang-format is upgraded to clang-format-11.
|
||||
|
||||
VPX_EXT_RATECTRL_ABI_VERSION was bumped due to incompatible changes to the
|
||||
feature of using external rate control models for vp9.
|
||||
|
||||
- Enhancement:
|
||||
Numerous improvements on Neon optimizations.
|
||||
Numerous improvements on AVX2 optimizations.
|
||||
Additional ARM targets added for Visual Studio.
|
||||
|
||||
- Bug fixes:
|
||||
Fix to calculating internal stats when frame dropped.
|
||||
Fix to segfault for external resize test in vp9.
|
||||
Fix to build system with replacing egrep with grep -E.
|
||||
Fix to a few bugs with external RTC rate control library.
|
||||
Fix to make SVC work with VBR.
|
||||
Fix to key frame setting in VP9 external RC.
|
||||
Fix to -Wimplicit-int (Clang 16).
|
||||
Fix to VP8 external RC for buffer levels.
|
||||
Fix to VP8 external RC for dynamic update of layers.
|
||||
Fix to VP9 auto level.
|
||||
Fix to off-by-one error of max w/h in validate_config.
|
||||
Fix to make SVC work for Profile 1.
|
||||
|
||||
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
|
||||
@@ -36,6 +395,7 @@
|
||||
levels, and includes several improvements to NEON and numerous bug fixes.
|
||||
|
||||
- Upgrading:
|
||||
This release is ABI incompatible with the previous release.
|
||||
New codec control is added to get quantization parameters and loop filter
|
||||
levels.
|
||||
|
||||
@@ -61,6 +421,7 @@
|
||||
well as numerous bug fixes.
|
||||
|
||||
- Upgrading:
|
||||
This release is ABI incompatible with the previous release.
|
||||
New codec control is added to disable loopfilter for VP9.
|
||||
|
||||
New encoder control is added to disable feature to increase Q on overshoot
|
||||
@@ -91,6 +452,7 @@
|
||||
well as incremental improvements.
|
||||
|
||||
- Upgrading:
|
||||
This release is ABI compatible with the previous release.
|
||||
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.
|
||||
@@ -114,12 +476,14 @@
|
||||
This release collects incremental improvements to many aspects of the library.
|
||||
|
||||
- Upgrading:
|
||||
This release is ABI compatible with the previous release.
|
||||
ARCH_* defines have been removed in favor of VPX_ARCH_*.
|
||||
|
||||
2019-07-15 v1.8.1 "Orpington Duck"
|
||||
This release collects incremental improvements to many aspects of the library.
|
||||
|
||||
- Upgrading:
|
||||
This release is ABI incompatible with the previous release.
|
||||
VP8E_SET_CPUUSED now accepts values up to 9 for vp9.
|
||||
VPX_CTRL_VP9E_SET_MAX_INTER_BITRATE_PCT had a spelling fix (was VP8E).
|
||||
The --sdk-path option has been removed. If you were using it to build for
|
||||
@@ -138,7 +502,8 @@
|
||||
This release focused on encoding performance for realtime and VOD use cases.
|
||||
|
||||
- Upgrading:
|
||||
This adds and improves several vp9 controls. Most are related to SVC:
|
||||
This release is ABI incompatible with the previous release. This adds and
|
||||
improves several vp9 controls. Most are related to SVC:
|
||||
VP9E_SET_SVC_FRAME_DROP_LAYER:
|
||||
- Frame dropping in SVC.
|
||||
VP9E_SET_SVC_INTER_LAYER_PRED:
|
||||
|
||||
+71
-5
@@ -1,5 +1,3 @@
|
||||
v1.12.0 Torrent Duck
|
||||
|
||||
Welcome to the WebM VP8/VP9 Codec SDK!
|
||||
|
||||
COMPILING THE APPLICATIONS/LIBRARIES:
|
||||
@@ -9,7 +7,7 @@ COMPILING THE APPLICATIONS/LIBRARIES:
|
||||
|
||||
1. Prerequisites
|
||||
|
||||
* All x86 targets require the Yasm[1] assembler be installed[2].
|
||||
* All x86 targets require the NASM[0] or Yasm[1] assembler be installed[2].
|
||||
* All Windows builds require that Cygwin[3] or MSYS2[4] be installed.
|
||||
* Building the documentation requires Doxygen[5]. If you do not
|
||||
have this package, the install-docs option will be disabled.
|
||||
@@ -20,11 +18,15 @@ COMPILING THE APPLICATIONS/LIBRARIES:
|
||||
source[7]. These requirements are optional if not running the unit
|
||||
tests.
|
||||
|
||||
[0]: https://www.nasm.us/
|
||||
[1]: http://www.tortall.net/projects/yasm
|
||||
[2]: For Visual Studio the base yasm binary (not vsyasm) should be in the
|
||||
PATH for Visual Studio. For VS2017 it is sufficient to rename
|
||||
yasm-<version>-<arch>.exe to yasm.exe and place it in:
|
||||
Program Files (x86)/Microsoft Visual Studio/2017/<level>/Common7/Tools/
|
||||
The MSYS2 version of the yasm binary can also be used and avoids an
|
||||
issue caused by a missing Visual C++ Redistributable install (Visual
|
||||
Studio 2010, MSVCR100.dll).
|
||||
[3]: http://www.cygwin.com
|
||||
[4]: http://www.msys2.org/
|
||||
[5]: http://www.doxygen.org
|
||||
@@ -64,9 +66,20 @@ COMPILING THE APPLICATIONS/LIBRARIES:
|
||||
arm64-android-gcc
|
||||
arm64-darwin-gcc
|
||||
arm64-darwin20-gcc
|
||||
arm64-darwin21-gcc
|
||||
arm64-darwin22-gcc
|
||||
arm64-darwin23-gcc
|
||||
arm64-darwin24-gcc
|
||||
arm64-darwin25-gcc
|
||||
arm64-linux-gcc
|
||||
arm64-win64-gcc
|
||||
arm64-win64-vs15
|
||||
arm64-win64-vs16
|
||||
arm64-win64-vs16-clangcl
|
||||
arm64-win64-vs17
|
||||
arm64-win64-vs17-clangcl
|
||||
arm64-win64-vs18
|
||||
arm64-win64-vs18-clangcl
|
||||
armv7-android-gcc
|
||||
armv7-darwin-gcc
|
||||
armv7-linux-rvct
|
||||
@@ -75,8 +88,12 @@ COMPILING THE APPLICATIONS/LIBRARIES:
|
||||
armv7-win32-gcc
|
||||
armv7-win32-vs14
|
||||
armv7-win32-vs15
|
||||
armv7-win32-vs16
|
||||
armv7-win32-vs17
|
||||
armv7s-darwin-gcc
|
||||
armv8-linux-gcc
|
||||
loongarch32-linux-gcc
|
||||
loongarch64-linux-gcc
|
||||
mips32-linux-gcc
|
||||
mips64-linux-gcc
|
||||
ppc64le-linux-gcc
|
||||
@@ -104,6 +121,7 @@ COMPILING THE APPLICATIONS/LIBRARIES:
|
||||
x86-win32-vs15
|
||||
x86-win32-vs16
|
||||
x86-win32-vs17
|
||||
x86-win32-vs18
|
||||
x86_64-android-gcc
|
||||
x86_64-darwin9-gcc
|
||||
x86_64-darwin10-gcc
|
||||
@@ -117,6 +135,11 @@ COMPILING THE APPLICATIONS/LIBRARIES:
|
||||
x86_64-darwin18-gcc
|
||||
x86_64-darwin19-gcc
|
||||
x86_64-darwin20-gcc
|
||||
x86_64-darwin21-gcc
|
||||
x86_64-darwin22-gcc
|
||||
x86_64-darwin23-gcc
|
||||
x86_64-darwin24-gcc
|
||||
x86_64-darwin25-gcc
|
||||
x86_64-iphonesimulator-gcc
|
||||
x86_64-linux-gcc
|
||||
x86_64-linux-icc
|
||||
@@ -126,6 +149,7 @@ COMPILING THE APPLICATIONS/LIBRARIES:
|
||||
x86_64-win64-vs15
|
||||
x86_64-win64-vs16
|
||||
x86_64-win64-vs17
|
||||
x86_64-win64-vs18
|
||||
generic-gnu
|
||||
|
||||
The generic-gnu target, in conjunction with the CROSS environment variable,
|
||||
@@ -138,8 +162,8 @@ COMPILING THE APPLICATIONS/LIBRARIES:
|
||||
$ CROSS=mipsel-linux-uclibc- ../libvpx/configure
|
||||
|
||||
In addition, the executables to be invoked can be overridden by specifying the
|
||||
environment variables: CC, AR, LD, AS, STRIP, NM. Additional flags can be
|
||||
passed to these executables with CFLAGS, LDFLAGS, and ASFLAGS.
|
||||
environment variables: AR, AS, CC, CXX, LD, STRIP. Additional flags can be
|
||||
passed to these executables with ASFLAGS, CFLAGS, CXXFLAGS, and LDFLAGS.
|
||||
|
||||
6. Configuration errors
|
||||
If the configuration step fails, the first step is to look in the error log.
|
||||
@@ -169,7 +193,49 @@ CODE STYLE:
|
||||
|
||||
See also: http://clang.llvm.org/docs/ClangFormat.html
|
||||
|
||||
PROFILE GUIDED OPTIMIZATION (PGO)
|
||||
Profile Guided Optimization can be enabled for Clang builds using the
|
||||
commands:
|
||||
|
||||
$ export CC=clang
|
||||
$ export CXX=clang++
|
||||
$ ../libvpx/configure --enable-profile
|
||||
$ make
|
||||
|
||||
Generate one or multiple PGO profile files by running vpxdec or vpxenc. For
|
||||
example:
|
||||
|
||||
$ ./vpxdec ../vpx/out_ful/vp90-2-sintel_1280x546_tile_1x4_1257kbps.webm \
|
||||
-o - > /dev/null
|
||||
|
||||
To convert and merge the raw profile files, use the llvm-profdata tool:
|
||||
|
||||
$ llvm-profdata merge -o perf.profdata default_8382761441159425451_0.profraw
|
||||
|
||||
Then, rebuild the project with the new profile file:
|
||||
|
||||
$ make clean
|
||||
$ ../libvpx/configure --use-profile=perf.profdata
|
||||
$ make
|
||||
|
||||
Note: Always use the llvm-profdata from the toolchain that is used for
|
||||
compiling the PGO-enabled binary.
|
||||
|
||||
To observe the improvements from a PGO-enabled build, enable and compare the
|
||||
list of failed optimizations by using the -Rpass-missed compiler flag. For
|
||||
example, to list the failed loop vectorizations:
|
||||
|
||||
$ ../libvpx/configure --use-profile=perf.profdata \
|
||||
--extra-cflags=-Rpass-missed=loop-vectorize
|
||||
|
||||
For guidance on utilizing PGO files to identify potential optimization
|
||||
opportunities, see: tools/README.pgo.md
|
||||
|
||||
SUPPORT
|
||||
This library is an open source project supported by its community. Please
|
||||
email webm-discuss@webmproject.org for help.
|
||||
|
||||
BUG REPORTS
|
||||
Bug reports can be filed in the libvpx component of the issue tracker:
|
||||
https://issues.webmproject.org/issues/new?component=1618984&template=2023833.
|
||||
For security reports, select 'Security report' from the Template dropdown.
|
||||
+16
-12
@@ -8,13 +8,13 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include "args.h"
|
||||
|
||||
#include "vpx/vpx_integer.h"
|
||||
#include "vpx_ports/msvc.h"
|
||||
|
||||
#if defined(__GNUC__)
|
||||
__attribute__((noreturn)) extern void die(const char *fmt, ...);
|
||||
@@ -24,7 +24,7 @@ __declspec(noreturn) extern void die(const char *fmt, ...);
|
||||
extern void die(const char *fmt, ...);
|
||||
#endif
|
||||
|
||||
struct arg arg_init(char **argv) {
|
||||
static struct arg arg_init(char **argv) {
|
||||
struct arg a;
|
||||
|
||||
a.argv = argv;
|
||||
@@ -91,24 +91,31 @@ char **argv_dup(int argc, const char **argv) {
|
||||
}
|
||||
|
||||
void arg_show_usage(FILE *fp, const struct arg_def *const *defs) {
|
||||
char option_text[40] = { 0 };
|
||||
|
||||
for (; *defs; defs++) {
|
||||
const struct arg_def *def = *defs;
|
||||
char *short_val = def->has_val ? " <arg>" : "";
|
||||
char *long_val = def->has_val ? "=<arg>" : "";
|
||||
int n = 0;
|
||||
|
||||
// Short options are indented with two spaces. Long options are indented
|
||||
// with 12 spaces.
|
||||
if (def->short_name && def->long_name) {
|
||||
char *comma = def->has_val ? "," : ", ";
|
||||
|
||||
snprintf(option_text, 37, "-%s%s%s --%s%6s", def->short_name, short_val,
|
||||
comma, def->long_name, long_val);
|
||||
n = fprintf(fp, " -%s%s%s --%s%s", def->short_name, short_val, comma,
|
||||
def->long_name, long_val);
|
||||
} else if (def->short_name)
|
||||
snprintf(option_text, 37, "-%s%s", def->short_name, short_val);
|
||||
n = fprintf(fp, " -%s%s", def->short_name, short_val);
|
||||
else if (def->long_name)
|
||||
snprintf(option_text, 37, " --%s%s", def->long_name, long_val);
|
||||
n = fprintf(fp, " --%s%s", def->long_name, long_val);
|
||||
|
||||
fprintf(fp, " %-37s\t%s\n", option_text, def->desc);
|
||||
// Descriptions are indented with 40 spaces. If an option is 40 characters
|
||||
// or longer, its description starts on the next line.
|
||||
if (n < 40)
|
||||
for (int i = 0; i < 40 - n; i++) fputc(' ', fp);
|
||||
else
|
||||
fputs("\n ", fp);
|
||||
fprintf(fp, "%s\n", def->desc);
|
||||
|
||||
if (def->enums) {
|
||||
const struct arg_enum_list *listptr;
|
||||
@@ -135,7 +142,6 @@ unsigned int arg_parse_uint(const struct arg *arg) {
|
||||
}
|
||||
|
||||
die("Option %s: Invalid character '%c'\n", arg->name, *endptr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int arg_parse_int(const struct arg *arg) {
|
||||
@@ -152,7 +158,6 @@ int arg_parse_int(const struct arg *arg) {
|
||||
}
|
||||
|
||||
die("Option %s: Invalid character '%c'\n", arg->name, *endptr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct vpx_rational {
|
||||
@@ -209,7 +214,6 @@ int arg_parse_enum(const struct arg *arg) {
|
||||
if (!strcmp(arg->val, listptr->name)) return listptr->val;
|
||||
|
||||
die("Option %s: Invalid value '%s'\n", arg->name, arg->val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int arg_parse_enum_or_int(const struct arg *arg) {
|
||||
|
||||
+5
-9
@@ -28,8 +28,7 @@ struct arg_enum_list {
|
||||
const char *name;
|
||||
int val;
|
||||
};
|
||||
#define ARG_ENUM_LIST_END \
|
||||
{ 0 }
|
||||
#define ARG_ENUM_LIST_END { 0 }
|
||||
|
||||
typedef struct arg_def {
|
||||
const char *short_name;
|
||||
@@ -38,19 +37,16 @@ typedef struct arg_def {
|
||||
const char *desc;
|
||||
const struct arg_enum_list *enums;
|
||||
} arg_def_t;
|
||||
#define ARG_DEF(s, l, v, d) \
|
||||
{ s, l, v, d, NULL }
|
||||
#define ARG_DEF_ENUM(s, l, v, d, e) \
|
||||
{ s, l, v, d, e }
|
||||
#define ARG_DEF_LIST_END \
|
||||
{ 0 }
|
||||
#define ARG_DEF(s, l, v, d) { s, l, v, d, NULL }
|
||||
#define ARG_DEF_ENUM(s, l, v, d, e) { s, l, v, d, e }
|
||||
#define ARG_DEF_LIST_END { 0 }
|
||||
|
||||
struct arg arg_init(char **argv);
|
||||
int arg_match(struct arg *arg_, const struct arg_def *def, char **argv);
|
||||
const char *arg_next(struct arg *arg);
|
||||
void arg_show_usage(FILE *fp, const struct arg_def *const *defs);
|
||||
char **argv_dup(int argc, const char **argv);
|
||||
|
||||
// Note: arg_match() must be called before invoking these functions.
|
||||
unsigned int arg_parse_uint(const struct arg *arg);
|
||||
int arg_parse_int(const struct arg *arg);
|
||||
struct vpx_rational arg_parse_rational(const struct arg *arg);
|
||||
|
||||
@@ -8,18 +8,16 @@
|
||||
## be found in the AUTHORS file in the root of the source tree.
|
||||
##
|
||||
|
||||
# Ignore this file during non-NDK builds.
|
||||
ifdef NDK_ROOT
|
||||
#
|
||||
# This file is to be used for compiling libvpx for Android using the NDK.
|
||||
# In an Android project place a libvpx checkout in the jni directory.
|
||||
# Run the configure script from the jni directory. Base libvpx
|
||||
# encoder/decoder configuration will look similar to:
|
||||
# ./libvpx/configure --target=armv7-android-gcc --disable-examples \
|
||||
# ./libvpx/configure --target=arm64-android-gcc --disable-examples \
|
||||
# --enable-external-build
|
||||
#
|
||||
# When targeting Android, realtime-only is enabled by default. This can
|
||||
# be overridden by adding the command line flag:
|
||||
# --disable-realtime-only
|
||||
#
|
||||
# This will create .mk files that contain variables that contain the
|
||||
# source files to compile.
|
||||
#
|
||||
@@ -27,7 +25,7 @@
|
||||
# Android.mk file in the libvpx directory:
|
||||
# LOCAL_PATH := $(call my-dir)
|
||||
# include $(CLEAR_VARS)
|
||||
# include jni/libvpx/build/make/Android.mk
|
||||
# include libvpx/build/make/Android.mk
|
||||
#
|
||||
# By default libvpx will use the 'cpufeatures' module from the NDK. This allows
|
||||
# the library to be built with all available optimizations (SSE2->AVX512 for
|
||||
@@ -36,11 +34,14 @@
|
||||
# but the resulting library *must* be run on devices supporting all of the
|
||||
# enabled extensions. They can be disabled individually with
|
||||
# --disable-{sse2, sse3, ssse3, sse4_1, avx, avx2, avx512}
|
||||
# --disable-neon[-asm]
|
||||
# --disable-neon{, -asm, -neon-dotprod, -neon-i8mm}
|
||||
# --disable-sve
|
||||
# --disable-{dspr2, msa}
|
||||
|
||||
#
|
||||
# Running ndk-build will build libvpx and include it in your project.
|
||||
# Running ndk-build will build libvpx and include it in your project. Set
|
||||
# APP_ABI to match the --target passed to configure:
|
||||
# https://developer.android.com/ndk/guides/application_mk#app_abi.
|
||||
#
|
||||
|
||||
CONFIG_DIR := $(LOCAL_PATH)/
|
||||
@@ -83,6 +84,8 @@ include $(LIBVPX_PATH)/libs.mk
|
||||
# Optimise the code. May want to revisit this setting in the future.
|
||||
LOCAL_CFLAGS := -O3
|
||||
|
||||
LOCAL_CONLYFLAGS := -std=c11
|
||||
|
||||
# For x86, include the source code in the search path so it will find files
|
||||
# like x86inc.asm and x86_abi_support.asm
|
||||
LOCAL_ASMFLAGS := -I$(LIBVPX_PATH)
|
||||
@@ -212,3 +215,4 @@ endif
|
||||
ifeq ($(CONFIG_RUNTIME_CPU_DETECT),yes)
|
||||
$(call import-module,android/cpufeatures)
|
||||
endif
|
||||
endif # NDK_ROOT
|
||||
@@ -21,9 +21,9 @@ all: .DEFAULT
|
||||
clean:: .DEFAULT
|
||||
exampletest: .DEFAULT
|
||||
install:: .DEFAULT
|
||||
test:: .DEFAULT
|
||||
test-no-data-check:: .DEFAULT
|
||||
testdata:: .DEFAULT
|
||||
test: .DEFAULT
|
||||
test-no-data-check: .DEFAULT
|
||||
testdata: .DEFAULT
|
||||
utiltest: .DEFAULT
|
||||
exampletest-no-data-check utiltest-no-data-check: .DEFAULT
|
||||
test_%: .DEFAULT ;
|
||||
@@ -111,13 +111,13 @@ exampletest:
|
||||
.PHONY: install
|
||||
install::
|
||||
.PHONY: test
|
||||
test::
|
||||
test:
|
||||
.PHONY: testdata
|
||||
testdata::
|
||||
testdata:
|
||||
.PHONY: utiltest
|
||||
utiltest:
|
||||
.PHONY: test-no-data-check exampletest-no-data-check utiltest-no-data-check
|
||||
test-no-data-check::
|
||||
test-no-data-check:
|
||||
exampletest-no-data-check utiltest-no-data-check:
|
||||
|
||||
# Force to realign stack always on OS/2
|
||||
@@ -143,6 +143,16 @@ $(BUILD_PFX)%_avx2.c.o: CFLAGS += -mavx2
|
||||
$(BUILD_PFX)%_avx512.c.d: CFLAGS += -mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl
|
||||
$(BUILD_PFX)%_avx512.c.o: CFLAGS += -mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl
|
||||
|
||||
# AARCH64
|
||||
$(BUILD_PFX)%_neon_dotprod.c.d: CFLAGS += -march=armv8.2-a+dotprod
|
||||
$(BUILD_PFX)%_neon_dotprod.c.o: CFLAGS += -march=armv8.2-a+dotprod
|
||||
$(BUILD_PFX)%_neon_i8mm.c.d: CFLAGS += -march=armv8.2-a+dotprod+i8mm
|
||||
$(BUILD_PFX)%_neon_i8mm.c.o: CFLAGS += -march=armv8.2-a+dotprod+i8mm
|
||||
$(BUILD_PFX)%_sve.c.d: CFLAGS += -march=armv8.2-a+dotprod+i8mm+sve
|
||||
$(BUILD_PFX)%_sve.c.o: CFLAGS += -march=armv8.2-a+dotprod+i8mm+sve
|
||||
$(BUILD_PFX)%_sve2.c.d: CFLAGS += -march=armv9-a+i8mm+sve2
|
||||
$(BUILD_PFX)%_sve2.c.o: CFLAGS += -march=armv9-a+i8mm+sve2
|
||||
|
||||
# POWER
|
||||
$(BUILD_PFX)%_vsx.c.d: CFLAGS += -maltivec -mvsx
|
||||
$(BUILD_PFX)%_vsx.c.o: CFLAGS += -maltivec -mvsx
|
||||
@@ -304,6 +314,19 @@ $(1):
|
||||
$(qexec)$$(AR) $$(ARFLAGS) $$@ $$^
|
||||
endef
|
||||
|
||||
# Don't use -Wl,-z,defs with Clang's sanitizers.
|
||||
#
|
||||
# Clang's AddressSanitizer documentation says "When linking shared libraries,
|
||||
# the AddressSanitizer run-time is not linked, so -Wl,-z,defs may cause link
|
||||
# errors (don't use it with AddressSanitizer)." See
|
||||
# https://clang.llvm.org/docs/AddressSanitizer.html#usage.
|
||||
NO_UNDEFINED := -Wl,-z,defs
|
||||
ifeq ($(findstring clang,$(CC)),clang)
|
||||
ifneq ($(filter -fsanitize=%,$(LDFLAGS)),)
|
||||
NO_UNDEFINED :=
|
||||
endif
|
||||
endif
|
||||
|
||||
define so_template
|
||||
# Not using a pattern rule here because we don't want to generate empty
|
||||
# archives when they are listed as a dependency in files not responsible
|
||||
@@ -313,7 +336,8 @@ define so_template
|
||||
$(1):
|
||||
$(if $(quiet),@echo " [LD] $$@")
|
||||
$(qexec)$$(LD) -shared $$(LDFLAGS) \
|
||||
-Wl,--no-undefined -Wl,-soname,$$(SONAME) \
|
||||
$(NO_UNDEFINED) \
|
||||
-Wl,-soname,$$(SONAME) \
|
||||
-Wl,--version-script,$$(EXPORTS_FILE) -o $$@ \
|
||||
$$(filter %.o,$$^) $$(extralibs)
|
||||
endef
|
||||
@@ -465,6 +489,6 @@ INSTALL_TARGETS += .install-docs .install-srcs .install-libs .install-bins
|
||||
all: $(BUILD_TARGETS)
|
||||
install:: $(INSTALL_TARGETS)
|
||||
dist: $(INSTALL_TARGETS)
|
||||
test::
|
||||
test:
|
||||
|
||||
.SUFFIXES: # Delete default suffix rules
|
||||
@@ -74,6 +74,8 @@ Build options:
|
||||
--cpu=CPU optimize for a specific cpu rather than a family
|
||||
--extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
|
||||
--extra-cxxflags=ECXXFLAGS add ECXXFLAGS to CXXFLAGS [$CXXFLAGS]
|
||||
--use-profile=PROFILE_FILE
|
||||
Use PROFILE_FILE for PGO
|
||||
${toggle_extra_warnings} emit harmless warnings (always non-fatal)
|
||||
${toggle_werror} treat warnings as errors, if possible
|
||||
(not available with all compilers)
|
||||
@@ -81,6 +83,7 @@ Build options:
|
||||
${toggle_pic} turn on/off Position Independent Code
|
||||
${toggle_ccache} turn on/off compiler cache
|
||||
${toggle_debug} enable/disable debug mode
|
||||
${toggle_profile} enable/disable profiling
|
||||
${toggle_gprof} enable/disable gprof profiling instrumentation
|
||||
${toggle_gcov} enable/disable gcov coverage instrumentation
|
||||
${toggle_thumb} enable/disable building arm assembly in thumb mode
|
||||
@@ -429,6 +432,42 @@ check_gcc_machine_options() {
|
||||
fi
|
||||
}
|
||||
|
||||
check_neon_sve_bridge_compiles() {
|
||||
if enabled sve; then
|
||||
check_cc -march=armv8.2-a+dotprod+i8mm+sve <<EOF
|
||||
#ifndef __ARM_NEON_SVE_BRIDGE
|
||||
#error 1
|
||||
#endif
|
||||
#include <arm_sve.h>
|
||||
#include <arm_neon_sve_bridge.h>
|
||||
EOF
|
||||
compile_result=$?
|
||||
if [ ${compile_result} -eq 0 ]; then
|
||||
# Check whether the compiler can compile SVE functions that require
|
||||
# backup/restore of SVE registers according to AAPCS. Clang for Windows
|
||||
# used to fail this, see
|
||||
# https://github.com/llvm/llvm-project/issues/80009.
|
||||
check_cc -march=armv8.2-a+dotprod+i8mm+sve <<EOF
|
||||
#include <arm_sve.h>
|
||||
void other(void);
|
||||
svfloat32_t func(svfloat32_t a) {
|
||||
other();
|
||||
return a;
|
||||
}
|
||||
EOF
|
||||
compile_result=$?
|
||||
fi
|
||||
|
||||
if [ ${compile_result} -ne 0 ]; then
|
||||
log_echo " disabling sve: arm_neon_sve_bridge.h not supported by compiler"
|
||||
log_echo " disabling sve2: arm_neon_sve_bridge.h not supported by compiler"
|
||||
disable_feature sve
|
||||
disable_feature sve2
|
||||
RTCD_OPTIONS="${RTCD_OPTIONS}--disable-sve --disable-sve2 "
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
check_gcc_avx512_compiles() {
|
||||
if disabled gcc; then
|
||||
return
|
||||
@@ -442,13 +481,11 @@ void f(void) {
|
||||
}
|
||||
EOF
|
||||
compile_result=$?
|
||||
#
|
||||
# if [ ${compile_result} -ne 0 ]; then
|
||||
# log_echo " disabling avx512: not supported by compiler"
|
||||
# disable_feature avx512
|
||||
# RTCD_OPTIONS="${RTCD_OPTIONS}--disable-avx512 "
|
||||
# fi
|
||||
#*/
|
||||
if [ ${compile_result} -ne 0 ]; then
|
||||
log_echo " disabling avx512: not supported by compiler"
|
||||
disable_feature avx512
|
||||
RTCD_OPTIONS="${RTCD_OPTIONS}--disable-avx512 "
|
||||
fi
|
||||
}
|
||||
|
||||
check_inline_asm() {
|
||||
@@ -511,7 +548,6 @@ AR=${AR}
|
||||
LD=${LD}
|
||||
AS=${AS}
|
||||
STRIP=${STRIP}
|
||||
NM=${NM}
|
||||
|
||||
CFLAGS = ${CFLAGS}
|
||||
CXXFLAGS = ${CXXFLAGS}
|
||||
@@ -523,6 +559,7 @@ AS_SFX = ${AS_SFX:-.asm}
|
||||
EXE_SFX = ${EXE_SFX}
|
||||
VCPROJ_SFX = ${VCPROJ_SFX}
|
||||
RTCD_OPTIONS = ${RTCD_OPTIONS}
|
||||
LIBWEBM_CXXFLAGS = ${LIBWEBM_CXXFLAGS}
|
||||
LIBYUV_CXXFLAGS = ${LIBYUV_CXXFLAGS}
|
||||
EOF
|
||||
|
||||
@@ -612,6 +649,9 @@ process_common_cmdline() {
|
||||
--extra-cxxflags=*)
|
||||
extra_cxxflags="${optval}"
|
||||
;;
|
||||
--use-profile=*)
|
||||
pgo_file=${optval}
|
||||
;;
|
||||
--enable-?*|--disable-?*)
|
||||
eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
|
||||
if is_in ${option} ${ARCH_EXT_LIST}; then
|
||||
@@ -708,7 +748,6 @@ setup_gnu_toolchain() {
|
||||
LD=${LD:-${CROSS}${link_with_cc:-ld}}
|
||||
AS=${AS:-${CROSS}as}
|
||||
STRIP=${STRIP:-${CROSS}strip}
|
||||
NM=${NM:-${CROSS}nm}
|
||||
AS_SFX=.S
|
||||
EXE_SFX=
|
||||
}
|
||||
@@ -793,7 +832,7 @@ process_common_toolchain() {
|
||||
tgt_isa=x86_64
|
||||
tgt_os=`echo $gcctarget | sed 's/.*\(darwin1[0-9]\).*/\1/'`
|
||||
;;
|
||||
*darwin2[0-1]*)
|
||||
*darwin2[0-5]*)
|
||||
tgt_isa=`uname -m`
|
||||
tgt_os=`echo $gcctarget | sed 's/.*\(darwin2[0-9]\).*/\1/'`
|
||||
;;
|
||||
@@ -844,6 +883,10 @@ process_common_toolchain() {
|
||||
|
||||
# Enable the architecture family
|
||||
case ${tgt_isa} in
|
||||
arm64 | armv8)
|
||||
enable_feature arm
|
||||
enable_feature aarch64
|
||||
;;
|
||||
arm*)
|
||||
enable_feature arm
|
||||
;;
|
||||
@@ -860,8 +903,14 @@ process_common_toolchain() {
|
||||
;;
|
||||
esac
|
||||
|
||||
# PIC is probably what we want when building shared libs
|
||||
# Position independent code (PIC) is probably what we want when building
|
||||
# shared libs or position independent executable (PIE) targets.
|
||||
enabled shared && soft_enable pic
|
||||
check_cpp << EOF || soft_enable pic
|
||||
#if !(__pie__ || __PIE__)
|
||||
#error Neither __pie__ or __PIE__ are set
|
||||
#endif
|
||||
EOF
|
||||
|
||||
# Minimum iOS version for all target platforms (darwin and iphonesimulator).
|
||||
# Shared library framework builds are only possible on iOS 8 and later.
|
||||
@@ -942,7 +991,7 @@ process_common_toolchain() {
|
||||
add_cflags "-mmacosx-version-min=10.15"
|
||||
add_ldflags "-mmacosx-version-min=10.15"
|
||||
;;
|
||||
*-darwin2[0-1]-*)
|
||||
*-darwin2[0-5]-*)
|
||||
add_cflags "-arch ${toolchain%%-*}"
|
||||
add_ldflags "-arch ${toolchain%%-*}"
|
||||
;;
|
||||
@@ -967,27 +1016,30 @@ process_common_toolchain() {
|
||||
;;
|
||||
esac
|
||||
|
||||
# Process ARM architecture variants
|
||||
# Process architecture variants
|
||||
case ${toolchain} in
|
||||
arm*)
|
||||
# on arm, isa versions are supersets
|
||||
case ${tgt_isa} in
|
||||
arm64|armv8)
|
||||
soft_enable neon
|
||||
case ${toolchain} in
|
||||
armv7*-darwin*)
|
||||
# Runtime cpu detection is not defined for these targets.
|
||||
enabled runtime_cpu_detect && disable_feature runtime_cpu_detect
|
||||
;;
|
||||
armv7|armv7s)
|
||||
soft_enable neon
|
||||
# Only enable neon_asm when neon is also enabled.
|
||||
enabled neon && soft_enable neon_asm
|
||||
# If someone tries to force it through, die.
|
||||
if disabled neon && enabled neon_asm; then
|
||||
die "Disabling neon while keeping neon-asm is not supported"
|
||||
fi
|
||||
*)
|
||||
soft_enable runtime_cpu_detect
|
||||
;;
|
||||
esac
|
||||
|
||||
asm_conversion_cmd="cat"
|
||||
if [ ${tgt_isa} = "armv7" ] || [ ${tgt_isa} = "armv7s" ]; then
|
||||
soft_enable neon
|
||||
# Only enable neon_asm when neon is also enabled.
|
||||
enabled neon && soft_enable neon_asm
|
||||
# If someone tries to force it through, die.
|
||||
if disabled neon && enabled neon_asm; then
|
||||
die "Disabling neon while keeping neon-asm is not supported"
|
||||
fi
|
||||
fi
|
||||
|
||||
asm_conversion_cmd="cat"
|
||||
case ${tgt_cc} in
|
||||
gcc)
|
||||
link_with_cc=gcc
|
||||
@@ -1068,8 +1120,11 @@ EOF
|
||||
enable_feature win_arm64_neon_h_workaround
|
||||
else
|
||||
# If a probe is not possible, assume this is the pure Windows
|
||||
# SDK and so the workaround is necessary.
|
||||
enable_feature win_arm64_neon_h_workaround
|
||||
# SDK and so the workaround is necessary when using Visual
|
||||
# Studio < 2019.
|
||||
if [ ${tgt_cc##vs} -lt 16 ]; then
|
||||
enable_feature win_arm64_neon_h_workaround
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@@ -1080,7 +1135,6 @@ EOF
|
||||
AS=armasm
|
||||
LD="${source_path}/build/make/armlink_adapter.sh"
|
||||
STRIP=arm-none-linux-gnueabi-strip
|
||||
NM=arm-none-linux-gnueabi-nm
|
||||
tune_cflags="--cpu="
|
||||
tune_asflags="--cpu="
|
||||
if [ -z "${tune_cpu}" ]; then
|
||||
@@ -1117,6 +1171,14 @@ EOF
|
||||
echo "See build/make/Android.mk for details."
|
||||
check_add_ldflags -static
|
||||
soft_enable unit_tests
|
||||
case "$AS" in
|
||||
*clang)
|
||||
# The GNU Assembler was removed in the r24 version of the NDK.
|
||||
# clang's internal assembler works, but `-c` is necessary to
|
||||
# avoid linking.
|
||||
add_asflags -c
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
darwin)
|
||||
@@ -1127,8 +1189,6 @@ EOF
|
||||
AR="$(${XCRUN_FIND} ar)"
|
||||
AS="$(${XCRUN_FIND} as)"
|
||||
STRIP="$(${XCRUN_FIND} strip)"
|
||||
NM="$(${XCRUN_FIND} nm)"
|
||||
RANLIB="$(${XCRUN_FIND} ranlib)"
|
||||
AS_SFX=.S
|
||||
LD="${CXX:-$(${XCRUN_FIND} ld)}"
|
||||
|
||||
@@ -1169,7 +1229,8 @@ EOF
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "$(show_darwin_sdk_major_version iphoneos)" -gt 8 ]; then
|
||||
if [ "$(show_darwin_sdk_major_version iphoneos)" -gt 8 ] \
|
||||
&& [ "$(show_xcode_version | cut -d. -f1)" -lt 16 ]; then
|
||||
check_add_cflags -fembed-bitcode
|
||||
check_add_asflags -fembed-bitcode
|
||||
check_add_ldflags -fembed-bitcode
|
||||
@@ -1203,6 +1264,38 @@ EOF
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# AArch64 ISA extensions are treated as supersets.
|
||||
if [ ${tgt_isa} = "arm64" ] || [ ${tgt_isa} = "armv8" ]; then
|
||||
aarch64_arch_flag_neon="arch=armv8-a"
|
||||
aarch64_arch_flag_neon_dotprod="arch=armv8.2-a+dotprod"
|
||||
aarch64_arch_flag_neon_i8mm="arch=armv8.2-a+dotprod+i8mm"
|
||||
aarch64_arch_flag_sve="arch=armv8.2-a+dotprod+i8mm+sve"
|
||||
aarch64_arch_flag_sve2="arch=armv9-a+sve2"
|
||||
for ext in ${ARCH_EXT_LIST_AARCH64}; do
|
||||
if [ "$disable_exts" = "yes" ]; then
|
||||
RTCD_OPTIONS="${RTCD_OPTIONS}--disable-${ext} "
|
||||
soft_disable $ext
|
||||
else
|
||||
# Check the compiler supports the -march flag for the extension.
|
||||
# This needs to happen after toolchain/OS inspection so we handle
|
||||
# $CROSS etc correctly when checking for flags, else these will
|
||||
# always fail.
|
||||
flag="$(eval echo \$"aarch64_arch_flag_${ext}")"
|
||||
check_gcc_machine_option "${flag}" "${ext}"
|
||||
if ! enabled $ext; then
|
||||
# Disable higher order extensions to simplify dependencies.
|
||||
disable_exts="yes"
|
||||
RTCD_OPTIONS="${RTCD_OPTIONS}--disable-${ext} "
|
||||
soft_disable $ext
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if enabled sve; then
|
||||
check_neon_sve_bridge_compiles
|
||||
fi
|
||||
fi
|
||||
|
||||
;;
|
||||
mips*)
|
||||
link_with_cc=gcc
|
||||
@@ -1270,6 +1363,7 @@ EOF
|
||||
fi
|
||||
;;
|
||||
x86*)
|
||||
soft_enable x86_asm
|
||||
case ${tgt_os} in
|
||||
android)
|
||||
soft_enable realtime_only
|
||||
@@ -1288,6 +1382,10 @@ EOF
|
||||
AS=${AS:-nasm}
|
||||
add_ldflags -Zhigh-mem
|
||||
;;
|
||||
darwin*)
|
||||
enabled x86 && darwin_arch="-arch i386" || darwin_arch="-arch x86_64"
|
||||
add_cflags ${darwin_arch}
|
||||
add_ldflags ${darwin_arch}
|
||||
esac
|
||||
|
||||
AS="${alt_as:-${AS:-auto}}"
|
||||
@@ -1410,9 +1508,6 @@ EOF
|
||||
;;
|
||||
darwin*)
|
||||
add_asflags -f macho${bits}
|
||||
enabled x86 && darwin_arch="-arch i386" || darwin_arch="-arch x86_64"
|
||||
add_cflags ${darwin_arch}
|
||||
add_ldflags ${darwin_arch}
|
||||
# -mdynamic-no-pic is still a bit of voodoo -- it was required at
|
||||
# one time, but does not seem to be now, and it breaks some of the
|
||||
# code that still relies on inline assembly.
|
||||
@@ -1459,6 +1554,14 @@ EOF
|
||||
;;
|
||||
esac
|
||||
|
||||
# Enable PGO
|
||||
if [ -n "${pgo_file}" ]; then
|
||||
check_add_cflags -fprofile-use=${pgo_file} || \
|
||||
die "-fprofile-use is not supported by compiler"
|
||||
check_add_ldflags -fprofile-use=${pgo_file} || \
|
||||
die "-fprofile-use is not supported by linker"
|
||||
fi
|
||||
|
||||
# Try to enable CPU specific tuning
|
||||
if [ -n "${tune_cpu}" ]; then
|
||||
if [ -n "${tune_cflags}" ]; then
|
||||
@@ -1479,6 +1582,9 @@ EOF
|
||||
else
|
||||
check_add_cflags -DNDEBUG
|
||||
fi
|
||||
enabled profile &&
|
||||
check_add_cflags -fprofile-generate &&
|
||||
check_add_ldflags -fprofile-generate
|
||||
|
||||
enabled gprof && check_add_cflags -pg && check_add_ldflags -pg
|
||||
enabled gcov &&
|
||||
@@ -1497,10 +1603,6 @@ EOF
|
||||
# shared objects
|
||||
enabled gcc && enabled pic && check_add_cflags -fPIC
|
||||
|
||||
# Work around longjmp interception on glibc >= 2.11, to improve binary
|
||||
# compatibility. See http://code.google.com/p/webm/issues/detail?id=166
|
||||
enabled linux && check_add_cflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
|
||||
|
||||
# Check for strip utility variant
|
||||
${STRIP} -V 2>/dev/null | grep GNU >/dev/null && enable_feature gnu_strip
|
||||
|
||||
@@ -1513,7 +1615,7 @@ EOF
|
||||
|
||||
# Try to find which inline keywords are supported
|
||||
check_cc <<EOF && INLINE="inline"
|
||||
static inline function() {}
|
||||
static inline int function(void) {}
|
||||
EOF
|
||||
|
||||
# Almost every platform uses pthreads.
|
||||
@@ -1523,6 +1625,7 @@ EOF
|
||||
;;
|
||||
*-android-gcc)
|
||||
# bionic includes basic pthread functionality, obviating -lpthread.
|
||||
soft_enable pthread_setname_np
|
||||
;;
|
||||
*)
|
||||
check_header pthread.h && check_lib -lpthread <<EOF && add_extralibs -lpthread || disable_feature pthread_h
|
||||
@@ -1531,6 +1634,15 @@ EOF
|
||||
void *thread_check (void *);
|
||||
void *thread_check (void *obj){ return obj;};
|
||||
int main(void) { pthread_t thread_id; return pthread_create(&thread_id, NULL, thread_check, NULL); }
|
||||
EOF
|
||||
|
||||
enabled pthread_h && check_lib -lpthread <<EOF && enable_feature pthread_setname_np
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
|
||||
#include <pthread.h>
|
||||
int main(void) { return &pthread_setname_np != 0; }
|
||||
EOF
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -42,7 +42,7 @@ done
|
||||
|
||||
[ -n "$srcfile" ] || show_help
|
||||
sfx=${sfx:-asm}
|
||||
includes=$(LC_ALL=C egrep -i "include +\"?[a-z0-9_/]+\.${sfx}" $srcfile |
|
||||
includes=$(LC_ALL=C grep -E -i "include +\"?[a-z0-9_/]+\.${sfx}" $srcfile |
|
||||
perl -p -e "s;.*?([a-z0-9_/]+.${sfx}).*;\1;")
|
||||
#" restore editor state
|
||||
for inc in ${includes}; do
|
||||
|
||||
@@ -25,7 +25,7 @@ files.
|
||||
Options:
|
||||
--help Print this message
|
||||
--out=outfile Redirect output to a file
|
||||
--ver=version Version (14-17) of visual studio to generate for
|
||||
--ver=version Version (14-18) of visual studio to generate for
|
||||
--target=isa-os-cc Target specifier
|
||||
EOF
|
||||
exit 1
|
||||
@@ -220,6 +220,7 @@ for opt in "$@"; do
|
||||
15) vs_year=2017 ;;
|
||||
16) vs_year=2019 ;;
|
||||
17) vs_year=2022 ;;
|
||||
18) vs_year=2026 ;;
|
||||
*) die Unrecognized Visual Studio Version in $opt ;;
|
||||
esac
|
||||
;;
|
||||
@@ -233,7 +234,7 @@ done
|
||||
outfile=${outfile:-/dev/stdout}
|
||||
mkoutfile=${mkoutfile:-/dev/stdout}
|
||||
case "${vs_ver}" in
|
||||
1[4-7])
|
||||
1[4-8])
|
||||
# VS has used Format Version 12.00 continuously since vs11.
|
||||
sln_vers="12.00"
|
||||
sln_vers_str="Visual Studio ${vs_year}"
|
||||
|
||||
@@ -34,7 +34,7 @@ Options:
|
||||
--name=project_name Name of the project (required)
|
||||
--proj-guid=GUID GUID to use for the project
|
||||
--module-def=filename File containing export definitions (for DLLs)
|
||||
--ver=version Version (14-16) of visual studio to generate for
|
||||
--ver=version Version (14-18) of visual studio to generate for
|
||||
--src-path-bare=dir Path to root of source tree
|
||||
-Ipath/to/include Additional include directories
|
||||
-DFLAG[=value] Preprocessor macros to define
|
||||
@@ -106,8 +106,12 @@ generate_filter() {
|
||||
Include="$f"
|
||||
# Separate file names with Condition?
|
||||
tag_content ObjectFileName "\$(IntDir)$objf"
|
||||
# Check for AVX and turn it on to avoid warnings.
|
||||
if [[ $f =~ avx.?\.c$ ]]; then
|
||||
# Set the appropriate /arch option for AVX/AVX2/AVX-512 files.
|
||||
if [[ $f =~ avx512\.c$ ]]; then
|
||||
tag_content AdditionalOptions "/arch:AVX512"
|
||||
elif [[ $f =~ avx2\.c$ ]]; then
|
||||
tag_content AdditionalOptions "/arch:AVX2"
|
||||
elif [[ $f =~ avx\.c$ ]]; then
|
||||
tag_content AdditionalOptions "/arch:AVX"
|
||||
fi
|
||||
close_tag ClCompile
|
||||
@@ -141,7 +145,17 @@ for opt in "$@"; do
|
||||
case "$opt" in
|
||||
--help|-h) show_help
|
||||
;;
|
||||
--target=*) target="${optval}"
|
||||
--target=*)
|
||||
target="${optval}"
|
||||
platform_toolset=$(echo ${target} | awk 'BEGIN{FS="-"}{print $4}')
|
||||
case "$platform_toolset" in
|
||||
clangcl) platform_toolset="ClangCl"
|
||||
;;
|
||||
"")
|
||||
;;
|
||||
*) die Unrecognized Visual Studio Platform Toolset in $opt
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
--out=*) outfile="$optval"
|
||||
;;
|
||||
@@ -170,7 +184,7 @@ for opt in "$@"; do
|
||||
--ver=*)
|
||||
vs_ver="$optval"
|
||||
case "$optval" in
|
||||
1[4-7])
|
||||
1[4-8])
|
||||
;;
|
||||
*) die Unrecognized Visual Studio Version in $opt
|
||||
;;
|
||||
@@ -259,6 +273,10 @@ case "$target" in
|
||||
;;
|
||||
arm64*)
|
||||
platforms[0]="ARM64"
|
||||
# As of Visual Studio 2022 17.5.5, clang-cl does not support ARM64EC.
|
||||
if [ "$vs_ver" -ge 17 -a "$platform_toolset" != "ClangCl" ]; then
|
||||
platforms[1]="ARM64EC"
|
||||
fi
|
||||
asm_Debug_cmdline="armasm64 -nologo -oldit "%(FullPath)""
|
||||
asm_Release_cmdline="armasm64 -nologo -oldit "%(FullPath)""
|
||||
;;
|
||||
@@ -335,17 +353,24 @@ generate_vcxproj() {
|
||||
else
|
||||
tag_content ConfigurationType StaticLibrary
|
||||
fi
|
||||
if [ "$vs_ver" = "14" ]; then
|
||||
tag_content PlatformToolset v140
|
||||
fi
|
||||
if [ "$vs_ver" = "15" ]; then
|
||||
tag_content PlatformToolset v141
|
||||
fi
|
||||
if [ "$vs_ver" = "16" ]; then
|
||||
tag_content PlatformToolset v142
|
||||
fi
|
||||
if [ "$vs_ver" = "17" ]; then
|
||||
tag_content PlatformToolset v143
|
||||
if [ -n "$platform_toolset" ]; then
|
||||
tag_content PlatformToolset "$platform_toolset"
|
||||
else
|
||||
if [ "$vs_ver" = "14" ]; then
|
||||
tag_content PlatformToolset v140
|
||||
fi
|
||||
if [ "$vs_ver" = "15" ]; then
|
||||
tag_content PlatformToolset v141
|
||||
fi
|
||||
if [ "$vs_ver" = "16" ]; then
|
||||
tag_content PlatformToolset v142
|
||||
fi
|
||||
if [ "$vs_ver" = "17" ]; then
|
||||
tag_content PlatformToolset v143
|
||||
fi
|
||||
if [ "$vs_ver" = "18" ]; then
|
||||
tag_content PlatformToolset v145
|
||||
fi
|
||||
fi
|
||||
tag_content CharacterSet Unicode
|
||||
if [ "$config" = "Release" ]; then
|
||||
@@ -415,6 +440,8 @@ generate_vcxproj() {
|
||||
tag_content Optimization $opt
|
||||
tag_content AdditionalIncludeDirectories "$incs;%(AdditionalIncludeDirectories)"
|
||||
tag_content PreprocessorDefinitions "WIN32;$debug;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE$extradefines;%(PreprocessorDefinitions)"
|
||||
tag_content LanguageStandard_C stdc11
|
||||
tag_content LanguageStandard stdcpp17
|
||||
tag_content RuntimeLibrary $runtime
|
||||
tag_content WarningLevel Level3
|
||||
if ${werror:-false}; then
|
||||
|
||||
@@ -30,13 +30,9 @@ SCRIPT_DIR=$(dirname "$0")
|
||||
LIBVPX_SOURCE_DIR=$(cd ${SCRIPT_DIR}/../..; pwd)
|
||||
LIPO=$(xcrun -sdk iphoneos${SDK} -find lipo)
|
||||
ORIG_PWD="$(pwd)"
|
||||
ARM_TARGETS="arm64-darwin-gcc
|
||||
armv7-darwin-gcc
|
||||
armv7s-darwin-gcc"
|
||||
SIM_TARGETS="x86-iphonesimulator-gcc
|
||||
x86_64-iphonesimulator-gcc"
|
||||
OSX_TARGETS="x86-darwin16-gcc
|
||||
x86_64-darwin16-gcc"
|
||||
ARM_TARGETS="arm64-darwin-gcc"
|
||||
SIM_TARGETS="x86_64-iphonesimulator-gcc"
|
||||
OSX_TARGETS="x86_64-darwin16-gcc"
|
||||
TARGETS="${ARM_TARGETS} ${SIM_TARGETS}"
|
||||
|
||||
# Configures for the target specified by $1, and invokes make with the dist
|
||||
|
||||
@@ -73,6 +73,10 @@ sub vpx_config($) {
|
||||
}
|
||||
|
||||
sub specialize {
|
||||
if (@_ <= 1) {
|
||||
die "'specialize' must be called with a function name and at least one ",
|
||||
"architecture ('C' is implied): \n@_\n";
|
||||
}
|
||||
my $fn=$_[0];
|
||||
shift;
|
||||
foreach my $opt (@_) {
|
||||
@@ -209,6 +213,16 @@ sub filter {
|
||||
sub common_top() {
|
||||
my $include_guard = uc($opts{sym})."_H_";
|
||||
print <<EOF;
|
||||
/*
|
||||
* Copyright (c) 2017 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.
|
||||
*/
|
||||
|
||||
// This file is generated. Do not edit.
|
||||
#ifndef ${include_guard}
|
||||
#define ${include_guard}
|
||||
@@ -238,13 +252,14 @@ EOF
|
||||
}
|
||||
|
||||
sub common_bottom() {
|
||||
my $include_guard = uc($opts{sym})."_H_";
|
||||
print <<EOF;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif // ${include_guard}
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -438,19 +453,35 @@ EOF
|
||||
common_bottom;
|
||||
}
|
||||
|
||||
# List of architectures in low-to-high preference order.
|
||||
my @PRIORITY_ARCH = qw/
|
||||
c
|
||||
mmx sse sse2 sse3 ssse3 sse4_1 sse4_2 avx avx2 avx512
|
||||
arm_crc32 neon neon_dotprod neon_i8mm sve sve2
|
||||
rvv
|
||||
vsx
|
||||
dspr2 msa
|
||||
/;
|
||||
my %PRIORITY_INDEX;
|
||||
for (my $i = 0; $i < @PRIORITY_ARCH; $i++) {
|
||||
$PRIORITY_INDEX{$PRIORITY_ARCH[$i]} = $i;
|
||||
}
|
||||
|
||||
#
|
||||
# Main Driver
|
||||
#
|
||||
|
||||
&require("c");
|
||||
&require(keys %required);
|
||||
&require(sort { $PRIORITY_INDEX{$a} <=> $PRIORITY_INDEX{$b} } keys %required);
|
||||
if ($opts{arch} eq 'x86') {
|
||||
@ALL_ARCHS = filter(qw/mmx sse sse2 sse3 ssse3 sse4_1 avx avx2 avx512/);
|
||||
x86;
|
||||
} elsif ($opts{arch} eq 'x86_64') {
|
||||
@ALL_ARCHS = filter(qw/mmx sse sse2 sse3 ssse3 sse4_1 avx avx2 avx512/);
|
||||
@REQUIRES = filter(qw/mmx sse sse2/);
|
||||
&require(@REQUIRES);
|
||||
if (keys %required == 0) {
|
||||
@REQUIRES = filter(qw/mmx sse sse2/);
|
||||
&require(@REQUIRES);
|
||||
}
|
||||
x86;
|
||||
} elsif ($opts{arch} eq 'mips32' || $opts{arch} eq 'mips64') {
|
||||
my $have_dspr2 = 0;
|
||||
@@ -487,8 +518,11 @@ if ($opts{arch} eq 'x86') {
|
||||
@ALL_ARCHS = filter(qw/neon_asm neon/);
|
||||
arm;
|
||||
} elsif ($opts{arch} eq 'armv8' || $opts{arch} eq 'arm64' ) {
|
||||
@ALL_ARCHS = filter(qw/neon/);
|
||||
&require("neon");
|
||||
@ALL_ARCHS = filter(qw/neon neon_dotprod neon_i8mm sve sve2/);
|
||||
if (keys %required == 0) {
|
||||
@REQUIRES = filter(qw/neon/);
|
||||
&require(@REQUIRES);
|
||||
}
|
||||
arm;
|
||||
} elsif ($opts{arch} =~ /^ppc/ ) {
|
||||
@ALL_ARCHS = filter(qw/vsx/);
|
||||
|
||||
@@ -61,6 +61,8 @@ if [ ${bare} ]; then
|
||||
else
|
||||
cat<<EOF>$$.tmp
|
||||
// This file is generated. Do not edit.
|
||||
#ifndef VPX_VERSION_H_
|
||||
#define VPX_VERSION_H_
|
||||
#define VERSION_MAJOR $major_version
|
||||
#define VERSION_MINOR $minor_version
|
||||
#define VERSION_PATCH $patch_version
|
||||
@@ -68,6 +70,7 @@ else
|
||||
#define VERSION_PACKED ((VERSION_MAJOR<<16)|(VERSION_MINOR<<8)|(VERSION_PATCH))
|
||||
#define ${id}_NOSP "${version_str}"
|
||||
#define ${id} " ${version_str}"
|
||||
#endif // VPX_VERSION_H_
|
||||
EOF
|
||||
fi
|
||||
if [ -n "$out_file" ]; then
|
||||
|
||||
Vendored
+61
-16
@@ -101,9 +101,19 @@ all_platforms="${all_platforms} arm64-android-gcc"
|
||||
all_platforms="${all_platforms} arm64-darwin-gcc"
|
||||
all_platforms="${all_platforms} arm64-darwin20-gcc"
|
||||
all_platforms="${all_platforms} arm64-darwin21-gcc"
|
||||
all_platforms="${all_platforms} arm64-darwin22-gcc"
|
||||
all_platforms="${all_platforms} arm64-darwin23-gcc"
|
||||
all_platforms="${all_platforms} arm64-darwin24-gcc"
|
||||
all_platforms="${all_platforms} arm64-darwin25-gcc"
|
||||
all_platforms="${all_platforms} arm64-linux-gcc"
|
||||
all_platforms="${all_platforms} arm64-win64-gcc"
|
||||
all_platforms="${all_platforms} arm64-win64-vs15"
|
||||
all_platforms="${all_platforms} arm64-win64-vs16"
|
||||
all_platforms="${all_platforms} arm64-win64-vs16-clangcl"
|
||||
all_platforms="${all_platforms} arm64-win64-vs17"
|
||||
all_platforms="${all_platforms} arm64-win64-vs17-clangcl"
|
||||
all_platforms="${all_platforms} arm64-win64-vs18"
|
||||
all_platforms="${all_platforms} arm64-win64-vs18-clangcl"
|
||||
all_platforms="${all_platforms} armv7-android-gcc" #neon Cortex-A8
|
||||
all_platforms="${all_platforms} armv7-darwin-gcc" #neon Cortex-A8
|
||||
all_platforms="${all_platforms} armv7-linux-rvct" #neon Cortex-A8
|
||||
@@ -112,6 +122,8 @@ all_platforms="${all_platforms} armv7-none-rvct" #neon Cortex-A8
|
||||
all_platforms="${all_platforms} armv7-win32-gcc"
|
||||
all_platforms="${all_platforms} armv7-win32-vs14"
|
||||
all_platforms="${all_platforms} armv7-win32-vs15"
|
||||
all_platforms="${all_platforms} armv7-win32-vs16"
|
||||
all_platforms="${all_platforms} armv7-win32-vs17"
|
||||
all_platforms="${all_platforms} armv7s-darwin-gcc"
|
||||
all_platforms="${all_platforms} armv8-linux-gcc"
|
||||
all_platforms="${all_platforms} loongarch32-linux-gcc"
|
||||
@@ -143,6 +155,7 @@ all_platforms="${all_platforms} x86-win32-vs14"
|
||||
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-win32-vs18"
|
||||
all_platforms="${all_platforms} x86_64-android-gcc"
|
||||
all_platforms="${all_platforms} x86_64-darwin9-gcc"
|
||||
all_platforms="${all_platforms} x86_64-darwin10-gcc"
|
||||
@@ -157,6 +170,10 @@ 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-darwin22-gcc"
|
||||
all_platforms="${all_platforms} x86_64-darwin23-gcc"
|
||||
all_platforms="${all_platforms} x86_64-darwin24-gcc"
|
||||
all_platforms="${all_platforms} x86_64-darwin25-gcc"
|
||||
all_platforms="${all_platforms} x86_64-iphonesimulator-gcc"
|
||||
all_platforms="${all_platforms} x86_64-linux-gcc"
|
||||
all_platforms="${all_platforms} x86_64-linux-icc"
|
||||
@@ -166,6 +183,7 @@ all_platforms="${all_platforms} x86_64-win64-vs14"
|
||||
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} x86_64-win64-vs18"
|
||||
all_platforms="${all_platforms} generic-gnu"
|
||||
|
||||
# all_targets is a list of all targets that can be configured
|
||||
@@ -237,12 +255,22 @@ CODEC_FAMILIES="
|
||||
|
||||
ARCH_LIST="
|
||||
arm
|
||||
aarch64
|
||||
mips
|
||||
x86
|
||||
x86_64
|
||||
ppc
|
||||
loongarch
|
||||
"
|
||||
|
||||
ARCH_EXT_LIST_AARCH64="
|
||||
neon
|
||||
neon_dotprod
|
||||
neon_i8mm
|
||||
sve
|
||||
sve2
|
||||
"
|
||||
|
||||
ARCH_EXT_LIST_X86="
|
||||
mmx
|
||||
sse
|
||||
@@ -262,14 +290,15 @@ ARCH_EXT_LIST_LOONGSON="
|
||||
"
|
||||
|
||||
ARCH_EXT_LIST="
|
||||
neon
|
||||
neon_asm
|
||||
${ARCH_EXT_LIST_AARCH64}
|
||||
|
||||
mips32
|
||||
dspr2
|
||||
msa
|
||||
mips64
|
||||
|
||||
x86_asm
|
||||
${ARCH_EXT_LIST_X86}
|
||||
|
||||
vsx
|
||||
@@ -280,13 +309,14 @@ HAVE_LIST="
|
||||
${ARCH_EXT_LIST}
|
||||
vpx_ports
|
||||
pthread_h
|
||||
pthread_setname_np
|
||||
unistd_h
|
||||
"
|
||||
EXPERIMENT_LIST="
|
||||
fp_mb_stats
|
||||
emulate_hardware
|
||||
non_greedy_mv
|
||||
rate_ctrl
|
||||
collect_component_timing
|
||||
"
|
||||
CONFIG_LIST="
|
||||
dependency_tracking
|
||||
@@ -336,7 +366,6 @@ CONFIG_LIST="
|
||||
multi_res_encoding
|
||||
temporal_denoising
|
||||
vp9_temporal_denoising
|
||||
consistent_recode
|
||||
coefficient_range_checking
|
||||
vp9_highbitdepth
|
||||
better_hw_compatibility
|
||||
@@ -357,6 +386,7 @@ CMDLINE_SELECT="
|
||||
install_libs
|
||||
install_srcs
|
||||
debug
|
||||
profile
|
||||
gprof
|
||||
gcov
|
||||
pic
|
||||
@@ -400,7 +430,6 @@ CMDLINE_SELECT="
|
||||
multi_res_encoding
|
||||
temporal_denoising
|
||||
vp9_temporal_denoising
|
||||
consistent_recode
|
||||
coefficient_range_checking
|
||||
better_hw_compatibility
|
||||
vp9_highbitdepth
|
||||
@@ -629,7 +658,6 @@ process_toolchain() {
|
||||
if enabled gcc; then
|
||||
enabled werror && check_add_cflags -Werror
|
||||
check_add_cflags -Wall
|
||||
check_add_cflags -Wdeclaration-after-statement
|
||||
check_add_cflags -Wdisabled-optimization
|
||||
check_add_cflags -Wextra-semi
|
||||
check_add_cflags -Wextra-semi-stmt
|
||||
@@ -643,8 +671,10 @@ process_toolchain() {
|
||||
check_add_cflags -Wimplicit-function-declaration
|
||||
check_add_cflags -Wmissing-declarations
|
||||
check_add_cflags -Wmissing-prototypes
|
||||
check_add_cflags -Wshadow
|
||||
check_add_cflags -Wstrict-prototypes
|
||||
check_add_cflags -Wuninitialized
|
||||
check_add_cflags -Wunreachable-code-loop-increment
|
||||
check_add_cflags -Wunreachable-code-aggressive
|
||||
check_add_cflags -Wunused
|
||||
check_add_cflags -Wextra
|
||||
# check_add_cflags also adds to cxxflags. gtest does not do well with
|
||||
@@ -655,24 +685,39 @@ process_toolchain() {
|
||||
if enabled mips || [ -z "${INLINE}" ]; then
|
||||
enabled extra_warnings || check_add_cflags -Wno-unused-function
|
||||
fi
|
||||
# Enforce c89 for c files. Don't be too strict about it though. Allow
|
||||
# gnu extensions like "//" for comments.
|
||||
check_cflags -std=gnu89 && add_cflags_only -std=gnu89
|
||||
# Enforce C11 for C files. Allow GNU extensions.
|
||||
check_cflags -std=gnu11 && add_cflags_only -std=gnu11
|
||||
# Enforce C11 compatibility.
|
||||
check_cflags -Wc23-extensions && add_cflags_only -Wc23-extensions
|
||||
# Avoid this warning for third_party C++ sources. Some reorganization
|
||||
# would be needed to apply this only to test/*.cc.
|
||||
check_cflags -Wshorten-64-to-32 && add_cflags_only -Wshorten-64-to-32
|
||||
|
||||
# Do not allow implicit vector type conversions on Clang builds (this
|
||||
# is already the default on GCC builds).
|
||||
check_add_cflags -flax-vector-conversions=none
|
||||
|
||||
# Quiet gcc 6 vs 7 abi warnings:
|
||||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77728
|
||||
if enabled arm; then
|
||||
check_add_cxxflags -Wno-psabi
|
||||
fi
|
||||
|
||||
# disable some warnings specific to libyuv.
|
||||
# Enforce C++17 compatibility.
|
||||
check_add_cxxflags -Wc++20-extensions
|
||||
check_add_cxxflags -Wc++23-extensions
|
||||
check_add_cxxflags -Wnon-virtual-dtor
|
||||
|
||||
# disable some warnings specific to libyuv / libwebm.
|
||||
check_cxxflags -Wno-missing-declarations \
|
||||
&& LIBYUV_CXXFLAGS="${LIBYUV_CXXFLAGS} -Wno-missing-declarations"
|
||||
check_cxxflags -Wno-missing-prototypes \
|
||||
&& LIBYUV_CXXFLAGS="${LIBYUV_CXXFLAGS} -Wno-missing-prototypes"
|
||||
check_cxxflags -Wno-pass-failed \
|
||||
&& LIBYUV_CXXFLAGS="${LIBYUV_CXXFLAGS} -Wno-pass-failed"
|
||||
check_cxxflags -Wno-shadow \
|
||||
&& LIBWEBM_CXXFLAGS="${LIBWEBM_CXXFLAGS} -Wno-shadow" \
|
||||
&& LIBYUV_CXXFLAGS="${LIBYUV_CXXFLAGS} -Wno-shadow"
|
||||
check_cxxflags -Wno-unused-parameter \
|
||||
&& LIBYUV_CXXFLAGS="${LIBYUV_CXXFLAGS} -Wno-unused-parameter"
|
||||
fi
|
||||
@@ -745,33 +790,33 @@ process_toolchain() {
|
||||
soft_enable libyuv
|
||||
;;
|
||||
*-android-*)
|
||||
check_add_cxxflags -std=gnu++11 && soft_enable webm_io
|
||||
check_add_cxxflags -std=gnu++17 && soft_enable webm_io
|
||||
soft_enable libyuv
|
||||
# GTestLog must be modified to use Android logging utilities.
|
||||
;;
|
||||
*-darwin-*)
|
||||
check_add_cxxflags -std=gnu++11
|
||||
check_add_cxxflags -std=gnu++17
|
||||
# iOS/ARM builds do not work with gtest. This does not match
|
||||
# x86 targets.
|
||||
;;
|
||||
*-iphonesimulator-*)
|
||||
check_add_cxxflags -std=gnu++11 && soft_enable webm_io
|
||||
check_add_cxxflags -std=gnu++17 && soft_enable webm_io
|
||||
soft_enable libyuv
|
||||
;;
|
||||
*-win*)
|
||||
# Some mingw toolchains don't have pthread available by default.
|
||||
# Treat these more like visual studio where threading in gtest
|
||||
# would be disabled for the same reason.
|
||||
check_add_cxxflags -std=gnu++11 && soft_enable unit_tests \
|
||||
check_add_cxxflags -std=gnu++17 && soft_enable unit_tests \
|
||||
&& soft_enable webm_io
|
||||
check_cxx "$@" <<EOF && soft_enable libyuv
|
||||
int z;
|
||||
EOF
|
||||
;;
|
||||
*)
|
||||
enabled pthread_h && check_add_cxxflags -std=gnu++11 \
|
||||
enabled pthread_h && check_add_cxxflags -std=gnu++17 \
|
||||
&& soft_enable unit_tests
|
||||
check_add_cxxflags -std=gnu++11 && soft_enable webm_io
|
||||
check_add_cxxflags -std=gnu++17 && soft_enable webm_io
|
||||
check_cxx "$@" <<EOF && soft_enable libyuv
|
||||
int z;
|
||||
EOF
|
||||
|
||||
+8
-20
@@ -57,6 +57,7 @@ LIBWEBM_PARSER_SRCS = third_party/libwebm/mkvparser/mkvparser.cc \
|
||||
# Add compile flags and include path for libwebm sources.
|
||||
ifeq ($(CONFIG_WEBM_IO),yes)
|
||||
CXXFLAGS += -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS
|
||||
$(BUILD_PFX)third_party/libwebm/%.cc.o: CXXFLAGS += $(LIBWEBM_CXXFLAGS)
|
||||
INC_PATH-yes += $(SRC_PATH_BARE)/third_party/libwebm
|
||||
endif
|
||||
|
||||
@@ -68,7 +69,6 @@ vpxdec.SRCS += md5_utils.c md5_utils.h
|
||||
vpxdec.SRCS += vpx_ports/compiler_attributes.h
|
||||
vpxdec.SRCS += vpx_ports/mem_ops.h
|
||||
vpxdec.SRCS += vpx_ports/mem_ops_aligned.h
|
||||
vpxdec.SRCS += vpx_ports/msvc.h
|
||||
vpxdec.SRCS += vpx_ports/vpx_timer.h
|
||||
vpxdec.SRCS += vpx/vpx_integer.h
|
||||
vpxdec.SRCS += args.c args.h
|
||||
@@ -81,8 +81,6 @@ ifeq ($(CONFIG_LIBYUV),yes)
|
||||
$(BUILD_PFX)third_party/libyuv/%.cc.o: CXXFLAGS += ${LIBYUV_CXXFLAGS}
|
||||
endif
|
||||
ifeq ($(CONFIG_WEBM_IO),yes)
|
||||
vpxdec.SRCS += $(LIBWEBM_COMMON_SRCS)
|
||||
vpxdec.SRCS += $(LIBWEBM_MUXER_SRCS)
|
||||
vpxdec.SRCS += $(LIBWEBM_PARSER_SRCS)
|
||||
vpxdec.SRCS += webmdec.cc webmdec.h
|
||||
endif
|
||||
@@ -97,7 +95,6 @@ vpxenc.SRCS += tools_common.c tools_common.h
|
||||
vpxenc.SRCS += warnings.c warnings.h
|
||||
vpxenc.SRCS += vpx_ports/mem_ops.h
|
||||
vpxenc.SRCS += vpx_ports/mem_ops_aligned.h
|
||||
vpxenc.SRCS += vpx_ports/msvc.h
|
||||
vpxenc.SRCS += vpx_ports/vpx_timer.h
|
||||
vpxenc.SRCS += vpxstats.c vpxstats.h
|
||||
ifeq ($(CONFIG_LIBYUV),yes)
|
||||
@@ -119,24 +116,18 @@ vp9_spatial_svc_encoder.SRCS += y4minput.c y4minput.h
|
||||
vp9_spatial_svc_encoder.SRCS += tools_common.c tools_common.h
|
||||
vp9_spatial_svc_encoder.SRCS += video_common.h
|
||||
vp9_spatial_svc_encoder.SRCS += video_writer.h video_writer.c
|
||||
vp9_spatial_svc_encoder.SRCS += vpx_ports/msvc.h
|
||||
vp9_spatial_svc_encoder.SRCS += vpxstats.c vpxstats.h
|
||||
vp9_spatial_svc_encoder.SRCS += examples/svc_encodeframe.c
|
||||
vp9_spatial_svc_encoder.SRCS += examples/svc_context.h
|
||||
vp9_spatial_svc_encoder.GUID = 4A38598D-627D-4505-9C7B-D4020C84100D
|
||||
vp9_spatial_svc_encoder.DESCRIPTION = VP9 Spatial SVC Encoder
|
||||
|
||||
ifneq ($(CONFIG_SHARED),yes)
|
||||
EXAMPLES-$(CONFIG_VP9_ENCODER) += resize_util.c
|
||||
endif
|
||||
|
||||
EXAMPLES-$(CONFIG_ENCODERS) += vpx_temporal_svc_encoder.c
|
||||
vpx_temporal_svc_encoder.SRCS += ivfenc.c ivfenc.h
|
||||
vpx_temporal_svc_encoder.SRCS += y4minput.c y4minput.h
|
||||
vpx_temporal_svc_encoder.SRCS += tools_common.c tools_common.h
|
||||
vpx_temporal_svc_encoder.SRCS += video_common.h
|
||||
vpx_temporal_svc_encoder.SRCS += video_writer.h video_writer.c
|
||||
vpx_temporal_svc_encoder.SRCS += vpx_ports/msvc.h
|
||||
vpx_temporal_svc_encoder.GUID = B18C08F2-A439-4502-A78E-849BE3D60947
|
||||
vpx_temporal_svc_encoder.DESCRIPTION = Temporal SVC Encoder
|
||||
EXAMPLES-$(CONFIG_DECODERS) += simple_decoder.c
|
||||
@@ -148,7 +139,6 @@ simple_decoder.SRCS += video_common.h
|
||||
simple_decoder.SRCS += video_reader.h video_reader.c
|
||||
simple_decoder.SRCS += vpx_ports/mem_ops.h
|
||||
simple_decoder.SRCS += vpx_ports/mem_ops_aligned.h
|
||||
simple_decoder.SRCS += vpx_ports/msvc.h
|
||||
simple_decoder.DESCRIPTION = Simplified decoder loop
|
||||
EXAMPLES-$(CONFIG_DECODERS) += postproc.c
|
||||
postproc.SRCS += ivfdec.h ivfdec.c
|
||||
@@ -158,7 +148,6 @@ postproc.SRCS += video_common.h
|
||||
postproc.SRCS += video_reader.h video_reader.c
|
||||
postproc.SRCS += vpx_ports/mem_ops.h
|
||||
postproc.SRCS += vpx_ports/mem_ops_aligned.h
|
||||
postproc.SRCS += vpx_ports/msvc.h
|
||||
postproc.GUID = 65E33355-F35E-4088-884D-3FD4905881D7
|
||||
postproc.DESCRIPTION = Decoder postprocessor control
|
||||
EXAMPLES-$(CONFIG_DECODERS) += decode_to_md5.c
|
||||
@@ -171,7 +160,6 @@ decode_to_md5.SRCS += video_reader.h video_reader.c
|
||||
decode_to_md5.SRCS += vpx_ports/compiler_attributes.h
|
||||
decode_to_md5.SRCS += vpx_ports/mem_ops.h
|
||||
decode_to_md5.SRCS += vpx_ports/mem_ops_aligned.h
|
||||
decode_to_md5.SRCS += vpx_ports/msvc.h
|
||||
decode_to_md5.GUID = 59120B9B-2735-4BFE-B022-146CA340FE42
|
||||
decode_to_md5.DESCRIPTION = Frame by frame MD5 checksum
|
||||
EXAMPLES-$(CONFIG_ENCODERS) += simple_encoder.c
|
||||
@@ -180,7 +168,6 @@ simple_encoder.SRCS += y4minput.c y4minput.h
|
||||
simple_encoder.SRCS += tools_common.h tools_common.c
|
||||
simple_encoder.SRCS += video_common.h
|
||||
simple_encoder.SRCS += video_writer.h video_writer.c
|
||||
simple_encoder.SRCS += vpx_ports/msvc.h
|
||||
simple_encoder.GUID = 4607D299-8A71-4D2C-9B1D-071899B6FBFD
|
||||
simple_encoder.DESCRIPTION = Simplified encoder loop
|
||||
EXAMPLES-$(CONFIG_VP9_ENCODER) += vp9_lossless_encoder.c
|
||||
@@ -189,7 +176,6 @@ vp9_lossless_encoder.SRCS += y4minput.c y4minput.h
|
||||
vp9_lossless_encoder.SRCS += tools_common.h tools_common.c
|
||||
vp9_lossless_encoder.SRCS += video_common.h
|
||||
vp9_lossless_encoder.SRCS += video_writer.h video_writer.c
|
||||
vp9_lossless_encoder.SRCS += vpx_ports/msvc.h
|
||||
vp9_lossless_encoder.GUID = B63C7C88-5348-46DC-A5A6-CC151EF93366
|
||||
vp9_lossless_encoder.DESCRIPTION = Simplified lossless VP9 encoder
|
||||
EXAMPLES-$(CONFIG_ENCODERS) += twopass_encoder.c
|
||||
@@ -198,7 +184,6 @@ twopass_encoder.SRCS += y4minput.c y4minput.h
|
||||
twopass_encoder.SRCS += tools_common.h tools_common.c
|
||||
twopass_encoder.SRCS += video_common.h
|
||||
twopass_encoder.SRCS += video_writer.h video_writer.c
|
||||
twopass_encoder.SRCS += vpx_ports/msvc.h
|
||||
twopass_encoder.GUID = 73494FA6-4AF9-4763-8FBB-265C92402FD8
|
||||
twopass_encoder.DESCRIPTION = Two-pass encoder loop
|
||||
EXAMPLES-$(CONFIG_DECODERS) += decode_with_drops.c
|
||||
@@ -209,7 +194,6 @@ decode_with_drops.SRCS += video_common.h
|
||||
decode_with_drops.SRCS += video_reader.h video_reader.c
|
||||
decode_with_drops.SRCS += vpx_ports/mem_ops.h
|
||||
decode_with_drops.SRCS += vpx_ports/mem_ops_aligned.h
|
||||
decode_with_drops.SRCS += vpx_ports/msvc.h
|
||||
decode_with_drops.GUID = CE5C53C4-8DDA-438A-86ED-0DDD3CDB8D26
|
||||
decode_with_drops.DESCRIPTION = Drops frames while decoding
|
||||
EXAMPLES-$(CONFIG_ENCODERS) += set_maps.c
|
||||
@@ -218,7 +202,6 @@ set_maps.SRCS += y4minput.c y4minput.h
|
||||
set_maps.SRCS += tools_common.h tools_common.c
|
||||
set_maps.SRCS += video_common.h
|
||||
set_maps.SRCS += video_writer.h video_writer.c
|
||||
set_maps.SRCS += vpx_ports/msvc.h
|
||||
set_maps.GUID = ECB2D24D-98B8-4015-A465-A4AF3DCC145F
|
||||
set_maps.DESCRIPTION = Set active and ROI maps
|
||||
EXAMPLES-$(CONFIG_VP8_ENCODER) += vp8cx_set_ref.c
|
||||
@@ -227,7 +210,6 @@ vp8cx_set_ref.SRCS += y4minput.c y4minput.h
|
||||
vp8cx_set_ref.SRCS += tools_common.h tools_common.c
|
||||
vp8cx_set_ref.SRCS += video_common.h
|
||||
vp8cx_set_ref.SRCS += video_writer.h video_writer.c
|
||||
vp8cx_set_ref.SRCS += vpx_ports/msvc.h
|
||||
vp8cx_set_ref.GUID = C5E31F7F-96F6-48BD-BD3E-10EBF6E8057A
|
||||
vp8cx_set_ref.DESCRIPTION = VP8 set encoder reference frame
|
||||
|
||||
@@ -251,7 +233,6 @@ vp8_multi_resolution_encoder.SRCS += ivfenc.h ivfenc.c
|
||||
vp8_multi_resolution_encoder.SRCS += y4minput.c y4minput.h
|
||||
vp8_multi_resolution_encoder.SRCS += tools_common.h tools_common.c
|
||||
vp8_multi_resolution_encoder.SRCS += video_writer.h video_writer.c
|
||||
vp8_multi_resolution_encoder.SRCS += vpx_ports/msvc.h
|
||||
vp8_multi_resolution_encoder.SRCS += $(LIBYUV_SRCS)
|
||||
vp8_multi_resolution_encoder.GUID = 04f8738e-63c8-423b-90fa-7c2703a374de
|
||||
vp8_multi_resolution_encoder.DESCRIPTION = VP8 Multiple-resolution Encoding
|
||||
@@ -388,6 +369,13 @@ INSTALL-BINS-$(CONFIG_MSVS) += $(foreach p,$(VS_PLATFORMS),\
|
||||
$(foreach proj,$(call enabled,PROJECTS),\
|
||||
$(eval $(call vcproj_template,$(proj))))
|
||||
|
||||
# Generate a list of all enabled sources, in particular for exporting to gyp
|
||||
# based build systems.
|
||||
vpxdec_srcs.txt:
|
||||
@echo " [CREATE] $@"
|
||||
@echo $(vpxdec.SRCS) | xargs -n1 echo | LC_ALL=C sort -u > $@
|
||||
CLEAN-OBJS += vpxdec_srcs.txt
|
||||
|
||||
#
|
||||
# Documentation Rules
|
||||
#
|
||||
|
||||
@@ -1,123 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014 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 <assert.h>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../tools_common.h"
|
||||
#include "../vp9/encoder/vp9_resize.h"
|
||||
|
||||
static const char *exec_name = NULL;
|
||||
|
||||
static void usage() {
|
||||
printf("Usage:\n");
|
||||
printf("%s <input_yuv> <width>x<height> <target_width>x<target_height> ",
|
||||
exec_name);
|
||||
printf("<output_yuv> [<frames>]\n");
|
||||
}
|
||||
|
||||
void usage_exit(void) {
|
||||
usage();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
static int parse_dim(char *v, int *width, int *height) {
|
||||
char *x = strchr(v, 'x');
|
||||
if (x == NULL) x = strchr(v, 'X');
|
||||
if (x == NULL) return 0;
|
||||
*width = atoi(v);
|
||||
*height = atoi(&x[1]);
|
||||
if (*width <= 0 || *height <= 0)
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
char *fin, *fout;
|
||||
FILE *fpin, *fpout;
|
||||
uint8_t *inbuf, *outbuf;
|
||||
uint8_t *inbuf_u, *outbuf_u;
|
||||
uint8_t *inbuf_v, *outbuf_v;
|
||||
int f, frames;
|
||||
int width, height, target_width, target_height;
|
||||
|
||||
exec_name = argv[0];
|
||||
|
||||
if (argc < 5) {
|
||||
printf("Incorrect parameters:\n");
|
||||
usage();
|
||||
return 1;
|
||||
}
|
||||
|
||||
fin = argv[1];
|
||||
fout = argv[4];
|
||||
if (!parse_dim(argv[2], &width, &height)) {
|
||||
printf("Incorrect parameters: %s\n", argv[2]);
|
||||
usage();
|
||||
return 1;
|
||||
}
|
||||
if (!parse_dim(argv[3], &target_width, &target_height)) {
|
||||
printf("Incorrect parameters: %s\n", argv[3]);
|
||||
usage();
|
||||
return 1;
|
||||
}
|
||||
|
||||
fpin = fopen(fin, "rb");
|
||||
if (fpin == NULL) {
|
||||
printf("Can't open file %s to read\n", fin);
|
||||
usage();
|
||||
return 1;
|
||||
}
|
||||
fpout = fopen(fout, "wb");
|
||||
if (fpout == NULL) {
|
||||
printf("Can't open file %s to write\n", fout);
|
||||
usage();
|
||||
return 1;
|
||||
}
|
||||
if (argc >= 6)
|
||||
frames = atoi(argv[5]);
|
||||
else
|
||||
frames = INT_MAX;
|
||||
|
||||
printf("Input size: %dx%d\n", width, height);
|
||||
printf("Target size: %dx%d, Frames: ", target_width, target_height);
|
||||
if (frames == INT_MAX)
|
||||
printf("All\n");
|
||||
else
|
||||
printf("%d\n", frames);
|
||||
|
||||
inbuf = (uint8_t *)malloc(width * height * 3 / 2);
|
||||
outbuf = (uint8_t *)malloc(target_width * target_height * 3 / 2);
|
||||
inbuf_u = inbuf + width * height;
|
||||
inbuf_v = inbuf_u + width * height / 4;
|
||||
outbuf_u = outbuf + target_width * target_height;
|
||||
outbuf_v = outbuf_u + target_width * target_height / 4;
|
||||
f = 0;
|
||||
while (f < frames) {
|
||||
if (fread(inbuf, width * height * 3 / 2, 1, fpin) != 1) break;
|
||||
vp9_resize_frame420(inbuf, width, inbuf_u, inbuf_v, width / 2, height,
|
||||
width, outbuf, target_width, outbuf_u, outbuf_v,
|
||||
target_width / 2, target_height, target_width);
|
||||
fwrite(outbuf, target_width * target_height * 3 / 2, 1, fpout);
|
||||
f++;
|
||||
}
|
||||
printf("%d frames processed\n", f);
|
||||
fclose(fpin);
|
||||
fclose(fpout);
|
||||
|
||||
free(inbuf);
|
||||
free(outbuf);
|
||||
return 0;
|
||||
}
|
||||
@@ -192,7 +192,8 @@ int main(int argc, char **argv) {
|
||||
printf("Using %s\n", vpx_codec_iface_name(encoder->codec_interface()));
|
||||
|
||||
res = vpx_codec_enc_config_default(encoder->codec_interface(), &cfg, 0);
|
||||
if (res) die_codec(&codec, "Failed to get default codec config.");
|
||||
if (res)
|
||||
die("Failed to get default codec config: %s", vpx_codec_err_to_string(res));
|
||||
|
||||
cfg.g_w = info.frame_width;
|
||||
cfg.g_h = info.frame_height;
|
||||
|
||||
@@ -73,12 +73,15 @@
|
||||
// This example does not special case any error return codes. If there was
|
||||
// an error, a descriptive message is printed and the program exits. With
|
||||
// few exceptions, vpx_codec functions return an enumerated error status,
|
||||
// with the value `0` indicating success.
|
||||
// with the value `0` indicating success. VP8 may return success for a
|
||||
// corrupted frame, so the VP8D_GET_FRAME_CORRUPTED control is checked after
|
||||
// every decode.
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "vpx/vp8dx.h"
|
||||
#include "vpx/vpx_decoder.h"
|
||||
|
||||
#include "../tools_common.h"
|
||||
@@ -124,10 +127,14 @@ int main(int argc, char **argv) {
|
||||
vpx_codec_iter_t iter = NULL;
|
||||
vpx_image_t *img = NULL;
|
||||
size_t frame_size = 0;
|
||||
int corrupted = 0;
|
||||
const unsigned char *frame =
|
||||
vpx_video_reader_get_frame(reader, &frame_size);
|
||||
if (vpx_codec_decode(&codec, frame, (unsigned int)frame_size, NULL, 0))
|
||||
die_codec(&codec, "Failed to decode frame.");
|
||||
if (vpx_codec_control(&codec, VP8D_GET_FRAME_CORRUPTED, &corrupted))
|
||||
die_codec(&codec, "Failed to get frame corrupted state.");
|
||||
if (corrupted) die("Frame %d is corrupted.", frame_cnt);
|
||||
|
||||
while ((img = vpx_codec_get_frame(&codec, &iter)) != NULL) {
|
||||
vpx_img_write(img, outfile);
|
||||
|
||||
@@ -202,7 +202,8 @@ int main(int argc, char **argv) {
|
||||
printf("Using %s\n", vpx_codec_iface_name(encoder->codec_interface()));
|
||||
|
||||
res = vpx_codec_enc_config_default(encoder->codec_interface(), &cfg, 0);
|
||||
if (res) die_codec(&codec, "Failed to get default codec config.");
|
||||
if (res)
|
||||
die("Failed to get default codec config: %s", vpx_codec_err_to_string(res));
|
||||
|
||||
cfg.g_w = info.frame_width;
|
||||
cfg.g_h = info.frame_height;
|
||||
|
||||
@@ -39,6 +39,7 @@ typedef struct {
|
||||
int speed; // speed setting for codec
|
||||
int threads;
|
||||
int aqmode; // turns on aq-mode=3 (cyclic_refresh): 0=off, 1=on.
|
||||
int use_psnr;
|
||||
// private storage for vpx_svc_encode
|
||||
void *internal;
|
||||
} SvcContext;
|
||||
@@ -58,6 +59,7 @@ typedef struct SvcInternal {
|
||||
double psnr_sum[VPX_SS_MAX_LAYERS][COMPONENTS]; // total/Y/U/V
|
||||
uint64_t sse_sum[VPX_SS_MAX_LAYERS][COMPONENTS];
|
||||
uint32_t bytes_sum[VPX_SS_MAX_LAYERS];
|
||||
int number_of_frames[VPX_SS_MAX_LAYERS];
|
||||
|
||||
// codec encoding values
|
||||
int width; // width of highest layer
|
||||
@@ -65,7 +67,6 @@ typedef struct SvcInternal {
|
||||
int kf_dist; // distance between keyframes
|
||||
|
||||
// state variables
|
||||
int psnr_pkt_received;
|
||||
int layer;
|
||||
int use_multiple_frame_contexts;
|
||||
|
||||
|
||||
@@ -279,7 +279,7 @@ vpx_codec_err_t vpx_svc_set_options(SvcContext *svc_ctx, const char *options) {
|
||||
if (svc_ctx == NULL || options == NULL || si == NULL) {
|
||||
return VPX_CODEC_INVALID_PARAM;
|
||||
}
|
||||
strncpy(si->options, options, sizeof(si->options));
|
||||
strncpy(si->options, options, sizeof(si->options) - 1);
|
||||
si->options[sizeof(si->options) - 1] = '\0';
|
||||
return VPX_CODEC_OK;
|
||||
}
|
||||
@@ -381,7 +381,7 @@ vpx_codec_err_t vpx_svc_init(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
|
||||
vpx_codec_iface_t *iface,
|
||||
vpx_codec_enc_cfg_t *enc_cfg) {
|
||||
vpx_codec_err_t res;
|
||||
int i, sl, tl;
|
||||
int sl, tl;
|
||||
SvcInternal_t *const si = get_svc_internal(svc_ctx);
|
||||
if (svc_ctx == NULL || codec_ctx == NULL || iface == NULL ||
|
||||
enc_cfg == NULL) {
|
||||
@@ -433,7 +433,7 @@ vpx_codec_err_t vpx_svc_init(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
|
||||
}
|
||||
for (tl = 0; tl < svc_ctx->temporal_layers; ++tl) {
|
||||
for (sl = 0; sl < svc_ctx->spatial_layers; ++sl) {
|
||||
i = sl * svc_ctx->temporal_layers + tl;
|
||||
const int i = sl * svc_ctx->temporal_layers + tl;
|
||||
si->svc_params.max_quantizers[i] = MAX_QUANTIZER;
|
||||
si->svc_params.min_quantizers[i] = 0;
|
||||
if (enc_cfg->rc_end_usage == VPX_CBR &&
|
||||
@@ -503,7 +503,7 @@ vpx_codec_err_t vpx_svc_init(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
|
||||
|
||||
for (tl = 0; tl < svc_ctx->temporal_layers; ++tl) {
|
||||
for (sl = 0; sl < svc_ctx->spatial_layers; ++sl) {
|
||||
i = sl * svc_ctx->temporal_layers + tl;
|
||||
const int i = sl * svc_ctx->temporal_layers + tl;
|
||||
if (enc_cfg->rc_end_usage == VPX_CBR &&
|
||||
enc_cfg->g_pass == VPX_RC_ONE_PASS) {
|
||||
si->svc_params.max_quantizers[i] = enc_cfg->rc_max_quantizer;
|
||||
@@ -516,7 +516,11 @@ vpx_codec_err_t vpx_svc_init(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
|
||||
enc_cfg->g_error_resilient = 1;
|
||||
|
||||
// Initialize codec
|
||||
res = vpx_codec_enc_init(codec_ctx, iface, enc_cfg, VPX_CODEC_USE_PSNR);
|
||||
vpx_codec_flags_t flags = 0;
|
||||
if (svc_ctx->use_psnr) {
|
||||
flags |= VPX_CODEC_USE_PSNR;
|
||||
}
|
||||
res = vpx_codec_enc_init(codec_ctx, iface, enc_cfg, flags);
|
||||
if (res != VPX_CODEC_OK) {
|
||||
svc_log(svc_ctx, SVC_LOG_ERROR, "svc_enc_init error\n");
|
||||
return res;
|
||||
@@ -536,8 +540,6 @@ vpx_codec_err_t vpx_svc_encode(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
|
||||
struct vpx_image *rawimg, vpx_codec_pts_t pts,
|
||||
int64_t duration, int deadline) {
|
||||
vpx_codec_err_t res;
|
||||
vpx_codec_iter_t iter;
|
||||
const vpx_codec_cx_pkt_t *cx_pkt;
|
||||
SvcInternal_t *const si = get_svc_internal(svc_ctx);
|
||||
if (svc_ctx == NULL || codec_ctx == NULL || si == NULL) {
|
||||
return VPX_CODEC_INVALID_PARAM;
|
||||
@@ -548,17 +550,6 @@ vpx_codec_err_t vpx_svc_encode(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
|
||||
if (res != VPX_CODEC_OK) {
|
||||
return res;
|
||||
}
|
||||
// save compressed data
|
||||
iter = NULL;
|
||||
while ((cx_pkt = vpx_codec_get_cx_data(codec_ctx, &iter))) {
|
||||
switch (cx_pkt->kind) {
|
||||
case VPX_CODEC_PSNR_PKT: {
|
||||
}
|
||||
++si->psnr_pkt_received;
|
||||
break;
|
||||
default: { break; }
|
||||
}
|
||||
}
|
||||
|
||||
return VPX_CODEC_OK;
|
||||
}
|
||||
@@ -570,7 +561,6 @@ static double calc_psnr(double d) {
|
||||
|
||||
// dump accumulated statistics and reset accumulated values
|
||||
void vpx_svc_dump_statistics(SvcContext *svc_ctx) {
|
||||
int number_of_frames;
|
||||
int i, j;
|
||||
uint32_t bytes_total = 0;
|
||||
double scale[COMPONENTS];
|
||||
@@ -581,19 +571,18 @@ void vpx_svc_dump_statistics(SvcContext *svc_ctx) {
|
||||
SvcInternal_t *const si = get_svc_internal(svc_ctx);
|
||||
if (svc_ctx == NULL || si == NULL) return;
|
||||
|
||||
number_of_frames = si->psnr_pkt_received;
|
||||
if (number_of_frames <= 0) return;
|
||||
|
||||
svc_log(svc_ctx, SVC_LOG_INFO, "\n");
|
||||
for (i = 0; i < svc_ctx->spatial_layers; ++i) {
|
||||
svc_log(svc_ctx, SVC_LOG_INFO,
|
||||
"Layer %d Average PSNR=[%2.3f, %2.3f, %2.3f, %2.3f], Bytes=[%u]\n",
|
||||
i, si->psnr_sum[i][0] / number_of_frames,
|
||||
si->psnr_sum[i][1] / number_of_frames,
|
||||
si->psnr_sum[i][2] / number_of_frames,
|
||||
si->psnr_sum[i][3] / number_of_frames, si->bytes_sum[i]);
|
||||
"Layer %d Average PSNR=[%2.3f, %2.3f, %2.3f, %2.3f], Bytes=[%u], "
|
||||
"Number_of_frames %d \n",
|
||||
i, si->psnr_sum[i][0] / si->number_of_frames[i],
|
||||
si->psnr_sum[i][1] / si->number_of_frames[i],
|
||||
si->psnr_sum[i][2] / si->number_of_frames[i],
|
||||
si->psnr_sum[i][3] / si->number_of_frames[i], si->bytes_sum[i],
|
||||
si->number_of_frames[i]);
|
||||
// the following psnr calculation is deduced from ffmpeg.c#print_report
|
||||
y_scale = si->width * si->height * 255.0 * 255.0 * number_of_frames;
|
||||
y_scale = si->width * si->height * 255.0 * 255.0 * si->number_of_frames[i];
|
||||
scale[1] = y_scale;
|
||||
scale[2] = scale[3] = y_scale / 4; // U or V
|
||||
scale[0] = y_scale * 1.5; // total
|
||||
@@ -610,17 +599,17 @@ void vpx_svc_dump_statistics(SvcContext *svc_ctx) {
|
||||
mse[1], mse[2], mse[3]);
|
||||
|
||||
bytes_total += si->bytes_sum[i];
|
||||
// Clear sums for next time.
|
||||
}
|
||||
// Clear sums for next time.
|
||||
for (i = 0; i < svc_ctx->spatial_layers; ++i) {
|
||||
si->bytes_sum[i] = 0;
|
||||
si->number_of_frames[i] = 0;
|
||||
for (j = 0; j < COMPONENTS; ++j) {
|
||||
si->psnr_sum[i][j] = 0;
|
||||
si->sse_sum[i][j] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// only display statistics once
|
||||
si->psnr_pkt_received = 0;
|
||||
|
||||
svc_log(svc_ctx, SVC_LOG_INFO, "Total Bytes=[%u]\n", bytes_total);
|
||||
}
|
||||
|
||||
|
||||
@@ -191,7 +191,6 @@ static void pass1(vpx_image_t *raw, FILE *infile, const char *outfile_name,
|
||||
int main(int argc, char **argv) {
|
||||
FILE *infile = NULL;
|
||||
int w, h;
|
||||
vpx_codec_ctx_t codec;
|
||||
vpx_codec_enc_cfg_t cfg;
|
||||
vpx_image_t raw;
|
||||
vpx_codec_err_t res;
|
||||
@@ -228,7 +227,8 @@ int main(int argc, char **argv) {
|
||||
|
||||
// Configuration
|
||||
res = vpx_codec_enc_config_default(encoder->codec_interface(), &cfg, 0);
|
||||
if (res) die_codec(&codec, "Failed to get default codec config.");
|
||||
if (res)
|
||||
die("Failed to get default codec config: %s", vpx_codec_err_to_string(res));
|
||||
|
||||
cfg.g_w = w;
|
||||
cfg.g_h = h;
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
#include <sys/time.h>
|
||||
@@ -438,7 +437,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
/* Other-resolution encoder settings */
|
||||
for (i = 1; i < NUM_ENCODERS; i++) {
|
||||
memcpy(&cfg[i], &cfg[0], sizeof(vpx_codec_enc_cfg_t));
|
||||
cfg[i] = cfg[0];
|
||||
|
||||
cfg[i].rc_target_bitrate = target_bitrate[i];
|
||||
|
||||
|
||||
@@ -140,7 +140,8 @@ int main(int argc, char **argv) {
|
||||
printf("Using %s\n", vpx_codec_iface_name(encoder->codec_interface()));
|
||||
|
||||
res = vpx_codec_enc_config_default(encoder->codec_interface(), &cfg, 0);
|
||||
if (res) die_codec(&codec, "Failed to get default codec config.");
|
||||
if (res)
|
||||
die("Failed to get default codec config: %s", vpx_codec_err_to_string(res));
|
||||
|
||||
cfg.g_w = info.frame_width;
|
||||
cfg.g_h = info.frame_height;
|
||||
|
||||
@@ -96,7 +96,8 @@ int main(int argc, char **argv) {
|
||||
printf("Using %s\n", vpx_codec_iface_name(encoder->codec_interface()));
|
||||
|
||||
res = vpx_codec_enc_config_default(encoder->codec_interface(), &cfg, 0);
|
||||
if (res) die_codec(&codec, "Failed to get default codec config.");
|
||||
if (res)
|
||||
die("Failed to get default codec config: %s", vpx_codec_err_to_string(res));
|
||||
|
||||
cfg.g_w = info.frame_width;
|
||||
cfg.g_h = info.frame_height;
|
||||
|
||||
@@ -14,8 +14,11 @@
|
||||
* that benefit from a scalable bitstream.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
@@ -24,14 +27,16 @@
|
||||
#include "../tools_common.h"
|
||||
#include "../video_writer.h"
|
||||
|
||||
#include "../vpx_ports/bitops.h"
|
||||
#include "../vpx_ports/vpx_timer.h"
|
||||
#include "./svc_context.h"
|
||||
#include "vpx/vp8cx.h"
|
||||
#include "vpx/vpx_decoder.h"
|
||||
#include "vpx/vpx_encoder.h"
|
||||
#include "../vpxstats.h"
|
||||
#include "vp9/encoder/vp9_encoder.h"
|
||||
#include "./y4minput.h"
|
||||
|
||||
#define OUTPUT_FRAME_STATS 0
|
||||
#define OUTPUT_RC_STATS 1
|
||||
|
||||
#define SIMULCAST_MODE 0
|
||||
@@ -88,6 +93,8 @@ static const arg_def_t bitrates_arg =
|
||||
ARG_DEF("bl", "bitrates", 1, "bitrates[sl * num_tl + tl]");
|
||||
static const arg_def_t dropframe_thresh_arg =
|
||||
ARG_DEF(NULL, "drop-frame", 1, "Temporal resampling threshold (buf %)");
|
||||
static const arg_def_t psnr_arg =
|
||||
ARG_DEF(NULL, "psnr", 1, "Enable PSNR computation and statistics");
|
||||
static const struct arg_enum_list tune_content_enum[] = {
|
||||
{ "default", VP9E_CONTENT_DEFAULT },
|
||||
{ "screen", VP9E_CONTENT_SCREEN },
|
||||
@@ -141,6 +148,7 @@ static const arg_def_t *svc_args[] = { &frames_arg,
|
||||
&dropframe_thresh_arg,
|
||||
&tune_content_arg,
|
||||
&inter_layer_pred_arg,
|
||||
&psnr_arg,
|
||||
NULL };
|
||||
|
||||
static const uint32_t default_frames_to_skip = 0;
|
||||
@@ -200,6 +208,7 @@ static void parse_command_line(int argc, const char **argv_,
|
||||
#endif
|
||||
svc_ctx->speed = default_speed;
|
||||
svc_ctx->threads = default_threads;
|
||||
svc_ctx->use_psnr = 0;
|
||||
|
||||
// start with default encoder configuration
|
||||
res = vpx_codec_enc_config_default(vpx_codec_vp9_cx(), enc_cfg, 0);
|
||||
@@ -315,7 +324,6 @@ static void parse_command_line(int argc, const char **argv_,
|
||||
break;
|
||||
default:
|
||||
die("Error: Invalid bit depth selected (%d)\n", enc_cfg->g_bit_depth);
|
||||
break;
|
||||
}
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
} else if (arg_match(&arg, &dropframe_thresh_arg, argi)) {
|
||||
@@ -324,6 +332,8 @@ static void parse_command_line(int argc, const char **argv_,
|
||||
app_input->tune_content = arg_parse_uint(&arg);
|
||||
} else if (arg_match(&arg, &inter_layer_pred_arg, argi)) {
|
||||
app_input->inter_layer_pred = arg_parse_uint(&arg);
|
||||
} else if (arg_match(&arg, &psnr_arg, argi)) {
|
||||
svc_ctx->use_psnr = arg_parse_uint(&arg);
|
||||
} else {
|
||||
++argj;
|
||||
}
|
||||
@@ -776,8 +786,8 @@ static void svc_output_rc_stats(
|
||||
int count = 0;
|
||||
double sum_bitrate = 0.0;
|
||||
double sum_bitrate2 = 0.0;
|
||||
vp9_zero(sizes);
|
||||
vp9_zero(sizes_parsed);
|
||||
memset(sizes, 0, sizeof(sizes));
|
||||
memset(sizes_parsed, 0, sizeof(sizes_parsed));
|
||||
vpx_codec_control(codec, VP9E_GET_SVC_LAYER_ID, layer_id);
|
||||
parse_superframe_index(cx_pkt->data.frame.buf, cx_pkt->data.frame.sz,
|
||||
sizes_parsed, &count);
|
||||
@@ -880,7 +890,9 @@ int main(int argc, const char **argv) {
|
||||
int pts = 0; /* PTS starts at 0 */
|
||||
int frame_duration = 1; /* 1 timebase tick per frame */
|
||||
int end_of_stream = 0;
|
||||
#if OUTPUT_FRAME_STATS
|
||||
int frames_received = 0;
|
||||
#endif
|
||||
#if OUTPUT_RC_STATS
|
||||
VpxVideoWriter *outfile[VPX_SS_MAX_LAYERS] = { NULL };
|
||||
struct RateControlStats rc;
|
||||
@@ -1126,41 +1138,65 @@ int main(int argc, const char **argv) {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/*
|
||||
#if OUTPUT_FRAME_STATS
|
||||
printf("SVC frame: %d, kf: %d, size: %d, pts: %d\n", frames_received,
|
||||
!!(cx_pkt->data.frame.flags & VPX_FRAME_IS_KEY),
|
||||
(int)cx_pkt->data.frame.sz, (int)cx_pkt->data.frame.pts);
|
||||
*/
|
||||
if (enc_cfg.ss_number_layers == 1 && enc_cfg.ts_number_layers == 1)
|
||||
si->bytes_sum[0] += (int)cx_pkt->data.frame.sz;
|
||||
++frames_received;
|
||||
#endif
|
||||
if (enc_cfg.ss_number_layers > 1) {
|
||||
uint64_t sizes[8] = { 0 };
|
||||
int count = 0;
|
||||
int num_layers_encoded = 0;
|
||||
parse_superframe_index(cx_pkt->data.frame.buf,
|
||||
cx_pkt->data.frame.sz, sizes, &count);
|
||||
for (sl = 0; sl < enc_cfg.ss_number_layers; ++sl) {
|
||||
if (cx_pkt->data.frame.spatial_layer_encoded[sl]) {
|
||||
si->bytes_sum[sl] += (int)sizes[num_layers_encoded];
|
||||
num_layers_encoded++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
si->bytes_sum[0] += (int)cx_pkt->data.frame.sz;
|
||||
}
|
||||
#if CONFIG_VP9_DECODER && !SIMULCAST_MODE
|
||||
if (vpx_codec_decode(&decoder, cx_pkt->data.frame.buf,
|
||||
(unsigned int)cx_pkt->data.frame.sz, NULL, 0))
|
||||
die_codec(&decoder, "Failed to decode frame.");
|
||||
vpx_codec_control(&encoder, VP9E_GET_SVC_LAYER_ID, &layer_id);
|
||||
// Don't look for mismatch on top spatial and top temporal layers as
|
||||
// they are non reference frames. Don't look at frames whose top
|
||||
// spatial layer is dropped.
|
||||
if ((enc_cfg.ss_number_layers > 1 || enc_cfg.ts_number_layers > 1) &&
|
||||
cx_pkt->data.frame
|
||||
.spatial_layer_encoded[enc_cfg.ss_number_layers - 1] &&
|
||||
!(layer_id.temporal_layer_id > 0 &&
|
||||
layer_id.temporal_layer_id ==
|
||||
(int)enc_cfg.ts_number_layers - 1)) {
|
||||
test_decode(&encoder, &decoder, frame_cnt, &mismatch_seen);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case VPX_CODEC_PSNR_PKT: {
|
||||
SvcInternal_t *const si = (SvcInternal_t *)svc_ctx.internal;
|
||||
sl = cx_pkt->data.psnr.spatial_layer_id;
|
||||
si->number_of_frames[sl]++;
|
||||
for (int j = 0; j < 4; ++j) {
|
||||
si->psnr_sum[sl][j] += cx_pkt->data.psnr.psnr[j];
|
||||
si->sse_sum[sl][j] += cx_pkt->data.psnr.sse[j];
|
||||
}
|
||||
break;
|
||||
}
|
||||
case VPX_CODEC_STATS_PKT: {
|
||||
stats_write(&app_input.rc_stats, cx_pkt->data.twopass_stats.buf,
|
||||
cx_pkt->data.twopass_stats.sz);
|
||||
break;
|
||||
}
|
||||
default: { break; }
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_VP9_DECODER && !SIMULCAST_MODE
|
||||
vpx_codec_control(&encoder, VP9E_GET_SVC_LAYER_ID, &layer_id);
|
||||
// Don't look for mismatch on top spatial and top temporal layers as they
|
||||
// are non reference frames.
|
||||
if ((enc_cfg.ss_number_layers > 1 || enc_cfg.ts_number_layers > 1) &&
|
||||
!(layer_id.temporal_layer_id > 0 &&
|
||||
layer_id.temporal_layer_id == (int)enc_cfg.ts_number_layers - 1 &&
|
||||
cx_pkt->data.frame
|
||||
.spatial_layer_encoded[enc_cfg.ss_number_layers - 1])) {
|
||||
test_decode(&encoder, &decoder, frame_cnt, &mismatch_seen);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!end_of_stream) {
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
|
||||
static const char *exec_name;
|
||||
|
||||
void usage_exit() {
|
||||
void usage_exit(void) {
|
||||
fprintf(stderr,
|
||||
"Usage: %s <width> <height> <infile> <outfile> "
|
||||
"<frame> <limit(optional)>\n",
|
||||
|
||||
@@ -41,8 +41,8 @@
|
||||
$make -j32
|
||||
|
||||
* Build vp9 fuzzer
|
||||
$ $CXX $CXXFLAGS -std=gnu++11 -DDECODER=vp9 \
|
||||
-fsanitize=fuzzer -I../libvpx -I. -Wl,--start-group \
|
||||
$ $CXX $CXXFLAGS -std=gnu++17 -Wall -Wextra -Wimplicit-fallthrough \
|
||||
-DDECODER=vp9 -fsanitize=fuzzer -I../libvpx -I. -Wl,--start-group \
|
||||
../libvpx/examples/vpx_dec_fuzzer.cc -o ./vpx_dec_fuzzer_vp9 \
|
||||
./libvpx.a -Wl,--end-group
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
||||
#include "third_party/nalloc/nalloc.h"
|
||||
#include "vpx/vp8dx.h"
|
||||
#include "vpx/vpx_decoder.h"
|
||||
#include "vpx_ports/mem_ops.h"
|
||||
@@ -85,33 +86,64 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
if (size <= IVF_FILE_HDR_SZ) {
|
||||
return 0;
|
||||
}
|
||||
nalloc_init(nullptr);
|
||||
|
||||
vpx_codec_ctx_t codec;
|
||||
// Set thread count in the range [1, 64].
|
||||
const unsigned int threads = (data[IVF_FILE_HDR_SZ] & 0x3f) + 1;
|
||||
vpx_codec_dec_cfg_t cfg = { threads, 0, 0 };
|
||||
if (vpx_codec_dec_init(&codec, VPXD_INTERFACE(DECODER), &cfg, 0)) {
|
||||
vpx_codec_flags_t flags = 0;
|
||||
if ((data[IVF_FILE_HDR_SZ] & 0x40) != 0) {
|
||||
flags |= VPX_CODEC_USE_POSTPROC;
|
||||
}
|
||||
vpx_codec_err_t err =
|
||||
vpx_codec_dec_init(&codec, VPXD_INTERFACE(DECODER), &cfg, flags);
|
||||
if (err == VPX_CODEC_INCAPABLE) {
|
||||
// vpx_codec_dec_init may fail with VPX_CODEC_USE_POSTPROC
|
||||
// if the library is configured with --disable-postproc.
|
||||
flags = 0;
|
||||
if (vpx_codec_dec_init(&codec, VPXD_INTERFACE(DECODER), &cfg, flags)) {
|
||||
return 0;
|
||||
}
|
||||
} else if (err != 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
nalloc_start(data, size);
|
||||
|
||||
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);
|
||||
err = vpx_codec_control(&codec, VP9D_SET_LOOP_FILTER_OPT, enable);
|
||||
}
|
||||
|
||||
data += IVF_FILE_HDR_SZ;
|
||||
size -= IVF_FILE_HDR_SZ;
|
||||
|
||||
int frame_cnt = 0;
|
||||
while (size > IVF_FRAME_HDR_SZ) {
|
||||
size_t frame_size = mem_get_le32(data);
|
||||
size -= IVF_FRAME_HDR_SZ;
|
||||
data += IVF_FRAME_HDR_SZ;
|
||||
frame_size = std::min(size, frame_size);
|
||||
|
||||
const vpx_codec_err_t err =
|
||||
vpx_codec_decode(&codec, data, frame_size, nullptr, 0);
|
||||
vpx_codec_stream_info_t stream_info;
|
||||
stream_info.sz = sizeof(stream_info);
|
||||
err = vpx_codec_peek_stream_info(VPXD_INTERFACE(DECODER), data, size,
|
||||
&stream_info);
|
||||
|
||||
++frame_cnt;
|
||||
if (flags & VPX_CODEC_USE_POSTPROC) {
|
||||
if (frame_cnt % 16 == 4) {
|
||||
vp8_postproc_cfg_t pp = { 0, 0, 0 };
|
||||
if (vpx_codec_control(&codec, VP8_SET_POSTPROC, &pp)) goto fail;
|
||||
} else if (frame_cnt % 16 == 12) {
|
||||
vp8_postproc_cfg_t pp = { VP8_DEBLOCK | VP8_DEMACROBLOCK | VP8_MFQE, 4,
|
||||
0 };
|
||||
if (vpx_codec_control(&codec, VP8_SET_POSTPROC, &pp)) goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
err = vpx_codec_decode(&codec, data, frame_size, nullptr, 0);
|
||||
static_cast<void>(err);
|
||||
vpx_codec_iter_t iter = nullptr;
|
||||
vpx_image_t *img = nullptr;
|
||||
@@ -120,6 +152,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
data += frame_size;
|
||||
size -= frame_size;
|
||||
}
|
||||
fail:
|
||||
vpx_codec_destroy(&codec);
|
||||
nalloc_end();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,256 @@
|
||||
/*
|
||||
* Copyright (c) 2025 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Fuzzer for libvpx encoders
|
||||
* ==========================
|
||||
* Requirements
|
||||
* --------------
|
||||
* Requires Clang 6.0 or above as -fsanitize=fuzzer is used as a linker
|
||||
* option.
|
||||
|
||||
* Steps to build
|
||||
* --------------
|
||||
* Clone libvpx repository
|
||||
$git clone https://chromium.googlesource.com/webm/libvpx
|
||||
|
||||
* Create a directory in parallel to libvpx and change directory
|
||||
$mkdir vpx_enc_fuzzer
|
||||
$cd vpx_enc_fuzzer/
|
||||
|
||||
* Enable sanitizers (Supported: address integer memory thread undefined)
|
||||
$source ../libvpx/tools/set_analyzer_env.sh address
|
||||
|
||||
* Configure libvpx.
|
||||
* Note --size-limit and VPX_MAX_ALLOCABLE_MEMORY are defined to avoid
|
||||
* Out of memory errors when running generated fuzzer binary
|
||||
$../libvpx/configure --disable-unit-tests --size-limit=12288x12288 \
|
||||
--extra-cflags="-fsanitize=fuzzer-no-link \
|
||||
-DVPX_MAX_ALLOCABLE_MEMORY=1073741824" \
|
||||
--disable-webm-io --enable-debug --enable-vp8-encoder \
|
||||
--enable-vp9-encoder --disable-examples
|
||||
|
||||
* Build libvpx
|
||||
$make -j32
|
||||
|
||||
* Build vp9 fuzzer
|
||||
$ $CXX $CXXFLAGS -std=gnu++17 -Wall -Wextra -Wimplicit-fallthrough \
|
||||
-DENCODER=vp9 -fsanitize=fuzzer -I../libvpx -I. -Wl,--start-group \
|
||||
../libvpx/examples/vpx_enc_fuzzer.cc -o ./vpx_enc_fuzzer_vp9 \
|
||||
./libvpx.a -Wl,--end-group
|
||||
|
||||
* ENCODER should be defined as vp9 or vp8 to enable vp9/vp8
|
||||
*
|
||||
* create a corpus directory and copy some ivf files there.
|
||||
* Based on which codec (vp8/vp9) is being tested, it is recommended to
|
||||
* have corresponding ivf files in corpus directory
|
||||
* Empty corpus directory also is acceptable, though not recommended
|
||||
$mkdir CORPUS && cp some-files CORPUS
|
||||
|
||||
* Run fuzzing:
|
||||
$./vpx_enc_fuzzer_vp9 CORPUS
|
||||
|
||||
* References:
|
||||
* http://llvm.org/docs/LibFuzzer.html
|
||||
* https://github.com/google/oss-fuzz
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "vpx/vp8cx.h"
|
||||
#include "vpx/vpx_encoder.h"
|
||||
#include "vpx_ports/mem_ops.h"
|
||||
#include "third_party/nalloc/nalloc.h"
|
||||
|
||||
// fuzz header to have config options, before raw image data
|
||||
#define FUZZ_HDR_SZ 32
|
||||
|
||||
#define VPXC_INTERFACE(name) VPXC_INTERFACE_(name)
|
||||
#define VPXC_INTERFACE_(name) vpx_codec_##name##_cx()
|
||||
|
||||
extern "C" void usage_exit(void) { exit(EXIT_FAILURE); }
|
||||
|
||||
static int vpx_img_plane_width(const vpx_image_t *img, int plane) {
|
||||
if (plane > 0 && img->x_chroma_shift > 0)
|
||||
return (img->d_w + 1) >> img->x_chroma_shift;
|
||||
else
|
||||
return img->d_w;
|
||||
}
|
||||
|
||||
static int vpx_img_plane_height(const vpx_image_t *img, int plane) {
|
||||
if (plane > 0 && img->y_chroma_shift > 0)
|
||||
return (img->d_h + 1) >> img->y_chroma_shift;
|
||||
else
|
||||
return img->d_h;
|
||||
}
|
||||
|
||||
static int fuzz_vpx_img_read(vpx_image_t *img, const uint8_t *data,
|
||||
size_t size) {
|
||||
int plane;
|
||||
// TODO: wtc - Need to clamp the sample values so that they are in range
|
||||
// For example, if the bit depth is 10, the sample values must be <= 1023.
|
||||
assert(img->bit_depth == 8);
|
||||
const size_t bytespp = (img->fmt & VPX_IMG_FMT_HIGHBITDEPTH) ? 2 : 1;
|
||||
|
||||
if (size == 0) return 0;
|
||||
size_t used = 0;
|
||||
for (plane = 0; plane < 3; ++plane) {
|
||||
unsigned char *buf = img->planes[plane];
|
||||
const int stride = img->stride[plane];
|
||||
int w = vpx_img_plane_width(img, plane);
|
||||
const int h = vpx_img_plane_height(img, plane);
|
||||
int y;
|
||||
|
||||
// Assuming that for nv12 we read all chroma data at once
|
||||
if (img->fmt == VPX_IMG_FMT_NV12 && plane > 1) break;
|
||||
// NV12 UV plane is interleaved, so it has twice the width of a subsampled
|
||||
// plane.
|
||||
if (img->fmt == VPX_IMG_FMT_NV12 && plane == 1) w = w * 2;
|
||||
|
||||
for (y = 0; y < h; ++y) {
|
||||
size_t nb = bytespp * w;
|
||||
if (nb > size - used) {
|
||||
nb = size - used;
|
||||
}
|
||||
memcpy(buf, data, nb);
|
||||
memset(buf + nb, 0, bytespp * w - nb);
|
||||
buf += stride;
|
||||
data += nb;
|
||||
used += nb;
|
||||
}
|
||||
}
|
||||
|
||||
return used;
|
||||
}
|
||||
|
||||
static int encode_frame(vpx_codec_ctx_t *codec, vpx_image_t *img,
|
||||
int frame_index, int flags, FILE *out,
|
||||
vpx_enc_deadline_t quality) {
|
||||
int got_pkts = 0;
|
||||
vpx_codec_iter_t iter = nullptr;
|
||||
const vpx_codec_cx_pkt_t *pkt = nullptr;
|
||||
const vpx_codec_err_t res =
|
||||
vpx_codec_encode(codec, img, frame_index, 1, flags, quality);
|
||||
if (res != VPX_CODEC_OK) return 0;
|
||||
|
||||
while ((pkt = vpx_codec_get_cx_data(codec, &iter)) != nullptr) {
|
||||
got_pkts = 1;
|
||||
|
||||
if (pkt->kind == VPX_CODEC_CX_FRAME_PKT) {
|
||||
if (fwrite(pkt->data.frame.buf, 1, pkt->data.frame.sz, out) !=
|
||||
pkt->data.frame.sz)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return got_pkts;
|
||||
}
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
if (size <= FUZZ_HDR_SZ) {
|
||||
return 0;
|
||||
}
|
||||
nalloc_init(nullptr);
|
||||
|
||||
int keyframe_interval = 0;
|
||||
int frame_count = 0;
|
||||
vpx_codec_ctx_t codec;
|
||||
vpx_image_t raw;
|
||||
vpx_codec_enc_cfg_t cfg;
|
||||
vpx_enc_deadline_t quality = VPX_DL_GOOD_QUALITY;
|
||||
|
||||
if ((data[0] & 0x80) != 0) {
|
||||
keyframe_interval = 8;
|
||||
}
|
||||
if ((data[0] & 0x40) != 0) {
|
||||
quality = VPX_DL_REALTIME;
|
||||
} else if ((data[0] & 0x20) != 0) {
|
||||
quality = VPX_DL_BEST_QUALITY;
|
||||
}
|
||||
const int max_frames = (quality == VPX_DL_BEST_QUALITY) ? 150 : 300;
|
||||
|
||||
if (vpx_codec_enc_config_default(VPXC_INTERFACE(ENCODER), &cfg, 0)) abort();
|
||||
FILE *out = fopen("/dev/null", "wb");
|
||||
|
||||
switch (data[0] & 0x1F) {
|
||||
case 0:
|
||||
cfg.g_w = 64;
|
||||
cfg.g_h = 1;
|
||||
break;
|
||||
case 1:
|
||||
cfg.g_w = 1;
|
||||
cfg.g_h = 48;
|
||||
break;
|
||||
case 2:
|
||||
cfg.g_w = 1;
|
||||
cfg.g_h = 1;
|
||||
break;
|
||||
case 3:
|
||||
cfg.g_w = 4;
|
||||
cfg.g_h = 4;
|
||||
break;
|
||||
case 4:
|
||||
cfg.g_w = 16;
|
||||
cfg.g_h = 16;
|
||||
break;
|
||||
default:
|
||||
cfg.g_w = 64;
|
||||
cfg.g_h = 48;
|
||||
break;
|
||||
}
|
||||
cfg.g_timebase.num = 1;
|
||||
cfg.g_timebase.den = 30; // fps
|
||||
cfg.rc_target_bitrate = 200;
|
||||
cfg.g_error_resilient = 1;
|
||||
|
||||
if (vpx_codec_enc_init(&codec, VPXC_INTERFACE(ENCODER), &cfg, 0)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!vpx_img_alloc(&raw, VPX_IMG_FMT_I420, cfg.g_w, cfg.g_h, 1)) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
nalloc_start(data, size);
|
||||
// We may want to add more config options (for more complex encoders as seen
|
||||
// in the examples) in the future while still maintaining the same format (so
|
||||
// that generated corpus is still valid). So we reserve FUZZ_HDR_SZ=32 bytes
|
||||
// for this even if we just use one byte so far.
|
||||
data += FUZZ_HDR_SZ;
|
||||
size -= FUZZ_HDR_SZ;
|
||||
|
||||
// Encode frames.
|
||||
for (int i = 0; i < max_frames; ++i) {
|
||||
int flags = 0;
|
||||
size_t size_read = fuzz_vpx_img_read(&raw, data, size);
|
||||
if (size_read == 0) break;
|
||||
data += size_read;
|
||||
size -= size_read;
|
||||
if (keyframe_interval > 0 && frame_count % keyframe_interval == 0)
|
||||
flags |= VPX_EFLAG_FORCE_KF;
|
||||
encode_frame(&codec, &raw, frame_count++, flags, out, quality);
|
||||
}
|
||||
|
||||
// Flush encoder.
|
||||
while (encode_frame(&codec, nullptr, -1, 0, out, quality)) {
|
||||
}
|
||||
|
||||
fail:
|
||||
nalloc_end();
|
||||
vpx_img_free(&raw);
|
||||
vpx_codec_destroy(&codec);
|
||||
fclose(out);
|
||||
return 0;
|
||||
}
|
||||
@@ -32,8 +32,6 @@
|
||||
|
||||
#define zero(Dest) memset(&(Dest), 0, sizeof(Dest))
|
||||
|
||||
static const char *exec_name;
|
||||
|
||||
void usage_exit(void) { exit(EXIT_FAILURE); }
|
||||
|
||||
// Denoiser states for vp8, for temporal denoising.
|
||||
@@ -607,19 +605,24 @@ static void set_temporal_layer_pattern(int layering_mode,
|
||||
}
|
||||
|
||||
#if ROI_MAP
|
||||
static void read_mask(FILE *mask_file, int *seg_map) {
|
||||
static int read_mask(FILE *mask_file, int *seg_map, int allowed_mask_rows,
|
||||
int allowed_mask_cols) {
|
||||
int mask_rows, mask_cols, i, j;
|
||||
int *map_start = seg_map;
|
||||
fscanf(mask_file, "%d %d\n", &mask_cols, &mask_rows);
|
||||
if (fscanf(mask_file, "%d %d\n", &mask_cols, &mask_rows) != 2) return 0;
|
||||
if (mask_rows != allowed_mask_rows || mask_cols != allowed_mask_cols) {
|
||||
return 0;
|
||||
}
|
||||
for (i = 0; i < mask_rows; i++) {
|
||||
for (j = 0; j < mask_cols; j++) {
|
||||
fscanf(mask_file, "%d ", &seg_map[j]);
|
||||
if (fscanf(mask_file, "%d ", &seg_map[j]) != 1) return 0;
|
||||
// reverse the bit
|
||||
seg_map[j] = 1 - seg_map[j];
|
||||
}
|
||||
seg_map += mask_cols;
|
||||
}
|
||||
seg_map = map_start;
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -679,7 +682,6 @@ int main(int argc, char **argv) {
|
||||
input_ctx.only_i420 = 1;
|
||||
input_ctx.bit_depth = 0;
|
||||
|
||||
exec_name = argv[0];
|
||||
// Check usage and arguments.
|
||||
if (argc < min_args) {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
@@ -965,12 +967,16 @@ int main(int argc, char **argv) {
|
||||
argv[argc - 1], frame_cnt);
|
||||
mask_file = fopen(mask_file_name, "r");
|
||||
if (mask_file != NULL) {
|
||||
read_mask(mask_file, mask_map);
|
||||
int mask_is_valid = read_mask(mask_file, mask_map, mask_rows, mask_cols);
|
||||
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");
|
||||
if (mask_is_valid) {
|
||||
// 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");
|
||||
} else {
|
||||
die_codec(&codec, "Mask input is invalid for ROI map");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
frame_avail = read_frame(&input_ctx, &raw);
|
||||
|
||||
@@ -654,12 +654,6 @@ VERBATIM_HEADERS = YES
|
||||
|
||||
ALPHABETICAL_INDEX = NO
|
||||
|
||||
# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
|
||||
# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
|
||||
# in which this list will be split (can be a number in the range [1..20])
|
||||
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
|
||||
# In case all classes in a project start with a common prefix, all
|
||||
# classes will be put under the same header in the alphabetical index.
|
||||
# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
|
||||
@@ -1099,32 +1093,10 @@ ALLEXTERNALS = NO
|
||||
|
||||
EXTERNAL_GROUPS = YES
|
||||
|
||||
# The PERL_PATH should be the absolute path and name of the perl script
|
||||
# interpreter (i.e. the result of `which perl').
|
||||
|
||||
PERL_PATH = /usr/bin/perl
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
|
||||
# generate a inheritance diagram (in HTML, RTF and la_te_x) for classes with base
|
||||
# or super classes. Setting the tag to NO turns the diagrams off. Note that
|
||||
# this option is superseded by the HAVE_DOT option below. This is only a
|
||||
# fallback. It is recommended to install and use dot, since it yields more
|
||||
# powerful graphs.
|
||||
|
||||
CLASS_DIAGRAMS = YES
|
||||
|
||||
# You can define message sequence charts within doxygen comments using the \msc
|
||||
# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to
|
||||
# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to
|
||||
# specify the directory where the mscgen tool resides. If left empty the tool is assumed to
|
||||
# be found in the default search path.
|
||||
|
||||
MSCGEN_PATH =
|
||||
|
||||
# If set to YES, the inheritance and collaboration graphs will hide
|
||||
# inheritance and usage relations if the target is undocumented
|
||||
# or is not a class.
|
||||
@@ -1138,10 +1110,14 @@ HIDE_UNDOC_RELATIONS = YES
|
||||
|
||||
HAVE_DOT = NO
|
||||
|
||||
# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
|
||||
# will generate a graph for each documented class showing the direct and
|
||||
# indirect inheritance relations. Setting this tag to YES will force the
|
||||
# the CLASS_DIAGRAMS tag to NO.
|
||||
# If the CLASS_GRAPH tag is set to YES (or GRAPH) then doxygen will generate a
|
||||
# graph for each documented class showing the direct and indirect inheritance
|
||||
# relations. In case HAVE_DOT is set as well dot will be used to draw the graph,
|
||||
# otherwise the built-in generator will be used. If the CLASS_GRAPH tag is set
|
||||
# to TEXT the direct and indirect inheritance relations will be shown as texts /
|
||||
# links.
|
||||
# Possible values are: NO, YES, TEXT and GRAPH.
|
||||
# The default value is: YES.
|
||||
|
||||
CLASS_GRAPH = YES
|
||||
|
||||
@@ -1247,14 +1223,6 @@ DOT_GRAPH_MAX_NODES = 50
|
||||
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
|
||||
# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
|
||||
# background. This is disabled by default, which results in a white background.
|
||||
# Warning: Depending on the platform used, enabling this option may lead to
|
||||
# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
|
||||
# read).
|
||||
|
||||
DOT_TRANSPARENT = YES
|
||||
|
||||
# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
|
||||
# files in one run (i.e. multiple -o and -T options on the command line). This
|
||||
# makes dot run faster, but since only newer versions of dot (>1.8.10)
|
||||
|
||||
+24
-48
@@ -178,26 +178,21 @@ INSTALL-LIBS-yes += include/vpx/vpx_image.h
|
||||
INSTALL-LIBS-yes += include/vpx/vpx_integer.h
|
||||
INSTALL-LIBS-$(CONFIG_DECODERS) += include/vpx/vpx_decoder.h
|
||||
INSTALL-LIBS-$(CONFIG_ENCODERS) += include/vpx/vpx_encoder.h
|
||||
INSTALL-LIBS-$(CONFIG_ENCODERS) += include/vpx/vpx_tpl.h
|
||||
ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
|
||||
ifeq ($(CONFIG_MSVS),yes)
|
||||
INSTALL-LIBS-yes += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/$(CODEC_LIB).lib)
|
||||
ifeq ($(CONFIG_STATIC),yes)
|
||||
INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/$(CODEC_LIB)d.lib)
|
||||
endif
|
||||
INSTALL-LIBS-$(CONFIG_SHARED) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/vpx.dll)
|
||||
INSTALL-LIBS-$(CONFIG_SHARED) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/vpx.exp)
|
||||
endif
|
||||
else
|
||||
INSTALL-LIBS-$(CONFIG_STATIC) += $(LIBSUBDIR)/libvpx.a
|
||||
ifeq ($(CONFIG_STATIC),yes)
|
||||
INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(LIBSUBDIR)/libvpx_g.a
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_VP9_ENCODER)$(CONFIG_RATE_CTRL),yesyes)
|
||||
SIMPLE_ENCODE_SRCS := $(call enabled,CODEC_SRCS)
|
||||
SIMPLE_ENCODE_SRCS += $(VP9_PREFIX)simple_encode.cc
|
||||
SIMPLE_ENCODE_SRCS += $(VP9_PREFIX)simple_encode.h
|
||||
SIMPLE_ENCODE_SRCS += ivfenc.h
|
||||
SIMPLE_ENCODE_SRCS += ivfenc.c
|
||||
INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(VP9_PREFIX)simple_encode.cc
|
||||
INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(VP9_PREFIX)simple_encode.h
|
||||
endif
|
||||
|
||||
CODEC_SRCS=$(call enabled,CODEC_SRCS)
|
||||
@@ -213,6 +208,11 @@ libvpx_srcs.txt:
|
||||
@echo $(CODEC_SRCS) | xargs -n1 echo | LC_ALL=C sort -u > $@
|
||||
CLEAN-OBJS += libvpx_srcs.txt
|
||||
|
||||
libvpxrc_srcs.txt:
|
||||
@echo " [CREATE] $@"
|
||||
@echo $(RC_RTC_SRCS) | xargs -n1 echo | LC_ALL=C sort -u > $@
|
||||
CLEAN-OBJS += libvpxrc_srcs.txt
|
||||
|
||||
# Assembly files that are included, but don't define symbols themselves.
|
||||
# Filtered out to avoid Windows build warnings.
|
||||
ASM_INCLUDES := \
|
||||
@@ -312,7 +312,7 @@ $(BUILD_PFX)libvpx_g.a: $(LIBVPX_OBJS)
|
||||
# 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_MAJOR := 12
|
||||
SO_VERSION_MINOR := 1
|
||||
SO_VERSION_PATCH := 0
|
||||
ifeq ($(filter darwin%,$(TGT_OS)),$(TGT_OS))
|
||||
@@ -418,13 +418,6 @@ ifeq ($(CONFIG_ENCODERS),yes)
|
||||
$(BUILD_PFX)libvpxrc_g.a: $(RC_RTC_OBJS)
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_VP9_ENCODER)$(CONFIG_RATE_CTRL),yesyes)
|
||||
SIMPLE_ENCODE_OBJS=$(call objs,$(SIMPLE_ENCODE_SRCS))
|
||||
OBJS-yes += $(SIMPLE_ENCODE_OBJS)
|
||||
LIBS-yes += $(BUILD_PFX)libsimple_encode.a $(BUILD_PFX)libsimple_encode_g.a
|
||||
$(BUILD_PFX)libsimple_encode_g.a: $(SIMPLE_ENCODE_OBJS)
|
||||
endif
|
||||
|
||||
endif # ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
|
||||
|
||||
libvpx.ver: $(call enabled,CODEC_EXPORTS)
|
||||
@@ -446,13 +439,13 @@ ifeq ($(VPX_ARCH_X86)$(VPX_ARCH_X86_64),yes)
|
||||
# YASM
|
||||
$(BUILD_PFX)vpx_config.asm: $(BUILD_PFX)vpx_config.h
|
||||
@echo " [CREATE] $@"
|
||||
@LC_ALL=C egrep "#define [A-Z0-9_]+ [01]" $< \
|
||||
@LC_ALL=C grep -E "#define [A-Z0-9_]+ [01]" $< \
|
||||
| awk '{print $$2 " equ " $$3}' > $@
|
||||
else
|
||||
ADS2GAS=$(if $(filter yes,$(CONFIG_GCC)),| $(ASM_CONVERSION))
|
||||
$(BUILD_PFX)vpx_config.asm: $(BUILD_PFX)vpx_config.h
|
||||
@echo " [CREATE] $@"
|
||||
@LC_ALL=C egrep "#define [A-Z0-9_]+ [01]" $< \
|
||||
@LC_ALL=C grep -E "#define [A-Z0-9_]+ [01]" $< \
|
||||
| awk '{print $$2 " EQU " $$3}' $(ADS2GAS) > $@
|
||||
@echo " END" $(ADS2GAS) >> $@
|
||||
CLEAN-OBJS += $(BUILD_PFX)vpx_config.asm
|
||||
@@ -512,11 +505,6 @@ RC_INTERFACE_TEST_SRCS=$(call addprefix_clean,test/,\
|
||||
RC_INTERFACE_TEST_OBJS := $(sort $(call objs,$(RC_INTERFACE_TEST_SRCS)))
|
||||
endif
|
||||
|
||||
SIMPLE_ENCODE_TEST_BIN=./test_simple_encode$(EXE_SFX)
|
||||
SIMPLE_ENCODE_TEST_SRCS=$(call addprefix_clean,test/,\
|
||||
$(call enabled,SIMPLE_ENCODE_TEST_SRCS))
|
||||
SIMPLE_ENCODE_TEST_OBJS := $(sort $(call objs,$(SIMPLE_ENCODE_TEST_SRCS)))
|
||||
|
||||
libvpx_test_srcs.txt:
|
||||
@echo " [CREATE] $@"
|
||||
@echo $(LIBVPX_TEST_SRCS) | xargs -n1 echo | LC_ALL=C sort -u > $@
|
||||
@@ -536,7 +524,7 @@ $(LIBVPX_TEST_DATA): $(SRC_PATH_BARE)/test/test-data.sha1
|
||||
esac \
|
||||
)
|
||||
|
||||
testdata:: $(LIBVPX_TEST_DATA)
|
||||
testdata: $(LIBVPX_TEST_DATA)
|
||||
$(qexec)[ -x "$$(which sha1sum)" ] && sha1sum=sha1sum;\
|
||||
[ -x "$$(which shasum)" ] && sha1sum=shasum;\
|
||||
[ -x "$$(which sha1)" ] && sha1sum=sha1;\
|
||||
@@ -545,7 +533,7 @@ testdata:: $(LIBVPX_TEST_DATA)
|
||||
echo "Checking test data:";\
|
||||
for f in $(call enabled,LIBVPX_TEST_DATA); do\
|
||||
grep $$f $(SRC_PATH_BARE)/test/test-data.sha1 |\
|
||||
(cd $(LIBVPX_TEST_DATA_PATH); $${sha1sum} -c);\
|
||||
(cd "$(LIBVPX_TEST_DATA_PATH)"; $${sha1sum} -c);\
|
||||
done; \
|
||||
else\
|
||||
echo "Skipping test data integrity check, sha1sum not found.";\
|
||||
@@ -631,8 +619,8 @@ test_rc_interface.$(VCPROJ_SFX): $(RC_INTERFACE_TEST_SRCS) vpx.$(VCPROJ_SFX) \
|
||||
-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 # CONFIG_ENCODERS
|
||||
endif # CONFIG_MSVS
|
||||
else
|
||||
|
||||
include $(SRC_PATH_BARE)/third_party/googletest/gtest.mk
|
||||
@@ -687,19 +675,7 @@ $(eval $(call linkerxx_template,$(RC_INTERFACE_TEST_BIN), \
|
||||
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_EXTERNAL_BUILD
|
||||
|
||||
# Install test sources only if codec source is included
|
||||
INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(patsubst $(SRC_PATH_BARE)/%,%,\
|
||||
@@ -709,22 +685,22 @@ INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(TEST_INTRA_PRED_SPEED_SRCS)
|
||||
INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(RC_INTERFACE_TEST_SRCS)
|
||||
|
||||
define test_shard_template
|
||||
test:: test_shard.$(1)
|
||||
test-no-data-check:: test_shard_ndc.$(1)
|
||||
test: test_shard.$(1)
|
||||
test-no-data-check: test_shard_ndc.$(1)
|
||||
test_shard.$(1) test_shard_ndc.$(1): $(LIBVPX_TEST_BIN)
|
||||
@set -e; \
|
||||
export GTEST_SHARD_INDEX=$(1); \
|
||||
export GTEST_TOTAL_SHARDS=$(2); \
|
||||
$(LIBVPX_TEST_BIN)
|
||||
test_shard.$(1): testdata
|
||||
.PHONY: test_shard.$(1)
|
||||
.PHONY: test_shard.$(1) test_shard_ndc.$(1)
|
||||
endef
|
||||
|
||||
NUM_SHARDS := 10
|
||||
SHARDS := 0 1 2 3 4 5 6 7 8 9
|
||||
$(foreach s,$(SHARDS),$(eval $(call test_shard_template,$(s),$(NUM_SHARDS))))
|
||||
|
||||
endif
|
||||
endif # CONFIG_UNIT_TESTS
|
||||
|
||||
##
|
||||
## documentation directives
|
||||
@@ -764,10 +740,10 @@ TEST_BIN_PATH := $(addsuffix /$(TGT_OS:win64=x64)/Release, $(TEST_BIN_PATH))
|
||||
endif
|
||||
utiltest utiltest-no-data-check:
|
||||
$(qexec)$(SRC_PATH_BARE)/test/vpxdec.sh \
|
||||
--test-data-path $(LIBVPX_TEST_DATA_PATH) \
|
||||
--test-data-path "$(LIBVPX_TEST_DATA_PATH)" \
|
||||
--bin-path $(TEST_BIN_PATH)
|
||||
$(qexec)$(SRC_PATH_BARE)/test/vpxenc.sh \
|
||||
--test-data-path $(LIBVPX_TEST_DATA_PATH) \
|
||||
--test-data-path "$(LIBVPX_TEST_DATA_PATH)" \
|
||||
--bin-path $(TEST_BIN_PATH)
|
||||
utiltest: testdata
|
||||
else
|
||||
@@ -791,7 +767,7 @@ EXAMPLES_BIN_PATH := $(TGT_OS:win64=x64)/Release
|
||||
endif
|
||||
exampletest exampletest-no-data-check: examples
|
||||
$(qexec)$(SRC_PATH_BARE)/test/examples.sh \
|
||||
--test-data-path $(LIBVPX_TEST_DATA_PATH) \
|
||||
--test-data-path "$(LIBVPX_TEST_DATA_PATH)" \
|
||||
--bin-path $(EXAMPLES_BIN_PATH)
|
||||
exampletest: testdata
|
||||
else
|
||||
|
||||
@@ -151,8 +151,8 @@ void MD5Final(md5byte digest[16], struct MD5Context *ctx) {
|
||||
* reflect the addition of 16 longwords of new data. MD5Update blocks
|
||||
* the data and converts bytes into longwords for this routine.
|
||||
*/
|
||||
VPX_NO_UNSIGNED_OVERFLOW_CHECK void MD5Transform(UWORD32 buf[4],
|
||||
UWORD32 const in[16]) {
|
||||
VPX_NO_UNSIGNED_OVERFLOW_CHECK VPX_NO_UNSIGNED_SHIFT_CHECK void MD5Transform(
|
||||
UWORD32 buf[4], UWORD32 const in[16]) {
|
||||
UWORD32 a, b, c, d;
|
||||
|
||||
a = buf[0];
|
||||
|
||||
@@ -9,10 +9,11 @@
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "./rate_hist.h"
|
||||
|
||||
@@ -48,7 +49,8 @@ struct rate_hist *init_rate_histogram(const vpx_codec_enc_cfg_t *cfg,
|
||||
// Determine the number of samples in the buffer. Use the file's framerate
|
||||
// to determine the number of frames in rc_buf_sz milliseconds, with an
|
||||
// adjustment (5/4) to account for alt-refs
|
||||
hist->samples = cfg->rc_buf_sz * 5 / 4 * fps->num / fps->den / 1000;
|
||||
hist->samples =
|
||||
(int)((int64_t)cfg->rc_buf_sz * 5 / 4 * fps->num / fps->den / 1000);
|
||||
|
||||
// prevent division by zero
|
||||
if (hist->samples == 0) hist->samples = 1;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "vpx/vpx_integer.h"
|
||||
|
||||
@@ -28,43 +28,45 @@ class ACMRandom {
|
||||
explicit ACMRandom(int seed) : random_(seed) {}
|
||||
|
||||
void Reset(int seed) { random_.Reseed(seed); }
|
||||
uint16_t Rand16(void) {
|
||||
uint16_t Rand16() {
|
||||
const uint32_t value =
|
||||
random_.Generate(testing::internal::Random::kMaxRange);
|
||||
return (value >> 15) & 0xffff;
|
||||
}
|
||||
|
||||
int32_t Rand20Signed(void) {
|
||||
int32_t Rand20Signed() {
|
||||
// Use 20 bits: values between 524287 and -524288.
|
||||
const uint32_t value = random_.Generate(1048576);
|
||||
return static_cast<int32_t>(value) - 524288;
|
||||
}
|
||||
|
||||
int16_t Rand16Signed(void) {
|
||||
int16_t Rand16Signed() {
|
||||
// Use 16 bits: values between 32767 and -32768.
|
||||
return static_cast<int16_t>(random_.Generate(65536));
|
||||
}
|
||||
|
||||
int16_t Rand13Signed(void) {
|
||||
// Use 13 bits: values between 4095 and -4096.
|
||||
const uint32_t value = random_.Generate(8192);
|
||||
return static_cast<int16_t>(value) - 4096;
|
||||
uint16_t Rand12() {
|
||||
const uint32_t value =
|
||||
random_.Generate(testing::internal::Random::kMaxRange);
|
||||
// There's a bit more entropy in the upper bits of this implementation.
|
||||
return (value >> 19) & 0xfff;
|
||||
}
|
||||
|
||||
int16_t Rand9Signed(void) {
|
||||
// Use 9 bits: values between 255 (0x0FF) and -256 (0x100).
|
||||
const uint32_t value = random_.Generate(512);
|
||||
return static_cast<int16_t>(value) - 256;
|
||||
uint16_t Rand10() {
|
||||
const uint32_t value =
|
||||
random_.Generate(testing::internal::Random::kMaxRange);
|
||||
// There's a bit more entropy in the upper bits of this implementation.
|
||||
return (value >> 21) & 0x3ff;
|
||||
}
|
||||
|
||||
uint8_t Rand8(void) {
|
||||
uint8_t Rand8() {
|
||||
const uint32_t value =
|
||||
random_.Generate(testing::internal::Random::kMaxRange);
|
||||
// There's a bit more entropy in the upper bits of this implementation.
|
||||
return (value >> 23) & 0xff;
|
||||
}
|
||||
|
||||
uint8_t Rand8Extremes(void) {
|
||||
uint8_t Rand8Extremes() {
|
||||
// Returns a random value near 0 or near 255, to better exercise
|
||||
// saturation behavior.
|
||||
const uint8_t r = Rand8();
|
||||
@@ -82,7 +84,7 @@ class ACMRandom {
|
||||
|
||||
int operator()(int n) { return PseudoUniform(n); }
|
||||
|
||||
static int DeterministicSeed(void) { return 0xbaba; }
|
||||
static int DeterministicSeed() { return 0xbaba; }
|
||||
|
||||
private:
|
||||
testing::internal::Random random_;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
#include <algorithm>
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/encode_test_driver.h"
|
||||
#include "test/util.h"
|
||||
@@ -62,16 +62,16 @@ class ActiveMapRefreshTest
|
||||
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
|
||||
protected:
|
||||
ActiveMapRefreshTest() : EncoderTest(GET_PARAM(0)) {}
|
||||
virtual ~ActiveMapRefreshTest() {}
|
||||
~ActiveMapRefreshTest() override = default;
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
InitializeConfig();
|
||||
SetMode(GET_PARAM(1));
|
||||
cpu_used_ = GET_PARAM(2);
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) {
|
||||
void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) override {
|
||||
::libvpx_test::Y4mVideoSource *y4m_video =
|
||||
static_cast<libvpx_test::Y4mVideoSource *>(video);
|
||||
if (video->frame() == 0) {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
#include <climits>
|
||||
#include <vector>
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/encode_test_driver.h"
|
||||
#include "test/i420_video_source.h"
|
||||
@@ -26,16 +26,16 @@ class ActiveMapTest
|
||||
static const int kHeight = 144;
|
||||
|
||||
ActiveMapTest() : EncoderTest(GET_PARAM(0)) {}
|
||||
virtual ~ActiveMapTest() {}
|
||||
~ActiveMapTest() override = default;
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
InitializeConfig();
|
||||
SetMode(GET_PARAM(1));
|
||||
cpu_used_ = GET_PARAM(2);
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) {
|
||||
void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) override {
|
||||
if (video->frame() == 0) {
|
||||
encoder->Control(VP8E_SET_CPUUSED, cpu_used_);
|
||||
encoder->Control(VP9E_SET_AQ_MODE, GET_PARAM(3));
|
||||
|
||||
@@ -8,14 +8,17 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
#include <math.h>
|
||||
|
||||
#include <memory>
|
||||
#include <tuple>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "test/clear_system_state.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "test/util.h"
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "./vpx_dsp_rtcd.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
#include "vpx_config.h"
|
||||
#include "vpx_dsp/postproc.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
|
||||
@@ -23,17 +26,17 @@ namespace {
|
||||
|
||||
static const int kNoiseSize = 3072;
|
||||
|
||||
typedef void (*AddNoiseFunc)(uint8_t *start, const int8_t *noise,
|
||||
int blackclamp, int whiteclamp, int width,
|
||||
int height, int pitch);
|
||||
using AddNoiseFunc = void (*)(uint8_t *start, const int8_t *noise,
|
||||
int blackclamp, int whiteclamp, int width,
|
||||
int height, int pitch);
|
||||
|
||||
typedef std::tuple<double, AddNoiseFunc> AddNoiseTestFPParam;
|
||||
using AddNoiseTestFPParam = std::tuple<double, AddNoiseFunc>;
|
||||
|
||||
class AddNoiseTest : public ::testing::Test,
|
||||
public ::testing::WithParamInterface<AddNoiseTestFPParam> {
|
||||
public:
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
virtual ~AddNoiseTest() {}
|
||||
void TearDown() override { libvpx_test::ClearSystemState(); }
|
||||
~AddNoiseTest() override = default;
|
||||
};
|
||||
|
||||
double stddev6(char a, char b, char c, char d, char e, char f) {
|
||||
@@ -97,33 +100,35 @@ TEST_P(AddNoiseTest, CheckNoiseAdded) {
|
||||
}
|
||||
|
||||
TEST_P(AddNoiseTest, CheckCvsAssembly) {
|
||||
const int width = 64;
|
||||
static constexpr int kWidths[] = { 8, 18, 34, 64, 66 };
|
||||
const int height = 64;
|
||||
const int image_size = width * height;
|
||||
int8_t noise[kNoiseSize];
|
||||
const int clamp = vpx_setup_noise(4.4, noise, kNoiseSize);
|
||||
|
||||
uint8_t *const s = reinterpret_cast<uint8_t *>(vpx_calloc(image_size, 1));
|
||||
uint8_t *const d = reinterpret_cast<uint8_t *>(vpx_calloc(image_size, 1));
|
||||
ASSERT_NE(s, nullptr);
|
||||
ASSERT_NE(d, nullptr);
|
||||
for (int width : kWidths) {
|
||||
const int image_size = width * height;
|
||||
std::unique_ptr<uint8_t[], decltype(&vpx_free)> s(
|
||||
reinterpret_cast<uint8_t *>(vpx_calloc(image_size, 1)), vpx_free);
|
||||
std::unique_ptr<uint8_t[], decltype(&vpx_free)> d(
|
||||
reinterpret_cast<uint8_t *>(vpx_calloc(image_size, 1)), vpx_free);
|
||||
ASSERT_NE(s, nullptr);
|
||||
ASSERT_NE(d, nullptr);
|
||||
|
||||
memset(s, 99, image_size);
|
||||
memset(d, 99, image_size);
|
||||
memset(s.get(), 99, image_size);
|
||||
memset(d.get(), 99, image_size);
|
||||
|
||||
srand(0);
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
GET_PARAM(1)(s, noise, clamp, clamp, width, height, width));
|
||||
srand(0);
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
vpx_plane_add_noise_c(d, noise, clamp, clamp, width, height, width));
|
||||
srand(0);
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
GET_PARAM(1)(s.get(), noise, clamp, clamp, width, height, width));
|
||||
srand(0);
|
||||
ASM_REGISTER_STATE_CHECK(vpx_plane_add_noise_c(d.get(), noise, clamp, clamp,
|
||||
width, height, width));
|
||||
|
||||
for (int i = 0; i < image_size; ++i) {
|
||||
EXPECT_EQ(static_cast<int>(s[i]), static_cast<int>(d[i])) << "i = " << i;
|
||||
for (int i = 0; i < image_size; ++i) {
|
||||
EXPECT_EQ(static_cast<int>(s[i]), static_cast<int>(d[i]))
|
||||
<< "width = " << width << ", idx = " << i;
|
||||
}
|
||||
}
|
||||
|
||||
vpx_free(d);
|
||||
vpx_free(s);
|
||||
}
|
||||
|
||||
using std::make_tuple;
|
||||
@@ -133,7 +138,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
::testing::Values(make_tuple(3.25, vpx_plane_add_noise_c),
|
||||
make_tuple(4.4, vpx_plane_add_noise_c)));
|
||||
|
||||
#if HAVE_SSE2
|
||||
#if HAVE_SSE2 && HAVE_X86_ASM
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
SSE2, AddNoiseTest,
|
||||
::testing::Values(make_tuple(3.25, vpx_plane_add_noise_sse2),
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/encode_test_driver.h"
|
||||
#include "test/i420_video_source.h"
|
||||
@@ -20,9 +20,9 @@ class AltRefAqSegmentTest
|
||||
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
|
||||
protected:
|
||||
AltRefAqSegmentTest() : EncoderTest(GET_PARAM(0)) {}
|
||||
virtual ~AltRefAqSegmentTest() {}
|
||||
~AltRefAqSegmentTest() override = default;
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
InitializeConfig();
|
||||
SetMode(GET_PARAM(1));
|
||||
set_cpu_used_ = GET_PARAM(2);
|
||||
@@ -30,8 +30,8 @@ class AltRefAqSegmentTest
|
||||
alt_ref_aq_mode_ = 0;
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) {
|
||||
void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) override {
|
||||
if (video->frame() == 0) {
|
||||
encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);
|
||||
encoder->Control(VP9E_SET_ALT_REF_AQ, alt_ref_aq_mode_);
|
||||
|
||||
@@ -7,11 +7,12 @@
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/encode_test_driver.h"
|
||||
#include "test/i420_video_source.h"
|
||||
#include "test/util.h"
|
||||
#include "vpx_config.h"
|
||||
namespace {
|
||||
|
||||
#if CONFIG_VP8_ENCODER
|
||||
@@ -24,24 +25,24 @@ class AltRefTest : public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<int> {
|
||||
protected:
|
||||
AltRefTest() : EncoderTest(GET_PARAM(0)), altref_count_(0) {}
|
||||
virtual ~AltRefTest() {}
|
||||
~AltRefTest() override = default;
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
InitializeConfig();
|
||||
SetMode(libvpx_test::kTwoPassGood);
|
||||
}
|
||||
|
||||
virtual void BeginPassHook(unsigned int /*pass*/) { altref_count_ = 0; }
|
||||
void BeginPassHook(unsigned int /*pass*/) override { altref_count_ = 0; }
|
||||
|
||||
virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
|
||||
libvpx_test::Encoder *encoder) {
|
||||
void PreEncodeFrameHook(libvpx_test::VideoSource *video,
|
||||
libvpx_test::Encoder *encoder) override {
|
||||
if (video->frame() == 0) {
|
||||
encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1);
|
||||
encoder->Control(VP8E_SET_CPUUSED, 3);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
|
||||
if (pkt->data.frame.flags & VPX_FRAME_IS_INVISIBLE) ++altref_count_;
|
||||
}
|
||||
|
||||
@@ -75,17 +76,17 @@ class AltRefForcedKeyTestLarge
|
||||
AltRefForcedKeyTestLarge()
|
||||
: EncoderTest(GET_PARAM(0)), encoding_mode_(GET_PARAM(1)),
|
||||
cpu_used_(GET_PARAM(2)), forced_kf_frame_num_(1), frame_num_(0) {}
|
||||
virtual ~AltRefForcedKeyTestLarge() {}
|
||||
~AltRefForcedKeyTestLarge() override = default;
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
InitializeConfig();
|
||||
SetMode(encoding_mode_);
|
||||
cfg_.rc_end_usage = VPX_VBR;
|
||||
cfg_.g_threads = 0;
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) {
|
||||
void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) override {
|
||||
if (video->frame() == 0) {
|
||||
encoder->Control(VP8E_SET_CPUUSED, cpu_used_);
|
||||
encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1);
|
||||
@@ -100,7 +101,7 @@ class AltRefForcedKeyTestLarge
|
||||
(video->frame() == forced_kf_frame_num_) ? VPX_EFLAG_FORCE_KF : 0;
|
||||
}
|
||||
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
|
||||
if (frame_num_ == forced_kf_frame_num_) {
|
||||
ASSERT_TRUE(!!(pkt->data.frame.flags & VPX_FRAME_IS_KEY))
|
||||
<< "Frame #" << frame_num_ << " isn't a keyframe!";
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
# The test app itself runs on the command line through adb shell
|
||||
# The paths are really messed up as the libvpx make file
|
||||
# expects to be made from a parent directory.
|
||||
|
||||
# Ignore this file during non-NDK builds.
|
||||
ifdef NDK_ROOT
|
||||
CUR_WD := $(call my-dir)
|
||||
BINDINGS_DIR := $(CUR_WD)/../../..
|
||||
LOCAL_PATH := $(CUR_WD)/../../..
|
||||
@@ -28,6 +31,7 @@ LOCAL_PATH := $(CUR_WD)/../..
|
||||
#libgtest
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_ARM_MODE := arm
|
||||
LOCAL_CPPFLAGS := -std=c++17
|
||||
LOCAL_CPP_EXTENSION := .cc
|
||||
LOCAL_MODULE := gtest
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/third_party/googletest/src/
|
||||
@@ -42,6 +46,7 @@ include $(BUILD_STATIC_LIBRARY)
|
||||
#libvpx_test
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_ARM_MODE := arm
|
||||
LOCAL_CPPFLAGS := -std=c++17
|
||||
LOCAL_MODULE := libvpx_test
|
||||
LOCAL_STATIC_LIBRARIES := gtest libwebm
|
||||
|
||||
@@ -61,3 +66,4 @@ LOCAL_SRC_FILES := $(addprefix ./test/, $(FILTERED_SRC))
|
||||
# some test files depend on *_rtcd.h, ensure they're generated first.
|
||||
$(eval $(call rtcd_dep_template))
|
||||
include $(BUILD_EXECUTABLE)
|
||||
endif # NDK_ROOT
|
||||
@@ -38,7 +38,7 @@ def get_file_sha(filename):
|
||||
buf = file.read(HASH_CHUNK)
|
||||
return sha_hash.hexdigest()
|
||||
except IOError:
|
||||
print "Error reading " + filename
|
||||
print("Error reading " + filename)
|
||||
|
||||
# Downloads a file from a url, and then checks the sha against the passed
|
||||
# in sha
|
||||
@@ -67,7 +67,7 @@ try:
|
||||
getopt.getopt(sys.argv[1:], \
|
||||
"u:i:o:", ["url=", "input_csv=", "output_dir="])
|
||||
except:
|
||||
print 'get_files.py -u <url> -i <input_csv> -o <output_dir>'
|
||||
print('get_files.py -u <url> -i <input_csv> -o <output_dir>')
|
||||
sys.exit(2)
|
||||
|
||||
for opt, arg in opts:
|
||||
@@ -79,7 +79,7 @@ for opt, arg in opts:
|
||||
local_resource_path = os.path.join(arg)
|
||||
|
||||
if len(sys.argv) != 7:
|
||||
print "Expects two paths and a url!"
|
||||
print("Expects two paths and a url!")
|
||||
exit(1)
|
||||
|
||||
if not os.path.isdir(local_resource_path):
|
||||
@@ -89,7 +89,7 @@ file_list_csv = open(file_list_path, "rb")
|
||||
|
||||
# Our 'csv' file uses multiple spaces as a delimiter, python's
|
||||
# csv class only uses single character delimiters, so we convert them below
|
||||
file_list_reader = csv.reader((re.sub(' +', ' ', line) \
|
||||
file_list_reader = csv.reader((re.sub(' +', ' ', line.decode('utf-8')) \
|
||||
for line in file_list_csv), delimiter = ' ')
|
||||
|
||||
file_shas = []
|
||||
@@ -104,15 +104,16 @@ for row in file_list_reader:
|
||||
file_list_csv.close()
|
||||
|
||||
# Download files, only if they don't already exist and have correct shas
|
||||
for filename, sha in itertools.izip(file_names, file_shas):
|
||||
for filename, sha in zip(file_names, file_shas):
|
||||
filename = filename.lstrip('*')
|
||||
path = os.path.join(local_resource_path, filename)
|
||||
if os.path.isfile(path) \
|
||||
and get_file_sha(path) == sha:
|
||||
print path + ' exists, skipping'
|
||||
print(path + ' exists, skipping')
|
||||
continue
|
||||
for retry in range(0, ftp_retries):
|
||||
print "Downloading " + path
|
||||
print("Downloading " + path)
|
||||
if not download_and_check_sha(url, filename, sha):
|
||||
print "Sha does not match, retrying..."
|
||||
print("Sha does not match, retrying...")
|
||||
else:
|
||||
break
|
||||
@@ -7,7 +7,7 @@
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/encode_test_driver.h"
|
||||
#include "test/i420_video_source.h"
|
||||
@@ -20,17 +20,17 @@ class AqSegmentTest
|
||||
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
|
||||
protected:
|
||||
AqSegmentTest() : EncoderTest(GET_PARAM(0)) {}
|
||||
virtual ~AqSegmentTest() {}
|
||||
~AqSegmentTest() override = default;
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
InitializeConfig();
|
||||
SetMode(GET_PARAM(1));
|
||||
set_cpu_used_ = GET_PARAM(2);
|
||||
aq_mode_ = 0;
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) {
|
||||
void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) override {
|
||||
if (video->frame() == 0) {
|
||||
encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);
|
||||
encoder->Control(VP9E_SET_AQ_MODE, aq_mode_);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <string.h>
|
||||
#include <tuple>
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "./vp9_rtcd.h"
|
||||
#include "./vpx_config.h"
|
||||
@@ -38,7 +38,7 @@ class AverageTestBase : public ::testing::Test {
|
||||
: width_(width), height_(height), source_data_(nullptr),
|
||||
source_stride_(0), bit_depth_(8) {}
|
||||
|
||||
virtual void TearDown() {
|
||||
void TearDown() override {
|
||||
vpx_free(source_data_);
|
||||
source_data_ = nullptr;
|
||||
libvpx_test::ClearSystemState();
|
||||
@@ -49,7 +49,7 @@ class AverageTestBase : public ::testing::Test {
|
||||
static const int kDataAlignment = 16;
|
||||
static const int kDataBlockSize = 64 * 128;
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
source_data_ = reinterpret_cast<Pixel *>(
|
||||
vpx_memalign(kDataAlignment, kDataBlockSize * sizeof(source_data_[0])));
|
||||
ASSERT_NE(source_data_, nullptr);
|
||||
@@ -94,9 +94,9 @@ class AverageTestBase : public ::testing::Test {
|
||||
|
||||
ACMRandom rnd_;
|
||||
};
|
||||
typedef unsigned int (*AverageFunction)(const uint8_t *s, int pitch);
|
||||
using AverageFunction = unsigned int (*)(const uint8_t *s, int pitch);
|
||||
|
||||
typedef std::tuple<int, int, int, int, AverageFunction> AvgFunc;
|
||||
using AvgFunc = std::tuple<int, int, int, int, AverageFunction>;
|
||||
|
||||
class AverageTest : public AverageTestBase<uint8_t>,
|
||||
public ::testing::WithParamInterface<AvgFunc> {
|
||||
@@ -153,10 +153,10 @@ class AverageTestHBD : public AverageTestBase<uint16_t>,
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
|
||||
#if HAVE_NEON || HAVE_SSE2 || HAVE_MSA
|
||||
typedef void (*IntProRowFunc)(int16_t hbuf[16], uint8_t const *ref,
|
||||
const int ref_stride, const int height);
|
||||
using IntProRowFunc = void (*)(int16_t hbuf[16], uint8_t const *ref,
|
||||
const int ref_stride, const int height);
|
||||
|
||||
typedef std::tuple<int, IntProRowFunc, IntProRowFunc> IntProRowParam;
|
||||
using IntProRowParam = std::tuple<int, IntProRowFunc, IntProRowFunc>;
|
||||
|
||||
class IntProRowTest : public AverageTestBase<uint8_t>,
|
||||
public ::testing::WithParamInterface<IntProRowParam> {
|
||||
@@ -169,7 +169,7 @@ class IntProRowTest : public AverageTestBase<uint8_t>,
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
source_data_ = reinterpret_cast<uint8_t *>(
|
||||
vpx_memalign(kDataAlignment, kDataBlockSize * sizeof(source_data_[0])));
|
||||
ASSERT_NE(source_data_, nullptr);
|
||||
@@ -180,7 +180,7 @@ class IntProRowTest : public AverageTestBase<uint8_t>,
|
||||
vpx_memalign(kDataAlignment, sizeof(*hbuf_c_) * 16));
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
void TearDown() override {
|
||||
vpx_free(source_data_);
|
||||
source_data_ = nullptr;
|
||||
vpx_free(hbuf_c_);
|
||||
@@ -190,8 +190,9 @@ class IntProRowTest : public AverageTestBase<uint8_t>,
|
||||
}
|
||||
|
||||
void RunComparison() {
|
||||
ASM_REGISTER_STATE_CHECK(c_func_(hbuf_c_, source_data_, 0, height_));
|
||||
ASM_REGISTER_STATE_CHECK(asm_func_(hbuf_asm_, source_data_, 0, height_));
|
||||
ASM_REGISTER_STATE_CHECK(c_func_(hbuf_c_, source_data_, width_, height_));
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
asm_func_(hbuf_asm_, source_data_, width_, height_));
|
||||
EXPECT_EQ(0, memcmp(hbuf_c_, hbuf_asm_, sizeof(*hbuf_c_) * 16))
|
||||
<< "Output mismatch";
|
||||
}
|
||||
@@ -204,9 +205,9 @@ class IntProRowTest : public AverageTestBase<uint8_t>,
|
||||
};
|
||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(IntProRowTest);
|
||||
|
||||
typedef int16_t (*IntProColFunc)(uint8_t const *ref, const int width);
|
||||
using IntProColFunc = int16_t (*)(uint8_t const *ref, const int width);
|
||||
|
||||
typedef std::tuple<int, IntProColFunc, IntProColFunc> IntProColParam;
|
||||
using IntProColParam = std::tuple<int, IntProColFunc, IntProColFunc>;
|
||||
|
||||
class IntProColTest : public AverageTestBase<uint8_t>,
|
||||
public ::testing::WithParamInterface<IntProColParam> {
|
||||
@@ -232,13 +233,13 @@ class IntProColTest : public AverageTestBase<uint8_t>,
|
||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(IntProColTest);
|
||||
#endif // HAVE_NEON || HAVE_SSE2 || HAVE_MSA
|
||||
|
||||
typedef int (*SatdFunc)(const tran_low_t *coeffs, int length);
|
||||
typedef std::tuple<int, SatdFunc> SatdTestParam;
|
||||
using SatdFunc = int (*)(const tran_low_t *coeffs, int length);
|
||||
using SatdTestParam = std::tuple<int, SatdFunc>;
|
||||
|
||||
class SatdTest : public ::testing::Test,
|
||||
public ::testing::WithParamInterface<SatdTestParam> {
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
satd_size_ = GET_PARAM(0);
|
||||
satd_func_ = GET_PARAM(1);
|
||||
rnd_.Reset(ACMRandom::DeterministicSeed());
|
||||
@@ -247,7 +248,7 @@ class SatdTest : public ::testing::Test,
|
||||
ASSERT_NE(src_, nullptr);
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
void TearDown() override {
|
||||
libvpx_test::ClearSystemState();
|
||||
vpx_free(src_);
|
||||
}
|
||||
@@ -276,7 +277,7 @@ class SatdTest : public ::testing::Test,
|
||||
|
||||
class SatdLowbdTest : public SatdTest {
|
||||
protected:
|
||||
virtual void FillRandom() {
|
||||
void FillRandom() override {
|
||||
for (int i = 0; i < satd_size_; ++i) {
|
||||
const int16_t tmp = rnd_.Rand16Signed();
|
||||
src_[i] = (tran_low_t)tmp;
|
||||
@@ -284,15 +285,15 @@ class SatdLowbdTest : public SatdTest {
|
||||
}
|
||||
};
|
||||
|
||||
typedef int64_t (*BlockErrorFunc)(const tran_low_t *coeff,
|
||||
const tran_low_t *dqcoeff, int block_size);
|
||||
typedef std::tuple<int, BlockErrorFunc> BlockErrorTestFPParam;
|
||||
using BlockErrorFunc = int64_t (*)(const tran_low_t *coeff,
|
||||
const tran_low_t *dqcoeff, int block_size);
|
||||
using BlockErrorTestFPParam = std::tuple<int, BlockErrorFunc>;
|
||||
|
||||
class BlockErrorTestFP
|
||||
: public ::testing::Test,
|
||||
public ::testing::WithParamInterface<BlockErrorTestFPParam> {
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
txfm_size_ = GET_PARAM(0);
|
||||
block_error_func_ = GET_PARAM(1);
|
||||
rnd_.Reset(ACMRandom::DeterministicSeed());
|
||||
@@ -304,7 +305,7 @@ class BlockErrorTestFP
|
||||
ASSERT_NE(dqcoeff_, nullptr);
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
void TearDown() override {
|
||||
libvpx_test::ClearSystemState();
|
||||
vpx_free(coeff_);
|
||||
vpx_free(dqcoeff_);
|
||||
@@ -463,7 +464,7 @@ TEST_P(SatdLowbdTest, DISABLED_Speed) {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
class SatdHighbdTest : public SatdTest {
|
||||
protected:
|
||||
virtual void FillRandom() {
|
||||
void FillRandom() override {
|
||||
for (int i = 0; i < satd_size_; ++i) {
|
||||
src_[i] = rnd_.Rand20Signed();
|
||||
}
|
||||
@@ -582,6 +583,13 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
make_tuple(16, 16, 1, 4, &vpx_highbd_avg_4x4_sse2)));
|
||||
#endif // HAVE_SSE2
|
||||
|
||||
#if HAVE_NEON
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
NEON, AverageTestHBD,
|
||||
::testing::Values(make_tuple(16, 16, 1, 8, &vpx_highbd_avg_8x8_neon),
|
||||
make_tuple(16, 16, 1, 4, &vpx_highbd_avg_4x4_neon)));
|
||||
#endif // HAVE_NEON
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(C, SatdHighbdTest,
|
||||
::testing::Values(make_tuple(16, &vpx_satd_c),
|
||||
make_tuple(64, &vpx_satd_c),
|
||||
@@ -632,12 +640,14 @@ INSTANTIATE_TEST_SUITE_P(SSE2, SatdLowbdTest,
|
||||
make_tuple(256, &vpx_satd_sse2),
|
||||
make_tuple(1024, &vpx_satd_sse2)));
|
||||
|
||||
#if HAVE_X86_ASM
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
SSE2, BlockErrorTestFP,
|
||||
::testing::Values(make_tuple(16, &vp9_block_error_fp_sse2),
|
||||
make_tuple(64, &vp9_block_error_fp_sse2),
|
||||
make_tuple(256, &vp9_block_error_fp_sse2),
|
||||
make_tuple(1024, &vp9_block_error_fp_sse2)));
|
||||
#endif // HAVE_X86_ASM
|
||||
#endif // HAVE_SSE2
|
||||
|
||||
#if HAVE_AVX2
|
||||
@@ -694,18 +704,32 @@ INSTANTIATE_TEST_SUITE_P(NEON, SatdLowbdTest,
|
||||
make_tuple(256, &vpx_satd_neon),
|
||||
make_tuple(1024, &vpx_satd_neon)));
|
||||
|
||||
// TODO(jianj): Remove the highbitdepth flag once the SIMD functions are
|
||||
// in place.
|
||||
#if !CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
NEON, SatdHighbdTest,
|
||||
::testing::Values(make_tuple(16, &vpx_highbd_satd_neon),
|
||||
make_tuple(64, &vpx_highbd_satd_neon),
|
||||
make_tuple(256, &vpx_highbd_satd_neon),
|
||||
make_tuple(1024, &vpx_highbd_satd_neon)));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
NEON, BlockErrorTestFP,
|
||||
::testing::Values(make_tuple(16, &vp9_block_error_fp_neon),
|
||||
make_tuple(64, &vp9_block_error_fp_neon),
|
||||
make_tuple(256, &vp9_block_error_fp_neon),
|
||||
make_tuple(1024, &vp9_block_error_fp_neon)));
|
||||
#endif // !CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // HAVE_NEON
|
||||
|
||||
#if HAVE_SVE
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
SVE, BlockErrorTestFP,
|
||||
::testing::Values(make_tuple(16, &vp9_block_error_fp_sve),
|
||||
make_tuple(64, &vp9_block_error_fp_sve),
|
||||
make_tuple(256, &vp9_block_error_fp_sve),
|
||||
make_tuple(1024, &vp9_block_error_fp_sve)));
|
||||
#endif // HAVE_SVE
|
||||
|
||||
#if HAVE_MSA
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
MSA, AverageTest,
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "test/bench.h"
|
||||
#include "vpx_ports/vpx_timer.h"
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
class AbstractBench {
|
||||
public:
|
||||
virtual ~AbstractBench() = default;
|
||||
|
||||
void RunNTimes(int n);
|
||||
void PrintMedian(const char *title);
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <string.h>
|
||||
#include <tuple>
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#if CONFIG_VP9_ENCODER
|
||||
@@ -49,14 +49,14 @@ class BlockinessTestBase : public ::testing::Test {
|
||||
reference_data_ = nullptr;
|
||||
}
|
||||
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
void TearDown() override { libvpx_test::ClearSystemState(); }
|
||||
|
||||
protected:
|
||||
// Handle frames up to 640x480
|
||||
static const int kDataAlignment = 16;
|
||||
static const int kDataBufferSize = 640 * 480;
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
source_stride_ = (width_ + 31) & ~31;
|
||||
reference_stride_ = width_ * 2;
|
||||
rnd_.Reset(ACMRandom::DeterministicSeed());
|
||||
@@ -139,7 +139,7 @@ class BlockinessTestBase : public ::testing::Test {
|
||||
};
|
||||
|
||||
#if CONFIG_VP9_ENCODER
|
||||
typedef std::tuple<int, int> BlockinessParam;
|
||||
using BlockinessParam = std::tuple<int, int>;
|
||||
class BlockinessVP9Test
|
||||
: public BlockinessTestBase,
|
||||
public ::testing::WithParamInterface<BlockinessParam> {
|
||||
|
||||
@@ -9,11 +9,12 @@
|
||||
*/
|
||||
#include <climits>
|
||||
#include <vector>
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/encode_test_driver.h"
|
||||
#include "test/i420_video_source.h"
|
||||
#include "test/util.h"
|
||||
#include "vpx_config.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -22,15 +23,15 @@ class BordersTest
|
||||
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
|
||||
protected:
|
||||
BordersTest() : EncoderTest(GET_PARAM(0)) {}
|
||||
virtual ~BordersTest() {}
|
||||
~BordersTest() override = default;
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
InitializeConfig();
|
||||
SetMode(GET_PARAM(1));
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) {
|
||||
void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) override {
|
||||
if (video->frame() == 0) {
|
||||
encoder->Control(VP8E_SET_CPUUSED, 1);
|
||||
encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1);
|
||||
@@ -40,7 +41,7 @@ class BordersTest
|
||||
}
|
||||
}
|
||||
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
|
||||
if (pkt->data.frame.flags & VPX_FRAME_IS_KEY) {
|
||||
}
|
||||
}
|
||||
@@ -79,6 +80,11 @@ TEST_P(BordersTest, TestLowBitrate) {
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
}
|
||||
|
||||
#if CONFIG_REALTIME_ONLY
|
||||
VP9_INSTANTIATE_TEST_SUITE(BordersTest,
|
||||
::testing::Values(::libvpx_test::kRealTime));
|
||||
#else
|
||||
VP9_INSTANTIATE_TEST_SUITE(BordersTest,
|
||||
::testing::Values(::libvpx_test::kTwoPassGood));
|
||||
#endif
|
||||
} // namespace
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "test/acm_random.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
|
||||
@@ -58,7 +58,7 @@ class ByteAlignmentTest
|
||||
ByteAlignmentTest()
|
||||
: video_(nullptr), decoder_(nullptr), md5_file_(nullptr) {}
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
video_ = new libvpx_test::WebMVideoSource(kVP9TestFile);
|
||||
ASSERT_NE(video_, nullptr);
|
||||
video_->Init();
|
||||
@@ -71,7 +71,7 @@ class ByteAlignmentTest
|
||||
OpenMd5File(kVP9Md5File);
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
void TearDown() override {
|
||||
if (md5_file_ != nullptr) fclose(md5_file_);
|
||||
|
||||
delete decoder_;
|
||||
|
||||
@@ -40,7 +40,7 @@ class CodecFactory {
|
||||
const vpx_codec_flags_t flags) const = 0;
|
||||
|
||||
virtual Encoder *CreateEncoder(vpx_codec_enc_cfg_t cfg,
|
||||
unsigned long deadline,
|
||||
vpx_enc_deadline_t deadline,
|
||||
const unsigned long init_flags,
|
||||
TwopassStatsStore *stats) const = 0;
|
||||
|
||||
@@ -84,7 +84,7 @@ class VP8Decoder : public Decoder {
|
||||
: Decoder(cfg, flag) {}
|
||||
|
||||
protected:
|
||||
virtual vpx_codec_iface_t *CodecInterface() const {
|
||||
vpx_codec_iface_t *CodecInterface() const override {
|
||||
#if CONFIG_VP8_DECODER
|
||||
return &vpx_codec_vp8_dx_algo;
|
||||
#else
|
||||
@@ -95,12 +95,12 @@ class VP8Decoder : public Decoder {
|
||||
|
||||
class VP8Encoder : public Encoder {
|
||||
public:
|
||||
VP8Encoder(vpx_codec_enc_cfg_t cfg, unsigned long deadline,
|
||||
VP8Encoder(vpx_codec_enc_cfg_t cfg, vpx_enc_deadline_t deadline,
|
||||
const unsigned long init_flags, TwopassStatsStore *stats)
|
||||
: Encoder(cfg, deadline, init_flags, stats) {}
|
||||
|
||||
protected:
|
||||
virtual vpx_codec_iface_t *CodecInterface() const {
|
||||
vpx_codec_iface_t *CodecInterface() const override {
|
||||
#if CONFIG_VP8_ENCODER
|
||||
return &vpx_codec_vp8_cx_algo;
|
||||
#else
|
||||
@@ -113,12 +113,12 @@ class VP8CodecFactory : public CodecFactory {
|
||||
public:
|
||||
VP8CodecFactory() : CodecFactory() {}
|
||||
|
||||
virtual Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg) const {
|
||||
Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg) const override {
|
||||
return CreateDecoder(cfg, 0);
|
||||
}
|
||||
|
||||
virtual Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg,
|
||||
const vpx_codec_flags_t flags) const {
|
||||
Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg,
|
||||
const vpx_codec_flags_t flags) const override {
|
||||
#if CONFIG_VP8_DECODER
|
||||
return new VP8Decoder(cfg, flags);
|
||||
#else
|
||||
@@ -128,10 +128,9 @@ class VP8CodecFactory : public CodecFactory {
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual Encoder *CreateEncoder(vpx_codec_enc_cfg_t cfg,
|
||||
unsigned long deadline,
|
||||
const unsigned long init_flags,
|
||||
TwopassStatsStore *stats) const {
|
||||
Encoder *CreateEncoder(vpx_codec_enc_cfg_t cfg, vpx_enc_deadline_t deadline,
|
||||
const unsigned long init_flags,
|
||||
TwopassStatsStore *stats) const override {
|
||||
#if CONFIG_VP8_ENCODER
|
||||
return new VP8Encoder(cfg, deadline, init_flags, stats);
|
||||
#else
|
||||
@@ -143,8 +142,8 @@ class VP8CodecFactory : public CodecFactory {
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual vpx_codec_err_t DefaultEncoderConfig(vpx_codec_enc_cfg_t *cfg,
|
||||
int usage) const {
|
||||
vpx_codec_err_t DefaultEncoderConfig(vpx_codec_enc_cfg_t *cfg,
|
||||
int usage) const override {
|
||||
#if CONFIG_VP8_ENCODER
|
||||
return vpx_codec_enc_config_default(&vpx_codec_vp8_cx_algo, cfg, usage);
|
||||
#else
|
||||
@@ -165,7 +164,9 @@ const libvpx_test::VP8CodecFactory kVP8;
|
||||
&libvpx_test::kVP8)), \
|
||||
__VA_ARGS__))
|
||||
#else
|
||||
#define VP8_INSTANTIATE_TEST_SUITE(test, ...)
|
||||
// static_assert() is used to avoid warnings about an extra ';' outside of a
|
||||
// function.
|
||||
#define VP8_INSTANTIATE_TEST_SUITE(test, ...) static_assert(CONFIG_VP8 == 0, "")
|
||||
#endif // CONFIG_VP8
|
||||
|
||||
/*
|
||||
@@ -180,7 +181,7 @@ class VP9Decoder : public Decoder {
|
||||
: Decoder(cfg, flag) {}
|
||||
|
||||
protected:
|
||||
virtual vpx_codec_iface_t *CodecInterface() const {
|
||||
vpx_codec_iface_t *CodecInterface() const override {
|
||||
#if CONFIG_VP9_DECODER
|
||||
return &vpx_codec_vp9_dx_algo;
|
||||
#else
|
||||
@@ -191,12 +192,12 @@ class VP9Decoder : public Decoder {
|
||||
|
||||
class VP9Encoder : public Encoder {
|
||||
public:
|
||||
VP9Encoder(vpx_codec_enc_cfg_t cfg, unsigned long deadline,
|
||||
VP9Encoder(vpx_codec_enc_cfg_t cfg, vpx_enc_deadline_t deadline,
|
||||
const unsigned long init_flags, TwopassStatsStore *stats)
|
||||
: Encoder(cfg, deadline, init_flags, stats) {}
|
||||
|
||||
protected:
|
||||
virtual vpx_codec_iface_t *CodecInterface() const {
|
||||
vpx_codec_iface_t *CodecInterface() const override {
|
||||
#if CONFIG_VP9_ENCODER
|
||||
return &vpx_codec_vp9_cx_algo;
|
||||
#else
|
||||
@@ -209,12 +210,12 @@ class VP9CodecFactory : public CodecFactory {
|
||||
public:
|
||||
VP9CodecFactory() : CodecFactory() {}
|
||||
|
||||
virtual Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg) const {
|
||||
Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg) const override {
|
||||
return CreateDecoder(cfg, 0);
|
||||
}
|
||||
|
||||
virtual Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg,
|
||||
const vpx_codec_flags_t flags) const {
|
||||
Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg,
|
||||
const vpx_codec_flags_t flags) const override {
|
||||
#if CONFIG_VP9_DECODER
|
||||
return new VP9Decoder(cfg, flags);
|
||||
#else
|
||||
@@ -224,10 +225,9 @@ class VP9CodecFactory : public CodecFactory {
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual Encoder *CreateEncoder(vpx_codec_enc_cfg_t cfg,
|
||||
unsigned long deadline,
|
||||
const unsigned long init_flags,
|
||||
TwopassStatsStore *stats) const {
|
||||
Encoder *CreateEncoder(vpx_codec_enc_cfg_t cfg, vpx_enc_deadline_t deadline,
|
||||
const unsigned long init_flags,
|
||||
TwopassStatsStore *stats) const override {
|
||||
#if CONFIG_VP9_ENCODER
|
||||
return new VP9Encoder(cfg, deadline, init_flags, stats);
|
||||
#else
|
||||
@@ -239,8 +239,8 @@ class VP9CodecFactory : public CodecFactory {
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual vpx_codec_err_t DefaultEncoderConfig(vpx_codec_enc_cfg_t *cfg,
|
||||
int usage) const {
|
||||
vpx_codec_err_t DefaultEncoderConfig(vpx_codec_enc_cfg_t *cfg,
|
||||
int usage) const override {
|
||||
#if CONFIG_VP9_ENCODER
|
||||
return vpx_codec_enc_config_default(&vpx_codec_vp9_cx_algo, cfg, usage);
|
||||
#else
|
||||
@@ -261,7 +261,9 @@ const libvpx_test::VP9CodecFactory kVP9;
|
||||
&libvpx_test::kVP9)), \
|
||||
__VA_ARGS__))
|
||||
#else
|
||||
#define VP9_INSTANTIATE_TEST_SUITE(test, ...)
|
||||
// static_assert() is used to avoid warnings about an extra ';' outside of a
|
||||
// function.
|
||||
#define VP9_INSTANTIATE_TEST_SUITE(test, ...) static_assert(CONFIG_VP9 == 0, "")
|
||||
#endif // CONFIG_VP9
|
||||
|
||||
} // namespace libvpx_test
|
||||
|
||||
@@ -8,13 +8,14 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "./vpx_dsp_rtcd.h"
|
||||
|
||||
#include "test/acm_random.h"
|
||||
#include "test/buffer.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "vpx_config.h"
|
||||
#include "vpx_ports/vpx_timer.h"
|
||||
|
||||
namespace {
|
||||
@@ -22,13 +23,14 @@ namespace {
|
||||
using ::libvpx_test::ACMRandom;
|
||||
using ::libvpx_test::Buffer;
|
||||
|
||||
typedef void (*AvgPredFunc)(uint8_t *a, const uint8_t *b, int w, int h,
|
||||
const uint8_t *c, int c_stride);
|
||||
template <typename Pixel>
|
||||
Pixel avg_with_rounding(Pixel a, Pixel b) {
|
||||
return (a + b + 1) >> 1;
|
||||
}
|
||||
|
||||
uint8_t avg_with_rounding(uint8_t a, uint8_t b) { return (a + b + 1) >> 1; }
|
||||
|
||||
void reference_pred(const Buffer<uint8_t> &pred, const Buffer<uint8_t> &ref,
|
||||
int width, int height, Buffer<uint8_t> *avg) {
|
||||
template <typename Pixel>
|
||||
void reference_pred(const Buffer<Pixel> &pred, const Buffer<Pixel> &ref,
|
||||
int width, int height, Buffer<Pixel> *avg) {
|
||||
ASSERT_NE(avg->TopLeftPixel(), nullptr);
|
||||
ASSERT_NE(pred.TopLeftPixel(), nullptr);
|
||||
ASSERT_NE(ref.TopLeftPixel(), nullptr);
|
||||
@@ -36,28 +38,36 @@ void reference_pred(const Buffer<uint8_t> &pred, const Buffer<uint8_t> &ref,
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (int x = 0; x < width; ++x) {
|
||||
avg->TopLeftPixel()[y * avg->stride() + x] =
|
||||
avg_with_rounding(pred.TopLeftPixel()[y * pred.stride() + x],
|
||||
ref.TopLeftPixel()[y * ref.stride() + x]);
|
||||
avg_with_rounding<Pixel>(pred.TopLeftPixel()[y * pred.stride() + x],
|
||||
ref.TopLeftPixel()[y * ref.stride() + x]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
using AvgPredFunc = void (*)(uint8_t *a, const uint8_t *b, int w, int h,
|
||||
const uint8_t *c, int c_stride);
|
||||
|
||||
template <int bitdepth, typename Pixel>
|
||||
class AvgPredTest : public ::testing::TestWithParam<AvgPredFunc> {
|
||||
public:
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
avg_pred_func_ = GetParam();
|
||||
rnd_.Reset(ACMRandom::DeterministicSeed());
|
||||
}
|
||||
|
||||
void TestSizeCombinations();
|
||||
void TestCompareReferenceRandom();
|
||||
void TestSpeed();
|
||||
|
||||
protected:
|
||||
AvgPredFunc avg_pred_func_;
|
||||
ACMRandom rnd_;
|
||||
};
|
||||
|
||||
TEST_P(AvgPredTest, SizeCombinations) {
|
||||
template <int bitdepth, typename Pixel>
|
||||
void AvgPredTest<bitdepth, Pixel>::TestSizeCombinations() {
|
||||
// This is called as part of the sub pixel variance. As such it must be one of
|
||||
// the variance block sizes.
|
||||
|
||||
for (int width_pow = 2; width_pow <= 6; ++width_pow) {
|
||||
for (int height_pow = width_pow - 1; height_pow <= width_pow + 1;
|
||||
++height_pow) {
|
||||
@@ -70,23 +80,30 @@ TEST_P(AvgPredTest, SizeCombinations) {
|
||||
const int width = 1 << width_pow;
|
||||
const int height = 1 << height_pow;
|
||||
// Only the reference buffer may have a stride not equal to width.
|
||||
Buffer<uint8_t> ref =
|
||||
Buffer<uint8_t>(width, height, ref_padding ? 8 : 0);
|
||||
Buffer<Pixel> ref = Buffer<Pixel>(width, height, ref_padding ? 8 : 0);
|
||||
ASSERT_TRUE(ref.Init());
|
||||
Buffer<uint8_t> pred = Buffer<uint8_t>(width, height, 0, 16);
|
||||
Buffer<Pixel> pred = Buffer<Pixel>(width, height, 0, 32);
|
||||
ASSERT_TRUE(pred.Init());
|
||||
Buffer<uint8_t> avg_ref = Buffer<uint8_t>(width, height, 0, 16);
|
||||
Buffer<Pixel> avg_ref = Buffer<Pixel>(width, height, 0, 32);
|
||||
ASSERT_TRUE(avg_ref.Init());
|
||||
Buffer<uint8_t> avg_chk = Buffer<uint8_t>(width, height, 0, 16);
|
||||
Buffer<Pixel> avg_chk = Buffer<Pixel>(width, height, 0, 32);
|
||||
ASSERT_TRUE(avg_chk.Init());
|
||||
const int bitdepth_mask = (1 << bitdepth) - 1;
|
||||
for (int h = 0; h < height; ++h) {
|
||||
for (int w = 0; w < width; ++w) {
|
||||
ref.TopLeftPixel()[w + h * width] = rnd_.Rand16() & bitdepth_mask;
|
||||
}
|
||||
}
|
||||
for (int h = 0; h < height; ++h) {
|
||||
for (int w = 0; w < width; ++w) {
|
||||
pred.TopLeftPixel()[w + h * width] = rnd_.Rand16() & bitdepth_mask;
|
||||
}
|
||||
}
|
||||
|
||||
ref.Set(&rnd_, &ACMRandom::Rand8);
|
||||
pred.Set(&rnd_, &ACMRandom::Rand8);
|
||||
|
||||
reference_pred(pred, ref, width, height, &avg_ref);
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
avg_pred_func_(avg_chk.TopLeftPixel(), pred.TopLeftPixel(), width,
|
||||
height, ref.TopLeftPixel(), ref.stride()));
|
||||
reference_pred<Pixel>(pred, ref, width, height, &avg_ref);
|
||||
ASM_REGISTER_STATE_CHECK(avg_pred_func_(
|
||||
(uint8_t *)avg_chk.TopLeftPixel(), (uint8_t *)pred.TopLeftPixel(),
|
||||
width, height, (uint8_t *)ref.TopLeftPixel(), ref.stride()));
|
||||
|
||||
EXPECT_TRUE(avg_chk.CheckValues(avg_ref));
|
||||
if (HasFailure()) {
|
||||
@@ -99,26 +116,36 @@ TEST_P(AvgPredTest, SizeCombinations) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(AvgPredTest, CompareReferenceRandom) {
|
||||
template <int bitdepth, typename Pixel>
|
||||
void AvgPredTest<bitdepth, Pixel>::TestCompareReferenceRandom() {
|
||||
const int width = 64;
|
||||
const int height = 32;
|
||||
Buffer<uint8_t> ref = Buffer<uint8_t>(width, height, 8);
|
||||
Buffer<Pixel> ref = Buffer<Pixel>(width, height, 8);
|
||||
ASSERT_TRUE(ref.Init());
|
||||
Buffer<uint8_t> pred = Buffer<uint8_t>(width, height, 0, 16);
|
||||
Buffer<Pixel> pred = Buffer<Pixel>(width, height, 0, 32);
|
||||
ASSERT_TRUE(pred.Init());
|
||||
Buffer<uint8_t> avg_ref = Buffer<uint8_t>(width, height, 0, 16);
|
||||
Buffer<Pixel> avg_ref = Buffer<Pixel>(width, height, 0, 32);
|
||||
ASSERT_TRUE(avg_ref.Init());
|
||||
Buffer<uint8_t> avg_chk = Buffer<uint8_t>(width, height, 0, 16);
|
||||
Buffer<Pixel> avg_chk = Buffer<Pixel>(width, height, 0, 32);
|
||||
ASSERT_TRUE(avg_chk.Init());
|
||||
|
||||
for (int i = 0; i < 500; ++i) {
|
||||
ref.Set(&rnd_, &ACMRandom::Rand8);
|
||||
pred.Set(&rnd_, &ACMRandom::Rand8);
|
||||
const int bitdepth_mask = (1 << bitdepth) - 1;
|
||||
for (int h = 0; h < height; ++h) {
|
||||
for (int w = 0; w < width; ++w) {
|
||||
ref.TopLeftPixel()[w + h * width] = rnd_.Rand16() & bitdepth_mask;
|
||||
}
|
||||
}
|
||||
for (int h = 0; h < height; ++h) {
|
||||
for (int w = 0; w < width; ++w) {
|
||||
pred.TopLeftPixel()[w + h * width] = rnd_.Rand16() & bitdepth_mask;
|
||||
}
|
||||
}
|
||||
|
||||
reference_pred(pred, ref, width, height, &avg_ref);
|
||||
ASM_REGISTER_STATE_CHECK(avg_pred_func_(avg_chk.TopLeftPixel(),
|
||||
pred.TopLeftPixel(), width, height,
|
||||
ref.TopLeftPixel(), ref.stride()));
|
||||
reference_pred<Pixel>(pred, ref, width, height, &avg_ref);
|
||||
ASM_REGISTER_STATE_CHECK(avg_pred_func_(
|
||||
(uint8_t *)avg_chk.TopLeftPixel(), (uint8_t *)pred.TopLeftPixel(),
|
||||
width, height, (uint8_t *)ref.TopLeftPixel(), ref.stride()));
|
||||
EXPECT_TRUE(avg_chk.CheckValues(avg_ref));
|
||||
if (HasFailure()) {
|
||||
printf("Width: %d Height: %d\n", width, height);
|
||||
@@ -128,7 +155,8 @@ TEST_P(AvgPredTest, CompareReferenceRandom) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(AvgPredTest, DISABLED_Speed) {
|
||||
template <int bitdepth, typename Pixel>
|
||||
void AvgPredTest<bitdepth, Pixel>::TestSpeed() {
|
||||
for (int width_pow = 2; width_pow <= 6; ++width_pow) {
|
||||
for (int height_pow = width_pow - 1; height_pow <= width_pow + 1;
|
||||
++height_pow) {
|
||||
@@ -138,22 +166,30 @@ TEST_P(AvgPredTest, DISABLED_Speed) {
|
||||
for (int ref_padding = 0; ref_padding < 2; ref_padding++) {
|
||||
const int width = 1 << width_pow;
|
||||
const int height = 1 << height_pow;
|
||||
Buffer<uint8_t> ref =
|
||||
Buffer<uint8_t>(width, height, ref_padding ? 8 : 0);
|
||||
Buffer<Pixel> ref = Buffer<Pixel>(width, height, ref_padding ? 8 : 0);
|
||||
ASSERT_TRUE(ref.Init());
|
||||
Buffer<uint8_t> pred = Buffer<uint8_t>(width, height, 0, 16);
|
||||
Buffer<Pixel> pred = Buffer<Pixel>(width, height, 0, 32);
|
||||
ASSERT_TRUE(pred.Init());
|
||||
Buffer<uint8_t> avg = Buffer<uint8_t>(width, height, 0, 16);
|
||||
Buffer<Pixel> avg = Buffer<Pixel>(width, height, 0, 32);
|
||||
ASSERT_TRUE(avg.Init());
|
||||
|
||||
ref.Set(&rnd_, &ACMRandom::Rand8);
|
||||
pred.Set(&rnd_, &ACMRandom::Rand8);
|
||||
const int bitdepth_mask = (1 << bitdepth) - 1;
|
||||
for (int h = 0; h < height; ++h) {
|
||||
for (int w = 0; w < width; ++w) {
|
||||
ref.TopLeftPixel()[w + h * width] = rnd_.Rand16() & bitdepth_mask;
|
||||
}
|
||||
}
|
||||
for (int h = 0; h < height; ++h) {
|
||||
for (int w = 0; w < width; ++w) {
|
||||
pred.TopLeftPixel()[w + h * width] = rnd_.Rand16() & bitdepth_mask;
|
||||
}
|
||||
}
|
||||
|
||||
vpx_usec_timer timer;
|
||||
vpx_usec_timer_start(&timer);
|
||||
for (int i = 0; i < 10000000 / (width * height); ++i) {
|
||||
avg_pred_func_(avg.TopLeftPixel(), pred.TopLeftPixel(), width, height,
|
||||
ref.TopLeftPixel(), ref.stride());
|
||||
for (int i = 0; i < 100000000 / (width * height); ++i) {
|
||||
avg_pred_func_((uint8_t *)avg.TopLeftPixel(),
|
||||
(uint8_t *)pred.TopLeftPixel(), width, height,
|
||||
(uint8_t *)ref.TopLeftPixel(), ref.stride());
|
||||
}
|
||||
vpx_usec_timer_mark(&timer);
|
||||
|
||||
@@ -166,26 +202,75 @@ TEST_P(AvgPredTest, DISABLED_Speed) {
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(C, AvgPredTest,
|
||||
using AvgPredTestLBD = AvgPredTest<8, uint8_t>;
|
||||
|
||||
TEST_P(AvgPredTestLBD, SizeCombinations) { TestSizeCombinations(); }
|
||||
|
||||
TEST_P(AvgPredTestLBD, CompareReferenceRandom) { TestCompareReferenceRandom(); }
|
||||
|
||||
TEST_P(AvgPredTestLBD, DISABLED_Speed) { TestSpeed(); }
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(C, AvgPredTestLBD,
|
||||
::testing::Values(&vpx_comp_avg_pred_c));
|
||||
|
||||
#if HAVE_SSE2
|
||||
INSTANTIATE_TEST_SUITE_P(SSE2, AvgPredTest,
|
||||
INSTANTIATE_TEST_SUITE_P(SSE2, AvgPredTestLBD,
|
||||
::testing::Values(&vpx_comp_avg_pred_sse2));
|
||||
#endif // HAVE_SSE2
|
||||
|
||||
#if HAVE_AVX2
|
||||
INSTANTIATE_TEST_SUITE_P(AVX2, AvgPredTestLBD,
|
||||
::testing::Values(&vpx_comp_avg_pred_avx2));
|
||||
#endif // HAVE_AVX2
|
||||
|
||||
#if HAVE_NEON
|
||||
INSTANTIATE_TEST_SUITE_P(NEON, AvgPredTest,
|
||||
INSTANTIATE_TEST_SUITE_P(NEON, AvgPredTestLBD,
|
||||
::testing::Values(&vpx_comp_avg_pred_neon));
|
||||
#endif // HAVE_NEON
|
||||
|
||||
#if HAVE_VSX
|
||||
INSTANTIATE_TEST_SUITE_P(VSX, AvgPredTest,
|
||||
INSTANTIATE_TEST_SUITE_P(VSX, AvgPredTestLBD,
|
||||
::testing::Values(&vpx_comp_avg_pred_vsx));
|
||||
#endif // HAVE_VSX
|
||||
|
||||
#if HAVE_LSX
|
||||
INSTANTIATE_TEST_SUITE_P(LSX, AvgPredTest,
|
||||
INSTANTIATE_TEST_SUITE_P(LSX, AvgPredTestLBD,
|
||||
::testing::Values(&vpx_comp_avg_pred_lsx));
|
||||
#endif // HAVE_LSX
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
using HighbdAvgPredFunc = void (*)(uint16_t *a, const uint16_t *b, int w, int h,
|
||||
const uint16_t *c, int c_stride);
|
||||
|
||||
template <HighbdAvgPredFunc fn>
|
||||
void highbd_wrapper(uint8_t *a, const uint8_t *b, int w, int h,
|
||||
const uint8_t *c, int c_stride) {
|
||||
fn((uint16_t *)a, (const uint16_t *)b, w, h, (const uint16_t *)c, c_stride);
|
||||
}
|
||||
|
||||
using AvgPredTestHBD = AvgPredTest<12, uint16_t>;
|
||||
|
||||
TEST_P(AvgPredTestHBD, SizeCombinations) { TestSizeCombinations(); }
|
||||
|
||||
TEST_P(AvgPredTestHBD, CompareReferenceRandom) { TestCompareReferenceRandom(); }
|
||||
|
||||
TEST_P(AvgPredTestHBD, DISABLED_Speed) { TestSpeed(); }
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
C, AvgPredTestHBD,
|
||||
::testing::Values(&highbd_wrapper<vpx_highbd_comp_avg_pred_c>));
|
||||
|
||||
#if HAVE_SSE2
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
SSE2, AvgPredTestHBD,
|
||||
::testing::Values(&highbd_wrapper<vpx_highbd_comp_avg_pred_sse2>));
|
||||
#endif // HAVE_SSE2
|
||||
|
||||
#if HAVE_NEON
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
NEON, AvgPredTestHBD,
|
||||
::testing::Values(&highbd_wrapper<vpx_highbd_comp_avg_pred_neon>));
|
||||
#endif // HAVE_NEON
|
||||
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
} // namespace
|
||||
@@ -7,7 +7,7 @@
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/encode_test_driver.h"
|
||||
#include "test/util.h"
|
||||
@@ -22,24 +22,24 @@ class ConfigTest
|
||||
ConfigTest()
|
||||
: EncoderTest(GET_PARAM(0)), frame_count_in_(0), frame_count_out_(0),
|
||||
frame_count_max_(0) {}
|
||||
virtual ~ConfigTest() {}
|
||||
~ConfigTest() override = default;
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
InitializeConfig();
|
||||
SetMode(GET_PARAM(1));
|
||||
}
|
||||
|
||||
virtual void BeginPassHook(unsigned int /*pass*/) {
|
||||
void BeginPassHook(unsigned int /*pass*/) override {
|
||||
frame_count_in_ = 0;
|
||||
frame_count_out_ = 0;
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(libvpx_test::VideoSource * /*video*/) {
|
||||
void PreEncodeFrameHook(libvpx_test::VideoSource * /*video*/) override {
|
||||
++frame_count_in_;
|
||||
abort_ |= (frame_count_in_ >= frame_count_max_);
|
||||
}
|
||||
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t * /*pkt*/) {
|
||||
void FramePktHook(const vpx_codec_cx_pkt_t * /*pkt*/) override {
|
||||
++frame_count_out_;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <string.h>
|
||||
#include <tuple>
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#if CONFIG_VP9_ENCODER
|
||||
@@ -65,14 +65,14 @@ class ConsistencyTestBase : public ::testing::Test {
|
||||
delete[] ssim_array_;
|
||||
}
|
||||
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
void TearDown() override { libvpx_test::ClearSystemState(); }
|
||||
|
||||
protected:
|
||||
// Handle frames up to 640x480
|
||||
static const int kDataAlignment = 16;
|
||||
static const int kDataBufferSize = 640 * 480;
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
source_stride_ = (width_ + 31) & ~31;
|
||||
reference_stride_ = width_ * 2;
|
||||
rnd_.Reset(ACMRandom::DeterministicSeed());
|
||||
@@ -128,7 +128,7 @@ class ConsistencyTestBase : public ::testing::Test {
|
||||
};
|
||||
|
||||
#if CONFIG_VP9_ENCODER
|
||||
typedef std::tuple<int, int> ConsistencyParam;
|
||||
using ConsistencyParam = std::tuple<int, int>;
|
||||
class ConsistencyVP9Test
|
||||
: public ConsistencyTestBase,
|
||||
public ::testing::WithParamInterface<ConsistencyParam> {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <string.h>
|
||||
#include <tuple>
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "./vp9_rtcd.h"
|
||||
#include "./vpx_config.h"
|
||||
@@ -32,17 +32,24 @@ namespace {
|
||||
|
||||
static const unsigned int kMaxDimension = 64;
|
||||
|
||||
typedef void (*ConvolveFunc)(const uint8_t *src, ptrdiff_t src_stride,
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const InterpKernel *filter, int x0_q4,
|
||||
int x_step_q4, int y0_q4, int y_step_q4, int w,
|
||||
int h);
|
||||
using ConvolveFunc = void (*)(const uint8_t *src, ptrdiff_t src_stride,
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const InterpKernel *filter, int x0_q4,
|
||||
int x_step_q4, int y0_q4, int y_step_q4, int w,
|
||||
int h);
|
||||
#if !CONFIG_REALTIME_ONLY && CONFIG_VP9_ENCODER
|
||||
using ConvolveFunc12Tap = void (*)(const uint8_t *src, ptrdiff_t src_stride,
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const InterpKernel12 *filter, int x0_q4,
|
||||
int x_step_q4, int y0_q4, int y_step_q4,
|
||||
int w, int h);
|
||||
#endif
|
||||
|
||||
typedef void (*WrapperFilterBlock2d8Func)(
|
||||
const uint8_t *src_ptr, const unsigned int src_stride,
|
||||
const int16_t *hfilter, const int16_t *vfilter, uint8_t *dst_ptr,
|
||||
unsigned int dst_stride, unsigned int output_width,
|
||||
unsigned int output_height, int use_highbd);
|
||||
using WrapperFilterBlock2d8Func =
|
||||
void (*)(const uint8_t *src_ptr, const unsigned int src_stride,
|
||||
const int16_t *hfilter, const int16_t *vfilter, uint8_t *dst_ptr,
|
||||
unsigned int dst_stride, unsigned int output_width,
|
||||
unsigned int output_height, int use_highbd);
|
||||
|
||||
struct ConvolveFunctions {
|
||||
ConvolveFunctions(ConvolveFunc copy, ConvolveFunc avg, ConvolveFunc h8,
|
||||
@@ -78,7 +85,26 @@ struct ConvolveFunctions {
|
||||
int use_highbd_; // 0 if high bitdepth not used, else the actual bit depth.
|
||||
};
|
||||
|
||||
typedef std::tuple<int, int, const ConvolveFunctions *> ConvolveParam;
|
||||
using ConvolveParam = std::tuple<int, int, const ConvolveFunctions *>;
|
||||
|
||||
#if !CONFIG_REALTIME_ONLY && CONFIG_VP9_ENCODER
|
||||
struct ConvolveFunctions12Tap {
|
||||
ConvolveFunctions12Tap(ConvolveFunc12Tap h12, ConvolveFunc12Tap v12,
|
||||
ConvolveFunc12Tap hv12, int bd)
|
||||
: use_highbd_(bd) {
|
||||
h12_ = h12;
|
||||
v12_ = v12;
|
||||
hv12_ = hv12;
|
||||
}
|
||||
|
||||
ConvolveFunc12Tap h12_;
|
||||
ConvolveFunc12Tap v12_;
|
||||
ConvolveFunc12Tap hv12_;
|
||||
int use_highbd_; // 0 if high bitdepth not used, else the actual bit depth.
|
||||
};
|
||||
|
||||
using Convolve12TapParam = std::tuple<int, int, const ConvolveFunctions12Tap *>;
|
||||
#endif
|
||||
|
||||
#define ALL_SIZES(convolve_fn) \
|
||||
make_tuple(4, 4, &convolve_fn), make_tuple(8, 4, &convolve_fn), \
|
||||
@@ -88,7 +114,13 @@ typedef std::tuple<int, int, const ConvolveFunctions *> ConvolveParam;
|
||||
make_tuple(16, 32, &convolve_fn), make_tuple(32, 32, &convolve_fn), \
|
||||
make_tuple(64, 32, &convolve_fn), make_tuple(32, 64, &convolve_fn), \
|
||||
make_tuple(64, 64, &convolve_fn)
|
||||
|
||||
#if !CONFIG_REALTIME_ONLY && CONFIG_VP9_ENCODER
|
||||
#define ALL_SIZES_12TAP(convolve_fn) \
|
||||
make_tuple(8, 8, &convolve_fn), make_tuple(16, 8, &convolve_fn), \
|
||||
make_tuple(8, 16, &convolve_fn), make_tuple(16, 16, &convolve_fn), \
|
||||
make_tuple(32, 16, &convolve_fn), make_tuple(16, 32, &convolve_fn), \
|
||||
make_tuple(32, 32, &convolve_fn)
|
||||
#endif
|
||||
// Reference 8-tap subpixel filter, slightly modified to fit into this test.
|
||||
#define VP9_FILTER_WEIGHT 128
|
||||
#define VP9_FILTER_SHIFT 7
|
||||
@@ -244,7 +276,7 @@ void highbd_filter_block2d_8_c(const uint16_t *src_ptr,
|
||||
|
||||
// Vertical pass (transposed intermediate -> dst).
|
||||
{
|
||||
uint16_t *src_ptr = intermediate_buffer;
|
||||
src_ptr = intermediate_buffer;
|
||||
const int dst_next_row_stride = dst_stride - output_width;
|
||||
unsigned int i, j;
|
||||
for (i = 0; i < output_height; ++i) {
|
||||
@@ -361,7 +393,7 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
void TearDown() override { libvpx_test::ClearSystemState(); }
|
||||
|
||||
static void TearDownTestSuite() {
|
||||
vpx_free(input_ - 1);
|
||||
@@ -403,7 +435,7 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
|
||||
i % kOuterBlockSize >= (BorderLeft() + Width()));
|
||||
}
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
UUT_ = GET_PARAM(2);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
if (UUT_->use_highbd_ != 0) {
|
||||
@@ -549,6 +581,438 @@ uint16_t *ConvolveTest::input16_ = nullptr;
|
||||
uint16_t *ConvolveTest::output16_ = nullptr;
|
||||
uint16_t *ConvolveTest::output16_ref_ = nullptr;
|
||||
#endif
|
||||
#if !CONFIG_REALTIME_ONLY && CONFIG_VP9_ENCODER
|
||||
class ConvolveTest12Tap : public ::testing::TestWithParam<Convolve12TapParam> {
|
||||
public:
|
||||
static void SetUpTestSuite() {
|
||||
// Force input_ to be unaligned, output to be 16 byte aligned.
|
||||
input_ = reinterpret_cast<uint8_t *>(
|
||||
vpx_memalign(kDataAlignment, kInputBufferSize + 1)) +
|
||||
1;
|
||||
output_ = reinterpret_cast<uint8_t *>(
|
||||
vpx_memalign(kDataAlignment, kOutputBufferSize));
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
input16_ = reinterpret_cast<uint16_t *>(vpx_memalign(
|
||||
kDataAlignment, (kInputBufferSize + 1) * sizeof(uint16_t))) +
|
||||
1;
|
||||
output16_ = reinterpret_cast<uint16_t *>(
|
||||
vpx_memalign(kDataAlignment, (kOutputBufferSize) * sizeof(uint16_t)));
|
||||
#endif
|
||||
}
|
||||
|
||||
void TearDown() override { libvpx_test::ClearSystemState(); }
|
||||
|
||||
static void TearDownTestSuite() {
|
||||
vpx_free(input_ - 1);
|
||||
input_ = nullptr;
|
||||
vpx_free(output_);
|
||||
output_ = nullptr;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
vpx_free(input16_ - 1);
|
||||
input16_ = nullptr;
|
||||
vpx_free(output16_);
|
||||
output16_ = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
protected:
|
||||
static const int kDataAlignment = 16;
|
||||
static const int kOuterBlockSize = 256;
|
||||
static const int kInputStride = kOuterBlockSize;
|
||||
static const int kOutputStride = kOuterBlockSize;
|
||||
static const int kInputBufferSize = kOuterBlockSize * kOuterBlockSize;
|
||||
static const int kOutputBufferSize = kOuterBlockSize * kOuterBlockSize;
|
||||
|
||||
int Width() const { return GET_PARAM(0); }
|
||||
int Height() const { return GET_PARAM(1); }
|
||||
int BorderLeft() const {
|
||||
const int center = (kOuterBlockSize - Width()) / 2;
|
||||
return (center + (kDataAlignment - 1)) & ~(kDataAlignment - 1);
|
||||
}
|
||||
int BorderTop() const { return (kOuterBlockSize - Height()) / 2; }
|
||||
|
||||
bool IsIndexInBorder(int i) {
|
||||
return (i < BorderTop() * kOuterBlockSize ||
|
||||
i >= (BorderTop() + Height()) * kOuterBlockSize ||
|
||||
i % kOuterBlockSize < BorderLeft() ||
|
||||
i % kOuterBlockSize >= (BorderLeft() + Width()));
|
||||
}
|
||||
|
||||
void SetUp() override {
|
||||
UUT_ = GET_PARAM(2);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
if (UUT_->use_highbd_ != 0) {
|
||||
mask_ = (1 << UUT_->use_highbd_) - 1;
|
||||
} else {
|
||||
mask_ = 255;
|
||||
}
|
||||
#endif
|
||||
/* Set up guard blocks for an inner block centered in the outer block */
|
||||
for (int i = 0; i < kOutputBufferSize; ++i) {
|
||||
if (IsIndexInBorder(i)) {
|
||||
output_[i] = 255;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
output16_[i] = mask_;
|
||||
#endif
|
||||
} else {
|
||||
output_[i] = 0;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
output16_[i] = 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
::libvpx_test::ACMRandom prng;
|
||||
for (int i = 0; i < kInputBufferSize; ++i) {
|
||||
if (i & 1) {
|
||||
input_[i] = 255;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
input16_[i] = mask_;
|
||||
#endif
|
||||
} else {
|
||||
input_[i] = prng.Rand8Extremes();
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
input16_[i] = prng.Rand16() & mask_;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SetConstantInput(int value) {
|
||||
memset(input_, value, kInputBufferSize);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
vpx_memset16(input16_, value, kInputBufferSize);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CheckGuardBlocks() {
|
||||
for (int i = 0; i < kOutputBufferSize; ++i) {
|
||||
if (IsIndexInBorder(i)) {
|
||||
EXPECT_EQ(255, output_[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t *input() const {
|
||||
const int offset = BorderTop() * kOuterBlockSize + BorderLeft();
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
if (UUT_->use_highbd_ == 0) {
|
||||
return input_ + offset;
|
||||
} else {
|
||||
return CAST_TO_BYTEPTR(input16_ + offset);
|
||||
}
|
||||
#else
|
||||
return input_ + offset;
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t *output() const {
|
||||
const int offset = BorderTop() * kOuterBlockSize + BorderLeft();
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
if (UUT_->use_highbd_ == 0) {
|
||||
return output_ + offset;
|
||||
} else {
|
||||
return CAST_TO_BYTEPTR(output16_ + offset);
|
||||
}
|
||||
#else
|
||||
return output_ + offset;
|
||||
#endif
|
||||
}
|
||||
|
||||
uint16_t lookup(uint8_t *list, int index) const {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
if (UUT_->use_highbd_ == 0) {
|
||||
return list[index];
|
||||
} else {
|
||||
return CAST_TO_SHORTPTR(list)[index];
|
||||
}
|
||||
#else
|
||||
return list[index];
|
||||
#endif
|
||||
}
|
||||
|
||||
void assign_val(uint8_t *list, int index, uint16_t val) const {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
if (UUT_->use_highbd_ == 0) {
|
||||
list[index] = (uint8_t)val;
|
||||
} else {
|
||||
CAST_TO_SHORTPTR(list)[index] = val;
|
||||
}
|
||||
#else
|
||||
list[index] = (uint8_t)val;
|
||||
#endif
|
||||
}
|
||||
const ConvolveFunctions12Tap *UUT_;
|
||||
static uint8_t *input_;
|
||||
static uint8_t *output_;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
static uint16_t *input16_;
|
||||
static uint16_t *output16_;
|
||||
int mask_;
|
||||
#endif
|
||||
};
|
||||
|
||||
uint8_t *ConvolveTest12Tap::input_ = nullptr;
|
||||
uint8_t *ConvolveTest12Tap::output_ = nullptr;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
uint16_t *ConvolveTest12Tap::input16_ = nullptr;
|
||||
uint16_t *ConvolveTest12Tap::output16_ = nullptr;
|
||||
#endif
|
||||
|
||||
TEST_P(ConvolveTest12Tap, MatchesReferenceSubpixelFilter) {
|
||||
uint8_t *const in = input();
|
||||
uint8_t *const out = output();
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
uint8_t ref8[kOutputStride * kMaxDimension];
|
||||
uint16_t ref16[kOutputStride * kMaxDimension];
|
||||
uint8_t *ref;
|
||||
if (UUT_->use_highbd_ == 0) {
|
||||
ref = ref8;
|
||||
} else {
|
||||
ref = CAST_TO_BYTEPTR(ref16);
|
||||
}
|
||||
#else
|
||||
uint8_t ref[kOutputStride * kMaxDimension];
|
||||
#endif
|
||||
|
||||
// Populate ref and out with some random data
|
||||
::libvpx_test::ACMRandom prng;
|
||||
for (int y = 0; y < Height(); ++y) {
|
||||
for (int x = 0; x < Width(); ++x) {
|
||||
uint16_t r;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
if (UUT_->use_highbd_ == 0 || UUT_->use_highbd_ == 8) {
|
||||
r = prng.Rand8Extremes();
|
||||
} else {
|
||||
r = prng.Rand16() & mask_;
|
||||
}
|
||||
#else
|
||||
r = prng.Rand8Extremes();
|
||||
#endif
|
||||
|
||||
assign_val(out, y * kOutputStride + x, r);
|
||||
assign_val(ref, y * kOutputStride + x, r);
|
||||
}
|
||||
}
|
||||
|
||||
const InterpKernel12 *filters = sub_pel_filters_12;
|
||||
for (int filter_x = 0; filter_x < 16; ++filter_x) {
|
||||
for (int filter_y = 0; filter_y < 16; ++filter_y) {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
if (UUT_->use_highbd_ == 0) {
|
||||
vpx_convolve12_c(in, kInputStride, ref, kOutputStride, filters,
|
||||
filter_x, 16, filter_y, 16, Width(), Height());
|
||||
} else {
|
||||
vpx_highbd_convolve12_c(CAST_TO_SHORTPTR(in), kInputStride,
|
||||
CAST_TO_SHORTPTR(ref), kOutputStride, filters,
|
||||
filter_x, 16, filter_y, 16, Width(), Height(),
|
||||
UUT_->use_highbd_);
|
||||
}
|
||||
#else
|
||||
vpx_convolve12_c(in, kInputStride, ref, kOutputStride, filters, filter_x,
|
||||
16, filter_y, 16, Width(), Height());
|
||||
#endif
|
||||
if (filter_x && filter_y)
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
UUT_->hv12_(in, kInputStride, out, kOutputStride, filters, filter_x,
|
||||
16, filter_y, 16, Width(), Height()));
|
||||
else if (filter_y)
|
||||
ASM_REGISTER_STATE_CHECK(UUT_->v12_(in, kInputStride, out,
|
||||
kOutputStride, filters, 0, 16,
|
||||
filter_y, 16, Width(), Height()));
|
||||
else if (filter_x)
|
||||
ASM_REGISTER_STATE_CHECK(UUT_->h12_(in, kInputStride, out,
|
||||
kOutputStride, filters, filter_x,
|
||||
16, 0, 16, Width(), Height()));
|
||||
else
|
||||
continue;
|
||||
|
||||
CheckGuardBlocks();
|
||||
|
||||
for (int y = 0; y < Height(); ++y) {
|
||||
for (int x = 0; x < Width(); ++x)
|
||||
ASSERT_EQ(lookup(ref, y * kOutputStride + x),
|
||||
lookup(out, y * kOutputStride + x))
|
||||
<< "mismatch at (" << x << "," << y << "), "
|
||||
<< "filters ("
|
||||
<< "," << filter_x << "," << filter_y << ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(ConvolveTest12Tap, FilterExtremes) {
|
||||
uint8_t *const in = input();
|
||||
uint8_t *const out = output();
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
uint8_t ref8[kOutputStride * kMaxDimension];
|
||||
uint16_t ref16[kOutputStride * kMaxDimension];
|
||||
uint8_t *ref;
|
||||
if (UUT_->use_highbd_ == 0) {
|
||||
ref = ref8;
|
||||
} else {
|
||||
ref = CAST_TO_BYTEPTR(ref16);
|
||||
}
|
||||
#else
|
||||
uint8_t ref[kOutputStride * kMaxDimension];
|
||||
#endif
|
||||
|
||||
// Populate ref and out with some random data
|
||||
::libvpx_test::ACMRandom prng;
|
||||
for (int y = 0; y < Height(); ++y) {
|
||||
for (int x = 0; x < Width(); ++x) {
|
||||
uint16_t r;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
if (UUT_->use_highbd_ == 0 || UUT_->use_highbd_ == 8) {
|
||||
r = prng.Rand8Extremes();
|
||||
} else {
|
||||
r = prng.Rand16() & mask_;
|
||||
}
|
||||
#else
|
||||
r = prng.Rand8Extremes();
|
||||
#endif
|
||||
assign_val(out, y * kOutputStride + x, r);
|
||||
assign_val(ref, y * kOutputStride + x, r);
|
||||
}
|
||||
}
|
||||
|
||||
for (int axis = 0; axis < 2; axis++) {
|
||||
int seed_val = 0;
|
||||
while (seed_val < 256) {
|
||||
for (int y = 0; y < 8; ++y) {
|
||||
for (int x = 0; x < 8; ++x) {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
assign_val(in, y * kOutputStride + x - MAX_FILTER_TAP / 2 + 1,
|
||||
((seed_val >> (axis ? y : x)) & 1) * mask_);
|
||||
#else
|
||||
assign_val(in, y * kOutputStride + x - MAX_FILTER_TAP / 2 + 1,
|
||||
((seed_val >> (axis ? y : x)) & 1) * 255);
|
||||
#endif
|
||||
if (axis) seed_val++;
|
||||
}
|
||||
if (axis) {
|
||||
seed_val -= 8;
|
||||
} else {
|
||||
seed_val++;
|
||||
}
|
||||
}
|
||||
if (axis) seed_val += 8;
|
||||
|
||||
const InterpKernel12 *filters = sub_pel_filters_12;
|
||||
for (int filter_x = 0; filter_x < 16; ++filter_x) {
|
||||
for (int filter_y = 0; filter_y < 16; ++filter_y) {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
if (UUT_->use_highbd_ == 0) {
|
||||
vpx_convolve12_c(in, kInputStride, ref, kOutputStride, filters,
|
||||
filter_x, 16, filter_y, 16, Width(), Height());
|
||||
} else {
|
||||
vpx_highbd_convolve12_c(CAST_TO_SHORTPTR(in), kInputStride,
|
||||
CAST_TO_SHORTPTR(ref), kOutputStride,
|
||||
filters, filter_x, 16, filter_y, 16,
|
||||
Width(), Height(), UUT_->use_highbd_);
|
||||
}
|
||||
#else
|
||||
vpx_convolve12_c(in, kInputStride, ref, kOutputStride, filters,
|
||||
filter_x, 16, filter_y, 16, Width(), Height());
|
||||
#endif
|
||||
if (filter_x && filter_y)
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
UUT_->hv12_(in, kInputStride, out, kOutputStride, filters,
|
||||
filter_x, 16, filter_y, 16, Width(), Height()));
|
||||
else if (filter_y)
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
UUT_->v12_(in, kInputStride, out, kOutputStride, filters, 0, 16,
|
||||
filter_y, 16, Width(), Height()));
|
||||
else if (filter_x)
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
UUT_->h12_(in, kInputStride, out, kOutputStride, filters,
|
||||
filter_x, 16, 0, 16, Width(), Height()));
|
||||
else
|
||||
continue;
|
||||
|
||||
for (int y = 0; y < Height(); ++y) {
|
||||
for (int x = 0; x < Width(); ++x)
|
||||
ASSERT_EQ(lookup(ref, y * kOutputStride + x),
|
||||
lookup(out, y * kOutputStride + x))
|
||||
<< "mismatch at (" << x << "," << y << "), "
|
||||
<< "filters ("
|
||||
<< "," << filter_x << "," << filter_y << ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(ConvolveTest12Tap, DISABLED_12Tap_Speed) {
|
||||
const uint8_t *const in = input();
|
||||
uint8_t *const out = output();
|
||||
const InterpKernel12 *const twelvetap = sub_pel_filters_12;
|
||||
const int kNumTests = 5000000;
|
||||
const int width = Width();
|
||||
const int height = Height();
|
||||
vpx_usec_timer timer;
|
||||
|
||||
SetConstantInput(127);
|
||||
|
||||
vpx_usec_timer_start(&timer);
|
||||
for (int n = 0; n < kNumTests; ++n) {
|
||||
UUT_->hv12_(in, kInputStride, out, kOutputStride, twelvetap, 8, 16, 8, 16,
|
||||
width, height);
|
||||
}
|
||||
vpx_usec_timer_mark(&timer);
|
||||
|
||||
const int elapsed_time = static_cast<int>(vpx_usec_timer_elapsed(&timer));
|
||||
printf("convolve12_%dx%d_%d: %d us\n", width, height,
|
||||
UUT_->use_highbd_ ? UUT_->use_highbd_ : 8, elapsed_time);
|
||||
}
|
||||
|
||||
TEST_P(ConvolveTest12Tap, DISABLED_12Tap_Horiz_Speed) {
|
||||
const uint8_t *const in = input();
|
||||
uint8_t *const out = output();
|
||||
const InterpKernel12 *const twelvetap = sub_pel_filters_12;
|
||||
const int kNumTests = 5000000;
|
||||
const int width = Width();
|
||||
const int height = Height();
|
||||
vpx_usec_timer timer;
|
||||
|
||||
SetConstantInput(127);
|
||||
|
||||
vpx_usec_timer_start(&timer);
|
||||
for (int n = 0; n < kNumTests; ++n) {
|
||||
UUT_->h12_(in, kInputStride, out, kOutputStride, twelvetap, 8, 16, 8, 16,
|
||||
width, height);
|
||||
}
|
||||
vpx_usec_timer_mark(&timer);
|
||||
|
||||
const int elapsed_time = static_cast<int>(vpx_usec_timer_elapsed(&timer));
|
||||
printf("convolve12_horiz_%dx%d_%d: %d us\n", width, height,
|
||||
UUT_->use_highbd_ ? UUT_->use_highbd_ : 8, elapsed_time);
|
||||
}
|
||||
|
||||
TEST_P(ConvolveTest12Tap, DISABLED_12Tap_Vert_Speed) {
|
||||
const uint8_t *const in = input();
|
||||
uint8_t *const out = output();
|
||||
const InterpKernel12 *const twelvetap = sub_pel_filters_12;
|
||||
const int kNumTests = 5000000;
|
||||
const int width = Width();
|
||||
const int height = Height();
|
||||
vpx_usec_timer timer;
|
||||
|
||||
SetConstantInput(127);
|
||||
|
||||
vpx_usec_timer_start(&timer);
|
||||
for (int n = 0; n < kNumTests; ++n) {
|
||||
UUT_->v12_(in, kInputStride, out, kOutputStride, twelvetap, 8, 16, 8, 16,
|
||||
width, height);
|
||||
}
|
||||
vpx_usec_timer_mark(&timer);
|
||||
|
||||
const int elapsed_time = static_cast<int>(vpx_usec_timer_elapsed(&timer));
|
||||
printf("convolve12_vert_%dx%d_%d: %d us\n", width, height,
|
||||
UUT_->use_highbd_ ? UUT_->use_highbd_ : 8, elapsed_time);
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_P(ConvolveTest, GuardBlocks) { CheckGuardBlocks(); }
|
||||
|
||||
@@ -1135,7 +1599,7 @@ using std::make_tuple;
|
||||
x0_q4, x_step_q4, y0_q4, y_step_q4, w, h, bd); \
|
||||
}
|
||||
|
||||
#if HAVE_SSE2 && VPX_ARCH_X86_64
|
||||
#if HAVE_SSE2 && VPX_ARCH_X86_64 && HAVE_X86_ASM
|
||||
WRAP(convolve_copy_sse2, 8)
|
||||
WRAP(convolve_avg_sse2, 8)
|
||||
WRAP(convolve_copy_sse2, 10)
|
||||
@@ -1160,9 +1624,9 @@ WRAP(convolve8_vert_sse2, 12)
|
||||
WRAP(convolve8_avg_vert_sse2, 12)
|
||||
WRAP(convolve8_sse2, 12)
|
||||
WRAP(convolve8_avg_sse2, 12)
|
||||
#endif // HAVE_SSE2 && VPX_ARCH_X86_64
|
||||
#endif // HAVE_SSE2 && VPX_ARCH_X86_64 && HAVE_X86_ASM
|
||||
|
||||
#if HAVE_AVX2
|
||||
#if HAVE_AVX2 && HAVE_X86_ASM
|
||||
WRAP(convolve_copy_avx2, 8)
|
||||
WRAP(convolve_avg_avx2, 8)
|
||||
WRAP(convolve8_horiz_avx2, 8)
|
||||
@@ -1189,7 +1653,7 @@ WRAP(convolve8_vert_avx2, 12)
|
||||
WRAP(convolve8_avg_avx2, 12)
|
||||
WRAP(convolve8_avg_horiz_avx2, 12)
|
||||
WRAP(convolve8_avg_vert_avx2, 12)
|
||||
#endif // HAVE_AVX2
|
||||
#endif // HAVE_AVX2 && HAVE_X86_ASM
|
||||
|
||||
#if HAVE_NEON
|
||||
WRAP(convolve_copy_neon, 8)
|
||||
@@ -1218,6 +1682,30 @@ WRAP(convolve8_neon, 12)
|
||||
WRAP(convolve8_avg_neon, 12)
|
||||
#endif // HAVE_NEON
|
||||
|
||||
#if HAVE_SVE
|
||||
WRAP(convolve8_horiz_sve, 8)
|
||||
WRAP(convolve8_avg_horiz_sve, 8)
|
||||
WRAP(convolve8_horiz_sve, 10)
|
||||
WRAP(convolve8_avg_horiz_sve, 10)
|
||||
WRAP(convolve8_horiz_sve, 12)
|
||||
WRAP(convolve8_avg_horiz_sve, 12)
|
||||
#endif // HAVE_SVE
|
||||
|
||||
#if HAVE_SVE2
|
||||
WRAP(convolve8_sve2, 8)
|
||||
WRAP(convolve8_avg_sve2, 8)
|
||||
WRAP(convolve8_vert_sve2, 8)
|
||||
WRAP(convolve8_avg_vert_sve2, 8)
|
||||
WRAP(convolve8_sve2, 10)
|
||||
WRAP(convolve8_avg_sve2, 10)
|
||||
WRAP(convolve8_vert_sve2, 10)
|
||||
WRAP(convolve8_avg_vert_sve2, 10)
|
||||
WRAP(convolve8_sve2, 12)
|
||||
WRAP(convolve8_avg_sve2, 12)
|
||||
WRAP(convolve8_vert_sve2, 12)
|
||||
WRAP(convolve8_avg_vert_sve2, 12)
|
||||
#endif // HAVE_SVE2
|
||||
|
||||
WRAP(convolve_copy_c, 8)
|
||||
WRAP(convolve_avg_c, 8)
|
||||
WRAP(convolve8_horiz_c, 8)
|
||||
@@ -1280,9 +1768,107 @@ const ConvolveParam kArrayConvolve_c[] = { ALL_SIZES(convolve8_c) };
|
||||
#endif
|
||||
INSTANTIATE_TEST_SUITE_P(C, ConvolveTest,
|
||||
::testing::ValuesIn(kArrayConvolve_c));
|
||||
#if !CONFIG_REALTIME_ONLY && CONFIG_VP9_ENCODER
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#define WRAP12TAP(func, bd) \
|
||||
void wrap_##func##_##bd( \
|
||||
const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, \
|
||||
ptrdiff_t dst_stride, const InterpKernel12 *filter, int x0_q4, \
|
||||
int x_step_q4, int y0_q4, int y_step_q4, int w, int h) { \
|
||||
vpx_highbd_##func(reinterpret_cast<const uint16_t *>(src), src_stride, \
|
||||
reinterpret_cast<uint16_t *>(dst), dst_stride, filter, \
|
||||
x0_q4, x_step_q4, y0_q4, y_step_q4, w, h, bd); \
|
||||
}
|
||||
|
||||
#if HAVE_AVX2 && HAVE_X86_ASM
|
||||
WRAP12TAP(convolve12_horiz_avx2, 8)
|
||||
WRAP12TAP(convolve12_vert_avx2, 8)
|
||||
WRAP12TAP(convolve12_avx2, 8)
|
||||
WRAP12TAP(convolve12_horiz_avx2, 10)
|
||||
WRAP12TAP(convolve12_vert_avx2, 10)
|
||||
WRAP12TAP(convolve12_avx2, 10)
|
||||
WRAP12TAP(convolve12_horiz_avx2, 12)
|
||||
WRAP12TAP(convolve12_vert_avx2, 12)
|
||||
WRAP12TAP(convolve12_avx2, 12)
|
||||
#endif // HAVE_AVX2
|
||||
|
||||
#if HAVE_SSSE3 && HAVE_X86_ASM
|
||||
WRAP12TAP(convolve12_horiz_ssse3, 8)
|
||||
WRAP12TAP(convolve12_vert_ssse3, 8)
|
||||
WRAP12TAP(convolve12_ssse3, 8)
|
||||
WRAP12TAP(convolve12_horiz_ssse3, 10)
|
||||
WRAP12TAP(convolve12_vert_ssse3, 10)
|
||||
WRAP12TAP(convolve12_ssse3, 10)
|
||||
WRAP12TAP(convolve12_horiz_ssse3, 12)
|
||||
WRAP12TAP(convolve12_vert_ssse3, 12)
|
||||
WRAP12TAP(convolve12_ssse3, 12)
|
||||
#endif // HAVE_SSSE3 && HAVE_X86_ASM
|
||||
|
||||
#if HAVE_NEON
|
||||
WRAP12TAP(convolve12_horiz_neon, 8)
|
||||
WRAP12TAP(convolve12_vert_neon, 8)
|
||||
WRAP12TAP(convolve12_neon, 8)
|
||||
WRAP12TAP(convolve12_horiz_neon, 10)
|
||||
WRAP12TAP(convolve12_vert_neon, 10)
|
||||
WRAP12TAP(convolve12_neon, 10)
|
||||
WRAP12TAP(convolve12_horiz_neon, 12)
|
||||
WRAP12TAP(convolve12_vert_neon, 12)
|
||||
WRAP12TAP(convolve12_neon, 12)
|
||||
#endif // HAVE_NEON
|
||||
|
||||
#if HAVE_SVE2
|
||||
WRAP12TAP(convolve12_horiz_sve2, 8)
|
||||
WRAP12TAP(convolve12_vert_sve2, 8)
|
||||
WRAP12TAP(convolve12_sve2, 8)
|
||||
WRAP12TAP(convolve12_horiz_sve2, 10)
|
||||
WRAP12TAP(convolve12_vert_sve2, 10)
|
||||
WRAP12TAP(convolve12_sve2, 10)
|
||||
WRAP12TAP(convolve12_horiz_sve2, 12)
|
||||
WRAP12TAP(convolve12_vert_sve2, 12)
|
||||
WRAP12TAP(convolve12_sve2, 12)
|
||||
#endif // HAVE_SVE2
|
||||
|
||||
WRAP12TAP(convolve12_horiz_c, 8)
|
||||
WRAP12TAP(convolve12_vert_c, 8)
|
||||
WRAP12TAP(convolve12_c, 8)
|
||||
WRAP12TAP(convolve12_horiz_c, 10)
|
||||
WRAP12TAP(convolve12_vert_c, 10)
|
||||
WRAP12TAP(convolve12_c, 10)
|
||||
WRAP12TAP(convolve12_horiz_c, 12)
|
||||
WRAP12TAP(convolve12_vert_c, 12)
|
||||
WRAP12TAP(convolve12_c, 12)
|
||||
#undef WRAP12TAP
|
||||
|
||||
const ConvolveFunctions12Tap convolve12tap_8bit_c(wrap_convolve12_horiz_c_8,
|
||||
wrap_convolve12_vert_c_8,
|
||||
wrap_convolve12_c_8, 8);
|
||||
|
||||
const ConvolveFunctions12Tap convolve12tap_10bit_c(wrap_convolve12_horiz_c_10,
|
||||
wrap_convolve12_vert_c_10,
|
||||
wrap_convolve12_c_10, 10);
|
||||
|
||||
const ConvolveFunctions12Tap convolve12tap_12bit_c(wrap_convolve12_horiz_c_12,
|
||||
wrap_convolve12_vert_c_12,
|
||||
wrap_convolve12_c_12, 12);
|
||||
|
||||
const Convolve12TapParam kArrayConvolve12Tap_c[] = {
|
||||
ALL_SIZES_12TAP(convolve12tap_8bit_c), ALL_SIZES_12TAP(convolve12tap_10bit_c),
|
||||
ALL_SIZES_12TAP(convolve12tap_12bit_c)
|
||||
};
|
||||
#else
|
||||
const ConvolveFunctions12Tap convolve12Tap_c(vpx_convolve12_horiz_c,
|
||||
vpx_convolve12_vert_c,
|
||||
vpx_convolve12_c, 0);
|
||||
const Convolve12TapParam kArrayConvolve12Tap_c[] = { ALL_SIZES_12TAP(
|
||||
convolve12Tap_c) };
|
||||
#endif
|
||||
INSTANTIATE_TEST_SUITE_P(C, ConvolveTest12Tap,
|
||||
::testing::ValuesIn(kArrayConvolve12Tap_c));
|
||||
#endif
|
||||
|
||||
#if HAVE_SSE2 && VPX_ARCH_X86_64
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if HAVE_X86_ASM
|
||||
const ConvolveFunctions convolve8_sse2(
|
||||
wrap_convolve_copy_sse2_8, wrap_convolve_avg_sse2_8,
|
||||
wrap_convolve8_horiz_sse2_8, wrap_convolve8_avg_horiz_sse2_8,
|
||||
@@ -1310,6 +1896,9 @@ const ConvolveFunctions convolve12_sse2(
|
||||
const ConvolveParam kArrayConvolve_sse2[] = { ALL_SIZES(convolve8_sse2),
|
||||
ALL_SIZES(convolve10_sse2),
|
||||
ALL_SIZES(convolve12_sse2) };
|
||||
INSTANTIATE_TEST_SUITE_P(SSE2, ConvolveTest,
|
||||
::testing::ValuesIn(kArrayConvolve_sse2));
|
||||
#endif // HAVE_X86_ASM
|
||||
#else
|
||||
const ConvolveFunctions convolve8_sse2(
|
||||
vpx_convolve_copy_sse2, vpx_convolve_avg_sse2, vpx_convolve8_horiz_sse2,
|
||||
@@ -1319,12 +1908,12 @@ const ConvolveFunctions convolve8_sse2(
|
||||
vpx_scaled_avg_vert_c, vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
|
||||
|
||||
const ConvolveParam kArrayConvolve_sse2[] = { ALL_SIZES(convolve8_sse2) };
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
INSTANTIATE_TEST_SUITE_P(SSE2, ConvolveTest,
|
||||
::testing::ValuesIn(kArrayConvolve_sse2));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif
|
||||
|
||||
#if HAVE_SSSE3
|
||||
#if HAVE_SSSE3 && HAVE_X86_ASM
|
||||
const ConvolveFunctions convolve8_ssse3(
|
||||
vpx_convolve_copy_c, vpx_convolve_avg_c, vpx_convolve8_horiz_ssse3,
|
||||
vpx_convolve8_avg_horiz_ssse3, vpx_convolve8_vert_ssse3,
|
||||
@@ -1335,9 +1924,40 @@ const ConvolveFunctions convolve8_ssse3(
|
||||
const ConvolveParam kArrayConvolve8_ssse3[] = { ALL_SIZES(convolve8_ssse3) };
|
||||
INSTANTIATE_TEST_SUITE_P(SSSE3, ConvolveTest,
|
||||
::testing::ValuesIn(kArrayConvolve8_ssse3));
|
||||
#endif
|
||||
|
||||
#if HAVE_AVX2
|
||||
#if !CONFIG_REALTIME_ONLY && CONFIG_VP9_ENCODER
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
const ConvolveFunctions12Tap convolve12tap_8bit_ssse3(
|
||||
wrap_convolve12_horiz_ssse3_8, wrap_convolve12_vert_ssse3_8,
|
||||
wrap_convolve12_ssse3_8, 8);
|
||||
|
||||
const ConvolveFunctions12Tap convolve12tap_10bit_ssse3(
|
||||
wrap_convolve12_horiz_ssse3_10, wrap_convolve12_vert_ssse3_10,
|
||||
wrap_convolve12_ssse3_10, 10);
|
||||
|
||||
const ConvolveFunctions12Tap convolve12tap_12bit_ssse3(
|
||||
wrap_convolve12_horiz_ssse3_12, wrap_convolve12_vert_ssse3_12,
|
||||
wrap_convolve12_ssse3_12, 12);
|
||||
|
||||
const Convolve12TapParam kArrayConvolve12Tap_ssse3[] = {
|
||||
ALL_SIZES_12TAP(convolve12tap_8bit_ssse3),
|
||||
ALL_SIZES_12TAP(convolve12tap_10bit_ssse3),
|
||||
ALL_SIZES_12TAP(convolve12tap_12bit_ssse3)
|
||||
};
|
||||
#else
|
||||
const ConvolveFunctions12Tap convolve12_ssse3(vpx_convolve12_horiz_ssse3,
|
||||
vpx_convolve12_vert_ssse3,
|
||||
vpx_convolve12_ssse3, 0);
|
||||
const Convolve12TapParam kArrayConvolve12Tap_ssse3[] = { ALL_SIZES_12TAP(
|
||||
convolve12_ssse3) };
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(SSSE3, ConvolveTest12Tap,
|
||||
::testing::ValuesIn(kArrayConvolve12Tap_ssse3));
|
||||
#endif // !CONFIG_REALTIME_ONLY && CONFIG_VP9_ENCODER
|
||||
#endif // HAVE_SSSE3 && HAVE_X86_ASM
|
||||
|
||||
#if HAVE_AVX2 && HAVE_X86_ASM
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
const ConvolveFunctions convolve8_avx2(
|
||||
wrap_convolve_copy_avx2_8, wrap_convolve_avg_avx2_8,
|
||||
@@ -1378,7 +1998,37 @@ const ConvolveParam kArrayConvolve8_avx2[] = { ALL_SIZES(convolve8_avx2) };
|
||||
INSTANTIATE_TEST_SUITE_P(AVX2, ConvolveTest,
|
||||
::testing::ValuesIn(kArrayConvolve8_avx2));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // HAVE_AVX2
|
||||
|
||||
#if !CONFIG_REALTIME_ONLY && CONFIG_VP9_ENCODER
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
const ConvolveFunctions12Tap convolve12Tap_8bit_avx2(
|
||||
wrap_convolve12_horiz_avx2_8, wrap_convolve12_vert_avx2_8,
|
||||
wrap_convolve12_avx2_8, 8);
|
||||
|
||||
const ConvolveFunctions12Tap convolve12Tap_10bit_avx2(
|
||||
wrap_convolve12_horiz_avx2_10, wrap_convolve12_vert_avx2_10,
|
||||
wrap_convolve12_avx2_10, 10);
|
||||
|
||||
const ConvolveFunctions12Tap convolve12Tap_12bit_avx2(
|
||||
wrap_convolve12_horiz_avx2_12, wrap_convolve12_vert_avx2_12,
|
||||
wrap_convolve12_avx2_12, 12);
|
||||
|
||||
const Convolve12TapParam kArrayConvolve12Tap_avx2[] = {
|
||||
ALL_SIZES_12TAP(convolve12Tap_8bit_avx2),
|
||||
ALL_SIZES_12TAP(convolve12Tap_10bit_avx2),
|
||||
ALL_SIZES_12TAP(convolve12Tap_12bit_avx2)
|
||||
};
|
||||
#else
|
||||
const ConvolveFunctions12Tap convolve12Tap_avx2(vpx_convolve12_horiz_avx2,
|
||||
vpx_convolve12_vert_avx2,
|
||||
vpx_convolve12_avx2, 0);
|
||||
const Convolve12TapParam kArrayConvolve12Tap_avx2[] = { ALL_SIZES_12TAP(
|
||||
convolve12Tap_avx2) };
|
||||
#endif
|
||||
INSTANTIATE_TEST_SUITE_P(AVX2, ConvolveTest12Tap,
|
||||
::testing::ValuesIn(kArrayConvolve12Tap_avx2));
|
||||
#endif
|
||||
#endif // HAVE_AVX2 && HAVE_X86_ASM
|
||||
|
||||
#if HAVE_NEON
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
@@ -1421,8 +2071,182 @@ const ConvolveParam kArrayConvolve_neon[] = { ALL_SIZES(convolve8_neon) };
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
INSTANTIATE_TEST_SUITE_P(NEON, ConvolveTest,
|
||||
::testing::ValuesIn(kArrayConvolve_neon));
|
||||
|
||||
#if !CONFIG_REALTIME_ONLY && CONFIG_VP9_ENCODER
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
const ConvolveFunctions12Tap convolve12tap_8bit_neon(
|
||||
wrap_convolve12_horiz_neon_8, wrap_convolve12_vert_neon_8,
|
||||
wrap_convolve12_neon_8, 8);
|
||||
|
||||
const ConvolveFunctions12Tap convolve12tap_10bit_neon(
|
||||
wrap_convolve12_horiz_neon_10, wrap_convolve12_vert_neon_10,
|
||||
wrap_convolve12_neon_10, 10);
|
||||
|
||||
const ConvolveFunctions12Tap convolve12tap_12bit_neon(
|
||||
wrap_convolve12_horiz_neon_12, wrap_convolve12_vert_neon_12,
|
||||
wrap_convolve12_neon_12, 12);
|
||||
|
||||
const Convolve12TapParam kArrayConvolve12Tap_neon[] = {
|
||||
ALL_SIZES_12TAP(convolve12tap_8bit_neon),
|
||||
ALL_SIZES_12TAP(convolve12tap_10bit_neon),
|
||||
ALL_SIZES_12TAP(convolve12tap_12bit_neon)
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
const ConvolveFunctions12Tap convolve12Tap_neon(vpx_convolve12_horiz_neon,
|
||||
vpx_convolve12_vert_neon,
|
||||
vpx_convolve12_neon, 0);
|
||||
const Convolve12TapParam kArrayConvolve12Tap_neon[] = { ALL_SIZES_12TAP(
|
||||
convolve12Tap_neon) };
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(NEON, ConvolveTest12Tap,
|
||||
::testing::ValuesIn(kArrayConvolve12Tap_neon));
|
||||
#endif // !CONFIG_REALTIME_ONLY && CONFIG_VP9_ENCODER
|
||||
#endif // HAVE_NEON
|
||||
|
||||
#if HAVE_NEON_DOTPROD
|
||||
const ConvolveFunctions convolve8_neon_dotprod(
|
||||
vpx_convolve_copy_c, vpx_convolve_avg_c, vpx_convolve8_horiz_neon_dotprod,
|
||||
vpx_convolve8_avg_horiz_neon_dotprod, vpx_convolve8_vert_neon_dotprod,
|
||||
vpx_convolve8_avg_vert_neon_dotprod, vpx_convolve8_neon_dotprod,
|
||||
vpx_convolve8_avg_neon_dotprod, vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c,
|
||||
vpx_scaled_vert_c, vpx_scaled_avg_vert_c, vpx_scaled_2d_c,
|
||||
vpx_scaled_avg_2d_c, 0);
|
||||
|
||||
const ConvolveParam kArrayConvolve_neon_dotprod[] = { ALL_SIZES(
|
||||
convolve8_neon_dotprod) };
|
||||
INSTANTIATE_TEST_SUITE_P(NEON_DOTPROD, ConvolveTest,
|
||||
::testing::ValuesIn(kArrayConvolve_neon_dotprod));
|
||||
|
||||
#if !CONFIG_REALTIME_ONLY && CONFIG_VP9_ENCODER
|
||||
const ConvolveFunctions12Tap convolve12Tap_neon_dotprod(
|
||||
vpx_convolve12_horiz_neon_dotprod, vpx_convolve12_vert_neon_dotprod,
|
||||
vpx_convolve12_neon_dotprod, 0);
|
||||
const Convolve12TapParam kArrayConvolve12Tap_neon_dotprod[] = { ALL_SIZES_12TAP(
|
||||
convolve12Tap_neon_dotprod) };
|
||||
INSTANTIATE_TEST_SUITE_P(NEON_DOTPROD, ConvolveTest12Tap,
|
||||
::testing::ValuesIn(kArrayConvolve12Tap_neon_dotprod));
|
||||
#endif
|
||||
#endif // HAVE_NEON_DOTPROD
|
||||
|
||||
#if HAVE_SVE
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
const ConvolveFunctions convolve8_sve(
|
||||
wrap_convolve_copy_c_8, wrap_convolve_avg_c_8, wrap_convolve8_horiz_sve_8,
|
||||
wrap_convolve8_avg_horiz_sve_8, wrap_convolve8_vert_c_8,
|
||||
wrap_convolve8_avg_vert_c_8, wrap_convolve8_c_8, wrap_convolve8_avg_c_8,
|
||||
wrap_convolve8_horiz_c_8, wrap_convolve8_avg_horiz_c_8,
|
||||
wrap_convolve8_vert_c_8, wrap_convolve8_avg_vert_c_8, wrap_convolve8_c_8,
|
||||
wrap_convolve8_avg_c_8, 8);
|
||||
const ConvolveFunctions convolve10_sve(
|
||||
wrap_convolve_copy_c_10, wrap_convolve_avg_c_10,
|
||||
wrap_convolve8_horiz_sve_10, wrap_convolve8_avg_horiz_sve_10,
|
||||
wrap_convolve8_vert_c_10, wrap_convolve8_avg_vert_c_10, wrap_convolve8_c_10,
|
||||
wrap_convolve8_avg_c_10, wrap_convolve8_horiz_c_10,
|
||||
wrap_convolve8_avg_horiz_c_10, wrap_convolve8_vert_c_10,
|
||||
wrap_convolve8_avg_vert_c_10, wrap_convolve8_c_10, wrap_convolve8_avg_c_10,
|
||||
10);
|
||||
const ConvolveFunctions convolve12_sve(
|
||||
wrap_convolve_copy_c_12, wrap_convolve_avg_c_12,
|
||||
wrap_convolve8_horiz_sve_12, wrap_convolve8_avg_horiz_sve_12,
|
||||
wrap_convolve8_vert_c_12, wrap_convolve8_avg_vert_c_12, wrap_convolve8_c_12,
|
||||
wrap_convolve8_avg_c_12, wrap_convolve8_horiz_c_12,
|
||||
wrap_convolve8_avg_horiz_c_12, wrap_convolve8_vert_c_12,
|
||||
wrap_convolve8_avg_vert_c_12, wrap_convolve8_c_12, wrap_convolve8_avg_c_12,
|
||||
12);
|
||||
|
||||
const ConvolveParam kArrayConvolve_sve[] = { ALL_SIZES(convolve8_sve),
|
||||
ALL_SIZES(convolve10_sve),
|
||||
ALL_SIZES(convolve12_sve) };
|
||||
INSTANTIATE_TEST_SUITE_P(SVE, ConvolveTest,
|
||||
::testing::ValuesIn(kArrayConvolve_sve));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // HAVE_SVE
|
||||
|
||||
#if HAVE_SVE2
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
const ConvolveFunctions convolve8_sve2(
|
||||
wrap_convolve_copy_c_8, wrap_convolve_avg_c_8, wrap_convolve8_horiz_c_8,
|
||||
wrap_convolve8_avg_horiz_c_8, wrap_convolve8_vert_sve2_8,
|
||||
wrap_convolve8_avg_vert_sve2_8, wrap_convolve8_sve2_8,
|
||||
wrap_convolve8_avg_sve2_8, wrap_convolve8_horiz_c_8,
|
||||
wrap_convolve8_avg_horiz_c_8, wrap_convolve8_vert_c_8,
|
||||
wrap_convolve8_avg_vert_c_8, wrap_convolve8_c_8, wrap_convolve8_avg_c_8, 8);
|
||||
const ConvolveFunctions convolve10_sve2(
|
||||
wrap_convolve_copy_c_10, wrap_convolve_avg_c_10, wrap_convolve8_horiz_c_10,
|
||||
wrap_convolve8_avg_horiz_c_10, wrap_convolve8_vert_sve2_10,
|
||||
wrap_convolve8_avg_vert_sve2_10, wrap_convolve8_sve2_10,
|
||||
wrap_convolve8_avg_sve2_10, wrap_convolve8_horiz_c_10,
|
||||
wrap_convolve8_avg_horiz_c_10, wrap_convolve8_vert_c_10,
|
||||
wrap_convolve8_avg_vert_c_10, wrap_convolve8_c_10, wrap_convolve8_avg_c_10,
|
||||
10);
|
||||
const ConvolveFunctions convolve12_sve2(
|
||||
wrap_convolve_copy_c_12, wrap_convolve_avg_c_12, wrap_convolve8_horiz_c_12,
|
||||
wrap_convolve8_avg_horiz_c_12, wrap_convolve8_vert_sve2_12,
|
||||
wrap_convolve8_avg_vert_sve2_12, wrap_convolve8_sve2_12,
|
||||
wrap_convolve8_avg_sve2_12, wrap_convolve8_horiz_c_12,
|
||||
wrap_convolve8_avg_horiz_c_12, wrap_convolve8_vert_c_12,
|
||||
wrap_convolve8_avg_vert_c_12, wrap_convolve8_c_12, wrap_convolve8_avg_c_12,
|
||||
12);
|
||||
|
||||
const ConvolveParam kArrayConvolve_sve2[] = { ALL_SIZES(convolve8_sve2),
|
||||
ALL_SIZES(convolve10_sve2),
|
||||
ALL_SIZES(convolve12_sve2) };
|
||||
INSTANTIATE_TEST_SUITE_P(SVE2, ConvolveTest,
|
||||
::testing::ValuesIn(kArrayConvolve_sve2));
|
||||
|
||||
#if !CONFIG_REALTIME_ONLY && CONFIG_VP9_ENCODER
|
||||
const ConvolveFunctions12Tap convolve12tap_8bit_sve2(
|
||||
wrap_convolve12_horiz_sve2_8, wrap_convolve12_vert_sve2_8,
|
||||
wrap_convolve12_sve2_8, 8);
|
||||
|
||||
const ConvolveFunctions12Tap convolve12tap_10bit_sve2(
|
||||
wrap_convolve12_horiz_sve2_10, wrap_convolve12_vert_sve2_10,
|
||||
wrap_convolve12_sve2_10, 10);
|
||||
|
||||
const ConvolveFunctions12Tap convolve12tap_12bit_sve2(
|
||||
wrap_convolve12_horiz_sve2_12, wrap_convolve12_vert_sve2_12,
|
||||
wrap_convolve12_sve2_12, 12);
|
||||
|
||||
const Convolve12TapParam kArrayConvolve12Tap_sve2[] = {
|
||||
ALL_SIZES_12TAP(convolve12tap_8bit_sve2),
|
||||
ALL_SIZES_12TAP(convolve12tap_10bit_sve2),
|
||||
ALL_SIZES_12TAP(convolve12tap_12bit_sve2)
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(SVE2, ConvolveTest12Tap,
|
||||
::testing::ValuesIn(kArrayConvolve12Tap_sve2));
|
||||
#endif // !CONFIG_REALTIME_ONLY && CONFIG_VP9_ENCODER
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // HAVE_SVE2
|
||||
|
||||
#if HAVE_NEON_I8MM
|
||||
const ConvolveFunctions convolve8_neon_i8mm(
|
||||
vpx_convolve_copy_c, vpx_convolve_avg_c, vpx_convolve8_horiz_neon_i8mm,
|
||||
vpx_convolve8_avg_horiz_neon_i8mm, vpx_convolve8_vert_neon_i8mm,
|
||||
vpx_convolve8_avg_vert_neon_i8mm, vpx_convolve8_neon_i8mm,
|
||||
vpx_convolve8_avg_neon_i8mm, vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c,
|
||||
vpx_scaled_vert_c, vpx_scaled_avg_vert_c, vpx_scaled_2d_c,
|
||||
vpx_scaled_avg_2d_c, 0);
|
||||
|
||||
const ConvolveParam kArrayConvolve_neon_i8mm[] = { ALL_SIZES(
|
||||
convolve8_neon_i8mm) };
|
||||
INSTANTIATE_TEST_SUITE_P(NEON_I8MM, ConvolveTest,
|
||||
::testing::ValuesIn(kArrayConvolve_neon_i8mm));
|
||||
|
||||
#if !CONFIG_REALTIME_ONLY && CONFIG_VP9_ENCODER
|
||||
const ConvolveFunctions12Tap convolve12Tap_neon_i8mm(
|
||||
vpx_convolve12_horiz_neon_i8mm, vpx_convolve12_vert_neon_i8mm,
|
||||
vpx_convolve12_neon_i8mm, 0);
|
||||
const Convolve12TapParam kArrayConvolve12Tap_neon_i8mm[] = { ALL_SIZES_12TAP(
|
||||
convolve12Tap_neon_i8mm) };
|
||||
INSTANTIATE_TEST_SUITE_P(NEON_I8MM, ConvolveTest12Tap,
|
||||
::testing::ValuesIn(kArrayConvolve12Tap_neon_i8mm));
|
||||
#endif
|
||||
#endif // HAVE_NEON_I8MM
|
||||
|
||||
#if HAVE_DSPR2
|
||||
const ConvolveFunctions convolve8_dspr2(
|
||||
vpx_convolve_copy_dspr2, vpx_convolve_avg_dspr2, vpx_convolve8_horiz_dspr2,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/encode_test_driver.h"
|
||||
#include "test/i420_video_source.h"
|
||||
@@ -26,9 +26,9 @@ class CpuSpeedTest
|
||||
: EncoderTest(GET_PARAM(0)), encoding_mode_(GET_PARAM(1)),
|
||||
set_cpu_used_(GET_PARAM(2)), min_psnr_(kMaxPSNR),
|
||||
tune_content_(VP9E_CONTENT_DEFAULT) {}
|
||||
virtual ~CpuSpeedTest() {}
|
||||
~CpuSpeedTest() override = default;
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
InitializeConfig();
|
||||
SetMode(encoding_mode_);
|
||||
if (encoding_mode_ != ::libvpx_test::kRealTime) {
|
||||
@@ -40,10 +40,10 @@ class CpuSpeedTest
|
||||
}
|
||||
}
|
||||
|
||||
virtual void BeginPassHook(unsigned int /*pass*/) { min_psnr_ = kMaxPSNR; }
|
||||
void BeginPassHook(unsigned int /*pass*/) override { min_psnr_ = kMaxPSNR; }
|
||||
|
||||
virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) {
|
||||
void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) override {
|
||||
if (video->frame() == 0) {
|
||||
encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);
|
||||
encoder->Control(VP9E_SET_TUNE_CONTENT, tune_content_);
|
||||
@@ -56,7 +56,7 @@ class CpuSpeedTest
|
||||
}
|
||||
}
|
||||
|
||||
virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) override {
|
||||
if (pkt->data.psnr.psnr[0] < min_psnr_) min_psnr_ = pkt->data.psnr.psnr[0];
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ TEST_P(CpuSpeedTest, TestTuneScreen) {
|
||||
::libvpx_test::Y4mVideoSource video("screendata.y4m", 0, 25);
|
||||
cfg_.g_timebase = video.timebase();
|
||||
cfg_.rc_2pass_vbr_minsection_pct = 5;
|
||||
cfg_.rc_2pass_vbr_minsection_pct = 2000;
|
||||
cfg_.rc_2pass_vbr_maxsection_pct = 2000;
|
||||
cfg_.rc_target_bitrate = 2000;
|
||||
cfg_.rc_max_quantizer = 63;
|
||||
cfg_.rc_min_quantizer = 0;
|
||||
@@ -148,9 +148,6 @@ TEST_P(CpuSpeedTest, TestLowBitrate) {
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
}
|
||||
|
||||
VP9_INSTANTIATE_TEST_SUITE(CpuSpeedTest,
|
||||
::testing::Values(::libvpx_test::kTwoPassGood,
|
||||
::libvpx_test::kOnePassGood,
|
||||
::libvpx_test::kRealTime),
|
||||
VP9_INSTANTIATE_TEST_SUITE(CpuSpeedTest, ONE_PASS_TEST_MODES,
|
||||
::testing::Range(0, 10));
|
||||
} // namespace
|
||||
@@ -9,11 +9,12 @@
|
||||
*/
|
||||
#include <cmath>
|
||||
#include <map>
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/encode_test_driver.h"
|
||||
#include "test/i420_video_source.h"
|
||||
#include "test/util.h"
|
||||
#include "vpx_config.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -27,7 +28,7 @@ class CQTest : public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<int> {
|
||||
public:
|
||||
// maps the cqlevel to the bitrate produced.
|
||||
typedef std::map<int, uint32_t> BitrateMap;
|
||||
using BitrateMap = std::map<int, uint32_t>;
|
||||
|
||||
static void SetUpTestSuite() { bitrates_.clear(); }
|
||||
|
||||
@@ -50,21 +51,21 @@ class CQTest : public ::libvpx_test::EncoderTest,
|
||||
init_flags_ = VPX_CODEC_USE_PSNR;
|
||||
}
|
||||
|
||||
virtual ~CQTest() {}
|
||||
~CQTest() override = default;
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
InitializeConfig();
|
||||
SetMode(libvpx_test::kTwoPassGood);
|
||||
}
|
||||
|
||||
virtual void BeginPassHook(unsigned int /*pass*/) {
|
||||
void BeginPassHook(unsigned int /*pass*/) override {
|
||||
file_size_ = 0;
|
||||
psnr_ = 0.0;
|
||||
n_frames_ = 0;
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
|
||||
libvpx_test::Encoder *encoder) {
|
||||
void PreEncodeFrameHook(libvpx_test::VideoSource *video,
|
||||
libvpx_test::Encoder *encoder) override {
|
||||
if (video->frame() == 0) {
|
||||
if (cfg_.rc_end_usage == VPX_CQ) {
|
||||
encoder->Control(VP8E_SET_CQ_LEVEL, cq_level_);
|
||||
@@ -73,12 +74,12 @@ class CQTest : public ::libvpx_test::EncoderTest,
|
||||
}
|
||||
}
|
||||
|
||||
virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) override {
|
||||
psnr_ += pow(10.0, pkt->data.psnr.psnr[0] / 10.0);
|
||||
n_frames_++;
|
||||
}
|
||||
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
|
||||
file_size_ += pkt->data.frame.sz;
|
||||
}
|
||||
|
||||
@@ -103,6 +104,10 @@ class CQTest : public ::libvpx_test::EncoderTest,
|
||||
CQTest::BitrateMap CQTest::bitrates_;
|
||||
|
||||
TEST_P(CQTest, LinearPSNRIsHigherForCQLevel) {
|
||||
#if CONFIG_REALTIME_ONLY
|
||||
GTEST_SKIP()
|
||||
<< "Non-zero g_lag_in_frames is unsupported with CONFIG_REALTIME_ONLY";
|
||||
#else
|
||||
const vpx_rational timebase = { 33333333, 1000000000 };
|
||||
cfg_.g_timebase = timebase;
|
||||
cfg_.rc_target_bitrate = kCQTargetBitrate;
|
||||
@@ -124,6 +129,7 @@ TEST_P(CQTest, LinearPSNRIsHigherForCQLevel) {
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
const double vbr_psnr_lin = GetLinearPSNROverBitrate();
|
||||
EXPECT_GE(cq_psnr_lin, vbr_psnr_lin);
|
||||
#endif // CONFIG_REALTIME_ONLY
|
||||
}
|
||||
|
||||
VP8_INSTANTIATE_TEST_SUITE(CQTest, ::testing::Range(kCQLevelMin, kCQLevelMax,
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <string.h>
|
||||
#include <tuple>
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "./vp9_rtcd.h"
|
||||
#include "./vpx_dsp_rtcd.h"
|
||||
@@ -25,8 +25,9 @@
|
||||
#include "vp9/common/vp9_scan.h"
|
||||
#include "vpx/vpx_codec.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
#include "vpx_config.h"
|
||||
#include "vpx_ports/mem.h"
|
||||
#include "vpx_ports/msvc.h" // for round()
|
||||
#include "vpx_ports/vpx_timer.h"
|
||||
|
||||
using libvpx_test::ACMRandom;
|
||||
|
||||
@@ -223,16 +224,16 @@ void reference_16x16_dct_2d(int16_t input[256], double output[256]) {
|
||||
}
|
||||
}
|
||||
|
||||
typedef void (*FdctFunc)(const int16_t *in, tran_low_t *out, int stride);
|
||||
typedef void (*IdctFunc)(const tran_low_t *in, uint8_t *out, int stride);
|
||||
typedef void (*FhtFunc)(const int16_t *in, tran_low_t *out, int stride,
|
||||
int tx_type);
|
||||
typedef void (*IhtFunc)(const tran_low_t *in, uint8_t *out, int stride,
|
||||
int tx_type);
|
||||
using FdctFunc = void (*)(const int16_t *in, tran_low_t *out, int stride);
|
||||
using IdctFunc = void (*)(const tran_low_t *in, uint8_t *out, int stride);
|
||||
using FhtFunc = void (*)(const int16_t *in, tran_low_t *out, int stride,
|
||||
int tx_type);
|
||||
using IhtFunc = void (*)(const tran_low_t *in, uint8_t *out, int stride,
|
||||
int tx_type);
|
||||
|
||||
typedef std::tuple<FdctFunc, IdctFunc, int, vpx_bit_depth_t> Dct16x16Param;
|
||||
typedef std::tuple<FhtFunc, IhtFunc, int, vpx_bit_depth_t> Ht16x16Param;
|
||||
typedef std::tuple<IdctFunc, IdctFunc, int, vpx_bit_depth_t> Idct16x16Param;
|
||||
using Dct16x16Param = std::tuple<FdctFunc, IdctFunc, int, vpx_bit_depth_t>;
|
||||
using Ht16x16Param = std::tuple<FhtFunc, IhtFunc, int, vpx_bit_depth_t>;
|
||||
using Idct16x16Param = std::tuple<IdctFunc, IdctFunc, int, vpx_bit_depth_t>;
|
||||
|
||||
void fdct16x16_ref(const int16_t *in, tran_low_t *out, int stride,
|
||||
int /*tx_type*/) {
|
||||
@@ -309,7 +310,7 @@ void idct16x16_10_add_12_sse2(const tran_low_t *in, uint8_t *out, int stride) {
|
||||
|
||||
class Trans16x16TestBase {
|
||||
public:
|
||||
virtual ~Trans16x16TestBase() {}
|
||||
virtual ~Trans16x16TestBase() = default;
|
||||
|
||||
protected:
|
||||
virtual void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) = 0;
|
||||
@@ -548,12 +549,50 @@ class Trans16x16TestBase {
|
||||
}
|
||||
}
|
||||
|
||||
void RunSpeedTest() {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
const int count_test_block = 10000;
|
||||
int c_sum_time = 0;
|
||||
int simd_sum_time = 0;
|
||||
|
||||
DECLARE_ALIGNED(32, int16_t, input_block[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(32, tran_low_t, output_ref_block[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(32, tran_low_t, output_block[kNumCoeffs]);
|
||||
|
||||
// Initialize a test block with input range [-mask_, mask_].
|
||||
for (int j = 0; j < kNumCoeffs; ++j) {
|
||||
input_block[j] = (rnd.Rand16() & mask_) - (rnd.Rand16() & mask_);
|
||||
}
|
||||
|
||||
vpx_usec_timer timer_c;
|
||||
vpx_usec_timer_start(&timer_c);
|
||||
for (int i = 0; i < count_test_block; ++i) {
|
||||
vpx_fdct16x16_c(input_block, output_ref_block, pitch_);
|
||||
}
|
||||
vpx_usec_timer_mark(&timer_c);
|
||||
c_sum_time += static_cast<int>(vpx_usec_timer_elapsed(&timer_c));
|
||||
|
||||
vpx_usec_timer timer_mod;
|
||||
vpx_usec_timer_start(&timer_mod);
|
||||
for (int i = 0; i < count_test_block; ++i) {
|
||||
RunFwdTxfm(input_block, output_block, pitch_);
|
||||
}
|
||||
|
||||
vpx_usec_timer_mark(&timer_mod);
|
||||
simd_sum_time += static_cast<int>(vpx_usec_timer_elapsed(&timer_mod));
|
||||
|
||||
printf(
|
||||
"c_time = %d \t simd_time = %d \t Gain = %4.2f \n", c_sum_time,
|
||||
simd_sum_time,
|
||||
(static_cast<float>(c_sum_time) / static_cast<float>(simd_sum_time)));
|
||||
}
|
||||
|
||||
void CompareInvReference(IdctFunc ref_txfm, int thresh) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
const int count_test_block = 10000;
|
||||
const int eob = 10;
|
||||
const int16_t *scan = vp9_default_scan_orders[TX_16X16].scan;
|
||||
DECLARE_ALIGNED(16, tran_low_t, coeff[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(32, tran_low_t, coeff[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint8_t, ref[kNumCoeffs]);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
@@ -604,6 +643,80 @@ class Trans16x16TestBase {
|
||||
}
|
||||
}
|
||||
|
||||
void RunInvTrans16x16SpeedTest(IdctFunc ref_txfm, int thresh) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
const int count_test_block = 10000;
|
||||
const int eob = 10;
|
||||
const int16_t *scan = vp9_default_scan_orders[TX_16X16].scan;
|
||||
int64_t c_sum_time = 0;
|
||||
int64_t simd_sum_time = 0;
|
||||
DECLARE_ALIGNED(32, tran_low_t, coeff[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint8_t, ref[kNumCoeffs]);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
DECLARE_ALIGNED(16, uint16_t, dst16[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint16_t, ref16[kNumCoeffs]);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
|
||||
for (int j = 0; j < kNumCoeffs; ++j) {
|
||||
if (j < eob) {
|
||||
// Random values less than the threshold, either positive or negative
|
||||
coeff[scan[j]] = rnd(thresh);
|
||||
} else {
|
||||
coeff[scan[j]] = 0;
|
||||
}
|
||||
if (bit_depth_ == VPX_BITS_8) {
|
||||
dst[j] = 0;
|
||||
ref[j] = 0;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
} else {
|
||||
dst16[j] = 0;
|
||||
ref16[j] = 0;
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
}
|
||||
}
|
||||
|
||||
if (bit_depth_ == VPX_BITS_8) {
|
||||
vpx_usec_timer timer_c;
|
||||
vpx_usec_timer_start(&timer_c);
|
||||
for (int i = 0; i < count_test_block; ++i) {
|
||||
ref_txfm(coeff, ref, pitch_);
|
||||
}
|
||||
vpx_usec_timer_mark(&timer_c);
|
||||
c_sum_time += vpx_usec_timer_elapsed(&timer_c);
|
||||
|
||||
vpx_usec_timer timer_mod;
|
||||
vpx_usec_timer_start(&timer_mod);
|
||||
for (int i = 0; i < count_test_block; ++i) {
|
||||
RunInvTxfm(coeff, dst, pitch_);
|
||||
}
|
||||
vpx_usec_timer_mark(&timer_mod);
|
||||
simd_sum_time += vpx_usec_timer_elapsed(&timer_mod);
|
||||
} else {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
vpx_usec_timer timer_c;
|
||||
vpx_usec_timer_start(&timer_c);
|
||||
for (int i = 0; i < count_test_block; ++i) {
|
||||
ref_txfm(coeff, CAST_TO_BYTEPTR(ref16), pitch_);
|
||||
}
|
||||
vpx_usec_timer_mark(&timer_c);
|
||||
c_sum_time += vpx_usec_timer_elapsed(&timer_c);
|
||||
|
||||
vpx_usec_timer timer_mod;
|
||||
vpx_usec_timer_start(&timer_mod);
|
||||
for (int i = 0; i < count_test_block; ++i) {
|
||||
RunInvTxfm(coeff, CAST_TO_BYTEPTR(dst16), pitch_);
|
||||
}
|
||||
vpx_usec_timer_mark(&timer_mod);
|
||||
simd_sum_time += vpx_usec_timer_elapsed(&timer_mod);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
}
|
||||
printf(
|
||||
"c_time = %" PRId64 " \t simd_time = %" PRId64 " \t Gain = %4.2f \n",
|
||||
c_sum_time, simd_sum_time,
|
||||
(static_cast<float>(c_sum_time) / static_cast<float>(simd_sum_time)));
|
||||
}
|
||||
|
||||
int pitch_;
|
||||
int tx_type_;
|
||||
vpx_bit_depth_t bit_depth_;
|
||||
@@ -615,9 +728,9 @@ class Trans16x16TestBase {
|
||||
class Trans16x16DCT : public Trans16x16TestBase,
|
||||
public ::testing::TestWithParam<Dct16x16Param> {
|
||||
public:
|
||||
virtual ~Trans16x16DCT() {}
|
||||
~Trans16x16DCT() override = default;
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
fwd_txfm_ = GET_PARAM(0);
|
||||
inv_txfm_ = GET_PARAM(1);
|
||||
tx_type_ = GET_PARAM(2);
|
||||
@@ -636,13 +749,13 @@ class Trans16x16DCT : public Trans16x16TestBase,
|
||||
inv_txfm_ref = idct16x16_ref;
|
||||
#endif
|
||||
}
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
void TearDown() override { libvpx_test::ClearSystemState(); }
|
||||
|
||||
protected:
|
||||
void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) {
|
||||
void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) override {
|
||||
fwd_txfm_(in, out, stride);
|
||||
}
|
||||
void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
|
||||
void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) override {
|
||||
inv_txfm_(out, dst, stride);
|
||||
}
|
||||
|
||||
@@ -664,12 +777,14 @@ TEST_P(Trans16x16DCT, QuantCheck) {
|
||||
|
||||
TEST_P(Trans16x16DCT, InvAccuracyCheck) { RunInvAccuracyCheck(); }
|
||||
|
||||
TEST_P(Trans16x16DCT, DISABLED_Speed) { RunSpeedTest(); }
|
||||
|
||||
class Trans16x16HT : public Trans16x16TestBase,
|
||||
public ::testing::TestWithParam<Ht16x16Param> {
|
||||
public:
|
||||
virtual ~Trans16x16HT() {}
|
||||
~Trans16x16HT() override = default;
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
fwd_txfm_ = GET_PARAM(0);
|
||||
inv_txfm_ = GET_PARAM(1);
|
||||
tx_type_ = GET_PARAM(2);
|
||||
@@ -688,13 +803,13 @@ class Trans16x16HT : public Trans16x16TestBase,
|
||||
inv_txfm_ref = iht16x16_ref;
|
||||
#endif
|
||||
}
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
void TearDown() override { libvpx_test::ClearSystemState(); }
|
||||
|
||||
protected:
|
||||
void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) {
|
||||
void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) override {
|
||||
fwd_txfm_(in, out, stride, tx_type_);
|
||||
}
|
||||
void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
|
||||
void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) override {
|
||||
inv_txfm_(out, dst, stride, tx_type_);
|
||||
}
|
||||
|
||||
@@ -714,13 +829,12 @@ TEST_P(Trans16x16HT, QuantCheck) {
|
||||
RunQuantCheck(429, 729);
|
||||
}
|
||||
|
||||
#if HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
class InvTrans16x16DCT : public Trans16x16TestBase,
|
||||
public ::testing::TestWithParam<Idct16x16Param> {
|
||||
public:
|
||||
virtual ~InvTrans16x16DCT() {}
|
||||
~InvTrans16x16DCT() override = default;
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
ref_txfm_ = GET_PARAM(0);
|
||||
inv_txfm_ = GET_PARAM(1);
|
||||
thresh_ = GET_PARAM(2);
|
||||
@@ -728,11 +842,12 @@ class InvTrans16x16DCT : public Trans16x16TestBase,
|
||||
pitch_ = 16;
|
||||
mask_ = (1 << bit_depth_) - 1;
|
||||
}
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
void TearDown() override { libvpx_test::ClearSystemState(); }
|
||||
|
||||
protected:
|
||||
void RunFwdTxfm(int16_t * /*in*/, tran_low_t * /*out*/, int /*stride*/) {}
|
||||
void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
|
||||
void RunFwdTxfm(int16_t * /*in*/, tran_low_t * /*out*/,
|
||||
int /*stride*/) override {}
|
||||
void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) override {
|
||||
inv_txfm_(out, dst, stride);
|
||||
}
|
||||
|
||||
@@ -745,7 +860,10 @@ GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(InvTrans16x16DCT);
|
||||
TEST_P(InvTrans16x16DCT, CompareReference) {
|
||||
CompareInvReference(ref_txfm_, thresh_);
|
||||
}
|
||||
#endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
TEST_P(InvTrans16x16DCT, DISABLED_Speed) {
|
||||
RunInvTrans16x16SpeedTest(ref_txfm_, thresh_);
|
||||
}
|
||||
|
||||
using std::make_tuple;
|
||||
|
||||
@@ -787,15 +905,31 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 1, 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)));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(C, InvTrans16x16DCT,
|
||||
::testing::Values(make_tuple(&vpx_idct16x16_256_add_c,
|
||||
&vpx_idct16x16_256_add_c,
|
||||
6225, VPX_BITS_8)));
|
||||
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
|
||||
#if HAVE_NEON && !CONFIG_EMULATE_HARDWARE
|
||||
#if HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
NEON, Trans16x16DCT,
|
||||
::testing::Values(make_tuple(&vpx_fdct16x16_neon,
|
||||
&vpx_idct16x16_256_add_neon, 0, VPX_BITS_8)));
|
||||
#endif // HAVE_NEON && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
#if HAVE_NEON && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
NEON, Trans16x16DCT,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_highbd_fdct16x16_neon, &idct16x16_10, 0, VPX_BITS_10),
|
||||
make_tuple(&vpx_highbd_fdct16x16_neon, &idct16x16_12, 0, VPX_BITS_12),
|
||||
make_tuple(&vpx_fdct16x16_neon, &vpx_idct16x16_256_add_c, 0,
|
||||
VPX_BITS_8)));
|
||||
#endif // HAVE_NEON && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
SSE2, Trans16x16DCT,
|
||||
@@ -811,8 +945,25 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
2, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2,
|
||||
3, VPX_BITS_8)));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(SSE2, InvTrans16x16DCT,
|
||||
::testing::Values(make_tuple(
|
||||
&vpx_idct16x16_256_add_c,
|
||||
&vpx_idct16x16_256_add_sse2, 6225, VPX_BITS_8)));
|
||||
#endif // HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
#if HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
AVX2, Trans16x16DCT,
|
||||
::testing::Values(make_tuple(&vpx_fdct16x16_avx2,
|
||||
&vpx_idct16x16_256_add_sse2, 0, VPX_BITS_8)));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(AVX2, InvTrans16x16DCT,
|
||||
::testing::Values(make_tuple(
|
||||
&vpx_idct16x16_256_add_c,
|
||||
&vpx_idct16x16_256_add_avx2, 6225, VPX_BITS_8)));
|
||||
#endif // HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
#if HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
SSE2, Trans16x16DCT,
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <string.h>
|
||||
#include <tuple>
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "./vp9_rtcd.h"
|
||||
#include "./vpx_config.h"
|
||||
@@ -24,10 +24,11 @@
|
||||
#include "test/register_state_check.h"
|
||||
#include "test/util.h"
|
||||
#include "vp9/common/vp9_entropy.h"
|
||||
#include "vp9/common/vp9_scan.h"
|
||||
#include "vpx/vpx_codec.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
#include "vpx_ports/mem.h"
|
||||
#include "vpx_ports/msvc.h" // for round()
|
||||
#include "vpx_ports/vpx_timer.h"
|
||||
|
||||
using libvpx_test::ACMRandom;
|
||||
|
||||
@@ -65,11 +66,14 @@ void reference_32x32_dct_2d(const int16_t input[kNumCoeffs],
|
||||
}
|
||||
}
|
||||
|
||||
typedef void (*FwdTxfmFunc)(const int16_t *in, tran_low_t *out, int stride);
|
||||
typedef void (*InvTxfmFunc)(const tran_low_t *in, uint8_t *out, int stride);
|
||||
using FwdTxfmFunc = void (*)(const int16_t *in, tran_low_t *out, int stride);
|
||||
using InvTxfmFunc = void (*)(const tran_low_t *in, uint8_t *out, int stride);
|
||||
|
||||
typedef std::tuple<FwdTxfmFunc, InvTxfmFunc, int, vpx_bit_depth_t>
|
||||
Trans32x32Param;
|
||||
using Trans32x32Param =
|
||||
std::tuple<FwdTxfmFunc, InvTxfmFunc, int, vpx_bit_depth_t>;
|
||||
|
||||
using InvTrans32x32Param =
|
||||
std::tuple<InvTxfmFunc, InvTxfmFunc, int, vpx_bit_depth_t, int, int>;
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
void idct32x32_10(const tran_low_t *in, uint8_t *out, int stride) {
|
||||
@@ -84,8 +88,8 @@ void idct32x32_12(const tran_low_t *in, uint8_t *out, int stride) {
|
||||
class Trans32x32Test : public AbstractBench,
|
||||
public ::testing::TestWithParam<Trans32x32Param> {
|
||||
public:
|
||||
virtual ~Trans32x32Test() {}
|
||||
virtual void SetUp() {
|
||||
~Trans32x32Test() override = default;
|
||||
void SetUp() override {
|
||||
fwd_txfm_ = GET_PARAM(0);
|
||||
inv_txfm_ = GET_PARAM(1);
|
||||
version_ = GET_PARAM(2); // 0: high precision forward transform
|
||||
@@ -94,7 +98,7 @@ class Trans32x32Test : public AbstractBench,
|
||||
mask_ = (1 << bit_depth_) - 1;
|
||||
}
|
||||
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
void TearDown() override { libvpx_test::ClearSystemState(); }
|
||||
|
||||
protected:
|
||||
int version_;
|
||||
@@ -105,7 +109,7 @@ class Trans32x32Test : public AbstractBench,
|
||||
|
||||
int16_t *bench_in_;
|
||||
tran_low_t *bench_out_;
|
||||
virtual void Run();
|
||||
void Run() override;
|
||||
};
|
||||
|
||||
void Trans32x32Test::Run() { fwd_txfm_(bench_in_, bench_out_, 32); }
|
||||
@@ -314,6 +318,174 @@ TEST_P(Trans32x32Test, InverseAccuracy) {
|
||||
}
|
||||
}
|
||||
|
||||
class InvTrans32x32Test : public ::testing::TestWithParam<InvTrans32x32Param> {
|
||||
public:
|
||||
~InvTrans32x32Test() override = default;
|
||||
void SetUp() override {
|
||||
ref_txfm_ = GET_PARAM(0);
|
||||
inv_txfm_ = GET_PARAM(1);
|
||||
version_ = GET_PARAM(2); // 0: high precision forward transform
|
||||
// 1: low precision version for rd loop
|
||||
bit_depth_ = GET_PARAM(3);
|
||||
eob_ = GET_PARAM(4);
|
||||
thresh_ = GET_PARAM(4);
|
||||
mask_ = (1 << bit_depth_) - 1;
|
||||
pitch_ = 32;
|
||||
}
|
||||
|
||||
void TearDown() override { libvpx_test::ClearSystemState(); }
|
||||
|
||||
protected:
|
||||
void RunRefTxfm(tran_low_t *out, uint8_t *dst, int stride) {
|
||||
ref_txfm_(out, dst, stride);
|
||||
}
|
||||
void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
|
||||
inv_txfm_(out, dst, stride);
|
||||
}
|
||||
int version_;
|
||||
vpx_bit_depth_t bit_depth_;
|
||||
int mask_;
|
||||
int eob_;
|
||||
int thresh_;
|
||||
|
||||
InvTxfmFunc ref_txfm_;
|
||||
InvTxfmFunc inv_txfm_;
|
||||
int pitch_;
|
||||
|
||||
void RunInvTrans32x32SpeedTest() {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
const int count_test_block = 10000;
|
||||
int64_t c_sum_time = 0;
|
||||
int64_t simd_sum_time = 0;
|
||||
const int16_t *scan = vp9_default_scan_orders[TX_32X32].scan;
|
||||
DECLARE_ALIGNED(32, tran_low_t, coeff[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint8_t, ref[kNumCoeffs]);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
DECLARE_ALIGNED(16, uint16_t, dst16[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint16_t, ref16[kNumCoeffs]);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
|
||||
for (int j = 0; j < kNumCoeffs; ++j) {
|
||||
if (j < eob_) {
|
||||
// Random values less than the threshold, either positive or negative
|
||||
coeff[scan[j]] = rnd(thresh_);
|
||||
} else {
|
||||
coeff[scan[j]] = 0;
|
||||
}
|
||||
if (bit_depth_ == VPX_BITS_8) {
|
||||
dst[j] = 0;
|
||||
ref[j] = 0;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
} else {
|
||||
dst16[j] = 0;
|
||||
ref16[j] = 0;
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
}
|
||||
}
|
||||
|
||||
if (bit_depth_ == VPX_BITS_8) {
|
||||
vpx_usec_timer timer_c;
|
||||
vpx_usec_timer_start(&timer_c);
|
||||
for (int i = 0; i < count_test_block; ++i) {
|
||||
RunRefTxfm(coeff, ref, pitch_);
|
||||
}
|
||||
vpx_usec_timer_mark(&timer_c);
|
||||
c_sum_time += vpx_usec_timer_elapsed(&timer_c);
|
||||
|
||||
vpx_usec_timer timer_mod;
|
||||
vpx_usec_timer_start(&timer_mod);
|
||||
for (int i = 0; i < count_test_block; ++i) {
|
||||
RunInvTxfm(coeff, dst, pitch_);
|
||||
}
|
||||
vpx_usec_timer_mark(&timer_mod);
|
||||
simd_sum_time += vpx_usec_timer_elapsed(&timer_mod);
|
||||
} else {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
vpx_usec_timer timer_c;
|
||||
vpx_usec_timer_start(&timer_c);
|
||||
for (int i = 0; i < count_test_block; ++i) {
|
||||
RunRefTxfm(coeff, CAST_TO_BYTEPTR(ref16), pitch_);
|
||||
}
|
||||
vpx_usec_timer_mark(&timer_c);
|
||||
c_sum_time += vpx_usec_timer_elapsed(&timer_c);
|
||||
|
||||
vpx_usec_timer timer_mod;
|
||||
vpx_usec_timer_start(&timer_mod);
|
||||
for (int i = 0; i < count_test_block; ++i) {
|
||||
RunInvTxfm(coeff, CAST_TO_BYTEPTR(dst16), pitch_);
|
||||
}
|
||||
vpx_usec_timer_mark(&timer_mod);
|
||||
simd_sum_time += vpx_usec_timer_elapsed(&timer_mod);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
}
|
||||
printf(
|
||||
"c_time = %" PRId64 " \t simd_time = %" PRId64 " \t Gain = %4.2f \n",
|
||||
c_sum_time, simd_sum_time,
|
||||
(static_cast<float>(c_sum_time) / static_cast<float>(simd_sum_time)));
|
||||
}
|
||||
|
||||
void CompareInvReference32x32() {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
const int count_test_block = 10000;
|
||||
const int eob = 31;
|
||||
const int16_t *scan = vp9_default_scan_orders[TX_32X32].scan;
|
||||
DECLARE_ALIGNED(32, tran_low_t, coeff[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint8_t, ref[kNumCoeffs]);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
DECLARE_ALIGNED(16, uint16_t, dst16[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint16_t, ref16[kNumCoeffs]);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
|
||||
for (int i = 0; i < count_test_block; ++i) {
|
||||
for (int j = 0; j < kNumCoeffs; ++j) {
|
||||
if (j < eob) {
|
||||
coeff[scan[j]] = rnd.Rand8Extremes();
|
||||
} else {
|
||||
coeff[scan[j]] = 0;
|
||||
}
|
||||
if (bit_depth_ == VPX_BITS_8) {
|
||||
dst[j] = 0;
|
||||
ref[j] = 0;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
} else {
|
||||
dst16[j] = 0;
|
||||
ref16[j] = 0;
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
}
|
||||
}
|
||||
if (bit_depth_ == VPX_BITS_8) {
|
||||
RunRefTxfm(coeff, ref, pitch_);
|
||||
RunInvTxfm(coeff, dst, pitch_);
|
||||
} else {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
RunRefTxfm(coeff, CAST_TO_BYTEPTR(ref16), pitch_);
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
RunInvTxfm(coeff, CAST_TO_BYTEPTR(dst16), pitch_));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
}
|
||||
|
||||
for (int j = 0; j < kNumCoeffs; ++j) {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
const uint32_t diff =
|
||||
bit_depth_ == VPX_BITS_8 ? dst[j] - ref[j] : dst16[j] - ref16[j];
|
||||
#else
|
||||
const uint32_t diff = dst[j] - ref[j];
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
const uint32_t error = diff * diff;
|
||||
EXPECT_EQ(0u, error) << "Error: 32x32 IDCT Comparison has error "
|
||||
<< error << " at index " << j;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(InvTrans32x32Test);
|
||||
|
||||
TEST_P(InvTrans32x32Test, DISABLED_Speed) { RunInvTrans32x32SpeedTest(); }
|
||||
TEST_P(InvTrans32x32Test, CompareReference) { CompareInvReference32x32(); }
|
||||
|
||||
using std::make_tuple;
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
@@ -334,6 +506,14 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
VPX_BITS_8),
|
||||
make_tuple(&vpx_fdct32x32_rd_c, &vpx_idct32x32_1024_add_c,
|
||||
1, VPX_BITS_8)));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
C, InvTrans32x32Test,
|
||||
::testing::Values(
|
||||
(make_tuple(&vpx_idct32x32_1024_add_c, &vpx_idct32x32_1024_add_c, 0,
|
||||
VPX_BITS_8, 32, 6225)),
|
||||
make_tuple(&vpx_idct32x32_135_add_c, &vpx_idct32x32_135_add_c, 0,
|
||||
VPX_BITS_8, 16, 6255)));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
|
||||
#if HAVE_NEON && !CONFIG_EMULATE_HARDWARE
|
||||
@@ -352,6 +532,14 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
&vpx_idct32x32_1024_add_sse2, 0, VPX_BITS_8),
|
||||
make_tuple(&vpx_fdct32x32_rd_sse2,
|
||||
&vpx_idct32x32_1024_add_sse2, 1, VPX_BITS_8)));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
SSE2, InvTrans32x32Test,
|
||||
::testing::Values(
|
||||
(make_tuple(&vpx_idct32x32_1024_add_c, &vpx_idct32x32_1024_add_sse2, 0,
|
||||
VPX_BITS_8, 32, 6225)),
|
||||
make_tuple(&vpx_idct32x32_135_add_c, &vpx_idct32x32_135_add_sse2, 0,
|
||||
VPX_BITS_8, 16, 6225)));
|
||||
#endif // HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
#if HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
@@ -377,6 +565,14 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
&vpx_idct32x32_1024_add_sse2, 0, VPX_BITS_8),
|
||||
make_tuple(&vpx_fdct32x32_rd_avx2,
|
||||
&vpx_idct32x32_1024_add_sse2, 1, VPX_BITS_8)));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
AVX2, InvTrans32x32Test,
|
||||
::testing::Values(
|
||||
(make_tuple(&vpx_idct32x32_1024_add_c, &vpx_idct32x32_1024_add_avx2, 0,
|
||||
VPX_BITS_8, 32, 6225)),
|
||||
make_tuple(&vpx_idct32x32_135_add_c, &vpx_idct32x32_135_add_avx2, 0,
|
||||
VPX_BITS_8, 16, 6225)));
|
||||
#endif // HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <limits>
|
||||
#include <tuple>
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "./vpx_dsp_rtcd.h"
|
||||
#include "test/acm_random.h"
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "test/clear_system_state.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "test/util.h"
|
||||
#include "vpx_config.h"
|
||||
#include "vpx/vpx_codec.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
#include "vpx_dsp/vpx_dsp_common.h"
|
||||
@@ -32,10 +33,10 @@ using std::make_tuple;
|
||||
using std::tuple;
|
||||
|
||||
namespace {
|
||||
typedef void (*PartialFdctFunc)(const int16_t *in, tran_low_t *out, int stride);
|
||||
using PartialFdctFunc = void (*)(const int16_t *in, tran_low_t *out,
|
||||
int stride);
|
||||
|
||||
typedef tuple<PartialFdctFunc, int /* size */, vpx_bit_depth_t>
|
||||
PartialFdctParam;
|
||||
using PartialFdctParam = tuple<PartialFdctFunc, int /*size*/, vpx_bit_depth_t>;
|
||||
|
||||
tran_low_t partial_fdct_ref(const Buffer<int16_t> &in, int size) {
|
||||
int64_t sum = 0;
|
||||
@@ -67,7 +68,7 @@ class PartialFdctTest : public ::testing::TestWithParam<PartialFdctParam> {
|
||||
bit_depth_ = GET_PARAM(2);
|
||||
}
|
||||
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
void TearDown() override { libvpx_test::ClearSystemState(); }
|
||||
|
||||
protected:
|
||||
void RunTest() {
|
||||
@@ -145,11 +146,17 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
NEON, PartialFdctTest,
|
||||
::testing::Values(make_tuple(&vpx_fdct32x32_1_neon, 32, VPX_BITS_8),
|
||||
make_tuple(&vpx_fdct16x16_1_neon, 16, VPX_BITS_8),
|
||||
::testing::Values(make_tuple(&vpx_highbd_fdct32x32_1_neon, 32, VPX_BITS_12),
|
||||
make_tuple(&vpx_highbd_fdct32x32_1_neon, 32, VPX_BITS_10),
|
||||
make_tuple(&vpx_highbd_fdct32x32_1_neon, 32, VPX_BITS_8),
|
||||
make_tuple(&vpx_highbd_fdct16x16_1_neon, 16, VPX_BITS_12),
|
||||
make_tuple(&vpx_highbd_fdct16x16_1_neon, 16, VPX_BITS_10),
|
||||
make_tuple(&vpx_highbd_fdct16x16_1_neon, 16, VPX_BITS_8),
|
||||
make_tuple(&vpx_fdct8x8_1_neon, 8, VPX_BITS_12),
|
||||
make_tuple(&vpx_fdct8x8_1_neon, 8, VPX_BITS_10),
|
||||
make_tuple(&vpx_fdct8x8_1_neon, 8, VPX_BITS_8),
|
||||
make_tuple(&vpx_fdct4x4_1_neon, 4, VPX_BITS_12),
|
||||
make_tuple(&vpx_fdct4x4_1_neon, 4, VPX_BITS_10),
|
||||
make_tuple(&vpx_fdct4x4_1_neon, 4, VPX_BITS_8)));
|
||||
#else
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <string.h>
|
||||
#include <tuple>
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "./vp9_rtcd.h"
|
||||
#include "./vpx_dsp_rtcd.h"
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "test/register_state_check.h"
|
||||
#include "test/util.h"
|
||||
#include "vp9/common/vp9_entropy.h"
|
||||
#include "vpx_config.h"
|
||||
#include "vpx/vpx_codec.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
#include "vpx_ports/mem.h"
|
||||
@@ -33,16 +34,16 @@ using std::make_tuple;
|
||||
using std::tuple;
|
||||
|
||||
namespace {
|
||||
typedef void (*FdctFunc)(const int16_t *in, tran_low_t *out, int stride);
|
||||
typedef void (*IdctFunc)(const tran_low_t *in, uint8_t *out, int stride);
|
||||
typedef void (*FhtFunc)(const int16_t *in, tran_low_t *out, int stride,
|
||||
int tx_type);
|
||||
typedef void (*FhtFuncRef)(const Buffer<int16_t> &in, Buffer<tran_low_t> *out,
|
||||
int size, int tx_type);
|
||||
typedef void (*IhtFunc)(const tran_low_t *in, uint8_t *out, int stride,
|
||||
int tx_type);
|
||||
typedef void (*IhtWithBdFunc)(const tran_low_t *in, uint8_t *out, int stride,
|
||||
int tx_type, int bd);
|
||||
using FdctFunc = void (*)(const int16_t *in, tran_low_t *out, int stride);
|
||||
using IdctFunc = void (*)(const tran_low_t *in, uint8_t *out, int stride);
|
||||
using FhtFunc = void (*)(const int16_t *in, tran_low_t *out, int stride,
|
||||
int tx_type);
|
||||
using FhtFuncRef = void (*)(const Buffer<int16_t> &in, Buffer<tran_low_t> *out,
|
||||
int size, int tx_type);
|
||||
using IhtFunc = void (*)(const tran_low_t *in, uint8_t *out, int stride,
|
||||
int tx_type);
|
||||
using IhtWithBdFunc = void (*)(const tran_low_t *in, uint8_t *out, int stride,
|
||||
int tx_type, int bd);
|
||||
|
||||
template <FdctFunc fn>
|
||||
void fdct_wrapper(const int16_t *in, tran_low_t *out, int stride, int tx_type) {
|
||||
@@ -66,11 +67,11 @@ void iht_wrapper(const tran_low_t *in, uint8_t *out, int stride, int tx_type,
|
||||
}
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
typedef void (*HighbdIdctFunc)(const tran_low_t *in, uint16_t *out, int stride,
|
||||
int bd);
|
||||
using HighbdIdctFunc = void (*)(const tran_low_t *in, uint16_t *out, int stride,
|
||||
int bd);
|
||||
|
||||
typedef void (*HighbdIhtFunc)(const tran_low_t *in, uint16_t *out, int stride,
|
||||
int tx_type, int bd);
|
||||
using HighbdIhtFunc = void (*)(const tran_low_t *in, uint16_t *out, int stride,
|
||||
int tx_type, int bd);
|
||||
|
||||
template <HighbdIdctFunc fn>
|
||||
void highbd_idct_wrapper(const tran_low_t *in, uint8_t *out, int stride,
|
||||
@@ -94,7 +95,7 @@ struct FuncInfo {
|
||||
};
|
||||
|
||||
/* forward transform, inverse transform, size, transform type, bit depth */
|
||||
typedef tuple<int, const FuncInfo *, int, vpx_bit_depth_t> DctParam;
|
||||
using DctParam = tuple<int, const FuncInfo *, int, vpx_bit_depth_t>;
|
||||
|
||||
void fdct_ref(const Buffer<int16_t> &in, Buffer<tran_low_t> *out, int size,
|
||||
int /*tx_type*/) {
|
||||
@@ -134,7 +135,7 @@ void fwht_ref(const Buffer<int16_t> &in, Buffer<tran_low_t> *out, int size,
|
||||
|
||||
class TransTestBase : public ::testing::TestWithParam<DctParam> {
|
||||
public:
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
rnd_.Reset(ACMRandom::DeterministicSeed());
|
||||
const int idx = GET_PARAM(0);
|
||||
const FuncInfo *func_info = &(GET_PARAM(1)[idx]);
|
||||
@@ -166,7 +167,7 @@ class TransTestBase : public ::testing::TestWithParam<DctParam> {
|
||||
ASSERT_NE(dst_, nullptr);
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
void TearDown() override {
|
||||
vpx_free(src_);
|
||||
src_ = nullptr;
|
||||
vpx_free(dst_);
|
||||
@@ -358,14 +359,6 @@ class TransTestBase : public ::testing::TestWithParam<DctParam> {
|
||||
ASSERT_TRUE(in.Init());
|
||||
Buffer<tran_low_t> coeff = Buffer<tran_low_t>(size_, size_, 0, 16);
|
||||
ASSERT_TRUE(coeff.Init());
|
||||
Buffer<uint8_t> dst = Buffer<uint8_t>(size_, size_, 0, 16);
|
||||
ASSERT_TRUE(dst.Init());
|
||||
Buffer<uint8_t> src = Buffer<uint8_t>(size_, size_, 0);
|
||||
ASSERT_TRUE(src.Init());
|
||||
Buffer<uint16_t> dst16 = Buffer<uint16_t>(size_, size_, 0, 16);
|
||||
ASSERT_TRUE(dst16.Init());
|
||||
Buffer<uint16_t> src16 = Buffer<uint16_t>(size_, size_, 0);
|
||||
ASSERT_TRUE(src16.Init());
|
||||
|
||||
for (int i = 0; i < count_test_block; ++i) {
|
||||
InitMem();
|
||||
@@ -539,6 +532,18 @@ INSTANTIATE_TEST_SUITE_P(AVX2, TransDCT,
|
||||
#endif // HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH
|
||||
|
||||
#if HAVE_NEON
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
static const FuncInfo dct_neon_func_info[] = {
|
||||
{ &fdct_wrapper<vpx_highbd_fdct4x4_neon>,
|
||||
&highbd_idct_wrapper<vpx_highbd_idct4x4_16_add_neon>, 4, 2 },
|
||||
{ &fdct_wrapper<vpx_highbd_fdct8x8_neon>,
|
||||
&highbd_idct_wrapper<vpx_highbd_idct8x8_64_add_neon>, 8, 2 },
|
||||
{ &fdct_wrapper<vpx_highbd_fdct16x16_neon>,
|
||||
&highbd_idct_wrapper<vpx_highbd_idct16x16_256_add_neon>, 16, 2 },
|
||||
/* { &fdct_wrapper<vpx_highbd_fdct32x32_neon>,
|
||||
&highbd_idct_wrapper<vpx_highbd_idct32x32_1024_add_neon>, 32, 2 },*/
|
||||
};
|
||||
#else
|
||||
static const FuncInfo dct_neon_func_info[4] = {
|
||||
{ &fdct_wrapper<vpx_fdct4x4_neon>, &idct_wrapper<vpx_idct4x4_16_add_neon>, 4,
|
||||
1 },
|
||||
@@ -549,12 +554,15 @@ static const FuncInfo dct_neon_func_info[4] = {
|
||||
{ &fdct_wrapper<vpx_fdct32x32_neon>,
|
||||
&idct_wrapper<vpx_idct32x32_1024_add_neon>, 32, 1 }
|
||||
};
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
NEON, TransDCT,
|
||||
::testing::Combine(::testing::Range(0, 4),
|
||||
::testing::Values(dct_neon_func_info),
|
||||
::testing::Values(0), ::testing::Values(VPX_BITS_8)));
|
||||
::testing::Combine(
|
||||
::testing::Range(0, static_cast<int>(sizeof(dct_neon_func_info) /
|
||||
sizeof(dct_neon_func_info[0]))),
|
||||
::testing::Values(dct_neon_func_info), ::testing::Values(0),
|
||||
::testing::Values(VPX_BITS_8, VPX_BITS_10, VPX_BITS_12)));
|
||||
#endif // HAVE_NEON
|
||||
|
||||
#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH
|
||||
@@ -652,10 +660,16 @@ static const FuncInfo ht_neon_func_info[] = {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
{ &vp9_highbd_fht4x4_c, &highbd_iht_wrapper<vp9_highbd_iht4x4_16_add_neon>, 4,
|
||||
2 },
|
||||
{ &vp9_highbd_fht4x4_neon, &highbd_iht_wrapper<vp9_highbd_iht4x4_16_add_neon>,
|
||||
4, 2 },
|
||||
{ &vp9_highbd_fht8x8_c, &highbd_iht_wrapper<vp9_highbd_iht8x8_64_add_neon>, 8,
|
||||
2 },
|
||||
{ &vp9_highbd_fht8x8_neon, &highbd_iht_wrapper<vp9_highbd_iht8x8_64_add_neon>,
|
||||
8, 2 },
|
||||
{ &vp9_highbd_fht16x16_c,
|
||||
&highbd_iht_wrapper<vp9_highbd_iht16x16_256_add_neon>, 16, 2 },
|
||||
{ &vp9_highbd_fht16x16_neon,
|
||||
&highbd_iht_wrapper<vp9_highbd_iht16x16_256_add_neon>, 16, 2 },
|
||||
#endif
|
||||
{ &vp9_fht4x4_c, &iht_wrapper<vp9_iht4x4_16_add_neon>, 4, 1 },
|
||||
{ &vp9_fht4x4_neon, &iht_wrapper<vp9_iht4x4_16_add_neon>, 4, 1 },
|
||||
@@ -754,7 +768,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
::testing::Values(wht_c_func_info), ::testing::Values(0),
|
||||
::testing::Values(VPX_BITS_8, VPX_BITS_10, VPX_BITS_12)));
|
||||
|
||||
#if HAVE_SSE2 && !CONFIG_EMULATE_HARDWARE
|
||||
#if HAVE_SSE2 && HAVE_X86_ASM && !CONFIG_EMULATE_HARDWARE
|
||||
static const FuncInfo wht_sse2_func_info = {
|
||||
&fdct_wrapper<vp9_fwht4x4_sse2>, &idct_wrapper<vpx_iwht4x4_16_add_sse2>, 4, 1
|
||||
};
|
||||
@@ -762,7 +776,7 @@ static const FuncInfo wht_sse2_func_info = {
|
||||
INSTANTIATE_TEST_SUITE_P(SSE2, TransWHT,
|
||||
::testing::Values(make_tuple(0, &wht_sse2_func_info, 0,
|
||||
VPX_BITS_8)));
|
||||
#endif // HAVE_SSE2 && !CONFIG_EMULATE_HARDWARE
|
||||
#endif // HAVE_SSE2 && HAVE_X86_ASM && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
#if HAVE_VSX && !CONFIG_EMULATE_HARDWARE && !CONFIG_VP9_HIGHBITDEPTH
|
||||
static const FuncInfo wht_vsx_func_info = {
|
||||
|
||||
@@ -8,19 +8,30 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include <array>
|
||||
#include <vector>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#if CONFIG_VP8_DECODER && CONFIG_MULTITHREAD && defined(__linux__)
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
#include "test/ivf_video_source.h"
|
||||
#include "test/video_source.h"
|
||||
#if CONFIG_VP8_ENCODER || CONFIG_VP9_ENCODER
|
||||
#include "vpx/vp8cx.h"
|
||||
#endif
|
||||
#include "vpx/vp8dx.h"
|
||||
#include "vpx/vpx_decoder.h"
|
||||
#include "vpx/vpx_encoder.h"
|
||||
|
||||
namespace {
|
||||
|
||||
#define NELEMENTS(x) static_cast<int>(sizeof(x) / sizeof(x[0]))
|
||||
|
||||
TEST(DecodeAPI, InvalidParams) {
|
||||
static const vpx_codec_iface_t *kCodecs[] = {
|
||||
static vpx_codec_iface_t *kCodecs[] = {
|
||||
#if CONFIG_VP8_DECODER
|
||||
&vpx_codec_vp8_dx_algo,
|
||||
#endif
|
||||
@@ -77,6 +88,369 @@ TEST(DecodeAPI, OptionalParams) {
|
||||
VPX_CODEC_USE_ERROR_CONCEALMENT));
|
||||
#endif // CONFIG_ERROR_CONCEALMENT
|
||||
}
|
||||
|
||||
TEST(DecodeAPI, Vp8FlushAfterFragmentError) {
|
||||
static constexpr uint8_t kInvalidKeyframe[10] = { 0 };
|
||||
vpx_codec_ctx_t dec;
|
||||
|
||||
ASSERT_EQ(VPX_CODEC_OK,
|
||||
vpx_codec_dec_init(&dec, &vpx_codec_vp8_dx_algo, nullptr,
|
||||
VPX_CODEC_USE_INPUT_FRAGMENTS));
|
||||
EXPECT_EQ(VPX_CODEC_OK,
|
||||
vpx_codec_decode(&dec, kInvalidKeyframe, sizeof(kInvalidKeyframe),
|
||||
nullptr, 0));
|
||||
EXPECT_EQ(VPX_CODEC_UNSUP_BITSTREAM,
|
||||
vpx_codec_decode(&dec, nullptr, 0, nullptr, 0));
|
||||
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_decode(&dec, nullptr, 0, nullptr, 0));
|
||||
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&dec));
|
||||
}
|
||||
|
||||
#if CONFIG_SIZE_LIMIT && \
|
||||
(DECODE_WIDTH_LIMIT < 16383 || DECODE_HEIGHT_LIMIT < 16383)
|
||||
TEST(DecodeAPI, Vp8RejectsOversizedKeyframeBeforeInitialization) {
|
||||
vpx_codec_ctx_t dec;
|
||||
ASSERT_EQ(VPX_CODEC_OK,
|
||||
vpx_codec_dec_init(&dec, &vpx_codec_vp8_dx_algo, nullptr, 0));
|
||||
|
||||
#if DECODE_WIDTH_LIMIT < 16383
|
||||
constexpr uint16_t kWidth = DECODE_WIDTH_LIMIT + 1;
|
||||
constexpr uint16_t kHeight = 1;
|
||||
#else
|
||||
constexpr uint16_t kWidth = 1;
|
||||
constexpr uint16_t kHeight = DECODE_HEIGHT_LIMIT + 1;
|
||||
#endif
|
||||
static constexpr uint8_t kOversizedKeyframe[10] = {
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x9d,
|
||||
0x01,
|
||||
0x2a,
|
||||
static_cast<uint8_t>(kWidth),
|
||||
static_cast<uint8_t>(kWidth >> 8),
|
||||
static_cast<uint8_t>(kHeight),
|
||||
static_cast<uint8_t>(kHeight >> 8),
|
||||
};
|
||||
EXPECT_EQ(
|
||||
VPX_CODEC_CORRUPT_FRAME,
|
||||
vpx_codec_decode(&dec, kOversizedKeyframe,
|
||||
static_cast<unsigned int>(sizeof(kOversizedKeyframe)),
|
||||
nullptr, 0));
|
||||
|
||||
static constexpr uint8_t kInterframe[10] = { 0x01 };
|
||||
EXPECT_EQ(VPX_CODEC_UNSUP_BITSTREAM,
|
||||
vpx_codec_decode(&dec, kInterframe,
|
||||
static_cast<unsigned int>(sizeof(kInterframe)),
|
||||
nullptr, 0));
|
||||
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&dec));
|
||||
}
|
||||
#endif // CONFIG_SIZE_LIMIT && dimension limit is representable in VP8
|
||||
|
||||
TEST(DecodeAPI, Vp8FlushWithNoFragments) {
|
||||
vpx_codec_ctx_t dec;
|
||||
vpx_codec_dec_cfg_t cfg = { 1, 0, 0 };
|
||||
vpx_codec_flags_t flags = VPX_CODEC_USE_INPUT_FRAGMENTS;
|
||||
|
||||
EXPECT_EQ(VPX_CODEC_OK,
|
||||
vpx_codec_dec_init(&dec, &vpx_codec_vp8_dx_algo, &cfg, flags));
|
||||
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_decode(&dec, nullptr, 0, nullptr, 0));
|
||||
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&dec));
|
||||
}
|
||||
|
||||
#if CONFIG_VP8_ENCODER && CONFIG_MULTITHREAD
|
||||
// Encodes a sequence of key frames using two token partitions, truncates the
|
||||
// second token partition of one frame so that the worker thread's bool decoder
|
||||
// runs past the end of its partition, and then verifies that the
|
||||
// multi-threaded decoder still reports subsequent well-formed key frames as
|
||||
// not corrupted.
|
||||
TEST(DecodeAPI, Vp8MultiThreadedCorruptedStateResetAcrossFrames) {
|
||||
constexpr int kWidth = 16;
|
||||
constexpr int kHeight = 32;
|
||||
constexpr int kFrames = 4;
|
||||
|
||||
std::vector<std::vector<uint8_t>> frames;
|
||||
{
|
||||
vpx_codec_ctx_t enc;
|
||||
vpx_codec_enc_cfg_t cfg;
|
||||
ASSERT_EQ(vpx_codec_enc_config_default(&vpx_codec_vp8_cx_algo, &cfg, 0),
|
||||
VPX_CODEC_OK);
|
||||
cfg.g_w = kWidth;
|
||||
cfg.g_h = kHeight;
|
||||
cfg.g_lag_in_frames = 0;
|
||||
ASSERT_EQ(vpx_codec_enc_init(&enc, &vpx_codec_vp8_cx_algo, &cfg, 0),
|
||||
VPX_CODEC_OK);
|
||||
ASSERT_EQ(vpx_codec_control(&enc, VP8E_SET_TOKEN_PARTITIONS,
|
||||
VP8_TWO_TOKENPARTITION),
|
||||
VPX_CODEC_OK);
|
||||
|
||||
libvpx_test::RandomVideoSource video;
|
||||
video.SetSize(kWidth, kHeight);
|
||||
video.set_limit(kFrames);
|
||||
for (video.Begin(); video.img() != nullptr; video.Next()) {
|
||||
ASSERT_EQ(
|
||||
vpx_codec_encode(&enc, video.img(), video.pts(), video.duration(),
|
||||
VPX_EFLAG_FORCE_KF, VPX_DL_REALTIME),
|
||||
VPX_CODEC_OK);
|
||||
vpx_codec_iter_t iter = nullptr;
|
||||
const vpx_codec_cx_pkt_t *pkt;
|
||||
while ((pkt = vpx_codec_get_cx_data(&enc, &iter)) != nullptr) {
|
||||
if (pkt->kind != VPX_CODEC_CX_FRAME_PKT) continue;
|
||||
ASSERT_NE(pkt->data.frame.flags & VPX_FRAME_IS_KEY, 0u);
|
||||
const uint8_t *buf = static_cast<const uint8_t *>(pkt->data.frame.buf);
|
||||
frames.emplace_back(buf, buf + pkt->data.frame.sz);
|
||||
}
|
||||
}
|
||||
ASSERT_EQ(vpx_codec_destroy(&enc), VPX_CODEC_OK);
|
||||
}
|
||||
ASSERT_EQ(frames.size(), static_cast<size_t>(kFrames));
|
||||
|
||||
// Truncate frame 1 so that only a single byte of the second token partition
|
||||
// remains. The first token partition (used by the main thread) is left
|
||||
// intact.
|
||||
{
|
||||
std::vector<uint8_t> &f = frames[1];
|
||||
ASSERT_GT(f.size(), 10u);
|
||||
const size_t first_part_sz =
|
||||
(static_cast<size_t>(f[0]) | (static_cast<size_t>(f[1]) << 8) |
|
||||
(static_cast<size_t>(f[2]) << 16)) >>
|
||||
5;
|
||||
const size_t part_sizes = 10 + first_part_sz;
|
||||
ASSERT_LT(part_sizes + 3, f.size());
|
||||
const size_t part0_sz = static_cast<size_t>(f[part_sizes]) |
|
||||
(static_cast<size_t>(f[part_sizes + 1]) << 8) |
|
||||
(static_cast<size_t>(f[part_sizes + 2]) << 16);
|
||||
const size_t part1_start = part_sizes + 3 + part0_sz;
|
||||
ASSERT_LT(part1_start, f.size());
|
||||
f.resize(part1_start + 1);
|
||||
}
|
||||
|
||||
vpx_codec_ctx_t dec;
|
||||
vpx_codec_dec_cfg_t dec_cfg = { /*threads=*/4, /*w=*/0, /*h=*/0 };
|
||||
ASSERT_EQ(vpx_codec_dec_init(&dec, &vpx_codec_vp8_dx_algo, &dec_cfg, 0),
|
||||
VPX_CODEC_OK);
|
||||
for (int i = 0; i < kFrames; ++i) {
|
||||
const vpx_codec_err_t res = vpx_codec_decode(
|
||||
&dec, frames[i].data(), static_cast<unsigned int>(frames[i].size()),
|
||||
/*user_priv=*/nullptr, /*deadline=*/0);
|
||||
vpx_codec_iter_t iter = nullptr;
|
||||
while (vpx_codec_get_frame(&dec, &iter)) {
|
||||
}
|
||||
if (i == 1) continue;
|
||||
EXPECT_EQ(res, VPX_CODEC_OK)
|
||||
<< "frame " << i << ": " << vpx_codec_error_detail(&dec);
|
||||
int corrupted = -1;
|
||||
EXPECT_EQ(vpx_codec_control(&dec, VP8D_GET_FRAME_CORRUPTED, &corrupted),
|
||||
VPX_CODEC_OK);
|
||||
EXPECT_EQ(corrupted, 0) << "frame " << i;
|
||||
}
|
||||
EXPECT_EQ(vpx_codec_destroy(&dec), VPX_CODEC_OK);
|
||||
}
|
||||
|
||||
// Issue: 559707641
|
||||
// Encodes a sequence of frames with two token partitions, truncates the second
|
||||
// token partition of one frame (used by a worker thread), and verifies that
|
||||
// the multi-threaded decoder returns VPX_CODEC_CORRUPT_FRAME and does not emit
|
||||
// a partially written frame. Also verifies that subsequent well-formed frames
|
||||
// still decode correctly.
|
||||
TEST(DecodeAPI, Vp8MultiThreadedWorkerDecodeErrorFailsFrame) {
|
||||
constexpr int kWidth = 32;
|
||||
constexpr int kHeight = 32;
|
||||
class PatternVideoSource : public libvpx_test::DummyVideoSource {
|
||||
protected:
|
||||
void FillFrame() override {
|
||||
if (!img_) return;
|
||||
// Keep row 0 flat so partition 0 size is small.
|
||||
memset(img_->planes[VPX_PLANE_Y], 128, img_->stride[VPX_PLANE_Y] * 16);
|
||||
// Fill row 1 with varying pattern so partition 1 has tokens to truncate.
|
||||
for (int y = 16; y < 32; ++y) {
|
||||
uint8_t *row =
|
||||
img_->planes[VPX_PLANE_Y] + y * img_->stride[VPX_PLANE_Y];
|
||||
for (int x = 0; x < 32; ++x) {
|
||||
row[x] = static_cast<uint8_t>((x * 37 + y * 73) ^ (frame_ * 19));
|
||||
}
|
||||
}
|
||||
memset(img_->planes[VPX_PLANE_U], 128, img_->stride[VPX_PLANE_U] * 16);
|
||||
memset(img_->planes[VPX_PLANE_V], 128, img_->stride[VPX_PLANE_V] * 16);
|
||||
}
|
||||
};
|
||||
|
||||
constexpr int kFrames = 4;
|
||||
std::vector<std::vector<uint8_t>> frames;
|
||||
{
|
||||
vpx_codec_ctx_t enc;
|
||||
vpx_codec_enc_cfg_t cfg;
|
||||
ASSERT_EQ(vpx_codec_enc_config_default(&vpx_codec_vp8_cx_algo, &cfg, 0),
|
||||
VPX_CODEC_OK);
|
||||
cfg.g_w = kWidth;
|
||||
cfg.g_h = kHeight;
|
||||
cfg.g_lag_in_frames = 0;
|
||||
ASSERT_EQ(vpx_codec_enc_init(&enc, &vpx_codec_vp8_cx_algo, &cfg, 0),
|
||||
VPX_CODEC_OK);
|
||||
ASSERT_EQ(vpx_codec_control(&enc, VP8E_SET_TOKEN_PARTITIONS,
|
||||
VP8_TWO_TOKENPARTITION),
|
||||
VPX_CODEC_OK);
|
||||
|
||||
PatternVideoSource video;
|
||||
video.SetSize(kWidth, kHeight);
|
||||
video.set_limit(kFrames);
|
||||
for (video.Begin(); video.img() != nullptr; video.Next()) {
|
||||
ASSERT_EQ(
|
||||
vpx_codec_encode(&enc, video.img(), video.pts(), video.duration(),
|
||||
VPX_EFLAG_FORCE_KF, VPX_DL_REALTIME),
|
||||
VPX_CODEC_OK);
|
||||
vpx_codec_iter_t iter = nullptr;
|
||||
const vpx_codec_cx_pkt_t *pkt;
|
||||
while ((pkt = vpx_codec_get_cx_data(&enc, &iter)) != nullptr) {
|
||||
if (pkt->kind != VPX_CODEC_CX_FRAME_PKT) continue;
|
||||
ASSERT_NE(pkt->data.frame.flags & VPX_FRAME_IS_KEY, 0u);
|
||||
const uint8_t *buf = static_cast<const uint8_t *>(pkt->data.frame.buf);
|
||||
frames.emplace_back(buf, buf + pkt->data.frame.sz);
|
||||
}
|
||||
}
|
||||
ASSERT_EQ(vpx_codec_destroy(&enc), VPX_CODEC_OK);
|
||||
}
|
||||
ASSERT_EQ(frames.size(), static_cast<size_t>(kFrames));
|
||||
|
||||
// Truncate frame 1 so that only a single byte of the second token partition
|
||||
// remains. The first token partition (used by the main thread) is left
|
||||
// intact.
|
||||
{
|
||||
std::vector<uint8_t> &f = frames[1];
|
||||
ASSERT_GT(f.size(), 10u);
|
||||
const size_t first_part_sz =
|
||||
(static_cast<size_t>(f[0]) | (static_cast<size_t>(f[1]) << 8) |
|
||||
(static_cast<size_t>(f[2]) << 16)) >>
|
||||
5;
|
||||
const size_t part_sizes = 10 + first_part_sz;
|
||||
ASSERT_LT(part_sizes + 3, f.size());
|
||||
const size_t part0_sz = static_cast<size_t>(f[part_sizes]) |
|
||||
(static_cast<size_t>(f[part_sizes + 1]) << 8) |
|
||||
(static_cast<size_t>(f[part_sizes + 2]) << 16);
|
||||
const size_t part1_start = part_sizes + 3 + part0_sz;
|
||||
ASSERT_LT(part1_start, f.size());
|
||||
f.resize(part1_start + 1);
|
||||
}
|
||||
|
||||
vpx_codec_ctx_t dec;
|
||||
vpx_codec_dec_cfg_t dec_cfg = { /*threads=*/4, /*w=*/0, /*h=*/0 };
|
||||
ASSERT_EQ(vpx_codec_dec_init(&dec, &vpx_codec_vp8_dx_algo, &dec_cfg, 0),
|
||||
VPX_CODEC_OK);
|
||||
for (int i = 0; i < kFrames; ++i) {
|
||||
const vpx_codec_err_t res = vpx_codec_decode(
|
||||
&dec, frames[i].data(), static_cast<unsigned int>(frames[i].size()),
|
||||
/*user_priv=*/nullptr, /*deadline=*/0);
|
||||
vpx_codec_iter_t iter = nullptr;
|
||||
const vpx_image_t *img = vpx_codec_get_frame(&dec, &iter);
|
||||
if (i == 1) {
|
||||
EXPECT_EQ(res, VPX_CODEC_CORRUPT_FRAME);
|
||||
EXPECT_EQ(img, nullptr);
|
||||
continue;
|
||||
}
|
||||
EXPECT_EQ(res, VPX_CODEC_OK)
|
||||
<< "frame " << i << ": " << vpx_codec_error_detail(&dec);
|
||||
EXPECT_NE(img, nullptr) << "frame " << i;
|
||||
int corrupted = -1;
|
||||
EXPECT_EQ(vpx_codec_control(&dec, VP8D_GET_FRAME_CORRUPTED, &corrupted),
|
||||
VPX_CODEC_OK);
|
||||
EXPECT_EQ(corrupted, 0) << "frame " << i;
|
||||
}
|
||||
EXPECT_EQ(vpx_codec_destroy(&dec), VPX_CODEC_OK);
|
||||
}
|
||||
#endif // CONFIG_VP8_ENCODER && CONFIG_MULTITHREAD
|
||||
|
||||
#if CONFIG_MULTITHREAD && defined(__linux__)
|
||||
// Issue: 571147583
|
||||
// Verifies that when restarting decode threads fails on a keyframe with a new
|
||||
// resolution, the cached dimensions (ctx->si.w, ctx->si.h) are cleared so a
|
||||
// subsequent decode triggers a resolution change and reallocates frame buffers.
|
||||
TEST(DecodeAPI, Vp8MultiThreadedRestartResolutionChange) {
|
||||
// Minimal 2-partition VP8 keyframe buffer (first partition = 256 bytes).
|
||||
std::vector<uint8_t> frame(1500, 0);
|
||||
frame[0] = 0x10;
|
||||
frame[1] = 0x20;
|
||||
frame[3] = 0x9d;
|
||||
frame[4] = 0x01;
|
||||
frame[5] = 0x2a;
|
||||
frame[6] = 0x00; // width = 256
|
||||
frame[7] = 0x01;
|
||||
frame[8] = 0x00; // height = 256
|
||||
frame[9] = 0x01;
|
||||
frame[10] = 0x0f; // 2 token partitions
|
||||
frame[11] = 0xc1;
|
||||
frame[12] = 0x28;
|
||||
frame[266] = 0x58; // token partition 0 size = 600
|
||||
frame[267] = 0x02;
|
||||
|
||||
vpx_codec_ctx_t dec;
|
||||
vpx_codec_dec_cfg_t cfg = { /*threads=*/2, /*w=*/0, /*h=*/0 };
|
||||
ASSERT_EQ(vpx_codec_dec_init(&dec, &vpx_codec_vp8_dx_algo, &cfg, 0),
|
||||
VPX_CODEC_OK);
|
||||
|
||||
// Frame 0: valid 256x256 keyframe initializes 256x256 frame buffers
|
||||
// (yv12_fb_new->y_width = 256, pc->Width = 256) and worker threads.
|
||||
ASSERT_EQ(
|
||||
vpx_codec_decode(&dec, frame.data(),
|
||||
static_cast<unsigned int>(frame.size()), nullptr, 0),
|
||||
VPX_CODEC_OK);
|
||||
|
||||
// Frame 1: truncate token partition 0 to 1 byte so the worker thread fails in
|
||||
// vp8mt_decode_mb_rows(), shutting down threads and setting
|
||||
// ctx->restart_threads = 1.
|
||||
frame[266] = 1;
|
||||
frame[267] = 0;
|
||||
EXPECT_EQ(
|
||||
vpx_codec_decode(&dec, frame.data(),
|
||||
static_cast<unsigned int>(frame.size()), nullptr, 0),
|
||||
VPX_CODEC_CORRUPT_FRAME);
|
||||
|
||||
// Change keyframe header to 16x64. In each iteration:
|
||||
// 1. Set RLIMIT_NPROC = 0 so pthread_create fails inside restart_threads and
|
||||
// vpx_codec_decode returns VPX_CODEC_ERROR after vp8_peek_si_internal()
|
||||
// has updated ctx->si.w = 16, ctx->si.h = 64.
|
||||
// 2. Restore RLIMIT_NPROC and decode again so restart_threads succeeds and
|
||||
// allocates mt_yabove_row for pc->Width.
|
||||
//
|
||||
// Without the fix:
|
||||
// - ctx->si.w = 16, ctx->si.h = 64 remain cached after step 1, so step 2
|
||||
// sees resolution_change == 0 and skips vp8_alloc_frame_buffers()
|
||||
// (leaving yv12_fb_new->y_width = 256).
|
||||
// - In iteration 0 step 2, vp8_decode_frame() sets pc->Width = 16 from the
|
||||
// keyframe header before failing on the truncated token partition
|
||||
// (setting ctx->restart_threads = 1 again).
|
||||
// - In iteration 1 step 2, restart_threads allocates mt_yabove_row for
|
||||
// pc->Width = 16 (103 bytes) while yv12_fb_new->y_width is still 256,
|
||||
// causing a 261-byte write (heap-buffer-overflow) in
|
||||
// vp8mt_decode_mb_rows().
|
||||
//
|
||||
// With the fix:
|
||||
// - Step 1 clears ctx->si.w = 0, ctx->si.h = 0 on thread restart failure.
|
||||
// - Step 2 detects resolution_change == 1, reallocates frame buffers to
|
||||
// 16x64, and cleanly returns VPX_CODEC_CORRUPT_FRAME on the truncated
|
||||
// partition.
|
||||
frame[6] = 16;
|
||||
frame[7] = 0;
|
||||
frame[8] = 64;
|
||||
frame[9] = 0;
|
||||
struct rlimit old_lim;
|
||||
ASSERT_EQ(getrlimit(RLIMIT_NPROC, &old_lim), 0);
|
||||
const struct rlimit zero_lim = { 0, old_lim.rlim_max };
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
ASSERT_EQ(setrlimit(RLIMIT_NPROC, &zero_lim), 0);
|
||||
const vpx_codec_err_t res =
|
||||
vpx_codec_decode(&dec, frame.data(),
|
||||
static_cast<unsigned int>(frame.size()), nullptr, 0);
|
||||
ASSERT_EQ(setrlimit(RLIMIT_NPROC, &old_lim), 0);
|
||||
EXPECT_EQ(res, VPX_CODEC_ERROR);
|
||||
|
||||
EXPECT_EQ(
|
||||
vpx_codec_decode(&dec, frame.data(),
|
||||
static_cast<unsigned int>(frame.size()), nullptr, 0),
|
||||
VPX_CODEC_CORRUPT_FRAME);
|
||||
}
|
||||
|
||||
EXPECT_EQ(vpx_codec_destroy(&dec), VPX_CODEC_OK);
|
||||
}
|
||||
#endif // CONFIG_MULTITHREAD && defined(__linux__)
|
||||
#endif // CONFIG_VP8_DECODER
|
||||
|
||||
#if CONFIG_VP9_DECODER
|
||||
@@ -120,7 +494,7 @@ void TestVp9Controls(vpx_codec_ctx_t *dec) {
|
||||
}
|
||||
|
||||
TEST(DecodeAPI, Vp9InvalidDecode) {
|
||||
const vpx_codec_iface_t *const codec = &vpx_codec_vp9_dx_algo;
|
||||
vpx_codec_iface_t *const codec = &vpx_codec_vp9_dx_algo;
|
||||
const char filename[] =
|
||||
"invalid-vp90-2-00-quantizer-00.webm.ivf.s5861_r01-05_b6-.v2.ivf";
|
||||
libvpx_test::IVFVideoSource video(filename);
|
||||
@@ -147,7 +521,7 @@ TEST(DecodeAPI, Vp9InvalidDecode) {
|
||||
|
||||
void TestPeekInfo(const uint8_t *const data, uint32_t data_sz,
|
||||
uint32_t peek_size) {
|
||||
const vpx_codec_iface_t *const codec = &vpx_codec_vp9_dx_algo;
|
||||
vpx_codec_iface_t *const codec = &vpx_codec_vp9_dx_algo;
|
||||
// Verify behavior of vpx_codec_decode. vpx_codec_decode doesn't even get
|
||||
// to decoder_peek_si_internal on frames of size < 8.
|
||||
if (data_sz >= 8) {
|
||||
@@ -193,6 +567,49 @@ TEST(DecodeAPI, Vp9PeekStreamInfoTruncated) {
|
||||
TestPeekInfo(profile1_data, data_sz, 11);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(DecodeAPI, Buganizer499206650) {
|
||||
vpx_codec_ctx_t dec;
|
||||
ASSERT_EQ(vpx_codec_dec_init(&dec, vpx_codec_vp9_dx(), /*cfg=*/nullptr,
|
||||
/*flags=*/0),
|
||||
VPX_CODEC_OK);
|
||||
|
||||
// Frame 1: VP9 intra_only, profile 0, 8x8, error_resilient=1,
|
||||
// refresh_frame_flags=0x00. Clears need_resync without updating ref slots.
|
||||
static constexpr std::array<uint8_t, 83> frame1 = {
|
||||
0x85, 0xa4, 0xc1, 0xa1, 0x00, 0x00, 0x03, 0x80, 0x03, 0x80, 0x00, 0x40,
|
||||
0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
EXPECT_EQ(vpx_codec_decode(&dec, frame1.data(),
|
||||
static_cast<unsigned int>(frame1.size()),
|
||||
/*user_priv=*/nullptr, /*deadline=*/0),
|
||||
VPX_CODEC_OK)
|
||||
<< vpx_codec_error_detail(&dec);
|
||||
|
||||
vpx_codec_iter_t it = nullptr;
|
||||
while (vpx_codec_get_frame(&dec, &it)) {
|
||||
}
|
||||
|
||||
// Frame 2: VP9 inter, profile 0, show_frame=1, error_resilient=1,
|
||||
// refresh=0xFF, references slot 0 (ref_frame_map[0] == -1).
|
||||
static constexpr std::array<uint8_t, 16> frame2 = {
|
||||
0x87, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
// Ensure there is no out of bounds read using the invalid index and that the
|
||||
// decoder reports an error.
|
||||
EXPECT_EQ(vpx_codec_decode(&dec, frame2.data(),
|
||||
static_cast<unsigned int>(frame2.size()),
|
||||
/*user_priv=*/nullptr, /*deadline=*/0),
|
||||
VPX_CODEC_CORRUPT_FRAME);
|
||||
|
||||
EXPECT_EQ(vpx_codec_destroy(&dec), VPX_CODEC_OK);
|
||||
}
|
||||
#endif // CONFIG_VP9_DECODER
|
||||
|
||||
TEST(DecodeAPI, HighBitDepthCapability) {
|
||||
@@ -212,4 +629,54 @@ TEST(DecodeAPI, HighBitDepthCapability) {
|
||||
#endif
|
||||
}
|
||||
|
||||
#if CONFIG_VP8_DECODER
|
||||
TEST(DecodeAPI, SetReferenceValidationVp8) {
|
||||
vpx_codec_ctx_t dec;
|
||||
ASSERT_EQ(vpx_codec_dec_init(&dec, vpx_codec_vp8_dx(), nullptr, 0),
|
||||
VPX_CODEC_OK);
|
||||
|
||||
vpx_image_t ref_img;
|
||||
ASSERT_NE(vpx_img_alloc(&ref_img, VPX_IMG_FMT_I420, 64, 64, 1), nullptr);
|
||||
|
||||
for (const int plane : { VPX_PLANE_Y, VPX_PLANE_U, VPX_PLANE_V }) {
|
||||
vpx_ref_frame_t ref_frame;
|
||||
ref_frame.frame_type = VP8_LAST_FRAME;
|
||||
ref_frame.img = ref_img;
|
||||
ref_frame.img.planes[plane] = nullptr;
|
||||
EXPECT_EQ(vpx_codec_control(&dec, VP8_SET_REFERENCE, &ref_frame),
|
||||
VPX_CODEC_INVALID_PARAM);
|
||||
EXPECT_EQ(vpx_codec_control(&dec, VP8_COPY_REFERENCE, &ref_frame),
|
||||
VPX_CODEC_INVALID_PARAM);
|
||||
}
|
||||
|
||||
vpx_img_free(&ref_img);
|
||||
EXPECT_EQ(vpx_codec_destroy(&dec), VPX_CODEC_OK);
|
||||
}
|
||||
#endif // CONFIG_VP8_DECODER
|
||||
|
||||
#if CONFIG_VP9_DECODER
|
||||
TEST(DecodeAPI, SetReferenceValidationVp9) {
|
||||
vpx_codec_ctx_t dec;
|
||||
ASSERT_EQ(vpx_codec_dec_init(&dec, vpx_codec_vp9_dx(), nullptr, 0),
|
||||
VPX_CODEC_OK);
|
||||
|
||||
vpx_image_t ref_img;
|
||||
ASSERT_NE(vpx_img_alloc(&ref_img, VPX_IMG_FMT_I420, 64, 64, 1), nullptr);
|
||||
|
||||
for (const int plane : { VPX_PLANE_Y, VPX_PLANE_U, VPX_PLANE_V }) {
|
||||
vpx_ref_frame_t ref_frame;
|
||||
ref_frame.frame_type = VP8_LAST_FRAME;
|
||||
ref_frame.img = ref_img;
|
||||
ref_frame.img.planes[plane] = nullptr;
|
||||
EXPECT_EQ(vpx_codec_control(&dec, VP8_SET_REFERENCE, &ref_frame),
|
||||
VPX_CODEC_INVALID_PARAM);
|
||||
EXPECT_EQ(vpx_codec_control(&dec, VP8_COPY_REFERENCE, &ref_frame),
|
||||
VPX_CODEC_INVALID_PARAM);
|
||||
}
|
||||
|
||||
vpx_img_free(&ref_img);
|
||||
EXPECT_EQ(vpx_codec_destroy(&dec), VPX_CODEC_OK);
|
||||
}
|
||||
#endif // CONFIG_VP9_DECODER
|
||||
|
||||
} // namespace
|
||||
@@ -10,12 +10,13 @@
|
||||
|
||||
#include <tuple>
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/encode_test_driver.h"
|
||||
#include "test/util.h"
|
||||
#include "test/i420_video_source.h"
|
||||
#include "vpx_config.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
|
||||
namespace {
|
||||
@@ -28,9 +29,9 @@ class DecodeCorruptedFrameTest
|
||||
DecodeCorruptedFrameTest() : EncoderTest(GET_PARAM(0)) {}
|
||||
|
||||
protected:
|
||||
virtual ~DecodeCorruptedFrameTest() {}
|
||||
~DecodeCorruptedFrameTest() override = default;
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
InitializeConfig();
|
||||
SetMode(::libvpx_test::kRealTime);
|
||||
cfg_.g_lag_in_frames = 0;
|
||||
@@ -44,21 +45,21 @@ class DecodeCorruptedFrameTest
|
||||
dec_cfg_.threads = 1;
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) {
|
||||
void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) override {
|
||||
if (video->frame() == 0) encoder->Control(VP8E_SET_CPUUSED, 7);
|
||||
}
|
||||
|
||||
virtual void MismatchHook(const vpx_image_t * /*img1*/,
|
||||
const vpx_image_t * /*img2*/) {}
|
||||
void MismatchHook(const vpx_image_t * /*img1*/,
|
||||
const vpx_image_t * /*img2*/) override {}
|
||||
|
||||
virtual const vpx_codec_cx_pkt_t *MutateEncoderOutputHook(
|
||||
const vpx_codec_cx_pkt_t *pkt) {
|
||||
const vpx_codec_cx_pkt_t *MutateEncoderOutputHook(
|
||||
const vpx_codec_cx_pkt_t *pkt) override {
|
||||
// Don't edit frame packet on key frame.
|
||||
if (pkt->data.frame.flags & VPX_FRAME_IS_KEY) return pkt;
|
||||
if (pkt->kind != VPX_CODEC_CX_FRAME_PKT) return pkt;
|
||||
|
||||
memcpy(&modified_pkt_, pkt, sizeof(*pkt));
|
||||
modified_pkt_ = *pkt;
|
||||
|
||||
// Halve the size so it's corrupted to decoder.
|
||||
modified_pkt_.data.frame.sz = modified_pkt_.data.frame.sz / 2;
|
||||
@@ -66,9 +67,9 @@ class DecodeCorruptedFrameTest
|
||||
return &modified_pkt_;
|
||||
}
|
||||
|
||||
virtual bool HandleDecodeResult(const vpx_codec_err_t res_dec,
|
||||
const libvpx_test::VideoSource & /*video*/,
|
||||
libvpx_test::Decoder *decoder) {
|
||||
bool HandleDecodeResult(const vpx_codec_err_t res_dec,
|
||||
const libvpx_test::VideoSource & /*video*/,
|
||||
libvpx_test::Decoder *decoder) override {
|
||||
EXPECT_NE(res_dec, VPX_CODEC_MEM_ERROR) << decoder->DecodeError();
|
||||
return VPX_CODEC_MEM_ERROR != res_dec;
|
||||
}
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
#include "test/md5_helper.h"
|
||||
#include "test/util.h"
|
||||
#include "test/webm_video_source.h"
|
||||
#include "vpx/vpx_codec.h"
|
||||
#include "vpx_ports/vpx_timer.h"
|
||||
#include "./ivfenc.h"
|
||||
#include "./vpx_version.h"
|
||||
|
||||
using std::make_tuple;
|
||||
|
||||
@@ -36,7 +36,7 @@ const char kNewEncodeOutputFile[] = "new_encode.ivf";
|
||||
/*
|
||||
DecodePerfTest takes a tuple of filename + number of threads to decode with
|
||||
*/
|
||||
typedef std::tuple<const char *, unsigned> DecodePerfParam;
|
||||
using DecodePerfParam = std::tuple<const char *, unsigned int>;
|
||||
|
||||
const DecodePerfParam kVP9DecodePerfVectors[] = {
|
||||
make_tuple("vp90-2-bbb_426x240_tile_1x1_180kbps.webm", 1),
|
||||
@@ -98,7 +98,7 @@ TEST_P(DecodePerfTest, PerfTest) {
|
||||
|
||||
printf("{\n");
|
||||
printf("\t\"type\" : \"decode_perf_test\",\n");
|
||||
printf("\t\"version\" : \"%s\",\n", VERSION_STRING_NOSP);
|
||||
printf("\t\"version\" : \"%s\",\n", vpx_codec_version_str());
|
||||
printf("\t\"videoName\" : \"%s\",\n", video_name);
|
||||
printf("\t\"threadCount\" : %u,\n", threads);
|
||||
printf("\t\"decodeTimeSecs\" : %f,\n", elapsed_secs);
|
||||
@@ -116,11 +116,11 @@ class VP9NewEncodeDecodePerfTest
|
||||
protected:
|
||||
VP9NewEncodeDecodePerfTest()
|
||||
: EncoderTest(GET_PARAM(0)), encoding_mode_(GET_PARAM(1)), speed_(0),
|
||||
outfile_(0), out_frames_(0) {}
|
||||
outfile_(nullptr), out_frames_(0) {}
|
||||
|
||||
virtual ~VP9NewEncodeDecodePerfTest() {}
|
||||
~VP9NewEncodeDecodePerfTest() override = default;
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
InitializeConfig();
|
||||
SetMode(encoding_mode_);
|
||||
|
||||
@@ -137,8 +137,8 @@ class VP9NewEncodeDecodePerfTest
|
||||
cfg_.rc_end_usage = VPX_VBR;
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) {
|
||||
void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) override {
|
||||
if (video->frame() == 0) {
|
||||
encoder->Control(VP8E_SET_CPUUSED, speed_);
|
||||
encoder->Control(VP9E_SET_FRAME_PARALLEL_DECODING, 1);
|
||||
@@ -146,14 +146,14 @@ class VP9NewEncodeDecodePerfTest
|
||||
}
|
||||
}
|
||||
|
||||
virtual void BeginPassHook(unsigned int /*pass*/) {
|
||||
void BeginPassHook(unsigned int /*pass*/) override {
|
||||
const std::string data_path = getenv("LIBVPX_TEST_DATA_PATH");
|
||||
const std::string path_to_source = data_path + "/" + kNewEncodeOutputFile;
|
||||
outfile_ = fopen(path_to_source.c_str(), "wb");
|
||||
ASSERT_NE(outfile_, nullptr);
|
||||
}
|
||||
|
||||
virtual void EndPassHook() {
|
||||
void EndPassHook() override {
|
||||
if (outfile_ != nullptr) {
|
||||
if (!fseek(outfile_, 0, SEEK_SET)) {
|
||||
ivf_write_file_header(outfile_, &cfg_, VP9_FOURCC, out_frames_);
|
||||
@@ -163,7 +163,7 @@ class VP9NewEncodeDecodePerfTest
|
||||
}
|
||||
}
|
||||
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
|
||||
++out_frames_;
|
||||
|
||||
// Write initial file header if first frame.
|
||||
@@ -177,7 +177,7 @@ class VP9NewEncodeDecodePerfTest
|
||||
pkt->data.frame.sz);
|
||||
}
|
||||
|
||||
virtual bool DoDecode() const { return false; }
|
||||
bool DoDecode() const override { return false; }
|
||||
|
||||
void set_speed(unsigned int speed) { speed_ = speed; }
|
||||
|
||||
@@ -249,7 +249,7 @@ TEST_P(VP9NewEncodeDecodePerfTest, PerfTest) {
|
||||
|
||||
printf("{\n");
|
||||
printf("\t\"type\" : \"decode_perf_test\",\n");
|
||||
printf("\t\"version\" : \"%s\",\n", VERSION_STRING_NOSP);
|
||||
printf("\t\"version\" : \"%s\",\n", vpx_codec_version_str());
|
||||
printf("\t\"videoName\" : \"%s\",\n", kNewEncodeOutputFile);
|
||||
printf("\t\"threadCount\" : %u,\n", threads);
|
||||
printf("\t\"decodeTimeSecs\" : %f,\n", elapsed_secs);
|
||||
|
||||
@@ -25,17 +25,16 @@ class DecodeSvcTest : public ::libvpx_test::DecoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<const char *> {
|
||||
protected:
|
||||
DecodeSvcTest() : DecoderTest(GET_PARAM(::libvpx_test::kCodecFactoryParam)) {}
|
||||
virtual ~DecodeSvcTest() {}
|
||||
~DecodeSvcTest() override = default;
|
||||
|
||||
virtual void PreDecodeFrameHook(
|
||||
const libvpx_test::CompressedVideoSource &video,
|
||||
libvpx_test::Decoder *decoder) {
|
||||
void PreDecodeFrameHook(const libvpx_test::CompressedVideoSource &video,
|
||||
libvpx_test::Decoder *decoder) override {
|
||||
if (video.frame_number() == 0)
|
||||
decoder->Control(VP9_DECODE_SVC_SPATIAL_LAYER, spatial_layer_);
|
||||
}
|
||||
|
||||
virtual void DecompressedFrameHook(const vpx_image_t &img,
|
||||
const unsigned int frame_number) {
|
||||
void DecompressedFrameHook(const vpx_image_t &img,
|
||||
const unsigned int frame_number) override {
|
||||
ASSERT_EQ(img.d_w, width_);
|
||||
ASSERT_EQ(img.d_h, height_);
|
||||
total_frames_ = frame_number;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/decode_test_driver.h"
|
||||
@@ -111,7 +111,7 @@ void DecoderTest::RunLoop(CompressedVideoSource *video) {
|
||||
}
|
||||
|
||||
void DecoderTest::set_cfg(const vpx_codec_dec_cfg_t &dec_cfg) {
|
||||
memcpy(&cfg_, &dec_cfg, sizeof(cfg_));
|
||||
cfg_ = dec_cfg;
|
||||
}
|
||||
|
||||
void DecoderTest::set_flags(const vpx_codec_flags_t flags) { flags_ = flags; }
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#ifndef VPX_TEST_DECODE_TEST_DRIVER_H_
|
||||
#define VPX_TEST_DECODE_TEST_DRIVER_H_
|
||||
#include <cstring>
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "./vpx_config.h"
|
||||
#include "vpx/vpx_decoder.h"
|
||||
|
||||
|
||||
+4354
-34
File diff suppressed because it is too large.
Load diff
@@ -7,15 +7,15 @@
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "./vpx_config.h"
|
||||
#include "./vpx_version.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/encode_test_driver.h"
|
||||
#include "test/i420_video_source.h"
|
||||
#include "test/util.h"
|
||||
#include "test/y4m_video_source.h"
|
||||
#include "vpx/vpx_codec.h"
|
||||
#include "vpx_ports/vpx_timer.h"
|
||||
|
||||
namespace {
|
||||
@@ -61,9 +61,9 @@ class VP9EncodePerfTest
|
||||
: EncoderTest(GET_PARAM(0)), min_psnr_(kMaxPsnr), nframes_(0),
|
||||
encoding_mode_(GET_PARAM(1)), speed_(0), threads_(1) {}
|
||||
|
||||
virtual ~VP9EncodePerfTest() {}
|
||||
~VP9EncodePerfTest() override = default;
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
InitializeConfig();
|
||||
SetMode(encoding_mode_);
|
||||
|
||||
@@ -82,8 +82,8 @@ class VP9EncodePerfTest
|
||||
cfg_.g_threads = threads_;
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) {
|
||||
void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) override {
|
||||
if (video->frame() == 0) {
|
||||
const int log2_tile_columns = 3;
|
||||
encoder->Control(VP8E_SET_CPUUSED, speed_);
|
||||
@@ -93,19 +93,19 @@ class VP9EncodePerfTest
|
||||
}
|
||||
}
|
||||
|
||||
virtual void BeginPassHook(unsigned int /*pass*/) {
|
||||
void BeginPassHook(unsigned int /*pass*/) override {
|
||||
min_psnr_ = kMaxPsnr;
|
||||
nframes_ = 0;
|
||||
}
|
||||
|
||||
virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) override {
|
||||
if (pkt->data.psnr.psnr[0] < min_psnr_) {
|
||||
min_psnr_ = pkt->data.psnr.psnr[0];
|
||||
}
|
||||
}
|
||||
|
||||
// for performance reasons don't decode
|
||||
virtual bool DoDecode() const { return false; }
|
||||
bool DoDecode() const override { return false; }
|
||||
|
||||
double min_psnr() const { return min_psnr_; }
|
||||
|
||||
@@ -169,7 +169,7 @@ TEST_P(VP9EncodePerfTest, PerfTest) {
|
||||
|
||||
printf("{\n");
|
||||
printf("\t\"type\" : \"encode_perf_test\",\n");
|
||||
printf("\t\"version\" : \"%s\",\n", VERSION_STRING_NOSP);
|
||||
printf("\t\"version\" : \"%s\",\n", vpx_codec_version_str());
|
||||
printf("\t\"videoName\" : \"%s\",\n", display_name.c_str());
|
||||
printf("\t\"encodeTimeSecs\" : %f,\n", elapsed_secs);
|
||||
printf("\t\"totalFrames\" : %u,\n", frames);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#include "test/codec_factory.h"
|
||||
@@ -52,7 +52,8 @@ void Encoder::InitEncoder(VideoSource *video) {
|
||||
}
|
||||
}
|
||||
|
||||
void Encoder::EncodeFrame(VideoSource *video, const unsigned long frame_flags) {
|
||||
void Encoder::EncodeFrame(VideoSource *video,
|
||||
const vpx_enc_frame_flags_t frame_flags) {
|
||||
if (video->img()) {
|
||||
EncodeFrameInternal(*video, frame_flags);
|
||||
} else {
|
||||
@@ -70,7 +71,7 @@ void Encoder::EncodeFrame(VideoSource *video, const unsigned long frame_flags) {
|
||||
}
|
||||
|
||||
void Encoder::EncodeFrameInternal(const VideoSource &video,
|
||||
const unsigned long frame_flags) {
|
||||
const vpx_enc_frame_flags_t frame_flags) {
|
||||
vpx_codec_err_t res;
|
||||
const vpx_image_t *img = video.img();
|
||||
|
||||
@@ -169,7 +170,7 @@ void EncoderTest::RunLoop(VideoSource *video) {
|
||||
|
||||
ASSERT_TRUE(passes_ == 1 || passes_ == 2);
|
||||
for (unsigned int pass = 0; pass < passes_; pass++) {
|
||||
last_pts_ = 0;
|
||||
vpx_codec_pts_t last_pts = 0;
|
||||
|
||||
if (passes_ == 1) {
|
||||
cfg_.g_pass = VPX_RC_ONE_PASS;
|
||||
@@ -225,8 +226,8 @@ void EncoderTest::RunLoop(VideoSource *video) {
|
||||
|
||||
has_dxdata = true;
|
||||
}
|
||||
ASSERT_GE(pkt->data.frame.pts, last_pts_);
|
||||
last_pts_ = pkt->data.frame.pts;
|
||||
ASSERT_GE(pkt->data.frame.pts, last_pts);
|
||||
last_pts = pkt->data.frame.pts;
|
||||
FramePktHook(pkt);
|
||||
break;
|
||||
|
||||
|
||||
@@ -13,13 +13,13 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#if CONFIG_VP8_ENCODER || CONFIG_VP9_ENCODER
|
||||
#include "vpx/vp8cx.h"
|
||||
#endif
|
||||
#include "vpx/vpx_encoder.h"
|
||||
#include "vpx/vpx_tpl.h"
|
||||
|
||||
namespace libvpx_test {
|
||||
|
||||
@@ -33,15 +33,24 @@ enum TestMode {
|
||||
kTwoPassGood,
|
||||
kTwoPassBest
|
||||
};
|
||||
|
||||
#if CONFIG_REALTIME_ONLY
|
||||
#define ALL_TEST_MODES ::testing::Values(::libvpx_test::kRealTime)
|
||||
#define ONE_PASS_TEST_MODES ::testing::Values(::libvpx_test::kRealTime)
|
||||
#define ONE_OR_TWO_PASS_TEST_MODES ::testing::Values(::libvpx_test::kRealTime)
|
||||
#else
|
||||
#define ALL_TEST_MODES \
|
||||
::testing::Values(::libvpx_test::kRealTime, ::libvpx_test::kOnePassGood, \
|
||||
::libvpx_test::kOnePassBest, ::libvpx_test::kTwoPassGood, \
|
||||
::libvpx_test::kTwoPassBest)
|
||||
|
||||
#define ONE_PASS_TEST_MODES \
|
||||
::testing::Values(::libvpx_test::kRealTime, ::libvpx_test::kOnePassGood, \
|
||||
::libvpx_test::kOnePassBest)
|
||||
|
||||
#define ONE_OR_TWO_PASS_TEST_MODES \
|
||||
::testing::Values(::libvpx_test::kOnePassGood, ::libvpx_test::kTwoPassGood)
|
||||
#endif
|
||||
|
||||
#define TWO_PASS_TEST_MODES \
|
||||
::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kTwoPassBest)
|
||||
|
||||
@@ -86,7 +95,7 @@ class TwopassStatsStore {
|
||||
// level of abstraction will be fleshed out as more tests are written.
|
||||
class Encoder {
|
||||
public:
|
||||
Encoder(vpx_codec_enc_cfg_t cfg, unsigned long deadline,
|
||||
Encoder(vpx_codec_enc_cfg_t cfg, vpx_enc_deadline_t deadline,
|
||||
const unsigned long init_flags, TwopassStatsStore *stats)
|
||||
: cfg_(cfg), deadline_(deadline), init_flags_(init_flags), stats_(stats) {
|
||||
memset(&encoder_, 0, sizeof(encoder_));
|
||||
@@ -103,7 +112,7 @@ class Encoder {
|
||||
}
|
||||
// This is a thin wrapper around vpx_codec_encode(), so refer to
|
||||
// vpx_encoder.h for its semantics.
|
||||
void EncodeFrame(VideoSource *video, const unsigned long frame_flags);
|
||||
void EncodeFrame(VideoSource *video, vpx_enc_frame_flags_t frame_flags);
|
||||
|
||||
// Convenience wrapper for EncodeFrame()
|
||||
void EncodeFrame(VideoSource *video) { EncodeFrame(video, 0); }
|
||||
@@ -153,6 +162,11 @@ class Encoder {
|
||||
const vpx_codec_err_t res = vpx_codec_control_(&encoder_, ctrl_id, arg);
|
||||
ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
|
||||
}
|
||||
|
||||
void Control(int ctrl_id, VpxTplGopStats *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
|
||||
@@ -172,7 +186,7 @@ class Encoder {
|
||||
cfg_ = *cfg;
|
||||
}
|
||||
|
||||
void set_deadline(unsigned long deadline) { deadline_ = deadline; }
|
||||
void set_deadline(vpx_enc_deadline_t deadline) { deadline_ = deadline; }
|
||||
|
||||
protected:
|
||||
virtual vpx_codec_iface_t *CodecInterface() const = 0;
|
||||
@@ -184,14 +198,14 @@ class Encoder {
|
||||
|
||||
// Encode an image
|
||||
void EncodeFrameInternal(const VideoSource &video,
|
||||
const unsigned long frame_flags);
|
||||
vpx_enc_frame_flags_t frame_flags);
|
||||
|
||||
// Flush the encoder on EOS
|
||||
void Flush();
|
||||
|
||||
vpx_codec_ctx_t encoder_;
|
||||
vpx_codec_enc_cfg_t cfg_;
|
||||
unsigned long deadline_;
|
||||
vpx_enc_deadline_t deadline_;
|
||||
unsigned long init_flags_;
|
||||
TwopassStatsStore *stats_;
|
||||
};
|
||||
@@ -206,8 +220,7 @@ class Encoder {
|
||||
class EncoderTest {
|
||||
protected:
|
||||
explicit EncoderTest(const CodecFactory *codec)
|
||||
: codec_(codec), abort_(false), init_flags_(0), frame_flags_(0),
|
||||
last_pts_(0) {
|
||||
: codec_(codec), abort_(false), init_flags_(0), frame_flags_(0) {
|
||||
// Default to 1 thread.
|
||||
cfg_.g_threads = 1;
|
||||
}
|
||||
@@ -260,7 +273,7 @@ class EncoderTest {
|
||||
|
||||
const CodecFactory *codec_;
|
||||
// Hook to determine whether to decode frame after encoding
|
||||
virtual bool DoDecode() const { return 1; }
|
||||
virtual bool DoDecode() const { return true; }
|
||||
|
||||
// Hook to handle encode/decode mismatch
|
||||
virtual void MismatchHook(const vpx_image_t *img1, const vpx_image_t *img2);
|
||||
@@ -287,11 +300,10 @@ class EncoderTest {
|
||||
vpx_codec_enc_cfg_t cfg_;
|
||||
vpx_codec_dec_cfg_t dec_cfg_;
|
||||
unsigned int passes_;
|
||||
unsigned long deadline_;
|
||||
vpx_enc_deadline_t deadline_;
|
||||
TwopassStatsStore stats_;
|
||||
unsigned long init_flags_;
|
||||
unsigned long frame_flags_;
|
||||
vpx_codec_pts_t last_pts_;
|
||||
vpx_enc_frame_flags_t frame_flags_;
|
||||
};
|
||||
|
||||
} // namespace libvpx_test
|
||||
|
||||
@@ -8,11 +8,12 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/encode_test_driver.h"
|
||||
#include "test/i420_video_source.h"
|
||||
#include "test/util.h"
|
||||
#include "vpx_config.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -30,7 +31,7 @@ class ErrorResilienceTestLarge
|
||||
Reset();
|
||||
}
|
||||
|
||||
virtual ~ErrorResilienceTestLarge() {}
|
||||
~ErrorResilienceTestLarge() override = default;
|
||||
|
||||
void Reset() {
|
||||
error_nframes_ = 0;
|
||||
@@ -38,19 +39,19 @@ class ErrorResilienceTestLarge
|
||||
pattern_switch_ = 0;
|
||||
}
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
InitializeConfig();
|
||||
SetMode(encoding_mode_);
|
||||
}
|
||||
|
||||
virtual void BeginPassHook(unsigned int /*pass*/) {
|
||||
void BeginPassHook(unsigned int /*pass*/) override {
|
||||
psnr_ = 0.0;
|
||||
nframes_ = 0;
|
||||
mismatch_psnr_ = 0.0;
|
||||
mismatch_nframes_ = 0;
|
||||
}
|
||||
|
||||
virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) override {
|
||||
psnr_ += pkt->data.psnr.psnr[0];
|
||||
nframes_++;
|
||||
}
|
||||
@@ -90,7 +91,7 @@ class ErrorResilienceTestLarge
|
||||
return frame_flags;
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video) {
|
||||
void PreEncodeFrameHook(libvpx_test::VideoSource *video) override {
|
||||
frame_flags_ &=
|
||||
~(VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF);
|
||||
// For temporal layer case.
|
||||
@@ -129,21 +130,21 @@ class ErrorResilienceTestLarge
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
virtual bool DoDecode() const {
|
||||
bool DoDecode() const override {
|
||||
if (error_nframes_ > 0 &&
|
||||
(cfg_.g_pass == VPX_RC_LAST_PASS || cfg_.g_pass == VPX_RC_ONE_PASS)) {
|
||||
for (unsigned int i = 0; i < error_nframes_; ++i) {
|
||||
if (error_frames_[i] == nframes_ - 1) {
|
||||
std::cout << " Skipping decoding frame: "
|
||||
<< error_frames_[i] << "\n";
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void MismatchHook(const vpx_image_t *img1, const vpx_image_t *img2) {
|
||||
void MismatchHook(const vpx_image_t *img1, const vpx_image_t *img2) override {
|
||||
double mismatch_psnr = compute_psnr(img1, img2);
|
||||
mismatch_psnr_ += mismatch_psnr;
|
||||
++mismatch_nframes_;
|
||||
@@ -194,6 +195,10 @@ class ErrorResilienceTestLarge
|
||||
};
|
||||
|
||||
TEST_P(ErrorResilienceTestLarge, OnVersusOff) {
|
||||
#if CONFIG_REALTIME_ONLY
|
||||
GTEST_SKIP()
|
||||
<< "Non-zero g_lag_in_frames is unsupported with CONFIG_REALTIME_ONLY";
|
||||
#else
|
||||
const vpx_rational timebase = { 33333333, 1000000000 };
|
||||
cfg_.g_timebase = timebase;
|
||||
cfg_.rc_target_bitrate = 2000;
|
||||
@@ -222,6 +227,7 @@ TEST_P(ErrorResilienceTestLarge, OnVersusOff) {
|
||||
EXPECT_GE(psnr_ratio, 0.9);
|
||||
EXPECT_LE(psnr_ratio, 1.1);
|
||||
}
|
||||
#endif // CONFIG_REALTIME_ONLY
|
||||
}
|
||||
|
||||
// Check for successful decoding and no encoder/decoder mismatch
|
||||
@@ -381,7 +387,7 @@ class ErrorResilienceTestLargeCodecControls
|
||||
Reset();
|
||||
}
|
||||
|
||||
virtual ~ErrorResilienceTestLargeCodecControls() {}
|
||||
~ErrorResilienceTestLargeCodecControls() override = default;
|
||||
|
||||
void Reset() {
|
||||
last_pts_ = 0;
|
||||
@@ -393,7 +399,7 @@ class ErrorResilienceTestLargeCodecControls
|
||||
duration_ = 0.0;
|
||||
}
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
InitializeConfig();
|
||||
SetMode(encoding_mode_);
|
||||
}
|
||||
@@ -460,8 +466,8 @@ class ErrorResilienceTestLargeCodecControls
|
||||
return layer_id;
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
|
||||
libvpx_test::Encoder *encoder) {
|
||||
void PreEncodeFrameHook(libvpx_test::VideoSource *video,
|
||||
libvpx_test::Encoder *encoder) override {
|
||||
if (cfg_.ts_number_layers > 1) {
|
||||
int layer_id = SetLayerId(video->frame(), cfg_.ts_number_layers);
|
||||
int frame_flags = SetFrameFlags(video->frame(), cfg_.ts_number_layers);
|
||||
@@ -476,7 +482,7 @@ class ErrorResilienceTestLargeCodecControls
|
||||
}
|
||||
}
|
||||
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
|
||||
// Time since last timestamp = duration.
|
||||
vpx_codec_pts_t duration = pkt->data.frame.pts - last_pts_;
|
||||
if (duration > 1) {
|
||||
@@ -496,7 +502,7 @@ class ErrorResilienceTestLargeCodecControls
|
||||
++tot_frame_number_;
|
||||
}
|
||||
|
||||
virtual void EndPassHook(void) {
|
||||
void EndPassHook() override {
|
||||
duration_ = (last_pts_ + 1) * timebase_;
|
||||
if (cfg_.ts_number_layers > 1) {
|
||||
for (int layer = 0; layer < static_cast<int>(cfg_.ts_number_layers);
|
||||
|
||||
@@ -210,13 +210,12 @@ class ExternalFrameBufferMD5Test
|
||||
: DecoderTest(GET_PARAM(::libvpx_test::kCodecFactoryParam)),
|
||||
md5_file_(nullptr), num_buffers_(0) {}
|
||||
|
||||
virtual ~ExternalFrameBufferMD5Test() {
|
||||
~ExternalFrameBufferMD5Test() override {
|
||||
if (md5_file_ != nullptr) fclose(md5_file_);
|
||||
}
|
||||
|
||||
virtual void PreDecodeFrameHook(
|
||||
const libvpx_test::CompressedVideoSource &video,
|
||||
libvpx_test::Decoder *decoder) {
|
||||
void PreDecodeFrameHook(const libvpx_test::CompressedVideoSource &video,
|
||||
libvpx_test::Decoder *decoder) override {
|
||||
if (num_buffers_ > 0 && video.frame_number() == 0) {
|
||||
// Have libvpx use frame buffers we create.
|
||||
ASSERT_TRUE(fb_list_.CreateBufferList(num_buffers_));
|
||||
@@ -232,8 +231,8 @@ class ExternalFrameBufferMD5Test
|
||||
<< "Md5 file open failed. Filename: " << md5_file_name_;
|
||||
}
|
||||
|
||||
virtual void DecompressedFrameHook(const vpx_image_t &img,
|
||||
const unsigned int frame_number) {
|
||||
void DecompressedFrameHook(const vpx_image_t &img,
|
||||
const unsigned int frame_number) override {
|
||||
ASSERT_NE(md5_file_, nullptr);
|
||||
char expected_md5[33];
|
||||
char junk[128];
|
||||
@@ -289,7 +288,7 @@ class ExternalFrameBufferTest : public ::testing::Test {
|
||||
ExternalFrameBufferTest()
|
||||
: video_(nullptr), decoder_(nullptr), num_buffers_(0) {}
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
video_ = new libvpx_test::WebMVideoSource(kVP9TestFile);
|
||||
ASSERT_NE(video_, nullptr);
|
||||
video_->Init();
|
||||
@@ -300,7 +299,7 @@ class ExternalFrameBufferTest : public ::testing::Test {
|
||||
ASSERT_NE(decoder_, nullptr);
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
void TearDown() override {
|
||||
delete decoder_;
|
||||
decoder_ = nullptr;
|
||||
delete video_;
|
||||
@@ -355,7 +354,7 @@ class ExternalFrameBufferTest : public ::testing::Test {
|
||||
|
||||
class ExternalFrameBufferNonRefTest : public ExternalFrameBufferTest {
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
video_ = new libvpx_test::WebMVideoSource(kVP9NonRefTestFile);
|
||||
ASSERT_NE(video_, nullptr);
|
||||
video_->Init();
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <string.h>
|
||||
#include <tuple>
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "./vp9_rtcd.h"
|
||||
#include "./vpx_dsp_rtcd.h"
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "test/util.h"
|
||||
#include "vp9/common/vp9_entropy.h"
|
||||
#include "vp9/common/vp9_scan.h"
|
||||
#include "vpx_config.h"
|
||||
#include "vpx/vpx_codec.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
#include "vpx_ports/mem.h"
|
||||
@@ -37,16 +38,16 @@ const double kPi = 3.141592653589793238462643383279502884;
|
||||
const int kSignBiasMaxDiff255 = 1500;
|
||||
const int kSignBiasMaxDiff15 = 10000;
|
||||
|
||||
typedef void (*FdctFunc)(const int16_t *in, tran_low_t *out, int stride);
|
||||
typedef void (*IdctFunc)(const tran_low_t *in, uint8_t *out, int stride);
|
||||
typedef void (*FhtFunc)(const int16_t *in, tran_low_t *out, int stride,
|
||||
int tx_type);
|
||||
typedef void (*IhtFunc)(const tran_low_t *in, uint8_t *out, int stride,
|
||||
int tx_type);
|
||||
using FdctFunc = void (*)(const int16_t *in, tran_low_t *out, int stride);
|
||||
using IdctFunc = void (*)(const tran_low_t *in, uint8_t *out, int stride);
|
||||
using FhtFunc = void (*)(const int16_t *in, tran_low_t *out, int stride,
|
||||
int tx_type);
|
||||
using IhtFunc = void (*)(const tran_low_t *in, uint8_t *out, int stride,
|
||||
int tx_type);
|
||||
|
||||
typedef std::tuple<FdctFunc, IdctFunc, int, vpx_bit_depth_t> Dct8x8Param;
|
||||
typedef std::tuple<FhtFunc, IhtFunc, int, vpx_bit_depth_t> Ht8x8Param;
|
||||
typedef std::tuple<IdctFunc, IdctFunc, int, vpx_bit_depth_t> Idct8x8Param;
|
||||
using Dct8x8Param = std::tuple<FdctFunc, IdctFunc, int, vpx_bit_depth_t>;
|
||||
using Ht8x8Param = std::tuple<FhtFunc, IhtFunc, int, vpx_bit_depth_t>;
|
||||
using Idct8x8Param = std::tuple<IdctFunc, IdctFunc, int, vpx_bit_depth_t>;
|
||||
|
||||
void reference_8x8_dct_1d(const double in[8], double out[8]) {
|
||||
const double kInvSqrt2 = 0.707106781186547524400844362104;
|
||||
@@ -132,9 +133,21 @@ void idct8x8_64_add_12_sse2(const tran_low_t *in, uint8_t *out, int stride) {
|
||||
#endif // HAVE_SSE2
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
|
||||
// Visual Studio 2022 (cl.exe) < 17.12.3 targeting AArch64 with optimizations
|
||||
// enabled produces invalid code in RunExtremalCheck() and
|
||||
// RunInvAccuracyCheck(). See:
|
||||
// https://developercommunity.visualstudio.com/t/1770-preview-1:-Misoptimization-for-AR/10369786
|
||||
#if defined(_MSC_FULL_VER) && _MSC_FULL_VER < 194234435 && \
|
||||
defined(_M_ARM64) && !defined(__clang__)
|
||||
#define AOM_WORK_AROUND_MSVC_BUG_10369786
|
||||
#endif
|
||||
|
||||
#ifdef AOM_WORK_AROUND_MSVC_BUG_10369786
|
||||
#pragma optimize("", off)
|
||||
#endif
|
||||
class FwdTrans8x8TestBase {
|
||||
public:
|
||||
virtual ~FwdTrans8x8TestBase() {}
|
||||
virtual ~FwdTrans8x8TestBase() = default;
|
||||
|
||||
protected:
|
||||
virtual void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) = 0;
|
||||
@@ -170,7 +183,7 @@ class FwdTrans8x8TestBase {
|
||||
for (int j = 0; j < 64; ++j) {
|
||||
const int diff = abs(count_sign_block[j][0] - count_sign_block[j][1]);
|
||||
const int max_diff = kSignBiasMaxDiff255;
|
||||
EXPECT_LT(diff, max_diff << (bit_depth_ - 8))
|
||||
ASSERT_LT(diff, max_diff << (bit_depth_ - 8))
|
||||
<< "Error: 8x8 FDCT/FHT has a sign bias > "
|
||||
<< 1. * max_diff / count_test_block * 100 << "%"
|
||||
<< " for input range [-255, 255] at index " << j
|
||||
@@ -201,7 +214,7 @@ class FwdTrans8x8TestBase {
|
||||
for (int j = 0; j < 64; ++j) {
|
||||
const int diff = abs(count_sign_block[j][0] - count_sign_block[j][1]);
|
||||
const int max_diff = kSignBiasMaxDiff15;
|
||||
EXPECT_LT(diff, max_diff << (bit_depth_ - 8))
|
||||
ASSERT_LT(diff, max_diff << (bit_depth_ - 8))
|
||||
<< "Error: 8x8 FDCT/FHT has a sign bias > "
|
||||
<< 1. * max_diff / count_test_block * 100 << "%"
|
||||
<< " for input range [-15, 15] at index " << j
|
||||
@@ -275,11 +288,11 @@ class FwdTrans8x8TestBase {
|
||||
}
|
||||
}
|
||||
|
||||
EXPECT_GE(1 << 2 * (bit_depth_ - 8), max_error)
|
||||
ASSERT_GE(1 << 2 * (bit_depth_ - 8), max_error)
|
||||
<< "Error: 8x8 FDCT/IDCT or FHT/IHT has an individual"
|
||||
<< " roundtrip error > 1";
|
||||
|
||||
EXPECT_GE((count_test_block << 2 * (bit_depth_ - 8)) / 5, total_error)
|
||||
ASSERT_GE((count_test_block << 2 * (bit_depth_ - 8)) / 5, total_error)
|
||||
<< "Error: 8x8 FDCT/IDCT or FHT/IHT has average roundtrip "
|
||||
<< "error > 1/5 per block";
|
||||
}
|
||||
@@ -360,17 +373,17 @@ class FwdTrans8x8TestBase {
|
||||
total_coeff_error += abs(coeff_diff);
|
||||
}
|
||||
|
||||
EXPECT_GE(1 << 2 * (bit_depth_ - 8), max_error)
|
||||
ASSERT_GE(1 << 2 * (bit_depth_ - 8), max_error)
|
||||
<< "Error: Extremal 8x8 FDCT/IDCT or FHT/IHT has"
|
||||
<< "an individual roundtrip error > 1";
|
||||
<< " an individual roundtrip error > 1";
|
||||
|
||||
EXPECT_GE((count_test_block << 2 * (bit_depth_ - 8)) / 5, total_error)
|
||||
ASSERT_GE((count_test_block << 2 * (bit_depth_ - 8)) / 5, total_error)
|
||||
<< "Error: Extremal 8x8 FDCT/IDCT or FHT/IHT has average"
|
||||
<< " roundtrip error > 1/5 per block";
|
||||
|
||||
EXPECT_EQ(0, total_coeff_error)
|
||||
ASSERT_EQ(0, total_coeff_error)
|
||||
<< "Error: Extremal 8x8 FDCT/FHT has"
|
||||
<< "overflow issues in the intermediate steps > 1";
|
||||
<< " overflow issues in the intermediate steps > 1";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -426,7 +439,7 @@ class FwdTrans8x8TestBase {
|
||||
const int diff = dst[j] - src[j];
|
||||
#endif
|
||||
const uint32_t error = diff * diff;
|
||||
EXPECT_GE(1u << 2 * (bit_depth_ - 8), error)
|
||||
ASSERT_GE(1u << 2 * (bit_depth_ - 8), error)
|
||||
<< "Error: 8x8 IDCT has error " << error << " at index " << j;
|
||||
}
|
||||
}
|
||||
@@ -456,7 +469,7 @@ class FwdTrans8x8TestBase {
|
||||
for (int j = 0; j < kNumCoeffs; ++j) {
|
||||
const int32_t diff = coeff[j] - coeff_r[j];
|
||||
const uint32_t error = diff * diff;
|
||||
EXPECT_GE(9u << 2 * (bit_depth_ - 8), error)
|
||||
ASSERT_GE(9u << 2 * (bit_depth_ - 8), error)
|
||||
<< "Error: 8x8 DCT has error " << error << " at index " << j;
|
||||
}
|
||||
}
|
||||
@@ -512,7 +525,7 @@ class FwdTrans8x8TestBase {
|
||||
const int diff = dst[j] - ref[j];
|
||||
#endif
|
||||
const uint32_t error = diff * diff;
|
||||
EXPECT_EQ(0u, error)
|
||||
ASSERT_EQ(0u, error)
|
||||
<< "Error: 8x8 IDCT has error " << error << " at index " << j;
|
||||
}
|
||||
}
|
||||
@@ -523,13 +536,16 @@ class FwdTrans8x8TestBase {
|
||||
vpx_bit_depth_t bit_depth_;
|
||||
int mask_;
|
||||
};
|
||||
#ifdef AOM_WORK_AROUND_MSVC_BUG_10369786
|
||||
#pragma optimize("", on)
|
||||
#endif
|
||||
|
||||
class FwdTrans8x8DCT : public FwdTrans8x8TestBase,
|
||||
public ::testing::TestWithParam<Dct8x8Param> {
|
||||
public:
|
||||
virtual ~FwdTrans8x8DCT() {}
|
||||
~FwdTrans8x8DCT() override = default;
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
fwd_txfm_ = GET_PARAM(0);
|
||||
inv_txfm_ = GET_PARAM(1);
|
||||
tx_type_ = GET_PARAM(2);
|
||||
@@ -539,13 +555,13 @@ class FwdTrans8x8DCT : public FwdTrans8x8TestBase,
|
||||
mask_ = (1 << bit_depth_) - 1;
|
||||
}
|
||||
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
void TearDown() override { libvpx_test::ClearSystemState(); }
|
||||
|
||||
protected:
|
||||
void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) {
|
||||
void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) override {
|
||||
fwd_txfm_(in, out, stride);
|
||||
}
|
||||
void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
|
||||
void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) override {
|
||||
inv_txfm_(out, dst, stride);
|
||||
}
|
||||
|
||||
@@ -566,9 +582,9 @@ TEST_P(FwdTrans8x8DCT, InvAccuracyCheck) { RunInvAccuracyCheck(); }
|
||||
class FwdTrans8x8HT : public FwdTrans8x8TestBase,
|
||||
public ::testing::TestWithParam<Ht8x8Param> {
|
||||
public:
|
||||
virtual ~FwdTrans8x8HT() {}
|
||||
~FwdTrans8x8HT() override = default;
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
fwd_txfm_ = GET_PARAM(0);
|
||||
inv_txfm_ = GET_PARAM(1);
|
||||
tx_type_ = GET_PARAM(2);
|
||||
@@ -578,13 +594,13 @@ class FwdTrans8x8HT : public FwdTrans8x8TestBase,
|
||||
mask_ = (1 << bit_depth_) - 1;
|
||||
}
|
||||
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
void TearDown() override { libvpx_test::ClearSystemState(); }
|
||||
|
||||
protected:
|
||||
void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) {
|
||||
void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) override {
|
||||
fwd_txfm_(in, out, stride, tx_type_);
|
||||
}
|
||||
void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
|
||||
void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) override {
|
||||
inv_txfm_(out, dst, stride, tx_type_);
|
||||
}
|
||||
|
||||
@@ -602,9 +618,9 @@ TEST_P(FwdTrans8x8HT, ExtremalCheck) { RunExtremalCheck(); }
|
||||
class InvTrans8x8DCT : public FwdTrans8x8TestBase,
|
||||
public ::testing::TestWithParam<Idct8x8Param> {
|
||||
public:
|
||||
virtual ~InvTrans8x8DCT() {}
|
||||
~InvTrans8x8DCT() override = default;
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
ref_txfm_ = GET_PARAM(0);
|
||||
inv_txfm_ = GET_PARAM(1);
|
||||
thresh_ = GET_PARAM(2);
|
||||
@@ -613,13 +629,14 @@ class InvTrans8x8DCT : public FwdTrans8x8TestBase,
|
||||
mask_ = (1 << bit_depth_) - 1;
|
||||
}
|
||||
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
void TearDown() override { libvpx_test::ClearSystemState(); }
|
||||
|
||||
protected:
|
||||
void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
|
||||
void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) override {
|
||||
inv_txfm_(out, dst, stride);
|
||||
}
|
||||
void RunFwdTxfm(int16_t * /*out*/, tran_low_t * /*dst*/, int /*stride*/) {}
|
||||
void RunFwdTxfm(int16_t * /*out*/, tran_low_t * /*dst*/,
|
||||
int /*stride*/) override {}
|
||||
|
||||
IdctFunc ref_txfm_;
|
||||
IdctFunc inv_txfm_;
|
||||
|
||||
@@ -9,17 +9,17 @@
|
||||
*/
|
||||
#include <memory>
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "test/video_source.h"
|
||||
#include "vpx_config.h"
|
||||
|
||||
namespace {
|
||||
|
||||
class EncoderWithExpectedError : public ::libvpx_test::Encoder {
|
||||
public:
|
||||
EncoderWithExpectedError(vpx_codec_enc_cfg_t cfg,
|
||||
unsigned long deadline, // NOLINT
|
||||
EncoderWithExpectedError(vpx_codec_enc_cfg_t cfg, vpx_enc_deadline_t deadline,
|
||||
const unsigned long init_flags, // NOLINT
|
||||
::libvpx_test::TwopassStatsStore *stats)
|
||||
: ::libvpx_test::Encoder(cfg, deadline, init_flags, stats) {}
|
||||
@@ -65,7 +65,7 @@ class EncoderWithExpectedError : public ::libvpx_test::Encoder {
|
||||
ASSERT_EQ(expected_err, res) << EncoderError();
|
||||
}
|
||||
|
||||
virtual vpx_codec_iface_t *CodecInterface() const {
|
||||
vpx_codec_iface_t *CodecInterface() const override {
|
||||
#if CONFIG_VP9_ENCODER
|
||||
return &vpx_codec_vp9_cx_algo;
|
||||
#else
|
||||
@@ -79,22 +79,22 @@ class VP9FrameSizeTestsLarge : public ::libvpx_test::EncoderTest,
|
||||
protected:
|
||||
VP9FrameSizeTestsLarge()
|
||||
: EncoderTest(&::libvpx_test::kVP9), expected_res_(VPX_CODEC_OK) {}
|
||||
virtual ~VP9FrameSizeTestsLarge() {}
|
||||
~VP9FrameSizeTestsLarge() override = default;
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
InitializeConfig();
|
||||
SetMode(::libvpx_test::kRealTime);
|
||||
}
|
||||
|
||||
virtual bool HandleDecodeResult(const vpx_codec_err_t res_dec,
|
||||
const libvpx_test::VideoSource & /*video*/,
|
||||
libvpx_test::Decoder *decoder) {
|
||||
bool HandleDecodeResult(const vpx_codec_err_t res_dec,
|
||||
const libvpx_test::VideoSource & /*video*/,
|
||||
libvpx_test::Decoder *decoder) override {
|
||||
EXPECT_EQ(expected_res_, res_dec) << decoder->DecodeError();
|
||||
return !::testing::Test::HasFailure();
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) {
|
||||
void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) override {
|
||||
if (video->frame() == 0) {
|
||||
encoder->Control(VP8E_SET_CPUUSED, 7);
|
||||
encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1);
|
||||
@@ -111,7 +111,7 @@ class VP9FrameSizeTestsLarge : public ::libvpx_test::EncoderTest,
|
||||
|
||||
ASSERT_TRUE(passes_ == 1 || passes_ == 2);
|
||||
for (unsigned int pass = 0; pass < passes_; pass++) {
|
||||
last_pts_ = 0;
|
||||
vpx_codec_pts_t last_pts = 0;
|
||||
|
||||
if (passes_ == 1) {
|
||||
cfg_.g_pass = VPX_RC_ONE_PASS;
|
||||
@@ -144,8 +144,8 @@ class VP9FrameSizeTestsLarge : public ::libvpx_test::EncoderTest,
|
||||
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;
|
||||
ASSERT_GE(pkt->data.frame.pts, last_pts);
|
||||
last_pts = pkt->data.frame.pts;
|
||||
FramePktHook(pkt);
|
||||
break;
|
||||
|
||||
@@ -168,6 +168,9 @@ class VP9FrameSizeTestsLarge : public ::libvpx_test::EncoderTest,
|
||||
};
|
||||
|
||||
TEST_F(VP9FrameSizeTestsLarge, TestInvalidSizes) {
|
||||
#ifdef CHROMIUM
|
||||
GTEST_SKIP() << "16K framebuffers are not supported by Chromium's allocator.";
|
||||
#else
|
||||
::libvpx_test::RandomVideoSource video;
|
||||
|
||||
#if CONFIG_SIZE_LIMIT
|
||||
@@ -176,9 +179,16 @@ TEST_F(VP9FrameSizeTestsLarge, TestInvalidSizes) {
|
||||
expected_res_ = VPX_CODEC_MEM_ERROR;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video, expected_res_));
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST_F(VP9FrameSizeTestsLarge, ValidSizes) {
|
||||
#ifdef CHROMIUM
|
||||
GTEST_SKIP()
|
||||
<< "Under Chromium's configuration the allocator is unable to provide"
|
||||
"the space required for a single frame at the maximum resolution.";
|
||||
#else
|
||||
::libvpx_test::RandomVideoSource video;
|
||||
|
||||
#if CONFIG_SIZE_LIMIT
|
||||
@@ -194,7 +204,7 @@ TEST_F(VP9FrameSizeTestsLarge, ValidSizes) {
|
||||
// size or almost 1 gig of memory.
|
||||
// In total the allocations will exceed 2GiB which may cause a failure with
|
||||
// mingw + wine, use a smaller size in that case.
|
||||
#if defined(_WIN32) && !defined(_WIN64) || defined(__OS2__)
|
||||
#if defined(_WIN32) && !defined(_WIN64)
|
||||
video.SetSize(4096, 3072);
|
||||
#else
|
||||
video.SetSize(4096, 4096);
|
||||
@@ -203,6 +213,8 @@ TEST_F(VP9FrameSizeTestsLarge, ValidSizes) {
|
||||
expected_res_ = VPX_CODEC_OK;
|
||||
ASSERT_NO_FATAL_FAILURE(::libvpx_test::EncoderTest::RunLoop(&video));
|
||||
#endif
|
||||
|
||||
#endif // defined(CHROMIUM)
|
||||
}
|
||||
|
||||
TEST_F(VP9FrameSizeTestsLarge, OneByOneVideo) {
|
||||
|
||||
@@ -10,20 +10,21 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "./vpx_dsp_rtcd.h"
|
||||
#include "vpx_ports/vpx_timer.h"
|
||||
|
||||
#include "test/acm_random.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "vpx_config.h"
|
||||
|
||||
namespace {
|
||||
|
||||
using ::libvpx_test::ACMRandom;
|
||||
|
||||
typedef void (*HadamardFunc)(const int16_t *a, ptrdiff_t a_stride,
|
||||
tran_low_t *b);
|
||||
using HadamardFunc = void (*)(const int16_t *a, ptrdiff_t a_stride,
|
||||
tran_low_t *b);
|
||||
|
||||
void hadamard_loop(const tran_low_t *a, tran_low_t *out) {
|
||||
tran_low_t b[8];
|
||||
@@ -130,13 +131,19 @@ std::ostream &operator<<(std::ostream &os, const HadamardFuncWithSize &hfs) {
|
||||
|
||||
class HadamardTestBase : public ::testing::TestWithParam<HadamardFuncWithSize> {
|
||||
public:
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
h_func_ = GetParam().func;
|
||||
bwh_ = GetParam().block_size;
|
||||
block_size_ = bwh_ * bwh_;
|
||||
rnd_.Reset(ACMRandom::DeterministicSeed());
|
||||
}
|
||||
|
||||
// The Rand() function generates values in the range [-((1 << BitDepth) - 1),
|
||||
// (1 << BitDepth) - 1]. This is because the input to the Hadamard transform
|
||||
// is the residual pixel, which is defined as 'source pixel - predicted
|
||||
// pixel'. Source pixel and predicted pixel take values in the range
|
||||
// [0, (1 << BitDepth) - 1] and thus the residual pixel ranges from
|
||||
// -((1 << BitDepth) - 1) to ((1 << BitDepth) - 1).
|
||||
virtual int16_t Rand() = 0;
|
||||
|
||||
void ReferenceHadamard(const int16_t *a, int a_stride, tran_low_t *b,
|
||||
@@ -170,6 +177,31 @@ class HadamardTestBase : public ::testing::TestWithParam<HadamardFuncWithSize> {
|
||||
EXPECT_EQ(0, memcmp(b, b_ref, sizeof(b)));
|
||||
}
|
||||
|
||||
void ExtremeValuesTest() {
|
||||
const int kMaxBlockSize = 32 * 32;
|
||||
DECLARE_ALIGNED(16, int16_t, input_extreme_block[kMaxBlockSize]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, b[kMaxBlockSize]);
|
||||
memset(b, 0, sizeof(b));
|
||||
|
||||
tran_low_t b_ref[kMaxBlockSize];
|
||||
memset(b_ref, 0, sizeof(b_ref));
|
||||
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
// Initialize a test block with input range [-mask_, mask_].
|
||||
const int sign = (i == 0) ? 1 : -1;
|
||||
for (int j = 0; j < kMaxBlockSize; ++j)
|
||||
input_extreme_block[j] = sign * 255;
|
||||
|
||||
ReferenceHadamard(input_extreme_block, bwh_, b_ref, bwh_);
|
||||
ASM_REGISTER_STATE_CHECK(h_func_(input_extreme_block, bwh_, b));
|
||||
|
||||
// The order of the output is not important. Sort before checking.
|
||||
std::sort(b, b + block_size_);
|
||||
std::sort(b_ref, b_ref + block_size_);
|
||||
EXPECT_EQ(0, memcmp(b, b_ref, sizeof(b)));
|
||||
}
|
||||
}
|
||||
|
||||
void VaryStride() {
|
||||
const int kMaxBlockSize = 32 * 32;
|
||||
DECLARE_ALIGNED(16, int16_t, a[kMaxBlockSize * 8]);
|
||||
@@ -220,11 +252,18 @@ class HadamardTestBase : public ::testing::TestWithParam<HadamardFuncWithSize> {
|
||||
|
||||
class HadamardLowbdTest : public HadamardTestBase {
|
||||
protected:
|
||||
virtual int16_t Rand() { return rnd_.Rand9Signed(); }
|
||||
// Use values between -255 (0xFF01) and 255 (0x00FF)
|
||||
int16_t Rand() override {
|
||||
int16_t src = rnd_.Rand8();
|
||||
int16_t pred = rnd_.Rand8();
|
||||
return src - pred;
|
||||
}
|
||||
};
|
||||
|
||||
TEST_P(HadamardLowbdTest, CompareReferenceRandom) { CompareReferenceRandom(); }
|
||||
|
||||
TEST_P(HadamardLowbdTest, ExtremeValuesTest) { ExtremeValuesTest(); }
|
||||
|
||||
TEST_P(HadamardLowbdTest, VaryStride) { VaryStride(); }
|
||||
|
||||
TEST_P(HadamardLowbdTest, DISABLED_Speed) {
|
||||
@@ -254,17 +293,18 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
HadamardFuncWithSize(&vpx_hadamard_32x32_avx2, 32)));
|
||||
#endif // HAVE_AVX2
|
||||
|
||||
#if HAVE_SSSE3 && VPX_ARCH_X86_64
|
||||
#if HAVE_SSSE3 && VPX_ARCH_X86_64 && HAVE_X86_ASM
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
SSSE3, HadamardLowbdTest,
|
||||
::testing::Values(HadamardFuncWithSize(&vpx_hadamard_8x8_ssse3, 8)));
|
||||
#endif // HAVE_SSSE3 && VPX_ARCH_X86_64
|
||||
#endif // HAVE_SSSE3 && VPX_ARCH_X86_64 && HAVE_X86_ASM
|
||||
|
||||
#if HAVE_NEON
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
NEON, HadamardLowbdTest,
|
||||
::testing::Values(HadamardFuncWithSize(&vpx_hadamard_8x8_neon, 8),
|
||||
HadamardFuncWithSize(&vpx_hadamard_16x16_neon, 16)));
|
||||
HadamardFuncWithSize(&vpx_hadamard_16x16_neon, 16),
|
||||
HadamardFuncWithSize(&vpx_hadamard_32x32_neon, 32)));
|
||||
#endif // HAVE_NEON
|
||||
|
||||
// TODO(jingning): Remove highbitdepth flag when the SIMD functions are
|
||||
@@ -295,7 +335,12 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
class HadamardHighbdTest : public HadamardTestBase {
|
||||
protected:
|
||||
virtual int16_t Rand() { return rnd_.Rand13Signed(); }
|
||||
// Use values between -4095 (0xF001) and 4095 (0x0FFF)
|
||||
int16_t Rand() override {
|
||||
int16_t src = rnd_.Rand12();
|
||||
int16_t pred = rnd_.Rand12();
|
||||
return src - pred;
|
||||
}
|
||||
};
|
||||
|
||||
TEST_P(HadamardHighbdTest, CompareReferenceRandom) { CompareReferenceRandom(); }
|
||||
@@ -323,5 +368,14 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
32)));
|
||||
#endif // HAVE_AVX2
|
||||
|
||||
#if HAVE_NEON
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
NEON, HadamardHighbdTest,
|
||||
::testing::Values(HadamardFuncWithSize(&vpx_highbd_hadamard_8x8_neon, 8),
|
||||
HadamardFuncWithSize(&vpx_highbd_hadamard_16x16_neon, 16),
|
||||
HadamardFuncWithSize(&vpx_highbd_hadamard_32x32_neon,
|
||||
32)));
|
||||
#endif
|
||||
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
} // namespace
|
||||
@@ -12,12 +12,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "./vpx_dsp_rtcd.h"
|
||||
#include "test/acm_random.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
#include "vpx_ports/msvc.h" // for round()
|
||||
|
||||
using libvpx_test::ACMRandom;
|
||||
|
||||
|
||||
@@ -11,23 +11,23 @@
|
||||
#include "./vpx_config.h"
|
||||
#include "./vp8_rtcd.h"
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "test/buffer.h"
|
||||
#include "test/clear_system_state.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
|
||||
typedef void (*IdctFunc)(int16_t *input, unsigned char *pred_ptr,
|
||||
int pred_stride, unsigned char *dst_ptr,
|
||||
int dst_stride);
|
||||
using IdctFunc = void (*)(int16_t *input, unsigned char *pred_ptr,
|
||||
int pred_stride, unsigned char *dst_ptr,
|
||||
int dst_stride);
|
||||
namespace {
|
||||
|
||||
using libvpx_test::Buffer;
|
||||
|
||||
class IDCTTest : public ::testing::TestWithParam<IdctFunc> {
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
UUT = GetParam();
|
||||
|
||||
input = new Buffer<int16_t>(4, 4, 0);
|
||||
@@ -41,7 +41,7 @@ class IDCTTest : public ::testing::TestWithParam<IdctFunc> {
|
||||
ASSERT_TRUE(output->Init());
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
void TearDown() override {
|
||||
delete input;
|
||||
delete predict;
|
||||
delete output;
|
||||
@@ -163,10 +163,10 @@ INSTANTIATE_TEST_SUITE_P(NEON, IDCTTest,
|
||||
::testing::Values(vp8_short_idct4x4llm_neon));
|
||||
#endif // HAVE_NEON
|
||||
|
||||
#if HAVE_MMX
|
||||
#if HAVE_MMX && HAVE_X86_ASM
|
||||
INSTANTIATE_TEST_SUITE_P(MMX, IDCTTest,
|
||||
::testing::Values(vp8_short_idct4x4llm_mmx));
|
||||
#endif // HAVE_MMX
|
||||
#endif // HAVE_MMX && HAVE_X86_ASM
|
||||
|
||||
#if HAVE_MSA
|
||||
INSTANTIATE_TEST_SUITE_P(MSA, IDCTTest,
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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 "test/init_vpx_test.h"
|
||||
|
||||
#include "./vpx_config.h"
|
||||
|
||||
#if !CONFIG_SHARED
|
||||
#include <string>
|
||||
#include "gtest/gtest.h"
|
||||
#if VPX_ARCH_ARM
|
||||
#include "vpx_ports/arm.h"
|
||||
#endif
|
||||
#if VPX_ARCH_X86 || VPX_ARCH_X86_64
|
||||
#include "vpx_ports/x86.h"
|
||||
#endif
|
||||
extern "C" {
|
||||
#if CONFIG_VP8
|
||||
extern void vp8_rtcd();
|
||||
#endif // CONFIG_VP8
|
||||
#if CONFIG_VP9
|
||||
extern void vp9_rtcd();
|
||||
#endif // CONFIG_VP9
|
||||
extern void vpx_dsp_rtcd();
|
||||
extern void vpx_scale_rtcd();
|
||||
}
|
||||
|
||||
#if VPX_ARCH_ARM || VPX_ARCH_X86 || VPX_ARCH_X86_64
|
||||
static void append_negative_gtest_filter(const char *str) {
|
||||
std::string flag_value = GTEST_FLAG_GET(filter);
|
||||
// Negative patterns begin with one '-' followed by a ':' separated list.
|
||||
if (flag_value.find('-') == std::string::npos) flag_value += '-';
|
||||
// OPT.* matches TEST() functions
|
||||
// OPT/* matches TEST_P() functions
|
||||
// OPT_* matches tests which have been manually sharded.
|
||||
// We do not match OPT* because of SSE/SSE2 collisions.
|
||||
const char *search_terminators = "./_";
|
||||
for (size_t pos = 0; pos < strlen(search_terminators); ++pos) {
|
||||
flag_value += ":";
|
||||
flag_value += str;
|
||||
flag_value += search_terminators[pos];
|
||||
flag_value += "*";
|
||||
}
|
||||
GTEST_FLAG_SET(filter, flag_value);
|
||||
}
|
||||
#endif // VPX_ARCH_ARM || VPX_ARCH_X86 || VPX_ARCH_X86_64
|
||||
#endif // !CONFIG_SHARED
|
||||
|
||||
namespace libvpx_test {
|
||||
void init_vpx_test() {
|
||||
#if !CONFIG_SHARED
|
||||
#if VPX_ARCH_AARCH64
|
||||
const int caps = arm_cpu_caps();
|
||||
if (!(caps & HAS_NEON_DOTPROD)) {
|
||||
append_negative_gtest_filter("NEON_DOTPROD");
|
||||
}
|
||||
if (!(caps & HAS_NEON_I8MM)) {
|
||||
append_negative_gtest_filter("NEON_I8MM");
|
||||
}
|
||||
if (!(caps & HAS_SVE)) {
|
||||
append_negative_gtest_filter("SVE");
|
||||
}
|
||||
if (!(caps & HAS_SVE2)) {
|
||||
append_negative_gtest_filter("SVE2");
|
||||
}
|
||||
#elif VPX_ARCH_ARM
|
||||
const int caps = arm_cpu_caps();
|
||||
if (!(caps & HAS_NEON)) append_negative_gtest_filter("NEON");
|
||||
#endif // VPX_ARCH_ARM
|
||||
|
||||
#if VPX_ARCH_X86 || VPX_ARCH_X86_64
|
||||
const int simd_caps = x86_simd_caps();
|
||||
if (!(simd_caps & HAS_MMX)) append_negative_gtest_filter("MMX");
|
||||
if (!(simd_caps & HAS_SSE)) append_negative_gtest_filter("SSE");
|
||||
if (!(simd_caps & HAS_SSE2)) append_negative_gtest_filter("SSE2");
|
||||
if (!(simd_caps & HAS_SSE3)) append_negative_gtest_filter("SSE3");
|
||||
if (!(simd_caps & HAS_SSSE3)) {
|
||||
append_negative_gtest_filter("SSSE3");
|
||||
}
|
||||
if (!(simd_caps & HAS_SSE4_1)) {
|
||||
append_negative_gtest_filter("SSE4_1");
|
||||
}
|
||||
if (!(simd_caps & HAS_AVX)) append_negative_gtest_filter("AVX");
|
||||
if (!(simd_caps & HAS_AVX2)) append_negative_gtest_filter("AVX2");
|
||||
if (!(simd_caps & HAS_AVX512)) {
|
||||
append_negative_gtest_filter("AVX512");
|
||||
}
|
||||
#endif // VPX_ARCH_X86 || VPX_ARCH_X86_64
|
||||
|
||||
// Shared library builds don't support whitebox tests that exercise internal
|
||||
// symbols.
|
||||
#if CONFIG_VP8
|
||||
vp8_rtcd();
|
||||
#endif // CONFIG_VP8
|
||||
#if CONFIG_VP9
|
||||
vp9_rtcd();
|
||||
#endif // CONFIG_VP9
|
||||
vpx_dsp_rtcd();
|
||||
vpx_scale_rtcd();
|
||||
#endif // !CONFIG_SHARED
|
||||
}
|
||||
} // namespace libvpx_test
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
|
||||
#ifndef TEST_INIT_VPX_TEST_H_
|
||||
#define TEST_INIT_VPX_TEST_H_
|
||||
|
||||
namespace libvpx_test {
|
||||
void init_vpx_test();
|
||||
}
|
||||
|
||||
#endif // TEST_INIT_VPX_TEST_H_
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "./vpx_config.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/decode_test_driver.h"
|
||||
@@ -40,7 +40,7 @@ class InvalidFileTest : public ::libvpx_test::DecoderTest,
|
||||
protected:
|
||||
InvalidFileTest() : DecoderTest(GET_PARAM(0)), res_file_(nullptr) {}
|
||||
|
||||
virtual ~InvalidFileTest() {
|
||||
~InvalidFileTest() override {
|
||||
if (res_file_ != nullptr) fclose(res_file_);
|
||||
}
|
||||
|
||||
@@ -50,10 +50,9 @@ class InvalidFileTest : public ::libvpx_test::DecoderTest,
|
||||
<< "Result file open failed. Filename: " << res_file_name_;
|
||||
}
|
||||
|
||||
virtual bool HandleDecodeResult(
|
||||
const vpx_codec_err_t res_dec,
|
||||
const libvpx_test::CompressedVideoSource &video,
|
||||
libvpx_test::Decoder *decoder) {
|
||||
bool HandleDecodeResult(const vpx_codec_err_t res_dec,
|
||||
const libvpx_test::CompressedVideoSource &video,
|
||||
libvpx_test::Decoder *decoder) override {
|
||||
EXPECT_NE(res_file_, nullptr);
|
||||
int expected_res_dec;
|
||||
|
||||
@@ -172,9 +171,9 @@ VP9_INSTANTIATE_TEST_SUITE(InvalidFileTest,
|
||||
class InvalidFileInvalidPeekTest : public InvalidFileTest {
|
||||
protected:
|
||||
InvalidFileInvalidPeekTest() : InvalidFileTest() {}
|
||||
virtual void HandlePeekResult(libvpx_test::Decoder *const /*decoder*/,
|
||||
libvpx_test::CompressedVideoSource * /*video*/,
|
||||
const vpx_codec_err_t /*res_peek*/) {}
|
||||
void HandlePeekResult(libvpx_test::Decoder *const /*decoder*/,
|
||||
libvpx_test::CompressedVideoSource * /*video*/,
|
||||
const vpx_codec_err_t /*res_peek*/) override {}
|
||||
};
|
||||
|
||||
TEST_P(InvalidFileInvalidPeekTest, ReturnCode) { RunTest(); }
|
||||
|
||||
@@ -33,19 +33,19 @@ class IVFVideoSource : public CompressedVideoSource {
|
||||
compressed_frame_buf_(nullptr), frame_sz_(0), frame_(0),
|
||||
end_of_file_(false) {}
|
||||
|
||||
virtual ~IVFVideoSource() {
|
||||
~IVFVideoSource() override {
|
||||
delete[] compressed_frame_buf_;
|
||||
|
||||
if (input_file_) fclose(input_file_);
|
||||
}
|
||||
|
||||
virtual void Init() {
|
||||
void Init() override {
|
||||
// Allocate a buffer for read in the compressed video frame.
|
||||
compressed_frame_buf_ = new uint8_t[libvpx_test::kCodeBufferSize];
|
||||
ASSERT_NE(compressed_frame_buf_, nullptr) << "Allocate frame buffer failed";
|
||||
}
|
||||
|
||||
virtual void Begin() {
|
||||
void Begin() override {
|
||||
input_file_ = OpenTestDataFile(file_name_);
|
||||
ASSERT_NE(input_file_, nullptr)
|
||||
<< "Input file open failed. Filename: " << file_name_;
|
||||
@@ -54,6 +54,15 @@ class IVFVideoSource : public CompressedVideoSource {
|
||||
uint8_t file_hdr[kIvfFileHdrSize];
|
||||
ASSERT_EQ(kIvfFileHdrSize, fread(file_hdr, 1, kIvfFileHdrSize, input_file_))
|
||||
<< "File header read failed.";
|
||||
// The following two conditions are not asserted directly as some static
|
||||
// analyzers (observed with clang-19) do not properly terminate execution
|
||||
// when an eof or error is assumed after the previous fread().
|
||||
if (ferror(input_file_)) {
|
||||
FAIL() << "File header read failed.";
|
||||
}
|
||||
if (feof(input_file_)) {
|
||||
FAIL() << "Unexpected eof.";
|
||||
}
|
||||
// Check file header
|
||||
ASSERT_TRUE(file_hdr[0] == 'D' && file_hdr[1] == 'K' &&
|
||||
file_hdr[2] == 'I' && file_hdr[3] == 'F')
|
||||
@@ -62,7 +71,7 @@ class IVFVideoSource : public CompressedVideoSource {
|
||||
FillFrame();
|
||||
}
|
||||
|
||||
virtual void Next() {
|
||||
void Next() override {
|
||||
++frame_;
|
||||
FillFrame();
|
||||
}
|
||||
@@ -86,11 +95,11 @@ class IVFVideoSource : public CompressedVideoSource {
|
||||
}
|
||||
}
|
||||
|
||||
virtual const uint8_t *cxdata() const {
|
||||
const uint8_t *cxdata() const override {
|
||||
return end_of_file_ ? nullptr : compressed_frame_buf_;
|
||||
}
|
||||
virtual size_t frame_size() const { return frame_sz_; }
|
||||
virtual unsigned int frame_number() const { return frame_; }
|
||||
size_t frame_size() const override { return frame_sz_; }
|
||||
unsigned int frame_number() const override { return frame_; }
|
||||
|
||||
protected:
|
||||
std::string file_name_;
|
||||
|
||||
@@ -8,12 +8,18 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
#include <climits>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/encode_test_driver.h"
|
||||
#include "test/i420_video_source.h"
|
||||
#include "test/util.h"
|
||||
#include "./vpx_config.h"
|
||||
#include "vpx/vp8cx.h"
|
||||
#include "vpx/vpx_codec.h"
|
||||
#include "vpx/vpx_encoder.h"
|
||||
#include "vpx/vpx_image.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -22,9 +28,9 @@ class KeyframeTest
|
||||
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
|
||||
protected:
|
||||
KeyframeTest() : EncoderTest(GET_PARAM(0)) {}
|
||||
virtual ~KeyframeTest() {}
|
||||
~KeyframeTest() override = default;
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
InitializeConfig();
|
||||
SetMode(GET_PARAM(1));
|
||||
kf_count_ = 0;
|
||||
@@ -33,8 +39,8 @@ class KeyframeTest
|
||||
set_cpu_used_ = 0;
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) {
|
||||
void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) override {
|
||||
if (kf_do_force_kf_) {
|
||||
frame_flags_ = (video->frame() % 3) ? 0 : VPX_EFLAG_FORCE_KF;
|
||||
}
|
||||
@@ -43,7 +49,7 @@ class KeyframeTest
|
||||
}
|
||||
}
|
||||
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
|
||||
if (pkt->data.frame.flags & VPX_FRAME_IS_KEY) {
|
||||
kf_pts_list_.push_back(pkt->data.frame.pts);
|
||||
kf_count_++;
|
||||
@@ -146,4 +152,105 @@ TEST_P(KeyframeTest, TestAutoKeyframe) {
|
||||
}
|
||||
|
||||
VP8_INSTANTIATE_TEST_SUITE(KeyframeTest, ALL_TEST_MODES);
|
||||
|
||||
bool IsVP9(vpx_codec_iface_t *iface) {
|
||||
static const char kVP9Name[] = "WebM Project VP9";
|
||||
return strncmp(kVP9Name, vpx_codec_iface_name(iface), sizeof(kVP9Name) - 1) ==
|
||||
0;
|
||||
}
|
||||
|
||||
vpx_image_t *CreateGrayImage(vpx_img_fmt_t fmt, unsigned int w,
|
||||
unsigned int h) {
|
||||
vpx_image_t *const image = vpx_img_alloc(nullptr, fmt, w, h, 1);
|
||||
if (!image) return image;
|
||||
|
||||
for (unsigned int i = 0; i < image->d_h; ++i) {
|
||||
memset(image->planes[0] + i * image->stride[0], 128, image->d_w);
|
||||
}
|
||||
const unsigned int uv_h = (image->d_h + 1) / 2;
|
||||
const unsigned int uv_w = (image->d_w + 1) / 2;
|
||||
for (unsigned int i = 0; i < uv_h; ++i) {
|
||||
memset(image->planes[1] + i * image->stride[1], 128, uv_w);
|
||||
memset(image->planes[2] + i * image->stride[2], 128, uv_w);
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
||||
// Tests kf_max_dist in one-pass encoding with zero lag.
|
||||
void TestKeyframeMaximumInterval(vpx_codec_iface_t *iface,
|
||||
vpx_enc_deadline_t deadline,
|
||||
unsigned int kf_max_dist) {
|
||||
vpx_codec_enc_cfg_t cfg;
|
||||
ASSERT_EQ(vpx_codec_enc_config_default(iface, &cfg, /*usage=*/0),
|
||||
VPX_CODEC_OK);
|
||||
cfg.g_w = 320;
|
||||
cfg.g_h = 240;
|
||||
cfg.g_pass = VPX_RC_ONE_PASS;
|
||||
cfg.g_lag_in_frames = 0;
|
||||
cfg.kf_mode = VPX_KF_AUTO;
|
||||
cfg.kf_min_dist = 0;
|
||||
cfg.kf_max_dist = kf_max_dist;
|
||||
|
||||
vpx_codec_ctx_t enc;
|
||||
ASSERT_EQ(vpx_codec_enc_init(&enc, iface, &cfg, 0), VPX_CODEC_OK);
|
||||
|
||||
const int speed = IsVP9(iface) ? 9 : -12;
|
||||
ASSERT_EQ(vpx_codec_control(&enc, VP8E_SET_CPUUSED, speed), VPX_CODEC_OK);
|
||||
|
||||
vpx_image_t *image = CreateGrayImage(VPX_IMG_FMT_I420, cfg.g_w, cfg.g_h);
|
||||
ASSERT_NE(image, nullptr);
|
||||
|
||||
// Encode frames.
|
||||
const vpx_codec_cx_pkt_t *pkt;
|
||||
const unsigned int num_frames = kf_max_dist == 0 ? 4 : 3 * kf_max_dist + 1;
|
||||
for (unsigned int i = 0; i < num_frames; ++i) {
|
||||
ASSERT_EQ(vpx_codec_encode(&enc, image, i, 1, 0, deadline), VPX_CODEC_OK);
|
||||
vpx_codec_iter_t iter = nullptr;
|
||||
while ((pkt = vpx_codec_get_cx_data(&enc, &iter)) != nullptr) {
|
||||
ASSERT_EQ(pkt->kind, VPX_CODEC_CX_FRAME_PKT);
|
||||
if (kf_max_dist == 0 || i % kf_max_dist == 0) {
|
||||
ASSERT_EQ(pkt->data.frame.flags & VPX_FRAME_IS_KEY, VPX_FRAME_IS_KEY);
|
||||
} else {
|
||||
ASSERT_EQ(pkt->data.frame.flags & VPX_FRAME_IS_KEY, 0u);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Flush the encoder.
|
||||
bool got_data;
|
||||
do {
|
||||
ASSERT_EQ(vpx_codec_encode(&enc, nullptr, 0, 1, 0, deadline), VPX_CODEC_OK);
|
||||
got_data = false;
|
||||
vpx_codec_iter_t iter = nullptr;
|
||||
while ((pkt = vpx_codec_get_cx_data(&enc, &iter)) != nullptr) {
|
||||
ASSERT_EQ(pkt->kind, VPX_CODEC_CX_FRAME_PKT);
|
||||
got_data = true;
|
||||
}
|
||||
} while (got_data);
|
||||
|
||||
vpx_img_free(image);
|
||||
ASSERT_EQ(vpx_codec_destroy(&enc), VPX_CODEC_OK);
|
||||
}
|
||||
|
||||
TEST(KeyframeIntervalTest, KeyframeMaximumInterval) {
|
||||
std::vector<vpx_codec_iface_t *> ifaces;
|
||||
#if CONFIG_VP8_ENCODER
|
||||
ifaces.push_back(vpx_codec_vp8_cx());
|
||||
#endif
|
||||
#if CONFIG_VP9_ENCODER
|
||||
ifaces.push_back(vpx_codec_vp9_cx());
|
||||
#endif
|
||||
for (vpx_codec_iface_t *iface : ifaces) {
|
||||
for (vpx_enc_deadline_t deadline :
|
||||
{ VPX_DL_REALTIME, VPX_DL_GOOD_QUALITY, VPX_DL_BEST_QUALITY }) {
|
||||
// Test 0 and 1 (both mean all intra), some powers of 2, some multiples
|
||||
// of 10, and some prime numbers.
|
||||
for (unsigned int kf_max_dist :
|
||||
{ 0, 1, 2, 3, 4, 7, 10, 13, 16, 20, 23, 29, 32 }) {
|
||||
TestKeyframeMaximumInterval(iface, deadline, kf_max_dist);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -7,11 +7,12 @@
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/encode_test_driver.h"
|
||||
#include "test/i420_video_source.h"
|
||||
#include "test/util.h"
|
||||
#include "vpx_config.h"
|
||||
|
||||
namespace {
|
||||
class LevelTest
|
||||
@@ -22,9 +23,9 @@ class LevelTest
|
||||
: EncoderTest(GET_PARAM(0)), encoding_mode_(GET_PARAM(1)),
|
||||
cpu_used_(GET_PARAM(2)), min_gf_internal_(24), target_level_(0),
|
||||
level_(0) {}
|
||||
virtual ~LevelTest() {}
|
||||
~LevelTest() override = default;
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
InitializeConfig();
|
||||
SetMode(encoding_mode_);
|
||||
if (encoding_mode_ != ::libvpx_test::kRealTime) {
|
||||
@@ -41,8 +42,8 @@ class LevelTest
|
||||
cfg_.rc_min_quantizer = 0;
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) {
|
||||
void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) override {
|
||||
if (video->frame() == 0) {
|
||||
encoder->Control(VP8E_SET_CPUUSED, cpu_used_);
|
||||
encoder->Control(VP9E_SET_TARGET_LEVEL, target_level_);
|
||||
@@ -67,6 +68,9 @@ class LevelTest
|
||||
};
|
||||
|
||||
TEST_P(LevelTest, TestTargetLevel11Large) {
|
||||
#if CONFIG_REALTIME_ONLY
|
||||
GTEST_SKIP();
|
||||
#else
|
||||
ASSERT_NE(encoding_mode_, ::libvpx_test::kRealTime);
|
||||
::libvpx_test::I420VideoSource video("hantro_odd.yuv", 208, 144, 30, 1, 0,
|
||||
60);
|
||||
@@ -74,9 +78,13 @@ TEST_P(LevelTest, TestTargetLevel11Large) {
|
||||
cfg_.rc_target_bitrate = 150;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
ASSERT_GE(target_level_, level_);
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST_P(LevelTest, TestTargetLevel20Large) {
|
||||
#if CONFIG_REALTIME_ONLY
|
||||
GTEST_SKIP();
|
||||
#else
|
||||
ASSERT_NE(encoding_mode_, ::libvpx_test::kRealTime);
|
||||
::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
|
||||
30, 1, 0, 60);
|
||||
@@ -84,9 +92,13 @@ TEST_P(LevelTest, TestTargetLevel20Large) {
|
||||
cfg_.rc_target_bitrate = 1200;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
ASSERT_GE(target_level_, level_);
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST_P(LevelTest, TestTargetLevel31Large) {
|
||||
#if CONFIG_REALTIME_ONLY
|
||||
GTEST_SKIP();
|
||||
#else
|
||||
ASSERT_NE(encoding_mode_, ::libvpx_test::kRealTime);
|
||||
::libvpx_test::I420VideoSource video("niklas_1280_720_30.y4m", 1280, 720, 30,
|
||||
1, 0, 60);
|
||||
@@ -94,6 +106,7 @@ TEST_P(LevelTest, TestTargetLevel31Large) {
|
||||
cfg_.rc_target_bitrate = 8000;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
ASSERT_GE(target_level_, level_);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Test for keeping level stats only
|
||||
@@ -120,7 +133,7 @@ TEST_P(LevelTest, TestTargetLevel255) {
|
||||
|
||||
TEST_P(LevelTest, TestTargetLevelApi) {
|
||||
::libvpx_test::I420VideoSource video("hantro_odd.yuv", 208, 144, 30, 1, 0, 1);
|
||||
static const vpx_codec_iface_t *codec = &vpx_codec_vp9_cx_algo;
|
||||
static vpx_codec_iface_t *codec = &vpx_codec_vp9_cx_algo;
|
||||
vpx_codec_ctx_t enc;
|
||||
vpx_codec_enc_cfg_t cfg;
|
||||
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_enc_config_default(codec, &cfg, 0));
|
||||
@@ -140,8 +153,6 @@ TEST_P(LevelTest, TestTargetLevelApi) {
|
||||
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&enc));
|
||||
}
|
||||
|
||||
VP9_INSTANTIATE_TEST_SUITE(LevelTest,
|
||||
::testing::Values(::libvpx_test::kTwoPassGood,
|
||||
::libvpx_test::kOnePassGood),
|
||||
VP9_INSTANTIATE_TEST_SUITE(LevelTest, ONE_OR_TWO_PASS_TEST_MODES,
|
||||
::testing::Range(0, 9));
|
||||
} // namespace
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#include "./vpx_dsp_rtcd.h"
|
||||
@@ -36,29 +36,29 @@ const int kNumCoeffs = 1024;
|
||||
const int number_of_iterations = 10000;
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
typedef uint16_t Pixel;
|
||||
using Pixel = uint16_t;
|
||||
#define PIXEL_WIDTH 16
|
||||
|
||||
typedef void (*loop_op_t)(Pixel *s, int p, const uint8_t *blimit,
|
||||
const uint8_t *limit, const uint8_t *thresh, int bd);
|
||||
typedef void (*dual_loop_op_t)(Pixel *s, int p, const uint8_t *blimit0,
|
||||
const uint8_t *limit0, const uint8_t *thresh0,
|
||||
const uint8_t *blimit1, const uint8_t *limit1,
|
||||
const uint8_t *thresh1, int bd);
|
||||
using loop_op_t = void (*)(Pixel *s, int p, const uint8_t *blimit,
|
||||
const uint8_t *limit, const uint8_t *thresh, int bd);
|
||||
using dual_loop_op_t = void (*)(Pixel *s, int p, const uint8_t *blimit0,
|
||||
const uint8_t *limit0, const uint8_t *thresh0,
|
||||
const uint8_t *blimit1, const uint8_t *limit1,
|
||||
const uint8_t *thresh1, int bd);
|
||||
#else
|
||||
typedef uint8_t Pixel;
|
||||
using Pixel = uint8_t;
|
||||
#define PIXEL_WIDTH 8
|
||||
|
||||
typedef void (*loop_op_t)(Pixel *s, int p, const uint8_t *blimit,
|
||||
const uint8_t *limit, const uint8_t *thresh);
|
||||
typedef void (*dual_loop_op_t)(Pixel *s, int p, const uint8_t *blimit0,
|
||||
const uint8_t *limit0, const uint8_t *thresh0,
|
||||
const uint8_t *blimit1, const uint8_t *limit1,
|
||||
const uint8_t *thresh1);
|
||||
using loop_op_t = void (*)(Pixel *s, int p, const uint8_t *blimit,
|
||||
const uint8_t *limit, const uint8_t *thresh);
|
||||
using dual_loop_op_t = void (*)(Pixel *s, int p, const uint8_t *blimit0,
|
||||
const uint8_t *limit0, const uint8_t *thresh0,
|
||||
const uint8_t *blimit1, const uint8_t *limit1,
|
||||
const uint8_t *thresh1);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
|
||||
typedef std::tuple<loop_op_t, loop_op_t, int> loop8_param_t;
|
||||
typedef std::tuple<dual_loop_op_t, dual_loop_op_t, int> dualloop8_param_t;
|
||||
using loop8_param_t = std::tuple<loop_op_t, loop_op_t, int>;
|
||||
using dualloop8_param_t = std::tuple<dual_loop_op_t, dual_loop_op_t, int>;
|
||||
|
||||
void InitInput(Pixel *s, Pixel *ref_s, ACMRandom *rnd, const uint8_t limit,
|
||||
const int mask, const int32_t p, const int i) {
|
||||
@@ -129,15 +129,15 @@ uint8_t GetHevThresh(ACMRandom *rnd) {
|
||||
|
||||
class Loop8Test6Param : public ::testing::TestWithParam<loop8_param_t> {
|
||||
public:
|
||||
virtual ~Loop8Test6Param() {}
|
||||
virtual void SetUp() {
|
||||
~Loop8Test6Param() override = default;
|
||||
void SetUp() override {
|
||||
loopfilter_op_ = GET_PARAM(0);
|
||||
ref_loopfilter_op_ = GET_PARAM(1);
|
||||
bit_depth_ = GET_PARAM(2);
|
||||
mask_ = (1 << bit_depth_) - 1;
|
||||
}
|
||||
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
void TearDown() override { libvpx_test::ClearSystemState(); }
|
||||
|
||||
protected:
|
||||
int bit_depth_;
|
||||
@@ -151,15 +151,15 @@ GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(Loop8Test6Param);
|
||||
(HAVE_DSPR2 || HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH)
|
||||
class Loop8Test9Param : public ::testing::TestWithParam<dualloop8_param_t> {
|
||||
public:
|
||||
virtual ~Loop8Test9Param() {}
|
||||
virtual void SetUp() {
|
||||
~Loop8Test9Param() override = default;
|
||||
void SetUp() override {
|
||||
loopfilter_op_ = GET_PARAM(0);
|
||||
ref_loopfilter_op_ = GET_PARAM(1);
|
||||
bit_depth_ = GET_PARAM(2);
|
||||
mask_ = (1 << bit_depth_) - 1;
|
||||
}
|
||||
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
void TearDown() override { libvpx_test::ClearSystemState(); }
|
||||
|
||||
protected:
|
||||
int bit_depth_;
|
||||
|
||||
@@ -47,7 +47,7 @@ class MD5 {
|
||||
MD5Update(&md5_, data, static_cast<uint32_t>(size));
|
||||
}
|
||||
|
||||
const char *Get(void) {
|
||||
const char *Get() {
|
||||
static const char hex[16] = {
|
||||
'0', '1', '2', '3', '4', '5', '6', '7',
|
||||
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f',
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* Copyright (c) 2026 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 <array>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <new>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "vpx_config.h"
|
||||
#include "vp9/common/vp9_mfqe.h"
|
||||
#include "vp9/common/vp9_onyxc_int.h"
|
||||
#include "vpx_scale/yv12config.h"
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr int kFrameSize = 64;
|
||||
constexpr int kCheckerboardSquareSize = 4;
|
||||
|
||||
class TmpFrameBuffer {
|
||||
public:
|
||||
// Returns an initialized frame, or nullptr if allocation fails.
|
||||
static std::unique_ptr<TmpFrameBuffer> Create(int width, int height,
|
||||
int stride,
|
||||
bool fill_checkerboard);
|
||||
|
||||
TmpFrameBuffer(const TmpFrameBuffer &) = delete;
|
||||
TmpFrameBuffer &operator=(const TmpFrameBuffer &) = delete;
|
||||
~TmpFrameBuffer() { vpx_free_frame_buffer(&buffer_); }
|
||||
|
||||
// Returns a borrowed reference valid for this object's lifetime.
|
||||
YV12_BUFFER_CONFIG &buffer() { return buffer_; }
|
||||
|
||||
private:
|
||||
// Takes ownership of buffer's allocation.
|
||||
explicit TmpFrameBuffer(const YV12_BUFFER_CONFIG &buffer) : buffer_(buffer) {}
|
||||
|
||||
YV12_BUFFER_CONFIG buffer_ = {};
|
||||
};
|
||||
|
||||
std::unique_ptr<TmpFrameBuffer> TmpFrameBuffer::Create(int width, int height,
|
||||
int stride,
|
||||
bool fill_checkerboard) {
|
||||
YV12_BUFFER_CONFIG buffer = {};
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
const int allocation_status =
|
||||
vpx_alloc_frame_buffer(&buffer, stride, height, 1, 1, 0, 0, 0);
|
||||
#else
|
||||
const int allocation_status =
|
||||
vpx_alloc_frame_buffer(&buffer, stride, height, 1, 1, 0, 0);
|
||||
#endif
|
||||
if (allocation_status != 0) return nullptr;
|
||||
|
||||
buffer.y_width = width;
|
||||
buffer.y_height = height;
|
||||
buffer.y_crop_width = width;
|
||||
buffer.y_crop_height = height;
|
||||
buffer.uv_width = width >> 1;
|
||||
buffer.uv_height = height >> 1;
|
||||
buffer.uv_crop_width = width >> 1;
|
||||
buffer.uv_crop_height = height >> 1;
|
||||
buffer.render_width = width;
|
||||
buffer.render_height = height;
|
||||
|
||||
if (fill_checkerboard) {
|
||||
// Fill the luma plane with a checkerboard pattern.
|
||||
for (int row = 0; row < height; ++row) {
|
||||
for (int col = 0; col < width; ++col) {
|
||||
const int checkerboard_row = row / kCheckerboardSquareSize;
|
||||
const int checkerboard_col = col / kCheckerboardSquareSize;
|
||||
int pixel_value = 0x20;
|
||||
if ((checkerboard_row + checkerboard_col) % 2 != 0) {
|
||||
pixel_value = 0xe0;
|
||||
}
|
||||
buffer.y_buffer[row * buffer.y_stride + col] = pixel_value;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Use a distinct initial luma value so copying is observable.
|
||||
for (int row = 0; row < height; ++row) {
|
||||
memset(buffer.y_buffer + row * buffer.y_stride, 0, width);
|
||||
}
|
||||
}
|
||||
|
||||
// Use neutral chroma so the checkerboard pattern is luma-only.
|
||||
for (int row = 0; row < height / 2; ++row) {
|
||||
memset(buffer.u_buffer + row * buffer.uv_stride, 0x80, width / 2);
|
||||
memset(buffer.v_buffer + row * buffer.uv_stride, 0x80, width / 2);
|
||||
}
|
||||
std::unique_ptr<TmpFrameBuffer> frame(new (std::nothrow)
|
||||
TmpFrameBuffer(buffer));
|
||||
if (frame == nullptr) {
|
||||
vpx_free_frame_buffer(&buffer);
|
||||
}
|
||||
return frame;
|
||||
}
|
||||
|
||||
TEST(MfqeTest, Copy64x64WithDifferentStrides) {
|
||||
auto source = TmpFrameBuffer::Create(kFrameSize, kFrameSize, kFrameSize,
|
||||
/*fill_checkerboard=*/true);
|
||||
ASSERT_NE(source, nullptr);
|
||||
// The wider allocation produces a different stride while preserving the
|
||||
// visible dimensions of the image.
|
||||
auto destination =
|
||||
TmpFrameBuffer::Create(kFrameSize, kFrameSize, kFrameSize + 16,
|
||||
/*fill_checkerboard=*/false);
|
||||
ASSERT_NE(destination, nullptr);
|
||||
ASSERT_NE(source->buffer().y_stride, destination->buffer().y_stride);
|
||||
|
||||
// One MODE_INFO entry per 8x8 MI unit in this 64x64 superblock.
|
||||
std::array<MODE_INFO, MI_BLOCK_SIZE * MI_BLOCK_SIZE> mi = {};
|
||||
mi[0].sb_type = BLOCK_64X64;
|
||||
mi[0].mode = DC_PRED; // Force the copy path rather than MFQE filtering.
|
||||
|
||||
VP9_COMMON cm = {};
|
||||
cm.frame_type = INTER_FRAME;
|
||||
cm.frame_to_show = &source->buffer();
|
||||
cm.post_proc_buffer = destination->buffer();
|
||||
cm.mi_rows = MI_BLOCK_SIZE;
|
||||
cm.mi_cols = MI_BLOCK_SIZE;
|
||||
cm.mi_stride = MI_BLOCK_SIZE;
|
||||
cm.mi = mi.data();
|
||||
|
||||
vp9_mfqe(&cm);
|
||||
|
||||
for (int row = 0; row < kFrameSize; ++row) {
|
||||
EXPECT_EQ(
|
||||
std::memcmp(
|
||||
source->buffer().y_buffer + row * source->buffer().y_stride,
|
||||
cm.post_proc_buffer.y_buffer + row * cm.post_proc_buffer.y_stride,
|
||||
kFrameSize),
|
||||
0)
|
||||
<< "row " << row;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -11,10 +11,12 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "vpx_config.h"
|
||||
#include "./vpx_dsp_rtcd.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
|
||||
#include "test/acm_random.h"
|
||||
#include "test/register_state_check.h"
|
||||
@@ -23,12 +25,12 @@ namespace {
|
||||
|
||||
using ::libvpx_test::ACMRandom;
|
||||
|
||||
typedef void (*MinMaxFunc)(const uint8_t *a, int a_stride, const uint8_t *b,
|
||||
int b_stride, int *min, int *max);
|
||||
using MinMaxFunc = void (*)(const uint8_t *a, int a_stride, const uint8_t *b,
|
||||
int b_stride, int *min, int *max);
|
||||
|
||||
class MinMaxTest : public ::testing::TestWithParam<MinMaxFunc> {
|
||||
public:
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
mm_func_ = GetParam();
|
||||
rnd_.Reset(ACMRandom::DeterministicSeed());
|
||||
}
|
||||
@@ -115,7 +117,115 @@ TEST_P(MinMaxTest, CompareReferenceAndVaryStride) {
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
|
||||
using HBDMinMaxTest = MinMaxTest;
|
||||
|
||||
void highbd_reference_minmax(const uint8_t *a, int a_stride, const uint8_t *b,
|
||||
int b_stride, int *min_ret, int *max_ret) {
|
||||
int min = 65535;
|
||||
int max = 0;
|
||||
const uint16_t *a_ptr = CONVERT_TO_SHORTPTR(a);
|
||||
const uint16_t *b_ptr = CONVERT_TO_SHORTPTR(b);
|
||||
for (int i = 0; i < 8; i++) {
|
||||
for (int j = 0; j < 8; j++) {
|
||||
const int diff = abs(a_ptr[i * a_stride + j] - b_ptr[i * b_stride + j]);
|
||||
if (min > diff) min = diff;
|
||||
if (max < diff) max = diff;
|
||||
}
|
||||
}
|
||||
|
||||
*min_ret = min;
|
||||
*max_ret = max;
|
||||
}
|
||||
|
||||
TEST_P(HBDMinMaxTest, MinValue) {
|
||||
uint8_t *a = CONVERT_TO_BYTEPTR(
|
||||
reinterpret_cast<uint16_t *>(vpx_malloc(64 * sizeof(uint16_t))));
|
||||
uint8_t *b = CONVERT_TO_BYTEPTR(
|
||||
reinterpret_cast<uint16_t *>(vpx_malloc(64 * sizeof(uint16_t))));
|
||||
for (int i = 0; i < 64; i++) {
|
||||
vpx_memset16(CONVERT_TO_SHORTPTR(a), 0, 64);
|
||||
vpx_memset16(CONVERT_TO_SHORTPTR(b), 65535, 64);
|
||||
CONVERT_TO_SHORTPTR(b)[i] = i; // Set a minimum difference of i.
|
||||
|
||||
int min, max;
|
||||
ASM_REGISTER_STATE_CHECK(mm_func_(a, 8, b, 8, &min, &max));
|
||||
EXPECT_EQ(65535, max);
|
||||
EXPECT_EQ(i, min);
|
||||
}
|
||||
vpx_free(CONVERT_TO_SHORTPTR(a));
|
||||
vpx_free(CONVERT_TO_SHORTPTR(b));
|
||||
}
|
||||
|
||||
TEST_P(HBDMinMaxTest, MaxValue) {
|
||||
uint8_t *a = CONVERT_TO_BYTEPTR(
|
||||
reinterpret_cast<uint16_t *>(vpx_malloc(64 * sizeof(uint16_t))));
|
||||
uint8_t *b = CONVERT_TO_BYTEPTR(
|
||||
reinterpret_cast<uint16_t *>(vpx_malloc(64 * sizeof(uint16_t))));
|
||||
for (int i = 0; i < 64; i++) {
|
||||
vpx_memset16(CONVERT_TO_SHORTPTR(a), 0, 64);
|
||||
vpx_memset16(CONVERT_TO_SHORTPTR(b), 0, 64);
|
||||
CONVERT_TO_SHORTPTR(b)[i] = i; // Set a minimum difference of i.
|
||||
|
||||
int min, max;
|
||||
ASM_REGISTER_STATE_CHECK(mm_func_(a, 8, b, 8, &min, &max));
|
||||
EXPECT_EQ(i, max);
|
||||
EXPECT_EQ(0, min);
|
||||
}
|
||||
vpx_free(CONVERT_TO_SHORTPTR(a));
|
||||
vpx_free(CONVERT_TO_SHORTPTR(b));
|
||||
}
|
||||
|
||||
TEST_P(HBDMinMaxTest, CompareReference) {
|
||||
uint8_t *a = CONVERT_TO_BYTEPTR(
|
||||
reinterpret_cast<uint16_t *>(vpx_malloc(64 * sizeof(uint16_t))));
|
||||
uint8_t *b = CONVERT_TO_BYTEPTR(
|
||||
reinterpret_cast<uint16_t *>(vpx_malloc(64 * sizeof(uint16_t))));
|
||||
for (int j = 0; j < 64; j++) {
|
||||
CONVERT_TO_SHORTPTR(a)[j] = rnd_.Rand16();
|
||||
CONVERT_TO_SHORTPTR(b)[j] = rnd_.Rand16();
|
||||
}
|
||||
|
||||
int min_ref, max_ref, min, max;
|
||||
highbd_reference_minmax(a, 8, b, 8, &min_ref, &max_ref);
|
||||
ASM_REGISTER_STATE_CHECK(mm_func_(a, 8, b, 8, &min, &max));
|
||||
vpx_free(CONVERT_TO_SHORTPTR(a));
|
||||
vpx_free(CONVERT_TO_SHORTPTR(b));
|
||||
EXPECT_EQ(max_ref, max);
|
||||
EXPECT_EQ(min_ref, min);
|
||||
}
|
||||
|
||||
TEST_P(HBDMinMaxTest, CompareReferenceAndVaryStride) {
|
||||
uint8_t *a = CONVERT_TO_BYTEPTR(
|
||||
reinterpret_cast<uint16_t *>(vpx_malloc((8 * 64) * sizeof(uint16_t))));
|
||||
uint8_t *b = CONVERT_TO_BYTEPTR(
|
||||
reinterpret_cast<uint16_t *>(vpx_malloc((8 * 64) * sizeof(uint16_t))));
|
||||
for (int i = 0; i < 8 * 64; i++) {
|
||||
CONVERT_TO_SHORTPTR(a)[i] = rnd_.Rand16();
|
||||
CONVERT_TO_SHORTPTR(b)[i] = rnd_.Rand16();
|
||||
}
|
||||
for (int a_stride = 8; a_stride <= 64; a_stride += 8) {
|
||||
for (int b_stride = 8; b_stride <= 64; b_stride += 8) {
|
||||
int min_ref, max_ref, min, max;
|
||||
highbd_reference_minmax(a, a_stride, b, b_stride, &min_ref, &max_ref);
|
||||
ASM_REGISTER_STATE_CHECK(mm_func_(a, a_stride, b, b_stride, &min, &max));
|
||||
EXPECT_EQ(max_ref, max)
|
||||
<< "when a_stride = " << a_stride << " and b_stride = " << b_stride;
|
||||
EXPECT_EQ(min_ref, min)
|
||||
<< "when a_stride = " << a_stride << " and b_stride = " << b_stride;
|
||||
}
|
||||
}
|
||||
vpx_free(CONVERT_TO_SHORTPTR(a));
|
||||
vpx_free(CONVERT_TO_SHORTPTR(b));
|
||||
}
|
||||
#endif
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(C, MinMaxTest, ::testing::Values(&vpx_minmax_8x8_c));
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
INSTANTIATE_TEST_SUITE_P(C, HBDMinMaxTest,
|
||||
::testing::Values(&vpx_highbd_minmax_8x8_c));
|
||||
#endif
|
||||
|
||||
#if HAVE_SSE2
|
||||
INSTANTIATE_TEST_SUITE_P(SSE2, MinMaxTest,
|
||||
@@ -125,6 +235,10 @@ INSTANTIATE_TEST_SUITE_P(SSE2, MinMaxTest,
|
||||
#if HAVE_NEON
|
||||
INSTANTIATE_TEST_SUITE_P(NEON, MinMaxTest,
|
||||
::testing::Values(&vpx_minmax_8x8_neon));
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
INSTANTIATE_TEST_SUITE_P(NEON, HBDMinMaxTest,
|
||||
::testing::Values(&vpx_highbd_minmax_8x8_neon));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAVE_MSA
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "vp9/encoder/vp9_non_greedy_mv.h"
|
||||
#include "./vpx_dsp_rtcd.h"
|
||||
|
||||
@@ -47,7 +47,7 @@ static void read_in_local_var(const char *filename, int *rows_ptr,
|
||||
|
||||
fscanf(input, "%d,%d\n", rows_ptr, cols_ptr);
|
||||
|
||||
*M_ptr = (int(*)[MF_LOCAL_STRUCTURE_SIZE])malloc(
|
||||
*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) {
|
||||
@@ -133,7 +133,7 @@ TEST(non_greedy_mv, smooth_mf) {
|
||||
MV *smooth_mf = nullptr;
|
||||
MV *estimation = nullptr;
|
||||
MV *ground_truth = nullptr;
|
||||
int(*local_var)[MF_LOCAL_STRUCTURE_SIZE] = nullptr;
|
||||
int (*local_var)[MF_LOCAL_STRUCTURE_SIZE] = nullptr;
|
||||
int rows = 0, cols = 0;
|
||||
|
||||
int alpha = 100, max_iter = 100;
|
||||
@@ -169,8 +169,8 @@ TEST(non_greedy_mv, local_var) {
|
||||
const char *gt_local_var_file = "non_greedy_mv_test_files/localVar_16x16.txt";
|
||||
const char *search_mf_file = "non_greedy_mv_test_files/exhaust_16x16.txt";
|
||||
BLOCK_SIZE bsize = BLOCK_16X16;
|
||||
int(*gt_local_var)[MF_LOCAL_STRUCTURE_SIZE] = nullptr;
|
||||
int(*est_local_var)[MF_LOCAL_STRUCTURE_SIZE] = nullptr;
|
||||
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;
|
||||
@@ -183,7 +183,7 @@ TEST(non_greedy_mv, local_var) {
|
||||
read_in_mf(search_mf_file, &rows, &cols, &search_mf);
|
||||
|
||||
fn.sdf = vpx_sad16x16;
|
||||
est_local_var = (int(*)[MF_LOCAL_STRUCTURE_SIZE])malloc(
|
||||
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);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <limits>
|
||||
#include <tuple>
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "./vp9_rtcd.h"
|
||||
#include "./vpx_dsp_rtcd.h"
|
||||
@@ -25,16 +25,17 @@
|
||||
#include "vp9/common/vp9_blockd.h"
|
||||
#include "vp9/common/vp9_scan.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
#include "vpx_config.h"
|
||||
#include "vpx_ports/vpx_timer.h"
|
||||
|
||||
using libvpx_test::ACMRandom;
|
||||
|
||||
namespace {
|
||||
|
||||
typedef void (*FwdTxfmFunc)(const int16_t *in, tran_low_t *out, int stride);
|
||||
typedef void (*InvTxfmFunc)(const tran_low_t *in, uint8_t *out, int stride);
|
||||
typedef void (*InvTxfmWithBdFunc)(const tran_low_t *in, uint8_t *out,
|
||||
int stride, int bd);
|
||||
using FwdTxfmFunc = void (*)(const int16_t *in, tran_low_t *out, int stride);
|
||||
using InvTxfmFunc = void (*)(const tran_low_t *in, uint8_t *out, int stride);
|
||||
using InvTxfmWithBdFunc = void (*)(const tran_low_t *in, uint8_t *out,
|
||||
int stride, int bd);
|
||||
|
||||
template <InvTxfmFunc fn>
|
||||
void wrapper(const tran_low_t *in, uint8_t *out, int stride, int bd) {
|
||||
@@ -43,24 +44,25 @@ void wrapper(const tran_low_t *in, uint8_t *out, int stride, int bd) {
|
||||
}
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
typedef void (*InvTxfmHighbdFunc)(const tran_low_t *in, uint16_t *out,
|
||||
int stride, int bd);
|
||||
using InvTxfmHighbdFunc = void (*)(const tran_low_t *in, uint16_t *out,
|
||||
int stride, int bd);
|
||||
|
||||
template <InvTxfmHighbdFunc fn>
|
||||
void highbd_wrapper(const tran_low_t *in, uint8_t *out, int stride, int bd) {
|
||||
fn(in, CAST_TO_SHORTPTR(out), stride, bd);
|
||||
}
|
||||
#endif
|
||||
|
||||
typedef std::tuple<FwdTxfmFunc, InvTxfmWithBdFunc, InvTxfmWithBdFunc, TX_SIZE,
|
||||
int, int, int>
|
||||
PartialInvTxfmParam;
|
||||
using PartialInvTxfmParam =
|
||||
std::tuple<FwdTxfmFunc, InvTxfmWithBdFunc, InvTxfmWithBdFunc, TX_SIZE, int,
|
||||
int, int>;
|
||||
const int kMaxNumCoeffs = 1024;
|
||||
const int kCountTestBlock = 1000;
|
||||
|
||||
class PartialIDctTest : public ::testing::TestWithParam<PartialInvTxfmParam> {
|
||||
public:
|
||||
virtual ~PartialIDctTest() {}
|
||||
virtual void SetUp() {
|
||||
~PartialIDctTest() override = default;
|
||||
void SetUp() override {
|
||||
rnd_.Reset(ACMRandom::DeterministicSeed());
|
||||
fwd_txfm_ = GET_PARAM(0);
|
||||
full_inv_txfm_ = GET_PARAM(1);
|
||||
@@ -76,7 +78,7 @@ class PartialIDctTest : public ::testing::TestWithParam<PartialInvTxfmParam> {
|
||||
case TX_8X8: size_ = 8; break;
|
||||
case TX_16X16: size_ = 16; break;
|
||||
case TX_32X32: size_ = 32; break;
|
||||
default: FAIL() << "Wrong Size!"; break;
|
||||
default: FAIL() << "Wrong Size!";
|
||||
}
|
||||
|
||||
// Randomize stride_ to a value less than or equal to 1024
|
||||
@@ -100,7 +102,7 @@ class PartialIDctTest : public ::testing::TestWithParam<PartialInvTxfmParam> {
|
||||
vpx_memalign(16, pixel_size_ * output_block_size_));
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
void TearDown() override {
|
||||
vpx_free(input_block_);
|
||||
input_block_ = nullptr;
|
||||
vpx_free(output_block_);
|
||||
|
||||
@@ -0,0 +1,238 @@
|
||||
/*
|
||||
* Copyright (c) 2026 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 <algorithm>
|
||||
#include <array>
|
||||
#include <memory>
|
||||
#include <new>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/decode_test_driver.h"
|
||||
#include "test/ivf_video_source.h"
|
||||
#include "test/test_vectors.h"
|
||||
#include "test/util.h"
|
||||
#if CONFIG_WEBM_IO
|
||||
#include "test/webm_video_source.h"
|
||||
#endif
|
||||
#include "vpx/vp8dx.h"
|
||||
#include "vpx/vpx_decoder.h"
|
||||
|
||||
namespace {
|
||||
|
||||
struct TestParam {
|
||||
int flags;
|
||||
const char *filename;
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, const TestParam ¶m) {
|
||||
std::string flags_str;
|
||||
if (param.flags == VP8_NOFILTERING) {
|
||||
flags_str = "default flags";
|
||||
} else {
|
||||
if (param.flags & VP8_DEBLOCK) flags_str += "deblock";
|
||||
if (param.flags & VP8_DEMACROBLOCK) {
|
||||
if (!flags_str.empty()) flags_str += ", ";
|
||||
flags_str += "demacroblock";
|
||||
}
|
||||
if (param.flags & VP8_ADDNOISE) {
|
||||
if (!flags_str.empty()) flags_str += ", ";
|
||||
flags_str += "addnoise";
|
||||
}
|
||||
if (param.flags & VP8_MFQE) {
|
||||
if (!flags_str.empty()) flags_str += ", ";
|
||||
flags_str += "mfqe";
|
||||
}
|
||||
}
|
||||
|
||||
return os << "(" << flags_str << ", " << param.filename << ")";
|
||||
}
|
||||
|
||||
class PostProcTest : public ::libvpx_test::DecoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<TestParam> {
|
||||
protected:
|
||||
PostProcTest()
|
||||
: DecoderTest(GET_PARAM(0)), postproc_flags_(GET_PARAM(1).flags) {}
|
||||
|
||||
~PostProcTest() override = default;
|
||||
|
||||
void PreDecodeFrameHook(const libvpx_test::CompressedVideoSource &video,
|
||||
libvpx_test::Decoder *decoder) override {
|
||||
// VP8_NOFILTERING is used to test the default flags set when only
|
||||
// VPX_CODEC_USE_POSTPROC is used.
|
||||
if (video.frame_number() == 0 && postproc_flags_ != VP8_NOFILTERING) {
|
||||
const vp8_postproc_cfg_t vp8_pp_cfg = { postproc_flags_,
|
||||
/*deblocking_level=*/2,
|
||||
/*noise_level=*/10 };
|
||||
decoder->Control(VP8_SET_POSTPROC, &vp8_pp_cfg);
|
||||
}
|
||||
}
|
||||
|
||||
void DecodeTest();
|
||||
|
||||
private:
|
||||
int postproc_flags_;
|
||||
};
|
||||
|
||||
void PostProcTest::DecodeTest() {
|
||||
const std::string filename = GET_PARAM(1).filename;
|
||||
vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
|
||||
cfg.threads = 2;
|
||||
|
||||
// Open compressed video file.
|
||||
std::unique_ptr<libvpx_test::CompressedVideoSource> video;
|
||||
if (filename.substr(filename.length() - 3, 3) == "ivf") {
|
||||
video.reset(new (std::nothrow) libvpx_test::IVFVideoSource(filename));
|
||||
} else if (filename.substr(filename.length() - 4, 4) == "webm") {
|
||||
#if CONFIG_WEBM_IO
|
||||
video.reset(new (std::nothrow) libvpx_test::WebMVideoSource(filename));
|
||||
#else
|
||||
GTEST_SKIP() << "WebM IO is disabled, skipping test vector " << filename;
|
||||
#endif
|
||||
}
|
||||
ASSERT_NE(video, nullptr);
|
||||
video->Init();
|
||||
|
||||
// Set decode config and flags.
|
||||
set_cfg(cfg);
|
||||
set_flags(VPX_CODEC_USE_POSTPROC);
|
||||
|
||||
// Decode frame.
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(video.get(), cfg));
|
||||
}
|
||||
|
||||
TEST_P(PostProcTest, Decode) { DecodeTest(); }
|
||||
|
||||
std::vector<int> GeneratePostProcFlags() {
|
||||
std::vector<int> flags;
|
||||
|
||||
flags.push_back(VP8_NOFILTERING);
|
||||
// Add each flag (or flags) on their own, and with add noise enabled.
|
||||
static constexpr std::array<int, 7> kFlags = { VP8_DEBLOCK,
|
||||
VP8_DEMACROBLOCK,
|
||||
VP8_ADDNOISE,
|
||||
VP8_MFQE,
|
||||
VP8_MFQE | VP8_DEBLOCK,
|
||||
VP8_MFQE | VP8_DEMACROBLOCK,
|
||||
VP8_MFQE | VP8_DEBLOCK |
|
||||
VP8_DEMACROBLOCK };
|
||||
for (const int flag : kFlags) {
|
||||
flags.push_back(flag);
|
||||
if (flag != VP8_ADDNOISE) {
|
||||
flags.push_back(flag | VP8_ADDNOISE);
|
||||
}
|
||||
}
|
||||
|
||||
std::sort(flags.begin(), flags.end());
|
||||
return flags;
|
||||
}
|
||||
|
||||
template <typename Iterator>
|
||||
std::vector<TestParam> GenerateTestParams(const std::vector<int> &flags,
|
||||
Iterator begin, Iterator end) {
|
||||
std::vector<TestParam> params;
|
||||
for (const int flag : flags) {
|
||||
for (Iterator it = begin; it != end; ++it) {
|
||||
params.push_back({ flag, *it });
|
||||
}
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
template <size_t N>
|
||||
std::vector<TestParam> GenerateTestParams(
|
||||
const std::vector<int> &flags,
|
||||
const std::array<const char *, N> &filenames) {
|
||||
return GenerateTestParams(flags, filenames.cbegin(), filenames.cend());
|
||||
}
|
||||
|
||||
class PostProcTestInvalidFiles : public PostProcTest {
|
||||
protected:
|
||||
void HandlePeekResult(libvpx_test::Decoder *const /*decoder*/,
|
||||
libvpx_test::CompressedVideoSource * /*video*/,
|
||||
const vpx_codec_err_t /*res_peek*/) override {}
|
||||
|
||||
bool HandleDecodeResult(const vpx_codec_err_t /*res_dec*/,
|
||||
const libvpx_test::CompressedVideoSource & /*video*/,
|
||||
libvpx_test::Decoder * /*decoder*/) override {
|
||||
// Ignore decode errors when decoding corrupted bitstreams.
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
TEST_P(PostProcTestInvalidFiles, Decode) { DecodeTest(); }
|
||||
|
||||
#if CONFIG_VP8_DECODER && CONFIG_POSTPROC
|
||||
VP8_INSTANTIATE_TEST_SUITE(
|
||||
PostProcTest,
|
||||
::testing::ValuesIn(GenerateTestParams(
|
||||
GeneratePostProcFlags(), libvpx_test::kVP8TestVectors,
|
||||
libvpx_test::kVP8TestVectors + libvpx_test::kNumVP8TestVectors)));
|
||||
|
||||
constexpr std::array<const char *, 5> kVP8InvalidFiles = {
|
||||
"invalid-bug-1443.ivf", "invalid-bug-148271109.ivf",
|
||||
"invalid-token-partition.ivf",
|
||||
"invalid-vp80-00-comprehensive-018.ivf.2kf_0x6.ivf",
|
||||
"invalid-vp80-00-comprehensive-s17661_r01-05_b6-.ivf"
|
||||
};
|
||||
|
||||
VP8_INSTANTIATE_TEST_SUITE(PostProcTestInvalidFiles,
|
||||
::testing::ValuesIn(GenerateTestParams(
|
||||
GeneratePostProcFlags(), kVP8InvalidFiles)));
|
||||
#endif // CONFIG_VP8_DECODER && CONFIG_POSTPROC
|
||||
|
||||
#if CONFIG_VP9_DECODER && CONFIG_VP9_POSTPROC
|
||||
VP9_INSTANTIATE_TEST_SUITE(
|
||||
PostProcTest,
|
||||
::testing::ValuesIn(GenerateTestParams(
|
||||
GeneratePostProcFlags(), libvpx_test::kVP9TestVectors,
|
||||
libvpx_test::kVP9TestVectors + libvpx_test::kNumVP9TestVectors)));
|
||||
|
||||
constexpr std::array<const char *, 27> kVP9InvalidFiles = {
|
||||
"invalid-crbug-1558.ivf", "invalid-crbug-1562.ivf",
|
||||
"invalid-crbug-629481.webm", "invalid-crbug-667044.webm",
|
||||
"invalid-vp90-01-v3.webm", "invalid-vp90-02-v2.webm",
|
||||
"invalid-vp90-03-v3.webm",
|
||||
"invalid-vp90-2-00-quantizer-00.webm.ivf.s5861_r01-05_b6-.v2.ivf",
|
||||
"invalid-vp90-2-00-quantizer-11.webm.ivf.s52984_r01-05_b6-.ivf",
|
||||
"invalid-vp90-2-00-quantizer-11.webm.ivf.s52984_r01-05_b6-z.ivf",
|
||||
// This file is disabled due to its high memory usage.
|
||||
// "invalid-vp90-2-00-quantizer-63.ivf.kf_65527x61446.ivf",
|
||||
"invalid-vp90-2-03-size-202x210.webm.ivf.s113306_r01-05_b6-.ivf",
|
||||
"invalid-vp90-2-03-size-224x196.webm.ivf.s44156_r01-05_b6-.ivf",
|
||||
"invalid-vp90-2-05-resize.ivf.s59293_r01-05_b6-.ivf",
|
||||
"invalid-vp90-2-07-frame_parallel-1.webm",
|
||||
"invalid-vp90-2-07-frame_parallel-2.webm",
|
||||
"invalid-vp90-2-07-frame_parallel-3.webm",
|
||||
"invalid-vp90-2-08-tile_1x2_frame_parallel.webm.ivf.s47039_r01-05_b6-.ivf",
|
||||
"invalid-vp90-2-08-tile_1x4_frame_parallel_all_key.webm",
|
||||
"invalid-vp90-2-08-tile_1x8_frame_parallel.webm.ivf.s288_r01-05_b6-.ivf",
|
||||
"invalid-vp90-2-09-aq2.webm.ivf.s3984_r01-05_b6-.v2.ivf",
|
||||
"invalid-vp90-2-09-subpixel-00.ivf.s19552_r01-05_b6-.v2.ivf",
|
||||
"invalid-vp90-2-09-subpixel-00.ivf.s20492_r01-05_b6-.v2.ivf",
|
||||
"invalid-vp90-2-10-show-existing-frame.webm.ivf.s180315_r01-05_b6-.ivf",
|
||||
"invalid-vp90-2-12-droppable_1.ivf.s3676_r01-05_b6-.ivf",
|
||||
"invalid-vp90-2-12-droppable_1.ivf.s73804_r01-05_b6-.ivf",
|
||||
"invalid-vp90-2-21-resize_inter_320x180_5_3-4.webm.ivf.s45551_r01-05_b6-.ivf",
|
||||
"invalid-vp91-2-mixedrefcsp-444to420.ivf"
|
||||
};
|
||||
|
||||
VP9_INSTANTIATE_TEST_SUITE(PostProcTestInvalidFiles,
|
||||
::testing::ValuesIn(GenerateTestParams(
|
||||
GeneratePostProcFlags(), kVP9InvalidFiles)));
|
||||
|
||||
#endif // CONFIG_VP9_DECODER && CONFIG_VP9_POSTPROC
|
||||
|
||||
} // namespace
|
||||
@@ -7,30 +7,35 @@
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#include "./vpx_dsp_rtcd.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "test/acm_random.h"
|
||||
#include "test/bench.h"
|
||||
#include "test/buffer.h"
|
||||
#include "test/clear_system_state.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
|
||||
using libvpx_test::ACMRandom;
|
||||
using libvpx_test::Buffer;
|
||||
|
||||
typedef void (*VpxPostProcDownAndAcrossMbRowFunc)(
|
||||
using VpxPostProcDownAndAcrossMbRowFunc = void (*)(
|
||||
unsigned char *src_ptr, unsigned char *dst_ptr, int src_pixels_per_line,
|
||||
int dst_pixels_per_line, int cols, unsigned char *flimit, int size);
|
||||
|
||||
typedef void (*VpxMbPostProcAcrossIpFunc)(unsigned char *src, int pitch,
|
||||
int rows, int cols, int flimit);
|
||||
using VpxMbPostProcAcrossIpFunc = void (*)(unsigned char *src, int pitch,
|
||||
int rows, int cols, int flimit);
|
||||
|
||||
typedef void (*VpxMbPostProcDownFunc)(unsigned char *dst, int pitch, int rows,
|
||||
int cols, int flimit);
|
||||
using VpxMbPostProcDownFunc = void (*)(unsigned char *dst, int pitch, int rows,
|
||||
int cols, int flimit);
|
||||
|
||||
namespace {
|
||||
// Compute the filter level used in post proc from the loop filter strength
|
||||
@@ -47,10 +52,10 @@ class VpxPostProcDownAndAcrossMbRowTest
|
||||
public:
|
||||
VpxPostProcDownAndAcrossMbRowTest()
|
||||
: mb_post_proc_down_and_across_(GetParam()) {}
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
void TearDown() override { libvpx_test::ClearSystemState(); }
|
||||
|
||||
protected:
|
||||
virtual void Run();
|
||||
void Run() override;
|
||||
|
||||
const VpxPostProcDownAndAcrossMbRowFunc mb_post_proc_down_and_across_;
|
||||
// Size of the underlying data block that will be filtered.
|
||||
@@ -62,9 +67,10 @@ class VpxPostProcDownAndAcrossMbRowTest
|
||||
};
|
||||
|
||||
void VpxPostProcDownAndAcrossMbRowTest::Run() {
|
||||
mb_post_proc_down_and_across_(
|
||||
src_image_->TopLeftPixel(), dst_image_->TopLeftPixel(),
|
||||
src_image_->stride(), dst_image_->stride(), block_width_, flimits_, 16);
|
||||
mb_post_proc_down_and_across_(src_image_->TopLeftPixel(),
|
||||
dst_image_->TopLeftPixel(),
|
||||
src_image_->stride(), dst_image_->stride(),
|
||||
block_width_, flimits_, block_height_);
|
||||
}
|
||||
|
||||
// Test routine for the VPx post-processing function
|
||||
@@ -121,99 +127,129 @@ TEST_P(VpxPostProcDownAndAcrossMbRowTest, CheckCvsAssembly) {
|
||||
// Size of the underlying data block that will be filtered.
|
||||
// Y blocks are always a multiple of 16 wide and exactly 16 high. U and V
|
||||
// blocks are always a multiple of 8 wide and exactly 8 high.
|
||||
block_width_ = 136;
|
||||
block_height_ = 16;
|
||||
|
||||
// 5-tap filter needs 2 padding rows above and below the block in the input.
|
||||
// SSE2 reads in blocks of 16. Pad an extra 8 in case the width is not %16.
|
||||
Buffer<uint8_t> src_image =
|
||||
Buffer<uint8_t>(block_width_, block_height_, 2, 2, 10, 2);
|
||||
ASSERT_TRUE(src_image.Init());
|
||||
|
||||
// Filter extends output block by 8 samples at left and right edges.
|
||||
// Though the left padding is only 8 bytes, there is 'above' padding as well
|
||||
// so when the assembly code tries to read 16 bytes before the pointer it is
|
||||
// not a problem.
|
||||
// SSE2 reads in blocks of 16. Pad an extra 8 in case the width is not %16.
|
||||
Buffer<uint8_t> dst_image =
|
||||
Buffer<uint8_t>(block_width_, block_height_, 8, 8, 16, 8);
|
||||
ASSERT_TRUE(dst_image.Init());
|
||||
Buffer<uint8_t> dst_image_ref =
|
||||
Buffer<uint8_t>(block_width_, block_height_, 8);
|
||||
ASSERT_TRUE(dst_image_ref.Init());
|
||||
|
||||
// Filter values are set in blocks of 16 for Y and 8 for U/V. Each macroblock
|
||||
// can have a different filter. SSE2 assembly reads flimits in blocks of 16 so
|
||||
// it must be padded out.
|
||||
const int flimits_width = block_width_ % 16 ? block_width_ + 8 : block_width_;
|
||||
flimits_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, flimits_width));
|
||||
static constexpr int kWidths[] = { 8, 16, 24, 32, 136 };
|
||||
static constexpr int kHeights[] = { 8, 16 };
|
||||
|
||||
ACMRandom rnd;
|
||||
rnd.Reset(ACMRandom::DeterministicSeed());
|
||||
// Initialize pixels in the input:
|
||||
// block pixels to random values.
|
||||
// border pixels to value 10.
|
||||
src_image.SetPadding(10);
|
||||
src_image.Set(&rnd, &ACMRandom::Rand8);
|
||||
|
||||
for (int blocks = 0; blocks < block_width_; blocks += 8) {
|
||||
(void)memset(flimits_, 0, sizeof(*flimits_) * flimits_width);
|
||||
for (int width : kWidths) {
|
||||
for (int height : kHeights) {
|
||||
char str[8];
|
||||
snprintf(str, sizeof(str), "%dx%d", width, height);
|
||||
SCOPED_TRACE(str);
|
||||
block_width_ = width;
|
||||
block_height_ = height;
|
||||
|
||||
for (int f = 0; f < 255; f++) {
|
||||
(void)memset(flimits_ + blocks, f, sizeof(*flimits_) * 8);
|
||||
dst_image.Set(0);
|
||||
dst_image_ref.Set(0);
|
||||
// 5-tap filter needs 2 padding rows above and below the block in the
|
||||
// input. SSE2 reads in blocks of 16. Pad an extra 8 in case the width is
|
||||
// not %16.
|
||||
Buffer<uint8_t> src_image =
|
||||
Buffer<uint8_t>(block_width_, block_height_, 2, 2, 10, 2);
|
||||
ASSERT_TRUE(src_image.Init());
|
||||
|
||||
vpx_post_proc_down_and_across_mb_row_c(
|
||||
src_image.TopLeftPixel(), dst_image_ref.TopLeftPixel(),
|
||||
src_image.stride(), dst_image_ref.stride(), block_width_, flimits_,
|
||||
block_height_);
|
||||
ASM_REGISTER_STATE_CHECK(mb_post_proc_down_and_across_(
|
||||
src_image.TopLeftPixel(), dst_image.TopLeftPixel(),
|
||||
src_image.stride(), dst_image.stride(), block_width_, flimits_,
|
||||
block_height_));
|
||||
// Filter extends output block by 8 samples at left and right edges.
|
||||
// Though the left padding is only 8 bytes, there is 'above' padding as
|
||||
// well so when the assembly code tries to read 16 bytes before the
|
||||
// pointer it is not a problem. SSE2 reads in blocks of 16. Pad an extra 8
|
||||
// in case the width is not %16.
|
||||
Buffer<uint8_t> dst_image =
|
||||
Buffer<uint8_t>(block_width_, block_height_, 8, 8, 16, 8);
|
||||
ASSERT_TRUE(dst_image.Init());
|
||||
Buffer<uint8_t> dst_image_ref =
|
||||
Buffer<uint8_t>(block_width_, block_height_, 8);
|
||||
ASSERT_TRUE(dst_image_ref.Init());
|
||||
|
||||
ASSERT_TRUE(dst_image.CheckValues(dst_image_ref));
|
||||
// Filter values are set in blocks of 16 for Y and 8 for U/V. Each
|
||||
// macroblock can have a different filter. SSE2 assembly reads flimits in
|
||||
// blocks of 16 so it must be padded out.
|
||||
const int flimits_width =
|
||||
block_width_ % 16 ? block_width_ + 8 : block_width_;
|
||||
flimits_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, flimits_width));
|
||||
|
||||
// Initialize pixels in the input:
|
||||
// block pixels to random values.
|
||||
// border pixels to value 10.
|
||||
src_image.SetPadding(10);
|
||||
src_image.Set(&rnd, &ACMRandom::Rand8);
|
||||
|
||||
for (int blocks = 0; blocks < block_width_; blocks += 8) {
|
||||
(void)memset(flimits_, 0, sizeof(*flimits_) * flimits_width);
|
||||
|
||||
for (int f = 0; f < 255; f++) {
|
||||
(void)memset(flimits_ + blocks, f, sizeof(*flimits_) * 8);
|
||||
dst_image.Set(0);
|
||||
dst_image_ref.Set(0);
|
||||
|
||||
vpx_post_proc_down_and_across_mb_row_c(
|
||||
src_image.TopLeftPixel(), dst_image_ref.TopLeftPixel(),
|
||||
src_image.stride(), dst_image_ref.stride(), block_width_,
|
||||
flimits_, block_height_);
|
||||
ASM_REGISTER_STATE_CHECK(mb_post_proc_down_and_across_(
|
||||
src_image.TopLeftPixel(), dst_image.TopLeftPixel(),
|
||||
src_image.stride(), dst_image.stride(), block_width_, flimits_,
|
||||
block_height_));
|
||||
|
||||
ASSERT_TRUE(dst_image.CheckValues(dst_image_ref));
|
||||
}
|
||||
}
|
||||
|
||||
vpx_free(flimits_);
|
||||
}
|
||||
}
|
||||
|
||||
vpx_free(flimits_);
|
||||
}
|
||||
|
||||
TEST_P(VpxPostProcDownAndAcrossMbRowTest, DISABLED_Speed) {
|
||||
// Size of the underlying data block that will be filtered.
|
||||
block_width_ = 16;
|
||||
block_height_ = 16;
|
||||
static constexpr struct {
|
||||
int width;
|
||||
int height;
|
||||
} kSizes[] = {
|
||||
{ 16, 16 },
|
||||
{ 136, 16 },
|
||||
{ 24, 8 },
|
||||
{ 8, 8 },
|
||||
};
|
||||
|
||||
// 5-tap filter needs 2 padding rows above and below the block in the input.
|
||||
Buffer<uint8_t> src_image = Buffer<uint8_t>(block_width_, block_height_, 2);
|
||||
ASSERT_TRUE(src_image.Init());
|
||||
this->src_image_ = &src_image;
|
||||
for (const auto &size : kSizes) {
|
||||
block_width_ = size.width;
|
||||
block_height_ = size.height;
|
||||
|
||||
// Filter extends output block by 8 samples at left and right edges.
|
||||
// Though the left padding is only 8 bytes, the assembly code tries to
|
||||
// read 16 bytes before the pointer.
|
||||
Buffer<uint8_t> dst_image =
|
||||
Buffer<uint8_t>(block_width_, block_height_, 8, 16, 8, 8);
|
||||
ASSERT_TRUE(dst_image.Init());
|
||||
this->dst_image_ = &dst_image;
|
||||
// 5-tap filter needs 2 padding rows above and below the block in the input.
|
||||
Buffer<uint8_t> src_image =
|
||||
Buffer<uint8_t>(block_width_, block_height_, 2, 2, 10, 2);
|
||||
ASSERT_TRUE(src_image.Init());
|
||||
this->src_image_ = &src_image;
|
||||
|
||||
flimits_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_width_));
|
||||
(void)memset(flimits_, 255, block_width_);
|
||||
// Filter extends output block by 8 samples at left and right edges.
|
||||
// Though the left padding is only 8 bytes, the assembly code tries to
|
||||
// read 16 bytes before the pointer. Pad an extra 8 in case the width is
|
||||
// not %16.
|
||||
Buffer<uint8_t> dst_image =
|
||||
Buffer<uint8_t>(block_width_, block_height_, 8, 8, 16, 8);
|
||||
ASSERT_TRUE(dst_image.Init());
|
||||
this->dst_image_ = &dst_image;
|
||||
|
||||
// Initialize pixels in the input:
|
||||
// block pixels to value 1,
|
||||
// border pixels to value 10.
|
||||
src_image.SetPadding(10);
|
||||
src_image.Set(1);
|
||||
const int flimits_width =
|
||||
block_width_ % 16 ? block_width_ + 8 : block_width_;
|
||||
flimits_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, flimits_width));
|
||||
(void)memset(flimits_, 255, flimits_width);
|
||||
|
||||
// Initialize pixels in the output to 99.
|
||||
dst_image.Set(99);
|
||||
// Initialize pixels in the input:
|
||||
// block pixels to value 1,
|
||||
// border pixels to value 10.
|
||||
src_image.SetPadding(10);
|
||||
src_image.Set(1);
|
||||
|
||||
RunNTimes(INT16_MAX);
|
||||
PrintMedian("16x16");
|
||||
// Initialize pixels in the output to 99.
|
||||
dst_image.Set(99);
|
||||
|
||||
vpx_free(flimits_);
|
||||
char title[32];
|
||||
snprintf(title, sizeof(title), "%dx%d", block_width_, block_height_);
|
||||
RunNTimes(INT16_MAX);
|
||||
PrintMedian(title);
|
||||
|
||||
vpx_free(flimits_);
|
||||
}
|
||||
}
|
||||
|
||||
class VpxMbPostProcAcrossIpTest
|
||||
@@ -223,10 +259,10 @@ class VpxMbPostProcAcrossIpTest
|
||||
VpxMbPostProcAcrossIpTest()
|
||||
: rows_(16), cols_(16), mb_post_proc_across_ip_(GetParam()),
|
||||
src_(Buffer<uint8_t>(rows_, cols_, 8, 8, 17, 8)) {}
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
void TearDown() override { libvpx_test::ClearSystemState(); }
|
||||
|
||||
protected:
|
||||
virtual void Run();
|
||||
void Run() override;
|
||||
|
||||
void SetCols(unsigned char *s, int rows, int cols, int src_width) {
|
||||
for (int r = 0; r < rows; r++) {
|
||||
@@ -352,10 +388,10 @@ class VpxMbPostProcDownTest
|
||||
: rows_(16), cols_(16), mb_post_proc_down_(GetParam()),
|
||||
src_c_(Buffer<uint8_t>(rows_, cols_, 8, 8, 8, 17)) {}
|
||||
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
void TearDown() override { libvpx_test::ClearSystemState(); }
|
||||
|
||||
protected:
|
||||
virtual void Run();
|
||||
void Run() override;
|
||||
|
||||
void SetRows(unsigned char *src_c, int rows, int cols, int src_width) {
|
||||
for (int r = 0; r < rows; r++) {
|
||||
@@ -458,14 +494,13 @@ TEST_P(VpxMbPostProcDownTest, CheckLowFilterOutput) {
|
||||
|
||||
SetRows(src_c_.TopLeftPixel(), rows_, cols_, src_c_.stride());
|
||||
|
||||
unsigned char *expected_output = new unsigned char[rows_ * cols_];
|
||||
std::unique_ptr<unsigned char[]> expected_output(
|
||||
new unsigned char[rows_ * cols_]);
|
||||
ASSERT_NE(expected_output, nullptr);
|
||||
SetRows(expected_output, rows_, cols_, cols_);
|
||||
SetRows(expected_output.get(), rows_, cols_, cols_);
|
||||
|
||||
RunFilterLevel(src_c_.TopLeftPixel(), rows_, cols_, src_c_.stride(), q2mbl(0),
|
||||
expected_output);
|
||||
|
||||
delete[] expected_output;
|
||||
expected_output.get());
|
||||
}
|
||||
|
||||
TEST_P(VpxMbPostProcDownTest, CheckCvsAssembly) {
|
||||
|
||||
@@ -8,11 +8,12 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <tuple>
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "./vp8_rtcd.h"
|
||||
#include "./vpx_config.h"
|
||||
@@ -21,20 +22,21 @@
|
||||
#include "test/clear_system_state.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "test/util.h"
|
||||
#include "vp8/common/blockd.h"
|
||||
#include "vp8/common/reconinter.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
#include "vpx_ports/msvc.h"
|
||||
|
||||
namespace {
|
||||
|
||||
using libvpx_test::ACMRandom;
|
||||
using std::make_tuple;
|
||||
|
||||
typedef void (*PredictFunc)(uint8_t *src_ptr, int src_pixels_per_line,
|
||||
int xoffset, int yoffset, uint8_t *dst_ptr,
|
||||
int dst_pitch);
|
||||
using PredictFunc = void (*)(uint8_t *src_ptr, int src_pixels_per_line,
|
||||
int xoffset, int yoffset, uint8_t *dst_ptr,
|
||||
int dst_pitch);
|
||||
|
||||
typedef std::tuple<int, int, PredictFunc> PredictParam;
|
||||
using PredictParam = std::tuple<int, int, PredictFunc>;
|
||||
|
||||
class PredictTestBase : public AbstractBench,
|
||||
public ::testing::TestWithParam<PredictParam> {
|
||||
@@ -43,7 +45,7 @@ class PredictTestBase : public AbstractBench,
|
||||
: width_(GET_PARAM(0)), height_(GET_PARAM(1)), predict_(GET_PARAM(2)),
|
||||
src_(nullptr), padded_dst_(nullptr), dst_(nullptr), dst_c_(nullptr) {}
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
src_ = new uint8_t[kSrcSize];
|
||||
ASSERT_NE(src_, nullptr);
|
||||
|
||||
@@ -64,7 +66,7 @@ class PredictTestBase : public AbstractBench,
|
||||
memset(dst_c_, 0, 16 * 16);
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
void TearDown() override {
|
||||
delete[] src_;
|
||||
src_ = nullptr;
|
||||
vpx_free(padded_dst_);
|
||||
@@ -209,7 +211,7 @@ class PredictTestBase : public AbstractBench,
|
||||
}
|
||||
}
|
||||
|
||||
void Run() {
|
||||
void Run() override {
|
||||
for (int xoffset = 0; xoffset < 8; ++xoffset) {
|
||||
for (int yoffset = 0; yoffset < 8; ++yoffset) {
|
||||
if (xoffset == 0 && yoffset == 0) {
|
||||
@@ -312,19 +314,19 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
make_tuple(8, 4, &vp8_sixtap_predict8x4_neon),
|
||||
make_tuple(4, 4, &vp8_sixtap_predict4x4_neon)));
|
||||
#endif
|
||||
#if HAVE_MMX
|
||||
#if HAVE_MMX && HAVE_X86_ASM
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
MMX, SixtapPredictTest,
|
||||
::testing::Values(make_tuple(4, 4, &vp8_sixtap_predict4x4_mmx)));
|
||||
#endif
|
||||
#if HAVE_SSE2
|
||||
#if HAVE_SSE2 && HAVE_X86_ASM
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
SSE2, SixtapPredictTest,
|
||||
::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_sse2),
|
||||
make_tuple(8, 8, &vp8_sixtap_predict8x8_sse2),
|
||||
make_tuple(8, 4, &vp8_sixtap_predict8x4_sse2)));
|
||||
#endif
|
||||
#if HAVE_SSSE3
|
||||
#if HAVE_SSSE3 && HAVE_X86_ASM
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
SSSE3, SixtapPredictTest,
|
||||
::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_ssse3),
|
||||
@@ -350,6 +352,14 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
make_tuple(4, 4, &vp8_sixtap_predict4x4_mmi)));
|
||||
#endif
|
||||
|
||||
#if HAVE_LSX
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
LSX, SixtapPredictTest,
|
||||
::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_lsx),
|
||||
make_tuple(8, 8, &vp8_sixtap_predict8x8_lsx),
|
||||
make_tuple(4, 4, &vp8_sixtap_predict4x4_lsx)));
|
||||
#endif
|
||||
|
||||
class BilinearPredictTest : public PredictTestBase {};
|
||||
|
||||
TEST_P(BilinearPredictTest, TestWithRandomData) {
|
||||
@@ -389,7 +399,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
make_tuple(8, 4, &vp8_bilinear_predict8x4_sse2),
|
||||
make_tuple(4, 4, &vp8_bilinear_predict4x4_sse2)));
|
||||
#endif
|
||||
#if HAVE_SSSE3
|
||||
#if HAVE_SSSE3 && HAVE_X86_ASM
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
SSSE3, BilinearPredictTest,
|
||||
::testing::Values(make_tuple(16, 16, &vp8_bilinear_predict16x16_ssse3),
|
||||
@@ -403,4 +413,110 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
make_tuple(8, 4, &vp8_bilinear_predict8x4_msa),
|
||||
make_tuple(4, 4, &vp8_bilinear_predict4x4_msa)));
|
||||
#endif
|
||||
class BuildInterPredictorTest : public ::testing::Test {
|
||||
protected:
|
||||
enum {
|
||||
kYStride = 64,
|
||||
kYSize = kYStride * kYStride,
|
||||
kUVStride = kYStride >> 1,
|
||||
kUVSize = kUVStride * kUVStride,
|
||||
kRef = 0x80,
|
||||
kFill = 0xcd
|
||||
};
|
||||
|
||||
void SetUp() override {
|
||||
xd_ =
|
||||
reinterpret_cast<MACROBLOCKD *>(vpx_memalign(32, sizeof(MACROBLOCKD)));
|
||||
ASSERT_NE(xd_, nullptr);
|
||||
memset(xd_, 0, sizeof(*xd_));
|
||||
|
||||
pre_y_ = reinterpret_cast<uint8_t *>(vpx_memalign(32, kYSize));
|
||||
pre_u_ = reinterpret_cast<uint8_t *>(vpx_memalign(32, kUVSize));
|
||||
pre_v_ = reinterpret_cast<uint8_t *>(vpx_memalign(32, kUVSize));
|
||||
dst_y_ = reinterpret_cast<uint8_t *>(vpx_memalign(32, kYSize));
|
||||
dst_u_ = reinterpret_cast<uint8_t *>(vpx_memalign(32, kUVSize));
|
||||
dst_v_ = reinterpret_cast<uint8_t *>(vpx_memalign(32, kUVSize));
|
||||
ASSERT_NE(pre_y_, nullptr);
|
||||
ASSERT_NE(pre_u_, nullptr);
|
||||
ASSERT_NE(pre_v_, nullptr);
|
||||
ASSERT_NE(dst_y_, nullptr);
|
||||
ASSERT_NE(dst_u_, nullptr);
|
||||
ASSERT_NE(dst_v_, nullptr);
|
||||
memset(pre_y_, kRef, kYSize);
|
||||
memset(pre_u_, kRef, kUVSize);
|
||||
memset(pre_v_, kRef, kUVSize);
|
||||
|
||||
memset(&mi_, 0, sizeof(mi_));
|
||||
xd_->mode_info_context = &mi_;
|
||||
xd_->pre.y_buffer = pre_y_ + (kYStride >> 1) * kYStride + (kYStride >> 1);
|
||||
xd_->pre.u_buffer =
|
||||
pre_u_ + (kUVStride >> 1) * kUVStride + (kUVStride >> 1);
|
||||
xd_->pre.v_buffer =
|
||||
pre_v_ + (kUVStride >> 1) * kUVStride + (kUVStride >> 1);
|
||||
xd_->pre.y_stride = kYStride;
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
vpx_free(xd_);
|
||||
vpx_free(pre_y_);
|
||||
vpx_free(pre_u_);
|
||||
vpx_free(pre_v_);
|
||||
vpx_free(dst_y_);
|
||||
vpx_free(dst_u_);
|
||||
vpx_free(dst_v_);
|
||||
libvpx_test::ClearSystemState();
|
||||
}
|
||||
|
||||
void RunAndCheck(int row, int col) {
|
||||
memset(dst_y_, kFill, kYSize);
|
||||
memset(dst_u_, kFill, kUVSize);
|
||||
memset(dst_v_, kFill, kUVSize);
|
||||
|
||||
mi_.mbmi.mv.as_mv.row = static_cast<short>(row);
|
||||
mi_.mbmi.mv.as_mv.col = static_cast<short>(col);
|
||||
mi_.mbmi.need_to_clamp_mvs = 1;
|
||||
|
||||
uint8_t *const dst_y =
|
||||
dst_y_ + (kYStride >> 1) * kYStride + (kYStride >> 1);
|
||||
uint8_t *const dst_u =
|
||||
dst_u_ + (kUVStride >> 1) * kUVStride + (kUVStride >> 1);
|
||||
uint8_t *const dst_v =
|
||||
dst_v_ + (kUVStride >> 1) * kUVStride + (kUVStride >> 1);
|
||||
|
||||
vp8_build_inter16x16_predictors_mb(xd_, dst_y, dst_u, dst_v, kYStride,
|
||||
kUVStride);
|
||||
|
||||
for (int r = 0; r < 8; ++r) {
|
||||
for (int c = 0; c < 8; ++c) {
|
||||
ASSERT_EQ(kRef, dst_u[r * kUVStride + c])
|
||||
<< "U[" << r << "][" << c << "] mv=(" << row << "," << col << ")";
|
||||
ASSERT_EQ(kRef, dst_v[r * kUVStride + c])
|
||||
<< "V[" << r << "][" << c << "] mv=(" << row << "," << col << ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MACROBLOCKD *xd_;
|
||||
MODE_INFO mi_;
|
||||
uint8_t *pre_y_;
|
||||
uint8_t *pre_u_;
|
||||
uint8_t *pre_v_;
|
||||
uint8_t *dst_y_;
|
||||
uint8_t *dst_u_;
|
||||
uint8_t *dst_v_;
|
||||
};
|
||||
|
||||
// With full-pixel-only chroma motion (fullpixel_mask == ~7), rounding the
|
||||
// derived chroma MV down can move it just past the border tap window. The
|
||||
// chroma destination must still be written from a clamped reference position.
|
||||
TEST_F(BuildInterPredictorTest, FullPixelChromaMVAlwaysWritesUV) {
|
||||
xd_->mb_to_left_edge = 0;
|
||||
xd_->mb_to_right_edge = 0;
|
||||
xd_->mb_to_top_edge = 0;
|
||||
xd_->mb_to_bottom_edge = 0;
|
||||
xd_->fullpixel_mask = ~7;
|
||||
|
||||
RunAndCheck(0, -152);
|
||||
RunAndCheck(-152, 0);
|
||||
}
|
||||
} // namespace
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <string.h>
|
||||
#include <tuple>
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "./vp8_rtcd.h"
|
||||
#include "./vpx_config.h"
|
||||
@@ -33,9 +33,9 @@ namespace {
|
||||
const int kNumBlocks = 25;
|
||||
const int kNumBlockEntries = 16;
|
||||
|
||||
typedef void (*VP8Quantize)(BLOCK *b, BLOCKD *d);
|
||||
using VP8Quantize = void (*)(BLOCK *b, BLOCKD *d);
|
||||
|
||||
typedef std::tuple<VP8Quantize, VP8Quantize> VP8QuantizeParam;
|
||||
using VP8QuantizeParam = std::tuple<VP8Quantize, VP8Quantize>;
|
||||
|
||||
using libvpx_test::ACMRandom;
|
||||
using std::make_tuple;
|
||||
@@ -71,7 +71,7 @@ class QuantizeTestBase {
|
||||
// Copy macroblockd from the reference to get pre-set-up dequant values.
|
||||
macroblockd_dst_ = reinterpret_cast<MACROBLOCKD *>(
|
||||
vpx_memalign(32, sizeof(*macroblockd_dst_)));
|
||||
memcpy(macroblockd_dst_, &vp8_comp_->mb.e_mbd, sizeof(*macroblockd_dst_));
|
||||
*macroblockd_dst_ = vp8_comp_->mb.e_mbd;
|
||||
// Fix block pointers - currently they point to the blocks in the reference
|
||||
// structure.
|
||||
vp8_setup_block_dptrs(macroblockd_dst_);
|
||||
@@ -80,7 +80,7 @@ class QuantizeTestBase {
|
||||
void UpdateQuantizer(int q) {
|
||||
vp8_set_quantizer(vp8_comp_, q);
|
||||
|
||||
memcpy(macroblockd_dst_, &vp8_comp_->mb.e_mbd, sizeof(*macroblockd_dst_));
|
||||
*macroblockd_dst_ = vp8_comp_->mb.e_mbd;
|
||||
vp8_setup_block_dptrs(macroblockd_dst_);
|
||||
}
|
||||
|
||||
@@ -121,13 +121,13 @@ class QuantizeTest : public QuantizeTestBase,
|
||||
public ::testing::TestWithParam<VP8QuantizeParam>,
|
||||
public AbstractBench {
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
SetupCompressor();
|
||||
asm_quant_ = GET_PARAM(0);
|
||||
c_quant_ = GET_PARAM(1);
|
||||
}
|
||||
|
||||
virtual void Run() {
|
||||
void Run() override {
|
||||
asm_quant_(&vp8_comp_->mb.block[0], ¯oblockd_dst_->block[0]);
|
||||
}
|
||||
|
||||
@@ -228,7 +228,8 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
#if HAVE_LSX
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
LSX, QuantizeTest,
|
||||
::testing::Values(make_tuple(&vp8_regular_quantize_b_lsx,
|
||||
&vp8_regular_quantize_b_c)));
|
||||
::testing::Values(
|
||||
make_tuple(&vp8_fast_quantize_b_lsx, &vp8_fast_quantize_b_c),
|
||||
make_tuple(&vp8_regular_quantize_b_lsx, &vp8_regular_quantize_b_c)));
|
||||
#endif // HAVE_LSX
|
||||
} // namespace
|
||||
@@ -9,11 +9,12 @@
|
||||
*/
|
||||
#include <limits.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/encode_test_driver.h"
|
||||
#include "test/util.h"
|
||||
#include "test/video_source.h"
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "vpx_config.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -26,7 +27,7 @@ class RealtimeTest
|
||||
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
|
||||
protected:
|
||||
RealtimeTest() : EncoderTest(GET_PARAM(0)), frame_packets_(0) {}
|
||||
~RealtimeTest() override {}
|
||||
~RealtimeTest() override = default;
|
||||
|
||||
void SetUp() override {
|
||||
InitializeConfig();
|
||||
@@ -94,8 +95,11 @@ TEST_P(RealtimeTest, RealtimeDefaultCpuUsed) {
|
||||
TEST_P(RealtimeTest, IntegerOverflow) { TestIntegerOverflow(2048, 2048); }
|
||||
|
||||
TEST_P(RealtimeTest, IntegerOverflowLarge) {
|
||||
#ifdef CHROMIUM
|
||||
GTEST_SKIP() << "16K framebuffers are not supported by Chromium's allocator.";
|
||||
#else
|
||||
if (IsVP9()) {
|
||||
#if VPX_ARCH_X86_64
|
||||
#if VPX_ARCH_AARCH64 || VPX_ARCH_X86_64
|
||||
TestIntegerOverflow(16384, 16384);
|
||||
#else
|
||||
TestIntegerOverflow(4096, 4096);
|
||||
@@ -107,6 +111,7 @@ TEST_P(RealtimeTest, IntegerOverflowLarge) {
|
||||
"warnings are fixed.";
|
||||
// TestIntegerOverflow(16383, 16383);
|
||||
}
|
||||
#endif // defined(CHROMIUM)
|
||||
}
|
||||
|
||||
VP8_INSTANTIATE_TEST_SUITE(RealtimeTest,
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#ifndef VPX_TEST_REGISTER_STATE_CHECK_H_
|
||||
#define VPX_TEST_REGISTER_STATE_CHECK_H_
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "./vpx_config.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
|
||||
@@ -184,13 +184,13 @@ class RegisterStateCheckMMX {
|
||||
uint16_t pre_fpu_env_[14];
|
||||
};
|
||||
|
||||
#define API_REGISTER_STATE_CHECK(statement) \
|
||||
do { \
|
||||
{ \
|
||||
libvpx_test::RegisterStateCheckMMX reg_check; \
|
||||
ASM_REGISTER_STATE_CHECK(statement); \
|
||||
} \
|
||||
__asm__ volatile("" ::: "memory"); \
|
||||
#define API_REGISTER_STATE_CHECK(statement) \
|
||||
do { \
|
||||
{ \
|
||||
libvpx_test::RegisterStateCheckMMX reg_check_mmx; \
|
||||
ASM_REGISTER_STATE_CHECK(statement); \
|
||||
} \
|
||||
__asm__ volatile("" ::: "memory"); \
|
||||
} while (false)
|
||||
|
||||
} // namespace libvpx_test
|
||||
|
||||
+174
-130
@@ -7,16 +7,15 @@
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
|
||||
#include <climits>
|
||||
#include <vector>
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/encode_test_driver.h"
|
||||
#include "test/i420_video_source.h"
|
||||
#include "test/video_source.h"
|
||||
#include "test/util.h"
|
||||
#include "test/video_source.h"
|
||||
#include "vpx_config.h"
|
||||
|
||||
// Enable(1) or Disable(0) writing of the compressed bitstream.
|
||||
#define WRITE_COMPRESSED_STREAM 0
|
||||
@@ -94,23 +93,28 @@ struct FrameInfo {
|
||||
void ScaleForFrameNumber(unsigned int frame, unsigned int initial_w,
|
||||
unsigned int initial_h, unsigned int *w,
|
||||
unsigned int *h, bool flag_codec,
|
||||
bool smaller_width_larger_size_) {
|
||||
if (smaller_width_larger_size_) {
|
||||
if (frame < 30) {
|
||||
*w = initial_w;
|
||||
*h = initial_h;
|
||||
return;
|
||||
}
|
||||
bool smaller_width_larger_size,
|
||||
bool random_input_one_half_only) {
|
||||
*w = initial_w;
|
||||
*h = initial_h;
|
||||
|
||||
if (random_input_one_half_only == 1) {
|
||||
if (frame < 100) {
|
||||
*w = initial_w * 7 / 10;
|
||||
*h = initial_h * 16 / 10;
|
||||
return;
|
||||
}
|
||||
*w = initial_w / 2;
|
||||
*h = initial_h / 2;
|
||||
return;
|
||||
}
|
||||
if (smaller_width_larger_size) {
|
||||
if (frame < 30) {
|
||||
return;
|
||||
}
|
||||
*w = initial_w * 7 / 10;
|
||||
*h = initial_h * 16 / 10;
|
||||
return;
|
||||
}
|
||||
if (frame < 10) {
|
||||
*w = initial_w;
|
||||
*h = initial_h;
|
||||
return;
|
||||
}
|
||||
if (frame < 20) {
|
||||
@@ -124,8 +128,6 @@ void ScaleForFrameNumber(unsigned int frame, unsigned int initial_w,
|
||||
return;
|
||||
}
|
||||
if (frame < 40) {
|
||||
*w = initial_w;
|
||||
*h = initial_h;
|
||||
return;
|
||||
}
|
||||
if (frame < 50) {
|
||||
@@ -139,8 +141,6 @@ void ScaleForFrameNumber(unsigned int frame, unsigned int initial_w,
|
||||
return;
|
||||
}
|
||||
if (frame < 70) {
|
||||
*w = initial_w;
|
||||
*h = initial_h;
|
||||
return;
|
||||
}
|
||||
if (frame < 80) {
|
||||
@@ -159,8 +159,6 @@ void ScaleForFrameNumber(unsigned int frame, unsigned int initial_w,
|
||||
return;
|
||||
}
|
||||
if (frame < 110) {
|
||||
*w = initial_w;
|
||||
*h = initial_h;
|
||||
return;
|
||||
}
|
||||
if (frame < 120) {
|
||||
@@ -179,8 +177,6 @@ void ScaleForFrameNumber(unsigned int frame, unsigned int initial_w,
|
||||
return;
|
||||
}
|
||||
if (frame < 150) {
|
||||
*w = initial_w;
|
||||
*h = initial_h;
|
||||
return;
|
||||
}
|
||||
if (frame < 160) {
|
||||
@@ -199,8 +195,6 @@ void ScaleForFrameNumber(unsigned int frame, unsigned int initial_w,
|
||||
return;
|
||||
}
|
||||
if (frame < 190) {
|
||||
*w = initial_w;
|
||||
*h = initial_h;
|
||||
return;
|
||||
}
|
||||
if (frame < 200) {
|
||||
@@ -219,8 +213,6 @@ void ScaleForFrameNumber(unsigned int frame, unsigned int initial_w,
|
||||
return;
|
||||
}
|
||||
if (frame < 230) {
|
||||
*w = initial_w;
|
||||
*h = initial_h;
|
||||
return;
|
||||
}
|
||||
if (frame < 240) {
|
||||
@@ -234,8 +226,6 @@ void ScaleForFrameNumber(unsigned int frame, unsigned int initial_w,
|
||||
return;
|
||||
}
|
||||
if (frame < 260) {
|
||||
*w = initial_w;
|
||||
*h = initial_h;
|
||||
return;
|
||||
}
|
||||
// Go down very low.
|
||||
@@ -248,36 +238,52 @@ void ScaleForFrameNumber(unsigned int frame, unsigned int initial_w,
|
||||
// Cases that only works for VP9.
|
||||
// For VP9: Swap width and height of original.
|
||||
if (frame < 320) {
|
||||
*w = initial_h;
|
||||
*h = initial_w;
|
||||
return;
|
||||
}
|
||||
}
|
||||
*w = initial_w;
|
||||
*h = initial_h;
|
||||
}
|
||||
|
||||
class ResizingVideoSource : public ::libvpx_test::DummyVideoSource {
|
||||
public:
|
||||
ResizingVideoSource() {
|
||||
SetSize(kInitialWidth, kInitialHeight);
|
||||
ResizingVideoSource(int width, int height)
|
||||
: smaller_width_larger_size_(false), random_input_one_half_only_(false),
|
||||
configured_width_(width), configured_height_(height) {
|
||||
limit_ = 350;
|
||||
smaller_width_larger_size_ = false;
|
||||
SetSize(configured_width_, configured_height_);
|
||||
}
|
||||
bool flag_codec_;
|
||||
bool smaller_width_larger_size_;
|
||||
virtual ~ResizingVideoSource() {}
|
||||
bool random_input_one_half_only_;
|
||||
// configured_width_/height_ is the configured resolution when codec is
|
||||
// created.
|
||||
int configured_width_;
|
||||
int configured_height_;
|
||||
~ResizingVideoSource() override = default;
|
||||
|
||||
protected:
|
||||
virtual void Next() {
|
||||
void Next() override {
|
||||
++frame_;
|
||||
unsigned int width = 0;
|
||||
unsigned int height = 0;
|
||||
ScaleForFrameNumber(frame_, kInitialWidth, kInitialHeight, &width, &height,
|
||||
flag_codec_, smaller_width_larger_size_);
|
||||
ScaleForFrameNumber(frame_, configured_width_, configured_height_, &width,
|
||||
&height, flag_codec_, smaller_width_larger_size_,
|
||||
random_input_one_half_only_);
|
||||
SetSize(width, height);
|
||||
FillFrame();
|
||||
}
|
||||
|
||||
void FillFrame() override {
|
||||
if (img_) {
|
||||
memset(img_->img_data, 0, raw_sz_);
|
||||
if (random_input_one_half_only_) {
|
||||
libvpx_test::ACMRandom rnd(libvpx_test::ACMRandom::DeterministicSeed());
|
||||
unsigned char *image = img_->planes[0];
|
||||
for (size_t i = 0; i < raw_sz_; ++i) {
|
||||
image[i] = rnd.Rand8();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class ResizeTest
|
||||
@@ -286,14 +292,14 @@ class ResizeTest
|
||||
protected:
|
||||
ResizeTest() : EncoderTest(GET_PARAM(0)) {}
|
||||
|
||||
virtual ~ResizeTest() {}
|
||||
~ResizeTest() override = default;
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
InitializeConfig();
|
||||
SetMode(GET_PARAM(1));
|
||||
}
|
||||
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
|
||||
ASSERT_NE(static_cast<int>(pkt->data.frame.width[0]), 0);
|
||||
ASSERT_NE(static_cast<int>(pkt->data.frame.height[0]), 0);
|
||||
encode_frame_width_.push_back(pkt->data.frame.width[0]);
|
||||
@@ -308,8 +314,8 @@ class ResizeTest
|
||||
return encode_frame_height_[idx];
|
||||
}
|
||||
|
||||
virtual void DecompressedFrameHook(const vpx_image_t &img,
|
||||
vpx_codec_pts_t pts) {
|
||||
void DecompressedFrameHook(const vpx_image_t &img,
|
||||
vpx_codec_pts_t pts) override {
|
||||
frame_info_list_.push_back(FrameInfo(pts, img.d_w, img.d_h));
|
||||
}
|
||||
|
||||
@@ -319,26 +325,26 @@ class ResizeTest
|
||||
};
|
||||
|
||||
TEST_P(ResizeTest, TestExternalResizeWorks) {
|
||||
ResizingVideoSource video;
|
||||
ResizingVideoSource video(kInitialWidth, kInitialHeight);
|
||||
video.flag_codec_ = false;
|
||||
video.smaller_width_larger_size_ = false;
|
||||
cfg_.g_lag_in_frames = 0;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
|
||||
for (std::vector<FrameInfo>::const_iterator info = frame_info_list_.begin();
|
||||
info != frame_info_list_.end(); ++info) {
|
||||
const unsigned int frame = static_cast<unsigned>(info->pts);
|
||||
for (const auto &info : frame_info_list_) {
|
||||
const unsigned int frame = static_cast<unsigned>(info.pts);
|
||||
unsigned int expected_w;
|
||||
unsigned int expected_h;
|
||||
const size_t idx = info - frame_info_list_.begin();
|
||||
ASSERT_EQ(info->w, GetFrameWidth(idx));
|
||||
ASSERT_EQ(info->h, GetFrameHeight(idx));
|
||||
const size_t idx = &info - &frame_info_list_[0];
|
||||
ASSERT_EQ(info.w, GetFrameWidth(idx));
|
||||
ASSERT_EQ(info.h, GetFrameHeight(idx));
|
||||
ScaleForFrameNumber(frame, kInitialWidth, kInitialHeight, &expected_w,
|
||||
&expected_h, video.flag_codec_,
|
||||
video.smaller_width_larger_size_);
|
||||
EXPECT_EQ(expected_w, info->w)
|
||||
video.smaller_width_larger_size_,
|
||||
/*random_input_one_half_only=*/false);
|
||||
EXPECT_EQ(expected_w, info.w)
|
||||
<< "Frame " << frame << " had unexpected width";
|
||||
EXPECT_EQ(expected_h, info->h)
|
||||
EXPECT_EQ(expected_h, info.h)
|
||||
<< "Frame " << frame << " had unexpected height";
|
||||
}
|
||||
}
|
||||
@@ -355,15 +361,15 @@ class ResizeInternalTest : public ResizeTest {
|
||||
ResizeInternalTest() : ResizeTest(), frame0_psnr_(0.0) {}
|
||||
#endif
|
||||
|
||||
virtual ~ResizeInternalTest() {}
|
||||
~ResizeInternalTest() override = default;
|
||||
|
||||
virtual void BeginPassHook(unsigned int /*pass*/) {
|
||||
void BeginPassHook(unsigned int /*pass*/) override {
|
||||
#if WRITE_COMPRESSED_STREAM
|
||||
outfile_ = fopen("vp90-2-05-resize.ivf", "wb");
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual void EndPassHook() {
|
||||
void EndPassHook() override {
|
||||
#if WRITE_COMPRESSED_STREAM
|
||||
if (outfile_) {
|
||||
if (!fseek(outfile_, 0, SEEK_SET))
|
||||
@@ -374,8 +380,8 @@ class ResizeInternalTest : public ResizeTest {
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
|
||||
libvpx_test::Encoder *encoder) {
|
||||
void PreEncodeFrameHook(libvpx_test::VideoSource *video,
|
||||
libvpx_test::Encoder *encoder) override {
|
||||
if (change_config_) {
|
||||
int new_q = 60;
|
||||
if (video->frame() == 0) {
|
||||
@@ -400,13 +406,13 @@ class ResizeInternalTest : public ResizeTest {
|
||||
}
|
||||
}
|
||||
|
||||
virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) override {
|
||||
if (frame0_psnr_ == 0.) frame0_psnr_ = pkt->data.psnr.psnr[0];
|
||||
EXPECT_NEAR(pkt->data.psnr.psnr[0], frame0_psnr_, 2.0);
|
||||
}
|
||||
|
||||
#if WRITE_COMPRESSED_STREAM
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
|
||||
++out_frames_;
|
||||
|
||||
// Write initial file header if first frame.
|
||||
@@ -442,15 +448,14 @@ TEST_P(ResizeInternalTest, TestInternalResizeWorks) {
|
||||
cfg_.g_lag_in_frames = 0;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
|
||||
for (std::vector<FrameInfo>::const_iterator info = frame_info_list_.begin();
|
||||
info != frame_info_list_.end(); ++info) {
|
||||
const vpx_codec_pts_t pts = info->pts;
|
||||
for (const auto &info : frame_info_list_) {
|
||||
const vpx_codec_pts_t pts = info.pts;
|
||||
if (pts >= kStepDownFrame && pts < kStepUpFrame) {
|
||||
ASSERT_EQ(282U, info->w) << "Frame " << pts << " had unexpected width";
|
||||
ASSERT_EQ(173U, info->h) << "Frame " << pts << " had unexpected height";
|
||||
ASSERT_EQ(282U, info.w) << "Frame " << pts << " had unexpected width";
|
||||
ASSERT_EQ(173U, info.h) << "Frame " << pts << " had unexpected height";
|
||||
} else {
|
||||
EXPECT_EQ(352U, info->w) << "Frame " << pts << " had unexpected width";
|
||||
EXPECT_EQ(288U, info->h) << "Frame " << pts << " had unexpected height";
|
||||
EXPECT_EQ(352U, info.w) << "Frame " << pts << " had unexpected width";
|
||||
EXPECT_EQ(288U, info.h) << "Frame " << pts << " had unexpected height";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -469,13 +474,17 @@ class ResizeRealtimeTest
|
||||
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
|
||||
protected:
|
||||
ResizeRealtimeTest() : EncoderTest(GET_PARAM(0)) {}
|
||||
virtual ~ResizeRealtimeTest() {}
|
||||
~ResizeRealtimeTest() override = default;
|
||||
|
||||
virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
|
||||
libvpx_test::Encoder *encoder) {
|
||||
void PreEncodeFrameHook(libvpx_test::VideoSource *video,
|
||||
libvpx_test::Encoder *encoder) override {
|
||||
if (video->frame() == 0) {
|
||||
encoder->Control(VP9E_SET_AQ_MODE, 3);
|
||||
encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);
|
||||
if (cfg_.g_threads > 0) {
|
||||
encoder->Control(VP9E_SET_ROW_MT, 1);
|
||||
encoder->Control(VP9E_SET_TILE_COLUMNS, cfg_.g_threads >> 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (change_bitrate_ && video->frame() == 120) {
|
||||
@@ -485,24 +494,24 @@ class ResizeRealtimeTest
|
||||
}
|
||||
}
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
InitializeConfig();
|
||||
SetMode(GET_PARAM(1));
|
||||
set_cpu_used_ = GET_PARAM(2);
|
||||
}
|
||||
|
||||
virtual void DecompressedFrameHook(const vpx_image_t &img,
|
||||
vpx_codec_pts_t pts) {
|
||||
void DecompressedFrameHook(const vpx_image_t &img,
|
||||
vpx_codec_pts_t pts) override {
|
||||
frame_info_list_.push_back(FrameInfo(pts, img.d_w, img.d_h));
|
||||
}
|
||||
|
||||
virtual void MismatchHook(const vpx_image_t *img1, const vpx_image_t *img2) {
|
||||
void MismatchHook(const vpx_image_t *img1, const vpx_image_t *img2) override {
|
||||
double mismatch_psnr = compute_psnr(img1, img2);
|
||||
mismatch_psnr_ += mismatch_psnr;
|
||||
++mismatch_nframes_;
|
||||
}
|
||||
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
|
||||
ASSERT_NE(static_cast<int>(pkt->data.frame.width[0]), 0);
|
||||
ASSERT_NE(static_cast<int>(pkt->data.frame.height[0]), 0);
|
||||
encode_frame_width_.push_back(pkt->data.frame.width[0]);
|
||||
@@ -551,7 +560,7 @@ class ResizeRealtimeTest
|
||||
};
|
||||
|
||||
TEST_P(ResizeRealtimeTest, TestExternalResizeWorks) {
|
||||
ResizingVideoSource video;
|
||||
ResizingVideoSource video(kInitialWidth, kInitialHeight);
|
||||
video.flag_codec_ = true;
|
||||
video.smaller_width_larger_size_ = false;
|
||||
DefaultConfig();
|
||||
@@ -562,24 +571,57 @@ TEST_P(ResizeRealtimeTest, TestExternalResizeWorks) {
|
||||
mismatch_nframes_ = 0;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
|
||||
for (std::vector<FrameInfo>::const_iterator info = frame_info_list_.begin();
|
||||
info != frame_info_list_.end(); ++info) {
|
||||
const unsigned int frame = static_cast<unsigned>(info->pts);
|
||||
for (const auto &info : frame_info_list_) {
|
||||
const unsigned int frame = static_cast<unsigned>(info.pts);
|
||||
unsigned int expected_w;
|
||||
unsigned int expected_h;
|
||||
ScaleForFrameNumber(frame, kInitialWidth, kInitialHeight, &expected_w,
|
||||
&expected_h, video.flag_codec_,
|
||||
video.smaller_width_larger_size_);
|
||||
EXPECT_EQ(expected_w, info->w)
|
||||
video.smaller_width_larger_size_,
|
||||
/*random_input_one_half_only=*/false);
|
||||
EXPECT_EQ(expected_w, info.w)
|
||||
<< "Frame " << frame << " had unexpected width";
|
||||
EXPECT_EQ(expected_h, info->h)
|
||||
EXPECT_EQ(expected_h, info.h)
|
||||
<< "Frame " << frame << " had unexpected height";
|
||||
EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());
|
||||
EXPECT_EQ(GetMismatchFrames(), static_cast<unsigned int>(0));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(ResizeRealtimeTest, DISABLED_TestExternalResizeSmallerWidthBiggerSize) {
|
||||
ResizingVideoSource video;
|
||||
// This test uses 4 threads with small keyframe spacing, random input,
|
||||
// and uses 640x480 as initial resolution.
|
||||
TEST_P(ResizeRealtimeTest, TestExternalResizeWorks4Threads) {
|
||||
ResizingVideoSource video(640, 480);
|
||||
video.flag_codec_ = true;
|
||||
video.smaller_width_larger_size_ = false;
|
||||
video.random_input_one_half_only_ = true;
|
||||
DefaultConfig();
|
||||
// Disable internal resize for this test.
|
||||
cfg_.rc_resize_allowed = 0;
|
||||
cfg_.g_threads = 4;
|
||||
cfg_.kf_max_dist = 50;
|
||||
cfg_.kf_min_dist = 50;
|
||||
change_bitrate_ = false;
|
||||
mismatch_psnr_ = 0.0;
|
||||
mismatch_nframes_ = 0;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
|
||||
for (const auto &info : frame_info_list_) {
|
||||
const unsigned int frame = static_cast<unsigned>(info.pts);
|
||||
unsigned int expected_w;
|
||||
unsigned int expected_h;
|
||||
ScaleForFrameNumber(frame, 640, 480, &expected_w, &expected_h,
|
||||
video.flag_codec_, video.smaller_width_larger_size_,
|
||||
video.random_input_one_half_only_);
|
||||
EXPECT_EQ(expected_w, info.w)
|
||||
<< "Frame " << frame << " had unexpected width";
|
||||
EXPECT_EQ(expected_h, info.h)
|
||||
<< "Frame " << frame << " had unexpected height";
|
||||
EXPECT_EQ(GetMismatchFrames(), static_cast<unsigned int>(0));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(ResizeRealtimeTest, TestExternalResizeSmallerWidthBiggerSize) {
|
||||
ResizingVideoSource video(kInitialWidth, kInitialHeight);
|
||||
video.flag_codec_ = true;
|
||||
video.smaller_width_larger_size_ = true;
|
||||
DefaultConfig();
|
||||
@@ -590,19 +632,19 @@ TEST_P(ResizeRealtimeTest, DISABLED_TestExternalResizeSmallerWidthBiggerSize) {
|
||||
mismatch_nframes_ = 0;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
|
||||
for (std::vector<FrameInfo>::const_iterator info = frame_info_list_.begin();
|
||||
info != frame_info_list_.end(); ++info) {
|
||||
const unsigned int frame = static_cast<unsigned>(info->pts);
|
||||
for (const auto &info : frame_info_list_) {
|
||||
const unsigned int frame = static_cast<unsigned>(info.pts);
|
||||
unsigned int expected_w;
|
||||
unsigned int expected_h;
|
||||
ScaleForFrameNumber(frame, kInitialWidth, kInitialHeight, &expected_w,
|
||||
&expected_h, video.flag_codec_,
|
||||
video.smaller_width_larger_size_);
|
||||
EXPECT_EQ(expected_w, info->w)
|
||||
video.smaller_width_larger_size_,
|
||||
/*random_input_one_half_only=*/false);
|
||||
EXPECT_EQ(expected_w, info.w)
|
||||
<< "Frame " << frame << " had unexpected width";
|
||||
EXPECT_EQ(expected_h, info->h)
|
||||
EXPECT_EQ(expected_h, info.h)
|
||||
<< "Frame " << frame << " had unexpected height";
|
||||
EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());
|
||||
EXPECT_EQ(GetMismatchFrames(), static_cast<unsigned int>(0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -620,27 +662,27 @@ TEST_P(ResizeRealtimeTest, TestInternalResizeDown) {
|
||||
mismatch_nframes_ = 0;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
|
||||
#if CONFIG_VP9_DECODER
|
||||
unsigned int last_w = cfg_.g_w;
|
||||
unsigned int last_h = cfg_.g_h;
|
||||
int resize_count = 0;
|
||||
for (std::vector<FrameInfo>::const_iterator info = frame_info_list_.begin();
|
||||
info != frame_info_list_.end(); ++info) {
|
||||
if (info->w != last_w || info->h != last_h) {
|
||||
for (const auto &info : frame_info_list_) {
|
||||
if (info.w != last_w || info.h != last_h) {
|
||||
// Verify that resize down occurs.
|
||||
ASSERT_LT(info->w, last_w);
|
||||
ASSERT_LT(info->h, last_h);
|
||||
last_w = info->w;
|
||||
last_h = info->h;
|
||||
ASSERT_LT(info.w, last_w);
|
||||
ASSERT_LT(info.h, last_h);
|
||||
last_w = info.w;
|
||||
last_h = info.h;
|
||||
resize_count++;
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_VP9_DECODER
|
||||
// Verify that we get 1 resize down event in this test.
|
||||
ASSERT_EQ(1, resize_count) << "Resizing should occur.";
|
||||
EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());
|
||||
EXPECT_EQ(GetMismatchFrames(), static_cast<unsigned int>(0));
|
||||
#else
|
||||
printf("Warning: VP9 decoder unavailable, unable to check resize count!\n");
|
||||
GTEST_SKIP()
|
||||
<< "Warning: VP9 decoder unavailable, unable to check resize count!\n";
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -665,33 +707,33 @@ TEST_P(ResizeRealtimeTest, TestInternalResizeDownUpChangeBitRate) {
|
||||
unsigned int last_w = cfg_.g_w;
|
||||
unsigned int last_h = cfg_.g_h;
|
||||
int resize_count = 0;
|
||||
for (std::vector<FrameInfo>::const_iterator info = frame_info_list_.begin();
|
||||
info != frame_info_list_.end(); ++info) {
|
||||
const size_t idx = info - frame_info_list_.begin();
|
||||
ASSERT_EQ(info->w, GetFrameWidth(idx));
|
||||
ASSERT_EQ(info->h, GetFrameHeight(idx));
|
||||
if (info->w != last_w || info->h != last_h) {
|
||||
for (const auto &info : frame_info_list_) {
|
||||
const size_t idx = &info - &frame_info_list_[0];
|
||||
ASSERT_EQ(info.w, GetFrameWidth(idx));
|
||||
ASSERT_EQ(info.h, GetFrameHeight(idx));
|
||||
if (info.w != last_w || info.h != last_h) {
|
||||
resize_count++;
|
||||
if (resize_count <= 2) {
|
||||
// Verify that resize down occurs.
|
||||
ASSERT_LT(info->w, last_w);
|
||||
ASSERT_LT(info->h, last_h);
|
||||
ASSERT_LT(info.w, last_w);
|
||||
ASSERT_LT(info.h, last_h);
|
||||
} else if (resize_count > 2) {
|
||||
// Verify that resize up occurs.
|
||||
ASSERT_GT(info->w, last_w);
|
||||
ASSERT_GT(info->h, last_h);
|
||||
ASSERT_GT(info.w, last_w);
|
||||
ASSERT_GT(info.h, last_h);
|
||||
}
|
||||
last_w = info->w;
|
||||
last_h = info->h;
|
||||
last_w = info.w;
|
||||
last_h = info.h;
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_VP9_DECODER
|
||||
// Verify that we get 4 resize events in this test.
|
||||
ASSERT_EQ(resize_count, 4) << "Resizing should occur twice.";
|
||||
EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());
|
||||
EXPECT_EQ(GetMismatchFrames(), static_cast<unsigned int>(0));
|
||||
#else
|
||||
printf("Warning: VP9 decoder unavailable, unable to check resize count!\n");
|
||||
GTEST_SKIP()
|
||||
<< "Warning: VP9 decoder unavailable, unable to check resize count!\n";
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -710,15 +752,15 @@ class ResizeCspTest : public ResizeTest {
|
||||
ResizeCspTest() : ResizeTest(), frame0_psnr_(0.0) {}
|
||||
#endif
|
||||
|
||||
virtual ~ResizeCspTest() {}
|
||||
~ResizeCspTest() override = default;
|
||||
|
||||
virtual void BeginPassHook(unsigned int /*pass*/) {
|
||||
void BeginPassHook(unsigned int /*pass*/) override {
|
||||
#if WRITE_COMPRESSED_STREAM
|
||||
outfile_ = fopen("vp91-2-05-cspchape.ivf", "wb");
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual void EndPassHook() {
|
||||
void EndPassHook() override {
|
||||
#if WRITE_COMPRESSED_STREAM
|
||||
if (outfile_) {
|
||||
if (!fseek(outfile_, 0, SEEK_SET))
|
||||
@@ -729,8 +771,11 @@ class ResizeCspTest : public ResizeTest {
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
|
||||
libvpx_test::Encoder *encoder) {
|
||||
void PreEncodeFrameHook(libvpx_test::VideoSource *video,
|
||||
libvpx_test::Encoder *encoder) override {
|
||||
if (video->frame() == 0) {
|
||||
encoder->Control(VP8E_SET_CPUUSED, 5);
|
||||
}
|
||||
if (CspForFrameNumber(video->frame()) != VPX_IMG_FMT_I420 &&
|
||||
cfg_.g_profile != 1) {
|
||||
cfg_.g_profile = 1;
|
||||
@@ -743,13 +788,13 @@ class ResizeCspTest : public ResizeTest {
|
||||
}
|
||||
}
|
||||
|
||||
virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) override {
|
||||
if (frame0_psnr_ == 0.) frame0_psnr_ = pkt->data.psnr.psnr[0];
|
||||
EXPECT_NEAR(pkt->data.psnr.psnr[0], frame0_psnr_, 2.0);
|
||||
EXPECT_NEAR(pkt->data.psnr.psnr[0], frame0_psnr_, 3.5);
|
||||
}
|
||||
|
||||
#if WRITE_COMPRESSED_STREAM
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
|
||||
++out_frames_;
|
||||
|
||||
// Write initial file header if first frame.
|
||||
@@ -775,10 +820,10 @@ class ResizingCspVideoSource : public ::libvpx_test::DummyVideoSource {
|
||||
limit_ = 30;
|
||||
}
|
||||
|
||||
virtual ~ResizingCspVideoSource() {}
|
||||
~ResizingCspVideoSource() override = default;
|
||||
|
||||
protected:
|
||||
virtual void Next() {
|
||||
void Next() override {
|
||||
++frame_;
|
||||
SetImageFormat(CspForFrameNumber(frame_));
|
||||
FillFrame();
|
||||
@@ -794,8 +839,7 @@ TEST_P(ResizeCspTest, TestResizeCspWorks) {
|
||||
}
|
||||
|
||||
VP8_INSTANTIATE_TEST_SUITE(ResizeTest, ONE_PASS_TEST_MODES);
|
||||
VP9_INSTANTIATE_TEST_SUITE(ResizeTest,
|
||||
::testing::Values(::libvpx_test::kRealTime));
|
||||
VP9_INSTANTIATE_TEST_SUITE(ResizeTest, ONE_PASS_TEST_MODES);
|
||||
VP9_INSTANTIATE_TEST_SUITE(ResizeInternalTest,
|
||||
::testing::Values(::libvpx_test::kOnePassBest));
|
||||
VP9_INSTANTIATE_TEST_SUITE(ResizeRealtimeTest,
|
||||
|
||||
Loaded 100 of 615 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user