Page 1 of 1

Slowness on pure decoding

Posted: Sun Jun 12, 2022 1:36 pm
by Guest 2
I am having some fast encoding with x265 preset medium and there were some strange drops in CPU usage.

I was not used to them as I always use preset slow and the CPU is completely busy in the encoding process.

I have found, strangely, that adding a simple prefetch (2) at the end of the AVS script increases my fps by almost 100%. Increasing to more than 2 does nothing or reduces performance.

The script is really simple:

SetMemoryMax()
SetFilterMTMode("DEFAULT_MT_MODE", 2)
LoadPlugin("D:\Eseguibili\Media\DGDecNV\DGDecodeNV.dll")
DGSource("F:\In\1_35 Boku no hero academia - Futari no hero\futari.dgi")
Prefetch(2)

I can't understand why I need the prefetch. My CPU is a really old i7-2600k and it isn't so fast to have to wait the gpu to provide frames. My GPU is a modern 1660 SUPER.

Anyway, that's it.

Ideas?

Slowness on pure decoding

Posted: Sun Jun 12, 2022 2:21 pm
by Bullwinkle
Get rid of the SetMemoryMax() and SetMTMode(). They are not needed for this script.

What is the container and video type?

Are you using AVSMeter64 to measure the FPS? If not, then what? If it is measured somehow during transcoding, I cannot control or immediately explain how the encoder invokes AVS, and its threading model, etc. Try with AVSMeter64 and we'll go from there if it is OK.

EDIT: I just did a test with this script (measuring with AVSMeter64):

loadplugin("d:\don\Programming\C++\dgdecnv\DGDecodeNV\x64\release\dgdecodenv.dll")
dgsource("D:\tmp\Guest 2\03 Una piccola ribellione.dgi")
prefetch(2)

Without prefetch: 460 FPS
With prefetch: 59 FPS

Slowness on pure decoding

Posted: Mon Jun 13, 2022 8:31 am
by Guest 2
Bullwinkle wrote:
Sun Jun 12, 2022 2:21 pm
Get rid of the SetMemoryMax() and SetMTMode(). They are not needed for this script.
I followed your instructions and here are the results.
Image
Bullwinkle wrote:
Sun Jun 12, 2022 2:21 pm
What is the container and video type?
There is minimal difference between mkv and m2ts.
Bullwinkle wrote:
Sun Jun 12, 2022 2:21 pm
Are you using AVSMeter64 to measure the FPS?
No. Syntethic benchmark is not useful in this situation. I need to encode the file, not to test video card speed.

Slowness on pure decoding

Posted: Mon Jun 13, 2022 8:53 am
by Bullwinkle
Please tell us your full and exact process so we can duplicate things. It's obvious this is related to x265 behavior, so we need to know EXACTLY and COMPLETELY what you are doing.

Slowness on pure decoding

Posted: Mon Jun 13, 2022 11:06 am
by Guest 2
Bullwinkle wrote:
Mon Jun 13, 2022 8:53 am
Please tell us your full and exact process so we can duplicate things.
avs+ [INFO]: AviSynth+ 3.7.2 (r3661, 3.7, x86_64)
avs+ [INFO]: 1920x1080 fps 24000/1001 i420p8 frames 0 - 32885 of 32886
x265 [INFO]: HEVC encoder version 3.5+37+12-4e46995bc [Mod by Patman]

Get a MKV file, 1080p full frame, possibly very compressible, such as flat colored anime, and index it.

You already know the AVS scripts: the only differences are the MT lines, present or not, and the Prefetch(x).

The encode command is:

D:\Eseguibili\Media\StaxRip\Apps\Encoders\x265\x265.exe --crf 22 --output-depth 10 --aq-mode 5 --fades --pools 12 --colorprim bt709 --colormatrix bt709 --transfer bt709 --range limited --output "F:\In\1_35 Boku no hero academia - Futari no hero\futari_1_temp\futari_1_out.hevc" "F:\In\1_35 Boku no hero academia - Futari no hero\futari_1_temp\futari_1.avs"

Pools number is up to you. My trials are from 8 to 12 on a 4 physical/8 logical core cpu.

Please notice that storage is not the bottleneck, as everything is on SSD here.

I have some doubts about the efficiency of my PCI-E 2.0 slot. Anyway I think that is more than enough.

Slowness on pure decoding

Posted: Mon Jun 13, 2022 11:08 am
by Rocky
Great info, thank you. Will try to duplicate it.

You can try also with a different decoder to see if the same thing is seen. If so, it's unlikely we can do anything about it.

Slowness on pure decoding

Posted: Mon Jun 13, 2022 12:11 pm
by Rocky
You initially wrote:

"I have found, strangely, that adding a simple prefetch (2) at the end of the AVS script increases my fps by almost 100%."

But the table you subsequently gave shows (for pools 12) an increase from 7.66 fps to 8.56 fps. How is that 100%?

Such a small difference can be accounted for by the windows cache and other factors. 100% is easy to get excited about, but this?

Slowness on pure decoding

Posted: Mon Jun 13, 2022 1:08 pm
by Guest 2
Rocky wrote:
Mon Jun 13, 2022 12:11 pm
"I have found, strangely, that adding a simple prefetch (2) at the end of the AVS script increases my fps by almost 100%."
I *swear* I saw the increase. :mrgreen:

Then I repeated in a scientific approach on multiple trials and I got consistent results.

Slowness on pure decoding

Posted: Mon Jun 13, 2022 1:09 pm
by Rocky
I ran a test with pools 12:

no prefetch: 31.92 fps
prefetch 2: 29.5 fps

Hoping for clarification from your side on the 100% claim.

EDIT: OK, just saw your post above.

Will mark resolved.

MKV re-design is proceeding well, BTW.