...
|
...
|
@@ -200,6 +200,14 @@ static T_JZsdkReturnCode IRC_data_PreliminaryDeal(U8_t *rawData , int dataSize, |
|
|
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
|
|
}
|
|
|
|
|
|
|
|
|
unsigned int Get_2DImage_PointToArray(int x, int y, int width, int height)
|
|
|
{
|
|
|
return (x + y*width);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
功能:IRC后处理
|
|
|
|
...
|
...
|
@@ -212,6 +220,8 @@ static T_JZsdkReturnCode IRC_Postdeal(unsigned char *rgb_data, struct IRC_param |
|
|
|
|
|
if (MirrorImageFlag == JZ_FLAGCODE_ON)
|
|
|
{
|
|
|
int x, y = 0;
|
|
|
|
|
|
int bytes_per_row = dealInfo->Width * 3; // 每行的字节数
|
|
|
unsigned char *temp_row = (unsigned char *)malloc(bytes_per_row); // 临时缓冲区,用于存储一行的像素数据
|
|
|
|
...
|
...
|
@@ -221,13 +231,13 @@ static T_JZsdkReturnCode IRC_Postdeal(unsigned char *rgb_data, struct IRC_param |
|
|
}
|
|
|
|
|
|
// 遍历图像的每一行
|
|
|
for (int y = 0; y < dealInfo->Height; y++)
|
|
|
for (y = 0; y < dealInfo->Height; y++)
|
|
|
{
|
|
|
// 复制当前行到临时缓冲区
|
|
|
memcpy(temp_row, rgb_data + y * bytes_per_row, bytes_per_row);
|
|
|
|
|
|
// 从右向左(即反向)复制临时缓冲区的数据回原位置
|
|
|
for (int x = 0; x < dealInfo->Width; x++) {
|
|
|
for (x = 0; x < dealInfo->Width; x++) {
|
|
|
int source_index = (dealInfo->Width - 1 - x) * 3; // 计算源像素的索引
|
|
|
int dest_index = x * 3; // 计算目标像素的索引
|
|
|
|
...
|
...
|
@@ -240,7 +250,81 @@ static T_JZsdkReturnCode IRC_Postdeal(unsigned char *rgb_data, struct IRC_param |
|
|
|
|
|
free(temp_row); // 释放临时缓冲区
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//修复外圈图像
|
|
|
if (dealInfo->RingRepair == JZ_FLAGCODE_ON)
|
|
|
{
|
|
|
int x, y = 0;
|
|
|
|
|
|
//修复上边
|
|
|
for (x = 2; x <= dealInfo->Width - 2; x++)
|
|
|
{
|
|
|
int SourceIndex = Get_2DImage_PointToArray(x, 3, dealInfo->Width, dealInfo->Height);
|
|
|
|
|
|
int FirstIndex = Get_2DImage_PointToArray(x, 0, dealInfo->Width, dealInfo->Height);
|
|
|
int SecondIndex = Get_2DImage_PointToArray(x, 1, dealInfo->Width, dealInfo->Height);
|
|
|
|
|
|
rgb_data[FirstIndex] = rgb_data[SourceIndex];
|
|
|
rgb_data[FirstIndex + 1] = rgb_data[SourceIndex + 1];
|
|
|
rgb_data[FirstIndex + 2] = rgb_data[SourceIndex + 2];
|
|
|
|
|
|
rgb_data[SecondIndex] = rgb_data[SourceIndex];
|
|
|
rgb_data[SecondIndex + 1] = rgb_data[SourceIndex + 1];
|
|
|
rgb_data[SecondIndex + 2] = rgb_data[SourceIndex + 2];
|
|
|
}
|
|
|
|
|
|
//修复下边
|
|
|
for (x = 2; x <= dealInfo->Width - 2; x++)
|
|
|
{
|
|
|
int SourceIndex = Get_2DImage_PointToArray(x, dealInfo->Height - 3, dealInfo->Width, dealInfo->Height);
|
|
|
|
|
|
int FirstIndex = Get_2DImage_PointToArray(x, dealInfo->Height - 1, dealInfo->Width, dealInfo->Height);
|
|
|
int SecondIndex = Get_2DImage_PointToArray(x, dealInfo->Height - 2, dealInfo->Width, dealInfo->Height);
|
|
|
|
|
|
rgb_data[FirstIndex] = rgb_data[SourceIndex];
|
|
|
rgb_data[FirstIndex + 1] = rgb_data[SourceIndex + 1];
|
|
|
rgb_data[FirstIndex + 2] = rgb_data[SourceIndex + 2];
|
|
|
|
|
|
rgb_data[SecondIndex] = rgb_data[SourceIndex];
|
|
|
rgb_data[SecondIndex + 1] = rgb_data[SourceIndex + 1];
|
|
|
rgb_data[SecondIndex + 2] = rgb_data[SourceIndex + 2];
|
|
|
}
|
|
|
|
|
|
//修复左边
|
|
|
for (int y = 0; y <= dealInfo->Height; y++)
|
|
|
{
|
|
|
int SourceIndex = Get_2DImage_PointToArray(2, y, dealInfo->Width, dealInfo->Height);
|
|
|
|
|
|
int FirstIndex = Get_2DImage_PointToArray(0, y, dealInfo->Width, dealInfo->Height);
|
|
|
int SecondIndex = Get_2DImage_PointToArray(1, y, dealInfo->Width, dealInfo->Height);
|
|
|
|
|
|
rgb_data[FirstIndex] = rgb_data[SourceIndex];
|
|
|
rgb_data[FirstIndex + 1] = rgb_data[SourceIndex + 1];
|
|
|
rgb_data[FirstIndex + 2] = rgb_data[SourceIndex + 2];
|
|
|
|
|
|
rgb_data[SecondIndex] = rgb_data[SourceIndex];
|
|
|
rgb_data[SecondIndex + 1] = rgb_data[SourceIndex + 1];
|
|
|
rgb_data[SecondIndex + 2] = rgb_data[SourceIndex + 2];
|
|
|
}
|
|
|
|
|
|
//修复右边
|
|
|
for (int y = 0; y <= dealInfo->Height; y++)
|
|
|
{
|
|
|
int SourceIndex = Get_2DImage_PointToArray(dealInfo->Width - 3, y, dealInfo->Width, dealInfo->Height);
|
|
|
int FirstIndex = Get_2DImage_PointToArray(dealInfo->Width - 1, y, dealInfo->Width, dealInfo->Height);
|
|
|
int SecondIndex = Get_2DImage_PointToArray(dealInfo->Width - 2, y, dealInfo->Width, dealInfo->Height);
|
|
|
|
|
|
rgb_data[FirstIndex] = rgb_data[SourceIndex];
|
|
|
rgb_data[FirstIndex + 1] = rgb_data[SourceIndex + 1];
|
|
|
rgb_data[FirstIndex + 2] = rgb_data[SourceIndex + 2];
|
|
|
|
|
|
rgb_data[SecondIndex] = rgb_data[SourceIndex];
|
|
|
rgb_data[SecondIndex + 1] = rgb_data[SourceIndex + 1];
|
|
|
rgb_data[SecondIndex + 2] = rgb_data[SourceIndex + 2];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
// 在rgb图上画图形
|
|
|
|
...
|
...
|
@@ -306,6 +390,10 @@ T_JZsdkReturnCode IRC_FrameDeal(unsigned char *rawData ,unsigned int dataSize, u |
|
|
case IRC_DEALMODE_KTLIB:
|
|
|
KtLib_DataDeal(U16_data, U16_dataSize, &RGB_data, &RGB_dataSize,g_IRC_Param);
|
|
|
break;
|
|
|
|
|
|
case IRC_DEALMODE_JZSDK:
|
|
|
JZIrcLib_DataDeal(U16_data, U16_dataSize, &RGB_data, &RGB_dataSize,g_IRC_Param);
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
return JZ_ERROR_SYSTEM_MODULE_CODE_FAILURE;
|
...
|
...
|
@@ -934,7 +1022,7 @@ static T_JZsdkReturnCode IRC_param_Init(struct IRC_param **index, int height, in |
|
|
return JZ_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
|
|
}
|
|
|
|
|
|
IrcDealCfg->DealWay = IRC_DEALMODE_KTLIB;
|
|
|
IrcDealCfg->DealWay = IRC_DEALMODE_JZSDK;
|
|
|
IrcDealCfg->ImgDataBits = 14; //图像为14位图像
|
|
|
IrcDealCfg->Height = height;
|
|
|
IrcDealCfg->Width = width;
|
...
|
...
|
@@ -955,6 +1043,8 @@ static T_JZsdkReturnCode IRC_param_Init(struct IRC_param **index, int height, in |
|
|
|
|
|
IrcDealCfg->OutputPixelColorMode = 0;
|
|
|
|
|
|
IrcDealCfg->RingRepair = JZ_FLAGCODE_ON;
|
|
|
|
|
|
//单点部分
|
|
|
IrcDealCfg->FirstSPC_flag = JZ_FLAGCODE_OFF;
|
|
|
IrcDealCfg->SPC_ResetFlag = JZ_FLAGCODE_OFF;
|
...
|
...
|
|