380 Commits

Author SHA1 Message Date
Matt Oliver ef79796c8d project: Update for 1.15.1 merge. 2025-06-14 21:52:12 +10:00
Matt Oliver 8186b704b7 Merge commit '39e8b9dcd4696d9ac3ebd4722e012488382f1adb' 2025-06-14 21:02:34 +10:00
Matt Oliver bcecc98a79 project: Update for 1.15.0 merge. 2025-06-14 19:48:26 +10:00
Matt Oliver 70414c8112 Merge commit '9f9b7e9ba2eb9d01640a9e69a3d655866265cf7f' 2025-06-14 19:22:24 +10:00
Jerome Jiang 39e8b9dcd4 Bump VPX_EXT_RATECTRL_ABI_VERSION
Fix the order of the newly added codec control

Bug: webm:384672478
Change-Id: I045c58865399ea9d74c91c1a5521215a0d2032f7
2025-01-10 14:30:59 -05:00
Jerome Jiang 2f1ad02bd5 Add changelog for v1.15.1 release
Bug: webm:384672478
Change-Id: I3346b06eb05e306eb23f7281b65ff7e9c84e7e6b
2025-01-09 14:52:08 -05:00
Jerome Jiang 69da847f66 Bump up version major
Before v1.15.0: c=10, a=1, r=0

Rule #3: source code has changed, increment r:
r=1

Rule #4: interfaces were removed in vpx_tpl.h, set r=0, increment c:
c=11, r=0

Rule #5: no interfaces have been added

Rule #6: interfaces were removed in vpx_tpl.h, set a=0:
a=0

After release: c=11, a=0, r=0

major = c-a = 11
minor = a = 0
patch = r = 0

Bug: webm:384672478
Change-Id: I2e70e7e35c64ece32eaf1dc5625640965483f9b9
2025-01-07 14:17:40 -05:00
James Zern 82a0c8a2db configure: add support for darwin24 (macOS 15.x)
Bug: webm:379534940
Change-Id: I8777b6bb8653a31080801e35916df9aa39a4c999
(cherry picked from commit 6e23d972a7a717f2ba3970c82b6b96d350b5bcde)
2024-11-19 22:03:26 +00:00
Matt Oliver bbedc9be7c project: Update template file for WinRT. 2024-11-09 19:38:13 +11:00
Jerome Jiang 9f9b7e9ba2 Changelog: add neon optimization speed up stats
Bug: webm:372498543
Change-Id: I297be5efb602b0181c2b25ff8b50060c10263130
2024-10-23 14:24:57 -04:00
Jerome Jiang 0ba09cc79f Update CHANGELOG and version
Bug: webm:372498543
Change-Id: Ieddfa0b18f8c5e53ab65e04b52b5a601c672ba62
2024-10-22 15:36:11 -04:00
James Zern 3939c5ebb0 vpx_highbd_convolve8_avg_sve2: fix C fallback typo
vpx_highbd_convolve8_c -> vpx_highbd_convolve8_avg_c

Change-Id: I8bc73c59d3e654739ee5c42a295f4ecdee6d7631
(cherry picked from commit 3500e57e52b6af057ed54223e15e560a95df8479)
2024-10-10 13:32:53 -04:00
Jerome Jiang 816a90fe76 Update AUTHORS and .mailmap
Bug: webm:372498543
Change-Id: I5041fd1558c0a36dce10395ec6e836f3d55384dc
2024-10-09 15:18:53 -04:00
Marco Paniconi 192b4a4ce7 rtc-vp9: Always disable svc_use_low_part
Possible fix for issue below. It was only disabled
for screen in a previous change, but we force it off
always to check if it clears the issue.

The speed feature disabled is only used for 3 spatial
layers and at least 2 temporal. The impact on speed is
expected to be small, ~2%, so ok to disable for now and
see if it clears the issue.

Bug: 366146260
Change-Id: If7af006425e1e0ef297b9d6466507ea4c90ddb6f
(cherry picked from commit 09b3d5fc5aa48752f95f4c0c37b0bd4ff55c0ba1)
2024-10-09 15:07:31 -04:00
Marco Paniconi cdd4e35015 vp8: Fix integer overflow in encode_frame_to_data_rate
Integer overflow in encode_frame_to_data_rate()
for the update:
lc->total_target_vs_actual += bits_off_for_this_layer

Fix is to use int64_t for total_target_vs_actual.

Bug: chromium:368114043
Change-Id: I9a01e1a69e26ae748e8ae23d9e1287431510388d
2024-09-20 09:50:41 -07:00
Wan-Teh Chang aa73610d03 Fix a typo: avg_frame_index => avg_frame_qindex
Change-Id: I8fd9f6f01ae712a9bf3dc9e34fe5f7115a305109
2024-09-19 00:09:36 -07:00
Marco Paniconi 417204d7fd rtc-vp9: Fix to integer overflow in vp9-svc
Divide by 3 instead of multiple by 3, in comparison of
lrc->avg_frame_bandwidth vd lrc->last_avg_frame_bandwidth,
in two functions for reset rc.
Small loss in precision, so acceptable.

Similar change to:
https://chromium-review.googlesource.com/c/webm/libvpx/+/5698570

Bug: chromium:367892770
Change-Id: Ia9ef09a9f6beba930fedd496407cfa7057e39336
2024-09-18 14:33:49 -07:00
James Zern ac68e7f999 aarch64_cpudetect: detect SVE/SVE2 on Windows
PF_ARM_SVE_INSTRUCTIONS_AVAILABLE and PF_ARM_SVE2_INSTRUCTIONS_AVAILABLE
are available in WinSDK 10.0.26100 and recent versions of mingw-w64.

Based on a patch by Martin Storsjö on ffmpeg-devel:
https://ffmpeg.org/pipermail/ffmpeg-devel/2024-September/333611.html

Change-Id: I34b2341a559f95aa400e84d709f3eb36da5dbb7b
2024-09-18 19:43:10 +00:00
James Zern 729b78a127 aarch64_cpudetect: detect I8MM on Windows via SVE-I8MM
There's no direct processor feature constant for I8MM alone, but
there is a flag for SVE-I8MM (added in WinSDK 10.0.26100 and
recent versions of mingw-w64). If SVE-I8MM is available, we can
assume that I8MM is available.

While HW supporting these features isn't yet commonly running
Windows, this at least allows detecting and running the I8MM codepaths
in Windows builds in Wine (possibly running in QEMU).

Based on patch from Martin Storsjö on ffmpeg-devel:
https://ffmpeg.org/pipermail/ffmpeg-devel/2024-September/333609.html

Change-Id: I77117bee8516924fddcdecccae8bab3cf5beed96
2024-09-18 19:43:10 +00:00
James Zern 6dfdc4ee10 tiny_ssim: fix argc check
The program requires a minimum of 2 parameters. Previously the tool
would crash if only one input file was given.

Bug: webm:365481206
Change-Id: I875d81b2db4fcc4338061c03b23bb51b0aad58e4
2024-09-18 19:06:17 +00:00
Marco Paniconi 696c488d35 rtc-vp9: Disable svc_use_low_part for screen
Possible fix for issue below. The speed feature disabled
is only used for 3 spatial layers and at least 2 temporal.
The impact on speed is expected to be small, ~2%, so ok
to disable for now and see if it clears the issue.

Bug: 366146260

Change-Id: I94ab991d583cc2ce758db337abbbb463a65f0767
2024-09-17 23:07:24 +00:00
Jerome Jiang c6de95ce0e Initialize gf_picture in vp9 tpl
Bug: b/365068397
Change-Id: Id267532928353148f916b73feb19de515db14cb9
2024-09-06 13:02:12 -04:00
James Zern 3ba1fada8b vpx_image.h: add lifetime note for img_data
The wrapped storage must exist for the duration of the vpx_image_t
allocation.

Bug: aomedia:363806063
Change-Id: Ic6b79a56b6c07776222d1767490d873d7408ced0
2024-09-03 19:19:09 -07:00
Marco Paniconi fbf63dff1f vp9: clamp the calculation of sb64_target_rate to INT_MAX
Bug: b/361617762
Change-Id: Ie7d2b0973e6de23d6e992ee058cbb94b826fda65
2024-08-28 14:48:57 +00:00
James Zern 507aea8e29 vp9_speed_features.h: fix partition_search_type comment
FIXED_SIZE_PARTITION -> FIXED_PARTITION

Change-Id: I5e6a561042d7dfa87d6f11b033052d340e433440
2024-08-27 17:38:43 -07:00
James Zern 50aa6cca4d README: add security report note
The default template for https://issues.webmproject.org/ is a public bug
report. Security issues can be reported securely using the 'Security
report' template.

Change-Id: Ic7144a6c7a144772b78852d1415a51a570c79d50
2024-08-26 15:30:01 -07:00
Wan-Teh Chang f00fa3ce74 Add macro name as comment for header guard #endif
Change-Id: I948f21f414fc269ad03673636506fa83acf5f5f6
2024-08-23 00:35:45 +00:00
Wan-Teh Chang 35b908f808 Add #ifndef header guard to vpx_version.h
Change-Id: Ief028037a3a56b1f18998298ad594a86cf906bd3
2024-08-22 14:40:16 -07:00
James Zern 2c778f4da6 remove vp9_{highbd_,}resize_frame*()
and examples/resize_util.c. These functions were added in:
  3cd37dfeb Adds a non-normative resize library to vp9 encoder
but never used meaningfully in the library.

This mirrors the change in libaom:
  d10029bb4b Restore function prototype of av1_resize_frame420
except that vp9_resize_frame420() was never exported in the shared
library, so can be deleted along with the rest.

The reasoning for removing examples/resize_util.c is the same: it is not
useful and examples should use the public functions of the libvpx
library.

Change-Id: I386080d3f1a3ef81dfc87fcdf5bbdf459d996f03
2024-08-21 19:22:48 -07:00
James Zern 312a9004c1 remove vpx_ssim_parms_16x16()
The last reference to this function was removed in:
5511968f2 Removed several unused functions.

Change-Id: I644482b4f0c9c4765035adcdc21ec495e3e3a6e6
2024-08-20 17:47:07 -07:00
Yunqing Wang a5ea71f091 Key frame temporal filtering
Added key frame temporal filtering. Enabled it for VOD encoding
with encoder speed < 2.
Minor improvement in prediction.
Added the restriction of using no more than "arnr_max_frames"
frames for temporal filtering.
Key frame temporal filtering is turned off by default for now. To
enable it, set "--enable-keyframe-filtering=1"

Borg result with "--enable-keyframe-filtering=1"
         avg_psnr:  ovr_psnr:   ssim:    vmaf:
hdres2:   -0.762     -0.863    -0.903   -0.680
midres2:  -0.813     -0.753    -0.757   -0.743
lowres2:  -0.492     -0.598    -0.737   -0.881
The impact on the encoder time is minimal.

Change-Id: If6abea3e21efcb96f1978cd9dfaa742c40dc2a56
2024-08-19 17:59:58 +00:00
Jerome Jiang 5d20cc3081 IWYU: include vp9_ext_ratectrl.h for tpl
Change-Id: Ia00dc7f79a69eb73c85fb409418861bef459e863
2024-08-19 11:05:38 -04:00
Jerome Jiang ee2552d903 vp9 ext rc: TPL & final encoding use same QP
Removed codec control VP9E_ENABLE_EXTERNAL_RC_TPL since it is
no longer needed.

Change-Id: I151254ff3f0496c017ddf73c2caf94783ef38f31
2024-08-16 17:16:29 -04:00
Jerome Jiang a69eeb0af2 ext rc: Override encode QP in TPL pass for VBR
Change-Id: I8f32b5847b57313d00401f5596ed62ac7c4817f0
2024-08-16 16:50:21 -04:00
Jerome Jiang d9d6c5e2c9 Remove ext_rc_recode
This flag is always set to 0

Change-Id: I228b3befae478517e7b31228d4a6553af4fd7a27
2024-08-16 13:54:02 -04:00
James Zern 95568674c2 remove redundant && __GNUC__ preproc check
`#if defined(__GNUC__)` is enough if a specific version isn't being
looked for.

Bug: aomedia:356832974
Change-Id: I3fcbecf9d547c6a2d89d7b5456e83ee08ddc6f5e
2024-08-16 16:43:45 +00:00
Yunqing Wang fcd1f39e56 Improve temporal filter prediction and process
Applied 12-tap filter to temporal filter prediction for better
result. Improved the calculation of frames to be used in temporal
filtering.

The overall PSNR gain was -0.511% (lowres), -0.338% (midres), and
-0.288% (hdres).
Encoder time was increased by ~2%, which would be largely reduced
by the following SIMD optimization.

Change-Id: If3ece30f1614beadc99ebf6b4dc3f2d988d3bdb9
2024-08-09 23:05:32 +00:00
Jerome Jiang 13be4a7190 Remove a stale TODO in ext RC
Change-Id: Ie871a476a7a0b04cf88db17da8402dad1c3247f7
2024-08-09 18:02:00 +00:00
Wan-Teh Chang b222d72285 Add the saturate_cast_double_to_int() function
Move the saturate_cast_double_to_int() function in
vp8/encoder/firstpass.c to vpx_dsp/vpx_dsp_common.h so that it can be
used in other files.

Change-Id: I748fea969520542dca68d7a46500d3272f22e16f
2024-08-08 11:42:03 -07:00
Jerome Jiang c18b9f7c68 Add min/max q index to ext rc config
Change-Id: I5d152f3b0868e78c6b33fe651c6a40597b42feef
2024-08-08 10:24:29 -04:00
James Zern 634e1f8fb1 vp9_calc_iframe_target_size_one_pass_cbr: clamp final target
to INT_MAX. This matches calc_iframe_target_size() in VP8
(http://crbug.com/1473473). If rc->avg_frame_bandwidth is large even
small kf_boost values will overflow an int.

Change-Id: Iaca5b47fe97793ae70930b3b2c2f42725d2c96fb
2024-08-08 02:37:47 +00:00
James Zern bb95d3652b update libwebm to libwebm-1.0.0.31-10-g3b63004
This fixes a build error seen in gcc 15:
3b63004 mkvparser/mkvparser.cc: add missing <cstdint> include

Bug: aomedia:357622679
Change-Id: I6c4a1795d189f9993d4f2c5c9f0375912bc58f0c
2024-08-06 11:31:25 -07:00
Wan-Teh Chang 428f3104fa Include "gtest/gtest.h" using the shorter path
Rely on the -I or -system compiler option to find "gtest/gtest.h". This
makes it easier to build our tests against a copy of gtest outside the
libvpx source tree.

Bug: webm:42330726
Change-Id: I3b189c6345e13b36b236d1eedc6ee091bfa71f48
2024-08-02 22:42:20 +00:00
Jerome Jiang 1865f20e9a Extend border for vp8 loopfilter
Bug: webm:356482713
Change-Id: I149d077a57d55c46fe1924cff4c5cfcf5c7609b0
2024-08-02 14:59:58 -04:00
Wan-Teh Chang 9f06827eeb Run clang-format on three files
Change-Id: I055186d915d4660e848f6d856d7895953aaf76ba
2024-08-02 07:03:40 -07:00
James Zern 0c4af6b4c1 vpx_fdct16x16_avx2: add missing cast
Fixes:
vpx_dsp/x86/fwd_txfm_avx2.c:378:50: error: incompatible pointer types
  passing 'int16_t *' (aka 'short *') to parameter of type
  'tran_low_t *' (aka 'int *') [-Werror,-Wincompatible-pointer-types]

Change-Id: I9f50547c1fc885c24b4b91e4c7d6857d397cceed
2024-08-02 00:14:58 +00:00
James Zern b5451de5c5 vp9_extrc_update_encodeframe_result: normalize decl & def
Fixes compiler warning in visual studio after:
2ab292e9e Remove unused parameters from ext rc callback

vp9\encoder\vp9_ext_ratectrl.c(186): warning C4028: formal parameter 3
different from declaration

Change-Id: I4cfddb3f55fb7191ebaf578851ab3bc2c55106e3
2024-08-02 00:14:58 +00:00
James Zern 4295bf4f0f Update third_party/libwebm to commit f4b07ec
Change-Id: I18ff0e388d3c8b683385d98d76bff3e238488a94
2024-08-01 13:38:00 -07:00
Jerome Jiang 2ab292e9e1 Remove unused parameters from ext rc callback
Bug: b/356424505
Change-Id: I1c684e7f4cc9bb7b916354d391abd1ae168af39f
2024-07-31 22:03:08 +00:00
James Zern 3cc287bbd7 vpx_scale,scale1d_c: add assert(dest_scale != 0)
This fixes a 'division by zero' static analysis report (seen with
clang-14).

Bug: b:328632178
Change-Id: I4c051631ff1a948e8f83a831286e01fc50ff1c1d
2024-07-31 18:25:19 +00:00
James Zern 8db1b663e2 vp9_subexp,remap_prob: add an assert
Fixes a 'Result of operation is garbage or undefined' static analysis
report (seen with clang-14) related to left shifting a negative value.

Bug: b:328632178
Change-Id: I18f0100eca0deac1cac9be0c7e848685d2911fb3
2024-07-30 14:54:01 -07:00
James Zern f987e3514c doxygen: quiet warnings in decoder-only config
Fixes:
warning: explicit link request to 'VP9E_SET_EXTERNAL_RATE_CONTROL' could
not be resolved

Change-Id: If7a0d97412cc8fad3457031fbf29cb447635f4a0
2024-07-30 17:55:49 +00:00
James Zern 85d386599d systemdependent.c: fix warning w/CONFIG_MULTITHREAD=0
fixes:
vp8/common/generic/systemdependent.c: In function
   'vp8_machine_specific_config':
vp8/common/generic/systemdependent.c:63:46: warning: unused parameter
   'ctx' [-Wunused-parameter]
    63 | void vp8_machine_specific_config(VP8_COMMON *ctx) {

Change-Id: I0eeaa0c27ccfa901cc62150eed590f5056eb9238
2024-07-29 13:23:58 -07:00
James Zern cdf8da4c03 vp8: fix OOB access in x->MVcount
Motion vectors are now clamped in
vp8_find_best_sub_pixel_step_iteratively, vp8_find_best_sub_pixel_step,
vp8_find_best_half_pixel_step, vp8_full_search_sad,
vp8_refining_search_sadx4 and vp8_refining_search_sad_c (the rtcd for
other optimizations are redirects to vp8_refining_search_sadx4).

The difference of valid motion vectors may still go beyond the range of
the MVcount array, however, so additional checks are added to
rd_update_mvcount() and update_mvcount().

Note the test source and settings (speed 1 and GOOD quality mode) come
from the issue report; additional coverage is added for realtime. The
realtime path does not trigger the error without the fix, but as it's
similar to the rd path, the same clamp is done to be safe.

Fixes:
vp8/encoder/rdopt.c:1579:5: runtime error: index 17467 out of bounds for
  type 'unsigned int[2047]'

Bug: oss-fuzz:69906
Change-Id: Ia8bd087cfe4475ab09ba711ed806fbcbaa72e552
2024-07-25 15:08:02 -07:00
James Zern f9120b789d vp8,calc_iframe_target_size: clamp kf_boost
cpi->output_framerate may be as large as 10M. Previously this would
cause kf_boost to be ~20M which would overflow an int when multiplied by
values in kf_boost_qadjustment[].

Fixes:
vp8/encoder/ratectrl.c:340:25: runtime error: signed integer overflow:
  19999984 * 220 cannot be represented in type 'int'

Bug: oss-fuzz:69100
Change-Id: I2d77c9d2912412f6265f6a8dc0e6b361b63b8242
2024-07-25 19:43:53 +00:00
Jingning Han d63ecb4117 Reset the ref_table array for the key frame GOP
Change-Id: Idda6ad9352d4c74dcbe8f2b6e1615d10e958e4c8
2024-07-24 16:02:39 -07:00
Jingning Han f809c987b5 Remove repeated ref_frame assignments
Change-Id: I0daa5a40489ce14582cb6a1c2816df354f1134f9
2024-07-24 16:01:24 -07:00
Bohan f96deb0bb4 Add tpl propagation with updated ref_frame idx
Change-Id: I6fcef44a90fc434e18447964aa1b4585c7f62310
2024-07-24 18:57:29 +00:00
Wan-Teh Chang 3fb0e5d75d Remove unneeded cpi->output_framerate assignment
The assignment "cpi->output_framerate = cpi->framerate;" after the
vp8_new_framerate() call is not needed, because vp8_new_framerate() sets
cpi->framerate and cpi->output_framerate to the same value.

Change-Id: I4de97b43957142d658e0c08ecfc6628844ce453a
2024-07-23 15:22:55 -07:00
Angie Chiang 057e53d759 Small refactoring in vp9_firstpass.c
Change-Id: If5e76b05f584650ff675363e6eb347bedae7728c
2024-07-19 21:38:08 +00:00
James Zern 9a1e8ae7aa README: add link to issue tracker
Change-Id: Ic8bc0167e5d1975e006135e20afacf27ee6badcf
2024-07-18 23:46:57 +00:00
James Zern efe615f804 add repro for crbug.com/352414650
+ fix an additional double -> int overflow warning (chrome's fuzzers do
  not have the float-cast-overflow sanitizer enabled)

Bug: chromium:352414650
Change-Id: I634bb421a74236eac434df138ed71dadf197596a
2024-07-18 13:36:10 -07:00
Marco Paniconi 3219f76cea Remove printf warning statements in set_size_literal()
Bug: b/347890801
Change-Id: I78c8dd0907d54f6cd1d3972ea6c3897f4b0c5adc
2024-07-15 11:33:26 -07:00
Wan-Teh Chang 72018e8c74 Some cleanup in vbr_rate_correction()
The only real change is in the initialization of frame_window. The (int)
cast is moved to the result of VPXMIN(), so that
cpi->twopass.total_stats.count - cpi->common.current_video_frame is
calculated in double.

Change-Id: Ia80f24614af7184b37cfdd99d8a8b1639460f273
2024-07-13 00:16:11 +00:00
James Zern 77974ec041 vp9_svc_adjust_avg_frame_qindex: fix int overflow
rc->avg_frame_bandwidth is capped at INT_MAX. Rather than multiply the
value by 3, divide projected_frame_size by 3 to avoid the overflow.
Without rounding this differs slightly from the original, but loss of
precision is acceptable in this case.

Bug: chromium:348440590
Change-Id: Id5960825c79d7c764d257e9b4bd0a1de751878d8
2024-07-11 17:34:57 -07:00
Wan-Teh Chang a40848c80f Do not include vpx_version.h
Replace the VERSION_STRING_NOSP macro by the public API function
vpx_codec_version_str().

Treat vpx_version.h as an absolutely internal header of the libvpx
library.

Change-Id: I86ba8548a62adae91ae7f5caad98169707f3fc64
2024-07-09 16:57:20 -07:00
Angie Chiang 1640ed4089 Turn off frame_stats == NULL error.
This change happens in define_gf_group().
Since this part is not critical for ext_ratectrl,
turn off the error reporting for now.

Change-Id: Ie74aa06a116edb8c5d9e7b29cadbd366232fbc1d
2024-07-09 13:35:00 -07:00
Wan-Teh Chang 066ea57e3d Fix unused function warnings in real-time only
The compare_fp_stats() and compare_fp_stats_md5() functions are not used
when CONFIG_REALTIME_ONLY is equal to 1. Define these functions only if
CONFIG_REALTIME_ONLY is 0 to avoid the -Wunused-function warnings.

Change-Id: Iaae208f67708cfaeee5304b0320ebce63c863f96
2024-07-08 14:31:23 -07:00
Jingning Han 7cc7bbba1f Allow TPL group to reference more frames
Allow the TPL group to use up to 3 reference frames from the
previous GOP. This slightly changes the coding stats in the range
of <0.1%.

STATS_CHANGED

Change-Id: Ieb4e948a783bf8ef9ca78717d56ff750f3f795a4
2024-07-08 17:02:15 +00:00
Wan-Teh Chang 4ac9c4ba32 Fix int cast errors in vp8 on max target bitrate
Fix double-to-int cast overflows in vp8 code caused by setting the
target bitrate to the maximum value (2000000).

Tested: Build libvpx with UndefinedBehaviorSanitizer and then run
./vpxenc husky.yuv -o AV1_husky_2000000_10000000_10000000.webm --good \
  --cpu-used=2 -v -t 0 -w 352 -h 288 --fps=10000000/10000000 \
  --target-bitrate=2000000 --limit=150 --test-decode=fatal --passes=2 \
  --lag-in-frames=25 --min-q=0 --max-q=63 --arnr-maxframes=7 \
  --arnr-strength=5 --kf-max-dist=9999 --undershoot-pct=100 \
  --overshoot-pct=100 --bias-pct=50 --codec=vp8

Note: This is essentially the VP8 version of the libaom CL
https://aomedia-review.googlesource.com/c/aom/+/191361.

Bug: 349440066
Change-Id: Ia43e1aad8fcab60ace49da960579081c2c3a5445
2024-07-03 17:09:52 +00:00
Wan-Teh Chang 27c39522f5 vpxenc.c: Fix UBSan integer errors in test_decode
Fix the following UBSan integer errors in test_decode():
vpxenc.c:1589:57: runtime error: implicit conversion from type 'int' of
value -16 (32-bit, signed) to type 'unsigned int' changed the value to
4294967280 (32-bit, unsigned)
vpxenc.c:1590:58: runtime error: implicit conversion from type 'int' of
value -16 (32-bit, signed) to type 'unsigned int' changed the value to
4294967280 (32-bit, unsigned)

Tested: Build libvpx with -fsanitize=integer and then run
./vpxenc husky.yuv -o AV1_husky_2000000_10000000_10000000.webm --good \
  --cpu-used=2 -v -t 0 -w 352 -h 288 --fps=10000000/10000000 \
  --target-bitrate=2000000 --limit=150 --test-decode=fatal --passes=2 \
  --lag-in-frames=25 --min-q=0 --max-q=63 --arnr-maxframes=7 \
  --arnr-strength=5 --kf-max-dist=9999 --undershoot-pct=100 \
  --overshoot-pct=100 --bias-pct=50 --codec=vp8

Bug: 349440066
Change-Id: Ice2f0e7176ffec664856559e2c02bd51113c4d74
2024-07-03 16:26:46 +00:00
Wan-Teh Chang a396ac214d Fix unsigned int overflow in init_rate_histogram()
Tested: Build libvpx with -fsanitize=integer and then run
./vpxenc husky.yuv -o AV1_husky_2000000_10000000_10000000.webm --good \
  --cpu-used=2 -v -t 0 -w 352 -h 288 --fps=10000000/10000000 \
  --target-bitrate=2000000 --limit=150 --test-decode=fatal --passes=2 \
  --lag-in-frames=25 --min-q=0 --max-q=63 --min-gf-interval=4 \
  --max-gf-interval=22 --arnr-maxframes=7 --arnr-strength=5 \
  --kf-max-dist=9999 --aq-mode=0 --undershoot-pct=100 \
  --overshoot-pct=100 --bias-pct=50

This unsigned integer overflow seems to be caused by
g_timebase.num=1000000.

Note: This is a port of the libaom CL
https://aomedia-review.googlesource.com/c/aom/+/191401.

Bug: 349440066
Change-Id: I924fa9c653400764dd7320938b88b4ea40f38172
2024-07-02 15:25:11 -07:00
Wan-Teh Chang af599a0c5f Fix further overflow issue in VBR.
This patch fixes some additional cases where under extreme conditions
some of the VBR adjustment variables can wrap.

As this happens on a per frame level the extra saturation checks should
not be an issue for performance.

Note: This CL is a port of the following libaom CLs:
https://aomedia-review.googlesource.com/c/aom/+/190521
https://aomedia-review.googlesource.com/c/aom/+/190888

Change-Id: I87c4ecca10f39767002f7d90d0f43b19c7150832
2024-06-28 21:29:04 -07:00
Wan-Teh Chang ac117ca7f9 Remove static from vars in parse_stream_params()
Those variables in parse_stream_params() don't need to be function-scope
static variables.

Change-Id: I5e0b0f78deb0aa8b4f95dcd2352d89342b9d528a
2024-06-27 17:30:01 -07:00
Angie Chiang 2693255a25 Let vp9_ext_ratectrl getting key frame decision
BUG = b/347936295

Change-Id: Ic152d3f6873ebe02977c1ede6a5663bd5f9be363
2024-06-21 11:21:18 -07:00
Marco Paniconi 253d6365e3 rtc-vp9: Allow scene detection for all speeds
Current code was disallowing scene detection for
speeds >= 8, to avoid any encode_time increase
(see comment in the code).

But we can expect the cost to be small even at speed 8,9,
and that concern on encode_time was from some time ago
before 8 and 9 were further optimized. And this is
needed for content with scene changes (see issue attached).
So allow scene detection now for all RTC speed settings (speed >= 5).

Bug: b/346846607
Change-Id: I678dbb88ff1399ed89b2bf9770ae9427e3044fc4
2024-06-18 16:58:00 +00:00
James Zern f07ca82f7a set_analyzer_env.sh: remove -fno-strict-aliasing
The last reference to the flag in configure was removed in:
fad70a358 Remove -fno-strict-aliasing flag

The library should be expected to function without this flag; it's built
and tested elsewhere without it.

Bug: webm:570, webm:603
Change-Id: Icf85fd9bd5c9cb0c81d6eecf10fba07807f48b4a
2024-06-14 12:16:33 -07:00
James Zern d6ae3ea465 rtcd.pl: add license header to generated files
Bug: aomedia:3525
Change-Id: I614056558fb5439b448342e0c01e53bd8da85585
2024-06-13 11:54:43 -07:00
Angie Chiang 68deb7ee20 Add missing header in vp9_firstpass.c
Change-Id: I675fa2b74b567e47f2a8fe2a7e4b4d3e77880d13
2024-06-12 14:29:08 -07:00
Angie Chiang ff67a4f209 Fix typo of received again
Change-Id: I6df009ec0423c2ef244399107c968ae1255337e5
2024-06-12 14:17:00 -07:00
Angie Chiang 277a5cdaa4 Remove redundant setting of max_layer_depth.
Change-Id: Ide2b6852339471b8e82109c846ba24fe7dc94aaa
2024-06-12 12:30:41 -07:00
Angie Chiang 2ca6e875c3 Typo recieved -> received
Change-Id: I140b5c2a5cefc346b3961dad09fd145d85d44d17
2024-06-12 10:28:12 -07:00
James Zern fb01e53c98 configure: add -c to ASFLAGS for android + AS=clang
The GNU Assembler was removed in r24. clang's internal assembler works,
but `-c` is necessary to avoid linking.

Bug: webm:1856
Change-Id: I61f80cf78657d3b71d5e73c5b2510575533ca5ea
2024-06-11 22:55:22 +00:00
James Zern b0c9d0c6fe configure: remove unused NM & RANLIB variables
+ update list in README

Change-Id: I363e9bc36b2e160de43d0fbcba4700297a582549
2024-06-11 22:55:22 +00:00
Angie Chiang ed95b102c4 Move ext_rc_define_gf_group_structure
Move the function into define_gf_group().
define_gf_group() has a lot of settings that might cause
performance drop if skipped.

Imitate define_gf_group_structure()'s behavior which add
an extra overlay frame at the end of gf_group whenever
alt_ref is used.

After this change, we can feed the baseline decision through
webmrc and get the same result as baseline.

This CL is tested with city_cif.yuv using ffmpeg

BUG = b/345528565

Change-Id: Ib61f0a0a72251f8662fb4072e0cfd7f456a243b3
2024-06-11 20:19:04 +00:00
James Zern 271b3f0bf0 tiny_ssim: mv read error checks closer to assignment
Quiets some spurious -Wmaybe-uninitialized warnings with gcc 14.1.0.

In function 'calc_plane_error16',
    inlined from 'main' at ../tools/tiny_ssim.c:464:5:
../tools/tiny_ssim.c:37:12: warning: 'v[0]' may be used uninitialized
  [-Wmaybe-uninitialized]
   37 |   if (orig == NULL || recon == NULL) {
      |            ^
In function 'calc_plane_error16',
    inlined from 'main' at ../tools/tiny_ssim.c:462:5:
../tools/tiny_ssim.c:37:12: warning: 'u[0]' may be used uninitialized
  [-Wmaybe-uninitialized]
   37 |   if (orig == NULL || recon == NULL) {
      |            ^
In function 'calc_plane_error',
    inlined from 'main' at ../tools/tiny_ssim.c:461:5:
../tools/tiny_ssim.c:61:12: warning: 'y[0]' may be used uninitialized
  [-Wmaybe-uninitialized]
   61 |   if (orig == NULL || recon == NULL) {

To reduce confusion, read_input_file() is changed to return an int as
previously it would only return (size_t)-1/0/1 (and now returns 0/1).

Change-Id: I2344048ecc2bd233891ffcef08002ee98d6d262a
2024-06-10 16:05:06 -07:00
James Zern a2508b5711 configure: disable runtime cpu detect w/armv7*-darwin
The default behavior changed in:
148d1085f Refactor and extend run-time CPU feature detection on Arm

This fixes build errors with these targets as there is no runtime cpu
detection defined for them.

Change-Id: Ie6b0bae1fc3e244d7dfcc823f60c3e466ccade79
2024-06-07 10:59:16 -07:00
Wan-Teh Chang ec129c190a Document the internal maximum of rc_target_bitrate
Both VP8 and VP9 internally cap the target bitrate to the smaller of the
uncompressed bitrate and 1000000 kilobits per second.

Change-Id: I4008ce09b5e709e75111800341d015e41eb1da42
2024-06-05 17:13:48 -07:00
Wan-Teh Chang b401a1ff2e Remove unnecessary double cast for cpi->framerate
cpi->framerate is already of the double type.

Change-Id: Ia9211b699e25b1c603585a40370a1ed66e7cbf03
2024-06-05 22:57:48 +00:00
Marco Paniconi faf12bdb83 vp9: round for framerate and _min/max_gf_interval()
Fixes for the comments in:
https://chromium-review.googlesource.com/c/webm/libvpx/+/5598161

Change-Id: Ib7db69649c848098cd3f6e4a88233d333e84f628
2024-06-05 14:21:58 -07:00
James Zern 713e0faca0 vp9: round avg_frame_bandwidth result
in vp9_rc_update_framerate() and in functions in vp9_svc_layercontext.c.

This matches the code in VP8 and AV1 as discussed in
https://chromium-review.googlesource.com/c/webm/libvpx/+/5566050/2/vp8/encoder/onyx_if.c

Change-Id: I084f8002f8f6c8efffc511566910b3f3df47ba4e
2024-06-05 00:14:34 +00:00
Marco Paniconi 60807f0aba Use round for RC calcutions in cyclic_refresh
Same as the fix in libaom:
https://aomedia-review.googlesource.com/c/aom/+/190881

Bug: aomedia:3579

Change-Id: Idb4026943a970189e6cd47a29e54e16623595e31
2024-06-04 14:50:58 -07:00
Angie Chiang 9d734db169 Rename gop_size by show_frame_count
Change-Id: Id95fbeaa0ceeb10c077bfd628f45fe880b42b3de
2024-06-03 07:35:49 -07:00
Wan-Teh Chang fd84dccd51 Fix high target data rate overflow.
These change fixes issues that can occur if the user specifies a very
high target data rate or rate per frame.

Fixes some issue with overflow of int variables used to hold bitrate
values (rate per second, rate per frame etc).

Note: This CL is a port of the following libaom CLs:
https://aomedia-review.googlesource.com/c/aom/+/190381
https://aomedia-review.googlesource.com/c/aom/+/190462

All the changes were ported to VP9. For VP8, only the new type of
cpi->bytes (equivalent to ppi->total_bytes in libaom) was ported.

Change-Id: I438dd46efd5a134389b893ffae1f8a2381207906
2024-05-31 16:00:25 -07:00
Jingning Han ffe9c9a457 Handle ARF and GF gop cases
Allow the inference scheme to cover GOPs with and without ARFs.

Change-Id: I68518791e96d7d5b92355c34360bbb74f2ecc436
2024-05-31 09:25:51 -07:00
Jingning Han ddf3c281e6 Remove a redundant condition in firstpass.c
Remove a redundant condition to trigger ext_rc gop structure
function all.

Change-Id: Ia3f135c67982b5539b9a2e8a74ba13edd9b5e46f
2024-05-30 18:56:47 +00:00
Jerome Jiang b5ba2274a0 Merge tag 'v1.14.1' into main-merge-1.14.1
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().

Change-Id: Ic5e274fdc35c9141591a65e825bf012d2cca3caa
2024-05-30 11:35:52 -04:00
Wan-Teh Chang 25540b3c12 Fix some UBSan errors in vp8_new_framerate()
Fix some UBSan errors in the calculations of cpi->av_per_frame_bandwidth
and cpi->min_frame_bandwidth in vp8_new_framerate() and in the
calculation of cpi->per_frame_bandwidth in encode_frame_to_data_rate().

A port of the VP9 changes in
https://chromium-review.googlesource.com/c/webm/libvpx/+/4944271 and
https://chromium-review.googlesource.com/c/webm/libvpx/+/5565157 to VP8.
Similar to the libaom CL
https://aomedia-review.googlesource.com/c/aom/+/190462.

Bug: aomedia:3509
Change-Id: I77b0e0b2f9fe667428daa9c4ceec0a35aafbfa81
2024-05-23 18:05:54 -07:00
Wan-Teh Chang 495c4b596c Add a #endif comment for CONFIG_VP9_HIGHBITDEPTH
Change-Id: Idc388e722e2579ce6935b52b1786038bdf2d5d47
2024-05-23 23:50:28 +00:00
James Zern f3e064e1d8 {aarch*,arm}_cpudetect: align define with comment
ANDROID_USE_CPU_FEATURES_LIB -> VPX_USE_ANDROID_CPU_FEATURES

Change-Id: I2d425cf3cd28219e570efb0c442b33f1a64447ae
2024-05-23 23:48:22 +00:00
Wan-Teh Chang 1f65facb63 Fix a UBSan error in vp9_rc_update_framerate()
Fix a UBSan error in the calculation of rc->min_frame_bandwidth in
vp9_rc_update_framerate().

A follow-up to
https://chromium-review.googlesource.com/c/webm/libvpx/+/4944271.
Similar to the libaom CL
https://aomedia-review.googlesource.com/c/aom/+/190462.

Bug: aomedia:3509
Change-Id: I36168a6d00cd81e60ae19a7d74c21f2e6c2f0caf
2024-05-23 14:38:50 -07:00
Wan-Teh Chang db4d6a5f54 Fix a typo in the CpuSpeedTest.TestTuneScreen test
Change the second rc_2pass_vbr_minsection_pct to
rc_2pass_vbr_maxsection_pct.

This copy-and-paste error was introduced in
https://chromium-review.googlesource.com/c/webm/libvpx/+/332653.

Change-Id: If2c61cd2ce0a6808643b8e80a27f054f7339e0fd
2024-05-22 16:04:40 -07:00
Angie Chiang 6c079c8beb Account for gop_decision->use_alt_ref
The change is in ext_rc_define_gf_group_structure()

Bug: b/339314081

Change-Id: I03576a0407105ced3e7cff4c33986e9a9a83b77f
2024-05-22 10:46:39 -07:00
Marco Paniconi 5b4cfe88e4 vp9-rtc: Fix integer overflow in key frame target size
The integer overflow happens
in vp9_calc_iframe_target_size_one_pass_cbr(), when
calculating the target size for L1T3 encoding.

The input target bitrate(kbps) is very large, so it gets set
to INT_MAX (before being multiplied by 1000 to convert to bps),
and avg_frame_bandwidth is then set to (INT_MAX / lc->framerate),
which when multipled by (16 + kf_boost) can exceed INT_MAX.
Fix is to cast the operands to int64_t and final result to int.

Bug: chromium:340918567
Change-Id: Ic00094b22c1f12ca988c0cb1fcaed473e1f8ed2b
2024-05-16 11:51:47 -07:00
Deepa K G 611d9ba0a5 Fix error handling in vp9_pack_bitstream()
In multi-threaded scenario, when the bitstream
buffer allocated is insufficient, the main thread
called 'longjmp' without waiting for the completion
of workers. In this patch, 'longjmp' is called by
the main thread after joining other worker threads.

This resolves the assertion failure as reported in
Bug: webm:1847

Bug: webm:1844

Change-Id: I399c76087b65e7b8d9a9fa4f12d784408243d648
2024-05-14 01:14:15 +05:30
Wan-Teh Chang b1cf64c40b vpx_decoder.h: Change "size member" to "sz member"
That member of vpx_codec_stream_info_t is named "sz", not "size".

Change-Id: I6cc878709d9dae37b9911cf746ba248a06ec1b1a
2024-05-13 17:03:10 +00:00
Wan-Teh Chang 498097b15b vpx_dec_fuzzer.cc: Initialize stream_info.sz
stream_info.sz should be initialized to sizeof(stream_info).

Bug: oss-fuzz:68912
Change-Id: I0cc0fcdfc93b7188a834ee1896f0bb4cf8c32fa9
2024-05-13 16:59:39 +00:00
Angie Chiang 5913401ebb Add vp9_ratectrl.h header to vp9_firstpass.c
KF_STD/GF_ARF_STD are used in vp9_firstpass.c
and defined in vp9_ratectrl.h

Change-Id: I5a6e42faa23e5f50630926e336daef37055fd195
2024-05-13 01:07:24 +00:00
Wan-Teh Chang db25581967 Assert a vpx_img_set_rect call always succeed
The vpx_img_set_rect() call at the end of img_alloc_helper() always
succeeds, so assert its return value is equal to 0.

A port of the changes to aom/src/aom_image.c in the libaom CLs
https://aomedia-review.googlesource.com/c/aom/+/90307 and
https://aomedia-review.googlesource.com/c/aom/+/190011.

Bug: webm:1850
Change-Id: I559820db245a596b4aed2042bfa7ebe7dd2d69b7
2024-05-10 23:58:23 +00:00
James Zern 1a3cd4922b vpx_dec_fuzzer: add vpx_codec_peek_stream_info coverage
Change-Id: I511539292cb8c2098c81f5fe3d711b9739482ffa
2024-05-09 17:19:33 -07:00
Jerome Jiang e934e35515 vp9 rc: also run tpl for GOPs without ARF
Tested with ffmpeg integration end to end test.

Bug: b/338393251
Change-Id: I4048036d35f8ab64c07305b838d091f765f64a8d
2024-05-09 15:19:35 -04:00
James Zern 8433fe6393 vpx_ext_ratectrl.h,cosmetics: Correspondent -> Corresponds
+ add some doxygen autolinks

Change-Id: Ifceb7d9e89d31037d0b690b1d661cebcd6fa67b8
2024-05-08 14:07:50 -07:00
James Zern 108f5128e2 encode_api_test.cc: assert encoder is initialized
Before proceeding with Encode(). This avoids some static analysis
warnings about uninitialized `cfg_` members.

Change-Id: Ib67b278d6706ab1034219e8c1ad9ba0c5b574ba8
2024-05-03 22:00:56 +00:00
Yunqing Wang 314ee14b64 Fix a rare memory overflow bug
In very rare cases (e.g. encoding with very high bit rate), the
allocated token memory isn't enough, which causes a buffer overflow
and then an encoder failure. This is fixed by using the aligned
number of blocks while allocating this buffer.

BUG=b/328803779

Change-Id: I5437cce13398206bf9982d57f35d6f9da17b187f
2024-05-03 21:01:23 +00:00
James Zern 9f73377821 vp9_pack_bitstream: remove a dead store
Fixes a static analysis warning:
Value stored to 'data_size' is never read

Bug: webm:1844
Change-Id: Ia27181b1051bb2c3a6bc4a4c2549df8b0525e889
2024-05-03 20:59:31 +00:00
James Zern 35f0262c5e configure: Do more elaborate test of whether SVE can be compiled
This is a port of the change in libaom:
https://aomedia-review.googlesource.com/c/aom/+/189761
5ccdc66ab6 cpu.cmake: Do more elaborate test of whether SVE can be compiled

For Windows targets, Clang will successfully compile simpler
SVE functions, but if the function requires backing up and restoring
SVE registers (as part of the AAPCS calling convention), Clang
will fail to generate unwind data for this function, resulting
in an error.

This issue is tracked upstream in Clang in
https://github.com/llvm/llvm-project/issues/80009.

Check whether the compiler can compile such a function, and
disable SVE if it is unable to handle that case.

Change-Id: I8550248abd6a7876bd8ecf6ba66bc70518133566
2024-05-02 15:21:07 -07:00
James Zern 3e713e39ae vp9_ethread_test: move 'best' mode to a Large test
This mode is used infrequently and is quite slow. This shifts the tests
to nightly to speed up the presubmit.

Change-Id: I3020887e0ca0150d7cbea9cc726649c11f94d56c
2024-05-02 22:20:00 +00:00
Angie Chiang 6db3f6e576 Add several utility functions to set gf_group
Use the utility functions and set gf_group_size in
ext_rc_define_gf_group_structure()

Avoid using gop_decision->update_type to keep the logic simple
for now.

Also simplify the interface.

Change-Id: I78fd5892e6f9731d50d6e5da97598b46c70a1dde
2024-05-02 21:41:30 +00:00
Wan-Teh Chang f65aff7b99 Remove vpx_ports/msvc.h
The vpx_ports/msvc.h header provides snprintf() and round() for MSVC
older than Visual Studio 2015 and Visual Studio 2013, respectively.

Since configure now requires vs14 (Visual Studio 2015) or later, it is
safe to remove vpx_ports/msvc.h.

Change-Id: I2fe4c41eaa126f4cf17639c11895f1e464294c76
2024-05-02 20:01:11 +00:00
James Zern 8372a5cfe1 vpx_ext_ratectrl.h: make rate_ctrl_log_path const
Change-Id: I499d77b25ca3dcdbd3c72fb319f9023e9a2823b0
2024-05-02 09:59:34 -07:00
Jerome Jiang 847b3548b4 Better format comments for vpx_ext_ratectrl.h
For vpx_rc_type_t: comment for each enum is moved to where it is
defined.

Change-Id: Ic1e2097ed381e7d71746792e0d517106db882685
2024-05-02 10:01:00 -04:00
Jerome Jiang 1c77f7fc0e Fix comments in vpx_ext_ratectrl.h
Added file level descriptor

Added comments for vpx_rc_ref_frame_t

Change-Id: Ifb000650821eab719b6e0fd003a00027ea132b9f
2024-05-02 10:01:00 -04:00
Wan-Teh Chang c0db981eaa Include <stdio.h> or <cstdio> for *printf()
Change-Id: Ifc0537fe5ae1223418fb68da5583cc72ae2c32a8
2024-05-02 02:26:16 +00:00
James Zern e9be4f607b encode_api_test.cc: apply iwyu
add missing <cstdio> and <cstdlib> and delete some unused headers.

Change-Id: I6c66368f557e6df896bffb2aa90228811f14f027
2024-05-02 02:25:43 +00:00
James Zern 7a0089dc08 vpx_ext_ratectrl.h: fix doxygen comments
fixes a few warnings about undocumented members update_type,
update_ref_index and ref_frame_list.

Change-Id: I668c61f6a511ba9e6c0907f6dafb0be614678e60
2024-05-01 13:24:59 -07:00
Angie Chiang f93e6aa333 Print gop_index in ENCODE_FRAME_RESULT
Change-Id: Icb522110dd2a7f87212ec0e7fc2638245008365f
2024-05-01 18:26:02 +00:00
James Zern b61b272208 vp9_rdopt.c: make init_frame_mv static
fixes a -Wmissing-prototypes warning

Change-Id: Ie380f9e4211ffab461f15dfe84184b8769d4f7bd
2024-04-26 12:54:08 -07:00
James Zern 63b9c2c0e2 VP9: add vpx_codec_get_global_headers() support
This returns the contents of CodecPrivate described in:
https://www.webmproject.org/docs/container/#vp9-codec-feature-metadata-codecprivate

The value for 4:2:0 is 1 (colocated) to match the default given for the
codec parameter string:
https://www.webmproject.org/vp9/mp4/#codecs-parameter-string

Bug: b:332052663
Change-Id: Ie50dd8d76e2d7389ac01bf4dbec801f9c8ea0e21
2024-04-25 15:20:18 -07:00
Angie Chiang 3015c41f06 Add VPX_RC_NONE
Change-Id: I8ca4caa7ffc4e9f8590ad8d02de0348b88c45254
2024-04-19 22:38:33 +00:00
James Zern 6f5839f986 vp9_encoder.c: fix printf format string
Replace %ld with %zu for `size_t`. Added in:
fd28f6f3c Add rate_ctrl_log_path

Fixes:
vp9\encoder\vp9_encoder.c(5748,15): warning C4477: 'fprintf' : format
  string '%ld' requires an argument of type 'long', but variadic
  argument 2 has type 'size_t'

Change-Id: I36fa9c7a9e14d4a2d9ef51a7f5c55de71bb34518
2024-04-19 10:55:20 -07:00
James Zern 2b88a07bc9 vpx_image_test.cc: add missing stdint include
fixes clang-tidy warning:
no header providing "uint16_t" is directly included

Change-Id: Ic71045ce6f88659ecd22243d473a3b6dc8c827dd
2024-04-18 12:50:01 -07:00
Angie Chiang fd28f6f3cc Add rate_ctrl_log_path
Change-Id: I4dc25c9ce4103cf3de44cff4d63e8ff8c82f35c0
2024-04-17 19:43:37 -07:00
Jerome Jiang 85dafa9c61 Initialize frame_mv in rd pick inter
Bug: b/334626386
Change-Id: Ie480a08f09c1b212b4163a5f6eb191c35510236f
2024-04-16 14:51:27 -04:00
Wan-Teh Chang 976134c50d Add 10 and 12b ranges to vpx_color_range_t comment
Add note about undefined behavior in vpx_codec_encode() description.

A port of the libaom CL
https://aomedia-review.googlesource.com/c/aom/+/158001
by Yannis Guyon <yguyon@google.com>.

Bug: webm:1850
Change-Id: Ia90f0bfd8265e35e9f33c17400c1c065d7915b77
2024-04-13 03:20:57 +00:00
Wan-Teh Chang 89efe85cd4 Clarify comment about buf_align in vpx_img_wrap.
If img_data is not NULL, img_alloc_helper ignores buf_align, so
vpx_img_wrap can set buf_align to any placeholder value.

A port of the libaom CL
https://aomedia-review.googlesource.com/c/aom/+/90362.

Bug: webm:1850
Change-Id: I42bc45aecf822a9314caf23058fe123d0574dc20
2024-04-13 03:19:57 +00:00
Wan-Teh Chang 3f4055b05b Introduce local vars uv_x,uv_y in vpx_img_set_rect
Port the changes to aom/src/aom_image.c in the libaom CL
https://aomedia-review.googlesource.com/c/aom/+/56643. The changes
related to `border` are not ported.

Bug: webm:1850
Change-Id: Ie81fffe0c84e912da880ffca245ae27cd71cf348
2024-04-13 03:19:00 +00:00
Wan-Teh Chang 74c70af016 Fix a bug in alloc_size for high bit depths
I introduced this bug in commit 2e32276:
https://chromium-review.googlesource.com/c/webm/libvpx/+/5446333

I changed the line

  stride_in_bytes = (fmt & VPX_IMG_FMT_HIGHBITDEPTH) ? s * 2 : s;

to three lines:

  s = (fmt & VPX_IMG_FMT_HIGHBITDEPTH) ? s * 2 : s;
  if (s > INT_MAX) goto fail;
  stride_in_bytes = (int)s;

But I didn't realize that `s` is used later in the calculation of
alloc_size.

As a quick fix, undo the effect of s * 2 for high bit depths after `s`
has been assigned to stride_in_bytes.

Bug: chromium:332382766
Change-Id: I53fbf405555645ab1d7254d31aadabe4f426be8c
2024-04-12 15:48:04 -07:00
Wan-Teh Chang 7d37ffacc6 Apply stride_align to byte count, not pixel count
A port of the libaom CL
https://aomedia-review.googlesource.com/c/aom/+/188962.

stride_align is documented to be the "alignment, in bytes, of each row
in the image (stride)."

Change-Id: I2184b50dc3607611f47719319fa5adb3adcef2fd
2024-04-11 16:46:13 -07:00
Wan-Teh Chang 8b2f8baee5 Avoid wasted calc of stride_in_bytes if !img_data
Change-Id: If1ddde5e894a06359f15486a2cee054a2f0cb1a2
2024-04-11 15:59:44 -07:00
Wan-Teh Chang 06af417e79 Avoid integer overflows in arithmetic operations
A port of the libaom CL
https://aomedia-review.googlesource.com/c/aom/+/188823.

Impose maximum values on the input parameters so that we can perform
arithmetic operations without worrying about overflows.

Also change the VpxImageTest.VpxImgAllocHugeWidth test to write to the
first and last samples in the first row of the Y plane, so that the test
will crash if there is unsigned integer overflow in the calculation of
stride_in_bytes.

Bug: chromium:332382766
Change-Id: I54cec6c9e26377abaa8a991042ba277ff70afdf3
2024-04-11 10:29:38 -07:00
Wan-Teh Chang 2e32276277 Fix integer overflows in calc of stride_in_bytes
A port of the libaom CL
https://aomedia-review.googlesource.com/c/aom/+/188761.

Fix unsigned integer overflows in the calculation of stride_in_bytes in
img_alloc_helper() when d_w is huge.

Change the type of stride_in_bytes from unsigned int to int because it
will be assigned to img->stride[VPX_PLANE_Y], which is of the int type.

Test:
. ../libvpx/tools/set_analyzer_env.sh integer
../libvpx/configure --enable-debug --disable-optimizations
make -j
./test_libvpx --gtest_filter=VpxImageTest.VpxImgAllocHugeWidth

Bug: chromium:332382766
Change-Id: I3b39d78f61c7255e10cbf72ba2f4975425a05a82
2024-04-10 20:47:45 -07:00
Wan-Teh Chang 3dbab0e664 Add test/vpx_image_test.cc
Ported from test/aom_image_test.cc in libaom commit 04d6253.

Change-Id: I56478d0a5603cfb5b65e644add0918387ff69a00
2024-04-10 18:15:00 -07:00
Wan-Teh Chang 8762f5efb2 Define the MAX_NUM_THREADS macro in vp9_ethread.h
The MAX_NUM_THREADS macro is unrelated to the VPxWorkerInterface, so it
doesn't need to be defined in vpx_util/vpx_thread.h.

The VP8 code doesn't seem to depend on MAX_NUM_THREADS, so VP8 can use
64 directly in the range check of its g_threads option. Move the
definition of the MAX_NUM_THREADS macro to vp9/encoder/vp9_ethread.h and
use it in VP9 code only.

Change-Id: Ibf788ca2496c743a2ac0498fefaab8a3c181228d
2024-04-04 20:27:32 +00:00
Chun-Min Chang 0752960c6a Add missing header for EBUSY on mingw
The `error: use of undeclared identifier 'EBUSY'` in
vpx_util/vpx_pthread.h was found in Mozilla's bug 1886318 [1]. This
patch addresses the issue by adding the `<errno.h>` header to introduce
the `EBUSY` identifier, resolving the problem.

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1886318#c1

Change-Id: Ic417dafebf5ab160060dd29f692fa9c40d8db05a
2024-04-04 10:10:37 -07:00
Wan-Teh Chang 6445da1b40 Fix GCC -Wmissing-braces warnings
warning: missing braces around initializer [-Wmissing-braces]

Bug: webm:1846
Change-Id: I007a68d09f48d4199ecd948136e69f9cf5f219f5
2024-04-04 00:03:35 +00:00
Casey Smalley 2bafeadd3e Add missing configuration includes
The Google cpp style guide dictates that you should "include what you
use" with respect to symbols. This CL adds vpx_config.h imports to unit
tests that rely on config flags but were otherwise indirectly included.

Change-Id: Ia70a512cebe6c104d2d64afbed3cde8a405c68df
2024-04-03 20:20:44 +00:00
Casey Smalley 588beb020b Unit test config changes for Chromium
This CL will help run libvpx tests under Chromium against its partition
allocator. The allocator does not support single allocations above
3.998GiB. Because of this tests related to large video sizes that
Chromium is configured for are expected to fail.

Chromium also only supports the CONFIG_REALTIME_ONLY option,
some changes are scoped behind this flag.

Change-Id: I80e8743c0619ce502688109ce0be01cb252d5f92
2024-04-03 20:20:44 +00:00
Wan-Teh Chang 05a4c855be Compare ctx->pending_cx_data with NULL
ctx->pending_cx_data is a pointer. It looks nicer to compare
ctx->pending_cx_data with NULL than with 0.

Change-Id: I18815907b3d75551abfc603cb3c5c0297dceed23
2024-04-03 02:53:45 +00:00
Hirokazu Honda 1d007eafa3 vp9 rc: Fix GetSegmentationData() crash in aq_mode=0
cpi_->cyclic_refresh is nullptr if aq_mode is 0, in other words, the
rate controller runs in non adaptive quantization mode. This CL fixes
the crash in GetSegmentationData() in non aq mode.

Bug: b/259487065
Test: video encoding on ChromeOS

Change-Id: I503b30d15c697c8dd1da203b3c7361b91c428e87
2024-04-02 23:00:50 +00:00
Wan-Teh Chang 976cedd643 Set priv->cx_data_sz to 0 if cx_data alloc fails
Change-Id: I6553cd7b09270b4d60ccd7199d499e03c22b3936
2024-04-02 22:53:17 +00:00
Wan-Teh Chang 419f36e8ed encoder_encode: Assert pending_cx_data_sz is valid
In encoder_encode(), assert ctx->pending_cx_data_sz is not too big
before the memmove() call.

Change-Id: Icd1e95f6d751b0bf67386d0d99218b256bc91ebd
2024-04-02 21:52:03 +00:00
Wan-Teh Chang dc74cf923b Dont use VPX_CODEC_CORRUPT_FRAME in set_frame_size
VPX_CODEC_CORRUPT_FRAME is a decoder error. It is strange for
vpx_codec_encode() to fail with this error. In set_frame_size(), change
VPX_CODEC_CORRUPT_FRAME to VPX_CODEC_ERROR.

The use of VPX_CODEC_CORRUPT_FRAME was originally added in
commit 1ed56a46b3.

Change-Id: Iee92ed4cfca5061289b278ece2ba475cf98fec06
2024-04-02 17:56:48 +00:00
Gerda Zsejke More bf932674a8 Add SVE2 implementation of vpx_highbd_convolve8_avg
Add SVE2 implementation of vpx_highbd_convolve8_avg function and the
corresponding tests as well.

Change-Id: I2ff707da55d11b1d5376eb0a7ec85c343a2709c2
2024-04-02 13:32:51 +02:00
Gerda Zsejke More 9274c2bbf0 Merge horiz. and vert. passes in HBD SVE2 2D 4tap convolution
The current SVE2 approach to 2D convolution is:
1) Filter horizontally, storing to an intermediate buffer.
2) Filter vertically and store the final output.

This patch merges the two phases for high bitdepth 2D convolution for
filter sizes smaller or equal to 4 to avoid the storing and
re-loading from the intermediate buffer.

This approach is not beneficial when applying an 8tap filter in the
convolution.

Change-Id: Ie090eb79f1cbf182300d9343ae63069396ef3956
2024-04-02 13:29:48 +02:00
Jingning Han 43d12d5079 Update yv12_mb initialization
BUG=webm:1846

Change-Id: If8475d46397f04ef769f3e4647de5c2d4b6760a4
2024-03-30 00:02:02 +00:00
Jerome Jiang 5396643be6 Add invalid value to gop decision enums
These invalid value definitions are necessary to initialize
the gop decision in external RC so libvpx can tell which is populated
and which is not

Bug: b/329483680
Change-Id: I06bbb41fa59d0fb95296aebd0d05a703ec953b81
2024-03-29 21:20:42 +00:00
Wan-Teh Chang 5f5dfb3303 Assert the return value of read_tx_mode() is < 5
Coverity somehow thinks the return value of read_tx_mode() is between 0
and 7 (inclusive).

Hopefully this will fix Coverity CID 1584457: Out-of-bounds access in
read_coef_probs().

Change-Id: I49fbddf6fd6861bc9def9dfa91eaaaa4aefe5710
2024-03-29 11:22:41 -07:00
Jingning Han ccefddef33 Initialize yv12_mb array
This array will be partially configured and used in later rate
distortion optimization search.

BUG=webm:1846

Change-Id: I83daba341c56767187031edb1c10d4528a4257a3
2024-03-29 09:10:23 -07:00
Wan-Teh Chang d790001fd5 Perform bounds checks in vpx_write_bit_buffer
Add the `size` and `error` members to the vpx_write_bit_buffer struct.
Add the vpx_wb_init() and vpx_wb_has_error() functions.

Instances of the vpx_write_bit_buffer struct are only allocated in the
vp9_pack_bitstream() function. So vp9_pack_bitstream() is the only
function outside vpx_dsp/bitwriter_buffer.* that needs updating.

This CL completes the work of adding output buffer bounds checks to
vp9/encoder/vp9_bitstream.c.

Bug: webm:1844
Change-Id: I6b362be572852ee51d96023b35bfb334faada7e1
2024-03-28 14:05:47 -07:00
Jerome Jiang d5501945fc vp9 rc: override GF_GROUP decisions using ext RC
Bug: b/329483680
Change-Id: I2e02673f1bca56bfa24545b4e25d5e3fd3b0e863
2024-03-28 17:33:54 +00:00
Marco Paniconi 3f8f19372b vp9: Fix to alloc for row_base_thresh_freq_fac
Issue happens for real-time nonrd pickmode.
Due to speed feature: sf->adaptive_rd_thresh_row_mt,
enabled for speed >= 8, and for speed >= 7 svc only.

Issue occurs where resolution (sb_rows) changes and
row_base_thresh_freq_fact needs to be re-allocated.

Fix is to add sb_rows to TileDataEnc and check for
re-alloc of row_base_thresh_freq_fac.

Bug: b:331108922
Change-Id: I1a1ca94c14f343200c180725e4cb8d91d3c55b83
2024-03-28 16:47:45 +00:00
Wan-Teh Chang 73703c188b Perform bounds checks in vpx_writer
In the vpx_writer struct, change the buffer_end field to the size field.
Change vpx_stop_encode() to return true on success, false on failure
(output buffer full).

In write_compressed_header(), remove the assertion
assert(header_bc.pos <= 0xffff). The caller (vp9_pack_bitstream()) will
check that condition.

In vp9_pack_bitstream(), the variable "first_part_size" is renamed
"compressed_hdr_size".

Bug: webm:1844
Change-Id: I4ed6ab905a707ad44d875e53036d5a42523a65d0
2024-03-27 09:07:03 -07:00
Wan-Teh Chang 5bea4606dd Fix a typo in comment: "it" -> "is"
Change-Id: I5d36c5198c67cbb2f424901ec045d0620fea2f04
2024-03-27 14:48:55 +00:00
Wan-Teh Chang 34277e53ad Free row mt memory before freeing cpi->tile_data
In vp9_init_tile_data(), call vp9_row_mt_mem_dealloc(cpi) to free the
row mt memory in cpi->tile_data before freeing cpi->tile_data.

Bug: b:331086799, b:331108729
Change-Id: Idc79984ce7e0110e6858139b2ed286492a2e8622
2024-03-26 23:38:09 +00:00
Gerda Zsejke More d2ba3a22b4 Add 2D-specific highbd SVE2 horizontal convolution function
2D 8-tap convolution filtering is performed in two passes -
horizontal and vertical. The horizontal pass must produce enough
input data for the subsequent vertical pass - 3 rows above and 4 rows
below, in addition to the actual block height.

At present, all highbd SVE horizontal convolution algorithms process
4 rows at a time, but this means we end up doing at least 1 row too
much work in the 2D first pass case where we need h + 7, not h + 8
rows of output.

This patch adds an additional SVE2 path that processes h + 7 rows of
data exactly, saving the work of the unnecessary extra row.

Change-Id: I2f5d39ad737dbd7eccb08dd2b51586c6710119b8
2024-03-26 19:00:26 +00:00
Gerda Zsejke More cd9d72c065 Add SVE2 implementation of vpx_highbd_convolve8
Add SVE2 implementation of vpx_highbd_convolve8 function. Add the
corresponding tests as well.

Change-Id: I783cc083f1bce5f13ce721bc191b34c48033f5ae
2024-03-26 19:00:26 +00:00
Wan-Teh Chang c9bd573531 Replace "cpi->common." with "pc->"
If a local variable "pc" is defined as &cpi->common, replace
"cpi->common." with "pc->".

Also replace a memcpy() call with a struct assignment.

Change-Id: I6f4f12e69d9989beaa6e04c83d93230e7d726278
2024-03-25 14:46:50 -07:00
Wan-Teh Chang 4f579df337 Declare VP9BitstreamWorkerData dest_size as size_t
Declare the dest_size member of the VP9BitstreamWorkerData struct as
size_t instead of int.

Fix the following MSVC warning:
vp9\encoder\vp9_bitstream.c(1031,37): warning C4267: '=':
conversion from 'size_t' to 'int', possible loss of data

Change-Id: Idab5ad5d4bf4d1e4754f011a3073c9a89da29f55
2024-03-23 11:20:22 -07:00
Wan-Teh Chang e387187438 Add the buffer_end field to the vpx_writer struct
The buffer_end field will allow bounds checking when vpx_writer writes
to the output buffer. This CL sets up the plumbing to pass the output
buffer size from vp9_pack_bitstream() to vpx_start_encode(), which
initializes the vpx_writer struct. vpx_writer doesn't use the output
buffer size in bounds checks yet, but the code in vp9_bitstream.c does.

Bug: webm:1844
Change-Id: I995e469ab453c02d740f54b46e0b08c7f2eb1a2e
2024-03-23 02:15:42 +00:00
James Zern 9137f7fa4b rtcd.pl: add empty specialize() check
This was added in libaom in:
5ddac0aac8 RTCD defs: Remove empty specialize statements once and for all.
https://aomedia-review.googlesource.com/c/aom/+/9062

Change-Id: I9c8fb0c8e4bd4dc9373d8533ab083dff816e7cbe
2024-03-22 09:45:42 -07:00
Wan-Teh Chang d48577579b Pass output buffer size to vp9_pack_bitstream()
Set up the plumbing to pass the size of the output buffer `dest` to
vp9_pack_bitstream(). The output buffer is the cx_data buffer in the
encoder_encode() function in vp9/vp9_cx_iface.c, and its size is
cx_data_sz.

In this CL vp9_pack_bitstream() ignores the `dest_size` parameter.

Bug: webm:1844
Change-Id: I53c80280143d409cf16f87c4d6deec3d9338aea3
2024-03-21 18:59:58 -07:00
James Zern cab4f31e1d encodeframe.c: remove some unused includes
clears some clang-tidy warnings

Change-Id: I82c1d212126b9c7b010b6bc8ac32d92453f6d376
2024-03-21 01:59:48 +00:00
James Zern 3c58cb1bc2 VP8_COMMON: remove unused cpu_caps member
This was set, but not read; rtcd covers this.

Change-Id: I1d8b8f8d8ed9e7bc56c3734cb96b79b937b5e20c
2024-03-20 13:14:35 -07:00
Wan-Teh Chang 6e879c6173 Save encode_tiles_buffer_alloc_size() result
Avoid calling encode_tiles_buffer_alloc_size() twice by saving its
return value in a local variable.

Change-Id: I3050f9cf7c3520f7edc80abf66620ba233fadad8
2024-03-20 20:03:57 +00:00
James Zern afc8b452b8 aarch64_cpudetect: add missing include
clears clang-tidy warning for HAS_*

Change-Id: I1b21326480b7c5c3be18c055f848071df0076915
2024-03-20 18:24:37 +00:00
James Zern 55d4b736b2 vpx_scaled_convolve8_neon: add missing include
clears clang-tidy warnings for types and constants in vpx_filter.h

Change-Id: I1f3f843b9ab6fd0ad038e33a048e8708cbd2a950
2024-03-20 18:24:37 +00:00
Jerome Jiang 6358ef6261 vp9 rc: Add ref frame list for each frame in GOP
Bug: b/329483680
Change-Id: I24573c25e70b41b7af243c473f28fa1b290cc373
2024-03-20 12:17:52 -04:00
Jerome Jiang 18059190d7 Remove vpx_rc_gop_info_t
Not being used anywhere any more. This was used to pass
GOP info to ML models.

Bug: b/617172914
Change-Id: Ibcfa00bc8215b73f43d9a11edbe00b6a2d7fb137
2024-03-20 16:17:23 +00:00
Jerome Jiang 6641e9e03c Add update type and ref update idx to gop decision
Bug: b/329483680
Change-Id: Ifc82ad79415400bbec4efe6ab9b78496d5f73ee7
2024-03-20 16:17:23 +00:00
Jerome Jiang 458e1c6875 Remove TPL IO functions
These are not used in libvpx.

Bug: webm:1837
Change-Id: Ic234b2dcd47d6614030b8a066c921e4285af5e99
2024-03-19 19:05:24 +00:00
Marco Paniconi 19832b1702 vp9: fix to integer overflow test
failure for the 16k test: issue introduced
in: c29e637283

Bug: b/329088759, b/329674887, b/329179808

Change-Id: I88e8a36b7f13223997c3006c84aec9cfa48c0bcf
2024-03-17 10:07:34 -07:00
Marco Paniconi c29e637283 Fix to buffer alloc for vp9_bitstream_worker_data
The code was using the bitstream_worker_data when it
wasn't allocated for big enough size. This is because
the existing condition was to only re-alloc the
bitstream_worker_data when current dest_size was larger
than the current frame_size. But under resolution change
where frame_size is increased, beyond the current dest_size,
we need to allow re-alloc to the new size.

The existing condition to re-alloc when dest_size is
larger than frame_size (which is not required) is kept
for now.

Also increase the dest_size to account for image format.

Added tests, for both ROW_MT=0 and 1, that reproduce
the failures in the bugs below.

Note: this issue only affects the REALTIME encoding path.

Bug: b/329088759, b/329674887, b/329179808

Change-Id: Icd65dbc5317120304d803f648d4bd9405710db6f
2024-03-15 21:43:28 +00:00
Wan-Teh Chang 7fb8ceccf9 Restrict ranges of duration,deadline to UINT32_MAX
Bug: webm:1828
Change-Id: I3b1d208cf300d7c4c5584681183d45b1e97c7380
2024-03-15 01:11:50 +00:00
Wan-Teh Chang bc5a22eb60 Replace timestamp_ratio by oxcf->g_timebase_in_ts
Fix a TODO comment in encoder_init().

Change-Id: Id737142202c807a3f538fdf50612e77ca790990c
2024-03-14 14:32:44 -07:00
Wan-Teh Chang 6c0bf97a98 Detect integer overflows related to pts & duration
A port of the following two libaom CLs:
https://aomedia-review.googlesource.com/c/aom/+/187902
https://aomedia-review.googlesource.com/c/aom/+/188161

Bug: webm:1828
Change-Id: Id25039b000c3d04e7a4c8d71579a6932e9fd65ef
2024-03-14 11:14:25 -07:00
Wan-Teh Chang 8c36d36bcc Add high bit depths, 4:2:2, 4:4:4 to VP9Encoder
A port of the changes to vp9_encoder_fuzz_test.cc in
https://chromium-review.googlesource.com/c/chromium/src/+/5292940.

Change-Id: Ie143ffd9cffbd6a8639812c72e85c9a017aa554e
2024-03-13 13:45:41 -07:00
Jonathan Wright ad1d0ece31 Disable SVE2 if compiler doesn't support arm_neon_sve_bridge.h
SVE and SVE2 code paths in libvpx require intrinsics from
arm_neon_sve_bridge.h. SVE is disabled if the compiler does not
support this header. This patch conditionally disables SVE2 in the
same way.

Also gate the check for arm_neon_sve_bridge.h on whether SVE is
enabled in the first place. The check isn't necessary if the user has
explicitly disabled SVE. (Explicitly disabling SVE already disables
SVE2 since the former is a pre-requisite for the latter.)

Change-Id: Ibb21f09e8b2470d1ce5d98b71b101f5b7f7dbcdc
2024-03-13 18:38:10 +00:00
James Zern c1494fa57e neon: fix -Woverflow warnings
with signed char values, 128 -> -128

Change-Id: Iec2257729d7878459794d6a3d6bc3f745d39e97c
2024-03-13 18:36:14 +00:00
Wan-Teh Chang daa33cca37 Remove return statement after vpx_internal_error()
In encoder_encode(), remove the return statement after a
vpx_internal_error() call because setjmp() has been called at that
point.

Change-Id: Ib8ebbfbacb21097ce7f1b4e3bf53004bbe88a42b
2024-03-13 00:57:33 +00:00
Wan-Teh Chang 0ba7b50338 Ignore the pts parameter when flushing the encoder
Change-Id: I8380a4a7ffcbf7a6f183d02d363473273b47f064
2024-03-12 11:02:30 -07:00
Wan-Teh Chang 7f6ba04e87 Move the local variable sd to the innermost scope
Change-Id: Ie6bfda6247ba408b9dbcf0b94fa95dbca0c57adb
2024-03-11 17:07:39 -07:00
James Zern cf1b7a65ff VP9RateControlRtcConfig: relocate some initializations
use default member initializers for all members for consistency.

Change-Id: I1956163c995d94aadbde38b4edaf21dc722e50c4
2024-03-11 18:50:00 +00:00
James Zern 0af7244971 ratectrl_rtc.h: remove use of vp9_zero()
This is an internal define that shouldn't be exposed in this header.

Change-Id: I43b793ab18c19ffab8bcc71fcd7097216989ca5a
2024-03-11 18:50:00 +00:00
James Zern ca7fd396e7 ratectrl_rtc.h: move some includes to .cc
This is the first step in removing the use of internal headers in a
public header.

Change-Id: Ia71b0b16a01037baa72942fc8ee7aeb4ffc04b86
2024-03-11 18:50:00 +00:00
James Zern 0ba67bb93d *ratectrl_rtc.h: remove unneeded 'public:'
in struct VP8RateControlRtcConfig and struct VP9RateControlRtcConfig;
structs default to public access.

Change-Id: Icdc5b44fb4c7297b0cb3c6cde8bec33ea5cee18c
2024-03-11 18:50:00 +00:00
James Zern cd88d25c53 vp8_ratectrl_rtc.cc: fix include order
vp8/vp8_ratectrl_rtc.h should come first as it's implemented in this
module. Split the rest of the groups on C/C++/vpx bounds.

Change-Id: If6bbbd8f3adf3766fa36fbc53ae06c9f6f76ebe9
2024-03-11 18:48:31 +00:00
Gerda Zsejke More 5391609fbe Add SVE2 implementation of vpx_highbd_convolve8_avg_vert
Add SVE2 implementation of vpx_highbd_convolve8_avg_vert function.
Add the corresponding tests as well.

Change-Id: I20ca19e09a1686bb00c0b51bf756ddab0adbc2c0
2024-03-11 18:43:35 +00:00
Gerda Zsejke More 45ea306dad Add SVE implementation of vpx_highbd_convolve8_avg_horiz
Add SVE implementation of vpx_highbd_convolve8_avg_horiz function.
Add the corresponding tests as well.

Change-Id: If13793fa653834dfdfeddfee60b80129eea85dd7
2024-03-11 18:43:35 +00:00
Gerda Zsejke More 2c3a9b69e7 Add SVE2 implementation of vpx_highbd_convolve8_vert
Add SVE2 implementation of vpx_highbd_convolve8_vert function. Add
the corresponding tests as well.

Change-Id: I289ac79d4493935217feaa4fd2fa0b8ef9a62972
2024-03-11 18:43:35 +00:00
Gerda Zsejke More 282e9aa0eb Add Arm SVE2 build flags and run-time CPU feature detection
Add 'sve2' arch options to the configure, build and unit test files -
adding appropriate conditional options where necessary. Arm SIMD
extensions are treated as supersets in libvpx, so disable SVE2 if
SVE is unavailable.

Change-Id: Icdec2aace357e36fba77c77cd8b70da1e5427fce
2024-03-11 18:43:35 +00:00
Wan-Teh Chang a87978a53d VP8: Always reset the setjmp flag before returning
Always reset the setjmp flag to 0 before returning from the function
where setjmp() was called.

Change-Id: I80bf39ef1769f656f53c6c6657c06e34489750f4
2024-03-11 16:45:59 +00:00
Wan-Teh Chang f51417671e Include system headers first
Change-Id: Ia096dacb3dd102829196e5ebd1bc148cf2ea2f93
2024-03-09 18:27:18 +00:00
James Zern 03c7f6a108 libs.doxy_template: remove DOT_TRANSPARENT
This was deprecated in 1.9.5 [1]. It is now enabled by default. For
earlier versions of doxygen this will set the value to false, but I
don't believe we were relying on this functionality.

[1]: https://www.doxygen.nl/manual/changelog.html#log_1_9_5

Change-Id: I75f576d35ca86636761cf70fda0dd0ad37f71d71
2024-03-09 02:33:16 +00:00
Wan-Teh Chang f46d99bcf7 Clear dangling ptr in vp8_remove_decoder_instances
Change-Id: I80c7d41c4675305efbbfbaddd45b42122979b318
2024-03-09 01:02:58 +00:00
Wan-Teh Chang ec06dcc314 Subtract pts_offset from pts after calling setjmp
This allows us to call vpx_internal_error() if the relative pts would be
negative.

Change-Id: I9ca314c4e32bb2c17bbe20ede6ea854bf9701ade
2024-03-08 14:07:38 -08:00
James Zern 99e887c09e vp8/encoder/encodeframe.c: sort includes
Change-Id: I30a8117754e8168a3f6fe37c4ea459475ad1b9aa
2024-03-07 19:57:44 -08:00
Wan-Teh Chang a6647c9cab Add vp8_ prefix to sem_* macro names
The sem_* macros do not behave exactly like the POSIX sem_* functions.
Add the vp8_ prefix to the sem_* macro names to make it clear that they
are not the POSIX sem_* functions. Another reason for adding the vp8_
prefix is that we need to wrap sem_wait() (to handle EINTR) on the Unix
platforms that have real sem_wait() function.

Handle EINTR in the Unix (non-Apple) definition of vp8_sem_wait().

Change-Id: I3df02a30f851d41691a55cf7a84aa2ff054bba9c
2024-03-08 01:46:59 +00:00
Jonathan Wright 6b6916be0a Refactor standard bitdepth Neon scaled convolve
Tidy up the standard bitdepth Armv8.0 Neon implementation of scaled
convolution.

Change-Id: I9e48e773b4a4b252b9254a22af23c8e834407b8a
2024-03-08 00:39:58 +00:00
Jonathan Wright 9b94b7bd01 Optimize Arm Neon implementation of transpose_u8_8x8()
Operate on 128-bit vectors to reduce the total number of instructions
by two.

Change-Id: I252e67831ccbb51adcfe5caaadb3205d3eb11b79
2024-03-08 00:39:58 +00:00
James Zern fa64af7bbf vp8/encoder/encodeframe.c: add missing include
Based on a clang-tidy warning:
  `no header providing "sem_wait" is directly included`
Though this may not clear it entirely, it's the closest that can be
done given the platform-dependent includes and implementation in
vp8/common/threading.h

Change-Id: I19984f820f3f380e58deef40563a2f0c66187748
2024-03-07 13:53:56 -08:00
James Zern 1f066bf77c build/make/Android.mk: update configure/build comments
set --target to the more modern aarch64-android-gcc and remove an
incorrect comment regarding realtime-only.

Change-Id: I5f6c9de9fcd96a60817e37fc6f6505725ddea6b9
2024-03-07 00:40:17 +00:00
George Steed b0e26cdcfd aarch64_cpudetect.c: Avoid unused variable warning
When dot-product and SVE support are disabled the hwcap variable is
currently unused. Fix this by wrapping it in an #ifdef matching the
conditions where it is needed.

Change-Id: I1c2e302d861c6c726b314e374f07d4fafe17ffc7
2024-03-06 18:52:38 +00:00
Jerome Jiang 148c7f65f0 IWYU: fix clang-tidy complaints
Include vp9_firstpass.h for KF_UPDATE

Change-Id: Ie1805a2201f3c42c7d3a0102e4eaa0378cca315e
2024-03-06 10:11:46 -05:00
Daniel Cheng b207d1c9bd Only #define __builtin_prefetch if it doesn't exist.
libvpx's check for conditionally defining __builtin_prefetch is broken,
since clang-cl defines __builtin_prefetch on Win ARM64: in addition, it
supports up to 3 arguments, with the latter 2 being optional. This
causes build breaks when paired with other libraries, like Abseil, which
do perform the conditional test correctly.

The real fix here is to define something like VPX_PREFETCH rather than
trying to #define an implementation-reserved name, which is undefined
behavior.

Bug: 328105513
Change-Id: Ibe14d9ce34306654bd20e560973f76c3b40036ee
2024-03-04 18:11:26 -08:00
Jerome Jiang a571299b07 vp9 ext rc: Do motion search on key frame in TPL
Bug: b/327254742
Change-Id: I7448c09994441c89c36420e780cd2641c6f1aa5a
2024-03-04 21:54:11 +00:00
Jonathan Wright 9d8d71b41b Refactor Arm Neon transpose_concat_*() to not need lookup table
Refactor the transpose_concat_*() helper function used in the Arm Neon
DotProd and I8MM vertical convolution implementations to not use TBL
instructions. Using vzip* to achieve the same outcome (with the same
number of instructions) avoids needing/loading the lookup indices and
also increases performance on little (in-order) Arm Cortex cores.

Change-Id: Iff62a44f8a9bf0ee239d5bb36be8424cab0dbca5
2024-03-04 20:24:03 +00:00
Jonathan Wright 5a8e2f705e Cosmetic: Remove 'vpx_' prefix from static Neon functions
Tidy up some of the naming in Arm Neon convolution functions.

Change-Id: I9cfd925dbcb754bdf9fe0860a46a1c9dca2c7f9a
2024-03-04 20:24:03 +00:00
Cheng Chen f394f2be74 Delete "public" from struct definitions
Struct by default is public.

Change-Id: I87dc164d6a63fcc950c6e513901fc2826e53a8ae
2024-02-29 14:16:55 -08:00
Wan-Teh Chang d4959f9825 Handle EINTR from sem_wait()
sem_wait() may be interrupted by a signal and fail with EINTR:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sem_wait.html

Retry the sem_wait() call if it fails with EINTR.

This finishes the fix started in
https://chromium-review.googlesource.com/c/webm/libvpx/+/5299569. As a
speculative fix, that CL fixed only the sem_wait(&cpi->h_event_end_lpf)
calls responsible for bug chromium:324459561. ClusterFuzz verified the
fix, so this CL extends it to the other sem_wait() calls.

Note that sem_wait() calls like the following do not need this fix,
because the while (1) loop retries the sem_wait() call if it fails:

  while (1) {
    if (vpx_atomic_load_acquire(&cpi->b_multi_threaded) == 0) break;

    if (sem_wait(&cpi->h_event_start_lpf) == 0) {
      ...
    }
  }

Bug: chromium:324459561
Change-Id: I0f0612616eee37fb3da68049e49b3e86927b5e24
2024-02-28 21:06:36 +00:00
Wan-Teh Chang b7b5d0a568 Use the value param in Win32 version of sem_init
Name the three parameters of sem_init() as sem, pshared, value. See
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sem_init.html.

Pass the `value` parameter to CreateSemaphore() as the second
(lInitialCount) parameter:
https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createsemaphorea

Remove unneeded parentheses around semaphore_wait(*sem).

Change-Id: I1735c94adb511ca539159dfea19421595ec15d24
2024-02-27 13:44:23 -08:00
George Steed fa50b26848 Only enable AArch64 extensions if the compiler supports them
We already have some logic in the configure.sh file to selectively
disable code dependent on particular architecture extensions, however we
do not yet have anything to check that the compiler being supplied
recognises and can compile code using these extensions.

This commit adds compiler "-march=..." flag tests to the existing
extension-disable loop so that we now correctly disable extensions that
are not supported by the compiler. For AArch64 this loop also needs to
move below the existing compiler/OS handling to ensure that prefixes
like $CROSS are handled correctly before running compiler tests.

Bug: webm:1841
Change-Id: I936b911c4b0ebf03abc34b7532b2bb4568129f57
2024-02-27 19:53:03 +00:00
Gerda Zsejke More 3646b12927 Specialise highbd_convolve8_horiz_sve for 4-tap filter
Add SVE implementation for vpx_highbd_convolve8_horiz that specialises
for 4-tap filters. This way we avoid a lot of redundant work to
multiply and add zero, given that some of the 8-tap filters are
zero-padded, so they are effectively 4-tap filters.

Change-Id: Ib5e0377f924df1d893e9436f443fcbe7d196ea27
2024-02-27 19:38:09 +00:00
Gerda Zsejke More c78f1ef4a0 Rename dot_neon_sve_bridge header file
Rename dot_neon_sve_bridge.h to vpx_neon_sve_bridge.h in order to
reflect that other instructions can be implemented in the header
file. In a subsequent patch, the usage of vtbl with Neon-SVE bridge
intrinsics will be added.

Change-Id: I8f71aad2b7fb4932c9554badf041a80aca58c7cf
2024-02-27 19:38:09 +00:00
Jonathan Wright 2bc1012c53 Remove redundant code for neon_dotprod 2D convolution
Remove the 4-tap Neon DotProd path for the horizontal pass of 2D
convolution since it has been made redundant by the horizontal-
vertical merged implementation. Also move the 8-tap path closer to
where it is used and call it explicitly rather than the filter-
agnostic wrapper.

Change-Id: I1861dc88a67a759c3e8deb0b471ec447a62063f2
2024-02-26 22:28:05 +00:00
Jonathan Wright baece7460d Merge h. and v. passes in 4-tap SBD Neon DotProd 2D convolution
The current SBD Neon DotProd approach to 2D convolution is:
1) Filter horizontally, storing to an intermediate buffer.
2) Filter vertically and store the final output.

This patch merges the two phases for 4-tap standard bitdepth 2D
convolution to avoid storing to and re-loading from the intermediate
buffer - giving a 10-25% speedup depending on block size. Merging the
passes for 8-tap filters does not have the same benefit, so keep the
existing implementation.

Change-Id: Ic6008836d1a499ee2cd957b9db194fca5671ccb4
2024-02-26 22:28:05 +00:00
Jonathan Wright d191c5f984 Remove redundant code for neon_i8mm 2D convolution
Remove the 4-tap Neon i8mm path for the horizontal pass of 2D
convolution since it has been made redundant by the horizontal-
vertical merged implementation. Also move the 8-tap path closer to
where it is used and call it explicitly rather than the filter-
agnostic wrapper.

Change-Id: Icddecb7e133656c54aa5e79536b49759715b6fcb
2024-02-26 20:59:41 +00:00
Jonathan Wright cef5b0da97 Merge h. and v. passes in 4-tap SBD Neon i8mm 2D convolution
The current SBD Neon i8mm approach to 2D convolution is:
1) Filter horizontally, storing to an intermediate buffer.
2) Filter vertically and store the final output.

This patch merges the two phases for 4-tap standard bitdepth 2D
convolution to avoid storing to and re-loading from the intermediate
buffer - giving a 5-40% speedup depending on block size. Merging the
passes for 8-tap filters does not have the same benefit, so keep the
existing implementation.

Change-Id: Ic8ec2822681176ef879dcaf8424d8d91c5e8d2df
2024-02-26 20:59:41 +00:00
James Zern a3209600f2 codec_factory.h: fix -Wpedantic warnings
With either CONFIG_VP8=0 or CONFIG_VP9=0. Fixes a warning about an extra
';' outside of a function due to VP[89]_INSTANTIATE_TEST_SUITE() being
defined to nothing.

Change-Id: I1878d7596e39c5166efbe96450a733efc08665ea
2024-02-26 20:52:35 +00:00
Jerome Jiang b5578f1283 Add inter/intra_pred_err to VpxTplBlockStats
inter/intra_cost in VP9 TPL is calculated with SATD
which should be close enough to be used as inter/intra_pred_err

Bug: b/326262148
Change-Id: Ic0fd08708fcf3640398fc22a1a6bb6f449b2a9b8
2024-02-26 12:27:38 -05:00
Jerome Jiang ff9591f8df vp9 ext rc: assign srcrf_dist/rate instead
Bug: b/326262148
Change-Id: I3af0b5d28c58447862eb11d5b10afa8a32d82ada
2024-02-26 17:27:11 +00:00
James Zern 5433b943a4 resize_test.cc: fix warning w/CONFIG_VP9=0
fixes -Wunused-but-set-variable

Change-Id: Id9431342745baa1492f5da0e32d09372e10fdcd2
2024-02-24 00:53:28 +00:00
James Zern fca3d1755f fix void param declarations
These should be funcname(void) rather than funcname(). Quiets some
-Wstrict-prototypes warnings.

Change-Id: I68705fe53f4438c9584e7040c39cecec859af27c
2024-02-22 15:13:03 -08:00
James Zern 5e90a97fa2 tokenize.h: remove undefined vp8_tokenize_initialize()
It was removed in:
f039a85fd Make global data const

Change-Id: Ib5aa35500c3ee7caf1ec216e0351c32ef373f5f2
2024-02-22 13:33:26 -08:00
Marco Paniconi 79284f4c84 vp8: add uv_delta_q support to external RC
Bug: b/321137490

Change-Id: Id9ccf8e80d693b296b224846094fc7c0f71c5d0a
2024-02-22 17:31:40 +00:00
James Zern 1659e73b0b vp9_context_tree.h: add name to union
Anonymous unions are not supported in C99, they were added in C11:
https://en.cppreference.com/w/c/language/union

Fixes -Wpendantic warning:
vp9/encoder/vp9_context_tree.h:93:4: warning: ISO C99 doesn’t support
  unnamed structs/unions [-Wpedantic]

Change-Id: Ibd29d6deca35d81ea886e80e9f44575c73ecd96d
2024-02-21 23:15:19 +00:00
James Zern 5d022e45ec vp9_rdopt,skip_iters: normalize use of const
Fixes a -Wpedantic warning:
vp9/encoder/vp9_rdopt.c:1988:20: warning: invalid use of pointers to
  arrays with different qualifiers in ISO C before C2X [-Wpedantic]

Change-Id: I581e21d7e59c0bae0e44056a3b3f049c5a4e7cf2
2024-02-20 13:56:59 -08:00
Gerda Zsejke More 9c0c5144e7 Add SVE implementation of vpx_highbd_convolve8_horiz
Add SVE implementation of vpx_highbd_convolve8_horiz function. Add
the corresponding tests as well.

Change-Id: I0b2815831daf203e167ea5289307087ce53ff9da
2024-02-20 19:14:56 +00:00
Jonathan Wright 7e9da9702c Use Armv8.0 Neon 4-tap vertical convolution for all arch levels
The new Armv8.0 Neon implementation of 4-tap vertical convolution is
faster than Armv8.4 DotProd and Armv8.6 I8MM implementations. This
patch removes the DotProd and I8MM implementations in favour of using
the Armv8.0 version everywhere.

Change-Id: I126470fd4862d8bb116153e90bb2e4f2f2dba1e4
2024-02-20 15:22:35 +00:00
Jonathan Wright 9f7a70bdf2 Further accelerate Armv8.0 Neon 4-tap convolution
Refactor Armv8.0 Neon 4-tap convolution functions to operate on 8-bit
types directly, rather than first widening to 16-bit.

2-tap (bilinear) filter values are always positive, but 4-tap filter
values are negative on the outer edges (taps 0 and 3), with taps 1
and 2 having much greater positive values to compensate. To use
instructions that operate on 8-bit types we also need the types to be
unsigned. In the convolution kernel, subtracting the products of taps
0 and 3 from the products of taps 1 and 2 always works since 2-tap
filters are 0-padded.

Co-authored by: Hari Limaye <hari.limaye@arm.com>

Change-Id: I87b32e2ef8cbd21eebb8cd2642e8826b704905b1
2024-02-20 15:22:22 +00:00
Wan-Teh Chang 4340382bb0 Move THREADFN macro definitions to vpx_pthread.h
The THREADFN and THREAD_EXIT_SUCCESS macros are used to define the
thread start routines passed to our implementation of pthread_create(),
so it makes sense to define these macros in vpx_util/vpx_pthread.h. This
also allows the VP8 and VP9 code to share the macro definitions.

Replace the THREAD_FUNCTION macro by THREADFN. They have the same
definition.

Change-Id: I79a7476e43652667af6a8da7ad7ce346b1b6b024
2024-02-16 09:46:39 -08:00
Wan-Teh Chang 4e384da53d Delete a duplicate definition of thread_sleep()
There are two identical definitions of thread_sleep() for Win32. Delete
the first one.

Change-Id: I617e180e3459a24fbafec5b060bbdcd4fcee8128
2024-02-15 20:31:25 -08:00
Wan-Teh Chang 3316c11240 Delete unused macro definitions
Change-Id: Ic12d5b9ec9b18743e8ef67d132ed3bbbc90c7fa6
2024-02-15 17:04:32 -08:00
Wan-Teh Chang d63efe0679 Handle EINTR from sem_wait(&cpi->h_event_end_lpf)
sem_wait() may be interrupted by a signal and fail with EINTR:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sem_wait.html

Retry the sem_wait(&cpi->h_event_end_lpf) call if it fails with EINTR.

Bug: chromium:324459561
Change-Id: Icc957e8b9f21f25ec3c95e22cab502af417443f2
2024-02-16 00:14:40 +00:00
Jerome Jiang e1da3834ba Add base qp to ext rc config
Change-Id: I0eb7e0dbe3d1784c4408fdddf763d2b64c90fbb5
2024-02-15 13:08:46 -05:00
Peter Kasting e92dd05124 Add VPX_WORKER_STATUS_ to values of global-scope status enum.
This helps prevent name clashes if code e.g. #includes headers from both
libvpx and libaom.

Bug: none
Change-Id: Ifc9e7ac4862dc04a399e7777d2636e1453627970
2024-02-14 20:37:40 -08:00
Peter Kasting 4c0cf7458c Split pthread wrapper to vpx_pthread.h.
Also does a bit of cleanup to the THREAD macros as suggested in review.

Bug: none
Change-Id: I1fbfacf99b2439ac1147e346e53d72d7ee39c298
2024-02-14 18:54:43 +00:00
Jerome Jiang b01d61c9af Remove unused signals for get_encodeframe_decision
Bug: b/323234722
Change-Id: Iab5c27b232552f924b05fdd7fa1cd6792e04faed
2024-02-14 10:46:18 -05:00
Jerome Jiang 591c787436 vp9 ext rc: Remove initializer for gop_decision
Change-Id: Ie4ebcc39ab8c34631395ce81e2916c766c3a7f13
2024-02-13 23:21:18 +00:00
Jonathan Wright 455cb26998 Optimize Arm Neon USDOT narrowing sequences in convolve kernels
Currently we use two rounds of complex right-shift operations to
narrow and pack results from the dot-product convolution kernels.
This patch refactors these sequences to use one "simple" right-shift
and one complex right-shift - reducing the latency by 4 cycles on
modern out-of-order Arm CPUs.

Change-Id: I3fd38560bb14d85826e417f40d35f11165ab80da
2024-02-13 19:58:25 +00:00
Jonathan Wright 939bcd4026 Optimize Arm Neon SDOT narrowing sequences in convolve kernels
Currently we use two rounds of complex right-shift operations to
narrow and pack results from the dot-product convolution kernels.
This patch refactors these sequences to use one "simple" right-shift
and one complex right-shift - reducing the latency by 4 cycles on
modern out-of-order Arm CPUs.

Change-Id: I908147ed65a87157009363782399ff398406cdf9
2024-02-13 19:58:25 +00:00
Jerome Jiang a64bf87fb9 Fix gop decision and gop index in TPL pass
- Initialize gop_decision
 - Initialize GF group for a new one
 - GF group index for key frame special treatment is not needed any more
   when key frame is decided by the RC

Bug: b/323050877
Change-Id: Iaf36ea4f671b833f3ba4c524b9799a3093412dfa
2024-02-13 18:01:20 +00:00
Peter Kasting 8cf26c1284 Backport thread-related changes from libaom.
This ports changes that touched aom_thread.[c,h] from the time after
libaom copied libvpx' sources, where they hadn't already been present.
The goal here is to unify the two repos' thread implementations in hopes
of ultimately sharing one.

The list of commits is approximately as follows; however, I made a few
other changes as necessary where noted.
https://aomedia-review.googlesource.com/c/aom/+/64044
  Edited other hook func return values similarly.
https://aomedia-review.googlesource.com/c/aom/+/71321
https://aomedia-review.googlesource.com/c/aom/+/71327
https://aomedia-review.googlesource.com/c/aom/+/71436
https://aomedia-review.googlesource.com/c/aom/+/72481
  Also removed conflicting MAX_NUM_THREADS definition of 80. I think
  this was incorrect as the relevant array was indexed by variables that
  were in turn controlled by the global config values that were clamped
  to <=64.
https://aomedia-review.googlesource.com/c/aom/+/102621
  Also removed a pre-XP handling block in
  vp8/common/generic/systemdependent.c.
https://aomedia-review.googlesource.com/c/aom/+/102601
  MAX_DECODE_THREADS was the only relevant piece.
https://aomedia-review.googlesource.com/c/aom/+/102741
https://aomedia-review.googlesource.com/c/aom/+/109025
https://aomedia-review.googlesource.com/c/aom/+/160961
https://aomedia-review.googlesource.com/c/aom/+/169684
  Also removed OS/2 support from elsewhere.
https://aomedia-review.googlesource.com/c/aom/+/169823
https://aomedia-review.googlesource.com/c/aom/+/170022
https://aomedia-review.googlesource.com/c/aom/+/169685
https://aomedia-review.googlesource.com/c/aom/+/173761
https://aomedia-review.googlesource.com/c/aom/+/174842

Bug: none
Change-Id: I91462873a57e9efa120288d1bd8af3a6c09d423d
2024-02-12 18:45:00 -08:00
Jonathan Wright 491c16a9f3 Merge horiz. and vert. passes in HBD Neon 2D avg convolution
The current Neon approach to 2D convolution is:
1) Filter horizontally, storing to an intermediate buffer.
2) Filter vertically, average with the dst block and store the final
   output.

This patch merges the two phases for high bitdepth 2D convolution to
avoid the storing and re-loading from the intermediate buffer. This
provides a small gain (<5%) for large block sizes but the benefit
increases for small block sizes - as the proportion of compute to
memory access decreases. These effects are amplified further when
considering little (in-order) core performance.

Change-Id: I84f1cafcfbbfa48b2cfe4b20881da9c4bc3b56ac
2024-02-12 13:22:19 +00:00
Jonathan Wright 364326c37f Merge horiz. and vert. passes in HBD Neon 2D convolution
The current Neon approach to 2D convolution is:
1) Filter horizontally, storing to an intermediate buffer.
2) Filter vertically and store the final output.

This patch merges the two phases for high bitdepth 2D convolution to
avoid the storing and re-loading from the intermediate buffer. This
provides a small gain (<5%) for large block sizes but the benefit
increases for small block sizes - as the proportion of compute to
memory access decreases. These effects are amplified further when
considering little (in-order) core performance.

Change-Id: I8ec13fb9edd642fdb927bf5394a3c2a349d22a29
2024-02-12 12:58:45 +00:00
Jonathan Wright 58731e2b7a Specialise highbd Neon 2D horiz convolution for 4-tap filters
Add a highbd Neon implementation of the horizontal portion of 2D
convolution specialised for executing with 4-tap filters. This new
path is also used when executing with bilinear (2-tap) filters.

Change-Id: I513e35c4f8857bc89e0def5e9402bc31ddd46440
2024-02-09 17:05:47 +00:00
Jonathan Wright 3127962e71 Specialise highbd Neon vert convolution for 4-tap filters
Add a highbd Neon implementation of vertical convolution specialised
for executing with 4-tap filters. This new path is also used when
executing with bilinear (2-tap) filters.

Change-Id: I30469c7b8e6ccff31d96588a3e4c21b401f1ed09
2024-02-09 15:37:51 +00:00
Jonathan Wright 70b14bf4dc Specialise highbd Neon horiz convolution for 4-tap filters
Add a highbd Neon implementation of horizontal convolution specialised
for executing with 4-tap filters. This new path is also used when
executing with bilinear (2-tap) filters.

Change-Id: Icabeea295af3e0bbeda755168996668cb960b0de
2024-02-09 15:37:51 +00:00
Jonathan Wright b1c9bbeaae Remove unneeded assert in vpx_filter.h
Filter tap reporting was made more granular recently[1] to enable Arm
Neon optimizations that specialise convolution implementations
according to the filter size. This patch removes an assert that
should have been removed during that change - it no longer serves any
purpose to assert that the filter being used is a no-op filter.

This change is a pre-requisite for some highbd Neon convolution
changes that specialise implementations according to filter size.
(Without this change a convolve-copy test would fail should we
interrogate the size of the filter.)

[1] https://chromium-review.googlesource.com/c/webm/libvpx/+/5063929

Change-Id: I2a71680d27134535e6c0663b1668ba1b150b1a6f
2024-02-09 15:29:18 +00:00
Jonathan Wright 00135942da Add 2D-specific highbd Neon horizontal convolution function
2D 8-tap convolution filtering is performed in two passes -
horizontal and vertical. The horizontal pass must produce enough
input data for the subsequent vertical pass - 3 rows above and 4 rows
below, in addition to the actual block height.

At present, all highbd Neon horizontal convolution algorithms process
4 rows at a time, but this means we end up doing at least 1 row too
much work in the 2D first pass case where we need h + 7, not h + 8
rows of output.

This patch adds an additional Neon path that processes h + 7 rows of
data exactly, saving the work of the unnecessary extra row.

Change-Id: Id6658b4e9e774effc760ff131e188b6907a57676
2024-02-09 10:38:12 +00:00
Jonathan Wright 08eb51bc1a Call scalar impl. immediately from HBD Neon 2D convolution
Call scalar C implementation of 2D convolution immediately if scaling
is required - instead of entering the Neon functions for the
horizontal and vertical passses and then falling back to the scalar
implementation. This has the benefit of being able to allocate a
smaller intermediate buffer.

Change-Id: Icacdd5f3a1401395951b613da1cd6932955bd0f8
2024-02-09 10:37:19 +00:00
Jonathan Wright ef3fd00c27 Refactor Neon highbd 2D convolution definitions and merge files
There's no reason for these files to be separate, and merging them
will make life easier in subsequent commits adding a horizontal pass
specialised for the first pass of 2D.

Also perform some refactoring for 2D convolution definitions:
- Add a comment deriving the intermediate buffer height.
- Align the intermediate buffers to 32 bytes.

Change-Id: Ib92524396e6f9c58295339de54d08d894ace3bd1
2024-02-08 17:49:45 +00:00
Jonathan Wright 72cc21e3a2 Refactor SBD Armv8.0 Neon horizontal convolve8 paths
Mostly a cosmetic change:
1) Remove forward declarations.
2) Remove excessive prefetches.

Change-Id: I88d42d8f9ee828c6c4095ffaec8e0333d776a4a1
2024-02-08 09:44:33 +00:00
Jonathan Wright 81ce6067cc Refactor SBD Armv8.0 Neon vertical convolve8 paths
Mostly a cosmetic change:
1) Remove forward declarations.
2) Remove excessive prefetches - some of which were wrong, prefetching
   data that had just been loaded.

Change-Id: I17d8accc2abf3a9b2050603f859fce588a1f7178
2024-02-08 09:44:19 +00:00
James Zern e32f9d4139 configure: remove profile from CONFIG_LIST
CONFIG_PROFILE is unused currently. The option can still be selected
because it is in the CMDLINE_SELECT list and interpreted by configure
directly.

Bug: webm:1835
Change-Id: Id9667289113335a10018803f578b255967bd60b1
2024-02-08 02:49:44 +00:00
James Zern 8408251f47 README,cosmetics: break some long lines / fix whitespace
+ normalize configure commands

Change-Id: Id21ebca85e7e8e4df128e986d4f4ec33c7f1483f
2024-02-07 19:24:45 +00:00
Jonathan Wright 96b64eaac5 Refactor Neon highbd_convolve8 kernels
Move narrowing shift and max value clipping into the 4-pixel-output
kernel. As well as cleaning up the code quite a bit, this also
improves performance by 5-10% as it eliminates the implied top /
bottom register shuffling of the previous approach.

Also clean up the formatting and magic numbers in the 8-pixel-output
kernel.

Change-Id: I77a5e9e317ef4097f187330d4b32973022ba573f
2024-02-07 00:35:02 +00:00
Jonathan Wright 18bc7ffe59 Optimize vpx_highbd_convolve8_horiz_avg_neon
Avoid transposes before and after convolution kernels by using extra
loads.

Change-Id: Iddee4752d7f9ed644502176ed863742fa77fe5a6
2024-02-07 00:34:19 +00:00
Jonathan Wright 04c8813a2c Optimize vpx_highbd_convolve8_horiz_neon
Avoid transposes before and after convolution kernels by using extra
loads.

Change-Id: I20c622fcb208e83534d604af50a58ba5ac472264
2024-02-07 00:33:55 +00:00
Wan-Teh Chang a0f3eb8ce4 Delete a useless clamp(q, x, y) call
In https://chromium-review.googlesource.com/c/webm/libvpx/+/71356, the
statement
  clamp(q, active_best_quality, active_worst_quality);
was added to rc_pick_q_and_bounds_two_pass() (recently renamed
vp9_rc_pick_q_and_bounds_two_pass()).

The result of the clamp() call is not used, so the clamp() call has no
side effect.

Fix Coverity CID 1577645 Useless call:
  side_effect_free: Calling
  clamp(q, active_best_quality, active_worst_quality) is only useful for
  its return value, which is ignored.

Change-Id: I014c3e4caf2bc999fe480000acc4e49e7ad15aaf
2024-02-06 23:31:27 +00:00
Jerome Jiang f5e1a0ab7e Include headers to fix clang-tidy complaints
Change-Id: I7fd2a10b4775e7e7fca49339832c257d84d99e33
2024-02-06 22:26:21 +00:00
Jonathan Wright 6c00356485 Refactor vpx_highbd_convolve8_avg_vert_neon
Various bits of tidying up to make the code more compact:
- Use appropriate load/store helper functions from mem_neon.h.
- Remove variable forward declarations.
- Use != 0 instead of > 0 in loop termination tests.
- Remove excessive prefetches.

Change-Id: I114cf4d2a34f02acc130558d125d2c191c6c5992
2024-02-06 21:24:27 +00:00
Jonathan Wright 01edfb3df4 Refactor vpx_highbd_convolve8_vert_neon
Various bits of tidying up to make the code more compact:
- Use/create appropriate mem_neon.h load/store helper functions.
- Remove variable forward declarations.
- Use != 0 instead of > 0 in loop termination tests.
- Remove excessive prefetches.

Change-Id: Ida7d3c4a3fe084600417f196baa26501c6e2d45a
2024-02-06 21:24:27 +00:00
Jonathan Wright de7883604f Init using 0-vector instead of load-broadcast in mem_neon.h
Initialise result vectors of mem_neon.h helpers with vdup_n_<type>(0)
instead of load-broadcast of the first loaded elements. The former is
more easily optimized by modern compilers.

Change-Id: If967e2bb55523670c3e433dd66d060665e13b4f2
2024-02-05 21:40:36 +00:00
Jonathan Wright a7a853c3a2 Remove stride width == 4 tests in mem_neon.h helpers
This condition is only ever true in unit tests. It does not benefit
real usage scenarios.

Change-Id: I0c1b09b0b371cfe99ba1e26aba57740a67434070
2024-02-05 21:40:36 +00:00
Jonathan Wright 4084250ccd Align intermediate buffers for 2D Neon convolutions
Align the intermediate buffers to 32 bytes and always use a stride of
64, regardless of the actual data block width.

Change-Id: I738eaa711168bc8231d8ac54d9e5e5e87b62e703
2024-02-05 21:40:36 +00:00
Zoltan Kuscsik c6a8fa27b7 Added documentation on PGO for optimization analysis
tools/README.pgo.md: documentation added

Bug: webm:1835
Change-Id: Iad72ca63fd143a1c36c7347f723578d11158e81b
2024-02-05 21:12:01 +00:00
Zoltan Kuscsik 7eec109a83 Add profile guided optimization support
Tested on x64/ARM64.

To generate a new profile
$ export CC=clang
$ export CXX=clang++
$ ./libvpx/configure --enable-encode_perf_tests --enable-profile

Using the profile:

$  make clean
$  llvm-profdata  merge  -o perf.profdata  default_xxx_0.profraw
$ ./libvpx/configure --use-profile=perf.profdata

Bug:webm:1835
Change-Id: I8ab53fef1f8e2cc98c3b0f5c0f50eece5466965d
2024-02-05 21:12:01 +00:00
Gerda Zsejke More 58fb0f1d27 Add SVE implementation of vp9_block_error_fp
Add SVE implementation of vp9_block_error_fp function. Add the
corresponding tests as well.

Change-Id: I81f4b11bd2f1d0b9f377553bb9298d735308da30
2024-02-05 21:09:18 +00:00
Gerda Zsejke More a9d91d7a0a Add SVE implementation of vp9_block_error function
Add SVE implementation of vp9_block_error function. Add the
corresponding tests as well.

Change-Id: Iebba73ee845855be939e120326e1005237230c2a
2024-02-05 21:09:18 +00:00
Gerda Zsejke More 075569f3a5 Add SVE implementation of vpx_sum_squares_2d_i16
Add SVE implementation of vpx_sum_squares_2d_i16 function. Add the
corresponding test as well.

Change-Id: If3b31c9882e2b7bed0106011efb0bb5522de7008
2024-02-05 21:09:18 +00:00
Jerome Jiang 1258773dc2 Ext rc: Remove max_frame_size from frame decision
Add rdmult to the frame decision as RC can return this information, and
we may want to use it in the future.

Bug: b/323234722
Change-Id: I8ddb7038073d89af1ef84932448b1abaf1937cee
2024-02-05 14:21:29 +00:00
Wan-Teh Chang a9bd789d24 Delete #if USE_PARTIAL_COPY code
The USE_PARTIAL_COPY macro was added in
https://chromium-review.googlesource.com/c/webm/libvpx/+/51505 and
the location of #if USE_PARTIAL_COPY was slightly adjusted in
https://chromium-review.googlesource.com/c/webm/libvpx/+/73600.

Delete the unused function vp9_copy_and_extend_frame_with_rect().

Change-Id: I160b312177ba2fabbea2638172af37f8144d60b1
2024-02-02 18:16:09 +00:00
Jonathan Wright c35f3e9e35 Cosmetic: Refactor Arm Neon i8mm convolution functions
Tweak some comments and remove forward declarations.

Change-Id: I6eb01621cee838f29981853ee1ef615947e05563
2024-02-02 00:24:06 +00:00
Jonathan Wright 224f2dc82a Refactor Arm Neon DotProd convolution functions
This change was intended to be cosmetic in that it tweaks some
comments, removes forward declarations and moves some constant
declarations into the kernels where they're used. However, it also
adds some performance for 8-tap vertical convolution paths as it
appears removing forward declarations also removes some false loop-
carried dependencies that the compiler wasn't able to figure out.

Change-Id: Ic58658b10fbe8378062920199819359d2df008de
2024-02-02 00:24:06 +00:00
Jerome Jiang 3b1039c822 Rewrite ext RC test
The updated test will validate the QP / frame type / ARF settings by the
rate controller and callbacks, making sure the callbacks are working as
expected.

Removed the old tests that verify the signals from the encoder, which
are not needed any more.

Change-Id: Ida3c484e2ac520f3e81358d7cbf7918abfdaca54
2024-02-01 12:29:35 -05:00
Jerome Jiang 9aefcb317a Ext RC: remove gop_info parameter
This is not used any more

Bug: b/323234722

Change-Id: I74bbed38a4a23f2aec8e05413754565e67437e9e
2024-01-31 21:08:07 -05:00
Jerome Jiang 91bc8ec56a vp9: Set VPX_FRAME_IS_INVISIBLE for no show frame
Detect if the frame is arf without parsing bitstream.

Change-Id: I3dd70369ef156508624c45591302b682b1785fa8
2024-01-31 21:07:07 -05:00
Jerome Jiang 861981b135 Allow external RC to control key frame
Disable some tests because they rely on vpx_rc_gop_info_t
which isn't populated when the callback is used for key frame

This parameter will be deleted / cleaned up in the follow-up.

Bug: b/323050877
Change-Id: If1c0476eac8d324c8d5a460bfc9afdb6d93aacdf
2024-01-31 22:17:06 +00:00
Jerome Jiang 56b67113d0 Move vp9_estimate_qp_gop to vp9_tpl_model.c
vp9_estimate_qp_gop is only used for TPL
Rename to vp9_estimate_tpl_qp_gop

Change-Id: I87246f72e90174bf3ba3bf8e1061f5f31edfddff
2024-01-30 19:49:31 -05:00
Jerome Jiang 8630b18323 Fix gf group index used in TPL pass for WebM RC
Change-Id: Ia781caf2de550015822ef5c954b36314ba8a2942
2024-01-30 23:19:00 +00:00
James Zern 7ad5f4f695 vp9_scale_and_extend_frame_ssse3: fix uv width/height
Use uv_crop_(width|height). This fixes an issue with 1 to 2 scaling from
1x1 where the unrounded value would go to zero, resulting in a heap
overflow. This path is only executed when the library is built without
--enable-vp9-highbitdepth.

Bug: b:319964497
Change-Id: I9cb6632f864ec54c045608af86aede20657d6253
2024-01-30 20:50:56 +00:00
James Zern ef09c2e1a4 vp9_encoder.c: make vp9_svc_twostage_scale static
Change-Id: Id7fa33df3f45e46968869ec15a6892c79aac263c
2024-01-30 20:50:33 +00:00
James Zern adac06ace7 vp9_scale_references: condense hbd #if
Change-Id: I6f1d85885b6bdced3925f86da0a60421a6058e91
2024-01-30 20:50:16 +00:00
Jonathan Wright 6cf6e1f082 Simplify Armv8.4 DotProd correction constant computation
Simplify the computation of the Armv8.4 DotProd convolution
correction constant. Summing 128 * filter_tap[0,7] is always the same
as 128 * 128 since the filter taps always sum to 128.

Change-Id: I227ba47ae47bed8304a695a2395bcc85f33c245c
2024-01-30 11:02:37 +00:00
Jonathan Wright fd6b80b153 Move Neon dotprod and i8mm convolution kernels into .c files
Move the convolution kernels using Armv8.4 dotprod and Armv8.6 i8mm
instructions into the respective .c files. These kernels are only used
in the respective .c files so it isn't useful for them to be declared
in a header.

This change also removes the need for feature-macro guarding - which
wasn't being done correctly for MSVC (since Microsoft's Arm
architecture feature macros are named differently to those defined by
GNU-compliant compilers.)

Bug: webm:1838
Change-Id: I495fca2a982c34978b6c9102f144bb9c45352a9a
2024-01-29 15:46:06 +00:00
Jonathan Wright 189c135d5d Merge Arm Neon dotprod and i8mm convolution files
Move the Arm Neon dotprod and i8mm 2D convolution functions into the
appropriate vpx_convolve8_neon_[dotprod|i8mm].c file. Only the
Armv7/Armv8.0 Neon files needed to be split in this way to allow
linking against a handwritten assembly implementation of the kernels
for Armv7 builds.

Change-Id: Ifc363556c3961aa78b9e53761537d4816c5b9964
2024-01-29 15:43:50 +00:00
James Zern 433577ae31 Update third_party/libwebm to commit affd7f4
This is one commit after the libwebm-1.0.0.31 tag:
affd7f4 In MakeUID(), call rand() under #ifdef _WIN32

Change-Id: I5979a8cd3b064d4f4f0dbeca9f84f6791e593b47
2024-01-27 03:02:10 +00:00
Marco Paniconi 2edd69749f Pass the aligned width/height in lookahead_push
Also use the crop_width/height for the setting
of larger_dimensions.

Change-Id: I6b3a3e49944b17f7b51f0705d7a95c2a43255f8c
2024-01-26 20:19:40 +00:00
Jonathan Wright fed0dfe965 Allow SVE variance functions to be called from Neon subpel var
Call indirect RTCD high bitdepth variance functions (instead of the
Neon functions) in the high bitdepth Neon subpel variance paths so
that faster SVE variance functions can be used on CPUs where SVE is
supported.

Change-Id: I04bdef235afac06f2100df0cbaccfb8caef41ac7
2024-01-26 00:16:50 +00:00
Gerda Zsejke More 33ef1caf2f Add SVE implementation of HBD get<w>x<h>var functions
Add SVE implementation of get<w>x<h>var functions for 8-, 10-, 12- bit
depth. Add the corresponding tests as well.

Change-Id: Id4feb8726a3eb0a963e3dd8932ee52374a67da48
2024-01-25 20:58:29 +00:00
Gerda Zsejke More 0e23256348 Enable HBDGetVariance test for different implementations
Enable HBDGetVariance test for Neon and SSE2 implementations.

Change-Id: I77dcf0243784e79b21d956f3899903e2e13a545a
2024-01-25 20:58:29 +00:00
Gerda Zsejke More c43ec846f3 Enable GetVariance test for different implementations
Enable GetVariance test for Neon, Neon Dotprod, SSE2, MSA, VSX
implementations.

Change-Id: Ia6f42af5ef99ad1bc6319cdb46e6bd164f7eea94
2024-01-25 20:58:29 +00:00
Gerda Zsejke More 95d0fcae01 Add unit tests for vpx_get<w>x<h>var functions
Add standard and high bitdepth unit tests for vpx_get<w>x<h>var
functions. Enable these unit tests for the C implementation.

Change-Id: I8716fd6a9718dab3eef218a8a60a1efd4c0e316c
2024-01-25 20:58:29 +00:00
Wan-Teh Chang 989c393b2b Initialize members in VP8/VP9RateControlRTC ctors
Fix Coverity defects CID 1568604 and CID 1568615 (Uninitialized pointer
field). Since the constructors are private and the Create() factory
methods set the cpi_ pointer field, these two Coverity defects are
harmless.

Define the constructors with "= default" instead of "{}".

Change-Id: Ie6b45fce66c23941a9a5c38ee0bccbc4b7d3a2a2
2024-01-24 14:04:24 -08:00
Gerda Zsejke More d84436d533 Add SVE implementation of HBD variance functions
Add SVE implementation of variance functions for 8-, 10-, 12- bit
depth. Add the corresponding tests as well.

Change-Id: I785d85760ad4346cbfbf0f842784b4945870afee
2024-01-22 22:57:55 +00:00
James Zern 0f6a274964 vp9_ratectrl.c: add missing include for INTER_LAYER_PRED_ON
clears a clang-tidy warning

Change-Id: Ie5b8825ef645658304252b0d0554cdefa3de26c2
2024-01-22 20:21:06 +00:00
James Zern 43e1c8bf10 encode_api_test,RandomPixelsVp8: fix stack overflow
Observed when built using Visual Studio 2019.

Move 720P image allocation to the heap.

Bug: webm:1831
Change-Id: I4e343af08d2f282618ad1b328a39d7dba5e79654
2024-01-22 18:04:03 +00:00
Wan-Teh Chang eeb1be7f23 Support VPX_IMG_FMT_NV12 in vpx_img_read/write
read_yuv_frame() supports VPX_IMG_FMT_NV12. Port its code to
vpx_img_read() and vpx_img_write().

The code in vp9/simple_encode.cc, including img_read(), doesn't support
VPX_IMG_FMT_NV12. Check before the vpx_img_alloc() calls and abort the
process if the image format is VPX_IMG_FMT_NV12.

Bug: chromium:1510090
Change-Id: Ie77e29c2c9ee7a01e6a59c8ad3cbcc769d9f2d4c
2024-01-19 11:48:46 -08:00
Wan-Teh Chang d3a946de8c Make img_alloc_helper() fail on VPX_IMG_FMT_NONE
If fmt is VPX_IMG_FMT_NONE, currently img_alloc_helper() allocates a
single plane because VPX_IMG_FMT_NONE (0) is not a planar format (the
VPX_IMG_FMT_PLANAR bit is not set in VPX_IMG_FMT_NONE).

Although this seems correct, the problem is that most of the code in
libvpx assumes planar formats and is likely to dereference a null
pointer when it uses img->planes[1]. Also, VPX_IMG_FMT_NONE isn't really
a valid image format. So it is safer to make img_alloc_helper() fail if
fmt is VPX_IMG_FMT_NONE.

Change-Id: I05b47f4b5eceb631a02384b2cce1c2f6fdca8673
2024-01-19 19:43:26 +00:00
James Zern db6a5c09ce README: remove library version
This often falls out of sync with the release and the version is already
contained in CHANGELOG.

Bug: webm:1833
Change-Id: Ieee6ca40249bf6e77037fbec30d87b109ca8fe21
2024-01-18 15:44:19 -08:00
Jerome Jiang 2dead7118a Merge tag 'v1.14.0'
Release v1.14.0 Venetian Duck

2024-01-18 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 interger 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.

Change-Id: I9c27fb2b917f9b80ed4bcc5cb3b4f87c56b62c2f
2024-01-18 12:33:56 -05:00
Gerda Zsejke More 71a5cb6e8a Add SVE implementation of HBD MSE functions
Add SVE implementation of MSE functions for 10-, 12- bit depth. Add
the corresponding tests as well.

An implementation was not added for 8 bit depth as the Neon DotProd
version is faster than the SVE implementation.

Change-Id: I0c5712ba2735a2879a0aa3a9a52980032fddc7a6
2024-01-17 21:38:54 +00:00
Marco Paniconi b95d175726 vp9-rtc: Fix to reset on scene change for temporal layers
Revert the part of the fix regarding temporal layers in:
https://chromium-review.googlesource.com/c/webm/libvpx/+/5191480

Keep it as it was for now until further testing.

Change-Id: If747aabf907ba93cc20bcc067d2ca8f7758a91dd
2024-01-17 18:33:32 +00:00
Gerda Zsejke More e001eeb5bc Enable Neon Dotprod impl for HBD MSE
Enable Neon Dotprod 8-bit high bitdepth implementation for MSE
function as it is now not called with bit depth 10 or 12.

Bug: webm:1819
Change-Id: I9d1d506401aa0523fba2d8ea4978dc00fdacbb95
2024-01-17 18:15:17 +00:00
Gerda Zsejke More 41e0655e5e Fix highbd_get_block_variance_fn input parameter
Instead of always calling highbd_get_block_variance_fn with bit depth
8 use the macroblock's bit depth.

Bug: webm:1819
Change-Id: Ib4b19703384e897ee9ffeef73a11a8af2d262558
2024-01-17 18:15:17 +00:00
Marco Paniconi 25f03e456f vp9-svc: Fix to sample encoder for mismatch check
Don't check for mismatch for superframes whose
top spatial layer resolution was dropped.

Change-Id: I0abef43a710f0fb52ba2490fc784e57cda9952a0
2024-01-16 19:49:06 +00:00
Marco Paniconi cc306fac74 vp9-svc: Fix to max-q on scene change for svc
For svc with no inter-layer prediction: reset
the RC and force max_qp on all spatial layers
on scene/slide changes. In the current code it was only
reset on current spatial layer because it was assumed
we can predict off lower spatial layer to avoid
prediction across scene change. But this does not apply
when inter-layer prediction is off on delta frames.

Also reset only up to current temporal layer.
Because of the hierarchical prediction structure
only the lower temporal layers need the RC to be reset.

This helps to reduce excessive frame drops for the
full_superframe_drop mode.

Change-Id: I76925681850b82aa7fff7f9b1c1a0a605cf3cf3b
2024-01-16 15:49:10 +00:00
Jerome Jiang 8aeb5848a5 Do not use TPL QP from RC for final encoding
Bug: b/316610379
Change-Id: Ie7c6f8be0132602155102a72a16b2ee94c1c3dbd
2024-01-12 21:26:42 +00:00
James Zern 0eecce72b2 vp9_quantize.c: add missing include for get_msb()
clears a clang-tidy warning

Change-Id: Iaf58775084e758246a8fe0a4828ae954ea95f5b1
2024-01-11 16:33:53 -08:00
James Zern 0a91e18eca vp8_datarate_test.cc: add missing include
for VPX_CODEC_USE_PSNR. This clears a clang-tidy warning. vpx_encoder.h
exports vpx_codec.h so it shouldn't be necessary.

Change-Id: I863b6f8689eeef59cd9eadf3cdc177247a0653f8
2024-01-11 16:30:21 -08:00
Marco Paniconi 43bd567950 vp8: Fix to integer division by zero and overflow
This can happen in the setting of the frame
target size for delta frames, for non-CBR mode
(end_usage != USAGE_STREAM_FROM_SERVER) and with
temporal layers.

In calc_pframe_target_size(): the percent_high
(factor to adjust the target_size) may end up dividing
bits_off_target by total_byte_count. The total_byte_count
is define per layer for temporal layers, so it will be zero
for delta frames if the enhancement layer has never been
encoded before.

Since percent_high is capped to over_shoot_pct, the proposed
fix is to apply this cap if total_byte_count is zero.
Also this CL fixes a few integer overflow issues in setting
the layer target_bandwidth, the recale function, and in
setting target_bits_per_mb.

Unittest is added by Wan-Teh which triggers this issue.

Bug: chromium:1514684

Change-Id: I091158e720ece75d7ab9b7c4d18d30a5783102ab
2024-01-11 23:05:47 +00:00
Gerda Zsejke More aeb4928c68 Add SVE 16-bit dot-product helper functions
Add header file containing helper functions to make use of SVE
dot-product intrinsics via the Neon-SVE bridge.

Change-Id: I6cd198f8202559672817cbc19f890db35c03d3ff
2024-01-11 19:26:52 +00:00
Salome Thirot 0801bfca3f Add -flax-vector-conversions=none to Clang builds
GCC already does not allow implicit vector type conversions by default,
add -flax-vector-conversions=none to Clang builds to have the same
behavior.

Change-Id: I9d1adb836377077cf48818c80fe71025e2d2bdc7
2024-01-11 18:26:28 +00:00
Zoltan Kuscsik e03c9d2a62 Update of get_files.py to support Python3.x
Change-Id: I92aeb2a060338bdfc0083602b837b99181a8421c
2024-01-11 18:25:39 +00:00
Gerda Zsejke More 6ea3b51ec2 Require Arm Neon-SVE bridge header for enabling SVE
Disable SVE feature if arm_neon_sve_bridge header is not supported
by the compiler.

Change-Id: I3f78be2dd95b37b8d51b9f1fceca1f9701535eca
2024-01-11 18:23:46 +00:00
Marco Paniconi 756b29a776 vp8: Fix to race issue for multi-thread with pnsr_calc
Added unitest which triggers the data race in the
bug below, when only C code is forced.

The data race is between the loopfilter and variance
computation from generate_psnr_packet calculation.
Proposed fix is to move the wait for loopfilter thread to
finish up before entering generate_psnr_packet().

Bug: b/266833179.

Change-Id: Id2871c53274be0f404e65601c9a5c98aaead0c72
2024-01-11 00:07:08 +00:00
Wan-Teh Chang aef73b22cb Make encoder know frame size increase from config
Equivalent to the change to av1_change_config() in the libaom CL
https://aomedia-review.googlesource.com/c/aom/+/182413.

Because we call alloc_compressor_data() only if
cm->mi_alloc_size < new_mi_size, this change won't cause
alloc_compressor_data() to be called unnecessarily, unlike the libaom
bug https://crbug.com/aomedia/3526.

Bug: b:317105128
Change-Id: I8a772a1d5c4766846641a6d541a6d861bf76c60f
2024-01-10 21:42:45 +00:00
Wan-Teh Chang c5f8086709 Move VPX_TPL_ABI_VERSION to the ext RC ABI version
The VpxTpl* structs defined in vpx_tpl.h are only used by the external
rate control library. Add a VPX_TPL_ABI_VERSION component to
VPX_EXT_RATECTRL_ABI_VERSION and remove the VPX_TPL_ABI_VERSION
component from VPX_ENCODER_ABI_VERSION.

The current value of VPX_TPL_ABI_VERSION is 2. It is subtracted from
VPX_EXT_RATECTRL_ABI_VERSION and added to VPX_ENCODER_ABI_VERSION so
that the values of those two macros stay the same.

Add a note to explain why VPX_ENCODER_ABI_VERSION has a
VPX_EXT_RATECTRL_ABI_VERSION component.

Change-Id: I680b8522dc04328cd51df6de590fdec75ca88ae8
2024-01-09 21:18:26 +00:00
Hari Limaye 469150a922 configure: add -arch flag when targeting darwin23
Commit db83435 introduced support for configuring for *-darwin23-gcc.
However configuring for *-darwin23-gcc does not currently add the
`-arch` flag to CFLAGS/LDFLAGS, so correct this here.

Change-Id: Ieeda1a5039ad40590dfcdcc6ba615a1d1697d54d
2024-01-09 20:38:58 +00:00
Jerome Jiang 3b3e8b5f29 vp9 ext rc: if->assert, more comment for TPL ctrl
Change if to assertion in vp9_extrc_get_encodeframe_decision

Clarify comment for VP9E_ENABLE_EXTERNAL_RC_TPL that
rc_type | VPX_RC_QP must be non zero for this control to work.

Change-Id: I2c54cf7eda1f0f12f4ff7ac929e8e6a1fdd2215d
2024-01-04 13:49:03 -05:00
Jerome Jiang 1474e3c729 Return error if TPL related interface isn't set
Bug: b/316610379
Change-Id: I391d9ef308a1c2d763b124e451ebb22a05060102
2024-01-03 11:11:41 -05:00
Jerome Jiang f6b7166a2b Clear some clang-tidy complaints
Change-Id: I749c0b2b97f26923fc5e1c1e46a1c017cf25823f
2024-01-02 15:08:06 -05:00
Jerome Jiang bd78034078 Add codec ctrl to control TPL by external RC
Bug: b/316610379
Change-Id: Ic18aad8da35436b3de81b9ddf9359407da522701
2024-01-02 15:24:00 +00:00
Zoltan Kuscsik 655da33b89 Use get_lsb in vp9 and vp8 invert_quant functions
Performance optimization. get_msb utilizes
the compiler/platform specific last significant bit
operator.

Note: 32 bit unsigned assumed, like all get_msb implementations do.
Change-Id: Ib013ad24aa0ea845efeb52aacd448b067edf91da
2023-12-21 14:23:04 +01:00
Jerome Jiang 41ced868a6 Remove VP9E_GET_TPL_STATS
This is never used.
A callback in external rc func was added and used instead.

Change-Id: Iade6f361072f0c28af98904baf457d2f0e9ca904
2023-12-16 20:12:34 +00:00
Wan-Teh Chang df655cf4fb Clarify the comment for update_error_state()
Explain why the encoder init functions cannot call update_error_state().

In vp8/vp8_cx_iface.c, this comment should have been added in
https://chromium-review.googlesource.com/c/webm/libvpx/+/4506609.

Rewrite update_error_state() in vp8/vp8_cx_iface.c to look like the
versions in vp9/vp9_cx_iface.c and av1/av1_cx_iface.c (in libaom).

Change-Id: I3f153d67b8c549ca5ac8ea0cfbcaad4ae705c8e6
2023-12-13 20:46:29 +00:00
Wan-Teh Chang 4fe07a0c41 Return correct error after longjmp in vp8e_encode
After a longjmp() call in vp8e_encode(), call update_error_state() so
that we return the error code and error detail set by the
vpx_internal_error() call.

Change-Id: I1f2428eb1b1f61e46c02604e16a5d44dcf162479
2023-12-13 10:56:28 -08:00
Marco Paniconi 193b151195 Fix to integer overflow in vp8 encodeframe.c
Unit test added.

Bug:webm:1831

Change-Id: Ib85f4f0fbdbebc0b49555f206a36376cea687df6
2023-12-12 22:49:46 +00:00
Hari Limaye a75859c439 Remove redundant comment in convolve8_4_usdot
The function convolve8_4_usdot contains a comment relating to the
SDOT implementation of convolve8, which requires addition of a
correction constant to account for range clamp of the input values.

This is not performed in the i8mm USDOT implementation - so remove the
comment.

Also add some const qualifiers to function arguments.

Change-Id: I10aff560d20403897f708ee293bf873be9c35761
2023-12-12 20:21:38 +00:00
Wan-Teh Chang 7e735cdf43 IWYU: include vp9_scale.h and vpx_codec.h
Fix the following clang-tidy misc-include-cleaner warnings:
vp9/encoder/vp9_encoder.c:
  no header providing "vp9_is_valid_scale" is directly included
  no header providing "VPX_CODEC_CORRUPT_FRAME" is directly included
vp9/vp9_cx_iface.c:
  no header providing "valid_ref_frame_size" is directly included

Change-Id: I20e846f5b14c42c72aaefec0718b4ae9c7eea44a
2023-12-09 00:15:40 +00:00
Wan-Teh Chang 3a88c0c204 Avoid dangling pointers in vp9_encode_free_mt_data
Set cpi->tile_thr_data and cpi->workers to NULL after freeing them.

Change-Id: I46fec5f08a6dd034c8d76828f4d546630442f216
2023-12-08 14:39:18 -08:00
Jerome Jiang fa60c7d9c1 IWYU: include yv12config.h for YV12_BUFFER_CONFIG
Fix clang-tiday warning

Change-Id: Ic4d6739cb933a37168176f6b481afdfd2562acfc
2023-12-07 12:35:30 -05:00
Cheng Chen 1ed56a46b3 Update frame size in actual encoding
Issue explanation:
The unit test calls set_config function twice after encoding the
first frame.
The first call of set_config reduces frame width, but is still within
half of the first frame.
The second call reduces frame width even more, making is less than
half of the first frame, which according to the encoder logic,
there is no valid ref frames, and this frame should be set as a
forced keyframe. This leads to null pointer access in scale_factors
later.

Solution:
To make sure the correct detection of a forced key frame,
we need to update the frame width and height only when the actual
encoding is performed.

Bug: b/311985118

Change-Id: Ie2cd3b760d4a4b399845693d7421c4eb11a12775
2023-12-06 21:46:54 -08:00
Yunqing Wang 50ed636e49 Fix a bug in simple motion search
This change fixed a bug revealed by b/311294795.
In simple motion search, the reference buffer pointer needs to be
restored after the search. Otherwise, it causes problems while the
reference frame scaling happens. This CL fixes the bug.

Bug: b/311294795
Change-Id: I093722d5888de3cc6a6542de82a6ec9d601f897d
2023-12-06 16:50:33 -08:00
Jerome Jiang 585798f756 Set pred buffer stride correctly
Bug: b/312875957
Change-Id: I2eb5ab86d5fe30079b3ed1cbdb8b45bb2dc72a1d
2023-12-06 23:54:31 +00:00
James Zern 2f258fdee1 vp9_frame_scale.c,cosmetics: funnction -> function
Change-Id: I8ecbd52037ff096f5c84c834b193b0a34c55a8b7
2023-12-06 20:45:12 +00:00
Wan-Teh Chang 476d02a2d2 Fix two clang-tidy misc-include-cleaner warnings
no header providing "CONFIG_VP9_HIGHBITDEPTH" is directly included
no header providing "VPX_BITS_8" is directly included

Change-Id: Ie6d78c79ab462501417f2b451bbe808a1fdce931
2023-12-06 19:17:08 +00:00
James Zern f9b7c85768 README: update target list
Change-Id: I001179ce34b2bf2350dce5f0197b6be175ab1c37
2023-12-06 19:11:27 +00:00
Wan-Teh Chang c4c9208054 Remove SSE code for 128x* blocks
The maximum block size is 64x64 in VP9.

Bug: webm:1819
Change-Id: If9802be9f81b51dbcdbc8a68d5afe48ca6d3d0e7
2023-12-05 14:29:37 -08:00
Wan-Teh Chang 7dfe343199 Use vpx_sse instead of vpx_mse to compute SSE
Use vpx_sse and vpx_highbd_sse instead of vpx_mse16x16 and
vpx_highbd_8_mse16x16 respectively to compute SSE for PSNR
calculations. This solves an issue whereby vpx_highbd_8_mse16x16
was being used to calculate SSE for 10- and 12-bit input.

This is a port of the libaom CL
https://aomedia-review.googlesource.com/c/aom/+/175063
by Jonathan Wright <jonathan.wright@arm.com>.

Bug: webm:1819
Change-Id: I37e3ac72835e67ccb44ac89a4ed16df62c2169a7
2023-12-05 22:13:43 +00:00
Jerome Jiang 4c2435c33e Fix several clang-tidy complaints
Change-Id: I78721d6b7ed692ad9363b5cac4e3324a3136d5b6
2023-12-05 22:08:56 +00:00
Marco Paniconi 12e928cb34 Add unittest for issue b/314857577
Bug: b/314857577

Change-Id: I591036c1ad3362023686d395adb4783c51baa62d
2023-12-05 22:02:45 +00:00
Wan-Teh Chang 97184161d5 Add "IWYU pragma: export" to some public headers
vpx/vpx_integer.h is clearly intended as the facade header for the
Standard C Library headers <stddef.h>, <inttypes.h>, and <stdint.h>.

It is reasonable to expect that vpx/vpx_decoder.h and vpx/vpx_encoder.h
should provide the symbols from vpx/vpx_codec.h.

Change-Id: I220797e63b2efc3dd9e2ac197fe2f918bf80d247
2023-12-05 21:18:45 +00:00
Jerome Jiang 7cfc58de48 RTC RC: add screen content support for vp8
Bug: b/281463780
Change-Id: I446c00bf8d794aa9134e4fe37960dd8a465448a4
2023-12-05 19:53:38 +00:00
Yunqing Wang 8bf3649d41 Fix a bug in frame scaling
This change fixed a corner case bug reealed by b/311394513.
During the frame scaling, vpx_highbd_convolve8() and vpx_scaled_2d()
requires both x_step_q4 and y_step_q4 are less than or equal to a
defined value. Otherwise, it needs to call vp9_scale_and_extend_
frame_nonnormative() that supports arbitrary scaling.

The fix was done in LBD and HBD funnctions.

Bug: b/311394513
Change-Id: Id0d34e7910ec98859030ef968ac19331488046d4
2023-12-04 19:39:08 -08:00
Bohan Li 9ad598f249 Improve test comments.
Change-Id: I42dddb946193e30cf07e39b43eaad051c5da479a
2023-12-04 23:32:08 +00:00
Gerda Zsejke More db83435afb configure: Add darwin23 support
Add target arm64-darwin23-gcc, x86_64-darwin23-gcc for MacOS 14.

Change-Id: I6b68a6a61d51aaa78ec11a5055bb95ce77a81d9c
2023-12-04 21:22:35 +00:00
Angie Chiang f10481dc0a Set skip_recode=0 in nonrd_pick_sb_modes
Need to set skip_recode properly so that
vp9_encode_block_intra() can work properly when it is
called by block_rd_txfm(). We can not skip "recode" because
it is still at the rd search stage.

Bug: b/310340241
Change-Id: I7d7600ef72addd341636549c2dad1868ad90e1cb
2023-12-02 07:18:11 +00:00
Wan-Teh Chang 5dcb4c1740 Define VPX_DL_* macros as unsigned long constants
Define the VPX_DL_REALTIME, VPX_DL_GOOD_QUALITY, and VPX_DL_BEST_QUALITY
macros as unsigned long, because the deadline parameter of
vpx_codec_encode() is of the unsigned long type. This enables C++
templates to deduce the unsigned long type from these macros.

Change-Id: I2173e3bbf5e15c84c11843790df93a497a35ed7d
2023-12-02 02:28:57 +00:00
Wan-Teh Chang bf07554183 Add the needed Android API level predicates.
fseeko and ftello are available on Android only from API level 24. Add
the needed guards for these functions.

Suggested by Yifan Yang.

Change-Id: I3a6721d31e1d961ab10b434ea6e92959bd5a70ab
2023-12-02 02:13:32 +00:00
Wan-Teh Chang 378af160ff Merge "Document vpx_codec_decode() ignores deadline param" into main 2023-12-01 23:09:06 +00:00
Wan-Teh Chang 478df94cd2 Merge "Define vpx_enc_deadline_t type for encode deadline" into main 2023-12-01 22:57:58 +00:00
Bohan Li a9f1bfdb8e Fix edge case when downsizing to one.
BUG: b/310329177
Change-Id: I2ebf4165adbc7351d6cc73554827812dedc4d362
2023-12-01 13:44:56 -08:00
Wan-Teh Chang 967c59b190 Merge "Fix scaled reference offsets." into main 2023-12-01 21:40:42 +00:00
James Zern d5ec829489 Merge "CHANGELOG: add CVE for issue #1642" into main 2023-12-01 21:39:31 +00:00
James Zern a88e7d869f Merge changes Ic2c3cb30,I027eaf2d,I455e5a94,I8f7633d9,I5116d10d, ... into main
* changes:
  Specialise Armv8.0 Neon horiz convolution for 4-tap filters
  Specialise Armv8.0 Neon vert convolution for 4-tap filters
  Specialise Armv8.6 Neon 2D horiz convolution for 4-tap filters
  Specialise Armv8.6 Neon horiz convolution for 4-tap filters
  Specialise Armv8.4 Neon 2D horiz convolution for 4-tap filters
  Specialise Armv8.4 Neon horiz convolution for 4-tap filters
  Specialise Armv8.6 Neon vert convolution for 4-tap filters
  Specialise Armv8.4 Neon vert convolution for 4-tap filters
  Make reporting of filter sizes more granular
  Delete redundant code in Neon SDOT/USDOT vertical convolutions
2023-12-01 21:38:51 +00:00
James Zern 5cad6fdc92 CHANGELOG: add CVE for issue #1642
CVE-2023-6349 was reserved for this issue. It's not yet published.

Bug: webm:1642, b:302710624
Change-Id: Iaab2a0bcae449a45e35678f5c049413fe0a4d2a4
2023-12-01 13:10:58 -08:00
Wan-Teh Chang 070d7e5cf3 Document vpx_codec_decode() ignores deadline param
The changes in this CL show that both the VP8 and VP9 implementations of
the decode function eventually discard the deadline parameter. Change
the code to ignore the deadline parameter in vpx_codec_decode() without
passing it to the decode function, and document that the deadline
parameter is ignored and 0 should be passed.

Change-Id: Ia977e16cdbdf97901207aa2d749887980137c4c0
2023-12-01 09:55:23 -08:00
Bohan Li 845a817c05 Fix scaled reference offsets.
Since the reference frame is already scaled, do not scale the offsets.

BUG: b/311489136, b/312656387
Change-Id: Ib346242e7ec8c4d3ed26668fa4094271218278ed
2023-12-01 09:52:59 -08:00
Jonathan Wright d144e6e95d Specialise Armv8.0 Neon horiz convolution for 4-tap filters
Add an Armv8.0 MLA Neon implementation of horizontal convolution
specialised for executing with 4-tap filters (the most common filter
size for settings --good --cpu-used=1.) This new path is also used
when executing with bilinear (2-tap) filters.

Change-Id: Ic2c3cb307b95964cd0ba86f1c42eece3a8ab7cf4
2023-12-01 00:20:00 +00:00
Jonathan Wright a33ac12dc0 Specialise Armv8.0 Neon vert convolution for 4-tap filters
Add an Armv8.0 MLA Neon implementation of vertical convolution
specialised for executing with 4-tap filters (the most common filter
size for settings --good --cpu-used=1.) This new path is also used
when executing with bilinear (2-tap) filters.

Change-Id: I027eaf2d1bb9711c2217cc8aa6b1e379d3e66b26
2023-11-30 12:00:00 +00:00
Wan-Teh Chang b027590c30 Define vpx_enc_deadline_t type for encode deadline
The deadline parameter of vpx_codec_encode() is of the unsigned long
type. The cpplint runtime/int check and the clang-tidy
google-runtime-int warn about the use of the unsigned long type. Adding
a type alias works around this issue.

Note: vpx_codec_decode() also has a deadline parameter, but it is of the
long type. So unfortuntely this type alias cannot be simply named
vpx_codec_deadline_t and the name must suggest it is encoder-specific.

Change-Id: I27b6b25730b620b328422ec3f91e63fdc55b377a
2023-11-29 17:36:24 -08:00
Jonathan Wright cc89450a48 Specialise Armv8.6 Neon 2D horiz convolution for 4-tap filters
Add an Armv8.6 USDOT Neon path for the horizontal portion of 2D
convolution, specialised for executing with 4-tap filters (the most
common filter size for settings --good --cpu-used=1.) This new path
is also used when executing with bilinear (2-tap) filters.

Change-Id: I455e5a94bdcea1358025bd8e4d4c8c62e373aa5d
2023-11-27 16:44:02 +00:00
Jonathan Wright 0dc67ecf54 Specialise Armv8.6 Neon horiz convolution for 4-tap filters
Add an Armv8.6 USDOT Neon implementation of horizontal convolution
specialised for executing with 4-tap filters (the most common filter
size for settings --good --cpu-used=1.) This new path is also used
when executing with bilinear (2-tap) filters.

Change-Id: I8f7633d9852ebfe8feb9b4a055715f849cccf297
2023-11-27 16:43:56 +00:00
Jonathan Wright 9cdb688919 Specialise Armv8.4 Neon 2D horiz convolution for 4-tap filters
Add an Armv8.4 SDOT Neon path for the horizontal portion of 2D
convolution, specialised for executing with 4-tap filters (the most
common filter size for settings --good --cpu-used=1.) This new path
is also used when executing with bilinear (2-tap) filters.

Change-Id: I5116d10ddb371ac2cf302ef905d06f2140dc7600
2023-11-27 16:43:21 +00:00
Jonathan Wright 68ef57f997 Specialise Armv8.4 Neon horiz convolution for 4-tap filters
Add an Armv8.4 SDOT Neon implementation of horizontal convolution
specialised for executing with 4-tap filters (the most common filter
size for settings --good --cpu-used=1.) This new path is also used
when executing with bilinear (2-tap) filters.

Change-Id: Ib396681b3f7b8b0eeba94381fbe33a06cf7b4a13
2023-11-27 16:43:15 +00:00
Jonathan Wright 2f8e94715d Specialise Armv8.6 Neon vert convolution for 4-tap filters
Add an Armv8.6 USDOT Neon implementation of vertical convolution
specialised for executing with 4-tap filters (the most common filter
size for settings --good --cpu-used=1.) This new path is also used
when executing with bilinear (2-tap) filters.

Change-Id: Ic893b25541e3317c5d5c270c338f868f080aed7c
2023-11-27 16:38:20 +00:00
Jonathan Wright bdc9e1c9d4 Specialise Armv8.4 Neon vert convolution for 4-tap filters
Add an Armv8.4 SDOT Neon implementation of vertical convolution
specialised for executing with 4-tap filters (the most common filter
size for settings --good --cpu-used=1.) This new path is also used
when executing with bilinear (2-tap) filters.

Change-Id: I3eb00b5a34f5676b68bda60a2a29be56e3d7d0cd
2023-11-27 16:37:56 +00:00
Jonathan Wright 1b3ec0676c Make reporting of filter sizes more granular
vpx_get_filter_taps() currently reports either 8-tap or 2-tap.
However, many 8-tap filters are actually 0-padded, resulting in a
lot of redundant work (multiplying by, and adding, 0) when processing
using an 8-tap convolution function. In preparation for adding 2- and
4-tap SIMD implementations for the convolution paths, make the filter
size reporting more granular, stripping any 0 padding. Filter sizes
can now be reported as 2-, 4-, 6- or 8-tap.

Change-Id: I100133aac7173134af34b918c9ad3007d98d6060
2023-11-23 15:11:11 +00:00
Jonathan Wright 9b729500d5 Delete redundant code in Neon SDOT/USDOT vertical convolutions
Delete redundant transpose/permute code in the Neon dot-product
vertical convolution paths. Variable values were assigned but never
used before subsequent assignment.

Change-Id: I15b29d0c993f56599e0d18ac1d5787e6385d2a3a
2023-11-23 13:58:42 +00:00
303 changed files with 9422 additions and 6539 deletions
+1
View File
@@ -5,6 +5,7 @@ Aex Converse <alexconv@twitch.tv> <alex.converse@gmail.com>
Alexis Ballier <aballier@gentoo.org> <alexis.ballier@gmail.com>
Alpha Lam <hclam@google.com> <hclam@chromium.org>
Angie Chiang <angiebird@google.com>
Bohan Li <bohanli@google.com>
Chris Cunningham <chcunningham@chromium.org>
Chi Yo Tsai <chiyotsai@google.com>
Daniele Castagna <dcastagna@chromium.org> <dcastagna@google.com>
+4
View File
@@ -32,6 +32,7 @@ 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>
@@ -42,7 +43,9 @@ 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>
Daniel Cheng <dcheng@chromium.org>
Daniele Castagna <dcastagna@chromium.org>
Daniel Kang <ddkang@google.com>
Daniel Sommermann <dcsommer@gmail.com>
@@ -233,6 +236,7 @@ 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>
Google Inc.
The Mozilla Foundation
The Xiph.Org Foundation
+86 -1
View File
@@ -1,3 +1,88 @@
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.
@@ -110,7 +195,7 @@
- Bug fixes:
https://crbug.com/1486441 (CVE-2023-5217)
Fix to a crash related to VP9 encoding (#1642)
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
+46 -4
View File
@@ -1,5 +1,3 @@
v1.13.1 Ugly Duckling
Welcome to the WebM VP8/VP9 Codec SDK!
COMPILING THE APPLICATIONS/LIBRARIES:
@@ -67,6 +65,7 @@ COMPILING THE APPLICATIONS/LIBRARIES:
arm64-darwin21-gcc
arm64-darwin22-gcc
arm64-darwin23-gcc
arm64-darwin24-gcc
arm64-linux-gcc
arm64-win64-gcc
arm64-win64-vs15
@@ -131,6 +130,7 @@ COMPILING THE APPLICATIONS/LIBRARIES:
x86_64-darwin21-gcc
x86_64-darwin22-gcc
x86_64-darwin23-gcc
x86_64-darwin24-gcc
x86_64-iphonesimulator-gcc
x86_64-linux-gcc
x86_64-linux-icc
@@ -152,8 +152,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.
@@ -183,7 +183,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 issue tracker:
https://issues.webmproject.org/.
For security reports, select 'Security report' from the Template dropdown.
+1 -1
View File
@@ -108,7 +108,7 @@ index b3af677d2..7b65bb4a7 100644
%macro FIRST_2_ROWS 0
movdqa xmm4, xmm0
diff --git a/vpx_dsp/x86/ssim_opt_x86_64.asm b/vpx_dsp/x86/ssim_opt_x86_64.asm
index 41ffbb07e..efb7759f5 100644
index 1ad3b88c8..d019e549d 100644
--- a/vpx_dsp/x86/ssim_opt_x86_64.asm
+++ b/vpx_dsp/x86/ssim_opt_x86_64.asm
@@ -10,6 +10,7 @@
-3
View File
@@ -24,9 +24,6 @@ EXPORTS
vpx_img_free
vpx_img_set_rect
vpx_img_wrap
vpx_free_tpl_gop_stats
vpx_read_tpl_gop_stats
vpx_write_tpl_gop_stats
vpx_codec_enc_config_default
vpx_codec_enc_config_set
vpx_codec_enc_init_multi_ver
-2
View File
@@ -184,7 +184,6 @@
<ClInclude Include="..\vpx_ports\mem.h" />
<ClInclude Include="..\vpx_ports\mem_ops.h" />
<ClInclude Include="..\vpx_ports\mem_ops_aligned.h" />
<ClInclude Include="..\vpx_ports\msvc.h" />
<ClInclude Include="..\vpx_ports\static_assert.h" />
<ClInclude Include="..\vpx_ports\system_state.h" />
<ClInclude Include="..\vpx_ports\vpx_once.h" />
@@ -367,7 +366,6 @@
<ClCompile Include="..\vpx\src\vpx_decoder.c" />
<ClCompile Include="..\vpx\src\vpx_encoder.c" />
<ClCompile Include="..\vpx\src\vpx_image.c" />
<ClCompile Include="..\vpx\src\vpx_tpl.c" />
<ClCompile Include="..\vpx_dsp\add_noise.c" />
<ClCompile Include="..\vpx_dsp\avg.c" />
<ClCompile Include="..\vpx_dsp\bitreader.c" />
+4
View File
@@ -228,6 +228,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<MinimumRequiredVersion Condition="'$(ApplicationTypeRevision)' == '10.0'">10.0</MinimumRequiredVersion>
<MinimumRequiredVersion Condition="'$(ApplicationTypeRevision)' == '8.1'">8.1</MinimumRequiredVersion>
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
<WindowsMetadataFile>$(OutDir)\lib\x86\$(RootNamespace).winmd</WindowsMetadataFile>
</Link>
</ItemDefinitionGroup>
@@ -254,6 +255,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<MinimumRequiredVersion Condition="'$(ApplicationTypeRevision)' == '10.0'">10.0</MinimumRequiredVersion>
<MinimumRequiredVersion Condition="'$(ApplicationTypeRevision)' == '8.1'">8.1</MinimumRequiredVersion>
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
<WindowsMetadataFile>$(OutDir)\lib\x64\$(RootNamespace).winmd</WindowsMetadataFile>
</Link>
</ItemDefinitionGroup>
@@ -344,6 +346,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<MinimumRequiredVersion Condition="'$(ApplicationTypeRevision)' == '10.0'">10.0</MinimumRequiredVersion>
<MinimumRequiredVersion Condition="'$(ApplicationTypeRevision)' == '8.1'">8.1</MinimumRequiredVersion>
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
<WindowsMetadataFile>$(OutDir)\lib\x86\$(RootNamespace).winmd</WindowsMetadataFile>
</Link>
</ItemDefinitionGroup>
@@ -378,6 +381,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<MinimumRequiredVersion Condition="'$(ApplicationTypeRevision)' == '10.0'">10.0</MinimumRequiredVersion>
<MinimumRequiredVersion Condition="'$(ApplicationTypeRevision)' == '8.1'">8.1</MinimumRequiredVersion>
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
<WindowsMetadataFile>$(OutDir)\lib\x64\$(RootNamespace).winmd</WindowsMetadataFile>
</Link>
</ItemDefinitionGroup>
+1
View File
@@ -18,6 +18,7 @@ HAVE_NEON equ 0
HAVE_NEON_DOTPROD equ 0
HAVE_NEON_I8MM equ 0
HAVE_SVE equ 0
HAVE_SVE2 equ 0
HAVE_MIPS32 equ 0
HAVE_DSPR2 equ 0
HAVE_MSA equ 0
+1
View File
@@ -27,6 +27,7 @@
#define HAVE_NEON_DOTPROD 0
#define HAVE_NEON_I8MM 0
#define HAVE_SVE 0
#define HAVE_SVE2 0
#define HAVE_MIPS32 0
#define HAVE_DSPR2 0
#define HAVE_MSA 0
+6 -3
View File
@@ -1,8 +1,11 @@
// This file is generated. Do not edit.
#ifndef VPX_VERSION_H_
#define VPX_VERSION_H_
#define VERSION_MAJOR 1
#define VERSION_MINOR 14
#define VERSION_MINOR 15
#define VERSION_PATCH 1
#define VERSION_EXTRA ""
#define VERSION_PACKED ((VERSION_MAJOR<<16)|(VERSION_MINOR<<8)|(VERSION_PATCH))
#define VERSION_STRING_NOSP "v1.14.1"
#define VERSION_STRING " v1.14.1"
#define VERSION_STRING_NOSP "v1.15.1"
#define VERSION_STRING " v1.15.1"
#endif // VPX_VERSION_H_
+11 -1
View File
@@ -1,3 +1,13 @@
/*
* 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.
*/
// This file is generated. Do not edit.
#ifndef VP8_RTCD_H_
#define VP8_RTCD_H_
@@ -320,4 +330,4 @@ static void setup_rtcd_internal(void)
} // extern "C"
#endif
#endif
#endif // VP8_RTCD_H_
+11 -1
View File
@@ -1,3 +1,13 @@
/*
* 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.
*/
// This file is generated. Do not edit.
#ifndef VP9_RTCD_H_
#define VP9_RTCD_H_
@@ -198,4 +208,4 @@ static void setup_rtcd_internal(void)
} // extern "C"
#endif
#endif
#endif // VP9_RTCD_H_
+11 -1
View File
@@ -1,3 +1,13 @@
/*
* 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.
*/
// This file is generated. Do not edit.
#ifndef VPX_DSP_RTCD_H_
#define VPX_DSP_RTCD_H_
@@ -3421,4 +3431,4 @@ static void setup_rtcd_internal(void)
} // extern "C"
#endif
#endif
#endif // VPX_DSP_RTCD_H_
+11 -1
View File
@@ -1,3 +1,13 @@
/*
* 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.
*/
// This file is generated. Do not edit.
#ifndef VPX_SCALE_RTCD_H_
#define VPX_SCALE_RTCD_H_
@@ -70,4 +80,4 @@ static void setup_rtcd_internal(void)
} // extern "C"
#endif
#endif
#endif // VPX_SCALE_RTCD_H_
+11 -1
View File
@@ -1,3 +1,13 @@
/*
* 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.
*/
// This file is generated. Do not edit.
#ifndef VP8_RTCD_H_
#define VP8_RTCD_H_
@@ -245,4 +255,4 @@ static void setup_rtcd_internal(void)
} // extern "C"
#endif
#endif
#endif // VP8_RTCD_H_
+11 -1
View File
@@ -1,3 +1,13 @@
/*
* 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.
*/
// This file is generated. Do not edit.
#ifndef VP9_RTCD_H_
#define VP9_RTCD_H_
@@ -179,4 +189,4 @@ static void setup_rtcd_internal(void)
} // extern "C"
#endif
#endif
#endif // VP9_RTCD_H_
+11 -1
View File
@@ -1,3 +1,13 @@
/*
* 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.
*/
// This file is generated. Do not edit.
#ifndef VPX_DSP_RTCD_H_
#define VPX_DSP_RTCD_H_
@@ -2698,4 +2708,4 @@ static void setup_rtcd_internal(void)
} // extern "C"
#endif
#endif
#endif // VPX_DSP_RTCD_H_
+11 -1
View File
@@ -1,3 +1,13 @@
/*
* 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.
*/
// This file is generated. Do not edit.
#ifndef VPX_SCALE_RTCD_H_
#define VPX_SCALE_RTCD_H_
@@ -70,4 +80,4 @@ static void setup_rtcd_internal(void)
} // extern "C"
#endif
#endif
#endif // VPX_SCALE_RTCD_H_
+1 -1
View File
@@ -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, ...);
+6 -7
View File
@@ -15,13 +15,9 @@ ifdef NDK_ROOT
# 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.
#
@@ -38,11 +34,14 @@ ifdef NDK_ROOT
# 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)/
+2
View File
@@ -150,6 +150,8 @@ $(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+sve2
$(BUILD_PFX)%_sve2.c.o: CFLAGS += -march=armv9-a+sve2
# POWER
$(BUILD_PFX)%_vsx.c.d: CFLAGS += -maltivec -mvsx
+43 -10
View File
@@ -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
@@ -457,8 +460,10 @@ EOF
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
RTCD_OPTIONS="${RTCD_OPTIONS}--disable-sve "
disable_feature sve2
RTCD_OPTIONS="${RTCD_OPTIONS}--disable-sve --disable-sve2 "
fi
fi
}
@@ -543,7 +548,6 @@ AR=${AR}
LD=${LD}
AS=${AS}
STRIP=${STRIP}
NM=${NM}
CFLAGS = ${CFLAGS}
CXXFLAGS = ${CXXFLAGS}
@@ -645,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
@@ -741,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=
}
@@ -826,7 +832,7 @@ process_common_toolchain() {
tgt_isa=x86_64
tgt_os=`echo $gcctarget | sed 's/.*\(darwin1[0-9]\).*/\1/'`
;;
*darwin2[0-3]*)
*darwin2[0-4]*)
tgt_isa=`uname -m`
tgt_os=`echo $gcctarget | sed 's/.*\(darwin2[0-9]\).*/\1/'`
;;
@@ -985,7 +991,7 @@ EOF
add_cflags "-mmacosx-version-min=10.15"
add_ldflags "-mmacosx-version-min=10.15"
;;
*-darwin2[0-3]-*)
*-darwin2[0-4]-*)
add_cflags "-arch ${toolchain%%-*}"
add_ldflags "-arch ${toolchain%%-*}"
;;
@@ -1013,7 +1019,15 @@ EOF
# Process architecture variants
case ${toolchain} in
arm*)
soft_enable runtime_cpu_detect
case ${toolchain} in
armv7*-darwin*)
# Runtime cpu detection is not defined for these targets.
enabled runtime_cpu_detect && disable_feature runtime_cpu_detect
;;
*)
soft_enable runtime_cpu_detect
;;
esac
if [ ${tgt_isa} = "armv7" ] || [ ${tgt_isa} = "armv7s" ]; then
soft_enable neon
@@ -1121,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
@@ -1158,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)
@@ -1168,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)}"
@@ -1251,6 +1270,7 @@ EOF
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} "
@@ -1270,7 +1290,9 @@ EOF
fi
fi
done
check_neon_sve_bridge_compiles
if enabled sve; then
check_neon_sve_bridge_compiles
fi
fi
;;
@@ -1529,6 +1551,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
@@ -1549,6 +1579,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 &&
+19 -2
View File
@@ -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 (@_) {
@@ -208,7 +212,19 @@ sub filter {
#
sub common_top() {
my $include_guard = uc($opts{sym})."_H_";
my @time = localtime;
my $year = $time[5] + 1900;
print <<EOF;
/*
* Copyright (c) ${year} 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 +254,14 @@ EOF
}
sub common_bottom() {
my $include_guard = uc($opts{sym})."_H_";
print <<EOF;
#ifdef __cplusplus
} // extern "C"
#endif
#endif
#endif // ${include_guard}
EOF
}
@@ -487,7 +504,7 @@ 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 neon_dotprod neon_i8mm sve/);
@ALL_ARCHS = filter(qw/neon neon_dotprod neon_i8mm sve sve2/);
@REQUIRES = filter(qw/neon/);
&require(@REQUIRES);
arm;
+3
View File
@@ -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
+9
View File
@@ -103,6 +103,7 @@ 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-linux-gcc"
all_platforms="${all_platforms} arm64-win64-gcc"
all_platforms="${all_platforms} arm64-win64-vs15"
@@ -167,6 +168,7 @@ 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-iphonesimulator-gcc"
all_platforms="${all_platforms} x86_64-linux-gcc"
all_platforms="${all_platforms} x86_64-linux-icc"
@@ -260,6 +262,7 @@ ARCH_EXT_LIST_AARCH64="
neon_dotprod
neon_i8mm
sve
sve2
"
ARCH_EXT_LIST_X86="
@@ -376,6 +379,7 @@ CMDLINE_SELECT="
install_libs
install_srcs
debug
profile
gprof
gcov
pic
@@ -659,6 +663,7 @@ process_toolchain() {
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-aggressive
check_add_cflags -Wunused
@@ -677,6 +682,10 @@ process_toolchain() {
# 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
-18
View File
@@ -69,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
@@ -96,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)
@@ -118,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
@@ -147,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
@@ -157,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
@@ -170,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
@@ -179,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
@@ -188,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
@@ -197,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
@@ -208,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
@@ -217,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
@@ -226,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
@@ -250,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
-131
View File
@@ -1,131 +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;
int failed = 0;
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) {
fclose(fpin);
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);
if (!(inbuf && outbuf)) {
printf("Failed to allocate buffers.\n");
failed = 1;
goto Error;
}
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);
Error:
fclose(fpin);
fclose(fpout);
free(inbuf);
free(outbuf);
return failed;
}
+6 -4
View File
@@ -16,6 +16,7 @@
#include <math.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
@@ -1156,12 +1157,13 @@ int main(int argc, const char **argv) {
#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.
// 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 &&
cx_pkt->data.frame
.spatial_layer_encoded[enc_cfg.ss_number_layers - 1])) {
layer_id.temporal_layer_id == (int)enc_cfg.ts_number_layers - 1)) {
test_decode(&encoder, &decoder, frame_cnt, &mismatch_seen);
}
#endif
+1 -1
View File
@@ -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",
+7 -2
View File
@@ -110,8 +110,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
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);
vpx_codec_err_t err = vpx_codec_peek_stream_info(VPXD_INTERFACE(DECODER),
data, size, &stream_info);
static_cast<void>(err);
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;
-8
View File
@@ -1223,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)
+2 -2
View File
@@ -313,9 +313,9 @@ $(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 := 9
SO_VERSION_MAJOR := 11
SO_VERSION_MINOR := 0
SO_VERSION_PATCH := 1
SO_VERSION_PATCH := 0
ifeq ($(filter darwin%,$(TGT_OS)),$(TGT_OS))
LIBVPX_SO := libvpx.$(SO_VERSION_MAJOR).dylib
SHARED_LIB_SUF := .dylib
+5 -3
View File
@@ -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;
+1 -1
View File
@@ -15,7 +15,7 @@
#include <limits>
#include "third_party/googletest/src/include/gtest/gtest.h"
#include "gtest/gtest.h"
#include "vpx/vpx_integer.h"
+1 -1
View File
@@ -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"
+1 -1
View File
@@ -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"
+2 -1
View File
@@ -10,12 +10,13 @@
#include <math.h>
#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"
+1 -1
View File
@@ -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"
+2 -1
View File
@@ -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
+9 -8
View File
@@ -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
+1 -1
View File
@@ -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"
+10 -1
View File
@@ -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"
@@ -719,6 +719,15 @@ INSTANTIATE_TEST_SUITE_P(
make_tuple(1024, &vp9_block_error_fp_neon)));
#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,
+1
View File
@@ -10,6 +10,7 @@
#include <stdio.h>
#include <algorithm>
#include <cstdlib>
#include "test/bench.h"
#include "vpx_ports/vpx_timer.h"
+1 -1
View File
@@ -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
+7 -1
View File
@@ -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 {
@@ -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
+1 -1
View File
@@ -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"
+11 -7
View File
@@ -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;
@@ -95,7 +95,7 @@ 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) {}
@@ -128,7 +128,7 @@ class VP8CodecFactory : public CodecFactory {
#endif
}
Encoder *CreateEncoder(vpx_codec_enc_cfg_t cfg, unsigned long deadline,
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
@@ -164,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
/*
@@ -190,7 +192,7 @@ 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) {}
@@ -223,7 +225,7 @@ class VP9CodecFactory : public CodecFactory {
#endif
}
Encoder *CreateEncoder(vpx_codec_enc_cfg_t cfg, unsigned long deadline,
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
@@ -259,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
+2 -1
View File
@@ -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 {
+1 -1
View File
@@ -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"
+1 -1
View File
@@ -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
+93 -1
View File
@@ -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"
@@ -1218,6 +1218,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)
@@ -1438,6 +1462,74 @@ INSTANTIATE_TEST_SUITE_P(NEON_DOTPROD, ConvolveTest,
::testing::ValuesIn(kArrayConvolve_neon_dotprod));
#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));
#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,
+3 -6
View File
@@ -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"
@@ -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
+7 -1
View File
@@ -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 {
@@ -104,6 +105,10 @@ CQTest::BitrateMap CQTest::bitrates_;
TEST_P(CQTest, LinearPSNRIsHigherForCQLevel) {
const vpx_rational timebase = { 33333333, 1000000000 };
#if CONFIG_REALTIME_ONlY
GTEST_SKIP()
<< "Non-zero g_lag_in_frames is unsupported with CONFIG_REALTIME_ONLY";
#else
cfg_.g_timebase = timebase;
cfg_.rc_target_bitrate = kCQTargetBitrate;
cfg_.g_lag_in_frames = 25;
@@ -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,
+2 -2
View File
@@ -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,8 @@
#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;
+1 -2
View File
@@ -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"
@@ -28,7 +28,6 @@
#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;
+2 -1
View File
@@ -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"
+2 -1
View File
@@ -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"
+1 -1
View File
@@ -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 "./vpx_config.h"
#include "test/ivf_video_source.h"
+2 -1
View File
@@ -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 {
+3 -3
View File
@@ -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;
@@ -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);
@@ -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);
+1 -1
View File
@@ -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"
+1 -1
View File
@@ -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"
+281 -14
View File
@@ -11,25 +11,22 @@
#include <cassert>
#include <climits>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <initializer_list>
#include <new>
#include <vector>
#include "third_party/googletest/src/include/gtest/gtest.h"
#include "gtest/gtest.h"
#include "test/acm_random.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/y4m_video_source.h"
#include "./vpx_config.h"
#include "vpx/vp8cx.h"
#include "vpx/vpx_codec.h"
#include "vpx/vpx_encoder.h"
#include "vpx/vpx_image.h"
#include "vpx/vpx_tpl.h"
#include "vpx_ports/msvc.h"
namespace {
@@ -375,7 +372,7 @@ class VP8Encoder {
~VP8Encoder();
void Configure(unsigned int threads, unsigned int width, unsigned int height,
vpx_rc_mode end_usage, unsigned long deadline);
vpx_rc_mode end_usage, vpx_enc_deadline_t deadline);
void Encode(bool key_frame);
private:
@@ -384,7 +381,7 @@ class VP8Encoder {
vpx_codec_enc_cfg_t cfg_;
vpx_codec_ctx_t enc_;
int frame_index_ = 0;
unsigned long deadline_ = 0;
vpx_enc_deadline_t deadline_ = 0;
};
VP8Encoder::~VP8Encoder() {
@@ -395,7 +392,7 @@ VP8Encoder::~VP8Encoder() {
void VP8Encoder::Configure(unsigned int threads, unsigned int width,
unsigned int height, vpx_rc_mode end_usage,
unsigned long deadline) {
vpx_enc_deadline_t deadline) {
deadline_ = deadline;
if (!initialized_) {
@@ -552,6 +549,108 @@ TEST(EncodeAPI, AomediaIssue3509VbrMinSection101PercentVP8) {
vpx_img_free(image);
ASSERT_EQ(vpx_codec_destroy(&enc), VPX_CODEC_OK);
}
TEST(EncodeAPI, OssFuzz69100) {
// Initialize libvpx encoder.
vpx_codec_iface_t *const iface = vpx_codec_vp8_cx();
vpx_codec_ctx_t enc;
vpx_codec_enc_cfg_t cfg;
ASSERT_EQ(vpx_codec_enc_config_default(iface, &cfg, 0), VPX_CODEC_OK);
cfg.g_w = 64;
cfg.g_h = 64;
cfg.g_lag_in_frames = 25;
cfg.g_timebase.num = 1;
cfg.g_timebase.den = 6240592;
cfg.rc_target_bitrate = 1202607620;
cfg.kf_max_dist = 24377;
ASSERT_EQ(vpx_codec_enc_init(&enc, iface, &cfg, 0), VPX_CODEC_OK);
ASSERT_EQ(vpx_codec_control(&enc, VP8E_SET_CPUUSED, 1), VPX_CODEC_OK);
ASSERT_EQ(vpx_codec_control(&enc, VP8E_SET_ARNR_MAXFRAMES, 0), VPX_CODEC_OK);
ASSERT_EQ(vpx_codec_control(&enc, VP8E_SET_ARNR_STRENGTH, 3), VPX_CODEC_OK);
ASSERT_EQ(vpx_codec_control_(&enc, VP8E_SET_ARNR_TYPE, 3),
VPX_CODEC_OK); // deprecated
ASSERT_EQ(vpx_codec_control(&enc, VP8E_SET_NOISE_SENSITIVITY, 0),
VPX_CODEC_OK);
ASSERT_EQ(vpx_codec_control(&enc, VP8E_SET_TOKEN_PARTITIONS, 0),
VPX_CODEC_OK);
ASSERT_EQ(vpx_codec_control(&enc, VP8E_SET_STATIC_THRESHOLD, 0),
VPX_CODEC_OK);
libvpx_test::RandomVideoSource video;
video.set_limit(30);
video.SetSize(cfg.g_w, cfg.g_h);
video.SetImageFormat(VPX_IMG_FMT_I420);
video.Begin();
do {
ASSERT_EQ(vpx_codec_encode(&enc, video.img(), video.pts(), video.duration(),
/*flags=*/0, VPX_DL_GOOD_QUALITY),
VPX_CODEC_OK);
video.Next();
} while (video.img() != nullptr);
ASSERT_EQ(vpx_codec_destroy(&enc), VPX_CODEC_OK);
}
void EncodeOssFuzz69906(int cpu_used, vpx_enc_deadline_t deadline) {
char str[80];
snprintf(str, sizeof(str), "cpu_used: %d deadline: %d", cpu_used,
static_cast<int>(deadline));
SCOPED_TRACE(str);
// Initialize libvpx encoder.
vpx_codec_iface_t *const iface = vpx_codec_vp8_cx();
vpx_codec_ctx_t enc;
vpx_codec_enc_cfg_t cfg;
ASSERT_EQ(vpx_codec_enc_config_default(iface, &cfg, 0), VPX_CODEC_OK);
cfg.g_w = 4097;
cfg.g_h = 16;
cfg.rc_target_bitrate = 1237084865;
cfg.kf_max_dist = 4336;
ASSERT_EQ(vpx_codec_enc_init(&enc, iface, &cfg, 0), VPX_CODEC_OK);
ASSERT_EQ(vpx_codec_control(&enc, VP8E_SET_CPUUSED, cpu_used), VPX_CODEC_OK);
ASSERT_EQ(vpx_codec_control(&enc, VP8E_SET_ARNR_MAXFRAMES, 0), VPX_CODEC_OK);
ASSERT_EQ(vpx_codec_control(&enc, VP8E_SET_ARNR_STRENGTH, 3), VPX_CODEC_OK);
ASSERT_EQ(vpx_codec_control_(&enc, VP8E_SET_ARNR_TYPE, 3),
VPX_CODEC_OK); // deprecated
ASSERT_EQ(vpx_codec_control(&enc, VP8E_SET_NOISE_SENSITIVITY, 0),
VPX_CODEC_OK);
ASSERT_EQ(vpx_codec_control(&enc, VP8E_SET_TOKEN_PARTITIONS, 0),
VPX_CODEC_OK);
ASSERT_EQ(vpx_codec_control(&enc, VP8E_SET_STATIC_THRESHOLD, 0),
VPX_CODEC_OK);
libvpx_test::Y4mVideoSource video("repro-oss-fuzz-69906.y4m", /*start=*/0,
/*limit=*/3);
video.Begin();
do {
ASSERT_EQ(vpx_codec_encode(&enc, video.img(), video.pts(), video.duration(),
/*flags=*/0, deadline),
VPX_CODEC_OK);
video.Next();
} while (video.img() != nullptr);
ASSERT_EQ(vpx_codec_destroy(&enc), VPX_CODEC_OK);
}
TEST(EncodeAPI, OssFuzz69906) {
// Note the original bug report was for speed 1, good quality. The remainder
// of the settings are for added coverage.
for (int cpu_used = 0; cpu_used <= 5; ++cpu_used) {
EncodeOssFuzz69906(cpu_used, VPX_DL_GOOD_QUALITY);
}
for (int cpu_used = -16; cpu_used <= -5; ++cpu_used) {
EncodeOssFuzz69906(cpu_used, VPX_DL_REALTIME);
}
}
#endif // CONFIG_VP8_ENCODER
// Set up 2 spatial streams with 2 temporal layers per stream, and generate
@@ -854,11 +953,98 @@ TEST(EncodeAPI, ConfigResizeBiggerAfterEncode) {
}
}
TEST(EncodeAPI, PtsSmallerThanInitialPts) {
for (const auto *iface : kCodecIfaces) {
// Initialize libvpx encoder.
vpx_codec_ctx_t enc;
vpx_codec_enc_cfg_t cfg;
ASSERT_EQ(vpx_codec_enc_config_default(iface, &cfg, 0), VPX_CODEC_OK);
ASSERT_EQ(vpx_codec_enc_init(&enc, iface, &cfg, 0), VPX_CODEC_OK);
// Create input image.
vpx_image_t *const image =
CreateImage(VPX_BITS_8, VPX_IMG_FMT_I420, cfg.g_w, cfg.g_h);
ASSERT_NE(image, nullptr);
// Encode frame.
ASSERT_EQ(vpx_codec_encode(&enc, image, 12, 1, 0, VPX_DL_BEST_QUALITY),
VPX_CODEC_OK);
ASSERT_EQ(vpx_codec_encode(&enc, image, 13, 1, 0, VPX_DL_BEST_QUALITY),
VPX_CODEC_OK);
// pts (10) is smaller than the initial pts (12).
ASSERT_EQ(vpx_codec_encode(&enc, image, 10, 1, 0, VPX_DL_BEST_QUALITY),
VPX_CODEC_INVALID_PARAM);
// Free resources.
vpx_img_free(image);
ASSERT_EQ(vpx_codec_destroy(&enc), VPX_CODEC_OK);
}
}
TEST(EncodeAPI, PtsOrDurationTooBig) {
for (const auto *iface : kCodecIfaces) {
// Initialize libvpx encoder.
vpx_codec_ctx_t enc;
vpx_codec_enc_cfg_t cfg;
ASSERT_EQ(vpx_codec_enc_config_default(iface, &cfg, 0), VPX_CODEC_OK);
ASSERT_EQ(vpx_codec_enc_init(&enc, iface, &cfg, 0), VPX_CODEC_OK);
// Create input image.
vpx_image_t *const image =
CreateImage(VPX_BITS_8, VPX_IMG_FMT_I420, cfg.g_w, cfg.g_h);
ASSERT_NE(image, nullptr);
// Encode frame.
ASSERT_EQ(vpx_codec_encode(&enc, image, 0, 1, 0, VPX_DL_BEST_QUALITY),
VPX_CODEC_OK);
#if ULONG_MAX > INT64_MAX
// duration is too big.
ASSERT_EQ(vpx_codec_encode(&enc, image, 0, (1ul << 63), 0, 2),
VPX_CODEC_INVALID_PARAM);
#endif
// pts, when converted to ticks, is too big.
ASSERT_EQ(vpx_codec_encode(&enc, image, INT64_MAX / 1000000 + 1, 1, 0,
VPX_DL_BEST_QUALITY),
VPX_CODEC_INVALID_PARAM);
#if ULONG_MAX > INT64_MAX
// duration is too big.
ASSERT_EQ(
vpx_codec_encode(&enc, image, 0, (1ul << 63), 0, VPX_DL_BEST_QUALITY),
VPX_CODEC_INVALID_PARAM);
// pts + duration is too big.
ASSERT_EQ(
vpx_codec_encode(&enc, image, 1, INT64_MAX, 0, VPX_DL_BEST_QUALITY),
VPX_CODEC_INVALID_PARAM);
#endif
// pts + duration, when converted to ticks, is too big.
#if ULONG_MAX > INT64_MAX
ASSERT_EQ(vpx_codec_encode(&enc, image, 0, 0xbd6b566b15c7, 0,
VPX_DL_BEST_QUALITY),
VPX_CODEC_INVALID_PARAM);
#endif
ASSERT_EQ(vpx_codec_encode(&enc, image, INT64_MAX / 1000000, 1, 0,
VPX_DL_BEST_QUALITY),
VPX_CODEC_INVALID_PARAM);
// Free resources.
vpx_img_free(image);
ASSERT_EQ(vpx_codec_destroy(&enc), VPX_CODEC_OK);
}
}
#if CONFIG_VP9_ENCODER
// Frame size needed to trigger the overflow exceeds the max buffer allowed on
// 32-bit systems defined by VPX_MAX_ALLOCABLE_MEMORY
#if VPX_ARCH_X86_64 || VPX_ARCH_AARCH64
TEST(EncodeAPI, ConfigLargeTargetBitrateVp9) {
#ifdef CHROMIUM
GTEST_SKIP() << "Under Chromium's configuration the allocator is unable"
"to provide the space required for the frames below.";
#else
constexpr int kWidth = 12383;
constexpr int kHeight = 8192;
constexpr auto *iface = &vpx_codec_vp9_cx_algo;
@@ -880,6 +1066,7 @@ TEST(EncodeAPI, ConfigLargeTargetBitrateVp9) {
EXPECT_NO_FATAL_FAILURE(InitCodec(*iface, kWidth, kHeight, &enc.ctx, &cfg))
<< "target bitrate: " << cfg.rc_target_bitrate << " framerate: "
<< static_cast<double>(cfg.g_timebase.den) / cfg.g_timebase.num;
#endif // defined(CHROMIUM)
}
#endif // VPX_ARCH_X86_64 || VPX_ARCH_AARCH64
@@ -898,7 +1085,7 @@ class VP9Encoder {
~VP9Encoder();
void Configure(unsigned int threads, unsigned int width, unsigned int height,
vpx_rc_mode end_usage, unsigned long deadline);
vpx_rc_mode end_usage, vpx_enc_deadline_t deadline);
void Encode(bool key_frame);
private:
@@ -910,7 +1097,7 @@ class VP9Encoder {
vpx_codec_enc_cfg_t cfg_;
vpx_codec_ctx_t enc_;
int frame_index_ = 0;
unsigned long deadline_ = 0;
vpx_enc_deadline_t deadline_ = 0;
};
VP9Encoder::~VP9Encoder() {
@@ -921,7 +1108,7 @@ VP9Encoder::~VP9Encoder() {
void VP9Encoder::Configure(unsigned int threads, unsigned int width,
unsigned int height, vpx_rc_mode end_usage,
unsigned long deadline) {
vpx_enc_deadline_t deadline) {
deadline_ = deadline;
if (!initialized_) {
@@ -1466,7 +1653,7 @@ TEST(EncodeAPI, Buganizer331108922BitDepth12) {
VPX_DL_REALTIME);
encoder.Encode(/*key_frame=*/false);
}
#endif
#endif // CONFIG_VP9_HIGHBITDEPTH
TEST(EncodeAPI, VP9GlobalHeaders) {
constexpr int kWidth = 320;
@@ -1655,6 +1842,86 @@ TEST(EncodeAPI, AomediaIssue3509VbrMinSection101PercentVP9) {
ASSERT_EQ(vpx_codec_destroy(&enc), VPX_CODEC_OK);
}
TEST(EncodeAPI, Chromium352414650) {
// Initialize libvpx encoder.
vpx_codec_iface_t *const iface = vpx_codec_vp9_cx();
vpx_codec_ctx_t enc;
vpx_codec_enc_cfg_t cfg;
ASSERT_EQ(vpx_codec_enc_config_default(iface, &cfg, 0), VPX_CODEC_OK);
cfg.g_w = 1024;
cfg.g_h = 1024;
cfg.g_profile = 0;
cfg.g_pass = VPX_RC_ONE_PASS;
cfg.g_lag_in_frames = 0;
cfg.rc_max_quantizer = 58;
cfg.rc_min_quantizer = 2;
cfg.g_threads = 4;
cfg.rc_resize_allowed = 0;
cfg.rc_dropframe_thresh = 0;
cfg.g_timebase.num = 1;
cfg.g_timebase.den = 1000000;
cfg.kf_min_dist = 0;
cfg.kf_max_dist = 10000;
cfg.rc_end_usage = VPX_CBR;
cfg.rc_target_bitrate = 754974;
cfg.ts_number_layers = 3;
cfg.ts_periodicity = 4;
cfg.ts_layer_id[0] = 0;
cfg.ts_layer_id[1] = 2;
cfg.ts_layer_id[2] = 1;
cfg.ts_layer_id[3] = 2;
cfg.ts_rate_decimator[0] = 4;
cfg.ts_rate_decimator[1] = 2;
cfg.ts_rate_decimator[2] = 1;
cfg.layer_target_bitrate[0] = 2147483;
cfg.layer_target_bitrate[1] = 3006476;
cfg.layer_target_bitrate[2] = 4294967;
cfg.temporal_layering_mode = VP9E_TEMPORAL_LAYERING_MODE_0212;
cfg.g_error_resilient = VPX_ERROR_RESILIENT_DEFAULT;
ASSERT_EQ(vpx_codec_enc_init(&enc, iface, &cfg, 0), VPX_CODEC_OK);
ASSERT_EQ(vpx_codec_control(&enc, VP8E_SET_CPUUSED, 7), VPX_CODEC_OK);
ASSERT_EQ(vpx_codec_control(&enc, VP9E_SET_TILE_COLUMNS, 2), VPX_CODEC_OK);
ASSERT_EQ(vpx_codec_control(&enc, VP9E_SET_ROW_MT, 1), VPX_CODEC_OK);
vpx_svc_extra_cfg_t svc_cfg = {};
svc_cfg.max_quantizers[0] = svc_cfg.max_quantizers[1] =
svc_cfg.max_quantizers[2] = 58;
svc_cfg.min_quantizers[0] = svc_cfg.min_quantizers[1] =
svc_cfg.min_quantizers[2] = 2;
svc_cfg.scaling_factor_num[0] = svc_cfg.scaling_factor_num[1] =
svc_cfg.scaling_factor_num[2] = 1;
svc_cfg.scaling_factor_den[0] = svc_cfg.scaling_factor_den[1] =
svc_cfg.scaling_factor_den[2] = 1;
ASSERT_EQ(vpx_codec_control(&enc, VP9E_SET_SVC_PARAMETERS, &svc_cfg),
VPX_CODEC_OK);
ASSERT_EQ(vpx_codec_control(&enc, VP9E_SET_SVC, 1), VPX_CODEC_OK);
ASSERT_EQ(vpx_codec_control(&enc, VP9E_SET_AQ_MODE, 3), VPX_CODEC_OK);
ASSERT_EQ(vpx_codec_control(&enc, VP8E_SET_STATIC_THRESHOLD, 1),
VPX_CODEC_OK);
ASSERT_EQ(vpx_codec_control(&enc, VP9E_SET_COLOR_SPACE, VPX_CS_SMPTE_170),
VPX_CODEC_OK);
ASSERT_EQ(vpx_codec_control(&enc, VP9E_SET_COLOR_RANGE, VPX_CR_STUDIO_RANGE),
VPX_CODEC_OK);
// Create input image.
vpx_image_t *const image =
CreateImage(VPX_BITS_8, VPX_IMG_FMT_I420, cfg.g_w, cfg.g_h);
ASSERT_NE(image, nullptr);
// Encode frame.
ASSERT_EQ(vpx_codec_encode(&enc, image, 0, /*duration=*/500000,
VPX_EFLAG_FORCE_KF, VPX_DL_REALTIME),
VPX_CODEC_OK);
// Free resources.
vpx_img_free(image);
ASSERT_EQ(vpx_codec_destroy(&enc), VPX_CODEC_OK);
}
#endif // CONFIG_VP9_ENCODER
} // namespace
+4 -4
View File
@@ -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 {
@@ -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);
+1 -1
View File
@@ -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"
+15 -6
View File
@@ -13,7 +13,7 @@
#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
@@ -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_));
@@ -177,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;
@@ -196,7 +205,7 @@ class Encoder {
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_;
};
@@ -291,7 +300,7 @@ 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_;
vpx_enc_frame_flags_t frame_flags_;
+7 -1
View File
@@ -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 {
@@ -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
+2 -1
View File
@@ -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"
+16 -4
View File
@@ -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) {}
@@ -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) {
+2 -1
View File
@@ -10,13 +10,14 @@
#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 {
+1 -2
View File
@@ -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;
+1 -1
View File
@@ -11,7 +11,7 @@
#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"
+4 -1
View File
@@ -14,7 +14,7 @@
#if !CONFIG_SHARED
#include <string>
#include "third_party/googletest/src/include/gtest/gtest.h"
#include "gtest/gtest.h"
#if VPX_ARCH_ARM
#include "vpx_ports/arm.h"
#endif
@@ -57,6 +57,9 @@ void init_vpx_test() {
if (!(caps & HAS_SVE)) {
append_negative_gtest_filter(":SVE.*:SVE/*");
}
if (!(caps & HAS_SVE2)) {
append_negative_gtest_filter(":SVE2.*:SVE2/*");
}
#elif VPX_ARCH_ARM
const int caps = arm_cpu_caps();
if (!(caps & HAS_NEON)) append_negative_gtest_filter(":NEON.*:NEON/*");
+1 -1
View File
@@ -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"
+3 -3
View File
@@ -10,7 +10,7 @@
#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"
@@ -178,7 +178,7 @@ vpx_image_t *CreateGrayImage(vpx_img_fmt_t fmt, unsigned int w,
// Tests kf_max_dist in one-pass encoding with zero lag.
void TestKeyframeMaximumInterval(vpx_codec_iface_t *iface,
unsigned long deadline,
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),
@@ -241,7 +241,7 @@ TEST(KeyframeIntervalTest, KeyframeMaximumInterval) {
ifaces.push_back(vpx_codec_vp9_cx());
#endif
for (vpx_codec_iface_t *iface : ifaces) {
for (unsigned long deadline :
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.
+15 -4
View File
@@ -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
@@ -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
@@ -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
+1 -1
View File
@@ -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"
+2 -1
View File
@@ -11,8 +11,9 @@
#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"
+1 -1
View File
@@ -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"
+2 -1
View File
@@ -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,6 +25,7 @@
#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;
+1 -1
View File
@@ -14,12 +14,12 @@
#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"
+2 -2
View File
@@ -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"
@@ -23,7 +24,6 @@
#include "test/util.h"
#include "vpx/vpx_integer.h"
#include "vpx_mem/vpx_mem.h"
#include "vpx_ports/msvc.h"
namespace {
+1 -1
View File
@@ -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"
+6 -1
View File
@@ -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 {
@@ -94,6 +95,9 @@ 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_AARCH64 || VPX_ARCH_X86_64
TestIntegerOverflow(16384, 16384);
@@ -107,6 +111,7 @@ TEST_P(RealtimeTest, IntegerOverflowLarge) {
"warnings are fixed.";
// TestIntegerOverflow(16383, 16383);
}
#endif // defined(CHROMIUM)
}
VP8_INSTANTIATE_TEST_SUITE(RealtimeTest,
+1 -1
View File
@@ -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"
+8 -7
View File
@@ -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
@@ -598,6 +597,7 @@ 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;
@@ -613,12 +613,12 @@ TEST_P(ResizeRealtimeTest, TestInternalResizeDown) {
}
}
#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());
#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
}
@@ -669,7 +669,8 @@ TEST_P(ResizeRealtimeTest, TestInternalResizeDownUpChangeBitRate) {
ASSERT_EQ(resize_count, 4) << "Resizing should occur twice.";
EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());
#else
printf("Warning: VP9 decoder unavailable, unable to check resize count!\n");
GTEST_SKIP()
<< "Warning: VP9 decoder unavailable, unable to check resize count!\n";
#endif
}
-69
View File
@@ -1,69 +0,0 @@
#!/bin/sh
##
## 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.
##
## This file tests the libvpx resize_util example code. To add new tests to
## this file, do the following:
## 1. Write a shell function (this is your test).
## 2. Add the function to resize_util_tests (on a new line).
##
. $(dirname $0)/tools_common.sh
# Environment check: $YUV_RAW_INPUT is required.
resize_util_verify_environment() {
if [ ! -e "${YUV_RAW_INPUT}" ]; then
echo "Libvpx test data must exist in LIBVPX_TEST_DATA_PATH."
return 1
fi
}
# Resizes $YUV_RAW_INPUT using the resize_util example. $1 is the output
# dimensions that will be passed to resize_util.
resize_util() {
local resizer="${LIBVPX_BIN_PATH}/resize_util${VPX_TEST_EXE_SUFFIX}"
local output_file="${VPX_TEST_OUTPUT_DIR}/resize_util.raw"
local frames_to_resize="10"
local target_dimensions="$1"
# resize_util is available only when CONFIG_SHARED is disabled.
if [ -z "$(vpx_config_option_enabled CONFIG_SHARED)" ]; then
if [ ! -x "${resizer}" ]; then
elog "${resizer} does not exist or is not executable."
return 1
fi
eval "${VPX_TEST_PREFIX}" "${resizer}" "${YUV_RAW_INPUT}" \
"${YUV_RAW_INPUT_WIDTH}x${YUV_RAW_INPUT_HEIGHT}" \
"${target_dimensions}" "${output_file}" ${frames_to_resize} \
${devnull} || return 1
[ -e "${output_file}" ] || return 1
fi
}
# Halves each dimension of $YUV_RAW_INPUT using resize_util().
resize_down() {
local target_width=$((${YUV_RAW_INPUT_WIDTH} / 2))
local target_height=$((${YUV_RAW_INPUT_HEIGHT} / 2))
resize_util "${target_width}x${target_height}"
}
# Doubles each dimension of $YUV_RAW_INPUT using resize_util().
resize_up() {
local target_width=$((${YUV_RAW_INPUT_WIDTH} * 2))
local target_height=$((${YUV_RAW_INPUT_HEIGHT} * 2))
resize_util "${target_width}x${target_height}"
}
resize_util_tests="resize_down
resize_up"
run_tests resize_util_verify_environment "${resize_util_tests}"
+2 -2
View File
@@ -8,10 +8,11 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include "third_party/googletest/src/include/gtest/gtest.h"
#include "gtest/gtest.h"
#include "./vpx_config.h"
#include "./vpx_dsp_rtcd.h"
@@ -23,7 +24,6 @@
#include "vpx/vpx_codec.h"
#include "vpx_mem/vpx_mem.h"
#include "vpx_ports/mem.h"
#include "vpx_ports/msvc.h"
#include "vpx_ports/vpx_timer.h"
// const[expr] should be sufficient for DECLARE_ALIGNED but early
+1 -1
View File
@@ -15,7 +15,7 @@
#include <string.h>
#include <sys/types.h>
#include "third_party/googletest/src/include/gtest/gtest.h"
#include "gtest/gtest.h"
#include "test/acm_random.h"
#include "vp8/encoder/onyx_int.h"
#include "vpx/vpx_integer.h"
+1 -1
View File
@@ -12,7 +12,7 @@
#include <memory>
#include <string>
#include <vector>
#include "third_party/googletest/src/include/gtest/gtest.h"
#include "gtest/gtest.h"
#include "test/video_source.h"
#include "vp9/simple_encode.h"
+8 -1
View File
@@ -14,7 +14,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"
@@ -119,6 +119,13 @@ INSTANTIATE_TEST_SUITE_P(
&vpx_sum_squares_2d_i16_neon)));
#endif // HAVE_NEON
#if HAVE_SVE
INSTANTIATE_TEST_SUITE_P(
SVE, SumSquaresTest,
::testing::Values(make_tuple(&vpx_sum_squares_2d_i16_c,
&vpx_sum_squares_2d_i16_sve)));
#endif // HAVE_SVE
#if HAVE_SSE2
INSTANTIATE_TEST_SUITE_P(
SSE2, SumSquaresTest,
+1 -1
View File
@@ -10,7 +10,7 @@
#include <climits>
#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/i420_video_source.h"
+1 -1
View File
@@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "./vpx_config.h"
#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"
+1 -1
View File
@@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "./vpx_config.h"
#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"
+1 -1
View File
@@ -12,7 +12,7 @@
#define VPX_TEST_SVC_TEST_H_
#include "./vpx_config.h"
#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"
+2
View File
@@ -22,6 +22,8 @@ LIBVPX_TEST_DATA-$(CONFIG_ENCODERS) += park_joy_90p_8_422.y4m
LIBVPX_TEST_DATA-$(CONFIG_ENCODERS) += park_joy_90p_8_444.y4m
LIBVPX_TEST_DATA-$(CONFIG_ENCODERS) += park_joy_90p_8_440.yuv
LIBVPX_TEST_DATA-$(CONFIG_VP8_ENCODER) += repro-oss-fuzz-69906.y4m
LIBVPX_TEST_DATA-$(CONFIG_VP9_ENCODER) += desktop_credits.y4m
LIBVPX_TEST_DATA-$(CONFIG_VP9_ENCODER) += niklas_1280_720_30.y4m
LIBVPX_TEST_DATA-$(CONFIG_VP9_ENCODER) += noisy_clip_640_360.y4m
+1
View File
@@ -871,3 +871,4 @@ d3964f9dad9f60363c81b688324d95b4ec7c8038 *invalid-bug-148271109.ivf.res
ad18ca16f0a249fb3b7c38de0d9b327fed273f96 *hantro_collage_w352h288_nv12.yuv
8a0b2c350539859463d3546a67876c83ff6ff0ac *desktopqvga.320_240.yuv
ad9942a073e245585c93f764ea299382a65939a7 *crowd_run_360p_10_150f.y4m
f9a73e921552598a5804911e9f84fec2318e056a *repro-oss-fuzz-69906.y4m
+8
View File
@@ -24,7 +24,9 @@ LIBVPX_TEST_SRCS-yes += ../md5_utils.h ../md5_utils.c
LIBVPX_TEST_SRCS-yes += vpx_image_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += ivf_video_source.h
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += ../y4minput.h ../y4minput.c
ifneq ($(CONFIG_REALTIME_ONLY),yes)
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += altref_test.cc
endif
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += encode_api_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += error_resilience_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += i420_video_source.h
@@ -33,7 +35,9 @@ LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += resize_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += y4m_video_source.h
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += yuv_video_source.h
ifneq ($(CONFIG_REALTIME_ONLY),yes)
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += config_test.cc
endif
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += cq_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += keyframe_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += vp8_datarate_test.cc
@@ -44,7 +48,9 @@ LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += external_frame_buffer_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += user_priv_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += active_map_refresh_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += active_map_test.cc
ifneq ($(CONFIG_REALTIME_ONLY),yes)
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += alt_ref_aq_segment_test.cc
endif
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += aq_segment_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += borders_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += cpu_speed_test.cc
@@ -61,7 +67,9 @@ LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += svc_test.h
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += svc_end_to_end_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += timestamp_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += vp9_datarate_test.cc
ifneq ($(CONFIG_REALTIME_ONLY),yes)
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += vp9_ext_ratectrl_test.cc
endif
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += ../vp9/simple_encode.h
LIBVPX_TEST_SRCS-yes += decode_test_driver.cc
+1 -1
View File
@@ -12,7 +12,7 @@
#include <stdio.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"

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