libyuv/docs/environment_variables.md
Frank Barchard f310cb6ce1 [libyuv] Pilot OpenMP support for row processing
Add SetMaxThreads() and GetMaxThreads() APIs (with LIBYUV_NUM_THREADS
environment variable override, defaulting to half of logical cores
capped at 8 when built with -fopenmp).

Enable OpenMP parallel row processing for large frames (>= 1280x720)
in I420ToARGBMatrix and CopyPlane (including reshaping coalesced
contiguous planes across threads), and configure thread counts for
ComputeHammingDistance, ComputeSumSquareError, and CalcFrameSsim.

1280x720 Benchmarks (ms):
Benchmark          Reps    1T    2T    4T    8T  Speedup
--------------------------------------------------------
I420ToARGB_Opt     1000   272   162    88    60    4.53x
CopyPlane_Opt      1000    57    42    19    14    4.07x
BenchmarkPsnr_Opt  1000    92    76    56    34    2.71x
BenchmarkSsim_Opt   100   518   241   147    89    5.82x

R=rrwinterton@gmail.com

Bug: none
Test: libyuv_unittest --gtest_filter=*TestSetMaxThreads*:*I420ToARGB_Opt*:*CopyPlane_Opt*:*Ssim*
Change-Id: I5ca9a2b8c68eaac870da6353c51306930d015c3a
CONV=a7f09b98-93ab-4652-a8eb-8d9551361f61
TAG=agy
2026-10-19 15:17:30 -07:00

1.7 KiB

Introduction

For test purposes, environment variables can be set to control libyuv behavior. These should only be used for testing, to narrow down bugs or to test performance.

CPU

By default the cpu is detected and the most advanced form of SIMD is used. But you can disable instruction sets selectively, or completely, falling back on C code. Set the variable to 1 to disable the specified instruction set.

All CPUs

LIBYUV_DISABLE_ASM

Intel CPUs

LIBYUV_DISABLE_X86
LIBYUV_DISABLE_SSE2
LIBYUV_DISABLE_SSSE3
LIBYUV_DISABLE_SSE41
LIBYUV_DISABLE_SSE42
LIBYUV_DISABLE_AVX
LIBYUV_DISABLE_AVX2
LIBYUV_DISABLE_ERMS
LIBYUV_DISABLE_FMA3
LIBYUV_DISABLE_F16C
LIBYUV_DISABLE_AVX512BW
LIBYUV_DISABLE_AVX512VL
LIBYUV_DISABLE_AVX512VNNI
LIBYUV_DISABLE_AVX512VBMI
LIBYUV_DISABLE_AVX512VBMI2
LIBYUV_DISABLE_AVX512VBITALG
LIBYUV_DISABLE_AVX10
LIBYUV_DISABLE_AVX10_2
LIBYUV_DISABLE_AVXVNNI
LIBYUV_DISABLE_AVXVNNIINT8
LIBYUV_DISABLE_AMXINT8

Arm CPUs

LIBYUV_DISABLE_NEON
LIBYUV_DISABLE_NEON_DOTPROD
LIBYUV_DISABLE_NEON_I8MM
LIBYUV_DISABLE_SVE
LIBYUV_DISABLE_SVE2
LIBYUV_DISABLE_SME

LOONGARCH CPUs

LIBYUV_DISABLE_LSX
LIBYUV_DISABLE_LASX

RISCV CPUs

LIBYUV_DISABLE_RVV

Hexagon CPUs

LIBYUV_DISABLE_HVX

Test Width/Height/Repeat

The unittests default to a small image (128x72) to run fast. This can be set by environment variable to test a specific resolutions. You can also repeat the test a specified number of iterations, allowing benchmarking and profiling.

set LIBYUV_WIDTH=1280
set LIBYUV_HEIGHT=720
set LIBYUV_REPEAT=999
set LIBYUV_FLAGS=-1
set LIBYUV_CPU_INFO=-1
set LIBYUV_NUM_THREADS=4