Ticket #4185: 0001-hevc-properly-handle-no_rasl_output_flag-when-removi.patch

File 0001-hevc-properly-handle-no_rasl_output_flag-when-removi.patch, 2.5 KB (added by Hendrik, 11 years ago)

New patch which more closely matches the spec and passes FATE

  • libavcodec/hevc.c

    From 839e13442eb1d45072cf4e0d6a456e41bd8b3dd7 Mon Sep 17 00:00:00 2001
    From: Hendrik Leppkes <h.leppkes@gmail.com>
    Date: Sat, 12 Sep 2015 21:50:24 +0200
    Subject: [PATCH] hevc: properly handle no_rasl_output_flag when removing
     pictures from the DPB
    
    ---
     libavcodec/hevc.c      | 5 +++++
     libavcodec/hevc.h      | 1 +
     libavcodec/hevc_refs.c | 2 +-
     3 files changed, 7 insertions(+), 1 deletion(-)
    
    diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
    index 8d4db22..e45f4a4 100644
    a b static int hls_slice_header(HEVCContext *s)  
    809809    s->HEVClc->tu.cu_qp_offset_cb = 0;
    810810    s->HEVClc->tu.cu_qp_offset_cr = 0;
    811811
     812    s->no_rasl_output_flag = IS_IDR(s) || IS_BLA(s) || (s->nal_unit_type == NAL_CRA_NUT && s->last_eos);
     813
    812814    return 0;
    813815}
    814816
    static int hevc_update_thread_context(AVCodecContext *dst,  
    31353137    s->pocTid0    = s0->pocTid0;
    31363138    s->max_ra     = s0->max_ra;
    31373139    s->eos        = s0->eos;
     3140    s->no_rasl_output_flag = s0->no_rasl_output_flag;
    31383141
    31393142    s->is_nalff        = s0->is_nalff;
    31403143    s->nal_length_size = s0->nal_length_size;
    static av_cold int hevc_decode_init(AVCodecContext *avctx)  
    32393242
    32403243    s->enable_parallel_tiles = 0;
    32413244    s->picture_struct = 0;
     3245    s->eos = 1;
    32423246
    32433247    if(avctx->active_thread_type & FF_THREAD_SLICE)
    32443248        s->threads_number = avctx->thread_count;
    static void hevc_decode_flush(AVCodecContext *avctx)  
    32803284    HEVCContext *s = avctx->priv_data;
    32813285    ff_hevc_flush_dpb(s);
    32823286    s->max_ra = INT_MAX;
     3287    s->eos = 1;
    32833288}
    32843289
    32853290#define OFFSET(x) offsetof(HEVCContext, x)
  • libavcodec/hevc.h

    diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h
    index 32d6da9..66b9a2f 100644
    a b typedef struct HEVCContext {  
    866866    int bs_height;
    867867
    868868    int is_decoded;
     869    int no_rasl_output_flag;
    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..611ad45 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->no_rasl_output_flag == 1) {
    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 &&