Skip to content

[bug] Binary search doesn't end after optimal quality setting is found #132

@xiota

Description

@xiota

Using the package provided by Arch Linux, the early stop code doesn't work.

/* Terminate early once bisection interval is a singleton. */
if (min == max)
attempt = 0;

$ pacman -Si jpeg-archive | grep -E '^(Repository|Name|Version|URL|Build)'
Repository      : extra
Name            : jpeg-archive
Version         : 2.2.0-3
URL             : https://github.com/danielgtaylor/jpeg-archive/
Build Date      : Fri 04 Nov 2022 05:42:19 PM UTC

$ jpeg-recompress -V
2.2.0

$ jpeg-recompress -l 15 test1.jpg t1.jpg

Metadata size is 12kb
ssim at q=67 (40 - 95): 0.999363
ssim at q=81 (68 - 95): 0.999838
ssim at q=88 (82 - 95): 0.999934
ssim at q=84 (82 - 87): 0.999897
ssim at q=86 (85 - 87): 0.999932
ssim at q=85 (85 - 85): 0.999898
ssim at q=85 (85 - 85): 0.999898
ssim at q=85 (85 - 85): 0.999898
ssim at q=85 (85 - 85): 0.999898
ssim at q=85 (85 - 85): 0.999898
ssim at q=85 (85 - 85): 0.999898
ssim at q=85 (85 - 85): 0.999898
ssim at q=85 (85 - 85): 0.999898
ssim at q=85 (85 - 85): 0.999898
Final optimized ssim at q=85: 0.999809
New size is 8% of original (saved 9460 kb)

$ jpeg-recompress -l 15 test2.jpg t2.jpg

Metadata size is 0kb
ssim at q=67 (40 - 95): 0.999380
ssim at q=81 (68 - 95): 0.999844
ssim at q=88 (82 - 95): 0.999935
ssim at q=84 (82 - 87): 0.999899
ssim at q=86 (85 - 87): 0.999933
ssim at q=85 (85 - 85): 0.999900
ssim at q=85 (85 - 85): 0.999900
ssim at q=85 (85 - 85): 0.999900
ssim at q=85 (85 - 85): 0.999900
ssim at q=85 (85 - 85): 0.999900
ssim at q=85 (85 - 85): 0.999900
ssim at q=85 (85 - 85): 0.999900
ssim at q=85 (85 - 85): 0.999900
ssim at q=85 (85 - 85): 0.999900
Final optimized ssim at q=85: 0.999818
New size is 7% of original (saved 12964 kb)

Also, what is the status of this project? I have found a few other bugs. Would pull requests with bug fixes actually be reviewed and accepted?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions