From dc447843b9faed8c61b8e9d8b4078282eef76b9f Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Thu, 7 Nov 2024 11:40:54 +0200 Subject: [PATCH] WIP: add XV15 --- pixutils/formats/pixelformats.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/pixutils/formats/pixelformats.py b/pixutils/formats/pixelformats.py index 78d4d0a..1a3813e 100644 --- a/pixutils/formats/pixelformats.py +++ b/pixutils/formats/pixelformats.py @@ -21,6 +21,9 @@ class PixelFormatPlaneInfo(NamedTuple): bytespergroup: int # plane's lines in a group linespergroup: int + # subsampling + hsub: int + vsub: int class PixelFormat: @@ -35,7 +38,13 @@ def __init__(self, name: str, self.packed = packed # pixel group size (width-in-pixels, height-in-lines) self.group_size = group_size - self.planes = [PixelFormatPlaneInfo(*p) for p in planes] + + def adjust_p(p): + if len(p) == 2: + return (p[0], p[1], 1, 1) + return p + + self.planes = [PixelFormatPlaneInfo(*adjust_p(p)) for p in planes] def __str__(self): return self.name @@ -279,6 +288,15 @@ def get_formats(): ( ( 4, 1 ), ), ) + XV15 = PixelFormat('XV15', + 'XV15', None, + PixelColorEncoding.YUV, + False, + ( 6, 2 ), + ( ( 8, 2, 1, 1, ), + ( 8, 1, 2, 2, ), ), + ) + # YUV 4:4:4 VUY888 = PixelFormat('VUY888',