Unified · Split
| @@ -208,6 +208,7 @@ static void mc(VVCLocalContext *lc, int16_t *dst, const VVCFrame *ref, const Mv · 207 unmodified lines | |||
| 208 | int x_off, int y_off, const int block_w, const int block_h, const int c_idx) | 208 | int x_off, int y_off, const int block_w, const int block_h, const int c_idx) |
| 209 | { | 209 | { |
| 210 | const VVCFrameContext *fc = lc->fc; | 210 | const VVCFrameContext *fc = lc->fc; |
| 211 | const PredictionUnit *pu = &lc->cu->pu; | ||
| 211 | const uint8_t *src = ref->frame->data[c_idx]; | 212 | const uint8_t *src = ref->frame->data[c_idx]; |
| 212 | ptrdiff_t src_stride = ref->frame->linesize[c_idx]; | 213 | ptrdiff_t src_stride = ref->frame->linesize[c_idx]; |
| 213 | const int is_chroma = !!c_idx; | 214 | const int is_chroma = !!c_idx; |
| @@ -216,8 +217,9 @@ static void mc(VVCLocalContext *lc, int16_t *dst, const VVCFrame *ref, const Mv · 2 unmodified lines | |||
| 216 | const int idx = av_log2(block_w) - 1; | 217 | const int idx = av_log2(block_w) - 1; |
| 217 | const intptr_t mx = av_mod_uintp2(mv->x, 4 + hs) << (is_chroma - hs); | 218 | const intptr_t mx = av_mod_uintp2(mv->x, 4 + hs) << (is_chroma - hs); |
| 218 | const intptr_t my = av_mod_uintp2(mv->y, 4 + vs) << (is_chroma - vs); | 219 | const intptr_t my = av_mod_uintp2(mv->y, 4 + vs) << (is_chroma - vs); |
| 219 | const int8_t *hf = INTER_FILTER(0, mx); | 220 | const int hpel_if_idx = (is_chroma || pu->merge_gpm_flag) ? 0 : pu->mi.hpel_if_idx; |
| 220 | const int8_t *vf = INTER_FILTER(0, my); | 221 | const int8_t *hf = INTER_FILTER(hpel_if_idx, mx); |
| 222 | const int8_t *vf = INTER_FILTER(hpel_if_idx, my); | ||
| 221 | 223 | ||
| 222 | x_off += mv->x >> (4 + hs); | 224 | x_off += mv->x >> (4 + hs); |
| 223 | y_off += mv->y >> (4 + vs); | 225 | y_off += mv->y >> (4 + vs); |
| @@ -229,9 +231,10 @@ static void mc(VVCLocalContext *lc, int16_t *dst, const VVCFrame *ref, const Mv · 5 unmodified lines | |||
| 229 | 231 | ||
| 230 | static void mc_uni(VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst_stride, | 232 | static void mc_uni(VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst_stride, |
| 231 | const VVCFrame *ref, const MvField *mvf, int x_off, int y_off, const int block_w, const int block_h, | 233 | const VVCFrame *ref, const MvField *mvf, int x_off, int y_off, const int block_w, const int block_h, |
| 232 | const int c_idx, const int hf_idx, const int vf_idx) | 234 | const int c_idx) |
| 233 | { | 235 | { |
| 234 | const VVCFrameContext *fc = lc->fc; | 236 | const VVCFrameContext *fc = lc->fc; |
| 237 | const PredictionUnit *pu = &lc->cu->pu; | ||
| 235 | const uint8_t *src = ref->frame->data[c_idx]; | 238 | const uint8_t *src = ref->frame->data[c_idx]; |
| 236 | ptrdiff_t src_stride = ref->frame->linesize[c_idx]; | 239 | ptrdiff_t src_stride = ref->frame->linesize[c_idx]; |
| 237 | const int lx = mvf->pred_flag - PF_L0; | 240 | const int lx = mvf->pred_flag - PF_L0; |
| @@ -242,8 +245,9 @@ static void mc_uni(VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst_stride · 4 unmodified lines | |||
| 242 | const int is_chroma = !!c_idx; | 245 | const int is_chroma = !!c_idx; |
| 243 | const intptr_t mx = av_mod_uintp2(mv->x, 4 + hs) << (is_chroma - hs); | 246 | const intptr_t mx = av_mod_uintp2(mv->x, 4 + hs) << (is_chroma - hs); |
| 244 | const intptr_t my = av_mod_uintp2(mv->y, 4 + vs) << (is_chroma - vs); | 247 | const intptr_t my = av_mod_uintp2(mv->y, 4 + vs) << (is_chroma - vs); |
| 245 | const int8_t *hf = INTER_FILTER(hf_idx, mx); | 248 | const int hpel_if_idx = is_chroma ? 0 : pu->mi.hpel_if_idx; |
| 246 | const int8_t *vf = INTER_FILTER(vf_idx, my); | 249 | const int8_t *hf = INTER_FILTER(hpel_if_idx, mx); |
| 250 | const int8_t *vf = INTER_FILTER(hpel_if_idx, my); | ||
| 247 | int denom, wx, ox; | 251 | int denom, wx, ox; |
| 248 | 252 | ||
| 249 | x_off += mv->x >> (4 + hs); | 253 | x_off += mv->x >> (4 + hs); |
| @@ -263,7 +267,7 @@ static void mc_uni(VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst_stride · 13 unmodified lines | |||
| 263 | static void mc_bi(VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst_stride, | 267 | static void mc_bi(VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst_stride, |
| 264 | const VVCFrame *ref0, const VVCFrame *ref1, const MvField *mvf, const MvField *orig_mv, | 268 | const VVCFrame *ref0, const VVCFrame *ref1, const MvField *mvf, const MvField *orig_mv, |
| 265 | const int x_off, const int y_off, const int block_w, const int block_h, const int c_idx, | 269 | const int x_off, const int y_off, const int block_w, const int block_h, const int c_idx, |
| 266 | const int sb_bdof_flag, const int hf_idx, const int vf_idx) | 270 | const int sb_bdof_flag) |
| 267 | { | 271 | { |
| 268 | const VVCFrameContext *fc = lc->fc; | 272 | const VVCFrameContext *fc = lc->fc; |
| 269 | const PredictionUnit *pu = &lc->cu->pu; | 273 | const PredictionUnit *pu = &lc->cu->pu; |
| @@ -275,6 +279,7 @@ static void mc_bi(VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst_stride, · 5 unmodified lines | |||
| 275 | int denom, w0, w1, o0, o1; | 279 | int denom, w0, w1, o0, o1; |
| 276 | const int weight_flag = derive_weight(&denom, &w0, &w1, &o0, &o1, lc, mvf, c_idx, pu->dmvr_flag); | 280 | const int weight_flag = derive_weight(&denom, &w0, &w1, &o0, &o1, lc, mvf, c_idx, pu->dmvr_flag); |
| 277 | const int is_chroma = !!c_idx; | 281 | const int is_chroma = !!c_idx; |
| 282 | const int hpel_if_idx = is_chroma ? 0 : pu->mi.hpel_if_idx; | ||
| 278 | 283 | ||
| 279 | for (int i = L0; i <= L1; i++) { | 284 | for (int i = L0; i <= L1; i++) { |
| 280 | const Mv *mv = mvf->mv + i; | 285 | const Mv *mv = mvf->mv + i; |
| @@ -285,8 +290,8 @@ static void mc_bi(VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst_stride, · 4 unmodified lines | |||
| 285 | const VVCFrame *ref = refs[i]; | 290 | const VVCFrame *ref = refs[i]; |
| 286 | ptrdiff_t src_stride = ref->frame->linesize[c_idx]; | 291 | ptrdiff_t src_stride = ref->frame->linesize[c_idx]; |
| 287 | const uint8_t *src = ref->frame->data[c_idx] + oy * src_stride + (ox * (1 << fc->ps.sps->pixel_shift)); | 292 | const uint8_t *src = ref->frame->data[c_idx] + oy * src_stride + (ox * (1 << fc->ps.sps->pixel_shift)); |
| 288 | const int8_t *hf = INTER_FILTER(hf_idx, mx); | 293 | const int8_t *hf = INTER_FILTER(hpel_if_idx, mx); |
| 289 | const int8_t *vf = INTER_FILTER(vf_idx, my); | 294 | const int8_t *vf = INTER_FILTER(hpel_if_idx, my); |
| 290 | 295 | ||
| 291 | if (pu->dmvr_flag) { | 296 | if (pu->dmvr_flag) { |
| 292 | const int x_sb = x_off + (orig_mv->mv[i].x >> (4 + hs)); | 297 | const int x_sb = x_off + (orig_mv->mv[i].x >> (4 + hs)); |
| @@ -515,17 +520,15 @@ static void pred_regular(VVCLocalContext *lc, const MvField *mvf, const MvField · 222 unmodified lines | |||
| 515 | const int do_ciip = lc->cu->ciip_flag && (is_luma || (w > 2)); | 520 | const int do_ciip = lc->cu->ciip_flag && (is_luma || (w > 2)); |
| 516 | uint8_t *inter = do_ciip ? (uint8_t *)lc->ciip_tmp : dst; | 521 | uint8_t *inter = do_ciip ? (uint8_t *)lc->ciip_tmp : dst; |
| 517 | const ptrdiff_t inter_stride = do_ciip ? (MAX_PB_SIZE * sizeof(uint16_t)) : dst_stride; | 522 | const ptrdiff_t inter_stride = do_ciip ? (MAX_PB_SIZE * sizeof(uint16_t)) : dst_stride; |
| 518 | const int hf_idx = is_luma ? lc->cu->pu.mi.hpel_if_idx : 0; | ||
| 519 | const int vf_idx = is_luma ? lc->cu->pu.mi.hpel_if_idx : 0; | ||
| 520 | const int do_bdof = is_luma && sb_bdof_flag; | 523 | const int do_bdof = is_luma && sb_bdof_flag; |
| 521 | 524 | ||
| 522 | if (mvf->pred_flag != PF_BI) { | 525 | if (mvf->pred_flag != PF_BI) { |
| 523 | const int lx = mvf->pred_flag - PF_L0; | 526 | const int lx = mvf->pred_flag - PF_L0; |
| 524 | mc_uni(lc, inter, inter_stride, refp[lx]->ref, mvf, | 527 | mc_uni(lc, inter, inter_stride, refp[lx]->ref, mvf, |
| 525 | x, y, w, h, c_idx, hf_idx, vf_idx); | 528 | x, y, w, h, c_idx); |
| 526 | } else { | 529 | } else { |
| 527 | mc_bi(lc, inter, inter_stride, refp[L0]->ref, refp[L1]->ref, mvf, orig_mvf, | 530 | mc_bi(lc, inter, inter_stride, refp[L0]->ref, refp[L1]->ref, mvf, orig_mvf, |
| 528 | x, y, w, h, c_idx, do_bdof, hf_idx, vf_idx); | 531 | x, y, w, h, c_idx, do_bdof); |
| 529 | } | 532 | } |
| 530 | if (do_ciip) { | 533 | if (do_ciip) { |
| 531 | const int intra_weight = ciip_derive_intra_weight(lc, x0, y0, sbw, sbh); | 534 | const int intra_weight = ciip_derive_intra_weight(lc, x0, y0, sbw, sbh); |