From patchwork Sat Aug 29 05:52:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guangxin Xu X-Patchwork-Id: 21977 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id A3D1244B595 for ; Sat, 29 Aug 2020 08:52:40 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 84932688392; Sat, 29 Aug 2020 08:52:40 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8122F6804AE for ; Sat, 29 Aug 2020 08:52:33 +0300 (EEST) Received: by mail-pl1-f174.google.com with SMTP id h2so652467plr.0 for ; Fri, 28 Aug 2020 22:52:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=VjveHd1OsKB6objGGq0v0eq8jjIr2N+2txFWFEtBeVg=; b=q/sTZdXH7c9cabJY+pJrypneeG2i3hI60M2p+oACatPi9ROfmhG33WmnV0PIMPli+k zQbiCMSibyxD8uFuiVq1OkywBKzlpWr1roPbl7zGBlPgWJ2wezYhsMRvCZspeJaWogGq NSUn/3o6bJAODfSU6ONrY8VYRPz7tPJ/VSaw3+BFsFiRTP45DeDZO30w7WIOUiwlrfax pjikZHisu0j4DIBOK5FUmfhR7mX+oXWWXZoFgQL23gPolekHNZnh/Km9bXd4JVu8DSec 51Ze9nqF88IcpzSQQFfLGuIunznlm9yBbGxd+19Pa9jCLCp1pljdcD7zOMVXmrWdb82M CYKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=VjveHd1OsKB6objGGq0v0eq8jjIr2N+2txFWFEtBeVg=; b=b8dF3enDbJM7P2iQ+2ApPPnoba1WjOQ3KJJfW0BsKthd3wx6skRLnRKx7WPpJHnIfZ kJQfsPIxOsE4SDgbiJnpwzY1djD97z9ZoTmJ2QvduXkI59QaHb/23gHdqz6pFPnohh6f VY7lng5q/w9rhAt2TGgCqWIxCWqZNYbA53t+0xyaZD5a5Fz0UXwcPKN6Ct7BfBhSdkna 5ESiCLFAVKxcBt1tadn/t1GffvrJjvHVx7ld5tfN6w1i5EQVoEOlbmJMn2V7m92WdCO1 CkCbqueHtkuwdqZU75oMEApBpMENn92e2KyNfs2IJ0z1Sdp18T5DCi+BqkS0PSJ6Nkb3 rGZQ== X-Gm-Message-State: AOAM530y4bynINUEwgCQhQYs0LHSX8JoGRZjsc468iuqNbpjd48kPHbN qPUrZYYfOn9ZCubznEjHdKEMXLe6BvFuCA== X-Google-Smtp-Source: ABdhPJwtJVwd65zNmncEprSS0sOQ37Xv76yVEX7KFGM0sap2nmLkhaEfVn8R//m9GdC5TNTlv7K0bg== X-Received: by 2002:a17:90b:e8a:: with SMTP id fv10mr1981803pjb.72.1598680351092; Fri, 28 Aug 2020 22:52:31 -0700 (PDT) Received: from localhost (23.83.245.51.16clouds.com. [23.83.245.51]) by smtp.gmail.com with ESMTPSA id j3sm950758pjw.23.2020.08.28.22.52.28 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 28 Aug 2020 22:52:30 -0700 (PDT) From: Xu Guangxin To: ffmpeg-devel@ffmpeg.org Date: Sat, 29 Aug 2020 13:52:17 +0800 Message-Id: <20200829055218.32261-1-oddstone@gmail.com> X-Mailer: git-send-email 2.17.1 Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/hevcdec: fix stat_coeff save/load for persistent_rice_adaptation_enabled_flag X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: michaelni@gmx.at, Xu Guangxin , Mickael.Raulet@insa-rennes.fr MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" It's required by 9.3.1. following clips have this feature: WPP_HIGH_TP_444_8BIT_RExt_Apple_2.bit Bitdepth_A_RExt_Sony_1.bin Bitdepth_B_RExt_Sony_1.bin EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_10BIT_RExt_Sony_1.bit EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_12BIT_RExt_Sony_1.bit EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_8BIT_RExt_Sony_1.bit EXTPREC_MAIN_444_16_INTRA_10BIT_RExt_Sony_1.bit EXTPREC_MAIN_444_16_INTRA_12BIT_RExt_Sony_1.bit EXTPREC_MAIN_444_16_INTRA_8BIT_RExt_Sony_1.bit WPP_AND_TILE_10Bit422Test_HIGH_TP_444_10BIT_RExt_Apple_2.bit WPP_AND_TILE_AND_CABAC_BYPASS_ALIGN_0_HIGH_TP_444_14BIT_RExt_Apple_2.bit WPP_AND_TILE_AND_CABAC_BYPASS_ALIGN_1_HIGH_TP_444_14BIT_RExt_Apple_2.bit WPP_AND_TILE_HIGH_TP_444_8BIT_RExt_Apple_2.bit you can download them from: https://www.itu.int/wftp3/av-arch/jctvc-site/bitstream_exchange/draft_conformance/RExt/ Signed-off-by: Xu Guangxin --- libavcodec/hevc_cabac.c | 6 ++++++ libavcodec/hevcdec.h | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c index 3dc0987dad..635b4edef3 100644 --- a/libavcodec/hevc_cabac.c +++ b/libavcodec/hevc_cabac.c @@ -454,12 +454,18 @@ void ff_hevc_save_states(HEVCContext *s, int ctb_addr_ts) (s->ps.sps->ctb_width == 2 && ctb_addr_ts % s->ps.sps->ctb_width == 0))) { memcpy(s->cabac_state, s->HEVClc->cabac_state, HEVC_CONTEXTS); + if (s->ps.sps->persistent_rice_adaptation_enabled_flag) { + memcpy(s->stat_coeff, s->HEVClc->stat_coeff, HEVC_STAT_COEFFS); + } } } static void load_states(HEVCContext *s) { memcpy(s->HEVClc->cabac_state, s->cabac_state, HEVC_CONTEXTS); + if (s->ps.sps->persistent_rice_adaptation_enabled_flag) { + memcpy(s->HEVClc->stat_coeff, s->stat_coeff, HEVC_STAT_COEFFS); + } } static int cabac_reinit(HEVCLocalContext *lc) diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h index 39c5c7f89f..d41aed4556 100644 --- a/libavcodec/hevcdec.h +++ b/libavcodec/hevcdec.h @@ -53,6 +53,7 @@ #define DEFAULT_INTRA_TC_OFFSET 2 #define HEVC_CONTEXTS 199 +#define HEVC_STAT_COEFFS 4 #define MRG_MAX_NUM_CANDS 5 @@ -424,7 +425,7 @@ typedef struct HEVCFrame { typedef struct HEVCLocalContext { uint8_t cabac_state[HEVC_CONTEXTS]; - uint8_t stat_coeff[4]; + uint8_t stat_coeff[HEVC_STAT_COEFFS]; uint8_t first_qp_group; @@ -480,6 +481,7 @@ typedef struct HEVCContext { int height; uint8_t *cabac_state; + uint8_t stat_coeff[HEVC_STAT_COEFFS]; /** 1 if the independent slice segment header was successfully parsed */ uint8_t slice_initialized;