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 D6C6E4CDF6 for ; Wed, 14 May 2025 13:42:14 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 44D5868C551; Wed, 14 May 2025 16:41:03 +0300 (EEST) Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CD70368C5C2 for ; Wed, 14 May 2025 16:40:56 +0300 (EEST) Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-7427a4def77so2403111b3a.0 for ; Wed, 14 May 2025 06:40:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747230055; x=1747834855; 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=duyCMlRl0O5mOJsiw1A3h0QeB+2zkSitwQcRGRb0I0+dtW5sumAP2+rEesg/eCG+ir K+nwLxYX639b2SOzY2zaKYbG8Typ6rxcQmAtbltucCFHDang9MAgRCsb8pyzYpBKvQQG IyNeRyVfhZnt8Tm4U0gomQz5XXAzeeUaiK12KsOHBWchUHFyO58HOZRPEK2QL1VXSuVa QMeikmxn7zHjlfd+6z4l2udy+M9TvDdQQqfGW07DkKtaRRWND8i4ZRS7ZRw+8/5165S5 HV5CXVLNi7kzTkuis3r/MqKM8jvzDC4cggan916YRcwA9N/ki7D8WP6WLsrECd3nLRiU yr/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747230055; x=1747834855; 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=IatHtL5SxPPd+c0Vu4NoSAJpIOA6rjaMcRMEiwqi5ev7shdeTfrm2n7mXDw8qUbw1m 5Iw6kuvGGkv7QXs3/wXV5VhZi0focK+PCrVd4je4X8vgSTH9o3loE2/nX1WqZCB8VHfb NmBYq28d0WUN5SRH+4fsobegiYwDh5+CgwL1GFnoK5cqk62UV4h+oXGuzoYHgiiaabDH 9UMqDu2ggJ4eKFFU+CqxKi6MjUt1voW/aXHyPieWw1vtjDUFMY4Yhjah3+NygCrFIwqT oG4/zcP+Rzuox/3vf7sOuqumiB/iRgPhmP1GH4fC49K5/Vi7Q9BqJX3JldoRw1beiMTC TkRA== X-Gm-Message-State: AOJu0Yyw6vjNbex1Q2dPcqGRw3mD6zsnNk4gMcD4fXK0cED6YnysaEVc aBPgKOt4Hwd3DUp85d9yh4gRF6dPl4bTC+cKQZ6jPr6dXj9uNPQcpjZIOTbT X-Gm-Gg: ASbGnct3GwniMHTgucDI9z+AqUT8zYP4faT49fulkel/f1DVk1qAm73JcyeLrIyyWYi EQtkNsKyZMTVSUvlFDgZC+P53fi21LmYNfR7C0nNd0SP9R+TFXqY10DXOFXPLxHXHfw0lZYpTvs r0jnRUX1MkC4/nOsLiXZaZVtUOBf2nTSMOsJQdbk2BL0VfkLnNGS6ZpWNLAw8r7obAEayAs01YP 02ZUFcPtXW5socD461KErxgKVJ+et2nTpsCuYJH9h/cC3YL6BUCCZUKWVZFp6eUB2fxrZgf8v+e /F01QhGj/3creqzji9WBeauE+lXpmPrETvQVkSmJDnWsw3zBpOSm7h0OlfjkbovqvlgwMgaL X-Google-Smtp-Source: AGHT+IGPySOU0he2+jfQFdIlxP5nKtQKkNuYmjnRhlw/UBgDDLRZfmunIhiTx4NlYWmr7VOEpcq7dA== X-Received: by 2002:a05:6a20:9f96:b0:20b:9774:ac6c with SMTP id adf61e73a8af0-215ff08f07bmr5195909637.5.1747230054733; Wed, 14 May 2025 06:40:54 -0700 (PDT) Received: from localhost.localdomain ([124.79.129.75]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-74237a8f7edsm9310669b3a.167.2025.05.14.06.40.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 May 2025 06:40:54 -0700 (PDT) From: toqsxw@gmail.com X-Google-Original-From: toqsxw@outlook.com To: ffmpeg-devel@ffmpeg.org Date: Wed, 14 May 2025 21:40:16 +0800 Message-ID: <20250514134031.1584-9-toqsxw@outlook.com> X-Mailer: git-send-email 2.44.0.windows.1 In-Reply-To: <20250514134031.1584-1-toqsxw@outlook.com> References: <20250514134031.1584-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".