Skip to content

Enabling "threaded-me" resulting in a massive performance regression #780

Description

@Akilan-Sivakumar

BB Issue #1028
Original issue created by MTTF (bitbucket username :MTTF).
Created on Bitbucket: 2026-03-06
Last updated on Bitbucket: 2026-03-20

I do realize the feature just got implemented, but considering it is supposed to speed up certain operations by "up to 50%" there is clearly a major issue somewhere.

Arch Linux 6.19.6, AMD Zen 5 based 16C/32T processor.

1080, Medium-preset: -55%

Without threaded-me:

./x265 --input FHD.y4m --preset medium --crf 21.0 --output Output.h265 y4m  [info]: 1920x1080 fps 30/1 i420p8 frames 0 - 352 of 353
raw  [info]: output file: Output.h265
x265 [info]: HEVC encoder version 4.1+234-e12088582
x265 [info]: build info [Linux][GCC 15.2.1][64 bit] 10bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 AVX512
x265 [info]: Main 10 profile, Level-4 (Main tier)
x265 [info]: Thread pool created using 32 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 5 / wpp(17 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 3
x265 [info]: Keyframe min / max / scenecut / bias  : 25 / 250 / 40 / 5.00 
x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 3 / off / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : CRF-21.0 / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip mode=1 signhide tmvp
x265 [info]: tools: b-intra strong-intra-smoothing lslices=6 deblock sao
x265 [info]: frame I:      3, Avg QP:21.98  kb/s: 35579.52                      
x265 [info]: frame P:     74, Avg QP:22.20  kb/s: 12535.63
x265 [info]: frame B:    276, Avg QP:28.01  kb/s: 1353.17 
x265 [info]: Weighted P-Frames: Y:0.0% UV:0.0%

encoded 353 frames in 3.66s (96.33 fps), 3988.25 kb/s, Avg QP:26.74
x265 [info]: CU: %12.10 time spent in motion estimation, averaging 8.999 CU inter modes per CTU
x265 [info]: CU: Skipped motion searches per depth %50.52 %36.06 %43.47 %0.00
x265 [info]: CU: %03.03 time spent in intra analysis, averaging 8.709 Intra PUs per CTU
x265 [info]: CU: Skipped intra CUs at depth %-nan %170.85 %150.50
x265 [info]: CU: %15.54 time spent in inter RDO, measuring 25.750 inter/merge predictions per CTU
x265 [info]: CU: %10.11 time spent in intra RDO, measuring 22.416 intra predictions per CTU
x265 [info]: CU: %06.34 time spent in loop filters, average 0.540 ms per call
x265 [info]: CU: %00.16 time spent in weight analysis, average 1.071 ms per call
x265 [info]: CU: %40.38 time spent in slicetypeDecide (avg 32.547ms) and prelookahead (avg 4.206ms)
x265 [info]: CU: %12.34 time spent in other tasks
x265 [info]: CU: Intra RDO time  per depth %00.00 %20.69 %18.55 %60.76
x265 [info]: CU: Intra RDO calls per depth %00.00 %02.52 %07.41 %90.07
x265 [info]: CU: Inter RDO time  per depth %22.60 %32.21 %21.23 %23.97
x265 [info]: CU: Inter RDO calls per depth %03.78 %14.31 %26.13 %55.79
x265 [info]: CU: 180030 64X64 CTUs compressed in 51.110 seconds, 3522.426 CTUs per worker-second
x265 [info]: CU: 13.947 average worker utilization, %43.58 of theoretical maximum utilization

With threaded-me:

./x265 --input FHD.y4m --preset medium --crf 21.0 --threaded-me --output Output.h265
y4m  [info]: 1920x1080 fps 30/1 i420p8 frames 0 - 352 of 353
raw  [info]: output file: Output.h265
x265 [info]: HEVC encoder version 4.1+234-e12088582
x265 [info]: build info [Linux][GCC 15.2.1][64 bit] 10bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 AVX512
x265 [info]: Main 10 profile, Level-4 (Main tier)
x265 [info]: Thread pool created using 25 threads
x265 [info]: Thread pool created using 7 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 2 / wpp(17 rows)+threaded-me
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: ThreadedME: task block / buf rows   : 1 / 10
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 3
x265 [info]: Keyframe min / max / scenecut / bias  : 25 / 250 / 40 / 5.00 
x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 3 / off / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : CRF-21.0 / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip mode=1 signhide tmvp
x265 [info]: tools: b-intra strong-intra-smoothing lslices=6 deblock sao
x265 [info]: frame I:      3, Avg QP:21.98  kb/s: 35579.52                      
x265 [info]: frame P:     74, Avg QP:22.21  kb/s: 12669.02
x265 [info]: frame B:    276, Avg QP:27.96  kb/s: 1533.53 
x265 [info]: Weighted P-Frames: Y:0.0% UV:0.0%

encoded 353 frames in 8.19s (43.12 fps), 4157.23 kb/s, Avg QP:26.70
x265 [info]: CU: %74.82 time spent in motion estimation, averaging 53.960 CU inter modes per CTU
x265 [info]: CU: %01.01 time spent in intra analysis, averaging 9.208 Intra PUs per CTU
x265 [info]: CU: Skipped intra CUs at depth %-nan %164.98 %147.70
x265 [info]: CU: %05.19 time spent in inter RDO, measuring 25.458 inter/merge predictions per CTU
x265 [info]: CU: %03.46 time spent in intra RDO, measuring 22.915 intra predictions per CTU
x265 [info]: CU: %03.44 time spent in loop filters, average 0.974 ms per call
x265 [info]: CU: %00.04 time spent in weight analysis, average 0.999 ms per call
x265 [info]: CU: %08.18 time spent in slicetypeDecide (avg 95.183ms) and prelookahead (avg 4.056ms)
x265 [info]: CU: %03.85 time spent in other tasks
x265 [info]: CU: Intra RDO time  per depth %00.00 %22.18 %18.62 %59.20
x265 [info]: CU: Intra RDO calls per depth %00.00 %02.68 %07.62 %89.70
x265 [info]: CU: Inter RDO time  per depth %23.82 %31.81 %20.83 %23.54
x265 [info]: CU: Inter RDO calls per depth %03.46 %13.37 %25.86 %57.32
x265 [info]: CU: 180030 64X64 CTUs compressed in 170.155 seconds, 1058.038 CTUs per worker-second
x265 [info]: CU: 13325 CTUs blocked by ThreadedME, %07.40 of total CTUs
x265 [info]: CU: 20.784 average worker utilization, %64.95 of theoretical maximum utilization

1080, Slow -preset: -69%

Without threaded-me:

./x265 --input FHD.y4m --preset slow --crf 21.0 --output Output.h265
y4m  [info]: 1920x1080 fps 30/1 i420p8 frames 0 - 352 of 353
raw  [info]: output file: Output.h265
x265 [info]: HEVC encoder version 4.1+234-e12088582
x265 [info]: build info [Linux][GCC 15.2.1][64 bit] 10bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 AVX512
x265 [info]: Main 10 profile, Level-4 (Main tier)
x265 [info]: Thread pool created using 32 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 5 / wpp(17 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : star / 57 / 3 / 3
x265 [info]: Keyframe min / max / scenecut / bias  : 25 / 250 / 40 / 5.00 
x265 [info]: Lookahead / bframes / badapt        : 25 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 4 / on / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : CRF-21.0 / 0.60
x265 [info]: tools: rect limit-modes rd=4 psy-rd=2.00 rdoq=2 psy-rdoq=1.00
x265 [info]: tools: rskip mode=1 signhide tmvp strong-intra-smoothing lslices=4
x265 [info]: tools: deblock sao
x265 [info]: frame I:      3, Avg QP:21.92  kb/s: 33589.44                      
x265 [info]: frame P:     73, Avg QP:22.07  kb/s: 14977.62
x265 [info]: frame B:    277, Avg QP:27.84  kb/s: 1667.21 
x265 [info]: Weighted P-Frames: Y:0.0% UV:0.0%

encoded 353 frames in 9.50s (37.15 fps), 4691.08 kb/s, Avg QP:26.60
x265 [info]: CU: %50.45 time spent in motion estimation, averaging 45.673 CU inter modes per CTU
x265 [info]: CU: Skipped motion searches per depth %62.83 %62.97 %63.55 %59.53
x265 [info]: CU: %01.00 time spent in intra analysis, averaging 6.832 Intra PUs per CTU
x265 [info]: CU: Skipped intra CUs at depth %-nan %133.50 %120.75
x265 [info]: CU: %18.12 time spent in inter RDO, measuring 34.844 inter/merge predictions per CTU
x265 [info]: CU: %06.31 time spent in intra RDO, measuring 21.483 intra predictions per CTU
x265 [info]: CU: %00.98 time spent in loop filters, average 0.202 ms per call
x265 [info]: CU: %00.06 time spent in weight analysis, average 1.001 ms per call
x265 [info]: CU: %15.97 time spent in slicetypeDecide (avg 33.792ms) and prelookahead (avg 4.514ms)
x265 [info]: CU: %07.11 time spent in other tasks
x265 [info]: CU: Intra RDO time  per depth %00.00 %20.83 %20.44 %58.72
x265 [info]: CU: Intra RDO calls per depth %00.00 %02.06 %06.98 %90.95
x265 [info]: CU: Inter RDO time  per depth %26.56 %31.18 %20.91 %21.35
x265 [info]: CU: Inter RDO calls per depth %05.15 %15.42 %25.79 %53.63
x265 [info]: CU: 180030 64X64 CTUs compressed in 124.500 seconds, 1446.026 CTUs per worker-second
x265 [info]: CU: 13.103 average worker utilization, %40.95 of theoretical maximum utilization

With threaded-me:

 ./x265 --input FHD.y4m --preset slow --crf 21.0 --threaded-me --output Output.h265
y4m  [info]: 1920x1080 fps 30/1 i420p8 frames 0 - 352 of 353
raw  [info]: output file: Output.h265
x265 [info]: HEVC encoder version 4.1+234-e12088582
x265 [info]: build info [Linux][GCC 15.2.1][64 bit] 10bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 AVX512
x265 [info]: Main 10 profile, Level-4 (Main tier)
x265 [info]: Thread pool created using 25 threads
x265 [info]: Thread pool created using 7 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 2 / wpp(17 rows)+threaded-me
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: ThreadedME: task block / buf rows   : 1 / 10
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : star / 57 / 3 / 3
x265 [info]: Keyframe min / max / scenecut / bias  : 25 / 250 / 40 / 5.00 
x265 [info]: Lookahead / bframes / badapt        : 25 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 4 / on / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : CRF-21.0 / 0.60
x265 [info]: tools: rect limit-modes rd=4 psy-rd=2.00 rdoq=2 psy-rdoq=1.00
x265 [info]: tools: rskip mode=1 signhide tmvp strong-intra-smoothing lslices=4
x265 [info]: tools: deblock sao
x265 [info]: frame I:      3, Avg QP:21.92  kb/s: 33589.44                      
x265 [info]: frame P:     73, Avg QP:22.07  kb/s: 15329.04
x265 [info]: frame B:    277, Avg QP:27.67  kb/s: 1793.78 
x265 [info]: Weighted P-Frames: Y:0.0% UV:0.0%

encoded 353 frames in 30.67s (11.51 fps), 4863.07 kb/s, Avg QP:26.46
x265 [info]: CU: %91.19 time spent in motion estimation, averaging 173.199 CU inter modes per CTU
x265 [info]: CU: %00.19 time spent in intra analysis, averaging 6.888 Intra PUs per CTU
x265 [info]: CU: Skipped intra CUs at depth %-nan %124.28 %114.08
x265 [info]: CU: %03.51 time spent in inter RDO, measuring 31.776 inter/merge predictions per CTU
x265 [info]: CU: %01.31 time spent in intra RDO, measuring 21.539 intra predictions per CTU
x265 [info]: CU: %00.52 time spent in loop filters, average 0.726 ms per call
x265 [info]: CU: %00.01 time spent in weight analysis, average 1.410 ms per call
x265 [info]: CU: %02.06 time spent in slicetypeDecide (avg 86.118ms) and prelookahead (avg 4.259ms)
x265 [info]: CU: %01.19 time spent in other tasks
x265 [info]: CU: Intra RDO time  per depth %00.00 %21.97 %20.45 %57.58
x265 [info]: CU: Intra RDO calls per depth %00.00 %02.13 %07.04 %90.83
x265 [info]: CU: Inter RDO time  per depth %24.68 %31.36 %20.96 %23.00
x265 [info]: CU: Inter RDO calls per depth %04.12 %14.08 %25.84 %55.96
x265 [info]: CU: 180030 64X64 CTUs compressed in 835.014 seconds, 215.601 CTUs per worker-second
x265 [info]: CU: 38752 CTUs blocked by ThreadedME, %21.53 of total CTUs
x265 [info]: CU: 27.225 average worker utilization, %85.08 of theoretical maximum utilization

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions