From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 621794A551 for ; Wed, 1 May 2024 22:41:21 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9B06868D5F8; Thu, 2 May 2024 01:41:19 +0300 (EEST) Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com [209.85.219.175]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6C90F68D374 for ; Thu, 2 May 2024 01:41:12 +0300 (EEST) Received: by mail-yb1-f175.google.com with SMTP id 3f1490d57ef6-de477949644so8176583276.1 for ; Wed, 01 May 2024 15:41:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714603270; x=1715208070; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ZWuoR9tYWCjixtR2UwtPovFSbk1t23n0Z6HYR4Sn70I=; b=lx0WqAShQnU6f/AtmNJu805hBGO6s81h3qo4JGS/Xq3oPm8X+cJvWSPWVwp8hgI8U9 yahzEK7386hD15ZaYiy1bKUe0PFNQZVXYVNikLhjgociCnx9Ciywam4IOvYZEGGCe0eH m+AQOD0IWr0klXT6QcSgMwUHHvzBssA2P1Vd7nsXq9dWVw4JVB8DhKRCx4z6mdgqFT3J QpwDYIj0hwxME+N8wejNac75t47yvm4XehEkfPVV6T1tie70kIyb2ZmF1JwbuiyxS/nW OtyBipY/4LXrJ/sgBOarr1MxGCju6JFN6bQQCqpK82Jzc/cfmxWV3fdzm5bgygEs6l+u UMkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714603270; x=1715208070; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ZWuoR9tYWCjixtR2UwtPovFSbk1t23n0Z6HYR4Sn70I=; b=KTq5YnP5QTe4NF3dBKp4porkdg4MX3cpqOKdjmF6eNr//jlINN23NAqBAM0ck4vIyX NZfFjky2YPm7mIU1ybJ58zM9/4WkgyksaPGocoNXa5rW9pmrW0J9bcGu6pPtOXRI+zz4 bkZPAC2NqSk7r+TVQTUX/YYZ4pVJU1s4q5a9OmkB7lqtIWtGwnpbMb1VtHB3UwaZDIV0 0fPIdLUC9RXBFBv7GqD5quRhzzqBfeloHIX8pJ2hIFyXrSZK9ucFCSDB856HGYqd1GD8 mX1S5WwtSn50ODSzyXHW49pYQH70sAniRujhP7JaN8M0Rm+ikdKjgpQk8gZm4KCIhAXJ Tn6A== X-Gm-Message-State: AOJu0YyHh/mGnYsvH+ETIHAzM6Yc/HBXvvGK+dMBWG4NAWkZmESZKBxc 64bqJDfX8bPZ//Y/Hn2Pp+TdR49rKeGvJ/CPpLPUTYEvU0gpfCGI7wXNPQ== X-Google-Smtp-Source: AGHT+IFKRdQUTuHPskkSoUzM4DGl0Nrp3CUZSdjux6cQo2TQY5qAONgtOvTXh3GBErCvX/09NiZ8nw== X-Received: by 2002:a05:6902:e09:b0:de6:1057:c856 with SMTP id df9-20020a0569020e0900b00de61057c856mr258022ybb.24.1714603270510; Wed, 01 May 2024 15:41:10 -0700 (PDT) Received: from fedora.tailc94c2.ts.net (209-6-133-125.s1659.c3-0.bkl-cbr1.sbo-bkl.ma.cable.rcncustomer.com. [209.6.133.125]) by smtp.gmail.com with ESMTPSA id a5-20020ac81085000000b00434a165d45asm12633222qtj.38.2024.05.01.15.41.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 15:41:10 -0700 (PDT) From: Stone Chen To: ffmpeg-devel@ffmpeg.org Date: Wed, 1 May 2024 18:39:56 -0400 Message-ID: <20240501224031.109294-2-chen.stonechen@gmail.com> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/3][GSoC 2024] libavcodec/vvc: convert (*sad) to (*sad[6]) to prepare for AVX2 funcs X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Stone Chen Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: To prepare for adding AVX2 functions for different block widths, change VVCInterDSPContext to contain (*sad[6]) instead of (*sad). This also default initializes the pointer array with the scalar function and the calling sites to jump to the correct function based on block width. There's no change in functionality. --- libavcodec/vvc/dsp.h | 2 +- libavcodec/vvc/inter.c | 4 ++-- libavcodec/vvc/inter_template.c | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/libavcodec/vvc/dsp.h b/libavcodec/vvc/dsp.h index 9810ac314c..b06a3ef10e 100644 --- a/libavcodec/vvc/dsp.h +++ b/libavcodec/vvc/dsp.h @@ -86,7 +86,7 @@ typedef struct VVCInterDSPContext { void (*apply_bdof)(uint8_t *dst, ptrdiff_t dst_stride, int16_t *src0, int16_t *src1, int block_w, int block_h); - int (*sad)(const int16_t *src0, const int16_t *src1, int dx, int dy, int block_w, int block_h); + int (*sad[6])(const int16_t *src0, const int16_t *src1, int dx, int dy, int block_w, int block_h); void (*dmvr[2][2])(int16_t *dst, const uint8_t *src, ptrdiff_t src_stride, int height, intptr_t mx, intptr_t my, int width); } VVCInterDSPContext; diff --git a/libavcodec/vvc/inter.c b/libavcodec/vvc/inter.c index 4a8d1d866a..a68f4f9452 100644 --- a/libavcodec/vvc/inter.c +++ b/libavcodec/vvc/inter.c @@ -742,7 +742,7 @@ static void dmvr_mv_refine(VVCLocalContext *lc, MvField *mvf, MvField *orig_mv, fc->vvcdsp.inter.dmvr[!!my][!!mx](tmp[i], src, src_stride, pred_h, mx, my, pred_w); } - min_sad = fc->vvcdsp.inter.sad(tmp[L0], tmp[L1], dx, dy, block_w, block_h); + min_sad = fc->vvcdsp.inter.sad[av_log2(block_w) - 2](tmp[L0], tmp[L1], dx, dy, block_w, block_h); min_sad -= min_sad >> 2; sad[dy][dx] = min_sad; @@ -752,7 +752,7 @@ static void dmvr_mv_refine(VVCLocalContext *lc, MvField *mvf, MvField *orig_mv, for (dy = 0; dy < SAD_ARRAY_SIZE; dy++) { for (dx = 0; dx < SAD_ARRAY_SIZE; dx++) { if (dx != sr_range || dy != sr_range) { - sad[dy][dx] = fc->vvcdsp.inter.sad(lc->tmp, lc->tmp1, dx, dy, block_w, block_h); + sad[dy][dx] = fc->vvcdsp.inter.sad[av_log2(block_w) - 2](lc->tmp, lc->tmp1, dx, dy, block_w, block_h); if (sad[dy][dx] < min_sad) { min_sad = sad[dy][dx]; min_dx = dx; diff --git a/libavcodec/vvc/inter_template.c b/libavcodec/vvc/inter_template.c index e2fbfd4fc0..545e8dd184 100644 --- a/libavcodec/vvc/inter_template.c +++ b/libavcodec/vvc/inter_template.c @@ -458,7 +458,10 @@ static void FUNC(ff_vvc_inter_dsp_init)(VVCInterDSPContext *const inter) inter->apply_prof_uni_w = FUNC(apply_prof_uni_w); inter->apply_bdof = FUNC(apply_bdof); inter->prof_grad_filter = FUNC(prof_grad_filter); - inter->sad = vvc_sad; + + for (int i = 0; i < FF_ARRAY_ELEMS(inter->sad); i++) { + inter->sad[i] = vvc_sad; + } } #undef FUNCS -- 2.44.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".