gem5 v24.0.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. | |
Pixel | toPixel (const uint8_t *rfb) const |
Get a Pixel representation by reading a word from memory. | |
uint32_t | fromPixel (const Pixel &pixel) const |
Convert a Pixel into a color word. | |
void | fromPixel (uint8_t *rfb, const Pixel &pixel) const |
Convert a pixel into a color word and store the resulting word in memory. | |
uint32_t | readWord (const uint8_t *p) const |
Read a word of a given length and endianness from memory. | |
void | writeWord (uint8_t *p, uint32_t word) const |
Write a word of a given length and endianness to memory. | |
Public Attributes | |
unsigned | length |
Bytes per pixel when stored in memory (including padding) | |
unsigned | depth |
Number of bits used to represent one pixel value (excluding padding). | |
ByteOrder | byte_order |
Byte order when stored to memory. | |
Channel | ch_r |
Red channel conversion helper. | |
Channel | ch_g |
Green channel conversion helper. | |
Channel | ch_b |
Blue channel conversion helper. | |
Static Public Attributes | |
static const PixelConverter | rgba8888_le |
Predefined 32-bit RGB (red in least significant bits, 8 bits/channel, little endian) conversion helper. | |
static const PixelConverter | rgb565_le |
Predefined 16-bit RGB565 (red in least significant bits, little endian) conversion helper. | |
static const PixelConverter | rgba8888_be |
Predefined 32-bit RGB (red in least significant bits, 8 bits/channel, big endian) conversion helper. | |
static const PixelConverter | rgb565_be |
Predefined 16-bit RGB565 (red in least significant bits, big endian) conversion helper. | |
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).
gem5::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 150 of file pixel.hh.
References gem5::Pixel::blue, ch_b, ch_g, ch_r, gem5::PixelConverter::Channel::fromPixel(), gem5::Pixel::green, and gem5::Pixel::red.
Referenced by gem5::FrameBuffer::copyOut(), fromPixel(), gem5::VncServer::sendFrameBufferUpdate(), and TEST().
|
inline |
Convert a pixel into a color word and store the resulting word in memory.
Definition at line 160 of file pixel.hh.
References fromPixel(), and writeWord().
uint32_t gem5::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 76 of file pixel.cc.
References byte_order, gem5::ArmISA::i, length, and gem5::MipsISA::p.
Referenced by toPixel().
|
inline |
Get a Pixel representation by reading a word from memory.
Definition at line 145 of file pixel.hh.
References readWord(), and toPixel().
|
inline |
Get the Pixel representation of a color word.
Definition at line 138 of file pixel.hh.
References ch_b, ch_g, ch_r, and gem5::PixelConverter::Channel::toPixel().
Referenced by gem5::FrameBuffer::copyIn(), gem5::HDLcd::lineNext(), gem5::HDLcd::pxlNext(), gem5::to_number(), and toPixel().
void gem5::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 92 of file pixel.cc.
References byte_order, gem5::ArmISA::i, length, and gem5::MipsISA::p.
Referenced by fromPixel().
ByteOrder gem5::PixelConverter::byte_order |
Byte order when stored to memory.
Definition at line 192 of file pixel.hh.
Referenced by readWord(), gem5::VncServer::VncServer(), and writeWord().
Channel gem5::PixelConverter::ch_b |
Blue channel conversion helper.
Definition at line 199 of file pixel.hh.
Referenced by fromPixel(), toPixel(), and gem5::VncServer::VncServer().
Channel gem5::PixelConverter::ch_g |
Green channel conversion helper.
Definition at line 197 of file pixel.hh.
Referenced by fromPixel(), toPixel(), and gem5::VncServer::VncServer().
Channel gem5::PixelConverter::ch_r |
Red channel conversion helper.
Definition at line 195 of file pixel.hh.
Referenced by fromPixel(), toPixel(), and gem5::VncServer::VncServer().
unsigned gem5::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 190 of file pixel.hh.
Referenced by gem5::VncServer::VncServer().
unsigned gem5::PixelConverter::length |
Bytes per pixel when stored in memory (including padding)
Definition at line 184 of file pixel.hh.
Referenced by gem5::FrameBuffer::copyIn(), gem5::FrameBuffer::copyOut(), gem5::HDLcd::lineNext(), PixelConverter(), gem5::HDLcd::pxlNext(), readWord(), gem5::VncServer::sendFrameBufferUpdate(), gem5::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 203 of file pixel.hh.
Referenced by gem5::operator<<(), TEST(), TEST(), TEST(), and gem5::to_number().