From 549c347d6feb2e94a810a720c97a8bf0f57317a1 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Mon, 4 May 2026 16:19:04 +0300 Subject: 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. --- kms++util/src/conv-yuv-planar-packed.h | 125 --------------------------------- 1 file changed, 125 deletions(-) delete mode 100644 kms++util/src/conv-yuv-planar-packed.h (limited to 'kms++util/src/conv-yuv-planar-packed.h') diff --git a/kms++util/src/conv-yuv-planar-packed.h b/kms++util/src/conv-yuv-planar-packed.h deleted file mode 100644 index 481b594..0000000 --- a/kms++util/src/conv-yuv-planar-packed.h +++ /dev/null @@ -1,125 +0,0 @@ -#pragma once - -#include - -#include -#include - -#include "conv-common.h" - -namespace kms -{ -/* YUV Planar Packed (only T430 for now) */ - -struct T430_Layout : FormatLayout < - PlaneLayout, - ComponentLayout, - ComponentLayout, - ComponentLayout>, - PlaneLayout, - ComponentLayout, - ComponentLayout, - ComponentLayout>, - PlaneLayout, - ComponentLayout, - ComponentLayout, - ComponentLayout> - > -{ - static constexpr size_t y_plane = 0; - static constexpr size_t cb_plane = 1; - static constexpr size_t cr_plane = 2; - -}; - -template -class YUVPlanarPackedWriter -{ - using YLayout = typename Format::template plane; - using CbLayout = typename Format::template plane; - using CrLayout = typename Format::template plane; - - using TY = typename YLayout::storage_type; - using TCb = typename CbLayout::storage_type; - using TCr = typename CrLayout::storage_type; - - static constexpr size_t pixels_in_group = 3; - - // Helper to extract the correct component based on component type - template - static uint16_t extract_component(const YUV16& pixel) - { - if constexpr (CType == ComponentType::Y) - return pixel.y; - else if constexpr (CType == ComponentType::Cb) - return pixel.u; - else if constexpr (CType == ComponentType::Cr) - return pixel.v; - else - return 0; // For padding or other component types - } - -public: - static void write_pattern(IFramebuffer& fb, size_t start_y, size_t end_y, - auto&& generate_line) - { - // Line buffers - std::vector linebuf(fb.width()); - - // Views to all planes - auto y_buf = make_strided_fb_view(fb.map(Format::y_plane), - fb.height(), fb.width(), - fb.stride(Format::y_plane)); - - auto cb_buf = make_strided_fb_view(fb.map(Format::cb_plane), - fb.height(), fb.width(), - fb.stride(Format::cb_plane)); - - auto cr_buf = make_strided_fb_view(fb.map(Format::cr_plane), - fb.height(), fb.width(), - fb.stride(Format::cr_plane)); - - for (size_t y_src = start_y; y_src <= end_y; y_src++) { - generate_line(y_src, linebuf); - - write_samples(md::submdspan(y_buf, y_src, md::full_extent), linebuf, fb.width()); - write_samples(md::submdspan(cb_buf, y_src, md::full_extent), linebuf, fb.width()); - write_samples(md::submdspan(cr_buf, y_src, md::full_extent), linebuf, fb.width()); - } - } - - -private: - template - static void write_samples(Buf&& view, auto&& linebuf, size_t num_pixels) - { - for (size_t x_src = 0; x_src < num_pixels; x_src += pixels_in_group) { - auto x_dst = x_src / pixels_in_group; - - write_group(view, linebuf, x_src, x_dst, - std::make_index_sequence{}); - } - } - - template - static void write_group(YBuf&& view, auto&& linebuf, size_t x_src, - size_t x_dst, std::index_sequence) - { - std::array values{ - static_cast( - (extract_component(linebuf[x_src + I]) >> - (16 - Plane::template component_size)))... - }; - - // Set padding bits to 0 - if constexpr (Plane::template component_count()) - values[Plane::template find_pos()] = 0; - - view[x_dst] = Plane::pack(values); - } -}; - -} // namespace kms -- cgit v1.2.3