Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
- // Jad home page: http://www.geocities.com/kpdus/jad.html
- // Decompiler options: braces fieldsfirst space lnc
- package com.tpvision.ambilightplushue.helpers;
- import java.util.concurrent.atomic.AtomicInteger;
- // Referenced classes of package com.tpvision.ambilightplushue.helpers:
- // ColorGamut
- public class Algorithm
- {
- private static final float MAX_BRI_0 = 0.3F;
- private static final float MAX_BRI_SLIDER_DYN = 0.7F;
- private static final float MAX_SAT = 1.25F;
- private static final float MAX_SAT_SLIDER = 0.8F;
- private static final float MAX_TT = 10F;
- private static final float MAX_TT_DELTA = 8F;
- private static final float MAX_TT_SLIDER = 1F;
- private static final float MIN_BRI_IN = 0.2F;
- private static final float MIN_SAT = 0.85F;
- private static final float MIN_SAT_SLIDER = 0.2F;
- private static final float MIN_TT = 3F;
- private static final float MIN_TT_DELTA = 2F;
- private static final float MIN_TT_SLIDER = 0.2F;
- public static final int MODEL_DEFAULT = -1;
- public static final int MODEL_TYPE_HUE = 0;
- public static final int MODEL_TYPE_LIVING_COLOR = 1;
- private static final float XB_AL = 0.270844F;
- private static final float XG_AL = 0.301434F;
- private static final float XR_AL = 0.399454F;
- private static final float YB_AL = 0.130816F;
- private static final float YG_AL = 0.666385F;
- private static final float YR_AL = 0.202799F;
- private static final float ZB_AL = 1.440815F;
- private static final float ZG_AL = 0.108732F;
- private static final float ZR_AL = 0.012291F;
- public Algorithm()
- {
- }
- private static float clip(float f, float f1, float f2)
- {
- if (f > f2)
- {
- return f2;
- }
- if (f < f1)
- {
- return f1;
- } else
- {
- return f;
- }
- }
- public static float[] convertRGBtoXY_final(float f, float f1, float f2, int i, int j, int k, AtomicInteger atomicinteger, AtomicInteger atomicinteger1,
- int l, int i1, String s)
- {
- float f3 = (float)i1 / 10F;
- float f4 = Math.max(0.0F, Math.min(1.0F, (float)l / 10F));
- float f5 = Math.max(0.0F, Math.min(1.0F, f3));
- float f6 = clip(fun_y(f4, 0.2F, 0.8F, 0.85F, 1.25F), 0.85F, 1.25F);
- float f7 = Math.max(f6 - 1.0F, 0.0F);
- float f8 = Math.max(Math.max(f, f1), f2);
- if (f6 < 1.0F)
- {
- float f35 = 0.2126F * f + 0.7152F * f1 + 0.0722F * f2;
- f = f6 * f + f35 * (1.0F - f6);
- f1 = f6 * f1 + f35 * (1.0F - f6);
- f2 = f6 * f2 + f35 * (1.0F - f6);
- }
- float f9 = 0.399454F * f + 0.301434F * f1 + 0.270844F * f2;
- float f10 = 0.202799F * f + 0.666385F * f1 + 0.130816F * f2;
- float f11 = 0.012291F * f + 0.108732F * f1 + 1.440815F * f2 + (f9 + f10);
- float f12;
- float f13;
- float f14;
- float f15;
- float f16;
- if (f11 > 1E-06F)
- {
- f12 = f9 / f11;
- f13 = f10 / f11;
- } else
- {
- f12 = 0.33F;
- f13 = 0.31F;
- }
- f14 = f12 + f7 * (f12 - 0.3127F);
- f15 = f13 + f7 * (f13 - 0.329F);
- f16 = 1.0F - f14 - f15;
- if (getModelType(s) == 0)
- {
- float f25 = 3.5784F * f14 + -2.7387F * f15 + -0.6154F * f16;
- float f26 = -1.0029F * f14 + 2.1013F * f15 + 0.1052F * f16;
- float f27 = 0.1451F * f14 + -0.3176F * f15 + 1.4407F * f16;
- float f28 = Math.max(0.0F, f25);
- float f29 = Math.max(0.0F, f26);
- float f30 = Math.max(0.0F, f27);
- float f31 = f29;
- float af[];
- float af1[];
- float f17;
- float f18;
- float f19;
- float f20;
- float f21;
- float f22;
- float f23;
- float f24;
- float f32;
- float f33;
- float f34;
- if (f30 < f29 && f29 < f28)
- {
- f31 = f29 - (0.5F * (f28 - f29) * (f29 - f30)) / (f28 - f30);
- } else
- if (f28 < f29 && f29 < f30)
- {
- f31 = f29 - (0.5F * (f30 - f29) * (f29 - f28)) / (f30 - f28);
- }
- f32 = 0.4407F * f28 + 0.5962F * f31 + 0.1447F * f30;
- f33 = 0.2102F * f28 + 0.7551F * f31 + 0.0347F * f30;
- f34 = 0.002F * f28 + 0.1064F * f31 + 0.6872F * f30 + (f32 + f33);
- if (f34 > 1E-06F)
- {
- f14 = f32 / f34;
- f15 = f33 / f34;
- } else
- {
- f14 = 0.33F;
- f15 = 0.31F;
- }
- }
- getModelType(s);
- af = desaturate(f14, f15, 0.33F, 0.31F, f8, 0.1F);
- af1 = ColorGamut.fixXYColor(af[0], af[1], s);
- f17 = af1[0];
- f18 = af1[1];
- f19 = (float)Math.sqrt(f8);
- f20 = f5 * Math.min(f4 / 0.7F, 1.0F);
- f21 = Math.max(0.0F, f5 - f20);
- f22 = f21 + Math.min(1.0F, f19 * f20);
- if (f19 < 0.2F)
- {
- f24 = fun_y(f19, 0.0F, 0.2F, 0.3F, f21 + Math.min(1.0F, 0.2F * f20));
- f22 = Math.min(f22, f24);
- }
- f23 = f22;
- atomicinteger1.set((int)clip(fun_y(f4, 0.2F, 1.0F, 10F + 8F * (float)(j / 2), 3F + 2.0F * (float)(j / 2)), 3F + 2.0F * (float)(j / 2), 10F + 8F * (float)(j / 2)));
- atomicinteger.set((int)(255F * Math.min(Math.max(f23 + 0.0F, 0.0F), 1.0F)));
- return (new float[] {
- f17, f18
- });
- }
- private static float[] desaturate(float f, float f1, float f2, float f3, float f4, float f5)
- {
- float f6 = f;
- float f7 = f1;
- if (f4 < f5)
- {
- float f8 = f4 / f5;
- f6 = f * f8 + f2 * (1.0F - f8);
- f7 = f1 * f8 + f3 * (1.0F - f8);
- }
- return (new float[] {
- f6, f7
- });
- }
- private static float fun_y(float f, float f1, float f2, float f3, float f4)
- {
- int i = f2 - f1 != 0.0F;
- float f5 = 0.0F;
- if (i != 0)
- {
- float f6 = (f4 - f3) / (f2 - f1);
- f5 = (f3 - f6 * f1) + f6 * f;
- }
- return f5;
- }
- public static int getModelType(String s)
- {
- if (s.equals("LCT001") || s.equals("LCT002") || s.equals("LCT003"))
- {
- return 0;
- }
- return !s.equals("LLC001") && !s.equals("LLC005") && !s.equals("LLC006") && !s.equals("LLC007") && !s.equals("LLC011") && !s.equals("LLC012") && !s.equals("LLC013") && !s.equals("LLC014") && !s.equals("LLS001") && !s.equals("LST001") ? -1 : 1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement