<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>i.MX ProcessorsのトピックIssue in using CLK_FILTER_LINEAR flag in sampler with read_imagef of OpenCL</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/Issue-in-using-CLK-FILTER-LINEAR-flag-in-sampler-with-read/m-p/1338930#M179969</link>
    <description>&lt;P&gt;Hi Team,&lt;BR /&gt;We are trying to use CLK_FILTER_LINEAR flag in sampler with read_imagef but it's returning either 0 or garbage value.&lt;BR /&gt;OpenCL Version 1.2&amp;nbsp; &amp;amp;&amp;nbsp; Hardware imx8&lt;/P&gt;&lt;P&gt;Below is the code snippet for the reference...&lt;/P&gt;&lt;P&gt;(Source code)&lt;BR /&gt;cl_image_format format;&lt;BR /&gt;format.image_channel_order = CL_R; //Note: Our Image is having only one channel.&lt;BR /&gt;format.image_channel_data_type = CL_FLOAT;&lt;/P&gt;&lt;P&gt;size_t width = imageWidth;&lt;BR /&gt;size_t height = imageHeight;&lt;/P&gt;&lt;P&gt;image = clCreateImage2D(context, CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR, &amp;amp;format, width, height, 0, imageHost, &amp;amp;err); //Note: imageHost is a float pointer.&lt;/P&gt;&lt;P&gt;(Kernel)&lt;BR /&gt;__constant sampler_t search_sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_LINEAR;&lt;BR /&gt;__kernel void readImage(__read_only image2d_t img)&lt;BR /&gt;{​​​​​&lt;BR /&gt;float4 value = read_imagef(img, search_sampler, (float2)(coord.x, coord.y));&lt;BR /&gt;printf("Values are %f %f %f %f \n", value.x, value.y, value.z, value.w);&lt;BR /&gt;}​​​​​&lt;BR /&gt;It would be very helpful if you can provide us the same kinda code snippet on how to use CLK_FILTER_LINEAR. And we would love if that code gives the actual value of the coord in image instead of normalized.&lt;/P&gt;&lt;P&gt;Note:&lt;BR /&gt;If we use CLK_FILTER_NEAREST with channel data type uint8 and read_imageui, it works perfectly.&lt;/P&gt;</description>
    <pubDate>Mon, 13 Sep 2021 07:25:35 GMT</pubDate>
    <dc:creator>monil</dc:creator>
    <dc:date>2021-09-13T07:25:35Z</dc:date>
    <item>
      <title>Issue in using CLK_FILTER_LINEAR flag in sampler with read_imagef of OpenCL</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Issue-in-using-CLK-FILTER-LINEAR-flag-in-sampler-with-read/m-p/1338930#M179969</link>
      <description>&lt;P&gt;Hi Team,&lt;BR /&gt;We are trying to use CLK_FILTER_LINEAR flag in sampler with read_imagef but it's returning either 0 or garbage value.&lt;BR /&gt;OpenCL Version 1.2&amp;nbsp; &amp;amp;&amp;nbsp; Hardware imx8&lt;/P&gt;&lt;P&gt;Below is the code snippet for the reference...&lt;/P&gt;&lt;P&gt;(Source code)&lt;BR /&gt;cl_image_format format;&lt;BR /&gt;format.image_channel_order = CL_R; //Note: Our Image is having only one channel.&lt;BR /&gt;format.image_channel_data_type = CL_FLOAT;&lt;/P&gt;&lt;P&gt;size_t width = imageWidth;&lt;BR /&gt;size_t height = imageHeight;&lt;/P&gt;&lt;P&gt;image = clCreateImage2D(context, CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR, &amp;amp;format, width, height, 0, imageHost, &amp;amp;err); //Note: imageHost is a float pointer.&lt;/P&gt;&lt;P&gt;(Kernel)&lt;BR /&gt;__constant sampler_t search_sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_LINEAR;&lt;BR /&gt;__kernel void readImage(__read_only image2d_t img)&lt;BR /&gt;{​​​​​&lt;BR /&gt;float4 value = read_imagef(img, search_sampler, (float2)(coord.x, coord.y));&lt;BR /&gt;printf("Values are %f %f %f %f \n", value.x, value.y, value.z, value.w);&lt;BR /&gt;}​​​​​&lt;BR /&gt;It would be very helpful if you can provide us the same kinda code snippet on how to use CLK_FILTER_LINEAR. And we would love if that code gives the actual value of the coord in image instead of normalized.&lt;/P&gt;&lt;P&gt;Note:&lt;BR /&gt;If we use CLK_FILTER_NEAREST with channel data type uint8 and read_imageui, it works perfectly.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Sep 2021 07:25:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Issue-in-using-CLK-FILTER-LINEAR-flag-in-sampler-with-read/m-p/1338930#M179969</guid>
      <dc:creator>monil</dc:creator>
      <dc:date>2021-09-13T07:25:35Z</dc:date>
    </item>
  </channel>
</rss>

