internal static Bc3Block EncodeBlock(RawBlock4X4Rgba32 rawBlock)
            {
                var pixels = rawBlock.AsSpan;

                PcaVectors.Create(pixels, out System.Numerics.Vector3 mean, out System.Numerics.Vector3 pa);
                PcaVectors.GetMinMaxColor565(pixels, mean, pa, out var min, out var max);

                var c0 = max;
                var c1 = min;

                Bc3Block best = TryColors(rawBlock, c0, c1, out float bestError);

                for (int i = 0; i < maxTries; i++)
                {
                    var(newC0, newC1) = ColorVariationGenerator.Variate565(c0, c1, i);

                    var block = TryColors(rawBlock, newC0, newC1, out var error);

                    if (error < bestError)
                    {
                        best      = block;
                        bestError = error;
                        c0        = newC0;
                        c1        = newC1;
                    }

                    if (bestError < errorThreshold)
                    {
                        break;
                    }
                }
                best = FindAlphaValues(best, rawBlock, 5);
                return(best);
            }
            internal static Bc3Block EncodeBlock(RawBlock4X4Rgba32 rawBlock)
            {
                var pixels = rawBlock.AsSpan;

                PcaVectors.Create(pixels, out System.Numerics.Vector3 mean, out System.Numerics.Vector3 pa);
                PcaVectors.GetMinMaxColor565(pixels, mean, pa, out var min, out var max);

                var c0 = max;
                var c1 = min;

                if (c0.data < c1.data)
                {
                    var c = c0;
                    c0 = c1;
                    c1 = c;
                }

                Bc3Block best = TryColors(rawBlock, c0, c1, out float bestError);

                int lastChanged = 0;

                for (int i = 0; i < maxTries; i++)
                {
                    var(newC0, newC1) = ColorVariationGenerator.Variate565(c0, c1, i);

                    if (newC0.data < newC1.data)
                    {
                        var c = newC0;
                        newC0 = newC1;
                        newC1 = c;
                    }

                    var block = TryColors(rawBlock, newC0, newC1, out var error);

                    lastChanged++;

                    if (error < bestError)
                    {
                        best        = block;
                        bestError   = error;
                        c0          = newC0;
                        c1          = newC1;
                        lastChanged = 0;
                    }

                    if (bestError < errorThreshold || lastChanged > ColorVariationGenerator.VarPatternCount)
                    {
                        break;
                    }
                }

                best = FindAlphaValues(best, rawBlock, 8);
                return(best);
            }