Repository navigation
rdoq: skip uncoded cost setup for trailing zero groups - #990
xiujunwang-dev wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Hi @xiujunwang-dev, thanks for the patch.
I verified it on x86 and ARM64 (8/10/12-bit, 26 test cases, asm off/on, AVX2 and AVX512). The output is bit-exact with master, with identical bitrate/PSNR/SSIM, and the testbench passes.
On ARM64 I see a small gain (about +1.8% fps with asm on). On x86, though, encoding is consistently about 6–7% slower in fps with both AVX2 and AVX512, across all presets, bit depths and test cases (low QP and CRF 18 are hit hardest, at about −9 to −10%). With --no-asm, x86 is neutral, so the slowdown comes from the SIMD path. A possible cause: the per-group psyRdoQuant/nonPsyRdoQuant calls replace the vectorized whole-block psyRdoQuantAll/nonPsyRdoQuantAll routines, and psyRdoQuant has no AVX2 version.
With the default preset (medium, rdoq-level 0) there is no impact, as expected (BasketballDrive 1080p, CRF 28: 21.50 vs 21.61 fps). The x86 regression appears only with RDOQ enabled (--preset slow and slower, or --rdoq-level 1/2).
Could you help with the following?
- Have you seen this slowdown on x86, or did you test only on arm64?
- Could you share the exact x265 command lines and input clips (the “HD” and “Portrait” inputs) you used for the rdoQuant timings and the 36 RDOQ output checks?
- Could you check x86 performance on your side (encoder fps and rdoQuant ns/call with --asm avx2 and --asm avx512)?
When the final coefficient group precedes trailing zero groups,
rdoQuantcurrently initializes uncoded distortion for every coefficient. The trailing groups add the same cost to every candidate, so this omits common work while preserving RDOQ decisions.Validation:
Quant::rdoQuantfunction-level timing on arm64, five paired runs (ns/call):