本文整理汇总了C++中dt_opencl_enqueue_kernel_2d函数的典型用法代码示例。如果您正苦于以下问题:C++ dt_opencl_enqueue_kernel_2d函数的具体用法?C++ dt_opencl_enqueue_kernel_2d怎么用?C++ dt_opencl_enqueue_kernel_2d使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dt_opencl_enqueue_kernel_2d函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: process_cl
int process_cl(struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out,
const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out)
{
dt_iop_highlights_data_t *d = (dt_iop_highlights_data_t *)piece->data;
dt_iop_highlights_global_data_t *gd = (dt_iop_highlights_global_data_t *)self->data;
cl_int err = -999;
const int devid = piece->pipe->devid;
const int width = roi_in->width;
const int height = roi_in->height;
size_t sizes[] = { ROUNDUPWD(width), ROUNDUPHT(height), 1 };
const float clip = d->clip
* fminf(piece->pipe->processed_maximum[0],
fminf(piece->pipe->processed_maximum[1], piece->pipe->processed_maximum[2]));
const int filters = dt_image_filter(&piece->pipe->image);
if(dt_dev_pixelpipe_uses_downsampled_input(piece->pipe) || !filters)
{
dt_opencl_set_kernel_arg(devid, gd->kernel_highlights_4f_clip, 0, sizeof(cl_mem), (void *)&dev_in);
dt_opencl_set_kernel_arg(devid, gd->kernel_highlights_4f_clip, 1, sizeof(cl_mem), (void *)&dev_out);
dt_opencl_set_kernel_arg(devid, gd->kernel_highlights_4f_clip, 2, sizeof(int), (void *)&width);
dt_opencl_set_kernel_arg(devid, gd->kernel_highlights_4f_clip, 3, sizeof(int), (void *)&height);
dt_opencl_set_kernel_arg(devid, gd->kernel_highlights_4f_clip, 4, sizeof(int), (void *)&d->mode);
dt_opencl_set_kernel_arg(devid, gd->kernel_highlights_4f_clip, 5, sizeof(float), (void *)&clip);
err = dt_opencl_enqueue_kernel_2d(devid, gd->kernel_highlights_4f_clip, sizes);
if(err != CL_SUCCESS) goto error;
}
else
{
const int kernel
= (d->mode == DT_IOP_HIGHLIGHTS_LCH) ? gd->kernel_highlights_1f_lch : gd->kernel_highlights_1f_clip;
dt_opencl_set_kernel_arg(devid, kernel, 0, sizeof(cl_mem), (void *)&dev_in);
dt_opencl_set_kernel_arg(devid, kernel, 1, sizeof(cl_mem), (void *)&dev_out);
dt_opencl_set_kernel_arg(devid, kernel, 2, sizeof(int), (void *)&width);
dt_opencl_set_kernel_arg(devid, kernel, 3, sizeof(int), (void *)&height);
dt_opencl_set_kernel_arg(devid, kernel, 4, sizeof(float), (void *)&clip);
dt_opencl_set_kernel_arg(devid, kernel, 5, sizeof(int), (void *)&roi_out->x);
dt_opencl_set_kernel_arg(devid, kernel, 6, sizeof(int), (void *)&roi_out->y);
dt_opencl_set_kernel_arg(devid, kernel, 7, sizeof(int), (void *)&filters);
err = dt_opencl_enqueue_kernel_2d(devid, kernel, sizes);
if(err != CL_SUCCESS) goto error;
}
// update processed maximum
const float m = fmaxf(fmaxf(
piece->pipe->processed_maximum[0],
piece->pipe->processed_maximum[1]),
piece->pipe->processed_maximum[2]);
for(int k=0;k<3;k++) piece->pipe->processed_maximum[k] = m;
return TRUE;
error:
dt_print(DT_DEBUG_OPENCL, "[opencl_highlights] couldn't enqueue kernel! %d\n", err);
return FALSE;
}
开发者ID:CarVac,项目名称:darktable,代码行数:57,代码来源:highlights.c
示例2: process_cl
int
process_cl (struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out, const dt_iop_roi_t *roi_in, const dt_iop_roi_t *roi_out)
{
dt_iop_relight_data_t *data = (dt_iop_relight_data_t *)piece->data;
dt_iop_relight_global_data_t *gd = (dt_iop_relight_global_data_t *)self->data;
cl_int err = -999;
const int devid = piece->pipe->devid;
const int width = roi_in->width;
const int height = roi_in->height;
const float center = data->center;
const float wings = data->width;
const float ev = data->ev;
size_t sizes[] = { ROUNDUPWD(width), ROUNDUPHT(height), 1};
dt_opencl_set_kernel_arg(devid, gd->kernel_relight, 0, sizeof(cl_mem), (void *)&dev_in);
dt_opencl_set_kernel_arg(devid, gd->kernel_relight, 1, sizeof(cl_mem), (void *)&dev_out);
dt_opencl_set_kernel_arg(devid, gd->kernel_relight, 2, sizeof(int), (void *)&width);
dt_opencl_set_kernel_arg(devid, gd->kernel_relight, 3, sizeof(int), (void *)&height);
dt_opencl_set_kernel_arg(devid, gd->kernel_relight, 4, sizeof(float), (void *)¢er);
dt_opencl_set_kernel_arg(devid, gd->kernel_relight, 5, sizeof(float), (void *)&wings);
dt_opencl_set_kernel_arg(devid, gd->kernel_relight, 6, sizeof(float), (void *)&ev);
err = dt_opencl_enqueue_kernel_2d(devid, gd->kernel_relight, sizes);
if(err != CL_SUCCESS) goto error;
return TRUE;
error:
dt_print(DT_DEBUG_OPENCL, "[opencl_relight] couldn't enqueue kernel! %d\n", err);
return FALSE;
}
开发者ID:bleader,项目名称:darktable,代码行数:32,代码来源:relight.c
示例3: process_cl
int process_cl(struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out,
const dt_iop_roi_t *roi_in, const dt_iop_roi_t *roi_out)
{
dt_iop_colorcorrection_data_t *d = (dt_iop_colorcorrection_data_t *)piece->data;
dt_iop_colorcorrection_global_data_t *gd = (dt_iop_colorcorrection_global_data_t *)self->data;
cl_int err = -999;
const int devid = piece->pipe->devid;
const int width = roi_out->width;
const int height = roi_out->height;
size_t sizes[2] = { ROUNDUPWD(width), ROUNDUPHT(height) };
dt_opencl_set_kernel_arg(devid, gd->kernel_colorcorrection, 0, sizeof(cl_mem), &dev_in);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorcorrection, 1, sizeof(cl_mem), &dev_out);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorcorrection, 2, sizeof(int), &width);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorcorrection, 3, sizeof(int), &height);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorcorrection, 4, sizeof(float), &d->saturation);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorcorrection, 5, sizeof(float), &d->a_scale);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorcorrection, 6, sizeof(float), &d->a_base);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorcorrection, 7, sizeof(float), &d->b_scale);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorcorrection, 8, sizeof(float), &d->b_base);
err = dt_opencl_enqueue_kernel_2d(devid, gd->kernel_colorcorrection, sizes);
if(err != CL_SUCCESS) goto error;
return TRUE;
error:
dt_print(DT_DEBUG_OPENCL, "[opencl_colorcorrection] couldn't enqueue kernel! %d\n", err);
return FALSE;
}
开发者ID:Nitrosito,项目名称:darktable,代码行数:31,代码来源:colorcorrection.c
示例4: process_cl
int
process_cl (struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out, const dt_iop_roi_t *roi_in, const dt_iop_roi_t *roi_out)
{
dt_iop_highlights_data_t *d = (dt_iop_highlights_data_t *)piece->data;
dt_iop_highlights_global_data_t *gd = (dt_iop_highlights_global_data_t *)self->data;
cl_int err = -999;
const int devid = piece->pipe->devid;
const int width = roi_in->width;
const int height = roi_in->height;
size_t sizes[] = { ROUNDUPWD(width), ROUNDUPHT(height), 1};
const float clip = d->clip * fminf(piece->pipe->processed_maximum[0], fminf(piece->pipe->processed_maximum[1], piece->pipe->processed_maximum[2]));
dt_opencl_set_kernel_arg(devid, gd->kernel_highlights, 0, sizeof(cl_mem), (void *)&dev_in);
dt_opencl_set_kernel_arg(devid, gd->kernel_highlights, 1, sizeof(cl_mem), (void *)&dev_out);
dt_opencl_set_kernel_arg(devid, gd->kernel_highlights, 2, sizeof(int), (void *)&width);
dt_opencl_set_kernel_arg(devid, gd->kernel_highlights, 3, sizeof(int), (void *)&height);
dt_opencl_set_kernel_arg(devid, gd->kernel_highlights, 4, sizeof(int), (void *)&d->mode);
dt_opencl_set_kernel_arg(devid, gd->kernel_highlights, 5, sizeof(float), (void *)&clip);
dt_opencl_set_kernel_arg(devid, gd->kernel_highlights, 6, sizeof(float), (void *)&d->blendL);
dt_opencl_set_kernel_arg(devid, gd->kernel_highlights, 7, sizeof(float), (void *)&d->blendC);
dt_opencl_set_kernel_arg(devid, gd->kernel_highlights, 8, sizeof(float), (void *)&d->blendh);
err = dt_opencl_enqueue_kernel_2d(devid, gd->kernel_highlights, sizes);
if(err != CL_SUCCESS) goto error;
return TRUE;
error:
dt_print(DT_DEBUG_OPENCL, "[opencl_highlights] couldn't enqueue kernel! %d\n", err);
return FALSE;
}
开发者ID:amitkr,项目名称:darktable,代码行数:30,代码来源:highlights.c
示例5: process_cl
int process_cl(struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out,
const dt_iop_roi_t *roi_in, const dt_iop_roi_t *roi_out)
{
dt_iop_exposure_data_t *d = (dt_iop_exposure_data_t *)piece->data;
dt_iop_exposure_global_data_t *gd = (dt_iop_exposure_global_data_t *)self->data;
commit_params_late(self, piece);
cl_int err = -999;
const float black = d->black;
const float white = exposure2white(d->exposure);
const float scale = 1.0 / (white - black);
const int devid = piece->pipe->devid;
const int width = roi_in->width;
const int height = roi_in->height;
size_t sizes[] = { ROUNDUPWD(width), ROUNDUPHT(height), 1 };
dt_opencl_set_kernel_arg(devid, gd->kernel_exposure, 0, sizeof(cl_mem), (void *)&dev_in);
dt_opencl_set_kernel_arg(devid, gd->kernel_exposure, 1, sizeof(cl_mem), (void *)&dev_out);
dt_opencl_set_kernel_arg(devid, gd->kernel_exposure, 2, sizeof(int), (void *)&width);
dt_opencl_set_kernel_arg(devid, gd->kernel_exposure, 3, sizeof(int), (void *)&height);
dt_opencl_set_kernel_arg(devid, gd->kernel_exposure, 4, sizeof(float), (void *)&black);
dt_opencl_set_kernel_arg(devid, gd->kernel_exposure, 5, sizeof(float), (void *)&scale);
err = dt_opencl_enqueue_kernel_2d(devid, gd->kernel_exposure, sizes);
if(err != CL_SUCCESS) goto error;
for(int k = 0; k < 3; k++) piece->pipe->processed_maximum[k] *= scale;
return TRUE;
error:
dt_print(DT_DEBUG_OPENCL, "[opencl_exposure] couldn't enqueue kernel! %d\n", err);
return FALSE;
}
开发者ID:Acidburn0zzz,项目名称:darktable,代码行数:33,代码来源:exposure.c
示例6: process_cl
int
process_cl (struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out, const dt_iop_roi_t *roi_in, const dt_iop_roi_t *roi_out)
{
dt_iop_colorcontrast_data_t *data = (dt_iop_colorcontrast_data_t *)piece->data;
dt_iop_colorcontrast_global_data_t *gd = (dt_iop_colorcontrast_global_data_t *)self->data;
cl_int err = -999;
const int devid = piece->pipe->devid;
const int width = roi_in->width;
const int height = roi_in->height;
float scale[4] = { 1.0f, data->a_steepness, data->b_steepness, 1.0f };
float offset[4] = { 0.0f, data->a_offset, data->b_offset, 0.0f };
size_t sizes[] = { ROUNDUPWD(width), ROUNDUPHT(height), 1};
dt_opencl_set_kernel_arg(devid, gd->kernel_colorcontrast, 0, sizeof(cl_mem), (void *)&dev_in);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorcontrast, 1, sizeof(cl_mem), (void *)&dev_out);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorcontrast, 2, sizeof(int), (void *)&width);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorcontrast, 3, sizeof(int), (void *)&height);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorcontrast, 4, 4*sizeof(float), (void *)&scale);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorcontrast, 5, 4*sizeof(float), (void *)&offset);
err = dt_opencl_enqueue_kernel_2d(devid, gd->kernel_colorcontrast, sizes);
if(err != CL_SUCCESS) goto error;
return TRUE;
error:
dt_print(DT_DEBUG_OPENCL, "[opencl_colorcontrast] couldn't enqueue kernel! %d\n", err);
return FALSE;
}
开发者ID:gthb,项目名称:darktable,代码行数:31,代码来源:colorcontrast.c
示例7: process_cl
int process_cl(struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out,
const dt_iop_roi_t *roi_in, const dt_iop_roi_t *roi_out)
{
dt_iop_colisa_data_t *d = (dt_iop_colisa_data_t *)piece->data;
dt_iop_colisa_global_data_t *gd = (dt_iop_colisa_global_data_t *)self->data;
cl_int err = -999;
const int devid = piece->pipe->devid;
const int width = roi_in->width;
const int height = roi_in->height;
const float saturation = d->saturation;
cl_mem dev_cm = NULL;
cl_mem dev_ccoeffs = NULL;
cl_mem dev_lm = NULL;
cl_mem dev_lcoeffs = NULL;
dev_cm = dt_opencl_copy_host_to_device(devid, d->ctable, 256, 256, sizeof(float));
if(dev_cm == NULL) goto error;
dev_ccoeffs = dt_opencl_copy_host_to_device_constant(devid, sizeof(float) * 3, d->cunbounded_coeffs);
if(dev_ccoeffs == NULL) goto error;
dev_lm = dt_opencl_copy_host_to_device(devid, d->ltable, 256, 256, sizeof(float));
if(dev_lm == NULL) goto error;
dev_lcoeffs = dt_opencl_copy_host_to_device_constant(devid, sizeof(float) * 3, d->lunbounded_coeffs);
if(dev_lcoeffs == NULL) goto error;
size_t sizes[3];
sizes[0] = ROUNDUPWD(width);
sizes[1] = ROUNDUPWD(height);
sizes[2] = 1;
dt_opencl_set_kernel_arg(devid, gd->kernel_colisa, 0, sizeof(cl_mem), (void *)&dev_in);
dt_opencl_set_kernel_arg(devid, gd->kernel_colisa, 1, sizeof(cl_mem), (void *)&dev_out);
dt_opencl_set_kernel_arg(devid, gd->kernel_colisa, 2, sizeof(int), (void *)&width);
dt_opencl_set_kernel_arg(devid, gd->kernel_colisa, 3, sizeof(int), (void *)&height);
dt_opencl_set_kernel_arg(devid, gd->kernel_colisa, 4, sizeof(float), (void *)&saturation);
dt_opencl_set_kernel_arg(devid, gd->kernel_colisa, 5, sizeof(cl_mem), (void *)&dev_cm);
dt_opencl_set_kernel_arg(devid, gd->kernel_colisa, 6, sizeof(cl_mem), (void *)&dev_ccoeffs);
dt_opencl_set_kernel_arg(devid, gd->kernel_colisa, 7, sizeof(cl_mem), (void *)&dev_lm);
dt_opencl_set_kernel_arg(devid, gd->kernel_colisa, 8, sizeof(cl_mem), (void *)&dev_lcoeffs);
err = dt_opencl_enqueue_kernel_2d(devid, gd->kernel_colisa, sizes);
if(err != CL_SUCCESS) goto error;
if(dev_lcoeffs != NULL) dt_opencl_release_mem_object(dev_lcoeffs);
if(dev_lm != NULL) dt_opencl_release_mem_object(dev_lm);
if(dev_ccoeffs != NULL) dt_opencl_release_mem_object(dev_ccoeffs);
if(dev_cm != NULL) dt_opencl_release_mem_object(dev_cm);
return TRUE;
error:
if(dev_lcoeffs != NULL) dt_opencl_release_mem_object(dev_lcoeffs);
if(dev_lm != NULL) dt_opencl_release_mem_object(dev_lm);
if(dev_ccoeffs != NULL) dt_opencl_release_mem_object(dev_ccoeffs);
if(dev_cm != NULL) dt_opencl_release_mem_object(dev_cm);
dt_print(DT_DEBUG_OPENCL, "[opencl_colisa] couldn't enqueue kernel! %d\n", err);
return FALSE;
}
开发者ID:boucman,项目名称:darktable,代码行数:59,代码来源:colisa.c
示例8: process_cl
int
process_cl (struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out, const dt_iop_roi_t *roi_in, const dt_iop_roi_t *roi_out)
{
dt_iop_highlights_data_t *d = (dt_iop_highlights_data_t *)piece->data;
dt_iop_highlights_global_data_t *gd = (dt_iop_highlights_global_data_t *)self->data;
cl_int err = -999;
const int devid = piece->pipe->devid;
const int width = roi_in->width;
const int height = roi_in->height;
size_t sizes[] = { ROUNDUPWD(width), ROUNDUPHT(height), 1};
const float clip = d->clip * fminf(piece->pipe->processed_maximum[0], fminf(piece->pipe->processed_maximum[1], piece->pipe->processed_maximum[2]));
const int filters = dt_image_flipped_filter(&piece->pipe->image);
if(piece->pipe->type == DT_DEV_PIXELPIPE_PREVIEW || !filters)
{
dt_opencl_set_kernel_arg(devid, gd->kernel_highlights_4f, 0, sizeof(cl_mem), (void *)&dev_in);
dt_opencl_set_kernel_arg(devid, gd->kernel_highlights_4f, 1, sizeof(cl_mem), (void *)&dev_out);
dt_opencl_set_kernel_arg(devid, gd->kernel_highlights_4f, 2, sizeof(int), (void *)&width);
dt_opencl_set_kernel_arg(devid, gd->kernel_highlights_4f, 3, sizeof(int), (void *)&height);
dt_opencl_set_kernel_arg(devid, gd->kernel_highlights_4f, 4, sizeof(int), (void *)&d->mode);
dt_opencl_set_kernel_arg(devid, gd->kernel_highlights_4f, 5, sizeof(float), (void *)&clip);
err = dt_opencl_enqueue_kernel_2d(devid, gd->kernel_highlights_4f, sizes);
if(err != CL_SUCCESS) goto error;
}
else
{
dt_opencl_set_kernel_arg(devid, gd->kernel_highlights_1f, 0, sizeof(cl_mem), (void *)&dev_in);
dt_opencl_set_kernel_arg(devid, gd->kernel_highlights_1f, 1, sizeof(cl_mem), (void *)&dev_out);
dt_opencl_set_kernel_arg(devid, gd->kernel_highlights_1f, 2, sizeof(int), (void *)&width);
dt_opencl_set_kernel_arg(devid, gd->kernel_highlights_1f, 3, sizeof(int), (void *)&height);
dt_opencl_set_kernel_arg(devid, gd->kernel_highlights_1f, 4, sizeof(int), (void *)&d->mode);
dt_opencl_set_kernel_arg(devid, gd->kernel_highlights_1f, 5, sizeof(float), (void *)&clip);
dt_opencl_set_kernel_arg(devid, gd->kernel_highlights_1f, 6, sizeof(int), (void *)&roi_out->x);
dt_opencl_set_kernel_arg(devid, gd->kernel_highlights_1f, 7, sizeof(int), (void *)&roi_out->y);
dt_opencl_set_kernel_arg(devid, gd->kernel_highlights_1f, 8, sizeof(int), (void *)&filters);
err = dt_opencl_enqueue_kernel_2d(devid, gd->kernel_highlights_1f, sizes);
if(err != CL_SUCCESS) goto error;
}
return TRUE;
error:
dt_print(DT_DEBUG_OPENCL, "[opencl_highlights] couldn't enqueue kernel! %d\n", err);
return FALSE;
}
开发者ID:gthb,项目名称:darktable,代码行数:45,代码来源:highlights.c
示例9: process_cl
int
process_cl (struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out, const dt_iop_roi_t *roi_in, const dt_iop_roi_t *roi_out)
{
dt_iop_temperature_data_t *d = (dt_iop_temperature_data_t *)piece->data;
dt_iop_temperature_global_data_t *gd = (dt_iop_temperature_global_data_t *)self->data;
const int devid = piece->pipe->devid;
const int filters = dt_image_flipped_filter(&piece->pipe->image);
float coeffs[3] = {d->coeffs[0], d->coeffs[1], d->coeffs[2]};
cl_mem dev_coeffs = NULL;
cl_int err = -999;
int kernel = -1;
if(!dt_dev_pixelpipe_uses_downsampled_input(piece->pipe) && filters && piece->pipe->image.bpp != 4)
{
kernel = gd->kernel_whitebalance_1ui;
for(int k=0; k<3; k++) coeffs[k] /= 65535.0f;
}
else if(!dt_dev_pixelpipe_uses_downsampled_input(piece->pipe) && filters && piece->pipe->image.bpp == 4)
{
kernel = gd->kernel_whitebalance_1f;
}
else
{
kernel = gd->kernel_whitebalance_4f;
}
dev_coeffs = dt_opencl_copy_host_to_device_constant(devid, sizeof(float)*3, coeffs);
if (dev_coeffs == NULL) goto error;
const int width = roi_in->width;
const int height = roi_in->height;
size_t sizes[] = { ROUNDUPWD(width), ROUNDUPHT(height), 1};
dt_opencl_set_kernel_arg(devid, kernel, 0, sizeof(cl_mem), (void *)&dev_in);
dt_opencl_set_kernel_arg(devid, kernel, 1, sizeof(cl_mem), (void *)&dev_out);
dt_opencl_set_kernel_arg(devid, kernel, 2, sizeof(int), (void *)&width);
dt_opencl_set_kernel_arg(devid, kernel, 3, sizeof(int), (void *)&height);
dt_opencl_set_kernel_arg(devid, kernel, 4, sizeof(cl_mem), (void *)&dev_coeffs);
dt_opencl_set_kernel_arg(devid, kernel, 5, sizeof(uint32_t), (void *)&filters);
dt_opencl_set_kernel_arg(devid, kernel, 6, sizeof(uint32_t), (void *)&roi_out->x);
dt_opencl_set_kernel_arg(devid, kernel, 7, sizeof(uint32_t), (void *)&roi_out->y);
err = dt_opencl_enqueue_kernel_2d(devid, kernel, sizes);
if(err != CL_SUCCESS) goto error;
dt_opencl_release_mem_object(dev_coeffs);
for(int k=0; k<3; k++)
piece->pipe->processed_maximum[k] = d->coeffs[k] * piece->pipe->processed_maximum[k];
return TRUE;
error:
if (dev_coeffs != NULL) dt_opencl_release_mem_object(dev_coeffs);
dt_print(DT_DEBUG_OPENCL, "[opencl_white_balance] couldn't enqueue kernel! %d\n", err);
return FALSE;
}
开发者ID:rharrison10,项目名称:darktable,代码行数:55,代码来源:temperature.c
示例10: process_cl
int process_cl(struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out,
const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out)
{
dt_iop_zonesystem_data_t *data = (dt_iop_zonesystem_data_t *)piece->data;
dt_iop_zonesystem_global_data_t *gd = (dt_iop_zonesystem_global_data_t *)self->data;
cl_mem dev_zmo, dev_zms = NULL;
cl_int err = -999;
const int devid = piece->pipe->devid;
const int width = roi_in->width;
const int height = roi_in->height;
/* calculate zonemap */
const int size = data->params.size;
float zonemap[MAX_ZONE_SYSTEM_SIZE] = { -1 };
float zonemap_offset[ROUNDUP(MAX_ZONE_SYSTEM_SIZE, 16)] = { -1 };
float zonemap_scale[ROUNDUP(MAX_ZONE_SYSTEM_SIZE, 16)] = { -1 };
_iop_zonesystem_calculate_zonemap(&(data->params), zonemap);
/* precompute scale and offset */
for(int k = 0; k < size - 1; k++) zonemap_scale[k] = (zonemap[k + 1] - zonemap[k]) * (size - 1);
for(int k = 0; k < size - 1; k++) zonemap_offset[k] = 100.0f * ((k + 1) * zonemap[k] - k * zonemap[k + 1]);
dev_zmo = dt_opencl_copy_host_to_device_constant(devid, sizeof(float) * ROUNDUP(MAX_ZONE_SYSTEM_SIZE, 16),
zonemap_offset);
if(dev_zmo == NULL) goto error;
dev_zms = dt_opencl_copy_host_to_device_constant(devid, sizeof(float) * ROUNDUP(MAX_ZONE_SYSTEM_SIZE, 16),
zonemap_scale);
if(dev_zms == NULL) goto error;
size_t sizes[] = { ROUNDUPWD(width), ROUNDUPHT(height), 1 };
dt_opencl_set_kernel_arg(devid, gd->kernel_zonesystem, 0, sizeof(cl_mem), (void *)&dev_in);
dt_opencl_set_kernel_arg(devid, gd->kernel_zonesystem, 1, sizeof(cl_mem), (void *)&dev_out);
dt_opencl_set_kernel_arg(devid, gd->kernel_zonesystem, 2, sizeof(int), (void *)&width);
dt_opencl_set_kernel_arg(devid, gd->kernel_zonesystem, 3, sizeof(int), (void *)&height);
dt_opencl_set_kernel_arg(devid, gd->kernel_zonesystem, 4, sizeof(int), (void *)&size);
dt_opencl_set_kernel_arg(devid, gd->kernel_zonesystem, 5, sizeof(cl_mem), (void *)&dev_zmo);
dt_opencl_set_kernel_arg(devid, gd->kernel_zonesystem, 6, sizeof(cl_mem), (void *)&dev_zms);
err = dt_opencl_enqueue_kernel_2d(devid, gd->kernel_zonesystem, sizes);
if(err != CL_SUCCESS) goto error;
dt_opencl_release_mem_object(dev_zmo);
dt_opencl_release_mem_object(dev_zms);
return TRUE;
error:
if(dev_zmo != NULL) dt_opencl_release_mem_object(dev_zmo);
if(dev_zms != NULL) dt_opencl_release_mem_object(dev_zms);
dt_print(DT_DEBUG_OPENCL, "[opencl_zonesystem] couldn't enqueue kernel! %d\n", err);
return FALSE;
}
开发者ID:AdamMajer,项目名称:darktable,代码行数:53,代码来源:zonesystem.c
示例11: process_cl
int process_cl(struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out,
const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out)
{
dt_iop_invert_data_t *d = (dt_iop_invert_data_t *)piece->data;
dt_iop_invert_global_data_t *gd = (dt_iop_invert_global_data_t *)self->data;
const int devid = piece->pipe->devid;
const uint32_t filters = piece->pipe->dsc.filters;
cl_mem dev_color = NULL;
cl_int err = -999;
int kernel = -1;
float film_rgb_f[4] = { d->color[0], d->color[1], d->color[2], d->color[3] };
if(filters)
{
kernel = gd->kernel_invert_1f;
const float *const m = piece->pipe->dsc.processed_maximum;
for(int c = 0; c < 4; c++) film_rgb_f[c] *= m[c];
}
else
{
kernel = gd->kernel_invert_4f;
}
dev_color = dt_opencl_copy_host_to_device_constant(devid, sizeof(float) * 3, film_rgb_f);
if(dev_color == NULL) goto error;
const int width = roi_in->width;
const int height = roi_in->height;
size_t sizes[] = { ROUNDUPWD(width), ROUNDUPHT(height), 1 };
dt_opencl_set_kernel_arg(devid, kernel, 0, sizeof(cl_mem), (void *)&dev_in);
dt_opencl_set_kernel_arg(devid, kernel, 1, sizeof(cl_mem), (void *)&dev_out);
dt_opencl_set_kernel_arg(devid, kernel, 2, sizeof(int), (void *)&width);
dt_opencl_set_kernel_arg(devid, kernel, 3, sizeof(int), (void *)&height);
dt_opencl_set_kernel_arg(devid, kernel, 4, sizeof(cl_mem), (void *)&dev_color);
dt_opencl_set_kernel_arg(devid, kernel, 5, sizeof(uint32_t), (void *)&filters);
dt_opencl_set_kernel_arg(devid, kernel, 6, sizeof(uint32_t), (void *)&roi_out->x);
dt_opencl_set_kernel_arg(devid, kernel, 7, sizeof(uint32_t), (void *)&roi_out->y);
err = dt_opencl_enqueue_kernel_2d(devid, kernel, sizes);
if(err != CL_SUCCESS) goto error;
dt_opencl_release_mem_object(dev_color);
for(int k = 0; k < 4; k++) piece->pipe->dsc.processed_maximum[k] = 1.0f;
return TRUE;
error:
dt_opencl_release_mem_object(dev_color);
dt_print(DT_DEBUG_OPENCL, "[opencl_invert] couldn't enqueue kernel! %d\n", err);
return FALSE;
}
开发者ID:dtorop,项目名称:darktable,代码行数:53,代码来源:invert.c
示例12: process_cl
int process_cl(struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out,
const dt_iop_roi_t *roi_in, const dt_iop_roi_t *roi_out)
{
dt_iop_colorout_data_t *d = (dt_iop_colorout_data_t *)piece->data;
dt_iop_colorout_global_data_t *gd = (dt_iop_colorout_global_data_t *)self->data;
cl_mem dev_m = NULL, dev_r = NULL, dev_g = NULL, dev_b = NULL, dev_coeffs = NULL;
cl_int err = -999;
const int devid = piece->pipe->devid;
const int width = roi_in->width;
const int height = roi_in->height;
size_t sizes[] = { ROUNDUPWD(width), ROUNDUPHT(height), 1 };
dev_m = dt_opencl_copy_host_to_device_constant(devid, sizeof(float) * 9, d->cmatrix);
if(dev_m == NULL) goto error;
dev_r = dt_opencl_copy_host_to_device(devid, d->lut[0], 256, 256, sizeof(float));
if(dev_r == NULL) goto error;
dev_g = dt_opencl_copy_host_to_device(devid, d->lut[1], 256, 256, sizeof(float));
if(dev_g == NULL) goto error;
dev_b = dt_opencl_copy_host_to_device(devid, d->lut[2], 256, 256, sizeof(float));
if(dev_b == NULL) goto error;
dev_coeffs
= dt_opencl_copy_host_to_device_constant(devid, sizeof(float) * 3 * 3, (float *)d->unbounded_coeffs);
if(dev_coeffs == NULL) goto error;
dt_opencl_set_kernel_arg(devid, gd->kernel_colorout, 0, sizeof(cl_mem), (void *)&dev_in);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorout, 1, sizeof(cl_mem), (void *)&dev_out);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorout, 2, sizeof(int), (void *)&width);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorout, 3, sizeof(int), (void *)&height);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorout, 4, sizeof(cl_mem), (void *)&dev_m);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorout, 5, sizeof(cl_mem), (void *)&dev_r);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorout, 6, sizeof(cl_mem), (void *)&dev_g);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorout, 7, sizeof(cl_mem), (void *)&dev_b);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorout, 8, sizeof(cl_mem), (void *)&dev_coeffs);
err = dt_opencl_enqueue_kernel_2d(devid, gd->kernel_colorout, sizes);
if(err != CL_SUCCESS) goto error;
dt_opencl_release_mem_object(dev_m);
dt_opencl_release_mem_object(dev_r);
dt_opencl_release_mem_object(dev_g);
dt_opencl_release_mem_object(dev_b);
dt_opencl_release_mem_object(dev_coeffs);
return TRUE;
error:
if(dev_m != NULL) dt_opencl_release_mem_object(dev_m);
if(dev_r != NULL) dt_opencl_release_mem_object(dev_r);
if(dev_g != NULL) dt_opencl_release_mem_object(dev_g);
if(dev_b != NULL) dt_opencl_release_mem_object(dev_b);
if(dev_coeffs != NULL) dt_opencl_release_mem_object(dev_coeffs);
dt_print(DT_DEBUG_OPENCL, "[opencl_colorout] couldn't enqueue kernel! %d\n", err);
return FALSE;
}
开发者ID:dirkbr,项目名称:darktable,代码行数:52,代码来源:colorout.c
示例13: process_cl
int
process_cl (struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out, const dt_iop_roi_t *roi_in, const dt_iop_roi_t *roi_out)
{
dt_iop_tonecurve_data_t *d = (dt_iop_tonecurve_data_t *)piece->data;
dt_iop_tonecurve_global_data_t *gd = (dt_iop_tonecurve_global_data_t *)self->data;
cl_mem dev_L, dev_a, dev_b = NULL;
cl_mem dev_coeffs = NULL;
cl_int err = -999;
const int devid = piece->pipe->devid;
const int width = roi_in->width;
const int height = roi_in->height;
const int autoscale_ab = d->autoscale_ab;
size_t sizes[] = { ROUNDUPWD(width), ROUNDUPHT(height), 1};
dev_L = dt_opencl_copy_host_to_device(devid, d->table[ch_L], 256, 256, sizeof(float));
dev_a = dt_opencl_copy_host_to_device(devid, d->table[ch_a], 256, 256, sizeof(float));
dev_b = dt_opencl_copy_host_to_device(devid, d->table[ch_b], 256, 256, sizeof(float));
if (dev_L == NULL || dev_a == NULL || dev_b == NULL) goto error;
dev_coeffs = dt_opencl_copy_host_to_device_constant(devid, sizeof(float)*3, d->unbounded_coeffs);
if (dev_coeffs == NULL) goto error;
dt_opencl_set_kernel_arg(devid, gd->kernel_tonecurve, 0, sizeof(cl_mem), (void *)&dev_in);
dt_opencl_set_kernel_arg(devid, gd->kernel_tonecurve, 1, sizeof(cl_mem), (void *)&dev_out);
dt_opencl_set_kernel_arg(devid, gd->kernel_tonecurve, 2, sizeof(int), (void *)&width);
dt_opencl_set_kernel_arg(devid, gd->kernel_tonecurve, 3, sizeof(int), (void *)&height);
dt_opencl_set_kernel_arg(devid, gd->kernel_tonecurve, 4, sizeof(cl_mem), (void *)&dev_L);
dt_opencl_set_kernel_arg(devid, gd->kernel_tonecurve, 5, sizeof(cl_mem), (void *)&dev_a);
dt_opencl_set_kernel_arg(devid, gd->kernel_tonecurve, 6, sizeof(cl_mem), (void *)&dev_b);
dt_opencl_set_kernel_arg(devid, gd->kernel_tonecurve, 7, sizeof(int), (void *)&autoscale_ab);
dt_opencl_set_kernel_arg(devid, gd->kernel_tonecurve, 8, sizeof(cl_mem), (void *)&dev_coeffs);
err = dt_opencl_enqueue_kernel_2d(devid, gd->kernel_tonecurve, sizes);
if(err != CL_SUCCESS) goto error;
dt_opencl_release_mem_object(dev_L);
dt_opencl_release_mem_object(dev_a);
dt_opencl_release_mem_object(dev_b);
dt_opencl_release_mem_object(dev_coeffs);
return TRUE;
error:
if (dev_L != NULL) dt_opencl_release_mem_object(dev_L);
if (dev_a != NULL) dt_opencl_release_mem_object(dev_a);
if (dev_b != NULL) dt_opencl_release_mem_object(dev_b);
if (dev_coeffs != NULL) dt_opencl_release_mem_object(dev_coeffs);
dt_print(DT_DEBUG_OPENCL, "[opencl_tonecurve] couldn't enqueue kernel! %d\n", err);
return FALSE;
}
开发者ID:rikles,项目名称:darktable,代码行数:48,代码来源:tonecurve.c
示例14: process_cl
int
process_cl (struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out, const dt_iop_roi_t *roi_in, const dt_iop_roi_t *roi_out)
{
dt_iop_colorize_data_t *data = (dt_iop_colorize_data_t *)piece->data;
dt_iop_colorize_global_data_t *gd = (dt_iop_colorize_global_data_t *)self->data;
cl_int err = -999;
const int devid = piece->pipe->devid;
const int width = roi_in->width;
const int height = roi_in->height;
/* create Lab */
float rgb[3]={0}, XYZ[3]={0}, Lab[3]={0};
hsl2rgb(rgb,data->hue, data->saturation, data->lightness/100.0);
XYZ[0] = (rgb[0] * 0.5767309) + (rgb[1] * 0.1855540) + (rgb[2] * 0.1881852);
XYZ[1] = (rgb[0] * 0.2973769) + (rgb[1] * 0.6273491) + (rgb[2] * 0.0752741);
XYZ[2] = (rgb[0] * 0.0270343) + (rgb[1] * 0.0706872) + (rgb[2] * 0.9911085);
dt_XYZ_to_Lab(XYZ,Lab);
/* a/b components */
const float L = Lab[0];
const float a = Lab[1];
const float b = Lab[2];
const float mix = data->source_lightness_mix/100.0f;
size_t sizes[] = { ROUNDUPWD(width), ROUNDUPHT(height), 1};
dt_opencl_set_kernel_arg(devid, gd->kernel_colorize, 0, sizeof(cl_mem), (void *)&dev_in);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorize, 1, sizeof(cl_mem), (void *)&dev_out);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorize, 2, sizeof(int), (void *)&width);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorize, 3, sizeof(int), (void *)&height);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorize, 4, sizeof(float), (void *)&mix);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorize, 5, sizeof(float), (void *)&L);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorize, 6, sizeof(float), (void *)&a);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorize, 7, sizeof(float), (void *)&b);
err = dt_opencl_enqueue_kernel_2d(devid, gd->kernel_colorize, sizes);
if(err != CL_SUCCESS) goto error;
return TRUE;
error:
dt_print(DT_DEBUG_OPENCL, "[opencl_colorize] couldn't enqueue kernel! %d\n", err);
return FALSE;
}
开发者ID:bgK,项目名称:darktable,代码行数:46,代码来源:colorize.c
示例15: process_cl
int
process_cl (struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out, const dt_iop_roi_t *roi_in, const dt_iop_roi_t *roi_out)
{
dt_develop_t *dev = self->dev;
dt_iop_overexposed_global_data_t *gd = (dt_iop_overexposed_global_data_t *)self->data;
cl_int err = -999;
const int devid = piece->pipe->devid;
const int width = roi_out->width;
const int height = roi_out->height;
const float lower = dev->overexposed.lower / 100.0f;
const float upper = dev->overexposed.upper / 100.0f;
const int colorscheme = dev->overexposed.colorscheme;
const float *upper_color = dt_iop_overexposed_colors[colorscheme][0];
const float *lower_color = dt_iop_overexposed_colors[colorscheme][1];
if(!dev->overexposed.enabled || !dev->gui_attached)
{
size_t origin[] = { 0, 0, 0};
size_t region[] = { width, height, 1};
err = dt_opencl_enqueue_copy_image(devid, dev_in, dev_out, origin, origin, region);
if (err != CL_SUCCESS) goto error;
return TRUE;
}
size_t sizes[2] = { ROUNDUPWD(width), ROUNDUPHT(height) };
dt_opencl_set_kernel_arg(devid, gd->kernel_overexposed, 0, sizeof(cl_mem), &dev_in);
dt_opencl_set_kernel_arg(devid, gd->kernel_overexposed, 1, sizeof(cl_mem), &dev_out);
dt_opencl_set_kernel_arg(devid, gd->kernel_overexposed, 2, sizeof(int), &width);
dt_opencl_set_kernel_arg(devid, gd->kernel_overexposed, 3, sizeof(int), &height);
dt_opencl_set_kernel_arg(devid, gd->kernel_overexposed, 4, sizeof(float), &lower);
dt_opencl_set_kernel_arg(devid, gd->kernel_overexposed, 5, sizeof(float), &upper);
dt_opencl_set_kernel_arg(devid, gd->kernel_overexposed, 6, 4*sizeof(float), lower_color);
dt_opencl_set_kernel_arg(devid, gd->kernel_overexposed, 7, 4*sizeof(float), upper_color);
err = dt_opencl_enqueue_kernel_2d(devid, gd->kernel_overexposed, sizes);
if(err != CL_SUCCESS) goto error;
return TRUE;
error:
dt_print(DT_DEBUG_OPENCL, "[opencl_overexposed] couldn't enqueue kernel! %d\n", err);
return FALSE;
}
开发者ID:PolarFox,项目名称:darktable,代码行数:45,代码来源:overexposed.c
示例16: process_cl
int process_cl(struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out,
const dt_iop_roi_t *roi_in, const dt_iop_roi_t *roi_out)
{
dt_iop_colorbalance_data_t *d = (dt_iop_colorbalance_data_t *)piece->data;
dt_iop_colorbalance_global_data_t *gd = (dt_iop_colorbalance_global_data_t *)self->data;
cl_int err = -999;
const int devid = piece->pipe->devid;
const int width = roi_in->width;
const int height = roi_in->height;
const float lift[4] = { 2.0f - (d->lift[CHANNEL_RED] * d->lift[CHANNEL_FACTOR]),
2.0f - (d->lift[CHANNEL_GREEN] * d->lift[CHANNEL_FACTOR]),
2.0f - (d->lift[CHANNEL_BLUE] * d->lift[CHANNEL_FACTOR]), 0.0f },
gamma[4] = { d->gamma[CHANNEL_RED] * d->gamma[CHANNEL_FACTOR],
d->gamma[CHANNEL_GREEN] * d->gamma[CHANNEL_FACTOR],
d->gamma[CHANNEL_BLUE] * d->gamma[CHANNEL_FACTOR], 0.0f },
gamma_inv[4] = { (gamma[0] != 0.0f) ? 1.0f / gamma[0] : 1000000.0f,
(gamma[1] != 0.0f) ? 1.0f / gamma[1] : 1000000.0f,
(gamma[2] != 0.0f) ? 1.0f / gamma[2] : 1000000.0f, 0.0f },
gain[4] = { d->gain[CHANNEL_RED] * d->gain[CHANNEL_FACTOR],
d->gain[CHANNEL_GREEN] * d->gain[CHANNEL_FACTOR],
d->gain[CHANNEL_BLUE] * d->gain[CHANNEL_FACTOR], 0.0f };
size_t sizes[] = { ROUNDUPWD(width), ROUNDUPHT(height), 1 };
dt_opencl_set_kernel_arg(devid, gd->kernel_colorbalance, 0, sizeof(cl_mem), (void *)&dev_in);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorbalance, 1, sizeof(cl_mem), (void *)&dev_out);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorbalance, 2, sizeof(int), (void *)&width);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorbalance, 3, sizeof(int), (void *)&height);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorbalance, 4, 4 * sizeof(float), (void *)&lift);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorbalance, 5, 4 * sizeof(float), (void *)&gain);
dt_opencl_set_kernel_arg(devid, gd->kernel_colorbalance, 6, 4 * sizeof(float), (void *)&gamma_inv);
err = dt_opencl_enqueue_kernel_2d(devid, gd->kernel_colorbalance, sizes);
if(err != CL_SUCCESS) goto error;
return TRUE;
error:
dt_print(DT_DEBUG_OPENCL, "[opencl_colorbalance] couldn't enqueue kernel! %d\n", err);
return FALSE;
}
开发者ID:boucman,项目名称:darktable,代码行数:42,代码来源:colorbalance.c
示例17: process_cl
int process_cl(dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out,
const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out)
{
dt_iop_levels_data_t *d = (dt_iop_levels_data_t *)piece->data;
dt_iop_levels_global_data_t *gd = (dt_iop_levels_global_data_t *)self->data;
if(d->mode == LEVELS_MODE_AUTOMATIC)
{
commit_params_late(self, piece);
}
cl_mem dev_lut = NULL;
cl_int err = -999;
const int devid = piece->pipe->devid;
const int width = roi_out->width;
const int height = roi_out->height;
dev_lut = dt_opencl_copy_host_to_device(devid, d->lut, 256, 256, sizeof(float));
if(dev_lut == NULL) goto error;
size_t sizes[2] = { ROUNDUPWD(width), ROUNDUPHT(height) };
dt_opencl_set_kernel_arg(devid, gd->kernel_levels, 0, sizeof(cl_mem), &dev_in);
dt_opencl_set_kernel_arg(devid, gd->kernel_levels, 1, sizeof(cl_mem), &dev_out);
dt_opencl_set_kernel_arg(devid, gd->kernel_levels, 2, sizeof(int), &width);
dt_opencl_set_kernel_arg(devid, gd->kernel_levels, 3, sizeof(int), &height);
dt_opencl_set_kernel_arg(devid, gd->kernel_levels, 4, sizeof(cl_mem), &dev_lut);
dt_opencl_set_kernel_arg(devid, gd->kernel_levels, 5, sizeof(float), &d->levels[0]);
dt_opencl_set_kernel_arg(devid, gd->kernel_levels, 6, sizeof(float), &d->levels[2]);
dt_opencl_set_kernel_arg(devid, gd->kernel_levels, 7, sizeof(float), &d->in_inv_gamma);
err = dt_opencl_enqueue_kernel_2d(devid, gd->kernel_levels, sizes);
if(err != CL_SUCCESS) goto error;
dt_opencl_release_mem_object(dev_lut);
return TRUE;
error:
if(dev_lut != NULL) dt_opencl_release_mem_object(dev_lut);
dt_print(DT_DEBUG_OPENCL, "[opencl_levels] couldn't enqueue kernel! %d\n", err);
return FALSE;
}
开发者ID:AdamMajer,项目名称:darktable,代码行数:42,代码来源:levels.c
示例18: process_cl
int
process_cl (struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out, const dt_iop_roi_t *roi_in, const dt_iop_roi_t *roi_out)
{
dt_iop_nlmeans_params_t *d = (dt_iop_nlmeans_params_t *)piece->data;
dt_iop_nlmeans_global_data_t *gd = (dt_iop_nlmeans_global_data_t *)self->data;
const int devid = piece->pipe->devid;
const int width = roi_in->width;
const int height = roi_in->height;
cl_int err = -999;
const int P = ceilf(
|
请发表评论