Chromatix_AEC—exposure table

一.曝光表的设置

第一行exp time 需要根据sensor info 进行计算 。 

高通文档的公式

1S秒 = 1000 ms毫秒 = 1000_1000 us微妙 = 1000_000_000 ns纳秒  
1GHz = 1000 MHz = 1000_000 KHz = 1000_000_000 Hz

转换为ns ,乘以1,000,000,000

    sensor 驱动获得到帧行长
      <frameLengthLines>3260</frameLengthLines>
      <!--Minimum horizontal blanking interval in pixels -->
      <minHorizontalBlanking>125</minHorizontalBlanking>
      <!--Minimum horizontal blanking interval in lines -->
      <minVerticalBlanking>30</minVerticalBlanking>

spec 中也可找到frame length

exp time  =  1/(30*3260)*1,000,000,000 = 10224

二. 曝光介绍

sensor 曝光分为逐行曝光和全局曝光。 

sensor 逐行曝光:从第一行开始曝光,一行一行的曝光。 好处:便宜

sensor 全局曝光:所有行同事开始曝光,并同时结束曝光。好处:每一行的曝光时间比较一致,拍摄运动物体时图像不会出现偏移和不一致的问题。

sensor 曝光相关计算:

1. line_time 

line_time = line_length/pclk 

line_time = 4896 /480000000 = 10200ns

      <!--Line length pixel clock of frame
          Typically this value is the active width + blanking width -->
      <lineLengthPixelClock>4896</lineLengthPixelClock>
      <!--Frame length lines of frame
          Typically this value is the active height + blanking height -->
      <frameLengthLines>3260</frameLengthLines>
      <!--Minimum horizontal blanking interval in pixels -->
      <minHorizontalBlanking>125</minHorizontalBlanking>
      <!--Minimum horizontal blanking interval in lines -->
      <minVerticalBlanking>30</minVerticalBlanking>
      <!--Output pixel clock -->
      <outputPixelClock>480000000</outputPixelClock>
a). line_length: 一行的长度(包含h_blank)

b). pclk: 是控制像素输出的时钟,即pixel采样时钟,单位Hz。表示是每个单位时间内采样的pixel数量

c). line_time: 曝光一行的时间

2. exposure_time 的计算

exposure = exposure_line * line_time 

a). exposure_time: 曝光时间。指这一帧曝光了多长时间。

b). exposure_line: 字面意思是曝光行。值得注意的是,曝光行不是指一次性曝光多少行,对于逐行曝光的sensor来说,永远都是一次曝光一行。所以,曝光行是指这一帧曝光了多少行。

c): line_time: 曝光一行的时间

3.fps 帧率计算

frame_length = Vsync = Dummy Line = VTotal = VTS = V_Size + V_Blank // 帧长; 不占用曝光时间
line_length = Hsync = Dummy Pixel = HTotal = HTS = H_Size + H_Blank // 行长; 会增加曝光时间

fps的计算公式:fps = pclk / (VTS * HTS )
              fps= pclk / (frame_length * line_length)
              fps = 1 / (frame_length * line_time)

根据上面信息可以计算 fps =  480Mhz / 4896*3260 = 30

可以通过fps 计算line_time 

frane_length * line_length 的意思时用一帧的行数乘以一行的长度,即一帧图像总共有多少像素。

pclk 为像素时钟,表示每秒钟可以采集480M个像数。用pclk 除以 frame_length * line_length 两者指积,即为1秒钟内采集的480M 个像素数可以分成多少帧。
 

三 其他

    <dummyInfo>
      <left>8</left>
      <right>8</right>
      <top>8</top>
      <bottom>8</bottom>
    </dummyInfo>

dummy_line :用来填充blanking 的行

frame_length = exposure_line + dummy_line 

 保持行数和帧长之间的最小偏移量  ,猜测为:一帧曝光结束到下次准备好重新开始曝光的时间
 <verticalOffset>8</verticalOffset>

四 

To calculate minimum blanking time: locate the following from sensor driver: pixel clock per line
(line_length_pclk), pixel clock = Maximum FPS * lines per frame, vertical offset (vert_offset) for
preview resolution
Minimum blanking time for preview (in Nano seconds) can be calculated by: minPreviewBlankingtime= (pixel clock per line / pixel clock) * vertOffset * (10^9). Note: 10^9 is conversion from Seconds toNano seconds.
每行的像素时钟(line_length_pclk),像素时钟 = 最大 FPS * 每帧行数,预览分辨率的垂直偏移 (vert_offset)
预览的最短消隐时间(单位为纳秒)计算公式为: minPreviewBlankingtime = (每行像素时钟 / 像
素时钟) * vertOffset * (10^9)。注: 10^9 是从秒转换为纳秒。

像素时钟 = 最大 FPS * 每帧行数 = 30*4896*3260

<lineLengthPixelClock>4896</lineLengthPixelClock>

<outputPixelClock>480000000</outputPixelClock>

4896/480,000,000 * 8 * 1,000,000,000 = 81600


 

  • 4
    点赞
  • 61
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
以下是一个使用C#实现微软AEC(回音消除)的示例代码: ```csharp using System; using System.IO; using System.Runtime.InteropServices; using System.Threading; class AEC { [DllImport("ms_aec.dll", CallingConvention = CallingConvention.Cdecl)] private static extern int Initialize(int sampleRate, int numChannels); [DllImport("ms_aec.dll", CallingConvention = CallingConvention.Cdecl)] private static extern int Process(IntPtr inputBuffer, int numSamples, IntPtr outputBuffer); [DllImport("ms_aec.dll", CallingConvention = CallingConvention.Cdecl)] private static extern int Terminate(); static void Main(string[] args) { // 初始化AEC int sampleRate = 16000; int numChannels = 1; int result = Initialize(sampleRate, numChannels); if (result != 0) { Console.WriteLine("Failed to initialize AEC"); return; } // 读取音频文件 string inputFile = "input.wav"; byte[] audioData = File.ReadAllBytes(inputFile); // 转换为16位有符号整数数组 short[] inputBuffer = new short[audioData.Length / 2]; Buffer.BlockCopy(audioData, 0, inputBuffer, 0, audioData.Length); // 处理音频数据 int numSamples = inputBuffer.Length; short[] outputBuffer = new short[numSamples]; GCHandle inputHandle = GCHandle.Alloc(inputBuffer, GCHandleType.Pinned); GCHandle outputHandle = GCHandle.Alloc(outputBuffer, GCHandleType.Pinned); IntPtr inputPtr = inputHandle.AddrOfPinnedObject(); IntPtr outputPtr = outputHandle.AddrOfPinnedObject(); result = Process(inputPtr, numSamples, outputPtr); if (result != 0) { Console.WriteLine("Failed to process audio with AEC"); return; } // 保存处理后的音频文件 byte[] outputData = new byte[numSamples * 2]; Buffer.BlockCopy(outputBuffer, 0, outputData, 0, outputData.Length); string outputFile = "output.wav"; File.WriteAllBytes(outputFile, outputData); // 终止AEC result = Terminate(); if (result != 0) { Console.WriteLine("Failed to terminate AEC"); return; } Console.WriteLine("AEC processing completed successfully"); } } ``` 请确保将 `ms_aec.dll` 文件放在与代码相同的目录下。另外,您还需要将输入音频文件 `input.wav` 替换为您自己的音频文件路径。 这段代码通过调用微软的AEC DLL来实现回声消除。它使用C#的P/Invoke功能与非托管的C++代码进行交互。在运行代码之前,请确保已正确安装所需的依赖项,

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值