gem5  v22.1.0.0
Classes | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
gem5::PixelConverter Class Reference

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...
 

Detailed Description

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 pixel.hh.

Constructor & Destructor Documentation

◆ PixelConverter()

gem5::PixelConverter::PixelConverter ( unsigned  length,
unsigned  ro,
unsigned  go,
unsigned  bo,
unsigned  rw,
unsigned  gw,
unsigned  bw,
ByteOrder  byte_order = ByteOrder::little 
)

Definition at line 54 of file pixel.cc.

References length.

Member Function Documentation

◆ fromPixel() [1/2]

uint32_t gem5::PixelConverter::fromPixel ( const Pixel pixel) const
inline

◆ fromPixel() [2/2]

void gem5::PixelConverter::fromPixel ( uint8_t *  rfb,
const Pixel pixel 
) const
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().

◆ readWord()

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.

Parameters
pPointer to the first byte in the word.
Returns
Word in host endianness.

Definition at line 76 of file pixel.cc.

References byte_order, gem5::ArmISA::i, length, and gem5::VegaISA::p.

Referenced by toPixel().

◆ toPixel() [1/2]

Pixel gem5::PixelConverter::toPixel ( const uint8_t *  rfb) const
inline

Get a Pixel representation by reading a word from memory.

Definition at line 145 of file pixel.hh.

References readWord(), and toPixel().

◆ toPixel() [2/2]

Pixel gem5::PixelConverter::toPixel ( uint32_t  word) const
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().

◆ writeWord()

void gem5::PixelConverter::writeWord ( uint8_t *  p,
uint32_t  word 
) const

Write a word of a given length and endianness to memory.

Parameters
pPointer to the first byte in memory.
wordWord to store (host endianness).

Definition at line 92 of file pixel.cc.

References byte_order, gem5::ArmISA::i, length, and gem5::VegaISA::p.

Referenced by fromPixel().

Member Data Documentation

◆ byte_order

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().

◆ ch_b

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().

◆ ch_g

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().

◆ ch_r

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().

◆ depth

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().

◆ length

unsigned gem5::PixelConverter::length

◆ rgb565_be

const PixelConverter gem5::PixelConverter::rgb565_be
static

Predefined 16-bit RGB565 (red in least significant bits, big endian) conversion helper.

Definition at line 213 of file pixel.hh.

◆ rgb565_le

const PixelConverter gem5::PixelConverter::rgb565_le
static

Predefined 16-bit RGB565 (red in least significant bits, little endian) conversion helper.

Definition at line 206 of file pixel.hh.

Referenced by TEST().

◆ rgba8888_be

const PixelConverter gem5::PixelConverter::rgba8888_be
static

Predefined 32-bit RGB (red in least significant bits, 8 bits/channel, big endian) conversion helper.

Definition at line 210 of file pixel.hh.

Referenced by TEST().

◆ rgba8888_le

const PixelConverter gem5::PixelConverter::rgba8888_le
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(), and gem5::to_number().


The documentation for this class was generated from the following files:

Generated on Wed Dec 21 2022 10:23:12 for gem5 by doxygen 1.9.1