From a1ea6e859c2554c58f1436357d27daa554863a7e Mon Sep 17 00:00:00 2001 From: Toni Date: Sat, 11 Nov 2023 11:06:49 +0100 Subject: [PATCH] Add BT601FullRange format --- FlashCap.Core/CaptureDeviceDescriptor.cs | 1 + FlashCap.Core/Internal/BitmapTranscoder.cs | 23 +++++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/FlashCap.Core/CaptureDeviceDescriptor.cs b/FlashCap.Core/CaptureDeviceDescriptor.cs index 006154a..01e4321 100644 --- a/FlashCap.Core/CaptureDeviceDescriptor.cs +++ b/FlashCap.Core/CaptureDeviceDescriptor.cs @@ -29,6 +29,7 @@ public enum TranscodeFormats Auto, DoNotTranscode, BT601, + BT601FullRange, BT709, BT709FullRange, BT2020, diff --git a/FlashCap.Core/Internal/BitmapTranscoder.cs b/FlashCap.Core/Internal/BitmapTranscoder.cs index 1940dc7..3766f58 100644 --- a/FlashCap.Core/Internal/BitmapTranscoder.cs +++ b/FlashCap.Core/Internal/BitmapTranscoder.cs @@ -28,15 +28,10 @@ internal static class BitmapTranscoder TranscodeFormats conversionStandard, bool isUYVY, byte* pFrom, byte* pTo) { - // default values BT.601 - int multY = 255; - int multUB = 516; - int multUG = 100; - int multVG = 208; - int multVR = 409; - int offsetY = 0; - - // set constants for the color conversion + // constants for color conversion + int multY, multUB, multUG, multVG, multVR, offsetY; + + // select constants for the color conversion switch (conversionStandard) { ////////////////////////////////////////////////// @@ -50,6 +45,15 @@ internal static class BitmapTranscoder //0 ,-100, 516 //409, -208, 0 + case TranscodeFormats.BT601FullRange: + multY = 255; + multUB = 516; + multUG = 100; + multVG = 208; + multVR = 409; + offsetY = 0; + + break; case TranscodeFormats.BT601: // YUV limited range // (Y is in [16..235], rescale to [0..255]) @@ -186,6 +190,7 @@ internal static class BitmapTranscoder switch (transcodeFormat) { case TranscodeFormats.BT601: + case TranscodeFormats.BT601FullRange: case TranscodeFormats.BT709: case TranscodeFormats.BT709FullRange: case TranscodeFormats.BT2020: -- 2.37.1.windows.1