SMPTE / st2067-21

SMPTE ST 2067-21 IMF Application #2E (Studio Masters)
Other
2 stars 0 forks source link

Parameter B values should be maximal, instead of exact, values #7

Open palemieux opened 4 months ago

palemieux commented 4 months ago

ST 2067-21, Annex I implies that the parameter B found in codestreams must match the specific values listed in Tables I.2 and I.3.

The parameter B essentially tells the decode the minimum number of bits of internal precision it will need to decode the codestream.

When read from the codestream, B can be used by a decoder to select different internal paths or fast-fail if B exceeds its capability.

The B values listed in Tables I.2 and I.3 are however intended to impose requirements on decoders: in order to successfully decode APP2.HT.REV and APP2.HT.IRV codestreams, a decoder must support B values greater than or equal to those of Tables I.2 and I.3. The values listed in Tables I.2 and I.3 are theoretical maxima, and values found in the codestream can be smaller.

As a result, Annex I should state that the values listed in Tables I.2 and I.3 are the maximum values that can be present in the codestream, instead of the exact values.

fschleich commented 3 months ago

For reference: It appears that current encoder implementations exceed the Parameter B values provided in Annex I, in some circumstances. Attached is a 10bit IRV codestream with a Parameter B value of 12. The codestream was extracted from an IMF package created using BMD Resolve Studio 19b5 with Kakadu codec selected.

VIDEO_4f4db789-6d05-49ff-afde-0fd0c9fca479_000000.j2c.zip

aous72 commented 3 months ago

Hi @fschleich,

What is the PSNR for that file? or point me to the original and I will find that.

Kind regards, Aous.

palemieux commented 3 months ago

@aous72 The original is at http://download.opencontent.netflix.com.s3.amazonaws.com/index.html?prefix=Meridian/tiffs/

fschleich commented 3 months ago

@aous72 @palemieux FYI: For no particular reason, I used another (non-HT) IMF package as input/source in Resolve. Attached is the corresponding frame dumped from that package, for reference.

VIDEO_a7be1d50-177d-4e2c-8177-7ed0519b24a9_000000.j2c.zip

aous72 commented 3 months ago

Hi @palemieux, @fschleich,

tldr: It is sufficient for the file to have B=8.

Thank you @fschleich. I could not measure the actual PSNR because I do not know how to correctly render the frame with the correct P3 and colour space. It is frame 00886 by the way.

I explored the contents of the file in https://github.com/SMPTE/st2067-21/issues/7#issuecomment-2251165190 This involved modifying my code to keep track of what B should be.

The following is my current understanding.

  1. Kakadu uses Qstep to decide B (my speculation). The default Qstep for 10 bit data is 1/2^10; the default I think is 1/2^N where N is the bit depth for the 8-12 range at least.
  2. For the actual data in the file, encoded at around 1.26bits/pixel, it is correct to set B=8 or more. The explanation is that while the bit-stream employs a Qstep of 1/2^10, the encoder ignores many LSBs from the quantized wavelet coefficients, and as such, do not use more what corresponds to B=8 for the magnitude of these coefficients.
  3. Two possible solutions. 1. Use coarser Qstep, which should cause not problems at 1.26bits/pixel. 2. Employ the SCP15_magb=8 or SCP15_magb=9 option for this bit rate.

Note: non-HT bit-streams do not need B values.