diff options
author | Nuo Mi <nuomi2021@gmail.com> | 2024-05-19 21:27:40 +0800 |
---|---|---|
committer | Nuo Mi <nuomi2021@gmail.com> | 2024-05-21 20:20:25 +0800 |
commit | aa8d5c6e7ed3c2340035c93a2fae93d1aa8dd9c6 (patch) | |
tree | 9d00d1a292dec93c3e9761e605d428255e605530 /libavcodec | |
parent | 08ad51ece6605c228a7751d777577342da2a7194 (diff) | |
download | ffmpeg-aa8d5c6e7ed3c2340035c93a2fae93d1aa8dd9c6.tar.gz |
avcodec/vvcdec: add vvc inter filters for RPR
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/vvc/data.c | 83 | ||||
-rw-r--r-- | libavcodec/vvc/data.h | 10 | ||||
-rw-r--r-- | libavcodec/vvc/inter.c | 8 |
3 files changed, 92 insertions, 9 deletions
diff --git a/libavcodec/vvc/data.c b/libavcodec/vvc/data.c index ace585b663..a91e20754e 100644 --- a/libavcodec/vvc/data.c +++ b/libavcodec/vvc/data.c @@ -1732,7 +1732,7 @@ const uint8_t ff_vvc_alf_aps_class_to_filt_map[25] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, }; -const int8_t ff_vvc_inter_luma_filters[VVC_INTER_FILTER_TYPES][VVC_INTER_LUMA_FACTS][VVC_INTER_LUMA_TAPS] = { +const int8_t ff_vvc_inter_luma_filters[VVC_INTER_LUMA_FILTER_TYPES][VVC_INTER_LUMA_FACTS][VVC_INTER_LUMA_TAPS] = { { //1x, hpelIfIdx == 0, Table 27 { 0, 0, 0, 64, 0, 0, 0, 0 }, @@ -1774,6 +1774,46 @@ const int8_t ff_vvc_inter_luma_filters[VVC_INTER_FILTER_TYPES][VVC_INTER_LUMA_FA }, { + //1.5x, Table 28 + { -1, -5, 17, 42, 17, -5, -1, 0 }, + { 0, -5, 15, 41, 19, -5, -1, 0 }, + { 0, -5, 13, 40, 21, -4, -1, 0 }, + { 0, -5, 11, 39, 24, -4, -2, 1 }, + { 0, -5, 9, 38, 26, -3, -2, 1 }, + { 0, -5, 7, 38, 28, -2, -3, 1 }, + { 1, -5, 5, 36, 30, -1, -3, 1 }, + { 1, -4, 3, 35, 32, 0, -4, 1 }, + { 1, -4, 2, 33, 33, 2, -4, 1 }, + { 1, -4, 0, 32, 35, 3, -4, 1 }, + { 1, -3, -1, 30, 36, 5, -5, 1 }, + { 1, -3, -2, 28, 38, 7, -5, 0 }, + { 1, -2, -3, 26, 38, 9, -5, 0 }, + { 1, -2, -4, 24, 39, 11, -5, 0 }, + { 0, -1, -4, 21, 40, 13, -5, 0 }, + { 0, -1, -5, 19, 41, 15, -5, 0 }, + }, + + { + //2x, Table 29 + { -4, 2, 20, 28, 20, 2, -4, 0 }, + { -4, 0, 19, 29, 21, 5, -4, -2 }, + { -4, -1, 18, 29, 22, 6, -4, -2 }, + { -4, -1, 16, 29, 23, 7, -4, -2 }, + { -4, -1, 16, 28, 24, 7, -4, -2 }, + { -4, -1, 14, 28, 25, 8, -4, -2 }, + { -3, -3, 14, 27, 26, 9, -3, -3 }, + { -3, -1, 12, 28, 25, 10, -4, -3 }, + { -3, -3, 11, 27, 27, 11, -3, -3 }, + { -3, -4, 10, 25, 28, 12, -1, -3 }, + { -3, -3, 9, 26, 27, 14, -3, -3 }, + { -2, -4, 8, 25, 28, 14, -1, -4 }, + { -2, -4, 7, 24, 28, 16, -1, -4 }, + { -2, -4, 7, 23, 29, 16, -1, -4 }, + { -2, -4, 6, 22, 29, 18, -1, -4 }, + { -2, -4, 5, 21, 29, 19, 0, -4 }, + }, + + { //1x, affine, Table 30 { 0, 0, 0, 64, 0, 0, 0, 0 }, { 0, 1, -3, 63, 4, -2, 1, 0 }, @@ -1793,9 +1833,48 @@ const int8_t ff_vvc_inter_luma_filters[VVC_INTER_FILTER_TYPES][VVC_INTER_LUMA_FA { 0, 1, -2, 4, 63, -3, 1, 0 }, }, + { + //1.5x, affine, Table 31 + { 0, -6, 17, 42, 17, -5, -1, 0 }, + { 0, -5, 15, 41, 19, -5, -1, 0 }, + { 0, -5, 13, 40, 21, -4, -1, 0 }, + { 0, -5, 11, 39, 24, -4, -1, 0 }, + { 0, -5, 9, 38, 26, -3, -1, 0 }, + { 0, -5, 7, 38, 28, -2, -2, 0 }, + { 0, -4, 5, 36, 30, -1, -2, 0 }, + { 0, -3, 3, 35, 32, 0, -3, 0 }, + { 0, -3, 2, 33, 33, 2, -3, 0 }, + { 0, -3, 0, 32, 35, 3, -3, 0 }, + { 0, -2, -1, 30, 36, 5, -4, 0 }, + { 0, -2, -2, 28, 38, 7, -5, 0 }, + { 0, -1, -3, 26, 38, 9, -5, 0 }, + { 0, -1, -4, 24, 39, 11, -5, 0 }, + { 0, -1, -4, 21, 40, 13, -5, 0 }, + { 0, -1, -5, 19, 41, 15, -5, 0 }, + }, + + { + //2x, affine, Table 32 + { 0, -2, 20, 28, 20, 2, -4, 0 }, + { 0, -4, 19, 29, 21, 5, -6, 0 }, + { 0, -5, 18, 29, 22, 6, -6, 0 }, + { 0, -5, 16, 29, 23, 7, -6, 0 }, + { 0, -5, 16, 28, 24, 7, -6, 0 }, + { 0, -5, 14, 28, 25, 8, -6, 0 }, + { 0, -6, 14, 27, 26, 9, -6, 0 }, + { 0, -4, 12, 28, 25, 10, -7, 0 }, + { 0, -6, 11, 27, 27, 11, -6, 0 }, + { 0, -7, 10, 25, 28, 12, -4, 0 }, + { 0, -6, 9, 26, 27, 14, -6, 0 }, + { 0, -6, 8, 25, 28, 14, -5, 0 }, + { 0, -6, 7, 24, 28, 16, -5, 0 }, + { 0, -6, 7, 23, 29, 16, -5, 0 }, + { 0, -6, 6, 22, 29, 18, -5, 0 }, + { 0, -6, 5, 21, 29, 19, -4, 0 }, + } }; -const int8_t ff_vvc_inter_chroma_filters[VVC_INTER_FILTER_TYPES][VVC_INTER_CHROMA_FACTS][VVC_INTER_CHROMA_TAPS] = { +const int8_t ff_vvc_inter_chroma_filters[VVC_INTER_CHROMA_FILTER_TYPES][VVC_INTER_CHROMA_FACTS][VVC_INTER_CHROMA_TAPS] = { { //1x, Table 33 { 0, 64, 0, 0 }, diff --git a/libavcodec/vvc/data.h b/libavcodec/vvc/data.h index e493b9e0e6..a0512e626b 100644 --- a/libavcodec/vvc/data.h +++ b/libavcodec/vvc/data.h @@ -43,15 +43,19 @@ extern const int8_t ff_vvc_lfnst_8x8[4][2][16][48]; extern const uint8_t ff_vvc_lfnst_tr_set_index[95]; extern uint8_t ff_vvc_default_scale_m[64 * 64]; -#define VVC_INTER_FILTER_TYPES 3 +#define VVC_INTER_LUMA_FILTER_TYPE_AFFINE 4 + +#define VVC_INTER_LUMA_FILTER_TYPES 7 +#define VVC_INTER_CHROMA_FILTER_TYPES 3 + #define VVC_INTER_LUMA_FACTS 16 #define VVC_INTER_LUMA_TAPS 8 #define VVC_INTER_CHROMA_FACTS 32 #define VVC_INTER_CHROMA_TAPS 4 #define VVC_INTER_LUMA_DMVR_FACTS 16 #define VVC_INTER_LUMA_DMVR_TAPS 2 -extern const int8_t ff_vvc_inter_luma_filters[VVC_INTER_FILTER_TYPES][VVC_INTER_LUMA_FACTS][VVC_INTER_LUMA_TAPS]; -extern const int8_t ff_vvc_inter_chroma_filters[VVC_INTER_FILTER_TYPES][VVC_INTER_CHROMA_FACTS][VVC_INTER_CHROMA_TAPS]; +extern const int8_t ff_vvc_inter_luma_filters[VVC_INTER_LUMA_FILTER_TYPES][VVC_INTER_LUMA_FACTS][VVC_INTER_LUMA_TAPS]; +extern const int8_t ff_vvc_inter_chroma_filters[VVC_INTER_CHROMA_FILTER_TYPES][VVC_INTER_CHROMA_FACTS][VVC_INTER_CHROMA_TAPS]; extern const int8_t ff_vvc_inter_luma_dmvr_filters[VVC_INTER_LUMA_DMVR_FACTS][VVC_INTER_LUMA_DMVR_TAPS]; #define VVC_INTRA_LUMA_TYPES 2 diff --git a/libavcodec/vvc/inter.c b/libavcodec/vvc/inter.c index 23d9ac05e6..31c6f43916 100644 --- a/libavcodec/vvc/inter.c +++ b/libavcodec/vvc/inter.c @@ -320,8 +320,8 @@ static void luma_prof_uni(VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst const Mv *mv = mvf->mv + lx; const int mx = mv->x & 0xf; const int my = mv->y & 0xf; - const int8_t *hf = ff_vvc_inter_luma_filters[2][mx]; - const int8_t *vf = ff_vvc_inter_luma_filters[2][my]; + const int8_t *hf = ff_vvc_inter_luma_filters[VVC_INTER_LUMA_FILTER_TYPE_AFFINE][mx]; + const int8_t *vf = ff_vvc_inter_luma_filters[VVC_INTER_LUMA_FILTER_TYPE_AFFINE][my]; int denom, wx, ox; const int weight_flag = derive_weight_uni(&denom, &wx, &ox, lc, mvf, LUMA); const int is_chroma = 0; @@ -368,8 +368,8 @@ static void luma_prof_bi(VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst_ const int oy = y_off + (mv->y >> 4); ptrdiff_t src_stride = ref[i]->linesize[0]; const uint8_t *src = ref[i]->data[0] + oy * src_stride + (ox * (1 << fc->ps.sps->pixel_shift)); - const int8_t *hf = ff_vvc_inter_luma_filters[2][mx]; - const int8_t *vf = ff_vvc_inter_luma_filters[2][my]; + const int8_t *hf = ff_vvc_inter_luma_filters[VVC_INTER_LUMA_FILTER_TYPE_AFFINE][mx]; + const int8_t *vf = ff_vvc_inter_luma_filters[VVC_INTER_LUMA_FILTER_TYPE_AFFINE][my]; MC_EMULATED_EDGE(lc->edge_emu_buffer, &src, &src_stride, ox, oy); if (!pu->cb_prof_flag[i]) { |