From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id F13544BFA2 for ; Thu, 1 May 2025 14:45:20 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2C01968B7CC; Thu, 1 May 2025 17:43:59 +0300 (EEST) Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E070368B722 for ; Thu, 1 May 2025 17:43:54 +0300 (EEST) Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-736bfa487c3so1035626b3a.1 for ; Thu, 01 May 2025 07:43:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746110633; x=1746715433; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ifgTX3Bzts5Etth8ACPBcv7bhgpXAPqbDsgibjt8Eck=; b=g+k5qf1CIzS3IFpzt0PVePwSPEDWsNvItvuQsw65PePOrpEYKmGmRrPz87x4jBlkIt odpVtEPrD7gUtcDVSQ5rTBP+NLyZXuT1IbYr/XfgLU5tmnVnOMHyaxL4yTewdrhSXD8x Jq+auCBoxPbMIOlIxpJNKTR/51/fDSyGtZja62zScNGnswgw+5ZK3EDhpQFRstMqBz1/ 2WKBcyeXSJDu+/PtOARkSEke9OoQC/QXAYW86hZEvjUxlSje6n/lB9MOpLeM3KCrbwag DS7SE4VNW6HblRqSs6mkIY+kRxOl4NukB+yZXzkKbXLa/L0QS74xNRabqzNw4VXO7iS5 XZ2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746110633; x=1746715433; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ifgTX3Bzts5Etth8ACPBcv7bhgpXAPqbDsgibjt8Eck=; b=ED84T2jehqp/fWH4oHjZBzyUFYuViHD7kBMsg29BobRB6oekzoQv3jXoW+zBAgkpvv BEdVKZ+9A69JwDKy7uERuuP/XOwT6Od6QhE/hiwAVdG3rPYJSWX4rEMCTvH2pSWqVbnI +HSvy3kKjIVF8vBz/6U0mdR+ylevsecYGE9sViTOrYIlHo1Vsi6FJsgEuAJlsPLaXsdh AVVcDQ2ZRFVunDLEZbeBHU5UduSw6xxPu7XquvruR59sIe9tRm2uQ9dzwRgqm0Y86KhE inbFFp83z9bBWFVAoiRjZA1OuwlbL/aPC9Xt1v1+PPoDHegeDh/8HHhP4ReCifmweNOw FA4g== X-Gm-Message-State: AOJu0YxpDNRtuzU98+zDJXN4t57p3D1fFS6tNg1bjrR6HiMcSYLtV9fd TlHlzmy/vdoafxnp3ar9uG6p2hDtq65oJyF0LGlCZBB9BzvhYpWbFhcKCA== X-Gm-Gg: ASbGncvMJEBWVer1+Era2dd5ag4H1Hix/dyV6X9f4qgQMIpjNAFVhk3GbMujeh+9ZlV lx/3kk5UUMPaK+fcD/AA0xGmbdyoKsG3xDOGxy4e3Qzw/5HZ+8yrhd4n8zJdeC3mZ8BnG3492Zb MaJIdA1dgugbqTe8wXmFRWdGDQDF7+9W+emggq0ZS/RW/G5Lf4Dxt4bZwfoMSbhWeV+gm3vfbtd PYxzOr6cNp04EeZYKH+1f7mt+WPmZM7S5YZFtYZvVRXcArycuNwNHy3MGo1Jf5wTpTGePrRqgZg pt5TrDYGwO0xECuGMnpRXu9MTY7e85G9ZxaXlFZWuljn24+zJ+VBEOV2hN3uFw== X-Google-Smtp-Source: AGHT+IE1kniXsFiI8NXpu+TORm20/5dKVGtqqIwiB8DLEUl2UKVqKUhvD41s50Dqi7wJCvFNPUkHQA== X-Received: by 2002:a05:6a21:118a:b0:1f5:93cd:59b5 with SMTP id adf61e73a8af0-20aa41839ccmr10073728637.28.1746110632908; Thu, 01 May 2025 07:43:52 -0700 (PDT) Received: from localhost.localdomain ([124.79.129.75]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b1f9d4b68e8sm807271a12.27.2025.05.01.07.43.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 May 2025 07:43:52 -0700 (PDT) From: toqsxw@gmail.com X-Google-Original-From: toqsxw@outlook.com To: ffmpeg-devel@ffmpeg.org Date: Thu, 1 May 2025 22:43:07 +0800 Message-ID: <20250501144324.958-9-toqsxw@outlook.com> X-Mailer: git-send-email 2.44.0.windows.1 In-Reply-To: <20250501144324.958-1-toqsxw@outlook.com> References: <20250501144324.958-1-toqsxw@outlook.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v1 09/23] avcodec/vvc/intra: add ff_vvc_palette_derive_scale X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: Wu Jianhua Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Wu Jianhua Signed-off-by: Wu Jianhua --- libavcodec/vvc/intra.c | 52 ++++++++++++++++++++++++++---------------- libavcodec/vvc/intra.h | 1 + 2 files changed, 33 insertions(+), 20 deletions(-) diff --git a/libavcodec/vvc/intra.c b/libavcodec/vvc/intra.c index 2e6cb8f09e..2e1703e234 100644 --- a/libavcodec/vvc/intra.c +++ b/libavcodec/vvc/intra.c @@ -336,29 +336,30 @@ static void derive_qp(const VVCLocalContext *lc, const TransformUnit *tu, Transf tb->bd_offset = (1 << tb->bd_shift) >> 1; } +static const uint8_t rem6[63 + 8 * 6 + 1] = { + 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, + 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, + 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, + 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, + 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, +}; + +static const uint8_t div6[63 + 8 * 6 + 1] = { + 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, + 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, + 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, + 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, + 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, +}; + +const static int level_scale[2][6] = { + { 40, 45, 51, 57, 64, 72 }, + { 57, 64, 72, 80, 90, 102 } +}; + //8.7.3 Scaling process for transform coefficients static av_always_inline int derive_scale(const TransformBlock *tb, const int sh_dep_quant_used_flag) { - static const uint8_t rem6[63 + 8 * 6 + 1] = { - 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, - 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, - 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, - 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, - 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, - }; - - static const uint8_t div6[63 + 8 * 6 + 1] = { - 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, - 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, - 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, - 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, - 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, - }; - - const static int level_scale[2][6] = { - { 40, 45, 51, 57, 64, 72 }, - { 57, 64, 72, 80, 90, 102 } - }; const int addin = sh_dep_quant_used_flag && !tb->ts; const int qp = tb->qp + addin; @@ -658,6 +659,17 @@ static void ibc_fill_vir_buf(const VVCLocalContext *lc, const CodingUnit *cu) } } +int ff_vvc_palette_derive_scale(VVCLocalContext *lc, const TransformUnit *tu, TransformBlock *tb) +{ + const VVCSPS *sps = lc->fc->ps.sps; + const int qp_prime_ts_min = 4 + 6 * sps->r->sps_min_qp_prime_ts; + int qp; + + derive_qp(lc, tu, tb); + qp = FFMAX(qp_prime_ts_min, tb->qp); + return level_scale[0][rem6[qp]] << div6[qp]; +} + int ff_vvc_reconstruct(VVCLocalContext *lc, const int rs, const int rx, const int ry) { const VVCFrameContext *fc = lc->fc; diff --git a/libavcodec/vvc/intra.h b/libavcodec/vvc/intra.h index 8a02699135..1201c70836 100644 --- a/libavcodec/vvc/intra.h +++ b/libavcodec/vvc/intra.h @@ -45,5 +45,6 @@ int ff_vvc_intra_pred_angle_derive(int pred_mode); int ff_vvc_intra_inv_angle_derive(int pred_mode); int ff_vvc_wide_angle_mode_mapping(const CodingUnit *cu, int tb_width, int tb_height, int c_idx, int pred_mode_intra); +int ff_vvc_palette_derive_scale(VVCLocalContext *lc, const TransformUnit *tu, TransformBlock *tb); #endif // AVCODEC_VVC_INTRA_H -- 2.44.0.windows.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".