From a9e7ecab862183399c5947931f2bad69ecec393d Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Wed, 5 Feb 2025 11:28:23 +0200 Subject: PixelFormats: New PixelFormatInfo code New pixel format code, from Python pixutils library. Signed-off-by: Tomi Valkeinen --- py/pykms/pykmsbase.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'py/pykms/pykmsbase.cpp') diff --git a/py/pykms/pykmsbase.cpp b/py/pykms/pykmsbase.cpp index 254dce6..ae8aebf 100644 --- a/py/pykms/pykmsbase.cpp +++ b/py/pykms/pykmsbase.cpp @@ -179,7 +179,7 @@ void init_pykmsbase(py::module& m) if (plane >= format_info.num_planes) throw runtime_error("map: bad plane number"); - array shape{ self.height(), self.width() * format_info.planes[plane].bitspp / 8 }; + array shape{ self.height(), format_info.stride(self.width(), plane) }; array strides{ self.stride(plane), sizeof(uint8_t) }; return py::memoryview::from_buffer(self.map(plane), shape, strides); @@ -311,9 +311,10 @@ void init_pykmsbase(py::module& m) .def("commit_sync", &AtomicReq::commit_sync, py::arg("allow_modeset") = false); py::class_(m, "PixelFormatPlaneInfo") - .def_readonly("bitspp", &PixelFormatPlaneInfo::bitspp) - .def_readonly("xsub", &PixelFormatPlaneInfo::xsub) - .def_readonly("ysub", &PixelFormatPlaneInfo::ysub); + .def_readonly("bytes_per_block", &PixelFormatPlaneInfo::bytes_per_block) + .def_readonly("pixels_per_block", &PixelFormatPlaneInfo::pixels_per_block) + .def_readonly("hsub", &PixelFormatPlaneInfo::hsub) + .def_readonly("vsub", &PixelFormatPlaneInfo::vsub); py::class_(m, "PixelFormatInfo") .def_readonly("num_planes", &PixelFormatInfo::num_planes) -- cgit v1.2.3