[FFmpeg-devel] [PATCH v1 12/23] avcodec/vvc/intra: add palette coding decoder
toqsxw at gmail.com
toqsxw at gmail.com
Thu May 1 17:43:10 EEST 2025
From: Wu Jianhua <toqsxw at outlook.com>
Introduction at https://ieeexplore.ieee.org/document/9408666
passed files:
10b422_G_Sony_5.bit
10b422_H_Sony_5.bit
10b422_I_Sony_5.bit
10b422_J_Sony_5.bit
10b422_K_Sony_5.bit
10b422_L_Sony_5.bit
8b422_G_Sony_5.bit
8b422_H_Sony_5.bit
8b422_I_Sony_5.bit
8b422_J_Sony_5.bit
8b422_K_Sony_5.bit
8b422_L_Sony_5.bit
8b444_A_Kwai_2.bit
8b444_B_Kwai_2.bit
PALETTE_A_Alibaba_2.bit
PALETTE_B_Alibaba_2.bit
PALETTE_C_Alibaba_2.bit
PALETTE_D_Alibaba_2.bit
PALETTE_E_Alibaba_2.bit
Signed-off-by: Wu Jianhua <toqsxw at outlook.com>
---
libavcodec/vvc/intra.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/libavcodec/vvc/intra.c b/libavcodec/vvc/intra.c
index 2e1703e234..7f772fa4ae 100644
--- a/libavcodec/vvc/intra.c
+++ b/libavcodec/vvc/intra.c
@@ -670,6 +670,27 @@ int ff_vvc_palette_derive_scale(VVCLocalContext *lc, const TransformUnit *tu, Tr
return level_scale[0][rem6[qp]] << div6[qp];
}
+// 8.4.5.3 Decoding process for palette mode
+static void vvc_predict_palette(VVCLocalContext *lc)
+{
+ const VVCFrameContext *fc = lc->fc;
+ const CodingUnit *cu = lc->cu;
+ TransformUnit *tu = cu->tus.head;
+ const VVCSPS *sps = fc->ps.sps;
+ const int ps = sps->pixel_shift;
+
+ for (int i = 0; i < tu->nb_tbs; i++) {
+ TransformBlock *tb = &tu->tbs[i];
+ const int c_idx = tb->c_idx;
+ const int w = tb->tb_width;
+ const int h = tb->tb_height;
+ const ptrdiff_t stride = fc->frame->linesize[c_idx];
+ uint8_t *dst = POS(c_idx, cu->x0, cu->y0);
+
+ av_image_copy_plane(dst, stride, (uint8_t*)tb->coeffs, w << ps, w << ps, h);
+ }
+}
+
int ff_vvc_reconstruct(VVCLocalContext *lc, const int rs, const int rx, const int ry)
{
const VVCFrameContext *fc = lc->fc;
@@ -690,6 +711,8 @@ int ff_vvc_reconstruct(VVCLocalContext *lc, const int rs, const int rx, const in
ff_vvc_predict_ciip(lc);
else if (cu->pred_mode == MODE_IBC)
vvc_predict_ibc(lc);
+ else if (cu->pred_mode == MODE_PLT)
+ vvc_predict_palette(lc);
if (cu->coded_flag) {
ret = reconstruct(lc);
} else {
--
2.44.0.windows.1
More information about the ffmpeg-devel
mailing list