GPUVideo-android icon indicating copy to clipboard operation
GPUVideo-android copied to clipboard

How to apply 8X8 LUT File

Open aahanverma00710 opened this issue 4 years ago • 4 comments

I have applied LUT file of 8x8 ratio and in this project they are using 1x16 ration

Do and its not working properly please help if any one have solution for this

aahanverma00710 avatar Jul 28 '20 10:07 aahanverma00710

I also want to know

StomHong avatar Jun 02 '21 06:06 StomHong

I have applied LUT file of 8x8 ratio and in this project they are using 1x16 ration

Do and its not working properly please help if any one have solution for this

use this shader:

private final static String FRAGMENT_SHADER = "varying highp vec2 vTextureCoord;\n" + "uniform sampler2D sTexture;\n" + "uniform sampler2D lutTexture;\n" + "void main()\n" + "{\n" + " float lookupDimension = 64.0;\n" + " highp vec4 textureColor = texture2D(sTexture, vTextureCoord);\n" + " highp float blueColor = textureColor.b * (lookupDimension - 1.0);\n" + " highp float lookupDimensionSqrt = sqrt(lookupDimension);\n" + " highp vec2 quad1;\n" + " quad1.y = floor(floor(blueColor) / lookupDimensionSqrt);\n" + " quad1.x = floor(blueColor) - (quad1.y * lookupDimensionSqrt);\n" + " highp vec2 quad2;\n" + " quad2.y = floor(ceil(blueColor) / lookupDimensionSqrt);\n" + " quad2.x = ceil(blueColor) - (quad2.y * lookupDimensionSqrt);\n" + " highp vec2 texPos1;\n" + " texPos1.x = (quad1.x / lookupDimensionSqrt) + 0.5/lookupDimensionSqrt/lookupDimension + ((1.0/lookupDimensionSqrt - 1.0/lookupDimensionSqrt/lookupDimension) * textureColor.r);\n" + " texPos1.y = (quad1.y / lookupDimensionSqrt) + 0.5/lookupDimensionSqrt/lookupDimension + ((1.0/lookupDimensionSqrt - 1.0/lookupDimensionSqrt/lookupDimension) * textureColor.g);\n" + " highp vec2 texPos2;\n" + " texPos2.x = (quad2.x / lookupDimensionSqrt) + 0.5/lookupDimensionSqrt/lookupDimension + ((1.0/lookupDimensionSqrt - 1.0/lookupDimensionSqrt/lookupDimension) * textureColor.r);\n" + " texPos2.y = (quad2.y / lookupDimensionSqrt) + 0.5/lookupDimensionSqrt/lookupDimension + ((1.0/lookupDimensionSqrt - 1.0/lookupDimensionSqrt/lookupDimension) * textureColor.g);\n" + " lowp vec4 newColor1 = texture2D(lutTexture, texPos1);\n" + " lowp vec4 newColor2 = texture2D(lutTexture, texPos2);\n" + " lowp vec4 newColor = vec4(mix(newColor1.rgb, newColor2.rgb, fract(blueColor)), textureColor.w);\n" + " gl_FragColor = mix(textureColor, newColor, textureColor.a);\n" + "}\n";

StomHong avatar Jun 03 '21 12:06 StomHong

Thanks

aahanverma00710 avatar Jun 04 '21 13:06 aahanverma00710

How can I set intensity of lut filter using this shader

milan15440 avatar Feb 08 '23 06:02 milan15440