本文整理汇总了C++中dt_opencl_set_kernel_arg函数的典型用法代码示例。如果您正苦于以下问题:C++ dt_opencl_set_kernel_arg函数的具体用法?C++ dt_opencl_set_kernel_arg怎么用?C++ dt_opencl_set_kernel_arg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dt_opencl_set_kernel_arg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 *roi_in, const dt_iop_roi_t *roi_out)
{
dt_iop_vibrance_data_t *data = (dt_iop_vibrance_data_t *)piece->data;
dt_iop_vibrance_global_data_t *gd = (dt_iop_vibrance_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 amount = data->amount * 0.01f;
size_t sizes[] = { ROUNDUPWD(width), ROUNDUPHT(height), 1 };
dt_opencl_set_kernel_arg(devid, gd->kernel_vibrance, 0, sizeof(cl_mem), (void *)&dev_in);
dt_opencl_set_kernel_arg(devid, gd->kernel_vibrance, 1, sizeof(cl_mem), (void *)&dev_out);
dt_opencl_set_kernel_arg(devid, gd->kernel_vibrance, 2, sizeof(int), (void *)&width);
dt_opencl_set_kernel_arg(devid, gd->kernel_vibrance, 3, sizeof(int), (void *)&height);
dt_opencl_set_kernel_arg(devid, gd->kernel_vibrance, 4, sizeof(float), (void *)&amount);
err = dt_opencl_enqueue_kernel_2d(devid, gd->kernel_vibrance, sizes);
if(err != CL_SUCCESS) goto error;
return TRUE;
error:
dt_print(DT_DEBUG_OPENCL, "[opencl_vibrance] couldn't enqueue kernel! %d\n", err);
return FALSE;
}
示例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_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;
}
示例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;
}
示例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_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;
}
示例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_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;
}
示例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_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;
}
示例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 *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;
}
示例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_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;
}
示例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_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;
}
示例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 *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;
}
示例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_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;
}
示例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_splittoning_data_t *d = (dt_iop_splittoning_data_t *)piece->data;
dt_iop_splittoning_global_data_t *gd = (dt_iop_splittoning_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 compress = (d->compress/110.0)/2.0; // Dont allow 100% compression..
const float balance = d->balance;
const float shadow_hue = d->shadow_hue;
const float shadow_saturation = d->shadow_saturation;
const float highlight_hue = d->highlight_hue;
const float highlight_saturation = d->highlight_saturation;
size_t sizes[2] = { ROUNDUPWD(width), ROUNDUPHT(height) };
dt_opencl_set_kernel_arg(devid, gd->kernel_splittoning, 0, sizeof(cl_mem), &dev_in);
dt_opencl_set_kernel_arg(devid, gd->kernel_splittoning, 1, sizeof(cl_mem), &dev_out);
dt_opencl_set_kernel_arg(devid, gd->kernel_splittoning, 2, sizeof(int), &width);
dt_opencl_set_kernel_arg(devid, gd->kernel_splittoning, 3, sizeof(int), &height);
dt_opencl_set_kernel_arg(devid, gd->kernel_splittoning, 4, sizeof(float), &compress);
dt_opencl_set_kernel_arg(devid, gd->kernel_splittoning, 5, sizeof(float), &balance);
dt_opencl_set_kernel_arg(devid, gd->kernel_splittoning, 6, sizeof(float), &shadow_hue);
dt_opencl_set_kernel_arg(devid, gd->kernel_splittoning, 7, sizeof(float), &shadow_saturation);
dt_opencl_set_kernel_arg(devid, gd->kernel_splittoning, 8, sizeof(float), &highlight_hue);
dt_opencl_set_kernel_arg(devid, gd->kernel_splittoning, 9, sizeof(float), &highlight_saturation);
err = dt_opencl_enqueue_kernel_2d(devid, gd->kernel_splittoning, sizes);
if(err != CL_SUCCESS) goto error;
return TRUE;
error:
dt_print(DT_DEBUG_OPENCL, "[opencl_splittoning] couldn't enqueue kernel! %d\n", err);
return FALSE;
}
示例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_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;
}
示例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_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;
}
示例15: 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;
}