gpt4 book ai didi

opencv - Opencv的Opencl代码中的WTV用于图像大小调整

转载 作者:行者123 更新时间:2023-12-02 17:04:26 28 4
gpt4 key购买 nike

WTV在以下Opencl代码中代表什么?
我找不到太多信息。该代码来自Opencv,用于在gpu上进行处理。

__

kernel void resizeAREA(__global const uchar * src, int src_step, int src_offset, int src_rows, int src_cols,
__global uchar * dst, int dst_step, int dst_offset, int dst_rows, int dst_cols,
float ifx, float ify, __global const int * ofs_tab,
__global const int * map_tab, __global const float * alpha_tab)
{
int dx = get_global_id(0);
int dy = get_global_id(1);

if (dx < dst_cols && dy < dst_rows)
{
int dst_index = mad24(dy, dst_step, dst_offset);

__global const int * xmap_tab = map_tab;
__global const int * ymap_tab = (__global const int *)(map_tab + (src_cols << 1));
__global const float * xalpha_tab = alpha_tab;
__global const float * yalpha_tab = (__global const float *)(alpha_tab + (src_cols << 1));
__global const int * xofs_tab = ofs_tab;
__global const int * yofs_tab = (__global const int *)(ofs_tab + dst_cols + 1);

int xk0 = xofs_tab[dx], xk1 = xofs_tab[dx + 1];
int yk0 = yofs_tab[dy], yk1 = yofs_tab[dy + 1];

int sy0 = ymap_tab[yk0], sy1 = ymap_tab[yk1 - 1];
int sx0 = xmap_tab[xk0], sx1 = xmap_tab[xk1 - 1];

WTV sum = (WTV)(0), buf;
int src_index = mad24(sy0, src_step, src_offset);

for (int sy = sy0, yk = yk0; sy <= sy1; ++sy, src_index += src_step, ++yk)
{
WTV beta = (WTV)(yalpha_tab[yk]);
buf = (WTV)(0);

for (int sx = sx0, xk = xk0; sx <= sx1; ++sx, ++xk)
{
WTV alpha = (WTV)(xalpha_tab[xk]);
buf += convertToWTV(loadpix(src + mad24(sx, TSIZE, src_index))) * alpha;
}
sum += buf * beta;
}

storepix(convertToT(sum), dst + mad24(dx, TSIZE, dst_index));
}
}

最佳答案

您共享的源中未定义它。它似乎是一种类型,例如float。只是猜测:它是在编译内核时使用“-D WTV = something”定义的。

关于opencv - Opencv的Opencl代码中的WTV用于图像大小调整,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57213172/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com