diff --git a/AIApplication/ACLHelloWorld/README.md b/AIApplication/ACLHelloWorld/README.md new file mode 100644 index 0000000000000000000000000000000000000000..0665691afc701f116d077c3b19d0a13d206f46d6 --- /dev/null +++ b/AIApplication/ACLHelloWorld/README.md @@ -0,0 +1,98 @@ +# Hello World! + +#### 样例介绍 + +基于AscendCL接口的HelloWorld应用,仅包含运行管理资源申请与释放功能。 + +本样例涉及以下运行管理资源: + +- Device:指安装了昇腾AI处理器的硬件设备,提供NN(Neural Network)计算能力。 +- Context:Context在Device下,一个Context一定属于一个唯一的Device。Context作为一个容器,管理了所有对象(包括Stream、设备内存等)的生命周期。 +- Stream:Stream用于维护一些异步操作的执行顺序,确保按照应用程序中的代码调用顺序在Device上执行。Stream是Device上的执行流,在同一个Stream中的任务执行严格保序。 + +#### 样例下载 + +可以使用以下两种方式下载,请选择其中一种进行源码准备。 + + - 命令行方式下载(**下载时间较长,但步骤简单**)。 + + ``` + # 登录开发板,HwHiAiUser用户命令行中执行以下命令下载源码仓。 + cd ${HOME} + git clone https://gitee.com/ascend/EdgeAndRobotics.git + # 切换到样例目录 + cd EdgeAndRobotics/AIApplication/ACLHelloWorld + ``` + + - 压缩包方式下载(**下载时间较短,但步骤稍微复杂**)。 + + ``` + # 1. 仓右上角选择 【克隆/下载】 下拉框并选择 【下载ZIP】。 + # 2. 将ZIP包上传到开发板的普通用户家目录中,【例如:${HOME}/EdgeAndRobotics-master.zip】。 + # 3. 开发环境中,执行以下命令,解压zip包。 + cd ${HOME} + chmod +x EdgeAndRobotics-master.zip + unzip EdgeAndRobotics-master.zip + # 4. 切换到样例目录 + cd EdgeAndRobotics-master/AIApplication/ACLHelloWorld + ``` + + +**样例的代码目录说明如下:** + +``` +|--- scripts + |--- sample_build.sh // 将样例源码编译成可执行文件的脚本 + |--- sample_run.sh // 运行可执行文件的脚本 +|--- src + |--- CMakeLists.txt // cmake编辑脚本 + |--- main.cpp // 样例源码 +``` + +#### 准备环境 + +1. 以HwHiAiUser用户登录开发板。 + +2. 设置环境变量。 + + ``` + # 配置程序编译依赖的头文件与库文件路径 + export DDK_PATH=/usr/local/Ascend/ascend-toolkit/latest + export NPU_HOST_LIB=$DDK_PATH/runtime/lib64/stub + ``` + + +#### 样例运行 + +1. 以HwHiAiUser用户登录开发板,切换到当前样例目录。 + +2. 编译样例源码。 + + 执行以下命令编译样例源码。 + + ``` + cd scripts + bash sample_build.sh + ``` + +3. 运行样例。 + + 执行以下脚本运行样例: + + ``` + bash sample_run.sh + ``` + + 执行成功后,在终端屏幕上的提示信息示例如下: + + ``` + [INFO] The sample starts to run + [INFO] Init Ascend NPU Success, NPU-ID:0 + [INFO] Hello! Welcome to Ascend World! + [INFO] Reset Ascend NPU Success. + ``` + +#### 相关操作 + +- 获取在线视频课程,请单击[Link](https://www.hiascend.com/edu/courses?activeTab=%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91)。 +- 获取学习文档,请单击[AscendCL C&C++](https://hiascend.com/document/redirect/CannCommunityCppAclQuick)或[AscendCL Python](https://hiascend.com/document/redirect/CannCommunityPyaclQuick),查看最新版本的AscendCL推理应用开发指南。 \ No newline at end of file diff --git a/AIApplication/ACLHelloWorld/scripts/sample_build.sh b/AIApplication/ACLHelloWorld/scripts/sample_build.sh new file mode 100644 index 0000000000000000000000000000000000000000..8dd10810552c62683611b33b6bc3498ed2f13b6e --- /dev/null +++ b/AIApplication/ACLHelloWorld/scripts/sample_build.sh @@ -0,0 +1,36 @@ +#!/bin/bash +ScriptPath="$( cd "$(dirname "$BASH_SOURCE")" ; pwd -P )" + +function build() +{ + if [ -d ${ScriptPath}/../build/intermediates/host ];then + rm -rf ${ScriptPath}/../build/intermediates/host + fi + + mkdir -p ${ScriptPath}/../build/intermediates/host + cd ${ScriptPath}/../build/intermediates/host + + cmake ../../../src -DCMAKE_CXX_COMPILER=g++ -DCMAKE_SKIP_RPATH=TRUE + if [ $? -ne 0 ];then + echo "[ERROR] cmake error, Please check your environment!" + return 1 + fi + make + if [ $? -ne 0 ];then + echo "[ERROR] build failed, Please check your environment!" + return 1 + fi + cd - > /dev/null +} +function main() +{ + echo "[INFO] Sample preparation" + + build + if [ $? -ne 0 ];then + return 1 + fi + + echo "[INFO] Sample preparation is complete" +} +main \ No newline at end of file diff --git a/AIApplication/ACLHelloWorld/scripts/sample_run.sh b/AIApplication/ACLHelloWorld/scripts/sample_run.sh new file mode 100644 index 0000000000000000000000000000000000000000..8afd98368d5fab213d030dd40894b050b2ddb6f8 --- /dev/null +++ b/AIApplication/ACLHelloWorld/scripts/sample_run.sh @@ -0,0 +1,17 @@ +#!/bin/bash +ScriptPath="$( cd "$(dirname "$BASH_SOURCE")" ; pwd -P )" + +function main() +{ + echo "[INFO] The sample starts to run" + running_command="./main" + cd ${ScriptPath}/../out + ${running_command} + if [ $? -ne 0 ];then + return 1 + else + echo "[INFO] The program runs successfully" + return 0 + fi +} +main diff --git a/AIApplication/ACLHelloWorld/src/CMakeLists.txt b/AIApplication/ACLHelloWorld/src/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..68a2f6aef66b6a997e827a1af5c04ff9c3ce0baf --- /dev/null +++ b/AIApplication/ACLHelloWorld/src/CMakeLists.txt @@ -0,0 +1,46 @@ +# Copyright (c) Huawei Technologies Co., Ltd. 2019. All rights reserved. + +cmake_minimum_required(VERSION 3.5.1) + +project(ACLHelloWorld) + +add_compile_options(-std=c++11) + +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "../../../out") +set(CMAKE_CXX_FLAGS_DEBUG "-fPIC -O0 -g -Wall") +set(CMAKE_CXX_FLAGS_RELEASE "-fPIC -O2 -Wall") + +set(INC_PATH $ENV{DDK_PATH}) +if (NOT DEFINED ENV{DDK_PATH}) + set(INC_PATH "/usr/local/Ascend/ascend-toolkit/latest") + message(STATUS "set default INC_PATH: ${INC_PATH}") +else() + message(STATUS "set INC_PATH: ${INC_PATH}") +endif () + +set(LIB_PATH $ENV{NPU_HOST_LIB}) +if (NOT DEFINED ENV{NPU_HOST_LIB}) + set(LIB_PATH "/usr/local/Ascend/ascend-toolkit/lastest/runtime/lib64/stub") + message(STATUS "set default LIB_PATH: ${LIB_PATH}") +else() + message(STATUS "set LIB_PATH: ${LIB_PATH}") +endif () + +include_directories( + ${INC_PATH}/runtime/include/ +) + +link_directories( + ${LIB_PATH} +) + +add_executable(main + main.cpp) + +if(target STREQUAL "Simulator_Function") + target_link_libraries(main funcsim) +else() + target_link_libraries(main ascendcl stdc++) +endif() + +install(TARGETS main DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) \ No newline at end of file diff --git a/AIApplication/ACLHelloWorld/src/main.cpp b/AIApplication/ACLHelloWorld/src/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ecee0bc3b25bff4fa5dfdc567eb808c2ae4313e8 --- /dev/null +++ b/AIApplication/ACLHelloWorld/src/main.cpp @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2020.Huawei Technologies Co., Ltd. All rights reserved. + * + * 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. + */ +# include +#include "acl/acl.h" +# define INFO_LOG(fmt, args...) fprintf(stdout, "[INFO] " fmt "\n", ##args) +# define WARN_LOG(fmt, args...) fprintf(stdout, "[WARN] " fmt "\n", ##args) +# define ERROR_LOG(fmt, args...) fprintf(stdout, "[ERROR] " fmt "\n", ##args) +using namespace std; + +int main(int argc, char *argv[]) +{ + uint32_t deviceId = 0; + aclrtContext context = nullptr; + aclrtStream stream = nullptr; + const char *aclConfigPath = ""; + aclError ret = aclInit(aclConfigPath); + if (ret != ACL_ERROR_NONE){ + ERROR_LOG("Acl Init Failed."); + return -1; + } + + ret = aclrtSetDevice(deviceId); + if (ret != ACL_ERROR_NONE){ + ERROR_LOG("Acl Set Device Failed."); + return -1; + } + INFO_LOG("Init Ascend NPU Success, NPU-ID:%d", deviceId); + + ret = aclrtCreateContext(&context, deviceId); + if (ret != ACL_ERROR_NONE){ + ERROR_LOG("Acl Create Context Failed."); + return -1; + } + + ret = aclrtCreateStream(&stream); + if (ret != ACL_ERROR_NONE){ + ERROR_LOG("Acl Create Stream Failed."); + return -1; + } + /* + * 业务执行 + */ + INFO_LOG("Hello! Welcome to Ascend World!"); + + ret = aclrtDestroyStream(stream); + if (ret != ACL_ERROR_NONE){ + ERROR_LOG("Acl Destroy Stream Failed."); + return -1; + } + + ret = aclrtDestroyContext(context); + if (ret != ACL_ERROR_NONE){ + ERROR_LOG("Acl Destroy Context Failed."); + return -1; + } + + ret = aclrtResetDevice(deviceId); + if (ret != ACL_ERROR_NONE){ + ERROR_LOG("Acl Reset Device Failed."); + return -1; + } + INFO_LOG("Reset Ascend NPU Success."); + + ret = aclFinalize(); + if (ret != ACL_ERROR_NONE){ + ERROR_LOG("Acl Finalize Failed."); + return -1; + } + return 0; +} diff --git a/AIApplication/Mnist_For_Pytorch/README.md b/AIApplication/Mnist_For_Pytorch/README.md new file mode 100644 index 0000000000000000000000000000000000000000..26e45022c9fd9352b40f054a24915c856b933fe6 --- /dev/null +++ b/AIApplication/Mnist_For_Pytorch/README.md @@ -0,0 +1,186 @@ +# 手写数字识别模型训练&推理 + +#### 样例介绍 + + + +#### 样例下载 + +可以使用以下两种方式下载,请选择其中一种进行源码准备。 + +- 命令行方式下载(**下载时间较长,但步骤简单**)。 + + ``` + # 登录开发板,HwHiAiUser用户命令行中执行以下命令下载源码仓。 + cd ${HOME} + git clone https://gitee.com/ascend/EdgeAndRobotics.git + # 切换到样例目录 + cd EdgeAndRobotics/AIApplication/Mnist_For_Pytorch + ``` + +- 压缩包方式下载(**下载时间较短,但步骤稍微复杂**)。 + + ``` + # 1. 仓右上角选择 【克隆/下载】 下拉框并选择 【下载ZIP】。 + # 2. 将ZIP包上传到开发板的普通用户家目录中,【例如:${HOME}/EdgeAndRobotics-master.zip】。 + # 3. 开发环境中,执行以下命令,解压zip包。 + cd ${HOME} + chmod +x EdgeAndRobotics-master.zip + unzip EdgeAndRobotics-master.zip + # 4. 切换到样例目录 + cd EdgeAndRobotics-master/AIApplication/Mnist_For_Pytorch + ``` + +#### 准备环境 + +- 本样例中的模型支持PyTorch2.1.0、torchvision1.16.0版本,请参考[安装PyTorch](https://www.hiascend.com/document/detail/zh/canncommercial/700/envdeployment/instg/instg_0046.html)章节安装PyTorch以及torch_npu插件。 + +- 本样例中的模型还依赖一些其它库(具体依赖哪些库,可查看本样例目录下的requirements.txt文件),可执行以下命令安装: + + ``` + pip3 install -r requirements.txt # PyTorch2.1版本 + ``` + +- 配置离线推理所需的环境变量。 + + ``` + # 配置程序编译依赖的头文件与库文件路径 + export DDK_PATH=/usr/local/Ascend/ascend-toolkit/latest + export NPU_HOST_LIB=$DDK_PATH/runtime/lib64/stub + ``` + +- 安装离线推理所需的ACLLite库。 + + 参考[Common安装指导]()安装ACLLite Common库。 + + 参考[DVPPLite安装指导]()安装DVPPLite库。 + + 参考[OMExecute安装指导]()安装OMExecute库。 + + +#### 模型训练 + +1. 以HwHiAiUser用户登录开发板,切换到样例目录下。 + +2. 运行训练脚本。 + + ``` + python3 main.py + ``` + + 成功运行训练脚本后,会自动下载Mnist数据集,数据集目录结构如下(如果用户网络状况不佳可以自行下载数据集放到指定目录dataset下): + + ``` + ├── dataset + ├──MNIST + ├──raw + │──train-labels-idx1-ubyte.gz + │──train-labels-idx1-ubyte + │──train-images-idx3-ubyte.gz + │──train-images-idx3-ubyte + │──t10k-labels-idx1-ubyte.gz + │──t10k-labels-idx1-ubyte + │──t10k-images-idx3-ubyte.gz + │──t10k-images-idx3-ubyte + ``` + + 训练完成后,权重文件保存在当前路径下,并输出模型训练精度和性能信息。 + + 此处展示单Device、batch_size=64的训练结果数据: + + | NAME | Acc@1 | FPS | Epochs | AMP_Type | Torch_Version | + | :----: | :---: | :---: | :----: | :------: | :-----------: | + | 1p-NPU | 97.89 | 17.24 | 10 | O2 | 2.1 | + +#### 在线推理 + +1. 以HwHiAiUser用户登录开发板,切换到当前样例目录。 + +2. 执行以下命令,将训练生成的mnist.pt转换mnist.onnx模型。 + + ``` + python3 export.py + ``` + + mnist.onnx模型生成在当前路径下。 + +3. 执行以下命令,获取在线推理的测试图片。 + + ``` + cd data + wget https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/wanzutao/mnist/8.jpg + ``` + +4. 执行在线推理。 + + ``` + cd ../onnxInfer/ + python3 infer.py + ``` + + 执行成功后,在屏幕上的关键提示信息示例如下: + + ``` + [image_path:data/8.jpg] [inferssession_time:1349 pictures/s] [output:8] + ``` + +#### 离线推理 + +1. 以HwHiAiUser用户登录开发板,切换到当前样例目录。 + +2. 获取测试图片数据。 + + ``` + cd omInfer/data + wget https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/wanzutao/mnist/8.jpg + ``` + + **注:**若需更换测试图片,则需自行准备测试图片,并将测试图片放到omInfer/data目录下。 + +3. 获取PyTorch框架的ResNet50模型(\*.onnx),并转换为昇腾AI处理器能识别的模型(\*.om)。 + + ``` + # 为了方便下载,在这里直接给出原始模型下载及模型转换命令,可以直接拷贝执行。 + # 将在线推理时导出的mnist.onnx模型拷贝到model目录下 + cd ../model + cp ../../mnist.onnx ./ + + # 获取AIPP配置文件 + wget https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/wanzutao/mnist/aipp.cfg + + # 模型转换 + atc --model=mnist.onnx --framework=5 --insert_op_conf=aipp.cfg --output=mnist --soc_version=Ascend310B4 + ``` + + atc命令中各参数的解释如下,详细约束说明请参见[《ATC模型转换指南》](https://hiascend.com/document/redirect/CannCommunityAtc)。 + + - --model:转换前模型文件的路径。 + - --framework:原始框架类型。5表示ONNX。 + - --output:转换后模型文件的路径。请注意,记录保存该om模型文件的路径,后续开发应用时需要使用。 + - --input\_shape:模型输入数据的shape。 + - --soc\_version:昇腾AI处理器的版本。 + +4. 编译样例源码。 + + 执行以下命令编译样例源码。 + + ``` + cd ../scripts + bash sample_build.sh + ``` + +5. 运行样例。 + + 执行以下脚本运行样例: + + ``` + bash sample_run.sh + ``` + + 执行成功后,在屏幕上的关键提示信息示例如下: + + ``` + [INFO] value[0.999993] output[8] + ``` + +#### 相关操作 \ No newline at end of file diff --git a/AIApplication/Mnist_For_Pytorch/data/.keep b/AIApplication/Mnist_For_Pytorch/data/.keep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/AIApplication/Mnist_For_Pytorch/dataset/.keep b/AIApplication/Mnist_For_Pytorch/dataset/.keep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/AIApplication/Mnist_For_Pytorch/export.py b/AIApplication/Mnist_For_Pytorch/export.py new file mode 100644 index 0000000000000000000000000000000000000000..6e2b7a8aa494aee4e98bcd9beb117f5ef93d33a7 --- /dev/null +++ b/AIApplication/Mnist_For_Pytorch/export.py @@ -0,0 +1,30 @@ +import onnx +import torch +import torch.nn as nn +class CNN(nn.Module): + def __init__(self): + super(CNN, self).__init__() + self.net = nn.Sequential( + nn.Conv2d(in_channels = 1, out_channels = 16, + kernel_size = (3, 3), + stride = (1, 1), + padding = 1), + nn.MaxPool2d(kernel_size = 2), + nn.Conv2d(16, 32, 3, 1, 1), + nn.MaxPool2d(2), + nn.Flatten(), + nn.Linear(32*7*7, 16), + nn.ReLU(), + nn.Linear(16, 10) + ) + def forward(self, x): + return self.net(x) +device = torch.device('cpu') +model = torch.load("./mnist.pt",map_location=device) +model.eval() + +input_names = ['input'] +output_names = ['output'] +x = torch.randn(1,1,28,28,requires_grad=True) + +torch.onnx.export(model, x, 'mnist.onnx', input_names=input_names, output_names=output_names, verbose='True') diff --git a/AIApplication/Mnist_For_Pytorch/main.py b/AIApplication/Mnist_For_Pytorch/main.py new file mode 100644 index 0000000000000000000000000000000000000000..92538cae20ec71d5ef534ad750b7ebd6b2f91415 --- /dev/null +++ b/AIApplication/Mnist_For_Pytorch/main.py @@ -0,0 +1,186 @@ +# 引入模块 +import time +import torch +import torch.nn as nn +import torch_npu +# 导入AMP模块 +from torch_npu.npu import amp +from torch.utils.data import Dataset, DataLoader +import torchvision +from enum import Enum + +#指定运行Device,用户请自行定义训练设备 +device = torch.device('npu:0') +#torch.npu.set_compile_mode(jit_compile=False) +#option = {"MM_BMM_ND_ENABLE":"disable"} +#torch_npu.npu.set_option(option) +class Summary(Enum): + NONE = 0 + AVERAGE = 1 + SUM = 2 + COUNT = 3 + +class ProgressMeter(object): + def __init__(self, num_batches, meters, prefix=""): + self.batch_fmtstr = self._get_batch_fmtstr(num_batches) + self.meters = meters + self.prefix = prefix + + def display(self, batch): + entries = [self.prefix + self.batch_fmtstr.format(batch)] + entries += [str(meter) for meter in self.meters] + print('\t'.join(entries)) + + def display_summary(self): + entries = [" *"] + entries += [meter.summary() for meter in self.meters] + print(' '.join(entries)) + + def _get_batch_fmtstr(self, num_batches): + num_digits = len(str(num_batches // 1)) + fmt = '{:' + str(num_digits) + 'd}' + return '[' + fmt + '/' + fmt.format(num_batches) + ']' + + +class AverageMeter(object): + """Computes and stores the average and current value""" + + def __init__(self, name, fmt=':f', summary_type=Summary.AVERAGE): + self.name = name + self.fmt = fmt + self.summary_type = summary_type + self.reset() + + def reset(self): + self.val = 0 + self.avg = 0 + self.sum = 0 + self.count = 0 + + def update(self, val, n=1): + self.val = val + self.sum += val * n + self.count += n + self.avg = self.sum / self.count + + def all_reduce(self): + if torch.npu.is_available(): + device = torch.device("npu") + elif torch.backends.mps.is_available(): + device = torch.device("mps") + else: + device = torch.device("cpu") + total = torch.tensor([self.sum, self.count], dtype=torch.float32, device=device) + dist.all_reduce(total, dist.ReduceOp.SUM, async_op=False) + self.sum, self.count = total.tolist() + self.avg = self.sum / self.count + + def __str__(self): + fmtstr = '{name} {val' + self.fmt + '} ({avg' + self.fmt + '})' + return fmtstr.format(**self.__dict__) + + def summary(self): + fmtstr = '' + if self.summary_type is Summary.NONE: + fmtstr = '' + elif self.summary_type is Summary.AVERAGE: + fmtstr = '{name} {avg:.3f}' + elif self.summary_type is Summary.SUM: + fmtstr = '{name} {sum:.3f}' + elif self.summary_type is Summary.COUNT: + fmtstr = '{name} {count:.3f}' + else: + raise ValueError('invalid summary type %r' % self.summary_type) + + return fmtstr.format(**self.__dict__) + +def accuracy(output, target, topk=(1,)): + """Computes the accuracy over the k top predictions for the specified values of k""" + with torch.no_grad(): + maxk = max(topk) + batch_size = target.size(0) + + _, pred = output.topk(maxk, 1, True, True) + pred = pred.t() + correct = pred.eq(target.view(1, -1).expand_as(pred)) + + res = [] + for k in topk: + correct_k = correct[:k].reshape(-1).float().sum(0, keepdim=True) + res.append(correct_k.mul_(100.0 / batch_size)) + return res + +class CNN(nn.Module): + def __init__(self): + super(CNN, self).__init__() + self.net = nn.Sequential( + nn.Conv2d(in_channels = 1, out_channels = 16, + kernel_size = (3, 3), + stride = (1, 1), + padding = 1), + nn.MaxPool2d(kernel_size = 2), + nn.Conv2d(16, 32, 3, 1, 1), + nn.MaxPool2d(2), + nn.Flatten(), + nn.Linear(32*7*7, 16), + nn.ReLU(), + nn.Linear(16, 10) + ) + def forward(self, x): + return self.net(x) + +# 数据集获取 +train_data = torchvision.datasets.MNIST( + "./dataset", + download = True, + train = True, + transform = torchvision.transforms.ToTensor() +) +# 定义训练相关参数 +batch_size = 64 +model = CNN().to(device) # 把模型放到指定NPU上 +train_dataloader = DataLoader(train_data, batch_size=batch_size) # 定义DataLoader +loss_func = nn.CrossEntropyLoss().to(device) # 定义损失函数 +optimizer = torch.optim.SGD(model.parameters(), lr=0.1) # 定义优化器 +scaler = amp.GradScaler() # 在模型、优化器定义之后,定义GradScaler +epochs = 10 # 设置循环次数 +batch_time = AverageMeter('Time', ':6.3f') +data_time = AverageMeter('Data', ':6.3f') +losses = AverageMeter('Loss', ':.4e') +top1 = AverageMeter('Acc@1', ':6.2f') +top5 = AverageMeter('Acc@5', ':6.2f') +outputs = None +loss = None +for epoch in range(epochs): + progress = ProgressMeter( + len(train_dataloader), + [batch_time, data_time, losses, top1, top5], + prefix="Epoch: [{}]".format(epoch)) + epoch_time = time.time() + end = time.time() + for batch_idx,(imgs, labels) in enumerate(train_dataloader): + data_time.update(time.time() - end) + start_time = time.time() + imgs = imgs.to(device) # 把img数据放到指定NPU上 + labels = labels.to(device) # 把label数据放到指定NPU上 + with amp.autocast(): # 设置amp + outputs = model(imgs) # 前向计算 + loss = loss_func(outputs, labels) # 损失函数计算 + optimizer.zero_grad() + # 进行反向传播前后的loss缩放、参数更新 + scaler.scale(loss).backward() # loss缩放并反向转播 + scaler.step(optimizer) # 更新参数(自动unscaling) + scaler.update() # 基于动态Loss Scale更新loss_scaling系数 + acc1, acc5 = accuracy(outputs, labels, topk=(1, 5)) + losses.update(loss.item(), imgs.size(0)) + top1.update(acc1[0], imgs.size(0)) + top5.update(acc5[0], imgs.size(0)) + + batch_time.update(time.time() - end) + end = time.time() + if batch_idx % 50 == 0: + progress.display(batch_idx + 1) + print('Train Epoch: {} [{}/{} ({:.0f}%)]\tLoss: {:.6f}'.format( + epoch, batch_idx * len(imgs), len(train_dataloader.dataset), + 100. * batch_idx / len(train_dataloader), loss.item())) +torch.save(model,"./mnist.pt") diff --git a/AIApplication/Mnist_For_Pytorch/main_cpu.py b/AIApplication/Mnist_For_Pytorch/main_cpu.py new file mode 100644 index 0000000000000000000000000000000000000000..8dca4144f0cf3b8d3580c4dc96c163bd7e95a4d8 --- /dev/null +++ b/AIApplication/Mnist_For_Pytorch/main_cpu.py @@ -0,0 +1,177 @@ +import torch +import torch.nn as nn +from torch.utils.data import Dataset, DataLoader +import torchvision +from enum import Enum +import time + +class Summary(Enum): + NONE = 0 + AVERAGE = 1 + SUM = 2 + COUNT = 3 +class ProgressMeter(object): + def __init__(self, num_batches, meters, prefix=""): + self.batch_fmtstr = self._get_batch_fmtstr(num_batches) + self.meters = meters + self.prefix = prefix + + def display(self, batch): + entries = [self.prefix + self.batch_fmtstr.format(batch)] + entries += [str(meter) for meter in self.meters] + print('\t'.join(entries)) + + def display_summary(self): + entries = [" *"] + entries += [meter.summary() for meter in self.meters] + print(' '.join(entries)) + + def _get_batch_fmtstr(self, num_batches): + num_digits = len(str(num_batches // 1)) + fmt = '{:' + str(num_digits) + 'd}' + return '[' + fmt + '/' + fmt.format(num_batches) + ']' + + +class AverageMeter(object): + """Computes and stores the average and current value""" + + def __init__(self, name, fmt=':f', summary_type=Summary.AVERAGE): + self.name = name + self.fmt = fmt + self.summary_type = summary_type + self.reset() + + def reset(self): + self.val = 0 + self.avg = 0 + self.sum = 0 + self.count = 0 + + def update(self, val, n=1): + self.val = val + self.sum += val * n + self.count += n + self.avg = self.sum / self.count + + def all_reduce(self): + if torch.npu.is_available(): + device = torch.device("npu") + elif torch.backends.mps.is_available(): + device = torch.device("mps") + else: + device = torch.device("cpu") + total = torch.tensor([self.sum, self.count], dtype=torch.float32, device=device) + dist.all_reduce(total, dist.ReduceOp.SUM, async_op=False) + self.sum, self.count = total.tolist() + self.avg = self.sum / self.count + + def __str__(self): + fmtstr = '{name} {val' + self.fmt + '} ({avg' + self.fmt + '})' + return fmtstr.format(**self.__dict__) + + def summary(self): + fmtstr = '' + if self.summary_type is Summary.NONE: + fmtstr = '' + elif self.summary_type is Summary.AVERAGE: + fmtstr = '{name} {avg:.3f}' + elif self.summary_type is Summary.SUM: + fmtstr = '{name} {sum:.3f}' + elif self.summary_type is Summary.COUNT: + fmtstr = '{name} {count:.3f}' + else: + raise ValueError('invalid summary type %r' % self.summary_type) + + return fmtstr.format(**self.__dict__) +def accuracy(output, target, topk=(1,)): + """Computes the accuracy over the k top predictions for the specified values of k""" + with torch.no_grad(): + maxk = max(topk) + batch_size = target.size(0) + + _, pred = output.topk(maxk, 1, True, True) + pred = pred.t() + correct = pred.eq(target.view(1, -1).expand_as(pred)) + + res = [] + for k in topk: + correct_k = correct[:k].reshape(-1).float().sum(0, keepdim=True) + res.append(correct_k.mul_(100.0 / batch_size)) + return res +# 指定运行Device,用户请自行定义训练设备号 +device = torch.device('cpu') + +# 定义一个简单的神经网络 +class CNN(nn.Module): + def __init__(self): + super(CNN, self).__init__() + self.net = nn.Sequential( + nn.Conv2d(in_channels = 1, out_channels = 16, + kernel_size = (3, 3), + stride = (1, 1), + padding = 1), + nn.MaxPool2d(kernel_size = 2), + nn.Conv2d(16, 32, 3, 1, 1), + nn.MaxPool2d(2), + nn.Flatten(), + nn.Linear(32*7*7, 16), + nn.ReLU(), + nn.Linear(16, 10) + ) + def forward(self, x): + return self.net(x) + +# 数据集获取 +train_data = torchvision.datasets.MNIST( + root = 'mnist', + download = True, + train = True, + transform = torchvision.transforms.ToTensor() +) +# 定义batchsize +batch_size = 64 +# 定义DataLoader +train_dataloader = DataLoader(train_data, batch_size = batch_size) + +# 把模型放到指定NPU上 +model = CNN().to(device) +# 定义损失函数 +loss_func = nn.CrossEntropyLoss().to(device) +# 定义优化器 +optimizer = torch.optim.SGD(model.parameters(), lr = 0.1) + +# 设置循环 +epochs = 10 + +batch_time = AverageMeter('Time', ':6.3f') +data_time = AverageMeter('Data', ':6.3f') +losses = AverageMeter('Loss', ':.4e') +top1 = AverageMeter('Acc@1', ':6.2f') +top5 = AverageMeter('Acc@5', ':6.2f') +progress = ProgressMeter( + len(train_dataloader), + [batch_time, data_time, losses, top1, top5], + prefix="Epoch: [{}]".format(epochs)) +for i in range(epochs): + end = time.time() + + for batch_idx,(imgs, labels) in enumerate(train_dataloader): + data_time.update(time.time() - end) + start_time = time.time() + start_time = time.time() # 记录训练开始时间 + imgs = imgs.to(device) # 把img数据放到指定NPU上 + labels = labels.to(device) # 把label数据放到指定NPU上 + outputs = model(imgs) # 前向计算 + loss = loss_func(outputs, labels) # 损失函数计算 + optimizer.zero_grad() + loss.backward() # 损失函数反向计算 + optimizer.step() # 更新优化器 + acc1, acc5 = accuracy(outputs, labels, topk=(1, 5)) + losses.update(loss.item(), imgs.size(0)) + top1.update(acc1[0], imgs.size(0)) + top5.update(acc5[0], imgs.size(0)) + progress.display(batch_idx + 1) + batch_time.update(time.time() - end) + end = time.time() +PATH = "state_dict_model.pt" # 创建保存路径 +torch.save(model, PATH) # 保存模型 \ No newline at end of file diff --git a/AIApplication/Mnist_For_Pytorch/omInfer/data/.keep b/AIApplication/Mnist_For_Pytorch/omInfer/data/.keep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/AIApplication/Mnist_For_Pytorch/omInfer/model/.keep b/AIApplication/Mnist_For_Pytorch/omInfer/model/.keep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/AIApplication/Mnist_For_Pytorch/omInfer/scripts/sample_build.sh b/AIApplication/Mnist_For_Pytorch/omInfer/scripts/sample_build.sh new file mode 100644 index 0000000000000000000000000000000000000000..d5837a40c294238f7f5d19c720efd49695b7989a --- /dev/null +++ b/AIApplication/Mnist_For_Pytorch/omInfer/scripts/sample_build.sh @@ -0,0 +1,40 @@ +#!/bin/bash +ScriptPath="$( cd "$(dirname "$BASH_SOURCE")" ; pwd -P )" + +function build() +{ + if [ -d ${ScriptPath}/../out ];then + rm -rf ${ScriptPath}/../out + fi + + if [ -d ${ScriptPath}/../build/intermediates/host ];then + rm -rf ${ScriptPath}/../build/intermediates/host + fi + + mkdir -p ${ScriptPath}/../build/intermediates/host + cd ${ScriptPath}/../build/intermediates/host + + cmake ../../../src -DCMAKE_CXX_COMPILER=g++ -DCMAKE_SKIP_RPATH=TRUE + if [ $? -ne 0 ];then + echo "[ERROR] cmake error, Please check your environment!" + return 1 + fi + make + if [ $? -ne 0 ];then + echo "[ERROR] build failed, Please check your environment!" + return 1 + fi + cd - > /dev/null +} + +function main() +{ + echo "[INFO] Sample preparation" + build + if [ $? -ne 0 ];then + return 1 + fi + echo "[INFO] Sample preparation is complete" +} +main + diff --git a/AIApplication/Mnist_For_Pytorch/omInfer/scripts/sample_run.sh b/AIApplication/Mnist_For_Pytorch/omInfer/scripts/sample_run.sh new file mode 100644 index 0000000000000000000000000000000000000000..2fe8dade67d7e7602a1a3f8b5eecad1fe4ed2a97 --- /dev/null +++ b/AIApplication/Mnist_For_Pytorch/omInfer/scripts/sample_run.sh @@ -0,0 +1,17 @@ +#!/bin/bash +ScriptPath="$( cd "$(dirname "$BASH_SOURCE")" ; pwd -P )" + +function main() +{ + echo "[INFO] The sample starts to run" + running_command="./main" + cd ${ScriptPath}/../out + ${running_command} + if [ $? -ne 0 ];then + echo "[INFO] The program runs failed" + else + echo "[INFO] The program runs successfully" + fi +} +main + diff --git a/AIApplication/Mnist_For_Pytorch/omInfer/src/CMakeLists.txt b/AIApplication/Mnist_For_Pytorch/omInfer/src/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e2b34009779fb98df1e362e79136bb216990355 --- /dev/null +++ b/AIApplication/Mnist_For_Pytorch/omInfer/src/CMakeLists.txt @@ -0,0 +1,54 @@ +# Copyright (c) Huawei Technologies Co., Ltd. 2019. All rights reserved. + +cmake_minimum_required(VERSION 3.5.1) + +project(sampleMnist) + +add_compile_options(-std=c++11) + +add_definitions(-DENABLE_DVPP_INTERFACE) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "../../../out") +set(CMAKE_CXX_FLAGS_DEBUG "-fPIC -O0 -g -Wall") +set(CMAKE_CXX_FLAGS_RELEASE "-fPIC -O2 -Wall") + +set(INC_PATH $ENV{DDK_PATH}) +if (NOT DEFINED ENV{DDK_PATH}) + set(INC_PATH "/usr/local/Ascend/ascend-toolkit/latest") + message(STATUS "set default INC_PATH: ${INC_PATH}") +else() + message(STATUS "set INC_PATH: ${INC_PATH}") +endif () + +set(LIB_PATH $ENV{NPU_HOST_LIB}) +if (NOT DEFINED ENV{NPU_HOST_LIB}) + set(LIB_PATH "/usr/local/Ascend/ascend-toolkit/latest/runtime/lib64/stub") + message(STATUS "set default LIB_PATH: ${LIB_PATH}") +else() + message(STATUS "set LIB_PATH: ${LIB_PATH}") +endif () + +find_path(AVCODEC_INCLUDE_DIR libavcodec/avcodec.h) +find_library(AVCODEC_LIBRARY avcodec) + +include_directories( + ${AVCODEC_INCLUDE_DIR} + ${INC_PATH}/runtime/include/ + ./ +) + +link_directories( + ${AVCODEC_LIBRARY} + ${LIB_PATH} +) + +add_executable(main + SampleMnist.cpp) + +if(target STREQUAL "Simulator_Function") + target_link_libraries(main funcsim) +else() + target_link_libraries(main ascendcl acl_dvpp stdc++ dl rt acllite_dvpp_lite acllite_om_execute acllite_common ${AVCODEC_LIBRARY}) +endif() + +install(TARGETS main DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + diff --git a/AIApplication/Mnist_For_Pytorch/omInfer/src/SampleMnist.cpp b/AIApplication/Mnist_For_Pytorch/omInfer/src/SampleMnist.cpp new file mode 100644 index 0000000000000000000000000000000000000000..044bb849c2e87fbf61c77d235d7638089ded94eb --- /dev/null +++ b/AIApplication/Mnist_For_Pytorch/omInfer/src/SampleMnist.cpp @@ -0,0 +1,59 @@ +#include +#include +#include +#include +#include "acllite_dvpp_lite/ImgProc.h" +#include "acllite_om_execute/ModelProc.h" + +using namespace std; +using namespace acllite; + +int main() +{ + + + AclLiteResource aclResource; + bool ret = aclResource.Init(); + CHECK_RET(ret, LOG_PRINT("[ERROR] InitACLResource failed."); return 1); + + ImgProc imgProc; + ModelProc modelProc; + ret = modelProc.Load("../model/mnist.om"); + CHECK_RET(ret, LOG_PRINT("[ERROR] load model mnist.om failed."); return 1); + ImgData src = imgProc.ImRead("../data/8.jpg"); + CHECK_RET(src.size, LOG_PRINT("[ERROR] ImRead image failed."); return 1); + + ImgData dst; + ImgSize dsize; + dsize.width = 28; + dsize.height = 28; + + imgProc.Resize(src, dst, dsize); + ret = modelProc.CreateInput(static_cast(dst.data.get()), dst.size); + CHECK_RET(ret, LOG_PRINT("[ERROR] Create model input failed."); return 1); + vector inferOutputs; + ret = modelProc.Execute(inferOutputs); + CHECK_RET(ret, LOG_PRINT("[ERROR] model execute failed."); return 1); + + uint32_t dataSize = inferOutputs[0].size; + // get result from output data set + float* outData = static_cast(inferOutputs[0].data.get()); + if (outData == nullptr) { + LOG_PRINT("get result from output data set failed."); + return 1; + } + int index = 0; + float max = 0; + double totalValue = 0.0; + for (uint32_t j = 0; j < dataSize / sizeof(float); ++j) { + if (outData[j] > max){ + max = outData[j]; + index = j; + } + totalValue += exp(outData[j]); + } + LOG_PRINT("[INFO] value[%lf] output[%d]", exp(outData[index])/totalValue , index); + outData = nullptr; + return 0; +} + diff --git a/AIApplication/Mnist_For_Pytorch/onnxInfer/export.py b/AIApplication/Mnist_For_Pytorch/onnxInfer/export.py new file mode 100644 index 0000000000000000000000000000000000000000..ec5b1cac3d89f22b9a815ca0c0876f5b1e3a30de --- /dev/null +++ b/AIApplication/Mnist_For_Pytorch/onnxInfer/export.py @@ -0,0 +1,30 @@ +import onnx +import torch +import torch.nn as nn +class CNN(nn.Module): + def __init__(self): + super(CNN, self).__init__() + self.net = nn.Sequential( + nn.Conv2d(in_channels = 1, out_channels = 16, + kernel_size = (3, 3), + stride = (1, 1), + padding = 1), + nn.MaxPool2d(kernel_size = 2), + nn.Conv2d(16, 32, 3, 1, 1), + nn.MaxPool2d(2), + nn.Flatten(), + nn.Linear(32*7*7, 16), + nn.ReLU(), + nn.Linear(16, 10) + ) + def forward(self, x): + return self.net(x) +device = torch.device('cpu') +model = torch.load("../mnist_cnn.pt",map_location=device) +model.eval() + +input_names = ['input'] +output_names = ['output'] +x = torch.randn(1,1,28,28,requires_grad=True) + +torch.onnx.export(model, x, 'best.onnx', input_names=input_names, output_names=output_names, verbose='True') diff --git a/AIApplication/Mnist_For_Pytorch/onnxInfer/infer.py b/AIApplication/Mnist_For_Pytorch/onnxInfer/infer.py new file mode 100644 index 0000000000000000000000000000000000000000..e4cea37c95213b4b7e71d4a480c7706a1c52af76 --- /dev/null +++ b/AIApplication/Mnist_For_Pytorch/onnxInfer/infer.py @@ -0,0 +1,40 @@ +import onnxruntime as rt +import numpy as np +import cv2 +import os +import time +current_dir = os.path.dirname(os.path.abspath(__file__)) +images_path = os.path.join(current_dir, "../data") +if not os.path.exists(images_path): + raise Exception("the directory is not exist") +all_path = [] +image_name = [] +for path in os.listdir(images_path): + if path != '.keep': + total_path = os.path.join(images_path, path) + all_path.append(total_path) +if len(all_path) == 0: + raise Exception("the directory is empty, please download image") +for input_path in all_path: + input_path = os.path.abspath(input_path) + image = cv2.imread(input_path) + resize_image = cv2.resize(image, (28, 28)) + resize_image = cv2.cvtColor(resize_image, cv2.COLOR_BGR2GRAY) + resize_image = resize_image.transpose(0, 1) + input = (resize_image / 255).astype(np.float32) + input = input.reshape(1, 1, 28, 28) + options = rt.SessionOptions() + options.intra_op_num_threads = 1 + options.inter_op_num_threads = 1 + sess = rt.InferenceSession("../mnist.onnx",options) + input_name = "input" + output_name = "output" + start_time = time.time() + output = sess.run([output_name], {input_name: input}) + end_time = time.time() + output = np.array(output).flatten() + vals = np.exp(output) / np.sum(np.exp(output)) + result = "[image_path:" + input_path + "] [inferssession_time:" + f"{int(1/(end_time - start_time))}" + " pictures/s]" + " [output:" + "\033[1;31;40m" + f"{np.argmax(vals)}" + "\033[0m]" + print(result) + + diff --git a/AIApplication/Mnist_For_Pytorch/requirements.txt b/AIApplication/Mnist_For_Pytorch/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce5b824ec078537d75fa6afc64aa4a455df0c55c --- /dev/null +++ b/AIApplication/Mnist_For_Pytorch/requirements.txt @@ -0,0 +1,5 @@ +onnx +onnxruntime==1.14.0 +numpy +opencv-python +protobuf==3.20.2 diff --git a/AIApplication/ResnetPicture/README.md b/AIApplication/ResnetPicture/README.md new file mode 100644 index 0000000000000000000000000000000000000000..1418158399a7828f2cba9f69cbf47614d853101a --- /dev/null +++ b/AIApplication/ResnetPicture/README.md @@ -0,0 +1,121 @@ +# 图片分类(ResNet50) + +#### 样例介绍 + +基于PyTorch框架的ResNet50模型,对*.jpg图片分类,输出各图片Toop5置信度的分类ID、分类名称。 + +#### 样例下载 + +可以使用以下两种方式下载,请选择其中一种进行源码准备。 + +- 命令行方式下载(**下载时间较长,但步骤简单**)。 + + ``` + # 登录开发板,HwHiAiUser用户命令行中执行以下命令下载源码仓。 + cd ${HOME} + git clone https://gitee.com/ascend/EdgeAndRobotics.git + # 切换到样例目录 + cd EdgeAndRobotics/AIApplication/ResnetPicture + ``` + +- 压缩包方式下载(**下载时间较短,但步骤稍微复杂**)。 + + ``` + # 1. 仓右上角选择 【克隆/下载】 下拉框并选择 【下载ZIP】。 + # 2. 将ZIP包上传到开发板的普通用户家目录中,【例如:${HOME}/EdgeAndRobotics-master.zip】。 + # 3. 开发环境中,执行以下命令,解压zip包。 + cd ${HOME} + chmod +x EdgeAndRobotics-master.zip + unzip EdgeAndRobotics-master.zip + # 4. 切换到样例目录 + cd EdgeAndRobotics-master/AIApplication/ResnetPicture + ``` + +#### 准备环境 + +1. 以HwHiAiUser用户登录开发板。 + +2. 设置环境变量。 + + ``` + # 配置程序编译依赖的头文件与库文件路径 + export DDK_PATH=/usr/local/Ascend/ascend-toolkit/latest + export NPU_HOST_LIB=$DDK_PATH/runtime/lib64/stub + ``` + +3. 安装ACLLite库。 + + 参考[Common安装指导]()安装ACLLite Common库。 + + 参考[DVPPLite安装指导]()安装DVPPLite库。 + + 参考[OMExecute安装指导]()安装OMExecute库。 + +#### 运行样例 + +1. 以HwHiAiUser用户登录开发板,切换到当前样例目录。 +2. 获取PyTorch框架的ResNet50模型(\*.onnx),并转换为昇腾AI处理器能识别的模型(\*.om)。 + + ``` + # 为了方便下载,在这里直接给出原始模型下载及模型转换命令,可以直接拷贝执行。 + cd model + wget https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/resnet50/resnet50.onnx + wget https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/resnet50/resnet50_DVPP/aipp.cfg + atc --model=resnet50.onnx --framework=5 --output=resnet50 --input_shape="actual_input_1:1,3,224,224" --soc_version=Ascend310B4 --insert_op_conf=aipp.cfg + ``` + + atc命令中各参数的解释如下,详细约束说明请参见[《ATC模型转换指南》](https://hiascend.com/document/redirect/CannCommunityAtc)。 + + - --model:ResNet-50网络的模型文件的路径。 + - --framework:原始框架类型。5表示ONNX。 + - --output:resnet50.om模型文件的路径。请注意,记录保存该om模型文件的路径,后续开发应用时需要使用。 + - --input\_shape:模型输入数据的shape。 + - --soc\_version:昇腾AI处理器的版本。 + + +3. 获取测试图片数据。 + + 请从以下链接获取该样例的测试图片dog1\_1024\_683.jpg,放在data目录下。 + + ``` + cd ../data + wget https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/models/aclsample/dog1_1024_683.jpg + ``` + + **注:**若需更换测试图片,则需自行准备测试图片,并将测试图片放到data目录下。 + +4. 编译样例源码。 + + 执行以下命令编译样例源码。 + + ``` + cd ../scripts + bash sample_build.sh + ``` + +5. 运行样例。 + + 执行以下脚本运行样例: + + ``` + bash sample_run.sh + ``` + + 执行成功后,在屏幕上的关键提示信息示例如下,提示信息中的top1-5表示图片置信度的前5种类别、index表示类别标识、value表示该分类的最大置信度,class表示所属类别。这些值可能会根据版本、环境有所不同,请以实际情况为准: + + ``` + [INFO] top 1: index[162] value[0.905956] class[beagle] + [INFO] top 2: index[161] value[0.092549] class[bassetbasset hound] + [INFO] top 3: index[166] value[0.000758] class[Walker houndWalker foxhound] + [INFO] top 4: index[167] value[0.000559] class[English foxhound] + [INFO] top 5: index[163] value[0.000076] class[bloodhound sleuthhound] + ``` + +#### 相关操作 + +- 获取更多样例,请单击[Link](https://gitee.com/ascend/samples/tree/master/inference/modelInference)。 +- 获取在线视频课程,请单击[Link](https://www.hiascend.com/edu/courses?activeTab=%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91)。 +- 获取学习文档,请单击[AscendCL C&C++](https://hiascend.com/document/redirect/CannCommunityCppAclQuick),查看最新版本的AscendCL推理应用开发指南。 +- 查模型的输入输出 + + 可使用第三方工具Netron打开网络模型,查看模型输入或输出的数据类型、Shape,便于在分析应用开发场景时使用。 diff --git a/AIApplication/ResnetPicture/data/.keep b/AIApplication/ResnetPicture/data/.keep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/AIApplication/ResnetPicture/model/.keep b/AIApplication/ResnetPicture/model/.keep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/AIApplication/ResnetPicture/out/.keep b/AIApplication/ResnetPicture/out/.keep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/AIApplication/ResnetPicture/scripts/sample_build.sh b/AIApplication/ResnetPicture/scripts/sample_build.sh new file mode 100644 index 0000000000000000000000000000000000000000..3bf4f9c925fc4e4bf618c12f0b9e146dc4672fce --- /dev/null +++ b/AIApplication/ResnetPicture/scripts/sample_build.sh @@ -0,0 +1,39 @@ +#!/bin/bash +ScriptPath="$( cd "$(dirname "$BASH_SOURCE")" ; pwd -P )" + +function build() +{ + if [ -d ${ScriptPath}/../out ];then + rm -rf ${ScriptPath}/../out + fi + + if [ -d ${ScriptPath}/../build/intermediates/host ];then + rm -rf ${ScriptPath}/../build/intermediates/host + fi + + mkdir -p ${ScriptPath}/../build/intermediates/host + cd ${ScriptPath}/../build/intermediates/host + + cmake ../../../src -DCMAKE_CXX_COMPILER=g++ -DCMAKE_SKIP_RPATH=TRUE + if [ $? -ne 0 ];then + echo "[ERROR] cmake error, Please check your environment!" + return 1 + fi + make + if [ $? -ne 0 ];then + echo "[ERROR] build failed, Please check your environment!" + return 1 + fi + cd - > /dev/null +} + +function main() +{ + echo "[INFO] Sample preparation" + build + if [ $? -ne 0 ];then + return 1 + fi + echo "[INFO] Sample preparation is complete" +} +main diff --git a/AIApplication/ResnetPicture/scripts/sample_run.sh b/AIApplication/ResnetPicture/scripts/sample_run.sh new file mode 100644 index 0000000000000000000000000000000000000000..b56b8e823c77d4d4928c76845aba36d654399a6e --- /dev/null +++ b/AIApplication/ResnetPicture/scripts/sample_run.sh @@ -0,0 +1,16 @@ +#!/bin/bash +ScriptPath="$( cd "$(dirname "$BASH_SOURCE")" ; pwd -P )" + +function main() +{ + echo "[INFO] The sample starts to run" + running_command="./main" + cd ${ScriptPath}/../out + ${running_command} + if [ $? -ne 0 ];then + echo "[INFO] The program runs failed" + else + echo "[INFO] The program runs successfully" + fi +} +main diff --git a/AIApplication/ResnetPicture/src/CMakeLists.txt b/AIApplication/ResnetPicture/src/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..23d751a356adfacb72c691a200f86319727a68e6 --- /dev/null +++ b/AIApplication/ResnetPicture/src/CMakeLists.txt @@ -0,0 +1,56 @@ +# Copyright (c) Huawei Technologies Co., Ltd. 2019. All rights reserved. + +cmake_minimum_required(VERSION 3.5.1) + +project(sampleResnet) + +add_compile_options(-std=c++11) + +add_definitions(-DENABLE_DVPP_INTERFACE) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "../../../out") +set(CMAKE_CXX_FLAGS_DEBUG "-fPIC -O0 -g -Wall") +set(CMAKE_CXX_FLAGS_RELEASE "-fPIC -O2 -Wall") + +set(INC_PATH $ENV{DDK_PATH}) +if (NOT DEFINED ENV{DDK_PATH}) + set(INC_PATH "/usr/local/Ascend/ascend-toolkit/latest") + message(STATUS "set default INC_PATH: ${INC_PATH}") +else() + message(STATUS "set INC_PATH: ${INC_PATH}") +endif () + +set(LIB_PATH $ENV{NPU_HOST_LIB}) +if (NOT DEFINED ENV{NPU_HOST_LIB}) + set(LIB_PATH "/usr/local/Ascend/ascend-toolkit/latest/runtime/lib64/stub") + message(STATUS "set default LIB_PATH: ${LIB_PATH}") +else() + message(STATUS "set LIB_PATH: ${LIB_PATH}") +endif () + +find_package(OpenCV REQUIRED) +find_path(AVCODEC_INCLUDE_DIR libavcodec/avcodec.h) +find_library(AVCODEC_LIBRARY avcodec) + +include_directories( + ${OpenCV_INCLUDE_DIRS} + ${AVCODEC_INCLUDE_DIR} + ${INC_PATH}/runtime/include/ + ./ +) + +link_directories( + ${OpenCV_LIB_DIRS} + ${AVCODEC_LIBRARY} + ${LIB_PATH} +) + +add_executable(main + main.cpp) + +if(target STREQUAL "Simulator_Function") + target_link_libraries(main funcsim) +else() + target_link_libraries(main ascendcl acl_dvpp stdc++ dl rt acllite_dvpp_lite acllite_om_execute acllite_common ${AVCODEC_LIBRARY} ${OpenCV_LIBS}) +endif() + +install(TARGETS main DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) diff --git a/AIApplication/ResnetPicture/src/label.h b/AIApplication/ResnetPicture/src/label.h new file mode 100644 index 0000000000000000000000000000000000000000..3ad42f77130c11a1999a07cc5e468bcf9e57053c --- /dev/null +++ b/AIApplication/ResnetPicture/src/label.h @@ -0,0 +1,275 @@ +/** +* Copyright (c) Huawei Technologies Co., Ltd. 2020-2022. All rights reserved. +* +* 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. + +* File label.h +* Description: label result +*/ +#ifndef modelInference_label_H +#define modelInference_label_H + +const std::string label[] ={"tenchTinca tinca", +"goldfishCarassius auratus", "great white sharkwhite sharkman-eaterman-eating sharkCarcharodon carcharias", +"tiger sharkGaleocerdo cuvieri", "hammerheadhammerhead shark", +"electric raycrampfishnumbfishtorpedo", "stingray", "cock", "hen", +"ostrichStruthio camelus", "bramblingFringilla montifringilla", +"goldfinchCarduelis carduelis", "house finchlinnetCarpodacus mexicanus", +"juncosnowbird", "indigo buntingindigo finchindigo birdPasserina cyanea", +"robinAmerican robinTurdus migratorius", "bulbul", "jay", "magpie", "chickadee", +"water ouzeldipper", "kite", "bald eagleAmerican eagleHaliaeetus leucocephalus", +"vulture", "great grey owlgreat gray owlStrix nebulosa", +"European fire salamanderSalamandra salamandra", +"common newtTriturus vulgaris", "eft", "spotted salamanderAmbystoma maculatum", +"axolotlmud puppyAmbystoma mexicanum", "bullfrogRana catesbeiana", "tree frogtree-frog", +"tailed frogbell toadribbed toadtailed toadAscaphus trui", +"loggerheadloggerhead turtleCaretta caretta", +"leatherback turtleleatherbackleathery turtleDermochelys coriacea", +"mud turtle", "terrapin", "box turtlebox tortoise", "banded gecko", +"common iguanaiguanaIguana iguana", "American chameleonanoleAnolis carolinensis", +"whiptailwhiptail lizard", "agama", "frilled lizardChlamydosaurus kingi", +"alligator lizard", "Gila monsterHeloderma suspectum", +"green lizardLacerta viridis", "African chameleonChamaeleo chamaeleon", +"Komodo dragonKomodo lizarddragon lizardgiant lizardVaranus komodoensis", +"African crocodileNile crocodileCrocodylus niloticus", "American alligatorAlligator mississipiensis", +"triceratops", "thunder snakeworm snakeCarphophis amoenus", "ringneck snakering-necked snakering snake", +"hognose snakepuff addersand viper", "green snakegrass snake", "king snakekingsnake", +"garter snakegrass snake", "water snake", "vine snake", "night snakeHypsiglena torquata", +"boa constrictorConstrictor constrictor", "rock pythonrock snakePython sebae", +"Indian cobraNaja naja", "green mamba", "sea snake", +"horned vipercerastessand viperhorned aspCerastes cornutus", +"diamondbackdiamondback rattlesnakeCrotalus adamanteus", +"sidewinderhorned rattlesnakeCrotalus cerastes", "trilobite", +"harvestmandaddy longlegsPhalangium opilio", "scorpion", +"black and gold garden spiderArgiope aurantia", "barn spiderAraneus cavaticus", +"garden spiderAranea diademata", "black widowLatrodectus mactans", "tarantula", +"wolf spiderhunting spider", "tick", "centipede", "black grouse", "ptarmigan", +"ruffed grousepartridgeBonasa umbellus", "prairie chickenprairie grouseprairie fowl", +"peacock", "quail", "partridge", "African greyAfrican grayPsittacus erithacus", +"macaw", "sulphur-crested cockatooKakatoe galeritaCacatua galerita", "lorikeet", +"coucal", "bee eater", "hornbill", "hummingbird", "jacamar", "toucan", "drake", +"red-breasted merganserMergus serrator", "goose", "black swanCygnus atratus", +"tusker", "echidnaspiny anteateranteater", +"platypusduckbillduckbilled platypusduck-billed platypusOrnithorhynchus anatinus", +"wallabybrush kangaroo", "koalakoala bearkangaroo bearnative bearPhascolarctos cinereus", +"wombat", "jellyfish", "sea anemoneanemone", "brain coral", "flatwormplatyhelminth", +"nematodenematode wormroundworm", "conch", "snail", "slug", "sea slugnudibranch", +"chitoncoat-of-mail shellsea cradlepolyplacophore", "chambered nautiluspearly nautilusnautilus", +"Dungeness crabCancer magister", "rock crabCancer irroratus", +"fiddler crab", "king crabAlaska crabAlaskan king crabAlaska king crabParalithodes camtschatica", +"American lobsterNorthern lobsterMaine lobsterHomarus americanus", +"spiny lobsterlangousterock lobstercrawfishcrayfishsea crawfish", +"crayfishcrawfishcrawdadcrawdaddy", "hermit crab", "isopod", +"white storkCiconia ciconia", "black storkCiconia nigra", +"spoonbill", "flamingo", "little blue heronEgretta caerulea", +"American egretgreat white heronEgretta albus", "bittern", "crane", +"limpkinAramus pictus", "European gallinulePorphyrio porphyrio", +"American cootmarsh henmud henwater henFulica americana", "bustard", +"ruddy turnstoneArenaria interpres", "red-backed sandpiperdunlinErolia alpina", +"redshankTringa totanus", "dowitcher", "oystercatcheroyster catcher", "pelican", +"king penguinAptenodytes patagonica", "albatrossmollymawk", +"grey whalegray whaledevilfishEschrichtius gibbosusEschrichtius robustus", +"killer whalekillerorcagrampussea wolfOrcinus orca", "dugongDugong dugon", +"sea lion", "Chihuahua", "Japanese spaniel", "Maltese dogMaltese terrierMaltese", +"PekinesePekingesePeke", "Shih-Tzu", "Blenheim spaniel", "papillon", "toy terrier", +"Rhodesian ridgeback", "Afghan houndAfghan", "bassetbasset hound", "beagle", +"bloodhound sleuthhound", "bluetick", "black-and-tan coonhound", "Walker houndWalker foxhound", +"English foxhound", "redbone", "borzoiRussian wolfhound", "Irish wolfhound", "Italian greyhound", +"whippet", "Ibizan houndIbizan Podenco", "Norwegian elkhoundelkhound", "otterhoundotter hound", +"Salukigazelle hound", "Scottish deerhounddeerhound", "Weimaraner", +"Staffordshire bullterrierStaffordshire bull terrier", +"American Staffordshire terrierStaffordshire terrierAmerican pit bull terrierpit bull terrier", +"Bedlington terrier", "Border terrier", "Kerry blue terrier", "Irish terrier", +"Norfolk terrier", "Norwich terrier", "Yorkshire terrier", "wire-haired fox terrier", +"Lakeland terrier", "Sealyham terrierSealyham", "AiredaleAiredale terrier", +"cairncairn terrier", "Australian terrier", "Dandie DinmontDandie Dinmont terrier", +"Boston bullBoston terrier", "miniature schnauzer", "giant schnauzer", +"standard schnauzer", "Scotch terrierScottish terrierScottie", "Tibetan terrierchrysanthemum dog", +"silky terrierSydney silky", "soft-coated wheaten terrier", "West Highland white terrier", +"LhasaLhasa apso", "flat-coated retriever", "curly-coated retriever", "golden retriever", +"Labrador retriever", "Chesapeake Bay retriever", "German short-haired pointer", +"vizslaHungarian pointer", "English setter", "Irish setterred setter", "Gordon setter", +"Brittany spaniel", "clumberclumber spaniel", "English springerEnglish springer spaniel", +"Welsh springer spaniel", "cocker spanielEnglish cocker spanielcocker", "Sussex spaniel", +"Irish water spaniel", "kuvasz", "schipperke", "groenendael", "malinois", "briard", "kelpie", +"komondor", "Old English sheepdogbobtail", "Shetland sheepdogShetland sheep dogShetland", +"collie", "Border collie", "Bouvier des FlandresBouviers des Flandres", "Rottweiler", +"German shepherdGerman shepherd dogGerman police dogalsatian", "DobermanDoberman pinscher", +"miniature pinscher", "Greater Swiss Mountain dog", "Bernese mountain dog", "Appenzeller", +"EntleBucher", "boxer", "bull mastiff", "Tibetan mastiff", "French bulldog", "Great Dane", +"Saint BernardSt Bernard", "Eskimo doghusky", "malamutemalemuteAlaskan malamute", "Siberian husky", +"dalmatiancoach dogcarriage dog", "affenpinschermonkey pinschermonkey dog", "basenji", "pugpug-dog", +"Leonberg", "NewfoundlandNewfoundland dog", "Great Pyrenees", "SamoyedSamoyede", "Pomeranian", +"chowchow chow", "keeshond", "Brabancon griffon", "PembrokePembroke Welsh corgi", +"CardiganCardigan Welsh corgi", "toy poodle", "miniature poodle", "standard poodle", +"Mexican hairless", "timber wolfgrey wolfgray wolfCanis lupus", +"white wolfArctic wolfCanis lupus tundrarum", +"red wolfmaned wolfCanis rufusCanis niger", "coyoteprairie wolfbrush wolfCanis latrans", +"dingowarrigalwarragalCanis dingo", "dholeCuon alpinus", +"African hunting doghyena dogCape hunting dogLycaon pictus", "hyenahyaena", "red foxVulpes vulpes", +"kit foxVulpes macrotis", "Arctic foxwhite foxAlopex lagopus", "grey foxgray foxUrocyon cinereoargenteus", +"tabbytabby cat", "tiger cat", "Persian cat", "Siamese catSiamese", "Egyptian cat", +"cougarpumacatamountmountain lionpainterpantherFelis concolor", "lynxcatamount", "leopardPanthera pardus", +"snow leopardouncePanthera uncia", "jaguarpantherPanthera oncaFelis onca", "lionking of beastsPanthera leo", +"tigerPanthera tigris", "cheetahchetahAcinonyx jubatus", "brown bearbruinUrsus arctos", +"American black bearblack bearUrsus americanusEuarctos americanus", +"ice bearpolar bearUrsus MaritimusThalarctos maritimus", "sloth bearMelursus ursinusUrsus ursinus", +"mongoose", "meerkatmierkat", "tiger beetle", "ladybugladybeetlelady beetleladybirdladybird beetle", +"ground beetlecarabid beetle", "long-horned beetlelongicornlongicorn beetle", "leaf beetlechrysomelid", +"dung beetle", "rhinoceros beetle", "weevil", "fly", "bee", "antemmetpismire", "grasshopperhopper", +"cricket", "walking stickwalkingstickstick insect", "cockroachroach", "mantismantid", "cicadacicala", +"leafhopper", "lacewinglacewing fly", +"dragonflydarning needledevil's darning needlesewing needlesnake feedersnake doctormosquito hawkskeeter hawk", +"damselfly", "admiral", "ringletringlet butterfly", "monarchmonarch butterflymilkweed butterflyDanaus plexippus", +"cabbage butterfly", "sulphur butterflysulfur butterfly", "lycaenidlycaenid butterfly", "starfishsea star", +"sea urchin", "sea cucumberholothurian", "wood rabbitcottontailcottontail rabbit", "hare", "AngoraAngora rabbit", +"hamster", "porcupinehedgehog", "fox squirreleastern fox squirrelSciurus niger", "marmot", "beaver", +"guinea pigCavia cobaya", "sorrel", "zebra", "hogpiggruntersquealerSus scrofa", "wild boarboarSus scrofa", +"warthog", "hippopotamushipporiver horseHippopotamus amphibius", "ox", +"water buffalowater oxAsiatic buffaloBubalus bubalis", "bison", "ramtup", +"bighornbighorn sheepcimarronRocky Mountain bighornRocky Mountain sheepOvis canadensis", "ibexCapra ibex", +"hartebeest", "impalaAepyceros melampus", "gazelle", "Arabian cameldromedaryCamelus dromedarius", "llama", +"weasel", "mink", "polecatfitchfoulmartfoumartMustela putorius", "black-footed ferretferretMustela nigripes", +"otter", "skunkpolecatwood pussy", "badger", "armadillo", "three-toed slothaiBradypus tridactylus", +"orangutanorangorangutangPongo pygmaeus", "gorillaGorilla gorilla", "chimpanzeechimpPan troglodytes", +"gibbonHylobates lar", "siamangHylobates syndactylusSymphalangus syndactylus", "guenonguenon monkey", +"patashussar monkeyErythrocebus patas", "baboon", "macaque", "langur", "colobuscolobus monkey", +"proboscis monkeyNasalis larvatus", "marmoset", "capuchinringtailCebus capucinus", "howler monkeyhowler", +"titititi monkey", "spider monkeyAteles geoffroyi", "squirrel monkeySaimiri sciureus", +"Madagascar catring-tailed lemurLemur catta", "indriindrisIndri indriIndri brevicaudatus", +"Indian elephantElephas maximus", "African elephantLoxodonta africana", +"lesser pandared pandapandabear catcat bearAilurus fulgens", +"giant pandapandapanda bearcoon bearAiluropoda melanoleuca", +"barracoutasnoek", "eel", "cohocohoecoho salmonblue jacksilver salmonOncorhynchus kisutch", +"rock beautyHolocanthus tricolor", "anemone fish", "sturgeon", "gargarfishgarpikebillfishLepisosteus osseus", +"lionfish", "pufferpufferfishblowfishglobefish", "abacus", "abaya", "academic gownacademic robejudge's robe", +"accordionpiano accordionsqueeze box", "acoustic guitar", "aircraft carriercarrierflattopattack aircraft carrier", +"airliner", "airshipdirigible", "altar", "ambulance", "amphibianamphibious vehicle", "analog clock", +"apiarybee house", "apron", "ashcantrash cangarbage canwastebinash binash-binashbindustbintrash barreltrash bin", +"assault rifleassault gun", "backpackback packknapsackpacksackrucksackhaversack", "bakerybakeshopbakehouse", +"balance beambeam", "balloon", "ballpointballpoint penballpenBiro", "Band Aid", "banjo", +"bannisterbanisterbalustradebalustershandrail", "barbell", "barber chair", "barbershop", +"barn", "barometer", "barrelcask", "barrowgarden cartlawn cartwheelbarrow", "baseball", "basketball", +"bassinet", "bassoon", "bathing capswimming cap", "bath towel", "bathtubbathing tubbathtub", +"beach wagonstation wagonwagonestate carbeach waggonstation waggonwaggon", "beaconlighthousebeacon lightpharos", +"beaker", "bearskinbusbyshako", "beer bottle", "beer glass", "bell cotebell cot", "bib", +"bicycle-built-for-twotandem bicycletandem", "bikinitwo-piece", "binderring-binder", +"binocularsfield glassesopera glasses", "birdhouse", "boathouse", "bobsledbobsleighbob", +"bolo tiebolobola tiebola", "bonnetpoke bonnet", "bookcase", "bookshopbookstorebookstall", +"bottlecap", "bow", "bow tiebow-tiebowtie", "brassmemorial tabletplaque", "brassierebrabandeau", +"breakwatergroingroynemolebulwarkseawalljetty", "breastplateaegisegis", "broom", "bucketpail", "buckle", +"bulletproof vest", "bullet trainbullet", "butcher shopmeat market", "cabhacktaxitaxicab", "caldroncauldron", +"candletaperwax light", "cannon", "canoe", "can openertin opener", "cardigan", "car mirror", +"carouselcarrouselmerry-go-roundroundaboutwhirligig", "carpenter's kittool kit", "carton", "car wheel", +"cash machinecash dispenserautomated teller machineautomatic teller machineautomated tellerautomatic tellerATM", +"cassette", "cassette player", "castle", "catamaran", "CD player", "cellovioloncello", +"cellular telephonecellular phonecellphonecellmobile phone", "chain", "chainlink fence", +"chain mailring mailmailchain armorchain armourring armorring armour", "chain sawchainsaw", "chest", +"chiffoniercommode", "chimebellgong", "china cabinetchina closet", "Christmas stocking", "churchchurch building", +"cinemamovie theatermovie theatremovie housepicture palace", "cleavermeat cleaverchopper", "cliff dwelling", +"cloak", "cloggetapattensabot", "cocktail shaker", "coffee mug", "coffeepot", "coilspiralvolutewhorlhelix", +"combination lock", "computer keyboardkeypad", "confectioneryconfectionarycandy store", +"container shipcontainershipcontainer vessel", "convertible", "corkscrewbottle screw", "cornethorntrumpettrump", +"cowboy boot", "cowboy hatten-gallon hat", "cradle", "crane", "crash helmet", "crate", "cribcot", "Crock Pot", +"croquet ball", "crutch", "cuirass", "damdikedyke", "desk", "desktop computer", "dial telephonedial phone", +"diapernappynapkin", "digital clock", "digital watch", "dining tableboard", "dishragdishcloth", +"dishwasherdish washerdishwashing machine", "disk brakedisc brake", "dockdockagedocking facility", +"dogsleddog sleddog sleigh", "dome", "doormatwelcome mat", "drilling platformoffshore rig", +"drummembranophonetympan", "drumstick", "dumbbell", "Dutch oven", "electric fanblower", "electric guitar", +"electric locomotive", "entertainment center", "envelope", "espresso maker", "face powder", "feather boaboa", +"filefile cabinetfiling cabinet", "fireboat", "fire enginefire truck", "fire screenfireguard", "flagpoleflagstaff", +"flutetransverse flute", "folding chair", "football helmet", "forklift", "fountain", "fountain pen", "four-poster", +"freight car", "French hornhorn", "frying panfrypanskillet", "fur coat", "garbage truckdustcart", +"gasmaskrespiratorgas helmet", "gas pumpgasoline pumppetrol pumpisland dispenser", "goblet", "go-kart", "golf ball", +"golfcartgolf cart", "gondola", "gongtam-tam", "gown", "grand pianogrand", "greenhousenurseryglasshouse", +"grilleradiator grille", "grocery storegroceryfood marketmarket", "guillotine", "hair slide", "hair spray", +"half track", "hammer", "hamper", "hand blowerblow dryerblow drierhair dryerhair drier", +"hand-held computerhand-held microcomputer", "handkerchiefhankiehankyhankey", "hard dischard diskfixed disk", +"harmonicamouth organharpmouth harp", "harp", "harvesterreaper", "hatchet", "holster", "home theaterhome theatre", +"honeycomb", "hookclaw", "hoopskirtcrinoline", "horizontal barhigh bar", "horse carthorse-cart", "hourglass", +"iPod", "ironsmoothing iron", "jack-o'-lantern", "jeanblue jeandenim", "jeeplandrover", "jerseyT-shirttee shirt", +"jigsaw puzzle", "jinrikisharicksharickshaw", "joystick", "kimono", "knee pad", "knot", "lab coatlaboratory coat", +"ladle", "lampshadelamp shade", "laptoplaptop computer", "lawn mowermower", "lens caplens cover", +"letter openerpaper knifepaperknife", "library", "lifeboat", "lighterlightigniterignitor", "limousinelimo", +"linerocean liner", "lipsticklip rouge", "Loafer", "lotion", +"loudspeakerspeakerspeaker unitloudspeaker systemspeaker system", +"loupejeweler's loupe", "lumbermillsawmill", "magnetic compass", "mailbagpostbag", +"mailboxletter box", "maillot", "maillottank suit", "manhole cover", "maraca", +"marimbaxylophone", "mask", "matchstick", "maypole", "mazelabyrinth", "measuring cup", +"medicine chestmedicine cabinet", "megalithmegalithic structure", "microphonemike", +"microwavemicrowave oven", "military uniform", "milk can", "minibus", "miniskirtmini", "minivan", "missile", +"mitten", "mixing bowl", "mobile homemanufactured home", "Model T", "modem", "monastery", "monitor", "moped", +"mortar", "mortarboard", "mosque", "mosquito net", "motor scooterscooter", "mountain bikeall-terrain bikeoff-roader", +"mountain tent", "mousecomputer mouse", "mousetrap", "moving van", "muzzle", "nail", "neck brace", "necklace", +"nipple", "notebooknotebook computer", "obelisk", "oboehautboyhautbois", "ocarinasweet potato", +"odometerhodometermileometermilometer", "oil filter", "organpipe organ", +"oscilloscopescopecathode-ray oscilloscopeCRO", "overskirt", "oxcart", "oxygen mask", "packet", +"paddleboat paddle", "paddlewheelpaddle wheel", "padlock", "paintbrush", "pajamapyjamapj'sjammies", +"palace", "panpipepandean pipesyrinx", "paper towel", "parachutechute", "parallel barsbars", +"park bench", "parking meter", "passenger carcoachcarriage", "patioterrace", "pay-phonepay-station", +"pedestalplinthfootstall", "pencil boxpencil case", "pencil sharpener", "perfumeessence", "Petri dish", +"photocopier", "pickplectrumplectron", "pickelhaube", "picket fencepaling", "pickuppickup truck", "pier", +"piggy bankpenny bank", "pill bottle", "pillow", "ping-pong ball", "pinwheel", "piratepirate ship", +"pitcherewer", "planecarpenter's planewoodworking plane", "planetarium", "plastic bag", "plate rack", "plowplough", +"plungerplumber's helper", "Polaroid cameraPolaroid Land camera", "pole", +"police vanpolice wagonpaddy wagonpatrol wagonwagonblack Maria", "poncho", "pool tablebilliard tablesnooker table", +"pop bottlesoda bottle", "potflowerpot", "potter's wheel", "power drill", "prayer rugprayer mat", "printer", +"prisonprison house", "projectilemissile", "projector", "puckhockey puck", +"punching bagpunch bagpunching ballpunchball", "purse", "quillquill pen", "quiltcomfortercomfortpuff", +"racerrace carracing car", "racketracquet", "radiator", "radiowireless", "radio telescoperadio reflector", +"rain barrel", "recreational vehicleRVR.V.", "reel", "reflex camera", "refrigeratoricebox", "remote controlremote", +"restauranteating houseeating placeeatery", "revolversix-gunsix-shooter", "rifle", "rocking chairrocker", +"rotisserie", "rubber eraserrubberpencil eraser", "rugby ball", "ruleruler", "running shoe", "safe", "safety pin", +"saltshakersalt shaker", "sandal", "sarong", "saxsaxophone", "scabbard", "scaleweighing machine", "school bus", +"schooner", "scoreboard", "screenCRT screen", "screw", "screwdriver", "seat beltseatbelt", "sewing machine", +"shieldbuckler", "shoe shopshoe-shopshoe store", "shoji", "shopping basket", "shopping cart", "shovel", +"shower cap", "shower curtain", "ski", "ski mask", "sleeping bag", "slide ruleslipstick", "sliding door", +"slotone-armed bandit", "snorkel", "snowmobile", "snowplowsnowplough", "soap dispenser", "soccer ball", +"sock", "solar dishsolar collectorsolar furnace", "sombrero", "soup bowl", "space bar", "space heater", +"space shuttle", "spatula", "speedboat", "spider webspider's web", "spindle", "sports carsport car", +"spotlightspot", "stage", "steam locomotive", "steel arch bridge", "steel drum", "stethoscope", "stole", +"stone wall", "stopwatchstop watch", "stove", "strainer", "streetcartramtramcartrolleytrolley car", "stretcher", +"studio couchday bed", "stupatope", "submarinepigboatsubU-boat", "suitsuit of clothes", "sundial", "sunglass", +"sunglassesdark glassesshades", "sunscreensunblocksun blocker", "suspension bridge", "swabswobmop", "sweatshirt", +"swimming trunksbathing trunks", "swing", "switchelectric switchelectrical switch", "syringe", "table lamp", +"tankarmy tankarmored combat vehiclearmoured combat vehicle", "tape player", "teapot", "teddyteddy bear", +"televisiontelevision system", "tennis ball", "thatchthatched roof", "theater curtaintheatre curtain", +"thimble", "thresherthrasherthreshing machine", "throne", "tile roof", "toaster", +"tobacco shoptobacconist shoptobacconist", "toilet seat", "torch", "totem pole", "tow trucktow carwrecker", +"toyshop", "tractor", "trailer trucktractor trailertrucking rigrigarticulated lorrysemi", "tray", "trench coat", +"tricycletrikevelocipede", "trimaran", "tripod", "triumphal arch", "trolleybustrolley coachtrackless trolley", +"trombone", "tubvat", "turnstile", "typewriter keyboard", "umbrella", "unicyclemonocycle", "uprightupright piano", +"vacuumvacuum cleaner", "vase", "vault", "velvet", "vending machine", "vestment", "viaduct", "violinfiddle", +"volleyball", "waffle iron", "wall clock", "walletbillfoldnotecasepocketbook", "wardrobeclosetpress", +"warplanemilitary plane", "washbasinhandbasinwashbowllavabowash-hand basin", "washerautomatic washerwashing machine", +"water bottle", "water jug", "water tower", "whiskey jug", "whistle", "wig", "window screen", "window shade", +"Windsor tie", "wine bottle", "wing", "wok", "wooden spoon", "woolwoolenwoollen", +"worm fencesnake fencesnake-rail fenceVirginia fence", "wreck", "yawl", "yurt", "web sitewebsiteinternet sitesite", +"comic book", "crossword puzzlecrossword", "street sign", "traffic lighttraffic signalstoplight", +"book jacketdust coverdust jacketdust wrapper", "menu", "plate", "guacamole", "consomme", "hot pothotpot", +"trifle", "ice creamicecream", "ice lollylollylollipoppopsicle", "French loaf", "bagelbeigel", "pretzel", +"cheeseburger", "hotdoghot dogred hot", "mashed potato", "head cabbage", "broccoli", "cauliflower", +"zucchinicourgette", "spaghetti squash", "acorn squash", "butternut squash", "cucumbercuke", +"artichokeglobe artichoke", "bell pepper", "cardoon", "mushroom", "Granny Smith", "strawberry", +"orange", "lemon", "fig", "pineappleananas", "banana", "jackfruitjakjack", "custard apple", +"pomegranate", "hay", "carbonara", "chocolate saucechocolate syrup", "dough", "meat loafmeatloaf", +"pizzapizza pie", "potpie", "burrito", "red wine", "espresso", "cup", "eggnog", "alp", "bubble", +"cliffdropdrop-off", "coral reef", "geyser", "lakesidelakeshore", "promontoryheadlandheadforeland", +"sandbarsand bar", "seashorecoastseacoastsea-coast", "valleyvale", "volcano", "ballplayerbaseball player", +"groombridegroom", "scuba diver", "rapeseed", "daisy", +"yellow lady's slipperyellow lady-slipperCypripedium calceolusCypripedium parviflorum", "corn", "acorn", +"hiprose hiprosehip", "buckeyehorse chestnutconker", "coral fungus", "agaric", "gyromitra", +"stinkhorncarrion fungus", "earthstar", "hen-of-the-woodshen of the woodsPolyporus frondosusGrifola frondosa", +"bolete", "earspikecapitulum", "toilet tissuetoilet paperbathroom tissue"}; +#endif // modelInference_label_H + diff --git a/AIApplication/ResnetPicture/src/main.cpp b/AIApplication/ResnetPicture/src/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3cfc097a3092b5c3c58f7fb83f0fcfad8a67584b --- /dev/null +++ b/AIApplication/ResnetPicture/src/main.cpp @@ -0,0 +1,66 @@ +#include +#include +#include +#include +#include "acllite_dvpp_lite/ImgProc.h" +#include "acllite_om_execute/ModelProc.h" +#include "label.h" +using namespace std; +using namespace acllite; + +int main() +{ + AclLiteResource aclResource; + bool ret = aclResource.Init(); + CHECK_RET(ret, LOG_PRINT("[ERROR] InitACLResource failed."); return 1); + + ImgProc imgProc; + ModelProc modelProc; + ret = modelProc.Load("../model/resnet50.om"); + CHECK_RET(ret, LOG_PRINT("[ERROR] load model resnet50.om failed."); return 1); + ImgData src = imgProc.ImRead("../data/dog1_1024_683.jpg"); + CHECK_RET(src.size, LOG_PRINT("[ERROR] ImRead image failed."); return 1); + + ImgData dst; + ImgSize dsize; + dsize.width = 224; + dsize.height = 224; + + imgProc.Resize(src, dst, dsize); + ret = modelProc.CreateInput(static_cast(dst.data.get()), dst.size); + CHECK_RET(ret, LOG_PRINT("[ERROR] Create model input failed."); return 1); + vector inferOutputs; + modelProc.Execute(inferOutputs); + CHECK_RET(ret, LOG_PRINT("[ERROR] model execute failed."); return 1); + + uint32_t dataSize = inferOutputs[0].size; + // get result from output data set + float* outData = static_cast(inferOutputs[0].data.get()); + if (outData == nullptr) { + LOG_PRINT("get result from output data set failed."); + return 1; + } + map > resultMap; + for (uint32_t j = 0; j < dataSize / sizeof(float); ++j) { + resultMap[*outData] = j; + outData++; + } + + uint32_t topConfidenceLevels = 5; + double totalValue = 0.0; + for (auto it = resultMap.begin(); it != resultMap.end(); ++it) { + totalValue += exp(it->first); + } + + int cnt = 0; + for (auto it = resultMap.begin(); it != resultMap.end(); ++it) { + // print top 5 + if (++cnt > topConfidenceLevels) { + break; + } + LOG_PRINT("[INFO] top %d: index[%d] value[%lf] class[%s]", cnt, it->second, + exp(it->first) / totalValue, label[it->second].c_str()); + } + outData = nullptr; + return 0; +} \ No newline at end of file diff --git a/AIApplication/YOLOV5MultiInput/README.md b/AIApplication/YOLOV5MultiInput/README.md new file mode 100644 index 0000000000000000000000000000000000000000..c50c818909d95966164db571c0516c455798180b --- /dev/null +++ b/AIApplication/YOLOV5MultiInput/README.md @@ -0,0 +1,113 @@ +## 目录 + + - [样例介绍](#样例介绍) + - [获取源码包](#获取源码包) + - [第三方依赖安装](#第三方依赖安装) + - [编译安装](#编译安装) + - [其他资源](#其他资源) + - [更新说明](#更新说明) + - [已知issue](#已知issue) + +## 样例介绍 + +演示如何使用DVPPLite和OMExecute进行离线推理的简单样例,使用16路mp4离线视频流作为程序输入,使用yolov5s模型对输入视频中的物体做实时检测,将推理结果信息使用imshow方式显示。 + +## 获取源码包 + + 可以使用以下两种方式下载,请选择其中一种进行源码准备。 + + - 命令行方式下载(下载时间较长,但步骤简单)。 + + ``` + # 开发环境,非root用户命令行中执行以下命令下载源码仓。 + cd ${HOME} + git clone https://gitee.com/alvin_yan/ascend-edge-and-robotics.git + ``` + - 压缩包方式下载(下载时间较短,但步骤稍微复杂)。 + **注:如果需要下载其它版本代码,请先请根据前置条件说明进行samples仓分支切换。** + ``` + # 1. Ascend Edge And Robotics仓右上角选择 【克隆/下载】 下拉框并选择 【下载ZIP】。 + # 2. 将ZIP包上传到开发环境中的普通用户家目录中,【例如:${HOME}/ascend-edge-and-robotics-master.zip】。 + # 3. 开发环境中,执行以下命令,解压zip包。 + cd ${HOME} + unzip ascend-edge-and-robotics-master.zip + ``` + +## 第三方依赖安装 + + 设置环境变量,配置程序编译依赖的头文件,库文件路径。“$HOME/Ascend”请替换“Ascend-cann-toolkit”包的实际安装路径。 + + ``` + export DDK_PATH=/usr/local/Ascend/ascend-toolkit/latest + export NPU_HOST_LIB=$DDK_PATH/runtime/lib64/stub + export LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH + ``` +- Common + + 参考前置步骤[Common安装指导](../../package_library/Common/README.md)安装Common库。 + +- DVPPLite + + 参考前置步骤[DVPPLite安装指导](../../package_library/DVPPLite/README.md)安装DVPPLite库。 + +- OMExecute + + 参考前置步骤[OMExecute安装指导](../../package_library/OMExecute/README.md)安装OMExecute库。 + +## 编译运行 + + + - 数据准备 + + 请从以下链接获取该样例的输入视频,放在data目录下。 + ``` + cd $HOME/ascend-edge-and-robotics/inference_sample/yolov5_sample/data + wget https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/yolov5s/test.mp4 --no-check-certificate + ``` + + + - ATC模型转换 + + 将yolov5s原始模型转换为适配昇腾310B处理器的离线模型(*.om文件),放在model路径下。 + ``` + # 为了方便下载,在这里直接给出原始模型下载及模型转换命令,可以直接拷贝执行。 + cd $HOME/ascend-edge-and-robotics/inference_sample/yolov5_sample/model + wget https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/yolov5s/yolov5s_nms.onnx --no-check-certificate + wget https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/yolov5s/aipp.cfg --no-check-certificate + atc --model=yolov5s_nms.onnx --framework=5 --output=yolov5s_nms --input_shape="images:1,3,640,640;img_info:1,4" --soc_version=Ascend310B4 --insert_op_conf=aipp.cfg + ``` + + - 样例编译 + + 执行以下命令,执行编译脚本,开始样例编译。 + + ``` + cd $HOME/ascend-edge-and-robotics/inference_sample/yolov5_sample/scripts + bash sample_build.sh + ``` + + - 样例运行 + + 执行运行脚本,开始样例运行。 + + ``` + bash sample_run.sh + + ``` + +## 其他资源 + +以下资源提供了对DVPP硬件媒体数据处理的更深入理解: + +**Documentation** +- [昇腾文档](https://www.hiascend.com/document?tag=community-developer) + +## 更新说明 + | 时间 | 更新事项 | + |----|------| + | 2024/01/04 | 新增README.md | + + +## 已知issue + + 暂无 diff --git a/AIApplication/YOLOV5MultiInput/data/.keep b/AIApplication/YOLOV5MultiInput/data/.keep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/AIApplication/YOLOV5MultiInput/model/.keep b/AIApplication/YOLOV5MultiInput/model/.keep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/AIApplication/YOLOV5MultiInput/scripts/sample_build.sh b/AIApplication/YOLOV5MultiInput/scripts/sample_build.sh new file mode 100644 index 0000000000000000000000000000000000000000..3bf4f9c925fc4e4bf618c12f0b9e146dc4672fce --- /dev/null +++ b/AIApplication/YOLOV5MultiInput/scripts/sample_build.sh @@ -0,0 +1,39 @@ +#!/bin/bash +ScriptPath="$( cd "$(dirname "$BASH_SOURCE")" ; pwd -P )" + +function build() +{ + if [ -d ${ScriptPath}/../out ];then + rm -rf ${ScriptPath}/../out + fi + + if [ -d ${ScriptPath}/../build/intermediates/host ];then + rm -rf ${ScriptPath}/../build/intermediates/host + fi + + mkdir -p ${ScriptPath}/../build/intermediates/host + cd ${ScriptPath}/../build/intermediates/host + + cmake ../../../src -DCMAKE_CXX_COMPILER=g++ -DCMAKE_SKIP_RPATH=TRUE + if [ $? -ne 0 ];then + echo "[ERROR] cmake error, Please check your environment!" + return 1 + fi + make + if [ $? -ne 0 ];then + echo "[ERROR] build failed, Please check your environment!" + return 1 + fi + cd - > /dev/null +} + +function main() +{ + echo "[INFO] Sample preparation" + build + if [ $? -ne 0 ];then + return 1 + fi + echo "[INFO] Sample preparation is complete" +} +main diff --git a/AIApplication/YOLOV5MultiInput/scripts/sample_run.sh b/AIApplication/YOLOV5MultiInput/scripts/sample_run.sh new file mode 100644 index 0000000000000000000000000000000000000000..b56b8e823c77d4d4928c76845aba36d654399a6e --- /dev/null +++ b/AIApplication/YOLOV5MultiInput/scripts/sample_run.sh @@ -0,0 +1,16 @@ +#!/bin/bash +ScriptPath="$( cd "$(dirname "$BASH_SOURCE")" ; pwd -P )" + +function main() +{ + echo "[INFO] The sample starts to run" + running_command="./main" + cd ${ScriptPath}/../out + ${running_command} + if [ $? -ne 0 ];then + echo "[INFO] The program runs failed" + else + echo "[INFO] The program runs successfully" + fi +} +main diff --git a/AIApplication/YOLOV5MultiInput/src/CMakeLists.txt b/AIApplication/YOLOV5MultiInput/src/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc256a07ff08c0d663fd824b2ed70aac294024e4 --- /dev/null +++ b/AIApplication/YOLOV5MultiInput/src/CMakeLists.txt @@ -0,0 +1,56 @@ +# Copyright (c) Huawei Technologies Co., Ltd. 2019. All rights reserved. + +cmake_minimum_required(VERSION 3.5.1) + +project(YOLOV5MultiInput) + +add_compile_options(-std=c++11) + +add_definitions(-DENABLE_DVPP_INTERFACE) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "../../../out") +set(CMAKE_CXX_FLAGS_DEBUG "-fPIC -O0 -g -Wall") +set(CMAKE_CXX_FLAGS_RELEASE "-fPIC -O2 -Wall") + +set(INC_PATH $ENV{DDK_PATH}) +if (NOT DEFINED ENV{DDK_PATH}) + set(INC_PATH "/usr/local/Ascend/ascend-toolkit/latest") + message(STATUS "set default INC_PATH: ${INC_PATH}") +else() + message(STATUS "set INC_PATH: ${INC_PATH}") +endif () + +set(LIB_PATH $ENV{NPU_HOST_LIB}) +if (NOT DEFINED ENV{NPU_HOST_LIB}) + set(LIB_PATH "/usr/local/Ascend/ascend-toolkit/latest/runtime/lib64/stub") + message(STATUS "set default LIB_PATH: ${LIB_PATH}") +else() + message(STATUS "set LIB_PATH: ${LIB_PATH}") +endif () + +find_package(OpenCV REQUIRED) +find_path(AVCODEC_INCLUDE_DIR libavcodec/avcodec.h) +find_library(AVCODEC_LIBRARY avcodec) + +include_directories( + ${OpenCV_INCLUDE_DIRS} + ${AVCODEC_INCLUDE_DIR} + ${INC_PATH}/runtime/include/ + ./ +) + +link_directories( + ${OpenCV_LIB_DIRS} + ${AVCODEC_LIBRARY} + ${LIB_PATH} +) + +add_executable(main + main.cpp) + +if(target STREQUAL "Simulator_Function") + target_link_libraries(main funcsim) +else() + target_link_libraries(main ascendcl acl_dvpp stdc++ dl rt acllite_dvpp_lite acllite_om_execute acllite_common ${AVCODEC_LIBRARY} ${OpenCV_LIBS}) +endif() + +install(TARGETS main DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) diff --git a/AIApplication/YOLOV5MultiInput/src/main.cpp b/AIApplication/YOLOV5MultiInput/src/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ac76ec45283667909be4717013beafd522fcc4f8 --- /dev/null +++ b/AIApplication/YOLOV5MultiInput/src/main.cpp @@ -0,0 +1,336 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "opencv2/opencv.hpp" +#include "opencv2/imgproc/types_c.h" +#include "opencv2/highgui/highgui.hpp" +#include "acllite_dvpp_lite/ImgProc.h" +#include "acllite_om_execute/ModelProc.h" +#include "acllite_dvpp_lite/VideoProc.h" +#include "acllite_common/Queue.h" +#include + +using namespace std; +using namespace acllite; +using namespace cv; +namespace { + aclrtContext context = nullptr; + // Set the number of channels to open the corresponding number of video streams + const int channelNum = 16; + // Set showNum for cv::imshow windows arrangement rules + const int showNum = 4; + const uint32_t modelWidth = 640; + const uint32_t modelHeight = 640; + + const uint32_t fullScreenWidth = 1920; + const uint32_t fullScreenHeight = 1050; + const uint32_t titleHeight = 30; + const int channel[36] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, + 17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35}; + // + bool exitFlag = false; + struct MsgData { + std::shared_ptr data = nullptr; + uint32_t size = 0; + uint32_t width = 0; + uint32_t height = 0; + int ChannelId = 0; + bool videoEnd = false; + cv::Mat srcImg; + }; + + struct MsgOut { + cv::Mat srcImg; + int ChannelId = 0; + bool videoEnd = false; + vector inferOutputs; + }; + + Queue msgDataQueue(32); + Queue msgOutQueue(32); + size_t imageInfoSize; + void* imageInfoBuf; + std::vector winNameList; + + const static std::vector yolov3Label = { "person", "bicycle", "car", "motorbike", + "aeroplane", "bus", "train", "truck", "boat", + "traffic light", "fire hydrant", "stop sign", "parking meter", + "bench", "bird", "cat", "dog", "horse", + "sheep", "cow", "elephant", "bear", "zebra", + "giraffe", "backpack", "umbrella", "handbag", "tie", + "suitcase", "frisbee", "skis", "snowboard", "sports ball", + "kite", "baseball bat", "baseball glove", "skateboard", "surfboard", + "tennis racket", "bottle", "wine glass", "cup", + "fork", "knife", "spoon", "bowl", "banana", + "apple", "sandwich", "orange", "broccoli", "carrot", + "hot dog", "pizza", "donut", "cake", "chair", + "sofa", "potted plant", "bed", "dining table", "toilet", + "TV monitor", "laptop", "mouse", "remote", "keyboard", + "cell phone", "microwave", "oven", "toaster", "sink", + "refrigerator", "book", "clock", "vase", "scissors", + "teddy bear", "hair drier", "toothbrush" }; + + enum BBoxIndex { TOPLEFTX = 0, TOPLEFTY, BOTTOMRIGHTX, BOTTOMRIGHTY, SCORE, LABEL }; + // bounding box line solid + const uint32_t lineSolid = 2; + // opencv draw label params. + const double fountScale = 0.5; + const cv::Scalar fontColor(0, 0, 255); + const uint32_t labelOffset = 11; + // opencv color list for boundingbox + const vector colors { + cv::Scalar(237, 149, 100), cv::Scalar(0, 215, 255), cv::Scalar(50, 205, 50), + cv::Scalar(139, 85, 26) }; + struct Rect { + uint32_t ltX = 0; + uint32_t ltY = 0; + uint32_t rbX = 0; + uint32_t rbY = 0; + }; + struct BBox { + Rect rect; + uint32_t score; + string text; + }; + +} +void Draw(cv::Mat &srcImg, int channel) { + cv::Mat resizedImg; + cv::resize(srcImg, resizedImg, cv::Size(fullScreenWidth/showNum, (fullScreenHeight-titleHeight)/showNum)); + cv::imshow(winNameList[channel], resizedImg); + cv::waitKey(1); +} + +void GetResult(std::vector& inferOutputs, + cv::Mat& srcImage, uint32_t modelWidth, uint32_t modelHeight, + int channelId) +{ + float *detectData = static_cast(inferOutputs[0].data.get()); + uint32_t* boxNum = static_cast(inferOutputs[1].data.get()); + if (boxNum == nullptr) return; + + uint32_t totalBox = boxNum[0]; + int srcWidth = srcImage.cols; + int srcHeight = srcImage.rows; + float widthScale = (float)(srcWidth) / modelWidth; + float heightScale = (float)(srcHeight) / modelHeight; + + for (uint32_t i = 0; i < totalBox; i++) { + cv::Point p1, p2; + uint32_t score = uint32_t(detectData[totalBox * SCORE + i] * 100); + if (score < 70) { + continue; + } + p1.x = detectData[totalBox * TOPLEFTX + i] * widthScale; + p1.y = detectData[totalBox * TOPLEFTY + i] * heightScale; + p2.x = detectData[totalBox * BOTTOMRIGHTX + i] * widthScale; + p2.y = detectData[totalBox * BOTTOMRIGHTY + i] * heightScale; + uint32_t objIndex = (uint32_t)detectData[totalBox * LABEL + i]; + string text = yolov3Label[objIndex] + std::to_string(score) + "\%"; + cv::rectangle(srcImage, p1, p2, colors[i % colors.size()], lineSolid); + cv::putText(srcImage, text, cv::Point(p1.x, p1.y + labelOffset), + cv::FONT_HERSHEY_COMPLEX, fountScale, fontColor); + } + Draw(srcImage, channelId); + return; +} + +void* GetInput(void* arg) { + bool ret = SetCurContext(context); + CHECK_RET(ret, LOG_PRINT("[ERROR] set cur context for pthread %ld failed.", pthread_self()); return NULL); + int32_t devicdeId = 0; + VideoProc cap("../data/test.mp4", devicdeId); + CHECK_RET(cap.IsOpened(), LOG_PRINT("[ERROR] open /dev/video0 failed."); return NULL); + ImgProc imgProc; + ImgData frame; + ImgSize modelSize; + modelSize.width = modelWidth; + modelSize.height = modelHeight; + LOG_PRINT("[INFO] start to decode..."); + uint32_t frameRate =30; + uint32_t cnt = 1; + while(1) { + ret = cap.Read(frame); + if (ret) { + if (cnt % frameRate == 0) { + ImgData dst; + imgProc.Resize(frame, dst, modelSize); + MsgData msgData; + msgData.data = dst.data; + msgData.size = dst.size; + msgData.width = dst.width; + msgData.height = dst.height; + msgData.ChannelId = *(int *)arg; + msgData.videoEnd = false; + cv::Mat yuv_img(frame.height*1.5, frame.width, CV_8UC1); + memcpy(yuv_img.data, (unsigned char*)frame.data.get(), frame.size); + cv::cvtColor(yuv_img, msgData.srcImg, cv::COLOR_YUV2RGB_NV21); + while (1) { + if (msgDataQueue.Push(msgData)) { + break; + } + usleep(100); + } + LOG_PRINT("[INFO] channel %d add msgData. tid : %ld", *(int *)arg, pthread_self()); + } + cnt++; + } else { + LOG_PRINT("[INFO] frame read end."); + break; + } + } + cap.Release(); + MsgData msgData; + msgData.videoEnd = true; + msgData.ChannelId = *(int *)arg; + while (1) { + if (msgDataQueue.Push(msgData)) { + break; + } + usleep(100); + } + LOG_PRINT("[INFO] channel %d add end msgData. tid : %ld", *(int *)arg, pthread_self()); + return NULL; +} + +void* ModelExecute(void* arg) { + bool ret = SetCurContext(context); + CHECK_RET(ret, LOG_PRINT("[ERROR] set cur context for pthread %ld failed.", pthread_self()); return NULL); + ModelProc modelProc; + ret = modelProc.Load("../model/yolov5s_nms.om"); + CHECK_RET(ret, LOG_PRINT("[ERROR] load model yolov5s_nms.om failed."); return NULL); + int num = *(int *)arg; + while(num) { + if(!msgDataQueue.Empty()) { + MsgData msgData = msgDataQueue.Pop(); + if (msgData.videoEnd) { + num--; + } + else { + ret = modelProc.CreateInput(static_cast(msgData.data.get()), msgData.size, imageInfoBuf, imageInfoSize); + CHECK_RET(ret, LOG_PRINT("[ERROR] Create model input failed."); break); + MsgOut msgOut; + msgOut.srcImg = msgData.srcImg; + msgOut.ChannelId = msgData.ChannelId; + msgOut.videoEnd = msgData.videoEnd; + modelProc.Execute(msgOut.inferOutputs); + CHECK_RET(ret, LOG_PRINT("[ERROR] model execute failed."); break); + while (1) { + if (msgOutQueue.Push(msgOut)) { + break; + } + usleep(100); + } + LOG_PRINT("[INFO] channel %d infer msgOut. tid : %ld", msgData.ChannelId, pthread_self()); + } + } + } + modelProc.DestroyResource(); + MsgOut msgOut; + msgOut.videoEnd = true; + while (1) { + if (msgOutQueue.Push(msgOut)) { + break; + } + usleep(100); + } + LOG_PRINT("[INFO] infer msg end. tid : %ld", pthread_self()); + return NULL; +} + +void* PostProcess(void* arg) { + const double fountScale = 1; + const cv::Scalar fountColor(0, 0, 255); + while(1) { + if(!msgOutQueue.Empty()) { + MsgOut msgOut = msgOutQueue.Pop(); + usleep(100); + if (msgOut.videoEnd) { + break; + } + GetResult(msgOut.inferOutputs, msgOut.srcImg, modelWidth, modelHeight, msgOut.ChannelId); + } + } + exitFlag = true; + LOG_PRINT("[INFO] *************** all video get done ***************"); + return NULL; +} + +bool CreateBuffer(uint32_t modelWidth, uint32_t modelHeight) +{ + const float imageInfo[4] = {(float)modelWidth, (float)modelHeight, + (float)modelWidth, (float)modelHeight}; + imageInfoSize = sizeof(imageInfo); + aclrtRunMode runMode; + aclrtGetRunMode(&runMode); + if (runMode == ACL_HOST) { + aclError aclRet = aclrtMalloc(&imageInfoBuf, imageInfoSize, ACL_MEM_MALLOC_NORMAL_ONLY); + CHECK_RET(aclRet == ACL_SUCCESS, LOG_PRINT("[ERROR] acldvppMalloc failed. ERROR: %d", aclRet); return false); + aclRet = aclrtMemcpy(imageInfoBuf, imageInfoSize, (void *)imageInfo, imageInfoSize, ACL_MEMCPY_HOST_TO_DEVICE); + if (aclRet != ACL_SUCCESS) { + LOG_PRINT("[ERROR] aclrtMemcpy failed. ERROR: %d", aclRet); + aclrtFree(imageInfoBuf); + return false; + } + } else { + aclError aclRet = aclrtMalloc(&imageInfoBuf, imageInfoSize, ACL_MEM_MALLOC_NORMAL_ONLY); + CHECK_RET(aclRet == ACL_SUCCESS, LOG_PRINT("[ERROR] acldvppMalloc failed. ERROR: %d", aclRet); return false); + aclRet = aclrtMemcpy(imageInfoBuf, imageInfoSize, (void *)imageInfo, imageInfoSize, ACL_MEMCPY_DEVICE_TO_DEVICE); + if (aclRet != ACL_SUCCESS) { + LOG_PRINT("[ERROR] aclrtMemcpy failed. ERROR: %d", aclRet); + aclrtFree(imageInfoBuf); + return false; + } + } + if (imageInfoBuf == nullptr) { + LOG_PRINT("[ERROR] Copy image info to device failed"); + return false; + } + return true; +} + +int main() { + AclLiteResource aclResource; + bool ret = aclResource.Init(); + CHECK_RET(ret, LOG_PRINT("[ERROR] InitACLResource failed."); return 1); + context = aclResource.GetContext(); + + ret = CreateBuffer(modelWidth, modelHeight); + CHECK_RET(ret, LOG_PRINT("[ERROR] CreateBuffer failed."); return 1); + + pthread_t preTids[channelNum], exeTids, posTids; + for(int i = 0; i < channelNum; i++) { + pthread_create(&preTids[i], NULL, GetInput, (void*)&channel[i]); + } + for (int i = channelNum - 1; i >= 0; i--) { + std::string head = "window"; + string winName = head+to_string(i); + cv::namedWindow(winName, WINDOW_NORMAL); + int x = (channel[i] % showNum) * (fullScreenWidth/showNum); + int y = (channel[i] / showNum) * ((fullScreenHeight-titleHeight)/showNum); + cv::moveWindow(winName, x, y+titleHeight); + cv::resizeWindow(winName, fullScreenWidth/showNum, (fullScreenHeight-titleHeight)/showNum); + winNameList.push_back(winName); + } + + pthread_create(&exeTids, NULL, ModelExecute, (void*)&channelNum); + pthread_create(&posTids, NULL, PostProcess, NULL); + + for(int i = 0; i < channelNum; i++) { + pthread_detach(preTids[i]); + } + pthread_detach(exeTids); + pthread_detach(posTids); + + while(!exitFlag) { + sleep(10); + } + usleep(1000); + return 0; +} diff --git a/AIApplication/YOLOV5USBCamera/README.md b/AIApplication/YOLOV5USBCamera/README.md new file mode 100644 index 0000000000000000000000000000000000000000..20c4950f4a2e25282c558c571698174ed5426bb4 --- /dev/null +++ b/AIApplication/YOLOV5USBCamera/README.md @@ -0,0 +1,100 @@ +# 目标检测(YoloV5s) + +#### 样例介绍 + +通过USB接口连接Camera与开发板,从Camera获取视频,基于yolov5s模型对输入视频中的物体做实时检测,将推理结果信息使用imshow方式显示。 + +#### 样例下载 + +可以使用以下两种方式下载,请选择其中一种进行源码准备。 + +- 命令行方式下载(**下载时间较长,但步骤简单**)。 + + ``` + # 登录开发板,HwHiAiUser用户命令行中执行以下命令下载源码仓。 + cd ${HOME} + git clone https://gitee.com/ascend/EdgeAndRobotics.git + # 切换到样例目录 + cd EdgeAndRobotics/AIApplication/YOLOV5USBCamera + ``` + +- 压缩包方式下载(**下载时间较短,但步骤稍微复杂**)。 + + ``` + # 1. 仓右上角选择 【克隆/下载】 下拉框并选择 【下载ZIP】。 + # 2. 将ZIP包上传到开发板的普通用户家目录中,【例如:${HOME}/EdgeAndRobotics-master.zip】。 + # 3. 开发环境中,执行以下命令,解压zip包。 + cd ${HOME} + chmod +x EdgeAndRobotics-master.zip + unzip EdgeAndRobotics-master.zip + # 4. 切换到样例目录 + cd EdgeAndRobotics-master/AIApplication/YOLOV5USBCamera + ``` + +#### 准备环境 + +1. 以HwHiAiUser用户登录开发板。 + +2. 设置环境变量。 + + ``` + # 配置程序编译依赖的头文件与库文件路径 + export DDK_PATH=/usr/local/Ascend/ascend-toolkit/latest + export NPU_HOST_LIB=$DDK_PATH/runtime/lib64/stub + ``` + +3. 安装ACLLite库。 + + 参考[Common安装指导]()安装ACLLite Common库。 + + 参考[DVPPLite安装指导]()安装DVPPLite库。 + + 参考[OMExecute安装指导]()安装OMExecute库。 + +#### 运行样例 + +1. 以HwHiAiUser用户登录开发板,切换到当前样例目录。 + +2. 获取PyTorch框架的Yolov5模型(\*.onnx),并转换为昇腾AI处理器能识别的模型(\*.om)。 + + ``` + # 为了方便下载,在这里直接给出原始模型下载及模型转换命令,可以直接拷贝执行。 + cd model + wget https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/yolov5s/yolov5s.onnx --no-check-certificate + wget https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/yolov5s/aipp.cfg --no-check-certificate + atc --model=yolov5s.onnx --framework=5 --output=yolov5s --input_shape="images:1,3,640,640" --soc_version=Ascend310B4 --insert_op_conf=aipp.cfg + ``` + + atc命令中各参数的解释如下,详细约束说明请参见[《ATC模型转换指南》](https://hiascend.com/document/redirect/CannCommunityAtc)。 + + - --model:ResNet-50网络的模型文件的路径。 + - --framework:原始框架类型。5表示ONNX。 + - --output:yolov5s.om模型文件的路径。请注意,记录保存该om模型文件的路径,后续开发应用时需要使用。 + - --input\_shape:模型输入数据的shape。 + - --soc\_version:昇腾AI处理器的版本。 + +3. 编译样例源码。 + + 执行以下命令编译样例源码。 + + ``` + cd ../scripts + bash sample_build.sh + ``` + +4. 运行样例。 + + 执行以下脚本运行样例: + + ``` + bash sample_run.sh + ``` + +#### 相关操作 + +- 获取更多样例,请单击[Link](https://gitee.com/ascend/samples/tree/master/inference/modelInference)。 +- 获取在线视频课程,请单击[Link](https://www.hiascend.com/edu/courses?activeTab=%E5%BA%94%E7%94%A8%E5%BC%80%E5%8F%91)。 +- 获取学习文档,请单击[AscendCL C&C++](https://hiascend.com/document/redirect/CannCommunityCppAclQuick),查看最新版本的AscendCL推理应用开发指南。 +- 查模型的输入输出 + + 可使用第三方工具Netron打开网络模型,查看模型输入或输出的数据类型、Shape,便于在分析应用开发场景时使用。 diff --git a/AIApplication/YOLOV5USBCamera/data/.keep b/AIApplication/YOLOV5USBCamera/data/.keep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/AIApplication/YOLOV5USBCamera/model/.keep b/AIApplication/YOLOV5USBCamera/model/.keep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/AIApplication/YOLOV5USBCamera/out/.keep b/AIApplication/YOLOV5USBCamera/out/.keep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/AIApplication/YOLOV5USBCamera/scripts/sample_build.sh b/AIApplication/YOLOV5USBCamera/scripts/sample_build.sh new file mode 100644 index 0000000000000000000000000000000000000000..3bf4f9c925fc4e4bf618c12f0b9e146dc4672fce --- /dev/null +++ b/AIApplication/YOLOV5USBCamera/scripts/sample_build.sh @@ -0,0 +1,39 @@ +#!/bin/bash +ScriptPath="$( cd "$(dirname "$BASH_SOURCE")" ; pwd -P )" + +function build() +{ + if [ -d ${ScriptPath}/../out ];then + rm -rf ${ScriptPath}/../out + fi + + if [ -d ${ScriptPath}/../build/intermediates/host ];then + rm -rf ${ScriptPath}/../build/intermediates/host + fi + + mkdir -p ${ScriptPath}/../build/intermediates/host + cd ${ScriptPath}/../build/intermediates/host + + cmake ../../../src -DCMAKE_CXX_COMPILER=g++ -DCMAKE_SKIP_RPATH=TRUE + if [ $? -ne 0 ];then + echo "[ERROR] cmake error, Please check your environment!" + return 1 + fi + make + if [ $? -ne 0 ];then + echo "[ERROR] build failed, Please check your environment!" + return 1 + fi + cd - > /dev/null +} + +function main() +{ + echo "[INFO] Sample preparation" + build + if [ $? -ne 0 ];then + return 1 + fi + echo "[INFO] Sample preparation is complete" +} +main diff --git a/AIApplication/YOLOV5USBCamera/scripts/sample_run.sh b/AIApplication/YOLOV5USBCamera/scripts/sample_run.sh new file mode 100644 index 0000000000000000000000000000000000000000..b56b8e823c77d4d4928c76845aba36d654399a6e --- /dev/null +++ b/AIApplication/YOLOV5USBCamera/scripts/sample_run.sh @@ -0,0 +1,16 @@ +#!/bin/bash +ScriptPath="$( cd "$(dirname "$BASH_SOURCE")" ; pwd -P )" + +function main() +{ + echo "[INFO] The sample starts to run" + running_command="./main" + cd ${ScriptPath}/../out + ${running_command} + if [ $? -ne 0 ];then + echo "[INFO] The program runs failed" + else + echo "[INFO] The program runs successfully" + fi +} +main diff --git a/AIApplication/YOLOV5USBCamera/src/CMakeLists.txt b/AIApplication/YOLOV5USBCamera/src/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..83bc2436418007f88807239be2350faa840b2ca0 --- /dev/null +++ b/AIApplication/YOLOV5USBCamera/src/CMakeLists.txt @@ -0,0 +1,56 @@ +# Copyright (c) Huawei Technologies Co., Ltd. 2019. All rights reserved. + +cmake_minimum_required(VERSION 3.5.1) + +project(sampleUsbCamera) + +add_compile_options(-std=c++11) + +add_definitions(-DENABLE_DVPP_INTERFACE) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "../../../out") +set(CMAKE_CXX_FLAGS_DEBUG "-fPIC -O0 -g -Wall") +set(CMAKE_CXX_FLAGS_RELEASE "-fPIC -O2 -Wall") + +set(INC_PATH $ENV{DDK_PATH}) +if (NOT DEFINED ENV{DDK_PATH}) + set(INC_PATH "/usr/local/Ascend/ascend-toolkit/latest") + message(STATUS "set default INC_PATH: ${INC_PATH}") +else() + message(STATUS "set INC_PATH: ${INC_PATH}") +endif () + +set(LIB_PATH $ENV{NPU_HOST_LIB}) +if (NOT DEFINED ENV{NPU_HOST_LIB}) + set(LIB_PATH "/usr/local/Ascend/ascend-toolkit/latest/runtime/lib64/stub") + message(STATUS "set default LIB_PATH: ${LIB_PATH}") +else() + message(STATUS "set LIB_PATH: ${LIB_PATH}") +endif () + +find_package(OpenCV REQUIRED) +find_path(AVCODEC_INCLUDE_DIR libavcodec/avcodec.h) +find_library(AVCODEC_LIBRARY avcodec) + +include_directories( + ${OpenCV_INCLUDE_DIRS} + ${AVCODEC_INCLUDE_DIR} + ${INC_PATH}/runtime/include/ + ./ +) + +link_directories( + ${OpenCV_LIB_DIRS} + ${AVCODEC_LIBRARY} + ${LIB_PATH} +) + +add_executable(main + main.cpp) + +if(target STREQUAL "Simulator_Function") + target_link_libraries(main funcsim) +else() + target_link_libraries(main ascendcl acl_dvpp stdc++ dl rt acllite_dvpp_lite acllite_om_execute acllite_common ${AVCODEC_LIBRARY} ${OpenCV_LIBS}) +endif() + +install(TARGETS main DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) diff --git a/AIApplication/YOLOV5USBCamera/src/label.h b/AIApplication/YOLOV5USBCamera/src/label.h new file mode 100644 index 0000000000000000000000000000000000000000..246a2f485a1eb3394b884b0923cf53106fbf5759 --- /dev/null +++ b/AIApplication/YOLOV5USBCamera/src/label.h @@ -0,0 +1,40 @@ +/** +* Copyright (c) Huawei Technologies Co., Ltd. 2020-2022. All rights reserved. +* +* 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. + +* File label.h +* Description: label result +*/ +#ifndef modelInference_label_H +#define modelInference_label_H +using namespace std; +const string label[] ={"person", "bicycle", "car", "motorbike", +"aeroplane", "bus", "train", "truck", "boat", +"traffic light", "fire hydrant", "stop sign", "parking meter", +"bench", "bird", "cat", "dog", "horse", +"sheep", "cow", "elephant", "bear", "zebra", +"giraffe", "backpack", "umbrella", "handbag", "tie", +"suitcase", "frisbee", "skis", "snowboard", "sports ball", +"kite", "baseball bat", "baseball glove", "skateboard", +"surfboard", +"tennis racket", "bottle", "wine glass", "cup", +"fork", "knife", "spoon", "bowl", "banana", +"apple", "sandwich", "orange", "broccoli", "carrot", +"hot dog", "pizza", "donut", "cake", "chair", +"sofa", "potted plant", "bed", "dining table", "toilet", +"TV monitor", "laptop", "mouse", "remote", "keyboard", +"cell phone", "microwave", "oven", "toaster", "sink", +"refrigerator", "book", "clock", "vase", "scissors", +"teddy bear", "hair drier", "toothbrush"}; +#endif //modelInference_label_H diff --git a/AIApplication/YOLOV5USBCamera/src/main.cpp b/AIApplication/YOLOV5USBCamera/src/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..27f38f6c618ee9a0db2b6abda7d260695f21fdc0 --- /dev/null +++ b/AIApplication/YOLOV5USBCamera/src/main.cpp @@ -0,0 +1,189 @@ +#include +#include +#include +#include +#include "opencv2/opencv.hpp" +#include "opencv2/imgproc/types_c.h" +#include "opencv2/highgui/highgui.hpp" +#include "acllite_dvpp_lite/ImgProc.h" +#include "acllite_om_execute/ModelProc.h" +#include "acllite_dvpp_lite/VideoProc.h" +#include "label.h" + +using namespace std; +using namespace acllite; +using namespace cv; + typedef struct BoundBox { + float x; + float y; + float width; + float height; + float score; + size_t classIndex; + size_t index; + } BoundBox; + + bool sortScore(BoundBox box1, BoundBox box2) + { + return box1.score > box2.score; + } + +void GetResult(std::vector& inferOutputs, + cv::Mat& srcImage, uint32_t modelWidth, uint32_t modelHeight) +{ + uint32_t outputDataBufId = 0; + float *classBuff = static_cast(inferOutputs[outputDataBufId].data.get()); + float confidenceThreshold = 0.25; + size_t classNum = 80; + size_t offset = 5; + size_t totalNumber = classNum + offset; + size_t modelOutputBoxNum = 25200; + size_t startIndex = 5; + int srcWidth = srcImage.cols; + int srcHeight = srcImage.rows; + + vector boxes; + size_t yIndex = 1; + size_t widthIndex = 2; + size_t heightIndex = 3; + size_t classConfidenceIndex = 4; + for (size_t i = 0; i < modelOutputBoxNum; ++i) { + float maxValue = 0; + float maxIndex = 0; + for (size_t j = startIndex; j < totalNumber; ++j) { + float value = classBuff[i * totalNumber + j] * classBuff[i * totalNumber + classConfidenceIndex]; + if (value > maxValue) { + maxIndex = j - startIndex; + maxValue = value; + } + } + float classConfidence = classBuff[i * totalNumber + classConfidenceIndex]; + if (classConfidence >= confidenceThreshold) { + size_t index = i * totalNumber + maxIndex + startIndex; + float finalConfidence = classConfidence * classBuff[index]; + BoundBox box; + box.x = classBuff[i * totalNumber] * srcWidth / modelWidth; + box.y = classBuff[i * totalNumber + yIndex] * srcHeight / modelHeight; + box.width = classBuff[i * totalNumber + widthIndex] * srcWidth/modelWidth; + box.height = classBuff[i * totalNumber + heightIndex] * srcHeight / modelHeight; + box.score = finalConfidence; + box.classIndex = maxIndex; + box.index = i; + if (maxIndex < classNum) { + boxes.push_back(box); + } + } + } + vector result; + result.clear(); + float NMSThreshold = 0.45; + int32_t maxLength = modelWidth > modelHeight ? modelWidth : modelHeight; + std::sort(boxes.begin(), boxes.end(), sortScore); + BoundBox boxMax; + BoundBox boxCompare; + while (boxes.size() != 0) { + size_t index = 1; + result.push_back(boxes[0]); + while (boxes.size() > index) { + boxMax.score = boxes[0].score; + boxMax.classIndex = boxes[0].classIndex; + boxMax.index = boxes[0].index; + boxMax.x = boxes[0].x + maxLength * boxes[0].classIndex; + boxMax.y = boxes[0].y + maxLength * boxes[0].classIndex; + boxMax.width = boxes[0].width; + boxMax.height = boxes[0].height; + + boxCompare.score = boxes[index].score; + boxCompare.classIndex = boxes[index].classIndex; + boxCompare.index = boxes[index].index; + boxCompare.x = boxes[index].x + boxes[index].classIndex * maxLength; + boxCompare.y = boxes[index].y + boxes[index].classIndex * maxLength; + boxCompare.width = boxes[index].width; + boxCompare.height = boxes[index].height; + float xLeft = max(boxMax.x, boxCompare.x); + float yTop = max(boxMax.y, boxCompare.y); + float xRight = min(boxMax.x + boxMax.width, boxCompare.x + boxCompare.width); + float yBottom = min(boxMax.y + boxMax.height, boxCompare.y + boxCompare.height); + float width = max(0.0f, xRight - xLeft); + float hight = max(0.0f, yBottom - yTop); + float area = width * hight; + float iou = area / (boxMax.width * boxMax.height + boxCompare.width * boxCompare.height - area); + if (iou > NMSThreshold) { + boxes.erase(boxes.begin() + index); + continue; + } + ++index; + } + boxes.erase(boxes.begin()); + } + const double fountScale = 0.5; + const uint32_t lineSolid = 2; + const uint32_t labelOffset = 11; + const cv::Scalar fountColor(0, 0, 255); + const vector colors{ + cv::Scalar(237, 149, 100), cv::Scalar(0, 215, 255), + cv::Scalar(50, 205, 50), cv::Scalar(139, 85, 26)}; + + int half = 2; + for (size_t i = 0; i < result.size(); ++i) { + if (result[i].score < 0.7) { + continue; + } + cv::Point leftUpPoint, rightBottomPoint; + leftUpPoint.x = result[i].x - result[i].width / half; + leftUpPoint.y = result[i].y - result[i].height / half; + rightBottomPoint.x = result[i].x + result[i].width / half; + rightBottomPoint.y = result[i].y + result[i].height / half; + cv::rectangle(srcImage, leftUpPoint, rightBottomPoint, colors[i % colors.size()], lineSolid); + string className = label[result[i].classIndex]; + string markString = to_string(result[i].score) + ":" + className; + cv::putText(srcImage, markString, cv::Point(leftUpPoint.x, leftUpPoint.y + labelOffset), + cv::FONT_HERSHEY_COMPLEX, fountScale, fountColor); + } + cv::imshow("ORB", srcImage); + cv::waitKey(1); + return; +} + +int main() +{ + AclLiteResource aclResource; + bool ret = aclResource.Init(); + CHECK_RET(ret, LOG_PRINT("[ERROR] InitACLResource failed."); return 1); + + VideoProc cap("/dev/video0"); + CHECK_RET(cap.IsOpened(), LOG_PRINT("[ERROR] open /dev/video0 failed."); return 1); + ImgProc imgProc; + ImgData frame; + + ModelProc modelProc; + ret = modelProc.Load("../model/yolov5s.om"); + CHECK_RET(ret, LOG_PRINT("[ERROR] load model yolov5s.om failed."); return 1); + ImgSize modelSize; + modelSize.width = 640; + modelSize.height = 640; + LOG_PRINT("[INFO] start to decode..."); + while(1) { + ret= cap.Read(frame); + if(!ret){ + LOG_PRINT("[INFO] frame read end."); + break; + } + ImgData dst; + imgProc.Resize(frame, dst, modelSize); + + ret = modelProc.CreateInput(static_cast(dst.data.get()), dst.size); + CHECK_RET(ret, LOG_PRINT("[ERROR] Create model input failed."); break); + + vector inferOutputs; + modelProc.Execute(inferOutputs); + CHECK_RET(ret, LOG_PRINT("[ERROR] model execute failed."); break); + + cv::Mat yuyvImg(frame.height, frame.width, CV_8UC2); + memcpy(yuyvImg.data, (unsigned char*)frame.data.get(), frame.size); + cv::Mat rgbImg; + cv::cvtColor(yuyvImg, rgbImg, cv::COLOR_YUV2BGR_YUYV); + GetResult(inferOutputs, rgbImg, modelSize.width, modelSize.height); + } + return 0; +} diff --git a/OnBoardInterface/Audio/MIPIAudio/CMakeLists.txt b/OnBoardInterface/Audio/MIPIAudio/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..551d3486cf74a3f01cf9a09c22dfd539daab9c46 --- /dev/null +++ b/OnBoardInterface/Audio/MIPIAudio/CMakeLists.txt @@ -0,0 +1,45 @@ +# CMake lowest version requirement +cmake_minimum_required(VERSION 3.5.1) + +# project information +project(audio_sample) + +set(LOCAL_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + +set(LIB_PATH $ENV{NPU_HOST_LIB}) +if (NOT DEFINED ENV{NPU_HOST_LIB}) + set(LIB_PATH /usr/local/Ascend/CANN-7.0/runtime/lib64/) + message(STATUS "set default LIB_PATH: ${LIB_PATH}") +else() + message(STATUS "env LIB_PATH: ${LIB_PATH}") +endif() + +set(INC_PATH $ENV{NPU_HOST_INC}) +if (NOT DEFINED ENV{NPU_HOST_INC}) + set(INC_PATH /usr/local/Ascend/CANN-7.0/runtime/include/) + message(STATUS "set default INC_PATH: ${INC_PATH}") +else() + message(STATUS "env INC_PATH: ${INC_PATH}") +endif() + +link_directories( + ${LIB_PATH}/stub/aarch64/ + ${LIB_PATH} +) + +add_definitions(-DTHREADED) + +add_executable(sample_audio + sample_audio.c +) + +include_directories(sample_audio + ${LOCAL_DIR}/include + ${INC_PATH}/acl/media +) + +target_link_libraries(sample_audio + acl_dvpp_mpi + acl_audio_mpi + pthread +) \ No newline at end of file diff --git a/OnBoardInterface/Audio/MIPIAudio/README.md b/OnBoardInterface/Audio/MIPIAudio/README.md new file mode 100644 index 0000000000000000000000000000000000000000..f6a0b1f9bb9bdce04cca91b91f4682b3cf12d99f --- /dev/null +++ b/OnBoardInterface/Audio/MIPIAudio/README.md @@ -0,0 +1,75 @@ +# 播音(MIPI接口) + +#### 样例介绍 + +本样例通过MIPI接口的耳机连接开发板,在运行应用时播放*.pcm音频文件的内容。 + +#### 样例下载 + +可以使用以下两种方式下载,请选择其中一种进行源码准备。 + +- 命令行方式下载(**下载时间较长,但步骤简单**)。 + + ``` + # 登录开发板,HwHiAiUser用户命令行中执行以下命令下载源码仓。 + cd ${HOME} + git clone https://gitee.com/ascend/EdgeAndRobotics.git + # 切换到样例目录 + cd EdgeAndRobotics/OnBoardInterface/Audio/MIPIAudio + ``` + +- 压缩包方式下载(**下载时间较短,但步骤稍微复杂**)。 + + ``` + # 1. 仓右上角选择 【克隆/下载】 下拉框并选择 【下载ZIP】。 + # 2. 将ZIP包上传到开发板的普通用户家目录中,【例如:${HOME}/EdgeAndRobotics-master.zip】。 + # 3. 开发环境中,执行以下命令,解压zip包。 + cd ${HOME} + chmod +x EdgeAndRobotics-master.zip + unzip EdgeAndRobotics-master.zip + # 4. 切换到样例目录 + cd EdgeAndRobotics-master/OnBoardInterface/Audio/MIPIAudio + ``` + +#### 准备环境 + +1. 以HwHiAiUser用户登录开发板。 + +2. 设置环境变量。 + + ``` + # 配置程序编译依赖的头文件与库文件路径 + export DDK_PATH=/usr/local/Ascend/ascend-toolkit/latest + export NPU_HOST_LIB=$DDK_PATH/runtime/lib64/stub + ``` + +#### 样例运行 + +1. 以HwHiAiUser用户登录开发板,切换到当前样例目录。 + +2. 编译样例源码。 + + 依次执行如下命令执行编译: + + ``` + mkdir build + cd build + cmake .. -DCMAKE_C_COMPILER=gcc -DCMAKE_SKIP_RPATH=TRUE + make + ``` + + 在build目录下会生成可执行文件sample_audio。 + +3. 运行样例。 + + 播音命令示例如下,其中pcm文件需根据实际情况替换,文件格式为采样率48kHz,位宽为16bit的单声道音频: + + ``` + ./sample_audio play qzgy_48kHz_16bit_1chn.pcm + ``` + + **注意**:录音任务需要执行 ps aux|grep audio 查询进程号,然后手动 kill -12 [pid] 结束进程 + +#### 相关操作 + +获取学习文档,请单击[AscendCL C&C++](https://hiascend.com/document/redirect/CannCommunityCppAclQuick),查看最新版本的AscendCL推理应用开发指南,在其中的”媒体数据处理(含图像/视频等)>音频获取&音频播放“章节了解接口调用流程。 \ No newline at end of file diff --git a/OnBoardInterface/Audio/MIPIAudio/include/sample_comm_audio.h b/OnBoardInterface/Audio/MIPIAudio/include/sample_comm_audio.h new file mode 100644 index 0000000000000000000000000000000000000000..021f290128b635115300efbd70cc8026eddabbe5 --- /dev/null +++ b/OnBoardInterface/Audio/MIPIAudio/include/sample_comm_audio.h @@ -0,0 +1,31 @@ +/** +* @File sample_comm_audio.h +* @Description audio sample app +* +* Copyright (c) Huawei Technologies Co., Ltd. 2016-2023. All rights reserved. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ +#include "stdio.h" +#include "hi_mpi_audio.h" +#include "hi_acodec.h" + +#define FILE_NAME_LEN 512 + +typedef struct { + hi_bool start; + hi_audio_dev ai_dev; + hi_ai_chn ai_chn; + hi_char file_name[FILE_NAME_LEN]; + pthread_t ai_pid; +} sample_ai; + +typedef struct { + hi_audio_dev ao_dev; + hi_bool start; + hi_char file_name[FILE_NAME_LEN]; + hi_ao_chn ao_chn; + pthread_t ao_pid; +} sample_ao; \ No newline at end of file diff --git a/OnBoardInterface/Audio/MIPIAudio/sample_audio.c b/OnBoardInterface/Audio/MIPIAudio/sample_audio.c new file mode 100644 index 0000000000000000000000000000000000000000..c56bd035a2c1618c1ca93e754ac9735b8ed6491a --- /dev/null +++ b/OnBoardInterface/Audio/MIPIAudio/sample_audio.c @@ -0,0 +1,462 @@ +/** +* @File sample_audio.c +* @Description audio sample app +* +* Copyright (c) Huawei Technologies Co., Ltd. 2016-2023. All rights reserved. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "sample_comm_audio.h" + +#define sample_dbg(ret) \ + do { \ + printf("ret = %#x, fuc:%s, line:%d\n", ret, __FUNCTION__, __LINE__); \ + } while (0) + +hi_s32 g_error_num = 0; +hi_s32 g_start = 0; +int g_point_num_per_frame = 960; +int g_bit_width = HI_AUDIO_BIT_WIDTH_16; +int g_snd_mode = HI_AUDIO_SOUND_MODE_MONO; +int g_dev_num = 2; +int g_chn_num = 0; + +/* vb exit & MPI system exit */ +hi_void sample_comm_sys_exit(hi_void) +{ + hi_mpi_sys_exit(); + return; +} + +/* vb init & MPI system init */ +hi_s32 sample_comm_sys_init(void) +{ + hi_s32 ret; + ret = hi_mpi_sys_init(); + if (ret != HI_SUCCESS) { + printf("hi_mpi_sys_init failed!\n"); + return HI_FAILURE; + } + + return HI_SUCCESS; +} + +static hi_void sample_audio_aio_init_param(hi_aio_attr *aio_attr) +{ + aio_attr->chn_cnt = 1; + aio_attr->point_num_per_frame = 960; + aio_attr->expand_flag = 0; + aio_attr->frame_num = 30; + aio_attr->clk_share = 1; + aio_attr->snd_mode = HI_AUDIO_SOUND_MODE_MONO; + aio_attr->sample_rate = HI_AUDIO_SAMPLE_RATE_48000; + aio_attr->bit_width = HI_AUDIO_BIT_WIDTH_16; + aio_attr->work_mode = HI_AIO_MODE_I2S_MASTER; + aio_attr->i2s_type = HI_AIO_I2STYPE_INNERCODEC; +} + +hi_void handle(int signum) +{ + g_start = 0; + return; +} + +/* start ao */ +hi_s32 sample_comm_audio_start_ao(hi_audio_dev ao_dev_id, hi_aio_attr *aio_attr) +{ + hi_s32 ret; + + ret = hi_mpi_ao_set_pub_attr(ao_dev_id, aio_attr); + if (ret != HI_SUCCESS) { + g_error_num = 1; + printf("%s: hi_mpi_ao_set_pub_attr(%d) failed with %#x!\n", __FUNCTION__, ao_dev_id, ret); + return HI_FAILURE; + } + + ret = hi_mpi_ao_enable(ao_dev_id); + if (ret != HI_SUCCESS) { + g_error_num = 2; + printf("%s: hi_mpi_ao_enable(%d) failed with %#x!\n", __FUNCTION__, ao_dev_id, ret); + return HI_FAILURE; + } + + ret = hi_mpi_ao_enable_chn(ao_dev_id, 0); + if (ret != HI_SUCCESS) { + g_error_num = 3; + printf("%s: hi_mpi_ao_enable_chn(%d) failed with %#x!\n", __FUNCTION__, 0, ret); + return HI_FAILURE; + } + + return HI_SUCCESS; +} + +/* start ai */ +hi_s32 sample_comm_audio_start_ai(hi_audio_dev ai_dev_id, hi_aio_attr *aio_attr, hi_audio_dev ao_dev_id) +{ + hi_s32 ret; + + ret = hi_mpi_ai_set_pub_attr(ai_dev_id, aio_attr); + if (ret) { + printf("%s: hi_mpi_ai_set_pub_attr(%d) failed with %#x\n", __FUNCTION__, ai_dev_id, ret); + return ret; + } + + ret = hi_mpi_ai_enable(ai_dev_id); + if (ret) { + printf("%s: hi_mpi_ai_enable(%d) failed with %#x\n", __FUNCTION__, ai_dev_id, ret); + return ret; + } + + ret = hi_mpi_ai_enable_chn(ai_dev_id, 0); + if (ret) { + printf("%s: hi_mpi_ai_enable_chn(%d,%d) failed with %#x\n", __FUNCTION__, ai_dev_id, 0, ret); + return ret; + } + + return HI_SUCCESS; +} + +/* stop ao */ +hi_s32 sample_comm_audio_stop_ao(hi_audio_dev ao_dev_id) +{ + hi_s32 ret; + ret = hi_mpi_ao_disable_chn(ao_dev_id, 0); + if (ret != HI_SUCCESS) { + printf("%s: hi_mpi_ao_disable_chn failed with %#x!\n", __FUNCTION__, ret); + return ret; + } + + ret = hi_mpi_ao_disable(ao_dev_id); + if (ret != HI_SUCCESS) { + printf("%s: hi_mpi_ao_disable failed with %#x!\n", __FUNCTION__, ret); + return ret; + } + + return HI_SUCCESS; +} + +/* stop ai */ +hi_s32 sample_comm_audio_stop_ai(hi_audio_dev ai_dev_id) +{ + hi_s32 ret; + + ret = hi_mpi_ai_disable_chn(ai_dev_id, 0); + if (ret != HI_SUCCESS) { + printf("[func]:%s [line]:%d [info]:%s\n", __FUNCTION__, __LINE__, "failed"); + return ret; + } + + ret = hi_mpi_ai_disable(ai_dev_id); + if (ret != HI_SUCCESS) { + printf("[func]:%s [line]:%d [info]:%s\n", __FUNCTION__, __LINE__, "failed"); + return ret; + } + + return HI_SUCCESS; +} + +/* init ai volume */ +hi_s32 sample_audio_ai_vol_init() +{ + hi_s32 fd; + hi_s32 ret; + + fd = open("/dev/acodec", O_RDWR); + hi_acodec_volume_ctrl vol_ctrl = {0}; + vol_ctrl.volume_ctrl = 15; // 15: default volume + + ret = ioctl(fd, HI_ACODEC_SET_ADCL_VOLUME, &vol_ctrl); + if (ret != HI_SUCCESS) { + printf("HI_ACODEC_SET_ADCL_VOLUME failed!\n"); + return HI_FAILURE; + } + + close(fd); + return HI_SUCCESS; +} + +hi_s32 sample_audio_ao_init() +{ + hi_s32 ret; + hi_aio_attr aio_attr = {0}; + + sample_audio_aio_init_param(&aio_attr); + + ret = sample_comm_audio_start_ao(g_dev_num, &aio_attr); + if (ret != HI_SUCCESS) { + printf("sample_comm_audio_start_ao err, ret = %#x\n", ret); + sample_dbg(ret); + } + + return ret; +} + +static hi_s32 sample_audio_ai_init() +{ + hi_s32 ret; + hi_aio_attr aio_attr = {0}; + + ret = sample_audio_ai_vol_init(); + if (ret != HI_SUCCESS) { + printf("sample_audio_ai_vol_init err, ret = %#x\n", ret); + sample_dbg(ret); + } + + sample_audio_aio_init_param(&aio_attr); + + ret = sample_comm_audio_start_ai(g_dev_num, &aio_attr, -1); + if (ret != HI_SUCCESS) { + sample_dbg(ret); + printf("sample_audio_ai err ret = %#x\n", ret); + return ret; + } + + return ret; +} + +static hi_s32 audio_ai_get_frame_and_send(sample_ai *ai_ctl, FILE *capture_fd) +{ + hi_s32 ret; + hi_audio_frame frame = {0}; + hi_aec_frame aec_frm = {0}; + + /* get frame from ai chn */ + ret = hi_mpi_ai_get_frame(ai_ctl->ai_dev, ai_ctl->ai_chn, &frame, &aec_frm, -1); + if (ret != HI_SUCCESS) { + /* continue */ + return HI_SUCCESS; + } + + fwrite(frame.virt_addr[0], 1, frame.len, capture_fd); + + /* finally you must release the stream */ + ret = hi_mpi_ai_release_frame(ai_ctl->ai_dev, ai_ctl->ai_chn, &frame, &aec_frm); + if (ret != HI_SUCCESS) { + printf("%s: hi_mpi_ai_release_frame(%d, %d), failed with %#x!\n", __FUNCTION__, ai_ctl->ai_dev, ai_ctl->ai_chn, + ret); + return HI_FAILURE; + } + + return HI_SUCCESS; +} + +static hi_void sample_audio_play_thread(void *parg) +{ + hi_s32 ret; + hi_audio_frame audio_frame = {0}; + hi_char play_file_name[FILE_NAME_LEN] = {0}; + FILE *play_fd = NULL; + hi_u32 readlen = 0; + hi_u8 * audio_buf = NULL; + hi_ao_chn ao_chn; + hi_u32 trans_len; + + sample_ao *ao_ctl = (sample_ao *)parg; + hi_audio_dev ao_dev = ao_ctl->ao_dev; + + ao_chn = ao_ctl->ao_chn; + trans_len = g_point_num_per_frame * 16 / 8; + + audio_buf = (hi_u8 *)malloc(sizeof(hi_u8) * trans_len); + if (audio_buf == NULL) { + printf("%s: malloc buffer failed!\n", __FUNCTION__); + } + + /* open file */ + ret = snprintf(play_file_name, FILE_NAME_LEN, ao_ctl->file_name); + if (ret < 0) { + printf("[func]:%s [line]:%d [info]:%s\n", __FUNCTION__, __LINE__, "get ao file name failed"); + return NULL; + } + + play_fd = fopen(play_file_name, "r"); + if (play_fd == NULL) { + printf("open play pcm1 file failed path = %s\n", play_file_name); + free(audio_buf); + return NULL; + } + + do { + readlen = fread(audio_buf, 1, trans_len, play_fd); + if (readlen == 0) { + printf("dev-%d play thread is end \n", ao_dev); + break; + } + + audio_frame.virt_addr[0] = audio_buf; + + audio_frame.len = trans_len; + audio_frame.bit_width = g_bit_width; + audio_frame.snd_mode = g_snd_mode; + + ret = hi_mpi_ao_send_frame(ao_dev, ao_chn, &audio_frame, -1); + if (ret != HI_SUCCESS) { + printf("%s: hi_mpi_ao_send_frame failed with %#x!\n", __FUNCTION__, ret); + break; + } + + } while (readlen > 0); + + free(audio_buf); + audio_buf = NULL; + fclose(play_fd); + ao_ctl->start = HI_FALSE; + pthread_kill(&ao_ctl->ao_pid, 0); +} + +static hi_void sample_audio_capture_thread(void *parg) +{ + hi_s32 ret; + sample_ai *ai_ctl = (sample_ai *)parg; + hi_char capture_file_name[FILE_NAME_LEN] = {0}; + FILE *cap_fd; + + ret = snprintf(capture_file_name, FILE_NAME_LEN, ai_ctl->file_name); + if (ret < 0) { + printf("[func]:%s [line]:%d [info]:%s\n", __FUNCTION__, __LINE__, "get ai file name failed"); + return NULL; + } + + cap_fd = fopen(capture_file_name, "w+"); + if (cap_fd == NULL) { + printf("capture save file open failed!\n"); + return NULL; + } + + while (g_start == 1) { + ret = audio_ai_get_frame_and_send(ai_ctl, cap_fd); + if (ret != HI_SUCCESS) { + break; + } + } + + fclose(cap_fd); + cap_fd = NULL; + + ai_ctl->start = HI_FALSE; + + pthread_kill(&ai_ctl->ai_pid, 0); + return NULL; +} + +static hi_void sample_audio_play(char *file_name) +{ + hi_s32 ret; + sample_ao ao_ctl = {0}; + + /* init ao */ + ret = sample_audio_ao_init(); + if (ret != HI_SUCCESS) { + printf("ao init failed! ret = %#x\n", ret); + if (g_error_num == 1 || g_error_num == 2) { + return; + } else if (g_error_num == 3) { + ret = hi_mpi_ao_disable(g_dev_num); + if (ret != HI_SUCCESS) { + printf("%s: hi_mpi_ao_disable failed with %#x!\n", __FUNCTION__, ret); + return ret; + } + } + } + + ao_ctl.ao_dev = g_dev_num; + strcpy(ao_ctl.file_name, file_name); + ao_ctl.ao_chn = g_chn_num; + ao_ctl.start = HI_TRUE; + + pthread_create(&ao_ctl.ao_pid, 0, sample_audio_play_thread, &ao_ctl); + + pthread_join(ao_ctl.ao_pid, NULL); + + hi_u32 delay = 0; + do { + hi_mpi_ao_get_chn_delay(g_dev_num, g_chn_num, &delay); + usleep(1000); + } while(delay != 0); + + ret = sample_comm_audio_stop_ao(g_dev_num); + if (ret != HI_SUCCESS) { + sample_dbg(ret); + } +} + +static hi_void sample_audio_capture(char *file_name) +{ + hi_s32 ret; + const hi_ai_chn ai_chn = 0; + sample_ai ai_ctl = {0}; + hi_s32 dev_id; + /* init ai */ + ret = sample_audio_ai_init(); + if (ret != HI_SUCCESS) { + printf("ai init failed! ret = %#x\n", ret); + goto ai_init_err; + } + + ai_ctl.ai_dev = g_dev_num; + ai_ctl.ai_chn = g_chn_num; + strcpy(ai_ctl.file_name, file_name); + ai_ctl.start = HI_TRUE; + + g_start = 1; + + signal(SIGUSR2, &handle); + + pthread_create(&ai_ctl.ai_pid, 0, sample_audio_capture_thread, &ai_ctl); + + pthread_join(ai_ctl.ai_pid, NULL); +ai_init_err: + ret = sample_comm_audio_stop_ai(g_dev_num); + if (ret != HI_SUCCESS) { + sample_dbg(ret); + } +} + +hi_s32 main(int argc, char *argv[]) +{ + hi_s32 ret; + char file_name[FILE_NAME_LEN]; + + if ((!strcmp(argv[1], "play")) || (!strcmp(argv[1], "capture"))) { + strcpy(file_name, argv[argc -1]); + } else { + printf("sample audio main() test_type fail\n"); + return HI_FAILURE; + } + + ret = sample_comm_sys_init(); + if (ret != HI_SUCCESS) { + printf("%s: system init failed with %#x!\n", __FUNCTION__, ret); + return HI_FAILURE; + } + + if (argc > 3) { // 2 - headphone; 3 - hdmi0; 4 - hdmi1 + g_dev_num = atoi(argv[2]); + if (g_dev_num > 4 || g_dev_num < 2) { + printf("audio dev is: = %u\n", g_dev_num); + return HI_FAILURE; + } + } + printf("audio dev is: = %u\n", g_dev_num); + + if (!strcmp(argv[1], "play")) { + sample_audio_play(file_name); + } else { + sample_audio_capture(file_name); + } + + sample_comm_sys_exit(); + printf("main finish!\n"); + return ret; +} diff --git a/OnBoardInterface/Audio/USBAudio/Readme.md b/OnBoardInterface/Audio/USBAudio/Readme.md new file mode 100644 index 0000000000000000000000000000000000000000..f5972691c552fc43dc65c7de819639c9e2990d8d --- /dev/null +++ b/OnBoardInterface/Audio/USBAudio/Readme.md @@ -0,0 +1,98 @@ +# 录音和播音(USB接口) + +#### 样例介绍 + +将USB接口的麦克风连接开发板,再运行本样例实现录音功能。 + +将USB接口的耳机连接开发板,可通过FFmpeg软件播放录制好的音频。 + +#### 样例下载 + +可以使用以下两种方式下载,请选择其中一种进行源码准备。 + +- 命令行方式下载(**下载时间较长,但步骤简单**)。 + + ``` + # 登录开发板,HwHiAiUser用户命令行中执行以下命令下载源码仓。 + cd ${HOME} + git clone https://gitee.com/ascend/EdgeAndRobotics.git + # 切换到样例目录 + cd EdgeAndRobotics/OnBoardInterface/Audio/USBAudio + ``` + +- 压缩包方式下载(**下载时间较短,但步骤稍微复杂**)。 + + ``` + # 1. 仓右上角选择 【克隆/下载】 下拉框并选择 【下载ZIP】。 + # 2. 将ZIP包上传到开发板的普通用户家目录中,【例如:${HOME}/EdgeAndRobotics-master.zip】。 + # 3. 开发环境中,执行以下命令,解压zip包。 + cd ${HOME} + chmod +x EdgeAndRobotics-master.zip + unzip EdgeAndRobotics-master.zip + # 4. 切换到样例目录 + cd EdgeAndRobotics-master/OnBoardInterface/Audio/USBAudio + ``` + +#### 准备环境 + +1. 以HwHiAiUser用户登录开发板。 + +2. 安装FFmpeg。 + + ``` + sudo apt-get install ffmpeg libavcodec-dev libswscale-dev libavdevice-dev + ``` + +#### 样例运行 + +1. 以HwHiAiUser用户登录开发板,切换到当前样例目录。 + +2. 编译样例源码。 + + 依次执行如下命令: + + ``` + # 执行编译命令 + gcc main.c -o main -lavutil -lavdevice -lavformat -lavcodec + ``` + + 编译命令执行成功后,在USBAudio样例目录下生成可执行文件main。 + +3. 运行样例,进行录音。 + + 执行如下命令查看录音设备编号: + + ``` + arecord -l + ``` + + 终端回显信息示例如下,其中**card 0**中的**0**表示录音设备编号: + + ``` + **** List of CAPTURE Hardware Devices **** + card 0: X5 [EPOS IMPACT X5], device 0: USB Audio [USB Audio] + Subdevices: 0/1 + Subdevice #0: subdevice #0 + ``` + + 运行可执行文件,其中0表示录音设备编号,需根据实际编码填写: + + ``` + ./main plughw:0 + ``` + + 运行可执行文件后,您可以使用麦克风录音,录音结束时,在终端界面输入**over**退出。 + + 录音成功后,在USBAudio样例目录下生成音频文件audio.pcm。 + +4. 播音。 + + 执行如下命令,使用FFmpeg软件播音: + + ``` + ffplay -ar 44100 -ac 2 -f s16le audio.pcm + ``` + +#### 相关操作 + +暂无 \ No newline at end of file diff --git a/OnBoardInterface/Audio/USBAudio/main.c b/OnBoardInterface/Audio/USBAudio/main.c new file mode 100644 index 0000000000000000000000000000000000000000..fa64f735caea0ea85d6227ff339c3e2242d2e191 --- /dev/null +++ b/OnBoardInterface/Audio/USBAudio/main.c @@ -0,0 +1,78 @@ +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +int main(int argc, char** argv) +{ + uint32_t argNum = 2; + if (argc < argNum) { + printf("Please input: ./main plughw:[card]\n"); + return -1; + } + + int ret = 0; + char errors[1024]; + int count = 0; + AVPacket pkt;//数据存放 + char *devicename = argv[1];//mac: :0 + AVFormatContext *fmt_ctx = NULL; //记得赋值NULL 上下文 + AVDictionary *options = NULL; + char *out = "./audio.pcm"; + FILE *outfile = NULL; + char input_command[128]; + int flag=-1; + + avdevice_register_all(); //打开所有设备 + AVInputFormat *iformat = av_find_input_format("alsa");//设置平台格式 mac: avfoundation + if( (ret = avformat_open_input(&fmt_ctx, devicename,iformat,&options) )< 0)//传入参数 打开设备 + { + av_strerror(ret,errors,1024); + av_log(NULL,AV_LOG_DEBUG,"Failed to open audio device,[%d]%s\n",ret,errors); + return -1; + } + av_init_packet(&pkt);//数据初始化 干净的空间; + + //create file + outfile = fopen(out,"wb+"); + flag=fcntl(0,F_GETFL); //获取当前flag + flag |=O_NONBLOCK; //设置新falg + fcntl(0,F_SETFL,flag); //更新flag + + printf("Start record!\n"); + + while((ret = av_read_frame(fmt_ctx,&pkt)) == 0) + { + //write FILE + fwrite(pkt.data,pkt.size,1,outfile); + fflush(outfile); + if((ret=read(0,input_command,sizeof(input_command))) > 0) + { + if(strncmp(input_command, "over",4) == 0) + { + av_log(NULL,AV_LOG_DEBUG,"over\n"); + break; + } + else + { + av_log(NULL,AV_LOG_DEBUG,"请重新输入\n"); + } + memset(input_command, 0, sizeof(input_command)); + } + av_log(NULL,AV_LOG_DEBUG,"pkt_size:%d(%p)\n",pkt.size,pkt.data); + av_packet_unref(&pkt);//缓冲区 内存释放 + } + + fclose(outfile); + avformat_close_input(&fmt_ctx); + + av_log(NULL,AV_LOG_DEBUG,"Finish\n"); + return 0; +} diff --git a/OnBoardInterface/Camera/MIPICamera/CMakeLists.txt b/OnBoardInterface/Camera/MIPICamera/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c83767bd3af708935c8844036c7364f49518b3c --- /dev/null +++ b/OnBoardInterface/Camera/MIPICamera/CMakeLists.txt @@ -0,0 +1,68 @@ +# Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. + +# CMake lowest version requirement +cmake_minimum_required(VERSION 3.5.1) + +# project information +project(vi_l1_sample) + +set(LIB_PATH $ENV{NPU_HOST_LIB}) +# Dynamic libraries in the stub directory can only be used for compilation +if (NOT DEFINED ENV{NPU_HOST_LIB}) + set(LIB_PATH "/usr/local/Ascend/ascend-toolkit/latest/CANN-6.4/runtime/lib64/stub/aarch64") + message(STATUS "set default LIB_PATH: ${LIB_PATH}") +else () + message(STATUS "env LIB_PATH: ${LIB_PATH}") +endif() + +set(INC_PATH $ENV{NPU_HOST_INC}) +# Dynamic libraries in the stub directory can only be used for compilation +if (NOT DEFINED ENV{NPU_HOST_INC}) + set(INC_PATH "/usr/local/Ascend/ascend-toolkit/latest/CANN-6.4/runtime/include") + message(STATUS "set default INC_PATH: ${INC_PATH}") +else () + message(STATUS "env INC_PATH: ${INC_PATH}") +endif() + +link_directories( + ${LIB_PATH} + ${LIB_PATH}/stub +) + +add_executable(vi_l1_sample + main.c + vi_with_sensor.c + ./common/sample_comm_isp.c + ./common/sample_comm_vi.c + ./sensor_sample/sensor_management.c + ./common/image_dump_util.c +) + +include_directories(vi_l1_sample + ${INC_PATH} + ${INC_PATH}/acl/media + ./sensor_sample + ./common + ./sensor/include + ./sensor/sony_imx219 + ./sensor/sony_imx477 +) + +add_compile_options(vi_l1_sample + -O2 + -Wall + -fpic +) + +target_link_libraries(vi_l1_sample + acl_dvpp_mpi + acl_isp_mpi + sns_imx219 + sns_imx477 + acl_vi_mpi + acl_vpss_mpi + acl_isp_ae_mpi + acl_isp_awb_mpi + ascendcl + pthread +) diff --git a/OnBoardInterface/Camera/MIPICamera/README.md b/OnBoardInterface/Camera/MIPICamera/README.md new file mode 100644 index 0000000000000000000000000000000000000000..40753338a832017b826f85b91505d9bc86b6816e --- /dev/null +++ b/OnBoardInterface/Camera/MIPICamera/README.md @@ -0,0 +1,116 @@ +# Camera图像获取(MIPI接口) + +#### 样例介绍 + +通过MIPI接口连接树莓派Camera与开发板,从树莓派Camera获取图像、并处理为YUV或RAW格式的图像。 + +本样例支持IMX219、IMX477两种型号的树莓派Camera,最多支持两个Camera。 + +#### 样例下载 + +可以使用以下两种方式下载,请选择其中一种进行源码准备。 + +- 命令行方式下载(**下载时间较长,但步骤简单**)。 + + ``` + # 登录开发板,HwHiAiUser用户命令行中执行以下命令下载源码仓。 + cd ${HOME} + git clone https://gitee.com/ascend/EdgeAndRobotics.git + # 切换到样例目录 + cd EdgeAndRobotics/OnBoardInterface/Camera/MIPICamera + ``` + +- 压缩包方式下载(**下载时间较短,但步骤稍微复杂**)。 + + ``` + # 1. 仓右上角选择 【克隆/下载】 下拉框并选择 【下载ZIP】。 + # 2. 将ZIP包上传到开发板的普通用户家目录中,【例如:${HOME}/EdgeAndRobotics-master.zip】。 + # 3. 开发环境中,执行以下命令,解压zip包。 + cd ${HOME} + chmod +x EdgeAndRobotics-master.zip + unzip EdgeAndRobotics-master.zip + # 4. 切换到样例目录 + cd EdgeAndRobotics-master/OnBoardInterface/Camera/MIPICamera + ``` + +#### 准备环境 + +1. 以HwHiAiUser用户登录开发板。 + +2. 设置环境变量。 + + ``` + # 配置程序编译依赖的头文件与库文件路径 + export DDK_PATH=/usr/local/Ascend/ascend-toolkit/latest + export NPU_HOST_LIB=$DDK_PATH/runtime/lib64/stub + ``` + +#### 样例运行 + +1. 以HwHiAiUser用户登录开发板,切换到当前样例目录。 + +2. 根据sensor源码编译出树莓派Camera依赖的so库文件。 + + - 依次执行如下命令,编译出IMX219树莓派Camera依赖的so库文件。 + + ``` + cd sensor/sony_imx219 + mkdir build + cd build + cmake .. -DCMAKE_C_COMPILER=gcc -DCMAKE_SKIP_RPATH=TRUE + sudo make + ``` + + 在“$NPU_HOST_LIB“环境变量设置的目录下会生成libsns_imx219.so库文件。 + + - 依次执行如下命令,编译出IMX477树莓派Camera依赖的so库文件。 + + ``` + # 切换到sensor/sony_imx477目录下,继续编译IMX477型号的库文件 + cd ../../sony_imx477 + mkdir build + cd build + cmake .. -DCMAKE_C_COMPILER=gcc -DCMAKE_SKIP_RPATH=TRUE + sudo make + ``` + + 在“$NPU_HOST_LIB“环境变量设置的目录下会生成libsns_imx477.so库文件。 + +3. 编译样例源码。 + + 依次执行如下命令编译源码: + + ``` + # 切换到样例根目录 + cd ../../../ + mkdir build + cd build + cmake .. -DCMAKE_C_COMPILER=gcc -DCMAKE_SKIP_RPATH=TRUE + make + ``` + + 在build目录下会生成可执行文件vi_l1_sample。 + +4. 运行样例。 + + 可执行文件的运行命令格式如下: + + - param1:1为输出yuv图,2为输出raw图; + - param2:Camera数量,可配置为1或2; + - param3:树莓派Camera型号,1为imx219,2为imx477。 + + ``` + ./vi_l1_sample param1 param2 param3 + ``` + + 命令示例: + + ``` + ./vi_l1_sample 1 1 1 + ``` + + **注意**:运行样例时,如果出现libsns_imx219.so、libsns_imx477.so找不到的情况,将/lib64/目录添加到LD_LIBRARY_PATH环境变量中即可。 + +#### 相关操作 + +获取学习文档,请单击[AscendCL C&C++](https://hiascend.com/document/redirect/CannCommunityCppAclQuick),查看最新版本的AscendCL推理应用开发指南,在其中的”媒体数据处理(含图像/视频等)>Camera场景视频数据获取和处理“章节了解接口调用流程。 \ No newline at end of file diff --git a/OnBoardInterface/Camera/MIPICamera/common/image_dump_util.c b/OnBoardInterface/Camera/MIPICamera/common/image_dump_util.c new file mode 100644 index 0000000000000000000000000000000000000000..0c3112f968318949a266579d46cfb7d5092a7b2b --- /dev/null +++ b/OnBoardInterface/Camera/MIPICamera/common/image_dump_util.c @@ -0,0 +1,492 @@ +/** +* @File image_dump_util.c +* @Description Provide util function for reading RAW & YUV data from the VI PIPE & CHN +* +* Copyright (c) Huawei Technologies Co., Ltd. 2016-2021. All rights reserved. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +#include +#include +#include "image_dump_util.h" + +static void sample_yuv_8bit_dump(hi_video_frame* pVBuf, FILE* pfd, hi_video_frame_info stFrame); +static hi_s32 ConvertBitPixel(hi_u8 *pu8Data, hi_u32 u32DataNum, hi_u32 u32BitWidth, hi_u16 *pu16OutData); +static inline hi_s32 BitWidth2PixelFormat(hi_u32 u32Nbit, hi_pixel_format *penPixelFormat); + +#define MAX_FRM_CNT 25 +#define MAX_FRM_WIDTH 16384 + +static inline hi_s32 BitWidth2PixelFormat(hi_u32 u32Nbit, hi_pixel_format *penPixelFormat) +{ + hi_pixel_format enPixelFormat; + if (8 == u32Nbit) { + enPixelFormat = HI_PIXEL_FORMAT_RGB_BAYER_8BPP; + } else if (10 == u32Nbit) { + enPixelFormat = HI_PIXEL_FORMAT_RGB_BAYER_10BPP; + } else if (12 == u32Nbit) { + enPixelFormat = HI_PIXEL_FORMAT_RGB_BAYER_12BPP; + } else if (14 == u32Nbit) { + enPixelFormat = HI_PIXEL_FORMAT_RGB_BAYER_14BPP; + } else if (16 == u32Nbit) { + enPixelFormat = HI_PIXEL_FORMAT_RGB_BAYER_16BPP; + } else { + enPixelFormat = HI_PIXEL_FORMAT_RGB_BAYER_16BPP; + } + *penPixelFormat = enPixelFormat; + return HI_SUCCESS; +} + +hi_s32 DumpYuv(hi_vi_pipe Pipe, hi_vi_chn Chn, hi_u32 u32FrameCnt, hi_u32 u32ByteAlign, hi_video_frame_info stFrame) +{ + hi_char szYuvName[128]; + hi_char szPixFrm[10]; + hi_char szDynamicRange[10]; + hi_char szVideoFrm[10]; + hi_u32 u32Cnt = u32FrameCnt; + hi_bool bSendToVgs = HI_FALSE; + hi_video_frame_info stFrmInfo; + hi_s32 s32Ret; + FILE* pfd = HI_NULL; + + switch (stFrame.v_frame.pixel_format) { + case HI_PIXEL_FORMAT_YVU_SEMIPLANAR_420: + snprintf(szPixFrm, 10, "P420"); + break; + case HI_PIXEL_FORMAT_YVU_SEMIPLANAR_422: + snprintf(szPixFrm, 10, "P422"); + break; + case HI_PIXEL_FORMAT_YUV_400: + snprintf(szPixFrm, 10, "P400"); + break; + default: + snprintf(szPixFrm, 10, "--"); + break; + } + + switch (stFrame.v_frame.video_format) { + case HI_VIDEO_FORMAT_LINEAR: + snprintf(szVideoFrm, 10, "linear"); + break; + case HI_VIDEO_FORMAT_TILE_64x16: + snprintf(szVideoFrm, 10, "tile_64X16"); + break; + case 3: + snprintf(szVideoFrm, 10, "tile_16X8"); + break; + default: + snprintf(szVideoFrm, 10, "--"); + break; + } + + switch (stFrame.v_frame.dynamic_range) { + case HI_DYNAMIC_RANGE_SDR8: + snprintf(szDynamicRange, 10, "SDR8"); + break; + case HI_DYNAMIC_RANGE_SDR10: + snprintf(szDynamicRange, 10, "SDR10"); + break; + case HI_DYNAMIC_RANGE_HDR10: + snprintf(szDynamicRange, 10, "HDR10"); + break; + case HI_DYNAMIC_RANGE_XDR: + snprintf(szDynamicRange, 10, "XDR"); + break; + case HI_DYNAMIC_RANGE_HLG: + snprintf(szDynamicRange, 10, "HLG"); + break; + case HI_DYNAMIC_RANGE_SLF: + snprintf(szDynamicRange, 10, "SLF"); + break; + default: + snprintf(szDynamicRange, 10, "--"); + break; + } + /* make file name */ + snprintf(szYuvName, 128, "./vi_pipe%d_chn%d_w%d_h%d_%s_%s_%s_%d.yuv", + Pipe, Chn, stFrame.v_frame.width, + stFrame.v_frame.height, szPixFrm, szVideoFrm, szDynamicRange, u32ByteAlign); + printf("Dump YUV frame of vi chn %d to file: \"%s\"\n", Chn, szYuvName); + fflush(stdout); + + /* open file */ + pfd = fopen(szYuvName, "ab"); + + if (HI_NULL == pfd) { + printf("open file failed:%s!\n", strerror(errno)); + return HI_FAILURE; + } + /* get frame */ + while (u32Cnt--) { + if (HI_DYNAMIC_RANGE_SDR8 == stFrame.v_frame.dynamic_range) { + sample_yuv_8bit_dump(&stFrame.v_frame, pfd, stFrame); + } else { + printf("Get ViPipe %d frame %d failed! only support dump 8bit yuv\n", Pipe, u32Cnt); + } + printf("Get ViPipe %d frame %d!!\n", Pipe, u32Cnt); + } + fclose(pfd); + return HI_SUCCESS; +} + +/*When saving a file,sp420 will be denoted by p420 and sp422 + will be denoted by p422 in the name of the file */ +static void sample_yuv_8bit_dump(hi_video_frame* pVBuf, FILE* pfd, hi_video_frame_info stFrame) +{ + unsigned int w, h; + char* pVBufVirt_Y; + char* pVBufVirt_C; + char* pMemContent; + // If this value is too small and the image is big, this memory may not be enough + unsigned char TmpBuff[MAX_FRM_WIDTH]; + hi_u8* pUserPageAddr[2]; + hi_u32 u32Size = 0; + + hi_u64 phy_addr; + hi_pixel_format enPixelFormat = pVBuf->pixel_format; + hi_video_format enVideoFormat = stFrame.v_frame.video_format; + /*When the storage format is a planar format, + this variable is used to keep the height of the UV component */ + hi_u32 u32UvHeight = 0; + + if (HI_PIXEL_FORMAT_YVU_SEMIPLANAR_420 == enPixelFormat) { + if (3 != enVideoFormat) { + u32Size = (pVBuf->width_stride[0]) * (pVBuf->height) * 3 / 2; + u32UvHeight = pVBuf->height / 2; + } else { + u32Size = (pVBuf->width_stride[0]) * (pVBuf->height); + u32UvHeight = 0; + } + } else if(HI_PIXEL_FORMAT_YVU_SEMIPLANAR_422 == enPixelFormat) { + u32Size = (pVBuf->width_stride[0]) * (pVBuf->height) * 2; + u32UvHeight = pVBuf->height; + } else if(HI_PIXEL_FORMAT_YUV_400 == enPixelFormat) { + u32Size = (pVBuf->width_stride[0]) * (pVBuf->height); + u32UvHeight = pVBuf->height; + } + phy_addr = pVBuf->phys_addr[0]; + printf("phy_addr:%#x, u32Size:%d\n", phy_addr, u32Size); + pUserPageAddr[0] = (hi_char*)phy_addr; + if (HI_NULL == pUserPageAddr[0]) { + return; + } + printf("stride: %d,%d\n",pVBuf->width_stride[0], pVBuf->width_stride[1] ); + pVBufVirt_Y = pUserPageAddr[0]; + pVBufVirt_C = pVBufVirt_Y + (pVBuf->width_stride[0]) * (pVBuf->height); + /* save Y ----------------------------------------------------------------*/ + fprintf(stderr, "saving......Y......"); + fflush(stderr); + if(3 == enVideoFormat) { + for (h = 0; h < pVBuf->height; h++) { + pMemContent = pVBufVirt_Y + h * pVBuf->width_stride[0]; + fwrite(pMemContent, pVBuf->width_stride[0], 1, pfd); + } + } else { + for (h = 0; h < pVBuf->height; h++) { + pMemContent = pVBufVirt_Y + h * pVBuf->width_stride[0]; + fwrite(pMemContent, pVBuf->width, 1, pfd); + } + } + + if(HI_PIXEL_FORMAT_YUV_400 != enPixelFormat && 3 != enVideoFormat) { + fflush(pfd); + /* save U ----------------------------------------------------------------*/ + fprintf(stderr, "U......"); + fflush(stderr); + + for (h = 0; h < u32UvHeight; h++) { + pMemContent = pVBufVirt_C + h * pVBuf->width_stride[1]; + pMemContent += 1; + for (w = 0; w < pVBuf->width / 2; w++) { + TmpBuff[w] = *pMemContent; + pMemContent += 2; + } + fwrite(TmpBuff, pVBuf->width / 2, 1, pfd); + } + fflush(pfd); + /* save V ----------------------------------------------------------------*/ + fprintf(stderr, "V......"); + fflush(stderr); + for (h = 0; h < u32UvHeight; h++) { + pMemContent = pVBufVirt_C + h * pVBuf->width_stride[1]; + for (w = 0; w < pVBuf->width / 2; w++) { + TmpBuff[w] = *pMemContent; + pMemContent += 2; + } + fwrite(TmpBuff, pVBuf->width / 2, 1, pfd); + } + } + fflush(pfd); + fprintf(stderr, "done %d!\n", pVBuf->time_ref); + fflush(stderr); + pUserPageAddr[0] = HI_NULL; +} + +static int SampleSaveUncompressRaw(hi_video_frame* pVBuf, hi_u32 u32Nbit, + FILE* pfd, hi_u32 u32ByteAlign) +{ + hi_u32 u32H; + hi_u16 *pu16Data = NULL; + hi_u64 phy_addr, size; + hi_u8* pUserPageAddr[2]; + hi_u8 *pu8Data; + hi_pixel_format enPixelFormat = HI_PIXEL_FORMAT_BUTT; + + BitWidth2PixelFormat(u32Nbit, &enPixelFormat); + if (enPixelFormat != pVBuf->pixel_format) { + fprintf(stderr, "NoCmp: invalid pixel format:%d, u32Nbit: %d\n", + pVBuf->pixel_format, u32Nbit); + return HI_FAILURE; + } + + size = (pVBuf->width_stride[0]) * (pVBuf->height); + phy_addr = pVBuf->phys_addr[0]; + pUserPageAddr[0] = (hi_u8*)phy_addr; + if (NULL == pUserPageAddr[0]) { + return HI_FAILURE; + } + pu8Data = pUserPageAddr[0]; + if ((8 != u32Nbit) && (16 != u32Nbit)) { + pu16Data = (hi_u16*)malloc(pVBuf->width * 2U); + if (NULL == pu16Data) { + fprintf(stderr, "alloc memory failed\n"); + pUserPageAddr[0] = NULL; + return HI_FAILURE; + } + } + /* save Y ----------------------------------------------------------------*/ + fprintf(stderr, "saving......dump data......u32Stride[0]: %d, width: %d\n", + pVBuf->width_stride[0], pVBuf->width); + fflush(stderr); + + for (u32H = 0; u32H < pVBuf->height; u32H++) { + if (8 == u32Nbit) { + fwrite(pu8Data, pVBuf->width, 1, pfd); + } else if (16 == u32Nbit) { + fwrite(pu8Data, pVBuf->width, 2, pfd); + fflush(pfd); + } else { + if (1 == u32ByteAlign) { + ConvertBitPixel(pu8Data, pVBuf->width, u32Nbit, pu16Data); + fwrite(pu16Data, pVBuf->width, 2, pfd); + } else { + if (0 == ((pVBuf->width * u32Nbit) % 8)) { + //-- pVBuf->width * u32Nbit / 8 + fwrite(pu8Data, pVBuf->width * u32Nbit / 8, 1, pfd); + } else { + fwrite(pu8Data, ((pVBuf->width * u32Nbit) / 8 + 8), 1, pfd); + } + } + } + pu8Data += pVBuf->width_stride[0]; + } + fflush(pfd); + fprintf(stderr, "u32Nbit_%d done u32TimeRef: %d, u32ByteAlign: %d!\n", u32Nbit, + pVBuf->time_ref, u32ByteAlign); + fflush(stderr); + if (NULL != pu16Data) { + free(pu16Data); + } + pUserPageAddr[0] = NULL; + return HI_SUCCESS; +} + +static int SampleSaveCompressedRaw(hi_video_frame* pVBuf, hi_u32 u32Nbit, FILE* pfd) +{ + hi_u32 u32H; + hi_u32 u32DataSize; + hi_u16 u16HeadData = 0x0; + hi_u64 phy_addr, size; + hi_u8* pUserPageAddr[2]; + hi_u8 *pu8Data; + hi_pixel_format enPixelFormat = HI_PIXEL_FORMAT_BUTT; + + BitWidth2PixelFormat(u32Nbit, &enPixelFormat); + if (enPixelFormat != pVBuf->pixel_format) { + fprintf(stderr, "Cmp: invalid pixel format:%d, u32Nbit: %d\n", pVBuf->pixel_format, u32Nbit); + return HI_FAILURE; + } + + size = (pVBuf->width_stride[0]) * (pVBuf->height); + phy_addr = pVBuf->phys_addr[0]; + pUserPageAddr[0] = (hi_u8*)phy_addr; + if (NULL == pUserPageAddr[0]) { + return HI_FAILURE; + } + + pu8Data = pUserPageAddr[0]; + /* save Y ----------------------------------------------------------------*/ + fprintf(stderr, "saving......dump data......u32Stride[0]: %d, width: %d\n", + pVBuf->width_stride[0], pVBuf->width); + fflush(stderr); + for (u32H = 0; u32H < pVBuf->height; u32H++) { + u16HeadData = *(hi_u16*)pu8Data; + u32DataSize = (u16HeadData + 1) * 16; + fwrite(pu8Data, u32DataSize, 1, pfd); + pu8Data += pVBuf->width_stride[0]; + } + fflush(pfd); + + fprintf(stderr, "done u32TimeRef: %d!\n", pVBuf->time_ref); + fflush(stderr); + pUserPageAddr[0] = NULL; + return HI_SUCCESS; +} + +static int SampleBayerDump(hi_video_frame* pVBuf, hi_u32 u32Nbit, FILE* pfd, hi_u32 u32ByteAlign) +{ + if(HI_COMPRESS_MODE_NONE == pVBuf->compress_mode) { + return SampleSaveUncompressRaw(pVBuf, u32Nbit, pfd, u32ByteAlign); + } else { + return SampleSaveCompressedRaw(pVBuf, u32Nbit, pfd); + } +} + +char* CompressModeToString(hi_compress_mode enCompressMode) +{ + if(HI_COMPRESS_MODE_NONE == enCompressMode) { + return "CMP_NONE"; + } else if(HI_COMPRESS_MODE_LINE == enCompressMode) { + return "CMP_LINE"; + } else if(HI_COMPRESS_MODE_SEG == enCompressMode) { + return "CMP_SEG"; + } else { + return "CMP_XXX"; + } +} + +hi_s32 DumpLinearBayer(hi_vi_pipe ViPipe, hi_u32 u32Nbit, hi_compress_mode enCompressMode, hi_u32 u32Cnt, + hi_u32 u32ByteAlign, hi_u32 u32RatioShow) +{ + hi_s32 s32Ret = HI_SUCCESS; + hi_s32 i, j; + hi_char szYuvName[256] = {0}; + FILE* pfd = NULL; + hi_s32 s32MilliSec = 5000; // 5s + hi_u32 u32CapCnt = 0; + hi_u64 u64IspInfoPhyAddr = 0; + hi_video_frame_info astFrame[MAX_FRM_CNT]; + hi_pixel_format enPixelFormat; + + BitWidth2PixelFormat(u32Nbit, &enPixelFormat); + while (1) { + printf("Start get vi Pipe %d frame\n", ViPipe); + if (HI_SUCCESS != hi_mpi_vi_get_pipe_frame(ViPipe, &astFrame[0], s32MilliSec)) { + printf("Linear: get vi Pipe %d frame err\n", ViPipe); + break; + } + if ((astFrame[0].v_frame.compress_mode == enCompressMode) + && (astFrame[0].v_frame.pixel_format == enPixelFormat)) { + hi_mpi_vi_release_pipe_frame(ViPipe, &astFrame[0]); + break; + } + hi_mpi_vi_release_pipe_frame(ViPipe, &astFrame[0]); + } + /* get VI frame */ + for (i = 0; i < u32Cnt; i++) { + if (HI_SUCCESS != hi_mpi_vi_get_pipe_frame(ViPipe, &astFrame[i], s32MilliSec)) { + printf("Linear: get vi Pipe %d frame err\n", ViPipe); + printf("only get %d frame\n", i); + break; + } + printf("Linear: get vi Pipe %d frame num %d ok\n",ViPipe, i); + } + u32CapCnt = i; + if (0 == u32CapCnt) { + return -1; + } + /* make file name */ + if (0 == u32RatioShow) { + snprintf(szYuvName, 256, "./vi_Pipe_%d_%d_%d_%d_%dbits_%s_%d_%d_%d.raw", + ViPipe, astFrame[0].v_frame.width, + astFrame[0].v_frame.height, u32CapCnt, u32Nbit, + CompressModeToString(astFrame[0].v_frame.compress_mode), + u32ByteAlign, u32RatioShow, astFrame[0].v_frame.time_ref); + } + /* open file */ + pfd = fopen(szYuvName, "wb"); + if (NULL == pfd) { + printf("open file failed:%s!\n", strerror(errno)); + goto end; + } + + for (j = 0; j < u32CapCnt; j++) { + /* save VI frame to file */ + printf("SampleBayerDump u32Nbit = %d!\n", u32Nbit); + SampleBayerDump(&astFrame[j].v_frame, u32Nbit, pfd, u32ByteAlign); + /* release frame after using */ + hi_mpi_vi_release_pipe_frame(ViPipe, &astFrame[j]); + } + fclose(pfd); + return HI_SUCCESS; +end: + for (j = 0; j < u32CapCnt; j++) { + hi_mpi_vi_release_pipe_frame(ViPipe, &astFrame[j]); + } + return HI_FAILURE; +} + +static hi_s32 ConvertBitPixel(hi_u8 *pu8Data, hi_u32 u32DataNum, hi_u32 u32BitWidth, hi_u16 *pu16OutData) +{ + hi_s32 i, u32Tmp, s32OutCnt; + hi_u64 u64Val; + hi_u32 u32Val; + hi_u8 *pu8Tmp = pu8Data; + s32OutCnt = 0; + switch(u32BitWidth) { + case 10: + { + /* 4 pixels consist of 5 bytes */ + u32Tmp = u32DataNum / 4; + for (i = 0; i < u32Tmp; i++) { + /* byte4 byte3 byte2 byte1 byte0 */ + pu8Tmp = pu8Data + 5 * i; + u64Val = pu8Tmp[0] + ((hi_u32)pu8Tmp[1] << 8) + ((hi_u32)pu8Tmp[2] << 16) + + ((hi_u32)pu8Tmp[3] << 24) + ((hi_u64)pu8Tmp[4] << 32); + pu16OutData[s32OutCnt++] = u64Val & 0x3ff; + pu16OutData[s32OutCnt++] = (u64Val >> 10) & 0x3ff; + pu16OutData[s32OutCnt++] = (u64Val >> 20) & 0x3ff; + pu16OutData[s32OutCnt++] = (u64Val >> 30) & 0x3ff; + } + } + break; + case 12: + { + /* 2 pixels consist of 3 bytes */ + u32Tmp = u32DataNum / 2; + for (i = 0; i < u32Tmp; i++) { + /* byte2 byte1 byte0 */ + pu8Tmp = pu8Data + 3 * i; + u32Val = pu8Tmp[0] + (pu8Tmp[1] << 8) + (pu8Tmp[2] << 16); + pu16OutData[s32OutCnt++] = u32Val & 0xfff; + pu16OutData[s32OutCnt++] = (u32Val >> 12) & 0xfff; + } + } + break; + case 14: + { + /* 4 pixels consist of 7 bytes */ + u32Tmp = u32DataNum / 4; + for (i = 0; i < u32Tmp; i++) { + pu8Tmp = pu8Data + 7 * i; + u64Val = pu8Tmp[0] + ((hi_u32)pu8Tmp[1] << 8) + ((hi_u32)pu8Tmp[2] << 16) + + ((hi_u32)pu8Tmp[3] << 24) + ((hi_u64)pu8Tmp[4] << 32) + + ((hi_u64)pu8Tmp[5] << 40) + ((hi_u64)pu8Tmp[6] << 48); + + pu16OutData[s32OutCnt++] = u64Val & 0x3fff; + pu16OutData[s32OutCnt++] = (u64Val >> 14) & 0x3fff; + pu16OutData[s32OutCnt++] = (u64Val >> 28) & 0x3fff; + pu16OutData[s32OutCnt++] = (u64Val >> 42) & 0x3fff; + } + } + break; + default: + fprintf(stderr, "unsuport bitWidth: %d\n", u32BitWidth); + return -1; + break; + } + return s32OutCnt; +} \ No newline at end of file diff --git a/OnBoardInterface/Camera/MIPICamera/common/image_dump_util.h b/OnBoardInterface/Camera/MIPICamera/common/image_dump_util.h new file mode 100644 index 0000000000000000000000000000000000000000..ae0f157c7e9aa52899c57ae7d19d5e5773e0f1a5 --- /dev/null +++ b/OnBoardInterface/Camera/MIPICamera/common/image_dump_util.h @@ -0,0 +1,20 @@ +/** +* @File image_dump_util.h +* @Description Provide util function for reading RAW & YUV data from the VI PIPE & CHN +* +* Copyright (c) Huawei Technologies Co., Ltd. 2016-2021. All rights reserved. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ +#ifndef IMAGE_DUMP_UTIL_H +#define IMAGE_DUMP_UTIL_H + +#include "sample_comm.h" + +hi_s32 DumpYuv(hi_vi_pipe Pipe, hi_vi_chn Chn, hi_u32 u32FrameCnt, + hi_u32 u32ByteAlign, hi_video_frame_info stFrame); +hi_s32 DumpLinearBayer(hi_vi_pipe ViPipe, hi_u32 u32Nbit, hi_compress_mode enCompressMode, + hi_u32 u32Cnt, hi_u32 u32ByteAlign, hi_u32 u32RatioShow); +#endif // IMAGE_DUMP_UTIL_H \ No newline at end of file diff --git a/OnBoardInterface/Camera/MIPICamera/common/sample_comm.h b/OnBoardInterface/Camera/MIPICamera/common/sample_comm.h new file mode 100644 index 0000000000000000000000000000000000000000..2a8e4446a8fe757d9e71c354c8250c1e035e3d0a --- /dev/null +++ b/OnBoardInterface/Camera/MIPICamera/common/sample_comm.h @@ -0,0 +1,117 @@ +#ifndef __SAMPLE_COMM_H__ +#define __SAMPLE_COMM_H__ + +#include + +#include "hi_mpi_isp.h" +#include "hi_mpi_vi.h" +#include "hi_mpi_ae.h" +#include "hi_mpi_awb.h" +#include "hi_mpi_vpss.h" +#include "hi_common_3a.h" +#include "hi_sns_ctrl.h" +#include "sensor_management.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif /* End of #ifdef __cplusplus */ + +/******************************************************* + macro define +*******************************************************/ +#define FILE_NAME_LEN 128 +#define WDR_MAX_PIPE_NUM 4 +#define MAX_FRM_CNT 25 + +#define CHECK_RET(express,name) \ + do{ \ + hi_s32 Ret; \ + Ret = express; \ + if (HI_SUCCESS != Ret) \ + { \ + printf("\033[0;31m%s failed at %s: LINE: %d with %#x!\033[0;39m\n", \ + name, __FUNCTION__, __LINE__, Ret); \ + return Ret; \ + } \ + }while(0) + +#define SAMPLE_PRT(fmt...) \ + do {\ + printf("[%s]-%d: ", __FUNCTION__, __LINE__);\ + printf(fmt);\ + }while(0) + +/******************************************************* + enum define +*******************************************************/ +typedef enum hiPIC_SIZE_E +{ + PIC_CIF, + PIC_360P, /* 640 * 360 */ + PIC_720P, /* 1280 * 720 */ + PIC_1080P, /* 1920 * 1080 */ + PIC_2592x1520, + PIC_2592x1944, + PIC_3264x2448, + PIC_3840x2160, + PIC_4096x2160, + PIC_BUTT +} PIC_SIZE_E; + +typedef struct HISAMPLE_SENSOR_INFO_S +{ + SAMPLE_SNS_TYPE_E enSnsType; + hi_s32 s32SnsId; + hi_s32 s32BusId; + combo_dev_t MipiDev; +} SAMPLE_SENSOR_INFO_S; + +typedef struct HISAMPLE_DEV_INFO_S +{ + hi_vi_dev ViDev; + hi_wdr_mode enWDRMode; +} SAMPLE_DEV_INFO_S; + +typedef struct HISAMPLE_PIPE_INFO_S +{ + hi_vi_pipe aPipe[WDR_MAX_PIPE_NUM]; + hi_u32 u32MaxW; /* RW;Range[VI_PIPE_MIN_WIDTH, VI_PIPE_MAX_WIDTH];Maximum width */ + hi_u32 u32MaxH; /* RW;Range[VI_PIPE_MIN_HEIGHT, VI_PIPE_MAX_HEIGHT];Maximum height */ + hi_data_bit_width enBitWidth; /* RW;Range:[0, 4];Bit width */ + hi_compress_mode enCompressMode; // VI压缩模式 +} SAMPLE_PIPE_INFO_S; + +typedef struct HISAMPLE_CHN_INFO_S +{ + hi_vi_chn ViChn; + hi_pixel_format enPixFormat; + hi_dynamic_range enDynamicRange; + hi_video_format enVideoFormat; + hi_compress_mode enCompressMode; +} SAMPLE_CHN_INFO_S; + +typedef struct HISAMPLE_VI_INFO_S +{ + SAMPLE_SENSOR_INFO_S stSnsInfo; + SAMPLE_DEV_INFO_S stDevInfo; + SAMPLE_PIPE_INFO_S stPipeInfo; + SAMPLE_CHN_INFO_S stChnInfo; +} SAMPLE_VI_INFO_S; + +typedef struct HISAMPLE_VI_CONFIG_S +{ + SAMPLE_VI_INFO_S astViInfo[HI_VI_MAX_DEV_NUM]; + hi_s32 as32WorkingViId[HI_VI_MAX_DEV_NUM]; + hi_s32 s32WorkingViNum; + lane_divide_mode_t mipi_lane_divide_mode; +} SAMPLE_VI_CONFIG_S; + +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif /* End of #ifdef __cplusplus */ + +#endif /* End of #ifndef __SAMPLE_COMMON_H__ */ diff --git a/OnBoardInterface/Camera/MIPICamera/common/sample_comm_isp.c b/OnBoardInterface/Camera/MIPICamera/common/sample_comm_isp.c new file mode 100644 index 0000000000000000000000000000000000000000..e05cc263debd19d5d2e3bde1a319f27768d54240 --- /dev/null +++ b/OnBoardInterface/Camera/MIPICamera/common/sample_comm_isp.c @@ -0,0 +1,312 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "sample_comm.h" +#include "sample_comm_isp.h" +#include "sensor_management.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif /* End of #ifdef __cplusplus */ + +#define ISP_MAX_DEV_NUM 8 + +static pthread_t g_IspPid[ISP_MAX_DEV_NUM] = {0}; +static hi_s32 g_DevId = 0; // 全局变量传参pthread 避免局部变量传参,函数返回后销毁,值不确定 +static hi_u32 g_au32IspSnsId[ISP_MAX_DEV_NUM] = {0, 1}; + +static void* Sample_Comm_Isp_Thread(void* param) +{ + hi_s32 s32Ret; + hi_isp_dev IspDev; + hi_char szThreadName[20]; + + IspDev = *((hi_isp_dev*)param); + + snprintf(szThreadName, 20, "ISP%d_RUN", IspDev); + prctl(PR_SET_NAME, szThreadName, 0,0,0); + + SAMPLE_PRT("ISP Dev %d running ! %p. \n", IspDev, param); + s32Ret = hi_mpi_isp_run(IspDev); + + if (HI_SUCCESS != s32Ret) + { + SAMPLE_PRT("hi_mpi_isp_run failed with %#x!\n", s32Ret); + } + + return NULL; +} + +/****************************************************************************** +* funciton : ISP init +******************************************************************************/ + +hi_s32 Sample_Comm_Isp_Aelib_Callback(hi_isp_dev IspDev) +{ + hi_isp_3a_alg_lib stAeLib; + + stAeLib.id = IspDev; + strncpy(stAeLib.lib_name, HI_AE_LIB_NAME, sizeof(HI_AE_LIB_NAME)); + CHECK_RET(hi_mpi_ae_register(IspDev, &stAeLib), "aelib register call back"); + return HI_SUCCESS; +} + +hi_s32 Sample_Comm_Isp_Aelib_UnCallback(hi_isp_dev IspDev) +{ + hi_isp_3a_alg_lib stAeLib; + + stAeLib.id = IspDev; + strncpy(stAeLib.lib_name, HI_AE_LIB_NAME, sizeof(HI_AE_LIB_NAME)); + CHECK_RET(hi_mpi_ae_unregister(IspDev, &stAeLib), "aelib unregister call back"); + return HI_SUCCESS; +} + +hi_s32 Sample_Comm_Isp_Awblib_Callback(hi_isp_dev IspDev) +{ + hi_isp_3a_alg_lib stAwbLib; + + stAwbLib.id = IspDev; + strncpy(stAwbLib.lib_name, HI_AWB_LIB_NAME, sizeof(HI_AWB_LIB_NAME)); + CHECK_RET(hi_mpi_awb_register(IspDev, &stAwbLib), "awblib register call back"); + return HI_SUCCESS; +} + +hi_s32 Sample_Comm_Isp_Awblib_UnCallback(hi_isp_dev IspDev) +{ + hi_isp_3a_alg_lib stAwbLib; + + stAwbLib.id = IspDev; + strncpy(stAwbLib.lib_name, HI_AWB_LIB_NAME, sizeof(HI_AWB_LIB_NAME)); + CHECK_RET(hi_mpi_awb_unregister(IspDev, &stAwbLib), "awblib unregister call back"); + return HI_SUCCESS; +} + +/****************************************************************************** +* funciton : ISP Run +******************************************************************************/ +hi_s32 Sample_Comm_Isp_Run(hi_isp_dev* pIspDev) +{ + hi_s32 s32Ret = 0; + pthread_attr_t* pstAttr = NULL; + g_DevId = *pIspDev; // pthread传参不能局部变? s32Ret = pthread_create(&g_IspPid[*pIspDev], pstAttr, Sample_Comm_Isp_Thread, (hi_void*)(&g_DevId)); + if (0 != s32Ret) + { + SAMPLE_PRT("create isp running thread failed!, error: %d, %s\r\n", s32Ret, strerror(s32Ret)); + goto out; + } + +out: + if (NULL != pstAttr) + { + pthread_attr_destroy(pstAttr); + } + return s32Ret; +} + +hi_s32 Sample_Comm_Isp_Sensor_Regiter_callback(hi_isp_dev IspDev, hi_u32 u32SnsId) +{ + hi_isp_3a_alg_lib stAeLib; + hi_isp_3a_alg_lib stAwbLib; + hi_isp_3a_alg_lib stAfLib; + const hi_isp_sns_obj* pstSnsObj; + hi_s32 s32Ret = -1; + + if (MAX_SENSOR_NUM <= u32SnsId) + { + SAMPLE_PRT("invalid sensor id: %d\n", u32SnsId); + return HI_FAILURE; + } + + pstSnsObj = Sample_Comm_Isp_GetSnsObj(u32SnsId); + + if (HI_NULL == pstSnsObj) + { + SAMPLE_PRT("sensor %d not exist!\n", u32SnsId); + return HI_FAILURE; + } + + stAeLib.id = IspDev; + stAwbLib.id = IspDev; + strncpy(stAeLib.lib_name, HI_AE_LIB_NAME, sizeof(HI_AE_LIB_NAME)); + strncpy(stAwbLib.lib_name, HI_AWB_LIB_NAME, sizeof(HI_AWB_LIB_NAME)); + + if (pstSnsObj->pfn_register_callback != HI_NULL) + { + s32Ret = pstSnsObj->pfn_register_callback(IspDev, &stAeLib, &stAwbLib); + + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("sensor_register_callback failed with %#x!\n", s32Ret); + return s32Ret; + } + } + else + { + SAMPLE_PRT("sensor_register_callback failed with HI_NULL!\n"); + } + g_au32IspSnsId[IspDev] = u32SnsId; + + return HI_SUCCESS; +} + +hi_s32 Sample_Comm_Isp_Sensor_UnRegiter_callback(hi_isp_dev IspDev) +{ + hi_isp_3a_alg_lib stAeLib; + hi_isp_3a_alg_lib stAwbLib; + hi_isp_3a_alg_lib stAfLib; + hi_u32 u32SnsId; + const hi_isp_sns_obj* pstSnsObj; + hi_s32 s32Ret = -1; + u32SnsId = g_au32IspSnsId[IspDev]; + + if (MAX_SENSOR_NUM <= u32SnsId) + { + SAMPLE_PRT("%s: invalid sensor id: %d\n", __FUNCTION__, u32SnsId); + return HI_FAILURE; + } + + pstSnsObj = Sample_Comm_Isp_GetSnsObj(u32SnsId); + + if (HI_NULL == pstSnsObj) + { + return HI_FAILURE; + } + + stAeLib.id = IspDev; + stAwbLib.id = IspDev; + strncpy(stAeLib.lib_name, HI_AE_LIB_NAME, sizeof(HI_AE_LIB_NAME)); + strncpy(stAwbLib.lib_name, HI_AWB_LIB_NAME, sizeof(HI_AWB_LIB_NAME)); + + if (pstSnsObj->pfn_un_register_callback != HI_NULL) + { + s32Ret = pstSnsObj->pfn_un_register_callback(IspDev, &stAeLib, &stAwbLib); + + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("sensor_unregister_callback failed with %#x!\n", s32Ret); + return s32Ret; + } + } + else + { + SAMPLE_PRT("sensor_unregister_callback failed with HI_NULL!\n"); + } + + return HI_SUCCESS; +} + +/****************************************************************************** +* funciton : stop ISP, and stop isp thread +******************************************************************************/ +hi_void Sample_Comm_Isp_Stop(hi_isp_dev IspDev) +{ + hi_mpi_isp_exit(IspDev); + if (g_IspPid[IspDev]) + { + SAMPLE_PRT("%s begin join g_IspPid=%u\n", __func__, g_IspPid[IspDev]); + pthread_join(g_IspPid[IspDev], NULL); + g_IspPid[IspDev] = 0; + } + + Sample_Comm_Isp_Awblib_UnCallback(IspDev); + Sample_Comm_Isp_Aelib_UnCallback(IspDev); + Sample_Comm_Isp_Sensor_UnRegiter_callback(IspDev); + return; +} + +hi_void Sample_Comm_All_ISP_Stop(hi_void) +{ + hi_isp_dev IspDev; + + for (IspDev = 0; IspDev < HI_ISP_MAX_PIPE_NUM; IspDev++) + { + Sample_Comm_Isp_Stop(IspDev); + } +} + +static hi_isp_sns_type Sample_Comm_GetSnsBusType(SAMPLE_SNS_TYPE_E enSnsType) +{ + hi_isp_sns_type enBusType; + + switch (enSnsType) + { + default: + enBusType = HI_ISP_SNS_I2C_TYPE; + break; + } + + return enBusType; +} + +hi_s32 Sample_Comm_Isp_BindSns(hi_isp_dev IspDev, hi_u32 u32SnsId, SAMPLE_SNS_TYPE_E enSnsType, hi_s8 s8SnsDev) +{ + hi_isp_sns_commbus uSnsBusInfo; + hi_isp_sns_type enBusType; + const hi_isp_sns_obj* pstSnsObj; + hi_s32 s32Ret; + + if (MAX_SENSOR_NUM <= u32SnsId) + { + SAMPLE_PRT("invalid sensor id: %d\n", u32SnsId); + return HI_FAILURE; + } + + pstSnsObj = Sample_Comm_Isp_GetSnsObj(u32SnsId); + + if (HI_NULL == pstSnsObj) + { + SAMPLE_PRT("sensor %d not exist!\n", u32SnsId); + return HI_FAILURE; + } + + enBusType = Sample_Comm_GetSnsBusType(enSnsType); + + if (HI_ISP_SNS_I2C_TYPE == enBusType) + { + uSnsBusInfo.i2c_dev = s8SnsDev; + } + else + { + uSnsBusInfo.ssp_dev.bit4_ssp_dev = s8SnsDev; + uSnsBusInfo.ssp_dev.bit4_ssp_cs = 0; + } + + if (HI_NULL != pstSnsObj->pfn_set_bus_info) + { + s32Ret = pstSnsObj->pfn_set_bus_info(IspDev, uSnsBusInfo); + + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("set sensor bus info failed with %#x!\n", s32Ret); + return s32Ret; + } + } + else + { + SAMPLE_PRT("not support set sensor bus info!\n"); + return HI_FAILURE; + } + + return s32Ret; +} + +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif /* End of #ifdef __cplusplus */ diff --git a/OnBoardInterface/Camera/MIPICamera/common/sample_comm_isp.h b/OnBoardInterface/Camera/MIPICamera/common/sample_comm_isp.h new file mode 100644 index 0000000000000000000000000000000000000000..62615dc1216f9b50812ebd0083408f055780a610 --- /dev/null +++ b/OnBoardInterface/Camera/MIPICamera/common/sample_comm_isp.h @@ -0,0 +1,26 @@ +#ifndef Sample_Comm_Isp_H +#define Sample_Comm_Isp_H + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif /* End of #ifdef __cplusplus */ + +hi_void Sample_Comm_Isp_Stop(hi_isp_dev IspDev); +hi_void Sample_Comm_All_ISP_Stop(hi_void); +hi_s32 Sample_Comm_Isp_Run(hi_isp_dev* pIspDev); +hi_s32 Sample_Comm_Isp_BindSns(hi_isp_dev IspDev, hi_u32 u32SnsId, SAMPLE_SNS_TYPE_E enSnsType, hi_s8 s8SnsDev); +hi_s32 Sample_Comm_Isp_Sensor_Regiter_callback(hi_isp_dev IspDev, hi_u32 u32SnsId); +hi_s32 Sample_Comm_Isp_Sensor_UnRegiter_callback(hi_isp_dev IspDev); +hi_s32 Sample_Comm_Isp_Aelib_Callback(hi_isp_dev IspDev); +hi_s32 Sample_Comm_Isp_Aelib_UnCallback(hi_isp_dev IspDev); +hi_s32 Sample_Comm_Isp_Awblib_Callback(hi_isp_dev IspDev); +hi_s32 Sample_Comm_Isp_Awblib_UnCallback(hi_isp_dev IspDev); + +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif /* End of #ifdef __cplusplus */ +#endif // Sample_Comm_Isp_H \ No newline at end of file diff --git a/OnBoardInterface/Camera/MIPICamera/common/sample_comm_vi.c b/OnBoardInterface/Camera/MIPICamera/common/sample_comm_vi.c new file mode 100644 index 0000000000000000000000000000000000000000..0e5c87042bc058cc52e2277bb18286dd746a51ba --- /dev/null +++ b/OnBoardInterface/Camera/MIPICamera/common/sample_comm_vi.c @@ -0,0 +1,1932 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "hi_mipi_rx.h" +#include "sample_comm.h" +#include "sample_comm_vi.h" +#include "sample_comm_isp.h" +#include "sensor_management.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif /* End of #ifdef __cplusplus */ + +#define MIPI_DEV_NODE "/dev/hi_mipi_rx" +#define MAX_FRAME_WIDTH 8192 + +static input_mode_t Sample_Comm_Vi_GetSnsInputMode(SAMPLE_SNS_TYPE_E enSnsType) +{ + input_mode_t enInputMode; + enInputMode = INPUT_MODE_MIPI; + + return enInputMode; +} + +hi_s32 Sample_Comm_Vi_ResetSns(sns_rst_source_t SnsDev) +{ + hi_s32 fd; + hi_s32 s32Ret; + + fd = open(MIPI_DEV_NODE, O_RDWR); + + if (fd < 0) + { + SAMPLE_PRT("open hi_mipi_rx dev failed\n"); + return -1; + } + + s32Ret = ioctl(fd, HI_MIPI_RESET_SENSOR, &SnsDev); + + if (HI_SUCCESS != s32Ret) + { + SAMPLE_PRT("HI_MIPI_SET_HS_MODE failed\n"); + } + + close(fd); + return s32Ret; +} + +hi_s32 Sample_Comm_Vi_SetMipiHsMode(lane_divide_mode_t enHsMode) +{ + hi_s32 fd; + hi_s32 s32Ret; + + fd = open(MIPI_DEV_NODE, O_RDWR); + if (fd < 0) + { + SAMPLE_PRT("open hi_mipi_rx dev failed\n"); + return -1; + } + + s32Ret = ioctl(fd, HI_MIPI_SET_HS_MODE, &enHsMode); + if (HI_SUCCESS != s32Ret) + { + SAMPLE_PRT("HI_MIPI_SET_HS_MODE failed\n"); + } + + close(fd); + return s32Ret; +} + +hi_s32 Sample_Comm_Vi_EnableMipiClock(SAMPLE_VI_CONFIG_S* pstViConfig) +{ + hi_s32 i = 0; + hi_s32 s32ViNum = 0; + hi_s32 s32Ret = HI_SUCCESS; + hi_s32 fd; + combo_dev_t devno = 0; + input_mode_t enInputMode; + SAMPLE_VI_INFO_S* pstViInfo = HI_NULL; + + if (!pstViConfig) + { + SAMPLE_PRT("%s: null ptr\n", __FUNCTION__); + return HI_FAILURE; + } + + fd = open(MIPI_DEV_NODE, O_RDWR); + if (fd < 0) + { + SAMPLE_PRT("open hi_mipi_rx dev failed\n"); + return HI_FAILURE; + } + + for (i = 0; i < pstViConfig->s32WorkingViNum; i++) + { + s32ViNum = pstViConfig->as32WorkingViId[i]; + pstViInfo = &pstViConfig->astViInfo[s32ViNum]; + devno = pstViInfo->stSnsInfo.MipiDev; + enInputMode = Sample_Comm_Vi_GetSnsInputMode(pstViInfo->stSnsInfo.enSnsType); + if (INPUT_MODE_SLVS == enInputMode) + { + s32Ret = ioctl(fd, HI_MIPI_ENABLE_SLVS_CLOCK, &devno); + } + else + { + s32Ret = ioctl(fd, HI_MIPI_ENABLE_MIPI_CLOCK, &devno); + } + + if (HI_SUCCESS != s32Ret) + { + SAMPLE_PRT("MIPI_ENABLE_CLOCK %d failed\n", devno); + goto EXIT; + } + } + +EXIT: + close(fd); + return s32Ret; +} + +hi_s32 Sample_Comm_Vi_DisableMipiClock(SAMPLE_VI_CONFIG_S* pstViConfig) +{ + hi_s32 i = 0; + hi_s32 s32ViNum = 0; + hi_s32 s32Ret = HI_SUCCESS; + hi_s32 fd; + combo_dev_t devno = 0; + input_mode_t enInputMode; + SAMPLE_VI_INFO_S* pstViInfo = HI_NULL; + + if (!pstViConfig) + { + SAMPLE_PRT("%s: null ptr\n", __FUNCTION__); + return HI_FAILURE; + } + + fd = open(MIPI_DEV_NODE, O_RDWR); + if (fd < 0) + { + SAMPLE_PRT("open hi_mipi_rx dev failed\n"); + return HI_FAILURE; + } + + for (i = 0; i < pstViConfig->s32WorkingViNum; i++) + { + s32ViNum = pstViConfig->as32WorkingViId[i]; + pstViInfo = &pstViConfig->astViInfo[s32ViNum]; + devno = pstViInfo->stSnsInfo.MipiDev; + enInputMode = Sample_Comm_Vi_GetSnsInputMode(pstViInfo->stSnsInfo.enSnsType); + if (INPUT_MODE_SLVS == enInputMode) + { + s32Ret = ioctl(fd, HI_MIPI_DISABLE_SLVS_CLOCK, &devno); + } + else + { + s32Ret = ioctl(fd, HI_MIPI_DISABLE_MIPI_CLOCK, &devno); + } + + if (HI_SUCCESS != s32Ret) + { + SAMPLE_PRT("MIPI_DISABLE_CLOCK %d failed\n", devno); + goto EXIT; + } + } + +EXIT: + close(fd); + return s32Ret; +} + +hi_s32 Sample_Comm_Vi_ClearMipi(SAMPLE_VI_CONFIG_S* pstViConfig) +{ + hi_s32 i = 0; + hi_s32 s32ViNum = 0; + hi_s32 s32Ret = HI_SUCCESS; + hi_s32 fd; + combo_dev_t devno = 0; + SAMPLE_VI_INFO_S* pstViInfo = HI_NULL; + + if (!pstViConfig) + { + SAMPLE_PRT("%s: null ptr\n", __FUNCTION__); + return HI_FAILURE; + } + + fd = open(MIPI_DEV_NODE, O_RDWR); + if (fd < 0) + { + SAMPLE_PRT("open hi_mipi_rx dev failed\n"); + return HI_FAILURE; + } + for (i = 0; i < pstViConfig->s32WorkingViNum; i++) + { + s32ViNum = pstViConfig->as32WorkingViId[i]; + pstViInfo = &pstViConfig->astViInfo[s32ViNum]; + devno = pstViInfo->stSnsInfo.MipiDev; + if (HI_SUCCESS != s32Ret) + { + SAMPLE_PRT("MIPI_CLEAR %d failed\n", devno); + goto EXIT; + } + } + +EXIT: + close(fd); + return s32Ret; +} + +hi_s32 Sample_Comm_Vi_ResetMipi(SAMPLE_VI_CONFIG_S* pstViConfig) +{ + hi_s32 i = 0; + hi_s32 s32ViNum = 0; + hi_s32 s32Ret = HI_SUCCESS; + hi_s32 fd; + combo_dev_t devno = 0; + input_mode_t enInputMode; + SAMPLE_VI_INFO_S* pstViInfo = HI_NULL; + + if (!pstViConfig) + { + SAMPLE_PRT("%s: null ptr\n", __FUNCTION__); + return HI_FAILURE; + } + fd = open(MIPI_DEV_NODE, O_RDWR); + + if (fd < 0) + { + SAMPLE_PRT("open hi_mipi_rx dev failed\n"); + return HI_FAILURE; + } + for (i = 0; i < pstViConfig->s32WorkingViNum; i++) + { + s32ViNum = pstViConfig->as32WorkingViId[i]; + pstViInfo = &pstViConfig->astViInfo[s32ViNum]; + devno = pstViInfo->stSnsInfo.MipiDev; + enInputMode = Sample_Comm_Vi_GetSnsInputMode(pstViInfo->stSnsInfo.enSnsType); + if (INPUT_MODE_SLVS == enInputMode) + { + s32Ret = ioctl(fd, HI_MIPI_RESET_SLVS, &devno); + } + else + { + s32Ret = ioctl(fd, HI_MIPI_RESET_MIPI, &devno); + } + + if (HI_SUCCESS != s32Ret) + { + SAMPLE_PRT("RESET_MIPI %d failed\n", devno); + goto EXIT; + } + } + +EXIT: + close(fd); + return s32Ret; +} + +hi_s32 Sample_Comm_Vi_UnresetMipi(SAMPLE_VI_CONFIG_S* pstViConfig) +{ + hi_s32 i = 0; + hi_s32 s32ViNum = 0; + hi_s32 s32Ret = HI_SUCCESS; + hi_s32 fd; + combo_dev_t devno = 0; + input_mode_t enInputMode; + SAMPLE_VI_INFO_S* pstViInfo = HI_NULL; + + if (!pstViConfig) + { + SAMPLE_PRT("%s: null ptr\n", __FUNCTION__); + return HI_FAILURE; + } + + fd = open(MIPI_DEV_NODE, O_RDWR); + if (fd < 0) + { + SAMPLE_PRT("open hi_mipi_rx dev failed\n"); + return HI_FAILURE; + } + for (i = 0; i < pstViConfig->s32WorkingViNum; i++) + { + s32ViNum = pstViConfig->as32WorkingViId[i]; + pstViInfo = &pstViConfig->astViInfo[s32ViNum]; + devno = pstViInfo->stSnsInfo.MipiDev; + enInputMode = Sample_Comm_Vi_GetSnsInputMode(pstViInfo->stSnsInfo.enSnsType); + if (INPUT_MODE_SLVS == enInputMode) + { + s32Ret = ioctl(fd, HI_MIPI_UNRESET_SLVS, &devno); + } + else + { + s32Ret = ioctl(fd, HI_MIPI_UNRESET_MIPI, &devno); + } + + if (HI_SUCCESS != s32Ret) + { + SAMPLE_PRT("UNRESET_MIPI %d failed\n", devno); + goto EXIT; + } + } + +EXIT: + close(fd); + return s32Ret; + +} + +hi_s32 sample_comm_vi_config_sensor_clk(SAMPLE_VI_CONFIG_S* viCfg) +{ + hi_s32 ret = HI_SUCCESS; + if (viCfg == NULL) { + SAMPLE_PRT("%s: null ptr\n", __FUNCTION__); + return HI_FAILURE; + } + + int fd = open(MIPI_DEV_NODE, O_RDWR); + if (fd < 0) { + SAMPLE_PRT("open hi_mipi_rx dev failed\n"); + return HI_FAILURE; + } + + for (hi_s32 i = 0; i < viCfg->s32WorkingViNum; i++) { + hi_s32 viNum = viCfg->as32WorkingViId[i]; + SAMPLE_VI_INFO_S* viInfo = &viCfg->astViInfo[viNum]; + sns_clk_cfg_t clk_cfg; + Sample_Comm_Vi_GetSnsClkCfgBySns(viInfo->stSnsInfo.enSnsType, + viInfo->stSnsInfo.MipiDev, &clk_cfg); + ret = ioctl(fd, HI_MIPI_CONFIG_SENSOR_CLOCK, &clk_cfg); + if (ret != 0) { + printf("HI_MIPI_CONFIG_SENSOR_CLOCK. Clock Source: %d, Clock Frequency: %d Error\n", + clk_cfg.clk_source, clk_cfg.clk_freq); + close(fd); + return HI_FAILURE; + } + printf("HI_MIPI_CONFIG_SENSOR_CLOCK. Clock Source: %d, Clock Frequency: %d OK\n", + clk_cfg.clk_source, clk_cfg.clk_freq); + } + + close(fd); + return HI_SUCCESS; +} + +hi_s32 sample_comm_vi_enable_sensor_clk(SAMPLE_VI_CONFIG_S* viCfg) +{ + hi_s32 ret = HI_SUCCESS; + if (viCfg == NULL) { + SAMPLE_PRT("%s: null ptr\n", __FUNCTION__); + return HI_FAILURE; + } + + int fd = open(MIPI_DEV_NODE, O_RDWR); + if (fd < 0) { + SAMPLE_PRT("open hi_mipi_rx dev failed\n"); + return HI_FAILURE; + } + + for (hi_s32 i = 0; i < viCfg->s32WorkingViNum; i++) { + hi_s32 viNum = viCfg->as32WorkingViId[i]; + SAMPLE_VI_INFO_S* viInfo = &viCfg->astViInfo[viNum]; + sns_clk_cfg_t clk_cfg; + sns_clk_source_t clk_src; + Sample_Comm_Vi_GetSnsClkCfgBySns(viInfo->stSnsInfo.enSnsType, + viInfo->stSnsInfo.MipiDev, &clk_cfg); + clk_src = clk_cfg.clk_source; + ret = ioctl(fd, HI_MIPI_ENABLE_SENSOR_CLOCK, &clk_src); + if (ret != 0) { + printf("HI_MIPI_ENABLE_SENSOR_CLOCK Clock Source: %d Error\n", clk_src); + close(fd); + return HI_FAILURE; + } + printf("HI_MIPI_ENABLE_SENSOR_CLOCK Clock Source: %d OK\n", clk_src); + } + + close(fd); + return HI_SUCCESS; +} + +hi_s32 sample_comm_vi_disable_sensor_clk(SAMPLE_VI_CONFIG_S* viCfg) +{ + hi_s32 ret = HI_SUCCESS; + if (viCfg == NULL) { + SAMPLE_PRT("%s: null ptr\n", __FUNCTION__); + return HI_FAILURE; + } + + int fd = open(MIPI_DEV_NODE, O_RDWR); + if (fd < 0) { + SAMPLE_PRT("open hi_mipi_rx dev failed\n"); + return HI_FAILURE; + } + + for (hi_s32 i = 0; i < viCfg->s32WorkingViNum; i++) { + hi_s32 viNum = viCfg->as32WorkingViId[i]; + SAMPLE_VI_INFO_S* viInfo = &viCfg->astViInfo[viNum]; + sns_clk_cfg_t clk_cfg; + sns_clk_source_t clk_src; + Sample_Comm_Vi_GetSnsClkCfgBySns(viInfo->stSnsInfo.enSnsType, + viInfo->stSnsInfo.MipiDev, &clk_cfg); + clk_src = clk_cfg.clk_source; + ret = ioctl(fd, HI_MIPI_DISABLE_SENSOR_CLOCK, &clk_src); + if (ret != 0) { + printf("HI_MIPI_DISABLE_SENSOR_CLOCK Clock Source: %d Error\n", clk_src); + close(fd); + return HI_FAILURE; + } + printf("HI_MIPI_DISABLE_SENSOR_CLOCK Clock Source: %d OK\n", clk_src); + } + + close(fd); + return HI_SUCCESS; +} + +hi_s32 sample_comm_vi_reset_sensor(SAMPLE_VI_CONFIG_S* viCfg) +{ + hi_s32 ret = HI_SUCCESS; + if (viCfg == NULL) { + SAMPLE_PRT("%s: null ptr\n", __FUNCTION__); + return HI_FAILURE; + } + + int fd = open(MIPI_DEV_NODE, O_RDWR); + if (fd < 0) { + SAMPLE_PRT("open hi_mipi_rx dev failed\n"); + return HI_FAILURE; + } + + for (hi_s32 i = 0; i < viCfg->s32WorkingViNum; i++) { + hi_s32 viNum = viCfg->as32WorkingViId[i]; + SAMPLE_VI_INFO_S* viInfo = &viCfg->astViInfo[viNum]; + sns_rst_source_t reset_port; + Sample_Comm_Vi_GetSnsRstSourceBySns(viInfo->stSnsInfo.enSnsType, + viInfo->stSnsInfo.MipiDev, &reset_port); + ret = ioctl(fd, HI_MIPI_RESET_SENSOR, &reset_port); + if (ret != 0) { + printf("HI_MIPI_RESET_SENSOR Reset Port: %d Error\n", reset_port); + close(fd); + return HI_FAILURE; + } + // 对于 imx219 模组,特殊情况,如复位前仍在出图 + // 需要在复位后增加一段延时满足sensor复位时序要求 + usleep(100 * 1000); /* 1ms: 1000us * (100) */ + printf("HI_MIPI_RESET_SENSOR Reset Port: %d OK\n", reset_port); + } + + close(fd); + return HI_SUCCESS; +} + +hi_s32 sample_comm_vi_unreset_sensor(SAMPLE_VI_CONFIG_S* viCfg) +{ + hi_s32 ret = HI_SUCCESS; + if (viCfg == NULL) { + SAMPLE_PRT("%s: null ptr\n", __FUNCTION__); + return HI_FAILURE; + } + + int fd = open(MIPI_DEV_NODE, O_RDWR); + if (fd < 0) { + SAMPLE_PRT("open hi_mipi_rx dev failed\n"); + return HI_FAILURE; + } + + for (hi_s32 i = 0; i < viCfg->s32WorkingViNum; i++) { + hi_s32 viNum = viCfg->as32WorkingViId[i]; + SAMPLE_VI_INFO_S* viInfo = &viCfg->astViInfo[viNum]; + sns_rst_source_t reset_port; + Sample_Comm_Vi_GetSnsRstSourceBySns(viInfo->stSnsInfo.enSnsType, + viInfo->stSnsInfo.MipiDev, &reset_port); + ret = ioctl(fd, HI_MIPI_UNRESET_SENSOR, &reset_port); + if (ret != 0) { + printf("HI_MIPI_UNRESET_SENSOR failed. reset port: %d\n", reset_port); + close(fd); + return HI_FAILURE; + } + printf("HI_MIPI_UNRESET_SENSOR Unreset Port: %d OK\n", reset_port); + } + + close(fd); + return HI_SUCCESS; +} + +hi_s32 Sample_Comm_Vi_SetMipiAttr(SAMPLE_VI_CONFIG_S* pstViConfig) +{ + hi_s32 i = 0; + hi_s32 s32ViNum = 0; + hi_s32 s32Ret = HI_SUCCESS; + hi_s32 fd; + SAMPLE_VI_INFO_S* pstViInfo = HI_NULL; + combo_dev_attr_t stcomboDevAttr; + + if (!pstViConfig) + { + SAMPLE_PRT("%s: null ptr\n", __FUNCTION__); + return HI_FAILURE; + } + fd = open(MIPI_DEV_NODE, O_RDWR); + if (fd < 0) + { + SAMPLE_PRT("open hi_mipi_rx dev failed\n"); + return HI_FAILURE; + } + + for (i = 0; i < pstViConfig->s32WorkingViNum; i++) + { + s32ViNum = pstViConfig->as32WorkingViId[i]; + pstViInfo = &pstViConfig->astViInfo[s32ViNum]; + Sample_Comm_Vi_GetComboAttrBySns(pstViInfo->stSnsInfo.enSnsType, + pstViInfo->stSnsInfo.MipiDev, &stcomboDevAttr); + stcomboDevAttr.data_rate = MIPI_DATA_RATE_X1; + SAMPLE_PRT("============= MipiDev %d, SetMipiAttr enWDRMode: %d\n", + pstViInfo->stSnsInfo.MipiDev, pstViInfo->stDevInfo.enWDRMode); + s32Ret = ioctl(fd, HI_MIPI_SET_DEV_ATTR, &stcomboDevAttr); + if (HI_SUCCESS != s32Ret) + { + SAMPLE_PRT("MIPI_SET_DEV_ATTR failed\n"); + goto EXIT; + } + } + +EXIT: + close(fd); + + return s32Ret; +} + +/***************************************************************************** +* function : init mipi +*****************************************************************************/ +hi_s32 Sample_Comm_Vi_StartMIPI(SAMPLE_VI_CONFIG_S* pstViConfig) +{ + hi_s32 s32Ret = HI_SUCCESS; + if (!pstViConfig) + { + SAMPLE_PRT("%s: null ptr\n", __FUNCTION__); + return HI_FAILURE; + } + + lane_divide_mode_t lane_divide_mode = pstViConfig->mipi_lane_divide_mode; + s32Ret = Sample_Comm_Vi_SetMipiHsMode(lane_divide_mode); + if (HI_SUCCESS != s32Ret) + { + SAMPLE_PRT("Sample_Comm_Vi_SetMipiHsMode failed!\n"); + return HI_FAILURE; + } + + s32Ret = Sample_Comm_Vi_EnableMipiClock(pstViConfig); + if (HI_SUCCESS != s32Ret) + { + SAMPLE_PRT("Sample_Comm_Vi_EnableMipiClock failed!\n"); + return HI_FAILURE; + } + + s32Ret = Sample_Comm_Vi_ResetMipi(pstViConfig); + if (HI_SUCCESS != s32Ret) + { + SAMPLE_PRT("Sample_Comm_Vi_ResetMipi failed!\n"); + return HI_FAILURE; + } + + s32Ret = sample_comm_vi_disable_sensor_clk(pstViConfig); + if (HI_SUCCESS != s32Ret) + { + SAMPLE_PRT("sample_comm_vi_disable_sensor_clk failed!\n"); + return HI_FAILURE; + } + + s32Ret = sample_comm_vi_config_sensor_clk(pstViConfig); + if (HI_SUCCESS != s32Ret) + { + SAMPLE_PRT("sample_comm_vi_config_sensor_clk failed!\n"); + return HI_FAILURE; + } + + s32Ret = sample_comm_vi_enable_sensor_clk(pstViConfig); + if (HI_SUCCESS != s32Ret) + { + SAMPLE_PRT("sample_comm_vi_enable_sensor_clk failed!\n"); + return HI_FAILURE; + } + + s32Ret = sample_comm_vi_reset_sensor(pstViConfig); + if (HI_SUCCESS != s32Ret) + { + SAMPLE_PRT("sample_comm_vi_reset_sensor failed!\n"); + return HI_FAILURE; + } + + s32Ret = Sample_Comm_Vi_SetMipiAttr(pstViConfig); + if (HI_SUCCESS != s32Ret) + { + SAMPLE_PRT("Sample_Comm_Vi_SetMipiAttr failed!\n"); + return HI_FAILURE; + } + + s32Ret = Sample_Comm_Vi_UnresetMipi(pstViConfig); + if (HI_SUCCESS != s32Ret) + { + SAMPLE_PRT("Sample_Comm_Vi_UnresetMipi failed!\n"); + return HI_FAILURE; + } + + s32Ret = sample_comm_vi_unreset_sensor(pstViConfig); + if (HI_SUCCESS != s32Ret) + { + SAMPLE_PRT("sample_comm_vi_unreset_sensor failed!\n"); + return HI_FAILURE; + } + return HI_SUCCESS; +} + +hi_s32 Sample_Comm_Vi_StopMIPI(SAMPLE_VI_CONFIG_S* pstViConfig) +{ + hi_s32 s32Ret = HI_SUCCESS; + + if (!pstViConfig) + { + SAMPLE_PRT("%s: null ptr\n", __FUNCTION__); + return HI_FAILURE; + } + + s32Ret = sample_comm_vi_reset_sensor(pstViConfig); + if (HI_SUCCESS != s32Ret) + { + SAMPLE_PRT("sample_comm_vi_reset_sensor failed!\n"); + return HI_FAILURE; + } + + s32Ret = sample_comm_vi_disable_sensor_clk(pstViConfig); + if (HI_SUCCESS != s32Ret) + { + SAMPLE_PRT("sample_comm_vi_disable_sensor_clk failed!\n"); + return HI_FAILURE; + } + + s32Ret = Sample_Comm_Vi_ResetMipi(pstViConfig); + if (HI_SUCCESS != s32Ret) + { + SAMPLE_PRT("Sample_Comm_Vi_ResetMipi failed!\n"); + return HI_FAILURE; + } + + s32Ret = Sample_Comm_Vi_DisableMipiClock(pstViConfig); + if (HI_SUCCESS != s32Ret) + { + SAMPLE_PRT("Sample_Comm_Vi_DisableMipiClock failed!\n"); + return HI_FAILURE; + } + + return HI_SUCCESS; +} + +hi_s32 Sample_Comm_Vi_SetParam(SAMPLE_VI_CONFIG_S* pstViConfig) +{ + hi_s32 i; + hi_s32 s32ViNum; + hi_s32 s32Ret; + hi_vi_pipe ViPipe; + SAMPLE_VI_INFO_S* pstViInfo = HI_NULL; + if (!pstViConfig) + { + SAMPLE_PRT("%s: null ptr\n", __FUNCTION__); + return HI_FAILURE; + } + return HI_SUCCESS; +} + +hi_s32 Sample_Comm_Vi_StartDev(SAMPLE_VI_INFO_S* pstViInfo) +{ + hi_s32 s32Ret; + hi_vi_dev ViDev; + SAMPLE_SNS_TYPE_E enSnsType; + hi_vi_dev_attr stViDevAttr; + + ViDev = pstViInfo->stDevInfo.ViDev; + enSnsType = pstViInfo->stSnsInfo.enSnsType; + SAMPLE_PRT("Function %s() enSnsType %d!\n", __FUNCTION__, enSnsType); + Sample_Comm_Vi_GetDevAttrBySns(enSnsType, &stViDevAttr); + SAMPLE_PRT("Function %s() hi_vi_intf_mode %d!\n", __FUNCTION__, stViDevAttr.intf_mode); + SAMPLE_PRT("Function %s() hi_vi_scan_mode %d!\n", __FUNCTION__, stViDevAttr.scan_mode); + stViDevAttr.wdr_attr.wdr_mode = pstViInfo->stDevInfo.enWDRMode; + stViDevAttr.data_rate = HI_DATA_RATE_X1; + + SAMPLE_PRT("Function %s() ViDev %d!\n", __FUNCTION__, ViDev); + s32Ret = hi_mpi_vi_set_dev_attr(ViDev, &stViDevAttr); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("HI_MPI_VI_SetDevAttr failed with %#x!\n", s32Ret); + return HI_FAILURE; + } + s32Ret = hi_mpi_vi_enable_dev(ViDev); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("hi_mpi_vi_enable_dev failed with %#x!\n", s32Ret); + return HI_FAILURE; + } + return HI_SUCCESS; +} + +hi_s32 Sample_Comm_Vi_StopDev(SAMPLE_VI_INFO_S* pstViInfo) +{ + hi_s32 s32Ret; + hi_vi_dev ViDev; + ViDev = pstViInfo->stDevInfo.ViDev; + s32Ret = hi_mpi_vi_disable_dev(ViDev); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("hi_mpi_vi_disable_dev failed with %#x!\n", s32Ret); + return HI_FAILURE; + } + return HI_SUCCESS; +} + +hi_s32 Sample_Comm_Vi_BindPipeDev(SAMPLE_VI_INFO_S* pstViInfo) +{ + hi_s32 i; + hi_s32 s32PipeCnt = 0; + hi_s32 s32Ret; + hi_vi_dev_bind_pipe stDevBindPipe = {0}; + + // Max Pipe Num 4 + for (i = 0; i < 4; i++) + { + if (pstViInfo->stPipeInfo.aPipe[i] >= 0 && pstViInfo->stPipeInfo.aPipe[i] < HI_VI_MAX_PIPE_NUM) + { + stDevBindPipe.pipe_id[s32PipeCnt] = pstViInfo->stPipeInfo.aPipe[i]; + s32PipeCnt++; + stDevBindPipe.num = s32PipeCnt; + } + } + SAMPLE_PRT("Function %s() ViDev: %d\n", __FUNCTION__, pstViInfo->stDevInfo.ViDev); + SAMPLE_PRT("Function %s() hi_vi_dev_bind_pipe.u32Num: %d\n", __FUNCTION__, stDevBindPipe.num); + s32Ret = hi_mpi_vi_set_dev_bind_pipe(pstViInfo->stDevInfo.ViDev, &stDevBindPipe); + + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("hi_mpi_vi_set_dev_bind_pipe failed with %#x!\n", s32Ret); + return HI_FAILURE; + } + + return s32Ret; +} + +static hi_s32 Sample_Comm_Vi_StartSingleViPipe(hi_vi_pipe ViPipe, hi_vi_pipe_attr* pstPipeAttr) +{ + hi_s32 s32Ret; + + s32Ret = hi_mpi_vi_create_pipe(ViPipe, pstPipeAttr); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("hi_mpi_vi_create_pipe failed with %#x!\n", s32Ret); + return HI_FAILURE; + } + s32Ret = hi_mpi_vi_start_pipe(ViPipe); + if (s32Ret != HI_SUCCESS) + { + hi_mpi_vi_destroy_pipe(ViPipe); + SAMPLE_PRT("hi_mpi_vi_start_pipe failed with %#x!\n", s32Ret); + return HI_FAILURE; + } + return s32Ret; +} + + +static hi_s32 Sample_Comm_Vi_ModeSwitchCreateSingleViPipe(hi_vi_pipe ViPipe, hi_vi_pipe_attr* pstPipeAttr) +{ + hi_s32 s32Ret; + s32Ret = hi_mpi_vi_create_pipe(ViPipe, pstPipeAttr); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("hi_mpi_vi_create_pipe failed with %#x!\n", s32Ret); + return HI_FAILURE; + } + return s32Ret; +} + + +static hi_s32 Sample_Comm_Vi_ModeSwitch_EnableSingleViPipe(hi_vi_pipe ViPipe, hi_vi_pipe_attr* pstPipeAttr) +{ + hi_s32 s32Ret; + s32Ret = hi_mpi_vi_start_pipe(ViPipe); + if (s32Ret != HI_SUCCESS) + { + hi_mpi_vi_destroy_pipe(ViPipe); + SAMPLE_PRT("hi_mpi_vi_start_pipe failed with %#x!\n", s32Ret); + return HI_FAILURE; + } + return s32Ret; +} + + +static hi_s32 Sample_Comm_Vi_StopSingleViPipe(hi_vi_pipe ViPipe) +{ + hi_s32 s32Ret; + s32Ret = hi_mpi_vi_stop_pipe(ViPipe); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("hi_mpi_vi_stop_pipe failed with %#x!\n", s32Ret); + return HI_FAILURE; + } + s32Ret = hi_mpi_vi_destroy_pipe(ViPipe); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("hi_mpi_vi_destroy_pipe failed with %#x!\n", s32Ret); + return HI_FAILURE; + } + return s32Ret; +} + + +hi_s32 Sample_Comm_Vi_ModeSwitch_StartViPipe(SAMPLE_VI_INFO_S* pstViInfo) +{ + hi_s32 i, j; + hi_s32 s32Ret = HI_SUCCESS; + hi_vi_pipe ViPipe; + hi_vi_pipe_attr stPipeAttr; + + for (i = 0; i < WDR_MAX_PIPE_NUM; i++) + { + if (pstViInfo->stPipeInfo.aPipe[i] >= 0 && pstViInfo->stPipeInfo.aPipe[i] < HI_VI_MAX_PIPE_NUM) + { + ViPipe = pstViInfo->stPipeInfo.aPipe[i]; + Sample_Comm_Vi_GetPipeAttrBySns(pstViInfo->stSnsInfo.enSnsType, &stPipeAttr); + { + s32Ret = Sample_Comm_Vi_ModeSwitchCreateSingleViPipe(ViPipe, &stPipeAttr); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("Sample_Comm_Vi_StartSingleViPipe %d failed!\n", ViPipe); + goto EXIT; + } + } + + } + } + return s32Ret; +EXIT: + for (j = 0; j < i; j++) + { + ViPipe = j; + Sample_Comm_Vi_StopSingleViPipe(ViPipe); + } + return s32Ret; +} + + +hi_s32 Sample_Comm_Vi_ModeSwitch_EnableViPipe(SAMPLE_VI_INFO_S* pstViInfo) +{ + hi_s32 i, j; + hi_s32 s32Ret = HI_SUCCESS; + hi_vi_pipe ViPipe; + hi_vi_pipe_attr stPipeAttr; + + for (i = 0; i < WDR_MAX_PIPE_NUM; i++) + { + if (pstViInfo->stPipeInfo.aPipe[i] >= 0 && pstViInfo->stPipeInfo.aPipe[i] < HI_VI_MAX_PIPE_NUM) + { + ViPipe = pstViInfo->stPipeInfo.aPipe[i]; + Sample_Comm_Vi_GetPipeAttrBySns(pstViInfo->stSnsInfo.enSnsType, &stPipeAttr); + { + s32Ret = Sample_Comm_Vi_ModeSwitch_EnableSingleViPipe(ViPipe, &stPipeAttr); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("Sample_Comm_Vi_StartSingleViPipe %d failed!\n", ViPipe); + goto EXIT; + } + } + + } + } + return s32Ret; + +EXIT: + for (j = 0; j < i; j++) + { + ViPipe = j; + Sample_Comm_Vi_StopSingleViPipe(ViPipe); + } + return s32Ret; +} + +hi_s32 Sample_Comm_Vi_StartViPipe(SAMPLE_VI_INFO_S* pstViInfo) +{ + SAMPLE_PRT("Enter Function %s()\n", __FUNCTION__); + hi_s32 i, j; + hi_s32 s32Ret = HI_SUCCESS; + hi_vi_pipe ViPipe; + hi_vi_pipe_attr stPipeAttr; + + for (i = 0; i < WDR_MAX_PIPE_NUM; i++) + { + if (pstViInfo->stPipeInfo.aPipe[i] >= 0 && pstViInfo->stPipeInfo.aPipe[i] < HI_VI_MAX_PIPE_NUM) + { + ViPipe = pstViInfo->stPipeInfo.aPipe[i]; + Sample_Comm_Vi_GetPipeAttrBySns(pstViInfo->stSnsInfo.enSnsType, &stPipeAttr); + // 在线不压缩前面已防护 + stPipeAttr.compress_mode = pstViInfo->stPipeInfo.enCompressMode; + printf("set pipe=%d compress mode=%u\n", i, stPipeAttr.compress_mode); + s32Ret = Sample_Comm_Vi_StartSingleViPipe(ViPipe, &stPipeAttr); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("Sample_Comm_Vi_StartSingleViPipe %d failed!\n", ViPipe); + goto EXIT; + } + } + } + SAMPLE_PRT("Function %s() success\n", __FUNCTION__); + return s32Ret; + +EXIT: + for (j = 0; j < i; j++) + { + ViPipe = j; + Sample_Comm_Vi_StopSingleViPipe(ViPipe); + } + return s32Ret; +} + +hi_s32 Sample_Comm_Vi_StopViPipe(SAMPLE_VI_INFO_S* pstViInfo) +{ + hi_s32 i; + hi_vi_pipe ViPipe; + for (i = 0; i < WDR_MAX_PIPE_NUM; i++) + { + if (pstViInfo->stPipeInfo.aPipe[i] >= 0 && pstViInfo->stPipeInfo.aPipe[i] < HI_VI_MAX_PIPE_NUM) + { + ViPipe = pstViInfo->stPipeInfo.aPipe[i]; + Sample_Comm_Vi_StopSingleViPipe(ViPipe); + } + } + return HI_SUCCESS; +} + + +hi_s32 Sample_Comm_Vi_ModeSwitch_StartViChn(SAMPLE_VI_INFO_S* pstViInfo) +{ + hi_s32 i; + hi_bool bNeedChn; + hi_s32 s32Ret = HI_SUCCESS; + hi_vi_pipe ViPipe; + hi_vi_chn ViChn; + hi_vi_chn_attr stChnAttr; + + for (i = 0; i < WDR_MAX_PIPE_NUM; i++) + { + if (pstViInfo->stPipeInfo.aPipe[i] >= 0 && pstViInfo->stPipeInfo.aPipe[i] < HI_VI_MAX_PIPE_NUM) + { + ViPipe = pstViInfo->stPipeInfo.aPipe[i]; + ViChn = pstViInfo->stChnInfo.ViChn; + Sample_Comm_Vi_GetChnAttrBySns(pstViInfo->stSnsInfo.enSnsType, &stChnAttr); + stChnAttr.dynamic_range = pstViInfo->stChnInfo.enDynamicRange; + stChnAttr.video_format = pstViInfo->stChnInfo.enVideoFormat; + stChnAttr.pixel_format = pstViInfo->stChnInfo.enPixFormat; + stChnAttr.compress_mode = pstViInfo->stChnInfo.enCompressMode; + if (HI_WDR_MODE_NONE == pstViInfo->stDevInfo.enWDRMode) + { + bNeedChn = HI_TRUE; + } + else + { + bNeedChn = (i > 0) ? HI_FALSE : HI_TRUE; + } + + if (bNeedChn) + { + s32Ret = hi_mpi_vi_set_chn_attr(ViPipe, ViChn, &stChnAttr); + + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("hi_mpi_vi_set_chn_attr failed with %#x!\n", s32Ret); + return HI_FAILURE; + } + } + } + } + + return s32Ret; +} +hi_s32 Sample_Comm_Vi_StartViChn(SAMPLE_VI_INFO_S* pstViInfo) +{ + hi_s32 i; + hi_bool bNeedChn; + hi_s32 s32Ret = HI_SUCCESS; + hi_vi_pipe ViPipe; + hi_vi_chn ViChn; + hi_vi_chn_attr stChnAttr; + + for (i = 0; i < WDR_MAX_PIPE_NUM; i++) + { + if (pstViInfo->stPipeInfo.aPipe[i] >= 0 && pstViInfo->stPipeInfo.aPipe[i] < HI_VI_MAX_PIPE_NUM) + { + ViPipe = pstViInfo->stPipeInfo.aPipe[i]; + ViChn = pstViInfo->stChnInfo.ViChn; + + Sample_Comm_Vi_GetChnAttrBySns(pstViInfo->stSnsInfo.enSnsType, &stChnAttr); + stChnAttr.dynamic_range = pstViInfo->stChnInfo.enDynamicRange; + stChnAttr.video_format = pstViInfo->stChnInfo.enVideoFormat; + stChnAttr.pixel_format = pstViInfo->stChnInfo.enPixFormat; + stChnAttr.compress_mode = pstViInfo->stChnInfo.enCompressMode; + if (HI_WDR_MODE_NONE == pstViInfo->stDevInfo.enWDRMode) + { + bNeedChn = HI_TRUE; + } + else + { + bNeedChn = (i > 0) ? HI_FALSE : HI_TRUE; + } + + if (bNeedChn) + { + s32Ret = hi_mpi_vi_set_chn_attr(ViPipe, ViChn, &stChnAttr); + + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("hi_mpi_vi_set_chn_attr failed with %#x!\n", s32Ret); + return HI_FAILURE; + } + s32Ret = hi_mpi_vi_enable_chn(ViPipe, ViChn); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("hi_mpi_vi_enable_chn failed with %#x!\n", s32Ret); + return HI_FAILURE; + } + } + } + } + + return s32Ret; +} + +static hi_s32 Sample_Comm_Vi_StopSingleViChn(hi_s32 ViPipe, hi_s32 ViChn) +{ + hi_s32 s32Ret; + s32Ret = hi_mpi_vi_disable_chn(ViPipe, ViChn); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("hi_mpi_vi_disable_chn failed with %#x!\n", s32Ret); + return HI_FAILURE; + } +} + +hi_s32 Sample_Comm_Vi_StopViChn(SAMPLE_VI_INFO_S* pstViInfo) +{ + hi_s32 i; + hi_bool bNeedChn; + hi_s32 s32Ret = HI_SUCCESS; + hi_vi_pipe ViPipe; + hi_vi_chn ViChn; + for (i = 0; i < 4; i++) + { + if (pstViInfo->stPipeInfo.aPipe[i] >= 0 && pstViInfo->stPipeInfo.aPipe[i] < HI_VI_MAX_PIPE_NUM) + { + ViPipe = pstViInfo->stPipeInfo.aPipe[i]; + ViChn = pstViInfo->stChnInfo.ViChn; + + if (HI_WDR_MODE_NONE == pstViInfo->stDevInfo.enWDRMode) + { + bNeedChn = HI_TRUE; + } + else + { + bNeedChn = (i > 0) ? HI_FALSE : HI_TRUE; + } + if (bNeedChn) + { + s32Ret = Sample_Comm_Vi_StopSingleViChn(ViPipe, ViChn); + } + } + } + return s32Ret; +} + +static hi_s32 Sample_Comm_Vi_CreateSingleVi(SAMPLE_VI_INFO_S* pstViInfo) +{ + hi_s32 s32Ret = HI_SUCCESS; + s32Ret = Sample_Comm_Vi_StartDev(pstViInfo); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("Sample_Comm_Vi_StartDev failed !\n"); + return HI_FAILURE; + } + // we should bind pipe,then creat pipe + s32Ret = Sample_Comm_Vi_BindPipeDev(pstViInfo); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("Sample_Comm_Vi_BindPipeDev failed !\n"); + goto EXIT1; + } + + s32Ret = Sample_Comm_Vi_StartViPipe(pstViInfo); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("Sample_Comm_Vi_StartViPipe failed !\n"); + goto EXIT1; + } + s32Ret = Sample_Comm_Vi_StartViChn(pstViInfo); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("Sample_Comm_Vi_StartViChn failed !\n"); + goto EXIT2; + } + return HI_SUCCESS; + +EXIT2: + Sample_Comm_Vi_StopViPipe(pstViInfo); +EXIT1: + Sample_Comm_Vi_StopDev(pstViInfo); + return s32Ret; +} + +static hi_s32 Sample_Comm_ModeSwitch_VI_CreateSingleVi(SAMPLE_VI_INFO_S* pstViInfo) +{ + hi_s32 s32Ret = HI_SUCCESS; + s32Ret = Sample_Comm_Vi_StartDev(pstViInfo); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("Sample_Comm_Vi_StartDev failed !\n"); + return HI_FAILURE; + } + //we should bind pipe,then creat pipe + s32Ret = Sample_Comm_Vi_BindPipeDev(pstViInfo); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("Sample_Comm_Vi_BindPipeDev failed !\n"); + goto EXIT1; + } + s32Ret = Sample_Comm_Vi_ModeSwitch_StartViPipe(pstViInfo); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("Sample_Comm_Vi_StartViPipe failed !\n"); + goto EXIT1; + } + s32Ret = Sample_Comm_Vi_ModeSwitch_StartViChn(pstViInfo); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("Sample_Comm_Vi_StartViChn failed !\n"); + goto EXIT2; + } + return HI_SUCCESS; +EXIT2: + Sample_Comm_Vi_StopViPipe(pstViInfo); +EXIT1: + Sample_Comm_Vi_StopDev(pstViInfo); + return s32Ret; +} + +static hi_s32 Sample_Comm_Vi_StartPipe_Chn(SAMPLE_VI_INFO_S* pstViInfo) +{ + hi_s32 s32Ret = HI_SUCCESS; + s32Ret = Sample_Comm_Vi_ModeSwitch_EnableViPipe(pstViInfo); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("Sample_Comm_Vi_StartViPipe failed !\n"); + goto EXIT1; + } + s32Ret = Sample_Comm_Vi_StartViChn(pstViInfo); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("Sample_Comm_Vi_StartViChn failed !\n"); + goto EXIT2; + } + return HI_SUCCESS; +EXIT2: + Sample_Comm_Vi_StopViPipe(pstViInfo); +EXIT1: + Sample_Comm_Vi_StopDev(pstViInfo); + return s32Ret; +} + +static hi_s32 Sample_Comm_Vi_DestroySingleVi(SAMPLE_VI_INFO_S* pstViInfo) +{ + Sample_Comm_Vi_StopViChn(pstViInfo); + Sample_Comm_Vi_StopViPipe(pstViInfo); + Sample_Comm_Vi_StopDev(pstViInfo); + return HI_SUCCESS; +} + +static hi_s32 Sample_Comm_Vi_DestroySinglePipe_Chn(SAMPLE_VI_INFO_S* pstViInfo) +{ + Sample_Comm_Vi_StopViChn(pstViInfo); + Sample_Comm_Vi_StopViPipe(pstViInfo); + return HI_SUCCESS; +} + +hi_s32 Sample_Comm_Vi_CreateVi(SAMPLE_VI_CONFIG_S* pstViConfig) +{ + hi_s32 i, j; + hi_s32 s32ViNum; + hi_s32 s32Ret = HI_SUCCESS; + SAMPLE_VI_INFO_S* pstViInfo = HI_NULL; + + if (!pstViConfig) + { + SAMPLE_PRT("%s: null ptr\n", __FUNCTION__); + return HI_FAILURE; + } + + for (i = 0; i < pstViConfig->s32WorkingViNum; i++) + { + s32ViNum = pstViConfig->as32WorkingViId[i]; + pstViInfo = &pstViConfig->astViInfo[s32ViNum]; + s32Ret = Sample_Comm_Vi_CreateSingleVi(pstViInfo); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("Sample_Comm_Vi_CreateSingleVi failed !\n"); + goto EXIT; + } + } + return HI_SUCCESS; +EXIT: + for (j = 0; j < i; j++) + { + s32ViNum = pstViConfig->as32WorkingViId[j]; + pstViInfo = &pstViConfig->astViInfo[s32ViNum]; + Sample_Comm_Vi_DestroySingleVi(pstViInfo); + } + return s32Ret; +} + +hi_s32 Sample_Comm_ModeSwitch_VI_CreateVi(SAMPLE_VI_CONFIG_S* pstViConfig) +{ + hi_s32 i, j; + hi_s32 s32ViNum; + hi_s32 s32Ret = HI_SUCCESS; + SAMPLE_VI_INFO_S* pstViInfo = HI_NULL; + if (!pstViConfig) + { + SAMPLE_PRT("%s: null ptr\n", __FUNCTION__); + return HI_FAILURE; + } + + for (i = 0; i < pstViConfig->s32WorkingViNum; i++) + { + s32ViNum = pstViConfig->as32WorkingViId[i]; + pstViInfo = &pstViConfig->astViInfo[s32ViNum]; + s32Ret = Sample_Comm_ModeSwitch_VI_CreateSingleVi(pstViInfo); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("Sample_Comm_Vi_CreateSingleVi failed !\n"); + goto EXIT; + } + } + return HI_SUCCESS; +EXIT: + for (j = 0; j < i; j++) + { + s32ViNum = pstViConfig->as32WorkingViId[j]; + pstViInfo = &pstViConfig->astViInfo[s32ViNum]; + Sample_Comm_Vi_DestroySingleVi(pstViInfo); + } + return s32Ret; +} + +hi_s32 Sample_Comm_ModeSwitch_VI_StartPipe_Chn(SAMPLE_VI_CONFIG_S* pstViConfig) +{ + hi_s32 i, j; + hi_s32 s32ViNum; + hi_s32 s32Ret = HI_SUCCESS; + SAMPLE_VI_INFO_S* pstViInfo = HI_NULL; + + if (!pstViConfig) + { + SAMPLE_PRT("%s: null ptr\n", __FUNCTION__); + return HI_FAILURE; + } + for (i = 0; i < pstViConfig->s32WorkingViNum; i++) + { + s32ViNum = pstViConfig->as32WorkingViId[i]; + pstViInfo = &pstViConfig->astViInfo[s32ViNum]; + s32Ret = Sample_Comm_Vi_StartPipe_Chn(pstViInfo); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("Sample_Comm_Vi_CreateSingleVi failed !\n"); + goto EXIT; + } + } + return HI_SUCCESS; +EXIT: + for (j = 0; j < i; j++) + { + s32ViNum = pstViConfig->as32WorkingViId[j]; + pstViInfo = &pstViConfig->astViInfo[s32ViNum]; + Sample_Comm_Vi_DestroySinglePipe_Chn(pstViInfo); + } + return s32Ret; +} + +hi_s32 Sample_Comm_Vi_DestroyVi(SAMPLE_VI_CONFIG_S* pstViConfig) +{ + hi_s32 i; + hi_s32 s32ViNum; + SAMPLE_VI_INFO_S* pstViInfo = HI_NULL; + if (!pstViConfig) + { + SAMPLE_PRT("%s: null ptr\n", __FUNCTION__); + return HI_FAILURE; + } + for (i = 0; i < pstViConfig->s32WorkingViNum; i++) + { + s32ViNum = pstViConfig->as32WorkingViId[i]; + pstViInfo = &pstViConfig->astViInfo[s32ViNum]; + Sample_Comm_Vi_DestroySingleVi(pstViInfo); + } + return HI_SUCCESS; +} + +hi_s32 Sample_Comm_Vi_ReStartSns(SAMPLE_VI_INFO_S* pstViInfo) +{ + hi_s32 i; + hi_s32 s32Ret = HI_SUCCESS; + hi_vi_pipe ViPipe; + hi_u32 u32SnsId; + const hi_isp_sns_obj* pstSnsObj; + + for (i = 0; i < WDR_MAX_PIPE_NUM; i++) + { + if (pstViInfo->stPipeInfo.aPipe[i] >= 0 && + pstViInfo->stPipeInfo.aPipe[i] < HI_VI_MAX_PIPE_NUM) + { + ViPipe = pstViInfo->stPipeInfo.aPipe[i]; + u32SnsId = pstViInfo->stSnsInfo.s32SnsId; + pstSnsObj = Sample_Comm_Isp_GetSnsObj(u32SnsId); + if (HI_NULL == pstSnsObj) + { + SAMPLE_PRT("sensor %d not exist!\n", u32SnsId); + return HI_FAILURE; + } + if (pstSnsObj->pfn_register_callback != HI_NULL) + { + pstSnsObj->pfn_restart(ViPipe); + } + else + { + SAMPLE_PRT("sensor_register_callback failed with HI_NULL!!!\n"); + } + } + } + return s32Ret; +} + +hi_s32 Sample_Comm_Vi_StartIsp(SAMPLE_VI_INFO_S* pstViInfo) +{ + hi_s32 i; + hi_bool bNeedPipe; + hi_s32 s32Ret = HI_SUCCESS; + hi_vi_pipe ViPipe; + hi_u32 u32SnsId; + hi_isp_pub_attr stPubAttr; + const hi_isp_sns_obj* pstSnsObj; + for (i = 0; i < WDR_MAX_PIPE_NUM; i++) + { + if (pstViInfo->stPipeInfo.aPipe[i] >= 0 && pstViInfo->stPipeInfo.aPipe[i] < HI_VI_MAX_PIPE_NUM) + { + ViPipe = pstViInfo->stPipeInfo.aPipe[i]; + u32SnsId = pstViInfo->stSnsInfo.s32SnsId; + Sample_Comm_Isp_GetIspAttrBySns(pstViInfo->stSnsInfo.enSnsType, &stPubAttr); + stPubAttr.wdr_mode = pstViInfo->stDevInfo.enWDRMode; + if (HI_WDR_MODE_NONE == pstViInfo->stDevInfo.enWDRMode) + { + bNeedPipe = HI_TRUE; + } + else + { + bNeedPipe = (i > 0) ? HI_FALSE : HI_TRUE; + } + if (HI_TRUE != bNeedPipe) + { + continue; + } + s32Ret = Sample_Comm_Isp_Sensor_Regiter_callback(ViPipe, u32SnsId); + if (HI_SUCCESS != s32Ret) + { + SAMPLE_PRT("register sensor %d to ISP %d failed\n", u32SnsId, ViPipe); + Sample_Comm_Isp_Stop(ViPipe); + return HI_FAILURE; + } + s32Ret = Sample_Comm_Isp_BindSns(ViPipe, u32SnsId, pstViInfo->stSnsInfo.enSnsType, + pstViInfo->stSnsInfo.s32BusId); + if (HI_SUCCESS != s32Ret) + { + SAMPLE_PRT("register sensor %d bus id %d failed\n", u32SnsId, + pstViInfo->stSnsInfo.s32BusId); + Sample_Comm_Isp_Stop(ViPipe); + return HI_FAILURE; + } + s32Ret = Sample_Comm_Isp_Aelib_Callback(ViPipe); + if (HI_SUCCESS != s32Ret) + { + SAMPLE_PRT("Sample_Comm_Isp_Aelib_Callback failed\n"); + Sample_Comm_Isp_Stop(ViPipe); + return HI_FAILURE; + } + s32Ret = Sample_Comm_Isp_Awblib_Callback(ViPipe); + if (HI_SUCCESS != s32Ret) + { + SAMPLE_PRT("Sample_Comm_Isp_Awblib_Callback failed\n"); + Sample_Comm_Isp_Stop(ViPipe); + return HI_FAILURE; + } + s32Ret = hi_mpi_isp_mem_init(ViPipe); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("Init Ext memory failed with %#x!\n", s32Ret); + Sample_Comm_Isp_Stop(ViPipe); + return HI_FAILURE; + } + s32Ret = hi_mpi_isp_set_pub_attr(ViPipe, &stPubAttr); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("SetPubAttr failed with %#x!\n", s32Ret); + Sample_Comm_Isp_Stop(ViPipe); + return HI_FAILURE; + } + s32Ret = hi_mpi_isp_init(ViPipe); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("ISP Init failed with %#x!\n", s32Ret); + Sample_Comm_Isp_Stop(ViPipe); + return HI_FAILURE; + } + s32Ret = Sample_Comm_Isp_Run(&pstViInfo->stPipeInfo.aPipe[i]); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("ISP Run failed with %#x!\n", s32Ret); + Sample_Comm_Isp_Stop(ViPipe); + return HI_FAILURE; + } + } + } + return s32Ret; +} + +hi_s32 Sample_Comm_Vi_StopIsp(SAMPLE_VI_INFO_S* pstViInfo) +{ + hi_s32 i; + hi_bool bNeedPipe; + hi_vi_pipe ViPipe; + for (i = 0; i < WDR_MAX_PIPE_NUM; i++) + { + if (pstViInfo->stPipeInfo.aPipe[i] >= 0 && + pstViInfo->stPipeInfo.aPipe[i] < HI_VI_MAX_PIPE_NUM) + { + ViPipe = pstViInfo->stPipeInfo.aPipe[i]; + + if (HI_WDR_MODE_NONE == pstViInfo->stDevInfo.enWDRMode) + { + bNeedPipe = HI_TRUE; + } + else + { + bNeedPipe = (i > 0) ? HI_FALSE : HI_TRUE; + } + + if (HI_TRUE != bNeedPipe) + { + continue; + } + Sample_Comm_Isp_Stop(ViPipe); + } + } + + return HI_SUCCESS; +} + +hi_s32 Sample_Comm_Vi_CreateIsp(SAMPLE_VI_CONFIG_S* pstViConfig) +{ + hi_s32 i; + hi_s32 s32ViNum; + hi_s32 s32Ret = HI_SUCCESS; + + SAMPLE_VI_INFO_S* pstViInfo = HI_NULL; + if (!pstViConfig) + { + SAMPLE_PRT("%s: null ptr\n", __FUNCTION__); + return HI_FAILURE; + } + for (i = 0; i < pstViConfig->s32WorkingViNum; i++) + { + s32ViNum = pstViConfig->as32WorkingViId[i]; + pstViInfo = &pstViConfig->astViInfo[s32ViNum]; + s32Ret = Sample_Comm_Vi_StartIsp(pstViInfo); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("Sample_Comm_Vi_StartIsp failed !\n"); + return HI_FAILURE; + } + } + for (i = 0; i < pstViConfig->s32WorkingViNum; i++) + { + s32ViNum = pstViConfig->as32WorkingViId[i]; + pstViInfo = &pstViConfig->astViInfo[s32ViNum]; + } + return HI_SUCCESS; +} + +hi_s32 Sample_Comm_Vi_DestroyIsp(SAMPLE_VI_CONFIG_S* pstViConfig) +{ + hi_s32 i; + hi_s32 s32ViNum; + hi_s32 s32Ret = HI_SUCCESS; + SAMPLE_VI_INFO_S* pstViInfo = HI_NULL; + if (!pstViConfig) + { + SAMPLE_PRT("%s: null ptr\n", __FUNCTION__); + return HI_FAILURE; + } + for (i = 0; i < pstViConfig->s32WorkingViNum; i++) + { + s32ViNum = pstViConfig->as32WorkingViId[i]; + pstViInfo = &pstViConfig->astViInfo[s32ViNum]; + s32Ret = Sample_Comm_Vi_StopIsp(pstViInfo); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("Sample_Comm_Vi_StopIsp failed !\n"); + return HI_FAILURE; + } + } + return HI_SUCCESS; +} + +hi_s32 Sample_Comm_Vi_StartVi(SAMPLE_VI_CONFIG_S* pstViConfig) +{ + hi_s32 s32Ret = HI_SUCCESS; + if (!pstViConfig) + { + SAMPLE_PRT("%s: null ptr\n", __FUNCTION__); + return HI_FAILURE; + } + s32Ret = Sample_Comm_Vi_StartMIPI(pstViConfig); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("Sample_Comm_Vi_StartMIPI failed!\n"); + return HI_FAILURE; + } + s32Ret = Sample_Comm_Vi_SetParam(pstViConfig); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("Sample_Comm_Vi_SetParam failed!\n"); + return HI_FAILURE; + } + s32Ret = Sample_Comm_Vi_CreateVi(pstViConfig); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("Sample_Comm_Vi_CreateVi failed!\n"); + return HI_FAILURE; + } + s32Ret = Sample_Comm_Vi_CreateIsp(pstViConfig); + if (s32Ret != HI_SUCCESS) + { + Sample_Comm_Vi_DestroyVi(pstViConfig); + SAMPLE_PRT("Sample_Comm_Vi_CreateIsp failed!\n"); + return HI_FAILURE; + } + return s32Ret; +} + +hi_s32 Sample_Comm_Vi_StopVi(SAMPLE_VI_CONFIG_S* pstViConfig) +{ + hi_s32 s32Ret = HI_SUCCESS; + s32Ret = Sample_Comm_Vi_DestroyIsp(pstViConfig); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("Sample_Comm_Vi_DestroyIsp failed !\n"); + return HI_FAILURE; + } + s32Ret = Sample_Comm_Vi_DestroyVi(pstViConfig); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("Sample_Comm_Vi_DestroyVi failed !\n"); + return HI_FAILURE; + } + s32Ret = Sample_Comm_Vi_StopMIPI(pstViConfig); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("Sample_Comm_Vi_StopMIPI failed !\n"); + return HI_FAILURE; + } + return s32Ret; +} + +static hi_s32 Sample_Comm_Vi_SetSingleIsp(hi_vi_pipe ViPipe, + hi_isp_pub_attr *stPrePubAttr, hi_isp_pub_attr *stPubAttr) +{ + hi_s32 s32Ret; + s32Ret = hi_mpi_isp_set_pub_attr(ViPipe, &stPrePubAttr); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("GetPubAttr failed with %#x!\n", s32Ret); + Sample_Comm_Isp_Stop(ViPipe); + return HI_FAILURE; + } + s32Ret = hi_mpi_isp_set_pub_attr(ViPipe, &stPubAttr); + if (s32Ret != HI_SUCCESS) + { + SAMPLE_PRT("SetPubAttr failed with %#x!\n", s32Ret); + Sample_Comm_Isp_Stop(ViPipe); + return HI_FAILURE; + } + return s32Ret; +} + +hi_s32 Sample_Comm_Vi_SwitchISPMode(SAMPLE_VI_CONFIG_S* pstViConfig) +{ + hi_s32 i,j; + hi_s32 s32ViNum; + hi_s32 s32Ret = HI_SUCCESS; + hi_bool bNeedPipe; + hi_vi_pipe ViPipe = 0; + hi_isp_pub_attr stPubAttr; + hi_isp_pub_attr stPrePubAttr; + SAMPLE_VI_INFO_S* pstViInfo = HI_NULL; + hi_bool bSwitchWDR[HI_VI_MAX_PIPE_NUM] = { HI_FALSE }; + hi_isp_inner_state_info stInnerStateInfo; + hi_bool bSwitchFinish; + hi_u32 u32SnsId; + const hi_isp_sns_obj *pstSnsObj; + if (!pstViConfig) + { + SAMPLE_PRT("%s: null ptr\n", __FUNCTION__); + return HI_FAILURE; + } + for (i = 0; i < pstViConfig->s32WorkingViNum; i++) + { + s32ViNum = pstViConfig->as32WorkingViId[i]; + pstViInfo = &pstViConfig->astViInfo[s32ViNum]; + for (j = 0; j < WDR_MAX_PIPE_NUM; j++) + { + if ( pstViInfo->stPipeInfo.aPipe[j] >= 0 && pstViInfo->stPipeInfo.aPipe[j] + < HI_VI_MAX_PIPE_NUM) + { + Sample_Comm_Isp_GetIspAttrBySns(pstViInfo->stSnsInfo.enSnsType, &stPubAttr); + stPubAttr.wdr_mode = pstViInfo->stDevInfo.enWDRMode ; + SAMPLE_PRT("Sample_Comm_Vi_CreateIsp enWDRMode is %d!\n", stPubAttr.wdr_mode); + if (HI_WDR_MODE_NONE == pstViInfo->stDevInfo.enWDRMode ) + { + bNeedPipe = HI_TRUE; + } + else + { + bNeedPipe = (j > 0) ? HI_FALSE : HI_TRUE; + } + if (HI_TRUE != bNeedPipe) + { + continue; + } + ViPipe = pstViInfo->stPipeInfo.aPipe[j]; + s32Ret = Sample_Comm_Vi_SetSingleIsp(ViPipe, &stPrePubAttr, &stPubAttr); + if (stPrePubAttr.wdr_mode != stPubAttr.wdr_mode) + { + bSwitchWDR[ViPipe] = HI_TRUE; + } + } + } + } + + while (1) + { + bSwitchFinish = HI_TRUE; + for (i = 0; i < pstViConfig->s32WorkingViNum; i++) + { + s32ViNum = pstViConfig->as32WorkingViId[i]; + pstViInfo = &pstViConfig->astViInfo[s32ViNum]; + ViPipe = pstViInfo->stPipeInfo.aPipe[0]; + u32SnsId = pstViInfo->stSnsInfo.s32SnsId; + hi_mpi_isp_query_inner_state_info(ViPipe, &stInnerStateInfo); + if (bSwitchWDR[ViPipe] == HI_TRUE) + { + bSwitchFinish &= stInnerStateInfo.wdr_switch_finish; + } + else + { + bSwitchFinish &= stInnerStateInfo.res_switch_finish; + } + } + if (bSwitchFinish == HI_TRUE) { + SAMPLE_PRT("Switch finish!\n"); + break; + } + usleep(1000); + } + + for (i = 0; i < pstViConfig->s32WorkingViNum; i++) + { + s32ViNum = pstViConfig->as32WorkingViId[i]; + pstViInfo = &pstViConfig->astViInfo[s32ViNum]; + } + + for (i = 0; i < pstViConfig->s32WorkingViNum; i++) + { + s32ViNum = pstViConfig->as32WorkingViId[i]; + pstViInfo = &pstViConfig->astViInfo[s32ViNum]; + Sample_Comm_Vi_StartPipe_Chn(pstViInfo); + } + return s32Ret; +} + +/****************************************************************************** +* funciton : Get enSize by diffrent sensor +******************************************************************************/ +hi_s32 Sample_Comm_Vi_GetFrameRateBySensor(SAMPLE_SNS_TYPE_E enMode, hi_u32* pu32FrameRate) +{ + hi_s32 s32Ret = HI_SUCCESS; + if (!pu32FrameRate) + { + return HI_FAILURE; + } + *pu32FrameRate = 30; // 设置sensor帧率为30 + return s32Ret; +} + +combo_dev_t Sample_Comm_Vi_GetComboDevBySensor(SAMPLE_SNS_TYPE_E enMode, hi_s32 s32SnsIdx) +{ + combo_dev_t dev = 0; + return dev; +} + +hi_s32 Sample_Comm_Vi_ConvertBitPixel(hi_u8 *pu8Data, hi_u32 u32DataNum, + hi_u32 u32BitWidth, hi_u16 *pu16OutData) +{ + hi_s32 i, u32Tmp, s32OutCnt; + hi_u32 u32Val; + hi_u64 u64Val; + hi_u8 *pu8Tmp = pu8Data; + + s32OutCnt = 0; + switch (u32BitWidth) + { + case 10: // 10 bit + { + /* 4 pixels consist of 5 bytes */ + u32Tmp = u32DataNum / 4; + for (i = 0; i < u32Tmp; i++) + { + /* byte4 byte3 byte2 byte1 byte0 */ + pu8Tmp = pu8Data + 5 * i; + u64Val = pu8Tmp[0] + ((hi_u32)pu8Tmp[1] << 8) + ((hi_u32)pu8Tmp[2] << 16) + + ((hi_u32)pu8Tmp[3] << 24) + ((hi_u64)pu8Tmp[4] << 32); + pu16OutData[s32OutCnt++] = u64Val & 0x3ff; + pu16OutData[s32OutCnt++] = (u64Val >> 10) & 0x3ff; + pu16OutData[s32OutCnt++] = (u64Val >> 20) & 0x3ff; + pu16OutData[s32OutCnt++] = (u64Val >> 30) & 0x3ff; + } + } + break; + case 12: // 12 bit + { + /* 2 pixels consist of 3 bytes */ + u32Tmp = u32DataNum / 2; + for (i = 0; i < u32Tmp; i++) + { + /* byte2 byte1 byte0 */ + pu8Tmp = pu8Data + 3 * i; + u32Val = pu8Tmp[0] + (pu8Tmp[1] << 8) + (pu8Tmp[2] << 16); + pu16OutData[s32OutCnt++] = u32Val & 0xfff; + pu16OutData[s32OutCnt++] = (u32Val >> 12) & 0xfff; + } + } + break; + case 14: // 14 bit + { + /* 4 pixels consist of 7 bytes */ + u32Tmp = u32DataNum / 4; + for (i = 0; i < u32Tmp; i++) + { + pu8Tmp = pu8Data + 7 * i; + u64Val = pu8Tmp[0] + ((hi_u32)pu8Tmp[1] << 8) + ((hi_u32)pu8Tmp[2] << 16) + + ((hi_u32)pu8Tmp[3] << 24) + ((hi_u64)pu8Tmp[4] << 32) + + ((hi_u64)pu8Tmp[5] << 40) + ((hi_u64)pu8Tmp[6] << 48); + pu16OutData[s32OutCnt++] = u64Val & 0x3fff; + pu16OutData[s32OutCnt++] = (u64Val >> 14) & 0x3fff; + pu16OutData[s32OutCnt++] = (u64Val >> 28) & 0x3fff; + pu16OutData[s32OutCnt++] = (u64Val >> 42) & 0x3fff; + } + } + break; + default: + SAMPLE_PRT("unsuport bitWidth: %d\n", u32BitWidth); + return HI_FAILURE; + break; + } + return s32OutCnt; +} + +static hi_s32 Sample_Comm_Vi_BitWidth2PixelFormat(hi_u32 u32Nbit, hi_pixel_format *penPixelFormat) +{ + hi_pixel_format enPixelFormat; + if (8 == u32Nbit) + { + enPixelFormat = HI_PIXEL_FORMAT_RGB_BAYER_8BPP; + } + else if (10 == u32Nbit) + { + enPixelFormat = HI_PIXEL_FORMAT_RGB_BAYER_10BPP; + } + else if (12 == u32Nbit) + { + enPixelFormat = HI_PIXEL_FORMAT_RGB_BAYER_12BPP; + } + else if (14 == u32Nbit) + { + enPixelFormat = HI_PIXEL_FORMAT_RGB_BAYER_14BPP; + } + else if (16 == u32Nbit) + { + enPixelFormat = HI_PIXEL_FORMAT_RGB_BAYER_16BPP; + } + else + { + return HI_FAILURE; + } + *penPixelFormat = enPixelFormat; + return HI_SUCCESS; +} + +hi_s32 Sample_Comm_Vi_SaveUncompressRaw(hi_video_frame* pVBuf, hi_u32 u32Nbit, FILE* pfd) +{ + hi_u32 u32Height; + hi_u64 u64PhyAddr; + hi_u64 u64Size; + hi_u8* pu8VirAddr; + hi_u16 *pu16Data = NULL; + hi_u8 *pu8Data; + hi_pixel_format enPixelFormat = HI_PIXEL_FORMAT_BUTT; + Sample_Comm_Vi_BitWidth2PixelFormat(u32Nbit, &enPixelFormat); + if (enPixelFormat != pVBuf->pixel_format) + { + SAMPLE_PRT("invalid pixel format:%d, u32Nbit: %d\n", pVBuf->pixel_format, u32Nbit); + return HI_FAILURE; + } + u64Size = (pVBuf->header_stride[0]) * ((hi_u64)pVBuf->height); + u64PhyAddr = pVBuf->phys_addr[0]; + pu8VirAddr = (hi_u8*)u64PhyAddr; + pu8Data = pu8VirAddr; + if ((8 != u32Nbit) && (16 != u32Nbit)) + { + pu16Data = (hi_u16*)malloc(pVBuf->width * 2U); + if (NULL == pu16Data) + { + SAMPLE_PRT("alloc memory failed\n"); + pu8VirAddr = NULL; + return HI_FAILURE; + } + } + /* save Y ----------------------------------------------------------------*/ + SAMPLE_PRT("saving......dump data......u32Stride[0]: %d, width: %d\n", + pVBuf->header_stride[0], pVBuf->width); + + for (u32Height = 0; u32Height < pVBuf->height; u32Height++) + { + if (8 == u32Nbit) + { + fwrite(pu8Data, pVBuf->width, 1, pfd); + } + else if (16 == u32Nbit) + { + fwrite(pu8Data, pVBuf->width, 2, pfd); + fflush(pfd); + } + else + { + Sample_Comm_Vi_ConvertBitPixel(pu8Data, pVBuf->width, u32Nbit, pu16Data); + fwrite(pu16Data, pVBuf->width, 2, pfd); + } + pu8Data += pVBuf->header_stride[0]; + } + fflush(pfd); + SAMPLE_PRT("done u32TimeRef: %d!\n", pVBuf->time_ref); + if (NULL != pu16Data) + { + free(pu16Data); + } + pu8VirAddr = NULL; + return HI_SUCCESS; +} + +hi_u32 Sample_Comm_Vi_PixelFormat2BitWidth(hi_pixel_format enPixelFormat) +{ + switch (enPixelFormat) + { + case HI_PIXEL_FORMAT_RGB_BAYER_8BPP: + return 8; + case HI_PIXEL_FORMAT_RGB_BAYER_10BPP: + return 10; + case HI_PIXEL_FORMAT_RGB_BAYER_12BPP: + return 12; + case HI_PIXEL_FORMAT_RGB_BAYER_14BPP: + return 14; + case HI_PIXEL_FORMAT_RGB_BAYER_16BPP: + return 16; + default: + return 0; + } +} + +char* Sample_Comm_Vi_CompressMode2String(hi_compress_mode enCompressMode) +{ + if(HI_COMPRESS_MODE_NONE == enCompressMode) + { + return "CMP_NONE"; + } + else if(HI_COMPRESS_MODE_LINE == enCompressMode) + { + return "CMP_LINE"; + } + else if(HI_COMPRESS_MODE_SEG == enCompressMode) + { + return "CMP_SEG"; + } + else + { + return "CMP_XXX"; + } +} + +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif /* End of #ifdef __cplusplus */ diff --git a/OnBoardInterface/Camera/MIPICamera/common/sample_comm_vi.h b/OnBoardInterface/Camera/MIPICamera/common/sample_comm_vi.h new file mode 100644 index 0000000000000000000000000000000000000000..688a3609e23a17ecda6c80c49492f08bcf415fe7 --- /dev/null +++ b/OnBoardInterface/Camera/MIPICamera/common/sample_comm_vi.h @@ -0,0 +1,33 @@ +#ifndef Sample_Comm_Vi_H +#define Sample_Comm_Vi_H + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif /* End of #ifdef __cplusplus */ + +hi_s32 Sample_Comm_Vi_GetWDRModeBySensor(SAMPLE_SNS_TYPE_E enMode, hi_wdr_mode* penWDRMode); +hi_s32 Sample_Comm_Vi_GetSizeBySensor(SAMPLE_SNS_TYPE_E enMode, PIC_SIZE_E* penSize); +hi_s32 Sample_Comm_Vi_GetFrameRateBySensor(SAMPLE_SNS_TYPE_E enMode, hi_u32* pu32FrameRate); +hi_s32 Sample_Comm_Vi_StartDev(SAMPLE_VI_INFO_S* pstViInfo); +hi_s32 Sample_Comm_Vi_StartChn(hi_vi_chn ViChn, hi_rect* pstCapRect, hi_size* pstTarSize, + SAMPLE_VI_CONFIG_S* pstViConfig); +hi_s32 Sample_Comm_Vi_StartMIPI(SAMPLE_VI_CONFIG_S* pstViConfig); +hi_s32 Sample_Comm_Vi_StartVi(SAMPLE_VI_CONFIG_S* pstViConfig); +hi_s32 Sample_Comm_Vi_StopVi(SAMPLE_VI_CONFIG_S* pstViConfig); +hi_s32 Sample_Comm_Vi_SetMipiAttr(SAMPLE_VI_CONFIG_S* pstViConfig); +hi_void Sample_Comm_Vi_GetSensorInfo(SAMPLE_VI_CONFIG_S* pstViConfig); + +combo_dev_t Sample_Comm_Vi_GetComboDevBySensor(SAMPLE_SNS_TYPE_E enMode, hi_s32 s32SnsIdx); +hi_s32 Sample_Comm_Vi_SetParam(SAMPLE_VI_CONFIG_S* pstViConfig); +hi_s32 Sample_Comm_Vi_SwitchMode_StopVI(SAMPLE_VI_CONFIG_S* pstViConfigSrc); +hi_s32 Sample_Comm_Vi_SwitchMode(SAMPLE_VI_CONFIG_S* pstViConfigDes); + +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif /* End of #ifdef __cplusplus */ + +#endif // Sample_Comm_Vi_H \ No newline at end of file diff --git a/OnBoardInterface/Camera/MIPICamera/main.c b/OnBoardInterface/Camera/MIPICamera/main.c new file mode 100644 index 0000000000000000000000000000000000000000..eb3b86d0856902ceff9edb9f26b4c5957c9c6a52 --- /dev/null +++ b/OnBoardInterface/Camera/MIPICamera/main.c @@ -0,0 +1,129 @@ +/** +* @File sample_raw_back.c +* @Description sample app +* +* Copyright (c) Huawei Technologies Co., Ltd. 2016-2021. All rights reserved. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "sample_comm.h" +#include "sample_comm_vi.h" +#include "sample_comm_isp.h" +#include "vi_with_sensor.h" + +static volatile sig_atomic_t g_sig_flag = 0; + +#define check_digit(x) ((x) >= '0' && (x) <= '9') + +static hi_void sample_vio_usage(char *prg_name) +{ + printf("usage : %s \n", prg_name); + printf("index:\n"); + printf(" (1) run VI with sensor\n"); + printf("camera num:\n"); + printf(" num between [1, 2]\n"); + printf("camera type:\n"); + printf(" (1) imx-219\n"); + printf(" (2) imx-477\n"); +} + +static hi_void sample_vio_handle_sig(hi_s32 signo) +{ + if (signo == SIGINT || signo == SIGTERM) { + g_sig_flag = 1; + } +} + +static hi_void sample_register_sig_handler(hi_void (*sig_handle)(hi_s32)) +{ + struct sigaction sa; + (hi_void)memset(&sa, 0, sizeof(struct sigaction)); + sa.sa_handler = sig_handle; + sa.sa_flags = 0; + sigaction(SIGINT, &sa, HI_NULL); + sigaction(SIGTERM, &sa, HI_NULL); +} + +static hi_s32 sample_vio_execute_case(hi_u32 case_index, case_info info) +{ + hi_s32 ret; + + switch (case_index) { + case 1: + ret = vi_with_sensor(0, info); + break; + case 2: + ret = vi_with_sensor(1, info); + break; + default: + ret = HI_FAILURE; + printf("Error. This case is not implemented.\n"); + break; + } + + return ret; +} + +hi_s32 main(hi_s32 argc, hi_char *argv[]) +{ + hi_s32 ret; + hi_u32 index; + case_info info; + + if (!strncmp(argv[1], "-h", 2)) { /* 2:arg num */ + sample_vio_usage(argv[0]); + return HI_FAILURE; + } + + if (!check_digit(argv[1][0]) || !check_digit(argv[2][0]) || !check_digit(argv[3][0])) { /* 2:arg len */ + printf("input is invalid\n", index); + sample_vio_usage(argv[0]); + return HI_FAILURE; + } + sample_register_sig_handler(sample_vio_handle_sig); + + index = atoi(argv[1]); + if (index <= 0 || index > 2) { + printf("index = %u is not supprot\n", index); + return HI_FAILURE; + } + + if (argc > 2) { + info.sensor_num = atoi(argv[2]); + if (info.sensor_num > 2 || info.sensor_num <= 0) { + printf("sensor_num = %u is support 1 or 2", info.sensor_num); + return HI_FAILURE; + } + } + printf("set sensor_num=%u\n", info.sensor_num); + if (argc > 3) { + info.sensor_type= atoi(argv[3]); // 压缩方式 + if (info.sensor_type <= 0 && info.sensor_type > 2) { + printf("sensor_type = %u is support 1 or 2\n", info.sensor_type); + return HI_FAILURE; + } + } + printf("set sensor_type = %u\n", info.sensor_type); + + ret = sample_vio_execute_case(index, info); + if ((ret == HI_SUCCESS) && (g_sig_flag == 0)) { + printf("\033[0;32mprogram exit normally!\033[0;39m\n"); + } else { + printf("\033[0;31mprogram exit abnormally!\033[0;39m\n"); + } + return ret; +} \ No newline at end of file diff --git a/OnBoardInterface/Camera/MIPICamera/sensor/CMakeLists.txt b/OnBoardInterface/Camera/MIPICamera/sensor/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..374fb48e34c028fe176701033d998cdf8d8b29c6 --- /dev/null +++ b/OnBoardInterface/Camera/MIPICamera/sensor/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(sony_imx219) +add_subdirectory(sony_imx477) \ No newline at end of file diff --git a/OnBoardInterface/Camera/MIPICamera/sensor/include/hi_sns_ctrl.h b/OnBoardInterface/Camera/MIPICamera/sensor/include/hi_sns_ctrl.h new file mode 100644 index 0000000000000000000000000000000000000000..d0bb2ac084e8fe143c4edeaa6850470b0bb557bd --- /dev/null +++ b/OnBoardInterface/Camera/MIPICamera/sensor/include/hi_sns_ctrl.h @@ -0,0 +1,122 @@ +/* + * Copyright (c) Hisilicon Technologies Co., Ltd. 2023-2023. All rights reserved. + * Description: Function of hi_sns_ctrl.h + * Author: Hisilicon multimedia software group + * Create: 2023-03-06 + */ + +#ifndef HI_SNS_CTRL_H +#define HI_SNS_CTRL_H + +#include "hi_media_type.h" +#include "hi_common_3a.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif /* End of #ifdef __cplusplus */ +#define ISP_SNS_SAVE_INFO_MAX 2U +typedef struct { + hi_bool init; /* HI_TRUE: Sensor init */ + hi_bool sync_init; /* HI_TRUE: Sync Reg init */ + hi_u8 img_mode; + hi_u8 hdr; /* HI_TRUE: HDR enbale */ + hi_wdr_mode wdr_mode; + + hi_isp_sns_regs_info regs_info[ISP_SNS_SAVE_INFO_MAX]; /* [0]: Sensor reg info of cur-frame; + [1]: Sensor reg info of pre-frame ; */ + + hi_u32 fl[ISP_SNS_SAVE_INFO_MAX]; /* [0]: FullLines of cur-frame; + [1]: Pre FullLines of pre-frame */ + hi_u32 fl_std; /* FullLines std */ + hi_u32 wdr_int_time[HI_ISP_WDR_MAX_FRAME_NUM]; + hi_u32 sensor_wb_gain[HI_ISP_BAYER_CHN_NUM]; +} hi_isp_sns_state; + +typedef enum hiISP_SNS_MIRRORFLIP_TYPE_E { + ISP_SNS_NORMAL = 0, + ISP_SNS_MIRROR = 1, + ISP_SNS_FLIP = 2, + ISP_SNS_MIRROR_FLIP = 3, + ISP_SNS_BUTT +} hi_isp_sns_mirrorflip_type; + +typedef struct { + hi_s32 (*pfn_register_callback)(hi_vi_pipe vi_pipe, hi_isp_3a_alg_lib *ae_lib, hi_isp_3a_alg_lib *awb_lib); + hi_s32 (*pfn_un_register_callback)(hi_vi_pipe vi_pipe, hi_isp_3a_alg_lib *ae_lib, hi_isp_3a_alg_lib *awb_lib); + hi_s32 (*pfn_set_bus_info)(hi_vi_pipe vi_pipe, hi_isp_sns_commbus sns_bus_info); + hi_void (*pfn_standby)(hi_vi_pipe vi_pipe); + hi_void (*pfn_restart)(hi_vi_pipe vi_pipe); + hi_void (*pfn_mirror_flip)(hi_vi_pipe vi_pipe, hi_isp_sns_mirrorflip_type sns_mirror_flip); + hi_s32 (*pfn_write_reg)(hi_vi_pipe vi_pipe, hi_u32 addr, hi_u32 data); + hi_s32 (*pfn_read_reg)(hi_vi_pipe vi_pipe, hi_u32 addr); + hi_s32 (*pfn_set_init)(hi_vi_pipe vi_pipe, hi_isp_init_attr *init_attr); + hi_s32 (*pfn_identify_module)(hi_vi_pipe vi_pipe); +} hi_isp_sns_obj; + +#define SENSOR_FREE(ptr) \ + do { \ + if ((ptr) != HI_NULL) { \ + free(ptr); \ + (ptr) = HI_NULL; \ + } \ + } while (0) + +#define SNS_ERR_TRACE(fmt, ...) \ + do { \ + printf("[sensor]" fmt, ##__VA_ARGS__); \ + } while (0) + +#define SNS_INFO_TRACE(fmt, ...) \ + do { \ + printf("[sensor]" fmt, ##__VA_ARGS__); \ + } while (0) + +#define CMOS_CHECK_POINTER(ptr) \ + do { \ + if ((ptr) == HI_NULL) { \ + SNS_ERR_TRACE("Null Pointer!\n"); \ + return HI_ERR_ISP_NULL_PTR; \ + } \ + } while (0) + +#define CMOS_CHECK_POINTER_VOID(ptr) \ + do { \ + if ((ptr) == HI_NULL) { \ + SNS_ERR_TRACE("Null Pointer!\n"); \ + return; \ + } \ + } while (0) + +#define SNS_CHECK_PIPE_RETURN(viPipe) \ + do { \ + if (((viPipe) < 0) || ((viPipe) >= HI_ISP_MAX_PIPE_NUM)) { \ + SNS_ERR_TRACE("Err viPipe %d!\n", viPipe); \ + return HI_ERR_ISP_ILLEGAL_PARAM; \ + } \ + } while (0) + +#define SNS_CHECK_PIPE_VOID(viPipe) \ + do { \ + if (((viPipe) < 0) || ((viPipe) >= HI_ISP_MAX_PIPE_NUM)) { \ + SNS_ERR_TRACE("Err viPipe %d!\n", viPipe); \ + return; \ + } \ + } while (0) + +#define SNS_DIV_0_TO_1(a) (((a) == 0) ? 1 : (a)) +#define SNS_DIV_0_TO_1_FLOAT(a) ((((a) < 1E-10) && ((a) > (-1E-10))) ? 1 : (a)) +#define sns_unused(x) ((hi_void)(x)) + +#define HIGHER_4BITS(x) (((x) & 0xf0000) >> 16U) +#define HIGH_8BITS(x) (((x) & 0xff00) >> 8U) +#define LOW_8BITS(x) ((x) & 0x00ff) + +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif /* End of #ifdef __cplusplus */ + +#endif /* HI_SNS_CTRL_H */ diff --git a/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx219/CMakeLists.txt b/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx219/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..23ae55d821f11540e39d8acb3b8ebcc6c2989186 --- /dev/null +++ b/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx219/CMakeLists.txt @@ -0,0 +1,46 @@ +# Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. + +# CMake lowest version requirement +cmake_minimum_required(VERSION 3.5.1) + +### Sensor SONY IMX219 ### +# project information +project(sns_imx219) + +set(LIB_PATH $ENV{NPU_HOST_LIB}) +# Dynamic libraries in the stub directory can only be used for compilation +if (NOT DEFINED ENV{NPU_HOST_LIB}) + set(LIB_PATH "/usr/local/Ascend/ascend-toolkit/latest/CANN-6.4/runtime/lib64/stub/aarch64") + message(STATUS "set default LIB_PATH: ${LIB_PATH}") +else () + message(STATUS "env LIB_PATH: ${LIB_PATH}") +endif() +set(INC_PATH $ENV{NPU_HOST_INC}) +# Dynamic libraries in the stub directory can only be used for compilation +if (NOT DEFINED ENV{NPU_HOST_INC}) + set(INC_PATH "/usr/local/Ascend/ascend-toolkit/latest/CANN-6.4/runtime/include") + message(STATUS "set default INC_PATH: ${INC_PATH}") +else () + message(STATUS "env INC_PATH: ${INC_PATH}") +endif() + +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIB_PATH}) + +link_directories( + ${LIB_PATH} + ${LIB_PATH}/stub +) + +add_library(sns_imx219 SHARED + imx219_cmos.c + imx219_sensor_ctl.c +) + +include_directories(sns_imx219 + ${INC_PATH}/acl/media + ../include +) + +target_link_libraries(sns_imx219 + acl_isp_mpi +) diff --git a/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx219/imx219_cfgs.h b/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx219/imx219_cfgs.h new file mode 100644 index 0000000000000000000000000000000000000000..f100c45a68f2838f77b8ff825f2d7c38ac14db51 --- /dev/null +++ b/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx219/imx219_cfgs.h @@ -0,0 +1,204 @@ +/* + * Copyright (c) Hisilicon Technologies Co., Ltd. 2023-2023. All rights reserved. + * Description: IMX219 Register Configure file + * Author: Hisilicon multimedia software group + * Create: 2023-03-06 + */ +#ifndef IMX219_CFGS_H +#define IMX219_CFGS_H +#include "hi_sns_ctrl.h" + +typedef struct cis_cfg { + hi_u16 address; + hi_u8 value; +} cis_cfg_imx219_t; + +/* 3280*2464 20fps raw 10 2Lane ok */ +const cis_cfg_imx219_t imx219_raw10_24M_20fps_mipi2lane[] = { + {0x0100, 0x00}, + {0x30EB, 0x05}, + {0x30EB, 0x0C}, + {0x300A, 0xFF}, + {0x300B, 0xFF}, + {0x30EB, 0x05}, + {0x30EB, 0x09}, + {0x0114, 0x01}, // 2lane 0x01; 4lane 0x04 + {0x0128, 0x00}, // MIPI Global timing setting, 0: auto mode, 1: manual mode + {0x012A, 0x18}, + {0x012B, 0x00}, // INCK frequency + {0x015A, 0x03}, + {0x0160, 0x0A}, + {0x0161, 0x55}, // FRM_LENGTH + {0x0162, 0x0D}, + {0x0163, 0x78}, // LINE_LENGTH + {0x0164, 0x00}, + {0x0165, 0x00}, // X_ADD_STA_A + {0x0166, 0x0C}, + {0x0167, 0xd0}, + {0x0168, 0x00}, + {0x0169, 0x00}, + {0x016A, 0x09}, + {0x016B, 0xa0}, + {0x016C, 0x0C}, + {0x016D, 0xD0}, // output image size (X-direction) + {0x016E, 0x09}, + {0x016F, 0xA0}, // output image size (Y-direction) + {0x0170, 0x01}, + {0x0171, 0x01}, + {0x0174, 0x00}, + {0x0175, 0x00}, + {0x018C, 0x0A}, // CSI_DATA_FORMAT_A + {0x018D, 0x0A}, // CSI_DATA_FORMAT_A + {0x0301, 0x05}, + {0x0303, 0x01}, + {0x0304, 0x03}, + {0x0305, 0x03}, + {0x0306, 0x00}, + {0x0307, 0x39}, + {0x0309, 0x0A}, + {0x030B, 0x01}, + {0x030C, 0x00}, + {0x030D, 0x72}, + {0x455E, 0x00}, + {0x471E, 0x4B}, + {0x4767, 0x0F}, + {0x4750, 0x14}, + {0x4540, 0x00}, + {0x47B4, 0x14}, + {0x4713, 0x30}, + {0x478B, 0x10}, + {0x478F, 0x10}, + {0x4793, 0x10}, + {0x4797, 0x0E}, + {0x479B, 0x0E}, + {0x0100, 0x01}, +}; + +/* 3280*2464 20fps raw8 2Lane ok */ +const cis_cfg_imx219_t imx219_raw8_24M_20fps_mipi2lane[] = { + {0x0100, 0x00}, + {0x30EB, 0x05}, + {0x30EB, 0x0C}, + {0x300A, 0xFF}, + {0x300B, 0xFF}, + {0x30EB, 0x05}, + {0x30EB, 0x09}, + {0x0114, 0x01}, // 2lane 0x01; 4lane 0x04 + {0x0128, 0x00}, // MIPI Global timing setting, 0: auto mode, 1: manual mode + {0x012A, 0x18}, + {0x012B, 0x00}, // INCK frequency + {0x015A, 0x03}, + {0x0160, 0x0A}, + {0x0161, 0x55}, // FRM_LENGTH + {0x0162, 0x0D}, + {0x0163, 0x78}, // LINE_LENGTH + {0x0164, 0x00}, + {0x0165, 0x00}, // X_ADD_STA_A + {0x0166, 0x0C}, + {0x0167, 0xd0}, + {0x0168, 0x00}, + {0x0169, 0x00}, + {0x016A, 0x09}, + {0x016B, 0xa0}, + {0x016C, 0x0C}, + {0x016D, 0xD0}, + {0x016E, 0x09}, + {0x016F, 0xA0}, + {0x0170, 0x01}, + {0x0171, 0x01}, + {0x0174, 0x00}, + {0x0175, 0x00}, + {0x018C, 0x08}, // CSI_DATA_FORMAT_A + {0x018D, 0x08}, // CSI_DATA_FORMAT_A + {0x0301, 0x05}, + {0x0303, 0x01}, + {0x0304, 0x03}, + {0x0305, 0x03}, + {0x0306, 0x00}, + {0x0307, 0x39}, + {0x0309, 0x08}, // OPPXCK_DIV + {0x030B, 0x01}, + {0x030C, 0x00}, + {0x030D, 0x72}, + {0x455E, 0x00}, + {0x471E, 0x4B}, + {0x4767, 0x0F}, + {0x4750, 0x14}, + {0x4540, 0x00}, + {0x47B4, 0x14}, + {0x4713, 0x30}, + {0x478B, 0x10}, + {0x478F, 0x10}, + {0x4793, 0x10}, + {0x4797, 0x0E}, + {0x479B, 0x0E}, + {0x0100, 0x01}, +}; + +static const cis_cfg_imx219_t imx219_raw10_1920x1080_30fps_mipi2lane[] = { + {0x0100, 0x00}, + {0x30EB, 0x05}, + {0x30EB, 0x0C}, + {0x300A, 0xFF}, + {0x300B, 0xFF}, + {0x30EB, 0x05}, + {0x30EB, 0x09}, + {0x0114, 0x01}, // 2lane 0x01; 4lane 0x04 + {0x0128, 0x00}, // MIPI Global timing setting, 0: auto mode, 1: manual mode + {0x012A, 0x18}, + {0x012B, 0x00}, // INCK frequency + {0x015A, 0x02}, // coarse_integration_time + {0x0160, 0x0A}, + {0x0161, 0x55}, // FRM_LENGTH + {0x0162, 0x0D}, + {0x0163, 0x78}, // LINE_LENGTH + {0x0164, 0x00}, + {0x0165, 0x00}, // X_ADD_STA_A + {0x0166, 0x07}, + {0x0167, 0x80}, + {0x0168, 0x00}, + {0x0169, 0x00}, + {0x016A, 0x04}, + {0x016B, 0x38}, + {0x016C, 0x07}, + {0x016D, 0x80}, + {0x016E, 0x04}, + {0x016F, 0x38}, + {0x0170, 0x01}, + {0x0171, 0x01}, + {0x0174, 0x00}, + {0x0175, 0x00}, + {0x018C, 0x0A}, // CSI_DATA_FORMAT_A + {0x018D, 0x0A}, // CSI_DATA_FORMAT_A + {0x0301, 0x05}, + {0x0303, 0x01}, + {0x0304, 0x03}, + {0x0305, 0x03}, + {0x0306, 0x00}, + {0x0307, 0x39}, + {0x0309, 0x0A}, + {0x030B, 0x01}, + {0x030C, 0x00}, + {0x030D, 0x72}, + {0x0600, 0x00}, + {0x0601, 0x00}, + {0x0624, 0x07}, + {0x0625, 0x80}, + {0x0626, 0x04}, + {0x0627, 0x38}, + {0x455E, 0x00}, + {0x471E, 0x4B}, + {0x4767, 0x0F}, + {0x4750, 0x14}, + {0x4540, 0x00}, + {0x47B4, 0x14}, + {0x4713, 0x30}, + {0x478B, 0x10}, + {0x478F, 0x10}, + {0x4793, 0x10}, + {0x4797, 0x0E}, + {0x479B, 0x0E}, + {0x0100, 0x01}, +}; + +#endif // IMX219_CFGS_H \ No newline at end of file diff --git a/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx219/imx219_cmos.c b/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx219/imx219_cmos.c new file mode 100644 index 0000000000000000000000000000000000000000..ab29f812300bc3c187ee9af59fa68f8431c85404 --- /dev/null +++ b/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx219/imx219_cmos.c @@ -0,0 +1,798 @@ +/* + * Copyright (c) Hisilicon Technologies Co., Ltd. 2023-2023. All rights reserved. + * Description: Function of imx219 adapt isp firmware + * Author: Hisilicon multimedia software group + * Create: 2023-03-06 + */ + +#include +#include +#include +#include "hi_mpi_isp.h" +#include "hi_mpi_ae.h" +#include "hi_mpi_awb.h" +#include "imx219_cmos_ex.h" +#include "imx219_cmos.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif + +#define IMX219_ID 219U +#define IMX219_AGAIN_TBL_RANGE 233U + +#define IMX219_SENSOR_SET_CTX(dev, pstCtx) ((g_pastImx219[dev]) = (pstCtx)) +#define IMX219_SENSOR_RESET_CTX(dev) (g_pastImx219[dev] = HI_NULL) + +#define ISP_SNS_SAVE_INFO_CUR_FRAME 0U +#define ISP_SNS_SAVE_INFO_PRE_FRAME 1U + +static hi_u32 g_au32InitExposure[HI_ISP_MAX_PIPE_NUM] = {0}; +static hi_u32 g_au32LinesPer500ms[HI_ISP_MAX_PIPE_NUM] = {0}; + +static hi_u16 g_au16InitWBGain[HI_ISP_MAX_PIPE_NUM][HI_ISP_RGB_CHN_NUM] = {{0}}; +static hi_u16 g_au16SampleRgain[HI_ISP_MAX_PIPE_NUM] = {0}; +static hi_u16 g_au16SampleBgain[HI_ISP_MAX_PIPE_NUM] = {0}; + +typedef struct hiIMX219_STATE_S { + hi_u8 u8Hcg; + hi_u32 u32BRL; + hi_u32 u32RHS1_MAX; + hi_u32 u32RHS2_MAX; +} IMX219_STATE_S; + +IMX219_STATE_S g_astimx219State[HI_ISP_MAX_PIPE_NUM] = {{0}}; +// FPGA IMX219 - I2C 2 +hi_isp_sns_commbus g_aunImx219BusInfo[HI_ISP_MAX_PIPE_NUM] = { + [0] = { .i2c_dev = 0}, + [1 ... HI_ISP_MAX_PIPE_NUM - 1] = { .i2c_dev = -1} +}; + +hi_isp_sns_state *g_pastImx219[HI_ISP_MAX_PIPE_NUM] = {HI_NULL}; +hi_isp_sns_state *imx219_get_ctx(hi_vi_pipe vi_pipe) +{ + return g_pastImx219[vi_pipe]; +} + +const IMX219_VIDEO_MODE_TBL_S g_astImx219ModeTbl[IMX219_MODE_BUTT] = { + {2645, 2645, 20, 1, 3280, 2464, 0, "3280_2464_raw10_20FPS" }, // MODE0 + {2645, 2645, 20, 1, 3280, 2464, 1, "3280_2464_raw8_20FPS" }, // MODE1 + {2645, 1322, 40, 1, 1920, 1080, 2, "IMX219_1920x1080_RAW10_30FPS_MODE" }, // MODE2 +}; + +static hi_s32 cmos_get_ae_default(hi_vi_pipe viPipe, + hi_isp_ae_sensor_default *pstAeSnsDft) +{ + hi_isp_sns_state *pstSnsState = HI_NULL; + SNS_CHECK_PIPE_RETURN(viPipe); + CMOS_CHECK_POINTER(pstAeSnsDft); + IMX219_SENSOR_GET_CTX(viPipe, pstSnsState); + CMOS_CHECK_POINTER(pstSnsState); + memset(&pstAeSnsDft->ae_route_attr, 0, sizeof(hi_isp_ae_route)); + pstAeSnsDft->full_lines_std = pstSnsState->fl_std; + pstAeSnsDft->flicker_freq = 0U; // 0:default flicker_freq + pstAeSnsDft->full_lines_max = 0xffff; // 0xffff:default full_lines_max + pstAeSnsDft->full_lines = pstSnsState->fl_std; + pstAeSnsDft->int_time_accu.accu_type = HI_ISP_AE_ACCURACY_LINEAR; + pstAeSnsDft->int_time_accu.accuracy = 1.0f; // 1:default int_time_accu.accuracy + pstAeSnsDft->int_time_accu.offset = 0; // 0:default int_time_accu.offset + pstAeSnsDft->again_accu.accu_type = HI_ISP_AE_ACCURACY_TABLE; + pstAeSnsDft->again_accu.accuracy = 1.0f; // 1:default again_accu.accuracy + pstAeSnsDft->dgain_accu.accu_type = HI_ISP_AE_ACCURACY_LINEAR; + pstAeSnsDft->dgain_accu.accuracy = 0.00390625f; // 0.00390625:1/256; + pstAeSnsDft->isp_dgain_shift = 8U; // 8: default isp_dgain_shift + pstAeSnsDft->min_isp_dgain_target = 1UL << pstAeSnsDft->isp_dgain_shift; + pstAeSnsDft->max_isp_dgain_target = 2UL << pstAeSnsDft->isp_dgain_shift; + memcpy(&pstAeSnsDft->piris_attr, &ST_PIRIS_ATTR, sizeof(hi_isp_piris_attr)); + pstAeSnsDft->max_iris_fno = HI_ISP_IRIS_F_NO_1_4; + pstAeSnsDft->min_iris_fno = HI_ISP_IRIS_F_NO_5_6; + pstAeSnsDft->ae_route_ex_valid = HI_FALSE; + pstAeSnsDft->ae_route_attr.total_num = 0; // 0:default ae_route_attr.total_num + pstAeSnsDft->ae_route_attr_ex.total_num = 0; // 0:default ae_route_attr_ex.total_num + if (g_au32InitExposure[viPipe] == 0) { + pstAeSnsDft->init_exposure = 1000000U; // 1000000:default init_exposure + } + if (g_au32LinesPer500ms[viPipe] == 0) { + /* pstSnsState->fl_std:0xa55 f32MaxFps max:30 */ + pstAeSnsDft->lines_per500ms = (hi_u32)(pstSnsState->fl_std * + g_astImx219ModeTbl[IMX219_24M_RAW10_MODE].f32MaxFps / 2); /* div 2 */ + } else { + pstAeSnsDft->lines_per500ms = g_au32LinesPer500ms[viPipe]; + } + pstAeSnsDft->hist_thresh[0] = 0xd; /* array index 0, 0xd */ + pstAeSnsDft->hist_thresh[1] = 0x28; /* array index 1, 0x28 */ + pstAeSnsDft->hist_thresh[2] = 0x60; /* array index 2, 0x60 */ + pstAeSnsDft->hist_thresh[3] = 0x80; /* array index 3, 0x80 */ + pstAeSnsDft->ae_compensation = 0x44; /* 0x38 ae_compensation */ + pstAeSnsDft->ae_exp_mode = HI_ISP_AE_EXP_HIGHLIGHT_PRIOR; + /* pstSnsState->fl_std:0xa55 */ + pstAeSnsDft->max_int_time = pstSnsState->fl_std > 4 ? // 4:fl_std-4 + pstSnsState->fl_std - 4 : pstSnsState->fl_std; // 4:fl_std-4 + pstAeSnsDft->min_int_time = 1; // 1:min_int_time + pstAeSnsDft->max_int_time_target = 65535U; // 65535:max_int_time_target + pstAeSnsDft->min_int_time_target = pstAeSnsDft->min_int_time; + pstAeSnsDft->max_again = 10922U; // 10922:max_again + pstAeSnsDft->min_again = 1024U; // 1024:min_again + pstAeSnsDft->max_again_target = pstAeSnsDft->max_again; + pstAeSnsDft->min_again_target = pstAeSnsDft->min_again; + pstAeSnsDft->max_dgain = 4095U; // 4095:max_dgain + pstAeSnsDft->min_dgain = 256U; // 256:min_dgain + pstAeSnsDft->max_dgain_target = pstAeSnsDft->max_dgain; + pstAeSnsDft->min_dgain_target = pstAeSnsDft->min_dgain; + return HI_SUCCESS; +} + +static hi_void cmos_config_vmax(hi_isp_sns_state *pstSnsState, hi_u32 u32VMAX) +{ + /* array index 5 */ + pstSnsState->regs_info[0].i2c_data[5].data = HIGH_8BITS(u32VMAX); + /* array index 6 */ + pstSnsState->regs_info[0].i2c_data[6].data = LOW_8BITS(u32VMAX); + return; +} + + +/* the function of sensor set fps */ +static hi_void cmos_fps_set(hi_vi_pipe viPipe, + hi_float f32Fps, hi_isp_ae_sensor_default *pstAeSnsDft) +{ + hi_u32 u32Lines, u32LinesMax; + hi_float f32MaxFps, f32MinFps; + hi_isp_sns_state *pstSnsState = HI_NULL; + SNS_CHECK_PIPE_VOID(viPipe); + CMOS_CHECK_POINTER_VOID(pstAeSnsDft); + IMX219_SENSOR_GET_CTX(viPipe, pstSnsState); + CMOS_CHECK_POINTER_VOID(pstSnsState); + switch (pstSnsState->img_mode) { + case IMX219_24M_RAW10_MODE: + case IMX219_24M_RAW8_MODE: + case IMX219_1920x1080_RAW10_30FPS_MODE: + u32Lines = g_astImx219ModeTbl[pstSnsState->img_mode].u32VertiLines; + u32LinesMax = g_astImx219ModeTbl[pstSnsState->img_mode].u32MaxVertiLines; + f32MaxFps = g_astImx219ModeTbl[pstSnsState->img_mode].f32MaxFps; + f32MinFps = g_astImx219ModeTbl[pstSnsState->img_mode].f32MinFps; + if ((f32Fps <= f32MaxFps) && (f32Fps >= f32MinFps)) { + /* u32MaxFps max:30 */ + u32Lines = (hi_u32)(u32LinesMax * f32MaxFps / SNS_DIV_0_TO_1_FLOAT(f32Fps)); + } else { + SNS_ERR_TRACE("imx219 Not support fps: %f, should be in [%f,%f]\n", + f32Fps, f32MinFps, f32MaxFps); + return; + } + break; + default: + SNS_ERR_TRACE("imx219 Not support ImgMode: %d, should less than %d\n", + pstSnsState->img_mode, IMX219_MODE_BUTT); + return; + } + cmos_config_vmax(pstSnsState, u32Lines); + pstSnsState->fl_std = u32Lines; + pstAeSnsDft->fps = f32Fps; + pstAeSnsDft->lines_per500ms = (hi_u32)(pstSnsState->fl_std * f32Fps / 2); /* div2 */ + pstAeSnsDft->full_lines_std = pstSnsState->fl_std; + pstAeSnsDft->max_int_time = + /* MaxIntTime: fl_std - 5 */ + pstSnsState->fl_std > 5U ? pstSnsState->fl_std - 5U : pstSnsState->fl_std; + pstSnsState->fl[0] = pstSnsState->fl_std; + pstAeSnsDft->full_lines = pstSnsState->fl[0]; + return; +} + +static hi_void cmos_slow_framerate_set(hi_vi_pipe viPipe, + hi_u32 u32FullLines, hi_isp_ae_sensor_default *pstAeSnsDft) +{ + hi_isp_sns_state *pstSnsState = HI_NULL; + SNS_CHECK_PIPE_VOID(viPipe); + CMOS_CHECK_POINTER_VOID(pstAeSnsDft); + IMX219_SENSOR_GET_CTX(viPipe, pstSnsState); + CMOS_CHECK_POINTER_VOID(pstSnsState); + pstSnsState->fl[0] = u32FullLines; /* array index 0 */ + if (pstSnsState->wdr_mode == HI_WDR_MODE_NONE) { + /* array index 5 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[5].data = + HIGH_8BITS(u32FullLines); + /* array index 6 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[6].data = + LOW_8BITS(u32FullLines); + } + pstAeSnsDft->full_lines = pstSnsState->fl[0]; + pstAeSnsDft->max_int_time = + /* MaxIntTime: Flstd - 4 */ + pstSnsState->fl[0] > 4U ? pstSnsState->fl[0] - 4U : pstSnsState->fl[0]; + return; +} + +/* while isp notify ae to update sensor regs, ae call these funcs. */ +static hi_void cmos_inttime_update(hi_vi_pipe viPipe, hi_u32 u32IntTime) +{ + hi_isp_sns_state *pstSnsState = HI_NULL; + SNS_CHECK_PIPE_VOID(viPipe); + IMX219_SENSOR_GET_CTX(viPipe, pstSnsState); + CMOS_CHECK_POINTER_VOID(pstSnsState); + // SET CORASE_INTEG_TIME + /* array index 3 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[3].data + = HIGH_8BITS(u32IntTime); + /* array index 4 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[4].data + = LOW_8BITS(u32IntTime); + return; +} + +static const hi_u32 ad_gain_table[IMX219_AGAIN_TBL_RANGE] = { + 1024, 1028, 1032, 1036, 1041, 1044, 1049, 1053, 1058, 1061, 1066, 1070, 1075, 1078, 1083, 1087, + 1092, 1097, 1101, 1106, 1111, 1115, 1120, 1125, 1131, 1134, 1140, 1145, 1150, 1154, 1160, 1165, + 1170, 1176, 1181, 1187, 1192, 1198, 1203, 1209, 1214, 1220, 1225, 1231, 1237, 1243, 1248, 1254, + 1260, 1267, 1273, 1279, 1285, 1291, 1298, 1304, 1310, 1318, 1324, 1331, 1338, 1344, 1351, 1358, + 1366, 1372, 1380, 1388, 1394, 1402, 1409, 1417, 1425, 1433, 1440, 1448, 1456, 1465, 1473, 1482, + 1489, 1497, 1506, 1515, 1523, 1532, 1543, 1552, 1561, 1570, 1579, 1590, 1599, 1608, 1617, 1629, + 1638, 1649, 1659, 1670, 1680, 1692, 1701, 1713, 1725, 1737, 1747, 1759, 1771, 1784, 1796, 1808, + 1821, 1834, 1846, 1859, 1872, 1885, 1900, 1913, 1927, 1942, 1956, 1972, 1985, 2001, 2017, 2031, + 2048, 2064, 2081, 2098, 2115, 2132, 2149, 2167, 2184, 2202, 2222, 2240, 2261, 2279, 2300, 2319, + 2340, 2362, 2384, 2406, 2428, 2451, 2473, 2496, 2519, 2546, 2569, 2596, 2620, 2647, 2675, 2703, + 2731, 2759, 2788, 2820, 2850, 2879, 2913, 2946, 2981, 3012, 3046, 3085, 3121, 3157, 3197, 3238, + 3276, 3317, 3360, 3403, 3450, 3494, 3542, 3592, 3642, 3692, 3744, 3800, 3853, 3911, 3970, 4035, + 4095, 4162, 4230, 4298, 4368, 4444, 4522, 4600, 4681, 4768, 4856, 4947, 5038, 5138, 5246, 5349, + 5461, 5576, 5699, 5825, 5961, 6100, 6242, 6394, 6551, 6719, 6899, 7084, 7283, 7487, 7714, 7940, + 8190, 8459, 8736, 9043, 9361, 9712, 10088, 10491, 10922 +}; + +static hi_void cmos_again_calc_table(hi_vi_pipe viPipe, hi_u32 *pu32AgainLin, hi_u32 *pu32AgainDb) +{ + hi_u32 i; + SNS_CHECK_PIPE_VOID(viPipe); + CMOS_CHECK_POINTER_VOID(pu32AgainLin); + CMOS_CHECK_POINTER_VOID(pu32AgainDb); + if (*pu32AgainLin >= ad_gain_table[IMX219_AGAIN_TBL_RANGE - 1]) { + *pu32AgainLin = ad_gain_table[IMX219_AGAIN_TBL_RANGE - 1]; + *pu32AgainDb = IMX219_AGAIN_TBL_RANGE - 1; + goto calc_table_end; + } + for (i = 1; i < IMX219_AGAIN_TBL_RANGE; i++) { + if (*pu32AgainLin < ad_gain_table[i]) { + *pu32AgainLin = ad_gain_table[i - 1]; + *pu32AgainDb = i - 1; + goto calc_table_end; + } + } +calc_table_end: + return; +} + +static hi_void cmos_gains_update(hi_vi_pipe viPipe, hi_u32 u32Again, hi_u32 u32Dgain) +{ + hi_isp_sns_state *pstSnsState = HI_NULL; + SNS_CHECK_PIPE_VOID(viPipe); + IMX219_SENSOR_GET_CTX(viPipe, pstSnsState); + CMOS_CHECK_POINTER_VOID(pstSnsState); + + // Again + /* array index 0 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[0].data = LOW_8BITS(u32Again); + // Dgain + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[1].data = HIGH_8BITS(u32Dgain); + /* array index 2 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[2].data = LOW_8BITS(u32Dgain); + return; +} + +static hi_s32 cmos_init_ae_exp_function(hi_isp_ae_sensor_exp_func *pstExpFuncs) +{ + hi_s32 ret; + CMOS_CHECK_POINTER(pstExpFuncs); + memset(pstExpFuncs, 0, sizeof(hi_isp_ae_sensor_exp_func)); + pstExpFuncs->pfn_cmos_get_ae_default = cmos_get_ae_default; + pstExpFuncs->pfn_cmos_fps_set = cmos_fps_set; + pstExpFuncs->pfn_cmos_slow_framerate_set = cmos_slow_framerate_set; + pstExpFuncs->pfn_cmos_inttime_update = cmos_inttime_update; + pstExpFuncs->pfn_cmos_gains_update = cmos_gains_update; + pstExpFuncs->pfn_cmos_again_calc_table = cmos_again_calc_table; + pstExpFuncs->pfn_cmos_dgain_calc_table = NULL; + return HI_SUCCESS; +} + +/* awb static param for Fuji Lens New IR_Cut */ +#define CALIBRATE_STATIC_TEMP 4950U +#define CALIBRATE_STATIC_WB_R_GAIN 377U +#define CALIBRATE_STATIC_WB_GR_GAIN 0X100 +#define CALIBRATE_STATIC_WB_GB_GAIN 0x100 +#define CALIBRATE_STATIC_WB_B_GAIN 336U + +/* Calibration results for Auto WB Planck */ +#define CALIBRATE_AWB_P1 (167) +#define CALIBRATE_AWB_P2 (-131) +#define CALIBRATE_AWB_Q1 (-220) +#define CALIBRATE_AWB_A1 (322690) +#define CALIBRATE_AWB_B1 (128) +#define CALIBRATE_AWB_C1 (-278581) + +/* Rgain and Bgain of the golden sample */ +#define GOLDEN_RGAIN 0U +#define GOLDEN_BGAIN 0U +static hi_s32 cmos_get_awb_default(hi_vi_pipe viPipe, + hi_isp_awb_sensor_default *pstAwbSnsDft) +{ + hi_s32 ret; + SNS_CHECK_PIPE_RETURN(viPipe); + CMOS_CHECK_POINTER(pstAwbSnsDft); + memset(pstAwbSnsDft, 0, sizeof(hi_isp_awb_sensor_default)); + pstAwbSnsDft->wb_ref_temp = 5120; /* 5120 */ + pstAwbSnsDft->gain_offset[0] = CALIBRATE_STATIC_WB_R_GAIN; /* array index 0 */ + pstAwbSnsDft->gain_offset[1] = CALIBRATE_STATIC_WB_GR_GAIN; /* array index 1 */ + pstAwbSnsDft->gain_offset[2] = CALIBRATE_STATIC_WB_GB_GAIN; /* array index 2 */ + pstAwbSnsDft->gain_offset[3] = CALIBRATE_STATIC_WB_B_GAIN; /* array index 3 */ + pstAwbSnsDft->wb_para[0] = CALIBRATE_AWB_P1; /* array index 0 */ + pstAwbSnsDft->wb_para[1] = CALIBRATE_AWB_P2; /* array index 1 */ + pstAwbSnsDft->wb_para[2] = CALIBRATE_AWB_Q1; /* array index 2 */ + pstAwbSnsDft->wb_para[3] = CALIBRATE_AWB_A1; /* array index 3 */ + pstAwbSnsDft->wb_para[4] = CALIBRATE_AWB_B1; /* array index 4 */ + pstAwbSnsDft->wb_para[5] = CALIBRATE_AWB_C1; /* array index 5 */ + pstAwbSnsDft->golden_rgain = GOLDEN_RGAIN; // GOLDEN_RGAIN; + pstAwbSnsDft->golden_bgain = GOLDEN_BGAIN; // GOLDEN_BGAIN; + memcpy(&pstAwbSnsDft->ccm, &g_stAwbCcm_NormalLens, sizeof(hi_isp_awb_ccm)); + memcpy(&pstAwbSnsDft->agc_tbl, &ST_AWB_AGC_TABLE, sizeof(hi_isp_awb_agc_table)); + pstAwbSnsDft->init_rgain = g_au16InitWBGain[viPipe][0]; + pstAwbSnsDft->init_ggain = g_au16InitWBGain[viPipe][1]; + pstAwbSnsDft->init_bgain = g_au16InitWBGain[viPipe][2]; /* array index 2 */ + pstAwbSnsDft->sample_rgain = g_au16SampleRgain[viPipe]; + pstAwbSnsDft->sample_bgain = g_au16SampleBgain[viPipe]; + + return HI_SUCCESS; +} + +static hi_s32 cmos_init_awb_exp_function(hi_isp_awb_sensor_exp_func *pstExpFuncs) +{ + hi_s32 ret; + CMOS_CHECK_POINTER(pstExpFuncs); + memset(pstExpFuncs, 0, sizeof(hi_isp_awb_sensor_exp_func)); + pstExpFuncs->pfn_cmos_get_awb_default = cmos_get_awb_default; + return HI_SUCCESS; +} + +static const hi_isp_cmos_dng_color_param g_stDngColorParam = { + {378, 256, 430}, + {439, 256, 439} +}; + +#define SENSOR_MAX_WIDTH 3264U +#define SNESOR_MAX_HIEGHT 2448U + +static hi_void cmos_get_isp_dng_default(hi_isp_sns_state *pstSnsState, hi_isp_cmos_default *pstDef) +{ + hi_s32 ret; + sns_unused(pstSnsState); + memcpy(&pstDef->dng_color_param, &g_stDngColorParam, sizeof(hi_isp_cmos_dng_color_param)); + pstDef->sensor_mode.dng_raw_format.bits_per_sample = 10UL; /* 10bit */ + pstDef->sensor_mode.dng_raw_format.white_level = 1023U; /* max 1023 */ + pstDef->sensor_mode.dng_raw_format.default_scale.default_scale_h.denominator = 1; + pstDef->sensor_mode.dng_raw_format.default_scale.default_scale_h.numerator = 1; + pstDef->sensor_mode.dng_raw_format.default_scale.default_scale_v.denominator = 1; + pstDef->sensor_mode.dng_raw_format.default_scale.default_scale_v.numerator = 1; + /* pattern 2 */ + pstDef->sensor_mode.dng_raw_format.cfa_repeat_pattern_dim.repeat_pattern_dim_rows = 2U; + /* pattern 2 */ + pstDef->sensor_mode.dng_raw_format.cfa_repeat_pattern_dim.repeat_pattern_dim_cols = 2U; + pstDef->sensor_mode.dng_raw_format.blc_repeat_dim.blc_repeat_rows = 2U; /* pattern 2 */ + pstDef->sensor_mode.dng_raw_format.blc_repeat_dim.blc_repeat_cols = 2U; /* pattern 2 */ + pstDef->sensor_mode.dng_raw_format.cfa_layout = CFALAYOUT_TYPE_RECTANGULAR; + pstDef->sensor_mode.dng_raw_format.cfa_plane_color[0] = 0U; + pstDef->sensor_mode.dng_raw_format.cfa_plane_color[1] = 1U; + pstDef->sensor_mode.dng_raw_format.cfa_plane_color[2] = 2U; /* index 2, CfaPlaneColor 2 */ + pstDef->sensor_mode.dng_raw_format.cfa_pattern[0] = 0U; + pstDef->sensor_mode.dng_raw_format.cfa_pattern[1] = 1U; + pstDef->sensor_mode.dng_raw_format.cfa_pattern[2] = 1U; /* index 2, CfaPattern 1 */ + pstDef->sensor_mode.dng_raw_format.cfa_pattern[3] = 2U; /* index 3, CfaPattern 2 */ + pstDef->sensor_mode.valid_dng_raw_format = HI_TRUE; + return; +} + +static hi_s32 cmos_get_isp_linear_default(hi_isp_cmos_default *pstDef) +{ + hi_s32 ret; + pstDef->key.bit1_demosaic = 1U; + pstDef->demosaic = &g_stIspDemosaic; + pstDef->key.bit1_drc = 1U; + pstDef->drc = &g_stIspDRC; + pstDef->key.bit1_gamma = 1U; + pstDef->gamma = &g_stIspGamma; + pstDef->key.bit1_bayer_nr = 1U; + pstDef->bayer_nr = &g_stIspBayerNr; + pstDef->key.bit1_sharpen = 1U; + pstDef->sharpen = &g_stIspYuvSharpen; + pstDef->key.bit1_edge_mark = 0U; + pstDef->edge_mark = &g_stIspEdgeMark; + pstDef->key.bit1_ge = 1U; + pstDef->ge = &g_stIspGe; + pstDef->key.bit1_anti_false_color = 1U; + pstDef->anti_false_color = &g_stIspAntiFalseColor; + pstDef->key.bit1_ldci = 1U; + pstDef->ldci = &g_stIspLdci; + memcpy(&pstDef->noise_calibration, &ST_ISP_NOISE_CALIB_RATIO, sizeof(hi_isp_cmos_noise_calibration)); + return HI_SUCCESS; +} + +static hi_s32 cmos_get_isp_default(hi_vi_pipe viPipe, hi_isp_cmos_default *pstDef) +{ + hi_s32 ret; + hi_isp_sns_state *pstSnsState = HI_NULL; + SNS_CHECK_PIPE_RETURN(viPipe); + CMOS_CHECK_POINTER(pstDef); + IMX219_SENSOR_GET_CTX(viPipe, pstSnsState); + CMOS_CHECK_POINTER(pstSnsState); + memset(pstDef, 0, sizeof(hi_isp_cmos_default)); + pstDef->key.bit1_ca = 1U; + pstDef->ca = &g_stIspCA; + pstDef->key.bit1_clut = 1U; + pstDef->clut = &g_stIspCLUT; + pstDef->key.bit1_wdr = 1U; + pstDef->wdr = &g_stIspWDR; + pstDef->key.bit1_dpc = 1U; + pstDef->dpc = &g_stCmosDpc; + pstDef->key.bit1_lsc = 1U; + pstDef->lsc = &g_stCmosLsc; + switch (pstSnsState->wdr_mode) { + case HI_WDR_MODE_NONE: + ret = cmos_get_isp_linear_default(pstDef); + break; + default: + break; + } + pstDef->sensor_max_resolution.max_width = SENSOR_MAX_WIDTH; + pstDef->sensor_max_resolution.max_height = SNESOR_MAX_HIEGHT; + pstDef->sensor_mode.sensor_id = IMX219_ID; + pstDef->sensor_mode.sensor_mode = pstSnsState->img_mode; + cmos_get_isp_dng_default(pstSnsState, pstDef); + return HI_SUCCESS; +} + + +static hi_s32 cmos_get_isp_black_level(hi_vi_pipe viPipe, + hi_isp_cmos_black_level *pstBlackLevel) +{ + hi_s32 i; + SNS_CHECK_PIPE_RETURN(viPipe); + CMOS_CHECK_POINTER(pstBlackLevel); + /* Don't need to update black level when iso change */ + pstBlackLevel->update = HI_FALSE; + if (pstBlackLevel->update == HI_TRUE) { + } else { + for (i = 0; i < HI_ISP_BAYER_CHN_NUM; i++) { + pstBlackLevel->black_level[i] = 255U; /* 255:black_level */ + } + } + return HI_SUCCESS; +} + +static hi_void cmos_set_pixel_detect(hi_vi_pipe viPipe, hi_bool bEnable) +{ + hi_isp_sns_state *pstSnsState = HI_NULL; + SNS_CHECK_PIPE_VOID(viPipe); + IMX219_SENSOR_GET_CTX(viPipe, pstSnsState); + CMOS_CHECK_POINTER_VOID(pstSnsState); + + if (bEnable) { + /* Detect set 5fps */ + imx219_write_register(viPipe, IMX219_ANA_GAIN_GLOBAL_L, 0x0); + imx219_write_register(viPipe, IMX219_ANA_GAIN_GLOBAL_H, 0x0); + imx219_write_register(viPipe, IMX219_DIG_GAIN_GR_L, 0x0); + imx219_write_register(viPipe, IMX219_DIG_GAIN_GR_H, 0xff); + } else { /* setup for ISP 'normal mode' */ + pstSnsState->sync_init = HI_FALSE; + } + return; +} + +static hi_void cmos_comm_sns_reg_info_init(hi_vi_pipe viPipe, hi_isp_sns_state *pstSnsState) +{ + hi_u32 i; + SNS_CHECK_PIPE_VOID(viPipe); + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].sns_type = HI_ISP_SNS_I2C_TYPE; + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].com_bus.i2c_dev + = g_aunImx219BusInfo[viPipe].i2c_dev; + // DelayMax 3 + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].cfg2_valid_delay_max = 3U; + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].reg_num = 7U; // RegNum 7 + for (i = 0; i < pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].reg_num; i++) { + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[i].update = HI_TRUE; + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[i].dev_addr + = IMX219_I2C_ADDR; + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[i].addr_byte_num + = IMX219_ADDR_BYTE; + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[i].data_byte_num + = IMX219_DATA_BYTE; + } + + // again + /* index 0, reg_addr 0x157 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[0].reg_addr = 0x157; + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[0].delay_frm_num = 1U; + // dgain + /* index 1, reg_addr 0x158 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[1].reg_addr = 0x158; + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[1].delay_frm_num = 1U; + /* index 2, reg_addr 0x159 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[2].reg_addr = 0x159; + /* index 2 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[2].delay_frm_num = 1U; + + // time + /* index 3, reg_addr 0x15A */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[3].reg_addr = 0x15A; + /* index 3 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[3].delay_frm_num = 0U; + /* index 4, reg_addr 0x15B */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[4].reg_addr = 0x15B; + /* index 4 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[4].delay_frm_num = 0U; + + // frm length + /* index 5, reg_addr 0x160 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[5].reg_addr = 0x160; + /* index 5 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[5].delay_frm_num = 0U; + /* index 6, reg_addr 0x161 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[6].reg_addr = 0x161; + /* index 6 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[6].delay_frm_num = 0U; + + pstSnsState->sync_init = HI_TRUE; +} + +static hi_s32 cmos_get_sns_regs_info(hi_vi_pipe viPipe, hi_isp_sns_regs_info *pstSnsRegsInfo) +{ + hi_s32 ret; + hi_u32 i; + hi_isp_sns_state *pstSnsState = HI_NULL; + + SNS_CHECK_PIPE_RETURN(viPipe); + CMOS_CHECK_POINTER(pstSnsRegsInfo); + IMX219_SENSOR_GET_CTX(viPipe, pstSnsState); + CMOS_CHECK_POINTER(pstSnsState); + if ((pstSnsState->sync_init == HI_FALSE) || (pstSnsRegsInfo->config == HI_FALSE)) { + cmos_comm_sns_reg_info_init(viPipe, pstSnsState); + } else { + for (i = 0; i < pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].reg_num; i++) { + if (pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[i].data == + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_PRE_FRAME].i2c_data[i].data) { + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[i].update = HI_FALSE; + } else { + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[i].update = HI_TRUE; + } + } + } + memcpy(pstSnsRegsInfo, &pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME], + sizeof(hi_isp_sns_regs_info)); + memcpy(&pstSnsState->regs_info[ISP_SNS_SAVE_INFO_PRE_FRAME], + &pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME], sizeof(hi_isp_sns_regs_info)); + pstSnsState->fl[1] = pstSnsState->fl[0]; + return HI_SUCCESS; +} + +static hi_s32 cmos_set_image_mode(hi_vi_pipe viPipe, + hi_isp_cmos_sensor_image_mode *pstSensorImageMode) +{ + hi_u8 u8SensorImageMode; + hi_isp_sns_state *pstSnsState = HI_NULL; + SNS_CHECK_PIPE_RETURN(viPipe); + CMOS_CHECK_POINTER(pstSensorImageMode); + IMX219_SENSOR_GET_CTX(viPipe, pstSnsState); + CMOS_CHECK_POINTER(pstSnsState); + + u8SensorImageMode = pstSnsState->img_mode; + pstSnsState->sync_init = HI_FALSE; + if (pstSensorImageMode->sns_mode < IMX219_MODE_BUTT) { + // The App directly specifies the image mode + u8SensorImageMode = pstSensorImageMode->sns_mode; + SNS_INFO_TRACE("IMX219 ISP Firmware specifies the image mode: %d\n", + u8SensorImageMode); + } else { + return HI_FAILURE; + } + if ((pstSnsState->init == HI_TRUE) && (u8SensorImageMode == pstSnsState->img_mode)) { + return HI_ISP_DO_NOT_NEED_SWITCH_IMAGEMODE; /* Don't need to switch SensorImageMode */ + } + pstSnsState->img_mode = u8SensorImageMode; + return HI_SUCCESS; +} + +static hi_void sensor_global_init(hi_vi_pipe viPipe) +{ + hi_s32 ret; + hi_isp_sns_state *pstSnsState = HI_NULL; + SNS_CHECK_PIPE_VOID(viPipe); + IMX219_SENSOR_GET_CTX(viPipe, pstSnsState); + CMOS_CHECK_POINTER_VOID(pstSnsState); + pstSnsState->wdr_mode = HI_WDR_MODE_NONE; + pstSnsState->init = HI_FALSE; + pstSnsState->sync_init = HI_FALSE; + pstSnsState->fl_std = 0xa55; /* 0xa55 fl_std */ + pstSnsState->img_mode = IMX219_24M_RAW10_MODE; + pstSnsState->fl[0] = pstSnsState->fl_std; + pstSnsState->fl[1] = pstSnsState->fl_std; + memset(&pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME], + 0, sizeof(hi_isp_sns_regs_info)); + memset(&pstSnsState->regs_info[ISP_SNS_SAVE_INFO_PRE_FRAME], + 0, sizeof(hi_isp_sns_regs_info)); +} + +static hi_s32 cmos_set_wdr_mode(hi_vi_pipe viPipe, hi_u8 u8Mode) +{ + SNS_CHECK_PIPE_RETURN(viPipe); + sns_unused(u8Mode); + return HI_SUCCESS; +} + +static hi_s32 cmos_init_sensor_exp_function(hi_isp_sensor_exp_func *pstSensorExpFunc) +{ + hi_s32 ret; + CMOS_CHECK_POINTER(pstSensorExpFunc); + memset(pstSensorExpFunc, 0, sizeof(hi_isp_sensor_exp_func)); + pstSensorExpFunc->pfn_cmos_sensor_init = imx219_init; + pstSensorExpFunc->pfn_cmos_sensor_exit = imx219_exit; + pstSensorExpFunc->pfn_cmos_sensor_global_init = sensor_global_init; + pstSensorExpFunc->pfn_cmos_set_image_mode = cmos_set_image_mode; + pstSensorExpFunc->pfn_cmos_set_wdr_mode = cmos_set_wdr_mode; + pstSensorExpFunc->pfn_cmos_get_isp_default = cmos_get_isp_default; + pstSensorExpFunc->pfn_cmos_get_isp_black_level = cmos_get_isp_black_level; + pstSensorExpFunc->pfn_cmos_set_pixel_detect = cmos_set_pixel_detect; + pstSensorExpFunc->pfn_cmos_get_sns_reg_info = cmos_get_sns_regs_info; + return HI_SUCCESS; +} + +static hi_s32 imx219_set_bus_info(hi_vi_pipe viPipe, hi_isp_sns_commbus unSNSBusInfo) +{ + SNS_CHECK_PIPE_RETURN(viPipe); + g_aunImx219BusInfo[viPipe].i2c_dev = unSNSBusInfo.i2c_dev; + SNS_INFO_TRACE("Config IMX219 sensor on VI PIPE %d: I2C bus %d\n", + viPipe, g_aunImx219BusInfo[viPipe].i2c_dev); + return HI_SUCCESS; +} + +static hi_s32 sensor_ctx_init(hi_vi_pipe viPipe) +{ + hi_s32 ret; + hi_isp_sns_state *pastSnsStateCtx = HI_NULL; + SNS_CHECK_PIPE_RETURN(viPipe); + IMX219_SENSOR_GET_CTX(viPipe, pastSnsStateCtx); + if (pastSnsStateCtx == HI_NULL) { + pastSnsStateCtx = (hi_isp_sns_state *)malloc(sizeof(hi_isp_sns_state)); + if (pastSnsStateCtx == HI_NULL) { + SNS_ERR_TRACE("Isp[%d] SnsCtx malloc memory failed!\n", viPipe); + return HI_ERR_ISP_NO_MEM; + } + } + memset(pastSnsStateCtx, 0, sizeof(hi_isp_sns_state)); + IMX219_SENSOR_SET_CTX(viPipe, pastSnsStateCtx); + return HI_SUCCESS; +} + +static hi_void sensor_ctx_exit(hi_vi_pipe viPipe) +{ + hi_isp_sns_state *pastSnsStateCtx = HI_NULL; + SNS_CHECK_PIPE_VOID(viPipe); + IMX219_SENSOR_GET_CTX(viPipe, pastSnsStateCtx); + SENSOR_FREE(pastSnsStateCtx); + IMX219_SENSOR_RESET_CTX(viPipe); +} + +static hi_s32 sensor_register_callback(hi_vi_pipe viPipe, hi_isp_3a_alg_lib *pstAeLib, + hi_isp_3a_alg_lib *pstAwbLib, hi_isp_3a_alg_lib *pstAfLib) +{ + hi_s32 s32Ret; + hi_isp_sensor_register stIspRegister; + hi_isp_ae_sensor_register stAeRegister; + hi_isp_awb_sensor_register stAwbRegister; + hi_isp_sns_attr_info stSnsAttrInfo; + SNS_CHECK_PIPE_RETURN(viPipe); + CMOS_CHECK_POINTER(pstAeLib); + CMOS_CHECK_POINTER(pstAwbLib); + s32Ret = sensor_ctx_init(viPipe); + if (s32Ret != HI_SUCCESS) { + return HI_FAILURE; + } + + stSnsAttrInfo.sensor_id = IMX219_ID; + s32Ret = cmos_init_sensor_exp_function(&stIspRegister.sns_exp); + if (s32Ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx219 cmos_init_sensor_exp_function err\n"); + goto fail0; + } + + s32Ret = hi_mpi_isp_sensor_reg_callback(viPipe, &stSnsAttrInfo, &stIspRegister); + if (s32Ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx219 sensor register callback function failed with 0x%x!\n", (hi_u32)s32Ret); + goto fail0; + } + + s32Ret = cmos_init_ae_exp_function(&stAeRegister.sns_exp); + if (s32Ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx219 cmos_init_ae_exp_function err\n"); + goto fail1; + } + + s32Ret = hi_mpi_ae_sensor_reg_callback(viPipe, pstAeLib, &stSnsAttrInfo, &stAeRegister); + if (s32Ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx219 sensor register callback function to ae lib failed with 0x%x!\n", (hi_u32)s32Ret); + goto fail1; + } + + s32Ret = cmos_init_awb_exp_function(&stAwbRegister.sns_exp); + if (s32Ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx219 cmos_init_awb_exp_function err\n"); + goto fail2; + } + + s32Ret = hi_mpi_awb_sensor_reg_callback(viPipe, pstAwbLib, &stSnsAttrInfo, &stAwbRegister); + if (s32Ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx219 sensor register callback function to awb lib failed with 0x%x!\n", (hi_u32)s32Ret); + goto fail2; + } + return HI_SUCCESS; + +fail2: + (hi_void)hi_mpi_ae_sensor_unreg_callback(viPipe, pstAeLib, IMX219_ID); +fail1: + (hi_void)hi_mpi_isp_sensor_unreg_callback(viPipe, IMX219_ID); +fail0: + sensor_ctx_exit(viPipe); + return HI_FAILURE; +} + +static hi_s32 sensor_unregister_callback(hi_vi_pipe viPipe, hi_isp_3a_alg_lib *pstAeLib, + hi_isp_3a_alg_lib *pstAwbLib, hi_isp_3a_alg_lib *pstAfLib) +{ + hi_s32 s32Ret = HI_SUCCESS; + hi_s32 result = HI_SUCCESS; + SNS_CHECK_PIPE_RETURN(viPipe); + CMOS_CHECK_POINTER(pstAeLib); + CMOS_CHECK_POINTER(pstAwbLib); + s32Ret = hi_mpi_isp_sensor_unreg_callback(viPipe, IMX219_ID); + if (s32Ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx219 sensor unregister callback function failed with 0x%x!\n", (hi_u32)s32Ret); + result = HI_FAILURE; + } + s32Ret = hi_mpi_ae_sensor_unreg_callback(viPipe, pstAeLib, IMX219_ID); + if (s32Ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx219 sensor unregister callback function to ae lib failed with 0x%x!\n", (hi_u32)s32Ret); + result = HI_FAILURE; + } + s32Ret = hi_mpi_awb_sensor_unreg_callback(viPipe, pstAwbLib, IMX219_ID); + if (s32Ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx219 sensor unregister callback function to awb lib failed with 0x%x!\n", (hi_u32)s32Ret); + result = HI_FAILURE; + } + sensor_ctx_exit(viPipe); + return result; +} + +static hi_s32 sensor_set_init(hi_vi_pipe viPipe, hi_isp_init_attr *pstInitAttr) +{ + SNS_CHECK_PIPE_RETURN(viPipe); + CMOS_CHECK_POINTER(pstInitAttr); + g_au32InitExposure[viPipe] = pstInitAttr->exposure; + g_au32LinesPer500ms[viPipe] = pstInitAttr->lines_per500ms; + g_au16InitWBGain[viPipe][0] = pstInitAttr->wb_r_gain; + g_au16InitWBGain[viPipe][1] = pstInitAttr->wb_g_gain; + g_au16InitWBGain[viPipe][2] = pstInitAttr->wb_b_gain; /* index 2 */ + g_au16SampleRgain[viPipe] = pstInitAttr->sample_r_gain; + g_au16SampleBgain[viPipe] = pstInitAttr->sample_b_gain; + return HI_SUCCESS; +} + +hi_isp_sns_obj g_sns_imx219_obj = { + .pfn_register_callback = sensor_register_callback, + .pfn_un_register_callback = sensor_unregister_callback, + .pfn_standby = imx219_standby, + .pfn_restart = imx219_restart, + .pfn_write_reg = imx219_write_register, + .pfn_read_reg = imx219_read_register, + .pfn_set_bus_info = imx219_set_bus_info, + .pfn_set_init = sensor_set_init +}; +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif /* End of #ifdef __cplusplus */ diff --git a/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx219/imx219_cmos.h b/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx219/imx219_cmos.h new file mode 100644 index 0000000000000000000000000000000000000000..0bbfb5861ba137bd435ef56f34bb992759a47ee4 --- /dev/null +++ b/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx219/imx219_cmos.h @@ -0,0 +1,84 @@ +/* + * Copyright (c) Hisilicon Technologies Co., Ltd. 2023-2023. All rights reserved. + * Description: Header file of imx219_coms + * Author: Hisilicon multimedia software group + * Create: 2023-03-06 + */ + +#ifndef IMX219_CMOS_H +#define IMX219_CMOS_H + +#include "hi_common_isp.h" +#include "hi_sns_ctrl.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif + +#define IMX219_I2C_ADDR 0x20 +#define IMX219_ADDR_BYTE 2U +#define IMX219_DATA_BYTE 1U +#define IMX219_SENSOR_GET_CTX(dev, pstCtx) ((pstCtx) = imx219_get_ctx(dev)) + +#define IMX219_FULL_LINES_MAX 0xFFFF + +#ifndef MIN +#define MIN(a, b) (((a) > (b)) ? (b) : (a)) +#endif + +#define FULL_LINES_MAX (0xFFFF) +// registers to control exposure +#define IMX219_COARSE_INTEG_TIME_L (0x0203) +#define IMX219_COARSE_INTEG_TIME_H (0x0202) +#define IMX219_ANA_GAIN_GLOBAL_L (0x0205) +#define IMX219_ANA_GAIN_GLOBAL_H (0x0204) +#define IMX219_DPGA_USE_GLOBAL_GAIN (0x3FF9) +#define IMX219_DIG_GAIN_GR_L (0x020F) +#define IMX219_DIG_GAIN_GR_H (0x020E) +#define IMX219_LINE_LENGTH_PCK_L (0x341) +#define IMX219_LINE_LENGTH_PCK_H (0x340) +#define IMX219_FRM_LENGTH_CTL (0x350) +#define IMX219_PRSH_LENGTH_LINE_L (0x3F3B) +#define IMX219_PRSH_LENGTH_LINE_H (0x3F3A) + +typedef enum { + IMX219_24M_RAW10_MODE = 0, + IMX219_24M_RAW8_MODE, + IMX219_1920x1080_RAW10_30FPS_MODE, + IMX219_MODE_BUTT +} IMX219_RES_MODE_E; + +typedef struct hiIMX219_VIDEO_MODE_TBL_S { + hi_u32 u32VertiLines; + hi_u32 u32MaxVertiLines; + hi_float f32MaxFps; + hi_float f32MinFps; + hi_u32 u32Width; + hi_u32 u32Height; + hi_u8 u8SnsMode; + const char *pszModeName; +} IMX219_VIDEO_MODE_TBL_S; + +hi_isp_sns_state *imx219_get_ctx(hi_vi_pipe vi_pipe); + +extern hi_isp_sns_state *g_pastImx219[HI_ISP_MAX_PIPE_NUM]; +extern hi_isp_sns_commbus g_aunImx219BusInfo[HI_ISP_MAX_PIPE_NUM]; +extern const IMX219_VIDEO_MODE_TBL_S g_astImx219ModeTbl[IMX219_MODE_BUTT]; +extern hi_isp_slave_sns_sync gstImx219Sync[HI_ISP_MAX_PIPE_NUM]; +extern hi_u8 g_u8Sensor219ImageMode; +extern hi_u8 g_u8Imx219LensMode; + +void imx219_init(hi_vi_pipe viPipe); +void imx219_exit(hi_vi_pipe viPipe); +void imx219_standby(hi_vi_pipe viPipe); +void imx219_restart(hi_vi_pipe viPipe); +int imx219_write_register(hi_vi_pipe viPipe, hi_u32 addr, hi_u32 data); +int imx219_read_register(hi_vi_pipe viPipe, hi_u32 addr); +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif /* End of #ifdef __cplusplus */ +#endif /* IMX219_CMOS_H */ diff --git a/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx219/imx219_cmos_ex.h b/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx219/imx219_cmos_ex.h new file mode 100644 index 0000000000000000000000000000000000000000..073fc3f40131e3fd9515e55ab42a6e4d738fa920 --- /dev/null +++ b/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx219/imx219_cmos_ex.h @@ -0,0 +1,1782 @@ +/* + * Copyright (c) Hisilicon Technologies Co., Ltd. 2023-2023. All rights reserved. + * Description: imx219_cmos_ex.h + * Author: Hisilicon multimedia software group + * Create: 2023-03-06 + */ +#ifndef IMX219_CMOS_EX_H +#define IMX219_CMOS_EX_H + +#include "hi_common_awb.h" +#include "hi_common_isp.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif + +/* Piris attr */ +static const hi_isp_piris_attr ST_PIRIS_ATTR = { + 0, // bStepFNOTableChange + 1, // bZeroIsMax + 94, // u16TotalStep + 62, // u16StepCount + /* Step-F number mapping table. Must be from small to large. F1.0 is 1024 and F32.0 is 1 */ + {30, 35, 40, 45, 50, 56, 61, 67, 73, 79, 85, 92, 98, 105, 112, 120, 127, 135, 143, 150, 158, 166, 174, 183, 191, 200, 208, 217, 225, 234, 243, 252, 261, 270, 279, 289, 298, 307, 316, 325, 335, 344, 353, 362, 372, 381, 390, 399, 408, 417, 426, 435, 444, 453, 462, 470, 478, 486, 493, 500, 506, 512}, + HI_ISP_IRIS_F_NO_1_4, // enMaxIrisFNOTarget + HI_ISP_IRIS_F_NO_5_6, // enMinIrisFNOTarget + 0, // bFNOExValid + 512, // u32MaxIrisFNOTarget + 30 // u32MinIrisFNOTarget +}; + +static hi_isp_awb_ccm g_stAwbCcm_NormalLens = { + 3, /* The number of CCM matrixes */ + { + { + 6437, /* D65 the current color temperature */ + { /* CCM matrixes for different color temperature */ + 0x029A, 0x81B7, 0x001D, + 0x8045, 0x0176, 0x8031, + 0x8014, 0x816E, 0x0282, + }, + }, + { + 3918, /* TL84 */ + { + 0x01F9, 0x80D2, 0x8027, + 0x8127, 0x01E5, 0x0042, + 0x802C, 0x817A, 0x02A6, + }, + }, + { + 2827, /* A */ + { + 0x0209, 0x80D4, 0x8035, + 0x0051, 0x0175, 0x80C6, + 0x8094, 0x8060, 0x01F4, + }, + }, + }, +}; + +static const hi_isp_awb_agc_table ST_AWB_AGC_TABLE = { + /* bvalid */ + 1, + + /* saturation */ + /* {0x80, 0x80, 0x78, 0x74, 0x68, 0x60, 0x58, 0x50, 0x48, 0x40, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38} */ + {128, 118, 108, 100, 94, 90, 85, 80, 72, 64, 56, 56, 56, 56, 56, 56} +}; + +static const hi_isp_cmos_ca g_stIspCA = { + /* CA */ + 1, + /* Y */ + { + 36, 81, 111, 136, 158, 182, 207, 228, 259, 290, 317, 345, 369, 396, 420, 444, 468, 492, 515, + 534, 556, 574, 597, 614, 632, 648, 666, 681, 697, 709, 723, 734, 748, 758, 771, 780, 788, 800, + 808, 815, 822, 829, 837, 841, 848, 854, 858, 864, 868, 871, 878, 881, 885, 890, 893, 897, 900, + 903, 906, 909, 912, 915, 918, 921, 924, 926, 929, 931, 934, 936, 938, 941, 943, 945, 947, 949, + 951, 952, 954, 956, 958, 961, 962, 964, 966, 968, 969, 970, 971, 973, 974, 976, 977, 979, 980, + 981, 983, 984, 985, 986, 988, 989, 990, 991, 992, 993, 995, 996, 997, 998, 999, 1000, 1001, 1004, + 1005, 1006, 1007, 1009, 1010, 1011, 1012, 1014, 1016, 1017, 1019, 1020, 1022, 1024 + }, + /* ISO */ + {1300, 1300, 1250, 1200, 1150, 1100, 1050, 1000, 950, 900, 900, 800, 800, 800, 800, 800}, + +}; + +static const hi_isp_cmos_clut g_stIspCLUT = { + 1, + 128, + 128, + 128, + { + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 67174464, 0, 67174464, 67174464, 67174464, 67174464, 67174464, + 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, + 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 0, + 67174464, 0, 67174464, 67174464, 67174464, 67174464, 0, 67174464, 0, 67174464, 67174464, + 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, + 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 0, 67174464, + 0, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 0, 67174464, + 0, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, + 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 0, 67174464, 0, + 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, + 67174464, 0, 67174464, 0, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, + 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 0, 67174464, 0, 67174464, + 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, + 67174464, 67174464, 67174464, 67174464, 0, 67174464, 0, 67174464, 67174464, 67174464, 67174464, + 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 0, 67174464, 0, 67174464, 67174464, + 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, + 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 0, 67174464, 0, 67174464, + 67174464, 67174464, 67174464, 67174464, 67174464, 0, 67174464, 0, 67174464, 67174464, 67174464, + 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, + 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 0, + 67174464, 0, 67174464, 67174464, 0, 67174464, 0, 67174464, 67174464, 67174464, 0, + 67174464, 67174464, 67174464, 0, 67174464, 67174464, 67174464, 0, 67174464, 67174464, 67174464, + 0, 67174464, 67174464, 67174464, 0, 67174464, 67174464, 67174464, 0, 67174464, 67174464, + 67174464, 0, 0, 0, 0, 0, 67174464, 67174464, 0, 0, 67174464, + 67174464, 0, 0, 67174464, 67174464, 0, 0, 67174464, 67174464, 0, 0, + 67174464, 67174464, 0, 0, 67174464, 67174464, 0, 0, 67174464, 67174464, 0, + 0, 67174464, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 67174464, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, + 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 67174464, 0, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 67174464, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 67174464, 0, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 0, 0, 0, 67174464, 0, + 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 67174464, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, + 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 0, 0, 0, + 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 67174464, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, + 0, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 0, + 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 67174464, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, + 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 67174464, 0, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, + 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 67174464, 0, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, + 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, + 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, + 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 67174464, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 67174464, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, + 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 67174464, 0, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 67174464, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, + 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 0, 0, 0, 67174464, + 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 67174464, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 0, 0, + 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 67174464, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 67174464, 0, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, + 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 67174464, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, + 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 67174464, 0, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 67174464, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 67174464, 0, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, + 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 67174464, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 67174464, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + }, + } +}; + +static const hi_isp_cmos_wdr g_stIspWDR = { + /* bFusionMode */ + 0, + + /* bMotionComp */ + 1, + + /* u16ShortThr */ + 4032, + + /* u16LongThr */ + 3008, + + /* bForceLong */ + 1, + + /* u16ForceLongLowThr */ + 500, + + /* u16ForceLongHigThr */ + 700, + + /* bShortExpoChk */ + 0, + + /* u16ShortCheckThd */ + 0x0, + + /* bMDRefFlicker */ + 0, + + /* au8MdThrLowGain[16] */ + + { 64, 64, 64, 64, 64, 64, 64, 96, 128, 255, 255, 255, 255, 255, 255, 255 }, + + /* au8MdThrHigGain[16] */ + + { 128, 128, 128, 128, 128, 128, 128, 128, 128, 255, 255, 255, 255, 255, 255, 255 }, + + /* enBnrMode */ + 1, + + /* u8BnrStr */ + // 16, + + /* au16FusionThr[4] */ + + { 3855, 3000 }, + + /* u8MdtStillThd */ + 0x14, + + /* u8MdtLongBlend */ + 0x0 + +}; + +static const hi_isp_cmos_dpc g_stCmosDpc = { + {0, 0, 0, 152, 200, 200, 220, 220, 220, 220, 152, 152, 152, 152, 152, 152}, /* au16Strength[16] */ + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 50, 50, 50, 50}, /* au16BlendRatio[16] */ +}; + +static const hi_isp_cmos_lsc g_stCmosLsc = { + /* MeshStrength */ + 4096, + /* MeshScale */ + 5, + /* ISP_LSC_CABLI_TABLE_S */ + { + { + /* Rgain */ + { + 0x3FF, 0x3FF, 0x3E0, 0x3AD, 0x380, 0x34D, 0x31B, 0x2EB, 0x2B6, 0x28B, 0x262, 0x237, 0x21E, 0x203, 0x1F0, 0x1E5, + 0x1E1, 0x1E4, 0x1E9, 0x1FC, 0x210, 0x22D, 0x24C, 0x274, 0x29D, 0x2CA, 0x2FD, 0x32B, 0x356, 0x389, 0x3BA, 0x3EE, + 0x3FF, 0x3FF, 0x3E8, 0x3AD, 0x37E, 0x348, 0x313, 0x2DF, 0x2AA, 0x279, 0x24C, 0x222, 0x1FC, 0x1DD, 0x1C0, 0x1B0, + 0x1A4, 0x1A0, 0x1A2, 0x1B0, 0x1BC, 0x1D2, 0x1EE, 0x210, 0x236, 0x262, 0x290, 0x2BE, 0x2F3, 0x328, 0x359, 0x38A, + 0x3C0, 0x3FF, 0x3FF, 0x3C6, 0x38D, 0x35D, 0x321, 0x2EB, 0x2B5, 0x27D, 0x244, 0x21A, 0x1EB, 0x1C6, 0x1A4, 0x189, + 0x175, 0x16C, 0x166, 0x16A, 0x174, 0x185, 0x19D, 0x1BB, 0x1DD, 0x205, 0x231, 0x260, 0x297, 0x2C8, 0x2FE, 0x336, + 0x369, 0x3A0, 0x3E3, 0x3F1, 0x3AD, 0x377, 0x33D, 0x302, 0x2C7, 0x28E, 0x256, 0x21E, 0x1EC, 0x1BE, 0x196, 0x176, + 0x158, 0x146, 0x13C, 0x137, 0x13A, 0x146, 0x156, 0x16F, 0x18C, 0x1B0, 0x1DC, 0x207, 0x23B, 0x274, 0x2AA, 0x2E5, + 0x31B, 0x351, 0x388, 0x3CA, 0x3DB, 0x398, 0x35B, 0x321, 0x2E2, 0x2A6, 0x26A, 0x22C, 0x1F5, 0x1C0, 0x192, 0x168, + 0x148, 0x12C, 0x117, 0x10B, 0x109, 0x10C, 0x117, 0x129, 0x143, 0x160, 0x185, 0x1B2, 0x1DE, 0x218, 0x24E, 0x288, + 0x2C5, 0x2FE, 0x337, 0x372, 0x3B1, 0x3BD, 0x37D, 0x341, 0x304, 0x2C2, 0x282, 0x243, 0x206, 0x1CB, 0x196, 0x164, + 0x13D, 0x11B, 0xFF, 0xEB, 0xE2, 0xDE, 0xDF, 0xEB, 0xFC, 0x115, 0x136, 0x15D, 0x18A, 0x1B8, 0x1F0, 0x22C, + 0x268, 0x2A5, 0x2E3, 0x31D, 0x35B, 0x39F, 0x3AD, 0x35F, 0x320, 0x2E2, 0x2A3, 0x25F, 0x21B, 0x1DC, 0x1A2, 0x16A, + 0x13C, 0x111, 0xEE, 0xD5, 0xBF, 0xB5, 0xB1, 0xB6, 0xC0, 0xD1, 0xEB, 0x10A, 0x131, 0x160, 0x191, 0x1CB, + 0x205, 0x242, 0x285, 0x2C3, 0x300, 0x33D, 0x38A, 0x391, 0x346, 0x305, 0x2C3, 0x27F, 0x23A, 0x1F4, 0x1B6, 0x179, + 0x142, 0x113, 0xE8, 0xC5, 0xAB, 0x99, 0x8D, 0x89, 0x8E, 0x9A, 0xAB, 0xC4, 0xE5, 0x10C, 0x139, 0x16D, + 0x1A5, 0x1E2, 0x221, 0x262, 0x2A6, 0x2E5, 0x327, 0x36B, 0x379, 0x331, 0x2EE, 0x2A8, 0x261, 0x21B, 0x1D5, 0x194, + 0x156, 0x11F, 0xEF, 0xC5, 0xA5, 0x89, 0x78, 0x6D, 0x6A, 0x6D, 0x79, 0x89, 0xA4, 0xC4, 0xEB, 0x117, + 0x14C, 0x183, 0x1C4, 0x205, 0x245, 0x28A, 0x2CD, 0x30F, 0x356, 0x36E, 0x320, 0x2DA, 0x292, 0x24A, 0x202, 0x1BD, + 0x179, 0x13D, 0x104, 0xD4, 0xAB, 0x89, 0x6F, 0x5E, 0x51, 0x4F, 0x52, 0x5D, 0x6E, 0x88, 0xA9, 0xCE, + 0xFC, 0x131, 0x16B, 0x1AB, 0x1EC, 0x230, 0x27A, 0x2B9, 0x2FE, 0x34B, 0x368, 0x311, 0x2CB, 0x282, 0x237, 0x1ED, + 0x1A8, 0x163, 0x124, 0xED, 0xBB, 0x93, 0x73, 0x57, 0x47, 0x3C, 0x39, 0x3D, 0x46, 0x58, 0x72, 0x92, + 0xB8, 0xE7, 0x11B, 0x158, 0x197, 0x1DC, 0x223, 0x266, 0x2AD, 0x2F0, 0x33D, 0x357, 0x303, 0x2BB, 0x273, 0x224, + 0x1DB, 0x196, 0x14E, 0x10F, 0xD9, 0xA7, 0x7F, 0x5F, 0x46, 0x36, 0x2B, 0x26, 0x2B, 0x34, 0x47, 0x5F, + 0x7E, 0xA6, 0xD4, 0x10A, 0x147, 0x187, 0x1C9, 0x210, 0x258, 0x2A1, 0x2EC, 0x32E, 0x34B, 0x2FA, 0x2AD, 0x262, + 0x214, 0x1CA, 0x182, 0x13C, 0xFE, 0xC4, 0x98, 0x6E, 0x4F, 0x36, 0x25, 0x1B, 0x18, 0x1B, 0x26, 0x37, + 0x4F, 0x70, 0x94, 0xC5, 0xF9, 0x135, 0x176, 0x1B9, 0x202, 0x24A, 0x293, 0x2D9, 0x32A, 0x33D, 0x2EB, 0x2A0, + 0x255, 0x206, 0x1BC, 0x172, 0x12E, 0xEF, 0xB7, 0x87, 0x61, 0x41, 0x29, 0x1A, 0xF, 0xC, 0x10, 0x1A, + 0x29, 0x41, 0x62, 0x87, 0xB5, 0xEB, 0x125, 0x168, 0x1AD, 0x1F4, 0x23F, 0x286, 0x2D1, 0x31C, 0x334, 0x2E0, + 0x295, 0x247, 0x1FC, 0x1B1, 0x166, 0x122, 0xE3, 0xAD, 0x7D, 0x57, 0x37, 0x1F, 0x10, 0x7, 0x3, 0x7, + 0xF, 0x1F, 0x37, 0x56, 0x7C, 0xAA, 0xE0, 0x11C, 0x15D, 0x1A1, 0x1EB, 0x234, 0x27B, 0x2C5, 0x311, 0x32D, + 0x2DC, 0x28F, 0x245, 0x1F9, 0x1A9, 0x164, 0x120, 0xDD, 0xA7, 0x79, 0x52, 0x32, 0x1C, 0xC, 0x3, 0x0, + 0x2, 0xC, 0x1C, 0x33, 0x51, 0x77, 0xA4, 0xD9, 0x118, 0x159, 0x19C, 0x1E6, 0x22F, 0x277, 0x2BF, 0x30D, + 0x332, 0x2D9, 0x290, 0x248, 0x1F9, 0x1AD, 0x165, 0x11F, 0xDF, 0xAA, 0x7A, 0x54, 0x34, 0x1D, 0xC, 0x5, + 0x0, 0x5, 0xE, 0x1F, 0x36, 0x55, 0x7B, 0xA9, 0xDC, 0x119, 0x15B, 0x1A1, 0x1EB, 0x234, 0x27C, 0x2C6, + 0x316, 0x339, 0x2E3, 0x296, 0x24A, 0x1FF, 0x1B3, 0x16C, 0x125, 0xE8, 0xB2, 0x82, 0x5B, 0x3A, 0x23, 0x12, + 0xA, 0x6, 0xA, 0x14, 0x25, 0x3E, 0x5C, 0x82, 0xB1, 0xE5, 0x123, 0x166, 0x1A7, 0x1F2, 0x23D, 0x281, + 0x2CB, 0x31E, 0x33D, 0x2EB, 0x2A1, 0x251, 0x206, 0x1BC, 0x174, 0x131, 0xF4, 0xBB, 0x8D, 0x64, 0x44, 0x2D, + 0x1B, 0x13, 0xF, 0x13, 0x1E, 0x2E, 0x47, 0x67, 0x8A, 0xBC, 0xF1, 0x12E, 0x170, 0x1B5, 0x1FD, 0x247, + 0x28E, 0x2D3, 0x325, 0x341, 0x2F3, 0x2A7, 0x25B, 0x211, 0x1C6, 0x181, 0x13C, 0xFF, 0xC8, 0x98, 0x70, 0x50, + 0x37, 0x27, 0x1E, 0x1B, 0x1E, 0x28, 0x3B, 0x52, 0x72, 0x98, 0xC8, 0xFE, 0x139, 0x17A, 0x1C1, 0x208, + 0x250, 0x295, 0x2DA, 0x32A, 0x342, 0x2F3, 0x2AC, 0x265, 0x219, 0x1D6, 0x18E, 0x14A, 0x10C, 0xD6, 0xA5, 0x7E, + 0x5D, 0x46, 0x34, 0x2A, 0x27, 0x2B, 0x35, 0x46, 0x61, 0x81, 0xA8, 0xD6, 0x10C, 0x148, 0x187, 0x1CC, + 0x211, 0x258, 0x2A1, 0x2E4, 0x333, 0x34D, 0x2FE, 0x2B7, 0x271, 0x22B, 0x1E0, 0x19D, 0x15B, 0x11F, 0xE8, 0xBC, + 0x90, 0x70, 0x57, 0x45, 0x3C, 0x39, 0x3C, 0x47, 0x5A, 0x72, 0x95, 0xBB, 0xE9, 0x11D, 0x15A, 0x198, + 0x1DB, 0x21E, 0x266, 0x2AA, 0x2E9, 0x334, 0x356, 0x30C, 0x2C9, 0x283, 0x23D, 0x1F8, 0x1B2, 0x174, 0x137, 0x101, + 0xD2, 0xAB, 0x89, 0x6F, 0x5E, 0x54, 0x51, 0x55, 0x5E, 0x73, 0x8D, 0xAE, 0xD4, 0x103, 0x136, 0x173, + 0x1B0, 0x1F2, 0x235, 0x279, 0x2B9, 0x2FA, 0x341, 0x367, 0x31F, 0x2DB, 0x29B, 0x258, 0x210, 0x1D1, 0x192, 0x156, + 0x121, 0xF3, 0xC9, 0xA7, 0x8F, 0x7D, 0x73, 0x6E, 0x74, 0x7E, 0x91, 0xAD, 0xCD, 0xF5, 0x122, 0x155, + 0x190, 0x1CD, 0x20F, 0x24F, 0x291, 0x2D0, 0x30F, 0x35F, 0x37D, 0x334, 0x2F7, 0x2B2, 0x271, 0x231, 0x1F1, 0x1B1, + 0x179, 0x143, 0x117, 0xEE, 0xCD, 0xB1, 0xA1, 0x96, 0x93, 0x97, 0xA1, 0xB5, 0xD0, 0xF2, 0x118, 0x146, + 0x179, 0x1B2, 0x1ED, 0x22E, 0x26C, 0x2AF, 0x2EA, 0x329, 0x36E, 0x391, 0x347, 0x309, 0x2CB, 0x28F, 0x24C, 0x20F, + 0x1D5, 0x19D, 0x168, 0x13A, 0x112, 0xF3, 0xD9, 0xC5, 0xBD, 0xB9, 0xBE, 0xC7, 0xDB, 0xF7, 0x118, 0x13E, + 0x16A, 0x19E, 0x1D3, 0x20D, 0x248, 0x28A, 0x2C5, 0x303, 0x33F, 0x382, 0x39C, 0x35B, 0x31F, 0x2E5, 0x2A6, 0x26D, + 0x230, 0x1F7, 0x1BF, 0x18F, 0x160, 0x13B, 0x11A, 0x101, 0xED, 0xE4, 0xE1, 0xE4, 0xEF, 0x102, 0x11D, 0x13D, + 0x163, 0x18F, 0x1BE, 0x1F6, 0x22F, 0x268, 0x2A6, 0x2DC, 0x317, 0x353, 0x398, 0x3B0, 0x36B, 0x330, 0x2F9, 0x2C0, + 0x287, 0x24F, 0x218, 0x1E2, 0x1B4, 0x187, 0x162, 0x143, 0x12A, 0x116, 0x10E, 0x10B, 0x10E, 0x119, 0x12C, 0x145, + 0x163, 0x18A, 0x1B5, 0x1E4, 0x218, 0x24D, 0x285, 0x2BC, 0x2F5, 0x328, 0x360, 0x3A9, 0x3BA, 0x379, 0x344, 0x312, + 0x2DC, 0x2A5, 0x26F, 0x239, 0x208, 0x1DB, 0x1B1, 0x18B, 0x16D, 0x156, 0x144, 0x13B, 0x135, 0x13C, 0x144, 0x157, + 0x170, 0x18E, 0x1B4, 0x1DA, 0x20A, 0x23A, 0x270, 0x2A1, 0x2D4, 0x30E, 0x33E, 0x373, 0x3B9, 0x3D3, 0x391, 0x35E, + 0x32B, 0x2FB, 0x2C8, 0x296, 0x263, 0x234, 0x208, 0x1E0, 0x1BC, 0x19D, 0x188, 0x175, 0x16E, 0x168, 0x16F, 0x178, + 0x189, 0x1A1, 0x1BE, 0x1E1, 0x209, 0x232, 0x266, 0x296, 0x2C6, 0x2F7, 0x32B, 0x359, 0x391, 0x3E1, 0x3F8, 0x3AF, + 0x37C, 0x34E, 0x31E, 0x2EE, 0x2C1, 0x291, 0x263, 0x239, 0x213, 0x1F1, 0x1D6, 0x1BB, 0x1AE, 0x1A4, 0x1A2, 0x1A4, + 0x1AF, 0x1C1, 0x1D7, 0x1F3, 0x214, 0x239, 0x262, 0x290, 0x2BE, 0x2EA, 0x31E, 0x34D, 0x380, 0x3B5, 0x3FF, 0x3FF, + 0x3D7, 0x39D, 0x372, 0x344, 0x318, 0x2EF, 0x2BF, 0x297, 0x26D, 0x249, 0x227, 0x20D, 0x1F8, 0x1E7, 0x1E1, 0x1DA, + 0x1DF, 0x1E7, 0x1FA, 0x20F, 0x228, 0x24B, 0x26F, 0x298, 0x2BF, 0x2F0, 0x319, 0x342, 0x36F, 0x3A0, 0x3DB, 0x3FF, + 0x3FF, 0x3FF, 0x3CC, 0x3A0, 0x36E, 0x348, 0x31E, 0x2F2, 0x2CC, 0x2A3, 0x27D, 0x260, 0x248, 0x234, 0x223, 0x221, + 0x218, 0x21E, 0x225, 0x238, 0x249, 0x266, 0x285, 0x2A5, 0x2CE, 0x2F3, 0x31C, 0x342, 0x377, 0x3A4, 0x3D3, 0x3FF, + 0x3FF, + }, + + /* Grgain */ + { + 0x3BD, 0x35E, 0x320, 0x2E7, 0x2B4, 0x282, 0x253, 0x227, 0x1FF, 0x1DB, 0x1BB, 0x1A0, 0x18B, 0x176, 0x16B, 0x15E, + 0x15E, 0x15F, 0x168, 0x172, 0x183, 0x198, 0x1AF, 0x1CB, 0x1EC, 0x212, 0x239, 0x266, 0x297, 0x2CB, 0x303, 0x34A, + 0x3A1, 0x37F, 0x323, 0x2E3, 0x2AC, 0x277, 0x246, 0x21A, 0x1EC, 0x1C7, 0x1A2, 0x183, 0x168, 0x150, 0x13F, 0x132, + 0x12A, 0x129, 0x129, 0x132, 0x13C, 0x14E, 0x163, 0x17A, 0x199, 0x1B7, 0x1DE, 0x205, 0x230, 0x25F, 0x294, 0x2CE, + 0x310, 0x362, 0x35F, 0x302, 0x2C3, 0x28B, 0x255, 0x224, 0x1F5, 0x1C9, 0x19F, 0x17D, 0x15E, 0x143, 0x12A, 0x118, + 0x10C, 0x103, 0xFF, 0x105, 0x10B, 0x117, 0x128, 0x13E, 0x157, 0x176, 0x195, 0x1B9, 0x1E4, 0x211, 0x23F, 0x272, + 0x2AC, 0x2ED, 0x33E, 0x33D, 0x2E7, 0x2A9, 0x26F, 0x23B, 0x207, 0x1D8, 0x1AC, 0x182, 0x15F, 0x13D, 0x121, 0x10A, + 0xF8, 0xEB, 0xE1, 0xE1, 0xE2, 0xEB, 0xF6, 0x108, 0x11E, 0x139, 0x156, 0x177, 0x19E, 0x1C6, 0x1F4, 0x227, + 0x25B, 0x290, 0x2D1, 0x325, 0x320, 0x2CE, 0x291, 0x255, 0x21E, 0x1ED, 0x1BE, 0x18E, 0x164, 0x140, 0x11E, 0x103, + 0xEB, 0xD7, 0xCB, 0xC3, 0xC0, 0xC4, 0xCB, 0xD7, 0xEA, 0x101, 0x11B, 0x139, 0x159, 0x183, 0x1AB, 0x1D9, + 0x208, 0x23F, 0x278, 0x2B9, 0x303, 0x30A, 0x2B3, 0x276, 0x23D, 0x203, 0x1D0, 0x19F, 0x172, 0x147, 0x122, 0x100, + 0xE1, 0xCC, 0xB9, 0xA9, 0xA5, 0xA1, 0xA4, 0xAB, 0xB8, 0xCB, 0xE1, 0xFE, 0x11C, 0x13D, 0x165, 0x191, + 0x1BF, 0x1F1, 0x225, 0x25D, 0x29D, 0x2ED, 0x2E7, 0x298, 0x25C, 0x21F, 0x1E9, 0x1B4, 0x182, 0x151, 0x127, 0x103, + 0xE1, 0xC4, 0xAB, 0x98, 0x8B, 0x84, 0x82, 0x85, 0x8E, 0x9B, 0xAC, 0xC4, 0xDF, 0x100, 0x123, 0x14A, + 0x174, 0x1A2, 0x1D6, 0x20A, 0x244, 0x280, 0x2D0, 0x2D1, 0x27C, 0x23F, 0x207, 0x1CB, 0x196, 0x167, 0x136, 0x10A, + 0xE5, 0xC3, 0xA6, 0x8E, 0x7C, 0x6D, 0x66, 0x64, 0x68, 0x71, 0x7E, 0x8F, 0xA7, 0xC3, 0xE4, 0x105, + 0x12E, 0x15B, 0x18B, 0x1BB, 0x1F3, 0x22B, 0x268, 0x2B5, 0x2B9, 0x267, 0x22C, 0x1ED, 0x1B6, 0x181, 0x14F, 0x11F, + 0xF3, 0xCC, 0xAC, 0x8D, 0x75, 0x63, 0x55, 0x50, 0x4D, 0x4F, 0x57, 0x63, 0x78, 0x8F, 0xAC, 0xCC, + 0xF0, 0x118, 0x145, 0x174, 0x1A4, 0x1DB, 0x214, 0x252, 0x29F, 0x2AF, 0x25A, 0x21B, 0x1E0, 0x1A5, 0x16F, 0x13C, + 0x10D, 0xE0, 0xBA, 0x99, 0x7A, 0x63, 0x4F, 0x44, 0x3C, 0x39, 0x3C, 0x45, 0x52, 0x63, 0x7C, 0x9A, + 0xBB, 0xDD, 0x108, 0x134, 0x165, 0x197, 0x1CD, 0x206, 0x243, 0x291, 0x2A8, 0x24F, 0x210, 0x1D4, 0x198, 0x160, + 0x12F, 0xFE, 0xD2, 0xA9, 0x87, 0x69, 0x53, 0x40, 0x33, 0x2C, 0x2B, 0x2E, 0x36, 0x42, 0x56, 0x6E, + 0x8B, 0xAD, 0xD1, 0xFC, 0x129, 0x159, 0x18C, 0x1C1, 0x1F9, 0x23A, 0x287, 0x29B, 0x244, 0x206, 0x1C7, 0x18D, + 0x157, 0x123, 0xF2, 0xC4, 0x9C, 0x78, 0x5D, 0x44, 0x34, 0x26, 0x20, 0x1E, 0x22, 0x28, 0x36, 0x48, + 0x61, 0x7C, 0x9F, 0xC6, 0xEF, 0x11C, 0x14D, 0x180, 0x1B8, 0x1F5, 0x231, 0x27C, 0x28F, 0x23C, 0x1FC, 0x1BC, + 0x183, 0x14B, 0x116, 0xE6, 0xB8, 0x8F, 0x6D, 0x4F, 0x39, 0x27, 0x1C, 0x15, 0x13, 0x16, 0x1E, 0x2A, + 0x3C, 0x54, 0x72, 0x95, 0xBA, 0xE4, 0x111, 0x142, 0x175, 0x1AD, 0x1E6, 0x225, 0x275, 0x283, 0x22F, 0x1EF, + 0x1B2, 0x178, 0x13F, 0x10A, 0xD9, 0xAC, 0x85, 0x61, 0x45, 0x2D, 0x1D, 0x11, 0xB, 0x9, 0xC, 0x14, + 0x1F, 0x32, 0x49, 0x67, 0x88, 0xAF, 0xD8, 0x107, 0x138, 0x16A, 0x1A4, 0x1DB, 0x21A, 0x266, 0x27A, 0x226, + 0x1E6, 0x1A8, 0x16D, 0x135, 0x101, 0xD0, 0xA2, 0x7C, 0x58, 0x3E, 0x26, 0x15, 0xB, 0x4, 0x3, 0x5, + 0xC, 0x18, 0x29, 0x41, 0x5F, 0x80, 0xA6, 0xD1, 0xFE, 0x12F, 0x164, 0x19B, 0x1D3, 0x212, 0x25E, 0x272, + 0x220, 0x1E1, 0x1A3, 0x16A, 0x132, 0xFC, 0xCB, 0x9E, 0x77, 0x56, 0x39, 0x23, 0x12, 0x8, 0x2, 0x0, + 0x1, 0x9, 0x14, 0x26, 0x3E, 0x5A, 0x7C, 0xA2, 0xCD, 0xFA, 0x12B, 0x160, 0x197, 0x1CF, 0x20E, 0x25C, + 0x276, 0x222, 0x1E2, 0x1A6, 0x16C, 0x132, 0xFF, 0xCD, 0xA1, 0x7A, 0x56, 0x3B, 0x24, 0x14, 0xA, 0x3, + 0x1, 0x3, 0xB, 0x18, 0x29, 0x40, 0x5E, 0x80, 0xA6, 0xCE, 0xFE, 0x130, 0x164, 0x19B, 0x1D3, 0x211, + 0x25E, 0x27C, 0x229, 0x1EB, 0x1AD, 0x173, 0x13A, 0x105, 0xD3, 0xA7, 0x7F, 0x5D, 0x41, 0x29, 0x18, 0xE, + 0x8, 0x6, 0x8, 0xF, 0x1E, 0x2F, 0x46, 0x63, 0x85, 0xAC, 0xD7, 0x105, 0x135, 0x169, 0x1A1, 0x1DB, + 0x21B, 0x264, 0x287, 0x22E, 0x1EF, 0x1B3, 0x177, 0x140, 0x10D, 0xDB, 0xAF, 0x87, 0x65, 0x49, 0x32, 0x20, + 0x15, 0xF, 0xD, 0xE, 0x16, 0x24, 0x36, 0x4E, 0x6B, 0x8E, 0xB5, 0xDF, 0x10F, 0x13F, 0x173, 0x1AB, + 0x1E4, 0x220, 0x26D, 0x28B, 0x233, 0x1F5, 0x1B9, 0x17D, 0x147, 0x114, 0xE5, 0xB7, 0x8F, 0x6E, 0x50, 0x39, + 0x28, 0x1C, 0x16, 0x14, 0x17, 0x1F, 0x2C, 0x3F, 0x58, 0x74, 0x95, 0xBC, 0xE8, 0x116, 0x147, 0x178, + 0x1B2, 0x1ED, 0x227, 0x272, 0x28B, 0x238, 0x1FA, 0x1BF, 0x182, 0x150, 0x11D, 0xEC, 0xBF, 0x9A, 0x77, 0x5B, + 0x42, 0x31, 0x26, 0x1D, 0x1D, 0x20, 0x27, 0x34, 0x48, 0x61, 0x7F, 0xA0, 0xC6, 0xF0, 0x11D, 0x14F, + 0x180, 0x1B8, 0x1F1, 0x22F, 0x27A, 0x297, 0x240, 0x1FF, 0x1C6, 0x18D, 0x158, 0x126, 0xF7, 0xCB, 0xA6, 0x84, + 0x66, 0x50, 0x3D, 0x30, 0x2A, 0x29, 0x2C, 0x33, 0x42, 0x55, 0x6F, 0x8A, 0xAD, 0xD1, 0xFD, 0x128, + 0x159, 0x18A, 0x1BE, 0x1F8, 0x235, 0x27E, 0x29C, 0x24C, 0x210, 0x1D4, 0x19C, 0x168, 0x133, 0x107, 0xDD, 0xB6, + 0x95, 0x78, 0x61, 0x4F, 0x42, 0x3E, 0x3B, 0x3D, 0x46, 0x56, 0x68, 0x80, 0x9E, 0xBD, 0xE3, 0x10D, + 0x138, 0x169, 0x199, 0x1CF, 0x207, 0x245, 0x28C, 0x2B3, 0x25F, 0x221, 0x1E9, 0x1B2, 0x17A, 0x14C, 0x11E, 0xF4, + 0xCF, 0xAE, 0x91, 0x79, 0x67, 0x5A, 0x54, 0x53, 0x56, 0x5D, 0x6B, 0x80, 0x98, 0xB5, 0xD4, 0xF8, + 0x124, 0x150, 0x17E, 0x1AD, 0x1E2, 0x21C, 0x25B, 0x2A4, 0x2C5, 0x274, 0x23C, 0x201, 0x1C7, 0x194, 0x166, 0x138, + 0x10E, 0xE8, 0xC8, 0xAA, 0x93, 0x81, 0x76, 0x6F, 0x6D, 0x70, 0x79, 0x87, 0x9B, 0xB2, 0xD0, 0xEF, + 0x112, 0x13A, 0x165, 0x196, 0x1C5, 0x1FD, 0x233, 0x271, 0x2BA, 0x2D5, 0x289, 0x24E, 0x213, 0x1DF, 0x1A9, 0x17D, + 0x14F, 0x127, 0x102, 0xE0, 0xC7, 0xAF, 0x9D, 0x91, 0x8A, 0x87, 0x8C, 0x95, 0xA4, 0xB6, 0xCD, 0xE8, + 0x10A, 0x12D, 0x152, 0x17E, 0x1AB, 0x1DD, 0x211, 0x24B, 0x28B, 0x2D2, 0x2EF, 0x29B, 0x262, 0x228, 0x1F3, 0x1C0, + 0x192, 0x166, 0x13E, 0x11D, 0xFB, 0xE2, 0xCB, 0xBB, 0xAE, 0xA6, 0xA6, 0xA8, 0xB0, 0xBE, 0xD1, 0xE8, + 0x105, 0x121, 0x145, 0x16A, 0x196, 0x1C1, 0x1F2, 0x229, 0x260, 0x29E, 0x2E7, 0x2FE, 0x2AE, 0x273, 0x23D, 0x20A, + 0x1D5, 0x1A8, 0x17F, 0x157, 0x134, 0x115, 0xFA, 0xE6, 0xD5, 0xC9, 0xC3, 0xC2, 0xC3, 0xCC, 0xD7, 0xEB, + 0x101, 0x11D, 0x13A, 0x15C, 0x182, 0x1AC, 0x1D8, 0x208, 0x23C, 0x276, 0x2B0, 0x302, 0x313, 0x2C3, 0x289, 0x254, + 0x220, 0x1EF, 0x1C1, 0x198, 0x171, 0x150, 0x133, 0x119, 0x103, 0xF3, 0xE6, 0xE1, 0xDE, 0xE3, 0xE9, 0xF6, + 0x10A, 0x11E, 0x139, 0x158, 0x178, 0x19D, 0x1C6, 0x1F0, 0x21F, 0x253, 0x288, 0x2CC, 0x31C, 0x334, 0x2DE, 0x2A5, + 0x270, 0x23D, 0x20D, 0x1DF, 0x1B9, 0x192, 0x172, 0x155, 0x13B, 0x126, 0x117, 0x109, 0x104, 0x103, 0x106, 0x10D, + 0x119, 0x12B, 0x13F, 0x159, 0x175, 0x197, 0x1BE, 0x1E4, 0x211, 0x23C, 0x273, 0x2A9, 0x2EC, 0x345, 0x364, 0x307, + 0x2C6, 0x290, 0x25E, 0x233, 0x205, 0x1DE, 0x1B8, 0x196, 0x17B, 0x162, 0x14C, 0x13D, 0x132, 0x12B, 0x12A, 0x12D, + 0x133, 0x140, 0x150, 0x166, 0x17E, 0x19D, 0x1BD, 0x1E1, 0x209, 0x234, 0x264, 0x298, 0x2D0, 0x316, 0x37A, 0x396, + 0x331, 0x2EE, 0x2B8, 0x283, 0x258, 0x22D, 0x205, 0x1E1, 0x1C1, 0x1A4, 0x18C, 0x176, 0x169, 0x15D, 0x157, 0x153, + 0x158, 0x15E, 0x16C, 0x17D, 0x190, 0x1A9, 0x1C4, 0x1E4, 0x208, 0x233, 0x25C, 0x28B, 0x2C2, 0x2FD, 0x348, 0x3AA, + 0x3C7, 0x36F, 0x321, 0x2ED, 0x2B5, 0x28A, 0x25E, 0x235, 0x212, 0x1F0, 0x1D8, 0x1BE, 0x1AC, 0x19C, 0x18D, 0x18B, + 0x186, 0x18A, 0x194, 0x19D, 0x1AC, 0x1C1, 0x1D8, 0x1F6, 0x218, 0x239, 0x261, 0x28E, 0x2BB, 0x2F1, 0x336, 0x386, + 0x3E7, + }, + + /* Gbgain */ + { + 0x3BA, 0x363, 0x320, 0x2EB, 0x2B4, 0x281, 0x250, 0x227, 0x1FE, 0x1DC, 0x1BD, 0x1A0, 0x186, 0x174, 0x168, 0x160, + 0x15D, 0x15D, 0x162, 0x16F, 0x182, 0x198, 0x1AC, 0x1CA, 0x1EB, 0x20D, 0x237, 0x262, 0x293, 0x2C7, 0x304, 0x345, + 0x3A5, 0x388, 0x326, 0x2E6, 0x2B1, 0x27A, 0x248, 0x21C, 0x1F0, 0x1C7, 0x1A6, 0x188, 0x16D, 0x156, 0x143, 0x135, + 0x12D, 0x128, 0x12B, 0x133, 0x13E, 0x14F, 0x165, 0x17D, 0x19B, 0x1B8, 0x1DD, 0x202, 0x22E, 0x260, 0x293, 0x2CB, + 0x30F, 0x366, 0x364, 0x302, 0x2C6, 0x28B, 0x258, 0x227, 0x1F6, 0x1CB, 0x1A3, 0x182, 0x161, 0x146, 0x12D, 0x11A, + 0x10E, 0x105, 0x103, 0x105, 0x10D, 0x118, 0x129, 0x140, 0x157, 0x176, 0x194, 0x1BA, 0x1E0, 0x20E, 0x23D, 0x26F, + 0x2A7, 0x2E8, 0x33F, 0x341, 0x2E6, 0x2A9, 0x270, 0x23B, 0x209, 0x1DC, 0x1AC, 0x185, 0x161, 0x142, 0x125, 0x10D, + 0xFA, 0xED, 0xE4, 0xE1, 0xE4, 0xEC, 0xF5, 0x109, 0x120, 0x139, 0x159, 0x175, 0x19D, 0x1C5, 0x1F4, 0x225, + 0x257, 0x28D, 0x2CB, 0x327, 0x32B, 0x2D0, 0x293, 0x257, 0x220, 0x1ED, 0x1BC, 0x18F, 0x167, 0x142, 0x121, 0x105, + 0xED, 0xD9, 0xCA, 0xC4, 0xC0, 0xC3, 0xCB, 0xD8, 0xEB, 0x102, 0x11B, 0x139, 0x15A, 0x182, 0x1A9, 0x1D7, + 0x206, 0x23D, 0x275, 0x2B3, 0x305, 0x30C, 0x2B4, 0x276, 0x23D, 0x205, 0x1D2, 0x1A0, 0x175, 0x149, 0x122, 0x100, + 0xE5, 0xCD, 0xBA, 0xAC, 0xA3, 0xA2, 0xA5, 0xAD, 0xB9, 0xCC, 0xE3, 0xFD, 0x11D, 0x13E, 0x165, 0x191, + 0x1BB, 0x1ED, 0x221, 0x258, 0x29A, 0x2ED, 0x2ED, 0x299, 0x25A, 0x21F, 0x1E9, 0x1B4, 0x183, 0x155, 0x129, 0x105, + 0xE4, 0xC6, 0xAD, 0x9A, 0x8D, 0x84, 0x82, 0x85, 0x8C, 0x9A, 0xAD, 0xC5, 0xE0, 0xFF, 0x123, 0x14A, + 0x173, 0x1A0, 0x1D3, 0x208, 0x23E, 0x27E, 0x2CD, 0x2D5, 0x27F, 0x240, 0x206, 0x1CD, 0x198, 0x168, 0x13A, 0x10E, + 0xE7, 0xC5, 0xA7, 0x8E, 0x7C, 0x6E, 0x67, 0x64, 0x67, 0x70, 0x7F, 0x92, 0xA8, 0xC4, 0xE4, 0x106, + 0x12F, 0x158, 0x186, 0x1B8, 0x1ED, 0x224, 0x261, 0x2B2, 0x2BE, 0x268, 0x22B, 0x1EF, 0x1B9, 0x182, 0x151, 0x122, + 0xF5, 0xCF, 0xAD, 0x8F, 0x77, 0x64, 0x56, 0x50, 0x4C, 0x50, 0x58, 0x65, 0x79, 0x90, 0xAE, 0xCC, + 0xF0, 0x117, 0x143, 0x171, 0x1A3, 0x1D9, 0x20F, 0x24B, 0x29C, 0x2B4, 0x25B, 0x21D, 0x1E1, 0x1A6, 0x171, 0x140, + 0x110, 0xE1, 0xBC, 0x9A, 0x7C, 0x64, 0x51, 0x45, 0x3B, 0x39, 0x3C, 0x45, 0x53, 0x66, 0x7E, 0x9B, + 0xBB, 0xDE, 0x106, 0x132, 0x161, 0x192, 0x1C9, 0x200, 0x23D, 0x290, 0x2AA, 0x250, 0x210, 0x1D6, 0x19A, 0x164, + 0x131, 0x102, 0xD5, 0xAD, 0x8A, 0x6C, 0x54, 0x41, 0x35, 0x2E, 0x2B, 0x2D, 0x36, 0x43, 0x56, 0x6F, + 0x8C, 0xAD, 0xD2, 0xFA, 0x127, 0x158, 0x189, 0x1C1, 0x1F6, 0x236, 0x285, 0x2A0, 0x246, 0x209, 0x1CA, 0x18E, + 0x159, 0x126, 0xF4, 0xC7, 0x9E, 0x7C, 0x5E, 0x47, 0x33, 0x28, 0x20, 0x1E, 0x22, 0x28, 0x37, 0x49, + 0x62, 0x7F, 0x9F, 0xC6, 0xEF, 0x11F, 0x14B, 0x17E, 0x1B5, 0x1ED, 0x22C, 0x27D, 0x295, 0x23B, 0x1FA, 0x1BD, + 0x181, 0x14B, 0x119, 0xE8, 0xBB, 0x92, 0x70, 0x52, 0x3A, 0x28, 0x1D, 0x15, 0x14, 0x16, 0x1E, 0x2B, + 0x3D, 0x55, 0x73, 0x96, 0xB9, 0xE4, 0x110, 0x140, 0x173, 0x1AA, 0x1E5, 0x221, 0x273, 0x288, 0x230, 0x1F0, + 0x1B3, 0x177, 0x142, 0x10D, 0xDD, 0xAF, 0x86, 0x64, 0x47, 0x30, 0x1E, 0x13, 0xD, 0xA, 0xC, 0x14, + 0x21, 0x32, 0x4B, 0x68, 0x88, 0xAF, 0xDA, 0x106, 0x136, 0x16B, 0x1A1, 0x1DC, 0x21A, 0x266, 0x284, 0x223, + 0x1E7, 0x1A9, 0x16F, 0x139, 0x104, 0xD4, 0xA6, 0x7E, 0x5C, 0x40, 0x27, 0x17, 0xB, 0x5, 0x3, 0x6, + 0xD, 0x1A, 0x2A, 0x43, 0x5F, 0x80, 0xA6, 0xD0, 0xFC, 0x12D, 0x161, 0x197, 0x1D2, 0x210, 0x263, 0x278, + 0x220, 0x1E3, 0x1A6, 0x16B, 0x133, 0x101, 0xCE, 0xA3, 0x7A, 0x59, 0x3B, 0x25, 0x14, 0x9, 0x2, 0x0, + 0x1, 0xA, 0x15, 0x26, 0x3F, 0x5B, 0x7C, 0xA2, 0xCD, 0xF9, 0x12B, 0x15F, 0x195, 0x1CE, 0x209, 0x25D, + 0x27D, 0x224, 0x1E4, 0x1A8, 0x16F, 0x137, 0x102, 0xD3, 0xA5, 0x7E, 0x5B, 0x3E, 0x26, 0x17, 0xA, 0x5, + 0x2, 0x3, 0xC, 0x18, 0x2B, 0x41, 0x5E, 0x81, 0xA6, 0xD0, 0xFE, 0x12F, 0x163, 0x199, 0x1D2, 0x20E, + 0x261, 0x281, 0x228, 0x1EB, 0x1AF, 0x174, 0x13C, 0x10A, 0xD7, 0xAB, 0x83, 0x60, 0x43, 0x2D, 0x1B, 0xF, + 0xA, 0x6, 0x9, 0x11, 0x1F, 0x30, 0x48, 0x63, 0x87, 0xAD, 0xD7, 0x107, 0x135, 0x169, 0x19E, 0x1D8, + 0x219, 0x269, 0x28D, 0x22F, 0x1F2, 0x1B5, 0x17C, 0x143, 0x110, 0xE0, 0xB3, 0x8C, 0x68, 0x4B, 0x33, 0x22, + 0x16, 0xF, 0xD, 0xF, 0x17, 0x24, 0x36, 0x4F, 0x6C, 0x90, 0xB4, 0xE0, 0x10C, 0x13D, 0x171, 0x1A7, + 0x1E2, 0x21E, 0x270, 0x28D, 0x235, 0x1F8, 0x1BC, 0x181, 0x14C, 0x119, 0xE8, 0xBB, 0x93, 0x6F, 0x53, 0x3B, + 0x2A, 0x1D, 0x17, 0x15, 0x18, 0x1F, 0x2D, 0x40, 0x58, 0x76, 0x96, 0xBB, 0xE8, 0x117, 0x147, 0x177, + 0x1AE, 0x1EA, 0x227, 0x276, 0x293, 0x23A, 0x1FC, 0x1C1, 0x188, 0x152, 0x11E, 0xF1, 0xC4, 0x9D, 0x79, 0x5D, + 0x46, 0x33, 0x28, 0x20, 0x1D, 0x20, 0x28, 0x36, 0x4A, 0x62, 0x7F, 0xA0, 0xC6, 0xF1, 0x11F, 0x14F, + 0x17E, 0x1B6, 0x1F0, 0x22C, 0x27B, 0x299, 0x240, 0x203, 0x1C8, 0x18F, 0x15C, 0x128, 0xFB, 0xCE, 0xA8, 0x88, + 0x69, 0x51, 0x3E, 0x32, 0x2C, 0x29, 0x2D, 0x35, 0x43, 0x56, 0x6F, 0x8C, 0xAE, 0xD2, 0xFC, 0x128, + 0x158, 0x188, 0x1BD, 0x1F6, 0x234, 0x284, 0x2A4, 0x24F, 0x212, 0x1D6, 0x1A0, 0x16A, 0x139, 0x10B, 0xE1, 0xBB, + 0x99, 0x7B, 0x63, 0x53, 0x43, 0x3D, 0x3B, 0x3F, 0x46, 0x55, 0x69, 0x81, 0x9F, 0xBF, 0xE3, 0x10C, + 0x139, 0x168, 0x199, 0x1CF, 0x208, 0x243, 0x28F, 0x2B6, 0x262, 0x223, 0x1EB, 0x1B5, 0x17D, 0x150, 0x121, 0xF7, + 0xD2, 0xB1, 0x93, 0x7C, 0x68, 0x5B, 0x55, 0x53, 0x57, 0x5E, 0x6C, 0x81, 0x98, 0xB5, 0xD6, 0xF9, + 0x124, 0x151, 0x17F, 0x1AE, 0x1E4, 0x21D, 0x25C, 0x2A6, 0x2CD, 0x276, 0x23C, 0x202, 0x1CD, 0x199, 0x168, 0x13C, + 0x112, 0xED, 0xCB, 0xAE, 0x96, 0x84, 0x78, 0x6F, 0x6F, 0x71, 0x7B, 0x88, 0x9C, 0xB4, 0xD1, 0xEF, + 0x114, 0x13A, 0x166, 0x196, 0x1C6, 0x1FB, 0x232, 0x274, 0x2BF, 0x2E2, 0x28E, 0x253, 0x21A, 0x1E4, 0x1AC, 0x180, + 0x152, 0x12A, 0x107, 0xE4, 0xC8, 0xB2, 0xA0, 0x93, 0x8C, 0x8A, 0x8E, 0x96, 0xA3, 0xB8, 0xCD, 0xEB, + 0x109, 0x12C, 0x155, 0x180, 0x1AD, 0x1DC, 0x211, 0x24B, 0x288, 0x2D8, 0x2F9, 0x2A1, 0x268, 0x22D, 0x1F8, 0x1C6, + 0x197, 0x16D, 0x144, 0x120, 0xFF, 0xE4, 0xCE, 0xBD, 0xAF, 0xA9, 0xA7, 0xA9, 0xB2, 0xBF, 0xD3, 0xE9, + 0x106, 0x123, 0x146, 0x16D, 0x196, 0x1C5, 0x1F4, 0x22A, 0x261, 0x29C, 0x2F0, 0x30C, 0x2B5, 0x275, 0x243, 0x20E, + 0x1DD, 0x1AD, 0x184, 0x15D, 0x139, 0x11B, 0xFF, 0xEA, 0xD9, 0xCC, 0xC5, 0xC4, 0xC4, 0xCE, 0xDA, 0xEE, + 0x104, 0x11F, 0x13B, 0x15E, 0x184, 0x1AC, 0x1D9, 0x207, 0x23E, 0x274, 0x2B1, 0x304, 0x31E, 0x2C9, 0x28E, 0x257, + 0x223, 0x1F2, 0x1C6, 0x19E, 0x178, 0x156, 0x136, 0x11F, 0x108, 0xF7, 0xEA, 0xE2, 0xE1, 0xE7, 0xED, 0xF8, + 0x10C, 0x121, 0x13D, 0x15A, 0x17B, 0x19E, 0x1C8, 0x1F3, 0x21F, 0x255, 0x28D, 0x2CC, 0x320, 0x33F, 0x2E7, 0x2AC, + 0x275, 0x241, 0x213, 0x1E5, 0x1BF, 0x197, 0x17A, 0x15C, 0x141, 0x12C, 0x11A, 0x10F, 0x108, 0x107, 0x109, 0x111, + 0x11D, 0x12E, 0x143, 0x15E, 0x179, 0x19B, 0x1BF, 0x1E6, 0x212, 0x23E, 0x271, 0x2AB, 0x2EF, 0x348, 0x370, 0x312, + 0x2CC, 0x298, 0x266, 0x236, 0x20B, 0x1E5, 0x1BE, 0x19F, 0x181, 0x167, 0x154, 0x143, 0x138, 0x131, 0x12E, 0x131, + 0x13A, 0x145, 0x156, 0x16A, 0x183, 0x1A0, 0x1C1, 0x1E3, 0x20A, 0x236, 0x264, 0x299, 0x2CF, 0x316, 0x37E, 0x39F, + 0x33D, 0x2F6, 0x2BE, 0x28C, 0x260, 0x232, 0x20F, 0x1E7, 0x1C8, 0x1AC, 0x193, 0x17F, 0x172, 0x165, 0x15D, 0x15B, + 0x15E, 0x163, 0x170, 0x181, 0x196, 0x1AE, 0x1C9, 0x1E9, 0x20C, 0x234, 0x25E, 0x28E, 0x2C1, 0x2FE, 0x348, 0x3B0, + 0x3D4, 0x37A, 0x330, 0x2F2, 0x2C2, 0x292, 0x268, 0x23E, 0x21C, 0x1FB, 0x1DF, 0x1C6, 0x1B0, 0x1A2, 0x193, 0x191, + 0x18C, 0x191, 0x198, 0x1A2, 0x1B1, 0x1C8, 0x1DE, 0x1FA, 0x21C, 0x242, 0x266, 0x292, 0x2C4, 0x2F8, 0x339, 0x38C, + 0x3EB, + }, + + /* Bgain */ + { + 0x32B, 0x2E1, 0x2B0, 0x27B, 0x252, 0x22A, 0x201, 0x1DF, 0x1BA, 0x19E, 0x188, 0x16E, 0x15C, 0x14C, 0x142, 0x138, + 0x139, 0x138, 0x13F, 0x148, 0x159, 0x16C, 0x180, 0x196, 0x1B2, 0x1D3, 0x1F6, 0x21D, 0x246, 0x272, 0x2A2, 0x2DE, + 0x329, 0x2FF, 0x2AD, 0x278, 0x24B, 0x21D, 0x1F2, 0x1D0, 0x1A8, 0x188, 0x16B, 0x153, 0x13C, 0x129, 0x119, 0x110, + 0x108, 0x104, 0x107, 0x10D, 0x117, 0x124, 0x13A, 0x152, 0x16A, 0x184, 0x1A3, 0x1C6, 0x1EA, 0x214, 0x243, 0x275, + 0x2AA, 0x2F1, 0x2DE, 0x28F, 0x25D, 0x22D, 0x1FE, 0x1D8, 0x1AF, 0x18B, 0x168, 0x14A, 0x131, 0x11C, 0x106, 0xF6, + 0xEC, 0xE7, 0xE2, 0xE6, 0xEA, 0xF6, 0x104, 0x117, 0x12F, 0x149, 0x162, 0x183, 0x1A7, 0x1CF, 0x1F8, 0x223, + 0x256, 0x28E, 0x2DA, 0x2C4, 0x278, 0x246, 0x216, 0x1E9, 0x1C0, 0x196, 0x172, 0x14D, 0x130, 0x116, 0x100, 0xEC, + 0xDC, 0xD0, 0xC9, 0xC8, 0xCA, 0xCF, 0xD9, 0xE9, 0xFE, 0x114, 0x130, 0x14C, 0x16E, 0x18F, 0x1B8, 0x1E2, + 0x211, 0x23E, 0x275, 0x2BF, 0x2B2, 0x263, 0x231, 0x200, 0x1D1, 0x1A6, 0x17D, 0x159, 0x135, 0x115, 0xFA, 0xE3, + 0xD0, 0xBF, 0xB3, 0xAD, 0xAC, 0xAD, 0xB3, 0xBF, 0xD0, 0xE4, 0xFA, 0x116, 0x132, 0x155, 0x17A, 0x19E, + 0x1CB, 0x1FA, 0x227, 0x260, 0x2AA, 0x29B, 0x24A, 0x21B, 0x1E8, 0x1BA, 0x18F, 0x164, 0x13F, 0x11B, 0xFE, 0xDF, + 0xC7, 0xB4, 0xA4, 0x97, 0x93, 0x90, 0x92, 0x99, 0xA4, 0xB3, 0xC9, 0xE3, 0xFC, 0x11B, 0x13C, 0x160, + 0x188, 0x1B4, 0x1E5, 0x212, 0x248, 0x28D, 0x280, 0x234, 0x201, 0x1D0, 0x1A2, 0x175, 0x14B, 0x127, 0xFF, 0xE1, + 0xC3, 0xAC, 0x96, 0x87, 0x7C, 0x77, 0x74, 0x77, 0x7E, 0x88, 0x98, 0xAF, 0xC6, 0xE2, 0xFF, 0x123, + 0x148, 0x16E, 0x19D, 0x1CC, 0x1FA, 0x231, 0x278, 0x269, 0x21B, 0x1EB, 0x1BB, 0x188, 0x15E, 0x134, 0x10B, 0xE7, + 0xC8, 0xAB, 0x91, 0x7C, 0x6C, 0x60, 0x5A, 0x5B, 0x5D, 0x63, 0x6F, 0x7F, 0x96, 0xAD, 0xC9, 0xE7, + 0x10B, 0x12F, 0x157, 0x182, 0x1B3, 0x1E3, 0x21A, 0x261, 0x256, 0x20A, 0x1D9, 0x1A7, 0x178, 0x14A, 0x121, 0xF7, + 0xD4, 0xB1, 0x93, 0x7B, 0x67, 0x57, 0x4B, 0x46, 0x44, 0x46, 0x4D, 0x57, 0x69, 0x7F, 0x99, 0xB5, + 0xD3, 0xF5, 0x11C, 0x145, 0x170, 0x1A2, 0x1D2, 0x204, 0x24D, 0x24E, 0x200, 0x1CE, 0x199, 0x16A, 0x13D, 0x112, + 0xE8, 0xC2, 0xA1, 0x85, 0x6C, 0x58, 0x46, 0x3B, 0x35, 0x33, 0x34, 0x3C, 0x49, 0x5A, 0x6F, 0x8A, + 0xA5, 0xC6, 0xE8, 0x10F, 0x139, 0x164, 0x194, 0x1C4, 0x1FA, 0x240, 0x241, 0x1F5, 0x1BF, 0x18F, 0x15E, 0x12F, + 0x105, 0xDE, 0xB7, 0x95, 0x78, 0x5D, 0x49, 0x3B, 0x2E, 0x27, 0x26, 0x29, 0x2F, 0x3B, 0x4C, 0x63, + 0x7B, 0x9B, 0xBA, 0xDE, 0x104, 0x12F, 0x15A, 0x18A, 0x1BC, 0x1F3, 0x239, 0x23D, 0x1EB, 0x1BA, 0x187, 0x155, + 0x126, 0xFE, 0xD0, 0xA9, 0x87, 0x6A, 0x51, 0x3E, 0x2E, 0x23, 0x1D, 0x1C, 0x1F, 0x23, 0x30, 0x41, + 0x57, 0x71, 0x8F, 0xAF, 0xD4, 0xFB, 0x123, 0x152, 0x184, 0x1B7, 0x1E9, 0x230, 0x232, 0x1E5, 0x1B2, 0x17A, + 0x14B, 0x11D, 0xF1, 0xC9, 0xA1, 0x7E, 0x5E, 0x45, 0x33, 0x23, 0x19, 0x13, 0x13, 0x14, 0x1A, 0x26, + 0x36, 0x4D, 0x67, 0x85, 0xA5, 0xCC, 0xF2, 0x11C, 0x149, 0x178, 0x1AB, 0x1E3, 0x228, 0x226, 0x1DB, 0x1A7, + 0x176, 0x141, 0x112, 0xE8, 0xBE, 0x97, 0x75, 0x57, 0x3D, 0x28, 0x1A, 0x11, 0xB, 0x9, 0xB, 0x11, + 0x1D, 0x2C, 0x41, 0x5D, 0x7A, 0x9B, 0xC2, 0xE8, 0x111, 0x141, 0x170, 0x1A1, 0x1DB, 0x220, 0x21A, 0x1D1, + 0x19A, 0x16C, 0x13A, 0x10A, 0xDE, 0xB5, 0x8E, 0x6D, 0x4E, 0x37, 0x22, 0x13, 0x9, 0x5, 0x2, 0x5, + 0xA, 0x16, 0x24, 0x39, 0x53, 0x72, 0x93, 0xB6, 0xDF, 0x109, 0x139, 0x169, 0x19B, 0x1CF, 0x214, 0x21B, + 0x1CE, 0x19A, 0x167, 0x137, 0x109, 0xDB, 0xB2, 0x8D, 0x6A, 0x4C, 0x33, 0x1F, 0x11, 0x6, 0x2, 0x0, + 0x2, 0x8, 0x11, 0x20, 0x35, 0x4D, 0x6C, 0x8D, 0xB4, 0xDC, 0x106, 0x131, 0x161, 0x198, 0x1CD, 0x210, + 0x21F, 0x1D1, 0x19D, 0x16B, 0x13B, 0x10B, 0xDF, 0xB5, 0x8F, 0x6D, 0x4E, 0x34, 0x20, 0x13, 0xA, 0x4, + 0x2, 0x4, 0x9, 0x15, 0x25, 0x3A, 0x55, 0x72, 0x92, 0xB4, 0xDC, 0x109, 0x138, 0x169, 0x19D, 0x1CE, + 0x214, 0x21E, 0x1D5, 0x1A4, 0x170, 0x13E, 0x110, 0xE5, 0xBB, 0x95, 0x72, 0x54, 0x3A, 0x26, 0x17, 0xD, + 0x8, 0x6, 0x8, 0x10, 0x1B, 0x2B, 0x40, 0x59, 0x79, 0x9A, 0xBF, 0xE7, 0x110, 0x13D, 0x169, 0x19B, + 0x1D6, 0x21C, 0x22A, 0x1DD, 0x1A6, 0x173, 0x146, 0x118, 0xEB, 0xC1, 0x9B, 0x79, 0x5A, 0x40, 0x2D, 0x1D, + 0x14, 0xD, 0xD, 0xE, 0x16, 0x21, 0x32, 0x47, 0x61, 0x7F, 0xA1, 0xC7, 0xEE, 0x118, 0x145, 0x174, + 0x1A8, 0x1DE, 0x21B, 0x22C, 0x1E1, 0x1AE, 0x17A, 0x14C, 0x11D, 0xF2, 0xC8, 0xA2, 0x80, 0x62, 0x48, 0x33, + 0x25, 0x1A, 0x15, 0x13, 0x16, 0x1D, 0x29, 0x3A, 0x4F, 0x69, 0x8A, 0xA8, 0xCD, 0xF5, 0x11D, 0x14C, + 0x17A, 0x1AE, 0x1E4, 0x227, 0x22C, 0x1E4, 0x1B2, 0x17D, 0x14F, 0x122, 0xF8, 0xCF, 0xA9, 0x87, 0x6A, 0x51, + 0x3C, 0x2D, 0x22, 0x1C, 0x1A, 0x1D, 0x24, 0x30, 0x41, 0x57, 0x71, 0x8E, 0xAF, 0xD5, 0xFA, 0x125, + 0x150, 0x180, 0x1B3, 0x1E7, 0x22B, 0x233, 0x1E6, 0x1B4, 0x184, 0x155, 0x128, 0x101, 0xD8, 0xB2, 0x92, 0x76, + 0x5B, 0x46, 0x37, 0x2D, 0x25, 0x24, 0x28, 0x2E, 0x3C, 0x4C, 0x62, 0x7A, 0x97, 0xB8, 0xDE, 0x105, + 0x12C, 0x157, 0x186, 0x1B7, 0x1EF, 0x231, 0x240, 0x1F4, 0x1C3, 0x191, 0x162, 0x136, 0x10C, 0xE5, 0xC0, 0xA1, + 0x83, 0x6C, 0x56, 0x47, 0x3C, 0x37, 0x34, 0x37, 0x3E, 0x4B, 0x5C, 0x71, 0x8C, 0xA7, 0xC6, 0xEA, + 0x112, 0x13B, 0x163, 0x193, 0x1C5, 0x1FD, 0x240, 0x24C, 0x205, 0x1D3, 0x1A2, 0x174, 0x145, 0x11F, 0xF7, 0xD5, + 0xB5, 0x99, 0x80, 0x6B, 0x5A, 0x51, 0x4B, 0x49, 0x4D, 0x54, 0x60, 0x72, 0x86, 0x9E, 0xBB, 0xDA, + 0xFE, 0x124, 0x14C, 0x177, 0x1A4, 0x1D6, 0x20E, 0x24F, 0x261, 0x21A, 0x1E8, 0x1B9, 0x188, 0x15A, 0x135, 0x10F, + 0xED, 0xCC, 0xB0, 0x96, 0x82, 0x74, 0x69, 0x64, 0x62, 0x65, 0x6E, 0x79, 0x89, 0x9D, 0xB6, 0xD1, + 0xF2, 0x113, 0x139, 0x162, 0x18B, 0x1BA, 0x1E9, 0x223, 0x263, 0x271, 0x229, 0x1FA, 0x1C9, 0x19C, 0x170, 0x149, + 0x125, 0x101, 0xE3, 0xC6, 0xAF, 0x9C, 0x8B, 0x81, 0x7C, 0x7A, 0x7E, 0x84, 0x90, 0xA1, 0xB6, 0xCE, + 0xE8, 0x107, 0x128, 0x14D, 0x174, 0x19F, 0x1CC, 0x1FB, 0x237, 0x276, 0x282, 0x23B, 0x207, 0x1D9, 0x1AE, 0x183, + 0x15B, 0x138, 0x116, 0xF8, 0xDD, 0xC6, 0xB1, 0xA4, 0x99, 0x94, 0x92, 0x95, 0x9C, 0xA8, 0xB7, 0xCD, + 0xE3, 0xFF, 0x11C, 0x13D, 0x161, 0x188, 0x1B2, 0x1E1, 0x210, 0x247, 0x28C, 0x290, 0x24A, 0x218, 0x1E9, 0x1BC, + 0x195, 0x16E, 0x14B, 0x12C, 0x10B, 0xF2, 0xDC, 0xC9, 0xBC, 0xB1, 0xAC, 0xA9, 0xAB, 0xB3, 0xBD, 0xCF, + 0xE1, 0xF6, 0x111, 0x12F, 0x14F, 0x174, 0x199, 0x1C1, 0x1F2, 0x21F, 0x258, 0x2A3, 0x2A6, 0x25D, 0x22C, 0x1FB, + 0x1D1, 0x1A7, 0x183, 0x160, 0x141, 0x125, 0x109, 0xF4, 0xE1, 0xD6, 0xC7, 0xC5, 0xC3, 0xC6, 0xCD, 0xD5, + 0xE8, 0xFA, 0x10E, 0x12B, 0x145, 0x164, 0x18A, 0x1B0, 0x1D6, 0x202, 0x232, 0x26E, 0x2BC, 0x2C2, 0x277, 0x242, + 0x215, 0x1EA, 0x1C2, 0x19E, 0x17C, 0x15B, 0x140, 0x126, 0x111, 0xFF, 0xF0, 0xE8, 0xE2, 0xE2, 0xE3, 0xEA, + 0xF7, 0x105, 0x115, 0x12B, 0x145, 0x162, 0x183, 0x1A2, 0x1CA, 0x1F1, 0x21B, 0x24E, 0x288, 0x2D2, 0x2EB, 0x296, + 0x261, 0x234, 0x209, 0x1E3, 0x1BD, 0x19C, 0x17E, 0x162, 0x148, 0x133, 0x123, 0x116, 0x10C, 0x104, 0x105, 0x104, + 0x10E, 0x118, 0x125, 0x138, 0x14B, 0x166, 0x180, 0x1A0, 0x1C3, 0x1E8, 0x214, 0x23E, 0x26E, 0x2B0, 0x303, 0x311, + 0x2BF, 0x28A, 0x258, 0x22D, 0x205, 0x1E0, 0x1BD, 0x1A1, 0x185, 0x16E, 0x158, 0x146, 0x13A, 0x131, 0x12F, 0x129, + 0x12B, 0x131, 0x13E, 0x14D, 0x15E, 0x171, 0x189, 0x1A3, 0x1C6, 0x1EA, 0x20C, 0x238, 0x261, 0x298, 0x2DB, 0x335, + 0x337, 0x2F3, 0x2B5, 0x281, 0x25D, 0x233, 0x20D, 0x1EB, 0x1CD, 0x1B4, 0x199, 0x187, 0x174, 0x167, 0x15C, 0x15A, + 0x154, 0x157, 0x161, 0x16A, 0x176, 0x18A, 0x19A, 0x1B4, 0x1CF, 0x1ED, 0x20E, 0x234, 0x261, 0x294, 0x2C7, 0x311, + 0x35D, + }, + }, + + { + /* Rgain */ + { + 0x399, 0x340, 0x2df, 0x289, 0x23e, 0x207, 0x1cd, 0x193, 0x170, 0x15f, 0x135, 0x113, 0xfc, 0xea, 0xdb, + 0xdd, 0xda, 0xd9, 0xe4, 0xee, 0xfd, 0x114, 0x12f, 0x14b, 0x16e, 0x19d, 0x1d4, 0x209, 0x24e, 0x29b, + 0x2ee, 0x364, 0x3e2, 0x38f, 0x329, 0x2c6, 0x276, 0x22a, 0x1ed, 0x1b5, 0x181, 0x15f, 0x147, 0x121, 0x102, + 0xf0, 0xd9, 0xd0, 0xc6, 0xc7, 0xcb, 0xd2, 0xdc, 0xee, 0x100, 0x11e, 0x138, 0x164, 0x18c, 0x1bb, + 0x1f4, 0x243, 0x286, 0x2d7, 0x341, 0x3a7, 0x372, 0x309, 0x2b0, 0x259, 0x20f, 0x1d6, 0x19a, 0x16c, 0x140, + 0x130, 0x109, 0xef, 0xdc, 0xc4, 0xb7, 0xb1, 0xaf, 0xb9, 0xbe, 0xc2, 0xd5, 0xeb, 0x105, 0x122, + 0x14c, 0x17a, 0x1a4, 0x1de, 0x225, 0x26f, 0x2b8, 0x319, 0x384, 0x355, 0x2ed, 0x290, 0x242, 0x1f7, 0x1bb, + 0x18a, 0x154, 0x12e, 0x10f, 0xee, 0xd8, 0xc6, 0xaf, 0xa7, 0x9b, 0x9c, 0xa6, 0xaa, 0xaf, 0xbe, + 0xd8, 0xf7, 0x110, 0x13a, 0x166, 0x191, 0x1c8, 0x216, 0x259, 0x2a3, 0x302, 0x365, 0x32a, 0x2d8, 0x276, + 0x229, 0x1e3, 0x1a6, 0x174, 0x140, 0x11c, 0xf6, 0xda, 0xc6, 0xaf, 0x9d, 0x92, 0x89, 0x88, 0x91, + 0x97, 0x9c, 0xac, 0xcb, 0xec, 0x102, 0x125, 0x150, 0x180, 0x1b6, 0x200, 0x247, 0x289, 0x2e8, 0x34f, + 0x30f, 0x2bb, 0x267, 0x213, 0x1cc, 0x194, 0x160, 0x130, 0x10d, 0xeb, 0xcc, 0xb1, 0x99, 0x87, 0x7c, + 0x77, 0x74, 0x79, 0x82, 0x8c, 0x9a, 0xba, 0xd7, 0xed, 0x115, 0x13c, 0x170, 0x1a4, 0x1e4, 0x22c, + 0x277, 0x2d2, 0x32a, 0x2f6, 0x2a9, 0x24f, 0x1ff, 0x1bd, 0x185, 0x14b, 0x124, 0xfd, 0xdb, 0xba, 0xa0, + 0x89, 0x76, 0x6c, 0x62, 0x61, 0x65, 0x71, 0x7b, 0x89, 0xa4, 0xc6, 0xde, 0x107, 0x129, 0x15a, + 0x191, 0x1c7, 0x213, 0x262, 0x2b4, 0x319, 0x2de, 0x28d, 0x23f, 0x1ef, 0x1b2, 0x179, 0x142, 0x114, 0xed, + 0xce, 0xa9, 0x8e, 0x79, 0x66, 0x5c, 0x51, 0x4f, 0x53, 0x5e, 0x6a, 0x76, 0x94, 0xae, 0xcf, + 0xf9, 0x11c, 0x14b, 0x17c, 0x1bf, 0x204, 0x248, 0x2a0, 0x2f5, 0x2c9, 0x282, 0x229, 0x1e0, 0x1a5, 0x16e, + 0x135, 0x109, 0xdb, 0xb8, 0x9b, 0x7d, 0x6a, 0x57, 0x4a, 0x41, 0x3f, 0x41, 0x4e, 0x5b, 0x6c, + 0x88, 0xa5, 0xc9, 0xeb, 0x112, 0x13e, 0x16f, 0x1b1, 0x1f5, 0x23d, 0x293, 0x2e3, 0x2bf, 0x271, 0x21c, + 0x1d1, 0x199, 0x15e, 0x129, 0xf9, 0xcf, 0xab, 0x92, 0x72, 0x5b, 0x47, 0x3b, 0x31, 0x2f, 0x32, + 0x3f, 0x4b, 0x60, 0x7b, 0x9c, 0xc1, 0xe7, 0x105, 0x136, 0x166, 0x1a6, 0x1ea, 0x232, 0x28d, 0x2d4, + 0x2b9, 0x262, 0x211, 0x1c7, 0x187, 0x14e, 0x11b, 0xef, 0xc9, 0xa2, 0x81, 0x63, 0x4d, 0x39, 0x2b, + 0x21, 0x21, 0x26, 0x2f, 0x3e, 0x58, 0x70, 0x8f, 0xb5, 0xda, 0xfb, 0x12a, 0x15c, 0x196, 0x1e1, + 0x229, 0x283, 0x2c8, 0x2ab, 0x25a, 0x205, 0x1bd, 0x178, 0x145, 0x111, 0xe8, 0xc1, 0x9a, 0x76, 0x5b, + 0x40, 0x2c, 0x1b, 0x15, 0x12, 0x19, 0x26, 0x36, 0x4e, 0x69, 0x80, 0xaa, 0xce, 0xf3, 0x122, + 0x153, 0x18a, 0x1d6, 0x21e, 0x277, 0x2c4, 0x29c, 0x24e, 0x1fb, 0x1b0, 0x16e, 0x13c, 0x10d, 0xe0, 0xb5, + 0x92, 0x6e, 0x53, 0x37, 0x1f, 0x11, 0x8, 0x7, 0x10, 0x1a, 0x2d, 0x46, 0x61, 0x7b, 0x9c, + 0xc3, 0xee, 0x118, 0x14a, 0x187, 0x1ca, 0x210, 0x268, 0x2b7, 0x291, 0x241, 0x1f2, 0x1ad, 0x170, 0x13a, + 0x10a, 0xdd, 0xb1, 0x8c, 0x69, 0x49, 0x30, 0x1c, 0xc, 0x1, 0x0, 0x8, 0x13, 0x26, 0x3f, + 0x58, 0x77, 0x97, 0xbc, 0xe9, 0x114, 0x146, 0x17c, 0x1c6, 0x20c, 0x261, 0x2aa, 0x2bc, 0x23c, 0x1f5, + 0x1b0, 0x16b, 0x134, 0x106, 0xde, 0xb1, 0x88, 0x61, 0x44, 0x2e, 0x17, 0x4, 0x0, 0x0, 0x4, + 0xe, 0x20, 0x3a, 0x54, 0x71, 0x95, 0xba, 0xe5, 0x113, 0x141, 0x17f, 0x1bd, 0x206, 0x258, 0x2a4, + 0x31e, 0x258, 0x1f8, 0x1ad, 0x168, 0x12f, 0x102, 0xd9, 0xaf, 0x84, 0x63, 0x44, 0x2d, 0x12, 0x3, + 0x5, 0x3, 0x1, 0xb, 0x1d, 0x36, 0x53, 0x6f, 0x92, 0xb2, 0xe5, 0x110, 0x13e, 0x17b, 0x1c1, + 0x204, 0x257, 0x2a7, 0x33a, 0x276, 0x1f3, 0x1a9, 0x165, 0x12f, 0xfd, 0xd3, 0xab, 0x85, 0x62, 0x44, + 0x2d, 0x13, 0x2, 0x3, 0x3, 0x2, 0x8, 0x1d, 0x35, 0x4d, 0x6e, 0x93, 0xb6, 0xe5, 0x10f, + 0x141, 0x179, 0x1ba, 0x202, 0x259, 0x29f, 0x336, 0x260, 0x1ef, 0x1a7, 0x166, 0x12b, 0xfd, 0xd3, 0xa7, + 0x85, 0x60, 0x42, 0x2e, 0x15, 0x5, 0x2, 0x3, 0x3, 0x9, 0x1d, 0x35, 0x4f, 0x6b, 0x91, + 0xb7, 0xe3, 0x111, 0x13f, 0x175, 0x1ba, 0x202, 0x255, 0x29b, 0x2f0, 0x239, 0x1e6, 0x1a5, 0x165, 0x12e, + 0x103, 0xd4, 0xac, 0x87, 0x63, 0x48, 0x30, 0x18, 0x7, 0x2, 0x1, 0x5, 0xb, 0x20, 0x36, + 0x51, 0x70, 0x96, 0xb8, 0xe4, 0x112, 0x13f, 0x176, 0x1b8, 0x208, 0x256, 0x2a4, 0x2a9, 0x256, 0x1ef, + 0x1aa, 0x16d, 0x134, 0x104, 0xda, 0xaf, 0x8b, 0x67, 0x4c, 0x31, 0x1d, 0xb, 0x5, 0x4, 0x8, + 0x10, 0x22, 0x3b, 0x55, 0x73, 0x94, 0xbb, 0xe6, 0x116, 0x144, 0x179, 0x1ba, 0x208, 0x25d, 0x2ad, + 0x2d2, 0x296, 0x1f4, 0x1b0, 0x171, 0x136, 0x106, 0xdc, 0xb6, 0x91, 0x70, 0x51, 0x38, 0x24, 0x15, + 0xb, 0xa, 0xd, 0x18, 0x28, 0x40, 0x5b, 0x78, 0x99, 0xbf, 0xed, 0x11c, 0x14b, 0x181, 0x1c3, + 0x20c, 0x267, 0x2ac, 0x2e8, 0x2ae, 0x1f8, 0x1b5, 0x175, 0x13e, 0x10e, 0xe4, 0xbc, 0x96, 0x78, 0x58, + 0x40, 0x2a, 0x1d, 0x17, 0x14, 0x1a, 0x24, 0x32, 0x46, 0x63, 0x7e, 0xa2, 0xc5, 0xf1, 0x11e, + 0x151, 0x188, 0x1c8, 0x213, 0x26e, 0x2b8, 0x2d0, 0x2a0, 0x202, 0x1bf, 0x17e, 0x144, 0x118, 0xec, 0xc0, + 0x9f, 0x7c, 0x60, 0x4a, 0x37, 0x2e, 0x2c, 0x1d, 0x23, 0x2e, 0x3d, 0x4f, 0x6b, 0x87, 0xad, + 0xcd, 0xf7, 0x122, 0x157, 0x190, 0x1ce, 0x21a, 0x271, 0x2bb, 0x2b0, 0x278, 0x20a, 0x1c6, 0x186, 0x14f, + 0x120, 0xf5, 0xcc, 0xa8, 0x89, 0x70, 0x58, 0x45, 0x41, 0x39, 0x2d, 0x30, 0x3a, 0x4b, 0x5e, + 0x74, 0x91, 0xb8, 0xd4, 0xfe, 0x133, 0x167, 0x19b, 0x1de, 0x220, 0x277, 0x2c7, 0x2be, 0x26f, 0x216, + 0x1dc, 0x194, 0x158, 0x12d, 0x101, 0xd9, 0xb5, 0x99, 0x78, 0x64, 0x53, 0x49, 0x47, 0x3d, 0x3d, + 0x48, 0x57, 0x68, 0x7f, 0x9d, 0xc0, 0xdd, 0x108, 0x13f, 0x16d, 0x1a3, 0x1e7, 0x229, 0x281, 0x2cf, + 0x2d2, 0x284, 0x225, 0x1e9, 0x1a8, 0x166, 0x136, 0x108, 0xe4, 0xc5, 0xa2, 0x87, 0x71, 0x63, 0x54, + 0x55, 0x4c, 0x4f, 0x58, 0x63, 0x79, 0x8c, 0xab, 0xca, 0xec, 0x116, 0x146, 0x174, 0x1ad, 0x1f2, + 0x23b, 0x291, 0x2e1, 0x2e4, 0x299, 0x236, 0x1f8, 0x1bb, 0x173, 0x144, 0x119, 0xf0, 0xcf, 0xb5, 0x9a, + 0x81, 0x72, 0x63, 0x5d, 0x62, 0x5f, 0x66, 0x74, 0x86, 0x9f, 0xb7, 0xd6, 0xfb, 0x11f, 0x14e, + 0x184, 0x1be, 0x1ff, 0x249, 0x2a3, 0x2ed, 0x2f4, 0x2a6, 0x256, 0x203, 0x1c0, 0x184, 0x156, 0x122, 0x100, + 0xe1, 0xc0, 0xa8, 0x95, 0x7f, 0x73, 0x70, 0x71, 0x6f, 0x78, 0x83, 0x93, 0xab, 0xc4, 0xe3, + 0x107, 0x12f, 0x161, 0x196, 0x1ce, 0x213, 0x25c, 0x2b2, 0x306, 0x30c, 0x2b8, 0x26c, 0x214, 0x1ce, 0x19b, + 0x164, 0x135, 0x110, 0xf2, 0xd4, 0xb9, 0xa4, 0x93, 0x86, 0x82, 0x7f, 0x7f, 0x86, 0x96, 0xa6, + 0xbd, 0xd7, 0xf2, 0x115, 0x140, 0x171, 0x1a6, 0x1da, 0x224, 0x270, 0x2c7, 0x31c, 0x322, 0x2cd, 0x27f, + 0x228, 0x1e2, 0x1ac, 0x177, 0x148, 0x123, 0x101, 0xe6, 0xcd, 0xb2, 0xa5, 0x99, 0x92, 0x8e, 0x90, + 0x9c, 0xa7, 0xb6, 0xce, 0xe8, 0x101, 0x127, 0x14f, 0x181, 0x1b9, 0x1f7, 0x23c, 0x287, 0x2df, 0x338, + 0x339, 0x2e8, 0x28d, 0x23c, 0x1fb, 0x1c0, 0x18d, 0x159, 0x133, 0x113, 0xf6, 0xdb, 0xc5, 0xba, 0xaa, + 0xa3, 0xa1, 0xa5, 0xae, 0xbb, 0xca, 0xde, 0xf8, 0x115, 0x138, 0x164, 0x195, 0x1e0, 0x210, 0x250, + 0x2a1, 0x2fb, 0x355, 0x35c, 0x309, 0x2a6, 0x257, 0x216, 0x1d3, 0x19d, 0x171, 0x144, 0x128, 0x107, 0xf1, + 0xdf, 0xce, 0xc2, 0xb8, 0xb4, 0xba, 0xc0, 0xcf, 0xdf, 0xf2, 0x10d, 0x128, 0x152, 0x177, 0x1b8, + 0x1fe, 0x228, 0x26e, 0x2bd, 0x316, 0x376, 0x37f, 0x318, 0x2be, 0x26e, 0x229, 0x1e5, 0x1b1, 0x17c, 0x159, + 0x137, 0x118, 0x100, 0xeb, 0xdc, 0xd3, 0xc6, 0xc6, 0xcc, 0xd4, 0xdd, 0xed, 0x102, 0x11f, 0x138, + 0x15d, 0x18b, 0x1cd, 0x207, 0x23d, 0x27d, 0x2cc, 0x331, 0x388, + }, + + /* Grgain */ + { + 0x324, 0x2cf, 0x279, 0x22e, 0x1f5, 0x1c7, 0x191, 0x168, 0x148, 0x136, 0x113, 0xf4, 0xe4, 0xd4, 0xcd, + 0xc9, 0xc9, 0xcc, 0xd4, 0xe2, 0xf2, 0x103, 0x11f, 0x139, 0x164, 0x186, 0x1b6, 0x1eb, 0x22c, 0x270, + 0x2ba, 0x321, 0x392, 0x30d, 0x2b7, 0x267, 0x220, 0x1e1, 0x1b4, 0x183, 0x156, 0x13a, 0x126, 0x105, 0xe6, + 0xd7, 0xc3, 0xbd, 0xb8, 0xb7, 0xbf, 0xc5, 0xd0, 0xe4, 0xf3, 0x10e, 0x12b, 0x151, 0x17a, 0x1a5, + 0x1d8, 0x21f, 0x260, 0x2a7, 0x305, 0x367, 0x2f1, 0x29d, 0x250, 0x207, 0x1cb, 0x19a, 0x16c, 0x141, 0x11f, + 0x10f, 0xe9, 0xd6, 0xc2, 0xae, 0xa8, 0xa5, 0xa5, 0xae, 0xb1, 0xba, 0xcf, 0xe0, 0xfa, 0x115, + 0x13d, 0x16a, 0x193, 0x1c0, 0x208, 0x245, 0x28d, 0x2eb, 0x349, 0x2d2, 0x284, 0x238, 0x1f8, 0x1b8, 0x182, + 0x15b, 0x130, 0x109, 0xec, 0xd6, 0xc5, 0xb1, 0x9c, 0x92, 0x8f, 0x8d, 0x97, 0xa0, 0xa6, 0xb8, + 0xd1, 0xef, 0x106, 0x12c, 0x155, 0x17c, 0x1ae, 0x1f5, 0x235, 0x275, 0x2cd, 0x32d, 0x2b8, 0x26d, 0x225, + 0x1e2, 0x1a9, 0x173, 0x148, 0x11f, 0xfa, 0xdf, 0xc5, 0xaf, 0x9c, 0x89, 0x80, 0x7c, 0x7e, 0x88, + 0x8e, 0x96, 0xa5, 0xc5, 0xe3, 0xf7, 0x11b, 0x142, 0x16e, 0x1a1, 0x1e6, 0x227, 0x266, 0x2b8, 0x316, + 0x29c, 0x259, 0x213, 0x1cf, 0x197, 0x165, 0x138, 0x111, 0xf1, 0xd0, 0xb4, 0x9e, 0x8b, 0x7b, 0x71, + 0x6a, 0x6d, 0x72, 0x7d, 0x85, 0x94, 0xb3, 0xd1, 0xe8, 0x10b, 0x134, 0x15e, 0x192, 0x1d1, 0x210, + 0x255, 0x2a7, 0x2fe, 0x28b, 0x247, 0x201, 0x1bf, 0x18e, 0x15b, 0x12a, 0x104, 0xe4, 0xc4, 0xa5, 0x8e, + 0x79, 0x6b, 0x60, 0x5b, 0x59, 0x5d, 0x6a, 0x77, 0x85, 0xa0, 0xbf, 0xd8, 0xfe, 0x120, 0x151, + 0x183, 0x1b7, 0x1f8, 0x243, 0x28e, 0x2e3, 0x27a, 0x239, 0x1ef, 0x1b4, 0x183, 0x151, 0x11b, 0xf6, 0xd3, + 0xb5, 0x96, 0x7d, 0x6b, 0x5b, 0x4d, 0x49, 0x49, 0x4b, 0x58, 0x66, 0x77, 0x94, 0xaa, 0xc9, + 0xf3, 0x115, 0x143, 0x176, 0x1aa, 0x1e7, 0x231, 0x281, 0x2cc, 0x26b, 0x22a, 0x1e5, 0x1a6, 0x174, 0x144, + 0x111, 0xe8, 0xc4, 0xa5, 0x88, 0x70, 0x5d, 0x4d, 0x40, 0x39, 0x39, 0x3e, 0x4a, 0x59, 0x69, + 0x86, 0xa2, 0xca, 0xea, 0x10b, 0x137, 0x168, 0x19e, 0x1dd, 0x223, 0x272, 0x2b8, 0x25d, 0x21c, 0x1d8, + 0x199, 0x168, 0x137, 0x107, 0xe0, 0xbc, 0x9b, 0x81, 0x66, 0x51, 0x40, 0x33, 0x2c, 0x2d, 0x2d, + 0x3c, 0x4c, 0x5f, 0x7b, 0x9a, 0xc2, 0xe2, 0x100, 0x131, 0x15d, 0x196, 0x1d6, 0x21d, 0x26b, 0x2ad, + 0x253, 0x214, 0x1cd, 0x18f, 0x159, 0x12c, 0xfc, 0xd7, 0xb2, 0x93, 0x73, 0x59, 0x43, 0x34, 0x26, + 0x20, 0x1e, 0x22, 0x30, 0x3f, 0x57, 0x70, 0x90, 0xb8, 0xd8, 0xf7, 0x124, 0x154, 0x188, 0x1d0, + 0x211, 0x262, 0x2a4, 0x24f, 0x208, 0x1c2, 0x189, 0x150, 0x121, 0xf4, 0xd0, 0xac, 0x89, 0x6b, 0x4e, + 0x3b, 0x28, 0x18, 0x15, 0xf, 0x18, 0x25, 0x36, 0x50, 0x69, 0x83, 0xac, 0xcb, 0xef, 0x11e, + 0x14b, 0x180, 0x1c7, 0x206, 0x25a, 0x2a3, 0x247, 0x201, 0x1bd, 0x180, 0x14c, 0x119, 0xf2, 0xcb, 0xa4, + 0x82, 0x65, 0x47, 0x31, 0x1d, 0x10, 0x8, 0x6, 0xe, 0x1a, 0x2f, 0x49, 0x61, 0x7c, 0x9e, + 0xc3, 0xec, 0x116, 0x143, 0x17a, 0x1c0, 0x201, 0x24c, 0x292, 0x23a, 0x1f7, 0x1b8, 0x17b, 0x146, 0x116, + 0xf0, 0xc8, 0xa2, 0x7e, 0x5e, 0x43, 0x2c, 0x17, 0x7, 0x0, 0x0, 0x8, 0x16, 0x28, 0x43, + 0x59, 0x77, 0x99, 0xbc, 0xe4, 0x113, 0x141, 0x178, 0x1b7, 0x1fa, 0x246, 0x28c, 0x263, 0x1f3, 0x1b6, + 0x17e, 0x141, 0x114, 0xec, 0xc6, 0xa1, 0x7a, 0x5a, 0x3e, 0x26, 0xf, 0x3, 0x2, 0x1, 0x4, + 0xf, 0x22, 0x3f, 0x56, 0x74, 0x96, 0xb9, 0xe2, 0x111, 0x13d, 0x172, 0x1b3, 0x1f3, 0x240, 0x285, + 0x2c8, 0x207, 0x1b7, 0x17e, 0x13f, 0x112, 0xe8, 0xc4, 0x9e, 0x77, 0x56, 0x3b, 0x24, 0xe, 0x2, + 0x6, 0x1, 0x1, 0xb, 0x21, 0x3b, 0x52, 0x70, 0x97, 0xb8, 0xe2, 0x111, 0x13c, 0x171, 0x1b3, + 0x1ed, 0x240, 0x27f, 0x2dc, 0x224, 0x1b4, 0x17b, 0x13e, 0x10d, 0xe6, 0xbf, 0x98, 0x76, 0x56, 0x3c, + 0x25, 0x10, 0x1, 0x6, 0x5, 0x4, 0xb, 0x1f, 0x38, 0x51, 0x71, 0x94, 0xb8, 0xe3, 0x10e, + 0x13d, 0x16f, 0x1b2, 0x1ed, 0x23e, 0x281, 0x2d0, 0x20f, 0x1b3, 0x17b, 0x140, 0x112, 0xe5, 0xbe, 0x98, + 0x77, 0x57, 0x3c, 0x27, 0x14, 0x3, 0x3, 0x2, 0x5, 0xb, 0x20, 0x38, 0x52, 0x73, 0x93, + 0xb7, 0xe3, 0x10e, 0x13a, 0x16e, 0x1b0, 0x1ef, 0x23f, 0x27e, 0x291, 0x1f1, 0x1af, 0x177, 0x142, 0x111, + 0xe5, 0xc3, 0x9d, 0x79, 0x5a, 0x3d, 0x2b, 0x13, 0x7, 0x2, 0x2, 0x6, 0xe, 0x22, 0x3c, + 0x54, 0x74, 0x96, 0xbb, 0xe6, 0x10f, 0x13c, 0x170, 0x1b1, 0x1f0, 0x23f, 0x27f, 0x251, 0x209, 0x1b6, + 0x17d, 0x144, 0x116, 0xe9, 0xc5, 0x9f, 0x7e, 0x5f, 0x44, 0x2d, 0x1a, 0xa, 0x5, 0x7, 0x9, + 0x13, 0x28, 0x3f, 0x5a, 0x75, 0x99, 0xbb, 0xe8, 0x112, 0x13d, 0x176, 0x1b2, 0x1f4, 0x245, 0x287, + 0x28d, 0x244, 0x1b7, 0x17f, 0x14b, 0x118, 0xee, 0xc7, 0xa5, 0x83, 0x64, 0x4c, 0x35, 0x22, 0x13, + 0xd, 0xa, 0xf, 0x1c, 0x2d, 0x42, 0x5e, 0x7d, 0x9d, 0xbe, 0xed, 0x116, 0x145, 0x17b, 0x1b6, + 0x1f8, 0x24a, 0x28c, 0x29f, 0x259, 0x1bb, 0x184, 0x14f, 0x11f, 0xf4, 0xcd, 0xa7, 0x8c, 0x6e, 0x52, + 0x3d, 0x29, 0x1c, 0x19, 0x14, 0x1a, 0x26, 0x36, 0x4a, 0x65, 0x84, 0xa7, 0xc8, 0xef, 0x11e, + 0x14d, 0x181, 0x1b9, 0x200, 0x252, 0x296, 0x27e, 0x253, 0x1c3, 0x18a, 0x156, 0x126, 0xfc, 0xd8, 0xb1, + 0x96, 0x76, 0x5b, 0x46, 0x34, 0x2e, 0x2d, 0x1f, 0x26, 0x2f, 0x3f, 0x55, 0x6c, 0x8c, 0xb3, + 0xd1, 0xf2, 0x127, 0x154, 0x185, 0x1c3, 0x207, 0x254, 0x2a5, 0x254, 0x220, 0x1d0, 0x195, 0x15b, 0x12d, + 0x105, 0xe0, 0xba, 0x9d, 0x7f, 0x66, 0x52, 0x3f, 0x40, 0x39, 0x30, 0x31, 0x3e, 0x4f, 0x63, + 0x78, 0x98, 0xb9, 0xd8, 0xfe, 0x135, 0x162, 0x18e, 0x1cc, 0x20c, 0x25e, 0x2a0, 0x265, 0x222, 0x1d8, + 0x1a8, 0x169, 0x134, 0x111, 0xe7, 0xc5, 0xa7, 0x8a, 0x71, 0x5c, 0x4e, 0x49, 0x48, 0x3f, 0x40, + 0x4c, 0x5c, 0x6e, 0x81, 0xa0, 0xc2, 0xe2, 0x107, 0x13b, 0x169, 0x199, 0x1d5, 0x215, 0x268, 0x2ac, + 0x277, 0x235, 0x1e4, 0x1b6, 0x179, 0x141, 0x11a, 0xf4, 0xd1, 0xb3, 0x99, 0x7d, 0x6c, 0x5c, 0x51, + 0x53, 0x4f, 0x4f, 0x5a, 0x69, 0x7a, 0x8f, 0xab, 0xcb, 0xec, 0x112, 0x145, 0x16f, 0x1a6, 0x1e1, + 0x221, 0x270, 0x2bd, 0x282, 0x244, 0x1f2, 0x1c0, 0x188, 0x14f, 0x125, 0xff, 0xde, 0xbe, 0xa5, 0x8f, + 0x79, 0x6c, 0x5e, 0x5e, 0x63, 0x60, 0x67, 0x75, 0x89, 0xa0, 0xb8, 0xd8, 0xf8, 0x11e, 0x14c, + 0x178, 0x1ae, 0x1ec, 0x231, 0x282, 0x2cb, 0x293, 0x24c, 0x20d, 0x1cb, 0x18f, 0x15e, 0x130, 0x10b, 0xea, + 0xce, 0xb3, 0x9d, 0x8c, 0x7a, 0x70, 0x70, 0x70, 0x70, 0x76, 0x87, 0x96, 0xae, 0xc7, 0xe3, + 0x106, 0x12d, 0x15b, 0x18a, 0x1bb, 0x1f9, 0x242, 0x28f, 0x2dc, 0x2a6, 0x25e, 0x221, 0x1d6, 0x19c, 0x16e, + 0x141, 0x11a, 0xfb, 0xdd, 0xc2, 0xad, 0x9a, 0x8b, 0x82, 0x7e, 0x7d, 0x7c, 0x88, 0x97, 0xa6, + 0xbd, 0xd6, 0xf3, 0x114, 0x13b, 0x168, 0x197, 0x1cd, 0x209, 0x257, 0x2a7, 0x2f4, 0x2b9, 0x271, 0x230, + 0x1e8, 0x1b0, 0x17d, 0x152, 0x12a, 0x10d, 0xee, 0xd4, 0xbf, 0xaa, 0x9c, 0x93, 0x90, 0x8e, 0x90, + 0x99, 0xa8, 0xb8, 0xce, 0xe6, 0x103, 0x124, 0x14d, 0x179, 0x1ad, 0x1e0, 0x21e, 0x268, 0x2b7, 0x306, + 0x2cd, 0x291, 0x240, 0x1fc, 0x1c2, 0x190, 0x166, 0x13c, 0x11e, 0xfe, 0xe7, 0xcf, 0xbc, 0xb1, 0xa8, + 0xa3, 0xa0, 0xa3, 0xac, 0xba, 0xca, 0xe0, 0xf7, 0x114, 0x138, 0x15e, 0x18a, 0x1d0, 0x1f8, 0x233, + 0x27d, 0x2cf, 0x31d, 0x2ef, 0x2a9, 0x257, 0x213, 0x1db, 0x1a8, 0x178, 0x151, 0x12d, 0x111, 0xf8, 0xe4, + 0xd4, 0xc7, 0xbb, 0xb2, 0xb6, 0xb5, 0xc1, 0xcd, 0xdf, 0xf2, 0x10b, 0x126, 0x14c, 0x173, 0x1ac, + 0x1ee, 0x20f, 0x250, 0x295, 0x2ea, 0x33b, 0x317, 0x2b7, 0x268, 0x228, 0x1ef, 0x1b5, 0x189, 0x161, 0x13b, + 0x121, 0x106, 0xf0, 0xde, 0xd7, 0xc9, 0xc2, 0xc3, 0xc8, 0xd3, 0xd9, 0xed, 0x100, 0x119, 0x133, + 0x15a, 0x189, 0x1c1, 0x1fd, 0x221, 0x260, 0x2a9, 0x302, 0x357, + }, + + /* Gbgain */ + { + 0x32b, 0x2cd, 0x277, 0x232, 0x1f2, 0x1c6, 0x18f, 0x166, 0x148, 0x136, 0x116, 0xf5, 0xe3, 0xd5, 0xc9, + 0xc8, 0xc9, 0xc9, 0xd5, 0xdf, 0xf1, 0x102, 0x11c, 0x138, 0x15a, 0x187, 0x1b4, 0x1e7, 0x22d, 0x270, + 0x2bd, 0x323, 0x38d, 0x313, 0x2b9, 0x267, 0x21e, 0x1e1, 0x1b1, 0x182, 0x154, 0x13b, 0x124, 0x104, 0xe7, + 0xd9, 0xc5, 0xbb, 0xb4, 0xb6, 0xbf, 0xc4, 0xd1, 0xe3, 0xf4, 0x10d, 0x12b, 0x151, 0x178, 0x1a4, + 0x1d7, 0x21b, 0x25d, 0x2a6, 0x306, 0x367, 0x2f4, 0x29e, 0x24d, 0x20b, 0x1ca, 0x198, 0x16d, 0x141, 0x11b, + 0x10d, 0xea, 0xd1, 0xc4, 0xb1, 0xa8, 0xa3, 0xa3, 0xb0, 0xb3, 0xb9, 0xc9, 0xdf, 0xfb, 0x116, + 0x13d, 0x168, 0x190, 0x1c2, 0x204, 0x243, 0x28e, 0x2ec, 0x348, 0x2da, 0x285, 0x239, 0x1f6, 0x1b9, 0x187, + 0x15a, 0x12d, 0x10a, 0xef, 0xd3, 0xbf, 0xb0, 0x9e, 0x92, 0x8e, 0x91, 0x9a, 0x9f, 0xa6, 0xb6, + 0xce, 0xeb, 0x102, 0x12d, 0x159, 0x17b, 0x1b3, 0x1f7, 0x235, 0x27b, 0x2d0, 0x32a, 0x2b8, 0x26e, 0x221, + 0x1e4, 0x1a8, 0x176, 0x149, 0x11e, 0xfe, 0xdf, 0xc5, 0xaf, 0x9b, 0x8c, 0x80, 0x7e, 0x7a, 0x89, + 0x8e, 0x98, 0xa6, 0xc4, 0xe2, 0xf5, 0x119, 0x142, 0x16f, 0x19f, 0x1e4, 0x227, 0x269, 0x2ba, 0x315, + 0x2a3, 0x25b, 0x213, 0x1d0, 0x193, 0x163, 0x137, 0x10e, 0xee, 0xd2, 0xb5, 0xa0, 0x8a, 0x7a, 0x71, + 0x6b, 0x6a, 0x71, 0x7c, 0x84, 0x95, 0xb2, 0xcf, 0xe9, 0x109, 0x133, 0x160, 0x18e, 0x1cd, 0x210, + 0x253, 0x2a1, 0x2fb, 0x28e, 0x249, 0x201, 0x1bf, 0x18a, 0x157, 0x12d, 0x103, 0xe3, 0xc4, 0xa2, 0x8e, + 0x78, 0x69, 0x60, 0x5a, 0x58, 0x5d, 0x6c, 0x76, 0x86, 0xa1, 0xc0, 0xdb, 0xfc, 0x11f, 0x14e, + 0x182, 0x1b9, 0x1f8, 0x242, 0x290, 0x2e7, 0x279, 0x238, 0x1ef, 0x1b4, 0x180, 0x152, 0x123, 0xf5, 0xd4, + 0xb5, 0x95, 0x7e, 0x6b, 0x59, 0x50, 0x48, 0x47, 0x4e, 0x58, 0x66, 0x75, 0x92, 0xaa, 0xca, + 0xf1, 0x114, 0x13f, 0x171, 0x1ab, 0x1e9, 0x233, 0x27f, 0x2c9, 0x270, 0x22b, 0x1e1, 0x1a5, 0x178, 0x147, + 0x115, 0xea, 0xc5, 0xa5, 0x8a, 0x73, 0x5e, 0x4d, 0x41, 0x3b, 0x3a, 0x3d, 0x4b, 0x59, 0x6a, + 0x84, 0xa2, 0xc5, 0xe7, 0x10c, 0x136, 0x165, 0x19e, 0x1de, 0x225, 0x271, 0x2bd, 0x268, 0x222, 0x1da, + 0x19f, 0x168, 0x137, 0x108, 0xdf, 0xbb, 0x9a, 0x7f, 0x64, 0x52, 0x40, 0x35, 0x2c, 0x2c, 0x2d, + 0x3d, 0x4b, 0x5f, 0x7a, 0x9b, 0xc2, 0xe1, 0x101, 0x12e, 0x15c, 0x198, 0x1d9, 0x21e, 0x26a, 0x2ae, + 0x258, 0x217, 0x1ce, 0x193, 0x15c, 0x12a, 0xff, 0xd5, 0xb1, 0x94, 0x75, 0x59, 0x44, 0x32, 0x26, + 0x1e, 0x1e, 0x20, 0x30, 0x41, 0x57, 0x70, 0x8d, 0xb6, 0xd7, 0xf7, 0x125, 0x155, 0x18c, 0x1d2, + 0x212, 0x261, 0x2a7, 0x24f, 0x20b, 0x1c5, 0x188, 0x154, 0x122, 0xf8, 0xce, 0xac, 0x8e, 0x6c, 0x52, + 0x3a, 0x27, 0x19, 0x13, 0x10, 0x18, 0x24, 0x36, 0x50, 0x68, 0x82, 0xaa, 0xca, 0xee, 0x11e, + 0x14d, 0x182, 0x1c2, 0x205, 0x259, 0x29d, 0x241, 0x201, 0x1bd, 0x184, 0x14f, 0x11c, 0xf2, 0xcc, 0xa5, + 0x85, 0x65, 0x4a, 0x30, 0x1e, 0x11, 0x7, 0x7, 0xd, 0x1b, 0x2f, 0x48, 0x5f, 0x7d, 0x9e, + 0xc3, 0xeb, 0x118, 0x148, 0x17b, 0x1c0, 0x1ff, 0x24d, 0x297, 0x23b, 0x1fa, 0x1b8, 0x17d, 0x149, 0x116, + 0xee, 0xcc, 0xa3, 0x80, 0x60, 0x44, 0x2a, 0x18, 0x7, 0x0, 0x0, 0x9, 0x14, 0x28, 0x43, + 0x58, 0x78, 0x98, 0xbd, 0xe7, 0x113, 0x142, 0x172, 0x1b4, 0x1fa, 0x245, 0x28a, 0x26b, 0x1fb, 0x1ba, + 0x180, 0x147, 0x117, 0xef, 0xca, 0xa1, 0x7c, 0x5b, 0x40, 0x28, 0x11, 0x4, 0x3, 0x1, 0x6, + 0x10, 0x23, 0x3e, 0x55, 0x75, 0x98, 0xba, 0xe5, 0x112, 0x13e, 0x171, 0x1b0, 0x1f4, 0x23e, 0x28b, + 0x2ca, 0x20e, 0x1bd, 0x17f, 0x142, 0x114, 0xe8, 0xc5, 0x9e, 0x79, 0x5a, 0x3b, 0x27, 0x10, 0x2, + 0x4, 0x2, 0x0, 0xb, 0x21, 0x37, 0x54, 0x73, 0x95, 0xb9, 0xe3, 0x111, 0x13c, 0x170, 0x1b0, + 0x1f2, 0x23e, 0x286, 0x2de, 0x22a, 0x1b6, 0x17e, 0x140, 0x113, 0xe5, 0xbe, 0x98, 0x79, 0x5a, 0x3a, + 0x27, 0x11, 0x1, 0x3, 0x5, 0x3, 0xb, 0x21, 0x37, 0x52, 0x71, 0x92, 0xb8, 0xe3, 0x10f, + 0x13c, 0x171, 0x1b3, 0x1f2, 0x239, 0x27f, 0x2d6, 0x215, 0x1b0, 0x179, 0x13d, 0x113, 0xe7, 0xbe, 0x99, + 0x79, 0x58, 0x3e, 0x29, 0x15, 0x4, 0x1, 0x4, 0x5, 0xb, 0x1f, 0x39, 0x53, 0x73, 0x94, + 0xb8, 0xe1, 0x10d, 0x138, 0x16d, 0x1b2, 0x1f2, 0x23d, 0x281, 0x293, 0x1f4, 0x1b0, 0x179, 0x144, 0x114, + 0xe6, 0xc0, 0x9c, 0x7c, 0x5a, 0x41, 0x2c, 0x16, 0x7, 0x2, 0x4, 0x7, 0xe, 0x21, 0x39, + 0x56, 0x74, 0x96, 0xbc, 0xe4, 0x10f, 0x139, 0x16e, 0x1ae, 0x1f4, 0x242, 0x282, 0x253, 0x210, 0x1b5, + 0x17d, 0x146, 0x115, 0xec, 0xc4, 0x9e, 0x82, 0x5e, 0x46, 0x2e, 0x1a, 0xb, 0x6, 0x7, 0x9, + 0x14, 0x25, 0x3f, 0x59, 0x78, 0x99, 0xbb, 0xe6, 0x114, 0x13d, 0x175, 0x1b1, 0x1f5, 0x247, 0x287, + 0x285, 0x24a, 0x1ba, 0x182, 0x14b, 0x11b, 0xef, 0xca, 0xa5, 0x84, 0x66, 0x4a, 0x36, 0x23, 0x15, + 0xf, 0xb, 0x10, 0x1d, 0x2c, 0x46, 0x5f, 0x7c, 0x9e, 0xc1, 0xeb, 0x117, 0x143, 0x17c, 0x1b8, + 0x1f8, 0x249, 0x293, 0x298, 0x25e, 0x1c1, 0x188, 0x151, 0x120, 0xf3, 0xcf, 0xac, 0x8e, 0x6e, 0x54, + 0x3f, 0x2a, 0x1d, 0x1b, 0x13, 0x1a, 0x26, 0x37, 0x4c, 0x67, 0x83, 0xa9, 0xc6, 0xf2, 0x11f, + 0x14a, 0x182, 0x1ba, 0x1fe, 0x250, 0x292, 0x27c, 0x251, 0x1c5, 0x18b, 0x159, 0x129, 0xfd, 0xd6, 0xb1, + 0x96, 0x79, 0x5b, 0x47, 0x34, 0x2e, 0x2d, 0x1f, 0x25, 0x33, 0x41, 0x56, 0x6e, 0x8e, 0xb3, + 0xce, 0xf5, 0x129, 0x155, 0x187, 0x1c3, 0x206, 0x254, 0x295, 0x258, 0x226, 0x1d0, 0x196, 0x162, 0x12d, + 0x105, 0xe0, 0xba, 0x9e, 0x80, 0x66, 0x50, 0x42, 0x40, 0x39, 0x31, 0x31, 0x40, 0x4f, 0x62, + 0x79, 0x99, 0xb9, 0xd9, 0xfe, 0x131, 0x164, 0x192, 0x1ca, 0x20e, 0x25b, 0x2a3, 0x266, 0x223, 0x1db, + 0x1ab, 0x16d, 0x13a, 0x111, 0xe8, 0xc6, 0xa9, 0x8d, 0x72, 0x5f, 0x50, 0x49, 0x45, 0x3f, 0x41, + 0x4a, 0x5d, 0x6f, 0x82, 0xa3, 0xc3, 0xe1, 0x108, 0x13a, 0x16b, 0x19c, 0x1d5, 0x219, 0x265, 0x2ac, + 0x277, 0x237, 0x1e4, 0x1b4, 0x17b, 0x143, 0x11c, 0xf3, 0xd2, 0xb3, 0x98, 0x81, 0x6d, 0x5e, 0x52, + 0x51, 0x4c, 0x52, 0x58, 0x69, 0x7b, 0x90, 0xac, 0xcb, 0xeb, 0x112, 0x142, 0x171, 0x1a2, 0x1e0, + 0x227, 0x274, 0x2b9, 0x280, 0x247, 0x1f4, 0x1c2, 0x18a, 0x14d, 0x126, 0xff, 0xde, 0xbf, 0xa5, 0x90, + 0x7e, 0x6e, 0x61, 0x5e, 0x61, 0x60, 0x67, 0x75, 0x87, 0x9d, 0xbd, 0xd9, 0xf6, 0x11f, 0x14e, + 0x17a, 0x1ae, 0x1ec, 0x232, 0x282, 0x2cb, 0x29a, 0x24f, 0x20e, 0x1cb, 0x191, 0x161, 0x133, 0x10d, 0xea, + 0xce, 0xb3, 0x9f, 0x8a, 0x7c, 0x71, 0x6f, 0x72, 0x6e, 0x79, 0x88, 0x96, 0xad, 0xca, 0xe5, + 0x107, 0x12e, 0x15c, 0x18c, 0x1bd, 0x1fa, 0x243, 0x292, 0x2de, 0x2ae, 0x25d, 0x21f, 0x1d7, 0x1a0, 0x16f, + 0x141, 0x11a, 0xf8, 0xde, 0xc4, 0xad, 0x99, 0x8c, 0x84, 0x80, 0x7f, 0x7f, 0x89, 0x97, 0xa6, + 0xbd, 0xd4, 0xf4, 0x115, 0x13b, 0x169, 0x19a, 0x1d1, 0x206, 0x255, 0x2a3, 0x2f2, 0x2bd, 0x275, 0x22f, + 0x1eb, 0x1b0, 0x17f, 0x151, 0x12d, 0x10c, 0xef, 0xd5, 0xbe, 0xae, 0x9e, 0x97, 0x90, 0x8e, 0x91, + 0x9c, 0xa8, 0xb9, 0xcd, 0xe5, 0x105, 0x124, 0x14d, 0x177, 0x1ae, 0x1e4, 0x220, 0x26b, 0x2b9, 0x307, + 0x2d4, 0x296, 0x243, 0x1fe, 0x1c6, 0x193, 0x165, 0x13f, 0x11a, 0x100, 0xe6, 0xd1, 0xc0, 0xb5, 0xa8, + 0xa0, 0xa0, 0xa5, 0xaa, 0xb8, 0xca, 0xe0, 0xfc, 0x115, 0x137, 0x15d, 0x18a, 0x1ce, 0x1f9, 0x236, + 0x282, 0x2d4, 0x324, 0x2f8, 0x2ab, 0x25d, 0x215, 0x1de, 0x1a9, 0x17c, 0x150, 0x12e, 0x110, 0xfb, 0xe6, + 0xd2, 0xc6, 0xba, 0xb6, 0xb6, 0xba, 0xc2, 0xcd, 0xdd, 0xf4, 0x10a, 0x127, 0x14b, 0x171, 0x1aa, + 0x1ec, 0x20f, 0x252, 0x29a, 0x2e9, 0x341, 0x310, 0x2b8, 0x26a, 0x22f, 0x1f0, 0x1b7, 0x18a, 0x15b, 0x13d, + 0x11f, 0x108, 0xf2, 0xde, 0xd4, 0xca, 0xc4, 0xc3, 0xc7, 0xcf, 0xdb, 0xf0, 0x101, 0x11d, 0x135, + 0x15b, 0x184, 0x1c1, 0x1ff, 0x227, 0x265, 0x2aa, 0x2fb, 0x360, + }, + + /* Bgain */ + { + 0x2f0, 0x29d, 0x24a, 0x20b, 0x1d2, 0x1ae, 0x175, 0x151, 0x137, 0x12c, 0x105, 0xeb, 0xd7, 0xc9, 0xbd, + 0xbd, 0xc0, 0xc2, 0xca, 0xdc, 0xec, 0xfb, 0x10f, 0x129, 0x14b, 0x178, 0x1a7, 0x1d2, 0x21b, 0x25c, + 0x29c, 0x305, 0x35e, 0x2d4, 0x284, 0x23e, 0x1ff, 0x1c5, 0x195, 0x16a, 0x143, 0x12a, 0x11c, 0xf5, 0xe1, + 0xcf, 0xbb, 0xb1, 0xae, 0xb2, 0xb8, 0xbf, 0xcd, 0xde, 0xed, 0x102, 0x11e, 0x14a, 0x16f, 0x195, + 0x1c6, 0x209, 0x24b, 0x28e, 0x2e7, 0x348, 0x2b8, 0x26f, 0x228, 0x1e8, 0x1ad, 0x181, 0x155, 0x131, 0x114, + 0x102, 0xe1, 0xca, 0xbe, 0xa8, 0xa0, 0x9c, 0x9d, 0xa6, 0xad, 0xb4, 0xc1, 0xd6, 0xf3, 0x10e, + 0x138, 0x15f, 0x183, 0x1b0, 0x1f5, 0x230, 0x278, 0x2cc, 0x325, 0x2a5, 0x254, 0x20e, 0x1d6, 0x19b, 0x16c, + 0x146, 0x11f, 0xfa, 0xe2, 0xcc, 0xbb, 0xab, 0x97, 0x8e, 0x8b, 0x8b, 0x93, 0x9c, 0xa2, 0xac, + 0xcb, 0xe6, 0xfa, 0x126, 0x14d, 0x174, 0x1a4, 0x1e7, 0x21d, 0x261, 0x2b8, 0x30f, 0x28f, 0x243, 0x1fe, + 0x1c0, 0x18b, 0x15b, 0x138, 0x10e, 0xf1, 0xd3, 0xbc, 0xa8, 0x96, 0x89, 0x7e, 0x79, 0x78, 0x83, + 0x8a, 0x92, 0xa2, 0xbf, 0xda, 0xee, 0x114, 0x13b, 0x162, 0x193, 0x1d6, 0x212, 0x253, 0x29d, 0x2f5, + 0x271, 0x22f, 0x1e9, 0x1b1, 0x17a, 0x14e, 0x126, 0x103, 0xe4, 0xc8, 0xad, 0x97, 0x85, 0x78, 0x6d, + 0x68, 0x6a, 0x6e, 0x74, 0x81, 0x90, 0xb0, 0xcb, 0xe0, 0x107, 0x12a, 0x155, 0x189, 0x1c5, 0x1ff, + 0x240, 0x28b, 0x2db, 0x25e, 0x21e, 0x1df, 0x1a8, 0x171, 0x146, 0x11b, 0xf1, 0xd7, 0xbb, 0x9f, 0x88, + 0x76, 0x67, 0x5d, 0x57, 0x5b, 0x5a, 0x69, 0x71, 0x84, 0xa0, 0xbd, 0xd4, 0xf9, 0x119, 0x14a, + 0x17b, 0x1ae, 0x1e9, 0x232, 0x27b, 0x2c8, 0x253, 0x214, 0x1d3, 0x197, 0x16b, 0x140, 0x111, 0xe8, 0xc5, + 0xa8, 0x90, 0x7c, 0x68, 0x58, 0x4e, 0x46, 0x4a, 0x4c, 0x58, 0x61, 0x73, 0x8d, 0xa4, 0xc6, + 0xed, 0x110, 0x139, 0x167, 0x19f, 0x1dc, 0x223, 0x26b, 0x2ab, 0x249, 0x206, 0x1c4, 0x18c, 0x15d, 0x130, + 0x105, 0xd6, 0xba, 0x9b, 0x83, 0x6b, 0x5a, 0x4a, 0x3c, 0x3a, 0x37, 0x3b, 0x4c, 0x58, 0x67, + 0x82, 0x9f, 0xc7, 0xe7, 0x101, 0x12f, 0x15d, 0x195, 0x1d2, 0x214, 0x25c, 0x2a1, 0x238, 0x1fd, 0x1bb, + 0x17f, 0x150, 0x123, 0xf7, 0xd1, 0xb1, 0x94, 0x78, 0x64, 0x4e, 0x3d, 0x30, 0x2e, 0x28, 0x2e, + 0x3e, 0x4b, 0x60, 0x77, 0x9a, 0xc3, 0xdc, 0xfe, 0x129, 0x155, 0x18c, 0x1c9, 0x20d, 0x256, 0x295, + 0x234, 0x1f0, 0x1af, 0x175, 0x141, 0x117, 0xf0, 0xcb, 0xa8, 0x8a, 0x71, 0x58, 0x3e, 0x2f, 0x23, + 0x1e, 0x1d, 0x23, 0x30, 0x41, 0x58, 0x72, 0x91, 0xbb, 0xd3, 0xf3, 0x122, 0x151, 0x180, 0x1c5, + 0x202, 0x24d, 0x287, 0x222, 0x1e8, 0x1a6, 0x16d, 0x13c, 0x10d, 0xe6, 0xc5, 0xa6, 0x82, 0x67, 0x4e, + 0x37, 0x23, 0x16, 0x12, 0x10, 0x18, 0x23, 0x37, 0x4f, 0x69, 0x84, 0xa9, 0xc7, 0xea, 0x11d, + 0x149, 0x178, 0x1be, 0x1fe, 0x247, 0x28a, 0x21e, 0x1e0, 0x19d, 0x169, 0x138, 0x10b, 0xe3, 0xc3, 0x9d, + 0x7d, 0x61, 0x44, 0x2e, 0x1d, 0xf, 0x8, 0x6, 0xe, 0x1a, 0x2d, 0x47, 0x5d, 0x7c, 0x9c, + 0xbf, 0xe6, 0x119, 0x141, 0x171, 0x1b4, 0x1f5, 0x241, 0x279, 0x21b, 0x1de, 0x19b, 0x168, 0x132, 0x107, + 0xdf, 0xbc, 0x9a, 0x78, 0x5d, 0x40, 0x29, 0x15, 0x7, 0x0, 0x0, 0xa, 0x13, 0x27, 0x45, + 0x58, 0x77, 0x9b, 0xbb, 0xe5, 0x113, 0x13c, 0x170, 0x1ae, 0x1f3, 0x238, 0x276, 0x244, 0x1d8, 0x19f, + 0x168, 0x133, 0x107, 0xdd, 0xba, 0x97, 0x75, 0x56, 0x3c, 0x28, 0x12, 0x4, 0x3, 0x1, 0x4, + 0x11, 0x21, 0x3d, 0x58, 0x77, 0x97, 0xbc, 0xe1, 0x10f, 0x13b, 0x16f, 0x1a9, 0x1e9, 0x232, 0x276, + 0x2a3, 0x1ec, 0x1a4, 0x16a, 0x12f, 0x102, 0xdb, 0xba, 0x94, 0x70, 0x56, 0x3b, 0x28, 0xf, 0x1, + 0x6, 0x2, 0x4, 0xe, 0x1f, 0x3a, 0x55, 0x74, 0x96, 0xb5, 0xe0, 0x10d, 0x13c, 0x16d, 0x1ac, + 0x1e5, 0x230, 0x271, 0x2a9, 0x206, 0x19e, 0x166, 0x12e, 0x101, 0xda, 0xb5, 0x92, 0x71, 0x54, 0x3a, + 0x24, 0x10, 0x4, 0x5, 0x7, 0x6, 0xd, 0x1f, 0x3c, 0x52, 0x75, 0x93, 0xb4, 0xe0, 0x10b, + 0x138, 0x168, 0x1a7, 0x1e9, 0x235, 0x271, 0x2a6, 0x1f1, 0x197, 0x160, 0x129, 0x100, 0xda, 0xb7, 0x92, + 0x70, 0x54, 0x3a, 0x26, 0x12, 0x4, 0x5, 0x5, 0x9, 0xc, 0x22, 0x38, 0x54, 0x71, 0x92, + 0xb6, 0xe2, 0x10c, 0x136, 0x167, 0x1a4, 0x1e2, 0x230, 0x275, 0x267, 0x1d3, 0x192, 0x160, 0x128, 0x101, + 0xd9, 0xbb, 0x96, 0x77, 0x56, 0x3b, 0x2a, 0x14, 0x6, 0x3, 0x7, 0x7, 0x10, 0x26, 0x3d, + 0x57, 0x74, 0x96, 0xb6, 0xe5, 0x10c, 0x136, 0x168, 0x1a3, 0x1e4, 0x22d, 0x271, 0x228, 0x1e9, 0x197, + 0x163, 0x12f, 0x103, 0xd9, 0xbb, 0x9a, 0x7c, 0x5c, 0x45, 0x2f, 0x1c, 0xb, 0x6, 0x7, 0xd, + 0x17, 0x28, 0x3f, 0x5b, 0x77, 0x98, 0xb8, 0xe7, 0x10d, 0x139, 0x16a, 0x1a7, 0x1e9, 0x234, 0x279, + 0x263, 0x226, 0x19a, 0x16a, 0x134, 0x108, 0xdd, 0xbc, 0x9d, 0x80, 0x65, 0x4c, 0x37, 0x25, 0x16, + 0xf, 0xe, 0x13, 0x1f, 0x2e, 0x46, 0x5e, 0x79, 0x9c, 0xbd, 0xeb, 0x112, 0x13d, 0x170, 0x1b0, + 0x1ef, 0x23a, 0x286, 0x271, 0x236, 0x19f, 0x16c, 0x13c, 0x10e, 0xe4, 0xc2, 0x9f, 0x83, 0x6a, 0x55, + 0x3d, 0x2a, 0x1f, 0x19, 0x14, 0x1b, 0x26, 0x36, 0x4c, 0x65, 0x84, 0xa4, 0xc2, 0xeb, 0x119, + 0x146, 0x178, 0x1af, 0x1f3, 0x240, 0x286, 0x254, 0x22e, 0x1a5, 0x16f, 0x143, 0x111, 0xf0, 0xc6, 0xa7, + 0x8d, 0x70, 0x5c, 0x46, 0x35, 0x2e, 0x32, 0x21, 0x24, 0x33, 0x40, 0x55, 0x6c, 0x90, 0xb1, + 0xcb, 0xf2, 0x11d, 0x150, 0x17d, 0x1bc, 0x1f9, 0x244, 0x287, 0x22b, 0x206, 0x1b0, 0x17a, 0x14d, 0x11b, + 0xf4, 0xce, 0xae, 0x93, 0x78, 0x63, 0x4d, 0x3d, 0x40, 0x38, 0x31, 0x31, 0x40, 0x4d, 0x62, + 0x74, 0x98, 0xb8, 0xd7, 0xfb, 0x12f, 0x15a, 0x18a, 0x1c6, 0x205, 0x248, 0x290, 0x236, 0x201, 0x1bd, + 0x190, 0x153, 0x124, 0x100, 0xd9, 0xba, 0xa1, 0x84, 0x6b, 0x57, 0x4b, 0x45, 0x47, 0x42, 0x44, + 0x50, 0x5b, 0x6d, 0x82, 0xa2, 0xc1, 0xde, 0x107, 0x137, 0x161, 0x194, 0x1cc, 0x20a, 0x257, 0x297, + 0x24c, 0x213, 0x1c6, 0x19b, 0x166, 0x12f, 0x10b, 0xe3, 0xc6, 0xaa, 0x90, 0x77, 0x67, 0x5b, 0x4c, + 0x4d, 0x4d, 0x51, 0x5d, 0x6c, 0x7c, 0x8e, 0xab, 0xc9, 0xe8, 0x112, 0x140, 0x16b, 0x19c, 0x1d6, + 0x21a, 0x263, 0x2a7, 0x25b, 0x223, 0x1db, 0x1a7, 0x175, 0x13c, 0x115, 0xf5, 0xd2, 0xb7, 0x9b, 0x86, + 0x76, 0x68, 0x5b, 0x5b, 0x5f, 0x61, 0x69, 0x78, 0x8a, 0xa0, 0xba, 0xd4, 0xf4, 0x11b, 0x149, + 0x176, 0x1a4, 0x1e0, 0x226, 0x26d, 0x2bb, 0x268, 0x22f, 0x1ec, 0x1b1, 0x17b, 0x14b, 0x121, 0xff, 0xe0, + 0xc5, 0xad, 0x96, 0x88, 0x79, 0x6d, 0x6a, 0x6e, 0x6c, 0x75, 0x87, 0x96, 0xae, 0xc9, 0xe2, + 0x103, 0x129, 0x157, 0x183, 0x1b2, 0x1eb, 0x236, 0x280, 0x2cc, 0x27d, 0x234, 0x1fb, 0x1b9, 0x186, 0x158, + 0x132, 0x109, 0xef, 0xd5, 0xbc, 0xa6, 0x97, 0x89, 0x81, 0x7d, 0x7d, 0x7d, 0x86, 0x94, 0xa4, + 0xba, 0xd5, 0xf2, 0x112, 0x136, 0x15e, 0x18a, 0x1bc, 0x1fb, 0x242, 0x28e, 0x2da, 0x28c, 0x249, 0x20e, + 0x1cc, 0x195, 0x162, 0x140, 0x11a, 0x100, 0xe4, 0xcb, 0xb3, 0xa7, 0x98, 0x90, 0x8f, 0x8e, 0x90, + 0x97, 0xa2, 0xb3, 0xc9, 0xdf, 0xfe, 0x122, 0x148, 0x16d, 0x1a6, 0x1d6, 0x210, 0x259, 0x2a1, 0x2e8, + 0x2a9, 0x264, 0x21f, 0x1da, 0x1aa, 0x175, 0x151, 0x129, 0x10e, 0xf4, 0xdc, 0xca, 0xb7, 0xaa, 0xa3, + 0x9c, 0x99, 0x9f, 0xaa, 0xb4, 0xc6, 0xd7, 0xee, 0x10a, 0x130, 0x156, 0x183, 0x1c5, 0x1f3, 0x229, + 0x264, 0x2b3, 0x304, 0x2c0, 0x279, 0x234, 0x1ef, 0x1bf, 0x18d, 0x165, 0x13d, 0x11d, 0x106, 0xeb, 0xdb, + 0xcb, 0xbf, 0xb6, 0xae, 0xad, 0xb3, 0xba, 0xc8, 0xd6, 0xeb, 0x103, 0x11b, 0x140, 0x166, 0x19d, + 0x1e6, 0x20b, 0x244, 0x282, 0x2c9, 0x320, 0x2d0, 0x28d, 0x245, 0x204, 0x1da, 0x19c, 0x175, 0x14b, 0x12c, + 0x10f, 0xf9, 0xe5, 0xdb, 0xd0, 0xc3, 0xbc, 0xbb, 0xbf, 0xc8, 0xd8, 0xe7, 0xf7, 0x114, 0x12b, + 0x14d, 0x176, 0x1b2, 0x1f1, 0x218, 0x259, 0x29b, 0x2e3, 0x338, + }, + }, + }, + + /* ISP_BNR_LSC_CALIB_TABLE_S */ + { + /* RGain */ + { + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096 + }, + /* GrGain */ + { + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096 + }, + /* GbGain */ + { + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096 + }, + /* BGain */ + { + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096 + }, + }, + +}; + + +static const hi_isp_cmos_demosaic g_stIspDemosaic = { + 1, // bEnable + /* au8NonDirStr */ + {0, 0, 32, 96, 168, 224, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240}, + /* au8NonDirMFDetailEhcStr */ + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + /* au8NonDirHFDetailEhcStr */ + {3, 3, 3, 5, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + + /* au8DetailSmoothRange */ + {2, 2, 2, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 7}, +}; + +static const hi_isp_cmos_afc g_stIspAntiFalseColor = { + 1, /* bEnable */ + {8, 8, 8, 8, 7, 7, 7, 6, 6, 6, 5, 4, 3, 2, 1, 0}, /* au8AntiFalseColorThreshold */ + {8, 8, 8, 8, 7, 7, 7, 6, 6, 6, 5, 4, 3, 2, 1, 0}, /* au8AntiFalseColorStrength */ +}; + +static const hi_isp_cmos_bayernr g_stIspBayerNr = { + 1, // bEnable + 0, // bLowPowerEnable + 0, // bBnrMonoSensorEn + 0, // bNrLscEnable + 0, // NrLscNrRatio + { 90, 95, 110, 110, 120, 120, 120, 120, 120, 100, 100, 16, 16, 16, 16, 16}, // FineStr + { + {2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, // ChromaStrR + {1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, // ChromaStrGr + {1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, // ChromaStrGb + {2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} // ChromaStrB + }, + { 0, 0, 0, 0}, // WDRCoarseStr + { 0, 0, 0, 0 }, /* FusionFrameStr */ + { + {180, 180, 180, 180, 160, 150, 120, 140, 160, 160, 180, 200, 200, 200, 200, 200}, // CoarseStrR + {130, 130, 130, 130, 110, 120, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110}, // CoarseStrGR + {120, 130, 130, 130, 110, 120, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110}, // CoarseStrGB + {180, 180, 180, 180, 160, 150, 120, 140, 160, 160, 180, 200, 200, 200, 200, 200} // CoarseStrB + }, + { 50, 45, 40, 50, 50, 50, 50, 50, 280, 280, 300, 400, 400, 400, 400, 400}, // lutCoringWeight + { + 60, 60, 60, 60, 65, 65, 65, 65, 70, 70, 70, 70, 70, 70, 70, 70, \ + 80, 80, 80, 85, 85, 85, 90, 90, 90, 95, 95, 95, 100, 100, 100, 100, 100 + } // CoringRatio +}; + +static const hi_isp_cmos_ldci g_stIspLdci = { + /* bEnable */ + 1, + /* u8GaussLPFSigma */ + 18, + + /* au8HePosWgt */ + {50, 45, 42, 40, 35, 32, 12, 8, 6, 0, 0, 0, 0, 0, 0, 0}, + /* au8HePosSigma */ + {80, 80, 72, 72, 72, 64, 24, 20, 12, 8, 6, 2, 1, 1, 1, 1}, + /* au8HePosMean */ + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + + /* au8HeNegWgt */ + {30, 30, 25, 25, 25, 18, 12, 8, 6, 0, 0, 0, 0, 0, 0, 0}, + /* au8HeNegSigma */ + {80, 80, 80, 80, 80, 72, 64, 54, 36, 8, 6, 2, 1, 1, 1, 1}, + /* au8HeNegMean */ + {128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + + /* au16BlcCtrl */ + {25, 25, 25, 25, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30} +}; + +static const hi_isp_cmos_gamma g_stIspGamma = { + { + 0, 20, 40, 60, 81, 101, 122, 142, 163, 184, 204, 225, 246, 267, 288, 308, 329, 350, 371, 391, 412, 432, 453, 473, 493, 513, 533, 553, 572, 591, 611, 629, \ + 648, 667, 685, 703, 720, 738, 755, 776, 798, 819, 839, 860, 880, 900, 920, 940, 959, 978, 997, 1016, 1034, 1053, 1070, 1088, 1105, 1122, 1139, 1156, 1172, 1188, 1203, 1218, \ + 1233, 1248, 1262, 1276, 1289, 1311, 1331, 1349, 1366, 1383, 1398, 1412, 1426, 1439, 1452, 1464, 1476, 1489, 1502, 1515, 1528, 1543, 1558, 1568, 1578, 1589, 1599, 1610, 1620, 1631, 1641, 1652, \ + 1663, 1673, 1684, 1695, 1705, 1716, 1727, 1738, 1749, 1759, 1770, 1781, 1792, 1803, 1814, 1825, 1835, 1846, 1855, 1864, 1873, 1881, 1890, 1899, 1908, 1917, 1926, 1935, 1944, 1953, 1962, 1971, \ + 1980, 1989, 1998, 2007, 2016, 2025, 2034, 2043, 2051, 2060, 2069, 2078, 2086, 2095, 2104, 2112, 2121, 2129, 2137, 2145, 2153, 2161, 2168, 2176, 2183, 2191, 2199, 2206, 2214, 2221, 2229, 2237, \ + 2244, 2252, 2259, 2266, 2274, 2281, 2288, 2296, 2303, 2310, 2317, 2324, 2330, 2337, 2344, 2350, 2357, 2363, 2369, 2375, 2381, 2387, 2392, 2398, 2403, 2410, 2417, 2423, 2429, 2435, 2440, 2446, \ + 2451, 2456, 2460, 2465, 2469, 2474, 2478, 2482, 2486, 2491, 2495, 2499, 2503, 2507, 2511, 2515, 2519, 2524, 2528, 2533, 2537, 2542, 2547, 2551, 2556, 2561, 2565, 2570, 2575, 2579, 2584, 2589, \ + 2593, 2598, 2603, 2607, 2612, 2617, 2621, 2626, 2631, 2635, 2640, 2644, 2649, 2654, 2658, 2663, 2667, 2672, 2675, 2679, 2682, 2686, 2689, 2693, 2696, 2700, 2703, 2706, 2710, 2713, 2717, 2720, \ + + 2723, 2727, 2730, 2733, 2737, 2740, 2744, 2747, 2750, 2754, 2757, 2760, 2764, 2767, 2771, 2774, 2778, 2781, 2785, 2788, 2792, 2795, 2798, 2801, 2804, 2807, 2810, 2813, 2816, 2819, 2822, 2825, \ + 2828, 2831, 2834, 2837, 2841, 2844, 2847, 2850, 2853, 2856, 2859, 2862, 2865, 2868, 2871, 2874, 2878, 2881, 2884, 2887, 2890, 2893, 2897, 2900, 2903, 2906, 2910, 2913, 2916, 2919, 2923, 2926, \ + 2929, 2932, 2934, 2936, 2939, 2941, 2943, 2946, 2948, 2950, 2953, 2955, 2957, 2960, 2962, 2965, 2967, 2970, 2972, 2974, 2977, 2979, 2982, 2984, 2987, 2989, 2992, 2994, 2997, 2999, 3002, 3004, \ + 3007, 3009, 3012, 3014, 3017, 3019, 3022, 3024, 3027, 3029, 3032, 3034, 3037, 3039, 3042, 3044, 3046, 3049, 3051, 3054, 3056, 3059, 3061, 3063, 3066, 3068, 3070, 3073, 3075, 3077, 3080, 3082, \ + 3084, 3086, 3089, 3091, 3093, 3095, 3098, 3100, 3102, 3104, 3106, 3109, 3111, 3113, 3115, 3117, 3119, 3122, 3124, 3126, 3128, 3130, 3132, 3134, 3136, 3138, 3141, 3143, 3145, 3147, 3149, 3151, \ + 3153, 3155, 3157, 3159, 3161, 3163, 3166, 3168, 3170, 3172, 3174, 3176, 3178, 3180, 3182, 3184, 3186, 3188, 3190, 3192, 3194, 3196, 3198, 3200, 3202, 3204, 3206, 3208, 3210, 3212, 3214, 3216, \ + 3218, 3220, 3222, 3224, 3226, 3228, 3230, 3232, 3234, 3236, 3238, 3240, 3243, 3245, 3247, 3249, 3251, 3253, 3255, 3257, 3259, 3261, 3263, 3265, 3267, 3269, 3271, 3273, 3275, 3277, 3279, 3281, \ + 3283, 3285, 3287, 3289, 3291, 3293, 3294, 3296, 3298, 3300, 3302, 3304, 3306, 3308, 3310, 3312, 3313, 3315, 3317, 3319, 3321, 3323, 3325, 3326, 3328, 3330, 3332, 3333, 3335, 3337, 3339, 3340, + + 3342, 3344, 3346, 3347, 3349, 3351, 3352, 3354, 3356, 3357, 3359, 3361, 3362, 3364, 3365, 3367, 3369, 3370, 3372, 3373, 3375, 3376, 3378, 3379, 3381, 3382, 3384, 3385, 3387, 3388, 3390, 3391, \ + 3393, 3394, 3396, 3397, 3398, 3400, 3401, 3403, 3404, 3406, 3407, 3409, 3410, 3411, 3413, 3414, 3416, 3417, 3419, 3420, 3422, 3423, 3424, 3426, 3427, 3429, 3430, 3432, 3433, 3435, 3436, 3438, \ + 3439, 3440, 3442, 3443, 3444, 3446, 3447, 3449, 3450, 3451, 3453, 3454, 3456, 3457, 3458, 3460, 3461, 3462, 3464, 3465, 3467, 3468, 3469, 3471, 3472, 3473, 3475, 3476, 3478, 3479, 3480, 3482, \ + 3483, 3484, 3486, 3487, 3488, 3490, 3491, 3493, 3494, 3495, 3497, 3498, 3499, 3501, 3502, 3503, 3505, 3506, 3507, 3509, 3510, 3511, 3513, 3514, 3515, 3517, 3518, 3519, 3521, 3522, 3523, 3525, \ + 3526, 3527, 3529, 3530, 3531, 3533, 3534, 3535, 3537, 3538, 3539, 3541, 3542, 3543, 3545, 3546, 3547, 3549, 3550, 3551, 3553, 3554, 3555, 3556, 3558, 3559, 3560, 3562, 3563, 3564, 3565, 3567, \ + 3568, 3569, 3571, 3572, 3573, 3574, 3576, 3577, 3578, 3580, 3581, 3582, 3583, 3585, 3586, 3587, 3589, 3590, 3591, 3593, 3594, 3595, 3597, 3598, 3599, 3601, 3602, 3603, 3605, 3606, 3607, 3609, \ + 3610, 3612, 3613, 3614, 3616, 3617, 3619, 3620, 3621, 3623, 3624, 3626, 3627, 3629, 3630, 3631, 3633, 3634, 3636, 3637, 3639, 3640, 3641, 3643, 3644, 3646, 3647, 3649, 3650, 3652, 3653, 3655, \ + 3656, 3658, 3659, 3660, 3662, 3663, 3665, 3666, 3668, 3669, 3671, 3672, 3674, 3675, 3677, 3678, 3680, 3681, 3683, 3684, 3686, 3687, 3688, 3690, 3691, 3693, 3694, 3696, 3697, 3699, 3700, 3702, + + 3703, 3704, 3706, 3707, 3709, 3710, 3712, 3713, 3715, 3716, 3718, 3719, 3720, 3722, 3723, 3725, 3726, 3728, 3729, 3731, 3732, 3733, 3735, 3736, 3738, 3739, 3741, 3742, 3744, 3745, 3747, 3748, \ + 3749, 3751, 3752, 3754, 3755, 3757, 3758, 3760, 3761, 3763, 3764, 3765, 3767, 3768, 3770, 3771, 3773, 3774, 3776, 3777, 3778, 3780, 3781, 3783, 3784, 3786, 3787, 3789, 3790, 3792, 3793, 3794, \ + 3796, 3797, 3799, 3800, 3802, 3803, 3805, 3806, 3807, 3809, 3810, 3812, 3813, 3815, 3816, 3817, 3819, 3820, 3822, 3823, 3824, 3826, 3827, 3829, 3830, 3832, 3833, 3834, 3836, 3837, 3839, 3840, \ + 3842, 3843, 3844, 3846, 3847, 3849, 3850, 3852, 3853, 3854, 3856, 3857, 3859, 3860, 3862, 3863, 3865, 3866, 3868, 3869, 3871, 3872, 3874, 3875, 3877, 3878, 3880, 3881, 3883, 3884, 3886, 3887, \ + 3889, 3890, 3892, 3893, 3895, 3897, 3898, 3900, 3901, 3903, 3905, 3906, 3908, 3909, 3911, 3913, 3914, 3916, 3918, 3919, 3921, 3922, 3924, 3926, 3927, 3929, 3931, 3932, 3934, 3936, 3937, 3939, \ + 3941, 3943, 3944, 3946, 3948, 3949, 3951, 3953, 3954, 3956, 3958, 3959, 3961, 3963, 3964, 3966, 3968, 3969, 3971, 3973, 3974, 3976, 3978, 3979, 3981, 3983, 3984, 3986, 3988, 3989, 3991, 3992, \ + 3994, 3996, 3997, 3999, 4000, 4002, 4004, 4005, 4007, 4008, 4010, 4012, 4013, 4015, 4016, 4018, 4020, 4021, 4023, 4024, 4026, 4027, 4029, 4031, 4032, 4034, 4035, 4037, 4038, 4040, 4042, 4043, \ + 4045, 4046, 4048, 4049, 4051, 4053, 4054, 4056, 4057, 4059, 4060, 4062, 4064, 4065, 4067, 4068, 4070, 4071, 4073, 4075, 4076, 4078, 4079, 4081, 4082, 4084, 4086, 4087, 4089, 4090, 4092, 4093, 4095 + } +}; + +static const hi_isp_cmos_edgemark g_stIspEdgeMark = { + 0, // HI_BOOL bEnable; /* RW; Range:[0, 1]; Format:1.0;Enable/Disable Edge Mark */ + 100, // HI_U8 u8Threshold; /* RW; range: [0, 255]; Format:8.0; */ + 0xFF0000, // HI_U32 u32Color; /* RW; range: [0, 0xFFFFFF]; Format:32.0; */ +}; + +static const hi_isp_cmos_sharpen g_stIspYuvSharpen = { + /* u8SkinUmin */ + 100, + /* u8SkinVmin */ + 135, + /* u8SkinUmax */ + 128, + /* u8SkinVmax */ + 150, + /* Manual Para */ + { + /* au8LumaWgt */ + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127}, + /* au16TextureStr */ + {100, 102, 105, 108, 110, 115, 120, 128, 136, 148, 150, 160, 165, 170, 170, 170, 170, 170, 168, 165, 162, 160, 155, 150, 140, 136, 130, 128, 125, 123, 120, 120}, + /* au16EdgeStr */ + {120, 123, 125, 128, 130, 135, 140, 148, 160, 168, 180, 190, 200, 210, 210, 210, 210, 210, 200, 190, 185, 175, 165, 160, 146, 136, 130, 128, 125, 123, 120, 120}, + /* u16TextureFreq; */ + 256, + /* u16EdgeFreq; */ + 100, + /* u8OverShoot; */ + 65, + /* u8UnderShoot; */ + 70, + /* u8shootSupStr; */ + 10, + /* u8shootSupAdj; */ + 9, + /* u8DetailCtrl; */ + 128, + /* u8DetailCtrlThr; */ + 180, + /* u8EdgeFiltStr; */ + 53, + /* u8EdgeFiltMaxCap; */ + 18, + /* u8RGain; */ + 31, + /* u8GGain; */ + 32, + /* u8BGain; */ + 31, + /* u8SkinGain; */ + 31, + /* u8MaxSharpGain; */ + 160 + }, + /* Auto Para */ + { + /* au16LumaWgt */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { {27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43 }, + {44, 44, 45, 46, 46, 47, 47, 48, 49, 49, 50, 51, 52, 52, 53, 53 }, + {27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43 }, + {44, 44, 45, 46, 46, 47, 47, 48, 49, 49, 50, 51, 52, 52, 53, 53 }, + {27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43 }, + {44, 44, 45, 46, 46, 47, 47, 48, 49, 49, 50, 51, 52, 52, 53, 53 }, + {27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43 }, + {44, 44, 45, 46, 46, 47, 47, 48, 49, 49, 50, 51, 52, 52, 53, 53 }, + {27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43 }, + {44, 44, 45, 46, 46, 47, 47, 48, 49, 49, 50, 51, 52, 52, 53, 53 }, + {27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43 }, + {44, 44, 45, 46, 46, 47, 47, 48, 49, 49, 50, 51, 52, 52, 53, 53 }, + {27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43 }, + {44, 44, 45, 46, 46, 47, 47, 48, 49, 49, 50, 51, 52, 52, 53, 53 }, + {27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43 }, + {44, 44, 45, 46, 46, 47, 47, 48, 49, 49, 50, 51, 52, 52, 53, 53 }, + {27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43 }, + {44, 44, 45, 46, 46, 47, 47, 48, 49, 49, 50, 51, 52, 52, 53, 53 }, + {27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43 }, + {44, 44, 45, 46, 46, 47, 47, 48, 49, 49, 50, 51, 52, 52, 53, 53 }, + {27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43 }, + {44, 44, 45, 46, 46, 47, 47, 48, 49, 49, 50, 51, 52, 52, 53, 53 }, + {27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43 }, + {44, 44, 45, 46, 46, 47, 47, 48, 49, 49, 50, 51, 52, 52, 53, 53 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 } + }, + /* au16TextureStr */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { {270, 270, 260, 245, 230, 200, 155, 130, 90, 70, 10, 10, 0, 0, 0, 0 }, + {270, 270, 260, 245, 230, 200, 155, 130, 90, 70, 10, 10, 0, 0, 0, 0 }, + {270, 270, 260, 255, 245, 200, 155, 130, 90, 70, 10, 10, 0, 0, 0, 0 }, + {270, 270, 260, 245, 245, 215, 160, 130, 90, 70, 10, 10, 0, 0, 0, 0 }, + {270, 270, 260, 250, 245, 215, 160, 130, 90, 70, 10, 10, 0, 0, 0, 0 }, + {270, 270, 260, 250, 245, 215, 180, 140, 90, 70, 10, 10, 0, 0, 0, 0 }, + {270, 270, 260, 250, 245, 215, 180, 140, 100, 70, 20, 20, 0, 0, 0, 0 }, + {275, 275, 265, 255, 245, 215, 180, 140, 100, 70, 20, 20, 0, 0, 0, 0 }, + {280, 280, 270, 265, 255, 220, 190, 140, 110, 70, 20, 20, 0, 0, 0, 0 }, + {285, 285, 275, 270, 255, 220, 190, 140, 110, 70, 20, 20, 2, 2, 2, 2 }, + {290, 290, 285, 280, 265, 220, 200, 145, 110, 70, 30, 30, 6, 6, 6, 6 }, + {295, 295, 285, 280, 265, 230, 210, 145, 110, 80, 30, 30, 10, 10, 10, 10 }, + {300, 300, 290, 285, 270, 230, 230, 160, 110, 80, 30, 30, 14, 14, 14, 14 }, + {305, 305, 295, 285, 270, 230, 230, 160, 110, 80, 40, 40, 16, 16, 16, 16 }, + {310, 310, 300, 295, 275, 230, 240, 160, 110, 80, 40, 40, 20, 20, 20, 20 }, + {315, 315, 300, 295, 275, 230, 240, 100, 110, 80, 50, 50, 20, 20, 20, 20 }, + {320, 320, 310, 300, 280, 240, 240, 160, 110, 80, 50, 50, 20, 20, 20, 20 }, + {320, 320, 310, 300, 280, 240, 240, 160, 110, 80, 60, 60, 20, 20, 20, 20 }, + {315, 315, 310, 300, 280, 240, 240, 160, 110, 80, 60, 60, 20, 20, 20, 20 }, + {310, 310, 305, 300, 280, 240, 240, 160, 110, 80, 70, 70, 18, 18, 18, 18 }, + {305, 305, 300, 300, 280, 240, 240, 130, 110, 70, 70, 70, 12, 12, 12, 12 }, + {300, 300, 295, 285, 265, 220, 180, 100, 80, 70, 80, 80, 10, 10, 10, 10 }, + {295, 295, 290, 285, 265, 220, 150, 100, 80, 70, 80, 80, 8, 8, 8, 8 }, + {280, 280, 275, 270, 255, 215, 120, 100, 80, 70, 80, 80, 6, 6, 6, 6 }, + {270, 270, 265, 260, 250, 215, 100, 100, 80, 70, 80, 80, 4, 4, 4, 4 }, + {265, 265, 260, 255, 250, 180, 100, 100, 80, 70, 80, 80, 2, 2, 2, 2 }, + {255, 255, 250, 240, 230, 180, 100, 90, 70, 70, 70, 70, 2, 2, 2, 2 }, + {245, 245, 240, 230, 220, 140, 100, 90, 70, 70, 70, 70, 2, 2, 2, 2 }, + {235, 235, 230, 220, 210, 110, 90, 90, 70, 70, 70, 70, 2, 2, 2, 2 }, + {225, 225, 210, 200, 190, 120, 90, 90, 60, 60, 60, 60, 2, 2, 2, 2 }, + {215, 215, 210, 200, 190, 110, 90, 90, 60, 60, 60, 60, 2, 2, 2, 2 }, + {200, 200, 190, 180, 175, 110, 90, 90, 60, 60, 60, 60, 2, 2, 2, 2 } + + }, + /* au16EdgeStr */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { + {200, 200, 190, 190, 185, 175, 170, 120, 110, 100, 100, 100, 100, 50, 50, 50 }, + {200, 200, 190, 190, 185, 175, 170, 120, 110, 100, 100, 100, 100, 50, 50, 50 }, + {200, 200, 190, 190, 185, 175, 170, 120, 110, 100, 100, 100, 100, 50, 50, 50 }, + {200, 200, 190, 190, 185, 175, 170, 120, 110, 100, 100, 100, 100, 50, 50, 50 }, + {200, 200, 190, 190, 185, 175, 170, 120, 110, 100, 100, 100, 100, 50, 50, 50 }, + {202, 202, 195, 195, 190, 180, 175, 130, 120, 110, 110, 110, 110, 50, 50, 50 }, + {202, 202, 195, 195, 190, 180, 175, 130, 120, 110, 110, 110, 110, 50, 50, 50 }, + {210, 210, 200, 200, 190, 180, 175, 140, 140, 130, 130, 130, 130, 50, 50, 50 }, + {220, 220, 210, 210, 200, 190, 180, 140, 140, 130, 130, 130, 130, 50, 50, 50 }, + {230, 230, 220, 220, 210, 200, 190, 140, 160, 150, 150, 150, 150, 50, 50, 50 }, + {240, 240, 230, 230, 220, 210, 195, 180, 180, 180, 160, 160, 160, 50, 50, 50 }, + {250, 250, 240, 240, 230, 220, 205, 180, 180, 180, 160, 160, 160, 50, 50, 50 }, + {260, 260, 250, 250, 240, 230, 210, 180, 180, 180, 160, 160, 160, 50, 50, 50 }, + {270, 270, 260, 260, 250, 240, 215, 190, 190, 190, 170, 170, 170, 50, 50, 50 }, + {280, 280, 270, 270, 260, 250, 220, 190, 190, 190, 170, 170, 170, 50, 50, 50 }, + {290, 290, 280, 280, 270, 260, 225, 180, 180, 180, 160, 160, 160, 50, 50, 50 }, + {300, 300, 290, 290, 280, 270, 230, 180, 180, 180, 160, 160, 160, 50, 50, 50 }, + {290, 290, 280, 280, 270, 260, 225, 190, 190, 190, 160, 160, 160, 50, 50, 50 }, + {280, 280, 270, 270, 260, 250, 220, 190, 190, 190, 160, 160, 160, 50, 50, 50 }, + {270, 270, 260, 260, 250, 240, 210, 190, 190, 190, 160, 160, 160, 50, 50, 50 }, + {260, 260, 250, 250, 240, 230, 205, 180, 180, 180, 160, 160, 160, 50, 50, 50 }, + {255, 255, 245, 245, 235, 230, 205, 180, 180, 180, 160, 160, 160, 50, 50, 50 }, + {250, 250, 245, 245, 235, 225, 200, 170, 170, 170, 150, 150, 150, 50, 50, 50 }, + {240, 240, 235, 235, 225, 220, 200, 160, 160, 160, 150, 150, 150, 50, 50, 50 }, + {230, 230, 225, 225, 215, 210, 195, 160, 160, 160, 150, 150, 150, 50, 50, 50 }, + {220, 220, 210, 210, 205, 200, 190, 160, 160, 160, 150, 150, 150, 50, 50, 50 }, + {210, 210, 200, 200, 195, 190, 185, 160, 160, 160, 140, 140, 140, 50, 50, 50 }, + {200, 200, 190, 190, 185, 180, 175, 155, 155, 155, 135, 135, 135, 50, 50, 50 }, + {195, 195, 185, 185, 185, 180, 175, 150, 150, 150, 135, 135, 135, 40, 40, 40 }, + {190, 190, 185, 185, 180, 175, 170, 150, 150, 150, 135, 135, 135, 30, 30, 30 }, + {180, 180, 175, 175, 170, 165, 160, 150, 150, 150, 135, 135, 135, 25, 25, 25 }, + {180, 180, 175, 175, 170, 165, 160, 150, 150, 150, 135, 135, 135, 20, 20, 20 } + + }, + /* au16TextureFreq */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { 200, 200, 200, 200, 220, 220, 250, 200, 180, 160, 160, 128, 128, 128, 128, 128}, + /* au16EdgeFreq */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { 128, 128, 128, 128, 150, 160, 170, 180, 80, 70, 70, 70, 70, 70, 70, 70}, + /* au8OverShoot */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { 100, 100, 100, 100, 65, 65, 60, 60, 70, 80, 90, 90, 90, 90, 90, 90}, + /* au8UnderShoot */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { 120, 120, 120, 120, 80, 80, 70, 60, 60, 70, 80, 90, 90, 90, 90, 90}, + /* au8ShootSupStr */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { 10, 10, 10, 10, 10, 10, 10, 9, 8, 8, 7, 7, 7, 7, 7, 7}, + /* au8ShootSupAdj */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 7, 7, 7, 7, 7, 7}, + /* au8DetailCtrl */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { 30, 40, 30, 30, 30, 30, 30, 30, 70, 30, 30, 128, 128, 128, 128, 128}, + /* au8DetailCtrlThr */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160}, + /* au8EdgeFiltStr */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { 53, 53, 53, 51, 48, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43 }, + { 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18 }, + /* au8RGain */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { 31, 31, 31, 31, 31, 31, 31, 20, 16, 16, 16, 16, 16, 16, 16, 16}, + /* au8GGain */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32}, + /* au8BGain */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { 31, 31, 31, 31, 31, 31, 31, 20, 16, 16, 16, 16, 16, 16, 16, 16}, + /* au8SkinGain */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { 31, 31, 31, 31, 31, 31, 31, 20, 16, 16, 16, 16, 16, 16, 16, 16}, + /* u8MaxSharpGain */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160} + }, + +}; + +static const hi_isp_cmos_drc g_stIspDRC = { + /* bEnable */ + 0, + /* enOpType */ + 0, + /* u16ManualStrength */ + 1023, + /* u16AutoStrength */ + 512, + /* u8SpatialFltCoef */ + 1, + /* u8RangeFltCoef */ + 2, + /* u8ContrastControl */ + 9, + /* s8DetailAdjustFactor */ + 6, + /* u8RangeAdaMax */ + 4, + /* u8GradRevMax */ + 30, + /* u8GradRevThr */ + 35, + /* u8BrightGainLmt */ + 15, + /* u8BrightGainLmtStep */ + 10, + /* u8DarkGainLmtY */ + 0, + /* u8DarkGainLmtC */ + 0, + /* u8PDStrength */ + 35, + /* u8LocalMixingBrightMax */ + 32, + /* u8LocalMixingBrightMin */ + 24, + /* u8LocalMixingBrightThr */ + 96, + /* s8LocalMixingBrightSlo */ + -3, + /* u8LocalMixingDarkMax */ + 36, + /* u8LocalMixingDarkMin */ + 28, + /* u8LocalMixingDarkThr */ + 200, + /* s8LocalMixingDarkSlo */ + 5, + /* ColorCorrectionLut[33] */ + { + 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 772, 768, 764, + 760, 756, 752, 748, 744, 740, 736, 732, 728, 724, 720, 716, 712, 708, 704, 700 + }, + /* ToneMappingValue[200] */ + { + 8, 8, 16, 24, 31, 39, 48, 56, 65, 75, 85, 95, 106, 118, 130, 143, + 156, 170, 185, 201, 218, 235, 254, 274, 294, 316, 339, 364, 390, 417, 446, 477, + 509, 543, 579, 617, 658, 701, 746, 794, 844, 898, 955, 1015, 1078, 1145, 1216, 1291, + 1370, 1454, 1543, 1637, 1736, 1841, 1952, 2069, 2194, 2325, 2465, 2612, 2767, 2932, 3106, 3290, + 3485, 3691, 3909, 4140, 4384, 4641, 4914, 5202, 5507, 5830, 6171, 6531, 6913, 7316, 7742, 8193, + 8669, 9173, 9705, 10268, 10863, 11492, 12145, 12808, 13483, 14171, 14872, 15587, 16319, 17069, 17840, 18635, + 19458, 19881, 20313, 20754, 21204, 21661, 22122, 22586, 23053, 23525, 24000, 24480, 24965, 25455, 25950, 26451, + 26959, 27473, 27995, 28524, 29062, 29609, 30165, 30732, 31309, 31899, 32501, 33116, 33746, 34391, 35043, 35706, + 36381, 37066, 37763, 38472, 39192, 39925, 40671, 41429, 42201, 42591, 42986, 43383, 43784, 44189, 44597, 45008, + 45424, 45842, 46265, 46691, 47121, 47555, 47993, 48434, 48880, 49329, 49783, 50241, 50703, 51169, 51639, 52113, + 52592, 53075, 53564, 54056, 54552, 55054, 55560, 56071, 56586, 56846, 57107, 57369, 57632, 57896, 58162, 58429, + 58697, 58967, 59238, 59510, 59783, 60057, 60333, 60611, 60889, 61169, 61451, 61733, 62017, 62303, 62589, 62877, + 63167, 63458, 63750, 64044, 64340, 64636, 64934, 65234 + }, + /* u8Asymmetry */ + 5, + /* u8SecondPole */ + 180, + /* u8Stretch */ + 50, + /* u8Compress */ + 150, + /* u8CurveSel */ + 0 +}; + +static const hi_isp_cmos_ge g_stIspGe = { + /* For GE */ + 1, /* bEnable */ + 9, /* u8Slope */ + 9, /* u8SensiSlope */ + 300, /* u16SensiThr */ + {300, 300, 300, 300, 310, 310, 310, 310, 320, 320, 320, 320, 330, 330, 330, 330}, /* au16Threshold[ISP_AUTO_ISO_STRENGTH_NUM] */ + { 128, 128, 128, 128, 129, 129, 129, 129, 130, 130, 130, 130, 131, 131, 131, 131}, /* au16Strength[ISP_AUTO_ISO_STRENGTH_NUM] */ + {1024, 1024, 1024, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048} /* au16NpOffset[ISP_AUTO_ISO_STRENGTH_NUM] */ +}; + +/* **BAYER NR* */ +static const hi_isp_cmos_noise_calibration ST_ISP_NOISE_CALIB_RATIO = { + 7, // Calibration Lut Num + /* ************Calibration LUT Table************ */ + { + {100.000000f, 0.046061f, 0.000000f}, + {200.000000f, 0.086122f, 0.000000f}, + {400.000000f, 0.172829f, 0.000000f}, + {800.000000f, 0.345248f, 0.000000f}, + {1600.000000f, 0.696803f, 0.000000f}, + {3200.000000f, 1.408294f, 0.000000f}, + {6400.000000f, 2.917792f, 0.000000f}, + {12800.000000f, 6.373769f, 0.000000f}, + }, + /* ******************************************* */ +}; +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif /* End of #ifdef __cplusplus */ + +#endif /* IMX219_CMOS_EX_H */ diff --git a/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx219/imx219_sensor_ctl.c b/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx219/imx219_sensor_ctl.c new file mode 100644 index 0000000000000000000000000000000000000000..690ed1fadfe3cd11ea9b22a00027a9cbc4b301c0 --- /dev/null +++ b/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx219/imx219_sensor_ctl.c @@ -0,0 +1,266 @@ +/* + * Copyright (c) Hisilicon Technologies Co., Ltd. 2023-2023. All rights reserved. + * Description: Function of imx219 configure sensor + * Author: Hisilicon multimedia software group + * Create: 2023-03-06 + */ + +#include +#include +#include +#include +#include +#include +#include +#include "linux/i2c-dev.h" +#include "imx219_cmos.h" +#include "imx219_cfgs.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif + +static hi_s32 g_fd[HI_ISP_MAX_PIPE_NUM] = {[0 ... (HI_ISP_MAX_PIPE_NUM - 1)] = -1}; + +#define I2C_DEV_FILE_NUM 16U +#define I2C_BUF_NUM 8U + +static hi_s32 imx219_i2c_init(hi_vi_pipe viPipe) +{ + hi_s32 ret; + char acDevFile[I2C_DEV_FILE_NUM]; + hi_s8 u8DevNum; + SNS_CHECK_PIPE_RETURN(viPipe); + if (g_fd[viPipe] >= 0) { + return HI_SUCCESS; + } + + u8DevNum = g_aunImx219BusInfo[viPipe].i2c_dev; + ret = snprintf(acDevFile, sizeof(acDevFile), "/dev/i2c-%d", u8DevNum); + if (ret < 0) { + SNS_ERR_TRACE("snprintf err\n"); + return HI_FAILURE; + } + + g_fd[viPipe] = open(acDevFile, O_RDWR, S_IRUSR | S_IWUSR); + if (g_fd[viPipe] < 0) { + SNS_ERR_TRACE("Open /dev/hi_i2c_drv-%u error! errno=%d.\n", u8DevNum, errno); + return HI_FAILURE; + } + // Config sensor I2C device address (7bit) + ret = ioctl(g_fd[viPipe], I2C_SLAVE_FORCE, (IMX219_I2C_ADDR >> 1)); + if (ret < 0) { + SNS_ERR_TRACE("I2C_SLAVE_FORCE error!\n"); + close(g_fd[viPipe]); + g_fd[viPipe] = -1; + return HI_FAILURE; + } + return HI_SUCCESS; +} + +static hi_s32 imx219_i2c_exit(hi_vi_pipe viPipe) +{ + SNS_CHECK_PIPE_RETURN(viPipe); + if (g_fd[viPipe] >= 0) { + close(g_fd[viPipe]); + g_fd[viPipe] = -1; + return HI_SUCCESS; + } + return HI_FAILURE; +} + +hi_s32 imx219_read_register(hi_vi_pipe viPipe, hi_u32 addr) +{ + hi_s32 ret; + hi_s32 idx = 0; + char buf[I2C_BUF_NUM]; + SNS_CHECK_PIPE_RETURN(viPipe); + if (g_fd[viPipe] < 0) { + return HI_FAILURE; + } + if (IMX219_ADDR_BYTE == 2) { /* 2 byte */ + buf[idx] = (addr >> 8) & 0xff; /* shift 8 */ + idx++; + buf[idx] = addr & 0xff; + idx++; + } else { + buf[idx] = addr & 0xff; + idx++; + } + ret = write(g_fd[viPipe], buf, IMX219_ADDR_BYTE); + if (ret < HI_SUCCESS) { + SNS_ERR_TRACE("I2C_WRITE DATA error!\n"); + return HI_FAILURE; + } + ret = read(g_fd[viPipe], buf, IMX219_DATA_BYTE); + if (ret < HI_SUCCESS) { + SNS_ERR_TRACE("I2C_READ DATA error!\n"); + return HI_FAILURE; + } + return buf[0]; +} + +hi_s32 imx219_write_register(hi_vi_pipe viPipe, hi_u32 addr, hi_u32 data) +{ + hi_s32 idx = 0; + char buf[I2C_BUF_NUM]; + hi_s32 ret; + SNS_CHECK_PIPE_RETURN(viPipe); + + if (g_fd[viPipe] < 0) { + SNS_ERR_TRACE("fd err:%d\n", g_fd[viPipe]); + return HI_FAILURE; + } + if (IMX219_ADDR_BYTE == 2) { /* 2 byte */ + buf[idx] = (addr >> 8) & 0xff; /* shift 8 */ + idx++; + buf[idx] = addr & 0xff; + idx++; + } else { + buf[idx] = addr & 0xff; + idx++; + } + if (IMX219_DATA_BYTE == 2) { /* 2 byte */ + buf[idx] = (data >> 8) & 0xff; /* shift 8 */ + idx++; + buf[idx] = data & 0xff; + idx++; + } else { + buf[idx] = data & 0xff; + idx++; + } + ret = write(g_fd[viPipe], buf, (IMX219_ADDR_BYTE + IMX219_DATA_BYTE)); + if (ret < HI_SUCCESS) { + SNS_ERR_TRACE("I2C_WRITE DATA error!\n"); + return HI_FAILURE; + } + return HI_SUCCESS; +} + +static hi_s32 imx219_readback_register(hi_vi_pipe viPipe, hi_u32 addr, hi_u8 data) +{ + hi_s32 read_back_data; + hi_u32 addr_h; + addr_h = (addr >> 8U) & 0xff; /* shift 8 */ + /* imx219 0x30xx 0x47xx 寄存器不可读 */ + /* 如果从地址的高位是 0x30 或�?0x47 , 不做回读直接返回成功 */ + if (addr_h == 0x30 || addr_h == 0x47) { + return HI_SUCCESS; + } + read_back_data = imx219_read_register(viPipe, addr); + if (data != (hi_u8)read_back_data) { + return HI_FAILURE; + } + return HI_SUCCESS; +} + +static void delay_ms(hi_u32 ms) +{ + usleep(ms * 1000); /* 1ms: 1000us */ + return; +} + +void imx219_standby(hi_vi_pipe viPipe) +{ + SNS_CHECK_PIPE_VOID(viPipe); + return; +} + +void imx219_restart(hi_vi_pipe viPipe) +{ + SNS_CHECK_PIPE_VOID(viPipe); + return; +} + +void imx219_init(hi_vi_pipe viPipe) +{ + hi_u8 u8ImgMode; + SNS_CHECK_PIPE_VOID(viPipe); + hi_isp_sns_state *sensor_ctx = HI_NULL; + sensor_ctx = imx219_get_ctx(viPipe); + u8ImgMode = sensor_ctx->img_mode; + hi_s32 ret = HI_SUCCESS; + hi_u32 i; + hi_u32 u32SeqEntries; + hi_u16 i2caddr; + hi_u8 i2cvalue; + /* 2. sensor i2c init */ + imx219_i2c_init(viPipe); + // Delay 100ms + delay_ms(100); + if (u8ImgMode == IMX219_24M_RAW10_MODE) { + u32SeqEntries = sizeof(imx219_raw10_24M_20fps_mipi2lane) / sizeof(cis_cfg_imx219_t); + for (i = 0 ; i < u32SeqEntries; i++) { + i2caddr = imx219_raw10_24M_20fps_mipi2lane[i].address; + i2cvalue = imx219_raw10_24M_20fps_mipi2lane[i].value; + ret = imx219_write_register(viPipe, i2caddr, i2cvalue); + if (ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx219 vipipe:%d, i2caddr:%u,i2cvalue:%u, write register failed!\n", + viPipe, i2caddr, i2cvalue); + return; + } + ret = imx219_readback_register(viPipe, i2caddr, i2cvalue); + if (ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx219 vipipe:%d, i2caddr:%u,i2cvalue:%u, read back failed!\n", + viPipe, i2caddr, i2cvalue); + } + } + } else if (u8ImgMode == IMX219_24M_RAW8_MODE) { + u32SeqEntries = sizeof(imx219_raw8_24M_20fps_mipi2lane) / sizeof(cis_cfg_imx219_t); + for (i = 0 ; i < u32SeqEntries; i++) { + i2caddr = imx219_raw8_24M_20fps_mipi2lane[i].address; + i2cvalue = imx219_raw8_24M_20fps_mipi2lane[i].value; + ret = imx219_write_register(viPipe, i2caddr, i2cvalue); + if (ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx219 vipipe:%d, i2caddr:%u,i2cvalue:%u, write register failed!\n", + viPipe, i2caddr, i2cvalue); + return; + } + ret = imx219_readback_register(viPipe, i2caddr, i2cvalue); + if (ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx219 vipipe:%d, i2caddr:%u,i2cvalue:%u, read back failed!\n", + viPipe, i2caddr, i2cvalue); + } + } + } else if (u8ImgMode == IMX219_1920x1080_RAW10_30FPS_MODE) { + u32SeqEntries = sizeof(imx219_raw10_1920x1080_30fps_mipi2lane) / sizeof(cis_cfg_imx219_t); + for (i = 0 ; i < u32SeqEntries; i++) { + i2caddr = imx219_raw10_1920x1080_30fps_mipi2lane[i].address; + i2cvalue = imx219_raw10_1920x1080_30fps_mipi2lane[i].value; + ret = imx219_write_register(viPipe, i2caddr, i2cvalue); + if (ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx219 vipipe:%d, i2caddr:%u,i2cvalue:%u, write register failed!\n", + viPipe, i2caddr, i2cvalue); + return; + } + ret = imx219_readback_register(viPipe, i2caddr, i2cvalue); + if (ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx219 vipipe:%d, i2caddr:%u,i2cvalue:%u, read back failed!\n", + viPipe, i2caddr, i2cvalue); + } + } + } else { + SNS_ERR_TRACE("imx219 Not support ImgMode: %d, should less than %d\n", + sensor_ctx->img_mode, IMX219_MODE_BUTT); + return; + } + + SNS_INFO_TRACE("Camera sensor IMX219 (viPipe: %d, Operation mode: %s) init success!\n", + viPipe, g_astImx219ModeTbl[u8ImgMode].pszModeName); + sensor_ctx->init = HI_TRUE; // Initialization flag + return ; +} + +void imx219_exit(hi_vi_pipe viPipe) +{ + SNS_CHECK_PIPE_VOID(viPipe); + imx219_i2c_exit(viPipe); + return; +} +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif /* End of #ifdef __cplusplus */ diff --git a/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx477/CMakeLists.txt b/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx477/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..76f6eb00cbbb2c6ee8084d8d6256113b02b89257 --- /dev/null +++ b/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx477/CMakeLists.txt @@ -0,0 +1,47 @@ +# Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. + +# CMake lowest version requirement +cmake_minimum_required(VERSION 3.5.1) + +### Sensor SONY IMX219 ### +# project information +project(sns_imx477) + +set(LIB_PATH $ENV{NPU_HOST_LIB}) +# Dynamic libraries in the stub directory can only be used for compilation +if (NOT DEFINED ENV{NPU_HOST_LIB}) + set(LIB_PATH "/usr/local/Ascend/ascend-toolkit/latest/CANN-6.4/runtime/lib64/stub/aarch64") + message(STATUS "set default LIB_PATH: ${LIB_PATH}") +else () + message(STATUS "env LIB_PATH: ${LIB_PATH}") +endif() +set(INC_PATH $ENV{NPU_HOST_INC}) +# Dynamic libraries in the stub directory can only be used for compilation +if (NOT DEFINED ENV{NPU_HOST_INC}) + set(INC_PATH "/usr/local/Ascend/ascend-toolkit/latest/CANN-6.4/runtime/include") + message(STATUS "set default INC_PATH: ${INC_PATH}") +else () + message(STATUS "env INC_PATH: ${INC_PATH}") +endif() + +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIB_PATH}) + +link_directories( + ${LIB_PATH} + ${LIB_PATH}/stub +) + +add_library(sns_imx477 SHARED + imx477_cmos.c + imx477_sensor_ctl.c +) + +include_directories(sns_imx477 + ${INC_PATH}/acl/media + ../include +) + +target_link_libraries(sns_imx477 + acl_isp_mpi +) + diff --git a/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx477/imx477_cmos.c b/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx477/imx477_cmos.c new file mode 100644 index 0000000000000000000000000000000000000000..ab793ed722a98d2900c5f7025c4b894cba67c785 --- /dev/null +++ b/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx477/imx477_cmos.c @@ -0,0 +1,1355 @@ +/* + * Copyright (c) Hisilicon Technologies Co., Ltd. 2023-2023. All rights reserved. + * Description: Function of imx477 adapt isp firmware + * Author: Hisilicon multimedia software group + * Create: 2023-03-06 + */ + +#include +#include +#include "hi_mpi_isp.h" +#include "hi_mpi_ae.h" +#include "hi_mpi_awb.h" +#include "imx477_cmos_ex.h" +#include "imx477_cmos.h" + +#define IMX477_ID 477U +#define IMX477_AGAIN_TBL_RANGE 979U + +#define IMX477_SENSOR_SET_CTX(dev, pstCtx) ((g_pastImx477[dev]) = (pstCtx)) +#define IMX477_SENSOR_RESET_CTX(dev) (g_pastImx477[dev] = HI_NULL) + +#define ISP_SNS_SAVE_INFO_CUR_FRAME 0U +#define ISP_SNS_SAVE_INFO_PRE_FRAME 1U + +static hi_isp_fswdr_mode g_genFSWDRMode[HI_ISP_MAX_PIPE_NUM] = { + [0 ... HI_ISP_MAX_PIPE_NUM - 1] = HI_ISP_FSWDR_NORMAL_MODE +}; + +static hi_u32 g_au32InitExposure[HI_ISP_MAX_PIPE_NUM] = {0}; +static hi_u32 g_au32LinesPer500ms[HI_ISP_MAX_PIPE_NUM] = {0}; + +static hi_u16 g_au16InitWBGain[HI_ISP_MAX_PIPE_NUM][HI_ISP_RGB_CHN_NUM] = {{0}}; +static hi_u16 g_au16SampleRgain[HI_ISP_MAX_PIPE_NUM] = {0}; +static hi_u16 g_au16SampleBgain[HI_ISP_MAX_PIPE_NUM] = {0}; + +static hi_bool g_abAERouteExValid[HI_ISP_MAX_PIPE_NUM] = {0}; +static hi_isp_ae_route g_astInitAERoute[HI_ISP_MAX_PIPE_NUM] = {{0}}; +static hi_isp_ae_route_ex g_astInitAERouteEx[HI_ISP_MAX_PIPE_NUM] = {{0}}; +static hi_isp_ae_route g_astInitAERouteSF[HI_ISP_MAX_PIPE_NUM] = {{0}}; +static hi_isp_ae_route_ex g_astInitAERouteSFEx[HI_ISP_MAX_PIPE_NUM] = {{0}}; + +hi_isp_sns_commbus g_aunImx477BusInfo[HI_ISP_MAX_PIPE_NUM] = { + [0] = { .i2c_dev = 0}, + [1 ... HI_ISP_MAX_PIPE_NUM - 1] = { .i2c_dev = -1} +}; + +/* Depart different sensor mode to get CCM/AWB param */ +hi_u8 g_u8Sensor477ImageMode = IMX477_4056x3040_RAW12_25FPS; + +hi_isp_sns_state *g_pastImx477[HI_ISP_MAX_PIPE_NUM] = {HI_NULL}; + +hi_isp_sns_commbus *imx477_get_bus_Info(hi_vi_pipe viPipe) +{ + SNS_CHECK_PIPE_RETURN(viPipe); + return &g_aunImx477BusInfo[viPipe]; +} + +hi_isp_sns_state *imx477_get_ctx(hi_vi_pipe viPipe) +{ + SNS_CHECK_PIPE_RETURN(viPipe); + return g_pastImx477[viPipe]; +} + +const IMX477_VIDEO_MODE_TBL_S g_astImx477ModeTbl[IMX477_MODE_BUTT] = { + {3100, 3100, 25, 1, 4056, 3040, 0, "IMX477_4056x3040_RAW12_25FPS" }, + {3100, 3100, 15, 1, 4056, 3040, 1, "IMX477_4056x3040_DOL2_RAW10_15fps" }, + {3100, 2516, 45, 1, 3840, 2160, 2, "IMX477_4K_45FPS" }, + {3100, 1292, 60, 1, 1920, 1080, 3, "IMX477_1920x1080_RAW12" }, + {3100, 1230, 40, 1, 1920, 1080, 4, "IMX477_1920x1080_DOL2_RAW10" }, +}; + +static hi_void cmos_get_ae_comm_default(hi_vi_pipe viPipe, + hi_isp_ae_sensor_default *pstAeSnsDft, hi_isp_sns_state *pstSnsState) +{ + hi_u32 u32Fll; + hi_float F32MaxFps; + u32Fll = g_astImx477ModeTbl[pstSnsState->img_mode].u32VertiLines; + F32MaxFps = g_astImx477ModeTbl[pstSnsState->img_mode].f32MaxFps; + pstSnsState->fl_std = u32Fll; + pstAeSnsDft->full_lines_std = pstSnsState->fl_std; + pstAeSnsDft->flicker_freq = 50U * 256U; /* light flicker freq: 50Hz, accuracy: 256 */ + /* 1000000 / (fll * maxfps) */ + pstAeSnsDft->hmax_times = (hi_u32)((1000000U) / (u32Fll * F32MaxFps)); + + pstAeSnsDft->int_time_accu.accu_type = HI_ISP_AE_ACCURACY_LINEAR; + pstAeSnsDft->int_time_accu.accuracy = 1.0f; + + pstAeSnsDft->init_exposure = + /* if equal to 0 init 1000000 */ + (g_au32InitExposure[viPipe] == 0) ? 1000000U : g_au32InitExposure[viPipe]; + pstAeSnsDft->lines_per500ms = (g_au32LinesPer500ms[viPipe] == 0) ? + (hi_u32)(((hi_u64)(u32Fll * F32MaxFps)) >> 1) : g_au32LinesPer500ms[viPipe]; + + pstAeSnsDft->max_int_time = pstSnsState->fl_std - 20U; /* sub 20 */ + pstAeSnsDft->int_time_accu.offset = 0U; + + pstAeSnsDft->again_accu.accu_type = HI_ISP_AE_ACCURACY_TABLE; + pstAeSnsDft->dgain_accu.accu_type = HI_ISP_AE_ACCURACY_LINEAR; + pstAeSnsDft->dgain_accu.accuracy = 0.00390625; // 0.00390625:1/256; + pstAeSnsDft->isp_dgain_shift = 8U; /* accuracy: 8 */ + pstAeSnsDft->min_isp_dgain_target = 1U << pstAeSnsDft->isp_dgain_shift; + pstAeSnsDft->max_isp_dgain_target = 6U << pstAeSnsDft->isp_dgain_shift; /* max 6 */ + (hi_void)memcpy(&pstAeSnsDft->piris_attr, + &ST_PIRIS_ATTR, sizeof(hi_isp_piris_attr)); + pstAeSnsDft->max_iris_fno = HI_ISP_IRIS_F_NO_1_4; + pstAeSnsDft->min_iris_fno = HI_ISP_IRIS_F_NO_5_6; + pstAeSnsDft->ae_route_ex_valid = HI_FALSE; + pstAeSnsDft->ae_route_attr.total_num = 0U; + pstAeSnsDft->ae_route_attr_ex.total_num = 0U; + return; +} + +static hi_void cmos_get_ae_linear_default(hi_vi_pipe viPipe, + hi_isp_ae_sensor_default *pstAeSnsDft, hi_isp_sns_state *pstSnsState) +{ + sns_unused(pstSnsState); + pstAeSnsDft->hist_thresh[0] = 0xd; + pstAeSnsDft->hist_thresh[1] = 0x28; + pstAeSnsDft->hist_thresh[2] = 0x60; /* index 2 */ + pstAeSnsDft->hist_thresh[3] = 0x80; /* index 3 */ + + pstAeSnsDft->ae_compensation = 0x38; + pstAeSnsDft->ae_exp_mode = HI_ISP_AE_EXP_HIGHLIGHT_PRIOR; + + pstAeSnsDft->min_int_time = 8U; /* min 8 */ + pstAeSnsDft->max_int_time_target = 65515U; /* max 65515 */ + pstAeSnsDft->min_int_time_target = 8U; /* min 8 */ + + pstAeSnsDft->max_again = 22795U; /* max 22795 */ + pstAeSnsDft->min_again = 1024U; /* min 1024 */ + pstAeSnsDft->max_again_target = pstAeSnsDft->max_again; + pstAeSnsDft->min_again_target = pstAeSnsDft->min_again; + + pstAeSnsDft->max_dgain = 4095U; // 4095:max_dgain + pstAeSnsDft->min_dgain = 256U; // 256:min_dgain + pstAeSnsDft->max_dgain_target = pstAeSnsDft->max_dgain; + pstAeSnsDft->min_dgain_target = pstAeSnsDft->min_dgain; + + pstAeSnsDft->ae_route_ex_valid = g_abAERouteExValid[viPipe]; + (hi_void)memcpy(&pstAeSnsDft->ae_route_attr, + &g_astInitAERoute[viPipe], sizeof(hi_isp_ae_route)); + (hi_void)memcpy(&pstAeSnsDft->ae_route_attr_ex, + &g_astInitAERouteEx[viPipe], sizeof(hi_isp_ae_route_ex)); + return; +} + +static hi_void cmos_get_ae_2to1_line_wdr_default(hi_vi_pipe viPipe, + hi_isp_ae_sensor_default *pstAeSnsDft, hi_isp_sns_state *pstSnsState) +{ + sns_unused(pstSnsState); + pstAeSnsDft->hist_thresh[0] = 0xC; + pstAeSnsDft->hist_thresh[1] = 0x18; + pstAeSnsDft->hist_thresh[2] = 0x60; /* index 2 */ + pstAeSnsDft->hist_thresh[3] = 0x80; /* index 3 */ + + pstAeSnsDft->min_int_time = 8U; /* min 8 */ + pstAeSnsDft->max_int_time_target = 65515U; /* max 65515 */ + pstAeSnsDft->min_int_time_target = 8U; /* min 8 */ + + pstAeSnsDft->max_again = 22795U; /* max 22795 */ + pstAeSnsDft->min_again = 1024U; /* min 1024 */ + pstAeSnsDft->max_again_target = pstAeSnsDft->max_again; + pstAeSnsDft->min_again_target = pstAeSnsDft->min_again; + + pstAeSnsDft->max_dgain = 4095U; // 4095:max_dgain + pstAeSnsDft->min_dgain = 256U; // 256:min_dgain + pstAeSnsDft->max_dgain_target = pstAeSnsDft->max_dgain; + pstAeSnsDft->min_dgain_target = pstAeSnsDft->min_dgain; + + pstAeSnsDft->init_exposure = (g_au32InitExposure[viPipe] != 0) ? + g_au32InitExposure[viPipe] : 52000U; /* init 52000 */ + + if (g_genFSWDRMode[viPipe] == HI_ISP_FSWDR_LONG_FRAME_MODE) { + pstAeSnsDft->ae_compensation = 64U; /* AeCompensation 64 */ + pstAeSnsDft->ae_exp_mode = HI_ISP_AE_EXP_HIGHLIGHT_PRIOR; + } else { + pstAeSnsDft->ae_compensation = 30U; /* AeCompensation 30 */ + pstAeSnsDft->ae_exp_mode = HI_ISP_AE_EXP_HIGHLIGHT_PRIOR; + pstAeSnsDft->prior_frame = HI_ISP_SHORT_FRAME; + pstAeSnsDft->man_ratio_enable = HI_TRUE; + pstAeSnsDft->arr_ratio[0] = 0x800; + pstAeSnsDft->arr_ratio[1] = 0x40; + pstAeSnsDft->arr_ratio[2] = 0x40; /* array index 2 */ + } + pstAeSnsDft->ae_route_ex_valid = g_abAERouteExValid[viPipe]; + (hi_void)memcpy(&pstAeSnsDft->ae_route_attr, + &g_astInitAERoute[viPipe], sizeof(hi_isp_ae_route)); + (hi_void)memcpy(&pstAeSnsDft->ae_route_attr_ex, + &g_astInitAERouteEx[viPipe], sizeof(hi_isp_ae_route_ex)); + (hi_void)memcpy(&pstAeSnsDft->ae_route_sf_attr, + &g_astInitAERouteSF[viPipe], sizeof(hi_isp_ae_route)); + (hi_void)memcpy(&pstAeSnsDft->ae_route_sf_attr_ex, + &g_astInitAERouteSFEx[viPipe], sizeof(hi_isp_ae_route_ex)); + return; +} + +static hi_s32 cmos_get_ae_default(hi_vi_pipe viPipe, hi_isp_ae_sensor_default *pstAeSnsDft) +{ + hi_isp_sns_state *pstSnsState = HI_NULL; + + SNS_CHECK_PIPE_RETURN(viPipe); + CMOS_CHECK_POINTER(pstAeSnsDft); + IMX477_SENSOR_GET_CTX(viPipe, pstSnsState); + CMOS_CHECK_POINTER(pstSnsState); + + (hi_void)memset(&pstAeSnsDft->ae_route_attr, 0, sizeof(hi_isp_ae_route)); + + cmos_get_ae_comm_default(viPipe, pstAeSnsDft, pstSnsState); + switch (pstSnsState->wdr_mode) { + case HI_WDR_MODE_NONE: + cmos_get_ae_linear_default(viPipe, pstAeSnsDft, pstSnsState); + break; + case HI_WDR_MODE_2To1_LINE: + cmos_get_ae_2to1_line_wdr_default(viPipe, pstAeSnsDft, pstSnsState); + break; + default: + break; + } + + return HI_SUCCESS; +} + +/* the function of sensor set fps */ +static hi_void cmos_fps_set(hi_vi_pipe viPipe, + hi_float f32Fps, hi_isp_ae_sensor_default *pstAeSnsDft) +{ + hi_u32 u32Lines, u32LinesMax; + hi_float f32MaxFps, f32MinFps; + hi_isp_sns_state *pstSnsState = HI_NULL; + + SNS_CHECK_PIPE_VOID(viPipe); + + CMOS_CHECK_POINTER_VOID(pstAeSnsDft); + IMX477_SENSOR_GET_CTX(viPipe, pstSnsState); + CMOS_CHECK_POINTER_VOID(pstSnsState); + + switch (pstSnsState->img_mode) { + case IMX477_4056x3040_RAW12_25FPS: + case IMX477_4056x3040_DOL2_RAW10_15fps: + case IMX477_4K_45FPS: + case IMX477_1920x1080_RAW12: + case IMX477_1920x1080_DOL2_RAW10: + u32Lines = g_astImx477ModeTbl[pstSnsState->img_mode].u32MaxVertiLines; + u32LinesMax = g_astImx477ModeTbl[pstSnsState->img_mode].u32MaxVertiLines; + f32MaxFps = g_astImx477ModeTbl[pstSnsState->img_mode].f32MaxFps; + f32MinFps = g_astImx477ModeTbl[pstSnsState->img_mode].f32MinFps; + if ((f32Fps <= f32MaxFps) && (f32Fps >= f32MinFps)) { + u32Lines = (hi_u32)(u32LinesMax * f32MaxFps / SNS_DIV_0_TO_1_FLOAT(f32Fps)); + } else { + SNS_ERR_TRACE("imx477 Not support fps: %f, should be in [%f,%f]\n", + f32Fps, f32MinFps, f32MaxFps); + return; + } + break; + default: + SNS_ERR_TRACE("imx477 Not support ImgMode: %d, should less than %d\n", + pstSnsState->img_mode, IMX477_MODE_BUTT); + return; + } + SNS_INFO_TRACE("imx477 Fps: %f\n", f32Fps); + /* array index 5 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[1].data + = HIGH_8BITS(u32Lines); + /* array index 6 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[0].data + = LOW_8BITS(u32Lines); + + pstSnsState->fl_std = u32Lines; + + pstAeSnsDft->fps = f32Fps; + pstAeSnsDft->lines_per500ms = (hi_u32)(pstSnsState->fl_std * f32Fps / 2U); /* div2 */ + pstAeSnsDft->full_lines_std = pstSnsState->fl_std; + pstAeSnsDft->max_int_time = + /* MaxIntTime: fl_std - 5 */ + pstSnsState->fl_std > 5U ? pstSnsState->fl_std - 5U : pstSnsState->fl_std; + pstSnsState->fl[0] = pstSnsState->fl_std; + pstAeSnsDft->full_lines = pstSnsState->fl[0]; + + return; +} + +static hi_void cmos_slow_framerate_set(hi_vi_pipe viPipe, + hi_u32 u32FullLines, hi_isp_ae_sensor_default *pstAeSnsDft) +{ + hi_isp_sns_state *pstSnsState = HI_NULL; + + SNS_CHECK_PIPE_VOID(viPipe); + + CMOS_CHECK_POINTER_VOID(pstAeSnsDft); + IMX477_SENSOR_GET_CTX(viPipe, pstSnsState); + CMOS_CHECK_POINTER_VOID(pstSnsState); + + pstSnsState->fl[0] = u32FullLines; + + pstAeSnsDft->full_lines= pstSnsState->fl[0]; + /* array index 5 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[1].data = + HIGH_8BITS(u32FullLines); + /* array index 6 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[0].data = + LOW_8BITS(u32FullLines); + + switch (pstSnsState->img_mode) { + case IMX477_4056x3040_RAW12_25FPS: + case IMX477_4056x3040_DOL2_RAW10_15fps: + case IMX477_4K_45FPS: + case IMX477_1920x1080_RAW12: + case IMX477_1920x1080_DOL2_RAW10: + pstAeSnsDft->max_int_time = pstSnsState->fl[0] - 20U; /* sub 20 */ + break; + default: + SNS_ERR_TRACE("imx477 Not support ImgMode: %d, should less than %d\n", + pstSnsState->img_mode, IMX477_MODE_BUTT); + return; + } + return; +} + +static hi_void cmos_inttime_update_linear(hi_vi_pipe viPipe, hi_u32 u32IntTime) +{ + hi_isp_sns_state *pstSnsState = HI_NULL; + + IMX477_SENSOR_GET_CTX(viPipe, pstSnsState); + CMOS_CHECK_POINTER_VOID(pstSnsState); + + // SET CORASE_INTEG_TIME + /* array index 8 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[8].data + = HIGH_8BITS(u32IntTime); + /* array index 7 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[7].data + = LOW_8BITS(u32IntTime); + + return; +} + +static hi_void cmos_inttime_update_2to1_line(hi_vi_pipe viPipe, hi_u32 u32IntTime) +{ + hi_isp_sns_state *pstSnsState = HI_NULL; + static hi_bool bFirst[HI_ISP_MAX_PIPE_NUM] = {[0 ...(HI_ISP_MAX_PIPE_NUM - 1)] = 1}; + + static hi_u32 u32ShortIntTime[HI_ISP_MAX_PIPE_NUM] = {0}; + static hi_u32 u32LongIntTime[HI_ISP_MAX_PIPE_NUM] = {0}; + + IMX477_SENSOR_GET_CTX(viPipe, pstSnsState); + CMOS_CHECK_POINTER_VOID(pstSnsState); + + if (bFirst[viPipe]) { /* short exposure */ + pstSnsState->wdr_int_time[0] = u32IntTime; + u32ShortIntTime[viPipe] = u32IntTime; + // SET CORASE_INTEG_TIME + /* array index 8 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[8].data + = HIGH_8BITS(u32ShortIntTime[viPipe]); + /* array index 7 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[7].data + = LOW_8BITS(u32ShortIntTime[viPipe]); + bFirst[viPipe] = HI_FALSE; + } else { /* long exposure */ + pstSnsState->wdr_int_time[1] = u32IntTime; + u32LongIntTime[viPipe] = u32IntTime; + /* array index 14 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[14].data + = HIGH_8BITS(u32LongIntTime[viPipe]); + /* array index 13 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[13].data + = LOW_8BITS(u32LongIntTime[viPipe]); + bFirst[viPipe] = HI_TRUE; + } + return; +} + +/* while isp notify ae to update sensor regs, ae call these funcs. */ +static hi_void cmos_inttime_update(hi_vi_pipe viPipe, hi_u32 u32IntTime) +{ + hi_isp_sns_state *pstSnsState = HI_NULL; + + SNS_CHECK_PIPE_VOID(viPipe); + + IMX477_SENSOR_GET_CTX(viPipe, pstSnsState); + CMOS_CHECK_POINTER_VOID(pstSnsState); + + if (pstSnsState->wdr_mode == HI_WDR_MODE_2To1_LINE) { + cmos_inttime_update_2to1_line(viPipe, u32IntTime); + } else { + cmos_inttime_update_linear(viPipe, u32IntTime); + } + return; +} + +static const hi_u32 ad_gain_table[IMX477_AGAIN_TBL_RANGE] = { + 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, + 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, + 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, + 1054, 1055, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, + 1065, 1066, 1067, 1068, 1069, 1071, 1072, 1073, 1074, 1075, + 1076, 1077, 1078, 1079, 1081, 1082, 1083, 1084, 1085, 1086, + 1087, 1088, 1089, 1091, 1092, 1093, 1094, 1095, 1096, 1097, + 1099, 1100, 1101, 1102, 1103, 1104, 1106, 1107, 1108, 1109, + 1110, 1111, 1113, 1114, 1115, 1116, 1117, 1119, 1120, 1121, + 1122, 1123, 1125, 1126, 1127, 1128, 1129, 1131, 1132, 1133, + 1134, 1136, 1137, 1138, 1139, 1140, 1142, 1143, 1144, 1145, + 1147, 1148, 1149, 1151, 1152, 1153, 1154, 1156, 1157, 1158, + 1159, 1161, 1162, 1163, 1165, 1166, 1167, 1168, 1170, 1171, + 1172, 1174, 1175, 1176, 1178, 1179, 1180, 1182, 1183, 1184, + 1186, 1187, 1188, 1190, 1191, 1192, 1194, 1195, 1197, 1198, + 1199, 1201, 1202, 1203, 1205, 1206, 1208, 1209, 1210, 1212, + 1213, 1215, 1216, 1217, 1219, 1220, 1222, 1223, 1224, 1226, + 1227, 1229, 1230, 1232, 1233, 1235, 1236, 1237, 1239, 1240, + 1242, 1243, 1245, 1246, 1248, 1249, 1251, 1252, 1254, 1255, + 1257, 1258, 1260, 1261, 1263, 1264, 1266, 1267, 1269, 1271, + 1272, 1274, 1275, 1277, 1278, 1280, 1281, 1283, 1285, 1286, + 1288, 1289, 1291, 1292, 1294, 1296, 1297, 1299, 1300, 1302, + 1304, 1305, 1307, 1309, 1310, 1312, 1314, 1315, 1317, 1318, + 1320, 1322, 1323, 1325, 1327, 1328, 1330, 1332, 1334, 1335, + 1337, 1339, 1340, 1342, 1344, 1346, 1347, 1349, 1351, 1353, + 1354, 1356, 1358, 1360, 1361, 1363, 1365, 1367, 1368, 1370, + 1372, 1374, 1376, 1377, 1379, 1381, 1383, 1385, 1387, 1388, + 1390, 1392, 1394, 1396, 1398, 1399, 1401, 1403, 1405, 1407, + 1409, 1411, 1413, 1415, 1416, 1418, 1420, 1422, 1424, 1426, + 1428, 1430, 1432, 1434, 1436, 1438, 1440, 1442, 1444, 1446, + 1448, 1450, 1452, 1454, 1456, 1458, 1460, 1462, 1464, 1466, + 1468, 1470, 1472, 1474, 1476, 1478, 1481, 1483, 1485, 1487, + 1489, 1491, 1493, 1495, 1497, 1500, 1502, 1504, 1506, 1508, + 1510, 1513, 1515, 1517, 1519, 1521, 1524, 1526, 1528, 1530, + 1533, 1535, 1537, 1539, 1542, 1544, 1546, 1548, 1551, 1553, + 1555, 1558, 1560, 1562, 1565, 1567, 1569, 1572, 1574, 1576, + 1579, 1581, 1583, 1586, 1588, 1591, 1593, 1596, 1598, 1600, + 1603, 1605, 1608, 1610, 1613, 1615, 1618, 1620, 1623, 1625, + 1628, 1630, 1633, 1635, 1638, 1640, 1643, 1646, 1648, 1651, + 1653, 1656, 1659, 1661, 1664, 1667, 1669, 1672, 1675, 1677, + 1680, 1683, 1685, 1688, 1691, 1693, 1696, 1699, 1702, 1705, + 1707, 1710, 1713, 1716, 1718, 1721, 1724, 1727, 1730, 1733, + 1736, 1738, 1741, 1744, 1747, 1750, 1753, 1756, 1759, 1762, + 1765, 1768, 1771, 1774, 1777, 1780, 1783, 1786, 1789, 1792, + 1795, 1798, 1801, 1804, 1807, 1811, 1814, 1817, 1820, 1823, + 1826, 1829, 1833, 1836, 1839, 1842, 1846, 1849, 1852, 1855, + 1859, 1862, 1865, 1869, 1872, 1875, 1879, 1882, 1885, 1889, + 1892, 1896, 1899, 1903, 1906, 1909, 1913, 1916, 1920, 1923, + 1927, 1931, 1934, 1938, 1941, 1945, 1949, 1952, 1956, 1959, + 1963, 1967, 1971, 1974, 1978, 1982, 1985, 1989, 1993, 1997, + 2001, 2004, 2008, 2012, 2016, 2020, 2024, 2028, 2032, 2036, + 2040, 2044, 2048, 2052, 2056, 2060, 2064, 2068, 2072, 2076, + 2080, 2084, 2088, 2092, 2097, 2101, 2105, 2109, 2114, 2118, + 2122, 2126, 2131, 2135, 2139, 2144, 2148, 2153, 2157, 2162, + 2166, 2170, 2175, 2179, 2184, 2189, 2193, 2198, 2202, 2207, + 2212, 2216, 2221, 2226, 2231, 2235, 2240, 2245, 2250, 2255, + 2259, 2264, 2269, 2274, 2279, 2284, 2289, 2294, 2299, 2304, + 2309, 2314, 2319, 2325, 2330, 2335, 2340, 2345, 2351, 2356, + 2361, 2366, 2372, 2377, 2383, 2388, 2394, 2399, 2404, 2410, + 2416, 2421, 2427, 2432, 2438, 2444, 2449, 2455, 2461, 2467, + 2473, 2478, 2484, 2490, 2496, 2502, 2508, 2514, 2520, 2526, + 2532, 2538, 2545, 2551, 2557, 2563, 2570, 2576, 2582, 2589, + 2595, 2601, 2608, 2614, 2621, 2628, 2634, 2641, 2647, 2654, + 2661, 2668, 2674, 2681, 2688, 2695, 2702, 2709, 2716, 2723, + 2730, 2737, 2744, 2752, 2759, 2766, 2774, 2781, 2788, 2796, + 2803, 2811, 2818, 2826, 2833, 2841, 2849, 2857, 2864, 2872, + 2880, 2888, 2896, 2904, 2912, 2920, 2928, 2937, 2945, 2953, + 2962, 2970, 2978, 2987, 2995, 3004, 3013, 3021, 3030, 3039, + 3048, 3057, 3066, 3075, 3084, 3093, 3102, 3111, 3120, 3130, + 3139, 3148, 3158, 3167, 3177, 3187, 3196, 3206, 3216, 3226, + 3236, 3246, 3256, 3266, 3276, 3287, 3297, 3307, 3318, 3328, + 3339, 3350, 3360, 3371, 3382, 3393, 3404, 3415, 3426, 3437, + 3449, 3460, 3472, 3483, 3495, 3506, 3518, 3530, 3542, 3554, + 3566, 3578, 3591, 3603, 3615, 3628, 3640, 3653, 3666, 3679, + 3692, 3705, 3718, 3731, 3744, 3758, 3771, 3785, 3799, 3813, + 3826, 3840, 3855, 3869, 3883, 3898, 3912, 3927, 3942, 3956, + 3971, 3986, 4002, 4017, 4032, 4048, 4064, 4080, 4096, 4112, + 4128, 4144, 4161, 4177, 4194, 4211, 4228, 4245, 4262, 4279, + 4297, 4315, 4332, 4350, 4369, 4387, 4405, 4424, 4443, 4462, + 4481, 4500, 4519, 4539, 4559, 4578, 4599, 4619, 4639, 4660, + 4681, 4702, 4723, 4744, 4766, 4788, 4809, 4832, 4854, 4877, + 4899, 4922, 4946, 4969, 4993, 5017, 5041, 5065, 5090, 5115, + 5140, 5165, 5190, 5216, 5242, 5269, 5295, 5322, 5349, 5377, + 5405, 5433, 5461, 5489, 5518, 5548, 5577, 5607, 5637, 5667, + 5698, 5729, 5761, 5793, 5825, 5857, 5890, 5924, 5957, 5991, + 6026, 6061, 6096, 6132, 6168, 6204, 6241, 6278, 6316, 6355, + 6393, 6432, 6472, 6512, 6553, 6594, 6636, 6678, 6721, 6765, + 6808, 6853, 6898, 6944, 6990, 7037, 7084, 7133, 7182, 7231, + 7281, 7332, 7384, 7436, 7489, 7543, 7598, 7653, 7710, 7767, + 7825, 7884, 7943, 8004, 8065, 8128, 8192, 8256, 8322, 8388, + 8456, 8525, 8594, 8665, 8738, 8811, 8886, 8962, 9039, 9118, + 9198, 9279, 9362, 9446, 9532, 9619, 9709, 9799, 9892, 9986, + 10082, 10180, 10280, 10381, 10485, 10591, 10699, 10810, 10922, 11037, + 11155, 11275, 11397, 11522, 11650, 11781, 11915, 12052, 12192, 12336, + 12483, 12633, 12787, 12945, 13107, 13273, 13443, 13617, 13797, 13981, + 14169, 14364, 14563, 14768, 14979, 15196, 15420, 15650, 15887, 16131, + 16384, 16644, 16912, 17189, 17476, 17772, 18078, 18396, 18724, 19065, + 19418, 19784, 20164, 20560, 20971, 21399, 21845, 22310, 22795 +}; + +static hi_void cmos_again_calc_table(hi_vi_pipe viPipe, + hi_u32 *pu32AgainLin, hi_u32 *pu32AgainDb) +{ + hi_u32 i; + + SNS_CHECK_PIPE_VOID(viPipe); + CMOS_CHECK_POINTER_VOID(pu32AgainLin); + CMOS_CHECK_POINTER_VOID(pu32AgainDb); + + if (*pu32AgainLin >= ad_gain_table[IMX477_AGAIN_TBL_RANGE - 1]) { + *pu32AgainLin = ad_gain_table[IMX477_AGAIN_TBL_RANGE - 1]; + *pu32AgainDb = IMX477_AGAIN_TBL_RANGE - 1U; + goto calc_table_end; + } + + for (i = 1; i < IMX477_AGAIN_TBL_RANGE; i++) { + if (*pu32AgainLin < ad_gain_table[i]) { + *pu32AgainLin = ad_gain_table[i - 1]; + *pu32AgainDb = i - 1U; + goto calc_table_end; + } + } +calc_table_end: + return; +} + +static hi_void cmos_gains_update(hi_vi_pipe viPipe, hi_u32 u32Again, hi_u32 u32Dgain) +{ + hi_isp_sns_state *pstSnsState = HI_NULL; + + SNS_CHECK_PIPE_VOID(viPipe); + + IMX477_SENSOR_GET_CTX(viPipe, pstSnsState); + CMOS_CHECK_POINTER_VOID(pstSnsState); + /* index 6 Dgain */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[6].data = 0U; + // Again + // I2C写的时刻 + /* array index 2 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[2].data + = LOW_8BITS(u32Again); + /* array index 3 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[3].data + = HIGH_8BITS(u32Again); + // Dgain + /* Shift Right 4 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[4].data + = LOW_8BITS(u32Dgain); + /* array index 5 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[5].data + = HIGH_8BITS(u32Dgain); + + if (pstSnsState->wdr_mode == HI_WDR_MODE_2To1_LINE) { + // Again + // I2C写的时刻 + /* array index 9 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[9].data + = LOW_8BITS(u32Again); + /* array index 10 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[10].data + = HIGH_8BITS(u32Again); + // Dgain + /* Shift Right 11 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[11].data + = LOW_8BITS(u32Dgain); + /* array index 12 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[12].data + = HIGH_8BITS(u32Dgain); + } + + return; +} + +static hi_s32 cmos_init_ae_exp_function(hi_isp_ae_sensor_exp_func *pstExpFuncs) +{ + hi_s32 ret; + + CMOS_CHECK_POINTER(pstExpFuncs); + + ret = memset(pstExpFuncs, 0, sizeof(hi_isp_ae_sensor_exp_func)); + if (ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx477 cmos_init_ae_exp_function memset err\n"); + return HI_FAILURE; + } + + pstExpFuncs->pfn_cmos_get_ae_default = cmos_get_ae_default; + pstExpFuncs->pfn_cmos_fps_set = cmos_fps_set; + pstExpFuncs->pfn_cmos_slow_framerate_set = cmos_slow_framerate_set; + pstExpFuncs->pfn_cmos_inttime_update = cmos_inttime_update; + pstExpFuncs->pfn_cmos_gains_update = cmos_gains_update; + pstExpFuncs->pfn_cmos_again_calc_table = cmos_again_calc_table; + pstExpFuncs->pfn_cmos_dgain_calc_table = NULL; + + return HI_SUCCESS; +} + +/* awb static param for Fuji Lens New IR_Cut */ +#define CALIBRATE_STATIC_TEMP 4950U +#define CALIBRATE_STATIC_WB_R_GAIN 800U +#define CALIBRATE_STATIC_WB_GR_GAIN 0X100 +#define CALIBRATE_STATIC_WB_GB_GAIN 0x100 +#define CALIBRATE_STATIC_WB_B_GAIN 450U + +/* Calibration results for Auto WB Planck */ +#define CALIBRATE_AWB_P1 (48) +#define CALIBRATE_AWB_P2 (48) +#define CALIBRATE_AWB_Q1 (-160) +#define CALIBRATE_AWB_A1 (473053) +#define CALIBRATE_AWB_B1 (128) +#define CALIBRATE_AWB_C1 (-421420) + +/* Rgain and Bgain of the golden sample */ +#define GOLDEN_RGAIN 0U +#define GOLDEN_BGAIN 0U +static hi_s32 cmos_get_awb_default(hi_vi_pipe viPipe, + hi_isp_awb_sensor_default *pstAwbSnsDft) +{ + hi_s32 ret; + SNS_CHECK_PIPE_RETURN(viPipe); + CMOS_CHECK_POINTER(pstAwbSnsDft); + + ret = memset(pstAwbSnsDft, 0, sizeof(hi_isp_awb_sensor_default)); + if (ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx477 cmos_get_awb_default memset err\n"); + return HI_FAILURE; + } + + pstAwbSnsDft->wb_ref_temp = 5120U; /* 5120 */ + + pstAwbSnsDft->gain_offset[0] = CALIBRATE_STATIC_WB_R_GAIN; /* array index 0 */ + pstAwbSnsDft->gain_offset[1] = CALIBRATE_STATIC_WB_GR_GAIN; /* array index 1 */ + pstAwbSnsDft->gain_offset[2] = CALIBRATE_STATIC_WB_GB_GAIN; /* array index 2 */ + pstAwbSnsDft->gain_offset[3] = CALIBRATE_STATIC_WB_B_GAIN; /* array index 3 */ + pstAwbSnsDft->wb_para[0] = CALIBRATE_AWB_P1; /* array index 0 */ + pstAwbSnsDft->wb_para[1] = CALIBRATE_AWB_P2; /* array index 1 */ + pstAwbSnsDft->wb_para[2] = CALIBRATE_AWB_Q1; /* array index 2 */ + pstAwbSnsDft->wb_para[3] = CALIBRATE_AWB_A1; /* array index 3 */ + pstAwbSnsDft->wb_para[4] = CALIBRATE_AWB_B1; /* array index 4 */ + pstAwbSnsDft->wb_para[5] = CALIBRATE_AWB_C1; /* array index 5 */ + pstAwbSnsDft->golden_rgain = GOLDEN_RGAIN; // GOLDEN_RGAIN; + pstAwbSnsDft->golden_bgain = GOLDEN_BGAIN; // GOLDEN_BGAIN; + + ret = memcpy(&pstAwbSnsDft->ccm, &g_stAwbCcm_NormalLens, sizeof(hi_isp_awb_ccm)); + if (ret != HI_SUCCESS) { + SNS_ERR_TRACE("cmos_get_awb_default 1 memcpy err\n"); + return HI_FAILURE; + } + + ret = memcpy(&pstAwbSnsDft->agc_tbl, &ST_AWB_AGC_TABLE, sizeof(hi_isp_awb_agc_table)); + if (ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx477 cmos_get_awb_default 3 memcpy err\n"); + return HI_FAILURE; + } + + pstAwbSnsDft->init_rgain = g_au16InitWBGain[viPipe][0]; + pstAwbSnsDft->init_ggain = g_au16InitWBGain[viPipe][1]; + pstAwbSnsDft->init_bgain = g_au16InitWBGain[viPipe][2]; /* array index 2 */ + pstAwbSnsDft->sample_rgain = g_au16SampleRgain[viPipe]; + pstAwbSnsDft->sample_bgain = g_au16SampleBgain[viPipe]; + + return HI_SUCCESS; +} + +static hi_s32 cmos_init_awb_exp_function(hi_isp_awb_sensor_exp_func *pstExpFuncs) +{ + hi_s32 ret; + CMOS_CHECK_POINTER(pstExpFuncs); + + ret = memset(pstExpFuncs, 0, sizeof(hi_isp_awb_sensor_exp_func)); + if (ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx477 cmos_init_awb_exp_function memset err\n"); + return HI_FAILURE; + } + + pstExpFuncs->pfn_cmos_get_awb_default = cmos_get_awb_default; + + return HI_SUCCESS; +} + +static const hi_isp_cmos_dng_color_param g_stDngColorParam = { + {378, 256, 430}, + {439, 256, 439} +}; + +#define SENSOR_MAX_WIDTH 4056U +#define SNESOR_MAX_HIEGHT 3040U + +static hi_void cmos_get_isp_dng_default(hi_isp_sns_state *pstSnsState, hi_isp_cmos_default *pstDef) +{ + hi_s32 ret; + ret = memcpy(&pstDef->dng_color_param, &g_stDngColorParam, sizeof(hi_isp_cmos_dng_color_param)); + if (ret != HI_SUCCESS) { + SNS_ERR_TRACE("cmos_get_isp_default memcpy err\n"); + return; + } + + switch (pstSnsState->img_mode) { + case IMX477_4056x3040_RAW12_25FPS: + case IMX477_4056x3040_DOL2_RAW10_15fps: + case IMX477_4K_45FPS: + case IMX477_1920x1080_RAW12: + case IMX477_1920x1080_DOL2_RAW10: + pstDef->sensor_mode.dng_raw_format.bits_per_sample = 12U; /* 12bit */ + pstDef->sensor_mode.dng_raw_format.white_level = 4095U; /* max 4095 */ + break; + default: + SNS_ERR_TRACE("imx477 Not support ImgMode: %d, should less than %d\n", + pstSnsState->img_mode, IMX477_MODE_BUTT); + return; + } + + pstDef->sensor_mode.dng_raw_format.default_scale.default_scale_h.denominator = 1; + pstDef->sensor_mode.dng_raw_format.default_scale.default_scale_h.numerator = 1; + pstDef->sensor_mode.dng_raw_format.default_scale.default_scale_v.denominator = 1; + pstDef->sensor_mode.dng_raw_format.default_scale.default_scale_v.numerator = 1; + /* pattern 2 */ + pstDef->sensor_mode.dng_raw_format.cfa_repeat_pattern_dim.repeat_pattern_dim_rows = 2U; + /* pattern 2 */ + pstDef->sensor_mode.dng_raw_format.cfa_repeat_pattern_dim.repeat_pattern_dim_cols = 2U; + pstDef->sensor_mode.dng_raw_format.blc_repeat_dim.blc_repeat_rows = 2U; /* pattern 2 */ + pstDef->sensor_mode.dng_raw_format.blc_repeat_dim.blc_repeat_cols = 2U; /* pattern 2 */ + pstDef->sensor_mode.dng_raw_format.cfa_layout = CFALAYOUT_TYPE_RECTANGULAR; + pstDef->sensor_mode.dng_raw_format.cfa_plane_color[0] = 0U; + pstDef->sensor_mode.dng_raw_format.cfa_plane_color[1] = 1U; + pstDef->sensor_mode.dng_raw_format.cfa_plane_color[2] = 2U; /* index 2, CfaPlaneColor 2 */ + pstDef->sensor_mode.dng_raw_format.cfa_pattern[0] = 0U; + pstDef->sensor_mode.dng_raw_format.cfa_pattern[1] = 1U; + pstDef->sensor_mode.dng_raw_format.cfa_pattern[2] = 1U; /* index 2, CfaPattern 1 */ + pstDef->sensor_mode.dng_raw_format.cfa_pattern[3] = 2U; /* index 3, CfaPattern 2 */ + pstDef->sensor_mode.valid_dng_raw_format = HI_TRUE; + return; +} + +static hi_s32 cmos_get_isp_linear_default(hi_isp_cmos_default *pstDef) +{ + hi_s32 ret; + pstDef->key.bit1_demosaic = 1U; + pstDef->demosaic = &g_stIspDemosaic; + pstDef->key.bit1_drc = 1U; + pstDef->drc = &g_stIspDRC; + pstDef->key.bit1_gamma = 1U; + pstDef->gamma = &g_stIspGamma; + pstDef->key.bit1_bayer_nr = 1U; + pstDef->bayer_nr = &g_stIspBayerNr; + pstDef->key.bit1_sharpen = 0U; + pstDef->sharpen = &g_stIspYuvSharpen; + pstDef->key.bit1_edge_mark = 0U; + pstDef->edge_mark = &g_stIspEdgeMark; + pstDef->key.bit1_ge = 1U; + pstDef->ge = &g_stIspGe; + pstDef->key.bit1_anti_false_color = 1U; + pstDef->anti_false_color = &g_stIspAntiFalseColor; + pstDef->key.bit1_ldci = 1U; + pstDef->ldci = &g_stIspLdci; + ret = memcpy(&pstDef->noise_calibration, + &ST_ISP_NOISE_CALIB_RATIO, sizeof(hi_isp_cmos_noise_calibration)); + if (ret != 0) { + SNS_ERR_TRACE("cmos_get_isp_default memcpy err\n"); + return HI_FAILURE; + } + return HI_SUCCESS; +} + +static hi_s32 cmos_get_isp_2to1_line_default(hi_isp_cmos_default *pstDef) +{ + hi_s32 ret; + pstDef->key.bit1_demosaic = 1U; + pstDef->demosaic = &g_stIspDemosaic; + pstDef->key.bit1_drc = 1U; + pstDef->drc = &g_stIspDRC; + pstDef->key.bit1_gamma = 1U; + pstDef->gamma = &g_stIspGamma; + pstDef->key.bit1_bayer_nr = 1U; + pstDef->bayer_nr = &g_stIspBayerNr; + pstDef->key.bit1_sharpen = 0U; + pstDef->sharpen = &g_stIspYuvSharpen; + pstDef->key.bit1_edge_mark = 0U; + pstDef->edge_mark = &g_stIspEdgeMark; + pstDef->key.bit1_ge = 1U; + pstDef->ge = &g_stIspGe; + pstDef->key.bit1_anti_false_color = 1U; + pstDef->anti_false_color = &g_stIspAntiFalseColor; + pstDef->key.bit1_ldci = 1U; + pstDef->ldci = &g_stIspLdci; + ret = memcpy(&pstDef->noise_calibration, + &ST_ISP_NOISE_CALIB_RATIO, sizeof(hi_isp_cmos_noise_calibration)); + if (ret != HI_SUCCESS) { + SNS_ERR_TRACE("cmos_get_isp_default memcpy err\n"); + return HI_FAILURE; + } + return HI_SUCCESS; +} + +static hi_s32 cmos_get_isp_default(hi_vi_pipe viPipe, hi_isp_cmos_default *pstDef) +{ + hi_s32 ret; + hi_isp_sns_state *pstSnsState = HI_NULL; + SNS_CHECK_PIPE_RETURN(viPipe); + CMOS_CHECK_POINTER(pstDef); + IMX477_SENSOR_GET_CTX(viPipe, pstSnsState); + CMOS_CHECK_POINTER(pstSnsState); + + ret = memset(pstDef, 0, sizeof(hi_isp_cmos_default)); + if (ret != HI_SUCCESS) { + return HI_FAILURE; + } + + pstDef->key.bit1_ca = 1U; + pstDef->ca = &g_stIspCA; + pstDef->key.bit1_clut = 1U; + pstDef->clut = &g_stIspCLUT; + pstDef->key.bit1_wdr = 1U; + pstDef->wdr = &g_stIspWDR; + pstDef->key.bit1_dpc = 1U; + pstDef->dpc = &g_stCmosDpc; + + pstDef->key.bit1_lsc = 1U; + pstDef->lsc = &ST_CMOS_LSC_NORMAL_LENS; + + switch (pstSnsState->wdr_mode) { + case HI_WDR_MODE_NONE: + ret = cmos_get_isp_linear_default(pstDef); + break; + case HI_WDR_MODE_2To1_LINE: + ret = cmos_get_isp_2to1_line_default(pstDef); + break; + default: + break; + } + + pstDef->sensor_max_resolution.max_width = SENSOR_MAX_WIDTH; + pstDef->sensor_max_resolution.max_height = SNESOR_MAX_HIEGHT; + pstDef->sensor_mode.sensor_id = IMX477_ID; + pstDef->sensor_mode.sensor_mode = pstSnsState->img_mode; + cmos_get_isp_dng_default(pstSnsState, pstDef); + + return HI_SUCCESS; +} + + +static hi_s32 cmos_get_isp_black_level(hi_vi_pipe viPipe, + hi_isp_cmos_black_level *pstBlackLevel) +{ + hi_s32 i; + SNS_CHECK_PIPE_RETURN(viPipe); + CMOS_CHECK_POINTER(pstBlackLevel); + + /* Don't need to update black level when iso change */ + pstBlackLevel->update = HI_FALSE; + + if (pstBlackLevel->update == HI_TRUE) { + } else { + for (i = 0; i < HI_ISP_BAYER_CHN_NUM; i++) { + pstBlackLevel->black_level[i] = 255U; /* 255:black_level */ + } + } + return HI_SUCCESS; +} + +static hi_void cmos_set_pixel_detect(hi_vi_pipe viPipe, hi_bool bEnable) +{ + hi_isp_sns_state *pstSnsState = HI_NULL; + + SNS_CHECK_PIPE_VOID(viPipe); + IMX477_SENSOR_GET_CTX(viPipe, pstSnsState); + CMOS_CHECK_POINTER_VOID(pstSnsState); + + if (bEnable) { + imx477_write_register(viPipe, IMX477_ANA_GAIN_GLOBAL_L, 0x0); + imx477_write_register(viPipe, IMX477_ANA_GAIN_GLOBAL_H, 0x0); + + imx477_write_register(viPipe, IMX477_DIG_GAIN_GR_L, 0x0); + imx477_write_register(viPipe, IMX477_DIG_GAIN_GR_H, 0xff); + } else { /* setup for ISP 'normal mode' */ + pstSnsState->sync_init = HI_FALSE; + } + return; +} + +static hi_s32 cmos_set_wdr_mode(hi_vi_pipe viPipe, hi_u8 u8Mode) +{ + hi_isp_sns_state *pstSnsState = HI_NULL; + SNS_CHECK_PIPE_RETURN(viPipe); + IMX477_SENSOR_GET_CTX(viPipe, pstSnsState); + CMOS_CHECK_POINTER(pstSnsState); + + pstSnsState->sync_init = HI_FALSE; + + switch (u8Mode & 0x3F) { + case HI_WDR_MODE_NONE: + pstSnsState->wdr_mode = HI_WDR_MODE_NONE; + SNS_INFO_TRACE("HI_WDR_MODE_NONE\n"); + break; + case HI_WDR_MODE_2To1_LINE: + pstSnsState->wdr_mode = HI_WDR_MODE_2To1_LINE; + SNS_INFO_TRACE("HI_WDR_MODE_2To1_LINE\n"); + break; + default: + SNS_ERR_TRACE("do not support this mode%u," + "only support HI_WDR_MODE_NONE or HI_WDR_MODE_2To1_LINE!\n", u8Mode); + return HI_FAILURE; + } + + (hi_void)memset(pstSnsState->wdr_int_time, 0, sizeof(pstSnsState->wdr_int_time)); + + return HI_SUCCESS; +} + +static hi_void cmos_comm_sns_reg_info_init(hi_vi_pipe viPipe, hi_isp_sns_state *pstSnsState) +{ + hi_u32 i; + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].sns_type = HI_ISP_SNS_I2C_TYPE; + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].com_bus.i2c_dev = + g_aunImx477BusInfo[viPipe].i2c_dev; + // DelayMax 3 + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].cfg2_valid_delay_max = 3U; + + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].reg_num = 9U; // RegNum 9 + if (pstSnsState->wdr_mode == HI_WDR_MODE_2To1_LINE) { + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].reg_num += 6U; /* RegNum add 6 */ + } + for (i = 0; i < pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].reg_num; i++) { + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[i].update = HI_TRUE; + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[i].dev_addr = IMX477_I2C_ADDR; + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[i].addr_byte_num = IMX477_ADDR_BYTE; + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[i].data_byte_num = IMX477_DATA_BYTE; + } + + /* fps cfg */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[0].reg_addr + = IMX477_FRM_LENGTH_LINES_L; + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[0].delay_frm_num = 0U; + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[1].reg_addr + = IMX477_FRM_LENGTH_LINES_H; + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[1].delay_frm_num = 0U; + /* Again related */ + /* index 2 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[2].reg_addr + = IMX477_ANA_GAIN_GLOBAL_L; + /* index 2 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[2].delay_frm_num = 1u; + /* index 3 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[3].reg_addr + = IMX477_ANA_GAIN_GLOBAL_H; + /* index 3 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[3].delay_frm_num = 1U; + + /* Dgain cfg */ + /* index 4 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[4].reg_addr + = IMX477_DIG_GAIN_GR_L; + /* index 4 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[4].delay_frm_num = 1u; + /* index 5 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[5].reg_addr + = IMX477_DIG_GAIN_GR_H; + /* index 5 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[5].delay_frm_num = 1U; + /* index 6 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[6].reg_addr + = IMX477_DPGA_USE_GLOBAL_GAIN; + /* index 6 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[6].delay_frm_num = 1u; + /* index 7 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[7].delay_frm_num = 1u; + /* index 7 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[7].reg_addr + = IMX477_COARSE_INTEG_TIME_L; + /* index 8 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[8].delay_frm_num = 1U; + /* index 8 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[8].reg_addr + = IMX477_COARSE_INTEG_TIME_H; + + pstSnsState->sync_init = HI_TRUE; +} + +static hi_void cmos_2to1_line_wdr_sns_reg_info_init(hi_vi_pipe viPipe, hi_isp_sns_state *pstSnsState) +{ + SNS_CHECK_PIPE_VOID(viPipe); + /* Again related */ + /* index 2 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[2].reg_addr + = IMX477_DOL1_ANA_GAIN_GLOBAL_L; + /* index 2 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[2].delay_frm_num = 1U; + /* index 3 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[3].reg_addr + = IMX477_DOL1_ANA_GAIN_GLOBAL_H; + /* index 3 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[3].delay_frm_num = 1U; + /* index 9 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[9].reg_addr + = IMX477_DOL2_ANA_GAIN_GLOBAL_L; + /* index 9 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[9].delay_frm_num = 1U; + /* index 10 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[10].reg_addr + = IMX477_DOL2_ANA_GAIN_GLOBAL_H; + /* index 10 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[10].delay_frm_num = 1U; + /* index 4 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[4].reg_addr + = IMX477_DOL1_DIG_GAIN_GR_L; + /* index 4 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[4].delay_frm_num = 1U; + /* index 5 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[5].reg_addr + = IMX477_DOL1_DIG_GAIN_GR_H; + /* index 5 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[5].delay_frm_num = 1U; + /* index 11 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[11].reg_addr + = IMX477_DOL2_DIG_GAIN_GR_L; + /* index 11 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[11].delay_frm_num = 1U; + /* index 12 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[12].reg_addr + = IMX477_DOL2_DIG_GAIN_GR_H; + /* index 12 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[12].delay_frm_num = 1U; + /* index 7 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[7].delay_frm_num = 1U; + /* index 7 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[7].reg_addr + = IMX477_DOL1_COARSE_INTEG_TIME_L; + /* index 8 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[8].delay_frm_num = 1U; + /* index 8 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[8].reg_addr + = IMX477_DOL1_COARSE_INTEG_TIME_H; + /* index 13 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[13].delay_frm_num = 1U; + /* index 13 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[13].reg_addr + = IMX477_DOL2_COARSE_INTEG_TIME_L; + /* index 14 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[14].delay_frm_num = 1U; + /* index 14 */ + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[14].reg_addr + = IMX477_DOL2_COARSE_INTEG_TIME_H; + + return; +} + +static hi_s32 cmos_get_sns_regs_info(hi_vi_pipe viPipe, hi_isp_sns_regs_info *pstSnsRegsInfo) +{ + hi_s32 ret; + hi_u32 i; + hi_isp_sns_state *pstSnsState = HI_NULL; + + SNS_CHECK_PIPE_RETURN(viPipe); + CMOS_CHECK_POINTER(pstSnsRegsInfo); + IMX477_SENSOR_GET_CTX(viPipe, pstSnsState); + CMOS_CHECK_POINTER(pstSnsState); + + if ((pstSnsState->sync_init == HI_FALSE) || (pstSnsRegsInfo->config == HI_FALSE)) { + cmos_comm_sns_reg_info_init(viPipe, pstSnsState); + if (pstSnsState->wdr_mode == HI_WDR_MODE_2To1_LINE) { + cmos_2to1_line_wdr_sns_reg_info_init(viPipe, pstSnsState); + } + } else { + for (i = 0; i < pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].reg_num; i++) { + if (pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[i].data == + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_PRE_FRAME].i2c_data[i].data) { + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[i].update = HI_FALSE; + } else { + pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME].i2c_data[i].update = HI_TRUE; + } + } + } + + pstSnsRegsInfo->config = HI_FALSE; + + ret = memcpy(pstSnsRegsInfo, + &pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME], sizeof(hi_isp_sns_regs_info)); + if (ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx477 cmos_get_sns_regs_info memcpy err\n"); + return HI_FAILURE; + } + + ret = memcpy(&pstSnsState->regs_info[ISP_SNS_SAVE_INFO_PRE_FRAME], + &pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME], sizeof(hi_isp_sns_regs_info)); + if (ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx477 cmos_get_sns_regs_info memcpy 2 err\n"); + return HI_FAILURE; + } + + pstSnsState->fl[1] = pstSnsState->fl[0]; + + return HI_SUCCESS; +} + +static hi_s32 cmos_set_image_mode(hi_vi_pipe viPipe, + hi_isp_cmos_sensor_image_mode *pstSensorImageMode) +{ + hi_u8 u8SensorImageMode; + hi_isp_sns_state *pstSnsState = HI_NULL; + SNS_CHECK_PIPE_RETURN(viPipe); + CMOS_CHECK_POINTER(pstSensorImageMode); + IMX477_SENSOR_GET_CTX(viPipe, pstSnsState); + CMOS_CHECK_POINTER(pstSnsState); + + u8SensorImageMode = pstSnsState->img_mode; + pstSnsState->sync_init = HI_FALSE; + + if (pstSensorImageMode->sns_mode < IMX477_MODE_BUTT) { + // The App directly specifies the image mode + u8SensorImageMode = pstSensorImageMode->sns_mode; + SNS_INFO_TRACE("IMX477 ISP Firmware specifies the image mode: %d\n", u8SensorImageMode); + } else { + return HI_FAILURE; + } + + if ((pstSnsState->init == HI_TRUE) && (u8SensorImageMode == pstSnsState->img_mode)) { + return HI_ISP_DO_NOT_NEED_SWITCH_IMAGEMODE; /* Don't need to switch SensorImageMode */ + } + pstSnsState->img_mode = u8SensorImageMode; + pstSnsState->fl[0] = pstSnsState->fl_std; // ? + pstSnsState->fl[1] = pstSnsState->fl[0]; // ? + + return HI_SUCCESS; +} + +static hi_void sensor_global_init(hi_vi_pipe viPipe) +{ + hi_s32 ret; + hi_isp_sns_state *pstSnsState = HI_NULL; + + SNS_CHECK_PIPE_VOID(viPipe); + IMX477_SENSOR_GET_CTX(viPipe, pstSnsState); + CMOS_CHECK_POINTER_VOID(pstSnsState); + + pstSnsState->wdr_mode = HI_WDR_MODE_NONE; + pstSnsState->init = HI_FALSE; + pstSnsState->sync_init = HI_FALSE; + + pstSnsState->fl_std = 0xa55; /* 0xa55 fl_std */ + pstSnsState->img_mode = IMX477_4056x3040_RAW12_25FPS; + pstSnsState->fl[0] = pstSnsState->fl_std; + pstSnsState->fl[1] = pstSnsState->fl_std; + + ret = memset(&pstSnsState->regs_info[ISP_SNS_SAVE_INFO_CUR_FRAME], + 0, sizeof(hi_isp_sns_regs_info)); + if (ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx477 sensor_global_init memset err\n"); + return; + } + + ret = memset(&pstSnsState->regs_info[ISP_SNS_SAVE_INFO_PRE_FRAME], + 0, sizeof(hi_isp_sns_regs_info)); + if (ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx477 sensor_global_init memset 2 err\n"); + return; + } +} + +static hi_s32 cmos_init_sensor_exp_function(hi_isp_sensor_exp_func *pstSensorExpFunc) +{ + hi_s32 ret; + CMOS_CHECK_POINTER(pstSensorExpFunc); + ret = memset(pstSensorExpFunc, 0, sizeof(hi_isp_sensor_exp_func)); + if (ret != HI_SUCCESS) { + SNS_ERR_TRACE("cmos_init_sensor_exp_function memset err\n"); + return HI_FAILURE; + } + + pstSensorExpFunc->pfn_cmos_sensor_init = imx477_init; + pstSensorExpFunc->pfn_cmos_sensor_exit = imx477_exit; + pstSensorExpFunc->pfn_cmos_sensor_global_init = sensor_global_init; + pstSensorExpFunc->pfn_cmos_set_image_mode = cmos_set_image_mode; + pstSensorExpFunc->pfn_cmos_set_wdr_mode = cmos_set_wdr_mode; + pstSensorExpFunc->pfn_cmos_get_isp_default = cmos_get_isp_default; + pstSensorExpFunc->pfn_cmos_get_isp_black_level = cmos_get_isp_black_level; + pstSensorExpFunc->pfn_cmos_set_pixel_detect = cmos_set_pixel_detect; + pstSensorExpFunc->pfn_cmos_get_sns_reg_info = cmos_get_sns_regs_info; + + return HI_SUCCESS; +} + +static hi_s32 imx477_set_bus_info(hi_vi_pipe viPipe, hi_isp_sns_commbus unSNSBusInfo) +{ + SNS_CHECK_PIPE_RETURN(viPipe); + g_aunImx477BusInfo[viPipe].i2c_dev = unSNSBusInfo.i2c_dev; + SNS_INFO_TRACE("Config IMX477 sensor on VI PIPE %d: I2C bus %d\n", + viPipe, g_aunImx477BusInfo[viPipe].i2c_dev); + return HI_SUCCESS; +} + +static hi_s32 sensor_ctx_init(hi_vi_pipe viPipe) +{ + hi_s32 ret; + hi_isp_sns_state *pastSnsStateCtx = HI_NULL; + + SNS_CHECK_PIPE_RETURN(viPipe); + IMX477_SENSOR_GET_CTX(viPipe, pastSnsStateCtx); + + if (pastSnsStateCtx == HI_NULL) { + pastSnsStateCtx = (hi_isp_sns_state *)malloc(sizeof(hi_isp_sns_state)); + if (pastSnsStateCtx == HI_NULL) { + SNS_ERR_TRACE("Isp[%d] SnsCtx malloc memory failed!\n", viPipe); + return HI_ERR_ISP_NO_MEM; + } + } + + ret = memset(pastSnsStateCtx, 0, sizeof(hi_isp_sns_state)); + if (ret != HI_SUCCESS) { + SNS_ERR_TRACE("sensor_ctx_init memset err\n"); + free(pastSnsStateCtx); + IMX477_SENSOR_RESET_CTX(viPipe); + return HI_FAILURE; + } + + IMX477_SENSOR_SET_CTX(viPipe, pastSnsStateCtx); + + return HI_SUCCESS; +} + +static hi_void sensor_ctx_exit(hi_vi_pipe viPipe) +{ + hi_isp_sns_state *pastSnsStateCtx = HI_NULL; + + SNS_CHECK_PIPE_VOID(viPipe); + IMX477_SENSOR_GET_CTX(viPipe, pastSnsStateCtx); + SENSOR_FREE(pastSnsStateCtx); + IMX477_SENSOR_RESET_CTX(viPipe); +} + +static hi_s32 sensor_register_callback(hi_vi_pipe viPipe, + hi_isp_3a_alg_lib *pstAeLib, hi_isp_3a_alg_lib *pstAwbLib) +{ + hi_s32 s32Ret; + hi_isp_sensor_register stIspRegister; + hi_isp_ae_sensor_register stAeRegister; + hi_isp_awb_sensor_register stAwbRegister; + hi_isp_sns_attr_info stSnsAttrInfo; + + SNS_CHECK_PIPE_RETURN(viPipe); + CMOS_CHECK_POINTER(pstAeLib); + CMOS_CHECK_POINTER(pstAwbLib); + + s32Ret = sensor_ctx_init(viPipe); + if (s32Ret != HI_SUCCESS) { + return HI_FAILURE; + } + + stSnsAttrInfo.sensor_id = IMX477_ID; + + s32Ret = cmos_init_sensor_exp_function(&stIspRegister.sns_exp); + if (s32Ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx477 cmos_init_sensor_exp_function err\n"); + goto fail0; + } + + s32Ret = hi_mpi_isp_sensor_reg_callback(viPipe, &stSnsAttrInfo, &stIspRegister); + if (s32Ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx477 sensor register callback function failed with 0x%x!\n", (hi_u32)s32Ret); + goto fail0; + } + + s32Ret = cmos_init_ae_exp_function(&stAeRegister.sns_exp); + if (s32Ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx477 cmos_init_ae_exp_function err\n"); + goto fail1; + } + + s32Ret = hi_mpi_ae_sensor_reg_callback(viPipe, pstAeLib, &stSnsAttrInfo, &stAeRegister); + if (s32Ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx477 sensor register callback function to ae lib failed with 0x%x!\n", (hi_u32)s32Ret); + goto fail1; + } + + s32Ret = cmos_init_awb_exp_function(&stAwbRegister.sns_exp); + if (s32Ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx477 cmos_init_awb_exp_function err\n"); + goto fail2; + } + + s32Ret = hi_mpi_awb_sensor_reg_callback(viPipe, pstAwbLib, &stSnsAttrInfo, &stAwbRegister); + if (s32Ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx477 sensor register callback function to awb lib failed with 0x%x!\n", (hi_u32)s32Ret); + goto fail2; + } + + return HI_SUCCESS; + +fail2: + (hi_void)hi_mpi_ae_sensor_unreg_callback(viPipe, pstAeLib, IMX477_ID); +fail1: + (hi_void)hi_mpi_isp_sensor_unreg_callback(viPipe, IMX477_ID); +fail0: + sensor_ctx_exit(viPipe); + return HI_FAILURE; +} + +static hi_s32 sensor_unregister_callback(hi_vi_pipe viPipe, + hi_isp_3a_alg_lib *pstAeLib, hi_isp_3a_alg_lib *pstAwbLib) +{ + hi_s32 s32Ret = HI_SUCCESS; + hi_s32 result = HI_SUCCESS; + SNS_CHECK_PIPE_RETURN(viPipe); + CMOS_CHECK_POINTER(pstAeLib); + CMOS_CHECK_POINTER(pstAwbLib); + + s32Ret = hi_mpi_isp_sensor_unreg_callback(viPipe, IMX477_ID); + if (s32Ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx477 sensor unregister callback function failed with 0x%x!\n", (hi_u32)s32Ret); + result = HI_FAILURE; + } + + s32Ret = hi_mpi_ae_sensor_unreg_callback(viPipe, pstAeLib, IMX477_ID); + if (s32Ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx477 sensor unregister callback function to ae lib failed with 0x%x!\n", (hi_u32)s32Ret); + result = HI_FAILURE; + } + + s32Ret = hi_mpi_awb_sensor_unreg_callback(viPipe, pstAwbLib, IMX477_ID); + if (s32Ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx477 sensor unregister callback function to awb lib failed with 0x%x!\n", (hi_u32)s32Ret); + result = HI_FAILURE; + } + + sensor_ctx_exit(viPipe); + + return result; +} + +static hi_s32 sensor_set_init(hi_vi_pipe viPipe, hi_isp_init_attr *pstInitAttr) +{ + SNS_CHECK_PIPE_RETURN(viPipe); + CMOS_CHECK_POINTER(pstInitAttr); + + g_au32InitExposure[viPipe] = pstInitAttr->exposure; + g_au32LinesPer500ms[viPipe] = pstInitAttr->lines_per500ms; + g_au16InitWBGain[viPipe][0] = pstInitAttr->wb_r_gain; + g_au16InitWBGain[viPipe][1] = pstInitAttr->wb_g_gain; + g_au16InitWBGain[viPipe][2] = pstInitAttr->wb_b_gain; /* index 2 */ + g_au16SampleRgain[viPipe] = pstInitAttr->sample_r_gain; + g_au16SampleBgain[viPipe] = pstInitAttr->sample_b_gain; + + g_abAERouteExValid[viPipe] = pstInitAttr->ae_route_ex_valid; + (hi_void)memcpy(&g_astInitAERoute[viPipe], + &pstInitAttr->ae_route, sizeof(hi_isp_ae_route)); + (hi_void)memcpy(&g_astInitAERouteEx[viPipe], + &pstInitAttr->ae_route_ex, sizeof(hi_isp_ae_route_ex)); + (hi_void)memcpy(&g_astInitAERouteSF[viPipe], + &pstInitAttr->ae_route_sf, sizeof(hi_isp_ae_route)); + (hi_void)memcpy(&g_astInitAERouteSFEx[viPipe], + &pstInitAttr->ae_route_sf_ex, sizeof(hi_isp_ae_route_ex)); + + return HI_SUCCESS; +} + +hi_isp_sns_obj g_sns_imx477_obj = { + .pfn_register_callback = sensor_register_callback, + .pfn_un_register_callback = sensor_unregister_callback, + .pfn_standby = imx477_standby, + .pfn_restart = imx477_restart, + .pfn_write_reg = imx477_write_register, + .pfn_read_reg = imx477_read_register, + .pfn_set_bus_info = imx477_set_bus_info, + .pfn_set_init = sensor_set_init, + .pfn_identify_module = imx477_identify_module +}; \ No newline at end of file diff --git a/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx477/imx477_cmos.h b/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx477/imx477_cmos.h new file mode 100644 index 0000000000000000000000000000000000000000..33303b7e8ba7ad8b52fb06b4cb012ec1d924d288 --- /dev/null +++ b/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx477/imx477_cmos.h @@ -0,0 +1,96 @@ +/* + * Copyright (c) Hisilicon Technologies Co., Ltd. 2023-2023. All rights reserved. + * Description: Header file of imx477_coms + * Author: Hisilicon multimedia software group + * Create: 2023-03-06 + */ + +#ifndef IMX477_CMOS_H +#define IMX477_CMOS_H + +#include "hi_common_isp.h" +#include "hi_sns_ctrl.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif + +#define IMX477_I2C_ADDR 0x34 +#define IMX477_ADDR_BYTE 2U +#define IMX477_DATA_BYTE 1U +#define IMX477_SENSOR_GET_CTX(dev, pstCtx) ((pstCtx) = imx477_get_ctx(dev)) + +#ifndef MIN +#define MIN(a, b) (((a) > (b)) ? (b) : (a)) +#endif + +#define IMX477_FULL_LINES_MAX (0xFFFF) +// registers to control exposure +#define IMX477_COARSE_INTEG_TIME_L (0x0203) +#define IMX477_COARSE_INTEG_TIME_H (0x0202) +#define IMX477_ANA_GAIN_GLOBAL_L (0x0205) +#define IMX477_ANA_GAIN_GLOBAL_H (0x0204) +#define IMX477_DPGA_USE_GLOBAL_GAIN (0x3FF9) +#define IMX477_DIG_GAIN_GR_L (0x020F) +#define IMX477_DIG_GAIN_GR_H (0x020E) +#define IMX477_FRM_LENGTH_LINES_L (0x0341) +#define IMX477_FRM_LENGTH_LINES_H (0x0340) +#define IMX477_LINE_LENGTH_PCK_L (0x0343) +#define IMX477_LINE_LENGTH_PCK_H (0x0342) + +#define IMX477_DOL1_COARSE_INTEG_TIME_L (0x00EB) +#define IMX477_DOL1_COARSE_INTEG_TIME_H (0x00EA) +#define IMX477_DOL2_COARSE_INTEG_TIME_L (0x00ED) +#define IMX477_DOL2_COARSE_INTEG_TIME_H (0x00EC) +#define IMX477_DOL1_ANA_GAIN_GLOBAL_L (0x00F1) +#define IMX477_DOL1_ANA_GAIN_GLOBAL_H (0x00F0) +#define IMX477_DOL2_ANA_GAIN_GLOBAL_L (0x00F3) +#define IMX477_DOL2_ANA_GAIN_GLOBAL_H (0x00F2) +#define IMX477_DOL1_DIG_GAIN_GR_L (0x00F7) +#define IMX477_DOL1_DIG_GAIN_GR_H (0x00F6) +#define IMX477_DOL2_DIG_GAIN_GR_L (0x00F9) +#define IMX477_DOL2_DIG_GAIN_GR_H (0x00F8) + +typedef enum { + IMX477_4056x3040_RAW12_25FPS = 0, + IMX477_4056x3040_DOL2_RAW10_15fps, + IMX477_4K_45FPS, + IMX477_1920x1080_RAW12, + IMX477_1920x1080_DOL2_RAW10, + IMX477_MODE_BUTT +} IMX477_RES_MODE_E; + +typedef struct hiIMX477_VIDEO_MODE_TBL_S { + hi_u32 u32VertiLines; + hi_u32 u32MaxVertiLines; + hi_float f32MaxFps; + hi_float f32MinFps; + hi_u32 u32Width; + hi_u32 u32Height; + hi_u8 u8SnsMode; + const char *pszModeName; +} IMX477_VIDEO_MODE_TBL_S; + +hi_isp_sns_state *imx477_get_ctx(hi_vi_pipe viPipe); +hi_isp_sns_commbus *imx477_get_bus_Info(hi_vi_pipe viPipe); + +extern hi_isp_sns_state *g_pastImx477[HI_ISP_MAX_PIPE_NUM]; +extern hi_isp_sns_commbus g_aunImx477BusInfo[HI_ISP_MAX_PIPE_NUM]; +extern const IMX477_VIDEO_MODE_TBL_S g_astImx477ModeTbl[IMX477_MODE_BUTT]; +extern hi_u8 g_u8Sensor477ImageMode; + +hi_void imx477_init(hi_vi_pipe viPipe); +hi_void imx477_exit(hi_vi_pipe viPipe); +hi_void imx477_standby(hi_vi_pipe viPipe); +hi_void imx477_restart(hi_vi_pipe viPipe); +hi_s32 imx477_write_register(hi_vi_pipe viPipe, hi_u32 addr, hi_u32 data); +hi_s32 imx477_read_register(hi_vi_pipe viPipe, hi_u32 addr); +hi_s32 imx477_identify_module(hi_vi_pipe viPipe); +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif /* End of #ifdef __cplusplus */ +#endif /* IMX477_CMOS_H */ diff --git a/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx477/imx477_cmos_ex.h b/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx477/imx477_cmos_ex.h new file mode 100644 index 0000000000000000000000000000000000000000..ddeaa30b8cf2027ae9f8d8cefccf800b747ae7ed --- /dev/null +++ b/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx477/imx477_cmos_ex.h @@ -0,0 +1,3206 @@ +/* + * Copyright (c) Hisilicon Technologies Co., Ltd. 2023-2023. All rights reserved. + * Description: imx477_cmos_ex.h + * Author: Hisilicon multimedia software group + * Create: 2023-03-06 + */ + +#ifndef IMX477_CMOS_EX_H +#define IMX477_CMOS_EX_H + +#include "hi_common_awb.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif + +/* Piris attr */ +static const hi_isp_piris_attr ST_PIRIS_ATTR = { + 0, // bStepFNOTableChange + 1, // bZeroIsMax + 94, // u16TotalStep + 62, // u16StepCount + /* Step-F number mapping table. Must be from small to large. F1.0 is 1024 and F32.0 is 1 */ + {30, 35, 40, 45, 50, 56, 61, 67, 73, 79, 85, 92, 98, 105, 112, 120, 127, 135, 143, 150, 158, 166, 174, 183, 191, 200, 208, 217, 225, 234, 243, 252, 261, 270, 279, 289, 298, 307, 316, 325, 335, 344, 353, 362, 372, 381, 390, 399, 408, 417, 426, 435, 444, 453, 462, 470, 478, 486, 493, 500, 506, 512}, + HI_ISP_IRIS_F_NO_1_4, // enMaxIrisFNOTarget + HI_ISP_IRIS_F_NO_5_6, // enMinIrisFNOTarget + 0, // bFNOExValid + 512, // u32MaxIrisFNOTarget + 30 // u32MinIrisFNOTarget +}; + +static hi_isp_awb_ccm g_stAwbCcm_NormalLens = { + 4, + { + { + 6420, + { 0x01C8, 0x80A8, 0x8020, 0x8040, 0x01B5, 0x8075, 0x8009, 0x8086, 0x018F }, + }, + { + 4850, + { 0x01BE, 0x8094, 0x802A, 0x803B, 0x01A0, 0x8065, 0x8003, 0x8084, 0x0187 }, + }, + { + 3630, + { 0x01B3, 0x8097, 0x801C, 0x8073, 0x01BE, 0x804B, 0x8001, 0x80D0, 0x01D1 }, + }, + { + 2525, + { 0x0217, 0x8113, 0x8004, 0x805C, 0x0190, 0x8034, 0x800A, 0x80C9, 0x01D3 }, + }, + } +}; + +static hi_isp_awb_ccm g_stAwbCcm_FishLens = { + 3, /* The number of CCM matrixes */ + { + { + 5075, /* the current color temperature */ + { /* CCM matrixes for different color temperature */ + 0x018E, 0x8089, 0x8005, + 0x8032, 0x016D, 0x803B, + 0x800B, 0x80A8, 0x01B3 + }, + }, + { + 3700, + { + 0x0190, 0x8091, 0x0001, + 0x804F, 0x0176, 0x8027, + 0x8008, 0x80A3, 0x01AB + }, + }, + { + 2570, + { + 0x01D1, 0x80D8, 0x0007, + 0x804B, 0x0157, 0x800C, + 0x8015, 0x81CC, 0x02E1 + }, + }, + { + 2100, + { + 0x0100, 0x0000, 0x0000, + 0x0000, 0x0100, 0x0000, + 0x0000, 0x0000, 0x0100 + }, + }, + { + 1600, + { + 0x0100, 0x0000, 0x0000, + 0x0000, 0x0100, 0x0000, + 0x0000, 0x0000, 0x0100 + }, + }, + { + 1400, + { + 0x0100, 0x0000, 0x0000, + 0x0000, 0x0100, 0x0000, + 0x0000, 0x0000, 0x0100 + }, + }, + { + 1000, + { + 0x0100, 0x0000, 0x0000, + 0x0000, 0x0100, 0x0000, + 0x0000, 0x0000, 0x0100 + }, + }, + }, +}; + +static const hi_isp_awb_agc_table ST_AWB_AGC_TABLE = { + /* bvalid */ + 1, + + /* saturation */ + { 0x73, 0x71, 0x6E, 0x6C, 0x69, 0x66, 0x5A, 0x4E, 0x44, 0x40, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 } +}; + +static const hi_isp_cmos_ca g_stIspCA = { + /* CA */ + 1, + /* Y */ + { + 36, 81, 111, 136, 158, 182, 207, 228, 259, 290, 317, 345, 369, 396, 420, 444, 468, 492, 515, + 534, 556, 574, 597, 614, 632, 648, 666, 681, 697, 709, 723, 734, 748, 758, 771, 780, 788, 800, + 808, 815, 822, 829, 837, 841, 848, 854, 858, 864, 868, 871, 878, 881, 885, 890, 893, 897, 900, + 903, 906, 909, 912, 915, 918, 921, 924, 926, 929, 931, 934, 936, 938, 941, 943, 945, 947, 949, + 951, 952, 954, 956, 958, 961, 962, 964, 966, 968, 969, 970, 971, 973, 974, 976, 977, 979, 980, + 981, 983, 984, 985, 986, 988, 989, 990, 991, 992, 993, 995, 996, 997, 998, 999, 1000, 1001, 1004, + 1005, 1006, 1007, 1009, 1010, 1011, 1012, 1014, 1016, 1017, 1019, 1020, 1022, 1024 + }, + /* ISO */ + {1300, 1300, 1250, 1200, 1150, 1100, 1050, 1000, 950, 900, 900, 800, 800, 800, 800, 800}, + +}; + +static const hi_isp_cmos_clut g_stIspCLUT = { + 0, + 128, + 128, + 128, + { + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 67174464, 0, 67174464, 67174464, 67174464, 67174464, 67174464, + 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, + 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 0, + 67174464, 0, 67174464, 67174464, 67174464, 67174464, 0, 67174464, 0, 67174464, 67174464, + 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, + 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 0, 67174464, + 0, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 0, 67174464, + 0, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, + 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 0, 67174464, 0, + 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, + 67174464, 0, 67174464, 0, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, + 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 0, 67174464, 0, 67174464, + 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, + 67174464, 67174464, 67174464, 67174464, 0, 67174464, 0, 67174464, 67174464, 67174464, 67174464, + 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 0, 67174464, 0, 67174464, 67174464, + 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, + 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 0, 67174464, 0, 67174464, + 67174464, 67174464, 67174464, 67174464, 67174464, 0, 67174464, 0, 67174464, 67174464, 67174464, + 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, + 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 67174464, 0, + 67174464, 0, 67174464, 67174464, 0, 67174464, 0, 67174464, 67174464, 67174464, 0, + 67174464, 67174464, 67174464, 0, 67174464, 67174464, 67174464, 0, 67174464, 67174464, 67174464, + 0, 67174464, 67174464, 67174464, 0, 67174464, 67174464, 67174464, 0, 67174464, 67174464, + 67174464, 0, 0, 0, 0, 0, 67174464, 67174464, 0, 0, 67174464, + 67174464, 0, 0, 67174464, 67174464, 0, 0, 67174464, 67174464, 0, 0, + 67174464, 67174464, 0, 0, 67174464, 67174464, 0, 0, 67174464, 67174464, 0, + 0, 67174464, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 67174464, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, + 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 67174464, 0, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 67174464, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 67174464, 0, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 0, 0, 0, 67174464, 0, + 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 67174464, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, + 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 0, 0, 0, + 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 67174464, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, + 0, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 0, + 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 67174464, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, + 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 67174464, 0, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, + 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 67174464, 0, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, + 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, + 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, + 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 67174464, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 67174464, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, + 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 67174464, 0, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 67174464, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, + 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 0, 0, 0, 67174464, + 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 67174464, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 0, 0, + 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 67174464, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 67174464, 0, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, + 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 67174464, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, + 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 67174464, 0, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 67174464, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 67174464, 0, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, + 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, + 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 67174464, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 67174464, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 67174464, 0, 67174464, 0, 0, 0, + 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, + 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 67174464, 0, + 0, 0, 67174464, 0, 0, 0, 67174464, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 67174464, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 67174464, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67174464, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 67174464, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 67174464, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + }, + } +}; + +static const hi_isp_cmos_wdr g_stIspWDR = { + /* bFusionMode */ + 1, + + /* bMotionComp */ + 1, + + /* u16ShortThr */ + 4032, + + /* u16LongThr */ + 3008, + + /* bForceLong */ + 1, + + /* u16ForceLongLowThr */ + 500, + + /* u16ForceLongHigThr */ + 700, + + /* bShortExpoChk */ + 0, + + /* u16ShortCheckThd */ + 0x0, + + /* bMDRefFlicker */ + 0, + + /* au8MdThrLowGain[16] */ + + { 64, 64, 64, 64, 64, 64, 64, 96, 128, 255, 255, 255, 255, 255, 255, 255 }, + + /* au8MdThrHigGain[16] */ + + { 128, 128, 128, 128, 128, 128, 128, 128, 128, 255, 255, 255, 255, 255, 255, 255 }, + + /* enBnrMode */ + 1, + + /* u8BnrStr */ + // 16, + + /* au16FusionThr[4] */ + + { 3855, 3000 }, + + /* u8MdtStillThd */ + 0x14, + + /* u8MdtLongBlend */ + 0x0 + +}; + +static const hi_isp_cmos_dpc g_stCmosDpc = { + {0, 0, 0, 152, 200, 200, 220, 220, 220, 220, 152, 152, 152, 152, 152, 152}, /* au16Strength[16] */ + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 50, 50, 50, 50}, /* au16BlendRatio[16] */ +}; + +static const hi_isp_cmos_lsc ST_CMOS_LSC_NORMAL_LENS = { + /* MeshStrength */ + 4096, + /* MeshScale */ + 4, + /* ISP_LSC_CABLI_TABLE_S */ + { + { + /* Rgain */ + { + 0x26b, 0x228, 0x1de, 0x1a8, 0x179, 0x149, 0x12a, 0x109, 0xee, 0xd5, 0xc4, 0xb0, 0xa2, 0x9b, 0x94, + 0x8f, 0x94, 0x93, 0x97, 0x9f, 0xad, 0xb8, 0xc8, 0xdb, 0x10d, 0x14a, 0x133, 0x15a, 0x184, 0x1c1, + 0x1fd, 0x23b, 0x284, 0x24e, 0x212, 0x1d3, 0x19a, 0x168, 0x13d, 0x11b, 0xfa, 0xe4, 0xca, 0xbb, 0xa7, + 0x9a, 0x93, 0x87, 0x88, 0x86, 0x85, 0x8d, 0x98, 0xa0, 0xab, 0xbd, 0xce, 0xf8, 0x12e, 0x123, + 0x14c, 0x179, 0x1af, 0x1e8, 0x22d, 0x267, 0x235, 0x1f9, 0x1ba, 0x18a, 0x158, 0x12c, 0x10d, 0xe9, 0xd3, + 0xbf, 0xad, 0x9b, 0x8c, 0x7e, 0x7b, 0x79, 0x74, 0x79, 0x7b, 0x86, 0x90, 0x9f, 0xaf, 0xc1, + 0xd8, 0xff, 0x114, 0x137, 0x164, 0x198, 0x1d1, 0x213, 0x253, 0x21f, 0x1e5, 0x1a8, 0x172, 0x146, 0x11a, + 0xfc, 0xde, 0xc8, 0xb1, 0x9d, 0x8a, 0x7f, 0x73, 0x6c, 0x66, 0x65, 0x68, 0x6c, 0x74, 0x80, + 0x92, 0xa0, 0xb5, 0xc9, 0xe4, 0x103, 0x128, 0x154, 0x183, 0x1bc, 0x1fe, 0x23b, 0x210, 0x1d3, 0x194, + 0x160, 0x136, 0x10e, 0xec, 0xd3, 0xbc, 0xa4, 0x91, 0x81, 0x6f, 0x67, 0x5d, 0x59, 0x59, 0x59, + 0x5f, 0x6a, 0x75, 0x84, 0x94, 0xab, 0xbf, 0xda, 0xf7, 0x11b, 0x149, 0x173, 0x1ac, 0x1ed, 0x229, + 0x1fa, 0x1c3, 0x185, 0x152, 0x124, 0x101, 0xe2, 0xcd, 0xaf, 0x9c, 0x86, 0x74, 0x65, 0x5a, 0x52, + 0x4c, 0x4c, 0x4d, 0x52, 0x5e, 0x6b, 0x7a, 0x8a, 0x9f, 0xb5, 0xcb, 0xeb, 0x10d, 0x137, 0x165, + 0x19c, 0x1da, 0x218, 0x1e1, 0x1b1, 0x177, 0x148, 0x11a, 0xf8, 0xd7, 0xbf, 0xa6, 0x90, 0x7c, 0x68, + 0x5b, 0x4d, 0x44, 0x40, 0x3e, 0x40, 0x4a, 0x51, 0x5c, 0x6c, 0x7d, 0x95, 0xab, 0xc3, 0xe2, + 0x101, 0x127, 0x154, 0x18f, 0x1cd, 0x200, 0x1d8, 0x1a2, 0x169, 0x13c, 0x111, 0xee, 0xd0, 0xb6, 0x9e, + 0x87, 0x73, 0x5f, 0x4f, 0x44, 0x38, 0x36, 0x35, 0x36, 0x3f, 0x47, 0x55, 0x64, 0x74, 0x8d, + 0xa3, 0xbd, 0xd7, 0xf8, 0x11e, 0x14a, 0x182, 0x1c2, 0x1f4, 0x1c8, 0x197, 0x15f, 0x131, 0x10d, 0xe9, + 0xc9, 0xae, 0x98, 0x7e, 0x69, 0x59, 0x4a, 0x3c, 0x32, 0x2b, 0x2a, 0x2b, 0x33, 0x41, 0x4a, + 0x55, 0x6b, 0x82, 0x9e, 0xb4, 0xd0, 0xed, 0x113, 0x142, 0x175, 0x1b3, 0x1e5, 0x1c1, 0x189, 0x154, + 0x126, 0x103, 0xdf, 0xc5, 0xa4, 0x8b, 0x77, 0x62, 0x4e, 0x3e, 0x34, 0x28, 0x20, 0x1f, 0x23, + 0x2b, 0x35, 0x43, 0x53, 0x64, 0x7a, 0x95, 0xac, 0xca, 0xe8, 0x10c, 0x13a, 0x16b, 0x1a9, 0x1e2, + 0x1b6, 0x182, 0x14f, 0x124, 0xf9, 0xdb, 0xbf, 0xa0, 0x84, 0x6d, 0x57, 0x46, 0x34, 0x29, 0x21, + 0x17, 0x18, 0x17, 0x21, 0x2c, 0x3a, 0x4b, 0x5e, 0x73, 0x8e, 0xa5, 0xc2, 0xe3, 0x105, 0x135, + 0x162, 0x1a0, 0x1d8, 0x1b0, 0x177, 0x146, 0x11d, 0xf6, 0xd7, 0xb8, 0x99, 0x81, 0x6a, 0x53, 0x41, + 0x2f, 0x21, 0x18, 0x11, 0xf, 0x11, 0x1b, 0x25, 0x35, 0x47, 0x5b, 0x6c, 0x86, 0xa2, 0xbc, + 0xdf, 0x101, 0x129, 0x15f, 0x198, 0x1cd, 0x1a9, 0x175, 0x140, 0x112, 0xef, 0xd4, 0xb4, 0x96, 0x7d, + 0x65, 0x50, 0x39, 0x2d, 0x1c, 0x11, 0x9, 0xa, 0xb, 0x15, 0x1f, 0x2f, 0x3f, 0x57, 0x69, + 0x83, 0x9e, 0xb9, 0xd9, 0xfb, 0x126, 0x156, 0x192, 0x1c3, 0x1a6, 0x171, 0x13a, 0x111, 0xef, 0xce, + 0xb1, 0x95, 0x7a, 0x65, 0x4e, 0x39, 0x28, 0x17, 0x9, 0x5, 0x3, 0x7, 0x10, 0x1b, 0x2b, + 0x3e, 0x51, 0x67, 0x82, 0x9c, 0xba, 0xd4, 0xfa, 0x124, 0x152, 0x18d, 0x1be, 0x1a5, 0x16d, 0x134, + 0x10d, 0xe9, 0xd0, 0xae, 0x92, 0x7a, 0x5d, 0x4b, 0x33, 0x26, 0x15, 0x8, 0x2, 0x4, 0x8, + 0xc, 0x16, 0x28, 0x3a, 0x4f, 0x65, 0x7f, 0x9a, 0xb8, 0xd6, 0xf7, 0x123, 0x151, 0x18a, 0x1bf, + 0x19b, 0x167, 0x137, 0x10c, 0xe8, 0xcb, 0xab, 0x8f, 0x78, 0x5d, 0x47, 0x33, 0x27, 0x11, 0x4, + 0x0, 0x2, 0x6, 0xe, 0x16, 0x27, 0x3b, 0x50, 0x65, 0x7d, 0x98, 0xb7, 0xd4, 0xf4, 0x121, + 0x151, 0x18d, 0x1be, 0x19d, 0x165, 0x134, 0x10f, 0xe8, 0xc8, 0xac, 0x8f, 0x75, 0x5c, 0x48, 0x37, + 0x34, 0x11, 0x4, 0x0, 0x0, 0x3, 0xa, 0x16, 0x25, 0x39, 0x50, 0x64, 0x7e, 0x9a, 0xb5, + 0xd5, 0xf8, 0x120, 0x150, 0x18b, 0x1bd, 0x198, 0x16a, 0x135, 0x10e, 0xe8, 0xc9, 0xab, 0x8b, 0x74, + 0x5c, 0x4b, 0x39, 0x36, 0x15, 0x6, 0x1, 0x1, 0x3, 0xc, 0x17, 0x26, 0x3b, 0x4e, 0x65, + 0x7f, 0x98, 0xb6, 0xd5, 0xfa, 0x11e, 0x150, 0x187, 0x1c0, 0x199, 0x167, 0x134, 0x10d, 0xea, 0xca, + 0xae, 0x8e, 0x73, 0x60, 0x4b, 0x39, 0x32, 0x16, 0x5, 0x4, 0x2, 0x6, 0xd, 0x19, 0x2a, + 0x3c, 0x4e, 0x66, 0x83, 0x9a, 0xbc, 0xd3, 0xf9, 0x11f, 0x151, 0x18a, 0x1c0, 0x19d, 0x16b, 0x135, + 0x110, 0xef, 0xce, 0xae, 0x94, 0x7b, 0x64, 0x4d, 0x3b, 0x2b, 0x19, 0x9, 0x9, 0x7, 0xc, + 0xf, 0x1c, 0x2c, 0x41, 0x54, 0x6a, 0x82, 0x9a, 0xbb, 0xd8, 0xfc, 0x124, 0x156, 0x18c, 0x1c0, + 0x1a5, 0x170, 0x139, 0x114, 0xee, 0xd1, 0xb1, 0x95, 0x7e, 0x65, 0x51, 0x3d, 0x2f, 0x1f, 0x14, + 0xc, 0xd, 0xe, 0x16, 0x23, 0x31, 0x42, 0x56, 0x6f, 0x86, 0x9e, 0xbb, 0xda, 0x100, 0x128, + 0x158, 0x190, 0x1c3, 0x1a9, 0x172, 0x144, 0x115, 0xf2, 0xd3, 0xb9, 0x99, 0x80, 0x6b, 0x58, 0x43, + 0x33, 0x28, 0x1b, 0x16, 0x14, 0x15, 0x1b, 0x2a, 0x3b, 0x48, 0x5b, 0x75, 0x8a, 0xa4, 0xc1, + 0xdc, 0x103, 0x12c, 0x15d, 0x196, 0x1cc, 0x1b2, 0x17b, 0x147, 0x11b, 0xfe, 0xda, 0xbd, 0x9f, 0x87, + 0x72, 0x5f, 0x4a, 0x3b, 0x2e, 0x24, 0x1d, 0x1b, 0x1d, 0x24, 0x32, 0x43, 0x51, 0x64, 0x79, + 0x90, 0xaa, 0xc8, 0xeb, 0x107, 0x134, 0x164, 0x19e, 0x1d2, 0x1b3, 0x187, 0x14e, 0x125, 0x102, 0xe2, + 0xc1, 0xa6, 0x8e, 0x77, 0x65, 0x53, 0x44, 0x37, 0x2c, 0x27, 0x25, 0x26, 0x2b, 0x37, 0x45, + 0x55, 0x67, 0x7f, 0x97, 0xb3, 0xcb, 0xec, 0x10f, 0x13c, 0x169, 0x1a4, 0x1dd, 0x1c1, 0x18b, 0x159, + 0x12e, 0x107, 0xe4, 0xca, 0xaf, 0x94, 0x80, 0x6e, 0x5a, 0x4d, 0x40, 0x36, 0x30, 0x30, 0x31, + 0x36, 0x41, 0x4e, 0x5f, 0x74, 0x89, 0x9b, 0xb5, 0xd1, 0xf1, 0x11a, 0x141, 0x173, 0x1aa, 0x1e2, + 0x1c9, 0x198, 0x162, 0x133, 0x112, 0xec, 0xd5, 0xbc, 0x9e, 0x88, 0x75, 0x65, 0x56, 0x4c, 0x42, + 0x3b, 0x3a, 0x3f, 0x40, 0x4c, 0x57, 0x6a, 0x7c, 0x91, 0xa5, 0xc0, 0xda, 0xf8, 0x11e, 0x148, + 0x17b, 0x1b7, 0x1ef, 0x1de, 0x1a5, 0x16f, 0x140, 0x119, 0xf8, 0xda, 0xc4, 0xa7, 0x92, 0x7f, 0x6d, + 0x64, 0x57, 0x4e, 0x48, 0x45, 0x48, 0x4f, 0x56, 0x62, 0x73, 0x86, 0x98, 0xb1, 0xc5, 0xe6, + 0x105, 0x128, 0x155, 0x188, 0x1c4, 0x1fd, 0x1e8, 0x1b2, 0x17b, 0x14b, 0x126, 0x103, 0xe8, 0xcc, 0xb1, + 0x9e, 0x89, 0x7d, 0x6f, 0x60, 0x59, 0x53, 0x53, 0x55, 0x5b, 0x64, 0x6f, 0x80, 0x8f, 0xa5, + 0xbe, 0xd4, 0xf0, 0x10d, 0x135, 0x15f, 0x18f, 0x1d6, 0x20c, 0x1f9, 0x1bf, 0x18a, 0x15a, 0x131, 0x10e, + 0xf2, 0xd7, 0xbf, 0xab, 0x99, 0x89, 0x79, 0x70, 0x65, 0x61, 0x60, 0x62, 0x6a, 0x72, 0x7b, + 0x8c, 0x9e, 0xb3, 0xc9, 0xe2, 0xfb, 0x117, 0x13d, 0x169, 0x19f, 0x1df, 0x21e, 0x20c, 0x1cf, 0x198, + 0x166, 0x13f, 0x119, 0xfb, 0xe0, 0xca, 0xb6, 0xa7, 0x95, 0x85, 0x7d, 0x74, 0x6e, 0x70, 0x70, + 0x74, 0x7d, 0x87, 0x98, 0xa9, 0xbe, 0xd2, 0xee, 0x106, 0x125, 0x14c, 0x176, 0x1af, 0x1f4, 0x22d, + 0x21c, 0x1e3, 0x1a9, 0x178, 0x14b, 0x126, 0x109, 0xee, 0xd6, 0xc3, 0xb4, 0xa5, 0x96, 0x8d, 0x83, + 0x7d, 0x7f, 0x7c, 0x83, 0x8f, 0x94, 0xa6, 0xb7, 0xcc, 0xe0, 0xf6, 0x115, 0x133, 0x15d, 0x189, + 0x1c1, 0x204, 0x23f, 0x22d, 0x1f1, 0x1bb, 0x187, 0x157, 0x132, 0x118, 0xfe, 0xe6, 0xd1, 0xc3, 0xb3, + 0xa7, 0x98, 0x91, 0x8b, 0x8e, 0x8d, 0x91, 0x9b, 0xa6, 0xb5, 0xc5, 0xd9, 0xf1, 0x107, 0x122, + 0x144, 0x16b, 0x19d, 0x1d5, 0x218, 0x252, 0x244, 0x204, 0x1c8, 0x18e, 0x167, 0x137, 0x127, 0x108, 0xf5, + 0xdd, 0xcc, 0xbf, 0xb1, 0xa6, 0x9f, 0x9d, 0x99, 0x9a, 0x98, 0xa5, 0xb3, 0xc0, 0xce, 0xe2, + 0xf7, 0x10b, 0x12e, 0x155, 0x17a, 0x1a6, 0x1e9, 0x223, 0x262, + }, + + /* Grgain */ + { + 0x27c, 0x243, 0x1fd, 0x1be, 0x18b, 0x162, 0x138, 0x114, 0xfb, 0xe1, 0xd2, 0xbb, 0xb1, 0xa9, 0xa3, + 0x9e, 0x9d, 0x9d, 0xa0, 0xb1, 0xb7, 0xc3, 0xd8, 0xea, 0x11d, 0x15a, 0x141, 0x170, 0x1a4, 0x1d8, + 0x21c, 0x268, 0x2ab, 0x265, 0x22e, 0x1e8, 0x1b1, 0x17e, 0x153, 0x128, 0x107, 0xef, 0xd9, 0xc6, 0xb3, + 0xa6, 0x9b, 0x94, 0x90, 0x91, 0x94, 0x96, 0xa0, 0xac, 0xb7, 0xcc, 0xdd, 0x101, 0x13d, 0x137, + 0x165, 0x193, 0x1c5, 0x206, 0x253, 0x297, 0x24a, 0x217, 0x1d0, 0x197, 0x164, 0x13d, 0x113, 0xf4, 0xde, + 0xc8, 0xb4, 0xa7, 0x96, 0x8c, 0x83, 0x7e, 0x7e, 0x81, 0x84, 0x8f, 0x9a, 0xa9, 0xbb, 0xcd, + 0xe8, 0x10f, 0x128, 0x150, 0x17a, 0x1b1, 0x1ec, 0x236, 0x274, 0x22f, 0x1fb, 0x1bb, 0x181, 0x154, 0x12b, + 0x108, 0xe8, 0xd0, 0xba, 0xa6, 0x96, 0x87, 0x7b, 0x74, 0x6f, 0x6e, 0x6e, 0x75, 0x7f, 0x8c, + 0x98, 0xab, 0xc2, 0xd9, 0xf3, 0x116, 0x13b, 0x168, 0x19d, 0x1d6, 0x220, 0x25c, 0x21c, 0x1e9, 0x1a8, + 0x173, 0x140, 0x11b, 0xf8, 0xde, 0xc5, 0xaf, 0x9b, 0x88, 0x77, 0x6d, 0x64, 0x5e, 0x5d, 0x61, + 0x67, 0x6f, 0x80, 0x8b, 0x9f, 0xb6, 0xca, 0xe7, 0x105, 0x12d, 0x15a, 0x18d, 0x1c1, 0x20a, 0x24e, + 0x209, 0x1d3, 0x199, 0x164, 0x134, 0x10e, 0xee, 0xd2, 0xba, 0xa4, 0x8e, 0x7c, 0x6b, 0x61, 0x58, + 0x53, 0x50, 0x54, 0x5a, 0x64, 0x70, 0x80, 0x92, 0xa8, 0xc1, 0xde, 0xfa, 0x11d, 0x147, 0x17b, + 0x1b7, 0x1f7, 0x238, 0x1f6, 0x1c5, 0x18b, 0x154, 0x127, 0x101, 0xe6, 0xc7, 0xaf, 0x97, 0x82, 0x70, + 0x62, 0x54, 0x4b, 0x44, 0x46, 0x47, 0x4e, 0x56, 0x64, 0x74, 0x85, 0x9d, 0xb6, 0xd1, 0xee, + 0x110, 0x13c, 0x16a, 0x1a6, 0x1e6, 0x22d, 0x1ed, 0x1b6, 0x179, 0x148, 0x11c, 0xfe, 0xda, 0xbc, 0xa7, + 0x8e, 0x78, 0x65, 0x55, 0x4a, 0x41, 0x38, 0x39, 0x3a, 0x43, 0x4c, 0x5a, 0x68, 0x7e, 0x94, + 0xab, 0xc7, 0xe5, 0x103, 0x130, 0x15a, 0x193, 0x1db, 0x21b, 0x1de, 0x1ad, 0x170, 0x13b, 0x118, 0xf0, + 0xd3, 0xb3, 0x9d, 0x85, 0x6f, 0x5c, 0x4c, 0x3d, 0x35, 0x2d, 0x2a, 0x2e, 0x37, 0x43, 0x4f, + 0x61, 0x76, 0x8b, 0xa3, 0xbc, 0xdb, 0xf9, 0x123, 0x153, 0x187, 0x1cc, 0x20b, 0x1ca, 0x19f, 0x165, + 0x130, 0x10c, 0xea, 0xcd, 0xaf, 0x95, 0x7d, 0x65, 0x53, 0x46, 0x36, 0x28, 0x24, 0x22, 0x25, + 0x2e, 0x38, 0x48, 0x58, 0x6c, 0x80, 0x9f, 0xb4, 0xd3, 0xf4, 0x11e, 0x14b, 0x181, 0x1c3, 0x1fc, + 0x1ca, 0x197, 0x15c, 0x129, 0x107, 0xe6, 0xc6, 0xa8, 0x8e, 0x76, 0x5d, 0x4d, 0x3c, 0x2c, 0x21, + 0x18, 0x19, 0x1c, 0x27, 0x2f, 0x41, 0x52, 0x68, 0x79, 0x94, 0xb2, 0xce, 0xee, 0x116, 0x149, + 0x17a, 0x1b9, 0x1fa, 0x1be, 0x18c, 0x156, 0x123, 0x100, 0xdc, 0xbe, 0xa3, 0x89, 0x6f, 0x5a, 0x46, + 0x33, 0x25, 0x19, 0xf, 0xe, 0x16, 0x1d, 0x28, 0x39, 0x49, 0x5f, 0x75, 0x8d, 0xaa, 0xc7, + 0xe9, 0x10f, 0x13c, 0x172, 0x1b3, 0x1ec, 0x1b4, 0x188, 0x151, 0x121, 0xfc, 0xde, 0xbd, 0x9e, 0x85, + 0x6b, 0x54, 0x40, 0x31, 0x1e, 0x12, 0xb, 0x9, 0xf, 0x16, 0x24, 0x34, 0x44, 0x5c, 0x70, + 0x89, 0xa6, 0xc6, 0xe5, 0x10a, 0x137, 0x16b, 0x1ac, 0x1e5, 0x1b1, 0x182, 0x148, 0x11d, 0xfa, 0xdb, + 0xb9, 0x9d, 0x81, 0x68, 0x52, 0x3e, 0x2c, 0x1b, 0xc, 0x6, 0x7, 0x9, 0x11, 0x20, 0x31, + 0x41, 0x59, 0x6e, 0x88, 0xa2, 0xc1, 0xdf, 0x106, 0x134, 0x165, 0x1a6, 0x1de, 0x1ae, 0x17d, 0x147, + 0x119, 0xf7, 0xd6, 0xb7, 0x9a, 0x80, 0x67, 0x53, 0x3a, 0x29, 0x18, 0xa, 0x3, 0x4, 0x6, + 0x12, 0x1a, 0x2c, 0x3f, 0x56, 0x6d, 0x86, 0xa1, 0xc1, 0xde, 0x103, 0x12e, 0x166, 0x1a2, 0x1dc, + 0x1a3, 0x17f, 0x147, 0x11c, 0xf3, 0xd5, 0xb4, 0x98, 0x7d, 0x63, 0x4e, 0x3b, 0x29, 0x13, 0xa, + 0x1, 0x0, 0x4, 0xe, 0x18, 0x2b, 0x40, 0x55, 0x6f, 0x84, 0xa3, 0xbf, 0xdf, 0x102, 0x12c, + 0x163, 0x1a0, 0x1da, 0x1ac, 0x17c, 0x144, 0x116, 0xf5, 0xd6, 0xb5, 0x98, 0x7d, 0x63, 0x4c, 0x3b, + 0x37, 0x14, 0x7, 0x0, 0x1, 0x5, 0xc, 0x1a, 0x2a, 0x40, 0x55, 0x6d, 0x83, 0xa1, 0xbe, + 0xdf, 0x101, 0x12f, 0x166, 0x1a0, 0x1d7, 0x1a7, 0x17d, 0x146, 0x118, 0xf8, 0xd4, 0xb6, 0x98, 0x80, + 0x68, 0x52, 0x3f, 0x3a, 0x18, 0x9, 0x1, 0x2, 0x6, 0xe, 0x1a, 0x2c, 0x40, 0x54, 0x6c, + 0x88, 0xa0, 0xc2, 0xe0, 0x103, 0x12d, 0x160, 0x19f, 0x1d5, 0x1aa, 0x17c, 0x145, 0x119, 0xf9, 0xd9, + 0xb6, 0x9b, 0x82, 0x6b, 0x52, 0x3e, 0x3a, 0x1b, 0xb, 0x3, 0x5, 0x7, 0xd, 0x1c, 0x2d, + 0x43, 0x57, 0x6c, 0x88, 0xa1, 0xc0, 0xe3, 0x102, 0x12e, 0x162, 0x1a0, 0x1dc, 0x1b0, 0x17f, 0x148, + 0x11f, 0xfd, 0xd8, 0xb8, 0x9c, 0x83, 0x6d, 0x55, 0x3f, 0x2d, 0x1e, 0x10, 0x7, 0x7, 0xb, + 0x13, 0x20, 0x31, 0x46, 0x5b, 0x72, 0x8c, 0xa7, 0xc6, 0xe2, 0x107, 0x131, 0x167, 0x1a3, 0x1df, + 0x1b4, 0x185, 0x14d, 0x124, 0xfe, 0xde, 0xbc, 0xa3, 0x87, 0x6e, 0x5c, 0x46, 0x36, 0x24, 0x16, + 0xf, 0xf, 0x13, 0x19, 0x24, 0x36, 0x49, 0x5f, 0x77, 0x8f, 0xad, 0xca, 0xe5, 0x10d, 0x139, + 0x16b, 0x1a6, 0x1e2, 0x1b7, 0x189, 0x152, 0x127, 0x103, 0xe2, 0xc3, 0xa6, 0x8d, 0x76, 0x5d, 0x4c, + 0x3c, 0x2c, 0x1c, 0x18, 0x18, 0x18, 0x21, 0x2b, 0x3d, 0x4e, 0x64, 0x7b, 0x96, 0xb0, 0xcf, + 0xee, 0x111, 0x13c, 0x171, 0x1af, 0x1e7, 0x1be, 0x191, 0x15a, 0x12d, 0x10b, 0xe3, 0xca, 0xac, 0x90, + 0x7a, 0x63, 0x57, 0x3e, 0x32, 0x26, 0x20, 0x1f, 0x23, 0x2b, 0x34, 0x44, 0x57, 0x69, 0x83, + 0x9c, 0xb4, 0xd2, 0xf7, 0x119, 0x145, 0x175, 0x1b8, 0x1f3, 0x1ca, 0x19a, 0x162, 0x139, 0x110, 0xea, + 0xcc, 0xb2, 0x98, 0x81, 0x6c, 0x59, 0x4a, 0x3b, 0x32, 0x2c, 0x29, 0x2b, 0x2f, 0x3d, 0x4a, + 0x5b, 0x73, 0x88, 0xa2, 0xbc, 0xd7, 0xfd, 0x11e, 0x147, 0x180, 0x1bf, 0x1fb, 0x1c9, 0x1a4, 0x16a, + 0x13f, 0x114, 0xf4, 0xd5, 0xba, 0x9e, 0x8a, 0x77, 0x63, 0x54, 0x45, 0x3a, 0x36, 0x33, 0x35, + 0x3a, 0x48, 0x54, 0x66, 0x79, 0x8f, 0xa8, 0xc6, 0xe1, 0x104, 0x127, 0x14f, 0x184, 0x1c8, 0x203, + 0x1e3, 0x1b0, 0x177, 0x145, 0x11e, 0xfd, 0xdc, 0xc3, 0xa5, 0x90, 0x7b, 0x6d, 0x5d, 0x50, 0x46, + 0x42, 0x41, 0x40, 0x47, 0x52, 0x61, 0x70, 0x85, 0x9b, 0xb3, 0xce, 0xe7, 0x109, 0x131, 0x15c, + 0x192, 0x1d1, 0x213, 0x1ed, 0x1bf, 0x186, 0x152, 0x12a, 0x108, 0xe7, 0xcd, 0xb1, 0x9c, 0x87, 0x78, + 0x6a, 0x5d, 0x55, 0x4f, 0x4c, 0x4d, 0x54, 0x5c, 0x6d, 0x7d, 0x8f, 0xa4, 0xbb, 0xd7, 0xf4, + 0x112, 0x137, 0x169, 0x1a0, 0x1de, 0x21a, 0x1fa, 0x1d2, 0x190, 0x160, 0x133, 0x110, 0xf2, 0xd9, 0xbb, + 0xa7, 0x96, 0x84, 0x75, 0x68, 0x5e, 0x5c, 0x5a, 0x5c, 0x60, 0x6d, 0x77, 0x8a, 0x99, 0xad, + 0xc6, 0xe1, 0xfd, 0x11d, 0x146, 0x173, 0x1ab, 0x1eb, 0x22a, 0x20d, 0x1dd, 0x1a0, 0x16f, 0x140, 0x11a, + 0xfc, 0xe5, 0xc7, 0xb3, 0xa3, 0x8f, 0x81, 0x75, 0x6d, 0x69, 0x66, 0x69, 0x71, 0x78, 0x85, + 0x93, 0xa5, 0xbb, 0xd3, 0xec, 0x108, 0x128, 0x152, 0x180, 0x1b9, 0x1fe, 0x23c, 0x21e, 0x1ee, 0x1b2, + 0x179, 0x150, 0x12c, 0x10c, 0xef, 0xd6, 0xc0, 0xad, 0x9d, 0x8f, 0x83, 0x7a, 0x79, 0x74, 0x79, + 0x7e, 0x86, 0x91, 0x9f, 0xb3, 0xcc, 0xdf, 0xf8, 0x114, 0x13b, 0x162, 0x18f, 0x1ca, 0x20e, 0x24e, + 0x231, 0x201, 0x1bf, 0x18c, 0x160, 0x137, 0x119, 0xfd, 0xe6, 0xcd, 0xbd, 0xad, 0x9e, 0x94, 0x8a, + 0x88, 0x84, 0x85, 0x8c, 0x97, 0xa2, 0xb0, 0xc5, 0xd6, 0xf0, 0x106, 0x123, 0x147, 0x16d, 0x1a1, + 0x1da, 0x21d, 0x260, 0x244, 0x211, 0x1d4, 0x19c, 0x171, 0x147, 0x128, 0x10e, 0xf3, 0xdf, 0xcc, 0xbc, + 0xaf, 0xa5, 0x9c, 0x96, 0x94, 0x97, 0x9c, 0xa7, 0xb0, 0xc1, 0xd4, 0xe7, 0xfd, 0x113, 0x131, + 0x156, 0x181, 0x1af, 0x1f1, 0x23a, 0x276, 0x25c, 0x224, 0x1e1, 0x1a9, 0x17f, 0x153, 0x136, 0x117, 0xfd, + 0xeb, 0xda, 0xc5, 0xbe, 0xb2, 0xaa, 0xa2, 0x9f, 0xa3, 0xa9, 0xb5, 0xbb, 0xcc, 0xda, 0xf1, + 0x104, 0x122, 0x13e, 0x161, 0x18e, 0x1c4, 0x1ff, 0x24b, 0x285, + }, + + /* Gbgain */ + { + 0x28b, 0x248, 0x1fd, 0x1c1, 0x18e, 0x160, 0x139, 0x115, 0xfd, 0xe8, 0xd7, 0xc4, 0xb6, 0xad, 0xa3, + 0xa4, 0xa4, 0xa3, 0xa9, 0xb5, 0xbc, 0xc8, 0xde, 0xf4, 0x126, 0x166, 0x14d, 0x17a, 0x1a5, 0x1dd, + 0x21f, 0x26c, 0x2b1, 0x271, 0x232, 0x1ea, 0x1b0, 0x180, 0x152, 0x12b, 0x10c, 0xf2, 0xdc, 0xca, 0xb9, + 0xab, 0xa1, 0x9a, 0x96, 0x96, 0x99, 0xa0, 0xa6, 0xb0, 0xbf, 0xd2, 0xe5, 0x10a, 0x143, 0x13f, + 0x16b, 0x19c, 0x1cd, 0x20e, 0x256, 0x29c, 0x256, 0x216, 0x1d6, 0x19d, 0x16a, 0x142, 0x11d, 0xfd, 0xe4, + 0xcc, 0xb9, 0xa9, 0x9b, 0x91, 0x87, 0x84, 0x83, 0x84, 0x8b, 0x94, 0xa0, 0xae, 0xc1, 0xd7, + 0xec, 0x113, 0x12e, 0x156, 0x183, 0x1b7, 0x1f5, 0x23d, 0x284, 0x240, 0x201, 0x1c3, 0x185, 0x155, 0x12d, + 0x10e, 0xee, 0xd4, 0xbe, 0xa9, 0x9b, 0x8b, 0x7e, 0x79, 0x74, 0x73, 0x74, 0x7a, 0x88, 0x92, + 0x9d, 0xb2, 0xc8, 0xe1, 0xfc, 0x11c, 0x143, 0x172, 0x1a1, 0x1dd, 0x226, 0x266, 0x229, 0x1eb, 0x1ad, + 0x176, 0x142, 0x11f, 0xfb, 0xe1, 0xc9, 0xb0, 0x9f, 0x89, 0x7c, 0x71, 0x6a, 0x64, 0x62, 0x65, + 0x6c, 0x74, 0x84, 0x90, 0xa4, 0xba, 0xd2, 0xed, 0x10f, 0x132, 0x15f, 0x18f, 0x1ce, 0x20f, 0x252, + 0x21a, 0x1d7, 0x19c, 0x163, 0x136, 0x110, 0xf1, 0xd5, 0xbc, 0xa6, 0x92, 0x81, 0x72, 0x64, 0x59, + 0x57, 0x58, 0x59, 0x5e, 0x69, 0x75, 0x84, 0x97, 0xad, 0xc5, 0xe1, 0x102, 0x124, 0x151, 0x183, + 0x1bc, 0x1ff, 0x23b, 0x201, 0x1c5, 0x18a, 0x155, 0x129, 0x106, 0xe8, 0xcc, 0xb1, 0x9a, 0x86, 0x74, + 0x67, 0x58, 0x4d, 0x4b, 0x4b, 0x4a, 0x51, 0x5c, 0x6a, 0x7c, 0x8b, 0xa4, 0xbc, 0xd5, 0xf9, + 0x115, 0x140, 0x175, 0x1ac, 0x1ef, 0x229, 0x1f5, 0x1b9, 0x17e, 0x14b, 0x11d, 0xfc, 0xde, 0xc0, 0xa9, + 0x91, 0x7c, 0x6a, 0x59, 0x4d, 0x43, 0x3f, 0x3c, 0x3f, 0x46, 0x4f, 0x5e, 0x6e, 0x84, 0x99, + 0xb0, 0xc9, 0xeb, 0x109, 0x135, 0x163, 0x19e, 0x1de, 0x21e, 0x1ea, 0x1af, 0x176, 0x142, 0x116, 0xf6, + 0xd2, 0xb7, 0x9e, 0x87, 0x73, 0x60, 0x4e, 0x43, 0x38, 0x31, 0x2f, 0x32, 0x3c, 0x45, 0x54, + 0x65, 0x7a, 0x91, 0xaa, 0xc3, 0xe0, 0x101, 0x127, 0x158, 0x18f, 0x1d1, 0x211, 0x1de, 0x1a2, 0x168, + 0x137, 0x110, 0xee, 0xcd, 0xb1, 0x98, 0x7f, 0x67, 0x56, 0x44, 0x39, 0x2e, 0x27, 0x27, 0x2a, + 0x33, 0x3d, 0x4a, 0x5c, 0x71, 0x87, 0xa3, 0xba, 0xda, 0xfa, 0x120, 0x14e, 0x183, 0x1c6, 0x208, + 0x1ce, 0x199, 0x160, 0x130, 0x107, 0xe8, 0xc8, 0xab, 0x94, 0x79, 0x5f, 0x50, 0x3d, 0x2f, 0x22, + 0x1a, 0x1e, 0x1e, 0x28, 0x32, 0x43, 0x55, 0x6b, 0x7f, 0x9a, 0xb4, 0xd1, 0xf3, 0x11c, 0x147, + 0x17d, 0x1c0, 0x1fa, 0x1c8, 0x191, 0x159, 0x12a, 0x101, 0xe1, 0xc3, 0xa4, 0x8c, 0x73, 0x5b, 0x48, + 0x34, 0x28, 0x1c, 0x13, 0x13, 0x14, 0x21, 0x2b, 0x3b, 0x4c, 0x65, 0x7a, 0x92, 0xae, 0xcf, + 0xeb, 0x116, 0x145, 0x178, 0x1b7, 0x1f6, 0x1bf, 0x188, 0x153, 0x11e, 0x101, 0xde, 0xbe, 0xa0, 0x86, + 0x6c, 0x54, 0x43, 0x2f, 0x20, 0x14, 0xd, 0xc, 0x10, 0x1b, 0x26, 0x36, 0x46, 0x60, 0x75, + 0x91, 0xa9, 0xc9, 0xea, 0x110, 0x13c, 0x16f, 0x1b0, 0x1eb, 0x1b8, 0x181, 0x14d, 0x121, 0xfc, 0xdb, + 0xb8, 0x9d, 0x85, 0x67, 0x54, 0x3e, 0x2e, 0x1c, 0xf, 0x7, 0x7, 0xa, 0x15, 0x21, 0x32, + 0x46, 0x5a, 0x72, 0x8b, 0xa8, 0xc7, 0xe4, 0x10c, 0x137, 0x16b, 0x1ab, 0x1e5, 0x1bf, 0x17f, 0x14a, + 0x11e, 0xfa, 0xd6, 0xb8, 0x9d, 0x81, 0x69, 0x4f, 0x3c, 0x28, 0x19, 0xb, 0x4, 0x3, 0x9, + 0x11, 0x1d, 0x2e, 0x43, 0x56, 0x6f, 0x8a, 0xa4, 0xc6, 0xe2, 0x10a, 0x139, 0x16a, 0x1ad, 0x1e2, + 0x1b5, 0x17f, 0x147, 0x11c, 0xf9, 0xd7, 0xb6, 0x97, 0x7d, 0x67, 0x4f, 0x3a, 0x2c, 0x16, 0x8, + 0x3, 0x3, 0x7, 0x12, 0x1b, 0x2e, 0x41, 0x57, 0x71, 0x8b, 0xa7, 0xc3, 0xe0, 0x109, 0x137, + 0x168, 0x1a5, 0x1db, 0x1b1, 0x17f, 0x149, 0x11b, 0xfa, 0xd4, 0xb8, 0x96, 0x7f, 0x66, 0x50, 0x3d, + 0x37, 0x16, 0x8, 0x1, 0x0, 0x6, 0xf, 0x18, 0x2e, 0x42, 0x57, 0x6f, 0x89, 0xa4, 0xc2, + 0xe3, 0x107, 0x135, 0x16a, 0x1a3, 0x1df, 0x1b2, 0x17f, 0x149, 0x11b, 0xf8, 0xd8, 0xb9, 0x9a, 0x7f, + 0x67, 0x52, 0x41, 0x3c, 0x16, 0xb, 0x3, 0x3, 0x7, 0xf, 0x19, 0x30, 0x43, 0x58, 0x6d, + 0x88, 0xa3, 0xc6, 0xe4, 0x107, 0x134, 0x167, 0x1a2, 0x1dd, 0x1b9, 0x180, 0x148, 0x120, 0xf9, 0xd9, + 0xba, 0x9c, 0x82, 0x68, 0x54, 0x3f, 0x36, 0x19, 0xd, 0x5, 0x5, 0x9, 0x10, 0x1e, 0x2f, + 0x43, 0x5a, 0x70, 0x8b, 0xa6, 0xc5, 0xe5, 0x10a, 0x136, 0x167, 0x1a4, 0x1dd, 0x1b9, 0x183, 0x14b, + 0x122, 0xfe, 0xda, 0xbc, 0x9d, 0x84, 0x6a, 0x56, 0x41, 0x2e, 0x1e, 0xf, 0xb, 0xa, 0xc, + 0x14, 0x23, 0x34, 0x4a, 0x5e, 0x74, 0x8d, 0xab, 0xc6, 0xe7, 0x10a, 0x139, 0x16e, 0x1a8, 0x1e0, + 0x1c0, 0x18b, 0x150, 0x123, 0x100, 0xdd, 0xbf, 0xa5, 0x86, 0x6d, 0x5a, 0x46, 0x34, 0x24, 0x16, + 0x11, 0x10, 0x12, 0x18, 0x26, 0x39, 0x4c, 0x61, 0x7a, 0x91, 0xae, 0xcb, 0xec, 0x115, 0x13e, + 0x171, 0x1ab, 0x1e9, 0x1c5, 0x18d, 0x155, 0x12a, 0x106, 0xe3, 0xc2, 0xa6, 0x8c, 0x76, 0x5d, 0x4c, + 0x3c, 0x2c, 0x1f, 0x19, 0x18, 0x1a, 0x22, 0x30, 0x40, 0x51, 0x66, 0x81, 0x96, 0xb3, 0xd1, + 0xf1, 0x117, 0x141, 0x174, 0x1b3, 0x1ed, 0x1d0, 0x194, 0x15d, 0x132, 0x10b, 0xe7, 0xc9, 0xac, 0x93, + 0x7c, 0x66, 0x53, 0x43, 0x35, 0x26, 0x22, 0x1f, 0x23, 0x29, 0x37, 0x46, 0x56, 0x6d, 0x84, + 0x9f, 0xba, 0xd4, 0xf7, 0x11a, 0x148, 0x17d, 0x1bb, 0x1f3, 0x1d3, 0x19c, 0x166, 0x138, 0x113, 0xed, + 0xce, 0xb2, 0x98, 0x82, 0x70, 0x58, 0x48, 0x3d, 0x32, 0x2b, 0x2a, 0x2c, 0x34, 0x40, 0x50, + 0x5f, 0x75, 0x8b, 0xa3, 0xc0, 0xdb, 0xfe, 0x122, 0x14e, 0x184, 0x1c5, 0x205, 0x1e1, 0x1a7, 0x16e, + 0x13e, 0x11a, 0xf5, 0xd6, 0xbb, 0x9d, 0x87, 0x76, 0x62, 0x54, 0x45, 0x3c, 0x37, 0x35, 0x37, + 0x40, 0x4a, 0x59, 0x69, 0x7b, 0x93, 0xad, 0xc5, 0xe4, 0x101, 0x128, 0x153, 0x187, 0x1cd, 0x20a, + 0x1f0, 0x1b3, 0x177, 0x146, 0x120, 0xfe, 0xdc, 0xc5, 0xa8, 0x8f, 0x7d, 0x6c, 0x5d, 0x4f, 0x47, + 0x41, 0x3f, 0x44, 0x49, 0x54, 0x62, 0x74, 0x86, 0x9b, 0xb1, 0xd1, 0xf0, 0x10c, 0x132, 0x15e, + 0x197, 0x1d8, 0x211, 0x200, 0x1c4, 0x184, 0x157, 0x12c, 0x107, 0xe8, 0xd0, 0xb3, 0x9a, 0x87, 0x76, + 0x66, 0x5a, 0x51, 0x4f, 0x4d, 0x50, 0x55, 0x5e, 0x6d, 0x7f, 0x93, 0xa3, 0xbd, 0xd9, 0xf9, + 0x119, 0x13f, 0x16e, 0x1a2, 0x1e3, 0x21d, 0x20f, 0x1d0, 0x193, 0x163, 0x138, 0x112, 0xf0, 0xd6, 0xbc, + 0xa5, 0x94, 0x83, 0x73, 0x69, 0x61, 0x5a, 0x59, 0x5d, 0x60, 0x6b, 0x79, 0x8b, 0x9e, 0xb4, + 0xc7, 0xe3, 0x104, 0x121, 0x149, 0x17b, 0x1ae, 0x1f3, 0x22e, 0x214, 0x1de, 0x1a4, 0x16f, 0x145, 0x11d, + 0xfd, 0xe1, 0xc7, 0xb4, 0x9f, 0x8f, 0x82, 0x74, 0x6d, 0x67, 0x66, 0x6b, 0x6d, 0x7a, 0x86, + 0x96, 0xa8, 0xbf, 0xd7, 0xef, 0x10c, 0x12b, 0x155, 0x183, 0x1bd, 0x203, 0x246, 0x22c, 0x1f1, 0x1b2, + 0x17f, 0x151, 0x12c, 0x109, 0xed, 0xd4, 0xc2, 0xab, 0x9f, 0x91, 0x83, 0x7a, 0x75, 0x78, 0x7a, + 0x7e, 0x8a, 0x96, 0xa3, 0xb8, 0xcb, 0xe1, 0xfe, 0x11a, 0x13a, 0x165, 0x190, 0x1ce, 0x20f, 0x252, + 0x242, 0x201, 0x1c2, 0x18d, 0x161, 0x136, 0x119, 0xfd, 0xe4, 0xcc, 0xb9, 0xae, 0x9d, 0x94, 0x8f, + 0x88, 0x83, 0x86, 0x8d, 0x9a, 0xa3, 0xb1, 0xc4, 0xd8, 0xf1, 0x109, 0x12a, 0x148, 0x174, 0x1a4, + 0x1e1, 0x227, 0x26b, 0x258, 0x213, 0x1d4, 0x19f, 0x16f, 0x145, 0x128, 0x10a, 0xf1, 0xdc, 0xcc, 0xbd, + 0xb0, 0xa2, 0x9d, 0x98, 0x94, 0x98, 0x9f, 0xa8, 0xb2, 0xc1, 0xd6, 0xe9, 0x101, 0x118, 0x138, + 0x159, 0x183, 0x1b8, 0x1f6, 0x240, 0x287, 0x261, 0x221, 0x1de, 0x1ad, 0x17f, 0x150, 0x131, 0x11b, 0xfd, + 0xe6, 0xd8, 0xcc, 0xbc, 0xa9, 0xac, 0xa0, 0x9d, 0xa0, 0xa9, 0xb5, 0xbe, 0xcb, 0xe0, 0xf7, + 0x109, 0x123, 0x142, 0x166, 0x193, 0x1c9, 0x208, 0x24f, 0x28f, + }, + + /* Bgain */ + { + 0x28e, 0x248, 0x202, 0x1bf, 0x186, 0x15f, 0x12f, 0x10c, 0xfb, 0xda, 0xcc, 0xbe, 0xb4, 0xa9, 0xa4, + 0xa1, 0xa4, 0xa5, 0xa9, 0xb5, 0xba, 0xcd, 0xe2, 0xf4, 0x120, 0x15d, 0x14b, 0x170, 0x1a5, 0x1d5, + 0x220, 0x263, 0x2b6, 0x27c, 0x235, 0x1f1, 0x1af, 0x17b, 0x14d, 0x127, 0x105, 0xec, 0xd4, 0xc2, 0xb2, + 0xa3, 0x96, 0x92, 0x95, 0x93, 0x93, 0x9c, 0xa3, 0xb1, 0xc0, 0xd1, 0xe4, 0x105, 0x13e, 0x139, + 0x162, 0x193, 0x1cd, 0x207, 0x252, 0x29e, 0x251, 0x222, 0x1d8, 0x19f, 0x16e, 0x139, 0x114, 0xf4, 0xde, + 0xc4, 0xb3, 0xa2, 0x92, 0x88, 0x83, 0x82, 0x81, 0x7f, 0x88, 0x94, 0xa1, 0xac, 0xbe, 0xd2, + 0xec, 0x112, 0x128, 0x150, 0x17d, 0x1b0, 0x1f1, 0x239, 0x274, 0x239, 0x203, 0x1c2, 0x18e, 0x15e, 0x12c, + 0x105, 0xe9, 0xd1, 0xb9, 0xa7, 0x97, 0x86, 0x7b, 0x73, 0x6b, 0x6f, 0x6b, 0x76, 0x84, 0x8f, + 0x9e, 0xaf, 0xc1, 0xdb, 0xf6, 0x118, 0x13d, 0x165, 0x1a0, 0x1d8, 0x222, 0x266, 0x228, 0x1f5, 0x1ac, + 0x175, 0x144, 0x11d, 0xfc, 0xe3, 0xc2, 0xb0, 0x97, 0x89, 0x7c, 0x71, 0x67, 0x60, 0x61, 0x5e, + 0x67, 0x74, 0x7e, 0x8b, 0x9e, 0xb5, 0xcf, 0xe6, 0x107, 0x12b, 0x155, 0x18b, 0x1c9, 0x212, 0x252, + 0x208, 0x1d6, 0x19a, 0x161, 0x136, 0x10a, 0xed, 0xd9, 0xbe, 0xa4, 0x8d, 0x7e, 0x6e, 0x62, 0x5c, + 0x53, 0x53, 0x58, 0x5b, 0x62, 0x6f, 0x7e, 0x91, 0xa8, 0xbe, 0xd3, 0xf5, 0x11b, 0x144, 0x17a, + 0x1b2, 0x1ff, 0x23d, 0x1fa, 0x1ca, 0x183, 0x155, 0x12a, 0x104, 0xe4, 0xcb, 0xb0, 0x9b, 0x83, 0x75, + 0x61, 0x57, 0x4d, 0x4b, 0x48, 0x48, 0x50, 0x59, 0x67, 0x78, 0x86, 0x9d, 0xb4, 0xcb, 0xec, + 0x10d, 0x133, 0x165, 0x1a4, 0x1e5, 0x22c, 0x1ec, 0x1b8, 0x17d, 0x141, 0x11b, 0xf7, 0xda, 0xc1, 0xad, + 0x94, 0x7a, 0x64, 0x59, 0x4e, 0x45, 0x3e, 0x3d, 0x3b, 0x43, 0x4d, 0x5b, 0x6b, 0x81, 0x96, + 0xaa, 0xc6, 0xe0, 0x104, 0x128, 0x15c, 0x190, 0x1da, 0x215, 0x1da, 0x1ad, 0x16d, 0x139, 0x113, 0xed, + 0xcd, 0xb7, 0x9f, 0x89, 0x70, 0x61, 0x4e, 0x44, 0x3a, 0x32, 0x2f, 0x34, 0x3c, 0x45, 0x51, + 0x65, 0x75, 0x8d, 0xa0, 0xbc, 0xdb, 0xf7, 0x11e, 0x150, 0x185, 0x1cc, 0x201, 0x1d2, 0x1a1, 0x15d, + 0x12d, 0x10a, 0xe8, 0xca, 0xb1, 0x92, 0x80, 0x67, 0x57, 0x49, 0x38, 0x2f, 0x28, 0x27, 0x29, + 0x33, 0x3c, 0x48, 0x5d, 0x6e, 0x85, 0x9e, 0xb4, 0xd4, 0xf3, 0x119, 0x148, 0x17f, 0x1ba, 0x1f8, + 0x1c5, 0x19b, 0x15d, 0x129, 0x101, 0xe3, 0xc5, 0xa7, 0x8b, 0x77, 0x5b, 0x51, 0x41, 0x34, 0x24, + 0x1c, 0x1e, 0x22, 0x27, 0x33, 0x3d, 0x54, 0x65, 0x81, 0x93, 0xb2, 0xce, 0xeb, 0x114, 0x146, + 0x179, 0x1b4, 0x1fc, 0x1b8, 0x191, 0x158, 0x122, 0x103, 0xde, 0xbb, 0xa0, 0x8c, 0x71, 0x5c, 0x49, + 0x39, 0x2a, 0x1d, 0x16, 0x15, 0x1b, 0x21, 0x28, 0x3a, 0x4c, 0x5f, 0x7a, 0x8d, 0xa9, 0xc7, + 0xe4, 0x10c, 0x13d, 0x172, 0x1b3, 0x1ed, 0x1bc, 0x189, 0x150, 0x120, 0xfb, 0xd9, 0xbe, 0xa0, 0x87, + 0x6f, 0x57, 0x43, 0x30, 0x24, 0x17, 0x11, 0xd, 0x15, 0x18, 0x24, 0x37, 0x46, 0x5f, 0x72, + 0x8b, 0xa6, 0xbf, 0xe3, 0x105, 0x137, 0x16b, 0x1ad, 0x1e9, 0x1b6, 0x184, 0x148, 0x11c, 0xf6, 0xd4, + 0xb6, 0x9a, 0x87, 0x6a, 0x53, 0x3e, 0x2a, 0x1e, 0x11, 0x7, 0x9, 0xb, 0x13, 0x21, 0x34, + 0x47, 0x5b, 0x70, 0x8a, 0xa3, 0xc2, 0xe0, 0x106, 0x132, 0x168, 0x1ab, 0x1e4, 0x1ac, 0x181, 0x147, + 0x11a, 0xf1, 0xd3, 0xb8, 0x98, 0x80, 0x65, 0x4f, 0x42, 0x29, 0x1b, 0xf, 0x6, 0x5, 0x6, + 0x10, 0x1a, 0x32, 0x44, 0x5c, 0x72, 0x88, 0xa3, 0xc2, 0xe4, 0x107, 0x131, 0x160, 0x1a4, 0x1d4, + 0x1ad, 0x17c, 0x13e, 0x112, 0xf0, 0xd3, 0xb5, 0x94, 0x7d, 0x66, 0x52, 0x3c, 0x2a, 0x19, 0xa, + 0x2, 0x0, 0x6, 0x10, 0x1d, 0x2d, 0x44, 0x57, 0x6f, 0x8b, 0xa3, 0xbd, 0xde, 0xff, 0x131, + 0x160, 0x19e, 0x1d8, 0x1af, 0x17c, 0x143, 0x114, 0xf7, 0xd3, 0xb4, 0x92, 0x7d, 0x64, 0x4f, 0x3a, + 0x3a, 0x17, 0x7, 0x2, 0x1, 0x5, 0xc, 0x18, 0x2f, 0x41, 0x57, 0x70, 0x8b, 0xa5, 0xc0, + 0xdf, 0x102, 0x133, 0x15f, 0x1a3, 0x1d8, 0x1a8, 0x17d, 0x149, 0x119, 0xf2, 0xd2, 0xb5, 0x92, 0x7e, + 0x68, 0x4e, 0x43, 0x3b, 0x19, 0xc, 0x3, 0x3, 0x7, 0x11, 0x1d, 0x2f, 0x45, 0x5c, 0x73, + 0x8a, 0xa6, 0xc1, 0xe3, 0x109, 0x131, 0x15e, 0x1a5, 0x1d8, 0x1a8, 0x17f, 0x147, 0x119, 0xf5, 0xd7, + 0xb6, 0x9b, 0x80, 0x68, 0x51, 0x3f, 0x37, 0x1b, 0xc, 0x6, 0x5, 0xa, 0x10, 0x1d, 0x2f, + 0x43, 0x5a, 0x73, 0x8b, 0xa4, 0xc8, 0xe2, 0x108, 0x134, 0x163, 0x1a7, 0x1da, 0x1b3, 0x183, 0x14a, + 0x11d, 0xf9, 0xd5, 0xb9, 0x9f, 0x86, 0x6a, 0x56, 0x3f, 0x2d, 0x21, 0xd, 0x9, 0x7, 0xe, + 0x13, 0x22, 0x31, 0x4a, 0x56, 0x76, 0x8d, 0xaa, 0xca, 0xe6, 0x103, 0x137, 0x167, 0x1a9, 0x1e3, + 0x1bc, 0x18b, 0x151, 0x125, 0xfb, 0xd9, 0xba, 0xa0, 0x8a, 0x6b, 0x59, 0x46, 0x36, 0x24, 0x15, + 0x10, 0xf, 0x12, 0x1b, 0x27, 0x38, 0x4e, 0x62, 0x75, 0x92, 0xad, 0xc9, 0xed, 0x10e, 0x13a, + 0x171, 0x1ac, 0x1ec, 0x1b9, 0x190, 0x155, 0x12a, 0x106, 0xde, 0xc4, 0xa3, 0x8a, 0x70, 0x5d, 0x4c, + 0x3d, 0x2b, 0x1f, 0x1a, 0x18, 0x19, 0x22, 0x2e, 0x40, 0x52, 0x66, 0x81, 0x94, 0xad, 0xd3, + 0xed, 0x114, 0x13f, 0x175, 0x1b9, 0x1e8, 0x1cd, 0x199, 0x156, 0x12b, 0x105, 0xe3, 0xc6, 0xa7, 0x8c, + 0x77, 0x66, 0x53, 0x45, 0x39, 0x27, 0x20, 0x23, 0x21, 0x27, 0x36, 0x47, 0x57, 0x6f, 0x86, + 0x9a, 0xb8, 0xd8, 0xf6, 0x115, 0x146, 0x17e, 0x1c0, 0x1ee, 0x1d1, 0x19d, 0x165, 0x12f, 0x10b, 0xeb, + 0xcb, 0xae, 0x97, 0x82, 0x6c, 0x5c, 0x4b, 0x40, 0x32, 0x2a, 0x2a, 0x2d, 0x33, 0x3e, 0x4f, + 0x61, 0x75, 0x89, 0xa1, 0xbe, 0xda, 0xf9, 0x11d, 0x14b, 0x184, 0x1c4, 0x201, 0x1da, 0x1b4, 0x16c, + 0x13a, 0x110, 0xf0, 0xd2, 0xb6, 0x9e, 0x8d, 0x78, 0x65, 0x54, 0x47, 0x3d, 0x36, 0x38, 0x38, + 0x3e, 0x4a, 0x58, 0x69, 0x78, 0x92, 0xad, 0xbf, 0xe3, 0xff, 0x126, 0x152, 0x186, 0x1cd, 0x20d, + 0x1f1, 0x1bb, 0x17b, 0x14c, 0x11c, 0xf7, 0xda, 0xc4, 0xa6, 0x90, 0x7f, 0x6d, 0x5c, 0x51, 0x47, + 0x40, 0x43, 0x41, 0x4a, 0x55, 0x63, 0x71, 0x84, 0x9b, 0xad, 0xca, 0xe9, 0x106, 0x131, 0x15f, + 0x198, 0x1d8, 0x215, 0x201, 0x1ce, 0x18e, 0x157, 0x12b, 0x103, 0xe2, 0xc7, 0xb1, 0x9b, 0x87, 0x78, + 0x67, 0x5b, 0x54, 0x4d, 0x51, 0x4d, 0x58, 0x5f, 0x6c, 0x7b, 0x93, 0xa5, 0xb8, 0xd6, 0xf4, + 0x111, 0x13b, 0x16a, 0x1a3, 0x1e4, 0x229, 0x20d, 0x1de, 0x19d, 0x164, 0x13a, 0x10f, 0xf2, 0xd1, 0xbb, + 0xa9, 0x93, 0x7f, 0x73, 0x6a, 0x63, 0x5c, 0x59, 0x5f, 0x61, 0x6d, 0x77, 0x8a, 0xa0, 0xb0, + 0xc7, 0xdc, 0xf9, 0x11e, 0x146, 0x175, 0x1ad, 0x1f3, 0x22a, 0x217, 0x1e8, 0x1aa, 0x16f, 0x147, 0x119, + 0x100, 0xe2, 0xc8, 0xb8, 0xa0, 0x92, 0x82, 0x78, 0x6c, 0x6b, 0x66, 0x6c, 0x6c, 0x7b, 0x86, + 0x95, 0xa9, 0xbf, 0xd0, 0xed, 0x107, 0x124, 0x156, 0x182, 0x1bb, 0x201, 0x23b, 0x225, 0x1fb, 0x1b9, + 0x17f, 0x158, 0x128, 0x106, 0xf2, 0xd4, 0xc1, 0xb0, 0x9d, 0x8f, 0x86, 0x77, 0x79, 0x73, 0x79, + 0x7e, 0x89, 0x94, 0xa5, 0xb6, 0xcf, 0xdd, 0xf8, 0x118, 0x133, 0x15d, 0x190, 0x1cc, 0x20c, 0x254, + 0x232, 0x20a, 0x1c2, 0x18f, 0x165, 0x133, 0x117, 0xff, 0xe4, 0xcd, 0xbf, 0xb4, 0xa2, 0x96, 0x8c, + 0x85, 0x85, 0x87, 0x8a, 0x93, 0x9f, 0xb3, 0xc1, 0xd6, 0xeb, 0x106, 0x126, 0x147, 0x16b, 0x19e, + 0x1dd, 0x228, 0x26c, 0x259, 0x21e, 0x1d7, 0x1a3, 0x170, 0x143, 0x128, 0x10b, 0xf1, 0xdc, 0xcd, 0xbf, + 0xb0, 0xa4, 0x9d, 0x97, 0x96, 0x98, 0x97, 0xa1, 0xab, 0xc0, 0xd2, 0xe4, 0xf9, 0x116, 0x12e, + 0x15a, 0x17d, 0x1af, 0x1f5, 0x23c, 0x280, 0x262, 0x22a, 0x1ea, 0x1b1, 0x17c, 0x14d, 0x132, 0x11c, 0xf7, + 0xea, 0xd2, 0xca, 0xc0, 0xb4, 0xa9, 0xa2, 0x9f, 0xa3, 0xa5, 0xae, 0xb9, 0xc7, 0xd3, 0xed, + 0x102, 0x11f, 0x137, 0x15e, 0x184, 0x1bf, 0x206, 0x257, 0x289, + }, + }, + + { + /* Rgain */ + { + 0x399, 0x340, 0x2df, 0x289, 0x23e, 0x207, 0x1cd, 0x193, 0x170, 0x15f, 0x135, 0x113, 0xfc, 0xea, 0xdb, + 0xdd, 0xda, 0xd9, 0xe4, 0xee, 0xfd, 0x114, 0x12f, 0x14b, 0x16e, 0x19d, 0x1d4, 0x209, 0x24e, 0x29b, + 0x2ee, 0x364, 0x3e2, 0x38f, 0x329, 0x2c6, 0x276, 0x22a, 0x1ed, 0x1b5, 0x181, 0x15f, 0x147, 0x121, 0x102, + 0xf0, 0xd9, 0xd0, 0xc6, 0xc7, 0xcb, 0xd2, 0xdc, 0xee, 0x100, 0x11e, 0x138, 0x164, 0x18c, 0x1bb, + 0x1f4, 0x243, 0x286, 0x2d7, 0x341, 0x3a7, 0x372, 0x309, 0x2b0, 0x259, 0x20f, 0x1d6, 0x19a, 0x16c, 0x140, + 0x130, 0x109, 0xef, 0xdc, 0xc4, 0xb7, 0xb1, 0xaf, 0xb9, 0xbe, 0xc2, 0xd5, 0xeb, 0x105, 0x122, + 0x14c, 0x17a, 0x1a4, 0x1de, 0x225, 0x26f, 0x2b8, 0x319, 0x384, 0x355, 0x2ed, 0x290, 0x242, 0x1f7, 0x1bb, + 0x18a, 0x154, 0x12e, 0x10f, 0xee, 0xd8, 0xc6, 0xaf, 0xa7, 0x9b, 0x9c, 0xa6, 0xaa, 0xaf, 0xbe, + 0xd8, 0xf7, 0x110, 0x13a, 0x166, 0x191, 0x1c8, 0x216, 0x259, 0x2a3, 0x302, 0x365, 0x32a, 0x2d8, 0x276, + 0x229, 0x1e3, 0x1a6, 0x174, 0x140, 0x11c, 0xf6, 0xda, 0xc6, 0xaf, 0x9d, 0x92, 0x89, 0x88, 0x91, + 0x97, 0x9c, 0xac, 0xcb, 0xec, 0x102, 0x125, 0x150, 0x180, 0x1b6, 0x200, 0x247, 0x289, 0x2e8, 0x34f, + 0x30f, 0x2bb, 0x267, 0x213, 0x1cc, 0x194, 0x160, 0x130, 0x10d, 0xeb, 0xcc, 0xb1, 0x99, 0x87, 0x7c, + 0x77, 0x74, 0x79, 0x82, 0x8c, 0x9a, 0xba, 0xd7, 0xed, 0x115, 0x13c, 0x170, 0x1a4, 0x1e4, 0x22c, + 0x277, 0x2d2, 0x32a, 0x2f6, 0x2a9, 0x24f, 0x1ff, 0x1bd, 0x185, 0x14b, 0x124, 0xfd, 0xdb, 0xba, 0xa0, + 0x89, 0x76, 0x6c, 0x62, 0x61, 0x65, 0x71, 0x7b, 0x89, 0xa4, 0xc6, 0xde, 0x107, 0x129, 0x15a, + 0x191, 0x1c7, 0x213, 0x262, 0x2b4, 0x319, 0x2de, 0x28d, 0x23f, 0x1ef, 0x1b2, 0x179, 0x142, 0x114, 0xed, + 0xce, 0xa9, 0x8e, 0x79, 0x66, 0x5c, 0x51, 0x4f, 0x53, 0x5e, 0x6a, 0x76, 0x94, 0xae, 0xcf, + 0xf9, 0x11c, 0x14b, 0x17c, 0x1bf, 0x204, 0x248, 0x2a0, 0x2f5, 0x2c9, 0x282, 0x229, 0x1e0, 0x1a5, 0x16e, + 0x135, 0x109, 0xdb, 0xb8, 0x9b, 0x7d, 0x6a, 0x57, 0x4a, 0x41, 0x3f, 0x41, 0x4e, 0x5b, 0x6c, + 0x88, 0xa5, 0xc9, 0xeb, 0x112, 0x13e, 0x16f, 0x1b1, 0x1f5, 0x23d, 0x293, 0x2e3, 0x2bf, 0x271, 0x21c, + 0x1d1, 0x199, 0x15e, 0x129, 0xf9, 0xcf, 0xab, 0x92, 0x72, 0x5b, 0x47, 0x3b, 0x31, 0x2f, 0x32, + 0x3f, 0x4b, 0x60, 0x7b, 0x9c, 0xc1, 0xe7, 0x105, 0x136, 0x166, 0x1a6, 0x1ea, 0x232, 0x28d, 0x2d4, + 0x2b9, 0x262, 0x211, 0x1c7, 0x187, 0x14e, 0x11b, 0xef, 0xc9, 0xa2, 0x81, 0x63, 0x4d, 0x39, 0x2b, + 0x21, 0x21, 0x26, 0x2f, 0x3e, 0x58, 0x70, 0x8f, 0xb5, 0xda, 0xfb, 0x12a, 0x15c, 0x196, 0x1e1, + 0x229, 0x283, 0x2c8, 0x2ab, 0x25a, 0x205, 0x1bd, 0x178, 0x145, 0x111, 0xe8, 0xc1, 0x9a, 0x76, 0x5b, + 0x40, 0x2c, 0x1b, 0x15, 0x12, 0x19, 0x26, 0x36, 0x4e, 0x69, 0x80, 0xaa, 0xce, 0xf3, 0x122, + 0x153, 0x18a, 0x1d6, 0x21e, 0x277, 0x2c4, 0x29c, 0x24e, 0x1fb, 0x1b0, 0x16e, 0x13c, 0x10d, 0xe0, 0xb5, + 0x92, 0x6e, 0x53, 0x37, 0x1f, 0x11, 0x8, 0x7, 0x10, 0x1a, 0x2d, 0x46, 0x61, 0x7b, 0x9c, + 0xc3, 0xee, 0x118, 0x14a, 0x187, 0x1ca, 0x210, 0x268, 0x2b7, 0x291, 0x241, 0x1f2, 0x1ad, 0x170, 0x13a, + 0x10a, 0xdd, 0xb1, 0x8c, 0x69, 0x49, 0x30, 0x1c, 0xc, 0x1, 0x0, 0x8, 0x13, 0x26, 0x3f, + 0x58, 0x77, 0x97, 0xbc, 0xe9, 0x114, 0x146, 0x17c, 0x1c6, 0x20c, 0x261, 0x2aa, 0x2bc, 0x23c, 0x1f5, + 0x1b0, 0x16b, 0x134, 0x106, 0xde, 0xb1, 0x88, 0x61, 0x44, 0x2e, 0x17, 0x4, 0x0, 0x0, 0x4, + 0xe, 0x20, 0x3a, 0x54, 0x71, 0x95, 0xba, 0xe5, 0x113, 0x141, 0x17f, 0x1bd, 0x206, 0x258, 0x2a4, + 0x31e, 0x258, 0x1f8, 0x1ad, 0x168, 0x12f, 0x102, 0xd9, 0xaf, 0x84, 0x63, 0x44, 0x2d, 0x12, 0x3, + 0x5, 0x3, 0x1, 0xb, 0x1d, 0x36, 0x53, 0x6f, 0x92, 0xb2, 0xe5, 0x110, 0x13e, 0x17b, 0x1c1, + 0x204, 0x257, 0x2a7, 0x33a, 0x276, 0x1f3, 0x1a9, 0x165, 0x12f, 0xfd, 0xd3, 0xab, 0x85, 0x62, 0x44, + 0x2d, 0x13, 0x2, 0x3, 0x3, 0x2, 0x8, 0x1d, 0x35, 0x4d, 0x6e, 0x93, 0xb6, 0xe5, 0x10f, + 0x141, 0x179, 0x1ba, 0x202, 0x259, 0x29f, 0x336, 0x260, 0x1ef, 0x1a7, 0x166, 0x12b, 0xfd, 0xd3, 0xa7, + 0x85, 0x60, 0x42, 0x2e, 0x15, 0x5, 0x2, 0x3, 0x3, 0x9, 0x1d, 0x35, 0x4f, 0x6b, 0x91, + 0xb7, 0xe3, 0x111, 0x13f, 0x175, 0x1ba, 0x202, 0x255, 0x29b, 0x2f0, 0x239, 0x1e6, 0x1a5, 0x165, 0x12e, + 0x103, 0xd4, 0xac, 0x87, 0x63, 0x48, 0x30, 0x18, 0x7, 0x2, 0x1, 0x5, 0xb, 0x20, 0x36, + 0x51, 0x70, 0x96, 0xb8, 0xe4, 0x112, 0x13f, 0x176, 0x1b8, 0x208, 0x256, 0x2a4, 0x2a9, 0x256, 0x1ef, + 0x1aa, 0x16d, 0x134, 0x104, 0xda, 0xaf, 0x8b, 0x67, 0x4c, 0x31, 0x1d, 0xb, 0x5, 0x4, 0x8, + 0x10, 0x22, 0x3b, 0x55, 0x73, 0x94, 0xbb, 0xe6, 0x116, 0x144, 0x179, 0x1ba, 0x208, 0x25d, 0x2ad, + 0x2d2, 0x296, 0x1f4, 0x1b0, 0x171, 0x136, 0x106, 0xdc, 0xb6, 0x91, 0x70, 0x51, 0x38, 0x24, 0x15, + 0xb, 0xa, 0xd, 0x18, 0x28, 0x40, 0x5b, 0x78, 0x99, 0xbf, 0xed, 0x11c, 0x14b, 0x181, 0x1c3, + 0x20c, 0x267, 0x2ac, 0x2e8, 0x2ae, 0x1f8, 0x1b5, 0x175, 0x13e, 0x10e, 0xe4, 0xbc, 0x96, 0x78, 0x58, + 0x40, 0x2a, 0x1d, 0x17, 0x14, 0x1a, 0x24, 0x32, 0x46, 0x63, 0x7e, 0xa2, 0xc5, 0xf1, 0x11e, + 0x151, 0x188, 0x1c8, 0x213, 0x26e, 0x2b8, 0x2d0, 0x2a0, 0x202, 0x1bf, 0x17e, 0x144, 0x118, 0xec, 0xc0, + 0x9f, 0x7c, 0x60, 0x4a, 0x37, 0x2e, 0x2c, 0x1d, 0x23, 0x2e, 0x3d, 0x4f, 0x6b, 0x87, 0xad, + 0xcd, 0xf7, 0x122, 0x157, 0x190, 0x1ce, 0x21a, 0x271, 0x2bb, 0x2b0, 0x278, 0x20a, 0x1c6, 0x186, 0x14f, + 0x120, 0xf5, 0xcc, 0xa8, 0x89, 0x70, 0x58, 0x45, 0x41, 0x39, 0x2d, 0x30, 0x3a, 0x4b, 0x5e, + 0x74, 0x91, 0xb8, 0xd4, 0xfe, 0x133, 0x167, 0x19b, 0x1de, 0x220, 0x277, 0x2c7, 0x2be, 0x26f, 0x216, + 0x1dc, 0x194, 0x158, 0x12d, 0x101, 0xd9, 0xb5, 0x99, 0x78, 0x64, 0x53, 0x49, 0x47, 0x3d, 0x3d, + 0x48, 0x57, 0x68, 0x7f, 0x9d, 0xc0, 0xdd, 0x108, 0x13f, 0x16d, 0x1a3, 0x1e7, 0x229, 0x281, 0x2cf, + 0x2d2, 0x284, 0x225, 0x1e9, 0x1a8, 0x166, 0x136, 0x108, 0xe4, 0xc5, 0xa2, 0x87, 0x71, 0x63, 0x54, + 0x55, 0x4c, 0x4f, 0x58, 0x63, 0x79, 0x8c, 0xab, 0xca, 0xec, 0x116, 0x146, 0x174, 0x1ad, 0x1f2, + 0x23b, 0x291, 0x2e1, 0x2e4, 0x299, 0x236, 0x1f8, 0x1bb, 0x173, 0x144, 0x119, 0xf0, 0xcf, 0xb5, 0x9a, + 0x81, 0x72, 0x63, 0x5d, 0x62, 0x5f, 0x66, 0x74, 0x86, 0x9f, 0xb7, 0xd6, 0xfb, 0x11f, 0x14e, + 0x184, 0x1be, 0x1ff, 0x249, 0x2a3, 0x2ed, 0x2f4, 0x2a6, 0x256, 0x203, 0x1c0, 0x184, 0x156, 0x122, 0x100, + 0xe1, 0xc0, 0xa8, 0x95, 0x7f, 0x73, 0x70, 0x71, 0x6f, 0x78, 0x83, 0x93, 0xab, 0xc4, 0xe3, + 0x107, 0x12f, 0x161, 0x196, 0x1ce, 0x213, 0x25c, 0x2b2, 0x306, 0x30c, 0x2b8, 0x26c, 0x214, 0x1ce, 0x19b, + 0x164, 0x135, 0x110, 0xf2, 0xd4, 0xb9, 0xa4, 0x93, 0x86, 0x82, 0x7f, 0x7f, 0x86, 0x96, 0xa6, + 0xbd, 0xd7, 0xf2, 0x115, 0x140, 0x171, 0x1a6, 0x1da, 0x224, 0x270, 0x2c7, 0x31c, 0x322, 0x2cd, 0x27f, + 0x228, 0x1e2, 0x1ac, 0x177, 0x148, 0x123, 0x101, 0xe6, 0xcd, 0xb2, 0xa5, 0x99, 0x92, 0x8e, 0x90, + 0x9c, 0xa7, 0xb6, 0xce, 0xe8, 0x101, 0x127, 0x14f, 0x181, 0x1b9, 0x1f7, 0x23c, 0x287, 0x2df, 0x338, + 0x339, 0x2e8, 0x28d, 0x23c, 0x1fb, 0x1c0, 0x18d, 0x159, 0x133, 0x113, 0xf6, 0xdb, 0xc5, 0xba, 0xaa, + 0xa3, 0xa1, 0xa5, 0xae, 0xbb, 0xca, 0xde, 0xf8, 0x115, 0x138, 0x164, 0x195, 0x1e0, 0x210, 0x250, + 0x2a1, 0x2fb, 0x355, 0x35c, 0x309, 0x2a6, 0x257, 0x216, 0x1d3, 0x19d, 0x171, 0x144, 0x128, 0x107, 0xf1, + 0xdf, 0xce, 0xc2, 0xb8, 0xb4, 0xba, 0xc0, 0xcf, 0xdf, 0xf2, 0x10d, 0x128, 0x152, 0x177, 0x1b8, + 0x1fe, 0x228, 0x26e, 0x2bd, 0x316, 0x376, 0x37f, 0x318, 0x2be, 0x26e, 0x229, 0x1e5, 0x1b1, 0x17c, 0x159, + 0x137, 0x118, 0x100, 0xeb, 0xdc, 0xd3, 0xc6, 0xc6, 0xcc, 0xd4, 0xdd, 0xed, 0x102, 0x11f, 0x138, + 0x15d, 0x18b, 0x1cd, 0x207, 0x23d, 0x27d, 0x2cc, 0x331, 0x388, + }, + + /* Grgain */ + { + 0x324, 0x2cf, 0x279, 0x22e, 0x1f5, 0x1c7, 0x191, 0x168, 0x148, 0x136, 0x113, 0xf4, 0xe4, 0xd4, 0xcd, + 0xc9, 0xc9, 0xcc, 0xd4, 0xe2, 0xf2, 0x103, 0x11f, 0x139, 0x164, 0x186, 0x1b6, 0x1eb, 0x22c, 0x270, + 0x2ba, 0x321, 0x392, 0x30d, 0x2b7, 0x267, 0x220, 0x1e1, 0x1b4, 0x183, 0x156, 0x13a, 0x126, 0x105, 0xe6, + 0xd7, 0xc3, 0xbd, 0xb8, 0xb7, 0xbf, 0xc5, 0xd0, 0xe4, 0xf3, 0x10e, 0x12b, 0x151, 0x17a, 0x1a5, + 0x1d8, 0x21f, 0x260, 0x2a7, 0x305, 0x367, 0x2f1, 0x29d, 0x250, 0x207, 0x1cb, 0x19a, 0x16c, 0x141, 0x11f, + 0x10f, 0xe9, 0xd6, 0xc2, 0xae, 0xa8, 0xa5, 0xa5, 0xae, 0xb1, 0xba, 0xcf, 0xe0, 0xfa, 0x115, + 0x13d, 0x16a, 0x193, 0x1c0, 0x208, 0x245, 0x28d, 0x2eb, 0x349, 0x2d2, 0x284, 0x238, 0x1f8, 0x1b8, 0x182, + 0x15b, 0x130, 0x109, 0xec, 0xd6, 0xc5, 0xb1, 0x9c, 0x92, 0x8f, 0x8d, 0x97, 0xa0, 0xa6, 0xb8, + 0xd1, 0xef, 0x106, 0x12c, 0x155, 0x17c, 0x1ae, 0x1f5, 0x235, 0x275, 0x2cd, 0x32d, 0x2b8, 0x26d, 0x225, + 0x1e2, 0x1a9, 0x173, 0x148, 0x11f, 0xfa, 0xdf, 0xc5, 0xaf, 0x9c, 0x89, 0x80, 0x7c, 0x7e, 0x88, + 0x8e, 0x96, 0xa5, 0xc5, 0xe3, 0xf7, 0x11b, 0x142, 0x16e, 0x1a1, 0x1e6, 0x227, 0x266, 0x2b8, 0x316, + 0x29c, 0x259, 0x213, 0x1cf, 0x197, 0x165, 0x138, 0x111, 0xf1, 0xd0, 0xb4, 0x9e, 0x8b, 0x7b, 0x71, + 0x6a, 0x6d, 0x72, 0x7d, 0x85, 0x94, 0xb3, 0xd1, 0xe8, 0x10b, 0x134, 0x15e, 0x192, 0x1d1, 0x210, + 0x255, 0x2a7, 0x2fe, 0x28b, 0x247, 0x201, 0x1bf, 0x18e, 0x15b, 0x12a, 0x104, 0xe4, 0xc4, 0xa5, 0x8e, + 0x79, 0x6b, 0x60, 0x5b, 0x59, 0x5d, 0x6a, 0x77, 0x85, 0xa0, 0xbf, 0xd8, 0xfe, 0x120, 0x151, + 0x183, 0x1b7, 0x1f8, 0x243, 0x28e, 0x2e3, 0x27a, 0x239, 0x1ef, 0x1b4, 0x183, 0x151, 0x11b, 0xf6, 0xd3, + 0xb5, 0x96, 0x7d, 0x6b, 0x5b, 0x4d, 0x49, 0x49, 0x4b, 0x58, 0x66, 0x77, 0x94, 0xaa, 0xc9, + 0xf3, 0x115, 0x143, 0x176, 0x1aa, 0x1e7, 0x231, 0x281, 0x2cc, 0x26b, 0x22a, 0x1e5, 0x1a6, 0x174, 0x144, + 0x111, 0xe8, 0xc4, 0xa5, 0x88, 0x70, 0x5d, 0x4d, 0x40, 0x39, 0x39, 0x3e, 0x4a, 0x59, 0x69, + 0x86, 0xa2, 0xca, 0xea, 0x10b, 0x137, 0x168, 0x19e, 0x1dd, 0x223, 0x272, 0x2b8, 0x25d, 0x21c, 0x1d8, + 0x199, 0x168, 0x137, 0x107, 0xe0, 0xbc, 0x9b, 0x81, 0x66, 0x51, 0x40, 0x33, 0x2c, 0x2d, 0x2d, + 0x3c, 0x4c, 0x5f, 0x7b, 0x9a, 0xc2, 0xe2, 0x100, 0x131, 0x15d, 0x196, 0x1d6, 0x21d, 0x26b, 0x2ad, + 0x253, 0x214, 0x1cd, 0x18f, 0x159, 0x12c, 0xfc, 0xd7, 0xb2, 0x93, 0x73, 0x59, 0x43, 0x34, 0x26, + 0x20, 0x1e, 0x22, 0x30, 0x3f, 0x57, 0x70, 0x90, 0xb8, 0xd8, 0xf7, 0x124, 0x154, 0x188, 0x1d0, + 0x211, 0x262, 0x2a4, 0x24f, 0x208, 0x1c2, 0x189, 0x150, 0x121, 0xf4, 0xd0, 0xac, 0x89, 0x6b, 0x4e, + 0x3b, 0x28, 0x18, 0x15, 0xf, 0x18, 0x25, 0x36, 0x50, 0x69, 0x83, 0xac, 0xcb, 0xef, 0x11e, + 0x14b, 0x180, 0x1c7, 0x206, 0x25a, 0x2a3, 0x247, 0x201, 0x1bd, 0x180, 0x14c, 0x119, 0xf2, 0xcb, 0xa4, + 0x82, 0x65, 0x47, 0x31, 0x1d, 0x10, 0x8, 0x6, 0xe, 0x1a, 0x2f, 0x49, 0x61, 0x7c, 0x9e, + 0xc3, 0xec, 0x116, 0x143, 0x17a, 0x1c0, 0x201, 0x24c, 0x292, 0x23a, 0x1f7, 0x1b8, 0x17b, 0x146, 0x116, + 0xf0, 0xc8, 0xa2, 0x7e, 0x5e, 0x43, 0x2c, 0x17, 0x7, 0x0, 0x0, 0x8, 0x16, 0x28, 0x43, + 0x59, 0x77, 0x99, 0xbc, 0xe4, 0x113, 0x141, 0x178, 0x1b7, 0x1fa, 0x246, 0x28c, 0x263, 0x1f3, 0x1b6, + 0x17e, 0x141, 0x114, 0xec, 0xc6, 0xa1, 0x7a, 0x5a, 0x3e, 0x26, 0xf, 0x3, 0x2, 0x1, 0x4, + 0xf, 0x22, 0x3f, 0x56, 0x74, 0x96, 0xb9, 0xe2, 0x111, 0x13d, 0x172, 0x1b3, 0x1f3, 0x240, 0x285, + 0x2c8, 0x207, 0x1b7, 0x17e, 0x13f, 0x112, 0xe8, 0xc4, 0x9e, 0x77, 0x56, 0x3b, 0x24, 0xe, 0x2, + 0x6, 0x1, 0x1, 0xb, 0x21, 0x3b, 0x52, 0x70, 0x97, 0xb8, 0xe2, 0x111, 0x13c, 0x171, 0x1b3, + 0x1ed, 0x240, 0x27f, 0x2dc, 0x224, 0x1b4, 0x17b, 0x13e, 0x10d, 0xe6, 0xbf, 0x98, 0x76, 0x56, 0x3c, + 0x25, 0x10, 0x1, 0x6, 0x5, 0x4, 0xb, 0x1f, 0x38, 0x51, 0x71, 0x94, 0xb8, 0xe3, 0x10e, + 0x13d, 0x16f, 0x1b2, 0x1ed, 0x23e, 0x281, 0x2d0, 0x20f, 0x1b3, 0x17b, 0x140, 0x112, 0xe5, 0xbe, 0x98, + 0x77, 0x57, 0x3c, 0x27, 0x14, 0x3, 0x3, 0x2, 0x5, 0xb, 0x20, 0x38, 0x52, 0x73, 0x93, + 0xb7, 0xe3, 0x10e, 0x13a, 0x16e, 0x1b0, 0x1ef, 0x23f, 0x27e, 0x291, 0x1f1, 0x1af, 0x177, 0x142, 0x111, + 0xe5, 0xc3, 0x9d, 0x79, 0x5a, 0x3d, 0x2b, 0x13, 0x7, 0x2, 0x2, 0x6, 0xe, 0x22, 0x3c, + 0x54, 0x74, 0x96, 0xbb, 0xe6, 0x10f, 0x13c, 0x170, 0x1b1, 0x1f0, 0x23f, 0x27f, 0x251, 0x209, 0x1b6, + 0x17d, 0x144, 0x116, 0xe9, 0xc5, 0x9f, 0x7e, 0x5f, 0x44, 0x2d, 0x1a, 0xa, 0x5, 0x7, 0x9, + 0x13, 0x28, 0x3f, 0x5a, 0x75, 0x99, 0xbb, 0xe8, 0x112, 0x13d, 0x176, 0x1b2, 0x1f4, 0x245, 0x287, + 0x28d, 0x244, 0x1b7, 0x17f, 0x14b, 0x118, 0xee, 0xc7, 0xa5, 0x83, 0x64, 0x4c, 0x35, 0x22, 0x13, + 0xd, 0xa, 0xf, 0x1c, 0x2d, 0x42, 0x5e, 0x7d, 0x9d, 0xbe, 0xed, 0x116, 0x145, 0x17b, 0x1b6, + 0x1f8, 0x24a, 0x28c, 0x29f, 0x259, 0x1bb, 0x184, 0x14f, 0x11f, 0xf4, 0xcd, 0xa7, 0x8c, 0x6e, 0x52, + 0x3d, 0x29, 0x1c, 0x19, 0x14, 0x1a, 0x26, 0x36, 0x4a, 0x65, 0x84, 0xa7, 0xc8, 0xef, 0x11e, + 0x14d, 0x181, 0x1b9, 0x200, 0x252, 0x296, 0x27e, 0x253, 0x1c3, 0x18a, 0x156, 0x126, 0xfc, 0xd8, 0xb1, + 0x96, 0x76, 0x5b, 0x46, 0x34, 0x2e, 0x2d, 0x1f, 0x26, 0x2f, 0x3f, 0x55, 0x6c, 0x8c, 0xb3, + 0xd1, 0xf2, 0x127, 0x154, 0x185, 0x1c3, 0x207, 0x254, 0x2a5, 0x254, 0x220, 0x1d0, 0x195, 0x15b, 0x12d, + 0x105, 0xe0, 0xba, 0x9d, 0x7f, 0x66, 0x52, 0x3f, 0x40, 0x39, 0x30, 0x31, 0x3e, 0x4f, 0x63, + 0x78, 0x98, 0xb9, 0xd8, 0xfe, 0x135, 0x162, 0x18e, 0x1cc, 0x20c, 0x25e, 0x2a0, 0x265, 0x222, 0x1d8, + 0x1a8, 0x169, 0x134, 0x111, 0xe7, 0xc5, 0xa7, 0x8a, 0x71, 0x5c, 0x4e, 0x49, 0x48, 0x3f, 0x40, + 0x4c, 0x5c, 0x6e, 0x81, 0xa0, 0xc2, 0xe2, 0x107, 0x13b, 0x169, 0x199, 0x1d5, 0x215, 0x268, 0x2ac, + 0x277, 0x235, 0x1e4, 0x1b6, 0x179, 0x141, 0x11a, 0xf4, 0xd1, 0xb3, 0x99, 0x7d, 0x6c, 0x5c, 0x51, + 0x53, 0x4f, 0x4f, 0x5a, 0x69, 0x7a, 0x8f, 0xab, 0xcb, 0xec, 0x112, 0x145, 0x16f, 0x1a6, 0x1e1, + 0x221, 0x270, 0x2bd, 0x282, 0x244, 0x1f2, 0x1c0, 0x188, 0x14f, 0x125, 0xff, 0xde, 0xbe, 0xa5, 0x8f, + 0x79, 0x6c, 0x5e, 0x5e, 0x63, 0x60, 0x67, 0x75, 0x89, 0xa0, 0xb8, 0xd8, 0xf8, 0x11e, 0x14c, + 0x178, 0x1ae, 0x1ec, 0x231, 0x282, 0x2cb, 0x293, 0x24c, 0x20d, 0x1cb, 0x18f, 0x15e, 0x130, 0x10b, 0xea, + 0xce, 0xb3, 0x9d, 0x8c, 0x7a, 0x70, 0x70, 0x70, 0x70, 0x76, 0x87, 0x96, 0xae, 0xc7, 0xe3, + 0x106, 0x12d, 0x15b, 0x18a, 0x1bb, 0x1f9, 0x242, 0x28f, 0x2dc, 0x2a6, 0x25e, 0x221, 0x1d6, 0x19c, 0x16e, + 0x141, 0x11a, 0xfb, 0xdd, 0xc2, 0xad, 0x9a, 0x8b, 0x82, 0x7e, 0x7d, 0x7c, 0x88, 0x97, 0xa6, + 0xbd, 0xd6, 0xf3, 0x114, 0x13b, 0x168, 0x197, 0x1cd, 0x209, 0x257, 0x2a7, 0x2f4, 0x2b9, 0x271, 0x230, + 0x1e8, 0x1b0, 0x17d, 0x152, 0x12a, 0x10d, 0xee, 0xd4, 0xbf, 0xaa, 0x9c, 0x93, 0x90, 0x8e, 0x90, + 0x99, 0xa8, 0xb8, 0xce, 0xe6, 0x103, 0x124, 0x14d, 0x179, 0x1ad, 0x1e0, 0x21e, 0x268, 0x2b7, 0x306, + 0x2cd, 0x291, 0x240, 0x1fc, 0x1c2, 0x190, 0x166, 0x13c, 0x11e, 0xfe, 0xe7, 0xcf, 0xbc, 0xb1, 0xa8, + 0xa3, 0xa0, 0xa3, 0xac, 0xba, 0xca, 0xe0, 0xf7, 0x114, 0x138, 0x15e, 0x18a, 0x1d0, 0x1f8, 0x233, + 0x27d, 0x2cf, 0x31d, 0x2ef, 0x2a9, 0x257, 0x213, 0x1db, 0x1a8, 0x178, 0x151, 0x12d, 0x111, 0xf8, 0xe4, + 0xd4, 0xc7, 0xbb, 0xb2, 0xb6, 0xb5, 0xc1, 0xcd, 0xdf, 0xf2, 0x10b, 0x126, 0x14c, 0x173, 0x1ac, + 0x1ee, 0x20f, 0x250, 0x295, 0x2ea, 0x33b, 0x317, 0x2b7, 0x268, 0x228, 0x1ef, 0x1b5, 0x189, 0x161, 0x13b, + 0x121, 0x106, 0xf0, 0xde, 0xd7, 0xc9, 0xc2, 0xc3, 0xc8, 0xd3, 0xd9, 0xed, 0x100, 0x119, 0x133, + 0x15a, 0x189, 0x1c1, 0x1fd, 0x221, 0x260, 0x2a9, 0x302, 0x357, + }, + + /* Gbgain */ + { + 0x32b, 0x2cd, 0x277, 0x232, 0x1f2, 0x1c6, 0x18f, 0x166, 0x148, 0x136, 0x116, 0xf5, 0xe3, 0xd5, 0xc9, + 0xc8, 0xc9, 0xc9, 0xd5, 0xdf, 0xf1, 0x102, 0x11c, 0x138, 0x15a, 0x187, 0x1b4, 0x1e7, 0x22d, 0x270, + 0x2bd, 0x323, 0x38d, 0x313, 0x2b9, 0x267, 0x21e, 0x1e1, 0x1b1, 0x182, 0x154, 0x13b, 0x124, 0x104, 0xe7, + 0xd9, 0xc5, 0xbb, 0xb4, 0xb6, 0xbf, 0xc4, 0xd1, 0xe3, 0xf4, 0x10d, 0x12b, 0x151, 0x178, 0x1a4, + 0x1d7, 0x21b, 0x25d, 0x2a6, 0x306, 0x367, 0x2f4, 0x29e, 0x24d, 0x20b, 0x1ca, 0x198, 0x16d, 0x141, 0x11b, + 0x10d, 0xea, 0xd1, 0xc4, 0xb1, 0xa8, 0xa3, 0xa3, 0xb0, 0xb3, 0xb9, 0xc9, 0xdf, 0xfb, 0x116, + 0x13d, 0x168, 0x190, 0x1c2, 0x204, 0x243, 0x28e, 0x2ec, 0x348, 0x2da, 0x285, 0x239, 0x1f6, 0x1b9, 0x187, + 0x15a, 0x12d, 0x10a, 0xef, 0xd3, 0xbf, 0xb0, 0x9e, 0x92, 0x8e, 0x91, 0x9a, 0x9f, 0xa6, 0xb6, + 0xce, 0xeb, 0x102, 0x12d, 0x159, 0x17b, 0x1b3, 0x1f7, 0x235, 0x27b, 0x2d0, 0x32a, 0x2b8, 0x26e, 0x221, + 0x1e4, 0x1a8, 0x176, 0x149, 0x11e, 0xfe, 0xdf, 0xc5, 0xaf, 0x9b, 0x8c, 0x80, 0x7e, 0x7a, 0x89, + 0x8e, 0x98, 0xa6, 0xc4, 0xe2, 0xf5, 0x119, 0x142, 0x16f, 0x19f, 0x1e4, 0x227, 0x269, 0x2ba, 0x315, + 0x2a3, 0x25b, 0x213, 0x1d0, 0x193, 0x163, 0x137, 0x10e, 0xee, 0xd2, 0xb5, 0xa0, 0x8a, 0x7a, 0x71, + 0x6b, 0x6a, 0x71, 0x7c, 0x84, 0x95, 0xb2, 0xcf, 0xe9, 0x109, 0x133, 0x160, 0x18e, 0x1cd, 0x210, + 0x253, 0x2a1, 0x2fb, 0x28e, 0x249, 0x201, 0x1bf, 0x18a, 0x157, 0x12d, 0x103, 0xe3, 0xc4, 0xa2, 0x8e, + 0x78, 0x69, 0x60, 0x5a, 0x58, 0x5d, 0x6c, 0x76, 0x86, 0xa1, 0xc0, 0xdb, 0xfc, 0x11f, 0x14e, + 0x182, 0x1b9, 0x1f8, 0x242, 0x290, 0x2e7, 0x279, 0x238, 0x1ef, 0x1b4, 0x180, 0x152, 0x123, 0xf5, 0xd4, + 0xb5, 0x95, 0x7e, 0x6b, 0x59, 0x50, 0x48, 0x47, 0x4e, 0x58, 0x66, 0x75, 0x92, 0xaa, 0xca, + 0xf1, 0x114, 0x13f, 0x171, 0x1ab, 0x1e9, 0x233, 0x27f, 0x2c9, 0x270, 0x22b, 0x1e1, 0x1a5, 0x178, 0x147, + 0x115, 0xea, 0xc5, 0xa5, 0x8a, 0x73, 0x5e, 0x4d, 0x41, 0x3b, 0x3a, 0x3d, 0x4b, 0x59, 0x6a, + 0x84, 0xa2, 0xc5, 0xe7, 0x10c, 0x136, 0x165, 0x19e, 0x1de, 0x225, 0x271, 0x2bd, 0x268, 0x222, 0x1da, + 0x19f, 0x168, 0x137, 0x108, 0xdf, 0xbb, 0x9a, 0x7f, 0x64, 0x52, 0x40, 0x35, 0x2c, 0x2c, 0x2d, + 0x3d, 0x4b, 0x5f, 0x7a, 0x9b, 0xc2, 0xe1, 0x101, 0x12e, 0x15c, 0x198, 0x1d9, 0x21e, 0x26a, 0x2ae, + 0x258, 0x217, 0x1ce, 0x193, 0x15c, 0x12a, 0xff, 0xd5, 0xb1, 0x94, 0x75, 0x59, 0x44, 0x32, 0x26, + 0x1e, 0x1e, 0x20, 0x30, 0x41, 0x57, 0x70, 0x8d, 0xb6, 0xd7, 0xf7, 0x125, 0x155, 0x18c, 0x1d2, + 0x212, 0x261, 0x2a7, 0x24f, 0x20b, 0x1c5, 0x188, 0x154, 0x122, 0xf8, 0xce, 0xac, 0x8e, 0x6c, 0x52, + 0x3a, 0x27, 0x19, 0x13, 0x10, 0x18, 0x24, 0x36, 0x50, 0x68, 0x82, 0xaa, 0xca, 0xee, 0x11e, + 0x14d, 0x182, 0x1c2, 0x205, 0x259, 0x29d, 0x241, 0x201, 0x1bd, 0x184, 0x14f, 0x11c, 0xf2, 0xcc, 0xa5, + 0x85, 0x65, 0x4a, 0x30, 0x1e, 0x11, 0x7, 0x7, 0xd, 0x1b, 0x2f, 0x48, 0x5f, 0x7d, 0x9e, + 0xc3, 0xeb, 0x118, 0x148, 0x17b, 0x1c0, 0x1ff, 0x24d, 0x297, 0x23b, 0x1fa, 0x1b8, 0x17d, 0x149, 0x116, + 0xee, 0xcc, 0xa3, 0x80, 0x60, 0x44, 0x2a, 0x18, 0x7, 0x0, 0x0, 0x9, 0x14, 0x28, 0x43, + 0x58, 0x78, 0x98, 0xbd, 0xe7, 0x113, 0x142, 0x172, 0x1b4, 0x1fa, 0x245, 0x28a, 0x26b, 0x1fb, 0x1ba, + 0x180, 0x147, 0x117, 0xef, 0xca, 0xa1, 0x7c, 0x5b, 0x40, 0x28, 0x11, 0x4, 0x3, 0x1, 0x6, + 0x10, 0x23, 0x3e, 0x55, 0x75, 0x98, 0xba, 0xe5, 0x112, 0x13e, 0x171, 0x1b0, 0x1f4, 0x23e, 0x28b, + 0x2ca, 0x20e, 0x1bd, 0x17f, 0x142, 0x114, 0xe8, 0xc5, 0x9e, 0x79, 0x5a, 0x3b, 0x27, 0x10, 0x2, + 0x4, 0x2, 0x0, 0xb, 0x21, 0x37, 0x54, 0x73, 0x95, 0xb9, 0xe3, 0x111, 0x13c, 0x170, 0x1b0, + 0x1f2, 0x23e, 0x286, 0x2de, 0x22a, 0x1b6, 0x17e, 0x140, 0x113, 0xe5, 0xbe, 0x98, 0x79, 0x5a, 0x3a, + 0x27, 0x11, 0x1, 0x3, 0x5, 0x3, 0xb, 0x21, 0x37, 0x52, 0x71, 0x92, 0xb8, 0xe3, 0x10f, + 0x13c, 0x171, 0x1b3, 0x1f2, 0x239, 0x27f, 0x2d6, 0x215, 0x1b0, 0x179, 0x13d, 0x113, 0xe7, 0xbe, 0x99, + 0x79, 0x58, 0x3e, 0x29, 0x15, 0x4, 0x1, 0x4, 0x5, 0xb, 0x1f, 0x39, 0x53, 0x73, 0x94, + 0xb8, 0xe1, 0x10d, 0x138, 0x16d, 0x1b2, 0x1f2, 0x23d, 0x281, 0x293, 0x1f4, 0x1b0, 0x179, 0x144, 0x114, + 0xe6, 0xc0, 0x9c, 0x7c, 0x5a, 0x41, 0x2c, 0x16, 0x7, 0x2, 0x4, 0x7, 0xe, 0x21, 0x39, + 0x56, 0x74, 0x96, 0xbc, 0xe4, 0x10f, 0x139, 0x16e, 0x1ae, 0x1f4, 0x242, 0x282, 0x253, 0x210, 0x1b5, + 0x17d, 0x146, 0x115, 0xec, 0xc4, 0x9e, 0x82, 0x5e, 0x46, 0x2e, 0x1a, 0xb, 0x6, 0x7, 0x9, + 0x14, 0x25, 0x3f, 0x59, 0x78, 0x99, 0xbb, 0xe6, 0x114, 0x13d, 0x175, 0x1b1, 0x1f5, 0x247, 0x287, + 0x285, 0x24a, 0x1ba, 0x182, 0x14b, 0x11b, 0xef, 0xca, 0xa5, 0x84, 0x66, 0x4a, 0x36, 0x23, 0x15, + 0xf, 0xb, 0x10, 0x1d, 0x2c, 0x46, 0x5f, 0x7c, 0x9e, 0xc1, 0xeb, 0x117, 0x143, 0x17c, 0x1b8, + 0x1f8, 0x249, 0x293, 0x298, 0x25e, 0x1c1, 0x188, 0x151, 0x120, 0xf3, 0xcf, 0xac, 0x8e, 0x6e, 0x54, + 0x3f, 0x2a, 0x1d, 0x1b, 0x13, 0x1a, 0x26, 0x37, 0x4c, 0x67, 0x83, 0xa9, 0xc6, 0xf2, 0x11f, + 0x14a, 0x182, 0x1ba, 0x1fe, 0x250, 0x292, 0x27c, 0x251, 0x1c5, 0x18b, 0x159, 0x129, 0xfd, 0xd6, 0xb1, + 0x96, 0x79, 0x5b, 0x47, 0x34, 0x2e, 0x2d, 0x1f, 0x25, 0x33, 0x41, 0x56, 0x6e, 0x8e, 0xb3, + 0xce, 0xf5, 0x129, 0x155, 0x187, 0x1c3, 0x206, 0x254, 0x295, 0x258, 0x226, 0x1d0, 0x196, 0x162, 0x12d, + 0x105, 0xe0, 0xba, 0x9e, 0x80, 0x66, 0x50, 0x42, 0x40, 0x39, 0x31, 0x31, 0x40, 0x4f, 0x62, + 0x79, 0x99, 0xb9, 0xd9, 0xfe, 0x131, 0x164, 0x192, 0x1ca, 0x20e, 0x25b, 0x2a3, 0x266, 0x223, 0x1db, + 0x1ab, 0x16d, 0x13a, 0x111, 0xe8, 0xc6, 0xa9, 0x8d, 0x72, 0x5f, 0x50, 0x49, 0x45, 0x3f, 0x41, + 0x4a, 0x5d, 0x6f, 0x82, 0xa3, 0xc3, 0xe1, 0x108, 0x13a, 0x16b, 0x19c, 0x1d5, 0x219, 0x265, 0x2ac, + 0x277, 0x237, 0x1e4, 0x1b4, 0x17b, 0x143, 0x11c, 0xf3, 0xd2, 0xb3, 0x98, 0x81, 0x6d, 0x5e, 0x52, + 0x51, 0x4c, 0x52, 0x58, 0x69, 0x7b, 0x90, 0xac, 0xcb, 0xeb, 0x112, 0x142, 0x171, 0x1a2, 0x1e0, + 0x227, 0x274, 0x2b9, 0x280, 0x247, 0x1f4, 0x1c2, 0x18a, 0x14d, 0x126, 0xff, 0xde, 0xbf, 0xa5, 0x90, + 0x7e, 0x6e, 0x61, 0x5e, 0x61, 0x60, 0x67, 0x75, 0x87, 0x9d, 0xbd, 0xd9, 0xf6, 0x11f, 0x14e, + 0x17a, 0x1ae, 0x1ec, 0x232, 0x282, 0x2cb, 0x29a, 0x24f, 0x20e, 0x1cb, 0x191, 0x161, 0x133, 0x10d, 0xea, + 0xce, 0xb3, 0x9f, 0x8a, 0x7c, 0x71, 0x6f, 0x72, 0x6e, 0x79, 0x88, 0x96, 0xad, 0xca, 0xe5, + 0x107, 0x12e, 0x15c, 0x18c, 0x1bd, 0x1fa, 0x243, 0x292, 0x2de, 0x2ae, 0x25d, 0x21f, 0x1d7, 0x1a0, 0x16f, + 0x141, 0x11a, 0xf8, 0xde, 0xc4, 0xad, 0x99, 0x8c, 0x84, 0x80, 0x7f, 0x7f, 0x89, 0x97, 0xa6, + 0xbd, 0xd4, 0xf4, 0x115, 0x13b, 0x169, 0x19a, 0x1d1, 0x206, 0x255, 0x2a3, 0x2f2, 0x2bd, 0x275, 0x22f, + 0x1eb, 0x1b0, 0x17f, 0x151, 0x12d, 0x10c, 0xef, 0xd5, 0xbe, 0xae, 0x9e, 0x97, 0x90, 0x8e, 0x91, + 0x9c, 0xa8, 0xb9, 0xcd, 0xe5, 0x105, 0x124, 0x14d, 0x177, 0x1ae, 0x1e4, 0x220, 0x26b, 0x2b9, 0x307, + 0x2d4, 0x296, 0x243, 0x1fe, 0x1c6, 0x193, 0x165, 0x13f, 0x11a, 0x100, 0xe6, 0xd1, 0xc0, 0xb5, 0xa8, + 0xa0, 0xa0, 0xa5, 0xaa, 0xb8, 0xca, 0xe0, 0xfc, 0x115, 0x137, 0x15d, 0x18a, 0x1ce, 0x1f9, 0x236, + 0x282, 0x2d4, 0x324, 0x2f8, 0x2ab, 0x25d, 0x215, 0x1de, 0x1a9, 0x17c, 0x150, 0x12e, 0x110, 0xfb, 0xe6, + 0xd2, 0xc6, 0xba, 0xb6, 0xb6, 0xba, 0xc2, 0xcd, 0xdd, 0xf4, 0x10a, 0x127, 0x14b, 0x171, 0x1aa, + 0x1ec, 0x20f, 0x252, 0x29a, 0x2e9, 0x341, 0x310, 0x2b8, 0x26a, 0x22f, 0x1f0, 0x1b7, 0x18a, 0x15b, 0x13d, + 0x11f, 0x108, 0xf2, 0xde, 0xd4, 0xca, 0xc4, 0xc3, 0xc7, 0xcf, 0xdb, 0xf0, 0x101, 0x11d, 0x135, + 0x15b, 0x184, 0x1c1, 0x1ff, 0x227, 0x265, 0x2aa, 0x2fb, 0x360, + }, + + /* Bgain */ + { + 0x2f0, 0x29d, 0x24a, 0x20b, 0x1d2, 0x1ae, 0x175, 0x151, 0x137, 0x12c, 0x105, 0xeb, 0xd7, 0xc9, 0xbd, + 0xbd, 0xc0, 0xc2, 0xca, 0xdc, 0xec, 0xfb, 0x10f, 0x129, 0x14b, 0x178, 0x1a7, 0x1d2, 0x21b, 0x25c, + 0x29c, 0x305, 0x35e, 0x2d4, 0x284, 0x23e, 0x1ff, 0x1c5, 0x195, 0x16a, 0x143, 0x12a, 0x11c, 0xf5, 0xe1, + 0xcf, 0xbb, 0xb1, 0xae, 0xb2, 0xb8, 0xbf, 0xcd, 0xde, 0xed, 0x102, 0x11e, 0x14a, 0x16f, 0x195, + 0x1c6, 0x209, 0x24b, 0x28e, 0x2e7, 0x348, 0x2b8, 0x26f, 0x228, 0x1e8, 0x1ad, 0x181, 0x155, 0x131, 0x114, + 0x102, 0xe1, 0xca, 0xbe, 0xa8, 0xa0, 0x9c, 0x9d, 0xa6, 0xad, 0xb4, 0xc1, 0xd6, 0xf3, 0x10e, + 0x138, 0x15f, 0x183, 0x1b0, 0x1f5, 0x230, 0x278, 0x2cc, 0x325, 0x2a5, 0x254, 0x20e, 0x1d6, 0x19b, 0x16c, + 0x146, 0x11f, 0xfa, 0xe2, 0xcc, 0xbb, 0xab, 0x97, 0x8e, 0x8b, 0x8b, 0x93, 0x9c, 0xa2, 0xac, + 0xcb, 0xe6, 0xfa, 0x126, 0x14d, 0x174, 0x1a4, 0x1e7, 0x21d, 0x261, 0x2b8, 0x30f, 0x28f, 0x243, 0x1fe, + 0x1c0, 0x18b, 0x15b, 0x138, 0x10e, 0xf1, 0xd3, 0xbc, 0xa8, 0x96, 0x89, 0x7e, 0x79, 0x78, 0x83, + 0x8a, 0x92, 0xa2, 0xbf, 0xda, 0xee, 0x114, 0x13b, 0x162, 0x193, 0x1d6, 0x212, 0x253, 0x29d, 0x2f5, + 0x271, 0x22f, 0x1e9, 0x1b1, 0x17a, 0x14e, 0x126, 0x103, 0xe4, 0xc8, 0xad, 0x97, 0x85, 0x78, 0x6d, + 0x68, 0x6a, 0x6e, 0x74, 0x81, 0x90, 0xb0, 0xcb, 0xe0, 0x107, 0x12a, 0x155, 0x189, 0x1c5, 0x1ff, + 0x240, 0x28b, 0x2db, 0x25e, 0x21e, 0x1df, 0x1a8, 0x171, 0x146, 0x11b, 0xf1, 0xd7, 0xbb, 0x9f, 0x88, + 0x76, 0x67, 0x5d, 0x57, 0x5b, 0x5a, 0x69, 0x71, 0x84, 0xa0, 0xbd, 0xd4, 0xf9, 0x119, 0x14a, + 0x17b, 0x1ae, 0x1e9, 0x232, 0x27b, 0x2c8, 0x253, 0x214, 0x1d3, 0x197, 0x16b, 0x140, 0x111, 0xe8, 0xc5, + 0xa8, 0x90, 0x7c, 0x68, 0x58, 0x4e, 0x46, 0x4a, 0x4c, 0x58, 0x61, 0x73, 0x8d, 0xa4, 0xc6, + 0xed, 0x110, 0x139, 0x167, 0x19f, 0x1dc, 0x223, 0x26b, 0x2ab, 0x249, 0x206, 0x1c4, 0x18c, 0x15d, 0x130, + 0x105, 0xd6, 0xba, 0x9b, 0x83, 0x6b, 0x5a, 0x4a, 0x3c, 0x3a, 0x37, 0x3b, 0x4c, 0x58, 0x67, + 0x82, 0x9f, 0xc7, 0xe7, 0x101, 0x12f, 0x15d, 0x195, 0x1d2, 0x214, 0x25c, 0x2a1, 0x238, 0x1fd, 0x1bb, + 0x17f, 0x150, 0x123, 0xf7, 0xd1, 0xb1, 0x94, 0x78, 0x64, 0x4e, 0x3d, 0x30, 0x2e, 0x28, 0x2e, + 0x3e, 0x4b, 0x60, 0x77, 0x9a, 0xc3, 0xdc, 0xfe, 0x129, 0x155, 0x18c, 0x1c9, 0x20d, 0x256, 0x295, + 0x234, 0x1f0, 0x1af, 0x175, 0x141, 0x117, 0xf0, 0xcb, 0xa8, 0x8a, 0x71, 0x58, 0x3e, 0x2f, 0x23, + 0x1e, 0x1d, 0x23, 0x30, 0x41, 0x58, 0x72, 0x91, 0xbb, 0xd3, 0xf3, 0x122, 0x151, 0x180, 0x1c5, + 0x202, 0x24d, 0x287, 0x222, 0x1e8, 0x1a6, 0x16d, 0x13c, 0x10d, 0xe6, 0xc5, 0xa6, 0x82, 0x67, 0x4e, + 0x37, 0x23, 0x16, 0x12, 0x10, 0x18, 0x23, 0x37, 0x4f, 0x69, 0x84, 0xa9, 0xc7, 0xea, 0x11d, + 0x149, 0x178, 0x1be, 0x1fe, 0x247, 0x28a, 0x21e, 0x1e0, 0x19d, 0x169, 0x138, 0x10b, 0xe3, 0xc3, 0x9d, + 0x7d, 0x61, 0x44, 0x2e, 0x1d, 0xf, 0x8, 0x6, 0xe, 0x1a, 0x2d, 0x47, 0x5d, 0x7c, 0x9c, + 0xbf, 0xe6, 0x119, 0x141, 0x171, 0x1b4, 0x1f5, 0x241, 0x279, 0x21b, 0x1de, 0x19b, 0x168, 0x132, 0x107, + 0xdf, 0xbc, 0x9a, 0x78, 0x5d, 0x40, 0x29, 0x15, 0x7, 0x0, 0x0, 0xa, 0x13, 0x27, 0x45, + 0x58, 0x77, 0x9b, 0xbb, 0xe5, 0x113, 0x13c, 0x170, 0x1ae, 0x1f3, 0x238, 0x276, 0x244, 0x1d8, 0x19f, + 0x168, 0x133, 0x107, 0xdd, 0xba, 0x97, 0x75, 0x56, 0x3c, 0x28, 0x12, 0x4, 0x3, 0x1, 0x4, + 0x11, 0x21, 0x3d, 0x58, 0x77, 0x97, 0xbc, 0xe1, 0x10f, 0x13b, 0x16f, 0x1a9, 0x1e9, 0x232, 0x276, + 0x2a3, 0x1ec, 0x1a4, 0x16a, 0x12f, 0x102, 0xdb, 0xba, 0x94, 0x70, 0x56, 0x3b, 0x28, 0xf, 0x1, + 0x6, 0x2, 0x4, 0xe, 0x1f, 0x3a, 0x55, 0x74, 0x96, 0xb5, 0xe0, 0x10d, 0x13c, 0x16d, 0x1ac, + 0x1e5, 0x230, 0x271, 0x2a9, 0x206, 0x19e, 0x166, 0x12e, 0x101, 0xda, 0xb5, 0x92, 0x71, 0x54, 0x3a, + 0x24, 0x10, 0x4, 0x5, 0x7, 0x6, 0xd, 0x1f, 0x3c, 0x52, 0x75, 0x93, 0xb4, 0xe0, 0x10b, + 0x138, 0x168, 0x1a7, 0x1e9, 0x235, 0x271, 0x2a6, 0x1f1, 0x197, 0x160, 0x129, 0x100, 0xda, 0xb7, 0x92, + 0x70, 0x54, 0x3a, 0x26, 0x12, 0x4, 0x5, 0x5, 0x9, 0xc, 0x22, 0x38, 0x54, 0x71, 0x92, + 0xb6, 0xe2, 0x10c, 0x136, 0x167, 0x1a4, 0x1e2, 0x230, 0x275, 0x267, 0x1d3, 0x192, 0x160, 0x128, 0x101, + 0xd9, 0xbb, 0x96, 0x77, 0x56, 0x3b, 0x2a, 0x14, 0x6, 0x3, 0x7, 0x7, 0x10, 0x26, 0x3d, + 0x57, 0x74, 0x96, 0xb6, 0xe5, 0x10c, 0x136, 0x168, 0x1a3, 0x1e4, 0x22d, 0x271, 0x228, 0x1e9, 0x197, + 0x163, 0x12f, 0x103, 0xd9, 0xbb, 0x9a, 0x7c, 0x5c, 0x45, 0x2f, 0x1c, 0xb, 0x6, 0x7, 0xd, + 0x17, 0x28, 0x3f, 0x5b, 0x77, 0x98, 0xb8, 0xe7, 0x10d, 0x139, 0x16a, 0x1a7, 0x1e9, 0x234, 0x279, + 0x263, 0x226, 0x19a, 0x16a, 0x134, 0x108, 0xdd, 0xbc, 0x9d, 0x80, 0x65, 0x4c, 0x37, 0x25, 0x16, + 0xf, 0xe, 0x13, 0x1f, 0x2e, 0x46, 0x5e, 0x79, 0x9c, 0xbd, 0xeb, 0x112, 0x13d, 0x170, 0x1b0, + 0x1ef, 0x23a, 0x286, 0x271, 0x236, 0x19f, 0x16c, 0x13c, 0x10e, 0xe4, 0xc2, 0x9f, 0x83, 0x6a, 0x55, + 0x3d, 0x2a, 0x1f, 0x19, 0x14, 0x1b, 0x26, 0x36, 0x4c, 0x65, 0x84, 0xa4, 0xc2, 0xeb, 0x119, + 0x146, 0x178, 0x1af, 0x1f3, 0x240, 0x286, 0x254, 0x22e, 0x1a5, 0x16f, 0x143, 0x111, 0xf0, 0xc6, 0xa7, + 0x8d, 0x70, 0x5c, 0x46, 0x35, 0x2e, 0x32, 0x21, 0x24, 0x33, 0x40, 0x55, 0x6c, 0x90, 0xb1, + 0xcb, 0xf2, 0x11d, 0x150, 0x17d, 0x1bc, 0x1f9, 0x244, 0x287, 0x22b, 0x206, 0x1b0, 0x17a, 0x14d, 0x11b, + 0xf4, 0xce, 0xae, 0x93, 0x78, 0x63, 0x4d, 0x3d, 0x40, 0x38, 0x31, 0x31, 0x40, 0x4d, 0x62, + 0x74, 0x98, 0xb8, 0xd7, 0xfb, 0x12f, 0x15a, 0x18a, 0x1c6, 0x205, 0x248, 0x290, 0x236, 0x201, 0x1bd, + 0x190, 0x153, 0x124, 0x100, 0xd9, 0xba, 0xa1, 0x84, 0x6b, 0x57, 0x4b, 0x45, 0x47, 0x42, 0x44, + 0x50, 0x5b, 0x6d, 0x82, 0xa2, 0xc1, 0xde, 0x107, 0x137, 0x161, 0x194, 0x1cc, 0x20a, 0x257, 0x297, + 0x24c, 0x213, 0x1c6, 0x19b, 0x166, 0x12f, 0x10b, 0xe3, 0xc6, 0xaa, 0x90, 0x77, 0x67, 0x5b, 0x4c, + 0x4d, 0x4d, 0x51, 0x5d, 0x6c, 0x7c, 0x8e, 0xab, 0xc9, 0xe8, 0x112, 0x140, 0x16b, 0x19c, 0x1d6, + 0x21a, 0x263, 0x2a7, 0x25b, 0x223, 0x1db, 0x1a7, 0x175, 0x13c, 0x115, 0xf5, 0xd2, 0xb7, 0x9b, 0x86, + 0x76, 0x68, 0x5b, 0x5b, 0x5f, 0x61, 0x69, 0x78, 0x8a, 0xa0, 0xba, 0xd4, 0xf4, 0x11b, 0x149, + 0x176, 0x1a4, 0x1e0, 0x226, 0x26d, 0x2bb, 0x268, 0x22f, 0x1ec, 0x1b1, 0x17b, 0x14b, 0x121, 0xff, 0xe0, + 0xc5, 0xad, 0x96, 0x88, 0x79, 0x6d, 0x6a, 0x6e, 0x6c, 0x75, 0x87, 0x96, 0xae, 0xc9, 0xe2, + 0x103, 0x129, 0x157, 0x183, 0x1b2, 0x1eb, 0x236, 0x280, 0x2cc, 0x27d, 0x234, 0x1fb, 0x1b9, 0x186, 0x158, + 0x132, 0x109, 0xef, 0xd5, 0xbc, 0xa6, 0x97, 0x89, 0x81, 0x7d, 0x7d, 0x7d, 0x86, 0x94, 0xa4, + 0xba, 0xd5, 0xf2, 0x112, 0x136, 0x15e, 0x18a, 0x1bc, 0x1fb, 0x242, 0x28e, 0x2da, 0x28c, 0x249, 0x20e, + 0x1cc, 0x195, 0x162, 0x140, 0x11a, 0x100, 0xe4, 0xcb, 0xb3, 0xa7, 0x98, 0x90, 0x8f, 0x8e, 0x90, + 0x97, 0xa2, 0xb3, 0xc9, 0xdf, 0xfe, 0x122, 0x148, 0x16d, 0x1a6, 0x1d6, 0x210, 0x259, 0x2a1, 0x2e8, + 0x2a9, 0x264, 0x21f, 0x1da, 0x1aa, 0x175, 0x151, 0x129, 0x10e, 0xf4, 0xdc, 0xca, 0xb7, 0xaa, 0xa3, + 0x9c, 0x99, 0x9f, 0xaa, 0xb4, 0xc6, 0xd7, 0xee, 0x10a, 0x130, 0x156, 0x183, 0x1c5, 0x1f3, 0x229, + 0x264, 0x2b3, 0x304, 0x2c0, 0x279, 0x234, 0x1ef, 0x1bf, 0x18d, 0x165, 0x13d, 0x11d, 0x106, 0xeb, 0xdb, + 0xcb, 0xbf, 0xb6, 0xae, 0xad, 0xb3, 0xba, 0xc8, 0xd6, 0xeb, 0x103, 0x11b, 0x140, 0x166, 0x19d, + 0x1e6, 0x20b, 0x244, 0x282, 0x2c9, 0x320, 0x2d0, 0x28d, 0x245, 0x204, 0x1da, 0x19c, 0x175, 0x14b, 0x12c, + 0x10f, 0xf9, 0xe5, 0xdb, 0xd0, 0xc3, 0xbc, 0xbb, 0xbf, 0xc8, 0xd8, 0xe7, 0xf7, 0x114, 0x12b, + 0x14d, 0x176, 0x1b2, 0x1f1, 0x218, 0x259, 0x29b, 0x2e3, 0x338, + }, + }, + }, + + /* ISP_BNR_LSC_CALIB_TABLE_S */ + { + /* RGain */ + { + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096 + }, + /* GrGain */ + { + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096 + }, + /* GbGain */ + { + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096 + }, + /* BGain */ + { + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096 + }, + }, + +}; + +static const hi_isp_cmos_lsc ST_CMOS_LSC_FISH_LENS_PIPE0 = { + /* MeshStrength */ + 4096, + /* MeshScale */ + 4, + /* ISP_LSC_CABLI_TABLE_S */ + { + { + /* Rgain */ + { + 0x26b, 0x228, 0x1de, 0x1a8, 0x179, 0x149, 0x12a, 0x109, 0xee, 0xd5, 0xc4, 0xb0, 0xa2, 0x9b, 0x94, + 0x8f, 0x94, 0x93, 0x97, 0x9f, 0xad, 0xb8, 0xc8, 0xdb, 0x10d, 0x14a, 0x133, 0x15a, 0x184, 0x1c1, + 0x1fd, 0x23b, 0x284, 0x24e, 0x212, 0x1d3, 0x19a, 0x168, 0x13d, 0x11b, 0xfa, 0xe4, 0xca, 0xbb, 0xa7, + 0x9a, 0x93, 0x87, 0x88, 0x86, 0x85, 0x8d, 0x98, 0xa0, 0xab, 0xbd, 0xce, 0xf8, 0x12e, 0x123, + 0x14c, 0x179, 0x1af, 0x1e8, 0x22d, 0x267, 0x235, 0x1f9, 0x1ba, 0x18a, 0x158, 0x12c, 0x10d, 0xe9, 0xd3, + 0xbf, 0xad, 0x9b, 0x8c, 0x7e, 0x7b, 0x79, 0x74, 0x79, 0x7b, 0x86, 0x90, 0x9f, 0xaf, 0xc1, + 0xd8, 0xff, 0x114, 0x137, 0x164, 0x198, 0x1d1, 0x213, 0x253, 0x21f, 0x1e5, 0x1a8, 0x172, 0x146, 0x11a, + 0xfc, 0xde, 0xc8, 0xb1, 0x9d, 0x8a, 0x7f, 0x73, 0x6c, 0x66, 0x65, 0x68, 0x6c, 0x74, 0x80, + 0x92, 0xa0, 0xb5, 0xc9, 0xe4, 0x103, 0x128, 0x154, 0x183, 0x1bc, 0x1fe, 0x23b, 0x210, 0x1d3, 0x194, + 0x160, 0x136, 0x10e, 0xec, 0xd3, 0xbc, 0xa4, 0x91, 0x81, 0x6f, 0x67, 0x5d, 0x59, 0x59, 0x59, + 0x5f, 0x6a, 0x75, 0x84, 0x94, 0xab, 0xbf, 0xda, 0xf7, 0x11b, 0x149, 0x173, 0x1ac, 0x1ed, 0x229, + 0x1fa, 0x1c3, 0x185, 0x152, 0x124, 0x101, 0xe2, 0xcd, 0xaf, 0x9c, 0x86, 0x74, 0x65, 0x5a, 0x52, + 0x4c, 0x4c, 0x4d, 0x52, 0x5e, 0x6b, 0x7a, 0x8a, 0x9f, 0xb5, 0xcb, 0xeb, 0x10d, 0x137, 0x165, + 0x19c, 0x1da, 0x218, 0x1e1, 0x1b1, 0x177, 0x148, 0x11a, 0xf8, 0xd7, 0xbf, 0xa6, 0x90, 0x7c, 0x68, + 0x5b, 0x4d, 0x44, 0x40, 0x3e, 0x40, 0x4a, 0x51, 0x5c, 0x6c, 0x7d, 0x95, 0xab, 0xc3, 0xe2, + 0x101, 0x127, 0x154, 0x18f, 0x1cd, 0x200, 0x1d8, 0x1a2, 0x169, 0x13c, 0x111, 0xee, 0xd0, 0xb6, 0x9e, + 0x87, 0x73, 0x5f, 0x4f, 0x44, 0x38, 0x36, 0x35, 0x36, 0x3f, 0x47, 0x55, 0x64, 0x74, 0x8d, + 0xa3, 0xbd, 0xd7, 0xf8, 0x11e, 0x14a, 0x182, 0x1c2, 0x1f4, 0x1c8, 0x197, 0x15f, 0x131, 0x10d, 0xe9, + 0xc9, 0xae, 0x98, 0x7e, 0x69, 0x59, 0x4a, 0x3c, 0x32, 0x2b, 0x2a, 0x2b, 0x33, 0x41, 0x4a, + 0x55, 0x6b, 0x82, 0x9e, 0xb4, 0xd0, 0xed, 0x113, 0x142, 0x175, 0x1b3, 0x1e5, 0x1c1, 0x189, 0x154, + 0x126, 0x103, 0xdf, 0xc5, 0xa4, 0x8b, 0x77, 0x62, 0x4e, 0x3e, 0x34, 0x28, 0x20, 0x1f, 0x23, + 0x2b, 0x35, 0x43, 0x53, 0x64, 0x7a, 0x95, 0xac, 0xca, 0xe8, 0x10c, 0x13a, 0x16b, 0x1a9, 0x1e2, + 0x1b6, 0x182, 0x14f, 0x124, 0xf9, 0xdb, 0xbf, 0xa0, 0x84, 0x6d, 0x57, 0x46, 0x34, 0x29, 0x21, + 0x17, 0x18, 0x17, 0x21, 0x2c, 0x3a, 0x4b, 0x5e, 0x73, 0x8e, 0xa5, 0xc2, 0xe3, 0x105, 0x135, + 0x162, 0x1a0, 0x1d8, 0x1b0, 0x177, 0x146, 0x11d, 0xf6, 0xd7, 0xb8, 0x99, 0x81, 0x6a, 0x53, 0x41, + 0x2f, 0x21, 0x18, 0x11, 0xf, 0x11, 0x1b, 0x25, 0x35, 0x47, 0x5b, 0x6c, 0x86, 0xa2, 0xbc, + 0xdf, 0x101, 0x129, 0x15f, 0x198, 0x1cd, 0x1a9, 0x175, 0x140, 0x112, 0xef, 0xd4, 0xb4, 0x96, 0x7d, + 0x65, 0x50, 0x39, 0x2d, 0x1c, 0x11, 0x9, 0xa, 0xb, 0x15, 0x1f, 0x2f, 0x3f, 0x57, 0x69, + 0x83, 0x9e, 0xb9, 0xd9, 0xfb, 0x126, 0x156, 0x192, 0x1c3, 0x1a6, 0x171, 0x13a, 0x111, 0xef, 0xce, + 0xb1, 0x95, 0x7a, 0x65, 0x4e, 0x39, 0x28, 0x17, 0x9, 0x5, 0x3, 0x7, 0x10, 0x1b, 0x2b, + 0x3e, 0x51, 0x67, 0x82, 0x9c, 0xba, 0xd4, 0xfa, 0x124, 0x152, 0x18d, 0x1be, 0x1a5, 0x16d, 0x134, + 0x10d, 0xe9, 0xd0, 0xae, 0x92, 0x7a, 0x5d, 0x4b, 0x33, 0x26, 0x15, 0x8, 0x2, 0x4, 0x8, + 0xc, 0x16, 0x28, 0x3a, 0x4f, 0x65, 0x7f, 0x9a, 0xb8, 0xd6, 0xf7, 0x123, 0x151, 0x18a, 0x1bf, + 0x19b, 0x167, 0x137, 0x10c, 0xe8, 0xcb, 0xab, 0x8f, 0x78, 0x5d, 0x47, 0x33, 0x27, 0x11, 0x4, + 0x0, 0x2, 0x6, 0xe, 0x16, 0x27, 0x3b, 0x50, 0x65, 0x7d, 0x98, 0xb7, 0xd4, 0xf4, 0x121, + 0x151, 0x18d, 0x1be, 0x19d, 0x165, 0x134, 0x10f, 0xe8, 0xc8, 0xac, 0x8f, 0x75, 0x5c, 0x48, 0x37, + 0x34, 0x11, 0x4, 0x0, 0x0, 0x3, 0xa, 0x16, 0x25, 0x39, 0x50, 0x64, 0x7e, 0x9a, 0xb5, + 0xd5, 0xf8, 0x120, 0x150, 0x18b, 0x1bd, 0x198, 0x16a, 0x135, 0x10e, 0xe8, 0xc9, 0xab, 0x8b, 0x74, + 0x5c, 0x4b, 0x39, 0x36, 0x15, 0x6, 0x1, 0x1, 0x3, 0xc, 0x17, 0x26, 0x3b, 0x4e, 0x65, + 0x7f, 0x98, 0xb6, 0xd5, 0xfa, 0x11e, 0x150, 0x187, 0x1c0, 0x199, 0x167, 0x134, 0x10d, 0xea, 0xca, + 0xae, 0x8e, 0x73, 0x60, 0x4b, 0x39, 0x32, 0x16, 0x5, 0x4, 0x2, 0x6, 0xd, 0x19, 0x2a, + 0x3c, 0x4e, 0x66, 0x83, 0x9a, 0xbc, 0xd3, 0xf9, 0x11f, 0x151, 0x18a, 0x1c0, 0x19d, 0x16b, 0x135, + 0x110, 0xef, 0xce, 0xae, 0x94, 0x7b, 0x64, 0x4d, 0x3b, 0x2b, 0x19, 0x9, 0x9, 0x7, 0xc, + 0xf, 0x1c, 0x2c, 0x41, 0x54, 0x6a, 0x82, 0x9a, 0xbb, 0xd8, 0xfc, 0x124, 0x156, 0x18c, 0x1c0, + 0x1a5, 0x170, 0x139, 0x114, 0xee, 0xd1, 0xb1, 0x95, 0x7e, 0x65, 0x51, 0x3d, 0x2f, 0x1f, 0x14, + 0xc, 0xd, 0xe, 0x16, 0x23, 0x31, 0x42, 0x56, 0x6f, 0x86, 0x9e, 0xbb, 0xda, 0x100, 0x128, + 0x158, 0x190, 0x1c3, 0x1a9, 0x172, 0x144, 0x115, 0xf2, 0xd3, 0xb9, 0x99, 0x80, 0x6b, 0x58, 0x43, + 0x33, 0x28, 0x1b, 0x16, 0x14, 0x15, 0x1b, 0x2a, 0x3b, 0x48, 0x5b, 0x75, 0x8a, 0xa4, 0xc1, + 0xdc, 0x103, 0x12c, 0x15d, 0x196, 0x1cc, 0x1b2, 0x17b, 0x147, 0x11b, 0xfe, 0xda, 0xbd, 0x9f, 0x87, + 0x72, 0x5f, 0x4a, 0x3b, 0x2e, 0x24, 0x1d, 0x1b, 0x1d, 0x24, 0x32, 0x43, 0x51, 0x64, 0x79, + 0x90, 0xaa, 0xc8, 0xeb, 0x107, 0x134, 0x164, 0x19e, 0x1d2, 0x1b3, 0x187, 0x14e, 0x125, 0x102, 0xe2, + 0xc1, 0xa6, 0x8e, 0x77, 0x65, 0x53, 0x44, 0x37, 0x2c, 0x27, 0x25, 0x26, 0x2b, 0x37, 0x45, + 0x55, 0x67, 0x7f, 0x97, 0xb3, 0xcb, 0xec, 0x10f, 0x13c, 0x169, 0x1a4, 0x1dd, 0x1c1, 0x18b, 0x159, + 0x12e, 0x107, 0xe4, 0xca, 0xaf, 0x94, 0x80, 0x6e, 0x5a, 0x4d, 0x40, 0x36, 0x30, 0x30, 0x31, + 0x36, 0x41, 0x4e, 0x5f, 0x74, 0x89, 0x9b, 0xb5, 0xd1, 0xf1, 0x11a, 0x141, 0x173, 0x1aa, 0x1e2, + 0x1c9, 0x198, 0x162, 0x133, 0x112, 0xec, 0xd5, 0xbc, 0x9e, 0x88, 0x75, 0x65, 0x56, 0x4c, 0x42, + 0x3b, 0x3a, 0x3f, 0x40, 0x4c, 0x57, 0x6a, 0x7c, 0x91, 0xa5, 0xc0, 0xda, 0xf8, 0x11e, 0x148, + 0x17b, 0x1b7, 0x1ef, 0x1de, 0x1a5, 0x16f, 0x140, 0x119, 0xf8, 0xda, 0xc4, 0xa7, 0x92, 0x7f, 0x6d, + 0x64, 0x57, 0x4e, 0x48, 0x45, 0x48, 0x4f, 0x56, 0x62, 0x73, 0x86, 0x98, 0xb1, 0xc5, 0xe6, + 0x105, 0x128, 0x155, 0x188, 0x1c4, 0x1fd, 0x1e8, 0x1b2, 0x17b, 0x14b, 0x126, 0x103, 0xe8, 0xcc, 0xb1, + 0x9e, 0x89, 0x7d, 0x6f, 0x60, 0x59, 0x53, 0x53, 0x55, 0x5b, 0x64, 0x6f, 0x80, 0x8f, 0xa5, + 0xbe, 0xd4, 0xf0, 0x10d, 0x135, 0x15f, 0x18f, 0x1d6, 0x20c, 0x1f9, 0x1bf, 0x18a, 0x15a, 0x131, 0x10e, + 0xf2, 0xd7, 0xbf, 0xab, 0x99, 0x89, 0x79, 0x70, 0x65, 0x61, 0x60, 0x62, 0x6a, 0x72, 0x7b, + 0x8c, 0x9e, 0xb3, 0xc9, 0xe2, 0xfb, 0x117, 0x13d, 0x169, 0x19f, 0x1df, 0x21e, 0x20c, 0x1cf, 0x198, + 0x166, 0x13f, 0x119, 0xfb, 0xe0, 0xca, 0xb6, 0xa7, 0x95, 0x85, 0x7d, 0x74, 0x6e, 0x70, 0x70, + 0x74, 0x7d, 0x87, 0x98, 0xa9, 0xbe, 0xd2, 0xee, 0x106, 0x125, 0x14c, 0x176, 0x1af, 0x1f4, 0x22d, + 0x21c, 0x1e3, 0x1a9, 0x178, 0x14b, 0x126, 0x109, 0xee, 0xd6, 0xc3, 0xb4, 0xa5, 0x96, 0x8d, 0x83, + 0x7d, 0x7f, 0x7c, 0x83, 0x8f, 0x94, 0xa6, 0xb7, 0xcc, 0xe0, 0xf6, 0x115, 0x133, 0x15d, 0x189, + 0x1c1, 0x204, 0x23f, 0x22d, 0x1f1, 0x1bb, 0x187, 0x157, 0x132, 0x118, 0xfe, 0xe6, 0xd1, 0xc3, 0xb3, + 0xa7, 0x98, 0x91, 0x8b, 0x8e, 0x8d, 0x91, 0x9b, 0xa6, 0xb5, 0xc5, 0xd9, 0xf1, 0x107, 0x122, + 0x144, 0x16b, 0x19d, 0x1d5, 0x218, 0x252, 0x244, 0x204, 0x1c8, 0x18e, 0x167, 0x137, 0x127, 0x108, 0xf5, + 0xdd, 0xcc, 0xbf, 0xb1, 0xa6, 0x9f, 0x9d, 0x99, 0x9a, 0x98, 0xa5, 0xb3, 0xc0, 0xce, 0xe2, + 0xf7, 0x10b, 0x12e, 0x155, 0x17a, 0x1a6, 0x1e9, 0x223, 0x262, + }, + + /* Grgain */ + { + 0x27c, 0x243, 0x1fd, 0x1be, 0x18b, 0x162, 0x138, 0x114, 0xfb, 0xe1, 0xd2, 0xbb, 0xb1, 0xa9, 0xa3, + 0x9e, 0x9d, 0x9d, 0xa0, 0xb1, 0xb7, 0xc3, 0xd8, 0xea, 0x11d, 0x15a, 0x141, 0x170, 0x1a4, 0x1d8, + 0x21c, 0x268, 0x2ab, 0x265, 0x22e, 0x1e8, 0x1b1, 0x17e, 0x153, 0x128, 0x107, 0xef, 0xd9, 0xc6, 0xb3, + 0xa6, 0x9b, 0x94, 0x90, 0x91, 0x94, 0x96, 0xa0, 0xac, 0xb7, 0xcc, 0xdd, 0x101, 0x13d, 0x137, + 0x165, 0x193, 0x1c5, 0x206, 0x253, 0x297, 0x24a, 0x217, 0x1d0, 0x197, 0x164, 0x13d, 0x113, 0xf4, 0xde, + 0xc8, 0xb4, 0xa7, 0x96, 0x8c, 0x83, 0x7e, 0x7e, 0x81, 0x84, 0x8f, 0x9a, 0xa9, 0xbb, 0xcd, + 0xe8, 0x10f, 0x128, 0x150, 0x17a, 0x1b1, 0x1ec, 0x236, 0x274, 0x22f, 0x1fb, 0x1bb, 0x181, 0x154, 0x12b, + 0x108, 0xe8, 0xd0, 0xba, 0xa6, 0x96, 0x87, 0x7b, 0x74, 0x6f, 0x6e, 0x6e, 0x75, 0x7f, 0x8c, + 0x98, 0xab, 0xc2, 0xd9, 0xf3, 0x116, 0x13b, 0x168, 0x19d, 0x1d6, 0x220, 0x25c, 0x21c, 0x1e9, 0x1a8, + 0x173, 0x140, 0x11b, 0xf8, 0xde, 0xc5, 0xaf, 0x9b, 0x88, 0x77, 0x6d, 0x64, 0x5e, 0x5d, 0x61, + 0x67, 0x6f, 0x80, 0x8b, 0x9f, 0xb6, 0xca, 0xe7, 0x105, 0x12d, 0x15a, 0x18d, 0x1c1, 0x20a, 0x24e, + 0x209, 0x1d3, 0x199, 0x164, 0x134, 0x10e, 0xee, 0xd2, 0xba, 0xa4, 0x8e, 0x7c, 0x6b, 0x61, 0x58, + 0x53, 0x50, 0x54, 0x5a, 0x64, 0x70, 0x80, 0x92, 0xa8, 0xc1, 0xde, 0xfa, 0x11d, 0x147, 0x17b, + 0x1b7, 0x1f7, 0x238, 0x1f6, 0x1c5, 0x18b, 0x154, 0x127, 0x101, 0xe6, 0xc7, 0xaf, 0x97, 0x82, 0x70, + 0x62, 0x54, 0x4b, 0x44, 0x46, 0x47, 0x4e, 0x56, 0x64, 0x74, 0x85, 0x9d, 0xb6, 0xd1, 0xee, + 0x110, 0x13c, 0x16a, 0x1a6, 0x1e6, 0x22d, 0x1ed, 0x1b6, 0x179, 0x148, 0x11c, 0xfe, 0xda, 0xbc, 0xa7, + 0x8e, 0x78, 0x65, 0x55, 0x4a, 0x41, 0x38, 0x39, 0x3a, 0x43, 0x4c, 0x5a, 0x68, 0x7e, 0x94, + 0xab, 0xc7, 0xe5, 0x103, 0x130, 0x15a, 0x193, 0x1db, 0x21b, 0x1de, 0x1ad, 0x170, 0x13b, 0x118, 0xf0, + 0xd3, 0xb3, 0x9d, 0x85, 0x6f, 0x5c, 0x4c, 0x3d, 0x35, 0x2d, 0x2a, 0x2e, 0x37, 0x43, 0x4f, + 0x61, 0x76, 0x8b, 0xa3, 0xbc, 0xdb, 0xf9, 0x123, 0x153, 0x187, 0x1cc, 0x20b, 0x1ca, 0x19f, 0x165, + 0x130, 0x10c, 0xea, 0xcd, 0xaf, 0x95, 0x7d, 0x65, 0x53, 0x46, 0x36, 0x28, 0x24, 0x22, 0x25, + 0x2e, 0x38, 0x48, 0x58, 0x6c, 0x80, 0x9f, 0xb4, 0xd3, 0xf4, 0x11e, 0x14b, 0x181, 0x1c3, 0x1fc, + 0x1ca, 0x197, 0x15c, 0x129, 0x107, 0xe6, 0xc6, 0xa8, 0x8e, 0x76, 0x5d, 0x4d, 0x3c, 0x2c, 0x21, + 0x18, 0x19, 0x1c, 0x27, 0x2f, 0x41, 0x52, 0x68, 0x79, 0x94, 0xb2, 0xce, 0xee, 0x116, 0x149, + 0x17a, 0x1b9, 0x1fa, 0x1be, 0x18c, 0x156, 0x123, 0x100, 0xdc, 0xbe, 0xa3, 0x89, 0x6f, 0x5a, 0x46, + 0x33, 0x25, 0x19, 0xf, 0xe, 0x16, 0x1d, 0x28, 0x39, 0x49, 0x5f, 0x75, 0x8d, 0xaa, 0xc7, + 0xe9, 0x10f, 0x13c, 0x172, 0x1b3, 0x1ec, 0x1b4, 0x188, 0x151, 0x121, 0xfc, 0xde, 0xbd, 0x9e, 0x85, + 0x6b, 0x54, 0x40, 0x31, 0x1e, 0x12, 0xb, 0x9, 0xf, 0x16, 0x24, 0x34, 0x44, 0x5c, 0x70, + 0x89, 0xa6, 0xc6, 0xe5, 0x10a, 0x137, 0x16b, 0x1ac, 0x1e5, 0x1b1, 0x182, 0x148, 0x11d, 0xfa, 0xdb, + 0xb9, 0x9d, 0x81, 0x68, 0x52, 0x3e, 0x2c, 0x1b, 0xc, 0x6, 0x7, 0x9, 0x11, 0x20, 0x31, + 0x41, 0x59, 0x6e, 0x88, 0xa2, 0xc1, 0xdf, 0x106, 0x134, 0x165, 0x1a6, 0x1de, 0x1ae, 0x17d, 0x147, + 0x119, 0xf7, 0xd6, 0xb7, 0x9a, 0x80, 0x67, 0x53, 0x3a, 0x29, 0x18, 0xa, 0x3, 0x4, 0x6, + 0x12, 0x1a, 0x2c, 0x3f, 0x56, 0x6d, 0x86, 0xa1, 0xc1, 0xde, 0x103, 0x12e, 0x166, 0x1a2, 0x1dc, + 0x1a3, 0x17f, 0x147, 0x11c, 0xf3, 0xd5, 0xb4, 0x98, 0x7d, 0x63, 0x4e, 0x3b, 0x29, 0x13, 0xa, + 0x1, 0x0, 0x4, 0xe, 0x18, 0x2b, 0x40, 0x55, 0x6f, 0x84, 0xa3, 0xbf, 0xdf, 0x102, 0x12c, + 0x163, 0x1a0, 0x1da, 0x1ac, 0x17c, 0x144, 0x116, 0xf5, 0xd6, 0xb5, 0x98, 0x7d, 0x63, 0x4c, 0x3b, + 0x37, 0x14, 0x7, 0x0, 0x1, 0x5, 0xc, 0x1a, 0x2a, 0x40, 0x55, 0x6d, 0x83, 0xa1, 0xbe, + 0xdf, 0x101, 0x12f, 0x166, 0x1a0, 0x1d7, 0x1a7, 0x17d, 0x146, 0x118, 0xf8, 0xd4, 0xb6, 0x98, 0x80, + 0x68, 0x52, 0x3f, 0x3a, 0x18, 0x9, 0x1, 0x2, 0x6, 0xe, 0x1a, 0x2c, 0x40, 0x54, 0x6c, + 0x88, 0xa0, 0xc2, 0xe0, 0x103, 0x12d, 0x160, 0x19f, 0x1d5, 0x1aa, 0x17c, 0x145, 0x119, 0xf9, 0xd9, + 0xb6, 0x9b, 0x82, 0x6b, 0x52, 0x3e, 0x3a, 0x1b, 0xb, 0x3, 0x5, 0x7, 0xd, 0x1c, 0x2d, + 0x43, 0x57, 0x6c, 0x88, 0xa1, 0xc0, 0xe3, 0x102, 0x12e, 0x162, 0x1a0, 0x1dc, 0x1b0, 0x17f, 0x148, + 0x11f, 0xfd, 0xd8, 0xb8, 0x9c, 0x83, 0x6d, 0x55, 0x3f, 0x2d, 0x1e, 0x10, 0x7, 0x7, 0xb, + 0x13, 0x20, 0x31, 0x46, 0x5b, 0x72, 0x8c, 0xa7, 0xc6, 0xe2, 0x107, 0x131, 0x167, 0x1a3, 0x1df, + 0x1b4, 0x185, 0x14d, 0x124, 0xfe, 0xde, 0xbc, 0xa3, 0x87, 0x6e, 0x5c, 0x46, 0x36, 0x24, 0x16, + 0xf, 0xf, 0x13, 0x19, 0x24, 0x36, 0x49, 0x5f, 0x77, 0x8f, 0xad, 0xca, 0xe5, 0x10d, 0x139, + 0x16b, 0x1a6, 0x1e2, 0x1b7, 0x189, 0x152, 0x127, 0x103, 0xe2, 0xc3, 0xa6, 0x8d, 0x76, 0x5d, 0x4c, + 0x3c, 0x2c, 0x1c, 0x18, 0x18, 0x18, 0x21, 0x2b, 0x3d, 0x4e, 0x64, 0x7b, 0x96, 0xb0, 0xcf, + 0xee, 0x111, 0x13c, 0x171, 0x1af, 0x1e7, 0x1be, 0x191, 0x15a, 0x12d, 0x10b, 0xe3, 0xca, 0xac, 0x90, + 0x7a, 0x63, 0x57, 0x3e, 0x32, 0x26, 0x20, 0x1f, 0x23, 0x2b, 0x34, 0x44, 0x57, 0x69, 0x83, + 0x9c, 0xb4, 0xd2, 0xf7, 0x119, 0x145, 0x175, 0x1b8, 0x1f3, 0x1ca, 0x19a, 0x162, 0x139, 0x110, 0xea, + 0xcc, 0xb2, 0x98, 0x81, 0x6c, 0x59, 0x4a, 0x3b, 0x32, 0x2c, 0x29, 0x2b, 0x2f, 0x3d, 0x4a, + 0x5b, 0x73, 0x88, 0xa2, 0xbc, 0xd7, 0xfd, 0x11e, 0x147, 0x180, 0x1bf, 0x1fb, 0x1c9, 0x1a4, 0x16a, + 0x13f, 0x114, 0xf4, 0xd5, 0xba, 0x9e, 0x8a, 0x77, 0x63, 0x54, 0x45, 0x3a, 0x36, 0x33, 0x35, + 0x3a, 0x48, 0x54, 0x66, 0x79, 0x8f, 0xa8, 0xc6, 0xe1, 0x104, 0x127, 0x14f, 0x184, 0x1c8, 0x203, + 0x1e3, 0x1b0, 0x177, 0x145, 0x11e, 0xfd, 0xdc, 0xc3, 0xa5, 0x90, 0x7b, 0x6d, 0x5d, 0x50, 0x46, + 0x42, 0x41, 0x40, 0x47, 0x52, 0x61, 0x70, 0x85, 0x9b, 0xb3, 0xce, 0xe7, 0x109, 0x131, 0x15c, + 0x192, 0x1d1, 0x213, 0x1ed, 0x1bf, 0x186, 0x152, 0x12a, 0x108, 0xe7, 0xcd, 0xb1, 0x9c, 0x87, 0x78, + 0x6a, 0x5d, 0x55, 0x4f, 0x4c, 0x4d, 0x54, 0x5c, 0x6d, 0x7d, 0x8f, 0xa4, 0xbb, 0xd7, 0xf4, + 0x112, 0x137, 0x169, 0x1a0, 0x1de, 0x21a, 0x1fa, 0x1d2, 0x190, 0x160, 0x133, 0x110, 0xf2, 0xd9, 0xbb, + 0xa7, 0x96, 0x84, 0x75, 0x68, 0x5e, 0x5c, 0x5a, 0x5c, 0x60, 0x6d, 0x77, 0x8a, 0x99, 0xad, + 0xc6, 0xe1, 0xfd, 0x11d, 0x146, 0x173, 0x1ab, 0x1eb, 0x22a, 0x20d, 0x1dd, 0x1a0, 0x16f, 0x140, 0x11a, + 0xfc, 0xe5, 0xc7, 0xb3, 0xa3, 0x8f, 0x81, 0x75, 0x6d, 0x69, 0x66, 0x69, 0x71, 0x78, 0x85, + 0x93, 0xa5, 0xbb, 0xd3, 0xec, 0x108, 0x128, 0x152, 0x180, 0x1b9, 0x1fe, 0x23c, 0x21e, 0x1ee, 0x1b2, + 0x179, 0x150, 0x12c, 0x10c, 0xef, 0xd6, 0xc0, 0xad, 0x9d, 0x8f, 0x83, 0x7a, 0x79, 0x74, 0x79, + 0x7e, 0x86, 0x91, 0x9f, 0xb3, 0xcc, 0xdf, 0xf8, 0x114, 0x13b, 0x162, 0x18f, 0x1ca, 0x20e, 0x24e, + 0x231, 0x201, 0x1bf, 0x18c, 0x160, 0x137, 0x119, 0xfd, 0xe6, 0xcd, 0xbd, 0xad, 0x9e, 0x94, 0x8a, + 0x88, 0x84, 0x85, 0x8c, 0x97, 0xa2, 0xb0, 0xc5, 0xd6, 0xf0, 0x106, 0x123, 0x147, 0x16d, 0x1a1, + 0x1da, 0x21d, 0x260, 0x244, 0x211, 0x1d4, 0x19c, 0x171, 0x147, 0x128, 0x10e, 0xf3, 0xdf, 0xcc, 0xbc, + 0xaf, 0xa5, 0x9c, 0x96, 0x94, 0x97, 0x9c, 0xa7, 0xb0, 0xc1, 0xd4, 0xe7, 0xfd, 0x113, 0x131, + 0x156, 0x181, 0x1af, 0x1f1, 0x23a, 0x276, 0x25c, 0x224, 0x1e1, 0x1a9, 0x17f, 0x153, 0x136, 0x117, 0xfd, + 0xeb, 0xda, 0xc5, 0xbe, 0xb2, 0xaa, 0xa2, 0x9f, 0xa3, 0xa9, 0xb5, 0xbb, 0xcc, 0xda, 0xf1, + 0x104, 0x122, 0x13e, 0x161, 0x18e, 0x1c4, 0x1ff, 0x24b, 0x285, + }, + + /* Gbgain */ + { + 0x28b, 0x248, 0x1fd, 0x1c1, 0x18e, 0x160, 0x139, 0x115, 0xfd, 0xe8, 0xd7, 0xc4, 0xb6, 0xad, 0xa3, + 0xa4, 0xa4, 0xa3, 0xa9, 0xb5, 0xbc, 0xc8, 0xde, 0xf4, 0x126, 0x166, 0x14d, 0x17a, 0x1a5, 0x1dd, + 0x21f, 0x26c, 0x2b1, 0x271, 0x232, 0x1ea, 0x1b0, 0x180, 0x152, 0x12b, 0x10c, 0xf2, 0xdc, 0xca, 0xb9, + 0xab, 0xa1, 0x9a, 0x96, 0x96, 0x99, 0xa0, 0xa6, 0xb0, 0xbf, 0xd2, 0xe5, 0x10a, 0x143, 0x13f, + 0x16b, 0x19c, 0x1cd, 0x20e, 0x256, 0x29c, 0x256, 0x216, 0x1d6, 0x19d, 0x16a, 0x142, 0x11d, 0xfd, 0xe4, + 0xcc, 0xb9, 0xa9, 0x9b, 0x91, 0x87, 0x84, 0x83, 0x84, 0x8b, 0x94, 0xa0, 0xae, 0xc1, 0xd7, + 0xec, 0x113, 0x12e, 0x156, 0x183, 0x1b7, 0x1f5, 0x23d, 0x284, 0x240, 0x201, 0x1c3, 0x185, 0x155, 0x12d, + 0x10e, 0xee, 0xd4, 0xbe, 0xa9, 0x9b, 0x8b, 0x7e, 0x79, 0x74, 0x73, 0x74, 0x7a, 0x88, 0x92, + 0x9d, 0xb2, 0xc8, 0xe1, 0xfc, 0x11c, 0x143, 0x172, 0x1a1, 0x1dd, 0x226, 0x266, 0x229, 0x1eb, 0x1ad, + 0x176, 0x142, 0x11f, 0xfb, 0xe1, 0xc9, 0xb0, 0x9f, 0x89, 0x7c, 0x71, 0x6a, 0x64, 0x62, 0x65, + 0x6c, 0x74, 0x84, 0x90, 0xa4, 0xba, 0xd2, 0xed, 0x10f, 0x132, 0x15f, 0x18f, 0x1ce, 0x20f, 0x252, + 0x21a, 0x1d7, 0x19c, 0x163, 0x136, 0x110, 0xf1, 0xd5, 0xbc, 0xa6, 0x92, 0x81, 0x72, 0x64, 0x59, + 0x57, 0x58, 0x59, 0x5e, 0x69, 0x75, 0x84, 0x97, 0xad, 0xc5, 0xe1, 0x102, 0x124, 0x151, 0x183, + 0x1bc, 0x1ff, 0x23b, 0x201, 0x1c5, 0x18a, 0x155, 0x129, 0x106, 0xe8, 0xcc, 0xb1, 0x9a, 0x86, 0x74, + 0x67, 0x58, 0x4d, 0x4b, 0x4b, 0x4a, 0x51, 0x5c, 0x6a, 0x7c, 0x8b, 0xa4, 0xbc, 0xd5, 0xf9, + 0x115, 0x140, 0x175, 0x1ac, 0x1ef, 0x229, 0x1f5, 0x1b9, 0x17e, 0x14b, 0x11d, 0xfc, 0xde, 0xc0, 0xa9, + 0x91, 0x7c, 0x6a, 0x59, 0x4d, 0x43, 0x3f, 0x3c, 0x3f, 0x46, 0x4f, 0x5e, 0x6e, 0x84, 0x99, + 0xb0, 0xc9, 0xeb, 0x109, 0x135, 0x163, 0x19e, 0x1de, 0x21e, 0x1ea, 0x1af, 0x176, 0x142, 0x116, 0xf6, + 0xd2, 0xb7, 0x9e, 0x87, 0x73, 0x60, 0x4e, 0x43, 0x38, 0x31, 0x2f, 0x32, 0x3c, 0x45, 0x54, + 0x65, 0x7a, 0x91, 0xaa, 0xc3, 0xe0, 0x101, 0x127, 0x158, 0x18f, 0x1d1, 0x211, 0x1de, 0x1a2, 0x168, + 0x137, 0x110, 0xee, 0xcd, 0xb1, 0x98, 0x7f, 0x67, 0x56, 0x44, 0x39, 0x2e, 0x27, 0x27, 0x2a, + 0x33, 0x3d, 0x4a, 0x5c, 0x71, 0x87, 0xa3, 0xba, 0xda, 0xfa, 0x120, 0x14e, 0x183, 0x1c6, 0x208, + 0x1ce, 0x199, 0x160, 0x130, 0x107, 0xe8, 0xc8, 0xab, 0x94, 0x79, 0x5f, 0x50, 0x3d, 0x2f, 0x22, + 0x1a, 0x1e, 0x1e, 0x28, 0x32, 0x43, 0x55, 0x6b, 0x7f, 0x9a, 0xb4, 0xd1, 0xf3, 0x11c, 0x147, + 0x17d, 0x1c0, 0x1fa, 0x1c8, 0x191, 0x159, 0x12a, 0x101, 0xe1, 0xc3, 0xa4, 0x8c, 0x73, 0x5b, 0x48, + 0x34, 0x28, 0x1c, 0x13, 0x13, 0x14, 0x21, 0x2b, 0x3b, 0x4c, 0x65, 0x7a, 0x92, 0xae, 0xcf, + 0xeb, 0x116, 0x145, 0x178, 0x1b7, 0x1f6, 0x1bf, 0x188, 0x153, 0x11e, 0x101, 0xde, 0xbe, 0xa0, 0x86, + 0x6c, 0x54, 0x43, 0x2f, 0x20, 0x14, 0xd, 0xc, 0x10, 0x1b, 0x26, 0x36, 0x46, 0x60, 0x75, + 0x91, 0xa9, 0xc9, 0xea, 0x110, 0x13c, 0x16f, 0x1b0, 0x1eb, 0x1b8, 0x181, 0x14d, 0x121, 0xfc, 0xdb, + 0xb8, 0x9d, 0x85, 0x67, 0x54, 0x3e, 0x2e, 0x1c, 0xf, 0x7, 0x7, 0xa, 0x15, 0x21, 0x32, + 0x46, 0x5a, 0x72, 0x8b, 0xa8, 0xc7, 0xe4, 0x10c, 0x137, 0x16b, 0x1ab, 0x1e5, 0x1bf, 0x17f, 0x14a, + 0x11e, 0xfa, 0xd6, 0xb8, 0x9d, 0x81, 0x69, 0x4f, 0x3c, 0x28, 0x19, 0xb, 0x4, 0x3, 0x9, + 0x11, 0x1d, 0x2e, 0x43, 0x56, 0x6f, 0x8a, 0xa4, 0xc6, 0xe2, 0x10a, 0x139, 0x16a, 0x1ad, 0x1e2, + 0x1b5, 0x17f, 0x147, 0x11c, 0xf9, 0xd7, 0xb6, 0x97, 0x7d, 0x67, 0x4f, 0x3a, 0x2c, 0x16, 0x8, + 0x3, 0x3, 0x7, 0x12, 0x1b, 0x2e, 0x41, 0x57, 0x71, 0x8b, 0xa7, 0xc3, 0xe0, 0x109, 0x137, + 0x168, 0x1a5, 0x1db, 0x1b1, 0x17f, 0x149, 0x11b, 0xfa, 0xd4, 0xb8, 0x96, 0x7f, 0x66, 0x50, 0x3d, + 0x37, 0x16, 0x8, 0x1, 0x0, 0x6, 0xf, 0x18, 0x2e, 0x42, 0x57, 0x6f, 0x89, 0xa4, 0xc2, + 0xe3, 0x107, 0x135, 0x16a, 0x1a3, 0x1df, 0x1b2, 0x17f, 0x149, 0x11b, 0xf8, 0xd8, 0xb9, 0x9a, 0x7f, + 0x67, 0x52, 0x41, 0x3c, 0x16, 0xb, 0x3, 0x3, 0x7, 0xf, 0x19, 0x30, 0x43, 0x58, 0x6d, + 0x88, 0xa3, 0xc6, 0xe4, 0x107, 0x134, 0x167, 0x1a2, 0x1dd, 0x1b9, 0x180, 0x148, 0x120, 0xf9, 0xd9, + 0xba, 0x9c, 0x82, 0x68, 0x54, 0x3f, 0x36, 0x19, 0xd, 0x5, 0x5, 0x9, 0x10, 0x1e, 0x2f, + 0x43, 0x5a, 0x70, 0x8b, 0xa6, 0xc5, 0xe5, 0x10a, 0x136, 0x167, 0x1a4, 0x1dd, 0x1b9, 0x183, 0x14b, + 0x122, 0xfe, 0xda, 0xbc, 0x9d, 0x84, 0x6a, 0x56, 0x41, 0x2e, 0x1e, 0xf, 0xb, 0xa, 0xc, + 0x14, 0x23, 0x34, 0x4a, 0x5e, 0x74, 0x8d, 0xab, 0xc6, 0xe7, 0x10a, 0x139, 0x16e, 0x1a8, 0x1e0, + 0x1c0, 0x18b, 0x150, 0x123, 0x100, 0xdd, 0xbf, 0xa5, 0x86, 0x6d, 0x5a, 0x46, 0x34, 0x24, 0x16, + 0x11, 0x10, 0x12, 0x18, 0x26, 0x39, 0x4c, 0x61, 0x7a, 0x91, 0xae, 0xcb, 0xec, 0x115, 0x13e, + 0x171, 0x1ab, 0x1e9, 0x1c5, 0x18d, 0x155, 0x12a, 0x106, 0xe3, 0xc2, 0xa6, 0x8c, 0x76, 0x5d, 0x4c, + 0x3c, 0x2c, 0x1f, 0x19, 0x18, 0x1a, 0x22, 0x30, 0x40, 0x51, 0x66, 0x81, 0x96, 0xb3, 0xd1, + 0xf1, 0x117, 0x141, 0x174, 0x1b3, 0x1ed, 0x1d0, 0x194, 0x15d, 0x132, 0x10b, 0xe7, 0xc9, 0xac, 0x93, + 0x7c, 0x66, 0x53, 0x43, 0x35, 0x26, 0x22, 0x1f, 0x23, 0x29, 0x37, 0x46, 0x56, 0x6d, 0x84, + 0x9f, 0xba, 0xd4, 0xf7, 0x11a, 0x148, 0x17d, 0x1bb, 0x1f3, 0x1d3, 0x19c, 0x166, 0x138, 0x113, 0xed, + 0xce, 0xb2, 0x98, 0x82, 0x70, 0x58, 0x48, 0x3d, 0x32, 0x2b, 0x2a, 0x2c, 0x34, 0x40, 0x50, + 0x5f, 0x75, 0x8b, 0xa3, 0xc0, 0xdb, 0xfe, 0x122, 0x14e, 0x184, 0x1c5, 0x205, 0x1e1, 0x1a7, 0x16e, + 0x13e, 0x11a, 0xf5, 0xd6, 0xbb, 0x9d, 0x87, 0x76, 0x62, 0x54, 0x45, 0x3c, 0x37, 0x35, 0x37, + 0x40, 0x4a, 0x59, 0x69, 0x7b, 0x93, 0xad, 0xc5, 0xe4, 0x101, 0x128, 0x153, 0x187, 0x1cd, 0x20a, + 0x1f0, 0x1b3, 0x177, 0x146, 0x120, 0xfe, 0xdc, 0xc5, 0xa8, 0x8f, 0x7d, 0x6c, 0x5d, 0x4f, 0x47, + 0x41, 0x3f, 0x44, 0x49, 0x54, 0x62, 0x74, 0x86, 0x9b, 0xb1, 0xd1, 0xf0, 0x10c, 0x132, 0x15e, + 0x197, 0x1d8, 0x211, 0x200, 0x1c4, 0x184, 0x157, 0x12c, 0x107, 0xe8, 0xd0, 0xb3, 0x9a, 0x87, 0x76, + 0x66, 0x5a, 0x51, 0x4f, 0x4d, 0x50, 0x55, 0x5e, 0x6d, 0x7f, 0x93, 0xa3, 0xbd, 0xd9, 0xf9, + 0x119, 0x13f, 0x16e, 0x1a2, 0x1e3, 0x21d, 0x20f, 0x1d0, 0x193, 0x163, 0x138, 0x112, 0xf0, 0xd6, 0xbc, + 0xa5, 0x94, 0x83, 0x73, 0x69, 0x61, 0x5a, 0x59, 0x5d, 0x60, 0x6b, 0x79, 0x8b, 0x9e, 0xb4, + 0xc7, 0xe3, 0x104, 0x121, 0x149, 0x17b, 0x1ae, 0x1f3, 0x22e, 0x214, 0x1de, 0x1a4, 0x16f, 0x145, 0x11d, + 0xfd, 0xe1, 0xc7, 0xb4, 0x9f, 0x8f, 0x82, 0x74, 0x6d, 0x67, 0x66, 0x6b, 0x6d, 0x7a, 0x86, + 0x96, 0xa8, 0xbf, 0xd7, 0xef, 0x10c, 0x12b, 0x155, 0x183, 0x1bd, 0x203, 0x246, 0x22c, 0x1f1, 0x1b2, + 0x17f, 0x151, 0x12c, 0x109, 0xed, 0xd4, 0xc2, 0xab, 0x9f, 0x91, 0x83, 0x7a, 0x75, 0x78, 0x7a, + 0x7e, 0x8a, 0x96, 0xa3, 0xb8, 0xcb, 0xe1, 0xfe, 0x11a, 0x13a, 0x165, 0x190, 0x1ce, 0x20f, 0x252, + 0x242, 0x201, 0x1c2, 0x18d, 0x161, 0x136, 0x119, 0xfd, 0xe4, 0xcc, 0xb9, 0xae, 0x9d, 0x94, 0x8f, + 0x88, 0x83, 0x86, 0x8d, 0x9a, 0xa3, 0xb1, 0xc4, 0xd8, 0xf1, 0x109, 0x12a, 0x148, 0x174, 0x1a4, + 0x1e1, 0x227, 0x26b, 0x258, 0x213, 0x1d4, 0x19f, 0x16f, 0x145, 0x128, 0x10a, 0xf1, 0xdc, 0xcc, 0xbd, + 0xb0, 0xa2, 0x9d, 0x98, 0x94, 0x98, 0x9f, 0xa8, 0xb2, 0xc1, 0xd6, 0xe9, 0x101, 0x118, 0x138, + 0x159, 0x183, 0x1b8, 0x1f6, 0x240, 0x287, 0x261, 0x221, 0x1de, 0x1ad, 0x17f, 0x150, 0x131, 0x11b, 0xfd, + 0xe6, 0xd8, 0xcc, 0xbc, 0xa9, 0xac, 0xa0, 0x9d, 0xa0, 0xa9, 0xb5, 0xbe, 0xcb, 0xe0, 0xf7, + 0x109, 0x123, 0x142, 0x166, 0x193, 0x1c9, 0x208, 0x24f, 0x28f, + }, + + /* Bgain */ + { + 0x28e, 0x248, 0x202, 0x1bf, 0x186, 0x15f, 0x12f, 0x10c, 0xfb, 0xda, 0xcc, 0xbe, 0xb4, 0xa9, 0xa4, + 0xa1, 0xa4, 0xa5, 0xa9, 0xb5, 0xba, 0xcd, 0xe2, 0xf4, 0x120, 0x15d, 0x14b, 0x170, 0x1a5, 0x1d5, + 0x220, 0x263, 0x2b6, 0x27c, 0x235, 0x1f1, 0x1af, 0x17b, 0x14d, 0x127, 0x105, 0xec, 0xd4, 0xc2, 0xb2, + 0xa3, 0x96, 0x92, 0x95, 0x93, 0x93, 0x9c, 0xa3, 0xb1, 0xc0, 0xd1, 0xe4, 0x105, 0x13e, 0x139, + 0x162, 0x193, 0x1cd, 0x207, 0x252, 0x29e, 0x251, 0x222, 0x1d8, 0x19f, 0x16e, 0x139, 0x114, 0xf4, 0xde, + 0xc4, 0xb3, 0xa2, 0x92, 0x88, 0x83, 0x82, 0x81, 0x7f, 0x88, 0x94, 0xa1, 0xac, 0xbe, 0xd2, + 0xec, 0x112, 0x128, 0x150, 0x17d, 0x1b0, 0x1f1, 0x239, 0x274, 0x239, 0x203, 0x1c2, 0x18e, 0x15e, 0x12c, + 0x105, 0xe9, 0xd1, 0xb9, 0xa7, 0x97, 0x86, 0x7b, 0x73, 0x6b, 0x6f, 0x6b, 0x76, 0x84, 0x8f, + 0x9e, 0xaf, 0xc1, 0xdb, 0xf6, 0x118, 0x13d, 0x165, 0x1a0, 0x1d8, 0x222, 0x266, 0x228, 0x1f5, 0x1ac, + 0x175, 0x144, 0x11d, 0xfc, 0xe3, 0xc2, 0xb0, 0x97, 0x89, 0x7c, 0x71, 0x67, 0x60, 0x61, 0x5e, + 0x67, 0x74, 0x7e, 0x8b, 0x9e, 0xb5, 0xcf, 0xe6, 0x107, 0x12b, 0x155, 0x18b, 0x1c9, 0x212, 0x252, + 0x208, 0x1d6, 0x19a, 0x161, 0x136, 0x10a, 0xed, 0xd9, 0xbe, 0xa4, 0x8d, 0x7e, 0x6e, 0x62, 0x5c, + 0x53, 0x53, 0x58, 0x5b, 0x62, 0x6f, 0x7e, 0x91, 0xa8, 0xbe, 0xd3, 0xf5, 0x11b, 0x144, 0x17a, + 0x1b2, 0x1ff, 0x23d, 0x1fa, 0x1ca, 0x183, 0x155, 0x12a, 0x104, 0xe4, 0xcb, 0xb0, 0x9b, 0x83, 0x75, + 0x61, 0x57, 0x4d, 0x4b, 0x48, 0x48, 0x50, 0x59, 0x67, 0x78, 0x86, 0x9d, 0xb4, 0xcb, 0xec, + 0x10d, 0x133, 0x165, 0x1a4, 0x1e5, 0x22c, 0x1ec, 0x1b8, 0x17d, 0x141, 0x11b, 0xf7, 0xda, 0xc1, 0xad, + 0x94, 0x7a, 0x64, 0x59, 0x4e, 0x45, 0x3e, 0x3d, 0x3b, 0x43, 0x4d, 0x5b, 0x6b, 0x81, 0x96, + 0xaa, 0xc6, 0xe0, 0x104, 0x128, 0x15c, 0x190, 0x1da, 0x215, 0x1da, 0x1ad, 0x16d, 0x139, 0x113, 0xed, + 0xcd, 0xb7, 0x9f, 0x89, 0x70, 0x61, 0x4e, 0x44, 0x3a, 0x32, 0x2f, 0x34, 0x3c, 0x45, 0x51, + 0x65, 0x75, 0x8d, 0xa0, 0xbc, 0xdb, 0xf7, 0x11e, 0x150, 0x185, 0x1cc, 0x201, 0x1d2, 0x1a1, 0x15d, + 0x12d, 0x10a, 0xe8, 0xca, 0xb1, 0x92, 0x80, 0x67, 0x57, 0x49, 0x38, 0x2f, 0x28, 0x27, 0x29, + 0x33, 0x3c, 0x48, 0x5d, 0x6e, 0x85, 0x9e, 0xb4, 0xd4, 0xf3, 0x119, 0x148, 0x17f, 0x1ba, 0x1f8, + 0x1c5, 0x19b, 0x15d, 0x129, 0x101, 0xe3, 0xc5, 0xa7, 0x8b, 0x77, 0x5b, 0x51, 0x41, 0x34, 0x24, + 0x1c, 0x1e, 0x22, 0x27, 0x33, 0x3d, 0x54, 0x65, 0x81, 0x93, 0xb2, 0xce, 0xeb, 0x114, 0x146, + 0x179, 0x1b4, 0x1fc, 0x1b8, 0x191, 0x158, 0x122, 0x103, 0xde, 0xbb, 0xa0, 0x8c, 0x71, 0x5c, 0x49, + 0x39, 0x2a, 0x1d, 0x16, 0x15, 0x1b, 0x21, 0x28, 0x3a, 0x4c, 0x5f, 0x7a, 0x8d, 0xa9, 0xc7, + 0xe4, 0x10c, 0x13d, 0x172, 0x1b3, 0x1ed, 0x1bc, 0x189, 0x150, 0x120, 0xfb, 0xd9, 0xbe, 0xa0, 0x87, + 0x6f, 0x57, 0x43, 0x30, 0x24, 0x17, 0x11, 0xd, 0x15, 0x18, 0x24, 0x37, 0x46, 0x5f, 0x72, + 0x8b, 0xa6, 0xbf, 0xe3, 0x105, 0x137, 0x16b, 0x1ad, 0x1e9, 0x1b6, 0x184, 0x148, 0x11c, 0xf6, 0xd4, + 0xb6, 0x9a, 0x87, 0x6a, 0x53, 0x3e, 0x2a, 0x1e, 0x11, 0x7, 0x9, 0xb, 0x13, 0x21, 0x34, + 0x47, 0x5b, 0x70, 0x8a, 0xa3, 0xc2, 0xe0, 0x106, 0x132, 0x168, 0x1ab, 0x1e4, 0x1ac, 0x181, 0x147, + 0x11a, 0xf1, 0xd3, 0xb8, 0x98, 0x80, 0x65, 0x4f, 0x42, 0x29, 0x1b, 0xf, 0x6, 0x5, 0x6, + 0x10, 0x1a, 0x32, 0x44, 0x5c, 0x72, 0x88, 0xa3, 0xc2, 0xe4, 0x107, 0x131, 0x160, 0x1a4, 0x1d4, + 0x1ad, 0x17c, 0x13e, 0x112, 0xf0, 0xd3, 0xb5, 0x94, 0x7d, 0x66, 0x52, 0x3c, 0x2a, 0x19, 0xa, + 0x2, 0x0, 0x6, 0x10, 0x1d, 0x2d, 0x44, 0x57, 0x6f, 0x8b, 0xa3, 0xbd, 0xde, 0xff, 0x131, + 0x160, 0x19e, 0x1d8, 0x1af, 0x17c, 0x143, 0x114, 0xf7, 0xd3, 0xb4, 0x92, 0x7d, 0x64, 0x4f, 0x3a, + 0x3a, 0x17, 0x7, 0x2, 0x1, 0x5, 0xc, 0x18, 0x2f, 0x41, 0x57, 0x70, 0x8b, 0xa5, 0xc0, + 0xdf, 0x102, 0x133, 0x15f, 0x1a3, 0x1d8, 0x1a8, 0x17d, 0x149, 0x119, 0xf2, 0xd2, 0xb5, 0x92, 0x7e, + 0x68, 0x4e, 0x43, 0x3b, 0x19, 0xc, 0x3, 0x3, 0x7, 0x11, 0x1d, 0x2f, 0x45, 0x5c, 0x73, + 0x8a, 0xa6, 0xc1, 0xe3, 0x109, 0x131, 0x15e, 0x1a5, 0x1d8, 0x1a8, 0x17f, 0x147, 0x119, 0xf5, 0xd7, + 0xb6, 0x9b, 0x80, 0x68, 0x51, 0x3f, 0x37, 0x1b, 0xc, 0x6, 0x5, 0xa, 0x10, 0x1d, 0x2f, + 0x43, 0x5a, 0x73, 0x8b, 0xa4, 0xc8, 0xe2, 0x108, 0x134, 0x163, 0x1a7, 0x1da, 0x1b3, 0x183, 0x14a, + 0x11d, 0xf9, 0xd5, 0xb9, 0x9f, 0x86, 0x6a, 0x56, 0x3f, 0x2d, 0x21, 0xd, 0x9, 0x7, 0xe, + 0x13, 0x22, 0x31, 0x4a, 0x56, 0x76, 0x8d, 0xaa, 0xca, 0xe6, 0x103, 0x137, 0x167, 0x1a9, 0x1e3, + 0x1bc, 0x18b, 0x151, 0x125, 0xfb, 0xd9, 0xba, 0xa0, 0x8a, 0x6b, 0x59, 0x46, 0x36, 0x24, 0x15, + 0x10, 0xf, 0x12, 0x1b, 0x27, 0x38, 0x4e, 0x62, 0x75, 0x92, 0xad, 0xc9, 0xed, 0x10e, 0x13a, + 0x171, 0x1ac, 0x1ec, 0x1b9, 0x190, 0x155, 0x12a, 0x106, 0xde, 0xc4, 0xa3, 0x8a, 0x70, 0x5d, 0x4c, + 0x3d, 0x2b, 0x1f, 0x1a, 0x18, 0x19, 0x22, 0x2e, 0x40, 0x52, 0x66, 0x81, 0x94, 0xad, 0xd3, + 0xed, 0x114, 0x13f, 0x175, 0x1b9, 0x1e8, 0x1cd, 0x199, 0x156, 0x12b, 0x105, 0xe3, 0xc6, 0xa7, 0x8c, + 0x77, 0x66, 0x53, 0x45, 0x39, 0x27, 0x20, 0x23, 0x21, 0x27, 0x36, 0x47, 0x57, 0x6f, 0x86, + 0x9a, 0xb8, 0xd8, 0xf6, 0x115, 0x146, 0x17e, 0x1c0, 0x1ee, 0x1d1, 0x19d, 0x165, 0x12f, 0x10b, 0xeb, + 0xcb, 0xae, 0x97, 0x82, 0x6c, 0x5c, 0x4b, 0x40, 0x32, 0x2a, 0x2a, 0x2d, 0x33, 0x3e, 0x4f, + 0x61, 0x75, 0x89, 0xa1, 0xbe, 0xda, 0xf9, 0x11d, 0x14b, 0x184, 0x1c4, 0x201, 0x1da, 0x1b4, 0x16c, + 0x13a, 0x110, 0xf0, 0xd2, 0xb6, 0x9e, 0x8d, 0x78, 0x65, 0x54, 0x47, 0x3d, 0x36, 0x38, 0x38, + 0x3e, 0x4a, 0x58, 0x69, 0x78, 0x92, 0xad, 0xbf, 0xe3, 0xff, 0x126, 0x152, 0x186, 0x1cd, 0x20d, + 0x1f1, 0x1bb, 0x17b, 0x14c, 0x11c, 0xf7, 0xda, 0xc4, 0xa6, 0x90, 0x7f, 0x6d, 0x5c, 0x51, 0x47, + 0x40, 0x43, 0x41, 0x4a, 0x55, 0x63, 0x71, 0x84, 0x9b, 0xad, 0xca, 0xe9, 0x106, 0x131, 0x15f, + 0x198, 0x1d8, 0x215, 0x201, 0x1ce, 0x18e, 0x157, 0x12b, 0x103, 0xe2, 0xc7, 0xb1, 0x9b, 0x87, 0x78, + 0x67, 0x5b, 0x54, 0x4d, 0x51, 0x4d, 0x58, 0x5f, 0x6c, 0x7b, 0x93, 0xa5, 0xb8, 0xd6, 0xf4, + 0x111, 0x13b, 0x16a, 0x1a3, 0x1e4, 0x229, 0x20d, 0x1de, 0x19d, 0x164, 0x13a, 0x10f, 0xf2, 0xd1, 0xbb, + 0xa9, 0x93, 0x7f, 0x73, 0x6a, 0x63, 0x5c, 0x59, 0x5f, 0x61, 0x6d, 0x77, 0x8a, 0xa0, 0xb0, + 0xc7, 0xdc, 0xf9, 0x11e, 0x146, 0x175, 0x1ad, 0x1f3, 0x22a, 0x217, 0x1e8, 0x1aa, 0x16f, 0x147, 0x119, + 0x100, 0xe2, 0xc8, 0xb8, 0xa0, 0x92, 0x82, 0x78, 0x6c, 0x6b, 0x66, 0x6c, 0x6c, 0x7b, 0x86, + 0x95, 0xa9, 0xbf, 0xd0, 0xed, 0x107, 0x124, 0x156, 0x182, 0x1bb, 0x201, 0x23b, 0x225, 0x1fb, 0x1b9, + 0x17f, 0x158, 0x128, 0x106, 0xf2, 0xd4, 0xc1, 0xb0, 0x9d, 0x8f, 0x86, 0x77, 0x79, 0x73, 0x79, + 0x7e, 0x89, 0x94, 0xa5, 0xb6, 0xcf, 0xdd, 0xf8, 0x118, 0x133, 0x15d, 0x190, 0x1cc, 0x20c, 0x254, + 0x232, 0x20a, 0x1c2, 0x18f, 0x165, 0x133, 0x117, 0xff, 0xe4, 0xcd, 0xbf, 0xb4, 0xa2, 0x96, 0x8c, + 0x85, 0x85, 0x87, 0x8a, 0x93, 0x9f, 0xb3, 0xc1, 0xd6, 0xeb, 0x106, 0x126, 0x147, 0x16b, 0x19e, + 0x1dd, 0x228, 0x26c, 0x259, 0x21e, 0x1d7, 0x1a3, 0x170, 0x143, 0x128, 0x10b, 0xf1, 0xdc, 0xcd, 0xbf, + 0xb0, 0xa4, 0x9d, 0x97, 0x96, 0x98, 0x97, 0xa1, 0xab, 0xc0, 0xd2, 0xe4, 0xf9, 0x116, 0x12e, + 0x15a, 0x17d, 0x1af, 0x1f5, 0x23c, 0x280, 0x262, 0x22a, 0x1ea, 0x1b1, 0x17c, 0x14d, 0x132, 0x11c, 0xf7, + 0xea, 0xd2, 0xca, 0xc0, 0xb4, 0xa9, 0xa2, 0x9f, 0xa3, 0xa5, 0xae, 0xb9, 0xc7, 0xd3, 0xed, + 0x102, 0x11f, 0x137, 0x15e, 0x184, 0x1bf, 0x206, 0x257, 0x289, + }, + }, + + { + /* Rgain */ + { + 0x399, 0x340, 0x2df, 0x289, 0x23e, 0x207, 0x1cd, 0x193, 0x170, 0x15f, 0x135, 0x113, 0xfc, 0xea, 0xdb, + 0xdd, 0xda, 0xd9, 0xe4, 0xee, 0xfd, 0x114, 0x12f, 0x14b, 0x16e, 0x19d, 0x1d4, 0x209, 0x24e, 0x29b, + 0x2ee, 0x364, 0x3e2, 0x38f, 0x329, 0x2c6, 0x276, 0x22a, 0x1ed, 0x1b5, 0x181, 0x15f, 0x147, 0x121, 0x102, + 0xf0, 0xd9, 0xd0, 0xc6, 0xc7, 0xcb, 0xd2, 0xdc, 0xee, 0x100, 0x11e, 0x138, 0x164, 0x18c, 0x1bb, + 0x1f4, 0x243, 0x286, 0x2d7, 0x341, 0x3a7, 0x372, 0x309, 0x2b0, 0x259, 0x20f, 0x1d6, 0x19a, 0x16c, 0x140, + 0x130, 0x109, 0xef, 0xdc, 0xc4, 0xb7, 0xb1, 0xaf, 0xb9, 0xbe, 0xc2, 0xd5, 0xeb, 0x105, 0x122, + 0x14c, 0x17a, 0x1a4, 0x1de, 0x225, 0x26f, 0x2b8, 0x319, 0x384, 0x355, 0x2ed, 0x290, 0x242, 0x1f7, 0x1bb, + 0x18a, 0x154, 0x12e, 0x10f, 0xee, 0xd8, 0xc6, 0xaf, 0xa7, 0x9b, 0x9c, 0xa6, 0xaa, 0xaf, 0xbe, + 0xd8, 0xf7, 0x110, 0x13a, 0x166, 0x191, 0x1c8, 0x216, 0x259, 0x2a3, 0x302, 0x365, 0x32a, 0x2d8, 0x276, + 0x229, 0x1e3, 0x1a6, 0x174, 0x140, 0x11c, 0xf6, 0xda, 0xc6, 0xaf, 0x9d, 0x92, 0x89, 0x88, 0x91, + 0x97, 0x9c, 0xac, 0xcb, 0xec, 0x102, 0x125, 0x150, 0x180, 0x1b6, 0x200, 0x247, 0x289, 0x2e8, 0x34f, + 0x30f, 0x2bb, 0x267, 0x213, 0x1cc, 0x194, 0x160, 0x130, 0x10d, 0xeb, 0xcc, 0xb1, 0x99, 0x87, 0x7c, + 0x77, 0x74, 0x79, 0x82, 0x8c, 0x9a, 0xba, 0xd7, 0xed, 0x115, 0x13c, 0x170, 0x1a4, 0x1e4, 0x22c, + 0x277, 0x2d2, 0x32a, 0x2f6, 0x2a9, 0x24f, 0x1ff, 0x1bd, 0x185, 0x14b, 0x124, 0xfd, 0xdb, 0xba, 0xa0, + 0x89, 0x76, 0x6c, 0x62, 0x61, 0x65, 0x71, 0x7b, 0x89, 0xa4, 0xc6, 0xde, 0x107, 0x129, 0x15a, + 0x191, 0x1c7, 0x213, 0x262, 0x2b4, 0x319, 0x2de, 0x28d, 0x23f, 0x1ef, 0x1b2, 0x179, 0x142, 0x114, 0xed, + 0xce, 0xa9, 0x8e, 0x79, 0x66, 0x5c, 0x51, 0x4f, 0x53, 0x5e, 0x6a, 0x76, 0x94, 0xae, 0xcf, + 0xf9, 0x11c, 0x14b, 0x17c, 0x1bf, 0x204, 0x248, 0x2a0, 0x2f5, 0x2c9, 0x282, 0x229, 0x1e0, 0x1a5, 0x16e, + 0x135, 0x109, 0xdb, 0xb8, 0x9b, 0x7d, 0x6a, 0x57, 0x4a, 0x41, 0x3f, 0x41, 0x4e, 0x5b, 0x6c, + 0x88, 0xa5, 0xc9, 0xeb, 0x112, 0x13e, 0x16f, 0x1b1, 0x1f5, 0x23d, 0x293, 0x2e3, 0x2bf, 0x271, 0x21c, + 0x1d1, 0x199, 0x15e, 0x129, 0xf9, 0xcf, 0xab, 0x92, 0x72, 0x5b, 0x47, 0x3b, 0x31, 0x2f, 0x32, + 0x3f, 0x4b, 0x60, 0x7b, 0x9c, 0xc1, 0xe7, 0x105, 0x136, 0x166, 0x1a6, 0x1ea, 0x232, 0x28d, 0x2d4, + 0x2b9, 0x262, 0x211, 0x1c7, 0x187, 0x14e, 0x11b, 0xef, 0xc9, 0xa2, 0x81, 0x63, 0x4d, 0x39, 0x2b, + 0x21, 0x21, 0x26, 0x2f, 0x3e, 0x58, 0x70, 0x8f, 0xb5, 0xda, 0xfb, 0x12a, 0x15c, 0x196, 0x1e1, + 0x229, 0x283, 0x2c8, 0x2ab, 0x25a, 0x205, 0x1bd, 0x178, 0x145, 0x111, 0xe8, 0xc1, 0x9a, 0x76, 0x5b, + 0x40, 0x2c, 0x1b, 0x15, 0x12, 0x19, 0x26, 0x36, 0x4e, 0x69, 0x80, 0xaa, 0xce, 0xf3, 0x122, + 0x153, 0x18a, 0x1d6, 0x21e, 0x277, 0x2c4, 0x29c, 0x24e, 0x1fb, 0x1b0, 0x16e, 0x13c, 0x10d, 0xe0, 0xb5, + 0x92, 0x6e, 0x53, 0x37, 0x1f, 0x11, 0x8, 0x7, 0x10, 0x1a, 0x2d, 0x46, 0x61, 0x7b, 0x9c, + 0xc3, 0xee, 0x118, 0x14a, 0x187, 0x1ca, 0x210, 0x268, 0x2b7, 0x291, 0x241, 0x1f2, 0x1ad, 0x170, 0x13a, + 0x10a, 0xdd, 0xb1, 0x8c, 0x69, 0x49, 0x30, 0x1c, 0xc, 0x1, 0x0, 0x8, 0x13, 0x26, 0x3f, + 0x58, 0x77, 0x97, 0xbc, 0xe9, 0x114, 0x146, 0x17c, 0x1c6, 0x20c, 0x261, 0x2aa, 0x2bc, 0x23c, 0x1f5, + 0x1b0, 0x16b, 0x134, 0x106, 0xde, 0xb1, 0x88, 0x61, 0x44, 0x2e, 0x17, 0x4, 0x0, 0x0, 0x4, + 0xe, 0x20, 0x3a, 0x54, 0x71, 0x95, 0xba, 0xe5, 0x113, 0x141, 0x17f, 0x1bd, 0x206, 0x258, 0x2a4, + 0x31e, 0x258, 0x1f8, 0x1ad, 0x168, 0x12f, 0x102, 0xd9, 0xaf, 0x84, 0x63, 0x44, 0x2d, 0x12, 0x3, + 0x5, 0x3, 0x1, 0xb, 0x1d, 0x36, 0x53, 0x6f, 0x92, 0xb2, 0xe5, 0x110, 0x13e, 0x17b, 0x1c1, + 0x204, 0x257, 0x2a7, 0x33a, 0x276, 0x1f3, 0x1a9, 0x165, 0x12f, 0xfd, 0xd3, 0xab, 0x85, 0x62, 0x44, + 0x2d, 0x13, 0x2, 0x3, 0x3, 0x2, 0x8, 0x1d, 0x35, 0x4d, 0x6e, 0x93, 0xb6, 0xe5, 0x10f, + 0x141, 0x179, 0x1ba, 0x202, 0x259, 0x29f, 0x336, 0x260, 0x1ef, 0x1a7, 0x166, 0x12b, 0xfd, 0xd3, 0xa7, + 0x85, 0x60, 0x42, 0x2e, 0x15, 0x5, 0x2, 0x3, 0x3, 0x9, 0x1d, 0x35, 0x4f, 0x6b, 0x91, + 0xb7, 0xe3, 0x111, 0x13f, 0x175, 0x1ba, 0x202, 0x255, 0x29b, 0x2f0, 0x239, 0x1e6, 0x1a5, 0x165, 0x12e, + 0x103, 0xd4, 0xac, 0x87, 0x63, 0x48, 0x30, 0x18, 0x7, 0x2, 0x1, 0x5, 0xb, 0x20, 0x36, + 0x51, 0x70, 0x96, 0xb8, 0xe4, 0x112, 0x13f, 0x176, 0x1b8, 0x208, 0x256, 0x2a4, 0x2a9, 0x256, 0x1ef, + 0x1aa, 0x16d, 0x134, 0x104, 0xda, 0xaf, 0x8b, 0x67, 0x4c, 0x31, 0x1d, 0xb, 0x5, 0x4, 0x8, + 0x10, 0x22, 0x3b, 0x55, 0x73, 0x94, 0xbb, 0xe6, 0x116, 0x144, 0x179, 0x1ba, 0x208, 0x25d, 0x2ad, + 0x2d2, 0x296, 0x1f4, 0x1b0, 0x171, 0x136, 0x106, 0xdc, 0xb6, 0x91, 0x70, 0x51, 0x38, 0x24, 0x15, + 0xb, 0xa, 0xd, 0x18, 0x28, 0x40, 0x5b, 0x78, 0x99, 0xbf, 0xed, 0x11c, 0x14b, 0x181, 0x1c3, + 0x20c, 0x267, 0x2ac, 0x2e8, 0x2ae, 0x1f8, 0x1b5, 0x175, 0x13e, 0x10e, 0xe4, 0xbc, 0x96, 0x78, 0x58, + 0x40, 0x2a, 0x1d, 0x17, 0x14, 0x1a, 0x24, 0x32, 0x46, 0x63, 0x7e, 0xa2, 0xc5, 0xf1, 0x11e, + 0x151, 0x188, 0x1c8, 0x213, 0x26e, 0x2b8, 0x2d0, 0x2a0, 0x202, 0x1bf, 0x17e, 0x144, 0x118, 0xec, 0xc0, + 0x9f, 0x7c, 0x60, 0x4a, 0x37, 0x2e, 0x2c, 0x1d, 0x23, 0x2e, 0x3d, 0x4f, 0x6b, 0x87, 0xad, + 0xcd, 0xf7, 0x122, 0x157, 0x190, 0x1ce, 0x21a, 0x271, 0x2bb, 0x2b0, 0x278, 0x20a, 0x1c6, 0x186, 0x14f, + 0x120, 0xf5, 0xcc, 0xa8, 0x89, 0x70, 0x58, 0x45, 0x41, 0x39, 0x2d, 0x30, 0x3a, 0x4b, 0x5e, + 0x74, 0x91, 0xb8, 0xd4, 0xfe, 0x133, 0x167, 0x19b, 0x1de, 0x220, 0x277, 0x2c7, 0x2be, 0x26f, 0x216, + 0x1dc, 0x194, 0x158, 0x12d, 0x101, 0xd9, 0xb5, 0x99, 0x78, 0x64, 0x53, 0x49, 0x47, 0x3d, 0x3d, + 0x48, 0x57, 0x68, 0x7f, 0x9d, 0xc0, 0xdd, 0x108, 0x13f, 0x16d, 0x1a3, 0x1e7, 0x229, 0x281, 0x2cf, + 0x2d2, 0x284, 0x225, 0x1e9, 0x1a8, 0x166, 0x136, 0x108, 0xe4, 0xc5, 0xa2, 0x87, 0x71, 0x63, 0x54, + 0x55, 0x4c, 0x4f, 0x58, 0x63, 0x79, 0x8c, 0xab, 0xca, 0xec, 0x116, 0x146, 0x174, 0x1ad, 0x1f2, + 0x23b, 0x291, 0x2e1, 0x2e4, 0x299, 0x236, 0x1f8, 0x1bb, 0x173, 0x144, 0x119, 0xf0, 0xcf, 0xb5, 0x9a, + 0x81, 0x72, 0x63, 0x5d, 0x62, 0x5f, 0x66, 0x74, 0x86, 0x9f, 0xb7, 0xd6, 0xfb, 0x11f, 0x14e, + 0x184, 0x1be, 0x1ff, 0x249, 0x2a3, 0x2ed, 0x2f4, 0x2a6, 0x256, 0x203, 0x1c0, 0x184, 0x156, 0x122, 0x100, + 0xe1, 0xc0, 0xa8, 0x95, 0x7f, 0x73, 0x70, 0x71, 0x6f, 0x78, 0x83, 0x93, 0xab, 0xc4, 0xe3, + 0x107, 0x12f, 0x161, 0x196, 0x1ce, 0x213, 0x25c, 0x2b2, 0x306, 0x30c, 0x2b8, 0x26c, 0x214, 0x1ce, 0x19b, + 0x164, 0x135, 0x110, 0xf2, 0xd4, 0xb9, 0xa4, 0x93, 0x86, 0x82, 0x7f, 0x7f, 0x86, 0x96, 0xa6, + 0xbd, 0xd7, 0xf2, 0x115, 0x140, 0x171, 0x1a6, 0x1da, 0x224, 0x270, 0x2c7, 0x31c, 0x322, 0x2cd, 0x27f, + 0x228, 0x1e2, 0x1ac, 0x177, 0x148, 0x123, 0x101, 0xe6, 0xcd, 0xb2, 0xa5, 0x99, 0x92, 0x8e, 0x90, + 0x9c, 0xa7, 0xb6, 0xce, 0xe8, 0x101, 0x127, 0x14f, 0x181, 0x1b9, 0x1f7, 0x23c, 0x287, 0x2df, 0x338, + 0x339, 0x2e8, 0x28d, 0x23c, 0x1fb, 0x1c0, 0x18d, 0x159, 0x133, 0x113, 0xf6, 0xdb, 0xc5, 0xba, 0xaa, + 0xa3, 0xa1, 0xa5, 0xae, 0xbb, 0xca, 0xde, 0xf8, 0x115, 0x138, 0x164, 0x195, 0x1e0, 0x210, 0x250, + 0x2a1, 0x2fb, 0x355, 0x35c, 0x309, 0x2a6, 0x257, 0x216, 0x1d3, 0x19d, 0x171, 0x144, 0x128, 0x107, 0xf1, + 0xdf, 0xce, 0xc2, 0xb8, 0xb4, 0xba, 0xc0, 0xcf, 0xdf, 0xf2, 0x10d, 0x128, 0x152, 0x177, 0x1b8, + 0x1fe, 0x228, 0x26e, 0x2bd, 0x316, 0x376, 0x37f, 0x318, 0x2be, 0x26e, 0x229, 0x1e5, 0x1b1, 0x17c, 0x159, + 0x137, 0x118, 0x100, 0xeb, 0xdc, 0xd3, 0xc6, 0xc6, 0xcc, 0xd4, 0xdd, 0xed, 0x102, 0x11f, 0x138, + 0x15d, 0x18b, 0x1cd, 0x207, 0x23d, 0x27d, 0x2cc, 0x331, 0x388, + }, + + /* Grgain */ + { + 0x324, 0x2cf, 0x279, 0x22e, 0x1f5, 0x1c7, 0x191, 0x168, 0x148, 0x136, 0x113, 0xf4, 0xe4, 0xd4, 0xcd, + 0xc9, 0xc9, 0xcc, 0xd4, 0xe2, 0xf2, 0x103, 0x11f, 0x139, 0x164, 0x186, 0x1b6, 0x1eb, 0x22c, 0x270, + 0x2ba, 0x321, 0x392, 0x30d, 0x2b7, 0x267, 0x220, 0x1e1, 0x1b4, 0x183, 0x156, 0x13a, 0x126, 0x105, 0xe6, + 0xd7, 0xc3, 0xbd, 0xb8, 0xb7, 0xbf, 0xc5, 0xd0, 0xe4, 0xf3, 0x10e, 0x12b, 0x151, 0x17a, 0x1a5, + 0x1d8, 0x21f, 0x260, 0x2a7, 0x305, 0x367, 0x2f1, 0x29d, 0x250, 0x207, 0x1cb, 0x19a, 0x16c, 0x141, 0x11f, + 0x10f, 0xe9, 0xd6, 0xc2, 0xae, 0xa8, 0xa5, 0xa5, 0xae, 0xb1, 0xba, 0xcf, 0xe0, 0xfa, 0x115, + 0x13d, 0x16a, 0x193, 0x1c0, 0x208, 0x245, 0x28d, 0x2eb, 0x349, 0x2d2, 0x284, 0x238, 0x1f8, 0x1b8, 0x182, + 0x15b, 0x130, 0x109, 0xec, 0xd6, 0xc5, 0xb1, 0x9c, 0x92, 0x8f, 0x8d, 0x97, 0xa0, 0xa6, 0xb8, + 0xd1, 0xef, 0x106, 0x12c, 0x155, 0x17c, 0x1ae, 0x1f5, 0x235, 0x275, 0x2cd, 0x32d, 0x2b8, 0x26d, 0x225, + 0x1e2, 0x1a9, 0x173, 0x148, 0x11f, 0xfa, 0xdf, 0xc5, 0xaf, 0x9c, 0x89, 0x80, 0x7c, 0x7e, 0x88, + 0x8e, 0x96, 0xa5, 0xc5, 0xe3, 0xf7, 0x11b, 0x142, 0x16e, 0x1a1, 0x1e6, 0x227, 0x266, 0x2b8, 0x316, + 0x29c, 0x259, 0x213, 0x1cf, 0x197, 0x165, 0x138, 0x111, 0xf1, 0xd0, 0xb4, 0x9e, 0x8b, 0x7b, 0x71, + 0x6a, 0x6d, 0x72, 0x7d, 0x85, 0x94, 0xb3, 0xd1, 0xe8, 0x10b, 0x134, 0x15e, 0x192, 0x1d1, 0x210, + 0x255, 0x2a7, 0x2fe, 0x28b, 0x247, 0x201, 0x1bf, 0x18e, 0x15b, 0x12a, 0x104, 0xe4, 0xc4, 0xa5, 0x8e, + 0x79, 0x6b, 0x60, 0x5b, 0x59, 0x5d, 0x6a, 0x77, 0x85, 0xa0, 0xbf, 0xd8, 0xfe, 0x120, 0x151, + 0x183, 0x1b7, 0x1f8, 0x243, 0x28e, 0x2e3, 0x27a, 0x239, 0x1ef, 0x1b4, 0x183, 0x151, 0x11b, 0xf6, 0xd3, + 0xb5, 0x96, 0x7d, 0x6b, 0x5b, 0x4d, 0x49, 0x49, 0x4b, 0x58, 0x66, 0x77, 0x94, 0xaa, 0xc9, + 0xf3, 0x115, 0x143, 0x176, 0x1aa, 0x1e7, 0x231, 0x281, 0x2cc, 0x26b, 0x22a, 0x1e5, 0x1a6, 0x174, 0x144, + 0x111, 0xe8, 0xc4, 0xa5, 0x88, 0x70, 0x5d, 0x4d, 0x40, 0x39, 0x39, 0x3e, 0x4a, 0x59, 0x69, + 0x86, 0xa2, 0xca, 0xea, 0x10b, 0x137, 0x168, 0x19e, 0x1dd, 0x223, 0x272, 0x2b8, 0x25d, 0x21c, 0x1d8, + 0x199, 0x168, 0x137, 0x107, 0xe0, 0xbc, 0x9b, 0x81, 0x66, 0x51, 0x40, 0x33, 0x2c, 0x2d, 0x2d, + 0x3c, 0x4c, 0x5f, 0x7b, 0x9a, 0xc2, 0xe2, 0x100, 0x131, 0x15d, 0x196, 0x1d6, 0x21d, 0x26b, 0x2ad, + 0x253, 0x214, 0x1cd, 0x18f, 0x159, 0x12c, 0xfc, 0xd7, 0xb2, 0x93, 0x73, 0x59, 0x43, 0x34, 0x26, + 0x20, 0x1e, 0x22, 0x30, 0x3f, 0x57, 0x70, 0x90, 0xb8, 0xd8, 0xf7, 0x124, 0x154, 0x188, 0x1d0, + 0x211, 0x262, 0x2a4, 0x24f, 0x208, 0x1c2, 0x189, 0x150, 0x121, 0xf4, 0xd0, 0xac, 0x89, 0x6b, 0x4e, + 0x3b, 0x28, 0x18, 0x15, 0xf, 0x18, 0x25, 0x36, 0x50, 0x69, 0x83, 0xac, 0xcb, 0xef, 0x11e, + 0x14b, 0x180, 0x1c7, 0x206, 0x25a, 0x2a3, 0x247, 0x201, 0x1bd, 0x180, 0x14c, 0x119, 0xf2, 0xcb, 0xa4, + 0x82, 0x65, 0x47, 0x31, 0x1d, 0x10, 0x8, 0x6, 0xe, 0x1a, 0x2f, 0x49, 0x61, 0x7c, 0x9e, + 0xc3, 0xec, 0x116, 0x143, 0x17a, 0x1c0, 0x201, 0x24c, 0x292, 0x23a, 0x1f7, 0x1b8, 0x17b, 0x146, 0x116, + 0xf0, 0xc8, 0xa2, 0x7e, 0x5e, 0x43, 0x2c, 0x17, 0x7, 0x0, 0x0, 0x8, 0x16, 0x28, 0x43, + 0x59, 0x77, 0x99, 0xbc, 0xe4, 0x113, 0x141, 0x178, 0x1b7, 0x1fa, 0x246, 0x28c, 0x263, 0x1f3, 0x1b6, + 0x17e, 0x141, 0x114, 0xec, 0xc6, 0xa1, 0x7a, 0x5a, 0x3e, 0x26, 0xf, 0x3, 0x2, 0x1, 0x4, + 0xf, 0x22, 0x3f, 0x56, 0x74, 0x96, 0xb9, 0xe2, 0x111, 0x13d, 0x172, 0x1b3, 0x1f3, 0x240, 0x285, + 0x2c8, 0x207, 0x1b7, 0x17e, 0x13f, 0x112, 0xe8, 0xc4, 0x9e, 0x77, 0x56, 0x3b, 0x24, 0xe, 0x2, + 0x6, 0x1, 0x1, 0xb, 0x21, 0x3b, 0x52, 0x70, 0x97, 0xb8, 0xe2, 0x111, 0x13c, 0x171, 0x1b3, + 0x1ed, 0x240, 0x27f, 0x2dc, 0x224, 0x1b4, 0x17b, 0x13e, 0x10d, 0xe6, 0xbf, 0x98, 0x76, 0x56, 0x3c, + 0x25, 0x10, 0x1, 0x6, 0x5, 0x4, 0xb, 0x1f, 0x38, 0x51, 0x71, 0x94, 0xb8, 0xe3, 0x10e, + 0x13d, 0x16f, 0x1b2, 0x1ed, 0x23e, 0x281, 0x2d0, 0x20f, 0x1b3, 0x17b, 0x140, 0x112, 0xe5, 0xbe, 0x98, + 0x77, 0x57, 0x3c, 0x27, 0x14, 0x3, 0x3, 0x2, 0x5, 0xb, 0x20, 0x38, 0x52, 0x73, 0x93, + 0xb7, 0xe3, 0x10e, 0x13a, 0x16e, 0x1b0, 0x1ef, 0x23f, 0x27e, 0x291, 0x1f1, 0x1af, 0x177, 0x142, 0x111, + 0xe5, 0xc3, 0x9d, 0x79, 0x5a, 0x3d, 0x2b, 0x13, 0x7, 0x2, 0x2, 0x6, 0xe, 0x22, 0x3c, + 0x54, 0x74, 0x96, 0xbb, 0xe6, 0x10f, 0x13c, 0x170, 0x1b1, 0x1f0, 0x23f, 0x27f, 0x251, 0x209, 0x1b6, + 0x17d, 0x144, 0x116, 0xe9, 0xc5, 0x9f, 0x7e, 0x5f, 0x44, 0x2d, 0x1a, 0xa, 0x5, 0x7, 0x9, + 0x13, 0x28, 0x3f, 0x5a, 0x75, 0x99, 0xbb, 0xe8, 0x112, 0x13d, 0x176, 0x1b2, 0x1f4, 0x245, 0x287, + 0x28d, 0x244, 0x1b7, 0x17f, 0x14b, 0x118, 0xee, 0xc7, 0xa5, 0x83, 0x64, 0x4c, 0x35, 0x22, 0x13, + 0xd, 0xa, 0xf, 0x1c, 0x2d, 0x42, 0x5e, 0x7d, 0x9d, 0xbe, 0xed, 0x116, 0x145, 0x17b, 0x1b6, + 0x1f8, 0x24a, 0x28c, 0x29f, 0x259, 0x1bb, 0x184, 0x14f, 0x11f, 0xf4, 0xcd, 0xa7, 0x8c, 0x6e, 0x52, + 0x3d, 0x29, 0x1c, 0x19, 0x14, 0x1a, 0x26, 0x36, 0x4a, 0x65, 0x84, 0xa7, 0xc8, 0xef, 0x11e, + 0x14d, 0x181, 0x1b9, 0x200, 0x252, 0x296, 0x27e, 0x253, 0x1c3, 0x18a, 0x156, 0x126, 0xfc, 0xd8, 0xb1, + 0x96, 0x76, 0x5b, 0x46, 0x34, 0x2e, 0x2d, 0x1f, 0x26, 0x2f, 0x3f, 0x55, 0x6c, 0x8c, 0xb3, + 0xd1, 0xf2, 0x127, 0x154, 0x185, 0x1c3, 0x207, 0x254, 0x2a5, 0x254, 0x220, 0x1d0, 0x195, 0x15b, 0x12d, + 0x105, 0xe0, 0xba, 0x9d, 0x7f, 0x66, 0x52, 0x3f, 0x40, 0x39, 0x30, 0x31, 0x3e, 0x4f, 0x63, + 0x78, 0x98, 0xb9, 0xd8, 0xfe, 0x135, 0x162, 0x18e, 0x1cc, 0x20c, 0x25e, 0x2a0, 0x265, 0x222, 0x1d8, + 0x1a8, 0x169, 0x134, 0x111, 0xe7, 0xc5, 0xa7, 0x8a, 0x71, 0x5c, 0x4e, 0x49, 0x48, 0x3f, 0x40, + 0x4c, 0x5c, 0x6e, 0x81, 0xa0, 0xc2, 0xe2, 0x107, 0x13b, 0x169, 0x199, 0x1d5, 0x215, 0x268, 0x2ac, + 0x277, 0x235, 0x1e4, 0x1b6, 0x179, 0x141, 0x11a, 0xf4, 0xd1, 0xb3, 0x99, 0x7d, 0x6c, 0x5c, 0x51, + 0x53, 0x4f, 0x4f, 0x5a, 0x69, 0x7a, 0x8f, 0xab, 0xcb, 0xec, 0x112, 0x145, 0x16f, 0x1a6, 0x1e1, + 0x221, 0x270, 0x2bd, 0x282, 0x244, 0x1f2, 0x1c0, 0x188, 0x14f, 0x125, 0xff, 0xde, 0xbe, 0xa5, 0x8f, + 0x79, 0x6c, 0x5e, 0x5e, 0x63, 0x60, 0x67, 0x75, 0x89, 0xa0, 0xb8, 0xd8, 0xf8, 0x11e, 0x14c, + 0x178, 0x1ae, 0x1ec, 0x231, 0x282, 0x2cb, 0x293, 0x24c, 0x20d, 0x1cb, 0x18f, 0x15e, 0x130, 0x10b, 0xea, + 0xce, 0xb3, 0x9d, 0x8c, 0x7a, 0x70, 0x70, 0x70, 0x70, 0x76, 0x87, 0x96, 0xae, 0xc7, 0xe3, + 0x106, 0x12d, 0x15b, 0x18a, 0x1bb, 0x1f9, 0x242, 0x28f, 0x2dc, 0x2a6, 0x25e, 0x221, 0x1d6, 0x19c, 0x16e, + 0x141, 0x11a, 0xfb, 0xdd, 0xc2, 0xad, 0x9a, 0x8b, 0x82, 0x7e, 0x7d, 0x7c, 0x88, 0x97, 0xa6, + 0xbd, 0xd6, 0xf3, 0x114, 0x13b, 0x168, 0x197, 0x1cd, 0x209, 0x257, 0x2a7, 0x2f4, 0x2b9, 0x271, 0x230, + 0x1e8, 0x1b0, 0x17d, 0x152, 0x12a, 0x10d, 0xee, 0xd4, 0xbf, 0xaa, 0x9c, 0x93, 0x90, 0x8e, 0x90, + 0x99, 0xa8, 0xb8, 0xce, 0xe6, 0x103, 0x124, 0x14d, 0x179, 0x1ad, 0x1e0, 0x21e, 0x268, 0x2b7, 0x306, + 0x2cd, 0x291, 0x240, 0x1fc, 0x1c2, 0x190, 0x166, 0x13c, 0x11e, 0xfe, 0xe7, 0xcf, 0xbc, 0xb1, 0xa8, + 0xa3, 0xa0, 0xa3, 0xac, 0xba, 0xca, 0xe0, 0xf7, 0x114, 0x138, 0x15e, 0x18a, 0x1d0, 0x1f8, 0x233, + 0x27d, 0x2cf, 0x31d, 0x2ef, 0x2a9, 0x257, 0x213, 0x1db, 0x1a8, 0x178, 0x151, 0x12d, 0x111, 0xf8, 0xe4, + 0xd4, 0xc7, 0xbb, 0xb2, 0xb6, 0xb5, 0xc1, 0xcd, 0xdf, 0xf2, 0x10b, 0x126, 0x14c, 0x173, 0x1ac, + 0x1ee, 0x20f, 0x250, 0x295, 0x2ea, 0x33b, 0x317, 0x2b7, 0x268, 0x228, 0x1ef, 0x1b5, 0x189, 0x161, 0x13b, + 0x121, 0x106, 0xf0, 0xde, 0xd7, 0xc9, 0xc2, 0xc3, 0xc8, 0xd3, 0xd9, 0xed, 0x100, 0x119, 0x133, + 0x15a, 0x189, 0x1c1, 0x1fd, 0x221, 0x260, 0x2a9, 0x302, 0x357, + }, + + /* Gbgain */ + { + 0x32b, 0x2cd, 0x277, 0x232, 0x1f2, 0x1c6, 0x18f, 0x166, 0x148, 0x136, 0x116, 0xf5, 0xe3, 0xd5, 0xc9, + 0xc8, 0xc9, 0xc9, 0xd5, 0xdf, 0xf1, 0x102, 0x11c, 0x138, 0x15a, 0x187, 0x1b4, 0x1e7, 0x22d, 0x270, + 0x2bd, 0x323, 0x38d, 0x313, 0x2b9, 0x267, 0x21e, 0x1e1, 0x1b1, 0x182, 0x154, 0x13b, 0x124, 0x104, 0xe7, + 0xd9, 0xc5, 0xbb, 0xb4, 0xb6, 0xbf, 0xc4, 0xd1, 0xe3, 0xf4, 0x10d, 0x12b, 0x151, 0x178, 0x1a4, + 0x1d7, 0x21b, 0x25d, 0x2a6, 0x306, 0x367, 0x2f4, 0x29e, 0x24d, 0x20b, 0x1ca, 0x198, 0x16d, 0x141, 0x11b, + 0x10d, 0xea, 0xd1, 0xc4, 0xb1, 0xa8, 0xa3, 0xa3, 0xb0, 0xb3, 0xb9, 0xc9, 0xdf, 0xfb, 0x116, + 0x13d, 0x168, 0x190, 0x1c2, 0x204, 0x243, 0x28e, 0x2ec, 0x348, 0x2da, 0x285, 0x239, 0x1f6, 0x1b9, 0x187, + 0x15a, 0x12d, 0x10a, 0xef, 0xd3, 0xbf, 0xb0, 0x9e, 0x92, 0x8e, 0x91, 0x9a, 0x9f, 0xa6, 0xb6, + 0xce, 0xeb, 0x102, 0x12d, 0x159, 0x17b, 0x1b3, 0x1f7, 0x235, 0x27b, 0x2d0, 0x32a, 0x2b8, 0x26e, 0x221, + 0x1e4, 0x1a8, 0x176, 0x149, 0x11e, 0xfe, 0xdf, 0xc5, 0xaf, 0x9b, 0x8c, 0x80, 0x7e, 0x7a, 0x89, + 0x8e, 0x98, 0xa6, 0xc4, 0xe2, 0xf5, 0x119, 0x142, 0x16f, 0x19f, 0x1e4, 0x227, 0x269, 0x2ba, 0x315, + 0x2a3, 0x25b, 0x213, 0x1d0, 0x193, 0x163, 0x137, 0x10e, 0xee, 0xd2, 0xb5, 0xa0, 0x8a, 0x7a, 0x71, + 0x6b, 0x6a, 0x71, 0x7c, 0x84, 0x95, 0xb2, 0xcf, 0xe9, 0x109, 0x133, 0x160, 0x18e, 0x1cd, 0x210, + 0x253, 0x2a1, 0x2fb, 0x28e, 0x249, 0x201, 0x1bf, 0x18a, 0x157, 0x12d, 0x103, 0xe3, 0xc4, 0xa2, 0x8e, + 0x78, 0x69, 0x60, 0x5a, 0x58, 0x5d, 0x6c, 0x76, 0x86, 0xa1, 0xc0, 0xdb, 0xfc, 0x11f, 0x14e, + 0x182, 0x1b9, 0x1f8, 0x242, 0x290, 0x2e7, 0x279, 0x238, 0x1ef, 0x1b4, 0x180, 0x152, 0x123, 0xf5, 0xd4, + 0xb5, 0x95, 0x7e, 0x6b, 0x59, 0x50, 0x48, 0x47, 0x4e, 0x58, 0x66, 0x75, 0x92, 0xaa, 0xca, + 0xf1, 0x114, 0x13f, 0x171, 0x1ab, 0x1e9, 0x233, 0x27f, 0x2c9, 0x270, 0x22b, 0x1e1, 0x1a5, 0x178, 0x147, + 0x115, 0xea, 0xc5, 0xa5, 0x8a, 0x73, 0x5e, 0x4d, 0x41, 0x3b, 0x3a, 0x3d, 0x4b, 0x59, 0x6a, + 0x84, 0xa2, 0xc5, 0xe7, 0x10c, 0x136, 0x165, 0x19e, 0x1de, 0x225, 0x271, 0x2bd, 0x268, 0x222, 0x1da, + 0x19f, 0x168, 0x137, 0x108, 0xdf, 0xbb, 0x9a, 0x7f, 0x64, 0x52, 0x40, 0x35, 0x2c, 0x2c, 0x2d, + 0x3d, 0x4b, 0x5f, 0x7a, 0x9b, 0xc2, 0xe1, 0x101, 0x12e, 0x15c, 0x198, 0x1d9, 0x21e, 0x26a, 0x2ae, + 0x258, 0x217, 0x1ce, 0x193, 0x15c, 0x12a, 0xff, 0xd5, 0xb1, 0x94, 0x75, 0x59, 0x44, 0x32, 0x26, + 0x1e, 0x1e, 0x20, 0x30, 0x41, 0x57, 0x70, 0x8d, 0xb6, 0xd7, 0xf7, 0x125, 0x155, 0x18c, 0x1d2, + 0x212, 0x261, 0x2a7, 0x24f, 0x20b, 0x1c5, 0x188, 0x154, 0x122, 0xf8, 0xce, 0xac, 0x8e, 0x6c, 0x52, + 0x3a, 0x27, 0x19, 0x13, 0x10, 0x18, 0x24, 0x36, 0x50, 0x68, 0x82, 0xaa, 0xca, 0xee, 0x11e, + 0x14d, 0x182, 0x1c2, 0x205, 0x259, 0x29d, 0x241, 0x201, 0x1bd, 0x184, 0x14f, 0x11c, 0xf2, 0xcc, 0xa5, + 0x85, 0x65, 0x4a, 0x30, 0x1e, 0x11, 0x7, 0x7, 0xd, 0x1b, 0x2f, 0x48, 0x5f, 0x7d, 0x9e, + 0xc3, 0xeb, 0x118, 0x148, 0x17b, 0x1c0, 0x1ff, 0x24d, 0x297, 0x23b, 0x1fa, 0x1b8, 0x17d, 0x149, 0x116, + 0xee, 0xcc, 0xa3, 0x80, 0x60, 0x44, 0x2a, 0x18, 0x7, 0x0, 0x0, 0x9, 0x14, 0x28, 0x43, + 0x58, 0x78, 0x98, 0xbd, 0xe7, 0x113, 0x142, 0x172, 0x1b4, 0x1fa, 0x245, 0x28a, 0x26b, 0x1fb, 0x1ba, + 0x180, 0x147, 0x117, 0xef, 0xca, 0xa1, 0x7c, 0x5b, 0x40, 0x28, 0x11, 0x4, 0x3, 0x1, 0x6, + 0x10, 0x23, 0x3e, 0x55, 0x75, 0x98, 0xba, 0xe5, 0x112, 0x13e, 0x171, 0x1b0, 0x1f4, 0x23e, 0x28b, + 0x2ca, 0x20e, 0x1bd, 0x17f, 0x142, 0x114, 0xe8, 0xc5, 0x9e, 0x79, 0x5a, 0x3b, 0x27, 0x10, 0x2, + 0x4, 0x2, 0x0, 0xb, 0x21, 0x37, 0x54, 0x73, 0x95, 0xb9, 0xe3, 0x111, 0x13c, 0x170, 0x1b0, + 0x1f2, 0x23e, 0x286, 0x2de, 0x22a, 0x1b6, 0x17e, 0x140, 0x113, 0xe5, 0xbe, 0x98, 0x79, 0x5a, 0x3a, + 0x27, 0x11, 0x1, 0x3, 0x5, 0x3, 0xb, 0x21, 0x37, 0x52, 0x71, 0x92, 0xb8, 0xe3, 0x10f, + 0x13c, 0x171, 0x1b3, 0x1f2, 0x239, 0x27f, 0x2d6, 0x215, 0x1b0, 0x179, 0x13d, 0x113, 0xe7, 0xbe, 0x99, + 0x79, 0x58, 0x3e, 0x29, 0x15, 0x4, 0x1, 0x4, 0x5, 0xb, 0x1f, 0x39, 0x53, 0x73, 0x94, + 0xb8, 0xe1, 0x10d, 0x138, 0x16d, 0x1b2, 0x1f2, 0x23d, 0x281, 0x293, 0x1f4, 0x1b0, 0x179, 0x144, 0x114, + 0xe6, 0xc0, 0x9c, 0x7c, 0x5a, 0x41, 0x2c, 0x16, 0x7, 0x2, 0x4, 0x7, 0xe, 0x21, 0x39, + 0x56, 0x74, 0x96, 0xbc, 0xe4, 0x10f, 0x139, 0x16e, 0x1ae, 0x1f4, 0x242, 0x282, 0x253, 0x210, 0x1b5, + 0x17d, 0x146, 0x115, 0xec, 0xc4, 0x9e, 0x82, 0x5e, 0x46, 0x2e, 0x1a, 0xb, 0x6, 0x7, 0x9, + 0x14, 0x25, 0x3f, 0x59, 0x78, 0x99, 0xbb, 0xe6, 0x114, 0x13d, 0x175, 0x1b1, 0x1f5, 0x247, 0x287, + 0x285, 0x24a, 0x1ba, 0x182, 0x14b, 0x11b, 0xef, 0xca, 0xa5, 0x84, 0x66, 0x4a, 0x36, 0x23, 0x15, + 0xf, 0xb, 0x10, 0x1d, 0x2c, 0x46, 0x5f, 0x7c, 0x9e, 0xc1, 0xeb, 0x117, 0x143, 0x17c, 0x1b8, + 0x1f8, 0x249, 0x293, 0x298, 0x25e, 0x1c1, 0x188, 0x151, 0x120, 0xf3, 0xcf, 0xac, 0x8e, 0x6e, 0x54, + 0x3f, 0x2a, 0x1d, 0x1b, 0x13, 0x1a, 0x26, 0x37, 0x4c, 0x67, 0x83, 0xa9, 0xc6, 0xf2, 0x11f, + 0x14a, 0x182, 0x1ba, 0x1fe, 0x250, 0x292, 0x27c, 0x251, 0x1c5, 0x18b, 0x159, 0x129, 0xfd, 0xd6, 0xb1, + 0x96, 0x79, 0x5b, 0x47, 0x34, 0x2e, 0x2d, 0x1f, 0x25, 0x33, 0x41, 0x56, 0x6e, 0x8e, 0xb3, + 0xce, 0xf5, 0x129, 0x155, 0x187, 0x1c3, 0x206, 0x254, 0x295, 0x258, 0x226, 0x1d0, 0x196, 0x162, 0x12d, + 0x105, 0xe0, 0xba, 0x9e, 0x80, 0x66, 0x50, 0x42, 0x40, 0x39, 0x31, 0x31, 0x40, 0x4f, 0x62, + 0x79, 0x99, 0xb9, 0xd9, 0xfe, 0x131, 0x164, 0x192, 0x1ca, 0x20e, 0x25b, 0x2a3, 0x266, 0x223, 0x1db, + 0x1ab, 0x16d, 0x13a, 0x111, 0xe8, 0xc6, 0xa9, 0x8d, 0x72, 0x5f, 0x50, 0x49, 0x45, 0x3f, 0x41, + 0x4a, 0x5d, 0x6f, 0x82, 0xa3, 0xc3, 0xe1, 0x108, 0x13a, 0x16b, 0x19c, 0x1d5, 0x219, 0x265, 0x2ac, + 0x277, 0x237, 0x1e4, 0x1b4, 0x17b, 0x143, 0x11c, 0xf3, 0xd2, 0xb3, 0x98, 0x81, 0x6d, 0x5e, 0x52, + 0x51, 0x4c, 0x52, 0x58, 0x69, 0x7b, 0x90, 0xac, 0xcb, 0xeb, 0x112, 0x142, 0x171, 0x1a2, 0x1e0, + 0x227, 0x274, 0x2b9, 0x280, 0x247, 0x1f4, 0x1c2, 0x18a, 0x14d, 0x126, 0xff, 0xde, 0xbf, 0xa5, 0x90, + 0x7e, 0x6e, 0x61, 0x5e, 0x61, 0x60, 0x67, 0x75, 0x87, 0x9d, 0xbd, 0xd9, 0xf6, 0x11f, 0x14e, + 0x17a, 0x1ae, 0x1ec, 0x232, 0x282, 0x2cb, 0x29a, 0x24f, 0x20e, 0x1cb, 0x191, 0x161, 0x133, 0x10d, 0xea, + 0xce, 0xb3, 0x9f, 0x8a, 0x7c, 0x71, 0x6f, 0x72, 0x6e, 0x79, 0x88, 0x96, 0xad, 0xca, 0xe5, + 0x107, 0x12e, 0x15c, 0x18c, 0x1bd, 0x1fa, 0x243, 0x292, 0x2de, 0x2ae, 0x25d, 0x21f, 0x1d7, 0x1a0, 0x16f, + 0x141, 0x11a, 0xf8, 0xde, 0xc4, 0xad, 0x99, 0x8c, 0x84, 0x80, 0x7f, 0x7f, 0x89, 0x97, 0xa6, + 0xbd, 0xd4, 0xf4, 0x115, 0x13b, 0x169, 0x19a, 0x1d1, 0x206, 0x255, 0x2a3, 0x2f2, 0x2bd, 0x275, 0x22f, + 0x1eb, 0x1b0, 0x17f, 0x151, 0x12d, 0x10c, 0xef, 0xd5, 0xbe, 0xae, 0x9e, 0x97, 0x90, 0x8e, 0x91, + 0x9c, 0xa8, 0xb9, 0xcd, 0xe5, 0x105, 0x124, 0x14d, 0x177, 0x1ae, 0x1e4, 0x220, 0x26b, 0x2b9, 0x307, + 0x2d4, 0x296, 0x243, 0x1fe, 0x1c6, 0x193, 0x165, 0x13f, 0x11a, 0x100, 0xe6, 0xd1, 0xc0, 0xb5, 0xa8, + 0xa0, 0xa0, 0xa5, 0xaa, 0xb8, 0xca, 0xe0, 0xfc, 0x115, 0x137, 0x15d, 0x18a, 0x1ce, 0x1f9, 0x236, + 0x282, 0x2d4, 0x324, 0x2f8, 0x2ab, 0x25d, 0x215, 0x1de, 0x1a9, 0x17c, 0x150, 0x12e, 0x110, 0xfb, 0xe6, + 0xd2, 0xc6, 0xba, 0xb6, 0xb6, 0xba, 0xc2, 0xcd, 0xdd, 0xf4, 0x10a, 0x127, 0x14b, 0x171, 0x1aa, + 0x1ec, 0x20f, 0x252, 0x29a, 0x2e9, 0x341, 0x310, 0x2b8, 0x26a, 0x22f, 0x1f0, 0x1b7, 0x18a, 0x15b, 0x13d, + 0x11f, 0x108, 0xf2, 0xde, 0xd4, 0xca, 0xc4, 0xc3, 0xc7, 0xcf, 0xdb, 0xf0, 0x101, 0x11d, 0x135, + 0x15b, 0x184, 0x1c1, 0x1ff, 0x227, 0x265, 0x2aa, 0x2fb, 0x360, + }, + + /* Bgain */ + { + 0x2f0, 0x29d, 0x24a, 0x20b, 0x1d2, 0x1ae, 0x175, 0x151, 0x137, 0x12c, 0x105, 0xeb, 0xd7, 0xc9, 0xbd, + 0xbd, 0xc0, 0xc2, 0xca, 0xdc, 0xec, 0xfb, 0x10f, 0x129, 0x14b, 0x178, 0x1a7, 0x1d2, 0x21b, 0x25c, + 0x29c, 0x305, 0x35e, 0x2d4, 0x284, 0x23e, 0x1ff, 0x1c5, 0x195, 0x16a, 0x143, 0x12a, 0x11c, 0xf5, 0xe1, + 0xcf, 0xbb, 0xb1, 0xae, 0xb2, 0xb8, 0xbf, 0xcd, 0xde, 0xed, 0x102, 0x11e, 0x14a, 0x16f, 0x195, + 0x1c6, 0x209, 0x24b, 0x28e, 0x2e7, 0x348, 0x2b8, 0x26f, 0x228, 0x1e8, 0x1ad, 0x181, 0x155, 0x131, 0x114, + 0x102, 0xe1, 0xca, 0xbe, 0xa8, 0xa0, 0x9c, 0x9d, 0xa6, 0xad, 0xb4, 0xc1, 0xd6, 0xf3, 0x10e, + 0x138, 0x15f, 0x183, 0x1b0, 0x1f5, 0x230, 0x278, 0x2cc, 0x325, 0x2a5, 0x254, 0x20e, 0x1d6, 0x19b, 0x16c, + 0x146, 0x11f, 0xfa, 0xe2, 0xcc, 0xbb, 0xab, 0x97, 0x8e, 0x8b, 0x8b, 0x93, 0x9c, 0xa2, 0xac, + 0xcb, 0xe6, 0xfa, 0x126, 0x14d, 0x174, 0x1a4, 0x1e7, 0x21d, 0x261, 0x2b8, 0x30f, 0x28f, 0x243, 0x1fe, + 0x1c0, 0x18b, 0x15b, 0x138, 0x10e, 0xf1, 0xd3, 0xbc, 0xa8, 0x96, 0x89, 0x7e, 0x79, 0x78, 0x83, + 0x8a, 0x92, 0xa2, 0xbf, 0xda, 0xee, 0x114, 0x13b, 0x162, 0x193, 0x1d6, 0x212, 0x253, 0x29d, 0x2f5, + 0x271, 0x22f, 0x1e9, 0x1b1, 0x17a, 0x14e, 0x126, 0x103, 0xe4, 0xc8, 0xad, 0x97, 0x85, 0x78, 0x6d, + 0x68, 0x6a, 0x6e, 0x74, 0x81, 0x90, 0xb0, 0xcb, 0xe0, 0x107, 0x12a, 0x155, 0x189, 0x1c5, 0x1ff, + 0x240, 0x28b, 0x2db, 0x25e, 0x21e, 0x1df, 0x1a8, 0x171, 0x146, 0x11b, 0xf1, 0xd7, 0xbb, 0x9f, 0x88, + 0x76, 0x67, 0x5d, 0x57, 0x5b, 0x5a, 0x69, 0x71, 0x84, 0xa0, 0xbd, 0xd4, 0xf9, 0x119, 0x14a, + 0x17b, 0x1ae, 0x1e9, 0x232, 0x27b, 0x2c8, 0x253, 0x214, 0x1d3, 0x197, 0x16b, 0x140, 0x111, 0xe8, 0xc5, + 0xa8, 0x90, 0x7c, 0x68, 0x58, 0x4e, 0x46, 0x4a, 0x4c, 0x58, 0x61, 0x73, 0x8d, 0xa4, 0xc6, + 0xed, 0x110, 0x139, 0x167, 0x19f, 0x1dc, 0x223, 0x26b, 0x2ab, 0x249, 0x206, 0x1c4, 0x18c, 0x15d, 0x130, + 0x105, 0xd6, 0xba, 0x9b, 0x83, 0x6b, 0x5a, 0x4a, 0x3c, 0x3a, 0x37, 0x3b, 0x4c, 0x58, 0x67, + 0x82, 0x9f, 0xc7, 0xe7, 0x101, 0x12f, 0x15d, 0x195, 0x1d2, 0x214, 0x25c, 0x2a1, 0x238, 0x1fd, 0x1bb, + 0x17f, 0x150, 0x123, 0xf7, 0xd1, 0xb1, 0x94, 0x78, 0x64, 0x4e, 0x3d, 0x30, 0x2e, 0x28, 0x2e, + 0x3e, 0x4b, 0x60, 0x77, 0x9a, 0xc3, 0xdc, 0xfe, 0x129, 0x155, 0x18c, 0x1c9, 0x20d, 0x256, 0x295, + 0x234, 0x1f0, 0x1af, 0x175, 0x141, 0x117, 0xf0, 0xcb, 0xa8, 0x8a, 0x71, 0x58, 0x3e, 0x2f, 0x23, + 0x1e, 0x1d, 0x23, 0x30, 0x41, 0x58, 0x72, 0x91, 0xbb, 0xd3, 0xf3, 0x122, 0x151, 0x180, 0x1c5, + 0x202, 0x24d, 0x287, 0x222, 0x1e8, 0x1a6, 0x16d, 0x13c, 0x10d, 0xe6, 0xc5, 0xa6, 0x82, 0x67, 0x4e, + 0x37, 0x23, 0x16, 0x12, 0x10, 0x18, 0x23, 0x37, 0x4f, 0x69, 0x84, 0xa9, 0xc7, 0xea, 0x11d, + 0x149, 0x178, 0x1be, 0x1fe, 0x247, 0x28a, 0x21e, 0x1e0, 0x19d, 0x169, 0x138, 0x10b, 0xe3, 0xc3, 0x9d, + 0x7d, 0x61, 0x44, 0x2e, 0x1d, 0xf, 0x8, 0x6, 0xe, 0x1a, 0x2d, 0x47, 0x5d, 0x7c, 0x9c, + 0xbf, 0xe6, 0x119, 0x141, 0x171, 0x1b4, 0x1f5, 0x241, 0x279, 0x21b, 0x1de, 0x19b, 0x168, 0x132, 0x107, + 0xdf, 0xbc, 0x9a, 0x78, 0x5d, 0x40, 0x29, 0x15, 0x7, 0x0, 0x0, 0xa, 0x13, 0x27, 0x45, + 0x58, 0x77, 0x9b, 0xbb, 0xe5, 0x113, 0x13c, 0x170, 0x1ae, 0x1f3, 0x238, 0x276, 0x244, 0x1d8, 0x19f, + 0x168, 0x133, 0x107, 0xdd, 0xba, 0x97, 0x75, 0x56, 0x3c, 0x28, 0x12, 0x4, 0x3, 0x1, 0x4, + 0x11, 0x21, 0x3d, 0x58, 0x77, 0x97, 0xbc, 0xe1, 0x10f, 0x13b, 0x16f, 0x1a9, 0x1e9, 0x232, 0x276, + 0x2a3, 0x1ec, 0x1a4, 0x16a, 0x12f, 0x102, 0xdb, 0xba, 0x94, 0x70, 0x56, 0x3b, 0x28, 0xf, 0x1, + 0x6, 0x2, 0x4, 0xe, 0x1f, 0x3a, 0x55, 0x74, 0x96, 0xb5, 0xe0, 0x10d, 0x13c, 0x16d, 0x1ac, + 0x1e5, 0x230, 0x271, 0x2a9, 0x206, 0x19e, 0x166, 0x12e, 0x101, 0xda, 0xb5, 0x92, 0x71, 0x54, 0x3a, + 0x24, 0x10, 0x4, 0x5, 0x7, 0x6, 0xd, 0x1f, 0x3c, 0x52, 0x75, 0x93, 0xb4, 0xe0, 0x10b, + 0x138, 0x168, 0x1a7, 0x1e9, 0x235, 0x271, 0x2a6, 0x1f1, 0x197, 0x160, 0x129, 0x100, 0xda, 0xb7, 0x92, + 0x70, 0x54, 0x3a, 0x26, 0x12, 0x4, 0x5, 0x5, 0x9, 0xc, 0x22, 0x38, 0x54, 0x71, 0x92, + 0xb6, 0xe2, 0x10c, 0x136, 0x167, 0x1a4, 0x1e2, 0x230, 0x275, 0x267, 0x1d3, 0x192, 0x160, 0x128, 0x101, + 0xd9, 0xbb, 0x96, 0x77, 0x56, 0x3b, 0x2a, 0x14, 0x6, 0x3, 0x7, 0x7, 0x10, 0x26, 0x3d, + 0x57, 0x74, 0x96, 0xb6, 0xe5, 0x10c, 0x136, 0x168, 0x1a3, 0x1e4, 0x22d, 0x271, 0x228, 0x1e9, 0x197, + 0x163, 0x12f, 0x103, 0xd9, 0xbb, 0x9a, 0x7c, 0x5c, 0x45, 0x2f, 0x1c, 0xb, 0x6, 0x7, 0xd, + 0x17, 0x28, 0x3f, 0x5b, 0x77, 0x98, 0xb8, 0xe7, 0x10d, 0x139, 0x16a, 0x1a7, 0x1e9, 0x234, 0x279, + 0x263, 0x226, 0x19a, 0x16a, 0x134, 0x108, 0xdd, 0xbc, 0x9d, 0x80, 0x65, 0x4c, 0x37, 0x25, 0x16, + 0xf, 0xe, 0x13, 0x1f, 0x2e, 0x46, 0x5e, 0x79, 0x9c, 0xbd, 0xeb, 0x112, 0x13d, 0x170, 0x1b0, + 0x1ef, 0x23a, 0x286, 0x271, 0x236, 0x19f, 0x16c, 0x13c, 0x10e, 0xe4, 0xc2, 0x9f, 0x83, 0x6a, 0x55, + 0x3d, 0x2a, 0x1f, 0x19, 0x14, 0x1b, 0x26, 0x36, 0x4c, 0x65, 0x84, 0xa4, 0xc2, 0xeb, 0x119, + 0x146, 0x178, 0x1af, 0x1f3, 0x240, 0x286, 0x254, 0x22e, 0x1a5, 0x16f, 0x143, 0x111, 0xf0, 0xc6, 0xa7, + 0x8d, 0x70, 0x5c, 0x46, 0x35, 0x2e, 0x32, 0x21, 0x24, 0x33, 0x40, 0x55, 0x6c, 0x90, 0xb1, + 0xcb, 0xf2, 0x11d, 0x150, 0x17d, 0x1bc, 0x1f9, 0x244, 0x287, 0x22b, 0x206, 0x1b0, 0x17a, 0x14d, 0x11b, + 0xf4, 0xce, 0xae, 0x93, 0x78, 0x63, 0x4d, 0x3d, 0x40, 0x38, 0x31, 0x31, 0x40, 0x4d, 0x62, + 0x74, 0x98, 0xb8, 0xd7, 0xfb, 0x12f, 0x15a, 0x18a, 0x1c6, 0x205, 0x248, 0x290, 0x236, 0x201, 0x1bd, + 0x190, 0x153, 0x124, 0x100, 0xd9, 0xba, 0xa1, 0x84, 0x6b, 0x57, 0x4b, 0x45, 0x47, 0x42, 0x44, + 0x50, 0x5b, 0x6d, 0x82, 0xa2, 0xc1, 0xde, 0x107, 0x137, 0x161, 0x194, 0x1cc, 0x20a, 0x257, 0x297, + 0x24c, 0x213, 0x1c6, 0x19b, 0x166, 0x12f, 0x10b, 0xe3, 0xc6, 0xaa, 0x90, 0x77, 0x67, 0x5b, 0x4c, + 0x4d, 0x4d, 0x51, 0x5d, 0x6c, 0x7c, 0x8e, 0xab, 0xc9, 0xe8, 0x112, 0x140, 0x16b, 0x19c, 0x1d6, + 0x21a, 0x263, 0x2a7, 0x25b, 0x223, 0x1db, 0x1a7, 0x175, 0x13c, 0x115, 0xf5, 0xd2, 0xb7, 0x9b, 0x86, + 0x76, 0x68, 0x5b, 0x5b, 0x5f, 0x61, 0x69, 0x78, 0x8a, 0xa0, 0xba, 0xd4, 0xf4, 0x11b, 0x149, + 0x176, 0x1a4, 0x1e0, 0x226, 0x26d, 0x2bb, 0x268, 0x22f, 0x1ec, 0x1b1, 0x17b, 0x14b, 0x121, 0xff, 0xe0, + 0xc5, 0xad, 0x96, 0x88, 0x79, 0x6d, 0x6a, 0x6e, 0x6c, 0x75, 0x87, 0x96, 0xae, 0xc9, 0xe2, + 0x103, 0x129, 0x157, 0x183, 0x1b2, 0x1eb, 0x236, 0x280, 0x2cc, 0x27d, 0x234, 0x1fb, 0x1b9, 0x186, 0x158, + 0x132, 0x109, 0xef, 0xd5, 0xbc, 0xa6, 0x97, 0x89, 0x81, 0x7d, 0x7d, 0x7d, 0x86, 0x94, 0xa4, + 0xba, 0xd5, 0xf2, 0x112, 0x136, 0x15e, 0x18a, 0x1bc, 0x1fb, 0x242, 0x28e, 0x2da, 0x28c, 0x249, 0x20e, + 0x1cc, 0x195, 0x162, 0x140, 0x11a, 0x100, 0xe4, 0xcb, 0xb3, 0xa7, 0x98, 0x90, 0x8f, 0x8e, 0x90, + 0x97, 0xa2, 0xb3, 0xc9, 0xdf, 0xfe, 0x122, 0x148, 0x16d, 0x1a6, 0x1d6, 0x210, 0x259, 0x2a1, 0x2e8, + 0x2a9, 0x264, 0x21f, 0x1da, 0x1aa, 0x175, 0x151, 0x129, 0x10e, 0xf4, 0xdc, 0xca, 0xb7, 0xaa, 0xa3, + 0x9c, 0x99, 0x9f, 0xaa, 0xb4, 0xc6, 0xd7, 0xee, 0x10a, 0x130, 0x156, 0x183, 0x1c5, 0x1f3, 0x229, + 0x264, 0x2b3, 0x304, 0x2c0, 0x279, 0x234, 0x1ef, 0x1bf, 0x18d, 0x165, 0x13d, 0x11d, 0x106, 0xeb, 0xdb, + 0xcb, 0xbf, 0xb6, 0xae, 0xad, 0xb3, 0xba, 0xc8, 0xd6, 0xeb, 0x103, 0x11b, 0x140, 0x166, 0x19d, + 0x1e6, 0x20b, 0x244, 0x282, 0x2c9, 0x320, 0x2d0, 0x28d, 0x245, 0x204, 0x1da, 0x19c, 0x175, 0x14b, 0x12c, + 0x10f, 0xf9, 0xe5, 0xdb, 0xd0, 0xc3, 0xbc, 0xbb, 0xbf, 0xc8, 0xd8, 0xe7, 0xf7, 0x114, 0x12b, + 0x14d, 0x176, 0x1b2, 0x1f1, 0x218, 0x259, 0x29b, 0x2e3, 0x338, + }, + }, + }, + + /* ISP_BNR_LSC_CALIB_TABLE_S */ + { + /* RGain */ + { + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096 + }, + /* GrGain */ + { + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096 + }, + /* GbGain */ + { + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096 + }, + /* BGain */ + { + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096 + }, + }, + +}; + +static const hi_isp_cmos_lsc ST_CMOS_LSC_FISH_LENS_PIPE1 = { + /* MeshStrength */ + 4096, + /* MeshScale */ + 4, + /* ISP_LSC_CABLI_TABLE_S */ + { + { + /* Rgain */ + { + 0x26b, 0x228, 0x1de, 0x1a8, 0x179, 0x149, 0x12a, 0x109, 0xee, 0xd5, 0xc4, 0xb0, 0xa2, 0x9b, 0x94, + 0x8f, 0x94, 0x93, 0x97, 0x9f, 0xad, 0xb8, 0xc8, 0xdb, 0x10d, 0x14a, 0x133, 0x15a, 0x184, 0x1c1, + 0x1fd, 0x23b, 0x284, 0x24e, 0x212, 0x1d3, 0x19a, 0x168, 0x13d, 0x11b, 0xfa, 0xe4, 0xca, 0xbb, 0xa7, + 0x9a, 0x93, 0x87, 0x88, 0x86, 0x85, 0x8d, 0x98, 0xa0, 0xab, 0xbd, 0xce, 0xf8, 0x12e, 0x123, + 0x14c, 0x179, 0x1af, 0x1e8, 0x22d, 0x267, 0x235, 0x1f9, 0x1ba, 0x18a, 0x158, 0x12c, 0x10d, 0xe9, 0xd3, + 0xbf, 0xad, 0x9b, 0x8c, 0x7e, 0x7b, 0x79, 0x74, 0x79, 0x7b, 0x86, 0x90, 0x9f, 0xaf, 0xc1, + 0xd8, 0xff, 0x114, 0x137, 0x164, 0x198, 0x1d1, 0x213, 0x253, 0x21f, 0x1e5, 0x1a8, 0x172, 0x146, 0x11a, + 0xfc, 0xde, 0xc8, 0xb1, 0x9d, 0x8a, 0x7f, 0x73, 0x6c, 0x66, 0x65, 0x68, 0x6c, 0x74, 0x80, + 0x92, 0xa0, 0xb5, 0xc9, 0xe4, 0x103, 0x128, 0x154, 0x183, 0x1bc, 0x1fe, 0x23b, 0x210, 0x1d3, 0x194, + 0x160, 0x136, 0x10e, 0xec, 0xd3, 0xbc, 0xa4, 0x91, 0x81, 0x6f, 0x67, 0x5d, 0x59, 0x59, 0x59, + 0x5f, 0x6a, 0x75, 0x84, 0x94, 0xab, 0xbf, 0xda, 0xf7, 0x11b, 0x149, 0x173, 0x1ac, 0x1ed, 0x229, + 0x1fa, 0x1c3, 0x185, 0x152, 0x124, 0x101, 0xe2, 0xcd, 0xaf, 0x9c, 0x86, 0x74, 0x65, 0x5a, 0x52, + 0x4c, 0x4c, 0x4d, 0x52, 0x5e, 0x6b, 0x7a, 0x8a, 0x9f, 0xb5, 0xcb, 0xeb, 0x10d, 0x137, 0x165, + 0x19c, 0x1da, 0x218, 0x1e1, 0x1b1, 0x177, 0x148, 0x11a, 0xf8, 0xd7, 0xbf, 0xa6, 0x90, 0x7c, 0x68, + 0x5b, 0x4d, 0x44, 0x40, 0x3e, 0x40, 0x4a, 0x51, 0x5c, 0x6c, 0x7d, 0x95, 0xab, 0xc3, 0xe2, + 0x101, 0x127, 0x154, 0x18f, 0x1cd, 0x200, 0x1d8, 0x1a2, 0x169, 0x13c, 0x111, 0xee, 0xd0, 0xb6, 0x9e, + 0x87, 0x73, 0x5f, 0x4f, 0x44, 0x38, 0x36, 0x35, 0x36, 0x3f, 0x47, 0x55, 0x64, 0x74, 0x8d, + 0xa3, 0xbd, 0xd7, 0xf8, 0x11e, 0x14a, 0x182, 0x1c2, 0x1f4, 0x1c8, 0x197, 0x15f, 0x131, 0x10d, 0xe9, + 0xc9, 0xae, 0x98, 0x7e, 0x69, 0x59, 0x4a, 0x3c, 0x32, 0x2b, 0x2a, 0x2b, 0x33, 0x41, 0x4a, + 0x55, 0x6b, 0x82, 0x9e, 0xb4, 0xd0, 0xed, 0x113, 0x142, 0x175, 0x1b3, 0x1e5, 0x1c1, 0x189, 0x154, + 0x126, 0x103, 0xdf, 0xc5, 0xa4, 0x8b, 0x77, 0x62, 0x4e, 0x3e, 0x34, 0x28, 0x20, 0x1f, 0x23, + 0x2b, 0x35, 0x43, 0x53, 0x64, 0x7a, 0x95, 0xac, 0xca, 0xe8, 0x10c, 0x13a, 0x16b, 0x1a9, 0x1e2, + 0x1b6, 0x182, 0x14f, 0x124, 0xf9, 0xdb, 0xbf, 0xa0, 0x84, 0x6d, 0x57, 0x46, 0x34, 0x29, 0x21, + 0x17, 0x18, 0x17, 0x21, 0x2c, 0x3a, 0x4b, 0x5e, 0x73, 0x8e, 0xa5, 0xc2, 0xe3, 0x105, 0x135, + 0x162, 0x1a0, 0x1d8, 0x1b0, 0x177, 0x146, 0x11d, 0xf6, 0xd7, 0xb8, 0x99, 0x81, 0x6a, 0x53, 0x41, + 0x2f, 0x21, 0x18, 0x11, 0xf, 0x11, 0x1b, 0x25, 0x35, 0x47, 0x5b, 0x6c, 0x86, 0xa2, 0xbc, + 0xdf, 0x101, 0x129, 0x15f, 0x198, 0x1cd, 0x1a9, 0x175, 0x140, 0x112, 0xef, 0xd4, 0xb4, 0x96, 0x7d, + 0x65, 0x50, 0x39, 0x2d, 0x1c, 0x11, 0x9, 0xa, 0xb, 0x15, 0x1f, 0x2f, 0x3f, 0x57, 0x69, + 0x83, 0x9e, 0xb9, 0xd9, 0xfb, 0x126, 0x156, 0x192, 0x1c3, 0x1a6, 0x171, 0x13a, 0x111, 0xef, 0xce, + 0xb1, 0x95, 0x7a, 0x65, 0x4e, 0x39, 0x28, 0x17, 0x9, 0x5, 0x3, 0x7, 0x10, 0x1b, 0x2b, + 0x3e, 0x51, 0x67, 0x82, 0x9c, 0xba, 0xd4, 0xfa, 0x124, 0x152, 0x18d, 0x1be, 0x1a5, 0x16d, 0x134, + 0x10d, 0xe9, 0xd0, 0xae, 0x92, 0x7a, 0x5d, 0x4b, 0x33, 0x26, 0x15, 0x8, 0x2, 0x4, 0x8, + 0xc, 0x16, 0x28, 0x3a, 0x4f, 0x65, 0x7f, 0x9a, 0xb8, 0xd6, 0xf7, 0x123, 0x151, 0x18a, 0x1bf, + 0x19b, 0x167, 0x137, 0x10c, 0xe8, 0xcb, 0xab, 0x8f, 0x78, 0x5d, 0x47, 0x33, 0x27, 0x11, 0x4, + 0x0, 0x2, 0x6, 0xe, 0x16, 0x27, 0x3b, 0x50, 0x65, 0x7d, 0x98, 0xb7, 0xd4, 0xf4, 0x121, + 0x151, 0x18d, 0x1be, 0x19d, 0x165, 0x134, 0x10f, 0xe8, 0xc8, 0xac, 0x8f, 0x75, 0x5c, 0x48, 0x37, + 0x34, 0x11, 0x4, 0x0, 0x0, 0x3, 0xa, 0x16, 0x25, 0x39, 0x50, 0x64, 0x7e, 0x9a, 0xb5, + 0xd5, 0xf8, 0x120, 0x150, 0x18b, 0x1bd, 0x198, 0x16a, 0x135, 0x10e, 0xe8, 0xc9, 0xab, 0x8b, 0x74, + 0x5c, 0x4b, 0x39, 0x36, 0x15, 0x6, 0x1, 0x1, 0x3, 0xc, 0x17, 0x26, 0x3b, 0x4e, 0x65, + 0x7f, 0x98, 0xb6, 0xd5, 0xfa, 0x11e, 0x150, 0x187, 0x1c0, 0x199, 0x167, 0x134, 0x10d, 0xea, 0xca, + 0xae, 0x8e, 0x73, 0x60, 0x4b, 0x39, 0x32, 0x16, 0x5, 0x4, 0x2, 0x6, 0xd, 0x19, 0x2a, + 0x3c, 0x4e, 0x66, 0x83, 0x9a, 0xbc, 0xd3, 0xf9, 0x11f, 0x151, 0x18a, 0x1c0, 0x19d, 0x16b, 0x135, + 0x110, 0xef, 0xce, 0xae, 0x94, 0x7b, 0x64, 0x4d, 0x3b, 0x2b, 0x19, 0x9, 0x9, 0x7, 0xc, + 0xf, 0x1c, 0x2c, 0x41, 0x54, 0x6a, 0x82, 0x9a, 0xbb, 0xd8, 0xfc, 0x124, 0x156, 0x18c, 0x1c0, + 0x1a5, 0x170, 0x139, 0x114, 0xee, 0xd1, 0xb1, 0x95, 0x7e, 0x65, 0x51, 0x3d, 0x2f, 0x1f, 0x14, + 0xc, 0xd, 0xe, 0x16, 0x23, 0x31, 0x42, 0x56, 0x6f, 0x86, 0x9e, 0xbb, 0xda, 0x100, 0x128, + 0x158, 0x190, 0x1c3, 0x1a9, 0x172, 0x144, 0x115, 0xf2, 0xd3, 0xb9, 0x99, 0x80, 0x6b, 0x58, 0x43, + 0x33, 0x28, 0x1b, 0x16, 0x14, 0x15, 0x1b, 0x2a, 0x3b, 0x48, 0x5b, 0x75, 0x8a, 0xa4, 0xc1, + 0xdc, 0x103, 0x12c, 0x15d, 0x196, 0x1cc, 0x1b2, 0x17b, 0x147, 0x11b, 0xfe, 0xda, 0xbd, 0x9f, 0x87, + 0x72, 0x5f, 0x4a, 0x3b, 0x2e, 0x24, 0x1d, 0x1b, 0x1d, 0x24, 0x32, 0x43, 0x51, 0x64, 0x79, + 0x90, 0xaa, 0xc8, 0xeb, 0x107, 0x134, 0x164, 0x19e, 0x1d2, 0x1b3, 0x187, 0x14e, 0x125, 0x102, 0xe2, + 0xc1, 0xa6, 0x8e, 0x77, 0x65, 0x53, 0x44, 0x37, 0x2c, 0x27, 0x25, 0x26, 0x2b, 0x37, 0x45, + 0x55, 0x67, 0x7f, 0x97, 0xb3, 0xcb, 0xec, 0x10f, 0x13c, 0x169, 0x1a4, 0x1dd, 0x1c1, 0x18b, 0x159, + 0x12e, 0x107, 0xe4, 0xca, 0xaf, 0x94, 0x80, 0x6e, 0x5a, 0x4d, 0x40, 0x36, 0x30, 0x30, 0x31, + 0x36, 0x41, 0x4e, 0x5f, 0x74, 0x89, 0x9b, 0xb5, 0xd1, 0xf1, 0x11a, 0x141, 0x173, 0x1aa, 0x1e2, + 0x1c9, 0x198, 0x162, 0x133, 0x112, 0xec, 0xd5, 0xbc, 0x9e, 0x88, 0x75, 0x65, 0x56, 0x4c, 0x42, + 0x3b, 0x3a, 0x3f, 0x40, 0x4c, 0x57, 0x6a, 0x7c, 0x91, 0xa5, 0xc0, 0xda, 0xf8, 0x11e, 0x148, + 0x17b, 0x1b7, 0x1ef, 0x1de, 0x1a5, 0x16f, 0x140, 0x119, 0xf8, 0xda, 0xc4, 0xa7, 0x92, 0x7f, 0x6d, + 0x64, 0x57, 0x4e, 0x48, 0x45, 0x48, 0x4f, 0x56, 0x62, 0x73, 0x86, 0x98, 0xb1, 0xc5, 0xe6, + 0x105, 0x128, 0x155, 0x188, 0x1c4, 0x1fd, 0x1e8, 0x1b2, 0x17b, 0x14b, 0x126, 0x103, 0xe8, 0xcc, 0xb1, + 0x9e, 0x89, 0x7d, 0x6f, 0x60, 0x59, 0x53, 0x53, 0x55, 0x5b, 0x64, 0x6f, 0x80, 0x8f, 0xa5, + 0xbe, 0xd4, 0xf0, 0x10d, 0x135, 0x15f, 0x18f, 0x1d6, 0x20c, 0x1f9, 0x1bf, 0x18a, 0x15a, 0x131, 0x10e, + 0xf2, 0xd7, 0xbf, 0xab, 0x99, 0x89, 0x79, 0x70, 0x65, 0x61, 0x60, 0x62, 0x6a, 0x72, 0x7b, + 0x8c, 0x9e, 0xb3, 0xc9, 0xe2, 0xfb, 0x117, 0x13d, 0x169, 0x19f, 0x1df, 0x21e, 0x20c, 0x1cf, 0x198, + 0x166, 0x13f, 0x119, 0xfb, 0xe0, 0xca, 0xb6, 0xa7, 0x95, 0x85, 0x7d, 0x74, 0x6e, 0x70, 0x70, + 0x74, 0x7d, 0x87, 0x98, 0xa9, 0xbe, 0xd2, 0xee, 0x106, 0x125, 0x14c, 0x176, 0x1af, 0x1f4, 0x22d, + 0x21c, 0x1e3, 0x1a9, 0x178, 0x14b, 0x126, 0x109, 0xee, 0xd6, 0xc3, 0xb4, 0xa5, 0x96, 0x8d, 0x83, + 0x7d, 0x7f, 0x7c, 0x83, 0x8f, 0x94, 0xa6, 0xb7, 0xcc, 0xe0, 0xf6, 0x115, 0x133, 0x15d, 0x189, + 0x1c1, 0x204, 0x23f, 0x22d, 0x1f1, 0x1bb, 0x187, 0x157, 0x132, 0x118, 0xfe, 0xe6, 0xd1, 0xc3, 0xb3, + 0xa7, 0x98, 0x91, 0x8b, 0x8e, 0x8d, 0x91, 0x9b, 0xa6, 0xb5, 0xc5, 0xd9, 0xf1, 0x107, 0x122, + 0x144, 0x16b, 0x19d, 0x1d5, 0x218, 0x252, 0x244, 0x204, 0x1c8, 0x18e, 0x167, 0x137, 0x127, 0x108, 0xf5, + 0xdd, 0xcc, 0xbf, 0xb1, 0xa6, 0x9f, 0x9d, 0x99, 0x9a, 0x98, 0xa5, 0xb3, 0xc0, 0xce, 0xe2, + 0xf7, 0x10b, 0x12e, 0x155, 0x17a, 0x1a6, 0x1e9, 0x223, 0x262, + }, + + /* Grgain */ + { + 0x27c, 0x243, 0x1fd, 0x1be, 0x18b, 0x162, 0x138, 0x114, 0xfb, 0xe1, 0xd2, 0xbb, 0xb1, 0xa9, 0xa3, + 0x9e, 0x9d, 0x9d, 0xa0, 0xb1, 0xb7, 0xc3, 0xd8, 0xea, 0x11d, 0x15a, 0x141, 0x170, 0x1a4, 0x1d8, + 0x21c, 0x268, 0x2ab, 0x265, 0x22e, 0x1e8, 0x1b1, 0x17e, 0x153, 0x128, 0x107, 0xef, 0xd9, 0xc6, 0xb3, + 0xa6, 0x9b, 0x94, 0x90, 0x91, 0x94, 0x96, 0xa0, 0xac, 0xb7, 0xcc, 0xdd, 0x101, 0x13d, 0x137, + 0x165, 0x193, 0x1c5, 0x206, 0x253, 0x297, 0x24a, 0x217, 0x1d0, 0x197, 0x164, 0x13d, 0x113, 0xf4, 0xde, + 0xc8, 0xb4, 0xa7, 0x96, 0x8c, 0x83, 0x7e, 0x7e, 0x81, 0x84, 0x8f, 0x9a, 0xa9, 0xbb, 0xcd, + 0xe8, 0x10f, 0x128, 0x150, 0x17a, 0x1b1, 0x1ec, 0x236, 0x274, 0x22f, 0x1fb, 0x1bb, 0x181, 0x154, 0x12b, + 0x108, 0xe8, 0xd0, 0xba, 0xa6, 0x96, 0x87, 0x7b, 0x74, 0x6f, 0x6e, 0x6e, 0x75, 0x7f, 0x8c, + 0x98, 0xab, 0xc2, 0xd9, 0xf3, 0x116, 0x13b, 0x168, 0x19d, 0x1d6, 0x220, 0x25c, 0x21c, 0x1e9, 0x1a8, + 0x173, 0x140, 0x11b, 0xf8, 0xde, 0xc5, 0xaf, 0x9b, 0x88, 0x77, 0x6d, 0x64, 0x5e, 0x5d, 0x61, + 0x67, 0x6f, 0x80, 0x8b, 0x9f, 0xb6, 0xca, 0xe7, 0x105, 0x12d, 0x15a, 0x18d, 0x1c1, 0x20a, 0x24e, + 0x209, 0x1d3, 0x199, 0x164, 0x134, 0x10e, 0xee, 0xd2, 0xba, 0xa4, 0x8e, 0x7c, 0x6b, 0x61, 0x58, + 0x53, 0x50, 0x54, 0x5a, 0x64, 0x70, 0x80, 0x92, 0xa8, 0xc1, 0xde, 0xfa, 0x11d, 0x147, 0x17b, + 0x1b7, 0x1f7, 0x238, 0x1f6, 0x1c5, 0x18b, 0x154, 0x127, 0x101, 0xe6, 0xc7, 0xaf, 0x97, 0x82, 0x70, + 0x62, 0x54, 0x4b, 0x44, 0x46, 0x47, 0x4e, 0x56, 0x64, 0x74, 0x85, 0x9d, 0xb6, 0xd1, 0xee, + 0x110, 0x13c, 0x16a, 0x1a6, 0x1e6, 0x22d, 0x1ed, 0x1b6, 0x179, 0x148, 0x11c, 0xfe, 0xda, 0xbc, 0xa7, + 0x8e, 0x78, 0x65, 0x55, 0x4a, 0x41, 0x38, 0x39, 0x3a, 0x43, 0x4c, 0x5a, 0x68, 0x7e, 0x94, + 0xab, 0xc7, 0xe5, 0x103, 0x130, 0x15a, 0x193, 0x1db, 0x21b, 0x1de, 0x1ad, 0x170, 0x13b, 0x118, 0xf0, + 0xd3, 0xb3, 0x9d, 0x85, 0x6f, 0x5c, 0x4c, 0x3d, 0x35, 0x2d, 0x2a, 0x2e, 0x37, 0x43, 0x4f, + 0x61, 0x76, 0x8b, 0xa3, 0xbc, 0xdb, 0xf9, 0x123, 0x153, 0x187, 0x1cc, 0x20b, 0x1ca, 0x19f, 0x165, + 0x130, 0x10c, 0xea, 0xcd, 0xaf, 0x95, 0x7d, 0x65, 0x53, 0x46, 0x36, 0x28, 0x24, 0x22, 0x25, + 0x2e, 0x38, 0x48, 0x58, 0x6c, 0x80, 0x9f, 0xb4, 0xd3, 0xf4, 0x11e, 0x14b, 0x181, 0x1c3, 0x1fc, + 0x1ca, 0x197, 0x15c, 0x129, 0x107, 0xe6, 0xc6, 0xa8, 0x8e, 0x76, 0x5d, 0x4d, 0x3c, 0x2c, 0x21, + 0x18, 0x19, 0x1c, 0x27, 0x2f, 0x41, 0x52, 0x68, 0x79, 0x94, 0xb2, 0xce, 0xee, 0x116, 0x149, + 0x17a, 0x1b9, 0x1fa, 0x1be, 0x18c, 0x156, 0x123, 0x100, 0xdc, 0xbe, 0xa3, 0x89, 0x6f, 0x5a, 0x46, + 0x33, 0x25, 0x19, 0xf, 0xe, 0x16, 0x1d, 0x28, 0x39, 0x49, 0x5f, 0x75, 0x8d, 0xaa, 0xc7, + 0xe9, 0x10f, 0x13c, 0x172, 0x1b3, 0x1ec, 0x1b4, 0x188, 0x151, 0x121, 0xfc, 0xde, 0xbd, 0x9e, 0x85, + 0x6b, 0x54, 0x40, 0x31, 0x1e, 0x12, 0xb, 0x9, 0xf, 0x16, 0x24, 0x34, 0x44, 0x5c, 0x70, + 0x89, 0xa6, 0xc6, 0xe5, 0x10a, 0x137, 0x16b, 0x1ac, 0x1e5, 0x1b1, 0x182, 0x148, 0x11d, 0xfa, 0xdb, + 0xb9, 0x9d, 0x81, 0x68, 0x52, 0x3e, 0x2c, 0x1b, 0xc, 0x6, 0x7, 0x9, 0x11, 0x20, 0x31, + 0x41, 0x59, 0x6e, 0x88, 0xa2, 0xc1, 0xdf, 0x106, 0x134, 0x165, 0x1a6, 0x1de, 0x1ae, 0x17d, 0x147, + 0x119, 0xf7, 0xd6, 0xb7, 0x9a, 0x80, 0x67, 0x53, 0x3a, 0x29, 0x18, 0xa, 0x3, 0x4, 0x6, + 0x12, 0x1a, 0x2c, 0x3f, 0x56, 0x6d, 0x86, 0xa1, 0xc1, 0xde, 0x103, 0x12e, 0x166, 0x1a2, 0x1dc, + 0x1a3, 0x17f, 0x147, 0x11c, 0xf3, 0xd5, 0xb4, 0x98, 0x7d, 0x63, 0x4e, 0x3b, 0x29, 0x13, 0xa, + 0x1, 0x0, 0x4, 0xe, 0x18, 0x2b, 0x40, 0x55, 0x6f, 0x84, 0xa3, 0xbf, 0xdf, 0x102, 0x12c, + 0x163, 0x1a0, 0x1da, 0x1ac, 0x17c, 0x144, 0x116, 0xf5, 0xd6, 0xb5, 0x98, 0x7d, 0x63, 0x4c, 0x3b, + 0x37, 0x14, 0x7, 0x0, 0x1, 0x5, 0xc, 0x1a, 0x2a, 0x40, 0x55, 0x6d, 0x83, 0xa1, 0xbe, + 0xdf, 0x101, 0x12f, 0x166, 0x1a0, 0x1d7, 0x1a7, 0x17d, 0x146, 0x118, 0xf8, 0xd4, 0xb6, 0x98, 0x80, + 0x68, 0x52, 0x3f, 0x3a, 0x18, 0x9, 0x1, 0x2, 0x6, 0xe, 0x1a, 0x2c, 0x40, 0x54, 0x6c, + 0x88, 0xa0, 0xc2, 0xe0, 0x103, 0x12d, 0x160, 0x19f, 0x1d5, 0x1aa, 0x17c, 0x145, 0x119, 0xf9, 0xd9, + 0xb6, 0x9b, 0x82, 0x6b, 0x52, 0x3e, 0x3a, 0x1b, 0xb, 0x3, 0x5, 0x7, 0xd, 0x1c, 0x2d, + 0x43, 0x57, 0x6c, 0x88, 0xa1, 0xc0, 0xe3, 0x102, 0x12e, 0x162, 0x1a0, 0x1dc, 0x1b0, 0x17f, 0x148, + 0x11f, 0xfd, 0xd8, 0xb8, 0x9c, 0x83, 0x6d, 0x55, 0x3f, 0x2d, 0x1e, 0x10, 0x7, 0x7, 0xb, + 0x13, 0x20, 0x31, 0x46, 0x5b, 0x72, 0x8c, 0xa7, 0xc6, 0xe2, 0x107, 0x131, 0x167, 0x1a3, 0x1df, + 0x1b4, 0x185, 0x14d, 0x124, 0xfe, 0xde, 0xbc, 0xa3, 0x87, 0x6e, 0x5c, 0x46, 0x36, 0x24, 0x16, + 0xf, 0xf, 0x13, 0x19, 0x24, 0x36, 0x49, 0x5f, 0x77, 0x8f, 0xad, 0xca, 0xe5, 0x10d, 0x139, + 0x16b, 0x1a6, 0x1e2, 0x1b7, 0x189, 0x152, 0x127, 0x103, 0xe2, 0xc3, 0xa6, 0x8d, 0x76, 0x5d, 0x4c, + 0x3c, 0x2c, 0x1c, 0x18, 0x18, 0x18, 0x21, 0x2b, 0x3d, 0x4e, 0x64, 0x7b, 0x96, 0xb0, 0xcf, + 0xee, 0x111, 0x13c, 0x171, 0x1af, 0x1e7, 0x1be, 0x191, 0x15a, 0x12d, 0x10b, 0xe3, 0xca, 0xac, 0x90, + 0x7a, 0x63, 0x57, 0x3e, 0x32, 0x26, 0x20, 0x1f, 0x23, 0x2b, 0x34, 0x44, 0x57, 0x69, 0x83, + 0x9c, 0xb4, 0xd2, 0xf7, 0x119, 0x145, 0x175, 0x1b8, 0x1f3, 0x1ca, 0x19a, 0x162, 0x139, 0x110, 0xea, + 0xcc, 0xb2, 0x98, 0x81, 0x6c, 0x59, 0x4a, 0x3b, 0x32, 0x2c, 0x29, 0x2b, 0x2f, 0x3d, 0x4a, + 0x5b, 0x73, 0x88, 0xa2, 0xbc, 0xd7, 0xfd, 0x11e, 0x147, 0x180, 0x1bf, 0x1fb, 0x1c9, 0x1a4, 0x16a, + 0x13f, 0x114, 0xf4, 0xd5, 0xba, 0x9e, 0x8a, 0x77, 0x63, 0x54, 0x45, 0x3a, 0x36, 0x33, 0x35, + 0x3a, 0x48, 0x54, 0x66, 0x79, 0x8f, 0xa8, 0xc6, 0xe1, 0x104, 0x127, 0x14f, 0x184, 0x1c8, 0x203, + 0x1e3, 0x1b0, 0x177, 0x145, 0x11e, 0xfd, 0xdc, 0xc3, 0xa5, 0x90, 0x7b, 0x6d, 0x5d, 0x50, 0x46, + 0x42, 0x41, 0x40, 0x47, 0x52, 0x61, 0x70, 0x85, 0x9b, 0xb3, 0xce, 0xe7, 0x109, 0x131, 0x15c, + 0x192, 0x1d1, 0x213, 0x1ed, 0x1bf, 0x186, 0x152, 0x12a, 0x108, 0xe7, 0xcd, 0xb1, 0x9c, 0x87, 0x78, + 0x6a, 0x5d, 0x55, 0x4f, 0x4c, 0x4d, 0x54, 0x5c, 0x6d, 0x7d, 0x8f, 0xa4, 0xbb, 0xd7, 0xf4, + 0x112, 0x137, 0x169, 0x1a0, 0x1de, 0x21a, 0x1fa, 0x1d2, 0x190, 0x160, 0x133, 0x110, 0xf2, 0xd9, 0xbb, + 0xa7, 0x96, 0x84, 0x75, 0x68, 0x5e, 0x5c, 0x5a, 0x5c, 0x60, 0x6d, 0x77, 0x8a, 0x99, 0xad, + 0xc6, 0xe1, 0xfd, 0x11d, 0x146, 0x173, 0x1ab, 0x1eb, 0x22a, 0x20d, 0x1dd, 0x1a0, 0x16f, 0x140, 0x11a, + 0xfc, 0xe5, 0xc7, 0xb3, 0xa3, 0x8f, 0x81, 0x75, 0x6d, 0x69, 0x66, 0x69, 0x71, 0x78, 0x85, + 0x93, 0xa5, 0xbb, 0xd3, 0xec, 0x108, 0x128, 0x152, 0x180, 0x1b9, 0x1fe, 0x23c, 0x21e, 0x1ee, 0x1b2, + 0x179, 0x150, 0x12c, 0x10c, 0xef, 0xd6, 0xc0, 0xad, 0x9d, 0x8f, 0x83, 0x7a, 0x79, 0x74, 0x79, + 0x7e, 0x86, 0x91, 0x9f, 0xb3, 0xcc, 0xdf, 0xf8, 0x114, 0x13b, 0x162, 0x18f, 0x1ca, 0x20e, 0x24e, + 0x231, 0x201, 0x1bf, 0x18c, 0x160, 0x137, 0x119, 0xfd, 0xe6, 0xcd, 0xbd, 0xad, 0x9e, 0x94, 0x8a, + 0x88, 0x84, 0x85, 0x8c, 0x97, 0xa2, 0xb0, 0xc5, 0xd6, 0xf0, 0x106, 0x123, 0x147, 0x16d, 0x1a1, + 0x1da, 0x21d, 0x260, 0x244, 0x211, 0x1d4, 0x19c, 0x171, 0x147, 0x128, 0x10e, 0xf3, 0xdf, 0xcc, 0xbc, + 0xaf, 0xa5, 0x9c, 0x96, 0x94, 0x97, 0x9c, 0xa7, 0xb0, 0xc1, 0xd4, 0xe7, 0xfd, 0x113, 0x131, + 0x156, 0x181, 0x1af, 0x1f1, 0x23a, 0x276, 0x25c, 0x224, 0x1e1, 0x1a9, 0x17f, 0x153, 0x136, 0x117, 0xfd, + 0xeb, 0xda, 0xc5, 0xbe, 0xb2, 0xaa, 0xa2, 0x9f, 0xa3, 0xa9, 0xb5, 0xbb, 0xcc, 0xda, 0xf1, + 0x104, 0x122, 0x13e, 0x161, 0x18e, 0x1c4, 0x1ff, 0x24b, 0x285, + }, + + /* Gbgain */ + { + 0x28b, 0x248, 0x1fd, 0x1c1, 0x18e, 0x160, 0x139, 0x115, 0xfd, 0xe8, 0xd7, 0xc4, 0xb6, 0xad, 0xa3, + 0xa4, 0xa4, 0xa3, 0xa9, 0xb5, 0xbc, 0xc8, 0xde, 0xf4, 0x126, 0x166, 0x14d, 0x17a, 0x1a5, 0x1dd, + 0x21f, 0x26c, 0x2b1, 0x271, 0x232, 0x1ea, 0x1b0, 0x180, 0x152, 0x12b, 0x10c, 0xf2, 0xdc, 0xca, 0xb9, + 0xab, 0xa1, 0x9a, 0x96, 0x96, 0x99, 0xa0, 0xa6, 0xb0, 0xbf, 0xd2, 0xe5, 0x10a, 0x143, 0x13f, + 0x16b, 0x19c, 0x1cd, 0x20e, 0x256, 0x29c, 0x256, 0x216, 0x1d6, 0x19d, 0x16a, 0x142, 0x11d, 0xfd, 0xe4, + 0xcc, 0xb9, 0xa9, 0x9b, 0x91, 0x87, 0x84, 0x83, 0x84, 0x8b, 0x94, 0xa0, 0xae, 0xc1, 0xd7, + 0xec, 0x113, 0x12e, 0x156, 0x183, 0x1b7, 0x1f5, 0x23d, 0x284, 0x240, 0x201, 0x1c3, 0x185, 0x155, 0x12d, + 0x10e, 0xee, 0xd4, 0xbe, 0xa9, 0x9b, 0x8b, 0x7e, 0x79, 0x74, 0x73, 0x74, 0x7a, 0x88, 0x92, + 0x9d, 0xb2, 0xc8, 0xe1, 0xfc, 0x11c, 0x143, 0x172, 0x1a1, 0x1dd, 0x226, 0x266, 0x229, 0x1eb, 0x1ad, + 0x176, 0x142, 0x11f, 0xfb, 0xe1, 0xc9, 0xb0, 0x9f, 0x89, 0x7c, 0x71, 0x6a, 0x64, 0x62, 0x65, + 0x6c, 0x74, 0x84, 0x90, 0xa4, 0xba, 0xd2, 0xed, 0x10f, 0x132, 0x15f, 0x18f, 0x1ce, 0x20f, 0x252, + 0x21a, 0x1d7, 0x19c, 0x163, 0x136, 0x110, 0xf1, 0xd5, 0xbc, 0xa6, 0x92, 0x81, 0x72, 0x64, 0x59, + 0x57, 0x58, 0x59, 0x5e, 0x69, 0x75, 0x84, 0x97, 0xad, 0xc5, 0xe1, 0x102, 0x124, 0x151, 0x183, + 0x1bc, 0x1ff, 0x23b, 0x201, 0x1c5, 0x18a, 0x155, 0x129, 0x106, 0xe8, 0xcc, 0xb1, 0x9a, 0x86, 0x74, + 0x67, 0x58, 0x4d, 0x4b, 0x4b, 0x4a, 0x51, 0x5c, 0x6a, 0x7c, 0x8b, 0xa4, 0xbc, 0xd5, 0xf9, + 0x115, 0x140, 0x175, 0x1ac, 0x1ef, 0x229, 0x1f5, 0x1b9, 0x17e, 0x14b, 0x11d, 0xfc, 0xde, 0xc0, 0xa9, + 0x91, 0x7c, 0x6a, 0x59, 0x4d, 0x43, 0x3f, 0x3c, 0x3f, 0x46, 0x4f, 0x5e, 0x6e, 0x84, 0x99, + 0xb0, 0xc9, 0xeb, 0x109, 0x135, 0x163, 0x19e, 0x1de, 0x21e, 0x1ea, 0x1af, 0x176, 0x142, 0x116, 0xf6, + 0xd2, 0xb7, 0x9e, 0x87, 0x73, 0x60, 0x4e, 0x43, 0x38, 0x31, 0x2f, 0x32, 0x3c, 0x45, 0x54, + 0x65, 0x7a, 0x91, 0xaa, 0xc3, 0xe0, 0x101, 0x127, 0x158, 0x18f, 0x1d1, 0x211, 0x1de, 0x1a2, 0x168, + 0x137, 0x110, 0xee, 0xcd, 0xb1, 0x98, 0x7f, 0x67, 0x56, 0x44, 0x39, 0x2e, 0x27, 0x27, 0x2a, + 0x33, 0x3d, 0x4a, 0x5c, 0x71, 0x87, 0xa3, 0xba, 0xda, 0xfa, 0x120, 0x14e, 0x183, 0x1c6, 0x208, + 0x1ce, 0x199, 0x160, 0x130, 0x107, 0xe8, 0xc8, 0xab, 0x94, 0x79, 0x5f, 0x50, 0x3d, 0x2f, 0x22, + 0x1a, 0x1e, 0x1e, 0x28, 0x32, 0x43, 0x55, 0x6b, 0x7f, 0x9a, 0xb4, 0xd1, 0xf3, 0x11c, 0x147, + 0x17d, 0x1c0, 0x1fa, 0x1c8, 0x191, 0x159, 0x12a, 0x101, 0xe1, 0xc3, 0xa4, 0x8c, 0x73, 0x5b, 0x48, + 0x34, 0x28, 0x1c, 0x13, 0x13, 0x14, 0x21, 0x2b, 0x3b, 0x4c, 0x65, 0x7a, 0x92, 0xae, 0xcf, + 0xeb, 0x116, 0x145, 0x178, 0x1b7, 0x1f6, 0x1bf, 0x188, 0x153, 0x11e, 0x101, 0xde, 0xbe, 0xa0, 0x86, + 0x6c, 0x54, 0x43, 0x2f, 0x20, 0x14, 0xd, 0xc, 0x10, 0x1b, 0x26, 0x36, 0x46, 0x60, 0x75, + 0x91, 0xa9, 0xc9, 0xea, 0x110, 0x13c, 0x16f, 0x1b0, 0x1eb, 0x1b8, 0x181, 0x14d, 0x121, 0xfc, 0xdb, + 0xb8, 0x9d, 0x85, 0x67, 0x54, 0x3e, 0x2e, 0x1c, 0xf, 0x7, 0x7, 0xa, 0x15, 0x21, 0x32, + 0x46, 0x5a, 0x72, 0x8b, 0xa8, 0xc7, 0xe4, 0x10c, 0x137, 0x16b, 0x1ab, 0x1e5, 0x1bf, 0x17f, 0x14a, + 0x11e, 0xfa, 0xd6, 0xb8, 0x9d, 0x81, 0x69, 0x4f, 0x3c, 0x28, 0x19, 0xb, 0x4, 0x3, 0x9, + 0x11, 0x1d, 0x2e, 0x43, 0x56, 0x6f, 0x8a, 0xa4, 0xc6, 0xe2, 0x10a, 0x139, 0x16a, 0x1ad, 0x1e2, + 0x1b5, 0x17f, 0x147, 0x11c, 0xf9, 0xd7, 0xb6, 0x97, 0x7d, 0x67, 0x4f, 0x3a, 0x2c, 0x16, 0x8, + 0x3, 0x3, 0x7, 0x12, 0x1b, 0x2e, 0x41, 0x57, 0x71, 0x8b, 0xa7, 0xc3, 0xe0, 0x109, 0x137, + 0x168, 0x1a5, 0x1db, 0x1b1, 0x17f, 0x149, 0x11b, 0xfa, 0xd4, 0xb8, 0x96, 0x7f, 0x66, 0x50, 0x3d, + 0x37, 0x16, 0x8, 0x1, 0x0, 0x6, 0xf, 0x18, 0x2e, 0x42, 0x57, 0x6f, 0x89, 0xa4, 0xc2, + 0xe3, 0x107, 0x135, 0x16a, 0x1a3, 0x1df, 0x1b2, 0x17f, 0x149, 0x11b, 0xf8, 0xd8, 0xb9, 0x9a, 0x7f, + 0x67, 0x52, 0x41, 0x3c, 0x16, 0xb, 0x3, 0x3, 0x7, 0xf, 0x19, 0x30, 0x43, 0x58, 0x6d, + 0x88, 0xa3, 0xc6, 0xe4, 0x107, 0x134, 0x167, 0x1a2, 0x1dd, 0x1b9, 0x180, 0x148, 0x120, 0xf9, 0xd9, + 0xba, 0x9c, 0x82, 0x68, 0x54, 0x3f, 0x36, 0x19, 0xd, 0x5, 0x5, 0x9, 0x10, 0x1e, 0x2f, + 0x43, 0x5a, 0x70, 0x8b, 0xa6, 0xc5, 0xe5, 0x10a, 0x136, 0x167, 0x1a4, 0x1dd, 0x1b9, 0x183, 0x14b, + 0x122, 0xfe, 0xda, 0xbc, 0x9d, 0x84, 0x6a, 0x56, 0x41, 0x2e, 0x1e, 0xf, 0xb, 0xa, 0xc, + 0x14, 0x23, 0x34, 0x4a, 0x5e, 0x74, 0x8d, 0xab, 0xc6, 0xe7, 0x10a, 0x139, 0x16e, 0x1a8, 0x1e0, + 0x1c0, 0x18b, 0x150, 0x123, 0x100, 0xdd, 0xbf, 0xa5, 0x86, 0x6d, 0x5a, 0x46, 0x34, 0x24, 0x16, + 0x11, 0x10, 0x12, 0x18, 0x26, 0x39, 0x4c, 0x61, 0x7a, 0x91, 0xae, 0xcb, 0xec, 0x115, 0x13e, + 0x171, 0x1ab, 0x1e9, 0x1c5, 0x18d, 0x155, 0x12a, 0x106, 0xe3, 0xc2, 0xa6, 0x8c, 0x76, 0x5d, 0x4c, + 0x3c, 0x2c, 0x1f, 0x19, 0x18, 0x1a, 0x22, 0x30, 0x40, 0x51, 0x66, 0x81, 0x96, 0xb3, 0xd1, + 0xf1, 0x117, 0x141, 0x174, 0x1b3, 0x1ed, 0x1d0, 0x194, 0x15d, 0x132, 0x10b, 0xe7, 0xc9, 0xac, 0x93, + 0x7c, 0x66, 0x53, 0x43, 0x35, 0x26, 0x22, 0x1f, 0x23, 0x29, 0x37, 0x46, 0x56, 0x6d, 0x84, + 0x9f, 0xba, 0xd4, 0xf7, 0x11a, 0x148, 0x17d, 0x1bb, 0x1f3, 0x1d3, 0x19c, 0x166, 0x138, 0x113, 0xed, + 0xce, 0xb2, 0x98, 0x82, 0x70, 0x58, 0x48, 0x3d, 0x32, 0x2b, 0x2a, 0x2c, 0x34, 0x40, 0x50, + 0x5f, 0x75, 0x8b, 0xa3, 0xc0, 0xdb, 0xfe, 0x122, 0x14e, 0x184, 0x1c5, 0x205, 0x1e1, 0x1a7, 0x16e, + 0x13e, 0x11a, 0xf5, 0xd6, 0xbb, 0x9d, 0x87, 0x76, 0x62, 0x54, 0x45, 0x3c, 0x37, 0x35, 0x37, + 0x40, 0x4a, 0x59, 0x69, 0x7b, 0x93, 0xad, 0xc5, 0xe4, 0x101, 0x128, 0x153, 0x187, 0x1cd, 0x20a, + 0x1f0, 0x1b3, 0x177, 0x146, 0x120, 0xfe, 0xdc, 0xc5, 0xa8, 0x8f, 0x7d, 0x6c, 0x5d, 0x4f, 0x47, + 0x41, 0x3f, 0x44, 0x49, 0x54, 0x62, 0x74, 0x86, 0x9b, 0xb1, 0xd1, 0xf0, 0x10c, 0x132, 0x15e, + 0x197, 0x1d8, 0x211, 0x200, 0x1c4, 0x184, 0x157, 0x12c, 0x107, 0xe8, 0xd0, 0xb3, 0x9a, 0x87, 0x76, + 0x66, 0x5a, 0x51, 0x4f, 0x4d, 0x50, 0x55, 0x5e, 0x6d, 0x7f, 0x93, 0xa3, 0xbd, 0xd9, 0xf9, + 0x119, 0x13f, 0x16e, 0x1a2, 0x1e3, 0x21d, 0x20f, 0x1d0, 0x193, 0x163, 0x138, 0x112, 0xf0, 0xd6, 0xbc, + 0xa5, 0x94, 0x83, 0x73, 0x69, 0x61, 0x5a, 0x59, 0x5d, 0x60, 0x6b, 0x79, 0x8b, 0x9e, 0xb4, + 0xc7, 0xe3, 0x104, 0x121, 0x149, 0x17b, 0x1ae, 0x1f3, 0x22e, 0x214, 0x1de, 0x1a4, 0x16f, 0x145, 0x11d, + 0xfd, 0xe1, 0xc7, 0xb4, 0x9f, 0x8f, 0x82, 0x74, 0x6d, 0x67, 0x66, 0x6b, 0x6d, 0x7a, 0x86, + 0x96, 0xa8, 0xbf, 0xd7, 0xef, 0x10c, 0x12b, 0x155, 0x183, 0x1bd, 0x203, 0x246, 0x22c, 0x1f1, 0x1b2, + 0x17f, 0x151, 0x12c, 0x109, 0xed, 0xd4, 0xc2, 0xab, 0x9f, 0x91, 0x83, 0x7a, 0x75, 0x78, 0x7a, + 0x7e, 0x8a, 0x96, 0xa3, 0xb8, 0xcb, 0xe1, 0xfe, 0x11a, 0x13a, 0x165, 0x190, 0x1ce, 0x20f, 0x252, + 0x242, 0x201, 0x1c2, 0x18d, 0x161, 0x136, 0x119, 0xfd, 0xe4, 0xcc, 0xb9, 0xae, 0x9d, 0x94, 0x8f, + 0x88, 0x83, 0x86, 0x8d, 0x9a, 0xa3, 0xb1, 0xc4, 0xd8, 0xf1, 0x109, 0x12a, 0x148, 0x174, 0x1a4, + 0x1e1, 0x227, 0x26b, 0x258, 0x213, 0x1d4, 0x19f, 0x16f, 0x145, 0x128, 0x10a, 0xf1, 0xdc, 0xcc, 0xbd, + 0xb0, 0xa2, 0x9d, 0x98, 0x94, 0x98, 0x9f, 0xa8, 0xb2, 0xc1, 0xd6, 0xe9, 0x101, 0x118, 0x138, + 0x159, 0x183, 0x1b8, 0x1f6, 0x240, 0x287, 0x261, 0x221, 0x1de, 0x1ad, 0x17f, 0x150, 0x131, 0x11b, 0xfd, + 0xe6, 0xd8, 0xcc, 0xbc, 0xa9, 0xac, 0xa0, 0x9d, 0xa0, 0xa9, 0xb5, 0xbe, 0xcb, 0xe0, 0xf7, + 0x109, 0x123, 0x142, 0x166, 0x193, 0x1c9, 0x208, 0x24f, 0x28f, + }, + + /* Bgain */ + { + 0x28e, 0x248, 0x202, 0x1bf, 0x186, 0x15f, 0x12f, 0x10c, 0xfb, 0xda, 0xcc, 0xbe, 0xb4, 0xa9, 0xa4, + 0xa1, 0xa4, 0xa5, 0xa9, 0xb5, 0xba, 0xcd, 0xe2, 0xf4, 0x120, 0x15d, 0x14b, 0x170, 0x1a5, 0x1d5, + 0x220, 0x263, 0x2b6, 0x27c, 0x235, 0x1f1, 0x1af, 0x17b, 0x14d, 0x127, 0x105, 0xec, 0xd4, 0xc2, 0xb2, + 0xa3, 0x96, 0x92, 0x95, 0x93, 0x93, 0x9c, 0xa3, 0xb1, 0xc0, 0xd1, 0xe4, 0x105, 0x13e, 0x139, + 0x162, 0x193, 0x1cd, 0x207, 0x252, 0x29e, 0x251, 0x222, 0x1d8, 0x19f, 0x16e, 0x139, 0x114, 0xf4, 0xde, + 0xc4, 0xb3, 0xa2, 0x92, 0x88, 0x83, 0x82, 0x81, 0x7f, 0x88, 0x94, 0xa1, 0xac, 0xbe, 0xd2, + 0xec, 0x112, 0x128, 0x150, 0x17d, 0x1b0, 0x1f1, 0x239, 0x274, 0x239, 0x203, 0x1c2, 0x18e, 0x15e, 0x12c, + 0x105, 0xe9, 0xd1, 0xb9, 0xa7, 0x97, 0x86, 0x7b, 0x73, 0x6b, 0x6f, 0x6b, 0x76, 0x84, 0x8f, + 0x9e, 0xaf, 0xc1, 0xdb, 0xf6, 0x118, 0x13d, 0x165, 0x1a0, 0x1d8, 0x222, 0x266, 0x228, 0x1f5, 0x1ac, + 0x175, 0x144, 0x11d, 0xfc, 0xe3, 0xc2, 0xb0, 0x97, 0x89, 0x7c, 0x71, 0x67, 0x60, 0x61, 0x5e, + 0x67, 0x74, 0x7e, 0x8b, 0x9e, 0xb5, 0xcf, 0xe6, 0x107, 0x12b, 0x155, 0x18b, 0x1c9, 0x212, 0x252, + 0x208, 0x1d6, 0x19a, 0x161, 0x136, 0x10a, 0xed, 0xd9, 0xbe, 0xa4, 0x8d, 0x7e, 0x6e, 0x62, 0x5c, + 0x53, 0x53, 0x58, 0x5b, 0x62, 0x6f, 0x7e, 0x91, 0xa8, 0xbe, 0xd3, 0xf5, 0x11b, 0x144, 0x17a, + 0x1b2, 0x1ff, 0x23d, 0x1fa, 0x1ca, 0x183, 0x155, 0x12a, 0x104, 0xe4, 0xcb, 0xb0, 0x9b, 0x83, 0x75, + 0x61, 0x57, 0x4d, 0x4b, 0x48, 0x48, 0x50, 0x59, 0x67, 0x78, 0x86, 0x9d, 0xb4, 0xcb, 0xec, + 0x10d, 0x133, 0x165, 0x1a4, 0x1e5, 0x22c, 0x1ec, 0x1b8, 0x17d, 0x141, 0x11b, 0xf7, 0xda, 0xc1, 0xad, + 0x94, 0x7a, 0x64, 0x59, 0x4e, 0x45, 0x3e, 0x3d, 0x3b, 0x43, 0x4d, 0x5b, 0x6b, 0x81, 0x96, + 0xaa, 0xc6, 0xe0, 0x104, 0x128, 0x15c, 0x190, 0x1da, 0x215, 0x1da, 0x1ad, 0x16d, 0x139, 0x113, 0xed, + 0xcd, 0xb7, 0x9f, 0x89, 0x70, 0x61, 0x4e, 0x44, 0x3a, 0x32, 0x2f, 0x34, 0x3c, 0x45, 0x51, + 0x65, 0x75, 0x8d, 0xa0, 0xbc, 0xdb, 0xf7, 0x11e, 0x150, 0x185, 0x1cc, 0x201, 0x1d2, 0x1a1, 0x15d, + 0x12d, 0x10a, 0xe8, 0xca, 0xb1, 0x92, 0x80, 0x67, 0x57, 0x49, 0x38, 0x2f, 0x28, 0x27, 0x29, + 0x33, 0x3c, 0x48, 0x5d, 0x6e, 0x85, 0x9e, 0xb4, 0xd4, 0xf3, 0x119, 0x148, 0x17f, 0x1ba, 0x1f8, + 0x1c5, 0x19b, 0x15d, 0x129, 0x101, 0xe3, 0xc5, 0xa7, 0x8b, 0x77, 0x5b, 0x51, 0x41, 0x34, 0x24, + 0x1c, 0x1e, 0x22, 0x27, 0x33, 0x3d, 0x54, 0x65, 0x81, 0x93, 0xb2, 0xce, 0xeb, 0x114, 0x146, + 0x179, 0x1b4, 0x1fc, 0x1b8, 0x191, 0x158, 0x122, 0x103, 0xde, 0xbb, 0xa0, 0x8c, 0x71, 0x5c, 0x49, + 0x39, 0x2a, 0x1d, 0x16, 0x15, 0x1b, 0x21, 0x28, 0x3a, 0x4c, 0x5f, 0x7a, 0x8d, 0xa9, 0xc7, + 0xe4, 0x10c, 0x13d, 0x172, 0x1b3, 0x1ed, 0x1bc, 0x189, 0x150, 0x120, 0xfb, 0xd9, 0xbe, 0xa0, 0x87, + 0x6f, 0x57, 0x43, 0x30, 0x24, 0x17, 0x11, 0xd, 0x15, 0x18, 0x24, 0x37, 0x46, 0x5f, 0x72, + 0x8b, 0xa6, 0xbf, 0xe3, 0x105, 0x137, 0x16b, 0x1ad, 0x1e9, 0x1b6, 0x184, 0x148, 0x11c, 0xf6, 0xd4, + 0xb6, 0x9a, 0x87, 0x6a, 0x53, 0x3e, 0x2a, 0x1e, 0x11, 0x7, 0x9, 0xb, 0x13, 0x21, 0x34, + 0x47, 0x5b, 0x70, 0x8a, 0xa3, 0xc2, 0xe0, 0x106, 0x132, 0x168, 0x1ab, 0x1e4, 0x1ac, 0x181, 0x147, + 0x11a, 0xf1, 0xd3, 0xb8, 0x98, 0x80, 0x65, 0x4f, 0x42, 0x29, 0x1b, 0xf, 0x6, 0x5, 0x6, + 0x10, 0x1a, 0x32, 0x44, 0x5c, 0x72, 0x88, 0xa3, 0xc2, 0xe4, 0x107, 0x131, 0x160, 0x1a4, 0x1d4, + 0x1ad, 0x17c, 0x13e, 0x112, 0xf0, 0xd3, 0xb5, 0x94, 0x7d, 0x66, 0x52, 0x3c, 0x2a, 0x19, 0xa, + 0x2, 0x0, 0x6, 0x10, 0x1d, 0x2d, 0x44, 0x57, 0x6f, 0x8b, 0xa3, 0xbd, 0xde, 0xff, 0x131, + 0x160, 0x19e, 0x1d8, 0x1af, 0x17c, 0x143, 0x114, 0xf7, 0xd3, 0xb4, 0x92, 0x7d, 0x64, 0x4f, 0x3a, + 0x3a, 0x17, 0x7, 0x2, 0x1, 0x5, 0xc, 0x18, 0x2f, 0x41, 0x57, 0x70, 0x8b, 0xa5, 0xc0, + 0xdf, 0x102, 0x133, 0x15f, 0x1a3, 0x1d8, 0x1a8, 0x17d, 0x149, 0x119, 0xf2, 0xd2, 0xb5, 0x92, 0x7e, + 0x68, 0x4e, 0x43, 0x3b, 0x19, 0xc, 0x3, 0x3, 0x7, 0x11, 0x1d, 0x2f, 0x45, 0x5c, 0x73, + 0x8a, 0xa6, 0xc1, 0xe3, 0x109, 0x131, 0x15e, 0x1a5, 0x1d8, 0x1a8, 0x17f, 0x147, 0x119, 0xf5, 0xd7, + 0xb6, 0x9b, 0x80, 0x68, 0x51, 0x3f, 0x37, 0x1b, 0xc, 0x6, 0x5, 0xa, 0x10, 0x1d, 0x2f, + 0x43, 0x5a, 0x73, 0x8b, 0xa4, 0xc8, 0xe2, 0x108, 0x134, 0x163, 0x1a7, 0x1da, 0x1b3, 0x183, 0x14a, + 0x11d, 0xf9, 0xd5, 0xb9, 0x9f, 0x86, 0x6a, 0x56, 0x3f, 0x2d, 0x21, 0xd, 0x9, 0x7, 0xe, + 0x13, 0x22, 0x31, 0x4a, 0x56, 0x76, 0x8d, 0xaa, 0xca, 0xe6, 0x103, 0x137, 0x167, 0x1a9, 0x1e3, + 0x1bc, 0x18b, 0x151, 0x125, 0xfb, 0xd9, 0xba, 0xa0, 0x8a, 0x6b, 0x59, 0x46, 0x36, 0x24, 0x15, + 0x10, 0xf, 0x12, 0x1b, 0x27, 0x38, 0x4e, 0x62, 0x75, 0x92, 0xad, 0xc9, 0xed, 0x10e, 0x13a, + 0x171, 0x1ac, 0x1ec, 0x1b9, 0x190, 0x155, 0x12a, 0x106, 0xde, 0xc4, 0xa3, 0x8a, 0x70, 0x5d, 0x4c, + 0x3d, 0x2b, 0x1f, 0x1a, 0x18, 0x19, 0x22, 0x2e, 0x40, 0x52, 0x66, 0x81, 0x94, 0xad, 0xd3, + 0xed, 0x114, 0x13f, 0x175, 0x1b9, 0x1e8, 0x1cd, 0x199, 0x156, 0x12b, 0x105, 0xe3, 0xc6, 0xa7, 0x8c, + 0x77, 0x66, 0x53, 0x45, 0x39, 0x27, 0x20, 0x23, 0x21, 0x27, 0x36, 0x47, 0x57, 0x6f, 0x86, + 0x9a, 0xb8, 0xd8, 0xf6, 0x115, 0x146, 0x17e, 0x1c0, 0x1ee, 0x1d1, 0x19d, 0x165, 0x12f, 0x10b, 0xeb, + 0xcb, 0xae, 0x97, 0x82, 0x6c, 0x5c, 0x4b, 0x40, 0x32, 0x2a, 0x2a, 0x2d, 0x33, 0x3e, 0x4f, + 0x61, 0x75, 0x89, 0xa1, 0xbe, 0xda, 0xf9, 0x11d, 0x14b, 0x184, 0x1c4, 0x201, 0x1da, 0x1b4, 0x16c, + 0x13a, 0x110, 0xf0, 0xd2, 0xb6, 0x9e, 0x8d, 0x78, 0x65, 0x54, 0x47, 0x3d, 0x36, 0x38, 0x38, + 0x3e, 0x4a, 0x58, 0x69, 0x78, 0x92, 0xad, 0xbf, 0xe3, 0xff, 0x126, 0x152, 0x186, 0x1cd, 0x20d, + 0x1f1, 0x1bb, 0x17b, 0x14c, 0x11c, 0xf7, 0xda, 0xc4, 0xa6, 0x90, 0x7f, 0x6d, 0x5c, 0x51, 0x47, + 0x40, 0x43, 0x41, 0x4a, 0x55, 0x63, 0x71, 0x84, 0x9b, 0xad, 0xca, 0xe9, 0x106, 0x131, 0x15f, + 0x198, 0x1d8, 0x215, 0x201, 0x1ce, 0x18e, 0x157, 0x12b, 0x103, 0xe2, 0xc7, 0xb1, 0x9b, 0x87, 0x78, + 0x67, 0x5b, 0x54, 0x4d, 0x51, 0x4d, 0x58, 0x5f, 0x6c, 0x7b, 0x93, 0xa5, 0xb8, 0xd6, 0xf4, + 0x111, 0x13b, 0x16a, 0x1a3, 0x1e4, 0x229, 0x20d, 0x1de, 0x19d, 0x164, 0x13a, 0x10f, 0xf2, 0xd1, 0xbb, + 0xa9, 0x93, 0x7f, 0x73, 0x6a, 0x63, 0x5c, 0x59, 0x5f, 0x61, 0x6d, 0x77, 0x8a, 0xa0, 0xb0, + 0xc7, 0xdc, 0xf9, 0x11e, 0x146, 0x175, 0x1ad, 0x1f3, 0x22a, 0x217, 0x1e8, 0x1aa, 0x16f, 0x147, 0x119, + 0x100, 0xe2, 0xc8, 0xb8, 0xa0, 0x92, 0x82, 0x78, 0x6c, 0x6b, 0x66, 0x6c, 0x6c, 0x7b, 0x86, + 0x95, 0xa9, 0xbf, 0xd0, 0xed, 0x107, 0x124, 0x156, 0x182, 0x1bb, 0x201, 0x23b, 0x225, 0x1fb, 0x1b9, + 0x17f, 0x158, 0x128, 0x106, 0xf2, 0xd4, 0xc1, 0xb0, 0x9d, 0x8f, 0x86, 0x77, 0x79, 0x73, 0x79, + 0x7e, 0x89, 0x94, 0xa5, 0xb6, 0xcf, 0xdd, 0xf8, 0x118, 0x133, 0x15d, 0x190, 0x1cc, 0x20c, 0x254, + 0x232, 0x20a, 0x1c2, 0x18f, 0x165, 0x133, 0x117, 0xff, 0xe4, 0xcd, 0xbf, 0xb4, 0xa2, 0x96, 0x8c, + 0x85, 0x85, 0x87, 0x8a, 0x93, 0x9f, 0xb3, 0xc1, 0xd6, 0xeb, 0x106, 0x126, 0x147, 0x16b, 0x19e, + 0x1dd, 0x228, 0x26c, 0x259, 0x21e, 0x1d7, 0x1a3, 0x170, 0x143, 0x128, 0x10b, 0xf1, 0xdc, 0xcd, 0xbf, + 0xb0, 0xa4, 0x9d, 0x97, 0x96, 0x98, 0x97, 0xa1, 0xab, 0xc0, 0xd2, 0xe4, 0xf9, 0x116, 0x12e, + 0x15a, 0x17d, 0x1af, 0x1f5, 0x23c, 0x280, 0x262, 0x22a, 0x1ea, 0x1b1, 0x17c, 0x14d, 0x132, 0x11c, 0xf7, + 0xea, 0xd2, 0xca, 0xc0, 0xb4, 0xa9, 0xa2, 0x9f, 0xa3, 0xa5, 0xae, 0xb9, 0xc7, 0xd3, 0xed, + 0x102, 0x11f, 0x137, 0x15e, 0x184, 0x1bf, 0x206, 0x257, 0x289, + }, + }, + + { + /* Rgain */ + { + 0x399, 0x340, 0x2df, 0x289, 0x23e, 0x207, 0x1cd, 0x193, 0x170, 0x15f, 0x135, 0x113, 0xfc, 0xea, 0xdb, + 0xdd, 0xda, 0xd9, 0xe4, 0xee, 0xfd, 0x114, 0x12f, 0x14b, 0x16e, 0x19d, 0x1d4, 0x209, 0x24e, 0x29b, + 0x2ee, 0x364, 0x3e2, 0x38f, 0x329, 0x2c6, 0x276, 0x22a, 0x1ed, 0x1b5, 0x181, 0x15f, 0x147, 0x121, 0x102, + 0xf0, 0xd9, 0xd0, 0xc6, 0xc7, 0xcb, 0xd2, 0xdc, 0xee, 0x100, 0x11e, 0x138, 0x164, 0x18c, 0x1bb, + 0x1f4, 0x243, 0x286, 0x2d7, 0x341, 0x3a7, 0x372, 0x309, 0x2b0, 0x259, 0x20f, 0x1d6, 0x19a, 0x16c, 0x140, + 0x130, 0x109, 0xef, 0xdc, 0xc4, 0xb7, 0xb1, 0xaf, 0xb9, 0xbe, 0xc2, 0xd5, 0xeb, 0x105, 0x122, + 0x14c, 0x17a, 0x1a4, 0x1de, 0x225, 0x26f, 0x2b8, 0x319, 0x384, 0x355, 0x2ed, 0x290, 0x242, 0x1f7, 0x1bb, + 0x18a, 0x154, 0x12e, 0x10f, 0xee, 0xd8, 0xc6, 0xaf, 0xa7, 0x9b, 0x9c, 0xa6, 0xaa, 0xaf, 0xbe, + 0xd8, 0xf7, 0x110, 0x13a, 0x166, 0x191, 0x1c8, 0x216, 0x259, 0x2a3, 0x302, 0x365, 0x32a, 0x2d8, 0x276, + 0x229, 0x1e3, 0x1a6, 0x174, 0x140, 0x11c, 0xf6, 0xda, 0xc6, 0xaf, 0x9d, 0x92, 0x89, 0x88, 0x91, + 0x97, 0x9c, 0xac, 0xcb, 0xec, 0x102, 0x125, 0x150, 0x180, 0x1b6, 0x200, 0x247, 0x289, 0x2e8, 0x34f, + 0x30f, 0x2bb, 0x267, 0x213, 0x1cc, 0x194, 0x160, 0x130, 0x10d, 0xeb, 0xcc, 0xb1, 0x99, 0x87, 0x7c, + 0x77, 0x74, 0x79, 0x82, 0x8c, 0x9a, 0xba, 0xd7, 0xed, 0x115, 0x13c, 0x170, 0x1a4, 0x1e4, 0x22c, + 0x277, 0x2d2, 0x32a, 0x2f6, 0x2a9, 0x24f, 0x1ff, 0x1bd, 0x185, 0x14b, 0x124, 0xfd, 0xdb, 0xba, 0xa0, + 0x89, 0x76, 0x6c, 0x62, 0x61, 0x65, 0x71, 0x7b, 0x89, 0xa4, 0xc6, 0xde, 0x107, 0x129, 0x15a, + 0x191, 0x1c7, 0x213, 0x262, 0x2b4, 0x319, 0x2de, 0x28d, 0x23f, 0x1ef, 0x1b2, 0x179, 0x142, 0x114, 0xed, + 0xce, 0xa9, 0x8e, 0x79, 0x66, 0x5c, 0x51, 0x4f, 0x53, 0x5e, 0x6a, 0x76, 0x94, 0xae, 0xcf, + 0xf9, 0x11c, 0x14b, 0x17c, 0x1bf, 0x204, 0x248, 0x2a0, 0x2f5, 0x2c9, 0x282, 0x229, 0x1e0, 0x1a5, 0x16e, + 0x135, 0x109, 0xdb, 0xb8, 0x9b, 0x7d, 0x6a, 0x57, 0x4a, 0x41, 0x3f, 0x41, 0x4e, 0x5b, 0x6c, + 0x88, 0xa5, 0xc9, 0xeb, 0x112, 0x13e, 0x16f, 0x1b1, 0x1f5, 0x23d, 0x293, 0x2e3, 0x2bf, 0x271, 0x21c, + 0x1d1, 0x199, 0x15e, 0x129, 0xf9, 0xcf, 0xab, 0x92, 0x72, 0x5b, 0x47, 0x3b, 0x31, 0x2f, 0x32, + 0x3f, 0x4b, 0x60, 0x7b, 0x9c, 0xc1, 0xe7, 0x105, 0x136, 0x166, 0x1a6, 0x1ea, 0x232, 0x28d, 0x2d4, + 0x2b9, 0x262, 0x211, 0x1c7, 0x187, 0x14e, 0x11b, 0xef, 0xc9, 0xa2, 0x81, 0x63, 0x4d, 0x39, 0x2b, + 0x21, 0x21, 0x26, 0x2f, 0x3e, 0x58, 0x70, 0x8f, 0xb5, 0xda, 0xfb, 0x12a, 0x15c, 0x196, 0x1e1, + 0x229, 0x283, 0x2c8, 0x2ab, 0x25a, 0x205, 0x1bd, 0x178, 0x145, 0x111, 0xe8, 0xc1, 0x9a, 0x76, 0x5b, + 0x40, 0x2c, 0x1b, 0x15, 0x12, 0x19, 0x26, 0x36, 0x4e, 0x69, 0x80, 0xaa, 0xce, 0xf3, 0x122, + 0x153, 0x18a, 0x1d6, 0x21e, 0x277, 0x2c4, 0x29c, 0x24e, 0x1fb, 0x1b0, 0x16e, 0x13c, 0x10d, 0xe0, 0xb5, + 0x92, 0x6e, 0x53, 0x37, 0x1f, 0x11, 0x8, 0x7, 0x10, 0x1a, 0x2d, 0x46, 0x61, 0x7b, 0x9c, + 0xc3, 0xee, 0x118, 0x14a, 0x187, 0x1ca, 0x210, 0x268, 0x2b7, 0x291, 0x241, 0x1f2, 0x1ad, 0x170, 0x13a, + 0x10a, 0xdd, 0xb1, 0x8c, 0x69, 0x49, 0x30, 0x1c, 0xc, 0x1, 0x0, 0x8, 0x13, 0x26, 0x3f, + 0x58, 0x77, 0x97, 0xbc, 0xe9, 0x114, 0x146, 0x17c, 0x1c6, 0x20c, 0x261, 0x2aa, 0x2bc, 0x23c, 0x1f5, + 0x1b0, 0x16b, 0x134, 0x106, 0xde, 0xb1, 0x88, 0x61, 0x44, 0x2e, 0x17, 0x4, 0x0, 0x0, 0x4, + 0xe, 0x20, 0x3a, 0x54, 0x71, 0x95, 0xba, 0xe5, 0x113, 0x141, 0x17f, 0x1bd, 0x206, 0x258, 0x2a4, + 0x31e, 0x258, 0x1f8, 0x1ad, 0x168, 0x12f, 0x102, 0xd9, 0xaf, 0x84, 0x63, 0x44, 0x2d, 0x12, 0x3, + 0x5, 0x3, 0x1, 0xb, 0x1d, 0x36, 0x53, 0x6f, 0x92, 0xb2, 0xe5, 0x110, 0x13e, 0x17b, 0x1c1, + 0x204, 0x257, 0x2a7, 0x33a, 0x276, 0x1f3, 0x1a9, 0x165, 0x12f, 0xfd, 0xd3, 0xab, 0x85, 0x62, 0x44, + 0x2d, 0x13, 0x2, 0x3, 0x3, 0x2, 0x8, 0x1d, 0x35, 0x4d, 0x6e, 0x93, 0xb6, 0xe5, 0x10f, + 0x141, 0x179, 0x1ba, 0x202, 0x259, 0x29f, 0x336, 0x260, 0x1ef, 0x1a7, 0x166, 0x12b, 0xfd, 0xd3, 0xa7, + 0x85, 0x60, 0x42, 0x2e, 0x15, 0x5, 0x2, 0x3, 0x3, 0x9, 0x1d, 0x35, 0x4f, 0x6b, 0x91, + 0xb7, 0xe3, 0x111, 0x13f, 0x175, 0x1ba, 0x202, 0x255, 0x29b, 0x2f0, 0x239, 0x1e6, 0x1a5, 0x165, 0x12e, + 0x103, 0xd4, 0xac, 0x87, 0x63, 0x48, 0x30, 0x18, 0x7, 0x2, 0x1, 0x5, 0xb, 0x20, 0x36, + 0x51, 0x70, 0x96, 0xb8, 0xe4, 0x112, 0x13f, 0x176, 0x1b8, 0x208, 0x256, 0x2a4, 0x2a9, 0x256, 0x1ef, + 0x1aa, 0x16d, 0x134, 0x104, 0xda, 0xaf, 0x8b, 0x67, 0x4c, 0x31, 0x1d, 0xb, 0x5, 0x4, 0x8, + 0x10, 0x22, 0x3b, 0x55, 0x73, 0x94, 0xbb, 0xe6, 0x116, 0x144, 0x179, 0x1ba, 0x208, 0x25d, 0x2ad, + 0x2d2, 0x296, 0x1f4, 0x1b0, 0x171, 0x136, 0x106, 0xdc, 0xb6, 0x91, 0x70, 0x51, 0x38, 0x24, 0x15, + 0xb, 0xa, 0xd, 0x18, 0x28, 0x40, 0x5b, 0x78, 0x99, 0xbf, 0xed, 0x11c, 0x14b, 0x181, 0x1c3, + 0x20c, 0x267, 0x2ac, 0x2e8, 0x2ae, 0x1f8, 0x1b5, 0x175, 0x13e, 0x10e, 0xe4, 0xbc, 0x96, 0x78, 0x58, + 0x40, 0x2a, 0x1d, 0x17, 0x14, 0x1a, 0x24, 0x32, 0x46, 0x63, 0x7e, 0xa2, 0xc5, 0xf1, 0x11e, + 0x151, 0x188, 0x1c8, 0x213, 0x26e, 0x2b8, 0x2d0, 0x2a0, 0x202, 0x1bf, 0x17e, 0x144, 0x118, 0xec, 0xc0, + 0x9f, 0x7c, 0x60, 0x4a, 0x37, 0x2e, 0x2c, 0x1d, 0x23, 0x2e, 0x3d, 0x4f, 0x6b, 0x87, 0xad, + 0xcd, 0xf7, 0x122, 0x157, 0x190, 0x1ce, 0x21a, 0x271, 0x2bb, 0x2b0, 0x278, 0x20a, 0x1c6, 0x186, 0x14f, + 0x120, 0xf5, 0xcc, 0xa8, 0x89, 0x70, 0x58, 0x45, 0x41, 0x39, 0x2d, 0x30, 0x3a, 0x4b, 0x5e, + 0x74, 0x91, 0xb8, 0xd4, 0xfe, 0x133, 0x167, 0x19b, 0x1de, 0x220, 0x277, 0x2c7, 0x2be, 0x26f, 0x216, + 0x1dc, 0x194, 0x158, 0x12d, 0x101, 0xd9, 0xb5, 0x99, 0x78, 0x64, 0x53, 0x49, 0x47, 0x3d, 0x3d, + 0x48, 0x57, 0x68, 0x7f, 0x9d, 0xc0, 0xdd, 0x108, 0x13f, 0x16d, 0x1a3, 0x1e7, 0x229, 0x281, 0x2cf, + 0x2d2, 0x284, 0x225, 0x1e9, 0x1a8, 0x166, 0x136, 0x108, 0xe4, 0xc5, 0xa2, 0x87, 0x71, 0x63, 0x54, + 0x55, 0x4c, 0x4f, 0x58, 0x63, 0x79, 0x8c, 0xab, 0xca, 0xec, 0x116, 0x146, 0x174, 0x1ad, 0x1f2, + 0x23b, 0x291, 0x2e1, 0x2e4, 0x299, 0x236, 0x1f8, 0x1bb, 0x173, 0x144, 0x119, 0xf0, 0xcf, 0xb5, 0x9a, + 0x81, 0x72, 0x63, 0x5d, 0x62, 0x5f, 0x66, 0x74, 0x86, 0x9f, 0xb7, 0xd6, 0xfb, 0x11f, 0x14e, + 0x184, 0x1be, 0x1ff, 0x249, 0x2a3, 0x2ed, 0x2f4, 0x2a6, 0x256, 0x203, 0x1c0, 0x184, 0x156, 0x122, 0x100, + 0xe1, 0xc0, 0xa8, 0x95, 0x7f, 0x73, 0x70, 0x71, 0x6f, 0x78, 0x83, 0x93, 0xab, 0xc4, 0xe3, + 0x107, 0x12f, 0x161, 0x196, 0x1ce, 0x213, 0x25c, 0x2b2, 0x306, 0x30c, 0x2b8, 0x26c, 0x214, 0x1ce, 0x19b, + 0x164, 0x135, 0x110, 0xf2, 0xd4, 0xb9, 0xa4, 0x93, 0x86, 0x82, 0x7f, 0x7f, 0x86, 0x96, 0xa6, + 0xbd, 0xd7, 0xf2, 0x115, 0x140, 0x171, 0x1a6, 0x1da, 0x224, 0x270, 0x2c7, 0x31c, 0x322, 0x2cd, 0x27f, + 0x228, 0x1e2, 0x1ac, 0x177, 0x148, 0x123, 0x101, 0xe6, 0xcd, 0xb2, 0xa5, 0x99, 0x92, 0x8e, 0x90, + 0x9c, 0xa7, 0xb6, 0xce, 0xe8, 0x101, 0x127, 0x14f, 0x181, 0x1b9, 0x1f7, 0x23c, 0x287, 0x2df, 0x338, + 0x339, 0x2e8, 0x28d, 0x23c, 0x1fb, 0x1c0, 0x18d, 0x159, 0x133, 0x113, 0xf6, 0xdb, 0xc5, 0xba, 0xaa, + 0xa3, 0xa1, 0xa5, 0xae, 0xbb, 0xca, 0xde, 0xf8, 0x115, 0x138, 0x164, 0x195, 0x1e0, 0x210, 0x250, + 0x2a1, 0x2fb, 0x355, 0x35c, 0x309, 0x2a6, 0x257, 0x216, 0x1d3, 0x19d, 0x171, 0x144, 0x128, 0x107, 0xf1, + 0xdf, 0xce, 0xc2, 0xb8, 0xb4, 0xba, 0xc0, 0xcf, 0xdf, 0xf2, 0x10d, 0x128, 0x152, 0x177, 0x1b8, + 0x1fe, 0x228, 0x26e, 0x2bd, 0x316, 0x376, 0x37f, 0x318, 0x2be, 0x26e, 0x229, 0x1e5, 0x1b1, 0x17c, 0x159, + 0x137, 0x118, 0x100, 0xeb, 0xdc, 0xd3, 0xc6, 0xc6, 0xcc, 0xd4, 0xdd, 0xed, 0x102, 0x11f, 0x138, + 0x15d, 0x18b, 0x1cd, 0x207, 0x23d, 0x27d, 0x2cc, 0x331, 0x388, + }, + + /* Grgain */ + { + 0x324, 0x2cf, 0x279, 0x22e, 0x1f5, 0x1c7, 0x191, 0x168, 0x148, 0x136, 0x113, 0xf4, 0xe4, 0xd4, 0xcd, + 0xc9, 0xc9, 0xcc, 0xd4, 0xe2, 0xf2, 0x103, 0x11f, 0x139, 0x164, 0x186, 0x1b6, 0x1eb, 0x22c, 0x270, + 0x2ba, 0x321, 0x392, 0x30d, 0x2b7, 0x267, 0x220, 0x1e1, 0x1b4, 0x183, 0x156, 0x13a, 0x126, 0x105, 0xe6, + 0xd7, 0xc3, 0xbd, 0xb8, 0xb7, 0xbf, 0xc5, 0xd0, 0xe4, 0xf3, 0x10e, 0x12b, 0x151, 0x17a, 0x1a5, + 0x1d8, 0x21f, 0x260, 0x2a7, 0x305, 0x367, 0x2f1, 0x29d, 0x250, 0x207, 0x1cb, 0x19a, 0x16c, 0x141, 0x11f, + 0x10f, 0xe9, 0xd6, 0xc2, 0xae, 0xa8, 0xa5, 0xa5, 0xae, 0xb1, 0xba, 0xcf, 0xe0, 0xfa, 0x115, + 0x13d, 0x16a, 0x193, 0x1c0, 0x208, 0x245, 0x28d, 0x2eb, 0x349, 0x2d2, 0x284, 0x238, 0x1f8, 0x1b8, 0x182, + 0x15b, 0x130, 0x109, 0xec, 0xd6, 0xc5, 0xb1, 0x9c, 0x92, 0x8f, 0x8d, 0x97, 0xa0, 0xa6, 0xb8, + 0xd1, 0xef, 0x106, 0x12c, 0x155, 0x17c, 0x1ae, 0x1f5, 0x235, 0x275, 0x2cd, 0x32d, 0x2b8, 0x26d, 0x225, + 0x1e2, 0x1a9, 0x173, 0x148, 0x11f, 0xfa, 0xdf, 0xc5, 0xaf, 0x9c, 0x89, 0x80, 0x7c, 0x7e, 0x88, + 0x8e, 0x96, 0xa5, 0xc5, 0xe3, 0xf7, 0x11b, 0x142, 0x16e, 0x1a1, 0x1e6, 0x227, 0x266, 0x2b8, 0x316, + 0x29c, 0x259, 0x213, 0x1cf, 0x197, 0x165, 0x138, 0x111, 0xf1, 0xd0, 0xb4, 0x9e, 0x8b, 0x7b, 0x71, + 0x6a, 0x6d, 0x72, 0x7d, 0x85, 0x94, 0xb3, 0xd1, 0xe8, 0x10b, 0x134, 0x15e, 0x192, 0x1d1, 0x210, + 0x255, 0x2a7, 0x2fe, 0x28b, 0x247, 0x201, 0x1bf, 0x18e, 0x15b, 0x12a, 0x104, 0xe4, 0xc4, 0xa5, 0x8e, + 0x79, 0x6b, 0x60, 0x5b, 0x59, 0x5d, 0x6a, 0x77, 0x85, 0xa0, 0xbf, 0xd8, 0xfe, 0x120, 0x151, + 0x183, 0x1b7, 0x1f8, 0x243, 0x28e, 0x2e3, 0x27a, 0x239, 0x1ef, 0x1b4, 0x183, 0x151, 0x11b, 0xf6, 0xd3, + 0xb5, 0x96, 0x7d, 0x6b, 0x5b, 0x4d, 0x49, 0x49, 0x4b, 0x58, 0x66, 0x77, 0x94, 0xaa, 0xc9, + 0xf3, 0x115, 0x143, 0x176, 0x1aa, 0x1e7, 0x231, 0x281, 0x2cc, 0x26b, 0x22a, 0x1e5, 0x1a6, 0x174, 0x144, + 0x111, 0xe8, 0xc4, 0xa5, 0x88, 0x70, 0x5d, 0x4d, 0x40, 0x39, 0x39, 0x3e, 0x4a, 0x59, 0x69, + 0x86, 0xa2, 0xca, 0xea, 0x10b, 0x137, 0x168, 0x19e, 0x1dd, 0x223, 0x272, 0x2b8, 0x25d, 0x21c, 0x1d8, + 0x199, 0x168, 0x137, 0x107, 0xe0, 0xbc, 0x9b, 0x81, 0x66, 0x51, 0x40, 0x33, 0x2c, 0x2d, 0x2d, + 0x3c, 0x4c, 0x5f, 0x7b, 0x9a, 0xc2, 0xe2, 0x100, 0x131, 0x15d, 0x196, 0x1d6, 0x21d, 0x26b, 0x2ad, + 0x253, 0x214, 0x1cd, 0x18f, 0x159, 0x12c, 0xfc, 0xd7, 0xb2, 0x93, 0x73, 0x59, 0x43, 0x34, 0x26, + 0x20, 0x1e, 0x22, 0x30, 0x3f, 0x57, 0x70, 0x90, 0xb8, 0xd8, 0xf7, 0x124, 0x154, 0x188, 0x1d0, + 0x211, 0x262, 0x2a4, 0x24f, 0x208, 0x1c2, 0x189, 0x150, 0x121, 0xf4, 0xd0, 0xac, 0x89, 0x6b, 0x4e, + 0x3b, 0x28, 0x18, 0x15, 0xf, 0x18, 0x25, 0x36, 0x50, 0x69, 0x83, 0xac, 0xcb, 0xef, 0x11e, + 0x14b, 0x180, 0x1c7, 0x206, 0x25a, 0x2a3, 0x247, 0x201, 0x1bd, 0x180, 0x14c, 0x119, 0xf2, 0xcb, 0xa4, + 0x82, 0x65, 0x47, 0x31, 0x1d, 0x10, 0x8, 0x6, 0xe, 0x1a, 0x2f, 0x49, 0x61, 0x7c, 0x9e, + 0xc3, 0xec, 0x116, 0x143, 0x17a, 0x1c0, 0x201, 0x24c, 0x292, 0x23a, 0x1f7, 0x1b8, 0x17b, 0x146, 0x116, + 0xf0, 0xc8, 0xa2, 0x7e, 0x5e, 0x43, 0x2c, 0x17, 0x7, 0x0, 0x0, 0x8, 0x16, 0x28, 0x43, + 0x59, 0x77, 0x99, 0xbc, 0xe4, 0x113, 0x141, 0x178, 0x1b7, 0x1fa, 0x246, 0x28c, 0x263, 0x1f3, 0x1b6, + 0x17e, 0x141, 0x114, 0xec, 0xc6, 0xa1, 0x7a, 0x5a, 0x3e, 0x26, 0xf, 0x3, 0x2, 0x1, 0x4, + 0xf, 0x22, 0x3f, 0x56, 0x74, 0x96, 0xb9, 0xe2, 0x111, 0x13d, 0x172, 0x1b3, 0x1f3, 0x240, 0x285, + 0x2c8, 0x207, 0x1b7, 0x17e, 0x13f, 0x112, 0xe8, 0xc4, 0x9e, 0x77, 0x56, 0x3b, 0x24, 0xe, 0x2, + 0x6, 0x1, 0x1, 0xb, 0x21, 0x3b, 0x52, 0x70, 0x97, 0xb8, 0xe2, 0x111, 0x13c, 0x171, 0x1b3, + 0x1ed, 0x240, 0x27f, 0x2dc, 0x224, 0x1b4, 0x17b, 0x13e, 0x10d, 0xe6, 0xbf, 0x98, 0x76, 0x56, 0x3c, + 0x25, 0x10, 0x1, 0x6, 0x5, 0x4, 0xb, 0x1f, 0x38, 0x51, 0x71, 0x94, 0xb8, 0xe3, 0x10e, + 0x13d, 0x16f, 0x1b2, 0x1ed, 0x23e, 0x281, 0x2d0, 0x20f, 0x1b3, 0x17b, 0x140, 0x112, 0xe5, 0xbe, 0x98, + 0x77, 0x57, 0x3c, 0x27, 0x14, 0x3, 0x3, 0x2, 0x5, 0xb, 0x20, 0x38, 0x52, 0x73, 0x93, + 0xb7, 0xe3, 0x10e, 0x13a, 0x16e, 0x1b0, 0x1ef, 0x23f, 0x27e, 0x291, 0x1f1, 0x1af, 0x177, 0x142, 0x111, + 0xe5, 0xc3, 0x9d, 0x79, 0x5a, 0x3d, 0x2b, 0x13, 0x7, 0x2, 0x2, 0x6, 0xe, 0x22, 0x3c, + 0x54, 0x74, 0x96, 0xbb, 0xe6, 0x10f, 0x13c, 0x170, 0x1b1, 0x1f0, 0x23f, 0x27f, 0x251, 0x209, 0x1b6, + 0x17d, 0x144, 0x116, 0xe9, 0xc5, 0x9f, 0x7e, 0x5f, 0x44, 0x2d, 0x1a, 0xa, 0x5, 0x7, 0x9, + 0x13, 0x28, 0x3f, 0x5a, 0x75, 0x99, 0xbb, 0xe8, 0x112, 0x13d, 0x176, 0x1b2, 0x1f4, 0x245, 0x287, + 0x28d, 0x244, 0x1b7, 0x17f, 0x14b, 0x118, 0xee, 0xc7, 0xa5, 0x83, 0x64, 0x4c, 0x35, 0x22, 0x13, + 0xd, 0xa, 0xf, 0x1c, 0x2d, 0x42, 0x5e, 0x7d, 0x9d, 0xbe, 0xed, 0x116, 0x145, 0x17b, 0x1b6, + 0x1f8, 0x24a, 0x28c, 0x29f, 0x259, 0x1bb, 0x184, 0x14f, 0x11f, 0xf4, 0xcd, 0xa7, 0x8c, 0x6e, 0x52, + 0x3d, 0x29, 0x1c, 0x19, 0x14, 0x1a, 0x26, 0x36, 0x4a, 0x65, 0x84, 0xa7, 0xc8, 0xef, 0x11e, + 0x14d, 0x181, 0x1b9, 0x200, 0x252, 0x296, 0x27e, 0x253, 0x1c3, 0x18a, 0x156, 0x126, 0xfc, 0xd8, 0xb1, + 0x96, 0x76, 0x5b, 0x46, 0x34, 0x2e, 0x2d, 0x1f, 0x26, 0x2f, 0x3f, 0x55, 0x6c, 0x8c, 0xb3, + 0xd1, 0xf2, 0x127, 0x154, 0x185, 0x1c3, 0x207, 0x254, 0x2a5, 0x254, 0x220, 0x1d0, 0x195, 0x15b, 0x12d, + 0x105, 0xe0, 0xba, 0x9d, 0x7f, 0x66, 0x52, 0x3f, 0x40, 0x39, 0x30, 0x31, 0x3e, 0x4f, 0x63, + 0x78, 0x98, 0xb9, 0xd8, 0xfe, 0x135, 0x162, 0x18e, 0x1cc, 0x20c, 0x25e, 0x2a0, 0x265, 0x222, 0x1d8, + 0x1a8, 0x169, 0x134, 0x111, 0xe7, 0xc5, 0xa7, 0x8a, 0x71, 0x5c, 0x4e, 0x49, 0x48, 0x3f, 0x40, + 0x4c, 0x5c, 0x6e, 0x81, 0xa0, 0xc2, 0xe2, 0x107, 0x13b, 0x169, 0x199, 0x1d5, 0x215, 0x268, 0x2ac, + 0x277, 0x235, 0x1e4, 0x1b6, 0x179, 0x141, 0x11a, 0xf4, 0xd1, 0xb3, 0x99, 0x7d, 0x6c, 0x5c, 0x51, + 0x53, 0x4f, 0x4f, 0x5a, 0x69, 0x7a, 0x8f, 0xab, 0xcb, 0xec, 0x112, 0x145, 0x16f, 0x1a6, 0x1e1, + 0x221, 0x270, 0x2bd, 0x282, 0x244, 0x1f2, 0x1c0, 0x188, 0x14f, 0x125, 0xff, 0xde, 0xbe, 0xa5, 0x8f, + 0x79, 0x6c, 0x5e, 0x5e, 0x63, 0x60, 0x67, 0x75, 0x89, 0xa0, 0xb8, 0xd8, 0xf8, 0x11e, 0x14c, + 0x178, 0x1ae, 0x1ec, 0x231, 0x282, 0x2cb, 0x293, 0x24c, 0x20d, 0x1cb, 0x18f, 0x15e, 0x130, 0x10b, 0xea, + 0xce, 0xb3, 0x9d, 0x8c, 0x7a, 0x70, 0x70, 0x70, 0x70, 0x76, 0x87, 0x96, 0xae, 0xc7, 0xe3, + 0x106, 0x12d, 0x15b, 0x18a, 0x1bb, 0x1f9, 0x242, 0x28f, 0x2dc, 0x2a6, 0x25e, 0x221, 0x1d6, 0x19c, 0x16e, + 0x141, 0x11a, 0xfb, 0xdd, 0xc2, 0xad, 0x9a, 0x8b, 0x82, 0x7e, 0x7d, 0x7c, 0x88, 0x97, 0xa6, + 0xbd, 0xd6, 0xf3, 0x114, 0x13b, 0x168, 0x197, 0x1cd, 0x209, 0x257, 0x2a7, 0x2f4, 0x2b9, 0x271, 0x230, + 0x1e8, 0x1b0, 0x17d, 0x152, 0x12a, 0x10d, 0xee, 0xd4, 0xbf, 0xaa, 0x9c, 0x93, 0x90, 0x8e, 0x90, + 0x99, 0xa8, 0xb8, 0xce, 0xe6, 0x103, 0x124, 0x14d, 0x179, 0x1ad, 0x1e0, 0x21e, 0x268, 0x2b7, 0x306, + 0x2cd, 0x291, 0x240, 0x1fc, 0x1c2, 0x190, 0x166, 0x13c, 0x11e, 0xfe, 0xe7, 0xcf, 0xbc, 0xb1, 0xa8, + 0xa3, 0xa0, 0xa3, 0xac, 0xba, 0xca, 0xe0, 0xf7, 0x114, 0x138, 0x15e, 0x18a, 0x1d0, 0x1f8, 0x233, + 0x27d, 0x2cf, 0x31d, 0x2ef, 0x2a9, 0x257, 0x213, 0x1db, 0x1a8, 0x178, 0x151, 0x12d, 0x111, 0xf8, 0xe4, + 0xd4, 0xc7, 0xbb, 0xb2, 0xb6, 0xb5, 0xc1, 0xcd, 0xdf, 0xf2, 0x10b, 0x126, 0x14c, 0x173, 0x1ac, + 0x1ee, 0x20f, 0x250, 0x295, 0x2ea, 0x33b, 0x317, 0x2b7, 0x268, 0x228, 0x1ef, 0x1b5, 0x189, 0x161, 0x13b, + 0x121, 0x106, 0xf0, 0xde, 0xd7, 0xc9, 0xc2, 0xc3, 0xc8, 0xd3, 0xd9, 0xed, 0x100, 0x119, 0x133, + 0x15a, 0x189, 0x1c1, 0x1fd, 0x221, 0x260, 0x2a9, 0x302, 0x357, + }, + + /* Gbgain */ + { + 0x32b, 0x2cd, 0x277, 0x232, 0x1f2, 0x1c6, 0x18f, 0x166, 0x148, 0x136, 0x116, 0xf5, 0xe3, 0xd5, 0xc9, + 0xc8, 0xc9, 0xc9, 0xd5, 0xdf, 0xf1, 0x102, 0x11c, 0x138, 0x15a, 0x187, 0x1b4, 0x1e7, 0x22d, 0x270, + 0x2bd, 0x323, 0x38d, 0x313, 0x2b9, 0x267, 0x21e, 0x1e1, 0x1b1, 0x182, 0x154, 0x13b, 0x124, 0x104, 0xe7, + 0xd9, 0xc5, 0xbb, 0xb4, 0xb6, 0xbf, 0xc4, 0xd1, 0xe3, 0xf4, 0x10d, 0x12b, 0x151, 0x178, 0x1a4, + 0x1d7, 0x21b, 0x25d, 0x2a6, 0x306, 0x367, 0x2f4, 0x29e, 0x24d, 0x20b, 0x1ca, 0x198, 0x16d, 0x141, 0x11b, + 0x10d, 0xea, 0xd1, 0xc4, 0xb1, 0xa8, 0xa3, 0xa3, 0xb0, 0xb3, 0xb9, 0xc9, 0xdf, 0xfb, 0x116, + 0x13d, 0x168, 0x190, 0x1c2, 0x204, 0x243, 0x28e, 0x2ec, 0x348, 0x2da, 0x285, 0x239, 0x1f6, 0x1b9, 0x187, + 0x15a, 0x12d, 0x10a, 0xef, 0xd3, 0xbf, 0xb0, 0x9e, 0x92, 0x8e, 0x91, 0x9a, 0x9f, 0xa6, 0xb6, + 0xce, 0xeb, 0x102, 0x12d, 0x159, 0x17b, 0x1b3, 0x1f7, 0x235, 0x27b, 0x2d0, 0x32a, 0x2b8, 0x26e, 0x221, + 0x1e4, 0x1a8, 0x176, 0x149, 0x11e, 0xfe, 0xdf, 0xc5, 0xaf, 0x9b, 0x8c, 0x80, 0x7e, 0x7a, 0x89, + 0x8e, 0x98, 0xa6, 0xc4, 0xe2, 0xf5, 0x119, 0x142, 0x16f, 0x19f, 0x1e4, 0x227, 0x269, 0x2ba, 0x315, + 0x2a3, 0x25b, 0x213, 0x1d0, 0x193, 0x163, 0x137, 0x10e, 0xee, 0xd2, 0xb5, 0xa0, 0x8a, 0x7a, 0x71, + 0x6b, 0x6a, 0x71, 0x7c, 0x84, 0x95, 0xb2, 0xcf, 0xe9, 0x109, 0x133, 0x160, 0x18e, 0x1cd, 0x210, + 0x253, 0x2a1, 0x2fb, 0x28e, 0x249, 0x201, 0x1bf, 0x18a, 0x157, 0x12d, 0x103, 0xe3, 0xc4, 0xa2, 0x8e, + 0x78, 0x69, 0x60, 0x5a, 0x58, 0x5d, 0x6c, 0x76, 0x86, 0xa1, 0xc0, 0xdb, 0xfc, 0x11f, 0x14e, + 0x182, 0x1b9, 0x1f8, 0x242, 0x290, 0x2e7, 0x279, 0x238, 0x1ef, 0x1b4, 0x180, 0x152, 0x123, 0xf5, 0xd4, + 0xb5, 0x95, 0x7e, 0x6b, 0x59, 0x50, 0x48, 0x47, 0x4e, 0x58, 0x66, 0x75, 0x92, 0xaa, 0xca, + 0xf1, 0x114, 0x13f, 0x171, 0x1ab, 0x1e9, 0x233, 0x27f, 0x2c9, 0x270, 0x22b, 0x1e1, 0x1a5, 0x178, 0x147, + 0x115, 0xea, 0xc5, 0xa5, 0x8a, 0x73, 0x5e, 0x4d, 0x41, 0x3b, 0x3a, 0x3d, 0x4b, 0x59, 0x6a, + 0x84, 0xa2, 0xc5, 0xe7, 0x10c, 0x136, 0x165, 0x19e, 0x1de, 0x225, 0x271, 0x2bd, 0x268, 0x222, 0x1da, + 0x19f, 0x168, 0x137, 0x108, 0xdf, 0xbb, 0x9a, 0x7f, 0x64, 0x52, 0x40, 0x35, 0x2c, 0x2c, 0x2d, + 0x3d, 0x4b, 0x5f, 0x7a, 0x9b, 0xc2, 0xe1, 0x101, 0x12e, 0x15c, 0x198, 0x1d9, 0x21e, 0x26a, 0x2ae, + 0x258, 0x217, 0x1ce, 0x193, 0x15c, 0x12a, 0xff, 0xd5, 0xb1, 0x94, 0x75, 0x59, 0x44, 0x32, 0x26, + 0x1e, 0x1e, 0x20, 0x30, 0x41, 0x57, 0x70, 0x8d, 0xb6, 0xd7, 0xf7, 0x125, 0x155, 0x18c, 0x1d2, + 0x212, 0x261, 0x2a7, 0x24f, 0x20b, 0x1c5, 0x188, 0x154, 0x122, 0xf8, 0xce, 0xac, 0x8e, 0x6c, 0x52, + 0x3a, 0x27, 0x19, 0x13, 0x10, 0x18, 0x24, 0x36, 0x50, 0x68, 0x82, 0xaa, 0xca, 0xee, 0x11e, + 0x14d, 0x182, 0x1c2, 0x205, 0x259, 0x29d, 0x241, 0x201, 0x1bd, 0x184, 0x14f, 0x11c, 0xf2, 0xcc, 0xa5, + 0x85, 0x65, 0x4a, 0x30, 0x1e, 0x11, 0x7, 0x7, 0xd, 0x1b, 0x2f, 0x48, 0x5f, 0x7d, 0x9e, + 0xc3, 0xeb, 0x118, 0x148, 0x17b, 0x1c0, 0x1ff, 0x24d, 0x297, 0x23b, 0x1fa, 0x1b8, 0x17d, 0x149, 0x116, + 0xee, 0xcc, 0xa3, 0x80, 0x60, 0x44, 0x2a, 0x18, 0x7, 0x0, 0x0, 0x9, 0x14, 0x28, 0x43, + 0x58, 0x78, 0x98, 0xbd, 0xe7, 0x113, 0x142, 0x172, 0x1b4, 0x1fa, 0x245, 0x28a, 0x26b, 0x1fb, 0x1ba, + 0x180, 0x147, 0x117, 0xef, 0xca, 0xa1, 0x7c, 0x5b, 0x40, 0x28, 0x11, 0x4, 0x3, 0x1, 0x6, + 0x10, 0x23, 0x3e, 0x55, 0x75, 0x98, 0xba, 0xe5, 0x112, 0x13e, 0x171, 0x1b0, 0x1f4, 0x23e, 0x28b, + 0x2ca, 0x20e, 0x1bd, 0x17f, 0x142, 0x114, 0xe8, 0xc5, 0x9e, 0x79, 0x5a, 0x3b, 0x27, 0x10, 0x2, + 0x4, 0x2, 0x0, 0xb, 0x21, 0x37, 0x54, 0x73, 0x95, 0xb9, 0xe3, 0x111, 0x13c, 0x170, 0x1b0, + 0x1f2, 0x23e, 0x286, 0x2de, 0x22a, 0x1b6, 0x17e, 0x140, 0x113, 0xe5, 0xbe, 0x98, 0x79, 0x5a, 0x3a, + 0x27, 0x11, 0x1, 0x3, 0x5, 0x3, 0xb, 0x21, 0x37, 0x52, 0x71, 0x92, 0xb8, 0xe3, 0x10f, + 0x13c, 0x171, 0x1b3, 0x1f2, 0x239, 0x27f, 0x2d6, 0x215, 0x1b0, 0x179, 0x13d, 0x113, 0xe7, 0xbe, 0x99, + 0x79, 0x58, 0x3e, 0x29, 0x15, 0x4, 0x1, 0x4, 0x5, 0xb, 0x1f, 0x39, 0x53, 0x73, 0x94, + 0xb8, 0xe1, 0x10d, 0x138, 0x16d, 0x1b2, 0x1f2, 0x23d, 0x281, 0x293, 0x1f4, 0x1b0, 0x179, 0x144, 0x114, + 0xe6, 0xc0, 0x9c, 0x7c, 0x5a, 0x41, 0x2c, 0x16, 0x7, 0x2, 0x4, 0x7, 0xe, 0x21, 0x39, + 0x56, 0x74, 0x96, 0xbc, 0xe4, 0x10f, 0x139, 0x16e, 0x1ae, 0x1f4, 0x242, 0x282, 0x253, 0x210, 0x1b5, + 0x17d, 0x146, 0x115, 0xec, 0xc4, 0x9e, 0x82, 0x5e, 0x46, 0x2e, 0x1a, 0xb, 0x6, 0x7, 0x9, + 0x14, 0x25, 0x3f, 0x59, 0x78, 0x99, 0xbb, 0xe6, 0x114, 0x13d, 0x175, 0x1b1, 0x1f5, 0x247, 0x287, + 0x285, 0x24a, 0x1ba, 0x182, 0x14b, 0x11b, 0xef, 0xca, 0xa5, 0x84, 0x66, 0x4a, 0x36, 0x23, 0x15, + 0xf, 0xb, 0x10, 0x1d, 0x2c, 0x46, 0x5f, 0x7c, 0x9e, 0xc1, 0xeb, 0x117, 0x143, 0x17c, 0x1b8, + 0x1f8, 0x249, 0x293, 0x298, 0x25e, 0x1c1, 0x188, 0x151, 0x120, 0xf3, 0xcf, 0xac, 0x8e, 0x6e, 0x54, + 0x3f, 0x2a, 0x1d, 0x1b, 0x13, 0x1a, 0x26, 0x37, 0x4c, 0x67, 0x83, 0xa9, 0xc6, 0xf2, 0x11f, + 0x14a, 0x182, 0x1ba, 0x1fe, 0x250, 0x292, 0x27c, 0x251, 0x1c5, 0x18b, 0x159, 0x129, 0xfd, 0xd6, 0xb1, + 0x96, 0x79, 0x5b, 0x47, 0x34, 0x2e, 0x2d, 0x1f, 0x25, 0x33, 0x41, 0x56, 0x6e, 0x8e, 0xb3, + 0xce, 0xf5, 0x129, 0x155, 0x187, 0x1c3, 0x206, 0x254, 0x295, 0x258, 0x226, 0x1d0, 0x196, 0x162, 0x12d, + 0x105, 0xe0, 0xba, 0x9e, 0x80, 0x66, 0x50, 0x42, 0x40, 0x39, 0x31, 0x31, 0x40, 0x4f, 0x62, + 0x79, 0x99, 0xb9, 0xd9, 0xfe, 0x131, 0x164, 0x192, 0x1ca, 0x20e, 0x25b, 0x2a3, 0x266, 0x223, 0x1db, + 0x1ab, 0x16d, 0x13a, 0x111, 0xe8, 0xc6, 0xa9, 0x8d, 0x72, 0x5f, 0x50, 0x49, 0x45, 0x3f, 0x41, + 0x4a, 0x5d, 0x6f, 0x82, 0xa3, 0xc3, 0xe1, 0x108, 0x13a, 0x16b, 0x19c, 0x1d5, 0x219, 0x265, 0x2ac, + 0x277, 0x237, 0x1e4, 0x1b4, 0x17b, 0x143, 0x11c, 0xf3, 0xd2, 0xb3, 0x98, 0x81, 0x6d, 0x5e, 0x52, + 0x51, 0x4c, 0x52, 0x58, 0x69, 0x7b, 0x90, 0xac, 0xcb, 0xeb, 0x112, 0x142, 0x171, 0x1a2, 0x1e0, + 0x227, 0x274, 0x2b9, 0x280, 0x247, 0x1f4, 0x1c2, 0x18a, 0x14d, 0x126, 0xff, 0xde, 0xbf, 0xa5, 0x90, + 0x7e, 0x6e, 0x61, 0x5e, 0x61, 0x60, 0x67, 0x75, 0x87, 0x9d, 0xbd, 0xd9, 0xf6, 0x11f, 0x14e, + 0x17a, 0x1ae, 0x1ec, 0x232, 0x282, 0x2cb, 0x29a, 0x24f, 0x20e, 0x1cb, 0x191, 0x161, 0x133, 0x10d, 0xea, + 0xce, 0xb3, 0x9f, 0x8a, 0x7c, 0x71, 0x6f, 0x72, 0x6e, 0x79, 0x88, 0x96, 0xad, 0xca, 0xe5, + 0x107, 0x12e, 0x15c, 0x18c, 0x1bd, 0x1fa, 0x243, 0x292, 0x2de, 0x2ae, 0x25d, 0x21f, 0x1d7, 0x1a0, 0x16f, + 0x141, 0x11a, 0xf8, 0xde, 0xc4, 0xad, 0x99, 0x8c, 0x84, 0x80, 0x7f, 0x7f, 0x89, 0x97, 0xa6, + 0xbd, 0xd4, 0xf4, 0x115, 0x13b, 0x169, 0x19a, 0x1d1, 0x206, 0x255, 0x2a3, 0x2f2, 0x2bd, 0x275, 0x22f, + 0x1eb, 0x1b0, 0x17f, 0x151, 0x12d, 0x10c, 0xef, 0xd5, 0xbe, 0xae, 0x9e, 0x97, 0x90, 0x8e, 0x91, + 0x9c, 0xa8, 0xb9, 0xcd, 0xe5, 0x105, 0x124, 0x14d, 0x177, 0x1ae, 0x1e4, 0x220, 0x26b, 0x2b9, 0x307, + 0x2d4, 0x296, 0x243, 0x1fe, 0x1c6, 0x193, 0x165, 0x13f, 0x11a, 0x100, 0xe6, 0xd1, 0xc0, 0xb5, 0xa8, + 0xa0, 0xa0, 0xa5, 0xaa, 0xb8, 0xca, 0xe0, 0xfc, 0x115, 0x137, 0x15d, 0x18a, 0x1ce, 0x1f9, 0x236, + 0x282, 0x2d4, 0x324, 0x2f8, 0x2ab, 0x25d, 0x215, 0x1de, 0x1a9, 0x17c, 0x150, 0x12e, 0x110, 0xfb, 0xe6, + 0xd2, 0xc6, 0xba, 0xb6, 0xb6, 0xba, 0xc2, 0xcd, 0xdd, 0xf4, 0x10a, 0x127, 0x14b, 0x171, 0x1aa, + 0x1ec, 0x20f, 0x252, 0x29a, 0x2e9, 0x341, 0x310, 0x2b8, 0x26a, 0x22f, 0x1f0, 0x1b7, 0x18a, 0x15b, 0x13d, + 0x11f, 0x108, 0xf2, 0xde, 0xd4, 0xca, 0xc4, 0xc3, 0xc7, 0xcf, 0xdb, 0xf0, 0x101, 0x11d, 0x135, + 0x15b, 0x184, 0x1c1, 0x1ff, 0x227, 0x265, 0x2aa, 0x2fb, 0x360, + }, + + /* Bgain */ + { + 0x2f0, 0x29d, 0x24a, 0x20b, 0x1d2, 0x1ae, 0x175, 0x151, 0x137, 0x12c, 0x105, 0xeb, 0xd7, 0xc9, 0xbd, + 0xbd, 0xc0, 0xc2, 0xca, 0xdc, 0xec, 0xfb, 0x10f, 0x129, 0x14b, 0x178, 0x1a7, 0x1d2, 0x21b, 0x25c, + 0x29c, 0x305, 0x35e, 0x2d4, 0x284, 0x23e, 0x1ff, 0x1c5, 0x195, 0x16a, 0x143, 0x12a, 0x11c, 0xf5, 0xe1, + 0xcf, 0xbb, 0xb1, 0xae, 0xb2, 0xb8, 0xbf, 0xcd, 0xde, 0xed, 0x102, 0x11e, 0x14a, 0x16f, 0x195, + 0x1c6, 0x209, 0x24b, 0x28e, 0x2e7, 0x348, 0x2b8, 0x26f, 0x228, 0x1e8, 0x1ad, 0x181, 0x155, 0x131, 0x114, + 0x102, 0xe1, 0xca, 0xbe, 0xa8, 0xa0, 0x9c, 0x9d, 0xa6, 0xad, 0xb4, 0xc1, 0xd6, 0xf3, 0x10e, + 0x138, 0x15f, 0x183, 0x1b0, 0x1f5, 0x230, 0x278, 0x2cc, 0x325, 0x2a5, 0x254, 0x20e, 0x1d6, 0x19b, 0x16c, + 0x146, 0x11f, 0xfa, 0xe2, 0xcc, 0xbb, 0xab, 0x97, 0x8e, 0x8b, 0x8b, 0x93, 0x9c, 0xa2, 0xac, + 0xcb, 0xe6, 0xfa, 0x126, 0x14d, 0x174, 0x1a4, 0x1e7, 0x21d, 0x261, 0x2b8, 0x30f, 0x28f, 0x243, 0x1fe, + 0x1c0, 0x18b, 0x15b, 0x138, 0x10e, 0xf1, 0xd3, 0xbc, 0xa8, 0x96, 0x89, 0x7e, 0x79, 0x78, 0x83, + 0x8a, 0x92, 0xa2, 0xbf, 0xda, 0xee, 0x114, 0x13b, 0x162, 0x193, 0x1d6, 0x212, 0x253, 0x29d, 0x2f5, + 0x271, 0x22f, 0x1e9, 0x1b1, 0x17a, 0x14e, 0x126, 0x103, 0xe4, 0xc8, 0xad, 0x97, 0x85, 0x78, 0x6d, + 0x68, 0x6a, 0x6e, 0x74, 0x81, 0x90, 0xb0, 0xcb, 0xe0, 0x107, 0x12a, 0x155, 0x189, 0x1c5, 0x1ff, + 0x240, 0x28b, 0x2db, 0x25e, 0x21e, 0x1df, 0x1a8, 0x171, 0x146, 0x11b, 0xf1, 0xd7, 0xbb, 0x9f, 0x88, + 0x76, 0x67, 0x5d, 0x57, 0x5b, 0x5a, 0x69, 0x71, 0x84, 0xa0, 0xbd, 0xd4, 0xf9, 0x119, 0x14a, + 0x17b, 0x1ae, 0x1e9, 0x232, 0x27b, 0x2c8, 0x253, 0x214, 0x1d3, 0x197, 0x16b, 0x140, 0x111, 0xe8, 0xc5, + 0xa8, 0x90, 0x7c, 0x68, 0x58, 0x4e, 0x46, 0x4a, 0x4c, 0x58, 0x61, 0x73, 0x8d, 0xa4, 0xc6, + 0xed, 0x110, 0x139, 0x167, 0x19f, 0x1dc, 0x223, 0x26b, 0x2ab, 0x249, 0x206, 0x1c4, 0x18c, 0x15d, 0x130, + 0x105, 0xd6, 0xba, 0x9b, 0x83, 0x6b, 0x5a, 0x4a, 0x3c, 0x3a, 0x37, 0x3b, 0x4c, 0x58, 0x67, + 0x82, 0x9f, 0xc7, 0xe7, 0x101, 0x12f, 0x15d, 0x195, 0x1d2, 0x214, 0x25c, 0x2a1, 0x238, 0x1fd, 0x1bb, + 0x17f, 0x150, 0x123, 0xf7, 0xd1, 0xb1, 0x94, 0x78, 0x64, 0x4e, 0x3d, 0x30, 0x2e, 0x28, 0x2e, + 0x3e, 0x4b, 0x60, 0x77, 0x9a, 0xc3, 0xdc, 0xfe, 0x129, 0x155, 0x18c, 0x1c9, 0x20d, 0x256, 0x295, + 0x234, 0x1f0, 0x1af, 0x175, 0x141, 0x117, 0xf0, 0xcb, 0xa8, 0x8a, 0x71, 0x58, 0x3e, 0x2f, 0x23, + 0x1e, 0x1d, 0x23, 0x30, 0x41, 0x58, 0x72, 0x91, 0xbb, 0xd3, 0xf3, 0x122, 0x151, 0x180, 0x1c5, + 0x202, 0x24d, 0x287, 0x222, 0x1e8, 0x1a6, 0x16d, 0x13c, 0x10d, 0xe6, 0xc5, 0xa6, 0x82, 0x67, 0x4e, + 0x37, 0x23, 0x16, 0x12, 0x10, 0x18, 0x23, 0x37, 0x4f, 0x69, 0x84, 0xa9, 0xc7, 0xea, 0x11d, + 0x149, 0x178, 0x1be, 0x1fe, 0x247, 0x28a, 0x21e, 0x1e0, 0x19d, 0x169, 0x138, 0x10b, 0xe3, 0xc3, 0x9d, + 0x7d, 0x61, 0x44, 0x2e, 0x1d, 0xf, 0x8, 0x6, 0xe, 0x1a, 0x2d, 0x47, 0x5d, 0x7c, 0x9c, + 0xbf, 0xe6, 0x119, 0x141, 0x171, 0x1b4, 0x1f5, 0x241, 0x279, 0x21b, 0x1de, 0x19b, 0x168, 0x132, 0x107, + 0xdf, 0xbc, 0x9a, 0x78, 0x5d, 0x40, 0x29, 0x15, 0x7, 0x0, 0x0, 0xa, 0x13, 0x27, 0x45, + 0x58, 0x77, 0x9b, 0xbb, 0xe5, 0x113, 0x13c, 0x170, 0x1ae, 0x1f3, 0x238, 0x276, 0x244, 0x1d8, 0x19f, + 0x168, 0x133, 0x107, 0xdd, 0xba, 0x97, 0x75, 0x56, 0x3c, 0x28, 0x12, 0x4, 0x3, 0x1, 0x4, + 0x11, 0x21, 0x3d, 0x58, 0x77, 0x97, 0xbc, 0xe1, 0x10f, 0x13b, 0x16f, 0x1a9, 0x1e9, 0x232, 0x276, + 0x2a3, 0x1ec, 0x1a4, 0x16a, 0x12f, 0x102, 0xdb, 0xba, 0x94, 0x70, 0x56, 0x3b, 0x28, 0xf, 0x1, + 0x6, 0x2, 0x4, 0xe, 0x1f, 0x3a, 0x55, 0x74, 0x96, 0xb5, 0xe0, 0x10d, 0x13c, 0x16d, 0x1ac, + 0x1e5, 0x230, 0x271, 0x2a9, 0x206, 0x19e, 0x166, 0x12e, 0x101, 0xda, 0xb5, 0x92, 0x71, 0x54, 0x3a, + 0x24, 0x10, 0x4, 0x5, 0x7, 0x6, 0xd, 0x1f, 0x3c, 0x52, 0x75, 0x93, 0xb4, 0xe0, 0x10b, + 0x138, 0x168, 0x1a7, 0x1e9, 0x235, 0x271, 0x2a6, 0x1f1, 0x197, 0x160, 0x129, 0x100, 0xda, 0xb7, 0x92, + 0x70, 0x54, 0x3a, 0x26, 0x12, 0x4, 0x5, 0x5, 0x9, 0xc, 0x22, 0x38, 0x54, 0x71, 0x92, + 0xb6, 0xe2, 0x10c, 0x136, 0x167, 0x1a4, 0x1e2, 0x230, 0x275, 0x267, 0x1d3, 0x192, 0x160, 0x128, 0x101, + 0xd9, 0xbb, 0x96, 0x77, 0x56, 0x3b, 0x2a, 0x14, 0x6, 0x3, 0x7, 0x7, 0x10, 0x26, 0x3d, + 0x57, 0x74, 0x96, 0xb6, 0xe5, 0x10c, 0x136, 0x168, 0x1a3, 0x1e4, 0x22d, 0x271, 0x228, 0x1e9, 0x197, + 0x163, 0x12f, 0x103, 0xd9, 0xbb, 0x9a, 0x7c, 0x5c, 0x45, 0x2f, 0x1c, 0xb, 0x6, 0x7, 0xd, + 0x17, 0x28, 0x3f, 0x5b, 0x77, 0x98, 0xb8, 0xe7, 0x10d, 0x139, 0x16a, 0x1a7, 0x1e9, 0x234, 0x279, + 0x263, 0x226, 0x19a, 0x16a, 0x134, 0x108, 0xdd, 0xbc, 0x9d, 0x80, 0x65, 0x4c, 0x37, 0x25, 0x16, + 0xf, 0xe, 0x13, 0x1f, 0x2e, 0x46, 0x5e, 0x79, 0x9c, 0xbd, 0xeb, 0x112, 0x13d, 0x170, 0x1b0, + 0x1ef, 0x23a, 0x286, 0x271, 0x236, 0x19f, 0x16c, 0x13c, 0x10e, 0xe4, 0xc2, 0x9f, 0x83, 0x6a, 0x55, + 0x3d, 0x2a, 0x1f, 0x19, 0x14, 0x1b, 0x26, 0x36, 0x4c, 0x65, 0x84, 0xa4, 0xc2, 0xeb, 0x119, + 0x146, 0x178, 0x1af, 0x1f3, 0x240, 0x286, 0x254, 0x22e, 0x1a5, 0x16f, 0x143, 0x111, 0xf0, 0xc6, 0xa7, + 0x8d, 0x70, 0x5c, 0x46, 0x35, 0x2e, 0x32, 0x21, 0x24, 0x33, 0x40, 0x55, 0x6c, 0x90, 0xb1, + 0xcb, 0xf2, 0x11d, 0x150, 0x17d, 0x1bc, 0x1f9, 0x244, 0x287, 0x22b, 0x206, 0x1b0, 0x17a, 0x14d, 0x11b, + 0xf4, 0xce, 0xae, 0x93, 0x78, 0x63, 0x4d, 0x3d, 0x40, 0x38, 0x31, 0x31, 0x40, 0x4d, 0x62, + 0x74, 0x98, 0xb8, 0xd7, 0xfb, 0x12f, 0x15a, 0x18a, 0x1c6, 0x205, 0x248, 0x290, 0x236, 0x201, 0x1bd, + 0x190, 0x153, 0x124, 0x100, 0xd9, 0xba, 0xa1, 0x84, 0x6b, 0x57, 0x4b, 0x45, 0x47, 0x42, 0x44, + 0x50, 0x5b, 0x6d, 0x82, 0xa2, 0xc1, 0xde, 0x107, 0x137, 0x161, 0x194, 0x1cc, 0x20a, 0x257, 0x297, + 0x24c, 0x213, 0x1c6, 0x19b, 0x166, 0x12f, 0x10b, 0xe3, 0xc6, 0xaa, 0x90, 0x77, 0x67, 0x5b, 0x4c, + 0x4d, 0x4d, 0x51, 0x5d, 0x6c, 0x7c, 0x8e, 0xab, 0xc9, 0xe8, 0x112, 0x140, 0x16b, 0x19c, 0x1d6, + 0x21a, 0x263, 0x2a7, 0x25b, 0x223, 0x1db, 0x1a7, 0x175, 0x13c, 0x115, 0xf5, 0xd2, 0xb7, 0x9b, 0x86, + 0x76, 0x68, 0x5b, 0x5b, 0x5f, 0x61, 0x69, 0x78, 0x8a, 0xa0, 0xba, 0xd4, 0xf4, 0x11b, 0x149, + 0x176, 0x1a4, 0x1e0, 0x226, 0x26d, 0x2bb, 0x268, 0x22f, 0x1ec, 0x1b1, 0x17b, 0x14b, 0x121, 0xff, 0xe0, + 0xc5, 0xad, 0x96, 0x88, 0x79, 0x6d, 0x6a, 0x6e, 0x6c, 0x75, 0x87, 0x96, 0xae, 0xc9, 0xe2, + 0x103, 0x129, 0x157, 0x183, 0x1b2, 0x1eb, 0x236, 0x280, 0x2cc, 0x27d, 0x234, 0x1fb, 0x1b9, 0x186, 0x158, + 0x132, 0x109, 0xef, 0xd5, 0xbc, 0xa6, 0x97, 0x89, 0x81, 0x7d, 0x7d, 0x7d, 0x86, 0x94, 0xa4, + 0xba, 0xd5, 0xf2, 0x112, 0x136, 0x15e, 0x18a, 0x1bc, 0x1fb, 0x242, 0x28e, 0x2da, 0x28c, 0x249, 0x20e, + 0x1cc, 0x195, 0x162, 0x140, 0x11a, 0x100, 0xe4, 0xcb, 0xb3, 0xa7, 0x98, 0x90, 0x8f, 0x8e, 0x90, + 0x97, 0xa2, 0xb3, 0xc9, 0xdf, 0xfe, 0x122, 0x148, 0x16d, 0x1a6, 0x1d6, 0x210, 0x259, 0x2a1, 0x2e8, + 0x2a9, 0x264, 0x21f, 0x1da, 0x1aa, 0x175, 0x151, 0x129, 0x10e, 0xf4, 0xdc, 0xca, 0xb7, 0xaa, 0xa3, + 0x9c, 0x99, 0x9f, 0xaa, 0xb4, 0xc6, 0xd7, 0xee, 0x10a, 0x130, 0x156, 0x183, 0x1c5, 0x1f3, 0x229, + 0x264, 0x2b3, 0x304, 0x2c0, 0x279, 0x234, 0x1ef, 0x1bf, 0x18d, 0x165, 0x13d, 0x11d, 0x106, 0xeb, 0xdb, + 0xcb, 0xbf, 0xb6, 0xae, 0xad, 0xb3, 0xba, 0xc8, 0xd6, 0xeb, 0x103, 0x11b, 0x140, 0x166, 0x19d, + 0x1e6, 0x20b, 0x244, 0x282, 0x2c9, 0x320, 0x2d0, 0x28d, 0x245, 0x204, 0x1da, 0x19c, 0x175, 0x14b, 0x12c, + 0x10f, 0xf9, 0xe5, 0xdb, 0xd0, 0xc3, 0xbc, 0xbb, 0xbf, 0xc8, 0xd8, 0xe7, 0xf7, 0x114, 0x12b, + 0x14d, 0x176, 0x1b2, 0x1f1, 0x218, 0x259, 0x29b, 0x2e3, 0x338, + }, + }, + }, + + /* ISP_BNR_LSC_CALIB_TABLE_S */ + { + /* RGain */ + { + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096 + }, + /* GrGain */ + { + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096 + }, + /* GbGain */ + { + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096 + }, + /* BGain */ + { + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096 + }, + }, + +}; + +static const hi_isp_cmos_demosaic g_stIspDemosaic = { + 1, // bEnable + /* au8NonDirStr */ + {0, 0, 32, 96, 168, 224, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240}, + /* au8NonDirMFDetailEhcStr */ + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + /* au8NonDirHFDetailEhcStr */ + {3, 3, 3, 5, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + + /* au8DetailSmoothRange */ + {2, 2, 2, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 7}, +}; + +static const hi_isp_cmos_afc g_stIspAntiFalseColor = { + 1, /* bEnable */ + {8, 8, 8, 8, 7, 7, 7, 6, 6, 6, 5, 4, 3, 2, 1, 0}, /* au8AntiFalseColorThreshold */ + {8, 8, 8, 8, 7, 7, 7, 6, 6, 6, 5, 4, 3, 2, 1, 0}, /* au8AntiFalseColorStrength */ +}; + +static const hi_isp_cmos_bayernr g_stIspBayerNr = { + 1, // bEnable + 0, // bLowPowerEnable + 0, // bBnrMonoSensorEn + 0, // bNrLscEnable + 0, // NrLscNrRatio + { 90, 83, 82, 80, 80, 80, 80, 100, 100, 100, 100, 100, 100, 100, 100, 100}, // FineStr + { + {1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3}, // ChromaStrR + {0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2}, // ChromaStrGr + {0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2}, // ChromaStrGb + {1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3} // ChromaStrB + }, + { 0, 0, 0, 0}, // WDRCoarseStr + { 0, 0, 0, 0 }, /* FusionFrameStr */ + { + {120, 120, 120, 120, 120, 120, 120, 140, 160, 160, 180, 200, 200, 200, 200, 200}, // CoarseStrR + {110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110}, // CoarseStrGR + {110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110}, // CoarseStrGB + {120, 120, 120, 120, 120, 120, 120, 140, 160, 160, 180, 200, 200, 200, 200, 200} // CoarseStrB + }, + { 50, 45, 40, 80, 100, 140, 200, 240, 280, 280, 300, 400, 400, 400, 400, 400}, // lutCoringWeight + { + 60, 60, 60, 60, 65, 65, 65, 65, 70, 70, 70, 70, 70, 70, 70, 70, \ + 80, 80, 80, 85, 85, 85, 90, 90, 90, 95, 95, 95, 100, 100, 100, 100, 100 + } // CoringRatio +}; + +static const hi_isp_cmos_ldci g_stIspLdci = { + /* bEnable */ + 1, + /* u8GaussLPFSigma */ + 18, + + /* au8HePosWgt */ + {50, 45, 42, 40, 35, 32, 12, 8, 6, 0, 0, 0, 0, 0, 0, 0}, + /* au8HePosSigma */ + {80, 80, 72, 72, 72, 64, 24, 20, 12, 8, 6, 2, 1, 1, 1, 1}, + /* au8HePosMean */ + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + + /* au8HeNegWgt */ + {30, 30, 25, 25, 25, 18, 12, 8, 6, 0, 0, 0, 0, 0, 0, 0}, + /* au8HeNegSigma */ + {80, 80, 80, 80, 80, 72, 64, 54, 36, 8, 6, 2, 1, 1, 1, 1}, + /* au8HeNegMean */ + {128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + + /* au16BlcCtrl */ + {25, 25, 25, 25, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30} +}; + +static const hi_isp_cmos_gamma g_stIspGamma = { + { + 0, 20, 40, 60, 81, 101, 122, 142, 163, 184, 204, 225, 246, 267, 288, 308, 329, 350, 371, 391, 412, 432, 453, 473, 493, 513, 533, 553, 572, 591, 611, 629, \ + 648, 667, 685, 703, 720, 738, 755, 776, 798, 819, 839, 860, 880, 900, 920, 940, 959, 978, 997, 1016, 1034, 1053, 1070, 1088, 1105, 1122, 1139, 1156, 1172, 1188, 1203, 1218, \ + 1233, 1248, 1262, 1276, 1289, 1311, 1331, 1349, 1366, 1383, 1398, 1412, 1426, 1439, 1452, 1464, 1476, 1489, 1502, 1515, 1528, 1543, 1558, 1568, 1578, 1589, 1599, 1610, 1620, 1631, 1641, 1652, \ + 1663, 1673, 1684, 1695, 1705, 1716, 1727, 1738, 1749, 1759, 1770, 1781, 1792, 1803, 1814, 1825, 1835, 1846, 1855, 1864, 1873, 1881, 1890, 1899, 1908, 1917, 1926, 1935, 1944, 1953, 1962, 1971, \ + 1980, 1989, 1998, 2007, 2016, 2025, 2034, 2043, 2051, 2060, 2069, 2078, 2086, 2095, 2104, 2112, 2121, 2129, 2137, 2145, 2153, 2161, 2168, 2176, 2183, 2191, 2199, 2206, 2214, 2221, 2229, 2237, \ + 2244, 2252, 2259, 2266, 2274, 2281, 2288, 2296, 2303, 2310, 2317, 2324, 2330, 2337, 2344, 2350, 2357, 2363, 2369, 2375, 2381, 2387, 2392, 2398, 2403, 2410, 2417, 2423, 2429, 2435, 2440, 2446, \ + 2451, 2456, 2460, 2465, 2469, 2474, 2478, 2482, 2486, 2491, 2495, 2499, 2503, 2507, 2511, 2515, 2519, 2524, 2528, 2533, 2537, 2542, 2547, 2551, 2556, 2561, 2565, 2570, 2575, 2579, 2584, 2589, \ + 2593, 2598, 2603, 2607, 2612, 2617, 2621, 2626, 2631, 2635, 2640, 2644, 2649, 2654, 2658, 2663, 2667, 2672, 2675, 2679, 2682, 2686, 2689, 2693, 2696, 2700, 2703, 2706, 2710, 2713, 2717, 2720, \ + + 2723, 2727, 2730, 2733, 2737, 2740, 2744, 2747, 2750, 2754, 2757, 2760, 2764, 2767, 2771, 2774, 2778, 2781, 2785, 2788, 2792, 2795, 2798, 2801, 2804, 2807, 2810, 2813, 2816, 2819, 2822, 2825, \ + 2828, 2831, 2834, 2837, 2841, 2844, 2847, 2850, 2853, 2856, 2859, 2862, 2865, 2868, 2871, 2874, 2878, 2881, 2884, 2887, 2890, 2893, 2897, 2900, 2903, 2906, 2910, 2913, 2916, 2919, 2923, 2926, \ + 2929, 2932, 2934, 2936, 2939, 2941, 2943, 2946, 2948, 2950, 2953, 2955, 2957, 2960, 2962, 2965, 2967, 2970, 2972, 2974, 2977, 2979, 2982, 2984, 2987, 2989, 2992, 2994, 2997, 2999, 3002, 3004, \ + 3007, 3009, 3012, 3014, 3017, 3019, 3022, 3024, 3027, 3029, 3032, 3034, 3037, 3039, 3042, 3044, 3046, 3049, 3051, 3054, 3056, 3059, 3061, 3063, 3066, 3068, 3070, 3073, 3075, 3077, 3080, 3082, \ + 3084, 3086, 3089, 3091, 3093, 3095, 3098, 3100, 3102, 3104, 3106, 3109, 3111, 3113, 3115, 3117, 3119, 3122, 3124, 3126, 3128, 3130, 3132, 3134, 3136, 3138, 3141, 3143, 3145, 3147, 3149, 3151, \ + 3153, 3155, 3157, 3159, 3161, 3163, 3166, 3168, 3170, 3172, 3174, 3176, 3178, 3180, 3182, 3184, 3186, 3188, 3190, 3192, 3194, 3196, 3198, 3200, 3202, 3204, 3206, 3208, 3210, 3212, 3214, 3216, \ + 3218, 3220, 3222, 3224, 3226, 3228, 3230, 3232, 3234, 3236, 3238, 3240, 3243, 3245, 3247, 3249, 3251, 3253, 3255, 3257, 3259, 3261, 3263, 3265, 3267, 3269, 3271, 3273, 3275, 3277, 3279, 3281, \ + 3283, 3285, 3287, 3289, 3291, 3293, 3294, 3296, 3298, 3300, 3302, 3304, 3306, 3308, 3310, 3312, 3313, 3315, 3317, 3319, 3321, 3323, 3325, 3326, 3328, 3330, 3332, 3333, 3335, 3337, 3339, 3340, + + 3342, 3344, 3346, 3347, 3349, 3351, 3352, 3354, 3356, 3357, 3359, 3361, 3362, 3364, 3365, 3367, 3369, 3370, 3372, 3373, 3375, 3376, 3378, 3379, 3381, 3382, 3384, 3385, 3387, 3388, 3390, 3391, \ + 3393, 3394, 3396, 3397, 3398, 3400, 3401, 3403, 3404, 3406, 3407, 3409, 3410, 3411, 3413, 3414, 3416, 3417, 3419, 3420, 3422, 3423, 3424, 3426, 3427, 3429, 3430, 3432, 3433, 3435, 3436, 3438, \ + 3439, 3440, 3442, 3443, 3444, 3446, 3447, 3449, 3450, 3451, 3453, 3454, 3456, 3457, 3458, 3460, 3461, 3462, 3464, 3465, 3467, 3468, 3469, 3471, 3472, 3473, 3475, 3476, 3478, 3479, 3480, 3482, \ + 3483, 3484, 3486, 3487, 3488, 3490, 3491, 3493, 3494, 3495, 3497, 3498, 3499, 3501, 3502, 3503, 3505, 3506, 3507, 3509, 3510, 3511, 3513, 3514, 3515, 3517, 3518, 3519, 3521, 3522, 3523, 3525, \ + 3526, 3527, 3529, 3530, 3531, 3533, 3534, 3535, 3537, 3538, 3539, 3541, 3542, 3543, 3545, 3546, 3547, 3549, 3550, 3551, 3553, 3554, 3555, 3556, 3558, 3559, 3560, 3562, 3563, 3564, 3565, 3567, \ + 3568, 3569, 3571, 3572, 3573, 3574, 3576, 3577, 3578, 3580, 3581, 3582, 3583, 3585, 3586, 3587, 3589, 3590, 3591, 3593, 3594, 3595, 3597, 3598, 3599, 3601, 3602, 3603, 3605, 3606, 3607, 3609, \ + 3610, 3612, 3613, 3614, 3616, 3617, 3619, 3620, 3621, 3623, 3624, 3626, 3627, 3629, 3630, 3631, 3633, 3634, 3636, 3637, 3639, 3640, 3641, 3643, 3644, 3646, 3647, 3649, 3650, 3652, 3653, 3655, \ + 3656, 3658, 3659, 3660, 3662, 3663, 3665, 3666, 3668, 3669, 3671, 3672, 3674, 3675, 3677, 3678, 3680, 3681, 3683, 3684, 3686, 3687, 3688, 3690, 3691, 3693, 3694, 3696, 3697, 3699, 3700, 3702, + + 3703, 3704, 3706, 3707, 3709, 3710, 3712, 3713, 3715, 3716, 3718, 3719, 3720, 3722, 3723, 3725, 3726, 3728, 3729, 3731, 3732, 3733, 3735, 3736, 3738, 3739, 3741, 3742, 3744, 3745, 3747, 3748, \ + 3749, 3751, 3752, 3754, 3755, 3757, 3758, 3760, 3761, 3763, 3764, 3765, 3767, 3768, 3770, 3771, 3773, 3774, 3776, 3777, 3778, 3780, 3781, 3783, 3784, 3786, 3787, 3789, 3790, 3792, 3793, 3794, \ + 3796, 3797, 3799, 3800, 3802, 3803, 3805, 3806, 3807, 3809, 3810, 3812, 3813, 3815, 3816, 3817, 3819, 3820, 3822, 3823, 3824, 3826, 3827, 3829, 3830, 3832, 3833, 3834, 3836, 3837, 3839, 3840, \ + 3842, 3843, 3844, 3846, 3847, 3849, 3850, 3852, 3853, 3854, 3856, 3857, 3859, 3860, 3862, 3863, 3865, 3866, 3868, 3869, 3871, 3872, 3874, 3875, 3877, 3878, 3880, 3881, 3883, 3884, 3886, 3887, \ + 3889, 3890, 3892, 3893, 3895, 3897, 3898, 3900, 3901, 3903, 3905, 3906, 3908, 3909, 3911, 3913, 3914, 3916, 3918, 3919, 3921, 3922, 3924, 3926, 3927, 3929, 3931, 3932, 3934, 3936, 3937, 3939, \ + 3941, 3943, 3944, 3946, 3948, 3949, 3951, 3953, 3954, 3956, 3958, 3959, 3961, 3963, 3964, 3966, 3968, 3969, 3971, 3973, 3974, 3976, 3978, 3979, 3981, 3983, 3984, 3986, 3988, 3989, 3991, 3992, \ + 3994, 3996, 3997, 3999, 4000, 4002, 4004, 4005, 4007, 4008, 4010, 4012, 4013, 4015, 4016, 4018, 4020, 4021, 4023, 4024, 4026, 4027, 4029, 4031, 4032, 4034, 4035, 4037, 4038, 4040, 4042, 4043, \ + 4045, 4046, 4048, 4049, 4051, 4053, 4054, 4056, 4057, 4059, 4060, 4062, 4064, 4065, 4067, 4068, 4070, 4071, 4073, 4075, 4076, 4078, 4079, 4081, 4082, 4084, 4086, 4087, 4089, 4090, 4092, 4093, 4095 + } +}; + +static const hi_isp_cmos_edgemark g_stIspEdgeMark = { + 0, // HI_BOOL bEnable; /* RW; Range:[0, 1]; Format:1.0;Enable/Disable Edge Mark */ + 100, // HI_U8 u8Threshold; /* RW; range: [0, 255]; Format:8.0; */ + 0xFF0000, // HI_U32 u32Color; /* RW; range: [0, 0xFFFFFF]; Format:32.0; */ +}; + +static const hi_isp_cmos_sharpen g_stIspYuvSharpen = { + /* u8SkinUmin */ + 100, + /* u8SkinVmin */ + 135, + /* u8SkinUmax */ + 128, + /* u8SkinVmax */ + 150, + /* Manual Para */ + { + /* au8LumaWgt */ + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127}, + /* au16TextureStr */ + {100, 102, 105, 108, 110, 115, 120, 128, 136, 148, 150, 160, 165, 170, 170, 170, 170, 170, 168, 165, 162, 160, 155, 150, 140, 136, 130, 128, 125, 123, 120, 120}, + /* au16EdgeStr */ + {120, 123, 125, 128, 130, 135, 140, 148, 160, 168, 180, 190, 200, 210, 210, 210, 210, 210, 200, 190, 185, 175, 165, 160, 146, 136, 130, 128, 125, 123, 120, 120}, + /* u16TextureFreq; */ + 256, + /* u16EdgeFreq; */ + 100, + /* u8OverShoot; */ + 65, + /* u8UnderShoot; */ + 70, + /* u8shootSupStr; */ + 10, + /* u8shootSupAdj; */ + 9, + /* u8DetailCtrl; */ + 128, + /* u8DetailCtrlThr; */ + 180, + /* u8EdgeFiltStr; */ + 53, + /* u8EdgeFiltMaxCap; */ + 18, + /* u8RGain; */ + 31, + /* u8GGain; */ + 32, + /* u8BGain; */ + 31, + /* u8SkinGain; */ + 31, + /* u8MaxSharpGain; */ + 160 + }, + /* Auto Para */ + { + /* au16LumaWgt */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, + {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 } + }, + /* au16TextureStr */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { {270, 270, 260, 245, 230, 200, 155, 130, 90, 70, 10, 10, 0, 0, 0, 0 }, + {270, 270, 260, 245, 230, 200, 155, 130, 90, 70, 10, 10, 0, 0, 0, 0 }, + {270, 270, 260, 255, 245, 200, 155, 130, 90, 70, 10, 10, 0, 0, 0, 0 }, + {270, 270, 260, 245, 245, 215, 160, 130, 90, 70, 10, 10, 0, 0, 0, 0 }, + {270, 270, 260, 250, 245, 215, 160, 130, 90, 70, 10, 10, 0, 0, 0, 0 }, + {270, 270, 260, 250, 245, 215, 180, 140, 90, 70, 10, 10, 0, 0, 0, 0 }, + {270, 270, 260, 250, 245, 215, 180, 140, 100, 70, 20, 20, 0, 0, 0, 0 }, + {275, 275, 265, 255, 245, 215, 180, 140, 100, 70, 20, 20, 0, 0, 0, 0 }, + {280, 280, 270, 265, 255, 220, 190, 140, 110, 70, 20, 20, 0, 0, 0, 0 }, + {285, 285, 275, 270, 255, 220, 190, 140, 110, 70, 20, 20, 2, 2, 2, 2 }, + {290, 290, 285, 280, 265, 220, 200, 145, 110, 70, 30, 30, 6, 6, 6, 6 }, + {295, 295, 285, 280, 265, 230, 210, 145, 110, 80, 30, 30, 10, 10, 10, 10 }, + {300, 300, 290, 285, 270, 230, 230, 160, 110, 80, 30, 30, 14, 14, 14, 14 }, + {305, 305, 295, 285, 270, 230, 230, 160, 110, 80, 40, 40, 16, 16, 16, 16 }, + {310, 310, 300, 295, 275, 230, 240, 160, 110, 80, 40, 40, 20, 20, 20, 20 }, + {315, 315, 300, 295, 275, 230, 240, 100, 110, 80, 50, 50, 20, 20, 20, 20 }, + {320, 320, 310, 300, 280, 240, 240, 160, 110, 80, 50, 50, 20, 20, 20, 20 }, + {320, 320, 310, 300, 280, 240, 240, 160, 110, 80, 60, 60, 20, 20, 20, 20 }, + {315, 315, 310, 300, 280, 240, 240, 160, 110, 80, 60, 60, 20, 20, 20, 20 }, + {310, 310, 305, 300, 280, 240, 240, 160, 110, 80, 70, 70, 18, 18, 18, 18 }, + {305, 305, 300, 300, 280, 240, 240, 130, 110, 70, 70, 70, 12, 12, 12, 12 }, + {300, 300, 295, 285, 265, 220, 180, 100, 80, 70, 80, 80, 10, 10, 10, 10 }, + {295, 295, 290, 285, 265, 220, 150, 100, 80, 70, 80, 80, 8, 8, 8, 8 }, + {280, 280, 275, 270, 255, 215, 120, 100, 80, 70, 80, 80, 6, 6, 6, 6 }, + {270, 270, 265, 260, 250, 215, 100, 100, 80, 70, 80, 80, 4, 4, 4, 4 }, + {265, 265, 260, 255, 250, 180, 100, 100, 80, 70, 80, 80, 2, 2, 2, 2 }, + {255, 255, 250, 240, 230, 180, 100, 90, 70, 70, 70, 70, 2, 2, 2, 2 }, + {245, 245, 240, 230, 220, 140, 100, 90, 70, 70, 70, 70, 2, 2, 2, 2 }, + {235, 235, 230, 220, 210, 110, 90, 90, 70, 70, 70, 70, 2, 2, 2, 2 }, + {225, 225, 210, 200, 190, 120, 90, 90, 60, 60, 60, 60, 2, 2, 2, 2 }, + {215, 215, 210, 200, 190, 110, 90, 90, 60, 60, 60, 60, 2, 2, 2, 2 }, + {200, 200, 190, 180, 175, 110, 90, 90, 60, 60, 60, 60, 2, 2, 2, 2 } + + }, + /* au16EdgeStr */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { + {200, 200, 190, 190, 185, 175, 170, 120, 110, 100, 100, 100, 100, 50, 50, 50 }, + {200, 200, 190, 190, 185, 175, 170, 120, 110, 100, 100, 100, 100, 50, 50, 50 }, + {200, 200, 190, 190, 185, 175, 170, 120, 110, 100, 100, 100, 100, 50, 50, 50 }, + {200, 200, 190, 190, 185, 175, 170, 120, 110, 100, 100, 100, 100, 50, 50, 50 }, + {200, 200, 190, 190, 185, 175, 170, 120, 110, 100, 100, 100, 100, 50, 50, 50 }, + {202, 202, 195, 195, 190, 180, 175, 130, 120, 110, 110, 110, 110, 50, 50, 50 }, + {202, 202, 195, 195, 190, 180, 175, 130, 120, 110, 110, 110, 110, 50, 50, 50 }, + {210, 210, 200, 200, 190, 180, 175, 140, 140, 130, 130, 130, 130, 50, 50, 50 }, + {220, 220, 210, 210, 200, 190, 180, 140, 140, 130, 130, 130, 130, 50, 50, 50 }, + {230, 230, 220, 220, 210, 200, 190, 140, 160, 150, 150, 150, 150, 50, 50, 50 }, + {240, 240, 230, 230, 220, 210, 195, 180, 180, 180, 160, 160, 160, 50, 50, 50 }, + {250, 250, 240, 240, 230, 220, 205, 180, 180, 180, 160, 160, 160, 50, 50, 50 }, + {260, 260, 250, 250, 240, 230, 210, 180, 180, 180, 160, 160, 160, 50, 50, 50 }, + {270, 270, 260, 260, 250, 240, 215, 190, 190, 190, 170, 170, 170, 50, 50, 50 }, + {280, 280, 270, 270, 260, 250, 220, 190, 190, 190, 170, 170, 170, 50, 50, 50 }, + {290, 290, 280, 280, 270, 260, 225, 180, 180, 180, 160, 160, 160, 50, 50, 50 }, + {300, 300, 290, 290, 280, 270, 230, 180, 180, 180, 160, 160, 160, 50, 50, 50 }, + {290, 290, 280, 280, 270, 260, 225, 190, 190, 190, 160, 160, 160, 50, 50, 50 }, + {280, 280, 270, 270, 260, 250, 220, 190, 190, 190, 160, 160, 160, 50, 50, 50 }, + {270, 270, 260, 260, 250, 240, 210, 190, 190, 190, 160, 160, 160, 50, 50, 50 }, + {260, 260, 250, 250, 240, 230, 205, 180, 180, 180, 160, 160, 160, 50, 50, 50 }, + {255, 255, 245, 245, 235, 230, 205, 180, 180, 180, 160, 160, 160, 50, 50, 50 }, + {250, 250, 245, 245, 235, 225, 200, 170, 170, 170, 150, 150, 150, 50, 50, 50 }, + {240, 240, 235, 235, 225, 220, 200, 160, 160, 160, 150, 150, 150, 50, 50, 50 }, + {230, 230, 225, 225, 215, 210, 195, 160, 160, 160, 150, 150, 150, 50, 50, 50 }, + {220, 220, 210, 210, 205, 200, 190, 160, 160, 160, 150, 150, 150, 50, 50, 50 }, + {210, 210, 200, 200, 195, 190, 185, 160, 160, 160, 140, 140, 140, 50, 50, 50 }, + {200, 200, 190, 190, 185, 180, 175, 155, 155, 155, 135, 135, 135, 50, 50, 50 }, + {195, 195, 185, 185, 185, 180, 175, 150, 150, 150, 135, 135, 135, 40, 40, 40 }, + {190, 190, 185, 185, 180, 175, 170, 150, 150, 150, 135, 135, 135, 30, 30, 30 }, + {180, 180, 175, 175, 170, 165, 160, 150, 150, 150, 135, 135, 135, 25, 25, 25 }, + {180, 180, 175, 175, 170, 165, 160, 150, 150, 150, 135, 135, 135, 20, 20, 20 } + + }, + /* au16TextureFreq */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { 200, 200, 200, 200, 200, 200, 200, 200, 180, 160, 160, 128, 128, 128, 128, 128}, + /* au16EdgeFreq */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { 128, 128, 128, 128, 128, 80, 80, 80, 80, 70, 70, 70, 70, 70, 70, 70}, + /* au8OverShoot */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { 100, 100, 100, 100, 65, 65, 60, 60, 70, 80, 90, 90, 90, 90, 90, 90}, + /* au8UnderShoot */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { 120, 120, 120, 120, 80, 80, 70, 60, 60, 70, 80, 90, 90, 90, 90, 90}, + /* au8ShootSupStr */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { 10, 10, 10, 10, 10, 10, 10, 9, 8, 8, 7, 7, 7, 7, 7, 7}, + /* au8ShootSupAdj */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 7, 7, 7, 7, 7, 7}, + /* au8DetailCtrl */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}, + /* au8DetailCtrlThr */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160}, + /* au8EdgeFiltStr */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { 53, 53, 53, 51, 48, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43 }, + { 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18 }, + /* au8RGain */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { 31, 31, 31, 31, 31, 31, 31, 20, 16, 16, 16, 16, 16, 16, 16, 16}, + /* au8GGain */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32}, + /* au8BGain */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { 31, 31, 31, 31, 31, 31, 31, 20, 16, 16, 16, 16, 16, 16, 16, 16}, + /* au8SkinGain */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { 31, 31, 31, 31, 31, 31, 31, 20, 16, 16, 16, 16, 16, 16, 16, 16}, + /* u8MaxSharpGain */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160} + }, + +}; + +static const hi_isp_cmos_drc g_stIspDRC = { + /* bEnable */ + 1, + /* enOpType */ + 0, + /* u16ManualStrength */ + 1023, + /* u16AutoStrength */ + 512, + /* u8SpatialFltCoef */ + 1, + /* u8RangeFltCoef */ + 2, + /* u8ContrastControl */ + 7, + /* s8DetailAdjustFactor */ + 6, + /* u8RangeAdaMax */ + 4, + /* u8GradRevMax */ + 30, + /* u8GradRevThr */ + 35, + /* u8BrightGainLmt */ + 15, + /* u8BrightGainLmtStep */ + 10, + /* u8DarkGainLmtY */ + 0, + /* u8DarkGainLmtC */ + 0, + /* u8PDStrength */ + 35, + /* u8LocalMixingBrightMax */ + 32, + /* u8LocalMixingBrightMin */ + 24, + /* u8LocalMixingBrightThr */ + 96, + /* s8LocalMixingBrightSlo */ + -3, + /* u8LocalMixingDarkMax */ + 36, + /* u8LocalMixingDarkMin */ + 28, + /* u8LocalMixingDarkThr */ + 200, + /* s8LocalMixingDarkSlo */ + 5, + /* ColorCorrectionLut[33] */ + { + 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 772, 768, 764, + 760, 756, 752, 748, 744, 740, 736, 732, 728, 724, 720, 716, 712, 708, 704, 700 + }, + /* ToneMappingValue[200] */ + { + 8, 8, 16, 24, 31, 39, 48, 56, 65, 75, 85, 95, 106, 118, 130, 143, + 156, 170, 185, 201, 218, 235, 254, 274, 294, 316, 339, 364, 390, 417, 446, 477, + 509, 543, 579, 617, 658, 701, 746, 794, 844, 898, 955, 1015, 1078, 1145, 1216, 1291, + 1370, 1454, 1543, 1637, 1736, 1841, 1952, 2069, 2194, 2325, 2465, 2612, 2767, 2932, 3106, 3290, + 3485, 3691, 3909, 4140, 4384, 4641, 4914, 5202, 5507, 5830, 6171, 6531, 6913, 7316, 7742, 8193, + 8669, 9173, 9705, 10268, 10863, 11492, 12145, 12808, 13483, 14171, 14872, 15587, 16319, 17069, 17840, 18635, + 19458, 19881, 20313, 20754, 21204, 21661, 22122, 22586, 23053, 23525, 24000, 24480, 24965, 25455, 25950, 26451, + 26959, 27473, 27995, 28524, 29062, 29609, 30165, 30732, 31309, 31899, 32501, 33116, 33746, 34391, 35043, 35706, + 36381, 37066, 37763, 38472, 39192, 39925, 40671, 41429, 42201, 42591, 42986, 43383, 43784, 44189, 44597, 45008, + 45424, 45842, 46265, 46691, 47121, 47555, 47993, 48434, 48880, 49329, 49783, 50241, 50703, 51169, 51639, 52113, + 52592, 53075, 53564, 54056, 54552, 55054, 55560, 56071, 56586, 56846, 57107, 57369, 57632, 57896, 58162, 58429, + 58697, 58967, 59238, 59510, 59783, 60057, 60333, 60611, 60889, 61169, 61451, 61733, 62017, 62303, 62589, 62877, + 63167, 63458, 63750, 64044, 64340, 64636, 64934, 65234 + }, + /* u8Asymmetry */ + 5, + /* u8SecondPole */ + 180, + /* u8Stretch */ + 50, + /* u8Compress */ + 150, + /* u8CurveSel */ + 0 +}; + +static const hi_isp_cmos_ge g_stIspGe = { + /* For GE */ + 1, /* bEnable */ + 9, /* u8Slope */ + 9, /* u8SensiSlope */ + 300, /* u16SensiThr */ + {300, 300, 300, 300, 310, 310, 310, 310, 320, 320, 320, 320, 330, 330, 330, 330}, /* au16Threshold[ISP_AUTO_ISO_STRENGTH_NUM] */ + { 128, 128, 128, 128, 129, 129, 129, 129, 130, 130, 130, 130, 131, 131, 131, 131}, /* au16Strength[ISP_AUTO_ISO_STRENGTH_NUM] */ + {1024, 1024, 1024, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048} /* au16NpOffset[ISP_AUTO_ISO_STRENGTH_NUM] */ +}; + +/* **BAYER NR* */ +static const hi_isp_cmos_noise_calibration ST_ISP_NOISE_CALIB_RATIO = { + 7, // Calibration Lut Num + /* ************Calibration LUT Table************ */ + { + {100.000000f, 0.046061f, 0.000000f}, + {200.000000f, 0.086122f, 0.000000f}, + {400.000000f, 0.172829f, 0.000000f}, + {800.000000f, 0.345248f, 0.000000f}, + {1600.000000f, 0.696803f, 0.000000f}, + {3200.000000f, 1.408294f, 0.000000f}, + {6400.000000f, 2.917792f, 0.000000f}, + {12800.000000f, 6.373769f, 0.000000f}, + }, + /* ******************************************* */ +}; +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif /* End of #ifdef __cplusplus */ + +#endif /* IMX477_CMOS_EX_H */ diff --git a/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx477/imx477_config.h b/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx477/imx477_config.h new file mode 100644 index 0000000000000000000000000000000000000000..2115224087c6ef8be815ae02ab4a178744db3111 --- /dev/null +++ b/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx477/imx477_config.h @@ -0,0 +1,1048 @@ +/* + * Copyright (c) Hisilicon Technologies Co., Ltd. 2023-2023. All rights reserved. + * Description: Header file of imx477_coms + * Author: Hisilicon multimedia software group + * Create: 2023-03-06 + */ + +#ifndef IMX477_CONFIG_H +#define IMX477_CONFIG_H + +#include "hi_media_type.h" + +typedef struct cis_cfg { + hi_u16 address; + hi_u8 value; +} cis_cfg_imx477_t; + +static const cis_cfg_imx477_t imx477_4056x3040_raw12_25fps[] = { + {0x0100, 0x00}, + {0x0136, 0x18}, + {0x0137, 0x00}, + {0x0808, 0x02}, + {0xE07A, 0x01}, + {0xE000, 0x00}, + {0x4AE9, 0x18}, + {0x4AEA, 0x08}, + {0xF61C, 0x04}, + {0xF61E, 0x04}, + {0x4AE9, 0x21}, + {0x4AEA, 0x80}, + {0x38A8, 0x1F}, + {0x38A9, 0xFF}, + {0x38AA, 0x1F}, + {0x38AB, 0xFF}, + {0x420B, 0x01}, + {0x55D4, 0x00}, + {0x55D5, 0x00}, + {0x55D6, 0x07}, + {0x55D7, 0xFF}, + {0x55E8, 0x07}, + {0x55E9, 0xFF}, + {0x55EA, 0x00}, + {0x55EB, 0x00}, + {0x574C, 0x07}, + {0x574D, 0xFF}, + {0x574E, 0x00}, + {0x574F, 0x00}, + {0x5754, 0x00}, + {0x5755, 0x00}, + {0x5756, 0x07}, + {0x5757, 0xFF}, + {0x5973, 0x04}, + {0x5974, 0x01}, + {0x5D13, 0xC3}, + {0x5D14, 0x58}, + {0x5D15, 0xA3}, + {0x5D16, 0x1D}, + {0x5D17, 0x65}, + {0x5D18, 0x8C}, + {0x5D1A, 0x06}, + {0x5D1B, 0xA9}, + {0x5D1C, 0x45}, + {0x5D1D, 0x3A}, + {0x5D1E, 0xAB}, + {0x5D1F, 0x15}, + {0x5D21, 0x0E}, + {0x5D22, 0x52}, + {0x5D23, 0xAA}, + {0x5D24, 0x7D}, + {0x5D25, 0x57}, + {0x5D26, 0xA8}, + {0x5D37, 0x5A}, + {0x5D38, 0x5A}, + {0x5D77, 0x7F}, + {0x7B7C, 0x00}, + {0x7B7D, 0x00}, + {0x8D1F, 0x00}, + {0x8D27, 0x00}, + {0x9004, 0x03}, + {0x9200, 0x50}, + {0x9201, 0x6C}, + {0x9202, 0x71}, + {0x9203, 0x00}, + {0x9204, 0x71}, + {0x9205, 0x01}, + {0x9371, 0x6A}, + {0x9373, 0x6A}, + {0x9375, 0x64}, + {0x990C, 0x00}, + {0x990D, 0x08}, + {0x9956, 0x8C}, + {0x9957, 0x64}, + {0x9958, 0x50}, + {0x9A48, 0x06}, + {0x9A49, 0x06}, + {0x9A4A, 0x06}, + {0x9A4B, 0x06}, + {0x9A4C, 0x06}, + {0x9A4D, 0x06}, + {0xA001, 0x0A}, + {0xA003, 0x0A}, + {0xA005, 0x0A}, + {0xA006, 0x01}, + {0xA007, 0xC0}, + {0xA009, 0xC0}, + {0x5078, 0x01}, + {0x0112, 0x0C}, + {0x0113, 0x0C}, + {0x0114, 0x01}, + {0x0342, 0x2A}, + {0x0343, 0x30}, + {0x0340, 0x0C}, + {0x0341, 0x1C}, + {0x0344, 0x00}, + {0x0345, 0x00}, + {0x0346, 0x00}, + {0x0347, 0x00}, + {0x0348, 0x0F}, + {0x0349, 0xD7}, + {0x034A, 0x0B}, + {0x034B, 0xDF}, + {0x00E3, 0x00}, + {0x00E4, 0x00}, + {0x00FC, 0x0A}, + {0x00FD, 0x0A}, + {0x00FE, 0x0A}, + {0x00FF, 0x0A}, + {0xE013, 0x00}, + {0x0220, 0x00}, + {0x0221, 0x11}, + {0x0381, 0x01}, + {0x0383, 0x01}, + {0x0385, 0x01}, + {0x0387, 0x01}, + {0x0900, 0x00}, + {0x0901, 0x11}, + {0x0902, 0x02}, + {0x3140, 0x02}, + {0x3C00, 0x00}, + {0x3C01, 0x03}, + {0x3C02, 0xA2}, + {0x3F0D, 0x01}, + {0x5748, 0x07}, + {0x5749, 0xFF}, + {0x574A, 0x00}, + {0x574B, 0x00}, + {0x7B75, 0x0A}, + {0x7B76, 0x0C}, + {0x7B77, 0x07}, + {0x7B78, 0x06}, + {0x7B79, 0x3C}, + {0x7B53, 0x01}, + {0x9369, 0x5A}, + {0x936B, 0x55}, + {0x936D, 0x28}, + {0x9304, 0x03}, + {0x9305, 0x00}, + {0x9E9A, 0x2F}, + {0x9E9B, 0x2F}, + {0x9E9C, 0x2F}, + {0x9E9D, 0x00}, + {0x9E9E, 0x00}, + {0x9E9F, 0x00}, + {0xA2A9, 0x60}, + {0xA2B7, 0x00}, + {0x0401, 0x00}, + {0x0404, 0x00}, + {0x0405, 0x10}, + {0x0408, 0x00}, + {0x0409, 0x00}, + {0x040A, 0x00}, + {0x040B, 0x00}, + {0x040C, 0x0F}, + {0x040D, 0xD8}, + {0x040E, 0x0B}, + {0x040F, 0xE0}, + {0x034C, 0x0F}, + {0x034D, 0xD8}, + {0x034E, 0x0B}, + {0x034F, 0xE0}, + {0x0301, 0x05}, + {0x0303, 0x02}, + {0x0305, 0x02}, + {0x0306, 0x00}, + {0x0307, 0xAF}, + {0x0309, 0x0C}, + {0x030B, 0x01}, + {0x030D, 0x02}, + {0x030E, 0x01}, + {0x030F, 0x5E}, + {0x0310, 0x00}, + {0x0820, 0x10}, + {0x0821, 0x68}, + {0x0822, 0x00}, + {0x0823, 0x00}, + {0x080A, 0x00}, + {0x080B, 0xC7}, + {0x080C, 0x00}, + {0x080D, 0x87}, + {0x080E, 0x00}, + {0x080F, 0xDF}, + {0x0810, 0x00}, + {0x0811, 0x97}, + {0x0812, 0x00}, + {0x0813, 0x8F}, + {0x0814, 0x00}, + {0x0815, 0x7F}, + {0x0816, 0x02}, + {0x0817, 0x27}, + {0x0818, 0x00}, + {0x0819, 0x6F}, + {0xE04C, 0x00}, + {0xE04D, 0xDF}, + {0xE04E, 0x00}, + {0xE04F, 0x1F}, + {0x3E20, 0x01}, + {0x3E37, 0x00}, + {0x3F50, 0x00}, + {0x3F56, 0x01}, + {0x3F57, 0x35}, + {0x0100, 0x01}, +}; + +static const cis_cfg_imx477_t imx477_4k_raw10_45fps[] = { + {0x0100, 0x00}, + {0x0136, 0x18}, + {0x0137, 0x00}, + {0x0808, 0x02}, + {0xE07A, 0x01}, + {0xE000, 0x00}, + {0x4AE9, 0x18}, + {0x4AEA, 0x08}, + {0xF61C, 0x04}, + {0xF61E, 0x04}, + {0x4AE9, 0x21}, + {0x4AEA, 0x80}, + {0x38A8, 0x1F}, + {0x38A9, 0xFF}, + {0x38AA, 0x1F}, + {0x38AB, 0xFF}, + {0x420B, 0x01}, + {0x55D4, 0x00}, + {0x55D5, 0x00}, + {0x55D6, 0x07}, + {0x55D7, 0xFF}, + {0x55E8, 0x07}, + {0x55E9, 0xFF}, + {0x55EA, 0x00}, + {0x55EB, 0x00}, + {0x574C, 0x07}, + {0x574D, 0xFF}, + {0x574E, 0x00}, + {0x574F, 0x00}, + {0x5754, 0x00}, + {0x5755, 0x00}, + {0x5756, 0x07}, + {0x5757, 0xFF}, + {0x5973, 0x04}, + {0x5974, 0x01}, + {0x5D13, 0xC3}, + {0x5D14, 0x58}, + {0x5D15, 0xA3}, + {0x5D16, 0x1D}, + {0x5D17, 0x65}, + {0x5D18, 0x8C}, + {0x5D1A, 0x06}, + {0x5D1B, 0xA9}, + {0x5D1C, 0x45}, + {0x5D1D, 0x3A}, + {0x5D1E, 0xAB}, + {0x5D1F, 0x15}, + {0x5D21, 0x0E}, + {0x5D22, 0x52}, + {0x5D23, 0xAA}, + {0x5D24, 0x7D}, + {0x5D25, 0x57}, + {0x5D26, 0xA8}, + {0x5D37, 0x5A}, + {0x5D38, 0x5A}, + {0x5D77, 0x7F}, + {0x7B7C, 0x00}, + {0x7B7D, 0x00}, + {0x8D1F, 0x00}, + {0x8D27, 0x00}, + {0x9004, 0x03}, + {0x9200, 0x50}, + {0x9201, 0x6C}, + {0x9202, 0x71}, + {0x9203, 0x00}, + {0x9204, 0x71}, + {0x9205, 0x01}, + {0x9371, 0x6A}, + {0x9373, 0x6A}, + {0x9375, 0x64}, + {0x990C, 0x00}, + {0x990D, 0x08}, + {0x9956, 0x8C}, + {0x9957, 0x64}, + {0x9958, 0x50}, + {0x9A48, 0x06}, + {0x9A49, 0x06}, + {0x9A4A, 0x06}, + {0x9A4B, 0x06}, + {0x9A4C, 0x06}, + {0x9A4D, 0x06}, + {0xA001, 0x0A}, + {0xA003, 0x0A}, + {0xA005, 0x0A}, + {0xA006, 0x01}, + {0xA007, 0xC0}, + {0xA009, 0xC0}, + {0x5078, 0x01}, + {0x0112, 0x0A}, + {0x0113, 0x0A}, + {0x0114, 0x01}, + {0x0342, 0x1D}, + {0x0343, 0x00}, + {0x0340, 0x0C}, + {0x0341, 0x1C}, + {0x0344, 0x00}, + {0x0345, 0x00}, + {0x0346, 0x00}, + {0x0347, 0x00}, + {0x0348, 0x0F}, + {0x0349, 0x00}, + {0x034A, 0x08}, + {0x034B, 0x70}, + {0x00E3, 0x00}, + {0x00E4, 0x00}, + {0x00FC, 0x0A}, + {0x00FD, 0x0A}, + {0x00FE, 0x0A}, + {0x00FF, 0x0A}, + {0xE013, 0x00}, + {0x0220, 0x00}, + {0x0221, 0x11}, + {0x0381, 0x01}, + {0x0383, 0x01}, + {0x0385, 0x01}, + {0x0387, 0x01}, + {0x0900, 0x00}, + {0x0901, 0x11}, + {0x0902, 0x02}, + {0x3140, 0x02}, + {0x3C00, 0x00}, + {0x3C01, 0x03}, + {0x3C02, 0xA2}, + {0x3F0D, 0x01}, + {0x5748, 0x07}, + {0x5749, 0xFF}, + {0x574A, 0x00}, + {0x574B, 0x00}, + {0x7B75, 0x0A}, + {0x7B76, 0x0C}, + {0x7B77, 0x07}, + {0x7B78, 0x06}, + {0x7B79, 0x3C}, + {0x7B53, 0x01}, + {0x9369, 0x5A}, + {0x936B, 0x55}, + {0x936D, 0x28}, + {0x9304, 0x03}, + {0x9305, 0x00}, + {0x9E9A, 0x2F}, + {0x9E9B, 0x2F}, + {0x9E9C, 0x2F}, + {0x9E9D, 0x00}, + {0x9E9E, 0x00}, + {0x9E9F, 0x00}, + {0xA2A9, 0x60}, + {0xA2B7, 0x00}, + {0x0401, 0x00}, + {0x0404, 0x00}, + {0x0405, 0x10}, + {0x0408, 0x00}, + {0x0409, 0x00}, + {0x040A, 0x00}, + {0x040B, 0x00}, + {0x040C, 0x0F}, + {0x040D, 0x00}, + {0x040E, 0x08}, + {0x040F, 0x70}, + {0x034C, 0x0F}, + {0x034D, 0x00}, + {0x034E, 0x08}, + {0x034F, 0x70}, + {0x0301, 0x05}, + {0x0303, 0x02}, + {0x0305, 0x02}, + {0x0306, 0x00}, + {0x0307, 0xAF}, + {0x0309, 0x0C}, + {0x030B, 0x01}, + {0x030D, 0x02}, + {0x030E, 0x01}, + {0x030F, 0x5E}, + {0x0310, 0x00}, + {0x0820, 0x10}, + {0x0821, 0x68}, + {0x0822, 0x00}, + {0x0823, 0x00}, + {0x080A, 0x00}, + {0x080B, 0xC7}, + {0x080C, 0x00}, + {0x080D, 0x87}, + {0x080E, 0x00}, + {0x080F, 0xDF}, + {0x0810, 0x00}, + {0x0811, 0x97}, + {0x0812, 0x00}, + {0x0813, 0x8F}, + {0x0814, 0x00}, + {0x0815, 0x7F}, + {0x0816, 0x02}, + {0x0817, 0x27}, + {0x0818, 0x00}, + {0x0819, 0x6F}, + {0xE04C, 0x00}, + {0xE04D, 0xDF}, + {0xE04E, 0x00}, + {0xE04F, 0x1F}, + {0x3E20, 0x01}, + {0x3E37, 0x00}, + {0x3F50, 0x00}, + {0x3F56, 0x01}, + {0x3F57, 0x35}, + {0x0100, 0x01}, +}; + +/* 3264*2448 20fps 2Lane ok */ +static const cis_cfg_imx477_t imx477_4056x3040_dol2_raw10_15fps[] = { + {0x0100, 0x00}, + {0x0136, 0x18}, + {0x0137, 0x00}, + {0x0808, 0x02}, + {0xE07A, 0x01}, + {0xE000, 0x00}, + {0x4AE9, 0x18}, + {0x4AEA, 0x08}, + {0xF61C, 0x04}, + {0xF61E, 0x04}, + {0x4AE9, 0x21}, + {0x4AEA, 0x80}, + {0x38A8, 0x1F}, + {0x38A9, 0xFF}, + {0x38AA, 0x1F}, + {0x38AB, 0xFF}, + {0x420B, 0x01}, + {0x55D4, 0x00}, + {0x55D5, 0x00}, + {0x55D6, 0x07}, + {0x55D7, 0xFF}, + {0x55E8, 0x07}, + {0x55E9, 0xFF}, + {0x55EA, 0x00}, + {0x55EB, 0x00}, + {0x574C, 0x07}, + {0x574D, 0xFF}, + {0x574E, 0x00}, + {0x574F, 0x00}, + {0x5754, 0x00}, + {0x5755, 0x00}, + {0x5756, 0x07}, + {0x5757, 0xFF}, + {0x5973, 0x04}, + {0x5974, 0x01}, + {0x5D13, 0xC3}, + {0x5D14, 0x58}, + {0x5D15, 0xA3}, + {0x5D16, 0x1D}, + {0x5D17, 0x65}, + {0x5D18, 0x8C}, + {0x5D1A, 0x06}, + {0x5D1B, 0xA9}, + {0x5D1C, 0x45}, + {0x5D1D, 0x3A}, + {0x5D1E, 0xAB}, + {0x5D1F, 0x15}, + {0x5D21, 0x0E}, + {0x5D22, 0x52}, + {0x5D23, 0xAA}, + {0x5D24, 0x7D}, + {0x5D25, 0x57}, + {0x5D26, 0xA8}, + {0x5D37, 0x5A}, + {0x5D38, 0x5A}, + {0x5D77, 0x7F}, + {0x7B7C, 0x00}, + {0x7B7D, 0x00}, + {0x8D1F, 0x00}, + {0x8D27, 0x00}, + {0x9004, 0x03}, + {0x9200, 0x50}, + {0x9201, 0x6C}, + {0x9202, 0x71}, + {0x9203, 0x00}, + {0x9204, 0x71}, + {0x9205, 0x01}, + {0x9371, 0x6A}, + {0x9373, 0x6A}, + {0x9375, 0x64}, + {0x990C, 0x00}, + {0x990D, 0x08}, + {0x9956, 0x8C}, + {0x9957, 0x64}, + {0x9958, 0x50}, + {0x9A48, 0x06}, + {0x9A49, 0x06}, + {0x9A4A, 0x06}, + {0x9A4B, 0x06}, + {0x9A4C, 0x06}, + {0x9A4D, 0x06}, + {0xA001, 0x0A}, + {0xA003, 0x0A}, + {0xA005, 0x0A}, + {0xA006, 0x01}, + {0xA007, 0xC0}, + {0xA009, 0xC0}, + {0x5078, 0x01}, + {0x0112, 0x0A}, + {0x0113, 0x0A}, + {0x0114, 0x01}, + {0x0342, 0x21}, + {0x0343, 0x34}, + {0x0340, 0x0C}, + {0x0341, 0x1C}, + {0x0344, 0x00}, + {0x0345, 0x00}, + {0x0346, 0x00}, + {0x0347, 0x00}, + {0x0348, 0x0F}, + {0x0349, 0xD7}, + {0x034A, 0x0B}, + {0x034B, 0xDF}, + {0x00E3, 0x01}, + {0x00E4, 0x01}, + {0x00FC, 0x0A}, + {0x00FD, 0x0A}, + {0x00FE, 0x0A}, + {0x00FF, 0x0A}, + {0xE013, 0x01}, + {0x0220, 0x00}, + {0x0221, 0x11}, + {0x0381, 0x01}, + {0x0383, 0x01}, + {0x0385, 0x01}, + {0x0387, 0x01}, + {0x0900, 0x00}, + {0x0901, 0x11}, + {0x0902, 0x02}, + {0x3140, 0x02}, + {0x3C00, 0x00}, + {0x3C01, 0x03}, + {0x3C02, 0xDC}, + {0x3F0D, 0x00}, + {0x5748, 0x07}, + {0x5749, 0xFF}, + {0x574A, 0x00}, + {0x574B, 0x00}, + {0x7B75, 0x0E}, + {0x7B76, 0x09}, + {0x7B77, 0x0C}, + {0x7B78, 0x06}, + {0x7B79, 0x3B}, + {0x7B53, 0x01}, + {0x9369, 0x5A}, + {0x936B, 0x55}, + {0x936D, 0x28}, + {0x9304, 0x03}, + {0x9305, 0x00}, + {0x9E9A, 0x2F}, + {0x9E9B, 0x2F}, + {0x9E9C, 0x2F}, + {0x9E9D, 0x00}, + {0x9E9E, 0x00}, + {0x9E9F, 0x00}, + {0xA2A9, 0x60}, + {0xA2B7, 0x00}, + {0x0401, 0x00}, + {0x0404, 0x00}, + {0x0405, 0x10}, + {0x0408, 0x00}, + {0x0409, 0x00}, + {0x040A, 0x00}, + {0x040B, 0x00}, + {0x040C, 0x0F}, + {0x040D, 0xD8}, + {0x040E, 0x0B}, + {0x040F, 0xE0}, + {0x034C, 0x0F}, + {0x034D, 0xD8}, + {0x034E, 0x0B}, + {0x034F, 0xE0}, + {0x0301, 0x05}, + {0x0303, 0x02}, + {0x0305, 0x02}, + {0x0306, 0x00}, + {0x0307, 0xAF}, + {0x0309, 0x0A}, + {0x030B, 0x01}, + {0x030D, 0x02}, + {0x030E, 0x01}, + {0x030F, 0x5E}, + {0x0310, 0x00}, + {0x0820, 0x10}, + {0x0821, 0x68}, + {0x0822, 0x00}, + {0x0823, 0x00}, + {0x080A, 0x00}, + {0x080B, 0xC7}, + {0x080C, 0x00}, + {0x080D, 0x87}, + {0x080E, 0x00}, + {0x080F, 0xDF}, + {0x0810, 0x00}, + {0x0811, 0x97}, + {0x0812, 0x00}, + {0x0813, 0x8F}, + {0x0814, 0x00}, + {0x0815, 0x7F}, + {0x0816, 0x02}, + {0x0817, 0x27}, + {0x0818, 0x00}, + {0x0819, 0x6F}, + {0xE04C, 0x00}, + {0xE04D, 0xDF}, + {0xE04E, 0x00}, + {0xE04F, 0x1F}, + {0x3E20, 0x01}, + {0x3E37, 0x00}, + {0x3F50, 0x00}, + {0x3F56, 0x00}, + {0x3F57, 0xF3}, + {0x0100, 0x01}, +}; + +static const cis_cfg_imx477_t imx477_1920x1080_dol2_raw10[] = { + {0x0100, 0x00}, + {0x0136, 0x18}, + {0x0137, 0x00}, + {0x0808, 0x02}, + {0xE07A, 0x01}, + {0xE000, 0x00}, + {0x4AE9, 0x18}, + {0x4AEA, 0x08}, + {0xF61C, 0x04}, + {0xF61E, 0x04}, + {0x4AE9, 0x21}, + {0x4AEA, 0x80}, + {0x38A8, 0x1F}, + {0x38A9, 0xFF}, + {0x38AA, 0x1F}, + {0x38AB, 0xFF}, + {0x420B, 0x01}, + {0x55D4, 0x00}, + {0x55D5, 0x00}, + {0x55D6, 0x07}, + {0x55D7, 0xFF}, + {0x55E8, 0x07}, + {0x55E9, 0xFF}, + {0x55EA, 0x00}, + {0x55EB, 0x00}, + {0x574C, 0x07}, + {0x574D, 0xFF}, + {0x574E, 0x00}, + {0x574F, 0x00}, + {0x5754, 0x00}, + {0x5755, 0x00}, + {0x5756, 0x07}, + {0x5757, 0xFF}, + {0x5973, 0x04}, + {0x5974, 0x01}, + {0x5D13, 0xC3}, + {0x5D14, 0x58}, + {0x5D15, 0xA3}, + {0x5D16, 0x1D}, + {0x5D17, 0x65}, + {0x5D18, 0x8C}, + {0x5D1A, 0x06}, + {0x5D1B, 0xA9}, + {0x5D1C, 0x45}, + {0x5D1D, 0x3A}, + {0x5D1E, 0xAB}, + {0x5D1F, 0x15}, + {0x5D21, 0x0E}, + {0x5D22, 0x52}, + {0x5D23, 0xAA}, + {0x5D24, 0x7D}, + {0x5D25, 0x57}, + {0x5D26, 0xA8}, + {0x5D37, 0x5A}, + {0x5D38, 0x5A}, + {0x5D77, 0x7F}, + {0x7B7C, 0x00}, + {0x7B7D, 0x00}, + {0x8D1F, 0x00}, + {0x8D27, 0x00}, + {0x9004, 0x03}, + {0x9200, 0x50}, + {0x9201, 0x6C}, + {0x9202, 0x71}, + {0x9203, 0x00}, + {0x9204, 0x71}, + {0x9205, 0x01}, + {0x9371, 0x6A}, + {0x9373, 0x6A}, + {0x9375, 0x64}, + {0x990C, 0x00}, + {0x990D, 0x08}, + {0x9956, 0x8C}, + {0x9957, 0x64}, + {0x9958, 0x50}, + {0x9A48, 0x06}, + {0x9A49, 0x06}, + {0x9A4A, 0x06}, + {0x9A4B, 0x06}, + {0x9A4C, 0x06}, + {0x9A4D, 0x06}, + {0xA001, 0x0A}, + {0xA003, 0x0A}, + {0xA005, 0x0A}, + {0xA006, 0x01}, + {0xA007, 0xC0}, + {0xA009, 0xC0}, + {0x5078, 0x01}, + {0x0112, 0x0A}, + {0x0113, 0x0A}, + {0x0114, 0x01}, + {0x0342, 0x21}, + {0x0343, 0x34}, + {0x0340, 0x0C}, + {0x0341, 0x1C}, + {0x0344, 0x00}, + {0x0345, 0x00}, + {0x0346, 0x00}, + {0x0347, 0x00}, + {0x0348, 0x0F}, + {0x0349, 0xD7}, + {0x034A, 0x0B}, + {0x034B, 0xDF}, + {0x00E3, 0x01}, + {0x00E4, 0x01}, + {0x00FC, 0x0A}, + {0x00FD, 0x0A}, + {0x00FE, 0x0A}, + {0x00FF, 0x0A}, + {0xE013, 0x01}, + {0x0220, 0x00}, + {0x0221, 0x11}, + {0x0381, 0x01}, + {0x0383, 0x01}, + {0x0385, 0x01}, + {0x0387, 0x01}, + {0x0900, 0x00}, + {0x0901, 0x11}, + {0x0902, 0x02}, + {0x3140, 0x02}, + {0x3C00, 0x00}, + {0x3C01, 0x03}, + {0x3C02, 0xDC}, + {0x3F0D, 0x00}, + {0x5748, 0x07}, + {0x5749, 0xFF}, + {0x574A, 0x00}, + {0x574B, 0x00}, + {0x7B75, 0x0E}, + {0x7B76, 0x09}, + {0x7B77, 0x0C}, + {0x7B78, 0x06}, + {0x7B79, 0x3B}, + {0x7B53, 0x01}, + {0x9369, 0x5A}, + {0x936B, 0x55}, + {0x936D, 0x28}, + {0x9304, 0x03}, + {0x9305, 0x00}, + {0x9E9A, 0x2F}, + {0x9E9B, 0x2F}, + {0x9E9C, 0x2F}, + {0x9E9D, 0x00}, + {0x9E9E, 0x00}, + {0x9E9F, 0x00}, + {0xA2A9, 0x60}, + {0xA2B7, 0x00}, + {0x0401, 0x00}, + {0x0404, 0x00}, + {0x0405, 0x10}, + {0x0408, 0x00}, + {0x0409, 0x00}, + {0x040A, 0x00}, + {0x040B, 0x00}, + {0x040C, 0x07}, + {0x040D, 0x80}, + {0x040E, 0x04}, + {0x040F, 0x38}, + {0x034C, 0x07}, + {0x034D, 0x80}, + {0x034E, 0x04}, + {0x034F, 0x38}, + {0x0301, 0x05}, + {0x0303, 0x02}, + {0x0305, 0x02}, + {0x0306, 0x00}, + {0x0307, 0xAF}, + {0x0309, 0x0A}, + {0x030B, 0x01}, + {0x030D, 0x02}, + {0x030E, 0x01}, + {0x030F, 0x5E}, + {0x0310, 0x00}, + {0x0820, 0x10}, + {0x0821, 0x68}, + {0x0822, 0x00}, + {0x0823, 0x00}, + {0x080A, 0x00}, + {0x080B, 0xC7}, + {0x080C, 0x00}, + {0x080D, 0x87}, + {0x080E, 0x00}, + {0x080F, 0xDF}, + {0x0810, 0x00}, + {0x0811, 0x97}, + {0x0812, 0x00}, + {0x0813, 0x8F}, + {0x0814, 0x00}, + {0x0815, 0x7F}, + {0x0816, 0x02}, + {0x0817, 0x27}, + {0x0818, 0x00}, + {0x0819, 0x6F}, + {0xE04C, 0x00}, + {0xE04D, 0xDF}, + {0xE04E, 0x00}, + {0xE04F, 0x1F}, + {0x3E20, 0x01}, + {0x3E37, 0x00}, + {0x3F50, 0x00}, + {0x3F56, 0x00}, + {0x3F57, 0xF3}, + {0x0100, 0x01}, +}; + +static const cis_cfg_imx477_t imx477_1920x1080_raw12[] = { + {0x0100, 0x00}, + {0x0136, 0x18}, + {0x0137, 0x00}, + {0x0808, 0x02}, + {0xE07A, 0x01}, + {0xE000, 0x00}, + {0x4AE9, 0x18}, + {0x4AEA, 0x08}, + {0xF61C, 0x04}, + {0xF61E, 0x04}, + {0x4AE9, 0x21}, + {0x4AEA, 0x80}, + {0x38A8, 0x1F}, + {0x38A9, 0xFF}, + {0x38AA, 0x1F}, + {0x38AB, 0xFF}, + {0x420B, 0x01}, + {0x55D4, 0x00}, + {0x55D5, 0x00}, + {0x55D6, 0x07}, + {0x55D7, 0xFF}, + {0x55E8, 0x07}, + {0x55E9, 0xFF}, + {0x55EA, 0x00}, + {0x55EB, 0x00}, + {0x574C, 0x07}, + {0x574D, 0xFF}, + {0x574E, 0x00}, + {0x574F, 0x00}, + {0x5754, 0x00}, + {0x5755, 0x00}, + {0x5756, 0x07}, + {0x5757, 0xFF}, + {0x5973, 0x04}, + {0x5974, 0x01}, + {0x5D13, 0xC3}, + {0x5D14, 0x58}, + {0x5D15, 0xA3}, + {0x5D16, 0x1D}, + {0x5D17, 0x65}, + {0x5D18, 0x8C}, + {0x5D1A, 0x06}, + {0x5D1B, 0xA9}, + {0x5D1C, 0x45}, + {0x5D1D, 0x3A}, + {0x5D1E, 0xAB}, + {0x5D1F, 0x15}, + {0x5D21, 0x0E}, + {0x5D22, 0x52}, + {0x5D23, 0xAA}, + {0x5D24, 0x7D}, + {0x5D25, 0x57}, + {0x5D26, 0xA8}, + {0x5D37, 0x5A}, + {0x5D38, 0x5A}, + {0x5D77, 0x7F}, + {0x7B7C, 0x00}, + {0x7B7D, 0x00}, + {0x8D1F, 0x00}, + {0x8D27, 0x00}, + {0x9004, 0x03}, + {0x9200, 0x50}, + {0x9201, 0x6C}, + {0x9202, 0x71}, + {0x9203, 0x00}, + {0x9204, 0x71}, + {0x9205, 0x01}, + {0x9371, 0x6A}, + {0x9373, 0x6A}, + {0x9375, 0x64}, + {0x990C, 0x00}, + {0x990D, 0x08}, + {0x9956, 0x8C}, + {0x9957, 0x64}, + {0x9958, 0x50}, + {0x9A48, 0x06}, + {0x9A49, 0x06}, + {0x9A4A, 0x06}, + {0x9A4B, 0x06}, + {0x9A4C, 0x06}, + {0x9A4D, 0x06}, + {0xA001, 0x0A}, + {0xA003, 0x0A}, + {0xA005, 0x0A}, + {0xA006, 0x01}, + {0xA007, 0xC0}, + {0xA009, 0xC0}, + {0x5078, 0x01}, + {0x0112, 0x0C}, + {0x0113, 0x0C}, + {0x0114, 0x01}, + {0x0342, 0x2A}, // LINE_LENGTH_PCK[15:8] + {0x0343, 0x30}, // LINE_LENGTH_PCK[7:0] + {0x0340, 0x0C}, + {0x0341, 0x1C}, + {0x0344, 0x00}, + {0x0345, 0x00}, + {0x0346, 0x00}, + {0x0347, 0x00}, + {0x0348, 0x0F}, + {0x0349, 0xD7}, + {0x034A, 0x0B}, + {0x034B, 0xDF}, + {0x00E3, 0x00}, + {0x00E4, 0x00}, + {0x00FC, 0x0A}, + {0x00FD, 0x0A}, + {0x00FE, 0x0A}, + {0x00FF, 0x0A}, + {0xE013, 0x00}, + {0x0220, 0x00}, + {0x0221, 0x11}, + {0x0381, 0x01}, + {0x0383, 0x01}, + {0x0385, 0x01}, + {0x0387, 0x01}, + {0x0900, 0x00}, + {0x0901, 0x11}, + {0x0902, 0x02}, + {0x3140, 0x02}, + {0x3C00, 0x00}, + {0x3C01, 0x03}, + {0x3C02, 0xA2}, + {0x3F0D, 0x01}, + {0x5748, 0x07}, + {0x5749, 0xFF}, + {0x574A, 0x00}, + {0x574B, 0x00}, + {0x7B75, 0x0A}, + {0x7B76, 0x0C}, + {0x7B77, 0x07}, + {0x7B78, 0x06}, + {0x7B79, 0x3C}, + {0x7B53, 0x01}, + {0x9369, 0x5A}, + {0x936B, 0x55}, + {0x936D, 0x28}, + {0x9304, 0x03}, + {0x9305, 0x00}, + {0x9E9A, 0x2F}, + {0x9E9B, 0x2F}, + {0x9E9C, 0x2F}, + {0x9E9D, 0x00}, + {0x9E9E, 0x00}, + {0x9E9F, 0x00}, + {0xA2A9, 0x60}, + {0xA2B7, 0x00}, + {0x0401, 0x00}, + {0x0404, 0x00}, + {0x0405, 0x10}, + {0x0408, 0x00}, + {0x0409, 0x00}, + {0x040A, 0x00}, + {0x040B, 0x00}, + {0x040C, 0x07}, + {0x040D, 0x7F}, + {0x040E, 0x04}, + {0x040F, 0x38}, + {0x034C, 0x07}, + {0x034D, 0x80}, + {0x034E, 0x04}, + {0x034F, 0x38}, + {0x0301, 0x05}, + {0x0303, 0x02}, + {0x0305, 0x02}, + {0x0306, 0x00}, + {0x0307, 0xAF}, + {0x0309, 0x0C}, + {0x030B, 0x01}, + {0x030D, 0x02}, + {0x030E, 0x01}, + {0x030F, 0x5E}, + {0x0310, 0x00}, + {0x0820, 0x10}, + {0x0821, 0x68}, + {0x0822, 0x00}, + {0x0823, 0x00}, + {0x080A, 0x00}, + {0x080B, 0xC7}, + {0x080C, 0x00}, + {0x080D, 0x87}, + {0x080E, 0x00}, + {0x080F, 0xDF}, + {0x0810, 0x00}, + {0x0811, 0x97}, + {0x0812, 0x00}, + {0x0813, 0x8F}, + {0x0814, 0x00}, + {0x0815, 0x7F}, + {0x0816, 0x02}, + {0x0817, 0x27}, + {0x0818, 0x00}, + {0x0819, 0x6F}, + {0xE04C, 0x00}, + {0xE04D, 0xDF}, + {0xE04E, 0x00}, + {0xE04F, 0x1F}, + {0x3E20, 0x01}, + {0x3E37, 0x00}, + {0x3F50, 0x00}, + {0x3F56, 0x01}, + {0x3F57, 0x35}, + {0x0100, 0x01}, +}; +#endif \ No newline at end of file diff --git a/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx477/imx477_sensor_ctl.c b/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx477/imx477_sensor_ctl.c new file mode 100644 index 0000000000000000000000000000000000000000..a7a072843f6feee4f760f7f6a75c208b93743d86 --- /dev/null +++ b/OnBoardInterface/Camera/MIPICamera/sensor/sony_imx477/imx477_sensor_ctl.c @@ -0,0 +1,333 @@ +/* + * Copyright (c) Hisilicon Technologies Co., Ltd. 2023-2023. All rights reserved. + * Description: Function of imx477 configure sensor + * Author: Hisilicon multimedia software group + * Create: 2023-03-06 + */ + +#include +#include +#include +#include +#include +#include +#include +#include "linux/i2c-dev.h" +#include "imx477_cmos.h" +#include "imx477_config.h" + +static hi_s32 g_fd[HI_ISP_MAX_PIPE_NUM] = {[0 ... (HI_ISP_MAX_PIPE_NUM - 1)] = -1}; + +#define I2C_DEV_FILE_NUM 16U +#define I2C_BUF_NUM 8U + +static hi_s32 imx477_i2c_init(hi_vi_pipe viPipe) +{ + SNS_INFO_TRACE("Camera sensor IMX477 i2c init\n"); + + hi_s32 ret; + char acDevFile[I2C_DEV_FILE_NUM]; + hi_u8 u8DevNum; + + SNS_CHECK_PIPE_RETURN(viPipe); + + if (g_fd[viPipe] >= 0) { + return HI_SUCCESS; + } + + u8DevNum = (hi_u8)g_aunImx477BusInfo[viPipe].i2c_dev; + SNS_INFO_TRACE("Camera sensor IMX477 vipipe :%d , i2c_dev:%u, i2c_addr:%x\n", + viPipe, u8DevNum, IMX477_I2C_ADDR >> 1); + ret = snprintf(acDevFile, sizeof(acDevFile), + sizeof(acDevFile) - 1, "/dev/i2c-%u", u8DevNum); + if (ret < 0) { + SNS_ERR_TRACE("snprintf err\n"); + return HI_FAILURE; + } + + g_fd[viPipe] = open(acDevFile, O_RDWR, S_IRUSR | S_IWUSR); + if (g_fd[viPipe] < 0) { + SNS_ERR_TRACE("Open /dev/hi_i2c_drv-%u error! errno=%d.\n", u8DevNum, errno); + return HI_FAILURE; + } + // Config sensor I2C device address (7bit) + ret = ioctl(g_fd[viPipe], I2C_SLAVE_FORCE, IMX477_I2C_ADDR >> 1); + if (ret < 0) { + SNS_ERR_TRACE("I2C_SLAVE_FORCE error!\n"); + close(g_fd[viPipe]); + g_fd[viPipe] = -1; + return HI_FAILURE; + } + + return HI_SUCCESS; +} + +static hi_s32 imx477_i2c_exit(hi_vi_pipe viPipe) +{ + SNS_CHECK_PIPE_RETURN(viPipe); + + if (g_fd[viPipe] >= 0) { + close(g_fd[viPipe]); + g_fd[viPipe] = -1; + return HI_SUCCESS; + } + return HI_FAILURE; +} + +hi_s32 imx477_read_register(hi_vi_pipe viPipe, hi_u32 addr) +{ + hi_s32 ret; + hi_s32 idx = 0; + char buf[I2C_BUF_NUM]; + + SNS_CHECK_PIPE_RETURN(viPipe); + + if (g_fd[viPipe] < 0) { + return HI_FAILURE; + } + + if (IMX477_ADDR_BYTE == 2) { /* 2 byte */ + buf[idx] = (addr >> 8) & 0xff; /* shift 8 */ + idx++; + buf[idx] = addr & 0xff; + idx++; + } else { + buf[idx] = addr & 0xff; + idx++; + } + + ret = write(g_fd[viPipe], buf, IMX477_ADDR_BYTE); + if (ret < HI_SUCCESS) { + SNS_ERR_TRACE("I2C_WRITE DATA error!\n"); + return HI_FAILURE; + } + + ret = read(g_fd[viPipe], buf, IMX477_DATA_BYTE); + if (ret < HI_SUCCESS) { + SNS_ERR_TRACE("I2C_READ DATA error!\n"); + return HI_FAILURE; + } + + return buf[0]; +} + +hi_s32 imx477_write_register(hi_vi_pipe viPipe, hi_u32 addr, hi_u32 data) +{ + hi_s32 idx = 0; + char buf[I2C_BUF_NUM]; + hi_s32 ret; + + SNS_CHECK_PIPE_RETURN(viPipe); + SNS_INFO_TRACE("viPipe:%d, addr:%x, data:%x\n", viPipe, addr, data); + if (g_fd[viPipe] < 0) { + SNS_ERR_TRACE("fd err:%d\n", g_fd[viPipe]); + return HI_FAILURE; + } + + if (IMX477_ADDR_BYTE == 2) { /* 2 byte */ + buf[idx] = (addr >> 8) & 0xff; /* shift 8 */ + idx++; + buf[idx] = addr & 0xff; + idx++; + } else { + buf[idx] = addr & 0xff; + idx++; + } + + if (IMX477_DATA_BYTE == 2) { /* 2 byte */ + buf[idx] = (data >> 8) & 0xff; /* shift 8 */ + idx++; + buf[idx] = data & 0xff; + idx++; + } else { + buf[idx] = data & 0xff; + idx++; + } + + ret = write(g_fd[viPipe], buf, (IMX477_ADDR_BYTE + IMX477_DATA_BYTE)); + if (ret < HI_SUCCESS) { + SNS_ERR_TRACE("I2C_WRITE DATA error!\n"); + return HI_FAILURE; + } + return HI_SUCCESS; +} + +static hi_s32 imx477_readback_register(hi_vi_pipe viPipe, hi_s32 addr, hi_s32 data) +{ + SNS_CHECK_PIPE_RETURN(viPipe); + hi_s32 read_back_data; + read_back_data = imx477_read_register(viPipe, addr); + if (data != (hi_u8)read_back_data) { + return HI_FAILURE; + } + return HI_SUCCESS; +} + +static hi_void delay_ms(hi_u32 ms) +{ + usleep(ms * 1000U); /* 1ms: 1000us */ + return; +} + +hi_void imx477_standby(hi_vi_pipe viPipe) +{ + SNS_CHECK_PIPE_VOID(viPipe); + hi_s32 ret; + ret = imx477_write_register(viPipe, 0x100, 0x0); + if (ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx477 vipipe:%d standby, write register failed!\n", viPipe); + } + return; +} + +hi_void imx477_restart(hi_vi_pipe viPipe) +{ + SNS_CHECK_PIPE_VOID(viPipe); + return; +} + +hi_void imx477_init(hi_vi_pipe viPipe) +{ + hi_s32 ret = HI_SUCCESS; + hi_u8 img_mode; + SNS_INFO_TRACE("Camera sensor IMX477 viPipe:%d init\n", viPipe); + SNS_CHECK_PIPE_VOID(viPipe); + hi_isp_sns_state *sensor_ctx = HI_NULL; + sensor_ctx = imx477_get_ctx(viPipe); + img_mode = sensor_ctx->img_mode; + + hi_u32 i; + hi_u32 u32SeqEntries; + hi_u16 i2caddr; + hi_u8 i2cvalue; + /* 2. sensor i2c init */ + imx477_i2c_init(viPipe); + // imx477 在接收到解复位信号后,由模组上的电路控制模组的供电,存在一定的时延 + // delay 500 ms + delay_ms(500); + /* When sensor first init, config all registers */ + if (img_mode == IMX477_4056x3040_RAW12_25FPS) { + u32SeqEntries = sizeof(imx477_4056x3040_raw12_25fps) / sizeof(cis_cfg_imx477_t); + for (i = 0 ; i < u32SeqEntries; i++) { + i2caddr = imx477_4056x3040_raw12_25fps[i].address; + i2cvalue = imx477_4056x3040_raw12_25fps[i].value; + ret = imx477_write_register(viPipe, i2caddr, i2cvalue); + if (ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx477 vipipe:%d, i2caddr:%u,i2cvalue:%u, write register failed!\n", + viPipe, i2caddr, i2cvalue); + return; + } + ret = imx477_readback_register(viPipe, i2caddr, i2cvalue); + if (ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx477 vipipe:%d, i2caddr:%u,i2cvalue:%u, read back failed!\n", + viPipe, i2caddr, i2cvalue); + } + } + } else if (img_mode == IMX477_4056x3040_DOL2_RAW10_15fps) { + u32SeqEntries = sizeof(imx477_4056x3040_dol2_raw10_15fps) / sizeof(cis_cfg_imx477_t); + for (i = 0 ; i < u32SeqEntries; i++) { + i2caddr = imx477_4056x3040_dol2_raw10_15fps[i].address; + i2cvalue = imx477_4056x3040_dol2_raw10_15fps[i].value; + ret = imx477_write_register(viPipe, i2caddr, i2cvalue); + if (ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx477 vipipe:%d, i2caddr:%u,i2cvalue:%u, write register failed!\n", + viPipe, i2caddr, i2cvalue); + return; + } + ret = imx477_readback_register(viPipe, i2caddr, i2cvalue); + if (ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx477 vipipe:%d, i2caddr:%u,i2cvalue:%u, read back failed!\n", + viPipe, i2caddr, i2cvalue); + } + } + } else if (img_mode == IMX477_4K_45FPS) { + u32SeqEntries = sizeof(imx477_4k_raw10_45fps) / sizeof(cis_cfg_imx477_t); + for (i = 0 ; i < u32SeqEntries; i++) { + i2caddr = imx477_4k_raw10_45fps[i].address; + i2cvalue = imx477_4k_raw10_45fps[i].value; + ret = imx477_write_register(viPipe, i2caddr, i2cvalue); + if (ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx477 vipipe:%d, i2caddr:%u,i2cvalue:%u, write register failed!\n", + viPipe, i2caddr, i2cvalue); + return; + } + ret = imx477_readback_register(viPipe, i2caddr, i2cvalue); + if (ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx477 vipipe:%d, i2caddr:%u,i2cvalue:%u, read back failed!\n", + viPipe, i2caddr, i2cvalue); + } + } + } else if (img_mode == IMX477_1920x1080_RAW12) { + u32SeqEntries = sizeof(imx477_1920x1080_raw12) / sizeof(cis_cfg_imx477_t); + for (i = 0 ; i < u32SeqEntries; i++) { + i2caddr = imx477_1920x1080_raw12[i].address; + i2cvalue = imx477_1920x1080_raw12[i].value; + ret = imx477_write_register(viPipe, i2caddr, i2cvalue); + if (ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx477 vipipe:%d, i2caddr:%u,i2cvalue:%u, write register failed!\n", + viPipe, i2caddr, i2cvalue); + return; + } + ret = imx477_readback_register(viPipe, i2caddr, i2cvalue); + if (ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx477 vipipe:%d, i2caddr:%u,i2cvalue:%u, read back failed!\n", + viPipe, i2caddr, i2cvalue); + } + } + } else if (img_mode == IMX477_1920x1080_DOL2_RAW10) { + u32SeqEntries = sizeof(imx477_1920x1080_dol2_raw10) / sizeof(cis_cfg_imx477_t); + for (i = 0 ; i < u32SeqEntries; i++) { + i2caddr = imx477_1920x1080_dol2_raw10[i].address; + i2cvalue = imx477_1920x1080_dol2_raw10[i].value; + ret = imx477_write_register(viPipe, i2caddr, i2cvalue); + if (ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx477 vipipe:%d, i2caddr:%u,i2cvalue:%u, write register failed!\n", + viPipe, i2caddr, i2cvalue); + return; + } + ret = imx477_readback_register(viPipe, i2caddr, i2cvalue); + if (ret != HI_SUCCESS) { + SNS_ERR_TRACE("imx477 vipipe:%d, i2caddr:%u,i2cvalue:%u, read back failed!\n", + viPipe, i2caddr, i2cvalue); + } + } + } else { + SNS_ERR_TRACE("imx477 Not support ImgMode: %d, should less than %d\n", + sensor_ctx->img_mode, IMX477_MODE_BUTT); + return; + } + SNS_INFO_TRACE("Camera sensor IMX477 (viPipe: %d, Operation mode: %s) init success!\n", + viPipe, g_astImx477ModeTbl[img_mode].pszModeName); + sensor_ctx->init = HI_TRUE; // Initialization flag + return; +} + +hi_void imx477_exit(hi_vi_pipe viPipe) +{ + SNS_CHECK_PIPE_VOID(viPipe); + imx477_standby(viPipe); + imx477_i2c_exit(viPipe); + + return; +} + +/* Chip ID */ +#define IMX477_CHIP_ID_REG 0x0016 +#define IMX477_CHIP_ID 0x0477 +#define CHIP_ID_LENGTH 2U +/* Verify chip ID */ +hi_s32 imx477_identify_module(hi_vi_pipe viPipe) +{ + SNS_CHECK_PIPE_RETURN(viPipe); + imx477_i2c_init(viPipe); + delay_ms(20); // delay 20 ms + + if (HIGH_8BITS(IMX477_CHIP_ID) != imx477_read_register(viPipe, IMX477_CHIP_ID_REG) || + LOW_8BITS(IMX477_CHIP_ID) != imx477_read_register(viPipe, IMX477_CHIP_ID_REG + 1)) { + SNS_INFO_TRACE("viPipe=%d, imx477 chip id recognition failed!\n", viPipe); + imx477_i2c_exit(viPipe); + return HI_FAILURE; + } + + return HI_SUCCESS; +} \ No newline at end of file diff --git a/OnBoardInterface/Camera/MIPICamera/sensor_sample/sensor_management.c b/OnBoardInterface/Camera/MIPICamera/sensor_sample/sensor_management.c new file mode 100644 index 0000000000000000000000000000000000000000..959d80cc64d49c35aedf1e5d6e8b2474ead85474 --- /dev/null +++ b/OnBoardInterface/Camera/MIPICamera/sensor_sample/sensor_management.c @@ -0,0 +1,193 @@ +#include "sensor_management.h" +#include "sony_imx219_config.h" +#include "sony_imx477_config.h" + +hi_s32 Sample_Set_Mipi_2lane(combo_dev_t MipiDev, combo_dev_attr_t* pstComboAttr) +{ + pstComboAttr->devno = MipiDev; + switch(MipiDev){ + case 0: + pstComboAttr->mipi_attr.lane_id[0]= 0; + pstComboAttr->mipi_attr.lane_id[1]= 2; + break; + case 1: + pstComboAttr->mipi_attr.lane_id[0]= 1; + pstComboAttr->mipi_attr.lane_id[1]= 3; + break; + case 2: + pstComboAttr->mipi_attr.lane_id[0]= 4; + pstComboAttr->mipi_attr.lane_id[1]= 6; + break; + case 3: + pstComboAttr->mipi_attr.lane_id[0]= 5; + pstComboAttr->mipi_attr.lane_id[1]= 7; + break; + default: + printf("Function %s() Error. MipiDev: %d\n", __FUNCTION__, MipiDev); + return HI_FAILURE; + } + return HI_SUCCESS; +} + +hi_s32 Sample_Comm_Vi_GetComboAttrBySns(SAMPLE_SNS_TYPE_E enSnsType, combo_dev_t MipiDev, combo_dev_attr_t* pstComboAttr) +{ + hi_s32 ret; + switch (enSnsType) { + case SONY_IMX219_MIPI_3K_10BIT_NORMAL: + memcpy(pstComboAttr, &MIPI_2lane_CHN0_SENSOR_IMX219_10BIT_24M_NOWDR_ATTR, sizeof(combo_dev_attr_t)); + ret = Sample_Set_Mipi_2lane(MipiDev, pstComboAttr); + break; + case SONY_IMX219_MIPI_1920x1080_10BIT_NORMAL: + case SONY_IMX219_MIPI_1920x1080_10BIT_30FPS_NORMAL: + memcpy(pstComboAttr, &MIPI_2lane_CHN0_SENSOR_IMX219_10BIT_1920x1080_NOWDR_ATTR, sizeof(combo_dev_attr_t)); + ret = Sample_Set_Mipi_2lane(MipiDev, pstComboAttr); + break; + case SONY_IMX477_MIPI_1920x1080_10BIT_DOL2_15FPS: + memcpy(pstComboAttr, &MIPI_2lane_CHN0_SENSOR_IMX477_10BIT_1920x1080_DOL2_ATTR, sizeof(combo_dev_attr_t)); + pstComboAttr->devno = MipiDev; + ret = Sample_Set_Mipi_2lane(MipiDev, pstComboAttr); + break; + default: + printf("Function %s() Error. Undefined sensor type: %#x\n", __FUNCTION__, enSnsType); + return HI_FAILURE; + } + return ret; +} + +hi_s32 Sample_Comm_Vi_GetSnsRstSourceBySns(SAMPLE_SNS_TYPE_E enSnsType, combo_dev_t MipiDev, sns_rst_source_t* sns_reset_port) +{ + switch (enSnsType) { + case SONY_IMX219_MIPI_3K_10BIT_NORMAL: + case SONY_IMX219_MIPI_1920x1080_10BIT_NORMAL: + case SONY_IMX219_MIPI_1920x1080_10BIT_30FPS_NORMAL: + case SONY_IMX477_MIPI_1920x1080_10BIT_DOL2_15FPS: + if (MipiDev == 0 || MipiDev == 1) { + *sns_reset_port = 0; + } + if (MipiDev == 2 || MipiDev == 3) { + *sns_reset_port = 1; + } + break; + default: + printf("Function %s() Error. Undefined sensor type: %#x\n", __FUNCTION__, enSnsType); + return HI_FAILURE; + } + return HI_SUCCESS; +} + +hi_s32 Sample_Comm_Vi_GetSnsClkCfgBySns(SAMPLE_SNS_TYPE_E enSnsType, combo_dev_t MipiDev, sns_clk_cfg_t* sns_clk_cfg) +{ + switch (enSnsType) { + case SONY_IMX219_MIPI_3K_10BIT_NORMAL: + case SONY_IMX219_MIPI_1920x1080_10BIT_NORMAL: + case SONY_IMX219_MIPI_1920x1080_10BIT_30FPS_NORMAL: + case SONY_IMX477_MIPI_1920x1080_10BIT_DOL2_15FPS: + memcpy(sns_clk_cfg, &g_mipi_sns_clk_cfg_attr, sizeof(sns_clk_cfg_t)); + break; + default: + printf("Function %s() Error. Undefined sensor type: %#x\n", __FUNCTION__, enSnsType); + return HI_FAILURE; + } + return HI_SUCCESS; +} + +hi_s32 Sample_Comm_Isp_GetIspAttrBySns(SAMPLE_SNS_TYPE_E enSnsType, hi_isp_pub_attr* pstPubAttr) +{ + switch (enSnsType) + { + case SONY_IMX219_MIPI_3K_10BIT_NORMAL: + memcpy(pstPubAttr, &ISP_PUB_ATTR_IMX219_24M_20FPS_raw10, sizeof(hi_isp_pub_attr)); + break; + case SONY_IMX219_MIPI_1920x1080_10BIT_NORMAL: + memcpy(pstPubAttr, &ISP_PUB_ATTR_IMX219_1920x1080_20FPS_raw10, sizeof(hi_isp_pub_attr)); + break; + case SONY_IMX219_MIPI_1920x1080_10BIT_30FPS_NORMAL: + memcpy(pstPubAttr, &ISP_PUB_ATTR_IMX219_1920x1080_30FPS_raw10, sizeof(hi_isp_pub_attr)); + break; + case SONY_IMX477_MIPI_1920x1080_10BIT_DOL2_15FPS: + memcpy(pstPubAttr, &ISP_PUB_ATTR_IMX477_1920x1080_10FPS_DOL2_RAW10, + sizeof(hi_isp_pub_attr)); + break; + default: + printf("Function %s() Error. Undefined sensor type: %#x\n", __FUNCTION__, enSnsType); + return HI_FAILURE; + } + + return HI_SUCCESS; +} + +hi_s32 Sample_Comm_Vi_GetDevAttrBySns(SAMPLE_SNS_TYPE_E enSnsType, hi_vi_dev_attr* pstViDevAttr) +{ + switch (enSnsType) + { + case SONY_IMX219_MIPI_3K_10BIT_NORMAL: + memcpy(pstViDevAttr, &DEV_ATTR_IMX219_24M, sizeof(hi_vi_dev_attr)); + break; + case SONY_IMX219_MIPI_1920x1080_10BIT_NORMAL: + case SONY_IMX219_MIPI_1920x1080_10BIT_30FPS_NORMAL: + memcpy(pstViDevAttr, &DEV_ATTR_IMX219_1920x1080, sizeof(hi_vi_dev_attr)); + break; + case SONY_IMX477_MIPI_1920x1080_10BIT_DOL2_15FPS: + memcpy(pstViDevAttr, &DEV_ATTR_IMX477_1920x1080_DOL2, + sizeof(hi_vi_dev_attr)); + break; + default: + printf("Function %s() Error. Undefined sensor type: %#x\n", __FUNCTION__, enSnsType); + return HI_FAILURE; + } + + return HI_SUCCESS; +} + +hi_s32 Sample_Comm_Vi_GetPipeAttrBySns(SAMPLE_SNS_TYPE_E enSnsType, hi_vi_pipe_attr* pstPipeAttr) +{ + switch (enSnsType) + { + case SONY_IMX219_MIPI_3K_10BIT_NORMAL: + memcpy(pstPipeAttr, &IMX219_PIPE_ATTR_3264x2448_RAW10_420_3DNR_RFR, sizeof(hi_vi_pipe_attr)); + break; + case SONY_IMX219_MIPI_1920x1080_10BIT_NORMAL: + case SONY_IMX219_MIPI_1920x1080_10BIT_30FPS_NORMAL: + memcpy(pstPipeAttr, &IMX219_PIPE_ATTR_1920x1080_RAW10_420_3DNR_RFR, sizeof(hi_vi_pipe_attr)); + break; + case SONY_IMX477_MIPI_1920x1080_10BIT_DOL2_15FPS: + memcpy(pstPipeAttr, &IMX477_PIPE_ATTR_1920x1080_RAW10_420_3DNR_RFR, + sizeof(hi_vi_pipe_attr)); + break; + default: + return HI_FAILURE; + } + + return HI_SUCCESS; +} + +hi_s32 Sample_Comm_Vi_GetChnAttrBySns(SAMPLE_SNS_TYPE_E enSnsType, hi_vi_chn_attr* pstChnAttr) +{ + switch (enSnsType) + { + case SONY_IMX219_MIPI_3K_10BIT_NORMAL: + memcpy(pstChnAttr, &IMX219_CHN_ATTR_3264x2448_420_SDR8_LINEAR, sizeof(hi_vi_chn_attr)); + break; + case SONY_IMX219_MIPI_1920x1080_10BIT_NORMAL: + case SONY_IMX219_MIPI_1920x1080_10BIT_30FPS_NORMAL: + memcpy(pstChnAttr, &IMX219_CHN_ATTR_1920x1080_420_SDR8_LINEAR, sizeof(hi_vi_chn_attr)); + break; + case SONY_IMX477_MIPI_1920x1080_10BIT_DOL2_15FPS: + memcpy(pstChnAttr, &IMX477_CHN_ATTR_1920x1080_420_SDR8_LINEAR, + sizeof(hi_vi_chn_attr)); + break; + default: + return HI_FAILURE; + } + return HI_SUCCESS; +} + +const hi_isp_sns_obj* g_enSnsObj[MAX_SENSOR_NUM] = { + &g_sns_imx219_obj, + &g_sns_imx477_obj, +}; + +const hi_isp_sns_obj* Sample_Comm_Isp_GetSnsObj(hi_u32 u32SnsId) +{ + return g_enSnsObj[u32SnsId]; +} \ No newline at end of file diff --git a/OnBoardInterface/Camera/MIPICamera/sensor_sample/sensor_management.h b/OnBoardInterface/Camera/MIPICamera/sensor_sample/sensor_management.h new file mode 100644 index 0000000000000000000000000000000000000000..1dd0404fdbc95b9cd365b3748d9991b1198fc338 --- /dev/null +++ b/OnBoardInterface/Camera/MIPICamera/sensor_sample/sensor_management.h @@ -0,0 +1,37 @@ +#include "hi_mipi_rx.h" +#include "hi_mpi_isp.h" +#include "hi_common_sns.h" +#include "hi_common_3a.h" +#include "hi_mpi_vi.h" +#include "hi_sns_ctrl.h" +#define MAX_SENSOR_NUM 20 + +#ifndef SENSOR_MANAGEMENT_H +#define SENSOR_MANAGEMENT_H + +typedef unsigned int combo_dev_t; +typedef unsigned int sns_rst_source_t; + +typedef enum HISAMPLE_SNS_TYPE_E +{ + SONY_IMX219_MIPI_3K_10BIT_NORMAL = 0x60, + SONY_IMX219_MIPI_1920x1080_10BIT_NORMAL = 0x62, + SONY_IMX219_MIPI_1920x1080_10BIT_30FPS_NORMAL = 0x64, + SONY_IMX477_MIPI_1920x1080_10BIT_DOL2_15FPS = 0x71, + SAMPLE_SNS_TYPE_BUTT, +} SAMPLE_SNS_TYPE_E; + +const hi_isp_sns_obj* Sample_Comm_Isp_GetSnsObj(hi_u32 u32SnsId); +hi_s32 Sample_Comm_Vi_GetComboAttrBySns(SAMPLE_SNS_TYPE_E enSnsType, combo_dev_t MipiDev, combo_dev_attr_t* pstComboAttr); +hi_s32 Sample_Comm_Isp_GetIspAttrBySns(SAMPLE_SNS_TYPE_E enSnsType, hi_isp_pub_attr* pstPubAttr); +hi_s32 Sample_Comm_Vi_GetDevAttrBySns(SAMPLE_SNS_TYPE_E enSnsType, hi_vi_dev_attr* pstViDevAttr); +hi_s32 Sample_Comm_Vi_GetChnAttrBySns(SAMPLE_SNS_TYPE_E enSnsType, hi_vi_chn_attr* pstChnAttr); +hi_s32 Sample_Comm_Vi_GetPipeAttrBySns(SAMPLE_SNS_TYPE_E enSnsType, hi_vi_pipe_attr* pstPipeAttr); +hi_s32 Sample_Comm_Vi_GetSnsRstSourceBySns(SAMPLE_SNS_TYPE_E enSnsType, combo_dev_t MipiDev, sns_rst_source_t* sns_reset_port); +hi_s32 Sample_Comm_Vi_GetSnsClkCfgBySns(SAMPLE_SNS_TYPE_E enSnsType, combo_dev_t MipiDev, sns_clk_cfg_t* sns_clk_cfg); +extern const hi_isp_sns_obj* g_enSnsObj[]; + +// Sensor Object +extern hi_isp_sns_obj g_sns_imx219_obj; +extern hi_isp_sns_obj g_sns_imx477_obj; +#endif diff --git a/OnBoardInterface/Camera/MIPICamera/sensor_sample/sony_imx219_config.h b/OnBoardInterface/Camera/MIPICamera/sensor_sample/sony_imx219_config.h new file mode 100644 index 0000000000000000000000000000000000000000..9d679a4ba9a13b133f6af7e2d14dcff084ef5755 --- /dev/null +++ b/OnBoardInterface/Camera/MIPICamera/sensor_sample/sony_imx219_config.h @@ -0,0 +1,165 @@ +/** +* @file imx219_sensor_config.c +* +* Copyright (c) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +#include "hi_mipi_rx.h" +#include "hi_mpi_isp.h" +#include "hi_mpi_vi.h" + +#include "sensor_management.h" + +sns_clk_cfg_t g_mipi_sns_clk_cfg_attr = { + .clk_source = 0, + .clk_freq = SENSOR_CLK_37P125MHz +}; + +combo_dev_attr_t MIPI_2lane_CHN0_SENSOR_IMX219_10BIT_24M_NOWDR_ATTR = +{ + .devno = 0, + .input_mode = INPUT_MODE_MIPI, + .data_rate = MIPI_DATA_RATE_X1, + .img_rect = {0, 0, 3264, 2448}, + + { + .mipi_attr = + { + DATA_TYPE_RAW_10BIT, + HI_MIPI_WDR_MODE_NONE, + {0, 2, -1, -1, -1, -1, -1, -1} + } + } +}; + +combo_dev_attr_t MIPI_2lane_CHN0_SENSOR_IMX219_10BIT_1920x1080_NOWDR_ATTR = +{ + .devno = 0, + .input_mode = INPUT_MODE_MIPI, + .data_rate = MIPI_DATA_RATE_X1, + .img_rect = {0, 0, 1920, 1080}, + + { + .mipi_attr = + { + DATA_TYPE_RAW_10BIT, + HI_MIPI_WDR_MODE_NONE, + {0, 2, -1, -1, -1, -1, -1, -1} + } + } +}; + +hi_isp_pub_attr ISP_PUB_ATTR_IMX219_24M_20FPS_raw10 = +{ + {0, 0, 3264, 2448}, + {3264, 2448}, + 20, + HI_ISP_BAYER_RGGB, + HI_WDR_MODE_NONE, + 0, // IMX219_RES_MODE_E raw10模式对应 +}; + +hi_isp_pub_attr ISP_PUB_ATTR_IMX219_1920x1080_20FPS_raw10 = +{ + {0, 0, 1920, 1080}, + {1920, 1080}, + 20, + HI_ISP_BAYER_RGGB, + HI_WDR_MODE_NONE, + 0, // IMX219_RES_MODE_E raw10模式对应 +}; + +hi_isp_pub_attr ISP_PUB_ATTR_IMX219_1920x1080_30FPS_raw10 = +{ + {0, 0, 1920, 1080}, + {1920, 1080}, + 30, + HI_ISP_BAYER_RGGB, + HI_WDR_MODE_NONE, + 2, // IMX219_RES_MODE_E raw10 1920x1080 30 fps 模式对应 +}; + +// hi_vi_dev_attr 3264x2448 +hi_vi_dev_attr DEV_ATTR_IMX219_24M = +{ + HI_VI_MODE_MIPI, + + HI_VI_SCAN_PROGRESSIVE, + + HI_VI_DATA_SEQ_YUYV, + + HI_VI_DATA_TYPE_RAW, + {3264, 2448}, + { + HI_WDR_MODE_NONE, + 2448 + }, + HI_DATA_RATE_X1 +}; + +hi_vi_dev_attr DEV_ATTR_IMX219_1920x1080 = +{ + HI_VI_MODE_MIPI, + + HI_VI_SCAN_PROGRESSIVE, + + HI_VI_DATA_SEQ_YUYV, + + HI_VI_DATA_TYPE_RAW, + {1920, 1080}, + { + HI_WDR_MODE_NONE, + 1920 + }, + HI_DATA_RATE_X1 +}; + +hi_vi_pipe_attr IMX219_PIPE_ATTR_3264x2448_RAW10_420_3DNR_RFR = +{ + HI_VI_PIPE_BYPASS_NONE, + HI_FALSE, + {3264, 2448}, + HI_PIXEL_FORMAT_RGB_BAYER_10BPP, + HI_COMPRESS_MODE_NONE, + HI_DATA_BIT_WIDTH_10, + { -1, -1} +}; + +hi_vi_pipe_attr IMX219_PIPE_ATTR_1920x1080_RAW10_420_3DNR_RFR = +{ + HI_VI_PIPE_BYPASS_NONE, + HI_FALSE, + {1920, 1080}, + HI_PIXEL_FORMAT_RGB_BAYER_10BPP, + HI_COMPRESS_MODE_NONE, + HI_DATA_BIT_WIDTH_10, + { -1, -1} +}; + +hi_vi_chn_attr IMX219_CHN_ATTR_3264x2448_420_SDR8_LINEAR = +{ + {3264, 2448}, + HI_PIXEL_FORMAT_YVU_SEMIPLANAR_420, + HI_DYNAMIC_RANGE_SDR8, + HI_VIDEO_FORMAT_LINEAR, + HI_COMPRESS_MODE_NONE, + // 0, 0, + 0, + { -1, -1} +}; + +hi_vi_chn_attr IMX219_CHN_ATTR_1920x1080_420_SDR8_LINEAR = +{ + {1920, 1080}, + HI_PIXEL_FORMAT_YVU_SEMIPLANAR_420, + HI_DYNAMIC_RANGE_SDR8, + HI_VIDEO_FORMAT_LINEAR, + HI_COMPRESS_MODE_NONE, + // 0, 0, + 0, + { -1, -1} +}; \ No newline at end of file diff --git a/OnBoardInterface/Camera/MIPICamera/sensor_sample/sony_imx477_config.h b/OnBoardInterface/Camera/MIPICamera/sensor_sample/sony_imx477_config.h new file mode 100644 index 0000000000000000000000000000000000000000..adc58fd973f9249abf1058482d725bf6d749727e --- /dev/null +++ b/OnBoardInterface/Camera/MIPICamera/sensor_sample/sony_imx477_config.h @@ -0,0 +1,125 @@ +/** +* @file imx477_sensor_config.c +* +* Copyright (c) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +#include "hi_mipi_rx.h" +#include "hi_common_isp.h" +#include "hi_common_vi.h" + +#include "sensor_management.h" + +combo_dev_attr_t MIPI_2lane_CHN0_SENSOR_IMX477_12BIT_1920x1080_NOWDR_ATTR = +{ + .devno = 0, + .input_mode = INPUT_MODE_MIPI, + .data_rate = MIPI_DATA_RATE_X1, + .img_rect = {0, 0, 1920, 1080}, + + { + .mipi_attr = + { + DATA_TYPE_RAW_12BIT, + HI_MIPI_WDR_MODE_NONE, + {0, 2, -1, -1, -1, -1, -1, -1} + } + } +}; + +combo_dev_attr_t MIPI_2lane_CHN0_SENSOR_IMX477_10BIT_1920x1080_DOL2_ATTR = +{ + .devno = 0, + .input_mode = INPUT_MODE_MIPI, + .data_rate = MIPI_DATA_RATE_X1, + .img_rect = {0, 0, 1920, 1080}, + + { + .mipi_attr = + { + DATA_TYPE_RAW_10BIT, + HI_MIPI_WDR_MODE_NONE, + {0, 2, -1, -1, -1, -1, -1, -1} + } + } +}; + +hi_isp_pub_attr ISP_PUB_ATTR_IMX477_1920x1080_25FPS_NOWDR_RAW12 = +{ + {0, 0, 1920, 1080}, + {1920, 1080}, + 30, + HI_ISP_BAYER_RGGB, + HI_WDR_MODE_NONE, + 3, // IMX477_4056x3040_RAW10_10FPS +}; + +hi_isp_pub_attr ISP_PUB_ATTR_IMX477_1920x1080_10FPS_DOL2_RAW10 = +{ + {0, 0, 1920, 1080}, + {1920, 1080}, + 15, + HI_ISP_BAYER_RGGB, + HI_WDR_MODE_2To1_LINE, + 4, // IMX477_1920x1080_DOL2_RAW10_15fps +}; + +hi_vi_dev_attr DEV_ATTR_IMX477_1920x1080_NOWDR = +{ + HI_VI_MODE_MIPI, + + HI_VI_SCAN_PROGRESSIVE, + + HI_VI_DATA_SEQ_YUYV, + + HI_VI_DATA_TYPE_RAW, + {1920, 1080}, + { + HI_WDR_MODE_NONE, + 1920 + }, + HI_DATA_RATE_X1 +}; + +hi_vi_dev_attr DEV_ATTR_IMX477_1920x1080_DOL2 = +{ + HI_VI_MODE_MIPI, + + HI_VI_SCAN_PROGRESSIVE, + + HI_VI_DATA_SEQ_YUYV, + + HI_VI_DATA_TYPE_RAW, + {1920, 1080}, + { + HI_WDR_MODE_2To1_LINE, + 1920 + }, + HI_DATA_RATE_X1 +}; + +hi_vi_pipe_attr IMX477_PIPE_ATTR_1920x1080_RAW10_420_3DNR_RFR = +{ + HI_VI_PIPE_BYPASS_NONE, + HI_FALSE, + {1920, 1080}, + HI_PIXEL_FORMAT_RGB_BAYER_10BPP, + HI_COMPRESS_MODE_NONE, + HI_DATA_BIT_WIDTH_10, + { -1, -1} +}; + +hi_vi_chn_attr IMX477_CHN_ATTR_1920x1080_420_SDR8_LINEAR = +{ + {1920, 1080}, + HI_PIXEL_FORMAT_YVU_SEMIPLANAR_420, + HI_DYNAMIC_RANGE_SDR8, + HI_VIDEO_FORMAT_LINEAR, + HI_COMPRESS_MODE_NONE, + 0, + { -1, -1} +}; diff --git a/OnBoardInterface/Camera/MIPICamera/vi_with_sensor.c b/OnBoardInterface/Camera/MIPICamera/vi_with_sensor.c new file mode 100644 index 0000000000000000000000000000000000000000..33a4d7be0c81d6c2fd3fe6a81e94d7ff51345098 --- /dev/null +++ b/OnBoardInterface/Camera/MIPICamera/vi_with_sensor.c @@ -0,0 +1,316 @@ +#include +#include +#include +#include +#include "vi_with_sensor.h" +#include "sample_comm.h" +#include "sample_comm_vi.h" +#include "sample_comm_isp.h" +#include "image_dump_util.h" +#include "acl/acl_rt.h" +#include "acl/acl.h" + +#define HI_MAX_PIPE_NUM 4 +#define HI_MAX_NAME_SIZE 128 +SAMPLE_VI_CONFIG_S g_stViConfig; +hi_s32 pipe_mult_sensor[HI_MAX_PIPE_NUM] = {0}; + +hi_u32 hi_pixel_format_bit_width(hi_pixel_format enPixelFormat) +{ + switch (enPixelFormat) { + case HI_PIXEL_FORMAT_RGB_BAYER_8BPP: + return 8; + case HI_PIXEL_FORMAT_RGB_BAYER_10BPP: + return 10; + case HI_PIXEL_FORMAT_RGB_BAYER_12BPP: + return 12; + case HI_PIXEL_FORMAT_RGB_BAYER_14BPP: + return 14; + case HI_PIXEL_FORMAT_RGB_BAYER_16BPP: + return 16; + default: + return 0; + } +} + +static hi_s32 sample_sys_init() +{ + hi_s32 ret = HI_FAILURE; + hi_mpi_sys_exit(); + + SAMPLE_PRT("begin hi_mpi_sys_init !\n"); + ret = hi_mpi_sys_init(); + if (HI_SUCCESS != ret) { + SAMPLE_PRT("hi_mpi_sys_init failed!\n"); + return HI_FAILURE; + } + SAMPLE_PRT("begin aclInit !\n"); + ret = aclInit(NULL); + if (ret != HI_SUCCESS) { + SAMPLE_PRT("aclInit failed!\n"); + return HI_FAILURE; + } + return HI_SUCCESS; +} + +hi_void close_camera(void) +{ + hi_s32 s32Ret; + (void)Sample_Comm_Vi_StopVi(&g_stViConfig); + s32Ret = hi_mpi_sys_exit(); + if (s32Ret != HI_SUCCESS) { + SAMPLE_PRT("hi_mpi_sys_exit failed!\n"); + } else { + SAMPLE_PRT("hi_mpi_sys_exit succ \n"); + } + s32Ret = aclFinalize(); + if (s32Ret != ACL_SUCCESS) { + SAMPLE_PRT("aclFinalize failed!\n"); + } else { + SAMPLE_PRT("aclFinalize succ \n"); + } + return; +} + +hi_s32 dump_raw(hi_vi_pipe ViPipe) +{ + hi_s32 s32Ret = 0; + hi_u32 u32Nbit = 12; + hi_u32 u32FrmCnt = 1; + hi_u32 u32RawDepth = 2; + hi_u32 u32ByteAlign = 1; + hi_u32 u32RatioShow = 0; + hi_compress_mode enCompressMode = HI_COMPRESS_MODE_NONE; + hi_vi_frame_dump_attr astBackUpDumpAttr; + hi_vi_frame_dump_attr stDumpAttr; + hi_vi_pipe_attr stPipeAttr; + + if (1 > u32FrmCnt || MAX_FRM_CNT < u32FrmCnt) { + printf("invalid FrmCnt %d, FrmCnt range from 1 to %d\n", u32FrmCnt, MAX_FRM_CNT); + exit(HI_FAILURE); + } + + s32Ret = hi_mpi_vi_get_pipe_attr(ViPipe, &stPipeAttr); + if (HI_SUCCESS != s32Ret) { + printf("Get Pipe %d attr failed!\n", ViPipe); + return s32Ret; + } + u32Nbit = hi_pixel_format_bit_width(stPipeAttr.pixel_format); + if (u32Nbit == 0) { + printf("the enPixFmt is %d, cannot dump raw!\n", stPipeAttr.pixel_format); + return -1; + } + s32Ret = hi_mpi_vi_get_pipe_frame_dump_attr(ViPipe, &astBackUpDumpAttr); + if (HI_SUCCESS != s32Ret) { + printf("Get Pipe %d dump attr failed!\n", ViPipe); + return s32Ret; + } + memcpy(&stDumpAttr, &astBackUpDumpAttr, sizeof(hi_vi_frame_dump_attr)); + stDumpAttr.enable = HI_TRUE; + stDumpAttr.depth = u32RawDepth; + s32Ret = hi_mpi_vi_set_pipe_frame_dump_attr(ViPipe, &stDumpAttr); + if (HI_SUCCESS != s32Ret) { + printf("Set Pipe %d dump attr failed!\n", ViPipe); + return s32Ret; + } + // dump raw + DumpLinearBayer(ViPipe, u32Nbit, enCompressMode, u32FrmCnt, u32ByteAlign, u32RatioShow); + stDumpAttr.enable = HI_FALSE; + s32Ret = hi_mpi_vi_set_pipe_frame_dump_attr(ViPipe, &stDumpAttr); + if (HI_SUCCESS != s32Ret) { + printf("Set Pipe %d dump attr failed!\n", ViPipe); + return s32Ret; + } + return s32Ret; +} + +hi_s32 dump(hi_s32 Pipe) +{ + hi_char szYuvName[HI_MAX_NAME_SIZE]; + hi_u32 depth = 3; + hi_s32 s32MilliSec = 120000; + hi_video_frame_info stFrame; + hi_s32 s32Ret; + hi_vi_chn_attr stChnAttr; + hi_s32 Chn = 0; + FILE* pfd = HI_NULL; + + s32Ret = hi_mpi_vi_get_chn_attr(Pipe, Chn, &stChnAttr); + if (s32Ret != HI_SUCCESS) { + SAMPLE_PRT("get chn attr error!!!\n"); + return HI_FAILURE; + } + + stChnAttr.depth = depth; + s32Ret = hi_mpi_vi_set_chn_attr(Pipe, Chn, &stChnAttr); + if (s32Ret != HI_SUCCESS) { + SAMPLE_PRT("set chn attr error!!!\n"); + return HI_FAILURE; + } + + memset(&stFrame, 0, sizeof(stFrame)); + + s32Ret = hi_mpi_vi_get_chn_frame(Pipe, Chn, &stFrame, s32MilliSec); + if (s32Ret != HI_SUCCESS) { + SAMPLE_PRT("Get frame fails s32Ret = 0x%x!!\n", s32Ret); + } + SAMPLE_PRT("hi_mpi_vi_get_chn_frame success\n!"); + + if (s32Ret != HI_SUCCESS) { + SAMPLE_PRT("get frame error for 4 times, now exit !!!\n"); + return HI_FAILURE; + } + /* get frame */ + snprintf(szYuvName, HI_MAX_NAME_SIZE, "./vi_pipe%d_chn%d_w%d_h%d.yuv", + Pipe, Chn, stFrame.v_frame.width, stFrame.v_frame.height); + /* open file */ + pfd = fopen(szYuvName, "wb"); + if (HI_NULL == pfd) { + SAMPLE_PRT("open file failed:%s!\n", strerror(errno)); + } + hi_u32 u32Size = (stFrame.v_frame.width) * (stFrame.v_frame.height) * 3 / 2; + fwrite(stFrame.v_frame.phys_addr[0], u32Size, 1, pfd); + fflush(pfd); + fclose(pfd); + s32Ret = hi_mpi_vi_release_chn_frame(Pipe, Chn, &stFrame); + if (HI_SUCCESS != s32Ret) { + SAMPLE_PRT("Release frame error ,now exit s32Ret is %#x!!!\n", s32Ret); + } + return s32Ret; +} + +hi_s32 start_camera(hi_u32 index, case_info sensor_info) +{ + hi_s32 ret; + hi_size stSize; + hi_s32 sensorId; + hi_s32 num; + lane_divide_mode_t divide_mode; + SAMPLE_SNS_TYPE_E sensor_type; + SAMPLE_VI_INFO_S sampleViInfo[HI_MAX_PIPE_NUM]; + + ret = sample_sys_init(); + if (ret != HI_SUCCESS) { + goto sys_init_failed; + } + // Obtaining Sensor and MIPI Information + if (sensor_info.sensor_num == 1) { + divide_mode = 1; + g_stViConfig.s32WorkingViNum = 1; // simple pipe + } else { + divide_mode = 3; + g_stViConfig.s32WorkingViNum = HI_MAX_PIPE_NUM; + } + // 1: imx219 + if (sensor_info.sensor_type == 1) { + sensor_type = SONY_IMX219_MIPI_1920x1080_10BIT_30FPS_NORMAL; + } else if (sensor_info.sensor_type == 2) { + sensor_type = SONY_IMX477_MIPI_1920x1080_10BIT_DOL2_15FPS; + } else { + goto sys_init_failed; + } + SAMPLE_PRT("The input sensor type is %#x\n", sensor_type); + + g_stViConfig.mipi_lane_divide_mode = divide_mode; + for (num = 0; num < g_stViConfig.s32WorkingViNum; num++) { + ret = get_sample_vi_info_by_sensorType(sensor_type, &sampleViInfo[num], num); + if (ret != HI_SUCCESS) { + return -1; + } + hi_vi_dev_attr stViDevAttr; + Sample_Comm_Vi_GetDevAttrBySns(sensor_type, &stViDevAttr); + g_stViConfig.as32WorkingViId[num] = num; + memcpy(&(g_stViConfig.astViInfo[num]), &sampleViInfo[num], sizeof(SAMPLE_VI_INFO_S)); + } + + ret = Sample_Comm_Vi_StartVi(&g_stViConfig); + if (ret != HI_SUCCESS) { + goto start_vi_failed; + } + + return 0; +start_vi_failed: + Sample_Comm_Vi_StopVi(&g_stViConfig); +sys_init_failed: + return -1; +} + +hi_s32 get_sample_vi_info_by_sensorType(const SAMPLE_SNS_TYPE_E sensor_type, + SAMPLE_VI_INFO_S *sample_vi_info, hi_s32 dev_id) +{ + static SAMPLE_VI_INFO_S sample_vi_info_linear = { + .stSnsInfo = { + .s32SnsId = 4, + .s32BusId = 2, + .MipiDev = 0, + }, + .stDevInfo = { + .enWDRMode = HI_WDR_MODE_NONE, + }, + .stPipeInfo = { + .aPipe = {0, -1, -1, -1}, + }, + .stChnInfo = { + .ViChn = 0, + .enPixFormat = HI_PIXEL_FORMAT_YVU_SEMIPLANAR_420, + .enDynamicRange = HI_DYNAMIC_RANGE_SDR8, + .enVideoFormat = HI_VIDEO_FORMAT_LINEAR, + .enCompressMode = HI_COMPRESS_MODE_NONE + } + }; + switch (sensor_type) { + case SONY_IMX219_MIPI_3K_10BIT_NORMAL: + case SONY_IMX219_MIPI_1920x1080_10BIT_NORMAL: + case SONY_IMX219_MIPI_1920x1080_10BIT_30FPS_NORMAL: + memcpy(sample_vi_info, &sample_vi_info_linear, sizeof(SAMPLE_VI_INFO_S)); + sample_vi_info->stSnsInfo.enSnsType = sensor_type; + sample_vi_info->stSnsInfo.s32BusId = dev_id; + sample_vi_info->stSnsInfo.s32SnsId = 0; + sample_vi_info->stSnsInfo.MipiDev = dev_id; + sample_vi_info->stPipeInfo.aPipe[0] = dev_id; + sample_vi_info->stDevInfo.ViDev = dev_id; + pipe_mult_sensor[dev_id] = dev_id; + break; + case SONY_IMX477_MIPI_1920x1080_10BIT_DOL2_15FPS: + memcpy(sample_vi_info, &sample_vi_info_linear, sizeof(SAMPLE_VI_INFO_S)); + sample_vi_info->stSnsInfo.enSnsType = sensor_type; + sample_vi_info->stSnsInfo.s32BusId = 0 + dev_id * 2; + sample_vi_info->stSnsInfo.s32SnsId = 1; + sample_vi_info->stSnsInfo.MipiDev = 0 + dev_id * 2; + sample_vi_info->stPipeInfo.aPipe[0] = 0 + dev_id * 2; + sample_vi_info->stPipeInfo.aPipe[1] = 1 + dev_id * 2; + sample_vi_info->stDevInfo.ViDev = 0 + dev_id * 2; + sample_vi_info->stDevInfo.enWDRMode = HI_WDR_MODE_2To1_LINE; + pipe_mult_sensor[dev_id] = 0 + 2 * dev_id; + break; + default: + SAMPLE_PRT("Function %s() Error. Undefined sensor type: %#x\n", __FUNCTION__, sensor_type); + return HI_FAILURE; + } + + return HI_SUCCESS; +} + +hi_s32 vi_with_sensor(hi_u32 index, case_info info) { + hi_s32 ret; + ret = start_camera(index, info); + if (ret != 0) { + goto exit; + } + if (index == 0) { // dump yuv + sleep(1); // 休眠1s,保证出图效果正常 + dump(0); + if (info.sensor_num == 2) { // dump 2路图像 + dump(2); + } + } else { // dump raw + sleep(1); // 休眠1s,保证出图效果正常 + dump_raw(0); + if (info.sensor_num == 2) { // dump 2路图像 + dump_raw(2); + } + } +exit: + close_camera(); + return 0; +} \ No newline at end of file diff --git a/OnBoardInterface/Camera/MIPICamera/vi_with_sensor.h b/OnBoardInterface/Camera/MIPICamera/vi_with_sensor.h new file mode 100644 index 0000000000000000000000000000000000000000..44ab09f4c9a6da627db2c8e38de55d96596bfbb1 --- /dev/null +++ b/OnBoardInterface/Camera/MIPICamera/vi_with_sensor.h @@ -0,0 +1,22 @@ +#ifndef VI_WITH_SENSOR_H +#define VI_WITH_SENSOR_H + +#include "hi_media_common.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif + +typedef struct { + hi_u32 sensor_num; + hi_u32 sensor_type; +} case_info; + +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif /* End of #ifdef __cplusplus */ +#endif // VI_WITH_SENSOR_H \ No newline at end of file diff --git a/OnBoardInterface/Camera/USBCamera/main.cpp b/OnBoardInterface/Camera/USBCamera/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0a4fcbbaa6343916614d68c6367fe4413491af2b --- /dev/null +++ b/OnBoardInterface/Camera/USBCamera/main.cpp @@ -0,0 +1,114 @@ +#include +#include +#include +extern "C"{ +#include +#include +#include +#include +} + +int main(int argc, char** argv) { + uint32_t argNum = 2; + if (argc < argNum) { + printf("Please input: ./main /dev/video[number]\n"); + return -1; + } + + // 注册 + avdevice_register_all(); + + // 打开摄像头设备 + AVFormatContext* formatContext = nullptr; + AVDictionary *options = NULL; + AVInputFormat *iformat = av_find_input_format("v4l2"); + + av_dict_set(&options,"video_size","1280*720",0); + av_dict_set(&options,"framerate","30",0); + av_dict_set(&options,"pixel_format","yuv420p",0); + + if (int err_code = avformat_open_input(&formatContext, argv[1], iformat, &options)) { + std::cout << "err_cde is: " << err_code <nb_streams; ++i) { + if (formatContext->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { + videoStreamIndex = i; + break; + } + } + + if (videoStreamIndex == -1) { + std::cout << "无法找到视频流" << std::endl; + return -1; + } + + // 获取视频编解码器上下文 + AVCodecParameters* codecParameters = formatContext->streams[videoStreamIndex]->codecpar; + // 寻找解码器 + AVCodec* codec = avcodec_find_decoder(codecParameters->codec_id); + if (codec == nullptr) { + std::cout << "无法找到解码器" << std::endl; + return -1; + } + + // 创建解码器上下文 + AVCodecContext* codecContext = avcodec_alloc_context3(codec); + if (avcodec_parameters_to_context(codecContext, codecParameters) < 0) { + std::cout << "无法创建解码器上下文" << std::endl; + return -1; + } + + // 打开解码器 + if (avcodec_open2(codecContext, codec, nullptr) < 0) { + std::cout << "无法打开解码器" << std::endl; + return -1; + } + + // 分配帧缓冲区 + AVFrame* frame = av_frame_alloc(); + + // 分配数据包 + AVPacket packet; + while (av_read_frame(formatContext, &packet) >= 0) { + // 解码视频帧 + if (packet.stream_index == videoStreamIndex) { + int response = avcodec_send_packet(codecContext, &packet); + if (response < 0 || response == AVERROR(EAGAIN)) { + continue; // 忽略错误或需要更多输入的情况 + } + while (response >= 0) { + response = avcodec_receive_frame(codecContext, frame); + if (response == AVERROR(EAGAIN)) { + break; // 需要更多输出,继续接收帧 + } else if (response < 0) { + std::cout << "错误解码视频帧" << std::endl; + return -1; + } + } + } + // 保存一帧图像 + FILE *fp; + fp = fopen("out.yuv","wb"); + fwrite(packet.data,1,packet.size,fp); + fclose(fp); + av_packet_unref(&packet); + break; + } + + // 清理资源 + av_frame_free(&frame); + avcodec_close(codecContext); + avformat_close_input(&formatContext); + return 0; +} diff --git a/OnBoardInterface/Camera/USBCamera/readme.md b/OnBoardInterface/Camera/USBCamera/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..db7267dff0f3f2bd56f031ce0ce0891cca864aa7 --- /dev/null +++ b/OnBoardInterface/Camera/USBCamera/readme.md @@ -0,0 +1,85 @@ +# Camera图像获取(USB接口) + +#### 样例介绍 + +通过USB接口连接树莓派Camera与开发板,从树莓派Camera获取图像、并处理为YUV图像。 + +#### 样例下载 + +可以使用以下两种方式下载,请选择其中一种进行源码准备。 + +- 命令行方式下载(**下载时间较长,但步骤简单**)。 + + ``` + # 登录开发板,HwHiAiUser用户命令行中执行以下命令下载源码仓。 + cd ${HOME} + git clone https://gitee.com/ascend/EdgeAndRobotics.git + # 切换到样例目录 + cd EdgeAndRobotics/OnBoardInterface/Camera/USBCamera + ``` + +- 压缩包方式下载(**下载时间较短,但步骤稍微复杂**)。 + + ``` + # 1. 仓右上角选择 【克隆/下载】 下拉框并选择 【下载ZIP】。 + # 2. 将ZIP包上传到开发板的普通用户家目录中,【例如:${HOME}/EdgeAndRobotics-master.zip】。 + # 3. 开发环境中,执行以下命令,解压zip包。 + cd ${HOME} + chmod +x EdgeAndRobotics-master.zip + unzip EdgeAndRobotics-master.zip + # 4. 切换到样例目录 + cd EdgeAndRobotics-master/OnBoardInterface/Camera/USBCamera + ``` + +#### 准备环境 + +1. 以HwHiAiUser用户登录开发板。 + +2. 安装FFmpeg。 + + ``` + sudo apt-get install ffmpeg libavcodec-dev libswscale-dev libavdevice-dev + ``` + +3. 安装OpenCV。 + + ``` + sudo apt-get install libopencv-dev + ``` + +#### 样例运行 + +1. 以HwHiAiUser用户登录开发板,切换到当前样例目录。 + +2. 编译样例源码。 + + ``` + # 执行编译命令 + g++ main.cpp -o main -lavutil -lavformat -lavcodec -lavdevice + ``` + + 编译命令执行成功后,在USBCamera样例目录下生成可执行文件main。 + +3. 运行样例,从Camera获取图像。 + + 运行可执行文件,其中/dev/video0表示Camera设备,需根据实际情况填写: + + ``` + ./main /dev/video0 + ``` + + 运行成功后,在USBCamera样例目录下生成yuyv422格式、1280*720分辨率的out.yuv文件。 + + **注意**:当把一个摄像头插入开发板后,执行ls /dev/vi*命令可看到摄像头的vedio节点。这里出现了两个设备节点:/dev/video0、/dev/video1,是因为一个是图像/视频采集,一个是metadata采集,因此本样例中在运行可执行文件时,选择图像/视频采集的设备节点/dev/video0。 + +4. 检查从Camera获取的图像。 + + 执行如下命令,使用FFmpeg软件查看图像: + + ``` + ffplay -pix_fmt yuyv422 -video_size 1280*720 out.yuv + ``` + +#### 相关操作 + +暂无 \ No newline at end of file diff --git a/OnBoardInterface/Display/HDMIDisplay/CMakeLists.txt b/OnBoardInterface/Display/HDMIDisplay/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..93e53e629443ee22c30fe5d0daa50a8aff7d3306 --- /dev/null +++ b/OnBoardInterface/Display/HDMIDisplay/CMakeLists.txt @@ -0,0 +1,46 @@ +# CMake lowest version requirement +cmake_minimum_required(VERSION 3.5.1) + +# project information +project(hdmi_sample) + +set(LOCAL_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + +set(LIB_PATH $ENV{NPU_HOST_LIB}) +if (NOT DEFINED ENV{NPU_HOST_LIB}) + set(LIB_PATH /usr/local/Ascend/CANN-7.0/runtime/lib64/) + message(STATUS "set default LIB_PATH: ${LIB_PATH}") +else() + message(STATUS "env LIB_PATH: ${LIB_PATH}") +endif() + +set(INC_PATH $ENV{NPU_HOST_INC}) +if (NOT DEFINED ENV{NPU_HOST_INC}) + set(INC_PATH /usr/local/Ascend/CANN-7.0/runtime/include/) + message(STATUS "set default INC_PATH: ${INC_PATH}") +else() + message(STATUS "env INC_PATH: ${INC_PATH}") +endif() + +link_directories( + ${LIB_PATH}/stub/aarch64/ + ${LIB_PATH} +) + +add_definitions(-DTHREADED) + +add_executable(sample_hdmi + sample_hdmi.c + hi_mpi_vo.c +) + +include_directories(sample_hdmi + ${LOCAL_DIR}/include + ${INC_PATH}/acl/media +) + +target_link_libraries(sample_hdmi + acl_vo_mpi + acl_hdmi_mpi + acl_dvpp_mpi +) \ No newline at end of file diff --git a/OnBoardInterface/Display/HDMIDisplay/README.md b/OnBoardInterface/Display/HDMIDisplay/README.md new file mode 100644 index 0000000000000000000000000000000000000000..b968f57e75ef9c60e46a0ce2d70002bff701c33f --- /dev/null +++ b/OnBoardInterface/Display/HDMIDisplay/README.md @@ -0,0 +1,82 @@ +# 图像显示(HDMI接口) + +#### 样例介绍 + +本样例支持通过hdmi0接口连接显示器,在显示器上显示yuv420 NV12格式、1920*1080分辨率的图片。 + +#### 样例下载 + +可以使用以下两种方式下载,请选择其中一种进行源码准备。 + +- 命令行方式下载(**下载时间较长,但步骤简单**)。 + + ``` + # 登录开发板,HwHiAiUser用户命令行中执行以下命令下载源码仓。 + cd ${HOME} + git clone https://gitee.com/ascend/EdgeAndRobotics.git + # 切换到样例目录 + cd EdgeAndRobotics/OnBoardInterface/Display/HDMIDisplay + ``` + +- 压缩包方式下载(**下载时间较短,但步骤稍微复杂**)。 + + ``` + # 1. 仓右上角选择 【克隆/下载】 下拉框并选择 【下载ZIP】。 + # 2. 将ZIP包上传到开发板的普通用户家目录中,【例如:${HOME}/EdgeAndRobotics-master.zip】。 + # 3. 开发环境中,执行以下命令,解压zip包。 + cd ${HOME} + chmod +x EdgeAndRobotics-master.zip + unzip EdgeAndRobotics-master.zip + # 4. 切换到样例目录 + cd EdgeAndRobotics-master/OnBoardInterface/Display/HDMIDisplay + ``` + +#### 准备环境 + +1. 以HwHiAiUser用户登录开发板。 + +2. 设置环境变量。 + + ``` + # 配置程序编译依赖的头文件与库文件路径 + export NPU_HOST_LIB=$HOME/Ascend/CANN-7.0/runtime/lib64/ + export NPU_HOST_INC=$HOME/Ascend/CANN-7.0/runtime/include/ + ``` + +#### 运行样例 + +1. 以HwHiAiUser用户登录开发板,切换到当前样例目录。 + +2. 编译样例源码。 + + 依次执行如下命令执行编译: + + ``` + mkdir build + cd build + cmake .. -DCMAKE_C_COMPILER=gcc -DCMAKE_SKIP_RPATH=TRUE + make + ``` + + 在build目录下会生成可执行文件sample_hdmi。 + +3. 运行样例。 + + 可执行文件的运行命令格式如下: + + - param1:yuv图片文件名,需提前准备测试图片,与可执行文件sample_hdmi放置在同一目录下,图像格式参数要求如下,分辨率:1920*1080,颜色空间:nv12(属于yuv420系列格式); + - param2:自定义显示时长,可选参数,默认为10s。 + + ``` + ./sample_hdmi param1 param2 + ``` + + 命令示例: + + ``` + ./sample_hdmi car.yuv 10 + ``` + +#### 相关操作 + +暂无。 \ No newline at end of file diff --git a/OnBoardInterface/Display/HDMIDisplay/hi_mpi_vo.c b/OnBoardInterface/Display/HDMIDisplay/hi_mpi_vo.c new file mode 100644 index 0000000000000000000000000000000000000000..3b437b46f0b541df4a6db30e25d93d567d7acda0 --- /dev/null +++ b/OnBoardInterface/Display/HDMIDisplay/hi_mpi_vo.c @@ -0,0 +1,131 @@ +/** +* @File hi_mpi_vo.c +* @Description hdmi info init functions +* +* Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ +#include +#include "vo_comm.h" + +hi_void hi_mpi_hdmi_init_sample(void) +{ + hi_s32 ret = hi_mpi_hdmi_init(); + if (ret != HI_SUCCESS) { + printf("hi_mpi_hdmi_init_sample error: %d", ret); + return; + } + ret = hi_mpi_hdmi_open(0); + if (ret != HI_SUCCESS) { + printf("hi_mpi_hdmi_open error: %d\n", ret); + return; + } +} + +hi_s32 hi_mpi_hdmi_set_info(hi_hdmi_attr attr, int hdmi_timing) +{ + hi_s32 ret = 0; + hi_hdmi_infoframe infoframe; + + ret = hi_mpi_hdmi_set_attr(0, &attr); + if (ret != HI_SUCCESS) { + printf("hi_mpi_hdmi_set_attr error: %d\n", ret); + return HI_FAILURE; + } + + infoframe.infoframe_type = HI_INFOFRAME_TYPE_AVI; + hi_hdmi_avi_infoframe *avi = &infoframe.infoframe_unit.avi_infoframe; + user_set_avi_infoframe_pattern(avi, hdmi_timing); + avi->color_space = HI_HDMI_COLOR_SPACE_YCBCR444; + ret = hi_mpi_hdmi_set_infoframe(0, &infoframe); + if (ret != HI_SUCCESS) { + printf("[avi]hi_mpi_hdmi_set_infoframe error: %d\n", ret); + return HI_FAILURE; + } + + infoframe.infoframe_type = HI_INFOFRAME_TYPE_AUDIO; + hi_hdmi_audio_infoframe *audio = &infoframe.infoframe_unit.audio_infoframe; + user_set_audio_infoframe(audio); + ret = hi_mpi_hdmi_set_infoframe(0, &infoframe); + if (ret != HI_SUCCESS) { + printf("[audio]hi_mpi_hdmi_set_infoframe error: %d\n", ret); + return HI_FAILURE; + } + sleep(1); + + return HI_SUCCESS; +} + +hi_s32 hi_mpi_hdmi_avi_infoframe_colorspace(int hdmi_timing, int pix_clk) +{ + hi_s32 ret = 0; + + hi_hdmi_attr attr; + attr.hdmi_en = HI_TRUE; + attr.video_format = HI_HDMI_VIDEO_FORMAT_VESA_CUSTOMER_DEFINE; + attr.deep_color_mode = HI_HDMI_DEEP_COLOR_24BIT; + attr.audio_en = HI_TRUE; + attr.sample_rate = HI_HDMI_SAMPLE_RATE_48K; + attr.bit_depth = HI_HDMI_BIT_DEPTH_16; + attr.auth_mode_en = HI_FALSE; + attr.deep_color_adapt_en = HI_TRUE; // 根据vo输出自动调整hdmi色域打开 + attr.pix_clk = pix_clk; + + ret = hi_mpi_hdmi_set_info(attr, hdmi_timing); + if (ret != HI_SUCCESS) { + return HI_FAILURE; + } + + ret = hi_mpi_hdmi_set_info(attr, hdmi_timing); + if (ret != HI_SUCCESS) { + return HI_FAILURE; + } + + ret = hi_mpi_hdmi_start(0); + if (ret != HI_SUCCESS) { + printf("hi_mpi_hdmi_start error: %d\n", ret); + return HI_FAILURE; + } + sleep(1); + + return HI_SUCCESS; +} + +void user_set_avi_infoframe_pattern(hi_hdmi_avi_infoframe *avi, int timing) +{ + avi->timing_mode = timing; + + avi->color_space = HI_HDMI_COLOR_SPACE_RGB444; + avi->active_info_present = HI_FALSE; // Active Format Aspect Ratio + avi->bar_info = HI_HDMI_BAR_INFO_NOT_VALID; + avi->scan_info = HI_HDMI_SCAN_INFO_NO_DATA; + avi->colorimetry = HI_HDMI_COMMON_COLORIMETRY_ITU601; + avi->ex_colorimetry = HI_HDMI_COMMON_COLORIMETRY_XVYCC_601; + avi->aspect_ratio = HI_HDMI_PIC_ASPECT_RATIO_4TO3; + avi->active_aspect_ratio = HI_HDMI_ACTIVE_ASPECT_RATIO_SAME_PIC; + avi->pic_scaling = HI_HDMI_PIC_NON_UNIFORM_SCALING; + avi->rgb_quant = HI_HDMI_RGB_QUANT_FULL_RANGE; + avi->is_it_content = HI_FALSE; + avi->pixel_repetition = HI_HDMI_PIXEL_REPET_NO; + avi->content_type = HI_HDMI_CONTNET_PHOTO; + avi->ycc_quant = HI_HDMI_YCC_QUANT_FULL_RANGE; + avi->line_n_end_of_top_bar = 0; + avi->line_n_start_of_bot_bar = 0; + avi->pixel_n_end_of_left_bar = 0; + avi->pixel_n_start_of_right_bar = 0; +} + +void user_set_audio_infoframe(hi_hdmi_audio_infoframe *audio) +{ + audio->chn_cnt = HI_HDMI_AUDIO_CHN_CNT_2; + audio->coding_type = HI_HDMI_AUDIO_CODING_PCM; + audio->sample_size = HI_HDMI_AUDIO_SAMPLE_SIZE_16; + audio->sampling_freq = HI_HDMI_AUDIO_SAMPLE_FREQ_48000; + audio->chn_alloc = 0; /* Channel/Speaker Allocation.Range [0,255] */ + audio->level_shift = HI_HDMI_LEVEL_SHIFT_VAL_0_DB; + audio->lfe_playback_level = HI_HDMI_LFE_PLAYBACK_NO; + audio->down_mix_inhibit = HI_FALSE; +} \ No newline at end of file diff --git a/OnBoardInterface/Display/HDMIDisplay/include/vo_comm.h b/OnBoardInterface/Display/HDMIDisplay/include/vo_comm.h new file mode 100644 index 0000000000000000000000000000000000000000..e5f0fa24fe9621459ddbccef131dfa1e4d40fa85 --- /dev/null +++ b/OnBoardInterface/Display/HDMIDisplay/include/vo_comm.h @@ -0,0 +1,65 @@ +/** +* @File vo_home.h +* @Description hdmi sample app +* +* Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ +#include +#include +#include +#include +#include +#include +#include +#include +#include "hi_media_common.h" +#include "hi_common_vo.h" +#include "hi_mpi_vo.h" +#include "hi_mpi_hdmi.h" +typedef hi_u32 hi_vb_pool; +typedef hi_u32 hi_vb_blk; + +#define VO_CHECK_RET(express, name) \ + do { \ + hi_s32 _ret; \ + _ret = express; \ + if (_ret != HI_SUCCESS) { \ + printf("%s failed at %s: LINE: %d with %#x!\n", name, __FUNCTION__, __LINE__, _ret); \ + } \ + } while (0) + +#define FILE_NAME_LEN 512 +#define VO_MST_ALIGN_16 16 +#define VO_MST_ALIGN_2 2 +#define VO_ALIGN_BACK(x, a) ((a) * (((x) / (a)))) +#define VO_TEST_ALIGN_BACK(x, a) (((a) * ((((x) + (a) - 1) / (a))))) +#define VO_LAYER_VHD0 0 +#define DEV_DHD0 0 + +typedef struct { + hi_vo_intf_sync intf_sync; + hi_char *name; + hi_u32 width; + hi_u32 height; + hi_u32 frame_rate; +} vo_mst_sync_info; + +typedef enum { + VB_REMAP_MODE_NONE = 0, // no remap + VB_REMAP_MODE_NOCACHE = 1, // no cache remap + VB_REMAP_MODE_CACHED = 2, // cache remap, if you use this mode, you should flush cache by yourself + VB_REMAP_MODE_BUTT +} vo_vb_remap_mode; + +typedef struct { + hi_u64 blk_size; + hi_u32 blk_cnt; + vo_vb_remap_mode remap_mode; +} hi_vb_pool_config; + +hi_void hi_mpi_hdmi_init_sample(void); +hi_s32 hi_mpi_hdmi_avi_infoframe_colorspace(int hdmi_timing, int pix_clk); \ No newline at end of file diff --git a/OnBoardInterface/Display/HDMIDisplay/sample_hdmi.c b/OnBoardInterface/Display/HDMIDisplay/sample_hdmi.c new file mode 100644 index 0000000000000000000000000000000000000000..53fad26c9280aa5a3ce54642748a0b086acdc03a --- /dev/null +++ b/OnBoardInterface/Display/HDMIDisplay/sample_hdmi.c @@ -0,0 +1,266 @@ +/** +* @File sample_hdmi.c +* @Description hdmi sample app +* +* Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ +#include +#include +#include +#include +#include "vo_comm.h" + +hi_void vo_mipi_get_sync_info(hi_vo_intf_sync intf_sync, vo_mst_sync_info *sync_info) +{ + sync_info->intf_sync = intf_sync; + sync_info->name = "1080P@60"; + sync_info->width = 1920; + sync_info->height = 1080; + sync_info->frame_rate = 60; +} + +/* init device */ +static hi_void vo_init_dev(hi_s32 dev, hi_vo_intf_type intf_type, hi_vo_intf_sync intf_sync) +{ + hi_vo_pub_attr pub_attr; + + pub_attr.bg_color = 0xffffff; + pub_attr.intf_sync = intf_sync; + pub_attr.intf_type = intf_type; + VO_CHECK_RET(hi_mpi_vo_set_pub_attr(dev, &pub_attr), "hi_mpi_vo_set_pub_attr"); + VO_CHECK_RET(hi_mpi_vo_enable(dev), "hi_mpi_vo_enable"); +} + +/* init layer */ +static hi_void vo_init_layer(hi_s32 layer, hi_u32 img_height, hi_u32 img_width, hi_u32 frame_rate) +{ + hi_vo_video_layer_attr layer_attr; + + layer_attr.double_frame_en = HI_FALSE; + layer_attr.cluster_mode_en = HI_FALSE; + layer_attr.dst_dynamic_range = HI_DYNAMIC_RANGE_SDR8; + layer_attr.pixel_format = HI_PIXEL_FORMAT_YUV_SEMIPLANAR_420; + layer_attr.display_buf_len = 4; + layer_attr.partition_mode = HI_VO_PARTITION_MODE_SINGLE; + layer_attr.compress_mode = 0; + layer_attr.display_rect.width = img_width; + layer_attr.display_rect.height = img_height; + layer_attr.display_rect.x = 0; + layer_attr.display_rect.y = 0; + layer_attr.img_size.width = img_width; + layer_attr.img_size.height = img_height; + layer_attr.display_frame_rate = frame_rate; + VO_CHECK_RET(hi_mpi_vo_set_video_layer_attr(layer, &layer_attr), "hi_mpi_vo_set_video_layer_attr"); + VO_CHECK_RET(hi_mpi_vo_enable_video_layer(layer), "hi_mpi_vo_enable_video_layer"); +} + +/* init channel */ +static hi_void vo_init_chn(hi_s32 layer, hi_u32 img_height, hi_u32 img_width) +{ + hi_vo_chn_attr chn_attr; + + chn_attr.rect.x = 0; + chn_attr.rect.y = 0; + chn_attr.rect.width = VO_ALIGN_BACK(img_width, VO_MST_ALIGN_2); + chn_attr.rect.height = VO_ALIGN_BACK(img_height, VO_MST_ALIGN_2); + chn_attr.priority = 0; + chn_attr.deflicker_en = HI_FALSE; + + VO_CHECK_RET(hi_mpi_vo_set_chn_attr(layer, 0, &chn_attr), "hi_mpi_vo_set_chn_attr"); + VO_CHECK_RET(hi_mpi_vo_enable_chn(layer, 0), "hi_mpi_vo_enable_chn"); +} + +static hi_u64 vo_mst_get_vb_blk_size(hi_u32 width, hi_u32 height) +{ + hi_u64 vb_blk_size; + hi_u32 align_width; + hi_u32 align_height; + hi_u32 head_size; + + align_width = VO_TEST_ALIGN_BACK(width, VO_MST_ALIGN_16); + align_height = VO_TEST_ALIGN_BACK(height, VO_MST_ALIGN_2); + + /* compress header stride 16 */ + head_size = VO_MST_ALIGN_16 * align_height; + vb_blk_size = (align_width * align_height + head_size) * 2; // HI_PIXEL_FORMAT_YVU_SEMIPLANAR_422 + return vb_blk_size; +} + +/* ************** VB INIT ************** */ +hi_void vo_mipi_sys_init(hi_u32 img_height, hi_u32 img_width) +{ + hi_mpi_sys_exit(); + VO_CHECK_RET(hi_mpi_sys_init(), "sys init"); +} + +/* ************** VB DEINIT ************** */ +hi_void vo_mipi_sys_exit(hi_void) +{ + VO_CHECK_RET(hi_mpi_sys_exit(), "sys exit"); +} + +/* ************** VB POOL CREATE ************** */ +hi_s32 vo_mipi_create_vb_pool(hi_u32 img_height, hi_u32 img_width, hi_u32 *blk_handle) +{ + hi_vb_pool_config pool_cfg; + hi_u32 pool_val; + + (hi_void)memset(&pool_cfg, 0, sizeof(hi_vb_pool_config)); + + pool_cfg.blk_size = vo_mst_get_vb_blk_size(img_width, img_height); + pool_cfg.blk_cnt = 10; + pool_cfg.remap_mode = 0; + + pool_val = hi_mpi_vo_create_pool(pool_cfg.blk_size); + + *blk_handle = pool_val; + if (pool_val == -1) { + return HI_FAILURE; + } + return HI_SUCCESS; +} + +static hi_void vo_init_user_frame(hi_u32 vb_pool_val, hi_u32 img_height, hi_u32 img_width, + hi_video_frame_info *user_frame) +{ + hi_u32 luma_size = 0; + hi_u32 chroma_size = 0; + + user_frame->v_frame.field = 4; + user_frame->v_frame.compress_mode = 0; + user_frame->v_frame.pixel_format = HI_PIXEL_FORMAT_YUV_SEMIPLANAR_420; + user_frame->v_frame.video_format = 0; + user_frame->v_frame.color_gamut = 0; + user_frame->v_frame.dynamic_range = 0; + user_frame->v_frame.height = img_height; + user_frame->v_frame.width = img_width; + + user_frame->v_frame.width_stride[0] = img_width; + user_frame->v_frame.width_stride[1] = img_width; + user_frame->v_frame.width_stride[0] = VO_TEST_ALIGN_BACK(img_width, VO_MST_ALIGN_2); + user_frame->v_frame.width_stride[1] = VO_TEST_ALIGN_BACK(img_width, VO_MST_ALIGN_2); + + user_frame->v_frame.time_ref = 0; + user_frame->v_frame.pts = 0; + + luma_size = user_frame->v_frame.width * user_frame->v_frame.height; + luma_size = VO_TEST_ALIGN_BACK(user_frame->v_frame.width, 2) * user_frame->v_frame.height; + + chroma_size = luma_size / 2; + + user_frame->pool_id = (vb_pool_val >> 16); + user_frame->v_frame.phys_addr[0] = hi_mpi_vo_handle_to_phys_addr(vb_pool_val); + user_frame->v_frame.phys_addr[1] = user_frame->v_frame.phys_addr[0] + luma_size; + user_frame->v_frame.header_phys_addr[0] = user_frame->v_frame.phys_addr[0]; + user_frame->v_frame.header_phys_addr[1] = user_frame->v_frame.phys_addr[1]; +} + +hi_s32 load_vo_mipi_RawImage(FILE *fp, hi_u8 *addr, hi_u32 width, hi_u32 height, hi_u32 format) +{ + hi_u32 stride; + hi_u32 offset; + hi_u32 bufSize = width * height * 3 / 2; + hi_u32 vbSize = width * height * 3; + + void *viraddr = (void *)addr; + (hi_void)memset(viraddr, 0, (bufSize)); + size_t buf_size = fread(viraddr, 1, vbSize, fp); + if (buf_size != bufSize) { + printf("buf_size is: %d, but should be: %d\n!", buf_size, bufSize); + return HI_FAILURE; + } + return HI_SUCCESS; +} + +hi_void vo_hlt_start(hi_u32 img_height, hi_u32 img_width, hi_u32 vb_pool_val, char *file_name) +{ + img_height = 1080; + img_width = 1920; + + hi_s32 ret; + hi_u32 vb_blk = vb_pool_val; + FILE *fdd; + hi_video_frame_info user_frame; + hi_u64 vb_blk_size = img_width * img_height * 2; + + vo_init_user_frame(vb_blk, img_height, img_width, &user_frame); + + fdd = fopen(file_name, "rb"); + if (fdd == NULL) { + printf("open file %s fail \n", file_name); + return; + } + + ret = load_vo_mipi_RawImage(fdd, user_frame.v_frame.phys_addr[0], user_frame.v_frame.width, + user_frame.v_frame.height, user_frame.v_frame.pixel_format); + if (ret == HI_SUCCESS) { + ret = hi_mpi_vo_send_frame(0, 0, &user_frame, 0); + if (ret != HI_SUCCESS) { + printf("Display one frame failed, ret = 0x%x!\n", ret); + } else { + printf("Display one frame success!\n"); + } + } + + fclose(fdd); + sleep(1); + return; +} + +hi_void vo_hdmi_init(hi_s32 dev, hi_s32 layer, hi_vo_intf_type intf_type, hi_vo_intf_sync intf_sync, + vo_mst_sync_info sync_info) +{ + vo_init_dev(dev, intf_type, intf_sync); + vo_init_layer(layer, sync_info.height, sync_info.width, sync_info.frame_rate); + vo_init_chn(layer, sync_info.height, sync_info.width); + hi_mpi_hdmi_init_sample(); + hi_mpi_hdmi_avi_infoframe_colorspace(HI_HDMI_VIDEO_FORMAT_1080P_60, 148500); +} + +hi_void vo_hdmi_deinit(hi_s32 dev, hi_s32 layer) +{ + hi_mpi_vo_disable_chn(layer, 0); + hi_mpi_vo_disable_video_layer(layer); + VO_CHECK_RET(hi_mpi_vo_disable(dev), "hi_mpi_vo_disable"); + + hi_mpi_hdmi_stop(0); + hi_mpi_hdmi_close(0); + hi_mpi_hdmi_deinit(); +} + +int main(int argc, char *argv[]) +{ + hi_u32 vb_pool_val = -1; + vo_mst_sync_info sync_info; + int waiting_time = 10; + char file_name[FILE_NAME_LEN]; + if (argc < 2) { + printf("The input filename is mandatory!\n"); + return 0; + } else { + strcpy(file_name, argv[1]); + if (argc == 3) { + waiting_time = atoi(argv[2]); + } + } + + vo_mipi_get_sync_info(HI_VO_OUT_1080P60, &sync_info); + vo_mipi_sys_init(sync_info.height, sync_info.width); + vo_hdmi_init(DEV_DHD0, VO_LAYER_VHD0, HI_VO_INTF_HDMI, HI_VO_OUT_1080P60 | HI_VO_INTF_VGA, sync_info); + + vo_mipi_create_vb_pool(sync_info.height, sync_info.width, &vb_pool_val); + + vo_hlt_start(sync_info.height, sync_info.width, vb_pool_val, file_name); + sleep(waiting_time); + + vo_hdmi_deinit(DEV_DHD0, VO_LAYER_VHD0); + hi_mpi_vo_destroy_pool(vb_pool_val); + vo_mipi_sys_exit(); + + printf("main finish!\n"); + return 0; +} \ No newline at end of file diff --git a/OnBoardInterface/Display/MIPIDisplay/CMakeLists.txt b/OnBoardInterface/Display/MIPIDisplay/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..c70fc87aefd04bb5bb77a429b28a6da055f73cdc --- /dev/null +++ b/OnBoardInterface/Display/MIPIDisplay/CMakeLists.txt @@ -0,0 +1,51 @@ +# CMake lowest version requirement +cmake_minimum_required(VERSION 3.5.1) + +# project information +project(mipitx_sample) + +set(LOCAL_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + +set(LIB_PATH $ENV{NPU_HOST_LIB}) + +if (NOT DEFINED ENV{NPU_HOST_LIB}) + set(LIB_PATH /usr/local/Ascend/CANN-7.0/runtime/lib64/) + message(STATUS "set default LIB_PATH: ${LIB_PATH}") +else() + message(STATUS "env LIB_PATH: ${LIB_PATH}") +endif() + +set(INC_PATH $ENV{NPU_HOST_INC}) + +if (NOT DEFINED ENV{NPU_HOST_INC}) + set(INC_PATH /usr/local/Ascend/CANN-7.0/runtime/include/) + message(STATUS "set default INC_PATH: ${INC_PATH}") +else() + message(STATUS "env INC_PATH: ${INC_PATH}") +endif() + +link_directories( + ${LIB_PATH}/stub/aarch64/ + ${LIB_PATH} +) + +include_directories( + ${LOCAL_DIR}/include + ${INC_PATH}/acl/media + ${INC_PATH} +) + +add_definitions(-DTHREADED) + +add_executable(raspberry_demo + raspberry_demo.c + ${LOCAL_DIR}/src/vo_init.c + ${LOCAL_DIR}/src/vo_mem.c + ${LOCAL_DIR}/src/vo_mipitx.c +) + +target_link_libraries(raspberry_demo PRIVATE + acl_dvpp_mpi + acl_vo_mpi +) + diff --git a/OnBoardInterface/Display/MIPIDisplay/README.md b/OnBoardInterface/Display/MIPIDisplay/README.md new file mode 100644 index 0000000000000000000000000000000000000000..425de73f1ccc13f23cf9b0a6f3256bf3c6eb68ff --- /dev/null +++ b/OnBoardInterface/Display/MIPIDisplay/README.md @@ -0,0 +1,73 @@ +# 图像显示(MIPI接口) + +#### 样例介绍 + +本样例支持通过mipi接口连接显示器,在显示器上显示yuv420SP格式、800*400分辨率的图片。 + +#### 样例下载 + +可以使用以下两种方式下载,请选择其中一种进行源码准备。 + +- 命令行方式下载(**下载时间较长,但步骤简单**)。 + + ``` + # 登录开发板,HwHiAiUser用户命令行中执行以下命令下载源码仓。 + cd ${HOME} + git clone https://gitee.com/ascend/EdgeAndRobotics.git + # 切换到样例目录 + cd EdgeAndRobotics/OnBoardInterface/Display/MIPIDisplay + ``` + +- 压缩包方式下载(**下载时间较短,但步骤稍微复杂**)。 + + ``` + # 1. 仓右上角选择 【克隆/下载】 下拉框并选择 【下载ZIP】。 + # 2. 将ZIP包上传到开发板的普通用户家目录中,【例如:${HOME}/EdgeAndRobotics-master.zip】。 + # 3. 开发环境中,执行以下命令,解压zip包。 + cd ${HOME} + chmod +x EdgeAndRobotics-master.zip + unzip EdgeAndRobotics-master.zip + # 4. 切换到样例目录 + cd EdgeAndRobotics-master/OnBoardInterface/Display/MIPIDisplay + ``` + +#### 准备环境 + +1. 以HwHiAiUser用户登录开发板。 + +2. 设置环境变量。 + + ``` + # 配置程序编译依赖的头文件与库文件路径 + export NPU_HOST_LIB=/usr/local/Ascend/ascend-toolkit/latest/runtime/lib64/ + export NPU_HOST_INC=/usr/local/Ascend/ascend-toolkit/latest/runtime/include/ + ``` + +#### 运行样例 + +1. 以HwHiAiUser用户登录开发板,切换到当前样例目录。 + +2. 编译样例源码。 + + 依次执行如下命令执行编译: + + ``` + mkdir build + cd build + cmake .. -DCMAKE_C_COMPILER=gcc -DCMAKE_SKIP_RPATH=TRUE + make + ``` + + 在build目录下会生成可执行文件raspberry_demo。 + +3. 运行样例。 + + 可执行文件的运行命令示例如下,需提前准备测试图片,与可执行文件raspberry_demo放置在同一目录下,图像格式参数要求如下,分辨率:800*400,颜色空间:yuv420SP格式。 + + ``` + ./raspberry_demo car2.yuv + ``` + +#### 相关操作 + +暂无。 \ No newline at end of file diff --git a/OnBoardInterface/Display/MIPIDisplay/include/func.h b/OnBoardInterface/Display/MIPIDisplay/include/func.h new file mode 100644 index 0000000000000000000000000000000000000000..2f80de4e8f54dc41497a47c260c71b614bc142ca --- /dev/null +++ b/OnBoardInterface/Display/MIPIDisplay/include/func.h @@ -0,0 +1,25 @@ +/** +* @File fun.h +* @Description Provide util function for reading RAW & YUV data from the VI PIPE & CHN +* +* Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ +#ifndef __FUNC_H__ +#define __FUNC_H__ + +#include "vo_comm.h" + +hi_void vo_get_sync_info(vo_mst_sync_info *sync_info); +hi_void vo_sys_init(hi_u32 img_height, hi_u32 img_width); +hi_void vo_sys_exit(hi_void); +hi_void vo_init(hi_s32 dev, hi_s32 layer, hi_vo_intf_type intf_type, hi_vo_intf_sync intf_sync, vo_mst_sync_info sync_info); +hi_void vo_deinit(hi_s32 dev, hi_s32 layer); +hi_s32 start_mipi_tx(); +hi_s32 close_mipi_tx(); +hi_s32 vo_create_vb_pool(hi_u32 img_height, hi_u32 img_width, hi_u32 *blk_handle); +hi_void vo_start(hi_u32 img_height, hi_u32 img_width, hi_u32 vb_blk, char *file_name); +#endif \ No newline at end of file diff --git a/OnBoardInterface/Display/MIPIDisplay/include/hi_mipi_tx.h b/OnBoardInterface/Display/MIPIDisplay/include/hi_mipi_tx.h new file mode 100644 index 0000000000000000000000000000000000000000..16ebdd0a93214535d7ef429d12e863235b030aa2 --- /dev/null +++ b/OnBoardInterface/Display/MIPIDisplay/include/hi_mipi_tx.h @@ -0,0 +1,126 @@ +/** +* @File hi_mipi_tx.h +* @Description Provide util function for reading RAW & YUV data from the VI PIPE & CHN +* +* Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +#ifndef __HI_MIPI_TX_H__ +#define __HI_MIPI_TX_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define CMD_MAX_NUM 4 +#define LANE_MAX_NUM 4 +#define MIPI_TX_DISABLE_LANE_ID (-1) +#define MIPI_TX_SET_DATA_SIZE 800 +#define MIPI_TX_GET_DATA_SIZE 160 + +#define HI_ALIGN_NUM 8 +#define HI_ATTRIBUTE __attribute__((aligned(HI_ALIGN_NUM))) + +typedef enum { + OUT_MODE_CSI = 0x0, /* csi mode */ + OUT_MODE_DSI_VIDEO = 0x1, /* dsi video mode */ + OUT_MODE_DSI_CMD = 0x2, /* dsi command mode */ + + OUT_MODE_BUTT +} out_mode_t; + +typedef enum { + MIPI_TX_WORK_MODE_LP = 0x0, /* LP(Low Power) work mode */ + MIPI_TX_WORK_MODE_HS = 0x1, /* HS(High Speed) work mode */ + + MIPI_TX_WORK_MODE_BUTT +} mipi_tx_work_mode_t; + +typedef enum { + BURST_MODE = 0x0, + NON_BURST_MODE_SYNC_PULSES = 0x1, + NON_BURST_MODE_SYNC_EVENTS = 0x2, + + VIDEO_DATA_MODE_BUTT +} video_mode_t; + +typedef enum { + OUT_FORMAT_RGB_16BIT = 0x0, /* DSI */ + OUT_FORMAT_RGB_18BIT = 0x1, + OUT_FORMAT_RGB_18BIT_LOOSELY = 0x2, + OUT_FORMAT_RGB_24BIT = 0x3, + OUT_FORMAT_YUV420_12BIT = 0x4, + OUT_FORMAT_YUV422_16BIT = 0x5, + + OUT_FORMAT_YUV420_8BIT_NORMAL = 0x6, /* CSI */ + OUT_FORMAT_YUV420_8BIT_LEGACY = 0x7, + OUT_FORMAT_YUV422_8BIT = 0x8, + OUT_FORMAT_RGB_888 = 0x9, + OUT_FORMAT_RAW_8BIT = 0xa, + OUT_FORMAT_RAW_10BIT = 0xb, + OUT_FORMAT_RAW_12BIT = 0xc, + OUT_FORMAT_RAW_14BIT = 0xd, + OUT_FORMAT_RAW_16BIT = 0xe, + OUT_FORMAT_BUTT +} out_format_t; + +typedef struct { + unsigned short hsa_pixels; + unsigned short hbp_pixels; + unsigned short hact_pixels; + unsigned short hfp_pixels; + + unsigned short vsa_lines; + unsigned short vbp_lines; + unsigned short vact_lines; + unsigned short vfp_lines; +} sync_info_t; + +typedef struct { + unsigned int devno; /* device number */ + short lane_id[LANE_MAX_NUM]; /* lane_id: -1 - disable */ + out_mode_t out_mode; /* output mode: CSI/DSI_VIDEO/DSI_CMD */ + video_mode_t video_mode; + out_format_t out_format; + sync_info_t sync_info; + unsigned int phy_data_rate; /* Mbps */ + unsigned int pixel_clk; /* KHz */ +} combo_dev_cfg_t; + +typedef struct { + unsigned int devno; /* device number */ + mipi_tx_work_mode_t work_mode; /* work mode: low power mode, high speed mode. */ + unsigned char lp_clk_en; /* low power clock enable. */ + unsigned short data_type; /* data type */ + unsigned short cmd_size; + const unsigned char HI_ATTRIBUTE *cmd; +} cmd_info_t; + +typedef struct { + unsigned int devno; /* device number */ + mipi_tx_work_mode_t work_mode; /* work mode: low power mode, high speed mode. */ + unsigned char lp_clk_en; /* low power clock enable. */ + unsigned short data_type; /* DSI data type */ + unsigned short data_param; /* data param,low 8 bit:first param.high 8 bit:second param, set 0 if not use */ + unsigned short get_data_size; /* read data size */ + unsigned char HI_ATTRIBUTE *get_data; /* read data memory address, should malloc by user */ +} get_cmd_info_t; + +#define HI_MIPI_TX_IOC_MAGIC 't' + +#define HI_MIPI_TX_SET_DEV_CFG _IOW(HI_MIPI_TX_IOC_MAGIC, 0x01, combo_dev_cfg_t) +#define HI_MIPI_TX_SET_CMD _IOW(HI_MIPI_TX_IOC_MAGIC, 0x02, cmd_info_t) +#define HI_MIPI_TX_ENABLE _IO(HI_MIPI_TX_IOC_MAGIC, 0x03) +#define HI_MIPI_TX_GET_CMD _IOWR(HI_MIPI_TX_IOC_MAGIC, 0x04, get_cmd_info_t) +#define HI_MIPI_TX_DISABLE _IO(HI_MIPI_TX_IOC_MAGIC, 0x05) +#define HI_MIPI_TX_COLORBAR _IO(HI_MIPI_TX_IOC_MAGIC, 0x06) + +#ifdef __cplusplus +} +#endif + +#endif /* end of #ifndef __HI_MIPI_TX_H__ */ diff --git a/OnBoardInterface/Display/MIPIDisplay/include/vo_comm.h b/OnBoardInterface/Display/MIPIDisplay/include/vo_comm.h new file mode 100644 index 0000000000000000000000000000000000000000..ab90111f508f981d43a7a47a02888db92edf6597 --- /dev/null +++ b/OnBoardInterface/Display/MIPIDisplay/include/vo_comm.h @@ -0,0 +1,114 @@ +/** +* @File vo_comm.h +* @Description Provide util function for reading RAW & YUV data from the VI PIPE & CHN +* +* Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ +#ifndef __VO_COMM_H__ +#define __VO_COMM_H__ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "hi_media_common.h" +#include "hi_common_vo.h" +#include "hi_mpi_vo.h" +#include "hi_mipi_tx.h" + +#define VO_CHECK_RET(express, name) \ + do { \ + hi_s32 _ret; \ + _ret = express; \ + if (_ret != HI_SUCCESS) { \ + printf("%s failed at %s: LINE: %d with %#x!\n", name, __FUNCTION__, __LINE__, _ret); \ + } \ + } while (0) + +#define FILE_NAME_LEN 512 +#define VO_MST_ALIGN_16 16 +#define VO_MST_ALIGN_2 2 +#define VO_ALIGN_BACK(x, a) ((a) * (((x) / (a)))) +#define VO_TEST_ALIGN_BACK(x, a) ((a) * (((x) + (a) - 1) / (a))) + +#define DEV_DHD0 0 +#define VO_LAYER_VHD0 0 + +#define CMD_COUNT 16 + +// typedef VB_BLK hi_vb_blk; + +typedef struct { + hi_vo_intf_sync intf_sync; + hi_char *name; + hi_u32 width; + hi_u32 height; + hi_u32 frame_rate; +} vo_mst_sync_info; + +typedef struct { + cmd_info_t cmd_info; + hi_u32 usleep_value; +}mipi_tx_cmd_info; + +typedef enum { + HI_MIPI_TX_OUT_576P50 = HI_VO_OUT_576P50, + HI_MIPI_TX_OUT_1024X768_60 = HI_VO_OUT_1024x768_60, + HI_MIPI_TX_OUT_720P50 = HI_VO_OUT_720P50, + HI_MIPI_TX_OUT_720P60 = HI_VO_OUT_720P60, + HI_MIPI_TX_OUT_1280X1024_60 = HI_VO_OUT_1280x1024_60, + HI_MIPI_TX_OUT_1080P24 = HI_VO_OUT_1080P24, + HI_MIPI_TX_OUT_1080P25 = HI_VO_OUT_1080P25, + HI_MIPI_TX_OUT_1080P30 = HI_VO_OUT_1080P30, + HI_MIPI_TX_OUT_1080P50 = HI_VO_OUT_1080P50, + HI_MIPI_TX_OUT_1080P60 = HI_VO_OUT_1080P60, + HI_MIPI_TX_OUT_3840X2160_24 = HI_VO_OUT_3840x2160_24, + HI_MIPI_TX_OUT_3840X2160_25 = HI_VO_OUT_3840x2160_25, + HI_MIPI_TX_OUT_3840X2160_30 = HI_VO_OUT_3840x2160_30, + HI_MIPI_TX_OUT_3840X2160_50 = HI_VO_OUT_3840x2160_50, + HI_MIPI_TX_OUT_3840X2160_60 = HI_VO_OUT_3840x2160_60, + + HI_MIPI_TX_OUT_720X1280_60 = HI_VO_OUT_720x1280_60, + HI_MIPI_TX_OUT_1080X1920_60 = HI_VO_OUT_1080x1920_60, + + HI_MIPI_TX_OUT_USER = HI_VO_OUT_USER, + + HI_MIPI_TX_OUT_BUTT = HI_VO_OUT_BUTT, +} mipi_tx_intf_sync; + +#define ARGB_FILE_MAX_LENGTH 64 + +typedef struct { + mipi_tx_intf_sync intf_sync; + + hi_u32 cmd_count; + mipi_tx_cmd_info *cmd_info; + + combo_dev_cfg_t combo_dev_cfg; +} sample_mipi_tx_config; + +typedef enum { + VB_REMAP_MODE_NONE = 0, /* no remap */ + VB_REMAP_MODE_NOCACHE = 1, /* no cache remap */ + VB_REMAP_MODE_CACHED = 2, /* cache remap, if you use this mode, you should flush cache by yourself */ + VB_REMAP_MODE_BUTT +} vo_vb_remap_mode; + +typedef struct { + hi_u64 blk_size; + hi_u32 blk_cnt; + vo_vb_remap_mode remap_mode; +} hi_vb_pool_config; + +#endif \ No newline at end of file diff --git a/OnBoardInterface/Display/MIPIDisplay/raspberry_demo.c b/OnBoardInterface/Display/MIPIDisplay/raspberry_demo.c new file mode 100644 index 0000000000000000000000000000000000000000..d2cb5e4a7f48482e45fc464485c6215a7c128886 --- /dev/null +++ b/OnBoardInterface/Display/MIPIDisplay/raspberry_demo.c @@ -0,0 +1,71 @@ +/** +* @File raspberry_demo.h +* @Description Provide util function for reading RAW & YUV data from the VI PIPE & CHN +* +* Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ +#include +#include +#include +#include "func.h" +#include "vo_comm.h" + +hi_s32 g_exit_flag = 0; + +void handler(hi_s32 flag) +{ + g_exit_flag = 1; +} + +hi_s32 main(hi_s32 argc, hi_s8 *argv[]) +{ + vo_mst_sync_info sync_info; + hi_u32 vb_pool_val = -1; + hi_s32 ret; + char file_name[FILE_NAME_LEN]; + + if (argc < 2) { + printf("The input filename is mandatory!\n"); + return -1; + } else { + strcpy(file_name, argv[1]); + } + + signal(SIGINT, handler); + + /* start vo */ + vo_get_sync_info(&sync_info); + vo_sys_init(sync_info.height, sync_info.width); + vo_init(DEV_DHD0, VO_LAYER_VHD0, HI_VO_INTF_MIPI, HI_VO_OUT_800x480_60, sync_info); + + ret = vo_create_vb_pool(sync_info.height, sync_info.width, &vb_pool_val); + if (ret != HI_SUCCESS) { + printf("start vo ... Failed!\n"); + return -1; + } + vo_start(sync_info.height, sync_info.width, vb_pool_val, file_name); + + /* start mipitx */ + ret = start_mipi_tx(); + if (ret != HI_SUCCESS) { + printf("start mipitx ... Failed!\n"); + return -1; + } + + if (!g_exit_flag) printf("\nIf you wanna stop, enter CTRL+C!\n"); + while (!g_exit_flag) { + sleep(1); + } + + close_mipi_tx(); + + vo_deinit(DEV_DHD0, VO_LAYER_VHD0); + + vo_sys_exit(); + + return -1; +} \ No newline at end of file diff --git a/OnBoardInterface/Display/MIPIDisplay/src/vo_init.c b/OnBoardInterface/Display/MIPIDisplay/src/vo_init.c new file mode 100644 index 0000000000000000000000000000000000000000..2bb44beb24a8bd2151a1b90acab320b910d48cfc --- /dev/null +++ b/OnBoardInterface/Display/MIPIDisplay/src/vo_init.c @@ -0,0 +1,95 @@ +/** +* @File vo_init.c +* @Description Provide util function for reading RAW & YUV data from the VI PIPE & CHN +* +* Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +#include "func.h" +#include "vo_comm.h" + +hi_void vo_get_sync_info(vo_mst_sync_info *sync_info) +{ + sync_info->intf_sync = HI_VO_OUT_800x480_60; + sync_info->name = "800x480@60"; + sync_info->width = 800; + sync_info->height = 480; + sync_info->frame_rate = 60; +} + +/* init device*/ +static hi_void vo_init_dev(hi_s32 dev, hi_vo_intf_type intf_type, hi_vo_intf_sync intf_sync) +{ + hi_vo_pub_attr pub_attr; + + pub_attr.bg_color = 0xffffff; + pub_attr.intf_sync = intf_sync; + pub_attr.intf_type = intf_type; + VO_CHECK_RET(hi_mpi_vo_set_pub_attr(dev, &pub_attr), "hi_mpi_vo_set_pub_attr"); + VO_CHECK_RET(hi_mpi_vo_enable(dev), "hi_mpi_vo_enable"); +} + +/* init layer */ +static hi_void vo_init_layer(hi_s32 layer, hi_u32 img_height, hi_u32 img_width, hi_u32 frame_rate) +{ + hi_vo_video_layer_attr layer_attr; + + layer_attr.double_frame_en = HI_FALSE; + layer_attr.cluster_mode_en = HI_FALSE; + layer_attr.dst_dynamic_range = HI_DYNAMIC_RANGE_SDR8; + layer_attr.pixel_format = HI_PIXEL_FORMAT_YVU_SEMIPLANAR_420; + layer_attr.display_buf_len = 4; + layer_attr.partition_mode = HI_VO_PARTITION_MODE_MULTI; + layer_attr.compress_mode = 0; + layer_attr.display_rect.width = img_width; + layer_attr.display_rect.height = img_height; + layer_attr.display_rect.x = 0; + layer_attr.display_rect.y = 0; + layer_attr.img_size.width = img_width; + layer_attr.img_size.height = img_height; + layer_attr.display_frame_rate = frame_rate; + VO_CHECK_RET(hi_mpi_vo_set_video_layer_attr(layer, &layer_attr), "hi_mpi_vo_set_video_layer_attr"); + VO_CHECK_RET(hi_mpi_vo_enable_video_layer(layer), "hi_mpi_vo_enable_video_layer"); +} + +/* init channel */ +static hi_void vo_init_chn(hi_s32 layer, hi_u32 img_height, hi_u32 img_width, hi_u32 chn_num) +{ + hi_vo_chn_attr chn_attr[chn_num]; + + hi_u32 square_sort = 1; + for (int chn = 0; chn < (square_sort * square_sort); chn++) { + chn_attr[chn].rect.x = VO_ALIGN_BACK((img_width / square_sort) * (chn % square_sort), VO_MST_ALIGN_2); + chn_attr[chn].rect.y = VO_ALIGN_BACK((img_height / square_sort) * (chn / square_sort), VO_MST_ALIGN_2); + chn_attr[chn].rect.width = VO_ALIGN_BACK(img_width / square_sort, VO_MST_ALIGN_2); + chn_attr[chn].rect.height = VO_ALIGN_BACK(img_height / square_sort, VO_MST_ALIGN_2); + chn_attr[chn].priority = 0; + chn_attr[chn].deflicker_en = HI_FALSE; + } + + for (int chn = 0; chn < chn_num; chn++) { + VO_CHECK_RET(hi_mpi_vo_set_chn_attr(layer, chn, &chn_attr[chn]), "hi_mpi_vo_set_chn_attr"); + VO_CHECK_RET(hi_mpi_vo_enable_chn(layer, chn), "hi_mpi_vo_enable_chn"); + } +} + +hi_void vo_init(hi_s32 dev, hi_s32 layer, hi_vo_intf_type intf_type, hi_vo_intf_sync intf_sync, vo_mst_sync_info sync_info) +{ + vo_init_dev(dev, intf_type, intf_sync); + vo_init_layer(layer, sync_info.height, sync_info.width, sync_info.frame_rate); + vo_init_chn(layer, sync_info.height, sync_info.width, 1); +} + +hi_void vo_deinit(hi_s32 dev, hi_s32 layer) +{ + hi_u32 chn_num = 1; + for (int chn = 0; chn < chn_num; chn++) { + hi_mpi_vo_disable_chn(layer, chn); + } + hi_mpi_vo_disable_video_layer(layer); + VO_CHECK_RET(hi_mpi_vo_disable(dev), "hi_mpi_vo_disable"); +} \ No newline at end of file diff --git a/OnBoardInterface/Display/MIPIDisplay/src/vo_mem.c b/OnBoardInterface/Display/MIPIDisplay/src/vo_mem.c new file mode 100644 index 0000000000000000000000000000000000000000..c4d7d7ef69177528d98c531cc990800f12678bf9 --- /dev/null +++ b/OnBoardInterface/Display/MIPIDisplay/src/vo_mem.c @@ -0,0 +1,133 @@ +/** +* @File vo_mem.h +* @Description Provide util function for reading RAW & YUV data from the VI PIPE & CHN +* +* Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +#include "func.h" +#include "vo_comm.h" + +static hi_u64 vo_mst_get_vb_blk_size(hi_u32 width, hi_u32 height) +{ + hi_u64 vb_blk_size; + hi_u32 align_width; + hi_u32 align_height; + hi_u32 head_size; + + align_width = VO_TEST_ALIGN_BACK(width, VO_MST_ALIGN_16); + align_height = VO_TEST_ALIGN_BACK(height, VO_MST_ALIGN_2); + + /* compress header stride 16 */ + head_size = VO_MST_ALIGN_16 * align_height; + vb_blk_size = (align_width * align_height + head_size) * 2; + return vb_blk_size; +} + +/* vb init */ +hi_void vo_sys_init(hi_u32 img_height, hi_u32 img_width) +{ + hi_mpi_sys_exit(); + VO_CHECK_RET(hi_mpi_sys_init();, "sys init"); +} + +/* vb deinit */ +hi_void vo_sys_exit(hi_void) +{ + VO_CHECK_RET(hi_mpi_sys_exit(), "sys exit"); +} + +/* vb pool create */ +hi_s32 vo_create_vb_pool(hi_u32 img_height, hi_u32 img_width, hi_u32 *blk_handle) +{ + hi_vb_pool_config pool_cfg; + hi_u32 pool_val; + + (hi_void)memset(&pool_cfg, 0, sizeof(hi_vb_pool_config)); + + pool_cfg.blk_size = vo_mst_get_vb_blk_size(img_width, img_height); + pool_cfg.blk_cnt = 10; + pool_cfg.remap_mode = 0; + + pool_val = hi_mpi_vo_create_pool(pool_cfg.blk_size); + + *blk_handle = pool_val; + if (pool_val == -1) { + return HI_FAILURE; + } + return HI_SUCCESS; +} + +static hi_void vo_init_user_frame(hi_u32 vb_blk, hi_u32 img_height, hi_u32 img_width, hi_video_frame_info *user_frame) +{ + hi_u32 luma_size = 0; + + user_frame->v_frame.field = 4; + user_frame->v_frame.compress_mode = 0; + user_frame->v_frame.pixel_format = HI_PIXEL_FORMAT_YVU_SEMIPLANAR_420; + user_frame->v_frame.video_format = 0; + user_frame->v_frame.color_gamut = 0; + user_frame->v_frame.dynamic_range = 0; + user_frame->v_frame.height = img_height; + user_frame->v_frame.width = img_width; + user_frame->v_frame.width_stride[0] = VO_TEST_ALIGN_BACK(img_width, VO_MST_ALIGN_16); + user_frame->v_frame.width_stride[1] = VO_TEST_ALIGN_BACK(img_width, VO_MST_ALIGN_16); + user_frame->v_frame.time_ref = 0; + user_frame->v_frame.pts = 0; + + luma_size = VO_TEST_ALIGN_BACK(user_frame->v_frame.width, VO_MST_ALIGN_16) * user_frame->v_frame.height; + + user_frame->pool_id = (vb_blk >> 16U); + user_frame->v_frame.phys_addr[0] = hi_mpi_vo_handle_to_phys_addr(vb_blk); + user_frame->v_frame.phys_addr[1] = user_frame->v_frame.phys_addr[0] + luma_size; + user_frame->v_frame.header_phys_addr[0] = user_frame->v_frame.phys_addr[0]; + user_frame->v_frame.header_phys_addr[1] = user_frame->v_frame.phys_addr[1]; +} + +static hi_s32 loadRawImage(FILE *fp, hi_u8 *addr, hi_u32 width, hi_u32 height, hi_u32 format) +{ + hi_u32 buf_size = width * height * 3U / 2U; + hi_u32 vb_size = buf_size; + + void *viraddr = (void*)addr; + if (fread(viraddr, 1, vb_size, fp) != buf_size) { + printf("buf_size should be: %d\n!", buf_size); + return HI_FAILURE; + } + return HI_SUCCESS; +} + +/* read image and display */ +hi_void vo_start(hi_u32 img_height, hi_u32 img_width, hi_u32 vb_blk, char *file_name) +{ + hi_s32 ret; + FILE *fd; + hi_video_frame_info user_frame; + + vo_init_user_frame(vb_blk, img_height, img_width, &user_frame); + + fd = fopen(file_name, "rb"); + if (fd == NULL) { + printf("open file %s fail \n", file_name); + return; + } + + ret = loadRawImage(fd, user_frame.v_frame.phys_addr[0], img_width, img_height, user_frame.v_frame.pixel_format); + if (ret == HI_SUCCESS) { + ret = hi_mpi_vo_send_frame(0, 0, &user_frame, 0); + if (ret != HI_SUCCESS) { + printf("Display one frame failed, ret = 0x%x!\n", ret); + } else { + printf("Display one frame success!\n"); + } + } + + fclose(fd); + + sleep(1); + return; +} \ No newline at end of file diff --git a/OnBoardInterface/Display/MIPIDisplay/src/vo_mipitx.c b/OnBoardInterface/Display/MIPIDisplay/src/vo_mipitx.c new file mode 100644 index 0000000000000000000000000000000000000000..e511ac6952b957979f30f20d4519c21a3af20175 --- /dev/null +++ b/OnBoardInterface/Display/MIPIDisplay/src/vo_mipitx.c @@ -0,0 +1,337 @@ +/** +* @File vo_mipix.c +* @Description Provide util function for reading RAW & YUV data from the VI PIPE & CHN +* +* Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +#include "func.h" +#include "hi_mipi_tx.h" +#include "linux/i2c-dev.h" + +#define MIPI_TX_DEV_NAME "/dev/ot_mipi_tx" + +static hi_s32 g_sample_comm_mipi_fd = -1; + +const sample_mipi_tx_config mipi_tx_rpi_configs[1] = { + { + /* for combo dev config */ + .intf_sync = HI_MIPI_TX_OUT_USER, + + /* for user sync */ + .combo_dev_cfg = { + .devno = 0, + .lane_id = {0, -1, -1, -1}, + .out_mode = OUT_MODE_DSI_VIDEO, + .out_format = OUT_FORMAT_RGB_24BIT, + .video_mode = BURST_MODE, + .sync_info = { + .hsa_pixels = 20, + .hbp_pixels = 26, + .hact_pixels = 800, + .hfp_pixels = 70, + .vsa_lines = 2, + .vbp_lines = 21, + .vact_lines = 480, + .vfp_lines = 7, + }, + .phy_data_rate = 720, + .pixel_clk = 27448, + }, + } +}; + +static hi_s32 sample_comm_mipi_tx_get_config(const combo_dev_cfg_t **mipi_tx_config) +{ + mipi_tx_intf_sync mipi_intf_sync; + const sample_mipi_tx_config *tx_config = &mipi_tx_rpi_configs[0]; + + mipi_intf_sync = tx_config->intf_sync; + + if (mipi_intf_sync == HI_MIPI_TX_OUT_USER) { + *mipi_tx_config = &tx_config->combo_dev_cfg; + if ((*mipi_tx_config)->phy_data_rate == 0) { + printf("error: not set mipi tx user config\n"); + return HI_FAILURE; + } + } + return HI_SUCCESS; +} + +static void sample_comm_mipi_tx_do_close_fd(void) +{ + if (g_sample_comm_mipi_fd != -1) { + close(g_sample_comm_mipi_fd); + g_sample_comm_mipi_fd = -1; + } +} + +static hi_s32 g_fd = -1; + +static hi_s32 rpi_i2c_init() +{ + char acDevFile[16] = {0}; + hi_u8 u8DevNum; + hi_s32 ret; + + u8DevNum = 13; + ret = snprintf(acDevFile, sizeof(acDevFile), "/dev/i2c-%u", u8DevNum); + if (ret < 0) { + return HI_FAILURE; + } + + g_fd = open(acDevFile, O_RDWR, S_IRUSR | S_IWUSR); + + if (g_fd < 0) { + printf("Open /dev/i2c-%u error!\n", u8DevNum); + return HI_FAILURE; + } + ret = ioctl(g_fd, I2C_SLAVE_FORCE, (0x45)); + if (ret < 0) { + printf("I2C_SLAVE_FORCE error!\n"); + close(g_fd); + g_fd = -1; + return ret; + } + + return HI_SUCCESS; +} + +static hi_s32 rpi_i2c_write_register(hi_u32 addr, hi_u32 data) +{ + if (g_fd < 0) { + return HI_FAILURE; + } + + hi_u32 idx = 0; + hi_s32 ret; + hi_u8 buf[8]; + + buf[idx] = addr & 0xff; + idx++; + + buf[idx] = data & 0xff; + idx++; + + ret = write(g_fd, buf, 2); + if (ret < 0) { + printf("I2C_WRITE error!\n"); + return HI_FAILURE; + } + + return HI_SUCCESS; +} + +static const hi_u8 cmd1[] = { + 0x10U, 0x02U, 0x03U, 0x00, 0x00, 0x00 +}; + +static const hi_u8 cmd2[] = { + 0x64U, 0x01U, 0x0cU, 0x00, 0x00, 0x00 +}; + +static const hi_u8 cmd3[] = { + 0x68U, 0x01U, 0x0cU, 0x00, 0x00, 0x00 +}; + +static const hi_u8 cmd4[] = { + 0x44U, 0x01U, 0x00, 0x00, 0x00, 0x00 +}; + +static const hi_u8 cmd5[] = { + 0x48U, 0x01U, 0x00, 0x00, 0x00, 0x00 +}; + +static const hi_u8 cmd6[] = { + 0x14U, 0x01U, 0x15U, 0x00, 0x00, 0x00 +}; + +static const hi_u8 cmd7[] = { + 0x50U, 0x04U, 0x60U, 0x00, 0x00, 0x00 +}; + +static const hi_u8 cmd8[] = { + 0x20U, 0x04U, 0x52U, 0x01U, 0x10U, 0x00 +}; + +static const hi_u8 cmd9[] = { + 0x24U, 0x04U, 0x14U, 0x00, 0x24U, 0x00 +}; + +static const hi_u8 cmd10[] = { + 0x28U, 0x04U, 0x20U, 0x03U, 0x90U, 0x00 +}; + +static const hi_u8 cmd11[] = { + 0x2cU, 0x04U, 0x02U, 0x00, 0x15U, 0x00 +}; + +static const hi_u8 cmd12[] = { + 0x30U, 0x04U, 0xe0U, 0x01U, 0x07U, 0x00 +}; + +static const hi_u8 cmd13[] = { + 0x34U, 0x04U, 0x01U, 0x00, 0x00, 0x00 +}; + +static const hi_u8 cmd14[] = { + 0x64U, 0x04U, 0x0fU, 0x04U, 0x00, 0x00 +}; + +static const hi_u8 cmd15[] = { + 0x04U, 0x01U, 0x01U, 0x00, 0x00, 0x00 +}; + +static const hi_u8 cmd16[] = { + 0x04U, 0x02U, 0x01U, 0x00, 0x00, 0x00 +}; + +static mipi_tx_cmd_info g_cmd_info_video_mode[CMD_COUNT] = { + /* LANE */ + {{0, 0, 1, 0x29, 0x0006, cmd1}, 50000U}, + /* D0S_CLRSIPOCOUNT */ + {{0, 0, 1, 0x29, 0x0006, cmd2}, 50000U}, + /* D1S_CLRSIPOCOUNT */ + {{0, 0, 1, 0x29, 0x0006, cmd3}, 50000U}, + /* D0S_ATMR */ + {{0, 0, 1, 0x29, 0x0006, cmd4}, 50000U}, + /* D1S_ATMR */ + {{0, 0, 1, 0x29, 0x0006, cmd5}, 50000U}, + /* LPTXTIMCNT */ + {{0, 0, 1, 0x29, 0x0006, cmd6}, 50000U}, + /* SPICMR/SPICTRL */ + {{0, 0, 1, 0x29, 0x0006, cmd7}, 50000U}, + /* PORT/LCDCTRL */ + {{0, 0, 1, 0x29, 0x0006, cmd8}, 50000U}, + /* HBPR/HSR */ + {{0, 0, 1, 0x29, 0x0006, cmd9}, 50000U}, + /* HFPR/HDISP */ + {{0, 0, 1, 0x29, 0x0006, cmd10}, 50000U}, + /* VBFR/VSR */ + {{0, 0, 1, 0x29, 0x0006, cmd11}, 50000U}, + /* VFPR/VDISP */ + {{0, 0, 1, 0x29, 0x0006, cmd12}, 50000U}, + /* VFUEN */ + {{0, 0, 1, 0x29, 0x0006, cmd13}, 50000U}, + /* SYSCTRL */ + {{0, 0, 1, 0x29, 0x0006, cmd14}, 50000U}, + /* STARTPPI */ + {{0, 0, 1, 0x29, 0x0006, cmd15}, 50000U}, + /* STARTDSI */ + {{0, 0, 1, 0x29, 0x0006, cmd16}, 50000U}, +}; + +static hi_s32 vo_mst_mipi_tx_send_one_cmd(cmd_info_t *cmd_info) +{ + hi_s32 ret; + ret = ioctl(g_sample_comm_mipi_fd, HI_MIPI_TX_SET_CMD, cmd_info); + if (ret != HI_SUCCESS) { + printf("MIPI_TX SET CMD failed\n"); + return HI_FAILURE; + } + return HI_SUCCESS; +} + +static hi_s32 mipi_tx_init_rpi_screen_v2() +{ + hi_s32 ret; + cmd_info_t ci = {0}; + hi_u32 loop; + hi_u32 loop_num; + + /* init i2c for power up */ + ret = rpi_i2c_init(); + ret |= rpi_i2c_write_register(0x85, 0x1); + usleep(200000); + ret |= rpi_i2c_write_register(0x81, 0x4); + usleep(100000); + ret |= rpi_i2c_write_register(0x86, 0xff); + usleep(100000); + + if (ret != HI_SUCCESS) { + printf("iic init failed!\n"); + return HI_FAILURE; + } + + /* init screen */ + const sample_mipi_tx_config tx_config = { + .cmd_count = CMD_COUNT, + .cmd_info = &g_cmd_info_video_mode, + }; + loop_num = tx_config.cmd_count; + + for (loop = 0; loop < loop_num; loop++) { + (hi_void)memcpy(&ci, &(tx_config.cmd_info[loop].cmd_info), sizeof(cmd_info_t)); + ret = vo_mst_mipi_tx_send_one_cmd(&ci); + if (ret != HI_SUCCESS) { + printf("screen init failed!\n"); + return HI_FAILURE; + } + usleep(tx_config.cmd_info[loop].usleep_value); + } + + return HI_SUCCESS; +} + +hi_s32 start_mipi_tx() +{ + hi_s32 ret; + const combo_dev_cfg_t *combo_config = HI_NULL; + + g_sample_comm_mipi_fd = open(MIPI_TX_DEV_NAME, O_RDONLY); + if (g_sample_comm_mipi_fd < 0) { + printf("open mipi dev file (%s) fail\n", MIPI_TX_DEV_NAME); + return HI_FAILURE; + } + + ret = sample_comm_mipi_tx_get_config(&combo_config); + if (ret != HI_SUCCESS) { + printf("get mipi tx config fail\n"); + sample_comm_mipi_tx_do_close_fd(); + return ret; + } + + /* step1 */ + ret = ioctl(g_sample_comm_mipi_fd, HI_MIPI_TX_SET_DEV_CFG, combo_config); + if (ret != HI_SUCCESS) { + printf("ioctl mipi tx HI_MIPI_TX_SET_DEV_CFG fail at ret\n"); + sample_comm_mipi_tx_do_close_fd(); + return ret; + } + + /* step2 */ + ret = mipi_tx_init_rpi_screen_v2(); + + if (ret != HI_SUCCESS) { + printf("init screen failed\n"); + sample_comm_mipi_tx_do_close_fd(); + return ret; + } + + ret = ioctl(g_sample_comm_mipi_fd, HI_MIPI_TX_ENABLE, NULL); + if (ret != HI_SUCCESS) { + printf("ioctl mipi tx HI_MIPI_TX_ENABLE fail at ret\n"); + sample_comm_mipi_tx_do_close_fd(); + return ret; + } + + return HI_SUCCESS; +} + +hi_s32 close_mipi_tx() +{ + hi_s32 ret; + ret = ioctl(g_sample_comm_mipi_fd, HI_MIPI_TX_DISABLE, NULL); + if (ret != HI_SUCCESS) { + printf("ioctl mipi tx HI_MIPI_TX_DISABLE fail at ret\n"); + sample_comm_mipi_tx_do_close_fd(); + return ret; + } + sample_comm_mipi_tx_do_close_fd(); + + return HI_SUCCESS; +} \ No newline at end of file