未验证 提交 f882f9fd 编写于 作者: X xiebaiyuan 提交者: GitHub

fix bilinear_interp build err on mali,test=develop (#3474)

上级 a6336543
......@@ -13,7 +13,8 @@ See the License for the specific language governing permissions and
limitations under the License. */
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
__kernel void bilinear_interp(__read_only image2d_t input, __write_only image2d_t output,
__kernel void bilinear_interp(
__read_only image2d_t input, __write_only image2d_t output,
__private const float scale_h, __private const float scale_w,
__private const int in_dims_h, __private const int out_dims_h,
__private const int in_dims_w, __private const int out_dims_w,
......@@ -45,10 +46,11 @@ __kernel void bilinear_interp(__read_only image2d_t input, __write_only image2d_
}
float wight0_w = center_w - floor_w;
float wight0_h = center_h - floor_h;
float wight1_w = 1.0 - wight0_w;
float wight1_h = 1.0 - wight0_h;
float wight1_w = 1.0f - wight0_w;
float wight1_h = 1.0f - wight0_h;
const sampler_t sampler = CLK_NORMALIZED_COORDS_TRUE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST;
const sampler_t sampler =
CLK_NORMALIZED_COORDS_TRUE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST;
// get left up pixel data
int2 left_up;
......@@ -75,8 +77,11 @@ __kernel void bilinear_interp(__read_only image2d_t input, __write_only image2d_
half4 right_down_data = read_imageh(input, sampler, right_down);
// calculate output data
half4 data = (left_down_data * wight1_w + right_down_data * wight0_w) * wight1_h
+ (left_up_data * wight1_w + right_up_data * wight0_w) * wight0_h;
half4 data =
(left_down_data * (half)wight1_w + right_down_data * (half)wight0_w) *
(half)wight1_h +
(left_up_data * (half)wight1_w + right_up_data * (half)wight0_w) *
(half)wight0_h;
write_imageh(output, output_pos, data);
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册