gem5
|
Configurable RGB pixel converter. More...
#include <framebuffer.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=LittleEndianByteOrder) | |
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).
Definition at line 91 of file framebuffer.hh.
PixelConverter::PixelConverter | ( | unsigned | length, |
unsigned | ro, | ||
unsigned | go, | ||
unsigned | bo, | ||
unsigned | rw, | ||
unsigned | gw, | ||
unsigned | bw, | ||
ByteOrder | byte_order = LittleEndianByteOrder |
||
) |
Definition at line 57 of file framebuffer.cc.
References length.
|
inline |
Convert a Pixel into a color word.
Definition at line 149 of file framebuffer.hh.
References Pixel::blue, ch_b, ch_g, ch_r, PixelConverter::Channel::fromPixel(), Pixel::green, and Pixel::red.
Referenced by FrameBuffer::copyOut(), fromPixel(), main(), and VncServer::sendFrameBufferUpdate().
|
inline |
Convert a pixel into a color word and store the resulting word in memory.
Definition at line 159 of file framebuffer.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 79 of file framebuffer.cc.
References byte_order, ArmISA::i, length, and LittleEndianByteOrder.
Referenced by toPixel().
|
inline |
Get the Pixel representation of a color word.
Definition at line 137 of file framebuffer.hh.
References ch_b, ch_g, ch_r, and PixelConverter::Channel::toPixel().
Referenced by FrameBuffer::copyIn(), HDLcd::pxlNext(), to_number(), and toPixel().
|
inline |
Get a Pixel representation by reading a word from memory.
Definition at line 144 of file framebuffer.hh.
References readWord(), 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 95 of file framebuffer.cc.
References byte_order, ArmISA::i, length, and LittleEndianByteOrder.
Referenced by fromPixel().
ByteOrder PixelConverter::byte_order |
Byte order when stored to memory.
Definition at line 191 of file framebuffer.hh.
Referenced by readWord(), VncServer::VncServer(), and writeWord().
Channel PixelConverter::ch_b |
Blue channel conversion helper.
Definition at line 198 of file framebuffer.hh.
Referenced by fromPixel(), toPixel(), and VncServer::VncServer().
Channel PixelConverter::ch_g |
Green channel conversion helper.
Definition at line 196 of file framebuffer.hh.
Referenced by fromPixel(), toPixel(), and VncServer::VncServer().
Channel PixelConverter::ch_r |
Red channel conversion helper.
Definition at line 194 of file framebuffer.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 189 of file framebuffer.hh.
Referenced by VncServer::VncServer().
unsigned PixelConverter::length |
Bytes per pixel when stored in memory (including padding)
Definition at line 183 of file framebuffer.hh.
Referenced by FrameBuffer::copyIn(), FrameBuffer::copyOut(), PixelConverter(), HDLcd::pxlNext(), readWord(), VncServer::sendFrameBufferUpdate(), VncServer::VncServer(), and writeWord().
|
static |
Predefined 16-bit RGB565 (red in least significant bits, big endian) conversion helper.
Definition at line 212 of file framebuffer.hh.
|
static |
Predefined 16-bit RGB565 (red in least significant bits, little endian) conversion helper.
Definition at line 205 of file framebuffer.hh.
Referenced by main().
|
static |
Predefined 32-bit RGB (red in least significant bits, 8 bits/channel, big endian) conversion helper.
Definition at line 209 of file framebuffer.hh.
Referenced by main().
|
static |
Predefined 32-bit RGB (red in least significant bits, 8 bits/channel, little endian) conversion helper.
Definition at line 202 of file framebuffer.hh.
Referenced by main(), operator<<(), and to_number().