package com.ifpdos.autotest.lancontrol.module.other.e.y;

import android.annotation.SuppressLint;
import java.util.Objects;

/* JADX INFO: compiled from: RGB.java */
/* JADX INFO: loaded from: classes.dex */
public class g {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public double f2161a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public double f2162b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public double f2163c;

    public g(double d2, double d3, double d4) {
        this.f2161a = d2;
        this.f2162b = d3;
        this.f2163c = d4;
    }

    private double c(String str, double d2) {
        double d3;
        if (str.equals("srgb") || str.equals("display_p3")) {
            if (d2 > 0.04045d) {
                return Math.pow((d2 + 0.055d) / 1.055d, 2.4d);
            }
            d3 = 12.92d;
        } else {
            if (str.equals("dci_p3")) {
                if (d2 <= 0.0d) {
                    return 0.0d;
                }
                return Math.pow(d2, 2.6d);
            }
            if (str.equals("adobergb")) {
                if (d2 <= 0.0d) {
                    return 0.0d;
                }
                return Math.pow(d2, 2.19921875d);
            }
            if (!str.equals("bt_2020")) {
                return 0.0d;
            }
            if (d2 > 0.04045d) {
                return Math.pow((d2 + 0.0993d) / 1.0993d, 2.4d);
            }
            d3 = 4.5d;
        }
        return d2 / d3;
    }

    public g a(String str) {
        return new g(c(str, this.f2161a), c(str, this.f2162b), c(str, this.f2163c));
    }

    public g b(int i) {
        double d2 = i;
        return new g(this.f2161a / d2, this.f2162b / d2, this.f2163c / d2);
    }

    public g d(int i) {
        double d2 = i;
        return new g(Math.round(this.f2161a * d2), Math.round(this.f2162b * d2), Math.round(this.f2163c * d2));
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || g.class != obj.getClass()) {
            return false;
        }
        g gVar = (g) obj;
        return Math.abs(gVar.f2161a - this.f2161a) <= 1.0E-5d && Math.abs(gVar.f2162b - this.f2162b) <= 1.0E-5d && Math.abs(gVar.f2163c - this.f2163c) <= 1.0E-5d;
    }

    public int hashCode() {
        return Objects.hash(Double.valueOf(this.f2161a), Double.valueOf(this.f2162b), Double.valueOf(this.f2163c));
    }

    @SuppressLint({"DefaultLocale"})
    public String toString() {
        return "rgb(" + String.format("%.6f", Double.valueOf(this.f2161a)) + ", " + String.format("%.6f", Double.valueOf(this.f2162b)) + ", " + String.format("%.6f", Double.valueOf(this.f2163c)) + ")";
    }

    public g(String str, String str2, String str3) {
        this.f2161a = Double.parseDouble(str);
        this.f2162b = Double.parseDouble(str2);
        this.f2163c = Double.parseDouble(str3);
    }
}
