Skip to content

Commit

Permalink
Merge pull request #36 from nazonoSAUNA/directionalblur
Browse files Browse the repository at this point in the history
OpenClの要求バージョンが引き上げられていたのを修正
  • Loading branch information
ePi5131 authored Jun 15, 2022
2 parents 44b9b4a + f73b9ac commit 897c203
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 3 additions & 5 deletions patch/clprogram.cl
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ kernel void DirectionalBlur_Media(global short* dst, global short* src, int obj_
int xx = x_itr >> 16;
int yy = y_itr >> 16;
if (0 <= xx && xx < obj_w && 0 <= yy && yy < obj_h) {
short* pix = src + (xx + yy * obj_line) * 4;
global short* pix = src + (xx + yy * obj_line) * 4;
int src_a = min((int)pix[3], 0x1000);
sum_y += pix[0] * src_a >> 12;
sum_cb += pix[1] * src_a >> 12;
Expand Down Expand Up @@ -628,7 +628,7 @@ kernel void DirectionalBlur_original_size(global short* dst, global short* src,
int xx = x_itr >> 16;
int yy = y_itr >> 16;
if (0 <= xx && xx < obj_w && 0 <= yy && yy < obj_h) {
short* pix = src + (xx + yy * obj_line) * 4;
global short* pix = src + (xx + yy * obj_line) * 4;
int src_a = min((int)pix[3], 0x1000);
sum_y += pix[0] * src_a >> 12;
sum_cb += pix[1] * src_a >> 12;
Expand All @@ -639,7 +639,6 @@ kernel void DirectionalBlur_original_size(global short* dst, global short* src,
x_itr += x_step;
y_itr += y_step;
}

if(cnt == 0) cnt = 0xffffff;
if (sum_a) {
dst[0] = (short)(sum_y * 4096 / sum_a);
Expand Down Expand Up @@ -669,7 +668,7 @@ kernel void DirectionalBlur_Filter(global short* dst, global short* src, int sce
int xx = x_itr >> 16;
int yy = y_itr >> 16;
if (0 <= xx && xx < scene_w && 0 <= yy && yy < scene_h) {
short* pix = src + (xx + yy * scene_line) * 3;
global short* pix = src + (xx + yy * scene_line) * 3;
sum_y += pix[0];
sum_cb += pix[1];
sum_cr += pix[2];
Expand All @@ -683,7 +682,6 @@ kernel void DirectionalBlur_Filter(global short* dst, global short* src, int sce
dst[1] = (short)(sum_cb / cnt);
dst[2] = (short)(sum_cr / cnt);
}

kernel void LensBlur_Media(global char* dst, global char* src, int obj_w, int obj_h, int obj_line,
int range, int rangep05_sqr, int range_t3m1, int rangem1_sqr) {

Expand Down
6 changes: 3 additions & 3 deletions patch/patch_fast_cl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ kernel void DirectionalBlur_Media(global short* dst, global short* src, int obj_
int xx = x_itr >> 16;
int yy = y_itr >> 16;
if (0 <= xx && xx < obj_w && 0 <= yy && yy < obj_h) {
short* pix = src + (xx + yy * obj_line) * 4;
global short* pix = src + (xx + yy * obj_line) * 4;
int src_a = min((int)pix[3], 0x1000);
sum_y += pix[0] * src_a >> 12;
sum_cb += pix[1] * src_a >> 12;
Expand Down Expand Up @@ -664,7 +664,7 @@ kernel void DirectionalBlur_original_size(global short* dst, global short* src,
int xx = x_itr >> 16;
int yy = y_itr >> 16;
if (0 <= xx && xx < obj_w && 0 <= yy && yy < obj_h) {
short* pix = src + (xx + yy * obj_line) * 4;
global short* pix = src + (xx + yy * obj_line) * 4;
int src_a = min((int)pix[3], 0x1000);
sum_y += pix[0] * src_a >> 12;
sum_cb += pix[1] * src_a >> 12;
Expand Down Expand Up @@ -705,7 +705,7 @@ kernel void DirectionalBlur_Filter(global short* dst, global short* src, int sce
int xx = x_itr >> 16;
int yy = y_itr >> 16;
if (0 <= xx && xx < scene_w && 0 <= yy && yy < scene_h) {
short* pix = src + (xx + yy * scene_line) * 3;
global short* pix = src + (xx + yy * scene_line) * 3;
sum_y += pix[0];
sum_cb += pix[1];
sum_cr += pix[2];
Expand Down

0 comments on commit 897c203

Please sign in to comment.