From patchwork Wed Dec 11 08:47:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fu, Linjie" X-Patchwork-Id: 16727 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 D4D91446A30 for ; Wed, 11 Dec 2019 10:57:56 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BE47868ADB2; Wed, 11 Dec 2019 10:57:56 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 51E8B68A983 for ; Wed, 11 Dec 2019 10:57:50 +0200 (EET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Dec 2019 00:57:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,301,1571727600"; d="scan'208";a="245165565" Received: from icl-dev.sh.intel.com ([10.239.158.73]) by fmsmga002.fm.intel.com with ESMTP; 11 Dec 2019 00:57:15 -0800 From: Linjie Fu To: ffmpeg-devel@ffmpeg.org Date: Wed, 11 Dec 2019 16:47:38 +0800 Message-Id: <1576054058-1518-1-git-send-email-linjie.fu@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [FFmpeg-devel] [PATCH] lavc/hevc_cabac: fix cbf_cb and cbf_cr for transform depth 4 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: Xu Guangxin , Linjie Fu MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" The max transform depth is 5(from 0 to 4), so we need 5 cabac states for cbf_cb and cbf_cr. See Table 9-4 for details. Signed-off-by: Xu Guangxin Signed-off-by: Linjie Fu --- libavcodec/hevc_cabac.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c index 8abb780..3dc0987 100644 --- a/libavcodec/hevc_cabac.c +++ b/libavcodec/hevc_cabac.c @@ -66,7 +66,7 @@ static const int8_t num_bins_in_se[] = { 1, // no_residual_data_flag 3, // split_transform_flag 2, // cbf_luma - 4, // cbf_cb, cbf_cr + 5, // cbf_cb, cbf_cr 2, // transform_skip_flag[][] 2, // explicit_rdpcm_flag[][] 2, // explicit_rdpcm_dir_flag[][] @@ -122,23 +122,23 @@ static const int elem_offset[sizeof(num_bins_in_se)] = { 37, // split_transform_flag 40, // cbf_luma 42, // cbf_cb, cbf_cr - 46, // transform_skip_flag[][] - 48, // explicit_rdpcm_flag[][] - 50, // explicit_rdpcm_dir_flag[][] - 52, // last_significant_coeff_x_prefix - 70, // last_significant_coeff_y_prefix - 88, // last_significant_coeff_x_suffix - 88, // last_significant_coeff_y_suffix - 88, // significant_coeff_group_flag - 92, // significant_coeff_flag - 136, // coeff_abs_level_greater1_flag - 160, // coeff_abs_level_greater2_flag - 166, // coeff_abs_level_remaining - 166, // coeff_sign_flag - 166, // log2_res_scale_abs - 174, // res_scale_sign_flag - 176, // cu_chroma_qp_offset_flag - 177, // cu_chroma_qp_offset_idx + 47, // transform_skip_flag[][] + 49, // explicit_rdpcm_flag[][] + 51, // explicit_rdpcm_dir_flag[][] + 53, // last_significant_coeff_x_prefix + 71, // last_significant_coeff_y_prefix + 89, // last_significant_coeff_x_suffix + 89, // last_significant_coeff_y_suffix + 89, // significant_coeff_group_flag + 93, // significant_coeff_flag + 137, // coeff_abs_level_greater1_flag + 161, // coeff_abs_level_greater2_flag + 167, // coeff_abs_level_remaining + 167, // coeff_sign_flag + 167, // log2_res_scale_abs + 175, // res_scale_sign_flag + 177, // cu_chroma_qp_offset_flag + 178, // cu_chroma_qp_offset_idx }; #define CNU 154 @@ -189,7 +189,7 @@ static const uint8_t init_values[3][HEVC_CONTEXTS] = { // cbf_luma 111, 141, // cbf_cb, cbf_cr - 94, 138, 182, 154, + 94, 138, 182, 154, 154, // transform_skip_flag 139, 139, // explicit_rdpcm_flag @@ -266,7 +266,7 @@ static const uint8_t init_values[3][HEVC_CONTEXTS] = { // cbf_luma 153, 111, // cbf_cb, cbf_cr - 149, 107, 167, 154, + 149, 107, 167, 154, 154, // transform_skip_flag 139, 139, // explicit_rdpcm_flag @@ -343,7 +343,7 @@ static const uint8_t init_values[3][HEVC_CONTEXTS] = { // cbf_luma 153, 111, // cbf_cb, cbf_cr - 149, 92, 167, 154, + 149, 92, 167, 154, 154, // transform_skip_flag 139, 139, // explicit_rdpcm_flag