Unified · Split
| @@ -347,40 +347,48 @@ static void luma_prof_uni(VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst · 346 unmodified lines | ||
| 347 | 347 | } |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | +static void luma_prof(VVCLocalContext *lc, int16_t *dst, const VVCFrame *ref, | |
| 351 | + const Mv *mv , const int x_off, const int y_off, const int block_w, const int block_h, const int lx) | |
| 352 | +{ | |
| 353 | + const VVCFrameContext *fc = lc->fc; | |
| 354 | + const PredictionUnit *pu = &lc->cu->pu; | |
| 355 | + const int mx = mv->x & 0xf; | |
| 356 | + const int my = mv->y & 0xf; | |
| 357 | + const int ox = x_off + (mv->x >> 4); | |
| 358 | + const int oy = y_off + (mv->y >> 4); | |
| 359 | + const int idx = av_log2(block_w) - 1; | |
| 360 | + const int is_chroma = 0; | |
| 361 | + uint16_t *prof_tmp = lc->tmp2 + PROF_TEMP_OFFSET; | |
| 362 | + ptrdiff_t src_stride = ref->frame->linesize[0]; | |
| 363 | + const uint8_t *src = ref->frame->data[0] + oy * src_stride + (ox * (1 << fc->ps.sps->pixel_shift)); | |
| 364 | + const int8_t *hf = ff_vvc_inter_luma_filters[VVC_INTER_LUMA_FILTER_TYPE_AFFINE][mx]; | |
| 365 | + const int8_t *vf = ff_vvc_inter_luma_filters[VVC_INTER_LUMA_FILTER_TYPE_AFFINE][my]; | |
| 366 | + | |
| 367 | + MC_EMULATED_EDGE(lc->edge_emu_buffer, &src, &src_stride, ox, oy); | |
| 368 | + if (!pu->cb_prof_flag[lx]) { | |
| 369 | + fc->vvcdsp.inter.put[LUMA][idx][!!my][!!mx](dst, src, src_stride, block_h, hf, vf, block_w); | |
| 370 | + } else { | |
| 371 | + fc->vvcdsp.inter.put[LUMA][idx][!!my][!!mx](prof_tmp, src, src_stride, AFFINE_MIN_BLOCK_SIZE, hf, vf, AFFINE_MIN_BLOCK_SIZE); | |
| 372 | + fc->vvcdsp.inter.fetch_samples(prof_tmp, src, src_stride, mx, my); | |
| 373 | + fc->vvcdsp.inter.apply_prof(dst, prof_tmp, pu->diff_mv_x[lx], pu->diff_mv_y[lx]); | |
| 374 | + } | |
| 375 | +} | |
| 376 | + | |
| 350 | 377 | static void luma_prof_bi(VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst_stride, |
| 351 | 378 | const VVCFrame *ref0, const VVCFrame *ref1, const MvField *mvf, const int x_off, const int y_off, |
| 352 | 379 | const int block_w, const int block_h) |
| 353 | 380 | { |
| 354 | 381 | const VVCFrameContext *fc = lc->fc; |
| 355 | − const PredictionUnit *pu = &lc->cu->pu; | |
| 356 | 382 | const VVCFrame *refs[] = { ref0, ref1 }; |
| 357 | 383 | int16_t *tmp[] = { lc->tmp, lc->tmp1 }; |
| 358 | − uint16_t *prof_tmp = lc->tmp2 + PROF_TEMP_OFFSET; | |
| 359 | − const int idx = av_log2(block_w) - 1; | |
| 360 | 384 | int denom, w0, w1, o0, o1; |
| 361 | 385 | const int weight_flag = derive_weight(&denom, &w0, &w1, &o0, &o1, lc, mvf, LUMA, 0); |
| 362 | − const int is_chroma = 0; | |
| 363 | 386 | |
| 364 | 387 | for (int i = L0; i <= L1; i++) { |
| 365 | − const Mv *mv = mvf->mv + i; | |
| 366 | − const int mx = mv->x & 0xf; | |
| 367 | − const int my = mv->y & 0xf; | |
| 368 | − const int ox = x_off + (mv->x >> 4); | |
| 369 | − const int oy = y_off + (mv->y >> 4); | |
| 370 | 388 | const VVCFrame *ref = refs[i]; |
| 371 | − ptrdiff_t src_stride = ref->frame->linesize[LUMA]; | |
| 372 | − const uint8_t *src = ref->frame->data[LUMA] + oy * src_stride + (ox * (1 << fc->ps.sps->pixel_shift)); | |
| 373 | − const int8_t *hf = ff_vvc_inter_luma_filters[VVC_INTER_LUMA_FILTER_TYPE_AFFINE][mx]; | |
| 374 | − const int8_t *vf = ff_vvc_inter_luma_filters[VVC_INTER_LUMA_FILTER_TYPE_AFFINE][my]; | |
| 375 | − | |
| 376 | − MC_EMULATED_EDGE(lc->edge_emu_buffer, &src, &src_stride, ox, oy); | |
| 377 | − if (!pu->cb_prof_flag[i]) { | |
| 378 | − fc->vvcdsp.inter.put[LUMA][idx][!!my][!!mx](tmp[i], src, src_stride, block_h, hf, vf, block_w); | |
| 379 | − } else { | |
| 380 | − fc->vvcdsp.inter.put[LUMA][idx][!!my][!!mx](prof_tmp, src, src_stride, AFFINE_MIN_BLOCK_SIZE, hf, vf, AFFINE_MIN_BLOCK_SIZE); | |
| 381 | − fc->vvcdsp.inter.fetch_samples(prof_tmp, src, src_stride, mx, my); | |
| 382 | − fc->vvcdsp.inter.apply_prof(tmp[i], prof_tmp, pu->diff_mv_x[i], pu->diff_mv_y[i]); | |
| 383 | − } | |
| 389 | + const Mv *mv = mvf->mv + i; | |
| 390 | + | |
| 391 | + luma_prof(lc, tmp[i], ref, mv, x_off, y_off, block_w, block_h, i); | |
| 384 | 392 | } |
| 385 | 393 | |
| 386 | 394 | if (weight_flag) |