summaryrefslogtreecommitdiff
path: root/kms++util/src/conv-yuv-packed.h
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ideasonboard.com>2026-05-04 16:19:04 +0300
committerTomi Valkeinen <tomi.valkeinen@ideasonboard.com>2026-05-08 17:25:34 +0300
commit549c347d6feb2e94a810a720c97a8bf0f57317a1 (patch)
tree8225a757a97e3aadb561f107adee7b1bc526c711 /kms++util/src/conv-yuv-packed.h
parent4e2b291a4acdc2cbd39f005c88bda363bc06bd34 (diff)
kms++util: Replace test-pattern generator with pixpat
Switch draw_test_pattern() to call libpixpat (linked statically into libkms++util.so) instead of the in-tree pattern generator. Pixpat covers every pattern (kmstest, smpte, solid colors) and every pixel format the previous generator handled, so behavior is unchanged for all callers. Drop the now-unused machinery: conv.h and conv-*.h template writers, color16.h (RGB16/YUV16 plus conversions), the *_old / _single / _multi declarations that had no definitions or callers, and the c_draw_test_pattern C ABI which had no callers anywhere in the tree. RecStandard and ColorRange move from color16.h directly into kms++util.h, since they are still part of the public TestPatternOptions struct.
Diffstat (limited to 'kms++util/src/conv-yuv-packed.h')
-rw-r--r--kms++util/src/conv-yuv-packed.h83
1 files changed, 0 insertions, 83 deletions
diff --git a/kms++util/src/conv-yuv-packed.h b/kms++util/src/conv-yuv-packed.h
deleted file mode 100644
index 01278ef..0000000
--- a/kms++util/src/conv-yuv-packed.h
+++ /dev/null
@@ -1,83 +0,0 @@
-#pragma once
-
-#include <vector>
-
-#include <kms++/framebuffer.h>
-#include <kms++util/color16.h>
-
-#include "conv-common.h"
-
-namespace kms
-{
-
-/* YUV Packed */
-
-template<ComponentType C0, ComponentType C1, ComponentType C2, ComponentType C3>
-struct YUV_Packed_Format
- : public FormatLayout<
- PlaneLayout<uint32_t,
- ComponentLayout<C0, 8, 0>,
- ComponentLayout<C1, 8, 8>,
- ComponentLayout<C2, 8, 16>,
- ComponentLayout<C3, 8, 24>
- >
- >
-{
-};
-
-// Define common packed YUV formats
-using YUYV_Layout = YUV_Packed_Format<ComponentType::Y0, ComponentType::Cb,
- ComponentType::Y1, ComponentType::Cr>;
-
-using YVYU_Layout = YUV_Packed_Format<ComponentType::Y0, ComponentType::Cr,
- ComponentType::Y1, ComponentType::Cb>;
-
-using UYVY_Layout = YUV_Packed_Format<ComponentType::Cb, ComponentType::Y0,
- ComponentType::Cr, ComponentType::Y1>;
-
-using VYUY_Layout = YUV_Packed_Format<ComponentType::Cr, ComponentType::Y0,
- ComponentType::Cb, ComponentType::Y1>;
-
-template<typename Layout>
-class YUVPackedWriter
-{
- using Plane = typename Layout::template plane<0>;
- using TStorage = typename Plane::storage_type;
-
- static constexpr size_t y0_pos = Plane::template find_pos<ComponentType::Y0>();
- static constexpr size_t y1_pos = Plane::template find_pos<ComponentType::Y1>();
- static constexpr size_t cb_pos = Plane::template find_pos<ComponentType::Cb>();
- static constexpr size_t cr_pos = Plane::template find_pos<ComponentType::Cr>();
-
-public:
- static void write_pattern(IFramebuffer& fb, size_t start_y, size_t end_y,
- auto&& generate_line)
- {
- std::vector<YUV16> linebuf(fb.width());
-
- auto view = make_strided_fb_view<TStorage>(fb.map(0), fb.height(),
- fb.width() / 2, // Two pixels per storage unit
- fb.stride(0));
-
- for (size_t y = start_y; y <= end_y; y++) {
- generate_line(y, linebuf);
-
- for (size_t x = 0; x < fb.width(); x += 2) {
- // Get two pixels
- const YUV16& pix0 = linebuf[x];
- const YUV16& pix1 = linebuf[x + 1];
-
- std::array<uint8_t, 4> components;
-
- components[y0_pos] = pix0.y >> 8;
- components[y1_pos] = pix1.y >> 8;
- components[cb_pos] = ((pix0.u + pix1.u) / 2) >> 8;
- components[cr_pos] = ((pix0.v + pix1.v) / 2) >> 8;
-
- view(y, x / 2) = Plane::pack(components);
- }
- }
- }
-};
-
-} // namespace kms