-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable fast saving mode for PNGs #74324
Conversation
I'm interested. Not able to review this week due to a brief break from godot engine 4.0 release. |
BenchmarkCPU: Intel Core i9-13900K Time taken to render https://github.com/Calinou/godot-movie-maker-demo:
File size of first frame in 3840×2160:
Considering saving time is the most important criterion in Movie Maker, I'd say this increase in file size is fine. It's common for games in general to take large, unoptimized screenshots to ensure they save quickly (so they don't interrupt the action for too long). Script used for testing#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
DEMO_DIR="$HOME/Documents/Godot/godot-movie-maker-demo"
mkdir -p "$DEMO_DIR/out"
export MANGOHUD=0
echo "#################################"
echo "Editor 1280x720"
echo "#################################"
echo "AVI:"
time bin/godot.linuxbsd.editor.x86_64.master --path "$DEMO_DIR" --write-movie "out/out.avi"
echo "End AVI."
echo "Master:"
time bin/godot.linuxbsd.editor.x86_64.master --path "$DEMO_DIR" --write-movie "out/out.png"
echo "End master."
echo "This PR:"
time bin/godot.linuxbsd.editor.x86_64 --path "$DEMO_DIR" --write-movie "out/out.png"
echo "End this PR."
echo "#################################"
echo "Release export template 1280x720"
echo "#################################"
echo "AVI:"
time bin/godot.linuxbsd.template_release.x86_64.master --path "$DEMO_DIR" --write-movie "out/out.avi"
echo "End AVI."
echo "Master:"
time bin/godot.linuxbsd.template_release.x86_64.master --path "$DEMO_DIR" --write-movie "out/out.png"
echo "End master."
echo "This PR:"
time bin/godot.linuxbsd.template_release.x86_64 --path "$DEMO_DIR" --write-movie "out/out.png"
echo "End this PR."
echo "#################################"
echo "Editor 3840x2160"
echo "#################################"
echo "AVI:"
time bin/godot.linuxbsd.editor.x86_64.master --path "$DEMO_DIR" --write-movie "out/out.avi" --fullscreen
echo "End AVI."
echo "Master:"
time bin/godot.linuxbsd.editor.x86_64.master --path "$DEMO_DIR" --write-movie "out/out.png" --fullscreen
echo "End master."
echo "This PR:"
time bin/godot.linuxbsd.editor.x86_64 --path "$DEMO_DIR" --write-movie "out/out.png" --fullscreen
echo "End this PR."
echo "#################################"
echo "Release export template 3840x2160"
echo "#################################"
echo "AVI:"
time bin/godot.linuxbsd.template_release.x86_64.master --path "$DEMO_DIR" --write-movie "out/out.avi" --fullscreen
echo "End AVI."
echo "Master:"
time bin/godot.linuxbsd.template_release.x86_64.master --path "$DEMO_DIR" --write-movie "out/out.png" --fullscreen
echo "End master."
echo "This PR:"
time bin/godot.linuxbsd.template_release.x86_64 --path "$DEMO_DIR" --write-movie "out/out.png" --fullscreen
echo "End this PR." |
! Amazing. Will need to wait for a production team review. |
Won't this increase the filesize of every PNG saved by the engine? Not just the ones created by the MovieMaker feature? |
I think @myaaaaaaaaa is saying that's a good tradeoff. |
It will, but the engine defaults to saving lossless WebP when importing images since 3.5. As a result, this PR doesn't affect the size of the That said, we could make Footnotes
|
In the "Marshalls.raw_to_base64(vp.get_texture().get_data().save_png_to_buffer())" that is very slow, and have several bottleneck points, one being that get_texture() itself, that can be better implemented to have bigger delay but lower cpu usage, the Save_png_to_buffer(), is still the one that consumes the most CPU time. |
I agree we should make this a flag in Could default to fast compression, but users should still have a way to opt in to best compression if they value size over compression speed. |
Needs more work after discussion.
Makes saving PNGs 2.5x faster for me at only 2% (!) increase in filesize, although please note that I only did basic testing. Presumably, more compressible images would end up with a bigger filesize penalty.
Helps with Movie Maker, see godotengine/godot-proposals#4751
Fixes #51868