History

avcodec/vvc/intra: add ff_vvc_palette_derive_scale

Wu Jianhua committed 1 year ago

Commit fd85f831 parent 3ecf8f82 files · +33 −20Browse files

Unified · Split

2 files
  1. libavcodec/vvc/intra.c +32 −20
  2. libavcodec/vvc/intra.h +1 −0
libavcodec/vvc/intra.c+32−20
@@ -336,29 +336,30 @@ static void derive_qp(const VVCLocalContext *lc, const TransformUnit *tu, Transf · 335 unmodified lines
336336 tb->bd_offset = (1 << tb->bd_shift) >> 1;
337337 }
338338
339+static const uint8_t rem6[63 + 8 * 6 + 1] = {
340+ 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5,
341+ 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5,
342+ 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5,
343+ 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5,
344+ 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3,
345+};
346+
347+static const uint8_t div6[63 + 8 * 6 + 1] = {
348+ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3,
349+ 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7,
350+ 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11,
351+ 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15,
352+ 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18,
353+};
354+
355+const static int level_scale[2][6] = {
356+ { 40, 45, 51, 57, 64, 72 },
357+ { 57, 64, 72, 80, 90, 102 }
358+};
359+
339360 //8.7.3 Scaling process for transform coefficients
340361 static av_always_inline int derive_scale(const TransformBlock *tb, const int sh_dep_quant_used_flag)
341362 {
342− static const uint8_t rem6[63 + 8 * 6 + 1] = {
343− 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5,
344− 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5,
345− 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5,
346− 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5,
347− 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3,
348− };
349−
350− static const uint8_t div6[63 + 8 * 6 + 1] = {
351− 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3,
352− 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7,
353− 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11,
354− 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15,
355− 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18,
356− };
357−
358− const static int level_scale[2][6] = {
359− { 40, 45, 51, 57, 64, 72 },
360− { 57, 64, 72, 80, 90, 102 }
361− };
362363 const int addin = sh_dep_quant_used_flag && !tb->ts;
363364 const int qp = tb->qp + addin;
364365
@@ -658,6 +659,17 @@ static void ibc_fill_vir_buf(const VVCLocalContext *lc, const CodingUnit *cu) · 293 unmodified lines
658659 }
659660 }
660661
662+int ff_vvc_palette_derive_scale(VVCLocalContext *lc, const TransformUnit *tu, TransformBlock *tb)
663+{
664+ const VVCSPS *sps = lc->fc->ps.sps;
665+ const int qp_prime_ts_min = 4 + 6 * sps->r->sps_min_qp_prime_ts;
666+ int qp;
667+
668+ derive_qp(lc, tu, tb);
669+ qp = FFMAX(qp_prime_ts_min, tb->qp);
670+ return level_scale[0][rem6[qp]] << div6[qp];
671+}
672+
661673 int ff_vvc_reconstruct(VVCLocalContext *lc, const int rs, const int rx, const int ry)
662674 {
663675 const VVCFrameContext *fc = lc->fc;
libavcodec/vvc/intra.h+1−0
@@ -45,5 +45,6 @@ int ff_vvc_intra_pred_angle_derive(int pred_mode); · 44 unmodified lines
4545 int ff_vvc_intra_inv_angle_derive(int pred_mode);
4646 int ff_vvc_wide_angle_mode_mapping(const CodingUnit *cu,
4747 int tb_width, int tb_height, int c_idx, int pred_mode_intra);
48+int ff_vvc_palette_derive_scale(VVCLocalContext *lc, const TransformUnit *tu, TransformBlock *tb);
4849
4950 #endif // AVCODEC_VVC_INTRA_H

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t