Пример #1
0
        public void TransposeInto()
        {
            float[] expected = Create8x8FloatData();
            ReferenceImplementations.Transpose8x8(expected);

            Block8x8F source = new Block8x8F();

            source.LoadFrom(Create8x8FloatData());

            Block8x8F dest = new Block8x8F();

            source.TransposeInto(ref dest);

            float[] actual = new float[64];
            dest.CopyTo(actual);

            Assert.Equal(expected, actual);
        }
Пример #2
0
        public void FDCT8x4_RightPart(int seed)
        {
            var src      = Create8x8RandomFloatData(-200, 200, seed);
            var srcBlock = new Block8x8F();

            srcBlock.LoadFrom(src);

            var destBlock = new Block8x8F();

            var expectedDest = new MutableSpan <float>(64);

            ReferenceImplementations.fDCT2D8x4_32f(src.Slice(4), expectedDest.Slice(4));
            DCT.FDCT8x4_RightPart(ref srcBlock, ref destBlock);

            var actualDest = new MutableSpan <float>(64);

            destBlock.CopyTo(actualDest);

            Assert.Equal(actualDest.Data, expectedDest.Data, new ApproximateFloatComparer(1f));
        }
Пример #3
0
        public void TransformFDCT(int seed)
        {
            var src      = Create8x8RandomFloatData(-200, 200, seed);
            var srcBlock = new Block8x8F();

            srcBlock.LoadFrom(src);

            var destBlock = new Block8x8F();

            var expectedDest = new MutableSpan <float>(64);
            var temp1        = new MutableSpan <float>(64);
            var temp2        = new Block8x8F();

            ReferenceImplementations.fDCT2D_llm(src, expectedDest, temp1, downscaleBy8: true);
            DCT.TransformFDCT(ref srcBlock, ref destBlock, ref temp2, false);

            var actualDest = new MutableSpan <float>(64);

            destBlock.CopyTo(actualDest);

            Assert.Equal(actualDest.Data, expectedDest.Data, new ApproximateFloatComparer(1f));
        }
Пример #4
0
        public void iDCT2D8x4_RightPart()
        {
            MutableSpan <float> sourceArray       = Create8x8FloatData();
            MutableSpan <float> expectedDestArray = new float[64];

            ReferenceImplementations.iDCT2D8x4_32f(sourceArray.Slice(4), expectedDestArray.Slice(4));

            Block8x8F source = new Block8x8F();

            source.LoadFrom(sourceArray);

            Block8x8F dest = new Block8x8F();

            DCT.IDCT8x4_RightPart(ref source, ref dest);

            float[] actualDestArray = new float[64];
            dest.CopyTo(actualDestArray);

            this.Print8x8Data(expectedDestArray);
            this.Output.WriteLine("**************");
            this.Print8x8Data(actualDestArray);

            Assert.Equal(expectedDestArray.Data, actualDestArray);
        }