Opened 10 years ago Closed 4 years ago #1321 closed defect (fixed)Overflow in cross component prediction
Description
In TComTrQuant.cpp:crossComponentPrediction the residuals are combined with the lines:
and
However, for high values of the residual this calculation can overflow the size of a Pel and change from a large positive to a large negative.
This occurs even for Main 4:4:4 10 profiles (but only in artificial test streams).
A temporary work around is to compile in highbitdepth mode as this increases the size of Pel. Change History (11)comment:1 Changed 10 years ago by DefaultCC Plugin
comment:2 Changed 10 years ago by karlsharmancomment:3 Changed 10 years ago by ksuehring
comment:4 Changed 10 years ago by karlsharman
Modified active ticket for RExt component to HM component. comment:5 Changed 10 years ago by karlsharman
At the 19th JCTVC meeting in Strasbourg, the JCTVC concluded that a
The restriction would likely be placed in Section 8.6.6: Residual
The restriction may be further refined during the development of
In HM (& SCM) the software function
comment:6 Changed 10 years ago by karlsharman
As indicated previously, the constraint might be further refined by
For example, does the case of 16-bit with extended precision disabled
comment:7 Changed 10 years ago by karlsharman
Software fix applied in r4227, assuming that inputs for 12-bit and below will not exceed 16-bit signed and beyond 12-bit will not exceed 23-bit signed. Modifying ticket to become a SCC text ticket as a reminder to editors. comment:8 Changed 10 years ago by ksuehring
comment:9 Changed 9 years ago by karlsharman
The meeting notes (JCTVC-T1000) indicated the following during the review of JCTVC-T0003:
This issue was discussed at the previous JCT-VC meeting in Strasbourg and it was agreed that a constraint could be added to the next version of the HEVC specification. (However, it was not yet incorporated into a draft text output document.)
...
Decision: As previously planned, for RExt purposes, specify a normative constraint that limits inputs to the inverse CCP to the range of the quantized coefficients CoeffMinY/C to CoeffMaxY/C. (Include in SCC draft output.) comment:10 Changed 5 years ago by karlsharman
Constraint added to HEVC v4. comment:11 Changed 4 years ago by crosewarne
Note: See
TracTickets for help on using
tickets. | This list contains all users that will be notified about changes made to this ticket. These roles will be notified: Reporter, Owner, Subscriber, Participant
|
Thank you Peter.
This has highlighted an issue with the possible range of the residual due to cross-component-prediction, and a corresponding thread will be created on the main JCTVC email reflector.
With cross-component-prediction, the output of the inverse-transforms (inverse-DCT/DST, inverse-RDPCM, inverse-transform-skip, inverse-transquant-bypass etc) are combined: a fraction of the luma is added to the chroma.
The specification does not have a clipping stage at the output of the inverse transforms; however, in the software, a clipping stage has been applied at the end of the inverse-transform to protect the resulting data from overflowing the size of the 16-bit Pel residual array. This was previously valid for Ver.1 since the only processing-stages following were the addition of the residual to the prediction and then clipping to the internal bit depth (IBD).
With CCP present, the clipping has to be removed - it cannot be clipped at the end of the transform, because there is a possibility that a large luma value is combined with a large negative chroma value and turns into a small value.
It is likely that this only occurs for pathological / "designed-to-be-evil" bit-streams.
Here are some calculations (please check) showing the output bit depths of the various tools using non-extended-precision and various internal bit depths (IBD), and highlighting cases that require residuals to be more than 16-bit.
For now, the work-around to use the HIGH_BIT_DEPTH_SUPPORT=1 build (which uses 32-bit Pels) is valid, although this will double the run-time memory footprint.