blob: 336de71701fd70e65af15cd11ff4d8daab71a6cf [file] [log] [blame]
/*
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef SAMPLES_RISP4ML_COMMON_CONSTANTS_H_
#define SAMPLES_RISP4ML_COMMON_CONSTANTS_H_
#include <stdint.h>
// Input and output are expected to be 8 bits per pixel
static const uint16_t kPipeInputBpp = 8;
static const uint16_t kPipeOutputBpp = 8;
// TODO(b/149969920): modify sign,bitwidths and internal precision for risp4ml
// Assume 8.8 format
static const uint16_t kRawPipelineBpp = 16;
static const uint16_t kRawPipelineInteger = 8;
static const uint16_t kRawPipelineFraction = 8;
// max = 0xFF.FF = 65535
// represnting 255 + 255/256
static const uint16_t kRawPipelineMaxVal = 0xFFFF;
static const uint16_t kRawPipelineMinVal = 0;
// min fraction = 0x00.01 = 1/256
static const uint16_t kRawPipelineMinFraction = 1;
// BayerIndex defines the order in 2x2 normal Bayer quad.
// +---+---+
// | R | Gr|
// +---+---+
// | Gb| B |
// +---+---+
typedef enum {
kR = 0,
kGr = 1,
kGb = 2,
kB = 3,
} BayerIndex;
typedef enum {
kRggb = 0,
kGrbg = 1,
kGbrg = 2,
kBggr = 3,
} BayerPattern;
#define kNumBayerPatterns 4
// TODO(alexkaplan): Add a way to update this based on the image
// or to make sure the BayerType corresponds to the loaded image
static const BayerPattern kBayerType = kRggb;
#endif // SAMPLES_RISP4ML_COMMON_CONSTANTS_H_