// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
//   protoc-gen-ts_proto  v1.181.1
//   protoc               v3.21.12
// source: ImgFrame.proto
/* eslint-disable */
import Long from "long";
import _m0 from "protobufjs/minimal";
import { CameraSettings, ImgTransformation, Timestamp } from "./common";
export const protobufPackage = "dai.proto.img_frame";
export var Type;
(function (Type) {
    /** YUV422i - interleaved 8 bit */
    Type[Type["YUV422i"] = 0] = "YUV422i";
    /** YUV444p - planar 4:4:4 format */
    Type[Type["YUV444p"] = 1] = "YUV444p";
    /** YUV420p - planar 4:2:0 format */
    Type[Type["YUV420p"] = 2] = "YUV420p";
    /** YUV422p - planar 8 bit */
    Type[Type["YUV422p"] = 3] = "YUV422p";
    /** YUV400p - 8-bit greyscale */
    Type[Type["YUV400p"] = 4] = "YUV400p";
    /** RGBA8888 - RGBA interleaved stored in 32 bit word */
    Type[Type["RGBA8888"] = 5] = "RGBA8888";
    /** RGB161616 - Planar 16 bit RGB data */
    Type[Type["RGB161616"] = 6] = "RGB161616";
    /** RGB888p - Planar 8 bit RGB data */
    Type[Type["RGB888p"] = 7] = "RGB888p";
    /** BGR888p - Planar 8 bit BGR data */
    Type[Type["BGR888p"] = 8] = "BGR888p";
    /** RGB888i - Interleaved 8 bit RGB data */
    Type[Type["RGB888i"] = 9] = "RGB888i";
    /** BGR888i - Interleaved 8 bit BGR data */
    Type[Type["BGR888i"] = 10] = "BGR888i";
    /** LUT2 - 1 bit  per pixel, Lookup table (used for graphics layers) */
    Type[Type["LUT2"] = 11] = "LUT2";
    /** LUT4 - 2 bits per pixel, Lookup table (used for graphics layers) */
    Type[Type["LUT4"] = 12] = "LUT4";
    /** LUT16 - 4 bits per pixel, Lookup table (used for graphics layers) */
    Type[Type["LUT16"] = 13] = "LUT16";
    /** RAW16 - save any raw type (8, 10, 12bit) on 16 bits */
    Type[Type["RAW16"] = 14] = "RAW16";
    /** RAW14 - 14bit value in 16bit storage */
    Type[Type["RAW14"] = 15] = "RAW14";
    /** RAW12 - 12bit value in 16bit storage */
    Type[Type["RAW12"] = 16] = "RAW12";
    /** RAW10 - 10bit value in 16bit storage */
    Type[Type["RAW10"] = 17] = "RAW10";
    Type[Type["RAW8"] = 18] = "RAW8";
    /** PACK10 - SIPP 10bit packed format */
    Type[Type["PACK10"] = 19] = "PACK10";
    /** PACK12 - SIPP 12bit packed format */
    Type[Type["PACK12"] = 20] = "PACK12";
    Type[Type["YUV444i"] = 21] = "YUV444i";
    Type[Type["NV12"] = 22] = "NV12";
    Type[Type["NV21"] = 23] = "NV21";
    /** BITSTREAM - used for video encoder bitstream */
    Type[Type["BITSTREAM"] = 24] = "BITSTREAM";
    Type[Type["HDR"] = 25] = "HDR";
    /** RGBF16F16F16p - Planar FP16 RGB data */
    Type[Type["RGBF16F16F16p"] = 26] = "RGBF16F16F16p";
    /** BGRF16F16F16p - Planar FP16 BGR data */
    Type[Type["BGRF16F16F16p"] = 27] = "BGRF16F16F16p";
    /** RGBF16F16F16i - Interleaved FP16 RGB data */
    Type[Type["RGBF16F16F16i"] = 28] = "RGBF16F16F16i";
    /** BGRF16F16F16i - Interleaved FP16 BGR data */
    Type[Type["BGRF16F16F16i"] = 29] = "BGRF16F16F16i";
    /** GRAY8 - 8 bit grayscale (1 plane) */
    Type[Type["GRAY8"] = 30] = "GRAY8";
    /** GRAYF16 - FP16 grayscale (normalized) */
    Type[Type["GRAYF16"] = 31] = "GRAYF16";
    /** RAW32 - 32 bits raw */
    Type[Type["RAW32"] = 32] = "RAW32";
    Type[Type["NONE"] = 33] = "NONE";
    Type[Type["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(Type || (Type = {}));
export function typeFromJSON(object) {
    switch (object) {
        case 0:
        case "YUV422i":
            return Type.YUV422i;
        case 1:
        case "YUV444p":
            return Type.YUV444p;
        case 2:
        case "YUV420p":
            return Type.YUV420p;
        case 3:
        case "YUV422p":
            return Type.YUV422p;
        case 4:
        case "YUV400p":
            return Type.YUV400p;
        case 5:
        case "RGBA8888":
            return Type.RGBA8888;
        case 6:
        case "RGB161616":
            return Type.RGB161616;
        case 7:
        case "RGB888p":
            return Type.RGB888p;
        case 8:
        case "BGR888p":
            return Type.BGR888p;
        case 9:
        case "RGB888i":
            return Type.RGB888i;
        case 10:
        case "BGR888i":
            return Type.BGR888i;
        case 11:
        case "LUT2":
            return Type.LUT2;
        case 12:
        case "LUT4":
            return Type.LUT4;
        case 13:
        case "LUT16":
            return Type.LUT16;
        case 14:
        case "RAW16":
            return Type.RAW16;
        case 15:
        case "RAW14":
            return Type.RAW14;
        case 16:
        case "RAW12":
            return Type.RAW12;
        case 17:
        case "RAW10":
            return Type.RAW10;
        case 18:
        case "RAW8":
            return Type.RAW8;
        case 19:
        case "PACK10":
            return Type.PACK10;
        case 20:
        case "PACK12":
            return Type.PACK12;
        case 21:
        case "YUV444i":
            return Type.YUV444i;
        case 22:
        case "NV12":
            return Type.NV12;
        case 23:
        case "NV21":
            return Type.NV21;
        case 24:
        case "BITSTREAM":
            return Type.BITSTREAM;
        case 25:
        case "HDR":
            return Type.HDR;
        case 26:
        case "RGBF16F16F16p":
            return Type.RGBF16F16F16p;
        case 27:
        case "BGRF16F16F16p":
            return Type.BGRF16F16F16p;
        case 28:
        case "RGBF16F16F16i":
            return Type.RGBF16F16F16i;
        case 29:
        case "BGRF16F16F16i":
            return Type.BGRF16F16F16i;
        case 30:
        case "GRAY8":
            return Type.GRAY8;
        case 31:
        case "GRAYF16":
            return Type.GRAYF16;
        case 32:
        case "RAW32":
            return Type.RAW32;
        case 33:
        case "NONE":
            return Type.NONE;
        case -1:
        case "UNRECOGNIZED":
        default:
            return Type.UNRECOGNIZED;
    }
}
export function typeToJSON(object) {
    switch (object) {
        case Type.YUV422i:
            return "YUV422i";
        case Type.YUV444p:
            return "YUV444p";
        case Type.YUV420p:
            return "YUV420p";
        case Type.YUV422p:
            return "YUV422p";
        case Type.YUV400p:
            return "YUV400p";
        case Type.RGBA8888:
            return "RGBA8888";
        case Type.RGB161616:
            return "RGB161616";
        case Type.RGB888p:
            return "RGB888p";
        case Type.BGR888p:
            return "BGR888p";
        case Type.RGB888i:
            return "RGB888i";
        case Type.BGR888i:
            return "BGR888i";
        case Type.LUT2:
            return "LUT2";
        case Type.LUT4:
            return "LUT4";
        case Type.LUT16:
            return "LUT16";
        case Type.RAW16:
            return "RAW16";
        case Type.RAW14:
            return "RAW14";
        case Type.RAW12:
            return "RAW12";
        case Type.RAW10:
            return "RAW10";
        case Type.RAW8:
            return "RAW8";
        case Type.PACK10:
            return "PACK10";
        case Type.PACK12:
            return "PACK12";
        case Type.YUV444i:
            return "YUV444i";
        case Type.NV12:
            return "NV12";
        case Type.NV21:
            return "NV21";
        case Type.BITSTREAM:
            return "BITSTREAM";
        case Type.HDR:
            return "HDR";
        case Type.RGBF16F16F16p:
            return "RGBF16F16F16p";
        case Type.BGRF16F16F16p:
            return "BGRF16F16F16p";
        case Type.RGBF16F16F16i:
            return "RGBF16F16F16i";
        case Type.BGRF16F16F16i:
            return "BGRF16F16F16i";
        case Type.GRAY8:
            return "GRAY8";
        case Type.GRAYF16:
            return "GRAYF16";
        case Type.RAW32:
            return "RAW32";
        case Type.NONE:
            return "NONE";
        case Type.UNRECOGNIZED:
        default:
            return "UNRECOGNIZED";
    }
}
function createBaseImgFrame() {
    return {
        ts: undefined,
        tsDevice: undefined,
        sequenceNum: 0,
        fb: undefined,
        sourceFb: undefined,
        cam: undefined,
        HFovDegrees: 0,
        instanceNum: 0,
        transformation: undefined,
        category: 0,
        data: new Uint8Array(0),
    };
}
export const ImgFrame = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.ts !== undefined) {
            Timestamp.encode(message.ts, writer.uint32(10).fork()).ldelim();
        }
        if (message.tsDevice !== undefined) {
            Timestamp.encode(message.tsDevice, writer.uint32(18).fork()).ldelim();
        }
        if (message.sequenceNum !== 0) {
            writer.uint32(24).int64(message.sequenceNum);
        }
        if (message.fb !== undefined) {
            Specs.encode(message.fb, writer.uint32(34).fork()).ldelim();
        }
        if (message.sourceFb !== undefined) {
            Specs.encode(message.sourceFb, writer.uint32(42).fork()).ldelim();
        }
        if (message.cam !== undefined) {
            CameraSettings.encode(message.cam, writer.uint32(50).fork()).ldelim();
        }
        if (message.HFovDegrees !== 0) {
            writer.uint32(61).float(message.HFovDegrees);
        }
        if (message.instanceNum !== 0) {
            writer.uint32(64).uint32(message.instanceNum);
        }
        if (message.transformation !== undefined) {
            ImgTransformation.encode(message.transformation, writer.uint32(74).fork()).ldelim();
        }
        if (message.category !== 0) {
            writer.uint32(80).uint32(message.category);
        }
        if (message.data.length !== 0) {
            writer.uint32(90).bytes(message.data);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseImgFrame();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.ts = Timestamp.decode(reader, reader.uint32());
                    continue;
                case 2:
                    if (tag !== 18) {
                        break;
                    }
                    message.tsDevice = Timestamp.decode(reader, reader.uint32());
                    continue;
                case 3:
                    if (tag !== 24) {
                        break;
                    }
                    message.sequenceNum = longToNumber(reader.int64());
                    continue;
                case 4:
                    if (tag !== 34) {
                        break;
                    }
                    message.fb = Specs.decode(reader, reader.uint32());
                    continue;
                case 5:
                    if (tag !== 42) {
                        break;
                    }
                    message.sourceFb = Specs.decode(reader, reader.uint32());
                    continue;
                case 6:
                    if (tag !== 50) {
                        break;
                    }
                    message.cam = CameraSettings.decode(reader, reader.uint32());
                    continue;
                case 7:
                    if (tag !== 61) {
                        break;
                    }
                    message.HFovDegrees = reader.float();
                    continue;
                case 8:
                    if (tag !== 64) {
                        break;
                    }
                    message.instanceNum = reader.uint32();
                    continue;
                case 9:
                    if (tag !== 74) {
                        break;
                    }
                    message.transformation = ImgTransformation.decode(reader, reader.uint32());
                    continue;
                case 10:
                    if (tag !== 80) {
                        break;
                    }
                    message.category = reader.uint32();
                    continue;
                case 11:
                    if (tag !== 90) {
                        break;
                    }
                    message.data = reader.bytes();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            ts: isSet(object.ts) ? Timestamp.fromJSON(object.ts) : undefined,
            tsDevice: isSet(object.tsDevice) ? Timestamp.fromJSON(object.tsDevice) : undefined,
            sequenceNum: isSet(object.sequenceNum) ? globalThis.Number(object.sequenceNum) : 0,
            fb: isSet(object.fb) ? Specs.fromJSON(object.fb) : undefined,
            sourceFb: isSet(object.sourceFb) ? Specs.fromJSON(object.sourceFb) : undefined,
            cam: isSet(object.cam) ? CameraSettings.fromJSON(object.cam) : undefined,
            HFovDegrees: isSet(object.HFovDegrees) ? globalThis.Number(object.HFovDegrees) : 0,
            instanceNum: isSet(object.instanceNum) ? globalThis.Number(object.instanceNum) : 0,
            transformation: isSet(object.transformation) ? ImgTransformation.fromJSON(object.transformation) : undefined,
            category: isSet(object.category) ? globalThis.Number(object.category) : 0,
            data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0),
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.ts !== undefined) {
            obj.ts = Timestamp.toJSON(message.ts);
        }
        if (message.tsDevice !== undefined) {
            obj.tsDevice = Timestamp.toJSON(message.tsDevice);
        }
        if (message.sequenceNum !== 0) {
            obj.sequenceNum = Math.round(message.sequenceNum);
        }
        if (message.fb !== undefined) {
            obj.fb = Specs.toJSON(message.fb);
        }
        if (message.sourceFb !== undefined) {
            obj.sourceFb = Specs.toJSON(message.sourceFb);
        }
        if (message.cam !== undefined) {
            obj.cam = CameraSettings.toJSON(message.cam);
        }
        if (message.HFovDegrees !== 0) {
            obj.HFovDegrees = message.HFovDegrees;
        }
        if (message.instanceNum !== 0) {
            obj.instanceNum = Math.round(message.instanceNum);
        }
        if (message.transformation !== undefined) {
            obj.transformation = ImgTransformation.toJSON(message.transformation);
        }
        if (message.category !== 0) {
            obj.category = Math.round(message.category);
        }
        if (message.data.length !== 0) {
            obj.data = base64FromBytes(message.data);
        }
        return obj;
    },
    create(base) {
        return ImgFrame.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseImgFrame();
        message.ts = (object.ts !== undefined && object.ts !== null) ? Timestamp.fromPartial(object.ts) : undefined;
        message.tsDevice = (object.tsDevice !== undefined && object.tsDevice !== null)
            ? Timestamp.fromPartial(object.tsDevice)
            : undefined;
        message.sequenceNum = object.sequenceNum ?? 0;
        message.fb = (object.fb !== undefined && object.fb !== null) ? Specs.fromPartial(object.fb) : undefined;
        message.sourceFb = (object.sourceFb !== undefined && object.sourceFb !== null)
            ? Specs.fromPartial(object.sourceFb)
            : undefined;
        message.cam = (object.cam !== undefined && object.cam !== null)
            ? CameraSettings.fromPartial(object.cam)
            : undefined;
        message.HFovDegrees = object.HFovDegrees ?? 0;
        message.instanceNum = object.instanceNum ?? 0;
        message.transformation = (object.transformation !== undefined && object.transformation !== null)
            ? ImgTransformation.fromPartial(object.transformation)
            : undefined;
        message.category = object.category ?? 0;
        message.data = object.data ?? new Uint8Array(0);
        return message;
    },
};
function createBaseSpecs() {
    return { type: 0, width: 0, height: 0, stride: 0, bytesPP: 0, p1Offset: 0, p2Offset: 0, p3Offset: 0 };
}
export const Specs = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.type !== 0) {
            writer.uint32(8).int32(message.type);
        }
        if (message.width !== 0) {
            writer.uint32(16).uint32(message.width);
        }
        if (message.height !== 0) {
            writer.uint32(24).uint32(message.height);
        }
        if (message.stride !== 0) {
            writer.uint32(32).uint32(message.stride);
        }
        if (message.bytesPP !== 0) {
            writer.uint32(40).uint32(message.bytesPP);
        }
        if (message.p1Offset !== 0) {
            writer.uint32(48).uint32(message.p1Offset);
        }
        if (message.p2Offset !== 0) {
            writer.uint32(56).uint32(message.p2Offset);
        }
        if (message.p3Offset !== 0) {
            writer.uint32(64).uint32(message.p3Offset);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseSpecs();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 8) {
                        break;
                    }
                    message.type = reader.int32();
                    continue;
                case 2:
                    if (tag !== 16) {
                        break;
                    }
                    message.width = reader.uint32();
                    continue;
                case 3:
                    if (tag !== 24) {
                        break;
                    }
                    message.height = reader.uint32();
                    continue;
                case 4:
                    if (tag !== 32) {
                        break;
                    }
                    message.stride = reader.uint32();
                    continue;
                case 5:
                    if (tag !== 40) {
                        break;
                    }
                    message.bytesPP = reader.uint32();
                    continue;
                case 6:
                    if (tag !== 48) {
                        break;
                    }
                    message.p1Offset = reader.uint32();
                    continue;
                case 7:
                    if (tag !== 56) {
                        break;
                    }
                    message.p2Offset = reader.uint32();
                    continue;
                case 8:
                    if (tag !== 64) {
                        break;
                    }
                    message.p3Offset = reader.uint32();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            type: isSet(object.type) ? typeFromJSON(object.type) : 0,
            width: isSet(object.width) ? globalThis.Number(object.width) : 0,
            height: isSet(object.height) ? globalThis.Number(object.height) : 0,
            stride: isSet(object.stride) ? globalThis.Number(object.stride) : 0,
            bytesPP: isSet(object.bytesPP) ? globalThis.Number(object.bytesPP) : 0,
            p1Offset: isSet(object.p1Offset) ? globalThis.Number(object.p1Offset) : 0,
            p2Offset: isSet(object.p2Offset) ? globalThis.Number(object.p2Offset) : 0,
            p3Offset: isSet(object.p3Offset) ? globalThis.Number(object.p3Offset) : 0,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.type !== 0) {
            obj.type = typeToJSON(message.type);
        }
        if (message.width !== 0) {
            obj.width = Math.round(message.width);
        }
        if (message.height !== 0) {
            obj.height = Math.round(message.height);
        }
        if (message.stride !== 0) {
            obj.stride = Math.round(message.stride);
        }
        if (message.bytesPP !== 0) {
            obj.bytesPP = Math.round(message.bytesPP);
        }
        if (message.p1Offset !== 0) {
            obj.p1Offset = Math.round(message.p1Offset);
        }
        if (message.p2Offset !== 0) {
            obj.p2Offset = Math.round(message.p2Offset);
        }
        if (message.p3Offset !== 0) {
            obj.p3Offset = Math.round(message.p3Offset);
        }
        return obj;
    },
    create(base) {
        return Specs.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseSpecs();
        message.type = object.type ?? 0;
        message.width = object.width ?? 0;
        message.height = object.height ?? 0;
        message.stride = object.stride ?? 0;
        message.bytesPP = object.bytesPP ?? 0;
        message.p1Offset = object.p1Offset ?? 0;
        message.p2Offset = object.p2Offset ?? 0;
        message.p3Offset = object.p3Offset ?? 0;
        return message;
    },
};
function bytesFromBase64(b64) {
    if (globalThis.Buffer) {
        return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
    }
    else {
        const bin = globalThis.atob(b64);
        const arr = new Uint8Array(bin.length);
        for (let i = 0; i < bin.length; ++i) {
            arr[i] = bin.charCodeAt(i);
        }
        return arr;
    }
}
function base64FromBytes(arr) {
    if (globalThis.Buffer) {
        return globalThis.Buffer.from(arr).toString("base64");
    }
    else {
        const bin = [];
        arr.forEach((byte) => {
            bin.push(globalThis.String.fromCharCode(byte));
        });
        return globalThis.btoa(bin.join(""));
    }
}
function longToNumber(long) {
    if (long.gt(globalThis.Number.MAX_SAFE_INTEGER)) {
        throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
    }
    if (long.lt(globalThis.Number.MIN_SAFE_INTEGER)) {
        throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
    }
    return long.toNumber();
}
if (_m0.util.Long !== Long) {
    _m0.util.Long = Long;
    _m0.configure();
}
function isSet(value) {
    return value !== null && value !== undefined;
}
export const protobufName = "ImgFrame";
//# sourceMappingURL=ImgFrame.js.map