/// <inheritdoc/> public void Deserialize(BufferReader reader, ref DepthImage depthImage, SerializationContext context) { Shared <EncodedDepthImage> sharedEncodedDepthImage = null; Serializer.Deserialize(reader, ref sharedEncodedDepthImage, context); using var sharedDepthImage = DepthImagePool.GetOrCreate(sharedEncodedDepthImage.Resource.Width, sharedEncodedDepthImage.Resource.Height); sharedDepthImage.Resource.DecodeFrom(sharedEncodedDepthImage.Resource, this.decoder); depthImage = sharedDepthImage.Resource.DeepClone(); sharedEncodedDepthImage.Dispose(); }
/// <inheritdoc/> protected override void Receive(Shared <EncodedDepthImage> sharedEncodedDepthImage, Envelope envelope) { using var sharedDepthImage = DepthImagePool.GetOrCreate( sharedEncodedDepthImage.Resource.Width, sharedEncodedDepthImage.Resource.Height, sharedEncodedDepthImage.Resource.DepthValueSemantics, sharedEncodedDepthImage.Resource.DepthValueToMetersScaleFactor); sharedDepthImage.Resource.DecodeFrom(sharedEncodedDepthImage.Resource, this.decoder); this.Out.Post(sharedDepthImage, envelope.OriginatingTime); }