History

avcodec/vvcdec: refact out deblock_is_boundary

Nuo Mi committed 2 years ago

Commit 0d12e9c1 parent 4020e681 file · +26 −40Browse files

Unified · Split

libavcodec/vvc/vvc_filter.c+26−40
@@ -528,6 +528,26 @@ static av_always_inline int deblock_bs(const VVCLocalContext *lc, · 527 unmodified lines
528 return boundary_strength(lc, mvf_q, mvf_p, rpl_p);528 return boundary_strength(lc, mvf_q, mvf_p, rpl_p);
529}529}
530 530
531static int deblock_is_boundary(const VVCLocalContext *lc, const int boundary,
532 const int pos, const int vertical)
533{
534 const VVCFrameContext *fc = lc->fc;
535 const H266RawPPS *rpps = fc->ps.pps->r;
536 int flag;
537 if (boundary && (pos % fc->ps.sps->ctb_size_y) == 0) {
538 flag = vertical ? BOUNDARY_LEFT_SLICE : BOUNDARY_UPPER_SLICE;
539 if (lc->boundary_flags & flag &&
540 !rpps->pps_loop_filter_across_slices_enabled_flag)
541 return 0;
542
543 flag = vertical ? BOUNDARY_LEFT_TILE : BOUNDARY_UPPER_TILE;
544 if (lc->boundary_flags & flag &&
545 !rpps->pps_loop_filter_across_tiles_enabled_flag)
546 return 0;
547 }
548 return boundary;
549}
550
531static void vvc_deblock_bs_luma_vertical(const VVCLocalContext *lc,551static void vvc_deblock_bs_luma_vertical(const VVCLocalContext *lc,
532 const int x0, const int y0, const int width, const int height)552 const int x0, const int y0, const int width, const int height)
533{553{
@@ -554,15 +574,7 @@ static void vvc_deblock_bs_luma_vertical(const VVCLocalContext *lc, · 20 unmodified lines
554 }574 }
555 575
556 // bs for vertical TU boundaries576 // bs for vertical TU boundaries
557 boundary_left = x0 > 0 && !(x0 & 3);577 boundary_left = deblock_is_boundary(lc, x0 > 0 && !(x0 & 3), x0, 1);
558 if (boundary_left &&
559 ((!fc->ps.pps->r->pps_loop_filter_across_slices_enabled_flag &&
560 lc->boundary_flags & BOUNDARY_LEFT_SLICE &&
561 (x0 % (1 << fc->ps.sps->ctb_log2_size_y)) == 0) ||
562 (!fc->ps.pps->r->pps_loop_filter_across_tiles_enabled_flag &&
563 lc->boundary_flags & BOUNDARY_LEFT_TILE &&
564 (x0 % (1 << fc->ps.sps->ctb_log2_size_y)) == 0)))
565 boundary_left = 0;
566 578
567 if (boundary_left) {579 if (boundary_left) {
568 const RefPicList *rpl_left =580 const RefPicList *rpl_left =
@@ -610,15 +622,7 @@ static void vvc_deblock_bs_luma_horizontal(const VVCLocalContext *lc, · 41 unmodified lines
610 has_horizontal_sb = cb_height > 8;622 has_horizontal_sb = cb_height > 8;
611 }623 }
612 624
613 boundary_upper = y0 > 0 && !(y0 & 3);625 boundary_upper = deblock_is_boundary(lc, y0 > 0 && !(y0 & 3), y0, 0);
614 if (boundary_upper &&
615 ((!fc->ps.pps->r->pps_loop_filter_across_slices_enabled_flag &&
616 lc->boundary_flags & BOUNDARY_UPPER_SLICE &&
617 (y0 % (1 << fc->ps.sps->ctb_log2_size_y)) == 0) ||
618 (!fc->ps.pps->r->pps_loop_filter_across_tiles_enabled_flag &&
619 lc->boundary_flags & BOUNDARY_UPPER_TILE &&
620 (y0 % (1 << fc->ps.sps->ctb_log2_size_y)) == 0)))
621 boundary_upper = 0;
622 626
623 if (boundary_upper) {627 if (boundary_upper) {
624 const RefPicList *rpl_top =628 const RefPicList *rpl_top =
@@ -646,18 +650,9 @@ static void vvc_deblock_bs_chroma_vertical(const VVCLocalContext *lc, · 21 unmodified lines
646 const int x0, const int y0, const int width, const int height)650 const int x0, const int y0, const int width, const int height)
647{651{
648 const VVCFrameContext *fc = lc->fc;652 const VVCFrameContext *fc = lc->fc;
649 int boundary_left;
650
651 // bs for vertical TU boundaries653 // bs for vertical TU boundaries
652 boundary_left = x0 > 0 && !(x0 & ((CHROMA_GRID << fc->ps.sps->hshift[1]) - 1));654 const int boundary_left = deblock_is_boundary(lc,
653 if (boundary_left &&655 x0 > 0 && !(x0 & ((CHROMA_GRID << fc->ps.sps->hshift[CHROMA]) - 1)), x0, 1);
654 ((!fc->ps.pps->r->pps_loop_filter_across_slices_enabled_flag &&
655 lc->boundary_flags & BOUNDARY_LEFT_SLICE &&
656 (x0 % (1 << fc->ps.sps->ctb_log2_size_y)) == 0) ||
657 (!fc->ps.pps->r->pps_loop_filter_across_tiles_enabled_flag &&
658 lc->boundary_flags & BOUNDARY_LEFT_TILE &&
659 (x0 % (1 << fc->ps.sps->ctb_log2_size_y)) == 0)))
660 boundary_left = 0;
661 656
662 if (boundary_left) {657 if (boundary_left) {
663 for (int i = 0; i < height; i += 2) {658 for (int i = 0; i < height; i += 2) {
@@ -674,17 +669,8 @@ static void vvc_deblock_bs_chroma_horizontal(const VVCLocalContext *lc, · 10 unmodified lines
674 const int x0, const int y0, const int width, const int height)669 const int x0, const int y0, const int width, const int height)
675{670{
676 const VVCFrameContext *fc = lc->fc;671 const VVCFrameContext *fc = lc->fc;
677 int boundary_upper;672 const int boundary_upper = deblock_is_boundary(lc,
678 673 y0 > 0 && !(y0 & ((CHROMA_GRID << fc->ps.sps->vshift[CHROMA]) - 1)), y0, 0);
679 boundary_upper = y0 > 0 && !(y0 & ((CHROMA_GRID << fc->ps.sps->vshift[1]) - 1));
680 if (boundary_upper &&
681 ((!fc->ps.pps->r->pps_loop_filter_across_slices_enabled_flag &&
682 lc->boundary_flags & BOUNDARY_UPPER_SLICE &&
683 (y0 % (1 << fc->ps.sps->ctb_log2_size_y)) == 0) ||
684 (!fc->ps.pps->r->pps_loop_filter_across_tiles_enabled_flag &&
685 lc->boundary_flags & BOUNDARY_UPPER_TILE &&
686 (y0 % (1 << fc->ps.sps->ctb_log2_size_y)) == 0)))
687 boundary_upper = 0;
688 674
689 if (boundary_upper) {675 if (boundary_upper) {
690 for (int i = 0; i < width; i += 2) {676 for (int i = 0; i < width; i += 2) {

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