NVENC - quality degradation with HEVC and B-frames reference mode MIDDLE

We are observing PSNR and visual quality drop in NVENC since drivers 525 (550 also tested) when using B-frames with parameter reference MIDDLE.

VMAF quality drop is around 0.7 (avg 82.7 → 82 in our samples)

Degradation is observed only on B ref mode MIDDLE and HEVC, there is no any issues with mode EACH and NONE or with H264 instead.

It looks like issue is located in part which is calculating number of reference frames as when limiting reference frames to 2 it is not observed when using 1 B-frames.

Is anyone else is facing this issue?
Do you need more info?
Is B ref mode MIDDLE still recomended or should we switch to EACH?

It looks like issue is with L0/L1 reference frames functionality, from our tests mode MIDDLE will ignore any value set in numRefL1 and will treat it as zero.

Same test with mode EACH will output different PSNR for different combinations of L0/L1.

Test with 4 B-frames: numRefL0 / numRefL1 - PSNR

--- EACH ---

auto - 34.065502

2/2 - 34.010047
4/4 - 34.073324
6/6 - 34.085693

2/0 - 33.945370
4/0 - 34.065502 <-- ref (auto)
6/0 - 34.076715

--- MIDDLE ---

auto - 33.986005 

2/2 - 33.928253 <-- should be more
4/4 - 33.986005 <-- should be more
6/6 - 33.986005 <-- should be more

2/0 - 33.928253
4/0 - 33.986005 <-- ref (auto)
6/0 - 33.986005