硬件实现外文翻译资料

 2022-07-27 15:35:19

1. Hardware implementation

1.1 Overview

In order to achieve real-time performance, which is impossible by the software implementation, the original method has been implemented on a FPGA device. The board used in this implementation was Altera Stratix II GX: EP2SGX130GF1508C5, in Quartus 5.1 platform.

The block diagram of the hardware implementation is depicted in Fig.4. The frame pixels enter the FPGA in raster scan order: one row after another and one frame after another. The algorithm consists of three parts. A preliminary scan of the frame (Part A) is required in order to obtain the global image statistics, which are necessary for the calculation of the global parameters of the method (Mdark, Mbright and Lobe). At the same time, the data Y, Cb and Cr are fed to a FIFO memory, in order to be used again in the third part of the implementation. The output of the first part is the histogram of the frame and its maximum and minimum luminance values (Ymax and Ymin). These outputs become inputs to the second part of the implementation (Part B), where the global parameters of the algorithm are calculated. The parameters Mdark, Mbright and Lobe, as well as the Stretching LUT, which is necessary for the implementation of equation (1), are propagated to the third part. In the third and final part of the implementation (Part C), the Y, Cb and Cr components, which were stored in the FIFO memory, are fed to a Serpentine memory [2], which is essentially a serial-to-parallel converter. It thus, allows the parallel calculation of the algorithmrsquo;s local parameters i.e. the luminance value of the central pixel and its average surrounding luminance, in three different scales. The local parameters are then loaded to the Stretching LUT, which maps them linearly to the interval [0,255]. Finally, both local and global parameters are loaded to the final LUT, which contains all the possible values of equation (2). At every clock cycle the final LUT outputs the new enhanced luminance value of the currently-processed pixel.

1.2 Detailed description of the implementation

1.2.1 First Stage: Image statistics computation

In the first block of Part A (Fig.4), the histogram of the frame is generated. This block, whose schematic is depicted in Fig.5 (Histogram Generator), consists of two identical circuits for generating the histogram of the odd and the even numbered frames. Every circuit has a dual-port RAM (DPRAM) of 256x19 bits, an adder, two comparators and a 4-to-1 multiplexer. The luminance values of the pixels are driven to the read-address bus of the DPRAM and the corresponding content is increased and driven to the data bus of the memory. The memory needs two clock cycles in order to output the content of a given address, thus the write- address bus is fed by the same luminance values as the read-address bus, delayed by two clock cycles, so that the data is written to the correct memory location. The delay that is introduced causes read-write conflicts for consecutive identical pixel values, or identical pixel values that are one clock cycle apart. This drawback can be surpassed using a control mechanism which consists of two comparators and a 4-to-1 multiplexer. Fig.6 illustrates the operation of the Histogram Generator module. In Fig.6, Y[7..0] is an example input of pixel values, Cpr is Y[7..0] delayed by two clock cycles, R-Adr and W-Adr are the inputs to the read-address and write- address bus of the DPRAM, respectively, while R-Data Out is the output of the memory. At every clock cycle read/write conflicts are controlled by two comparisons. The results of the comparisons produce the 2-bit select signal (Sel[Sel1,Sel2]) of the multiplexer. More specifically, if Y[7..0] =Cpr, then the Sel1=1 and if Y[7..0] = R-Adr, then Sel2=1 (Fig. 5). Through the required delays, the output of the multiplexer (B-Add, Fig.6) is synchronized and driven together with the R-Data Out to the adder. The result of the addition (Add Out, Fig.6) is written to the address (W-Adr) of the same time slot. Consequently, at the end of the first scan, the memory will contain the histogram of the frame.

At the same time, the calculation of the minimum and maximum luminance values of the frame, takes place in the second block. This block consists of two comparators and two 8-bit registers, as depicted in Fig.5 (Ymin, Ymax Calculation). The registers hold the maximum and the minimum luminance values and are initialized with 0 and 255, respectively. When a luminance value enters the block it is driven into the comparators. A comparison between the current value and the content of each register is executed. Every time that the comparison (pixel_valuegt; reg1_content or pixel_valuelt;reg2_content) is found true, the new value is stored, overwriting the existing content of the corresponding register. Consequently, at the end of the first scan the two registers will have the maximum and the minimum luminance values of the frame.

Parallel to the two aforementioned processes, the pixel flow (Y, Cb and Cr) is driven to the FIFO memory, in order to introduce the necessary delay which ensures that the second scan of the frame starts after Part B (Fig.4) is completed. The FIFO that was used in the implementation is 24-bit wide and (framesize 300) words deep. The 24-bit width refers to the YCbCr color space, while the particular depth of the FIFO was selected in order to match the delay of the first and second stage of the architecture. This will be extensively discussed in Section 3.3, where the pipelining procedure is presented. At this point we will stop short at mentioning that the design consists of three stages: the estimation of image statistics, where the necessary clock cycles are equal to the size of the frame (counted in pixels), the calculation of global parameters, where the necessary clock cycles are fixed to 300 (independent of the frame size) and the final tr

全文共31732字,剩余内容已隐藏,支付完成后下载完整资料


1 .硬件实现

1.1概述

为了实现软件实现的实时性,在FPGA器件上实现了原算法。在此实现中使用的板子是阿尔特拉ii GX : ep2sgx130gf1508c5,在第四的5.1平台上。

硬件实现的框图在fig.4.中画出了在光栅扫描顺序中输入FPGA的像素:一排接一排后一帧。该算法由三部分组成。为了获得全局图像统计,需要对框架( a部分)进行初步扫描,这是计算方法(mdark、mbright和勒贝)的全局参数所必需的。同时,数据y、CB和Cr被馈送到FIFO存储器,以便再次在实施的第三部分中使用。第一部分的输出是框架的直方图及其最大和最小亮度值( ymax和ymin)。这些产出成为执行情况第二部分的投入( b部分),其中计算了该算法的全球参数。参数mdark、mbright和勒贝以及实现方程( 1)所必需的拉伸查找表被传播到第三部分。在实现的第三部分和最后部分( c部分)中,存储在FIFO存储器中的y、CB和Cr部件被馈送给蜿蜒的存储器[ 2 ],其本质是串行到并行转换器。因此,在三种不同尺度下,允许并行计算算法的局部参数即中心像素的亮度值及其周围亮度。然后将局部参数加载到拉伸查找表,该查找表线性地将其映射到间隔[ 0,255]。最后,将本地和全局参数加载到最终表,其中包含等式( 2)的所有可能值。在每个时钟周期,最终的查找表输出当前处理过的像素的新的增强亮度值。

1.2详细说明执行情况

1.2.1第一阶段:图像统计计算

在第一部分a ( fig.4)的第一个块中,生成框架的直方图。这个块,其示意图在fig.5(直方图生成器)中,由两个相同的电路组成,用于生成奇数和偶数帧的直方图。每个电路有一个双端口ram ( dpram)的256x19位,一个加法器,两个比较器和一个4到1的复用器。将像素的亮度值驱动到dpram的阅读总线,增加相应的内容并驱动到存储器的数据总线。存储器需要两个时钟周期来输出给定地址的内容,因此写入地址总线以相同的亮度值作为读取地址总线馈送,延迟两个时钟周期,以便将数据写入正确的内存位置。引入的延迟将导致连续相同的像素值或与时钟周期不同的相同像素值的读取冲突。这一缺点可以被超越使用一个控制机制,由两个比较器和一个4到1的复用器。fig.6说明了直方图生成器模块的操作。在fig.6 , y [ 7..0 ]是像素值输入的示例, CPR是y [ 7..0 ]由两个时钟周期延迟, r和维丁格尔分别是对dpram的读写地址总线的输入,而r-数据输出是存储器的输出。在每个时钟周期读/写冲突由两个比较来控制。比较结果产生了多路复用器的2位选择信号(选取[ sel1 , sel2 ])。更具体地说,如果y [ 7..0 ] = CPR ,然后是sel1 = 1 ,如果y [ 7..= r - ADR ,然后= 1(附图)。5)。通过所需的延迟,多路复用器( b , fig.6)的输出与out到加法器的r数据同步和驱动。加法(加法、fig.6)的结果被写入同一个时隙的地址(维丁格尔)。因此,在第一次扫描结束时,存储器将包含帧的直方图。

同时,计算框架的最小和最大亮度值,在第二块中进行。该块包括两个比较器和两个8位寄存器,如fig.5 ( ymin ,ymax计算)所示。寄存器保持最大值和最小值,并分别用0和255初始化。当亮度值进入块时,它被驱动进入比较器。对每个寄存器的当前值和内容进行比较。每次进行比较(像素gt; reg1或像素lt; reg2)时,将存储新值,覆盖相应的寄存器的现有内容。因此,在第一扫描结束时,两个寄存器将具有帧的最大亮度值。

与上述两个过程并行,像素流( y、CB和Cr )被驱动到FIFO存储器,以便引入必要的延迟,以确保在完成b ( fig.4)之后开始帧的第二次扫描。在实现中使用的FIFO是24位宽和( framesize 300)字。24位宽度是指ycbcr颜色空间,而FIFO的特定深度是为了匹配体系结构的第一阶段和第二阶段的延迟而选择的。这将在3.3节中得到广泛讨论,在这里给出了流水线程序。在这一点上,我们将简短地指出,设计包括三个阶段:图像统计的估计,必要的时钟周期等于框架的大小(以像素计数) ,计算全球参数,必要的时钟周期固定为300(独立于框架大小)和最后变换,在必要的时钟周期也等于帧的大小。

1.2.2第二阶段:全局参数计算

计算全球参数( mdark、mbright、勒贝)的第一步是将输入值线性拉伸到区间[ 0,255 ] ,如等式( 1)所示。这个方程的直接执行需要额外的扫描框架,因为特殊变换需要适用于图像的每个像素。此外,它还引入了不必要的延迟,因为它需要计算密集型的组件,例如乘法器和分频器。因此,它降低了整个体系结构的效率,因此选择了一种替代方法。

而不是将方程( 1)应用到所有图像像素,只为像素可能具有的256个可能的亮度值计算拉伸变换,并存储在查找表中。该查找表从现在起被称为拉伸查找表,接收为输入像素的原始亮度值,并将相应的拉伸值输出到区间[ 0 , 255]。这样,在应用最终变换之前通过拉伸查找表驱动像素值,可以避免帧的额外扫描。在fig.7.中描述了扩展查找表的逻辑,该方法将必要的时钟周期降至约300,而它独立于帧大小。这种技术的显著延迟缩短很容易理解,考虑到在直线正向前的方法中,扫描400times;400像素的帧需要16万个时钟周期,对于VGA帧需要307,200个时钟周期(例如640times;像素)。

为了避免在资源(分隔和乘法器)方面使用昂贵的模块,方程( 1 )以增量方式实现,如方程( 13)所示。

这种替代方法的逻辑是,伸缩变换将亮度通道划分为相等的增量,其大小由递增因子255 ( ymax)确定。因此,每一个伸长值不同于以前和下一个增量因素。

方程( 13 )表明,通过将增量因子255 ( ymax)加到先前拉伸的亮度值可以找到拉伸查找表的每个值。考虑到ymax和ymin是强度值,我们可以假定它们在间隔[ 0,255]中变化,从而得出它们的差值也在相同的区间内。可以生成一个查找表,其中每个ymax的数量255 ( ymax)计算和关联。

这种方法中有一个弱点,这就是在硬件实现中很难阐明由255 ( ymax)操作产生的浮点值。如果上述操作的结果以8位字存储,将引入相当的精度误差。这个问题可以通过将结果乘以一个很大的常数值来超过。因此,结果将以更大的比特表示,并将实现更高的精度。之所以选择常量1024,是因为它增加了10位,转换为三个小数点精度。此外,在设计中,常量1024很容易通过右移删除,因为它是两个值的幂。

在此基础上,计算了原始直方图、拉伸查找表和图像的ymax和ymin。为了开始全球参数估计,需要进行更多的计算。如下文将详细说明的那样,全球参数是相关的,并根据原框架的全球统计数据进行估计。该过程首先创建一个3直方图,将亮度数据的范围分成三组:暗、中、亮。在fig.8.中描述了硬件实现电路。

第一步是计算ymax和ymin之间的差异,这将成为包含操作的预计算结果的查找表的地址[ 255 ( ymax ) ] *1024。8位计数器和两个比较器,控制累加器的时钟使能管脚.累加器计算以下增量函数。

必须为与差值ymax匹配的时钟周期启用累加器。两个比较器描述了从ymin到ymax计数器的计数区域。从累加器18位输出中最重要的8位,成为扩展表的数据,到计数器产生的对应地址。这10位移位相当于1024位的一个除法,为了达到更高的精度,执行的是为了移除先前添加的常量。

如前所述,为了继续进行全局参数估计,必须创建3 -bin规范化直方图。该帧的原始直方图将使用特定亮度值( y )的像素的数目与新的(拉伸)亮度值( y)匹配。将拉伸的亮度值y #39;被推入两个比较器,如fig.8b中所示,而将拉伸的原始亮度值驱动到保持直方图的双端口ram ( dpram)的地址总线中。dpram的数据输出将发送到四个不同的累加器。根据fig.8b中两个比较器的输出,激活相应的累加器,并计算在拉伸帧中具有这些亮度值的像素数目。第四个累加器通过整个过程进行活动,并对所有的像素进行求和,而不考虑其亮度值。当此过程结束时,即处理来自ymin到ymax的所有可能的亮度值,在fig.8b中描述的四个寄存器分别存储属于高bin、中间bin、低bin和帧大小的像素数。

如fig.8b所示,尽管累加器是18位宽,但仅记录了8个最重要的位。这导致了故意降低精度,以降低计算成本。在计算框架的全局统计时,与计算精度相关的误差不会在框架的最终视觉质量中引入任何退化,如第5节所示。

这导致了关于参数估计的最后一步。如上所述,该算法的三个全局参数是mdark、mbright和勒贝。这些参数作为原始框架的一般定性特征的指标。在硬件实现中,这些参数用2位表示。这意味着每个参数都有四个定性状态。在fig.9.中描述了硬件实现电路。

在参数估计的最后一步,存储在寄存器扔进垃圾箱、扔进垃圾箱、扔进垃圾箱和框架中的四个容器的值正在变成三个相同的电路,其中包括三个比较器和两个加法器,如fig.9.所示,这些电路允许我们定义每个容器的间隔。更具体地说,比较定义了每个bin中的间隔[ 0、大小/ 4 ]、[大小/ 4、大小/ 2 ]、[大小/ 2、3size ]或[ 3size /4、大小]。图像大小的三种不同的比例很容易计算。大小/ 2是注册框架的简单1位右移,大小/ 4是2位右移和3size /4比例的结果,添加了上述两个比例。例如,在fig.9.中显示一个参数的四个不同状态,当mdark参数的状态为00时,原始帧被描述为总体黑暗,因为四分之三以上的总像素具有低亮度值。

1.2.3第三阶段:最后亮度变换的应用

一旦计算了全局参数,则帧的第二次扫描发生在像素离开FIFO存储器时。为了在框架的每个像素上应用最终的亮度变换,必须计算三个不同尺度的每个像素的平均环绕。即使像素的亮度值在其退出FIFO时串行加载到电路中,也使用称为蛇纹石存储器[ 2]的流水线结构来并行程序。蛇形存储器是一种用于图像处理硬件设计的结构,当算法要求掩模相关性时。该技术具有两个主要优点:一个与掩码的相关性在每个时钟周期实现,而且它体现了数据重用的思想,因为否则只能通过内存读取实现相关性,这是众所周知的代价高昂的策略。在fig.10a.中描述了3x3相关掩模的蛇形存储器设计。

据[ 19]报道,相关掩模大于50x50像素提供了有效的局部对比度。实验结果表明,61x61像素相关掩模可用于硬件实现,实现了局部对比度增强和计算代价的最佳折衷。在fig.10b.中描述了掩模的形式,蛇纹石存储器的整个布局由61x61、24位寄存器和( 60 x py ) -61宽先进先出(其中py的宽度)组成。5种不同类型的登记册位于拟议的掩码中。在每个时钟周期,中央寄存器包含要转换的像素的原始亮度值。在计算中不使用出现白色的寄存器,而寄存器S1、S2、S3的三个不同的同心圆区域代表了周围的三个尺度。

目标是计算所有三个尺度的环绕的平均值。这意味着,构成一个区域的登记册的价值必须加上,除以每个领域的登记册数目。每个刻度都有许多寄存器,这是两个值。这简化了计算,因为除法可以通过右移执行。

第三个量表( S3)与其他两个量表不同。参与计算的一些寄存器是对称分布的,为了最大限度地减少所需寄存器的数量,并覆盖更大范围的像素。[ 15]采用了类似的办法。这种改变是可能的,因为像素越远离中心像素,它们在转换中的影响就越少。

除了上述掩模的布局之外,还有一个并行加法器电路,以计算三个周围尺度的平均亮度值。

在这一点上,介绍了一些技术限制。stratix iiGX中最大的并行加法器有128个输入,需要在13.7nsec或以上的时钟周期调整,以便在一个时钟周期中产生有效输出。这些限制导致了fig.11.中所示的硬件实现。

第一标度( S1)包括128寄存器。在这些寄存器中保存的128个亮度值由一个并行加法器添加。并行加法器的输出为15位宽.由刻度S1产生的环绕的最终平均亮度值在7位右移后。同样规模s 2需要7个128字的并行加法器,附加加上以前的规模( S1)和10位右移的结果。最后,规模s 3需要8个并行加法器,附加加上前一个表( S1)的结果和一个11位右移。

如在该电路中使用的设计策略所示,如fig.11所示,用一个时钟周期来计算三个刻度s1、S2、S3。因此,故意插入导致元素的延迟,以便同时得到所有三个平均值。

完成计算的最后一步是计算由方程( 15)描述的加权平均。一个区域越靠近中心像素,它对其转换的影响越大,

由方程( 15 )计算的环绕操作的值与蛇形存储器布局的中心像素的亮度值,被推入两个相同的拉伸附近地区,以将其拉伸到间隔[ 0 , 255 ],如fig.11.所示

由于最终绘图函数的计算密集型操作,在软件实现部分( 2)中描述,决定将其包含在查找表(最终查找表)中。

该查找表(在fig.4 , c部分)是一个用映射方程( 2 )的参数寻址的rom,并且在每个时钟周期输出该方程的结果。

构成表地址的参数如下。从最重要的位开始,地址从来自蛇纹石内存的拉伸中心像素的7位参数开始。这也是要转换的像素。接下来是7位拉伸的平均包围, 2位的勒贝参数,最后是2位m参数.m参数是mdark或mbright,取决于被拉伸的环绕参数的最重要位,该参数是由蛇形存储器在局部计算的,并通过拉伸查找表拉伸的。

用作最终查找表的rom存储器是218times;8位=256Kappa;Beta;。通过降低映射函数的四个参数的精度, FPGA产生的查找表适合FPGA,因此不会出现进一步的延迟。最终查找表的输出是像素在增强帧中具有的亮度值。

1.3流水线程序

全文共9087字,剩余内容已隐藏,支付完成后下载完整资料


资料编号:[144166],资料为PDF文档或Word文档,PDF文档可免费转换为Word

原文和译文剩余内容已隐藏,您需要先支付 30元 才能查看原文和译文全部内容!立即支付

以上是毕业论文外文翻译,课题毕业论文、任务书、文献综述、开题报告、程序设计、图纸设计等资料可联系客服协助查找。