Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qvideoframetestutils.cpp
Go to the documentation of this file.
1// Copyright (C) 2026 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
5
6#include <cstring>
7
8namespace QtMultimediaTest {
9
10QByteArray makeBytes(std::initializer_list<uchar> bytes)
11{
12 return QByteArray(reinterpret_cast<const char *>(bytes.begin()), qsizetype(bytes.size()));
13}
14
15void fillPlaneRows(uchar *data, qsizetype stride, int width, int height, QByteArrayView texel)
16{
17 for (int row = 0; row < height; ++row) {
18 uchar *rowData = data + row * stride;
19 for (int col = 0; col < width; ++col)
20 std::memcpy(rowData + col * texel.size(), texel.constData(), texel.size());
21 }
22}
23
24q23::expected<void, QString> comparePlaneRows(const uchar *data, qsizetype stride, int width,
25 int height, QByteArrayView texel)
26{
27 for (int row = 0; row < height; ++row) {
28 const uchar *rowData = data + row * stride;
29 for (int col = 0; col < width; ++col) {
30 if (std::memcmp(rowData + col * texel.size(), texel.constData(), texel.size()) != 0)
31 return q23::unexpected(
32 QStringLiteral("mismatch at row %1, column %2").arg(row).arg(col));
33 }
34 }
35 return {};
36}
37
38} // namespace QtMultimediaTest
q23::expected< void, QString > comparePlaneRows(const uchar *data, qsizetype stride, int width, int height, QByteArrayView texel)
QByteArray makeBytes(std::initializer_list< uchar > bytes)
void fillPlaneRows(uchar *data, qsizetype stride, int width, int height, QByteArrayView texel)