Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lossless image encoding efficiency #291

Closed
birdie-github opened this issue Jul 10, 2023 · 7 comments
Closed

Lossless image encoding efficiency #291

birdie-github opened this issue Jul 10, 2023 · 7 comments
Labels
question Further information is requested

Comments

@birdie-github
Copy link

birdie-github commented Jul 10, 2023

This is not a bug per se, more a question.

I expected VVC to beat JPEG-XL at image encoding and it doesn't seem to be the case.

See the attached files. The source file is RGB (24bpp), the result is yuv420p10le (15bpp?).

The VVC file was produced this way:

vvencapp --input screenshot.yuv --size 2560x1408 --format yuv420_10 --frames 1 \
    --preset slower --qp 0 --output screenshot.vvc

File: screenshot.png Dimensions: 2560x1408
vvencapp: Fraunhofer VVC Encoder ver. 1.8.0 [Linux][GCC 13.1.1][64 bit][SIMD=AVX2]
Configuration warning: disabling MCTF (and BIM), because QP < 17

Input     File : screenshot.yuv
Bitstream File : screenshot.vvc
Real Format    : 2560x1408  yuv420p10  60 Hz  SDR  1 frame
               : encode 1 frame 
Rate Control   : QP 0
CODING TOOL CFG: CTU128 QTMin44BTT3333332 IBD:0 SAO:1 ALF:1 (NonLinLuma:1 NonLinChr:1) CCALF:1 Tiles:1x1 Slices:1 WPP:0 WPP-Substreams:1 TMVP:1 DQ:1 SDH:0 CST:1 BDOF:1 DMVR:1 MTSImplicit:0 SBT:1 JCbCr:1 CabacInitPresent:0 AMVR:1 SMVD:1 LMCS:2 (Signal:SDR Opt:0) CIIP:1 MIP:1 AFFINE:1 (PROF:1, Type:1) MMVD:1 DisFracMMVD:1 SbTMVP:1 GPM:1 LFNST:1 MTS:1 (IntraCand:3) ISP:1 TS:2 TSLog2MaxSize:5 useChromaTS:0 BDPCM:2 IBC:2 BCW:2 
ENC. ALG. CFG: QPA:1 HAD:1 RDQ:1 RDQTS:1 ASR:1 MinSearchWindow:96 EDO:2 MCTF:0 BIM:0 
PRE-ANALYSIS CFG: STA:1 LeadFrames:0 TrailFrames:0 
FAST TOOL CFG: ECU:0 FEN:3 FDM:1 FastSearch:1 (SCC:2) LCTUFast:1 FastMrg:1 PBIntraFast:1 AMaxBT:0 FastQtBtEnc:1 ContentBasedFastQtbt:0 FastMIP:0 FastIntraTools:0 IntraEstDecBit:1 FastLocalDualTree:1 IntegerET:0 FastSubPel:0 ReduceFilterME:2 QtbttExtraFast:1 FastTTSplit:1 IBCFastMethod:1 FIM:0 ALFSpeed:0 QuantThr:4 SelectiveRDQO:0 
RATE CONTROL CFG: RateControl:0 QP:0 LookAhead:0 
PARALLEL PROCESSING CFG: NumThreads:8 MaxParallelFrames:4 WppBitEqual:1 WF:0 

POC     0 TId: 0 (  IDR_N_LP, I-SLICE, QP 0)          1263376 bits [Y 75.4249 dB    U 72.1552 dB    V 72.5252 dB] [ET    83 ] [L0 ] [L1 ]

	Total Frames |   Bitrate     Y-PSNR    U-PSNR    V-PSNR    YUV-PSNR   
	        1    a   75802.5600   75.4249   72.1552   72.5252   74.1361

screenshot.jxl -  31,749 bytes
screenshot.vvc - 157,922 bytes

I.e. 5 times bigger.

screenshot.zip

@adamjw24 adamjw24 added the question Further information is requested label Jul 10, 2023
@adamjw24
Copy link
Member

adamjw24 commented Jul 10, 2023

Please mind, that there is more to encoding lossless than just setting QP to 0.

At least the following adaptations have to be made:

  • MCTF=0
  • SAO=0
  • ALF=0, CCALF=0
  • Disable Deblocking (DeblockingFilterDisable=1)
  • LFNST=0
  • MTS=0 and ImplicitMTS=0
  • PerceptQPA=0
  • set maximal block size to 32 (best just CTUSize=32, alternatively Log2MaxTbSize=5) to avoid coefficient zero-out
  • DepQuant=0 RDOQ=0 (dep-quant does not support lossless decision-making, and there is not R- in the lossless decision making, so no point using it)

There might be more, but I cannot think of any right now (CostMode?).

Also, VVenC does not really support loss-less, so not sure if the decisions are going to be driven properly. Very experimental.

@birdie-github
Copy link
Author

birdie-github commented Jul 10, 2023

@adamjw24

Looks like this all requires using vvencFFapp.

The options you're talking about, will they net a higher compression ratio?

Maybe you could consider adding an encoding flag for this use case. I really want to check vvenc's "lossless" (lossy color space conversation makes it obviously impossible) efficiency, yeah, for something it's not entirely made for.

@adamjw24
Copy link
Member

All of the vvencFFapp options can be used in vvencapp with the --additional option (:-separated).

That's a good question about efficiency. Probably not, but they would allow you to do actual lossless. Just please don't judge how good VVC is suited for lossless from an encoder that is not intended for it.

@birdie-github
Copy link
Author

birdie-github commented Jul 10, 2023

As a rule new video codecs always improve I frames encoding efficiency, so I thought that VVC/H.266 would beat "classic" image codecs at that, considering all the new encoding methods incorporated into the standard.

VVC at the very least should beat almost three decades old PNG, I hope.

@adamjw24
Copy link
Member

Try VTM, it also has the required configuration changes documented in cfg/lossless/ directory.

@birdie-github
Copy link
Author

birdie-github commented Jul 10, 2023

Thanks a ton, I will give it a try.

VTM's ./EncoderAppStatic is too difficult to use. I give up. Error: found fewer Reference Picture Sets than GOPSize Error: Invalid GOP structure given

I don't understand what it wants and needs.

@adamjw24
Copy link
Member

adamjw24 commented Jul 21, 2023

I guess thats an issue for VTM. With the questions regarding VVenC being resolved, I will close this issue now, since we already have a lossless reminder issue (#59).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants