| 293 | } |
| 294 | |
| 295 | video::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 | |
| 321 | bool AVPixFmtDescriptorWrapper::setValuesFromPixelFormatYUV(PixelFormatYUV fmt) |
| 322 | { |
no test coverage detected