Android-cuttlefish cvd tool
image.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2023 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#pragma once
17
18#include <cstdint>
19#include <string>
20#include <vector>
21
23
24namespace gfxstream {
25
26struct RGBAImage {
27 uint32_t width;
28 uint32_t height;
29 std::vector<uint8_t> pixels;
30};
32 const std::string& filename);
33
35 uint32_t w, uint32_t h, const uint8_t* rgbaPixels,
36 const std::string& filename = "");
37
39 uint32_t width;
40 uint32_t height;
41 std::vector<uint8_t> y;
42 std::vector<uint8_t> u;
43 std::vector<uint8_t> v;
44};
46 const std::string& filename);
47
48RGBAImage FillWithColor(uint32_t width, uint32_t height, uint8_t red,
49 uint8_t green, uint8_t blue, uint8_t alpha);
50
52
53struct PixelDiff {
54 uint32_t x;
55 uint32_t y;
56 uint8_t expectedR;
57 uint8_t expectedG;
58 uint8_t expectedB;
59 uint8_t expectedA;
60 uint8_t actualR;
61 uint8_t actualG;
62 uint8_t actualB;
63 uint8_t actualA;
64};
65
67 const RGBAImage& expected, const RGBAImage& actual);
68
69} // namespace gfxstream
Definition: expected.h:33
Definition: egl.cpp:21
gfxstream::expected< Ok, std::string > SaveRGBAToBitmapFile(uint32_t w, uint32_t h, const uint8_t *rgbaPixels, const std::string &filename)
Definition: image.cpp:124
RGBAImage FillWithColor(uint32_t width, uint32_t height, uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha)
Definition: image.cpp:205
gfxstream::expected< Ok, std::vector< PixelDiff > > CompareImages(const RGBAImage &expected, const RGBAImage &actual)
Definition: image.cpp:310
gfxstream::expected< YUV420Image, std::string > LoadYUV420FromBitmapFile(const std::string &filename)
Definition: image.cpp:199
YUV420Image ConvertRGBA8888ToYUV420(const RGBAImage &rgbaImage)
Definition: image.cpp:251
gfxstream::expected< RGBAImage, std::string > LoadRGBAFromBitmapFile(const std::string &filename)
Definition: image.cpp:29
Definition: image.h:53
uint8_t expectedA
Definition: image.h:59
uint8_t expectedG
Definition: image.h:57
uint8_t expectedR
Definition: image.h:56
uint32_t x
Definition: image.h:54
uint8_t actualG
Definition: image.h:61
uint8_t actualA
Definition: image.h:63
uint8_t actualB
Definition: image.h:62
uint8_t actualR
Definition: image.h:60
uint8_t expectedB
Definition: image.h:58
uint32_t y
Definition: image.h:55
Definition: image.h:26
uint32_t height
Definition: image.h:28
uint32_t width
Definition: image.h:27
std::vector< uint8_t > pixels
Definition: image.h:29
Definition: image.h:38
uint32_t width
Definition: image.h:39
std::vector< uint8_t > y
Definition: image.h:41
std::vector< uint8_t > u
Definition: image.h:42
uint32_t height
Definition: image.h:40
std::vector< uint8_t > v
Definition: image.h:43
Definition: image.h:38