Ejemplo n.º 1
0
        private void YUV_420_888_toRGBIntrinsicsProcess(int width, int height, byte[] yuv)
        {
            if (yuv.Length != _yuvLength)
            {
                Android.Renderscripts.Type.Builder yuvType =
                    new Android.Renderscripts.Type.Builder(rs, Element.U8(rs)).SetX(yuv.Length);
                if (_input != null)
                {
                    _input.Destroy();
                }
                _input     = Allocation.CreateTyped(rs, yuvType.Create(), AllocationUsage.Script);
                _yuvLength = yuv.Length;
            }

            if (_width != width || _height != height)
            {
                Android.Renderscripts.Type.Builder rgbaType = new Android.Renderscripts.Type.Builder(rs, Element.RGBA_8888(rs)).SetX(width).SetY(height);
                if (_output != null)
                {
                    _output.Destroy();
                }
                _output = Allocation.CreateTyped(rs, rgbaType.Create(), AllocationUsage.Script);
                _width  = width;
                _height = height;
            }


            _input.CopyFromUnchecked(yuv);

            _yuvToRgbIntrinsic.SetInput(_input);
            _yuvToRgbIntrinsic.ForEach(_output);
        }