GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Gamma-correct chroma subsampling · Issue #193 · mozilla/mozjpeg

Gamma-correct chroma subsampling #193

New issue
Copy link
New issue
Copy link
Open
Open
Gamma-correct chroma subsampling#193
Copy link
Labels
enhancement

Description

@kornelski
kornelski
opened on Dec 1, 2015
Issue body actions

This image (source) should show RULES on an sRGB-ish monitor and/or browser with a good color management.

and if it's resized with appropriate gamma should resize to:

gamma 2.2

However, libjpeg blends pixels in Cr/Cb color space, which has non-linear gamma, and chroma subsampling results in:

bad gamma

It could be better. I've prototyped a very slow and hacky chroma downsampling that generates:

gamma-1 0-or-2 2-red-trianglefilter

so there's definitely a room for improvement.

Reacted by magicgoose

Activity

  1. kornelski commented on Dec 2, 2015

    @kornelski
    kornelski
    on Dec 2, 2015
    CollaboratorAuthor
    More actions

    Coincidentally the next version of WebP will solve that too, by using an iterative algorithm:

    https://chromium.googlesource.com/webm/libwebp/+/master/src/enc/picture_csp.c#487

  2. kornelski commented on Dec 6, 2015

    @kornelski
    kornelski
    on Dec 6, 2015
    CollaboratorAuthor
    More actions

    Prototyped https://github.com/pornel/jpeg-compressor#luma-from-chroma-subsampling

  3. CoolOppo commented on Dec 10, 2015

    @CoolOppo
    CoolOppo
    on Dec 10, 2015
    More actions

    That prototype is pretty impressive. It's far better than the current subsampling.

    Edit: I made a little comparison slider. The image on the right is the prototype:

    https://visionless.me/u/subsample-comparison.html

  4. bdaehlie
    added
    enhancement
    on May 26, 2016
  5. Artoria2e5 commented on Mar 22, 2020

    @Artoria2e5
    Artoria2e5
    on Mar 22, 2020
    More actions

    The webp source code link moved to https://github.com/webmproject/libwebp/blob/master/src/enc/picture_csp_enc.c. Search PreprocessARGB for the iterative code. As Ser-Gen memntioned, sjpeg calls this scaling "sharp YUV". https://github.com/webmproject/sjpeg/blob/5ce9c14cceba85a83ac6efcef94658eb28e304ea/src/yuv_convert.cc#L101

    The luma-scaled code is at https://github.com/kornelski/jpeg-compressor/blob/9eeb009fdb8673224de5be978574cb139e4b8bf6/jpge.cpp#L611.


    sharp YUV is now a separate libsharpyuv in the webp project, with its own pkg-config file and everything. It is an optional choice in AVIF.

    Reacted by Evan Wilson
  6. Artoria2e5 commented on Apr 21, 2023

    @Artoria2e5
    Artoria2e5
    on Apr 21, 2023
    More actions

    Huh, apparently there's yet another approach , the HDRTools way. Pic is from doi:10.5594/m001639. No idea how well it works in SDR, when "OETF" is just "gamma".
    image

    Oh god a google for "chroma subsampling" gave me some arxiv magic (possible published version) involving gradient descent in H.266. oh it's friendlier when you say "iterative" and it lists some prior work too. code's gone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.