Showing the changes to libavcodec (2 of 2 files). Show all
Unified · Split
| @@ -336,29 +336,30 @@ static void derive_qp(const VVCLocalContext *lc, const TransformUnit *tu, Transf · 335 unmodified lines | |||
| 336 | tb->bd_offset = (1 << tb->bd_shift) >> 1; | 336 | tb->bd_offset = (1 << tb->bd_shift) >> 1; |
| 337 | } | 337 | } |
| 338 | 338 | ||
| 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 | |||
| 339 | //8.7.3 Scaling process for transform coefficients | 360 | //8.7.3 Scaling process for transform coefficients |
| 340 | static av_always_inline int derive_scale(const TransformBlock *tb, const int sh_dep_quant_used_flag) | 361 | static av_always_inline int derive_scale(const TransformBlock *tb, const int sh_dep_quant_used_flag) |
| 341 | { | 362 | { |
| 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 | }; | ||
| 362 | const int addin = sh_dep_quant_used_flag && !tb->ts; | 363 | const int addin = sh_dep_quant_used_flag && !tb->ts; |
| 363 | const int qp = tb->qp + addin; | 364 | const int qp = tb->qp + addin; |
| 364 | 365 | ||
| @@ -658,6 +659,17 @@ static void ibc_fill_vir_buf(const VVCLocalContext *lc, const CodingUnit *cu) · 293 unmodified lines | |||
| 658 | } | 659 | } |
| 659 | } | 660 | } |
| 660 | 661 | ||
| 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 | |||
| 661 | int ff_vvc_reconstruct(VVCLocalContext *lc, const int rs, const int rx, const int ry) | 673 | int ff_vvc_reconstruct(VVCLocalContext *lc, const int rs, const int rx, const int ry) |
| 662 | { | 674 | { |
| 663 | const VVCFrameContext *fc = lc->fc; | 675 | const VVCFrameContext *fc = lc->fc; |
| @@ -45,5 +45,6 @@ int ff_vvc_intra_pred_angle_derive(int pred_mode); · 44 unmodified lines | |||
| 45 | int ff_vvc_intra_inv_angle_derive(int pred_mode); | 45 | int ff_vvc_intra_inv_angle_derive(int pred_mode); |
| 46 | int ff_vvc_wide_angle_mode_mapping(const CodingUnit *cu, | 46 | int ff_vvc_wide_angle_mode_mapping(const CodingUnit *cu, |
| 47 | int tb_width, int tb_height, int c_idx, int pred_mode_intra); | 47 | 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); | ||
| 48 | 49 | ||
| 49 | #endif // AVCODEC_VVC_INTRA_H | 50 | #endif // AVCODEC_VVC_INTRA_H |