示例#1
0
 private static unsafe void BuildIntraPredictorsHigh(
     ref MacroBlockD xd,
     byte *ref8,
     int refStride,
     byte *dst8,
     int dstStride,
     PredictionMode mode,
     TxSize txSize,
     int upAvailable,
     int leftAvailable,
     int rightAvailable,
     int x,
     int y,
     int plane)
 {
     int     i;
     ushort *dst = (ushort *)dst8;
     ushort *refr = (ushort *)ref8;
     ushort *leftCol = stackalloc ushort[32];
     ushort *aboveData = stackalloc ushort[64 + 16];
     ushort *aboveRow = aboveData + 16;
     ushort *constAboveRow = aboveRow;
     int     bs = 4 << (int)txSize;
     int     frameWidth, frameHeight;
     int     x0, y0;
     ref MacroBlockDPlane pd = ref xd.Plane[plane];
示例#2
0
 private static int DecodeCoefs(
     ref MacroBlockD xd,
     PlaneType type,
     Span <int> dqcoeff,
     TxSize txSize,
     ref Array2 <short> dq,
     int ctx,
     ReadOnlySpan <short> scan,
     ReadOnlySpan <short> nb,
     ref Reader r)
 {
     ref Vp9BackwardUpdates counts = ref xd.Counts.Value;
示例#3
0
        private static Span <uint> GetTxCounts(ref Vp9BackwardUpdates counts, TxSize maxTxSize, int ctx)
        {
            switch (maxTxSize)
            {
            case TxSize.Tx8x8: return(counts.Tx8x8[ctx].ToSpan());

            case TxSize.Tx16x16: return(counts.Tx16x16[ctx].ToSpan());

            case TxSize.Tx32x32: return(counts.Tx32x32[ctx].ToSpan());

            default: Debug.Assert(false, "Invalid maxTxSize."); return(Span <uint> .Empty);
            }
        }
示例#4
0
        private static ReadOnlySpan <byte> GetTxProbs(ref Vp9EntropyProbs fc, TxSize maxTxSize, int ctx)
        {
            switch (maxTxSize)
            {
            case TxSize.Tx8x8: return(fc.Tx8x8Prob[ctx].ToSpan());

            case TxSize.Tx16x16: return(fc.Tx16x16Prob[ctx].ToSpan());

            case TxSize.Tx32x32: return(fc.Tx32x32Prob[ctx].ToSpan());

            default: Debug.Assert(false, "Invalid maxTxSize."); return(ReadOnlySpan <byte> .Empty);
            }
        }
示例#5
0
        private static TxSize ReadTxSize(ref Vp9Common cm, ref MacroBlockD xd, bool allowSelect, ref Reader r)
        {
            TxMode    txMode    = cm.TxMode;
            BlockSize bsize     = xd.Mi[0].Value.SbType;
            TxSize    maxTxSize = Luts.MaxTxSizeLookup[(int)bsize];

            if (allowSelect && txMode == TxMode.TxModeSelect && bsize >= BlockSize.Block8x8)
            {
                return(ReadSelectedTxSize(ref cm, ref xd, maxTxSize, ref r));
            }
            else
            {
                return((TxSize)Math.Min((int)maxTxSize, (int)Luts.TxModeToBiggestTxSize[(int)txMode]));
            }
        }
示例#6
0
        private static TxSize ReadSelectedTxSize(ref Vp9Common cm, ref MacroBlockD xd, TxSize maxTxSize, ref Reader r)
        {
            int ctx = xd.GetTxSizeContext();
            ReadOnlySpan <byte> txProbs = GetTxProbs(ref cm.Fc.Value, maxTxSize, ctx);
            TxSize txSize = (TxSize)r.Read(txProbs[0]);

            if (txSize != TxSize.Tx4x4 && maxTxSize >= TxSize.Tx16x16)
            {
                txSize += r.Read(txProbs[1]);
                if (txSize != TxSize.Tx8x8 && maxTxSize >= TxSize.Tx32x32)
                {
                    txSize += r.Read(txProbs[2]);
                }
            }

            if (!xd.Counts.IsNull)
            {
                ++GetTxCounts(ref xd.Counts.Value, maxTxSize, ctx)[(int)txSize];
            }

            return(txSize);
        }
示例#7
0
 private static void InverseTransformBlockInter(ref MacroBlockD xd, int plane, TxSize txSize, Span <byte> dst, int stride, int eob)
 {
     ref MacroBlockDPlane pd      = ref xd.Plane[plane];