Opened 16 months ago

Last modified 16 months ago

#11563 new enhancement

Improve JPEG compression based on now-expired patents

Reported by: Balling Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: mjpeg
Cc: MasterQuestionable Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by Balling)

Summary of the bug: bigger bug is here "Image specific quantization tables", source code that will compile just fine (if you insert some std headers), https://pages.cs.wisc.edu/~ratnakar/rdopt.html and
there is even a better algorithm that doubles average size savings: Joint Optimization of Run-Length Coding, Huffman Coding, and Quantization Table With Complete Baseline JPEG Decoder Compatibility.

Unfortunately, it is patent encumbered probably until 2024 (2025 now, btw): https://www.google.com/patents/US7570827

There are also images comparison https://cloud.githubusercontent.com/assets/72159/8814942/99255002-300a-11e5-8fcd-4f810b0aa78b.jpg

vs

https://cloud.githubusercontent.com/assets/72159/8814943/992ee824-300a-11e5-99fe-0f56e3229c84.jpg

Change History (5)

comment:1 by Balling, 16 months ago

Bug Image specific quantization tables https://github.com/mozilla/mozjpeg/issues/182

comment:2 by MasterQuestionable, 16 months ago

Cc: MasterQuestionable added
Component: undeterminedavcodec
Summary: Implement better jpeg compression now that patents on those two algorithms expiredImprove JPEG compression based on now-expired patents

͏    Nevertheless, JPEG is a bad image codec overall:
͏    Both bad quality and compression.
͏    https://hackerfactor.com/blog/?archives/260-JPEG-Bitstream-Bytes.html
͏    https://hackerfactor.com/blog/?archives/242-Graphic-Content,-Parental-Supervision-Advised.html

͏    While no current video/image codec seems good enough.
͏    Likely need something total new.

comment:3 by Balling, 16 months ago

Description: modified (diff)

comment:4 by Balling, 16 months ago

JPEG is a bad image codec overall:
Both bad quality and compression

That does not use mozjpeg implementation and it does not use Image specific quantization tables.

And it does not matter: everyone uses mozjpeg and jpeg is still most popular encoder. Oh, and also here is mkver still optimising it: https://github.com/mkver/FFmpeg/commits/mjpegenc_huffman

Last edited 16 months ago by Balling (previous) (diff)

comment:5 by MasterQuestionable, 16 months ago

͏    Even so, still of so many inefficiencies; however optimized.
͏    Demonstrable by that some images may nevertheless compress better in PNG.
[ ^
͏    https://github.com/orgs/community/discussions/141322#discussioncomment-11754750
͏    Images that of large contiguous color region.

͏    Ideally in WebP Lossless, for whose overall superiority:
͏    https://github.com/lvandeve/lodepng/issues/187#issuecomment-2561596363

͏    Also note JPEG compression is simply block-based:
͏    Cannot properly merge certain duplicates disregard. ]

͏    Somewhat like the still prevalence of PNG?
͏    https://github.com/MasterInQuestion/talk/discussions/27
͏    .
͏    Being ubiquitous doesn't change that, it's still a poor codec in fact.


͏    Video is essentially a sequence of motion pictures.
͏    That could be just GOP (Group of Pictures).
͏    The image codecs could as well handle.
͏    (Inter-frame compression is fundamentally no different from Intra-frame)

͏    What's needed is just some extension of the basic container scheme:
͏    https://github.com/MasterInQuestion/talk/discussions/3#discussioncomment-9584627
͏    (MPX Simple)

Note: See TracTickets for help on using tickets.