Open allanwlz opened 4 years ago
Hi, AllanWlz!
What CLI params did you use for encoding?
May be you did not read manual for heif-enc? Take a chance to do it:
man heif-enc
or
heif-enc --help
And now you can see CLI params which can unveil 'hidden defaults':
-P, --params show all encoder parameters
and if to
heif-enc --params
we see
tune, default=ssim, { psnr,ssim,grain,fastdecode }
Did you select tune
param to psnr
value at least? You did not mention that.
Furthermore: you can also see
-p set encoder parameter (NAME=VALUE)
x265
params
and you are welcome to thousands of tests with tuning of many CLI params of x265 video encoder (not all cause some of them are for video for example for P- and B-frames; our target is I-frames if I remember correctly):
https://x265.readthedocs.io/en/default/cli.html
So you said about PSNR value, but you did not mention how you tried to optimise encoding to better PSNR values.
Hope that let you to dive deeper into problem you mentioned.
What PSNR should be if to try lossless encoding? Infinity?
Why you want to use PSNR? Are you prefer to optimise encoding for some sort of machine vision (PSNR) or for human eye (SSIM)?
May be you can estimate your encodings by SSIM also? May be it will be closer to application instead of some not so representative parameter?
heif-enc -p tune=psnr -p preset=veryslow -q quality input.png -o output.heic
heif-convert output.heic output.png
The params i use are shown above. When use different quality value, we can get differernt compression rate. The PSNR is calculated on the output.png.
Dose X265 params also matters? I didn't see infomation about that in --h help.
Using lossless encoding, PSNR should be the same as raw image. I didn't test that, but bpg444 can get PSNR value as hight as 57 (as shown in the top figure). So I think HIEF lossless encoding should get at least same level PSNR.
MS-SSIM figure. The same issue.
When you are encoding to/from PNG, there is also the color-space conversion RGB <-> YCbCr, which is not lossless. Only if you pass in the image as YCbCr directly to libheif, you can get true lossless.
When you are encoding to/from PNG, there is also the color-space conversion RGB <-> YCbCr, which is not lossless. Only if you pass in the image as YCbCr directly to libheif, you can get true lossless.
Yes, I notice that. But I'm not sure how much influence would that make.
How could I convert to YCbCr with PNG format? As far as I know, PNG only support RGB?
PNG is only RGB. libheif supports Y4M as YCbCr format. I added that when I did some PSNR tests myself.
PNG is only RGB. libheif supports Y4M as YCbCr format. I added that when I did some PSNR tests myself.
Hi, may I ask the methods that transform PNG to y4m?
I have tried ffmpeg. But got even worse result.
ffmpeg instruction like:
ffmpeg -i input.png -pix_fmt yuv444p -vsync 0 -preset placebo -tune psnr input.y4m -y
Hi, AllanWlz!
What CLI params did you use for encoding?
May be you did not read manual for heif-enc? Take a chance to do it:
man heif-enc
orheif-enc --help
And now you can see CLI params which can unveil 'hidden defaults':
-P, --params show all encoder parameters
and if toheif-enc --params
we seetune, default=ssim, { psnr,ssim,grain,fastdecode }
Did you select
tune
param topsnr
value at least? You did not mention that.Furthermore: you can also see
-p set encoder parameter (NAME=VALUE)
x265
params and you are welcome to thousands of tests with tuning of many CLI params of x265 video encoder (not all cause some of them are for video for example for P- and B-frames; our target is I-frames if I remember correctly): https://x265.readthedocs.io/en/default/cli.htmlSo you said about PSNR value, but you did not mention how you tried to optimise encoding to better PSNR values.
Hope that let you to dive deeper into problem you mentioned.
Hi, i used the parameters this :
heif-enc -p tune=psnr -p preset=veryslow -q quality input.png -o output.heic
heif-convert output.heic output.png
Is that correct? What other X265 parameter should I add?
Hi guys, is there any one who have tested encoder with kodak test? I have used the example binary file to encode the pictures, and compute the PSNR with respect to different bpp. As the result show, the encoder performs well at low bpp. But with bpp increasing, the PSNR couldn't surpass 40. I have tried lossless encoding, but the PSNR is still below 40.