From f79eeadde62ea6517181218c470c65ffe8c6be86 Mon Sep 17 00:00:00 2001 From: Johanness Date: Sun, 24 May 2026 21:17:44 +0300 Subject: [PATCH] Document BT.709 v210 conversion --- PixelFormat.hpp | 6 +++++- shaders/v210_decode.comp | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/PixelFormat.hpp b/PixelFormat.hpp index 74dce4e..f29a210 100644 --- a/PixelFormat.hpp +++ b/PixelFormat.hpp @@ -95,6 +95,8 @@ inline void decodeV210Line( default: y10 = y0; cb10 = cb0; cr10 = cr0; break; } + // BT.709 limited-range YCbCr to RGB. v210 stores 10-bit video-range + // samples: Y [64, 940], Cb/Cr centered at 512. int32_t yp = (static_cast(y10) - 64) >> 2; int32_t cbp = (static_cast(cb10) - 512) >> 2; int32_t crp = (static_cast(cr10) - 512) >> 2; @@ -175,6 +177,8 @@ inline void convertV210ToRgba( default: y10 = y0; cb10 = cb0; cr10 = cr0; break; } + // BT.709 limited-range YCbCr to RGB. v210 stores 10-bit video-range + // samples: Y [64, 940], Cb/Cr centered at 512. int32_t yp = (static_cast(y10) - 64) >> 2; int32_t cbp = (static_cast(cb10) - 512) >> 2; int32_t crp = (static_cast(cr10) - 512) >> 2; @@ -187,4 +191,4 @@ inline void convertV210ToRgba( {clampUint8(r), clampUint8(g), clampUint8(b)}); } } -} \ No newline at end of file +} diff --git a/shaders/v210_decode.comp b/shaders/v210_decode.comp index f4e2033..66d8a73 100644 --- a/shaders/v210_decode.comp +++ b/shaders/v210_decode.comp @@ -62,6 +62,8 @@ void main() default: y10 = y5; cb10 = cb4; cr10 = cr4; break; } + // BT.709 limited-range YCbCr to RGB. v210 stores 10-bit video-range + // samples: Y [64, 940], Cb/Cr centered at 512. int yp = int(y10) - 64; int cbp = int(cb10) - 512; int crp = int(cr10) - 512; @@ -79,4 +81,4 @@ void main() b = clamp(b, 0, 255); imageStore(dstImage, dstPos, vec4(float(r) / 255.0, float(g) / 255.0, float(b) / 255.0, 1.0)); -} \ No newline at end of file +}