title: Why opencl spec subtracts 0.5 for CLK_FILTER_LINEAR
body: <p>While reading OpenCL 1.1 spec about CLK_FILTER_LINEAR (section 8.2, p258), I came to know that for calculating weights of bilinear filter 0.5 will be subtracted as shown below. </p>
  
  <pre><code>i0 = address_mode((int)floor(u – 0.5))
  j0 = address_mode((int)floor(v – 0.5))
  i1 = address_mode((int)floor(u – 0.5) + 1)
  j1 = address_mode((int)floor(v – 0.5) + 1)
  </code></pre>
  
  <p>While for CLK_FILTER_NEAREST, it directly floor the u and v as below:</p>
  
  <pre><code>i = address_mode((int)floor(u))
  j = address_mode((int)floor(v))
  </code></pre>
  
  <p>So, there seems to be discrepancy. When I provide unnormalized coordinates (5,4) NEAREST filter will read pixel (5,4). And for LINEAR filter will produce average pixel from (4,3), (5,3), (4,4) and (5,4). But even for LINEAR filter I would expect to read from (5,4) because weights will be 1, 0, 0, 0. </p>
  
  <p><a href="https://www.khronos.org/registry/OpenCL/specs/opencl-1.1.pdf" rel="nofollow noreferrer">opencl1.1_spec</a></p>
  
  <p>Can anyone please clarify the spec intention?</p>