fraunhoferhhi / vvenc

VVenC, the Fraunhofer Versatile Video Encoder
https://www.hhi.fraunhofer.de/en/departments/vca/technologies-and-solutions/h266-vvc.html
BSD 3-Clause Clear License
965 stars 173 forks source link

What are the maximum dimensions? #205

Closed birdie-github closed 2 years ago

birdie-github commented 2 years ago

What are the maximum dimensions for the codec?

I'm trying to compress a very large image, 14552x8416 pixels, and the encoder exits with an error:

$ vvencapp --input source.yuv --size 14552x8416 --format yuv420_10 --frames 1 \
  --preset slower --qp 0 --output output.vvc
vvencapp: Fraunhofer VVC Encoder ver. 1.6.1 [Linux][GCC 12.2.1][64 bit][SIMD=AVX2]
disable MCTF for QP < 17

ERROR: In function "initHRDParameters" in /source/Lib/EncoderLib/EncHRD.cpp:80: Unspecified error
vvencapp [error]: vvencapp cannot create encoder, code -2: ERROR: In function
  "initHRDParameters" in /source/Lib/EncoderLib/EncHRD.cpp:80: Unspecified error

The source file was prepared this way:

$ ffmpeg -s 14552x8416 -i source.bmp -vframes 1 -pix_fmt yuv420p10le source.yuv

where source.bmp is a simple 24bit RGB file.

Would be great if you documented it. Thanks!

adamjw24 commented 2 years ago

We'll look into that. Looks like a bug on the encoder, might also be associated with some VVC level constraints, but this will require some more in-depth investigation. Hopefully there'll be a resolution next week.

birdie-github commented 2 years ago

We'll look into that. Looks like a bug on the encoder, might also be associated with some VVC level constraints, but this will require some more in-depth investigation. Hopefully there'll be a resolution next week.

The H.266 spec must have some constraints I guess, so I don't think it's worth going above and beyond. Unfortunately it's a very long document I've no idea how to read, so would be great if you found it out.

And if there are indeed certain constraints, it's worth adding them to your codebase directly and instead of showing a weird error your could output something like:

Error: the H.266 spec only allows at most X@Y videos. Bailing out. or something like this.

Thanks!

birdie-github commented 2 years ago

vvenc also doesn't show a pretty error message for a e.g. 333x333 source.

Instead would be nice to see something like:

Error: input dimensions must be multiples of 4 (or 8?)

Thanks!

alexander-g2 commented 2 years ago

Since VVenC only supports YUV 4:2:0 as input, it requires the input to be a multiple of 2. I don't think VVenC has any special requirements for input size beyond that.

jbrdbg commented 2 years ago

Well, internally the input source has to be a multiple of 8. In case your source is not a multiple of 8, the encoder will perform an automatic padding of the input pictures (expert option --ConformanceWindowMode 1, which is enabled by default in expert and easy app). There are additional expert padding options, if you like to control the padding by yourself, but in that case you should be sure what you are doing.

Using an odd size parameter will fail as explained above, due to the YUV 4:2:0 source format:

vvencapp --size 177x144 Parameter Check Error: Error: picture width is not an integer multiple of the specified chroma subsampling

Concerning your source format 14552x8416, l agree, this should give you a more explanatory error message. But, as explained before, this looks more like a bug or a VVC level constraint. And even if it is a level constraint, this should be checked at the input parameter side and not produce this error message. We will have a look into this issue.

adamjw24 commented 2 years ago

So I debugged your issue, and it seems indeed that the problem is level constraints. We will add more appropriate error message, but for now you could use:

Todos for us: