Ticket #4185: 0001-hevc-try-to-handle-the-NoRaslOutputFlag-logic.patch

File 0001-hevc-try-to-handle-the-NoRaslOutputFlag-logic.patch, 2.8 KB (added by Philip Langdale, 11 years ago)

Updated patch to apply cleanly to 2.8+

  • libavcodec/hevc.c

    From d78415252689fab22e499a270958f55272949317 Mon Sep 17 00:00:00 2001
    From: Philip Langdale <philipl@overt.org>
    Date: Sat, 12 Sep 2015 12:40:00 -0700
    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 8d4db22..da4f687 100644
    a b static int hevc_frame_start(HEVCContext *s)  
    26102610    if (ret < 0)
    26112611        goto fail;
    26122612
     2613    if (IS_IRAP(s))
     2614      s->NoRaslOutputFlag = 0;
     2615
    26132616    if (!s->avctx->hwaccel)
    26142617        ff_thread_finish_setup(s->avctx);
    26152618
    static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length)  
    27702773
    27712774    s->ref = NULL;
    27722775    s->last_eos = s->eos;
     2776    if (s->last_eos)
     2777      s->NoRaslOutputFlag = 1;
    27732778    s->eos = 0;
    27742779
    27752780    /* split the input packet into NAL units, so we know the upper bound on the
    static int hevc_update_thread_context(AVCodecContext *dst,  
    31353140    s->pocTid0    = s0->pocTid0;
    31363141    s->max_ra     = s0->max_ra;
    31373142    s->eos        = s0->eos;
     3143    s->NoRaslOutputFlag = s0->NoRaslOutputFlag;
    31383144
    31393145    s->is_nalff        = s0->is_nalff;
    31403146    s->nal_length_size = s0->nal_length_size;
    static av_cold int hevc_decode_init(AVCodecContext *avctx)  
    32393245
    32403246    s->enable_parallel_tiles = 0;
    32413247    s->picture_struct = 0;
     3248    s->NoRaslOutputFlag = 1;
    32423249
    32433250    if(avctx->active_thread_type & FF_THREAD_SLICE)
    32443251        s->threads_number = avctx->thread_count;
    static void hevc_decode_flush(AVCodecContext *avctx)  
    32803287    HEVCContext *s = avctx->priv_data;
    32813288    ff_hevc_flush_dpb(s);
    32823289    s->max_ra = INT_MAX;
     3290    s->NoRaslOutputFlag = 1;
    32833291}
    32843292
    32853293#define OFFSET(x) offsetof(HEVCContext, x)
  • libavcodec/hevc.h

    diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h
    index 32d6da9..196191a 100644
    a b typedef struct HEVCContext {  
    866866    int bs_height;
    867867
    868868    int is_decoded;
     869    int NoRaslOutputFlag;
    869870
    870871    HEVCPredContext hpc;
    871872    HEVCDSPContext hevcdsp;
  • libavcodec/hevc_refs.c

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