Пример #1
0
        private static unsafe void TMPredictor(byte *dst, int stride, int bs, byte *above, byte *left)
        {
            int r, c;
            int yTopLeft = above[-1];

            for (r = 0; r < bs; r++)
            {
                for (c = 0; c < bs; c++)
                {
                    dst[c] = BitUtils.ClipPixel(left[r] + above[c] - yTopLeft);
                }

                dst += stride;
            }
        }
Пример #2
0
        private static unsafe void ConvolveHoriz(
            byte *src,
            int srcStride,
            byte *dst,
            int dstStride,
            Array8 <short>[] xFilters,
            int x0Q4,
            int xStepQ4,
            int w,
            int h)
        {
            if (Sse41.IsSupported && UseIntrinsics && xStepQ4 == 1 << SubpelBits)
            {
                ConvolveHorizSse41(src, srcStride, dst, dstStride, xFilters, x0Q4, w, h);
                return;
            }

            int x, y;

            src -= SubpelTaps / 2 - 1;

            for (y = 0; y < h; ++y)
            {
                int xQ4 = x0Q4;
                for (x = 0; x < w; ++x)
                {
                    byte *srcX = &src[xQ4 >> SubpelBits];
                    ref Array8 <short> xFilter = ref xFilters[xQ4 & SubpelMask];
                    int k, sum = 0;
                    for (k = 0; k < SubpelTaps; ++k)
                    {
                        sum += srcX[k] * xFilter[k];
                    }

                    dst[x] = BitUtils.ClipPixel(BitUtils.RoundPowerOfTwo(sum, FilterBits));
                    xQ4   += xStepQ4;
                }
                src += srcStride;
                dst += dstStride;
            }