revert: encode PNG with zlib at the requested compression level (#18387) #21466
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/21466"
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?
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-11-16T07:18:02Z.
What
Exact inverse revert of #18387 (merge
179a2ef3dc). Since it merged, the Windowspatched_librariestest fails onmain(0694c4cbd6, on two machines):libSceVideoOut.prxandlibSceGnmDriver.prxfail to load withLoadLibraryExerror 127. The PNG encoder now calls zlib'scompress2andcompressBound; on WindowslibSceVideoOut.prximports them fromlibSceAgcDriver.prx(checked withobjdump -pon the built files), which does not export them, andlibSceGnmDriver.prxfails because it loadslibSceVideoOut.prx. The compression-level fix can come back once the PNG decoder links zlib so that every library using it gets its own copy.Tested
The full Windows suite on this PR must show
patched_librariespassing.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-16T07:20:19Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
9f284c930e:tools/check_conventions.pypassed;git diff --checkclean.decoder_png_tests,guest_png_enc_testsbuilt cleanly.decoder_png,guest_png_enc):core/Decoder/Png/src/Png.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.core/Decoder/Png/CMakeLists.txtremoveszlibstaticand--exclude-libslink options, restoring linkage strictly against${runtimeTarget}.core/Decoder/Png/src/Png.cpp(Decoder::Png::Encode) bounds-checks(rowSize + 1) * height <= INT_MAXbefore castingfiltered.size()tointforstbi_zlib_compress, and frees the returned buffer withSTBIW_FREEviastd::unique_ptrcustom deleter.core/Decoder/Png/src/Png.cppthrowsstd::runtime_errorwhenstbi_zlib_compressreturnsnullptrand passescompressedSizesafely asstd::size_ttoappendChunk.core/Decoder/Png/tests/Png.cppandcore/libs/tests/GuestPngEnc.cppcleanly remove only the stored-block compression-level 0 assertions introduced in #18387 while retaining full round-trip, filter-selection, and error-handling coverage.AGENTS.mdandCONVENTIONS.md(no code comments, no stray files, passing mechanical conventions and CTest suites fordecoder_pngandguest_png_enc).Looks Good To Me