示例#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];
        public Form1()
        {
            InitializeComponent();

            trainingApi = new TrainingApi()
            {
                ApiKey = trainingKey
            };
            currentPredictionMode = PredictionMode.Detection;
            project = trainingApi.GetProject(new Guid("e1ec7b7e-ac74-4959-9c8b-4d48d25a7668"));

            // Create a prediction endpoint, passing in obtained prediction key
            endpoint = new PredictionEndpoint()
            {
                ApiKey = predictionKey
            };

            labelInfo.Text         = textBoxUrl.Text = "";
            percentLevel           = trackBar1.Value;
            selectedItemIndex      = -1;
            isPredicting           = true;
            textBoxTag.Enabled     = buttonAddTag.Enabled = buttonSend.Enabled = buttonClear.Enabled = false;
            labelStatus.Text       = "PREDICTING";
            treeListToUpload       = new List <TreeData>();
            treeListDetection      = new List <TreeData>();
            treeListClassification = new List <TreeData>();
        }
        protected override IParseTree Parse(ITokenStream tokenStream, PredictionMode predictionMode, IParserErrorListener errorListener)
        {
            var parser = new VBAParser(tokenStream);

            parser.Interpreter.PredictionMode = predictionMode;
            parser.AddErrorListener(errorListener);
            return(parser.startRule());
        }
        protected override IParseTree Parse(ITokenStream tokenStream, PredictionMode predictionMode, IParserErrorListener errorListener)
        {
            var parser = new VBAConditionalCompilationParser(tokenStream);

            parser.Interpreter.PredictionMode = predictionMode;
            parser.AddErrorListener(errorListener);
            return(parser.compilationUnit());
        }
 private void radioButtonClassification_CheckedChanged(object sender, EventArgs e)
 {
     if (radioButtonClassification.Checked)
     {
         currentPredictionMode = PredictionMode.Classification;
         project             = trainingApi.GetProject(new Guid("7037781f-ff91-4fbf-943e-087d835438e7"));
         buttonClear.Enabled = false;
     }
     pictureBox1.Invalidate();
 }
 private void radioButtonDetection_CheckedChanged(object sender, EventArgs e)
 {
     if (radioButtonDetection.Checked)
     {
         currentPredictionMode = PredictionMode.Detection;
         project             = trainingApi.GetProject(new Guid("e1ec7b7e-ac74-4959-9c8b-4d48d25a7668"));
         buttonClear.Enabled = isPredicting ? false : true;
     }
     pictureBox1.Invalidate();
 }
示例#7
0
        private static PredictionMode ReadIntraModeUv(ref Vp9Common cm, ref MacroBlockD xd, ref Reader r, byte yMode)
        {
            PredictionMode uvMode = ReadIntraMode(ref r, cm.Fc.Value.UvModeProb[yMode].ToSpan());

            if (!xd.Counts.IsNull)
            {
                ++xd.Counts.Value.UvMode[yMode][(int)uvMode];
            }

            return(uvMode);
        }
示例#8
0
        private static PredictionMode ReadIntraModeY(ref Vp9Common cm, ref MacroBlockD xd, ref Reader r, int sizeGroup)
        {
            PredictionMode yMode = ReadIntraMode(ref r, cm.Fc.Value.YModeProb[sizeGroup].ToSpan());

            if (!xd.Counts.IsNull)
            {
                ++xd.Counts.Value.YMode[sizeGroup][(int)yMode];
            }

            return(yMode);
        }
            protected override IParseTree Parse(ITokenStream tokenStream, PredictionMode predictionMode, IParserErrorListener errorListener)
            {
                //Cannot use a switch because PredictionMode.Ll is not a constant.
                if (predictionMode == PredictionMode.Ll)
                {
                    return(_llFunction());
                }
                if (predictionMode == PredictionMode.Sll)
                {
                    return(_sllFunction());
                }

                throw new System.ComponentModel.InvalidEnumArgumentException();
            }
        private List <Vector3> PerformPrediction(Vector3 startPos, Vector3 velocity, Vector3 gravity, [CanBeNull] PhysicMaterial physicMaterial, float linearDrag = 0f, LineRenderer lineRenderer = null, PredictionMode predictionMode = PredictionMode.All)
        {
            List <Vector3> predictionPoints = new List <Vector3>();
            Vector3        direction        = Vector3.zero;
            Vector3        endPos;
            int            currentIteration = 0;

            float lineDistance = 0f;
            bool  done         = false;

            float invertedAccuracy = (1f - accuracy);

            Vector3 gravAdd        = (gravity * invertedAccuracy);
            float   dragMultiplier = Mathf.Clamp01(1f - (linearDrag * invertedAccuracy));

            while (!done && currentIteration < iterationLimit)
            {
                velocity += gravAdd;
                velocity *= dragMultiplier;

                endPos    = startPos + (velocity * invertedAccuracy);
                direction = endPos - startPos;
                predictionPoints.Add(startPos);

                float dist = Vector3.Distance(startPos, endPos);
                lineDistance += dist;

                if (checkForCollision)
                {
                    Ray        ray = new Ray(startPos, direction);
                    RaycastHit hit;
                    if (Physics.Raycast(ray, out hit, dist, raycastMask))
                    {
                        hitInfo3D = hit;
                        predictionPoints.Add(hit.point);
                        if (bounceOnCollision)
                        {
                            if (physicMaterial != null)
                            {
                                endPos   = hit.point;
                                velocity = Vector3.Reflect(velocity, hit.normal) * physicMaterial.bounciness;
                                if (physicMaterial.bounciness <= 0.01f)
                                {
                                    endMark = endPos;
                                    done    = true;
                                }
                            }
                            else
                            {
                                endMark = endPos;
                                done    = true;
                            }
                        }
                        else
                        {
                            endMark = endPos;
                            done    = true;
                        }
                    }
                }

                #if UNITY_EDITOR
                Debug.DrawRay(startPos, direction, Color.red, debugLineDuration);
                #endif

                startPos = endPos;
                currentIteration++;
            }

            if ((predictionMode == PredictionMode.DrawTrajectory || predictionMode == PredictionMode.All) &&
                lineRenderer != null)
            {
                DrawTrajectory(predictionPoints, lineRenderer);
            }

            return(predictionPoints);
        }
示例#11
0
 protected abstract IParseTree Parse(ITokenStream tokenStream, PredictionMode predictionMode, IParserErrorListener errorListener);