CARVIEW |
Navigation Menu
-
-
Notifications
You must be signed in to change notification settings - Fork 56.2k
APNG encoding optimization #26849
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
APNG encoding optimization #26849
Conversation
I propose to add simple performance test. |
An animation with 1 frame is not the same as one image (though it will be displayed the same). |
It should be like that for webp and avif. But when an animated png saved with only one frame, the only thing that changes actually is being 10 times slower. following code just writes IHDR and IDAT chunks like imwrite
|
anyway let me work on this PR a bit more. creating a performans test and maybe rethinking on one frame apng |
it was Z_BEST_COMPRESSION used for writing ( even writing with IMWRITE_PNG_COMPRESSION param) |
4cae20b
to
e70f4eb
Compare
@sturkmen72 Please rebase and fix conflict after you PR merge. |
e70f4eb
to
a22f8b5
Compare
943089c
to
8e06f9d
Compare
7987be5
to
97004ac
Compare
modules/imgcodecs/perf/perf_png.cpp
Outdated
SANITY_CHECK_NOTHING(); | ||
} | ||
|
||
PERF_TEST_P(PNG, DISABLED_params_filter_max_compression, testing::ValuesIn(PNGFilterFlags)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it disabled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when a common user run it takes so long time ( --perf_force_samples default value is 100 )
IMWRITE_PNG_NO_FILTERS = 0, //!< Disables all filtering. No filters will be applied when saving the image. | ||
IMWRITE_PNG_FILTER_NONE = 8, //!< Applies no filter to the PNG image (useful when you want to save the raw pixel data without any compression filter). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is difference between IMWRITE_PNG_NO_FILTERS and IMWRITE_PNG_FILTER_NONE? Why do we need both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they produces different sized outputs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMWRITE_PNG_NO_FILTERS removed. with libpng IMWRITE_PNG_NO_FILTERS and IMWRITE_PNG_ALL_FILTERS gives same results. with libspng IMWRITE_PNG_NO_FILTERS and IMWRITE_PNG_FILTER_NONE gives same results.
@asmorkalov i will try to write tests using PngSuite - Image filtering / PNG-files |
Ok, please try to use existing files in opencv-extra and do not add more. We have some subset of the suite already. |
22186b6
to
cf59c0c
Compare
@sturkmen72 Please rebase and fix conflicts. |
eda302f
to
e9f5c7e
Compare
e9f5c7e
to
8446122
Compare
@vrabaud I'm ready to merge the patch. Do you have any remarks? |
@vrabaud Please take a look again. |
related #26840
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.