// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs
// Based on "crates/store/re_types/definitions/rerun/datatypes/pixel_format.fbs".

#pragma once

#include "../result.hpp"

#include <cstdint>
#include <memory>

namespace arrow {
    /// \private
    template <typename T>
    class NumericBuilder;

    class Array;
    class DataType;
    class UInt8Type;
    using UInt8Builder = NumericBuilder<UInt8Type>;
} // namespace arrow

namespace rerun::datatypes {
    /// **Datatype**: Specifieds a particular format of an `archetypes::Image`.
    ///
    /// Most images can be described by a `datatypes::ColorModel` and a `datatypes::ChannelDatatype`,
    /// e.g. `RGB` and `U8` respectively.
    ///
    /// However, some image formats has chroma downsampling and/or
    /// use differing number of bits per channel, and that is what this `datatypes::PixelFormat` is for.
    ///
    /// All these formats support random access.
    ///
    /// For more compressed image formats, see `archetypes::EncodedImage`.
    enum class PixelFormat : uint8_t {

        /// NV12 (aka Y_UV12) is a YUV 4:2:0 chroma downsampled format with 12 bits per pixel and 8 bits per channel.
        ///
        /// First comes entire image in Y in one plane,
        /// followed by a plane with interleaved lines ordered as U0, V0, U1, V1, etc.
        NV12 = 26,

        /// YUY2 (aka YUYV or YUYV16), is a YUV 4:2:2 chroma downsampled format with 16 bits per pixel and 8 bits per channel.
        ///
        /// The order of the channels is Y0, U0, Y1, V0, all in the same plane.
        YUY2 = 27,
    };
} // namespace rerun::datatypes

namespace rerun {
    template <typename T>
    struct Loggable;

    /// \private
    template <>
    struct Loggable<datatypes::PixelFormat> {
        static constexpr const char Name[] = "rerun.datatypes.PixelFormat";

        /// Returns the arrow data type this type corresponds to.
        static const std::shared_ptr<arrow::DataType>& arrow_datatype();

        /// Serializes an array of `rerun::datatypes::PixelFormat` into an arrow array.
        static Result<std::shared_ptr<arrow::Array>> to_arrow(
            const datatypes::PixelFormat* instances, size_t num_instances
        );

        /// Fills an arrow array builder with an array of this type.
        static rerun::Error fill_arrow_array_builder(
            arrow::UInt8Builder* builder, const datatypes::PixelFormat* elements,
            size_t num_elements
        );
    };
} // namespace rerun
