Showing the changes to libavcodec (2 of 2 files). Show all
Unified · Split
| @@ -380,8 +380,7 @@ typedef struct VVCLocalContext { · 379 unmodified lines | |||
| 380 | DECLARE_ALIGNED(32, int16_t, tmp)[MAX_PB_SIZE * MAX_PB_SIZE]; | 380 | DECLARE_ALIGNED(32, int16_t, tmp)[MAX_PB_SIZE * MAX_PB_SIZE]; |
| 381 | DECLARE_ALIGNED(32, int16_t, tmp1)[MAX_PB_SIZE * MAX_PB_SIZE]; | 381 | DECLARE_ALIGNED(32, int16_t, tmp1)[MAX_PB_SIZE * MAX_PB_SIZE]; |
| 382 | DECLARE_ALIGNED(32, int16_t, tmp2)[MAX_PB_SIZE * MAX_PB_SIZE]; | 382 | DECLARE_ALIGNED(32, int16_t, tmp2)[MAX_PB_SIZE * MAX_PB_SIZE]; |
| 383 | DECLARE_ALIGNED(32, uint8_t, ciip_tmp1)[MAX_PB_SIZE * MAX_PB_SIZE * 2]; | 383 | DECLARE_ALIGNED(32, uint8_t, ciip_tmp)[MAX_PB_SIZE * MAX_PB_SIZE * 2]; |
| 384 | DECLARE_ALIGNED(32, uint8_t, ciip_tmp2)[MAX_PB_SIZE * MAX_PB_SIZE * 2]; | ||
| 385 | DECLARE_ALIGNED(32, uint8_t, sao_buffer)[(MAX_CTU_SIZE + 2 * SAO_PADDING_SIZE) * EDGE_EMU_BUFFER_STRIDE * 2]; | 384 | DECLARE_ALIGNED(32, uint8_t, sao_buffer)[(MAX_CTU_SIZE + 2 * SAO_PADDING_SIZE) * EDGE_EMU_BUFFER_STRIDE * 2]; |
| 386 | DECLARE_ALIGNED(32, uint8_t, alf_buffer_luma)[(MAX_CTU_SIZE + 2 * ALF_PADDING_SIZE) * EDGE_EMU_BUFFER_STRIDE * 2]; | 385 | DECLARE_ALIGNED(32, uint8_t, alf_buffer_luma)[(MAX_CTU_SIZE + 2 * ALF_PADDING_SIZE) * EDGE_EMU_BUFFER_STRIDE * 2]; |
| 387 | DECLARE_ALIGNED(32, uint8_t, alf_buffer_chroma)[(MAX_CTU_SIZE + 2 * ALF_PADDING_SIZE) * EDGE_EMU_BUFFER_STRIDE * 2]; | 386 | DECLARE_ALIGNED(32, uint8_t, alf_buffer_chroma)[(MAX_CTU_SIZE + 2 * ALF_PADDING_SIZE) * EDGE_EMU_BUFFER_STRIDE * 2]; |
| @@ -482,98 +482,48 @@ static int ciip_derive_intra_weight(const VVCLocalContext *lc, const int x0, con · 481 unmodified lines | |||
| 482 | return w; | 482 | return w; |
| 483 | } | 483 | } |
| 484 | 484 | ||
| 485 | static void pred_regular_luma(VVCLocalContext *lc, const int hf_idx, const int vf_idx, const MvField *mv, | 485 | static void pred_regular(VVCLocalContext *lc, const MvField *mvf, const MvField *orig_mvf, |
| 486 | const int x0, const int y0, const int sbw, const int sbh, const MvField *orig_mv, const int sb_bdof_flag) | 486 | const int x0, const int y0, const int sbw, const int sbh, const int sb_bdof_flag, const int c_start) |
| 487 | { | 487 | { |
| 488 | const SliceContext *sc = lc->sc; | 488 | const VVCFrameContext *fc = lc->fc; |
| 489 | const VVCFrameContext *fc = lc->fc; | 489 | const int c_end = fc->ps.sps->r->sps_chroma_format_idc ? CR : LUMA; |
| 490 | const int ciip_flag = lc->cu->ciip_flag; | ||
| 491 | uint8_t *dst = POS(0, x0, y0); | ||
| 492 | const ptrdiff_t dst_stride = fc->frame->linesize[0]; | ||
| 493 | uint8_t *inter = ciip_flag ? (uint8_t *)lc->ciip_tmp1 : dst; | ||
| 494 | const ptrdiff_t inter_stride = ciip_flag ? (MAX_PB_SIZE * sizeof(uint16_t)) : dst_stride; | ||
| 495 | VVCFrame *ref[2]; | ||
| 496 | |||
| 497 | if (pred_get_refs(lc, ref, mv) < 0) | ||
| 498 | return; | ||
| 499 | |||
| 500 | if (mv->pred_flag != PF_BI) { | ||
| 501 | const int lx = mv->pred_flag - PF_L0; | ||
| 502 | mc_uni(lc, inter, inter_stride, ref[lx]->frame, mv, | ||
| 503 | x0, y0, sbw, sbh, LUMA, hf_idx, vf_idx); | ||
| 504 | } else { | ||
| 505 | mc_bi(lc, inter, inter_stride, ref[0]->frame, ref[1]->frame, mv, orig_mv, | ||
| 506 | x0, y0, sbw, sbh, LUMA, sb_bdof_flag, hf_idx, vf_idx); | ||
| 507 | } | ||
| 508 | |||
| 509 | if (ciip_flag) { | ||
| 510 | const int intra_weight = ciip_derive_intra_weight(lc, x0, y0, sbw, sbh); | ||
| 511 | fc->vvcdsp.intra.intra_pred(lc, x0, y0, sbw, sbh, 0); | ||
| 512 | if (sc->sh.r->sh_lmcs_used_flag) | ||
| 513 | fc->vvcdsp.lmcs.filter(inter, inter_stride, sbw, sbh, &fc->ps.lmcs.fwd_lut); | ||
| 514 | fc->vvcdsp.inter.put_ciip(dst, dst_stride, sbw, sbh, inter, inter_stride, intra_weight); | ||
| 515 | |||
| 516 | } | ||
| 517 | } | ||
| 518 | |||
| 519 | static void pred_regular_chroma(VVCLocalContext *lc, const MvField *mv, | ||
| 520 | const int x0, const int y0, const int sbw, const int sbh, const MvField *orig_mv, const int dmvr_flag) | ||
| 521 | { | ||
| 522 | const VVCFrameContext *fc = lc->fc; | ||
| 523 | const int hs = fc->ps.sps->hshift[1]; | ||
| 524 | const int vs = fc->ps.sps->vshift[1]; | ||
| 525 | const int x0_c = x0 >> hs; | ||
| 526 | const int y0_c = y0 >> vs; | ||
| 527 | const int w_c = sbw >> hs; | ||
| 528 | const int h_c = sbh >> vs; | ||
| 529 | const int do_ciip = lc->cu->ciip_flag && (w_c > 2); | ||
| 530 | |||
| 531 | uint8_t* dst1 = POS(1, x0, y0); | ||
| 532 | uint8_t* dst2 = POS(2, x0, y0); | ||
| 533 | const ptrdiff_t dst1_stride = fc->frame->linesize[1]; | ||
| 534 | const ptrdiff_t dst2_stride = fc->frame->linesize[2]; | ||
| 535 | |||
| 536 | uint8_t *inter1 = do_ciip ? (uint8_t *)lc->ciip_tmp1 : dst1; | ||
| 537 | const ptrdiff_t inter1_stride = do_ciip ? (MAX_PB_SIZE * sizeof(uint16_t)) : dst1_stride; | ||
| 538 | |||
| 539 | uint8_t *inter2 = do_ciip ? (uint8_t *)lc->ciip_tmp2 : dst2; | ||
| 540 | const ptrdiff_t inter2_stride = do_ciip ? (MAX_PB_SIZE * sizeof(uint16_t)) : dst2_stride; | ||
| 541 | |||
| 542 | //fix me | ||
| 543 | const int hf_idx = 0; | ||
| 544 | const int vf_idx = 0; | ||
| 545 | VVCFrame *ref[2]; | 490 | VVCFrame *ref[2]; |
| 546 | 491 | ||
| 547 | if (pred_get_refs(lc, ref, mv) < 0) | 492 | if (pred_get_refs(lc, ref, mvf) < 0) |
| 548 | return; | 493 | return; |
| 549 | 494 | ||
| 550 | if (mv->pred_flag != PF_BI) { | 495 | for (int c_idx = c_start; c_idx <= c_end; c_idx++) { |
| 551 | const int lx = mv->pred_flag - PF_L0; | 496 | uint8_t *dst = POS(c_idx, x0, y0); |
| 552 | if (!ref[lx]) | 497 | const ptrdiff_t dst_stride = fc->frame->linesize[c_idx]; |
| 553 | return; | 498 | const int hs = fc->ps.sps->hshift[c_idx]; |
| 554 | 499 | const int vs = fc->ps.sps->vshift[c_idx]; | |
| 555 | mc_uni(lc, inter1, inter1_stride, ref[lx]->frame, mv, | 500 | const int x = x0 >> hs; |
| 556 | x0_c, y0_c, w_c, h_c, CB, hf_idx, vf_idx); | 501 | const int y = y0 >> vs; |
| 557 | mc_uni(lc, inter2, inter2_stride, ref[lx]->frame, mv, | 502 | const int w = sbw >> hs; |
| 558 | x0_c, y0_c, w_c, h_c, CR, hf_idx, vf_idx); | 503 | const int h = sbh >> vs; |
| 559 | } else { | 504 | const int is_luma = !c_idx; |
| 560 | if (!ref[0] || !ref[1]) | 505 | const int do_ciip = lc->cu->ciip_flag && (is_luma || (w > 2)); |
| 561 | return; | 506 | uint8_t *inter = do_ciip ? (uint8_t *)lc->ciip_tmp : dst; |
| 562 | 507 | const ptrdiff_t inter_stride = do_ciip ? (MAX_PB_SIZE * sizeof(uint16_t)) : dst_stride; | |
| 563 | mc_bi(lc, inter1, inter1_stride, ref[0]->frame, ref[1]->frame, mv, orig_mv, | 508 | const int hf_idx = is_luma ? lc->cu->pu.mi.hpel_if_idx : 0; |
| 564 | x0_c, y0_c, w_c, h_c, CB, 0, hf_idx, vf_idx); | 509 | const int vf_idx = is_luma ? lc->cu->pu.mi.hpel_if_idx : 0; |
| 565 | 510 | const int do_bdof = is_luma && sb_bdof_flag; | |
| 566 | mc_bi(lc, inter2, inter2_stride, ref[0]->frame, ref[1]->frame, mv, orig_mv, | 511 | |
| 567 | x0_c, y0_c, w_c, h_c, CR, 0, hf_idx, vf_idx); | 512 | if (mvf->pred_flag != PF_BI) { |
| 568 | 513 | const int lx = mvf->pred_flag - PF_L0; | |
| 569 | } | 514 | mc_uni(lc, inter, inter_stride, ref[lx]->frame, mvf, |
| 570 | if (do_ciip) { | 515 | x, y, w, h, c_idx, hf_idx, vf_idx); |
| 571 | const int intra_weight = ciip_derive_intra_weight(lc, x0, y0, sbw, sbh); | 516 | } else { |
| 572 | fc->vvcdsp.intra.intra_pred(lc, x0, y0, sbw, sbh, 1); | 517 | mc_bi(lc, inter, inter_stride, ref[0]->frame, ref[1]->frame, mvf, orig_mvf, |
| 573 | fc->vvcdsp.intra.intra_pred(lc, x0, y0, sbw, sbh, 2); | 518 | x, y, w, h, c_idx, do_bdof, hf_idx, vf_idx); |
| 574 | fc->vvcdsp.inter.put_ciip(dst1, dst1_stride, w_c, h_c, inter1, inter1_stride, intra_weight); | 519 | } |
| 575 | fc->vvcdsp.inter.put_ciip(dst2, dst2_stride, w_c, h_c, inter2, inter2_stride, intra_weight); | 520 | if (do_ciip) { |
| 576 | 521 | const int intra_weight = ciip_derive_intra_weight(lc, x0, y0, sbw, sbh); | |
| 522 | fc->vvcdsp.intra.intra_pred(lc, x0, y0, sbw, sbh, c_idx); | ||
| 523 | if (!c_idx && lc->sc->sh.r->sh_lmcs_used_flag) | ||
| 524 | fc->vvcdsp.lmcs.filter(inter, inter_stride, w, h, &fc->ps.lmcs.fwd_lut); | ||
| 525 | fc->vvcdsp.inter.put_ciip(dst, dst_stride, w, h, inter, inter_stride, intra_weight); | ||
| 526 | } | ||
| 577 | } | 527 | } |
| 578 | } | 528 | } |
| 579 | 529 | ||
| @@ -720,7 +670,6 @@ static void derive_sb_mv(VVCLocalContext *lc, MvField *mv, MvField *orig_mv, int · 140 unmodified lines | |||
| 720 | 670 | ||
| 721 | static void pred_regular_blk(VVCLocalContext *lc, const int skip_ciip) | 671 | static void pred_regular_blk(VVCLocalContext *lc, const int skip_ciip) |
| 722 | { | 672 | { |
| 723 | const VVCFrameContext *fc = lc->fc; | ||
| 724 | const CodingUnit *cu = lc->cu; | 673 | const CodingUnit *cu = lc->cu; |
| 725 | PredictionUnit *pu = &lc->cu->pu; | 674 | PredictionUnit *pu = &lc->cu->pu; |
| 726 | const MotionInfo *mi = &pu->mi; | 675 | const MotionInfo *mi = &pu->mi; |
| @@ -742,9 +691,7 @@ static void pred_regular_blk(VVCLocalContext *lc, const int skip_ciip) · 15 unmodified lines | |||
| 742 | ff_vvc_set_neighbour_available(lc, x0, y0, sbw, sbh); | 691 | ff_vvc_set_neighbour_available(lc, x0, y0, sbw, sbh); |
| 743 | 692 | ||
| 744 | derive_sb_mv(lc, &mv, &orig_mv, &sb_bdof_flag, x0, y0, sbw, sbh); | 693 | derive_sb_mv(lc, &mv, &orig_mv, &sb_bdof_flag, x0, y0, sbw, sbh); |
| 745 | pred_regular_luma(lc, mi->hpel_if_idx, mi->hpel_if_idx, &mv, x0, y0, sbw, sbh, &orig_mv, sb_bdof_flag); | 694 | pred_regular(lc, &mv, &orig_mv, x0, y0, sbw, sbh, sb_bdof_flag, LUMA); |
| 746 | if (fc->ps.sps->r->sps_chroma_format_idc) | ||
| 747 | pred_regular_chroma(lc, &mv, x0, y0, sbw, sbh, &orig_mv, pu->dmvr_flag); | ||
| 748 | } | 695 | } |
| 749 | } | 696 | } |
| 750 | } | 697 | } |
| @@ -804,9 +751,9 @@ static void pred_affine_blk(VVCLocalContext *lc) · 53 unmodified lines | |||
| 804 | if (fc->ps.sps->r->sps_chroma_format_idc) { | 751 | if (fc->ps.sps->r->sps_chroma_format_idc) { |
| 805 | if (!av_mod_uintp2(sby, vs) && !av_mod_uintp2(sbx, hs)) { | 752 | if (!av_mod_uintp2(sby, vs) && !av_mod_uintp2(sbx, hs)) { |
| 806 | MvField mvc; | 753 | MvField mvc; |
| 807 | derive_affine_mvc(&mvc, fc, mv, x, y, sbw, sbh); | ||
| 808 | pred_regular_chroma(lc, &mvc, x, y, sbw<<hs, sbh<<vs, NULL, 0); | ||
| 809 | 754 | ||
| 755 | derive_affine_mvc(&mvc, fc, mv, x, y, sbw, sbh); | ||
| 756 | pred_regular(lc, &mvc, NULL, x, y, sbw << hs, sbh << vs, 0, CB); | ||
| 810 | } | 757 | } |
| 811 | } | 758 | } |
| 812 | 759 | ||