[FFmpeg-devel] [PATCH] lavc/h2645_parse: Don't automatically remove nuh_layer_id > 0 packets

Andriy Gelman andriy.gelman at gmail.com
Mon Dec 2 05:30:40 EET 2019


On Mon, 02. Dec 00:07, James Almer wrote:
> On 12/1/2019 11:48 PM, Andriy Gelman wrote:
> > From: Andriy Gelman <andriy.gelman at gmail.com>
> > 
> > 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 bsf where such packets are
> > currently not supported.
> > ---
> >  libavcodec/cbs_h2645.c   | 3 +++
> >  libavcodec/h2645_parse.c | 7 +++----
> >  libavcodec/h2645_parse.h | 5 +++++
> >  libavcodec/hevc_parse.c  | 2 ++
> >  libavcodec/hevc_parser.c | 2 ++
> >  libavcodec/hevcdec.c     | 2 +-
> >  6 files changed, 16 insertions(+), 5 deletions(-)
> 
> Missing changes to extract_extradata_bsf.

I did look into this. My reasoning for not modifying extract_extractdata is because
the filter doesn't parse parameter sets and only makes them available in packet side
data. 

> 
> > 
> > diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
> > index 88fa0029cd6..9f89f1c5a55 100644
> > --- a/libavcodec/cbs_h2645.c
> > +++ b/libavcodec/cbs_h2645.c
> > @@ -562,6 +562,9 @@ static int cbs_h2645_fragment_add_nals(CodedBitstreamContext *ctx,
> >  
> >      for (i = 0; i < packet->nb_nals; i++) {
> >          const H2645NAL *nal = &packet->nals[i];
> > +        if (nal->nuh_layer_id > 0)
> > +            continue;
> 
> CBS itself must not ignore them. Users of CBS should be able to choose
> to ignore them, same way you're doing it for h2645_parse and its users
> below.

ok, will update.

Thanks
-- 
Andriy


More information about the ffmpeg-devel mailing list