feature/ISSUE-1-The-recording-method-is-very-inefficient #178
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
3 participants
Due date
No due date set.
Dependencies
No dependencies set.
Reference
IllusionMods/HSPlugins!178
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "SangMan_LINUX/HSPlugins:feature/ISSUE-1-The-recording-method-is-very-inefficient"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hello there,
By using in-memory pipeline technique, encoding time has been drastically reduced.
Bypassing GC occurrences except for KK, we pushed it to the limit as much as possible.
We have maintained maximum compatibility.
We have updated the required libraries.
In addition, we have supplemented the shortcomings.
Sincerely,
feature/ISSUE-1-The-recording-method-is-very-inefficientto WIP: feature/ISSUE-1-The-recording-method-is-very-inefficientI've done something similar with raw textures, on a way smaller scale, on my local version of VE, and I've encountered the same issue with the GC. I haven't tried this PR, but if it works in the same way, it's basically half second of encoding and half second of running the GC, so you get half of the potential speed.
Seeing this PR, i thought finally someone had managed to work around the horrible GetRawTextureData in Unity 5, but unfortunately it looks like you hit the same wall.
So, since now it's possible that the official plugin will start supporting raw textures in the encoding pipeline, i tried again to look for a workaround, and I finally found one at https://meetemq.com/2023/01/14/using-pointers-in-c-unity/.
It's quite hacky and involves following pointers in memory, basically what GetRawTextureData does itself, but it allows a similar handling to the one used for the newer NativeArray-version of GetRawTextureData, like you're doing in GetNativeRawData with _frameDataBuffer.
If you have the time, you could integrate this handling for the KK case, otherwise I'll try to add it once this PR gets merged.
It shouldn't matter here since KK is the only one without native handling, but it's an important note: this is not guaranteed to work with other games/Unity versions, as I used the decompilation of GetRawTextureData from CharaStudio (Unity 5.6.2f1) as reference.
This should be all you need:
Put in a standalone class:
Put in VideoExport or somewhere else where Logger is accessible:
For completion, here's the pseudocode from ghidra for GetRawTextureData, with a minimal set of renames needed to understand a little more:
Hello there, @mrspuff .
First of all, thank you for sharing your valuable knowledge with me, even though my brain cannot grasp it.
The unfortunate thing is that I don't have KK so I have no way to test it.
Also more importantly, as of now, I am not confident that I can handle "unsafe" keyword with my abilities.
So, I would like to prioritize maintaining the status quo in PR right now.
Sincerely,
No problem, I'll wait until this gets merged and handle it myself when I can. Thanks for the great work!
WIP: feature/ISSUE-1-The-recording-method-is-very-inefficientto feature/ISSUE-1-The-recording-method-is-very-inefficientd8514c9469toa1a10732b1Discussion moved to https://github.com/IllusionMods/HSPlugins/pull/180