MCPcopy Create free account
hub / github.com/IENT/YUView / bytesPerFrame

Method bytesPerFrame

YUViewLib/src/video/rgb/PixelFormatRGB.cpp:124–137  ·  view source on GitHub ↗

Get the number of bytes for a frame with this RGB format and the given size */

Source from the content-addressed store, hash-verified

122/* Get the number of bytes for a frame with this RGB format and the given size
123 */
124std::size_t PixelFormatRGB::bytesPerFrame(Size frameSize) const
125{
126 auto bpsValid = this->bitsPerSample >= 8 && this->bitsPerSample <= 16;
127 if (!bpsValid || !frameSize.isValid())
128 return 0;
129
130 auto numSamples = std::size_t(frameSize.height) * std::size_t(frameSize.width);
131 auto nrBytes = numSamples * this->nrChannels() * ((this->bitsPerSample + 7) / 8);
132 DEBUG_RGB_FORMAT("PixelFormatRGB::bytesPerFrame samples %d channels %d bytes %d",
133 int(numSamples),
134 this->nrChannels(),
135 nrBytes);
136 return nrBytes;
137}
138
139int PixelFormatRGB::getChannelPosition(Channel channel) const
140{

Callers 2

getBytesPerFrameMethod · 0.45

Calls 2

nrChannelsMethod · 0.95
isValidMethod · 0.45

Tested by

no test coverage detected