Ticket #4185: hevc-norasloutputflag.patch

File hevc-norasloutputflag.patch, 2.8 KB (added by Hendrik, 12 years ago)

A quick and dirty patch attempting to implement handling of NoRaslOutputFlag

  • libavcodec/hevc.c

    From 147865fac43fe674302de9f820ca689583cebc60 Mon Sep 17 00:00:00 2001
    From: Hendrik Leppkes <h.leppkes@gmail.com>
    Date: Sat, 13 Dec 2014 21:21:00 +0100
    Subject: [PATCH] hevc: try to handle the NoRaslOutputFlag logic
    
    ---
     libavcodec/hevc.c      | 8 ++++++++
     libavcodec/hevc.h      | 1 +
     libavcodec/hevc_refs.c | 2 +-
     3 files changed, 10 insertions(+), 1 deletion(-)
    
    diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
    index 802bff6..2ab2a53 100644
    a b static int hevc_frame_start(HEVCContext *s)  
    25802580    if (ret < 0)
    25812581        goto fail;
    25822582
     2583    if (IS_IRAP(s))
     2584      s->NoRaslOutputFlag = 0;
     2585
    25832586    ff_thread_finish_setup(s->avctx);
    25842587
    25852588    return 0;
    static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length)  
    28572860
    28582861    s->ref = NULL;
    28592862    s->last_eos = s->eos;
     2863    if (s->last_eos)
     2864      s->NoRaslOutputFlag = 1;
    28602865    s->eos = 0;
    28612866
    28622867    /* split the input packet into NAL units, so we know the upper bound on the
    static int hevc_update_thread_context(AVCodecContext *dst,  
    33063311    s->pocTid0    = s0->pocTid0;
    33073312    s->max_ra     = s0->max_ra;
    33083313    s->eos        = s0->eos;
     3314    s->NoRaslOutputFlag = s0->NoRaslOutputFlag;
    33093315
    33103316    s->is_nalff        = s0->is_nalff;
    33113317    s->nal_length_size = s0->nal_length_size;
    static av_cold int hevc_decode_init(AVCodecContext *avctx)  
    34003406
    34013407    s->enable_parallel_tiles = 0;
    34023408    s->picture_struct = 0;
     3409    s->NoRaslOutputFlag = 1;
    34033410
    34043411    if(avctx->active_thread_type & FF_THREAD_SLICE)
    34053412        s->threads_number = avctx->thread_count;
    static void hevc_decode_flush(AVCodecContext *avctx)  
    34573464    HEVCContext *s = avctx->priv_data;
    34583465    ff_hevc_flush_dpb(s);
    34593466    s->max_ra = INT_MAX;
     3467    s->NoRaslOutputFlag = 1;
    34603468}
    34613469
    34623470#define OFFSET(x) offsetof(HEVCContext, x)
  • libavcodec/hevc.h

    diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h
    index 1727b60..441d361 100644
    a b typedef struct HEVCContext {  
    843843    int bs_height;
    844844
    845845    int is_decoded;
     846    int NoRaslOutputFlag;
    846847
    847848    HEVCPredContext hpc;
    848849    HEVCDSPContext hevcdsp;
  • libavcodec/hevc_refs.c

    diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c
    index 5d8b214..f6e1bf2 100644
    a b int ff_hevc_output_frame(HEVCContext *s, AVFrame *out, int flush)  
    173173        int min_poc   = INT_MAX;
    174174        int i, min_idx, ret;
    175175
    176         if (s->sh.no_output_of_prior_pics_flag == 1) {
     176        if (s->sh.no_output_of_prior_pics_flag == 1 && s->NoRaslOutputFlag) {
    177177            for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) {
    178178                HEVCFrame *frame = &s->DPB[i];
    179179                if (!(frame->flags & HEVC_FRAME_FLAG_BUMPING) && frame->poc != s->poc &&