diff options
author | Andriy Gelman <andriy.gelman@gmail.com> | 2019-12-05 22:15:41 -0500 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2020-01-17 17:43:52 -0300 |
commit | ad326379c6634505c9ebc46964057441761008bc (patch) | |
tree | 75af00b336830dbbfc9a1038511f00306d8df23b /libavcodec/h2645_parse.c | |
parent | 5b7e90b252f765d677de6882bc65a362205638fa (diff) |
lavc/h2645_parse: Don't automatically remove nuh_layer_id > 0 packets
HEVC standard supports multi-layer streams (ITU-T H.265 02/2018 Annex
F). Each NAL unit belongs to a particular layer defined by nuh_layer_id
in the header.
Currently, all NAL units that do not belong to a base layer are
automatically removed in ff_h2645_packet_split(). Some data may
therefore be lost when future filters/decoders are designed to support
multi-layer streams.
A better approach is to forward nuh_layer_id > 0 packets and let blocks
down the chain decide how to process them. The condition to remove
packets has been moved to hevcdec and cbs.
Found-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/h2645_parse.c')
-rw-r--r-- | libavcodec/h2645_parse.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/libavcodec/h2645_parse.c b/libavcodec/h2645_parse.c index 4808f79a67..0f3343004f 100644 --- a/libavcodec/h2645_parse.c +++ b/libavcodec/h2645_parse.c @@ -292,23 +292,22 @@ static int get_bit_length(H2645NAL *nal, int skip_trailing_zeros) static int hevc_parse_nal_header(H2645NAL *nal, void *logctx) { GetBitContext *gb = &nal->gb; - int nuh_layer_id; if (get_bits1(gb) != 0) return AVERROR_INVALIDDATA; nal->type = get_bits(gb, 6); - nuh_layer_id = get_bits(gb, 6); + nal->nuh_layer_id = get_bits(gb, 6); nal->temporal_id = get_bits(gb, 3) - 1; if (nal->temporal_id < 0) return AVERROR_INVALIDDATA; av_log(logctx, AV_LOG_DEBUG, "nal_unit_type: %d(%s), nuh_layer_id: %d, temporal_id: %d\n", - nal->type, hevc_nal_unit_name(nal->type), nuh_layer_id, nal->temporal_id); + nal->type, hevc_nal_unit_name(nal->type), nal->nuh_layer_id, nal->temporal_id); - return nuh_layer_id == 0; + return 1; } static int h264_parse_nal_header(H2645NAL *nal, void *logctx) |