Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit577acde

Browse files
committed
inter: dsp, refact, remove apply_prof_bi and apply_prof_bi_w
1 parent98127f5 commit577acde

File tree

4 files changed

+26
-115
lines changed

4 files changed

+26
-115
lines changed

‎libavcodec/vvc/vvc_ctu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ struct VVCLocalContext {
318318
DECLARE_ALIGNED(32,uint8_t,edge_emu_buffer2)[(MAX_PB_SIZE+7)*EDGE_EMU_BUFFER_STRIDE*2];
319319
DECLARE_ALIGNED(32,int16_t,tmp)[MAX_PB_SIZE*MAX_PB_SIZE];
320320
DECLARE_ALIGNED(32,int16_t,tmp1)[MAX_PB_SIZE*MAX_PB_SIZE];
321+
DECLARE_ALIGNED(32,int16_t,tmp2)[MAX_PB_SIZE*MAX_PB_SIZE];
321322
DECLARE_ALIGNED(32,uint8_t,ciip_tmp1)[MAX_PB_SIZE*MAX_PB_SIZE*2];
322323
DECLARE_ALIGNED(32,uint8_t,ciip_tmp2)[MAX_PB_SIZE*MAX_PB_SIZE*2];
323324
DECLARE_ALIGNED(32,uint8_t,sao_buffer)[(MAX_CTU_SIZE+2*SAO_PADDING_SIZE)*EDGE_EMU_BUFFER_STRIDE*2];

‎libavcodec/vvc/vvc_inter.c

Lines changed: 25 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -440,57 +440,36 @@ static void luma_prof_bi(VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst_
440440
{
441441
constVVCFrameContext*fc=lc->fc;
442442
constPredictionUnit*pu=&lc->cu->pu;
443-
ptrdiff_tsrc0_stride=ref0->linesize[0];
444-
ptrdiff_tsrc1_stride=ref1->linesize[0];
445-
uint16_t*prof_tmp=lc->tmp1+1+MAX_PB_SIZE;
446-
constMv*mv0=mvf->mv+L0;
447-
constMv*mv1=mvf->mv+L1;
448-
constintmx0=mv0->x&0xf;
449-
constintmy0=mv0->y&0xf;
450-
constintmx1=mv1->x&0xf;
451-
constintmy1=mv1->y&0xf;
452-
constintx_off0=x_off+ (mv0->x >>4);
453-
constinty_off0=y_off+ (mv0->y >>4);
454-
constintx_off1=x_off+ (mv1->x >>4);
455-
constinty_off1=y_off+ (mv1->y >>4);
456-
457-
constuint8_t*src0=ref0->data[0]+y_off0*src0_stride+ (int)((unsigned)x_off0 <<fc->ps.sps->pixel_shift);
458-
constuint8_t*src1=ref1->data[0]+y_off1*src1_stride+ (int)((unsigned)x_off1 <<fc->ps.sps->pixel_shift);
459-
443+
constAVFrame*ref[]= {ref0,ref1 };
444+
int16_t*tmp[]= {lc->tmp,lc->tmp1 };
445+
uint16_t*prof_tmp=lc->tmp2+1+MAX_PB_SIZE;
460446
intdenom,w0,w1,o0,o1;
461-
constintweight_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+
constintweight_flag=derive_weight(&denom,&w0,&w1,&o0,&o1,lc,mvf,LUMA,0);
448+
449+
for (inti=L0;i <=L1;i++) {
450+
constMv*mv=mvf->mv+i;
451+
constintmx=mv->x&0xf;
452+
constintmy=mv->y&0xf;
453+
constintox=x_off+ (mv->x >>4);
454+
constintoy=y_off+ (mv->y >>4);
455+
ptrdiff_tsrc_stride=ref[i]->linesize[0];
456+
constuint8_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);
480462
}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]);
491466
}
492467
}
493468

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);
494473
}
495474

496475
staticintpred_get_refs(constVVCLocalContext*lc,VVCFrame*ref[2],constMvField*mv)

‎libavcodec/vvc/vvc_inter_template.c

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -805,68 +805,6 @@ static void FUNC(apply_prof_uni_w)(uint8_t *_dst, const ptrdiff_t _dst_stride,
805805
}
806806
}
807807

808-
staticvoidFUNC(apply_prof_bi)(uint8_t*_dst,constptrdiff_t_dst_stride,
809-
constint16_t*src0,constint16_t*src1,constint16_t*diff_mv_x,constint16_t*diff_mv_y)
810-
{
811-
constintlimit= (1 <<FFMAX(13,BIT_DEPTH+1));///< dILimit
812-
constptrdiff_tdst_stride=_dst_stride /sizeof(pixel);
813-
pixel*dst= (pixel*)_dst;
814-
constintshift=14+1-BIT_DEPTH;
815-
#ifBIT_DEPTH<14
816-
constintoffset=1 << (shift-1);
817-
#else
818-
constintoffset=0;
819-
#endif
820-
int16_tgradient_h[AFFINE_MIN_BLOCK_SIZE*AFFINE_MIN_BLOCK_SIZE];
821-
int16_tgradient_v[AFFINE_MIN_BLOCK_SIZE*AFFINE_MIN_BLOCK_SIZE];
822-
823-
FUNC(prof_grad_filter)(gradient_h,gradient_v,AFFINE_MIN_BLOCK_SIZE,src1,MAX_PB_SIZE,AFFINE_MIN_BLOCK_SIZE,AFFINE_MIN_BLOCK_SIZE,0);
824-
825-
for (inty=0;y<AFFINE_MIN_BLOCK_SIZE;y++) {
826-
for (intx=0;x<AFFINE_MIN_BLOCK_SIZE;x++) {
827-
constinto=y*AFFINE_MIN_BLOCK_SIZE+x;
828-
constintdi=gradient_h[o]*diff_mv_x[o]+gradient_v[o]*diff_mv_y[o];
829-
constintval=src1[x]+av_clip(di,-limit,limit-1);
830-
dst[x]=av_clip_pixel((val+src0[x]+offset) >>shift);
831-
832-
}
833-
src0+=MAX_PB_SIZE;
834-
src1+=MAX_PB_SIZE;
835-
dst+=dst_stride;
836-
}
837-
}
838-
839-
staticvoidFUNC(apply_prof_bi_w)(uint8_t*_dst,constptrdiff_t_dst_stride,
840-
constint16_t*src0,constint16_t*src1,constint16_t*diff_mv_x,constint16_t*diff_mv_y,
841-
constintdenom,constintw0,constintw1,constint_o0,int_o1)
842-
{
843-
constintlimit= (1 <<FFMAX(13,BIT_DEPTH+1));///< dILimit
844-
constptrdiff_tdst_stride=_dst_stride /sizeof(pixel);
845-
pixel*dst= (pixel*)_dst;
846-
constinto0=_o0* (1 << (BIT_DEPTH-8));
847-
constinto1=_o1* (1 << (BIT_DEPTH-8));
848-
constintshift=14+1-BIT_DEPTH;
849-
constintlog2Wd=denom+shift-1;
850-
constintoffset= ((o0+o1+1)* (1 <<log2Wd));
851-
int16_tgradient_h[AFFINE_MIN_BLOCK_SIZE*AFFINE_MIN_BLOCK_SIZE];
852-
int16_tgradient_v[AFFINE_MIN_BLOCK_SIZE*AFFINE_MIN_BLOCK_SIZE];
853-
854-
855-
FUNC(prof_grad_filter)(gradient_h,gradient_v,AFFINE_MIN_BLOCK_SIZE,src1,MAX_PB_SIZE,AFFINE_MIN_BLOCK_SIZE,AFFINE_MIN_BLOCK_SIZE,0);
856-
857-
for (inty=0;y<AFFINE_MIN_BLOCK_SIZE;y++) {
858-
for (intx=0;x<AFFINE_MIN_BLOCK_SIZE;x++) {
859-
constinto=y*AFFINE_MIN_BLOCK_SIZE+x;
860-
constintdi=gradient_h[o]*diff_mv_x[o]+gradient_v[o]*diff_mv_y[o];
861-
constintval=src1[x]+av_clip(di,-limit,limit-1);
862-
dst[x]=av_clip_pixel((val*w1+src0[x]*w0+offset) >> (log2Wd+1));
863-
}
864-
src0+=MAX_PB_SIZE;
865-
src1+=MAX_PB_SIZE;
866-
dst+=dst_stride;
867-
}
868-
}
869-
870808
staticvoidFUNC(derive_bdof_vx_vy)(constint16_t*_src0,constint16_t*_src1,
871809
constint16_t**gradient_h,constint16_t**gradient_v,ptrdiff_tgradient_stride,
872810
int*vx,int*vy)
@@ -1088,8 +1026,6 @@ static void FUNC(ff_vvc_inter_dsp_init)(VVCInterDSPContext *const inter)
10881026
inter->apply_prof=FUNC(apply_prof);
10891027
inter->apply_prof_uni=FUNC(apply_prof_uni);
10901028
inter->apply_prof_uni_w=FUNC(apply_prof_uni_w);
1091-
inter->apply_prof_bi=FUNC(apply_prof_bi);
1092-
inter->apply_prof_bi_w=FUNC(apply_prof_bi_w);
10931029
inter->apply_bdof=FUNC(apply_bdof);
10941030
inter->prof_grad_filter=FUNC(prof_grad_filter);
10951031
inter->sad=vvc_sad;

‎libavcodec/vvc/vvcdsp.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,6 @@ typedef struct VVCInterDSPContext {
8585
void (*apply_prof_uni_w)(uint8_t*dst,constptrdiff_tdst_stride,constint16_t*src,
8686
constint16_t*diff_mv_x,constint16_t*diff_mv_y,intdenom,intwx,intox);
8787

88-
void (*apply_prof_bi)(uint8_t*dst,ptrdiff_tdst_stride,constint16_t*src0,constint16_t*src1,
89-
constint16_t*diff_mv_x,constint16_t*diff_mv_y);
90-
void (*apply_prof_bi_w)(uint8_t*dst,ptrdiff_tdst_stride,constint16_t*src0,constint16_t*src1,
91-
constint16_t*diff_mv_x,constint16_t*diff_mv_y,intdenom,intw0,intw1,into0,into1);
92-
9388
void (*apply_bdof)(uint8_t*dst,ptrdiff_tdst_stride,int16_t*src0,int16_t*src1,intblock_w,intblock_h);
9489

9590
int (*sad)(constint16_t*src0,constint16_t*src1,intdx,intdy,intblock_w,intblock_h);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp