Пример #1
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);
            }
        }
Пример #2
0
#pragma warning restore CS0649

        public void Convert(ref Vp9EntropyProbs fc)
        {
            for (int i = 0; i < 10; i++)
            {
                for (int j = 0; j < 10; j++)
                {
                    for (int k = 0; k < 9; k++)
                    {
                        fc.KfYModeProb[i][j][k] = k < 8 ? KfYModeProbE0ToE7[i][j][k] : KfYModeProbE8[i][j];
                    }
                }
            }

            fc.SegTreeProb = SegTreeProbs;
            fc.SegPredProb = SegPredProbs;

            for (int i = 0; i < 7; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    fc.InterModeProb[i][j] = InterModeProb[i][j];
                }
            }

            fc.IntraInterProb = IntraInterProb;

            for (int i = 0; i < 10; i++)
            {
                for (int j = 0; j < 9; j++)
                {
                    fc.KfUvModeProb[i][j] = j < 8 ? KfUvModeProbE0ToE7[i][j] : KfUvModeProbE8[i];
                    fc.UvModeProb[i][j]   = j < 8 ? UvModeProbE0ToE7[i][j] : UvModeProbE8[i];
                }
            }

            fc.Tx8x8Prob   = Tx8x8Prob;
            fc.Tx16x16Prob = Tx16x16Prob;
            fc.Tx32x32Prob = Tx32x32Prob;

            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 9; j++)
                {
                    fc.YModeProb[i][j] = j < 8 ? YModeProbE0ToE7[i][j] : YModeProbE8[i];
                }
            }

            for (int i = 0; i < 16; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    fc.KfPartitionProb[i][j] = KfPartitionProb[i][j];
                    fc.PartitionProb[i][j]   = PartitionProb[i][j];
                }
            }

            fc.SwitchableInterpProb = SwitchableInterpProb;
            fc.CompInterProb        = CompInterProb;
            fc.SkipProb[0]          = SkipProbs[0];
            fc.SkipProb[1]          = SkipProbs[1];
            fc.SkipProb[2]          = SkipProbs[2];
            fc.Joints        = Joints;
            fc.Sign          = Sign;
            fc.Class0        = Class0;
            fc.Fp            = Fp;
            fc.Class0Hp      = Class0Hp;
            fc.Hp            = Hp;
            fc.Classes       = Classes;
            fc.Class0Fp      = Class0Fp;
            fc.Bits          = Bits;
            fc.SingleRefProb = SingleRefProb;
            fc.CompRefProb   = CompRefProb;

            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 2; j++)
                {
                    for (int k = 0; k < 2; k++)
                    {
                        for (int l = 0; l < 6; l++)
                        {
                            for (int m = 0; m < 6; m++)
                            {
                                for (int n = 0; n < 3; n++)
                                {
                                    fc.CoefProbs[i][j][k][l][m][n] = CoefProbs[i][j][k][l][m][n];
                                }
                            }
                        }
                    }
                }
            }
        }