Exemplo n.º 1
0
        public void MultiplyInplace_ByScalar()
        {
            Block8x8F original = CreateRandomFloatBlock(-500, 500);

            Block8x8F actual = original;

            actual.MultiplyInplace(42f);

            for (int i = 0; i < 64; i++)
            {
                Assert.Equal(original[i] * 42f, actual[i]);
            }
        }
Exemplo n.º 2
0
        public void MultiplyInplace_ByOtherBlock()
        {
            Block8x8F original = CreateRandomFloatBlock(-500, 500, 42);
            Block8x8F m        = CreateRandomFloatBlock(-500, 500, 42);

            Block8x8F actual = original;

            actual.MultiplyInplace(ref m);

            for (int i = 0; i < Block8x8F.Size; i++)
            {
                Assert.Equal(original[i] * m[i], actual[i]);
            }
        }
Exemplo n.º 3
0
        public unsafe void ZigZag_CreateDequantizationTable_MultiplicationShouldQuantize(int seed)
        {
            Block8x8F original = CreateRandomFloatBlock(-500, 500, seed);
            Block8x8F qt       = CreateRandomFloatBlock(0, 10, seed + 42);

            var       unzig = ZigZag.CreateUnzigTable();
            Block8x8F zigQt = ZigZag.CreateDequantizationTable(ref qt);

            Block8x8F expected = original;
            Block8x8F actual   = original;

            ReferenceImplementations.DequantizeBlock(&expected, &qt, unzig.Data);

            actual.MultiplyInplace(ref zigQt);

            this.CompareBlocks(expected, actual, 0);
        }