Results 1 to 8 of 8

Thread: jpg, png, webp encoder and butteraugli distance

  1. #1
    Member
    Join Date
    Aug 2020
    Location
    taiwan
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    jpg, png, webp encoder and butteraugli distance

    sorry, my english is not good.

    Hello, I compress a lot of non-photographic images, image type is Japanese Anime and Japanese Manga,
    png rgb24 using mozjpeg jpeg lossy q95~q99, png rgba32 using cwebp webp near-lossless 60,80,
    and pingo png lossy pngfilter=100, get some problem in cwebp webp lossy.

    I using butteraugli check compressed image quality, but had some question with butteraugli distance,
    i need some hint or suggest for those question, thanks you very much.

    my image set like this image set, Tab Anime, AW, Manga, Pixiv,

    1. butteraugli and butteraugli jpeg xl assessment difference butteraugli distance

    I using butteraugli and butteraugli xl to check image, in *Reference 01,
    butteraugli's xyb is likely more accurate,
    but some image butteraugli assessment good distance(1.3), butteraugli xl assessment bad distance(near 2.0),
    and some image butteraugli reject butteraugli xl good distance(1.3),
    how to correct understand butteraugli distance and butteraugli xl 3-norm?


    2. butteraugli safe area or great area

    Compress png rgba32 image, my process is using near-lossless 60 and pngfilter=100 to first compress,
    if compressed image not below safe butteraugli distance, using near-lossless 80 to second compress.

    I collect Jyrki Alakuijala Comment and create a table, in *Reference 02
    '1.0 ~ 1.3 definitely works as designed', '1.0 ~ 1.6 A value below 1.6 is great',
    if i want my compressed image have a great quality, i should choose area 1.0 ~ 1.3 or area 1.0 ~ 1.6?, if i made a mistake please let me know.

    pngfilter=100 butteraugli distance => [0.6 ~ 1.0, 1.3 ~ 1.6], [1.7]
    webp near-lossless 60 butteraugli distance => [0.4 ~ 1.0, 1.3 ~ 1.6], [2.1]
    ,near-lossless 60 [2.1] => near-lossless 80 [1.3]

    cwebp & pingo_rc3 command:
    pingo_rc3.exe -pngfilter=100 -noconversion -nosrgb -nodate -sa "%%A"
    cwebp.exe -mt -m 6 -af -near_lossless 60 -alpha_filter best -progress "%%A" -o "%%~nA.webp"


    3. non-photographic image and jpeg encoder quality suggest

    Compress png rgb24 image, my process is using quality 95 to first compress,
    if compressed image not below safe butteraugli distance, increase quality to second compress.

    In my png rgb24 image set, butteraugli assessment jpeg quality 95 doesn't get good butteraugli distance,

    jpeg quality 95 butteraugli distance => [1.5 ~ 1.6], [1.7 ~ 2.5]
    jpeg quality 95 butteraugli xl distance => [1.2 ~ 1.6], [1.7 ~ 2.2]

    but in cjpeg usage.txt :
    'specifying a quality value above about 95 will increase the size of the compressed
    file dramatically, and while the quality gain from these higher quality values is measurable'
    https://github.com/mozilla/mozjpeg/b...usage.txt#L115
    If i compress non-photographic image to jpeg and want near psychovisual lossless, it is necessary using
    above quality 95 to compress those image?
    or in *Reference 03, possibly butteraugli is too sensitive in some non-photographic image?

    mozjpeg command:
    cjpeg.exe -optimize -progressive -quality 95 -quant-table 3 -sample 1x1 -outfile "mozjpeg\%%~nA.jpg" "%%A"

    Update 20200929:
    I using jpeg xl sjpeg features, sjpeg can get great butteraugli distance in quality 96,
    but look like sjpeg features doesn't using jpeg xl vardct or modular mode?

    ​Size:
    png - 12mb
    mozjpeg -q 97 + jpegtran progressive 4.46mb
    jpegxl sjpeg -q 96 + jpegtran progressive 4.0mb

    cjpegxl command:
    cjpegxl.exe" "%%A" "xl\%%A" --jpeg1 --jpeg_quality=96 --progressive

    4. webp lossy q100 and butteraugli distance

    I test another non-photographic image set in webp lossy q100, but some image get larger butteraugli distance,
    it possibly webp lossy 420 subsampling and fancy upsampling will make some larger errors in some area?

    and i test webp lossy alpha(alpha_q) features, this features will increase butteraugli distance,
    but i don't understand, why lossy alpha will effect butteraugli distance?

    webp lossy q100 and lossy_alpha:
    q100.png 2.013666
    q100_lossy_alpha 80.png 2.035022
    q100_lossy_alpha 50.png 2.099735

    webp lossy q100 butteraugli distance => [1.2 ~ 1.6], [1.8 ~ 2.3], [3.1, 4.4, 5.5, 10.8]
    dssim => [0.000150 ~ 0.000749]

    cwebp command:
    ​cwebp.exe -mt -m 6 -q 100 -sharp_yuv -pre 4 -af -alpha_filter best -progress "%%A" -o "%%~nA.webp"


    I creating some table and quality test data, i will upload later, thanks you very much.

    Sample Image:
    2d art bg png file => https://mega.nz/file/FDBHmYjT#0Eruxq...V8FcTfPuFBEGmg

    ================================================== ===============================================
    Reference Area (From Jyrki Alakuijala Comment)
    *Reference 01
    From Jyrki Alakuijala Comment:
    Butteraugli vs Butteraugli(jpeg xl)
    butteraugli's xyb is likely more accurate,
    because of asymptotic log behaviour for high intensity values (instead of raising to a power),

    jpeg xl's xyb modeling is going to be substantially faster to computer,
    because gamma is exactly three there.

    *Reference 02
    From Jyrki Alakuijala Comment:
    0.6 ~ 0.7 // most critical use

    1.0 // normal use

    1.0 ~ 1.3 // definitely works as designed

    1.0 ~ 1.6 // A value below 1.6 is great

    1.6 ~ 2.1 // a value below 2.1 okayish

    2.1+ // Above 2.1 there is likely a noticeable artefact in an inplace flip test.

    2.5+ // not necessarily psychovisually relevant and fair

    4.0+ /* The non-linearities near the just-noticeable-boundary in scale At larger errors (4.0+)
    butteraugli becomes less useful. Current versions of butteraugli only extrapolate these values
    as multiples of just-noticeable-difference, but the human visual system is highly non-linear and
    large extrapolationdoesn't bring much value. */

    https://github.com/google/butteraugli/issues/22

    *Reference 03
    From Jyrki Alakuijala Comment:
    Butteraugli is a lot more sensitive for lines (displaced, emerging or removed) than any other visual measure,
    Last edited by Lithium Flower; 28th September 2020 at 20:31.

  2. #2
    Member
    Join Date
    Jun 2015
    Location
    Switzerland
    Posts
    902
    Thanks
    246
    Thanked 326 Times in 199 Posts
    Quote Originally Posted by Lithium Flower View Post

    1. butteraugli and butteraugli jpeg xl assessment difference butteraugli distance

    I using butteraugli and butteraugli xl to check image, in *Reference 01,

    but some image butteraugli assessment good distance(1.3), butteraugli xl assessment bad distance(near 2.0),
    and some image butteraugli reject butteraugli xl good distance(1.3),
    how to correct understand butteraugli distance and butteraugli xl 3-norm?

    In the very highest quality area (q95 to q99 jpeg), you need to use a higher norm than 3-norm. You could use the maximum butteraugli score or something like the 12th norm.

    If you compress around q60-q75, then the 3rd norm may be appropriate. Even there I have some signals that 6th norm is more appropriate.

    PSNR as a visual error metric is MSE-based and is homologous to using 2nd norm, and that is too low of a norm for aggregating visual errors. Consider 3rd norm as a compromise between tradition and what actually works. Lower norms are also easier for machine learning approaches to optimize for. Also note that butteraugli creates a mix of X, 2*X and 4*X p-norms for the given X, i.e., the 3-norm for butteraugli is actually an equal mix of 3-norm, 6-norm and 12-norm. In your use you'd need likely 12-norm, 24-norm and 48-norm and you can get them by setting the --error_pnorm=12

    Quote Originally Posted by Lithium Flower View Post

    2. butteraugli safe area or great area

    Compress png rgba32 image, my process is using near-lossless 60 and pngfilter=100 to first compress,
    if compressed image not below safe butteraugli distance, using near-lossless 80 to second compress.

    I collect Jyrki Alakuijala Comment and create a table, in *Reference 02

    if i want my compressed image have a great quality, i should choose area 1.0 ~ 1.3 or area 1.0 ~ 1.6?, if i made a mistake please let me know.

    pngfilter=100 butteraugli distance => [0.6 ~ 1.0, 1.3 ~ 1.6], [1.7]
    webp near-lossless 60 butteraugli distance => [0.4 ~ 1.0, 1.3 ~ 1.6], [2.1]
    ,near-lossless 60 [2.1] => near-lossless 80 [1.3]

    cwebp & pingo_rc3 command:
    pingo_rc3.exe -pngfilter=100 -noconversion -nosrgb -nodate -sa "%%A"
    cwebp.exe -mt -m 6 -af -near_lossless 60 -alpha_filter best -progress "%%A" -o "%%~nA.webp"
    My understanding is that near_lossless 60 will provide sufficient quality for all uses where 8-bit per channel RGBA is ok and does not need an additional butteraugli analysis.

    If someone has generated an image with webp near_lossless 60 that has a visually observable degradation, I'd like to learn about it.

    Quote Originally Posted by Lithium Flower View Post
    3. non-photographic image and jpeg encoder quality suggest

    Compress png rgb24 image, my process is using quality 95 to first compress,
    if compressed image not below safe butteraugli distance, increase quality to second compress.

    In my png rgb24 image set, butteraugli assessment jpeg quality 95 doesn't get good butteraugli distance,

    jpeg quality 95 butteraugli distance => [1.5 ~ 1.6], [1.7 ~ 2.5]
    jpeg quality 95 butteraugli xl distance => [1.2 ~ 1.6], [1.7 ~ 2.2]

    but in cjpeg usage.txt :
    If i compress non-photographic image to jpeg and want near psychovisual lossless, it is necessary using
    above quality 95 to compress those image?


    My experience is that libjpeg quality 95 with yuv444 is often enough. About 1/1000 images it is necessary to go to 97-98.

    Quote Originally Posted by Lithium Flower View Post
    or in *Reference 03, possibly butteraugli is too sensitive in some non-photographic image?


    It has been argued that butteraugli is not sufficiently sensitive for DCT8x8 artefacts.

    Butteraugli does not make an attempt to model the pupil size, making it sometimes too sensitive and other times not sensitive enough.

    Quote Originally Posted by Lithium Flower View Post
    mozjpeg command:
    cjpeg.exe -optimize -progressive -quality 95 -quant-table 3 -sample 1x1 -outfile "mozjpeg\%%~nA.jpg" "%%A"
    Quote Originally Posted by Lithium Flower View Post

    Update 20200929:
    I using jpeg xl sjpeg features, sjpeg can get great butteraugli distance in quality 96,
    but look like sjpeg features doesn't using jpeg xl vardct or modular mode?


    sjpeg is a new jpeg encoder created by the WebP library maintainer Pascal Massimino.

    I don't know which jpeg encoder (after guetzli) gets the best butteraugli scores or has the best psychovisual properties otherwise. I didn't follow the development of that field after the launch of guetzli.
    Quote Originally Posted by Lithium Flower View Post
    ​Size:
    png - 12mb
    mozjpeg -q 97 + jpegtran progressive 4.46mb
    jpegxl sjpeg -q 96 + jpegtran progressive 4.0mb

    cjpegxl command:
    cjpegxl.exe" "%%A" "xl\%%A" --jpeg1 --jpeg_quality=96 --progressive

    4. webp lossy q100 and butteraugli distance

    I test another non-photographic image set in webp lossy q100, but some image get larger butteraugli distance,
    it possibly webp lossy 420 subsampling and fancy upsampling will make some larger errors in some area?


    I have seen lossy WebP have problems on the borders of the images. YUV420 can be a problem.

    You can dump the butteraugli heatmap and see by yourself the area where butteraugli thinks the problem is.

    Quote Originally Posted by Lithium Flower View Post
    and i test webp lossy alpha(alpha_q) features, this features will increase butteraugli distance,
    but i don't understand, why lossy alpha will effect butteraugli distance?
    Butteraugli models human vision, and humans don't see translucency. So, it should not affect the valuation.

    The butteraugli executable, when seeing a translucent image, places the compared pair on white background and measures the scores.

    Then it places the same pair on a black background and measures the scores again.

    It reports the worse score of the two measurements. Losses in alpha are noticed by this methodology.

    This is not a perfect approach, but it may be better than nothing.

  3. #3
    Member
    Join Date
    Apr 2013
    Location
    France
    Posts
    61
    Thanks
    9
    Thanked 20 Times in 17 Posts
    Quote Originally Posted by Lithium Flower
    my process is using near-lossless 60 and pngfilter=100 to first compress
    Quote Originally Posted by Lithium Flower
    ​pingo_rc3.exe -pngfilter=100 -noconversion -nosrgb -nodate -sa "%%A"
    cwebp.exe -mt -m 6 -af -near_lossless 60 -alpha_filter best -progress "%%A" -o "%%~nA.webp"
    if you actually combine those, you would do loss over loss — so the result of near_lossless would be biaised and non-representative. if you want to compare, i would suggest instead to experiment the latest pingo with WebP, since all transformations (-webp-lossless, -webp-lossy, -webp-near, -webp-color, etc.) have heuristics/pre-processing which would not be done by the reference encoder atm; those would affect size/metrics, but could not be always better

  4. Thanks:

    Jyrki Alakuijala (6th October 2020)

  5. #4
    Member
    Join Date
    Jun 2015
    Location
    Switzerland
    Posts
    902
    Thanks
    246
    Thanked 326 Times in 199 Posts
    Quote Originally Posted by cssignet View Post
    ​if you actually combine those, you would do loss over loss — so the result of near_lossless would be biaised and non-representative. if you want to compare, i would suggest instead to experiment the latest pingo with WebP, since all transformations (-webp-lossless, -webp-lossy, -webp-near, -webp-color, etc.) have heuristics/pre-processing which would not be done by the reference encoder atm; those would affect size/metrics, but could not be always better
    Well spotted!

    Simply:

    cwebp --near_lossless=60 -q 100 -m 6 xyzzy.png -o xyzzy.webp

    (in cwebp near-lossless and lossless there are too parameters controlling the effort of computation, -q and -m)

    I haven't tried pingo myself, but the published results suggest that it can be a better option than cwebp.

  6. #5
    Member
    Join Date
    Apr 2013
    Location
    France
    Posts
    61
    Thanks
    9
    Thanked 20 Times in 17 Posts
    Quote Originally Posted by Jyrki Alakuijala
    I haven't tried pingo myself, but the published results suggest that it can be a better option than cwebp
    ​i consider my tools more like experimental stuff, implementations/demos of ideas: they do not pretend (and imo should not) replace well tested reference, but results could be compared sometimes

    Quote Originally Posted by Jyrki Alakuijala
    I have seen lossy WebP have problems on the borders of the images
    not sure if it is the same issue, but among several solutions, some simple pre-processing (RGB->255 if a=0) could be done and would impact quality/size

    Code:
    original.png
    
    cwebp -q 100 -sharp_yuv (56.78 KB)
    butteraugli: 5.670024
    butteraugli xl: 8.0223999023 (3-norm: 2.246375)
    ssimulacra xl: 0.01917124
    
    pingo -webp-lossy=100 (51.29 KB) <-- this use sharp_yuv too
    butteraugli: 1.928053
    butteraugli xl: 1.6332571507 (3-norm: 0.712645)
    ssimulacra xl: 0.00517459
    Quote Originally Posted by myself
    some simple pre-processing (RGB->255 if a=0) could be done
    edit: better solution could be done
    Attached Files Attached Files
    Last edited by cssignet; 9th October 2020 at 14:09. Reason: upload good files + better solution

  7. #6
    Member
    Join Date
    Apr 2013
    Location
    France
    Posts
    61
    Thanks
    9
    Thanked 20 Times in 17 Posts
    about the near_lossless in cwebp, perhaps i am wrong but it seems that the current implementation would change an alpha value from 1 to 0, even with low quantization value. i am not sure this would be the expected behavior, since it would impact things significantly (R-G-B should be altered by the alpha optimization). reusing the sample from my precedent post:

    Code:
    cwebp -near_lossless 80 (112.46 KB)
    butteraugli: 1.606584
    butteraugli xl: 50.7915344238 (3-norm: 15.189873)
    ssimulacra xl: 0.03084179
    
    pingo -webp-near=80 (113.97 KB) <-- avoid quantization on alpha
    butteraugli: 0.844221
    butteraugli xl: 1.0970934629 (3-norm: 0.365217)
    ssimulacra xl: 0.00218288
    
    -near_lossless 80 (112.70 KB) <-- avoid quantization if alpha < 2
    butteraugli: 1.609372
    butteraugli xl: 1.1307358742 (3-norm: 0.364205)
    ssimulacra xl: 0.00218043
    Attached Files Attached Files
    Last edited by cssignet; 8th October 2020 at 10:01. Reason: upload good files

  8. #7
    Member
    Join Date
    Aug 2020
    Location
    taiwan
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    @Jyrki Alakuijala

    sorry, my english is not good.

    I'm sorry for reply so lately.
    Thank you for your reply, I'm really grateful.

    1. use butteraugli metric compare different encoder

    I develop a python multithread program use butteraugli metric compare different encoder,
    and choose below maxButteraugliSocre and smaller image file.
    maxButteraugliSocre should setting on 1.6 or setting on 1.3?

    2. Some butteraugli question

    In my first post *Reference 02 ButteraugliSocre reference list and guetzli quality.cc,
    those score reference list still available in Butteraugli-master and Butteraugli-jpeg xl?
    in some non-photographic image, Butteraugli-jpeg xl butteraugli score will get some unexpected behavior,

    1. in jpeg q96,q97,q98 butteraugli-jpeg xl still get larger butteraugli score(1.8~2.0)

    2. rgba32 have transparent png file butteraugli score get larger butteraugli score(426.4349365234),
    behavior like @cssignet post sample.

    3. if Butteraugli-master and Butteraugli-jpeg xl return different butteraugli score,
    i should choose Butteraugli-master score, because Butteraugli-master xyb more accurate?

    4. butteraugli-jpeg xl 3rd norm and 12 norm have a quality reference list?
    ,like guetzli/quality.cc list and first post *Reference 02 list.

    3. jpeg xl -jpeg1 feature

    I build a sjpeg-master, and test some non-photographic image,
    get difference butteraugli score in same quality level, -jpeg1 get great butteraugli score,

    I think jpeg xl -jpeg1 don't use sjpeg to convert, only output, and if input image have transparent,
    jpeg xl -jpeg1 will keep transparent, sjpeg can't success output.
    i can't find more -jpeg1 detail, could you provide me the details?

    -jpeg1 butteraugli score data sheet

    4. lossy translucency(alpha) feature

    humans can't see translucency, webp lossy have compression factor,
    if i setting -alpha_q compression factor to 1 or 0, image translucency will get more lossy, this lossy is unvisible
    but lossy alpha this feature will make some unvisible bad side-effect or format bad side-effect?
    i very curious this question, could you teach me about this feature?

    https://developers.google.com/speed/webp/docs/cwebp
    -alpha_q int
    Specify the compression factor for alpha compression between 0 and 100. Lossless compression of alpha is achieved using
    a value of 100, while the lower values result in a lossy compression. The default is 100.

    @cssignet

    Thank you for your reply, I'm really grateful.

    I'm sorry, i did't make myself clear,
    I use butteraugli metric compare pingo near-lossless and pngfilter,
    and choose below maxButteraugliSocre and smaller image file.

    Thank your suggest, pingo near-lossless is working very well,
    and Thank you develop pingo.

    about larger butteraugli score, maybe this comment can explanation? i don't really understand this.

    From Jyrki Alakuijala Comment:
    butteraugli's xyb is likely more accurate because of asymptotic log behaviour for high intensity values
    (instead of raising to a power) and jpeg xl's xyb modeling is going to be substantially faster
    to computer because gamma is exactly three there.
    Last edited by Lithium Flower; Yesterday at 16:00.

  9. #8
    Member
    Join Date
    Nov 2011
    Location
    france
    Posts
    75
    Thanks
    8
    Thanked 40 Times in 29 Posts
    Quote Originally Posted by cssignet View Post


    Code:
    original.png
    
    cwebp -q 100 -sharp_yuv (56.78 KB)
    butteraugli: 5.670024
    butteraugli xl: 8.0223999023 (3-norm: 2.246375)
    ssimulacra xl: 0.01917124
    
    pingo -webp-lossy=100 (51.29 KB) <-- this use sharp_yuv too
    butteraugli: 1.928053
    butteraugli xl: 1.6332571507 (3-norm: 0.712645)
    ssimulacra xl: 0.00517459

    edit: better solution could be done
    Interesting... Is this happening only for qualities around q=100? Or at lower ones too? (q=60-80 for instance)...

    skal/

Similar Threads

  1. butteraugli
    By lorents17 in forum Download Area
    Replies: 9
    Last Post: 23rd February 2019, 12:59
  2. New butteraugli version
    By Jyrki Alakuijala in forum Data Compression
    Replies: 26
    Last Post: 5th October 2017, 20:14
  3. WEBP - how to improve it?
    By Stephan Busch in forum Data Compression
    Replies: 38
    Last Post: 4th June 2016, 13:43
  4. WebP (Lossless April 2012)
    By caveman in forum Data Compression
    Replies: 32
    Last Post: 19th April 2013, 15:53
  5. lossy simplifier of a png bmp jpg
    By toi007 in forum The Off-Topic Lounge
    Replies: 7
    Last Post: 7th July 2012, 00:44

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •