Description: Uint16 Overflow on the compression rate calculation Steps to Reproduce: 1. Load a large png image (eg. 70 MB) into impress 2. Call the compression tool 3. Let it calculate the compression rate Actual Results: Compression Rate: -18% Expected Results: Compression Rate: 98% Reproducible: Always User Profile Reset: No Additional Info: There is an UNIT16 overflow since the image is larger than 65535
Created attachment 184880 [details] Screenshot
Reproduced with: Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: 7f23dae00fedc9d7119b44b6c44d9eca4f8c87b8 CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3 Locale: en-AU (en_AU.UTF-8); UI: en-US Calc: threaded Using default settings in Right click > Compress, clicking "Calculate New Size", the calculated reduction in size is wrong for a large PNG file of about 48 mb. Large 47,196 kb file generated with ImageMacick: convert -size 5000x5000 xc:gray +noise gaussian large.png New size will be 20,484 kb but reduction displayed as "-32% reduction". Not-so-large 16,992 kb file generated with: convert -size 3000x3000 xc:gray +noise gaussian not_too_large.png New size will be 7,376 kb, correct reduction displayed: "56% reduction".
Tests with images generated with commands in Comment 2: - LO 7.1.0.3 (when percentages started being shown): - Large: 47,196 -> 439 kiB = 10% reduction (wrong) - Smaller: 16,992 -> 143 kiB = 99% reduction (correct) - LO 7.2.7.2 to 7.3.7.2: - Large: 47,196 -> 467 kiB = 10% reduction (wrong) - Smaller: 16,992 -> 151 kiB = 99% reduction (correct) - LO 7.4.6.2 - Large: 47,196 -> 19,637 = -30% reduction (wrong) - Smaller: 16,992 -> 7,071 = 58% reduction (correct) - LO 7.5.3.1 to recent master build 7.6 alpha0+: - Large: 47,196 -> 20,485 = -32% reduction (wrong) - Smaller: 16,992 -> 7,376 = 56% reduction (correct) So percentage has been wrong (in different ways) with large files since percentages started showing, so I assume since commit 46772b2dbbc269c2e83f00af2cd864fb64ccf425 that fixed bug 87963. Daniel hasn't been active since that commit, so copying Noel as a reviewer in case you have ideas / pointers. Master build: Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: 61b41646c5a93ca24f2c9f143cdb0da2c9258989 CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3 Locale: en-AU (en_AU.UTF-8); UI: en-US Calc: threaded
fix here: https://gerrit.libreoffice.org/c/core/+/150683
Oof that was quick, thanks Noel! :)
Noel Grandin committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/b167bc073b6b83110242bfbace107f6978e5bca7 tdf#153190 Compressing tool calculates compression rate wrong on large images It will be available in 7.6.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Noel Grandin committed a patch related to this issue. It has been pushed to "libreoffice-7-5": https://git.libreoffice.org/core/commit/086a546c2f30e918dad8793834559ae930d11e7a tdf#153190 Compressing tool calculates compression rate wrong on large images It will be available in 7.5.4. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Noel Grandin committed a patch related to this issue. It has been pushed to "libreoffice-7-4": https://git.libreoffice.org/core/commit/6982e1f3c6fc90d0e6ff268a12b78e8e3ef049fa tdf#153190 Compressing tool calculates compression rate wrong on large images It will be available in 7.4.8. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Thanks for fixing it! I tested it with 7.5.4.0.0+ (X86_64) and can confirm that it is working now as expected.
Noel Grandin committed a patch related to this issue. It has been pushed to "libreoffice-7-5-3": https://git.libreoffice.org/core/commit/fcda481a0758c9727d126404778cc16f4ef1bb13 tdf#153190 Compressing tool calculates compression rate wrong on large images It will be available in 7.5.3. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Noel Grandin committed a patch related to this issue. It has been pushed to "libreoffice-7-4-7": https://git.libreoffice.org/core/commit/81fef0001acb152bd21b0ec7ea6ac44ae0d287d0 tdf#153190 Compressing tool calculates compression rate wrong on large images It will be available in 7.4.7. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.