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

Method getRGBPixelFormat

YUViewLib/src/ffmpeg/AVPixFmtDescriptorWrapper.cpp:295–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

293}
294
295video::rgb::PixelFormatRGB AVPixFmtDescriptorWrapper::getRGBPixelFormat() const
296{
297 if (this->getRawFormat() == video::RawFormat::YUV || !flagsSupported(this->flags))
298 return {};
299
300 auto bitsPerSample = comp[0].depth;
301 for (int i = 1; i < nb_components; i++)
302 if (comp[i].depth != bitsPerSample)
303 // Varying bit depths for components is not supported
304 return {};
305
306 if (this->flags.bitwisePacked)
307 // Maybe this could be supported but I don't think that any decoder actually uses this.
308 // If you encounter a format that does not work because of this check please let us know.
309 return {};
310
311 // The only possible order of planes seems to be RGB(A)
312 auto dataLayout = this->flags.planar ? video::DataLayout::Planar : video::DataLayout::Packed;
313 auto alphaMode =
314 this->flags.hasAlphaPlane ? video::rgb::AlphaMode::Last : video::rgb::AlphaMode::None;
315 auto endianness = this->flags.bigEndian ? video::Endianness::Big : video::Endianness::Little;
316
317 return video::rgb::PixelFormatRGB(
318 bitsPerSample, dataLayout, video::rgb::ChannelOrder::RGB, alphaMode, endianness);
319}
320
321bool AVPixFmtDescriptorWrapper::setValuesFromPixelFormatYUV(PixelFormatYUV fmt)
322{

Callers 1

Calls 3

getRawFormatMethod · 0.95
flagsSupportedFunction · 0.85
PixelFormatRGBClass · 0.85

Tested by

no test coverage detected