image::pixel::Specification _pixelSpecificationFromColorSpace()

in cpp/spectrum/plugins/jpeg/LibJpegDecompressor.cpp [38:56]


image::pixel::Specification _pixelSpecificationFromColorSpace(
    J_COLOR_SPACE colorSpace,
    int componentsCount) {
  if (colorSpace == JCS_GRAYSCALE && componentsCount == 1) {
    return image::pixel::specifications::Gray;
  } else if (
      (colorSpace == JCS_RGB || colorSpace == JCS_EXT_RGB) &&
      componentsCount == 3) {
    return image::pixel::specifications::RGB;
  } else if (colorSpace == JCS_YCbCr && componentsCount == 3) {
    return image::pixel::specifications::yCbCr;
  } else {
    SPECTRUM_ERROR_FORMAT(
        codecs::error::DecompressorUnexpectedPixelSpecification,
        "colorSpace: %d, components: %d",
        colorSpace,
        componentsCount);
  }
}