Unified · Split
| @@ -586,56 +586,33 @@ static void vvc_deblock_bs_luma(const VVCLocalContext *lc, · 585 unmodified lines | ||
| 586 | 586 | } |
| 587 | 587 | } |
| 588 | 588 | |
| 589 | −static void vvc_deblock_bs_luma_vertical(const VVCLocalContext *lc, | |
| 590 | − const int x0, const int y0, const int width, const int height, const int rs) | |
| 591 | −{ | |
| 592 | − vvc_deblock_bs_luma(lc, x0, y0, width, height, rs, 1); | |
| 593 | −} | |
| 594 | − | |
| 595 | −static void vvc_deblock_bs_luma_horizontal(const VVCLocalContext *lc, | |
| 596 | − const int x0, const int y0, const int width, const int height, const int rs) | |
| 597 | −{ | |
| 598 | − vvc_deblock_bs_luma(lc, x0, y0, width, height, rs, 0); | |
| 599 | −} | |
| 600 | − | |
| 601 | −static void vvc_deblock_bs_chroma_vertical(const VVCLocalContext *lc, | |
| 602 | − const int x0, const int y0, const int width, const int height, const int rs) | |
| 589 | +static void vvc_deblock_bs_chroma(const VVCLocalContext *lc, | |
| 590 | + const int x0, const int y0, const int width, const int height, const int rs, const int vertical) | |
| 603 | 591 | { |
| 604 | 592 | const VVCFrameContext *fc = lc->fc; |
| 605 | − const int boundary_left = deblock_is_boundary(lc, | |
| 606 | − x0 > 0 && !(x0 & ((CHROMA_GRID << fc->ps.sps->hshift[CHROMA]) - 1)), x0, rs, 1); | |
| 607 | − | |
| 608 | − if (boundary_left) { | |
| 609 | − for (int i = 0; i < height; i += 2) { | |
| 610 | − for (int c_idx = CB; c_idx <= CR; c_idx++) { | |
| 611 | − const int bs = deblock_bs(lc, x0 - 1, y0 + i, x0, y0 + i, NULL, c_idx, 0, 0); | |
| 593 | + const int shift = (vertical ? fc->ps.sps->hshift : fc->ps.sps->vshift)[CHROMA]; | |
| 594 | + const int mask = (CHROMA_GRID << shift) - 1; | |
| 595 | + const int pos = vertical ? x0 : y0; | |
| 612 | 596 | |
| 613 | − TAB_BS(fc->tab.vertical_bs[c_idx], x0, (y0 + i)) = bs; | |
| 614 | − } | |
| 615 | − } | |
| 616 | − } | |
| 617 | −} | |
| 597 | + if (deblock_is_boundary(lc, pos > 0 && !(pos & mask), pos, rs, vertical)) { | |
| 598 | + const int size = vertical ? height : width; | |
| 618 | 599 | |
| 619 | −static void vvc_deblock_bs_chroma_horizontal(const VVCLocalContext *lc, | |
| 620 | − const int x0, const int y0, const int width, const int height, const int rs) | |
| 621 | −{ | |
| 622 | − const VVCFrameContext *fc = lc->fc; | |
| 623 | − const int boundary_upper = deblock_is_boundary(lc, | |
| 624 | − y0 > 0 && !(y0 & ((CHROMA_GRID << fc->ps.sps->vshift[CHROMA]) - 1)), y0, rs, 0); | |
| 600 | + for (int c_idx = CB; c_idx <= CR; c_idx++) { | |
| 601 | + uint8_t *tab_bs = (vertical ? fc->tab.vertical_bs : fc->tab.horizontal_bs)[c_idx]; | |
| 625 | 602 | |
| 626 | − if (boundary_upper) { | |
| 627 | − for (int i = 0; i < width; i += 2) { | |
| 628 | − for (int c_idx = CB; c_idx <= CR; c_idx++) { | |
| 629 | − const int bs = deblock_bs(lc, x0 + i, y0 - 1, x0 + i, y0, NULL, c_idx, 0, 0); | |
| 603 | + for (int i = 0; i < size; i += 2) { | |
| 604 | + const int x = x0 + i * !vertical; | |
| 605 | + const int y = y0 + i * vertical; | |
| 606 | + const int bs = deblock_bs(lc, x - vertical, y - !vertical, x, y, NULL, c_idx, 0, 0); | |
| 630 | 607 | |
| 631 | − TAB_BS(fc->tab.horizontal_bs[c_idx], x0 + i, y0) = bs; | |
| 608 | + TAB_BS(tab_bs, x, y) = bs; | |
| 632 | 609 | } |
| 633 | 610 | } |
| 634 | 611 | } |
| 635 | 612 | } |
| 636 | 613 | |
| 637 | 614 | typedef void (*deblock_bs_fn)(const VVCLocalContext *lc, const int x0, const int y0, |
| 638 | − const int width, const int height, const int rs); | |
| 615 | + const int width, const int height, const int rs, const int vertical); | |
| 639 | 616 | |
| 640 | 617 | static void vvc_deblock_bs(const VVCLocalContext *lc, const int x0, const int y0, const int rs, const int vertical) |
| 641 | 618 | { |
| @@ -645,9 +622,8 @@ static void vvc_deblock_bs(const VVCLocalContext *lc, const int x0, const int y0 · 3 unmodified lines | ||
| 645 | 622 | const int ctb_size = sps->ctb_size_y; |
| 646 | 623 | const int x_end = FFMIN(x0 + ctb_size, pps->width) >> MIN_TU_LOG2; |
| 647 | 624 | const int y_end = FFMIN(y0 + ctb_size, pps->height) >> MIN_TU_LOG2; |
| 648 | − deblock_bs_fn deblock_bs[2][2] = { | |
| 649 | − { vvc_deblock_bs_luma_horizontal, vvc_deblock_bs_chroma_horizontal }, | |
| 650 | − { vvc_deblock_bs_luma_vertical, vvc_deblock_bs_chroma_vertical } | |
| 625 | + deblock_bs_fn deblock_bs[] = { | |
| 626 | + vvc_deblock_bs_luma, vvc_deblock_bs_chroma | |
| 651 | 627 | }; |
| 652 | 628 | |
| 653 | 629 | for (int is_chroma = 0; is_chroma <= 1; is_chroma++) { |
| @@ -657,8 +633,8 @@ static void vvc_deblock_bs(const VVCLocalContext *lc, const int x0, const int y0 · 3 unmodified lines | ||
| 657 | 633 | for (int x = x0 >> MIN_TU_LOG2; x < x_end; x++) { |
| 658 | 634 | const int off = y * fc->ps.pps->min_tu_width + x; |
| 659 | 635 | if ((fc->tab.tb_pos_x0[is_chroma][off] >> MIN_TU_LOG2) == x && (fc->tab.tb_pos_y0[is_chroma][off] >> MIN_TU_LOG2) == y) { |
| 660 | − deblock_bs[vertical][is_chroma](lc, x << MIN_TU_LOG2, y << MIN_TU_LOG2, | |
| 661 | − fc->tab.tb_width[is_chroma][off] << hs, fc->tab.tb_height[is_chroma][off] << vs, rs); | |
| 636 | + deblock_bs[is_chroma](lc, x << MIN_TU_LOG2, y << MIN_TU_LOG2, | |
| 637 | + fc->tab.tb_width[is_chroma][off] << hs, fc->tab.tb_height[is_chroma][off] << vs, rs, vertical); | |
| 662 | 638 | } |
| 663 | 639 | } |
| 664 | 640 | } |