title: IO - Objective-c GPUImage Lookup Filter make effect with lookup image 4x4
body: <p>I know have a many solve make effect for image. But i choice GPUImage (<code>GPUImageLookupFilter</code>) make my image.
  <br>
  My source code i use.
  <br></p>
  
  <pre><code>GPUImagePicture *sourceImagePic = [[GPUImagePicture alloc] initWithImage:sourceImage];
  GPUImagePicture *lookupImageSource = [[GPUImagePicture alloc] initWithImage:[UIImage imageNamed:@"lookup.png"]];
  GPUImageLookupFilter *lookupImageFilter = [[GPUImageLookupFilter alloc] init];
  
  [sourceImagePic addTarget:lookupImageFilter];
  [lookupImageSource addTarget:lookupImageFilter];
  [lookupImageFilter useNextFrameForImageCapture];
  
  [sourceImagePic processImage];
  [lookupImageSource processImage];
  resultImage = [lookupImageFilter imageFromCurrentFramebufferWithOrientation:UIImageOrientationUp];
  
  return resultImage;
  </code></pre>
  
  <p><br>
  First i use lookup image 8x8 (512<sup>2</sup>)
  <br></p>
  
  <p><a href="https://i.stack.imgur.com/I10vu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/I10vu.png" alt="enter image description here"></a>
  <br>
  But when i working with array image (thumb in video or choice many image in library) memory higher.
  <br>
  I think if i use small lookup image (4x4) memory can reduced. I make a lookup image 4x4(16<sup>2</sup>).<br></p>
  
  <p><a href="https://i.stack.imgur.com/l2vSW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/l2vSW.png" alt="enter image description here"></a>
  <br>
  And i try edit code of <code>GPUImageLookupFilter</code> but it not work.</p>
  
  <pre><code> void main(){
   highp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);
  
   highp float blueColor = textureColor.b * 63.0;
  
   highp vec2 quad1;
   quad1.y = floor(floor(blueColor) / 8.0);
   quad1.x = floor(blueColor) - (quad1.y * 8.0);
  
   highp vec2 quad2;
   quad2.y = floor(ceil(blueColor) / 8.0);
   quad2.x = ceil(blueColor) - (quad2.y * 8.0);
  
   highp vec2 texPos1;
   texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);
   texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);
  
   highp vec2 texPos2;
   texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);
   texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);
  
   lowp vec4 newColor1 = texture2D(inputImageTexture2, texPos1);
   lowp vec4 newColor2 = texture2D(inputImageTexture2, texPos2);
  
   lowp vec4 newColor = mix(newColor1, newColor2, fract(blueColor));
   gl_FragColor = mix(textureColor, vec4(newColor.rgb, textureColor.w), intensity);
  }
  </code></pre>
  
  <p><br>
  You can help me edit this code work with image 4x4.
  <br>
  Thank you!.</p>