rust-av / ssimulacra2_bin

Binary interface for the ssimulacra2 Rust port
BSD 2-Clause "Simplified" License
40 stars 10 forks source link

[Suggestion] Support fewer image formats #23

Closed FreezyLemon closed 1 year ago

FreezyLemon commented 1 year ago

The default feature list of image is [bmp, dds, default, dxt, exr, farbfeld, gif, hdr, ico, jpeg, jpeg_rayon, openexr, png, pnm, scoped_threadpool, tga, tiff, webp].

I'd argue that a lot of these are not needed.

These features significantly bloat the binary size (6.2MiB / 3.6MiB -> 4.4MiB / 2.1MiB, unstripped / stripped, respectively) and also increase the build time in release mode a lot. The reason for this seems to be that the release profile uses codegen-units=1. Reducing the feature matrix above to just [png, jpeg] (like in this PR) reduces the build time for the image crate from ~16.7 seconds to 5.4. This results in roughly 50% time saved when building the entire project. The difference for debug builds is a lot smaller.

I'm open to discussion on what formats to "eliminate", but the default case is overkill IMHO. PNG and JPEG probably covers most use cases.

BTW: The original ssimulacra2 project only supports PNG input, as far as I'm aware.

shssoichiro commented 1 year ago

I'm good with this, I'd maybe enable webp as well since it's become more commonly used.

BuyMyMojo commented 1 year ago

Supporting openexr/exr and the hdr image formats is probably a good idea for being able to compare HDR video.

tiff support might also be useful as converting videos to tiff can be faster than png. (34fps for png and 180fps for tiff in a quick ffmpeg test)

FreezyLemon commented 1 year ago

@BuyMyMojo For videos, the video feature should be more convenient than converting to a frame sequence and comparing each frame pair via ssimulacra2_rs image ref dst.

Or are there any limitations to running ssimulacra2_rs video ref dst that image comparisons would work around? In that case, it might be better to implement those things in video mode too.

BuyMyMojo commented 1 year ago

for quick comparisons, I prefer to make single image comparisons before doing video clips because of the compute time ssimulacra2 takes so having HDR support for the image mode is very helpful

shssoichiro commented 1 year ago

Okay I readded those. Though it did add back in a few dependencies, not surprisingly.