Exemplo n.º 1
0
        public static void Iht8x864Add(ReadOnlySpan <int> input, Span <byte> dest, int stride, int txType)
        {
            int         i, j;
            Span <int>  output  = stackalloc int[8 * 8];
            Span <int>  outptr  = output;
            Span <int>  tempIn  = stackalloc int[8];
            Span <int>  tempOut = stackalloc int[8];
            Transform2D ht      = Iht8[txType];

            // Inverse transform row vectors
            for (i = 0; i < 8; ++i)
            {
                ht.Rows(input, outptr);
                input  = input.Slice(8);
                outptr = outptr.Slice(8);
            }

            // Inverse transform column vectors
            for (i = 0; i < 8; ++i)
            {
                for (j = 0; j < 8; ++j)
                {
                    tempIn[j] = output[j * 8 + i];
                }

                ht.Cols(tempIn, tempOut);
                for (j = 0; j < 8; ++j)
                {
                    dest[j * stride + i] = ClipPixelAdd(dest[j * stride + i], BitUtils.RoundPowerOfTwo(tempOut[j], 5));
                }
            }
        }
Exemplo n.º 2
0
        public static void Iht16x16256Add(ReadOnlySpan <int> input, Span <byte> dest, int stride, int txType)
        {
            int         i, j;
            Span <int>  output  = stackalloc int[16 * 16];
            Span <int>  outptr  = output;
            Span <int>  tempIn  = stackalloc int[16];
            Span <int>  tempOut = stackalloc int[16];
            Transform2D ht      = Iht16[txType];

            // Rows
            for (i = 0; i < 16; ++i)
            {
                ht.Rows(input, outptr);
                input  = input.Slice(16);
                outptr = outptr.Slice(16);
            }

            // Columns
            for (i = 0; i < 16; ++i)
            {
                for (j = 0; j < 16; ++j)
                {
                    tempIn[j] = output[j * 16 + i];
                }

                ht.Cols(tempIn, tempOut);
                for (j = 0; j < 16; ++j)
                {
                    dest[j * stride + i] = ClipPixelAdd(dest[j * stride + i], BitUtils.RoundPowerOfTwo(tempOut[j], 6));
                }
            }
        }