@@ -440,57 +440,36 @@ static void luma_prof_bi(VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst_
440
440
{
441
441
const VVCFrameContext * fc = lc -> fc ;
442
442
const PredictionUnit * pu = & lc -> cu -> pu ;
443
- ptrdiff_t src0_stride = ref0 -> linesize [0 ];
444
- ptrdiff_t src1_stride = ref1 -> linesize [0 ];
445
- uint16_t * prof_tmp = lc -> tmp1 + 1 + MAX_PB_SIZE ;
446
- const Mv * mv0 = mvf -> mv + L0 ;
447
- const Mv * mv1 = mvf -> mv + L1 ;
448
- const int mx0 = mv0 -> x & 0xf ;
449
- const int my0 = mv0 -> y & 0xf ;
450
- const int mx1 = mv1 -> x & 0xf ;
451
- const int my1 = mv1 -> y & 0xf ;
452
- const int x_off0 = x_off + (mv0 -> x >>4 );
453
- const int y_off0 = y_off + (mv0 -> y >>4 );
454
- const int x_off1 = x_off + (mv1 -> x >>4 );
455
- const int y_off1 = y_off + (mv1 -> y >>4 );
456
-
457
- const uint8_t * src0 = ref0 -> data [0 ]+ y_off0 * src0_stride + (int )((unsigned )x_off0 <<fc -> ps .sps -> pixel_shift );
458
- const uint8_t * src1 = ref1 -> data [0 ]+ y_off1 * src1_stride + (int )((unsigned )x_off1 <<fc -> ps .sps -> pixel_shift );
459
-
443
+ const AVFrame * ref []= {ref0 ,ref1 };
444
+ int16_t * tmp []= {lc -> tmp ,lc -> tmp1 };
445
+ uint16_t * prof_tmp = lc -> tmp2 + 1 + MAX_PB_SIZE ;
460
446
int denom ,w0 ,w1 ,o0 ,o1 ;
461
- const int weight_flag = derive_weight (& denom ,& w0 ,& w1 ,& o0 ,& o1 ,lc ,mvf ,LUMA ,0 );
462
-
463
- EMULATED_EDGE_LUMA (lc -> edge_emu_buffer ,& src0 ,& src0_stride ,x_off0 ,y_off0 );
464
- EMULATED_EDGE_LUMA (lc -> edge_emu_buffer2 ,& src1 ,& src1_stride ,x_off1 ,y_off1 );
465
-
466
- if (!pu -> cb_prof_flag [L0 ]) {
467
- fc -> vvcdsp .inter .put [LUMA ][!!my0 ][!!mx0 ](lc -> tmp ,src0 ,src0_stride ,
468
- block_h ,mx0 ,my0 ,block_w ,2 ,2 );
469
- }else {
470
- fc -> vvcdsp .inter .put [LUMA ][!!my0 ][!!mx0 ](prof_tmp ,src0 ,src0_stride ,AFFINE_MIN_BLOCK_SIZE ,mx0 ,my0 ,AFFINE_MIN_BLOCK_SIZE ,2 ,2 );
471
- fc -> vvcdsp .inter .fetch_samples (prof_tmp ,src0 ,src0_stride ,mx0 ,my0 );
472
- fc -> vvcdsp .inter .apply_prof (lc -> tmp ,prof_tmp ,pu -> diff_mv_x [L0 ],pu -> diff_mv_y [L0 ]);
473
- }
474
- if (!pu -> cb_prof_flag [L1 ]) {
475
- fc -> vvcdsp .inter .put [LUMA ][!!my1 ][!!mx1 ](lc -> tmp1 ,src1 ,src1_stride ,
476
- block_h ,mx1 ,my1 ,block_w ,2 ,2 );
477
- if (weight_flag ) {
478
- fc -> vvcdsp .inter .w_avg (dst ,dst_stride ,lc -> tmp ,lc -> tmp1 ,block_w ,block_h ,
479
- denom ,w0 ,w1 ,o0 ,o1 );
447
+ const int weight_flag = derive_weight (& denom ,& w0 ,& w1 ,& o0 ,& o1 ,lc ,mvf ,LUMA ,0 );
448
+
449
+ for (int i = L0 ;i <=L1 ;i ++ ) {
450
+ const Mv * mv = mvf -> mv + i ;
451
+ const int mx = mv -> x & 0xf ;
452
+ const int my = mv -> y & 0xf ;
453
+ const int ox = x_off + (mv -> x >>4 );
454
+ const int oy = y_off + (mv -> y >>4 );
455
+ ptrdiff_t src_stride = ref [i ]-> linesize [0 ];
456
+ const uint8_t * src = ref [i ]-> data [0 ]+ oy * src_stride + (int )((unsigned )ox <<fc -> ps .sps -> pixel_shift );
457
+
458
+ EMULATED_EDGE_LUMA (lc -> edge_emu_buffer ,& src ,& src_stride ,ox ,oy );
459
+ if (!pu -> cb_prof_flag [i ]) {
460
+ fc -> vvcdsp .inter .put [LUMA ][!!my ][!!mx ](tmp [i ],src ,src_stride ,
461
+ block_h ,mx ,my ,block_w ,2 ,2 );
480
462
}else {
481
- fc -> vvcdsp .inter .avg (dst ,dst_stride ,lc -> tmp ,lc -> tmp1 ,block_w ,block_h );
482
- }
483
- }else {
484
- fc -> vvcdsp .inter .put [LUMA ][!!my1 ][!!mx1 ](prof_tmp ,src1 ,src1_stride ,AFFINE_MIN_BLOCK_SIZE ,mx1 ,my1 ,AFFINE_MIN_BLOCK_SIZE ,2 ,2 );
485
- fc -> vvcdsp .inter .fetch_samples (prof_tmp ,src1 ,src1_stride ,mx1 ,my1 );
486
- if (weight_flag ) {
487
- fc -> vvcdsp .inter .apply_prof_bi_w (dst ,dst_stride ,lc -> tmp ,prof_tmp ,pu -> diff_mv_x [L1 ],pu -> diff_mv_y [L1 ],
488
- denom ,w0 ,w1 ,o0 ,o1 );
489
- }else {
490
- fc -> vvcdsp .inter .apply_prof_bi (dst ,dst_stride ,lc -> tmp ,prof_tmp ,pu -> diff_mv_x [L1 ],pu -> diff_mv_y [L1 ]);
463
+ fc -> vvcdsp .inter .put [LUMA ][!!my ][!!mx ](prof_tmp ,src ,src_stride ,AFFINE_MIN_BLOCK_SIZE ,mx ,my ,AFFINE_MIN_BLOCK_SIZE ,2 ,2 );
464
+ fc -> vvcdsp .inter .fetch_samples (prof_tmp ,src ,src_stride ,mx ,my );
465
+ fc -> vvcdsp .inter .apply_prof (tmp [i ],prof_tmp ,pu -> diff_mv_x [i ],pu -> diff_mv_y [i ]);
491
466
}
492
467
}
493
468
469
+ if (weight_flag )
470
+ fc -> vvcdsp .inter .w_avg (dst ,dst_stride ,tmp [L0 ],tmp [L1 ],block_w ,block_h ,denom ,w0 ,w1 ,o0 ,o1 );
471
+ else
472
+ fc -> vvcdsp .inter .avg (dst ,dst_stride ,tmp [L0 ],tmp [L1 ],block_w ,block_h );
494
473
}
495
474
496
475
static int pred_get_refs (const VVCLocalContext * lc ,VVCFrame * ref [2 ],const MvField * mv )