opencl : update upscale to support align corners (#14488)

This commit is contained in:
lhez
2025-07-02 00:07:42 -07:00
committed by GitHub
parent 611ba4b264
commit 603e43dc91
2 changed files with 36 additions and 25 deletions

View File

@@ -60,7 +60,8 @@ kernel void kernel_upscale_bilinear(
float sf0,
float sf1,
float sf2,
float sf3
float sf3,
float pixel_offset
) {
global const char * src_base = (global const char *)p_src0 + off_src0;
global float * dst_base = (global float *)((global char *)p_dst + off_dst);
@@ -80,8 +81,6 @@ kernel void kernel_upscale_bilinear(
int i02_src = (int)(i12_dst / sf2);
int i03_src = (int)(i13_dst / sf3);
const float pixel_offset = 0.5f;
float y_src_f = ((float)i11_dst + pixel_offset) / sf1 - pixel_offset;
long y0_src = (long)floor(y_src_f);
long y1_src = y0_src + 1;