Open RFCArrow opened 1 year ago
For convenience, here is a screenshot of the effect: and here is a short sample of the nv12 output: short_960x540_nv12.zip
In the case where the P-frames are blank, is extradata set? If extradata is set then are the P-frames no longer blank?
"In the case where the P-frames are blank, is extradata set?"
No
"If extradata is set then are the P-frames no longer blank?"
Yes, except for on HEVC when UseStartCodes is set, in which case the decoder crashes
I have summarised the effect in the table below. For your benefit, here are the input elementary streams used sample_input.zip and the first few frames of the output for each case which generates output sample_output.zip.
Codec | Extradata | UseStartCodes | Outcome |
---|---|---|---|
H264 | Set | False | Video renders correctly |
H264 | Unset | False | Output file is empty |
H264 | Set | True | Video renders correctly |
H264 | Unset | True | Video has garbage pixels and blank P-frames |
HEVC | Set | False | Video renders correctly |
HEVC | Unset | False | SimpleDecoder segfaults in AMFh265Parser_Fast::ParseSliceHeader() |
HEVC | Set | True | SimpleDecoder segfaults in AMFh265Parser_Fast::DecodeBuffer() |
HEVC | Unset | True | Video has garbage pixels |
Hey, is there any update on this? Have you managed to reproduce the issue?
Yes the issue was reproduced. We will provide another update once we have some fixes.
Great! Thanks for the update :+1:
Is there any updates?
The 4 valid cases of combinations of Extradata and UseStartCodes are below. Only one of Extradata and UseStartCodes should be enabled at a time, and not both or neither.
There have been some fixes such as for a crash with particular inputs on HEVC when both Extradata and UseStartCodes are unset, but this is an invalid option combination to use regardless.
Codec | Extradata | UseStartCodes |
---|---|---|
H264 | Set | FALSE |
H264 | Unset | TRUE |
HEVC | Set | FALSE |
HEVC | Unset | TRUE |
Describe the bug On input resolutions where a conformance window (frame cropping) must be applied, the decoder does not function correctly unless an
AVCDecoderConfigurationRecord
is supplied in theAMF_VIDEO_DECODER_EXTRADATA
property.An example resolution affected by this is 1920x1080 which will be cropped down from 1920x1088.
This bug effects both H264 and HEVC.
To Reproduce Apply the following patch to
SimpleDecoder.cpp
Then build and run the SimpleDecoder project:
cd AMF/amf
VK_SDK_PATH=~/vulkan/1.3.239.0 make -C public/samples
./bin/dbg_64/SimpleDecoder input_1920x1080.h264
Inspect the output file
output_1920x1080.nv12
and observe that I frames feature an area of garbage pixels at the bottom of the frame. Also observe that the P frames are completely blank.Note that the effect is not observed when the resolution is a whole number of macroblocks, for example 3840x2160.
Setup (please complete the following information): OS: Ubuntu Linux 22.04 LTS (5.19.0-45-generic) GPU: RX 7900 XTX Driver Version:
AMF Source: 1.4.29 origin/master (bd5db31) Which component has the issue: Encoder
Expected behavior All frames are correctly decoded in the output file.
Additional context While decoding HEVC bitstreams, setting the
AMF_VIDEO_DECODER_EXTRADATA
seems to require that the input bitstream is provided in AVCC format instead of Annex B format. If the input bitstream is in Annex B format while theAMF_VIDEO_DECODER_EXTRADATA
property is set, it tends to lead to the decoder segfaulting withinlibamfrt64.so
. While this behaviour makes some sense, this requirement does not appear to be documented anywhere in the documentation. Note that this behaviour is not observed while decoding H264 bitstreams.While investigating this bug, I noticed that the comments in
BitStreamParserH265.cpp:GetExtradata()
incorrectly referenceAVCDecoderConfigurationRecord
instead ofHEVCDecoderConfigurationRecord
. In particular, the section reference in ISO-IEC 14496-15 should be #8.3.3 andnumSequenceParameterSets
should not be mentioned.