Ejemplo n.º 1
0
        public static Mv AverageSplitMvs(ref MacroBlockDPlane pd, ref ModeInfo mi, int refr, int block)
        {
            int ssIdx = ((pd.SubsamplingX > 0 ? 1 : 0) << 1) | (pd.SubsamplingY > 0 ? 1 : 0);
            Mv  res   = new Mv();

            switch (ssIdx)
            {
            case 0: res = mi.Bmi[block].Mv[refr]; break;

            case 1: res = MiMvPredQ2(ref mi, refr, block, block + 2); break;

            case 2: res = MiMvPredQ2(ref mi, refr, block, block + 1); break;

            case 3: res = MiMvPredQ4(ref mi, refr); break;

            default: Debug.Assert(ssIdx <= 3 && ssIdx >= 0); break;
            }
            return(res);
        }
Ejemplo n.º 2
0
        public static void SetupDstPlanes(
            ref Array3 <MacroBlockDPlane> planes,
            ref Surface src,
            int miRow,
            int miCol)
        {
            Span <ArrayPtr <byte> > buffers = stackalloc ArrayPtr <byte> [Constants.MaxMbPlane];

            buffers[0] = src.YBuffer;
            buffers[1] = src.UBuffer;
            buffers[2] = src.VBuffer;
            Span <int> strides = stackalloc int[Constants.MaxMbPlane];

            strides[0] = src.Stride;
            strides[1] = src.UvStride;
            strides[2] = src.UvStride;
            int i;

            for (i = 0; i < Constants.MaxMbPlane; ++i)
            {
                ref MacroBlockDPlane pd = ref planes[i];
                SetupPredPlanes(ref pd.Dst, buffers[i], strides[i], miRow, miCol, Ptr <ScaleFactors> .Null, pd.SubsamplingX, pd.SubsamplingY);
            }