public YCbCrForwardConverter420(ImageFrame <TPixel> frame) { // matrices would be filled during convert calls this.YLeft = default; this.YRight = default; this.Cb = default; this.Cr = default; // temporal pixel buffers this.pixelSpan = new TPixel[PixelsPerSample].AsSpan(); this.rgbSpan = MemoryMarshal.Cast <byte, Rgb24>(new byte[RgbSpanByteSize + RgbToYCbCrConverterVectorized.AvxCompatibilityPadding].AsSpan()); // frame data this.samplingAreaSize = new Size(frame.Width, frame.Height); this.config = frame.GetConfiguration(); // conversion vector fallback data if (!RgbToYCbCrConverterVectorized.IsSupported) { this.colorTables = RgbToYCbCrConverterLut.Create(); } else { this.colorTables = default; } }
public static YCbCrForwardConverter <TPixel> Create() { var result = default(YCbCrForwardConverter <TPixel>); if (!RgbToYCbCrConverterVectorized.IsSupported) { // Avoid creating lookup tables, when vectorized converter is supported result.colorTables = RgbToYCbCrConverterLut.Create(); } return(result); }