Video 无插值核的逐行扫描

Video 无插值核的逐行扫描,video,graphics,opencl,gpgpu,video-processing,Video,Graphics,Opencl,Gpgpu,Video Processing,我正在研究OpenCL内核的一个特定的实时去隔行问题。我有帧(RGB,720*480*3),它们由4个交错场组成。因此,我尝试使用以下等式将解交错到维度(宽度/4)*(高度/4)的原始字段G: G_i=1/4(f(x',y')+f(x'+1,y')+f(x'+2,y')+f(x'+3,y')) 其中i=0,1,2,3 和(x',y')=(4x,4y+i) 因此,生成的场G_i将具有帧像素的1/16,最终我计划单独使用解交错场 这是我到目前为止所取得的成就,但我已经奋斗了相当长的一段时间,我还没有

我正在研究OpenCL内核的一个特定的实时去隔行问题。我有帧(RGB,720*480*3),它们由4个交错场组成。因此,我尝试使用以下等式将解交错到维度(宽度/4)*(高度/4)的原始字段G:

G_i=1/4(f(x',y')+f(x'+1,y')+f(x'+2,y')+f(x'+3,y'))

其中i=0,1,2,3

和(x',y')=(4x,4y+i)

因此,生成的场G_i将具有帧像素的1/16,最终我计划单独使用解交错场

这是我到目前为止所取得的成就,但我已经奋斗了相当长的一段时间,我还没有完全达到目标。有人能帮忙吗?我想我需要一个4英尺宽的跨步才能穿过扁平的框架

对OpenCL程序的调用(在PyOpenCL中): OpenCL内核: 框架:

结果是:

是的,所以我忘了缩小迭代范围

对OpenCL程序的调用应为:

# call limiting the global work space to 1/16th of the frame
# outputting to array of 1/16th the size
    self.program.deinterlace(self.queue, (self.dim[0]/self.n, self.dim[1]/self.n),
                             None,
                             self.frame_buf, self.dest_buf,
                             np.int32(self.dim[1]/self.n),
                             np.int32(self.dim[2]))
    result = np.empty((self.dim[0]/self.n, self.dim[1]/self.n, 3),
                      dtype=np.uint8)
    cl.enqueue_copy(self.queue, result, self.dest_buf).wait()

那么,修好了吗?太好了但是我还是不明白你在做什么。。。。看起来它不是“去交错”,而是不同的东西。
__kernel void deinterlace(

        __global const uchar *a,
        __global uchar *c,
        const int width,
        const int channels
    )
    {
        int rowid = get_global_id(0);
        int colid = get_global_id(1);

        int ncols = width;
        int nchan = channels;

        int index = rowid * 4 * ncols * 4 * nchan + colid * 4 * nchan;
        int newindex = rowid * ncols * nchan + colid * nchan;
        c[newindex + 0] = a[index + 0];
        c[newindex + 1] = a[index + 1];
        c[newindex + 2] = a[index + 2];
    }
# call limiting the global work space to 1/16th of the frame
# outputting to array of 1/16th the size
    self.program.deinterlace(self.queue, (self.dim[0]/self.n, self.dim[1]/self.n),
                             None,
                             self.frame_buf, self.dest_buf,
                             np.int32(self.dim[1]/self.n),
                             np.int32(self.dim[2]))
    result = np.empty((self.dim[0]/self.n, self.dim[1]/self.n, 3),
                      dtype=np.uint8)
    cl.enqueue_copy(self.queue, result, self.dest_buf).wait()