gem5
v20.1.0.0
|
Configurable RGB pixel converter. More...
#include <pixel.hh>
Classes | |
struct | Channel |
Color channel conversion and scaling helper class. More... | |
Public Member Functions | |
PixelConverter (unsigned length, unsigned ro, unsigned go, unsigned bo, unsigned rw, unsigned gw, unsigned bw, ByteOrder byte_order=ByteOrder::little) | |
Pixel | toPixel (uint32_t word) const |
Get the Pixel representation of a color word. More... | |
Pixel | toPixel (const uint8_t *rfb) const |
Get a Pixel representation by reading a word from memory. More... | |
uint32_t | fromPixel (const Pixel &pixel) const |
Convert a Pixel into a color word. More... | |
void | fromPixel (uint8_t *rfb, const Pixel &pixel) const |
Convert a pixel into a color word and store the resulting word in memory. More... | |
uint32_t | readWord (const uint8_t *p) const |
Read a word of a given length and endianness from memory. More... | |
void | writeWord (uint8_t *p, uint32_t word) const |
Write a word of a given length and endianness to memory. More... | |
Public Attributes | |
unsigned | length |
Bytes per pixel when stored in memory (including padding) More... | |
unsigned | depth |
Number of bits used to represent one pixel value (excluding padding). More... | |
ByteOrder | byte_order |
Byte order when stored to memory. More... | |
Channel | ch_r |
Red channel conversion helper. More... | |
Channel | ch_g |
Green channel conversion helper. More... | |
Channel | ch_b |
Blue channel conversion helper. More... | |
Static Public Attributes | |
static const PixelConverter | rgba8888_le |
Predefined 32-bit RGB (red in least significant bits, 8 bits/channel, little endian) conversion helper. More... | |
static const PixelConverter | rgb565_le |
Predefined 16-bit RGB565 (red in least significant bits, little endian) conversion helper. More... | |
static const PixelConverter | rgba8888_be |
Predefined 32-bit RGB (red in least significant bits, 8 bits/channel, big endian) conversion helper. More... | |
static const PixelConverter | rgb565_be |
Predefined 16-bit RGB565 (red in least significant bits, big endian) conversion helper. More... | |
Configurable RGB pixel converter.
This class converts between external RGB representations and gem5's internal Pixel representation. The class assumes that pixels are stored in a word of configurable length (up to 32 bits). Individual pixels are assumed to be represented by contiguous bit ranges in the word (i.e., it is possible to shift and mask out a contiguous bit range for each pixel).
PixelConverter::PixelConverter | ( | unsigned | length, |
unsigned | ro, | ||
unsigned | go, | ||
unsigned | bo, | ||
unsigned | rw, | ||
unsigned | gw, | ||
unsigned | bw, | ||
ByteOrder | byte_order = ByteOrder::little |
||
) |
|
inline |
Convert a Pixel into a color word.
Definition at line 145 of file pixel.hh.
References Pixel::blue, ch_b, ch_g, ch_r, PixelConverter::Channel::fromPixel(), Pixel::green, and Pixel::red.
Referenced by FrameBuffer::copyOut(), fromPixel(), VncServer::sendFrameBufferUpdate(), and TEST().
|
inline |
Convert a pixel into a color word and store the resulting word in memory.
Definition at line 155 of file pixel.hh.
References fromPixel(), and writeWord().
uint32_t PixelConverter::readWord | ( | const uint8_t * | p | ) | const |
Read a word of a given length and endianness from memory.
The number of bytes read from memory is determined by the length of a color word. Note that some of the bytes may be padding.
p | Pointer to the first byte in the word. |
Definition at line 73 of file pixel.cc.
References byte_order, ArmISA::i, length, and MipsISA::p.
Referenced by toPixel().
|
inline |
Get a Pixel representation by reading a word from memory.
Definition at line 140 of file pixel.hh.
References readWord(), and toPixel().
|
inline |
Get the Pixel representation of a color word.
Definition at line 133 of file pixel.hh.
References ch_b, ch_g, ch_r, and PixelConverter::Channel::toPixel().
Referenced by FrameBuffer::copyIn(), HDLcd::pxlNext(), to_number(), and toPixel().
void PixelConverter::writeWord | ( | uint8_t * | p, |
uint32_t | word | ||
) | const |
Write a word of a given length and endianness to memory.
p | Pointer to the first byte in memory. |
word | Word to store (host endianness). |
Definition at line 89 of file pixel.cc.
References byte_order, ArmISA::i, length, and MipsISA::p.
Referenced by fromPixel().
ByteOrder PixelConverter::byte_order |
Byte order when stored to memory.
Definition at line 187 of file pixel.hh.
Referenced by readWord(), VncServer::VncServer(), and writeWord().
Channel PixelConverter::ch_b |
Blue channel conversion helper.
Definition at line 194 of file pixel.hh.
Referenced by fromPixel(), toPixel(), and VncServer::VncServer().
Channel PixelConverter::ch_g |
Green channel conversion helper.
Definition at line 192 of file pixel.hh.
Referenced by fromPixel(), toPixel(), and VncServer::VncServer().
Channel PixelConverter::ch_r |
Red channel conversion helper.
Definition at line 190 of file pixel.hh.
Referenced by fromPixel(), toPixel(), and VncServer::VncServer().
unsigned PixelConverter::depth |
Number of bits used to represent one pixel value (excluding padding).
This could be less than length * 8 if the pixel value is padded.
Definition at line 185 of file pixel.hh.
Referenced by VncServer::VncServer().
unsigned PixelConverter::length |
Bytes per pixel when stored in memory (including padding)
Definition at line 179 of file pixel.hh.
Referenced by FrameBuffer::copyIn(), FrameBuffer::copyOut(), PixelConverter(), HDLcd::pxlNext(), readWord(), VncServer::sendFrameBufferUpdate(), VncServer::VncServer(), and writeWord().
|
static |
|
static |
|
static |
|
static |
Predefined 32-bit RGB (red in least significant bits, 8 bits/channel, little endian) conversion helper.
Definition at line 198 of file pixel.hh.
Referenced by operator<<(), TEST(), and to_number().