CN1581976A - Video Compression Bit Rate Control Device for Fixed Image Quality - Google Patents
Video Compression Bit Rate Control Device for Fixed Image Quality Download PDFInfo
- Publication number
- CN1581976A CN1581976A CN 03153184 CN03153184A CN1581976A CN 1581976 A CN1581976 A CN 1581976A CN 03153184 CN03153184 CN 03153184 CN 03153184 A CN03153184 A CN 03153184A CN 1581976 A CN1581976 A CN 1581976A
- Authority
- CN
- China
- Prior art keywords
- complexity
- mentioned
- bit rate
- current picture
- group
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Landscapes
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
Description
技术领域technical field
本发明涉及一种关于数据压缩的领域,特别是指一种适用于视讯编码是统以执行可变位元率控制的装置。The present invention relates to the field of data compression, in particular to a device suitable for video coding system to implement variable bit rate control.
背景技术Background technique
众所周知,电子通讯世界正经历一次数字革命,以数字表示信息的主要优点在于能够几近无误地储存、再生、传收、处理及运用的数据位元流(bitstream)。举例而言,NTSC的彩色视讯影像每秒有29.97张画面,每张画面约480条可见扫瞄线,每条扫瞄线约需480点以红、绿、蓝三色呈现的像素(pixel),但若每种色彩成分以8位元编码,则所产生的位元率(bitrate)每秒约168兆位(Mbits/s),故各种视讯格式其未经压缩处理的位元率非常高而不经济,因此不适于多数的应用。As we all know, the electronic communication world is undergoing a digital revolution. The main advantage of representing information digitally is the data bit stream (bitstream) that can be stored, reproduced, transmitted, processed and utilized almost without error. For example, NTSC color video images have 29.97 frames per second, and each frame has about 480 visible scan lines, and each scan line requires about 480 pixels in red, green, and blue colors. , but if each color component is encoded in 8 bits, the resulting bit rate (bitrate) is about 168 megabits per second (Mbits/s), so the uncompressed bit rate of various video formats is very High and uneconomical, and therefore unsuitable for most applications.
与计算机、电信网络、消费性产品整合的数字音讯和视讯,更加刺激信息革命的前进,而这革命的核心则是视、音讯的数字压缩技术。许多的压缩标准,包含以压缩技术共通的精髓为基础的算法,如:ITU-T(前身是CCITT)建议书H.261和H.263,以及ISO/IEC的MPEG-1、MPEG-2和MPEG-4标准。MPEG的算法是由动态影像专家群组(Moving Picture Experts Group,MPEG)所发展出来,该动态影像专家群组是国际标准组织(International StandardsOrganization,ISO)及国际电子技术委员会(International ElectrotechnicalCommission,IEC)的联合技术委员会,致力于发展视、音讯的压缩及多路传殊的表现方式,这些标准规定了压缩位元流的语法(syntax)以及解码的方法,但对于编码器所使用的算法而言,却为编码的新颖性与多样性保留了相当多的自由度。The integration of digital audio and video with computers, telecommunication networks, and consumer products has further stimulated the progress of the information revolution, and the core of this revolution is the digital compression technology of audio and video. Many compression standards include algorithms based on the common essence of compression technology, such as: ITU-T (formerly CCITT) recommendations H.261 and H.263, and ISO/IEC MPEG-1, MPEG-2 and MPEG-4 standard. The MPEG algorithm was developed by the Moving Picture Experts Group (MPEG), which is a joint effort of the International Standards Organization (ISO) and the International Electrotechnical Commission (IEC). The Joint Technical Committee is committed to the development of video and audio compression and multi-channel transmission. These standards specify the syntax (syntax) and decoding method of the compressed bit stream, but for the algorithm used by the encoder, However, considerable degrees of freedom are reserved for coding novelty and diversity.
根据MPEG,一连串的视讯画面(picture)分成一序列的画面群组(group ofpicture,GOP),其中每组GOP以I-画面开始,后面跟着P-画面和B-画面的安排,图1以显示的顺序说明一组典型的GOP。I-画面的编码毋须参考先前或将来的画面,P-画面则参考连串的视讯画面中在时间上最接近的I-画面或P-画面来进行编码,而B-画面散布于I-画面和P-画面之间。并且利用先前的、将来的或两者兼具的紧邻I-画面和P-画面来编码。虽然好几张B-画面可以紧接着连续出现,但绝不能以B-画面预估其它的画面。According to MPEG, a series of video pictures (pictures) are divided into a sequence of picture groups (group of picture, GOP), wherein each group of GOP starts with I-picture, followed by the arrangement of P-picture and B-picture, as shown in Figure 1 The sequence of shows a typical set of GOPs. The encoding of I-pictures does not need to refer to previous or future pictures. P-pictures are coded with reference to the closest I-picture or P-picture in time in a series of video pictures, and B-pictures are interspersed with I-pictures. and between P-pictures. And coded with immediately adjacent I-pictures and P-pictures, previous, future, or both. Although several B-pictures can appear in succession, B-pictures should never predict other pictures.
每张画面具有三种成分:亮度值(luminance,以Y表示),红色差值(redcolor difference,以Cr表示),以及蓝色差值(blue color difference,以Cb表示)。对于MPEG的4:2:0的格式而言,每一种Cr和Cb成分的取样点在水平与垂直方向只有Y成分的一半。请参阅图2,一张MPEG的画面其基本构成方块是大区块(macroblock,以MB表示)。以4:2:0的视讯为例,每个MB包含一个Y成分16×16取样点的阵列,以及两个Cr和Cb成分8×8取样点的区块,其中Y成分16×16取样点的阵列实际上由4个8×8取样点的区块所组成。Each picture has three components: luminance value (luminance, represented by Y), red color difference (red color difference, represented by Cr), and blue color difference (blue color difference, represented by Cb). For the MPEG 4:2:0 format, the sampling points of each Cr and Cb component are only half of the Y component in the horizontal and vertical directions. Please refer to FIG. 2 , the basic building block of an MPEG picture is a macroblock (expressed in MB). Taking 4:2:0 video as an example, each MB contains an array of 16×16 sampling points for the Y component, and two blocks of 8×8 sampling points for the Cr and Cb components, of which the Y component is 16×16 sampling points The array of is actually composed of four blocks of 8×8 sampling points.
编码器的作用在于决定何种画面编码型态以及何种预测模式为最佳。对每张I-画面,MB中的每个8×8方块均经过离散余弦转换(discrete cosinetransform,DCT)而形成8×8转换系数阵列,转换系数接着以一量化矩阵进行量化,然后用Z字形(zig-zag)扫瞄DCT系数的量化结果而得到一连串的DCT系数,并且此DCT系数序列以可变长度码(variable length code,VLC)进行编码。P-画面必须决定将每个MB以I型MB或P型MB进行编码,I型MB的编码以上述的方式进行,而对于每个P型MB,则需得到该MB以先前画面所做的预测,此预测是由一种移动向量(motion vector)获得,移动向量象征着目前画面中即将编码的MB及其在先前画面中的预估MB之间的变动,预估MB与目前MB间的预测误差则以DCT、量化、Z字形扫瞄以及VLC进行编码。The role of the encoder is to determine which picture coding type and which prediction mode is the best. For each I-picture, each 8×8 block in the MB is subjected to discrete cosine transform (discrete cosine transform, DCT) to form an 8×8 transformation coefficient array, and the transformation coefficient is then quantized with a quantization matrix, and then zigzag (zig-zag) scans the quantized result of the DCT coefficients to obtain a series of DCT coefficients, and the DCT coefficient sequence is coded with a variable length code (variable length code, VLC). A P-picture must decide whether to encode each MB as an I-type MB or a P-type MB. The encoding of the I-type MB is performed in the above-mentioned way, and for each P-type MB, it is necessary to obtain the MB that was done in the previous picture. Prediction, this prediction is obtained by a motion vector (motion vector), the motion vector symbolizes the change between the MB to be coded in the current picture and the estimated MB in the previous picture, and the difference between the estimated MB and the current MB Prediction errors are coded in DCT, quantization, zigzag and VLC.
处理B-画面时,必须决定以下列何种MB模式来编码每个MB:I模式、F模式、B模式以及FB模式。I模式是以MB本身而不借助移动补偿来编码(如I型MB一般);F模式为单向的向前预测编码,是以先前画面得到移动补偿的预估(如P型MB一般);反之,B模式为单向的向后预测编码,是以后来的画面得到移动补偿的预估。特别是FB模式,为双向的预测编码,运用向前的和向后的移动补偿预估两者来做内插(interpolation)而得到FB模式的移动补偿预估。对F、B和FB模式而言,预测误差可以使用DCT、量化、Z字形扫瞄以及VLC进行编码。When processing B-pictures, one must decide in which of the following MB modes to encode each MB: I mode, F mode, B mode, and FB mode. I mode is coded by MB itself without motion compensation (like I-type MB); F-mode is unidirectional forward predictive coding, which is estimated by motion compensation from the previous picture (like P-type MB); On the contrary, the B mode is unidirectional backward predictive coding, which is to obtain motion-compensated estimation of the subsequent pictures. In particular, the FB mode is bi-directional predictive coding, using both the forward and backward motion compensation estimates for interpolation to obtain the motion compensation estimates of the FB mode. For F, B and FB modes, the prediction error can be coded using DCT, quantization, zigzag and VLC.
视讯编码器必须为整张画面选取量化位阶以便在给定的位元率下控制可见的失真,然而,以选取的量化位阶编码一张画面所用的实际位元数,必然是在真正编码之后才会得知,现实中并不存在一个逆转函数,能够在给定希望达到的量化位阶下,事先决定一张画面所用的实际位元数。编码器很重要的一点即为位元率的控制。MPEG中重要的视讯编码器限制:即每张画面所用位元数变化的限制,特别是在固定位元率运作的情形,这种限制是透过视讯缓冲器检验(Video Buffer Verifier,VBV)来施行。若对于每张画面而言,VBV的输入数据速率均相同,则视讯可说是以固定位元率(Constant Bitrate,CBR)编码;否则即为可变位元率(Variable Bitrate,VBR)编码。VBV乃一种虚拟缓冲器并且是在解码器端的输入缓冲器模型,以固定位元率而言,编码器分配给一张画面的位元额度须使VBV缓冲器不会满溢或匮乏;而对可变位元率,编码过之位元流则是以特定的最大位元率进入VBV缓冲器直到其饱和、直到再没有多的位输入为止,这可解释为进入VBV缓冲器的位元率实际上是可变的且能达到上述的最大位元率。以可变位元率而言,则只要防止VBV匮乏即可。A video encoder must choose a quantization level for an entire frame in order to control visible artifacts at a given bit rate. However, the actual number of bits used to encode a frame at the chosen quantization level must It will be learned later that there is no inversion function in reality, which can determine in advance the actual number of bits used by a picture given the desired quantization level. A very important point of the encoder is the bit rate control. An important video encoder limitation in MPEG: the limitation of the number of bits used for each picture, especially in the case of fixed bit rate operation, this limitation is verified by Video Buffer Verifier (VBV) implement. If the input data rate of VBV is the same for each frame, the video can be said to be encoded with a constant bit rate (Constant Bitrate, CBR); otherwise, it is encoded with a variable bit rate (VBR). VBV is a virtual buffer and is a model of the input buffer at the decoder, the amount of bits allocated by the encoder to a picture at a fixed bit rate such that the VBV buffer does not overflow or starve; and For variable bit rates, the encoded bit stream enters the VBV buffer at a specified maximum bit rate until it saturates until no more bits are input, which can be interpreted as the number of bits entering the VBV buffer The rate is actually variable and can reach the maximum bit rate mentioned above. In terms of variable bit rate, it is only necessary to prevent VBV starvation.
可变位元率控制的目的是尽可能的提高解码后视讯的品质而还能维持输出位元率在允许的范围内。和固定位元率的方式不同,可变位元率拥有较大的弹性来分配额外的位元数给景物较复杂、变动较剧烈的画面,这种弹性可使重建的画面之间达到平均一致、流畅稳定的视觉品质。对于某些应用,例如数字电影,平稳的画面品质是最先考虑的,优于其它固定频宽的要求,这类的应用就该利用可变位元率且固定影像品质的位元率控制机制。不过,传统的位元率控制方法却相当复杂,通常需进行好几次才能完成视讯编码的处理。The purpose of variable bit rate control is to improve the quality of the decoded video as much as possible while maintaining the output bit rate within the allowable range. Different from the method of fixed bit rate, the variable bit rate has greater flexibility to allocate extra bits to pictures with more complex scenes and more dramatic changes. This flexibility can make the reconstructed pictures evenly consistent , smooth and stable visual quality. For some applications, such as digital cinema, stable picture quality is the first consideration, which is better than other fixed bandwidth requirements. Such applications should use the bit rate control mechanism with variable bit rate and fixed image quality. . However, the traditional bit rate control method is quite complicated, and it usually takes several times to complete the video encoding process.
由此可见,上述现有的视讯位元率控制装置仍存在有诸多的缺陷,而亟待加以进一步改进。It can be seen that the above-mentioned existing video bit rate control device still has many defects, and further improvement is urgently needed.
为了解决视讯位元率控制装置存在的问题,开发一种新颖的固定影像品质位元率控制技术,可用于单次、实时的视讯编码器,同时能提供一种适合施行于集成电路、以画面层级为基础的固定影像品质位元率控制装置相关厂商莫不费尽心思来谋求解决的道,但长久以来一直未见适用的设计被发展完成,而一般产品又没有适切的结构能够解决上述问题,此显然是相关业者急欲解决的问题。In order to solve the problems existing in the video bit rate control device, a novel constant image quality bit rate control technology is developed, which can be used in a single-shot, real-time video encoder, and at the same time can provide a suitable for implementation in integrated circuits, with a picture Manufacturers of hierarchical-based fixed image quality bit rate control devices have tried their best to find a solution, but no suitable design has been developed for a long time, and there is no suitable structure for general products to solve the above problems , this is obviously a problem that relevant industry players are eager to solve.
有鉴于上述现有的视讯位元率控制装置存在的缺陷,本发明人基于丰富的实务经验及专业知识,积极加以研究创新,经过不断的研究、设计,并经反复试作样品及改进后,终于创设出确具实用价值的本发明。In view of the defects existing in the above-mentioned existing video bit rate control device, the inventor actively researches and innovates based on rich practical experience and professional knowledge. After continuous research, design, and repeated trial production of samples and improvements, Finally create the present invention that really has practical value.
发明内容Contents of the invention
本发明的主要目的在于,克服上述现有的视讯位元率控制装置存在的缺陷,而提供一种新型结构的视讯压缩位元率控制装置,所要解决的主要技术问题是使其每一张画面其目标位元的分配,是基于先前画面的编码结果和对即将被编码的目前画面其预先分析的活动量,通过对目前画面的预先分析的活动量以及先前编码画面的实际复杂度的分析,估计出目前画面的复杂度,可以更精确地分配目标位元额度给每张画面,以达到视讯序列中不同画面之间稳定的视觉品质。The main purpose of the present invention is to overcome the defects of the above-mentioned existing video bit rate control device, and provide a video compression bit rate control device with a new structure. The main technical problem to be solved is to make each picture The allocation of the target bits is based on the encoding result of the previous picture and the pre-analyzed activity of the current picture to be encoded. Through the analysis of the pre-analyzed activity of the current picture and the actual complexity of the previous encoded picture, By estimating the complexity of the current frame, the target bit quota can be allocated to each frame more accurately, so as to achieve stable visual quality between different frames in the video sequence.
本发明的目的及解决其主要技术问题是采用以下的技术方案来实现的。依据本发明提出的一种固定影像品质的视讯压缩位元率控制装置,至少包含;一移动估算单元,接收一视讯序列里的一组连续画面中即将被编码的一目前画面,以计算该目前画面的一全部活动量;一复杂度估计器,基于该目前画面的该全部活动量以及该组连续画面中一同型态的先前编码画面其活动量对复杂度之比,用来估计该目前画面的一复杂度;一目标位元分派器,以该目前画面的该复杂度更新该组连续画面的一瞬间复杂度,并且基于该组连续画面的一既定参考位元率、一参考复杂度及该瞬间复杂度来计算该组连续画面的一瞬间位元率,而根据该目前画面的该复杂度、该组连续画面的该瞬间复杂度及该瞬间位元率,分配一目标位元额度给该目前画面;以及一参数更新器,根据该目前画面的该全部活动量、该目前画面的一实际消耗位元数和编码该目前画面实际所用量化位阶的平均值,计算该目前画面其活动量对复杂度之比;其中,该目前画面的该活动量对复杂度之比与该目前画面的该全部活动量成正比,而与该目前画面的该实际消耗位元数以及该目前画面实际所用量化位阶的该平均值成反比。The purpose of the present invention and the solution to its main technical problems are achieved by adopting the following technical solutions. According to the present invention, a fixed image quality video compression bit rate control device includes at least one motion estimation unit, which receives a current frame to be encoded in a group of continuous frames in a video sequence, to calculate the current frame a total activity of the picture; a complexity estimator for estimating the current picture based on the total activity of the current picture and the ratio of activity to complexity of previously coded pictures of the same type in the group of consecutive pictures a complexity of a target bit allocator, updating the instantaneous complexity of the group of continuous pictures with the complexity of the current picture, and based on a predetermined reference bit rate, a reference complexity and The instantaneous complexity is used to calculate the instantaneous bit rate of the group of continuous pictures, and according to the complexity of the current picture, the instantaneous complexity of the group of continuous pictures and the instantaneous bit rate, a target bit quota is allocated to The current picture; and a parameter updater, which calculates the activity of the current picture according to the total activity amount of the current picture, an actual consumed bit number of the current picture and the average value of the quantization scale actually used for encoding the current picture The ratio of the amount of activity to the complexity; wherein, the ratio of the amount of activity to the complexity of the current picture is proportional to the total activity of the current picture, and is related to the actual number of consumed bits of the current picture and the actual number of bits of the current picture. This average is inversely proportional to the quantization scale used.
本发明还揭露一种目标位元分派器,包括一瞬间位元率计算器、一配额计算器以及一限度单元。瞬间位元率计算器接收视讯序列所包含的一组连续画面中即将被编码的目前画面的复杂度,且以该复杂度为基础,来更新此组连续画面的瞬间复杂度,并根据一函数来计算这组连续画面的瞬间位元率,其中该函数取决于该组连续画面的既定参考位元率、参考复杂度及瞬间复杂度。配额计算器则以目前画面的复杂度、这组连续画面的瞬间位元率及瞬间复杂度为基础,将目标位元额度分配给目前画面,而限度单元则用来将此目标位元额度限制在既定的上限之下。The present invention also discloses a target bit allocator, which includes an instantaneous bit rate calculator, a quota calculator and a limit unit. The instantaneous bit rate calculator receives the complexity of the current picture to be encoded in a group of continuous pictures contained in the video sequence, and based on the complexity, updates the instantaneous complexity of this group of continuous pictures, and according to a function to calculate the instantaneous bit rate of the group of continuous pictures, wherein the function depends on the predetermined reference bit rate, reference complexity and instantaneous complexity of the group of continuous pictures. The quota calculator allocates the target bit quota to the current picture based on the complexity of the current picture, the instantaneous bit rate and the instantaneous complexity of this group of continuous pictures, and the limit unit is used to limit the target bit quota below the established limit.
本发明的目的及解决其技术问题还可以采用以下的技术措施来进一步实现。The purpose of the present invention and the solution to its technical problems can also be further realized by adopting the following technical measures.
前述的视讯压缩位元率控制装置,至少包含一影像编码器,依上述目前画面的上述目标位元额度而决定上述目前画面所使用的复数个量化位阶,该些量化位阶是作为上述目前画面中的每一空间区域编码之用,该影像编码器根据该些量化位阶编码上述目前画面,且将上述目前画面的上述实际消耗位元数以及上述目前画面实际所用量化位阶的上述平均值反馈给上述参数更新器。The aforementioned video compression bit rate control device includes at least one video encoder, which determines the plurality of quantization levels used by the above-mentioned current picture according to the above-mentioned target bit rate of the above-mentioned current picture, and these quantization levels are used as the above-mentioned current picture. For encoding each spatial region in a picture, the image encoder encodes the above-mentioned current picture according to the quantization levels, and the above-mentioned actual consumption bit number of the above-mentioned current picture and the above-mentioned average of the quantization levels actually used by the above-mentioned current picture Values are fed back to the above parameter updater.
前述的视讯压缩位元率控制装置,其中所述的复杂度估计器所估计得到的上述目前画面的上述复杂度,是依据一方程式:In the aforementioned video compression bit rate control device, the above-mentioned complexity of the above-mentioned current picture estimated by the complexity estimator is based on an equation:
其中,Cest是上述目前画面预估的上述复杂度,K是一既定的加权值,其范围在0到1之间,A是上述目前画面的上述全部活动量,ACR是上述同型态的先前编码画面其活动量对复杂度之比。Among them, C est is the estimated complexity of the above-mentioned current picture, K is a predetermined weighted value, and its range is between 0 and 1, A is the above-mentioned total activity amount of the above-mentioned current picture, ACR is the above-mentioned same type The ratio of the amount of activity to the complexity of a previously encoded picture.
前述的视讯压缩位元率控制装置,其中所述的参数更新器计算上述目前画面其活动量对复杂度之比,是依据:The aforementioned video compression bit rate control device, wherein the parameter updater calculates the ratio of the amount of activity to the complexity of the above-mentioned current picture, is based on:
其中,ACR代表上述目前画面其活动量对复杂度之比,A是上述目前画面的上述全部活动量,AQ是上述目前画面实际所用量化位阶的上述平均值,UB是上述目前画面的上述实际消耗位元数。Among them, ACR represents the ratio of activity to complexity of the above-mentioned current picture, A is the above-mentioned total activity of the above-mentioned current picture, AQ is the above-mentioned average value of the quantization scale actually used in the above-mentioned current picture, and UB is the above-mentioned actual value of the above-mentioned current picture. Consumed bits.
前述的视讯压缩位元率控制装置,其中所述的目标位元分派器为上述一组连续画面中的三种型态:I-画面、P-画面及B-画面分别储存其复杂度CI、复杂度CP与复杂度CB,并且取上述目前画面的上述复杂度来更新该三种型态中同型态画面的复杂度。The aforementioned video compression bit rate control device, wherein the target bit allocator is three types in the above-mentioned group of continuous pictures: I-picture, P-picture and B-picture respectively store their complexity C I , complexity C P and complexity C B , and take the above-mentioned complexity of the above-mentioned current picture to update the complexity of the same-type picture among the three types.
前述的视讯压缩位元率控制装置,其中所述的目标位元分派器至少包含:The aforementioned video compression bit rate control device, wherein the target bit allocator at least includes:
一瞬间位元率计算器,以上述目前画面的上述复杂度为基础,来更新上述一组连续画面的上述瞬间复杂度,并且根据一函数来计算上述一组连续画面的上述瞬间位元率,其中该函数是取决于上述一组连续画面的上述既定参考位元率、上述瞬间复杂度及上述参考复杂度;an instant bit rate calculator, based on the above-mentioned complexity of the above-mentioned current picture, to update the above-mentioned instant complexity of the above-mentioned group of continuous pictures, and calculate the above-mentioned instant bit rate of the above-mentioned group of continuous pictures according to a function, Wherein the function depends on the above-mentioned predetermined reference bit rate, the above-mentioned instantaneous complexity and the above-mentioned reference complexity of the above-mentioned group of consecutive pictures;
一配额计算器,以上述目前画面的上述复杂度、上述一组连续画面的上述瞬间位元率及上述瞬间复杂度为基础,来分配上述目标位元额度;以及a quota calculator for allocating the target bit quota based on the complexity of the current frame, the instantaneous bit rate and the instantaneous complexity of the group of consecutive frames; and
一限度单元,用来将上述目标位元额度限制在一既定上限之下。A limiting unit is used to limit the above-mentioned target bit quota below a predetermined upper limit.
前述的视讯压缩位元率控制装置,其中所述的瞬间位元率计算器求得的上述一组连续画面的上述瞬间复杂度,是根据:In the aforementioned video compression bit rate control device, the above-mentioned instantaneous complexity of the above-mentioned group of continuous pictures obtained by the instantaneous bit rate calculator is based on:
INST_C=NI×CI+NP×CP+NB×CB INST_C=N I ×C I +N P ×C P +N B ×C B
其中,INST_C代表上述瞬间复杂度,NI、NP和NB分别是上述一组连续画面的中上述I-、P-及B-画面的数目。Wherein, INST_C represents the above-mentioned instantaneous complexity, N I , N P and N B are respectively the numbers of the above-mentioned I-, P- and B-pictures in the above-mentioned group of continuous pictures.
前述的视讯压缩位元率控制装置,其中所述的瞬间位元率计算器计算上述一组连续画面的上述瞬间位元率,是根据:The aforementioned video compression bit rate control device, wherein the instantaneous bit rate calculator calculates the above-mentioned instantaneous bit rate of the above-mentioned group of continuous pictures, is based on:
其中,REF_R是上述一组连续画面的上述既定参考位元率,SF是一缩放因子,其范围在0到1之间,INST_C、REF_C分别是上述一组连续画面的上述瞬间复杂度与上述参考复杂度,INST_R代表上述瞬间位元率。Wherein, REF_R is the above-mentioned predetermined reference bit rate of the above-mentioned group of continuous pictures, SF is a scaling factor, and its range is between 0 and 1, INST_C, REF_C are the above-mentioned instantaneous complexity and the above-mentioned reference of the above-mentioned group of continuous pictures respectively. Complexity, INST_R represents the above instantaneous bit rate.
前述的视讯压缩位元率控制装置,其中所述的瞬间位元率是限制在上述一组连续画面的一既定最大位元率以及一既定最小位元率的范围内。In the aforementioned video compression bit rate control device, the instantaneous bit rate is limited within the range of a predetermined maximum bit rate and a predetermined minimum bit rate of the above-mentioned group of continuous frames.
前述的视讯压缩位元率控制装置,其中所述的一组连续画面的上述参考复杂度如下:In the aforementioned video compression bit rate control device, the above-mentioned reference complexity of the group of continuous frames is as follows:
其中,PBI、PBP和PBB用来规定上述一组连续画面之中上述I-、P-及B-画面间的编码位比例为PBI∶PBP∶PBB,DQI、DQP和DQB分别是上述一组连续画面的中上述I-、P-及B-画面的目标量化位阶,NI、NP和NB分别是上述一组连续画面之中上述I-、P-及B-画面的数目。Among them, PB I , PB P and PB B are used to specify that the coding bit ratio between the above-mentioned I-, P- and B-pictures in the above-mentioned group of continuous pictures is PB I : PB P : PB B , DQ I , DQ P and DQ B are respectively the target quantization levels of the above-mentioned I-, P- and B-pictures in the above-mentioned group of continuous pictures, and N I , N P and NB are respectively the above-mentioned I-, P-pictures in the above-mentioned group of continuous pictures. - and the number of B-pictures.
本发明与现有技术相比具有明显的优点和有益效果。由以上技术方案可知,为了达到前述发明目的,本发明的主要技术内容如下:Compared with the prior art, the present invention has obvious advantages and beneficial effects. As can be seen from the above technical solutions, in order to achieve the aforementioned object of the invention, the main technical contents of the present invention are as follows:
关于一种固定影像品质的视讯压缩位元率控制装置,根据本发明,先计算一组连续画面中即将被编码的目前画面的全部活动量,然后基于全部活动量以及该组连续画面中同型态的先前编码画面其活动量对复杂度之比,估计目前画面的复杂度,并且以此复杂度更新该组连续画面的瞬间复杂度和计算其瞬间位元率,而根据画面复杂度、该组连续画面的瞬间复杂度及瞬间位元率,分配目标位元额度给目前画面。在画面编码之后,根据目前画面的全部活动量、实际消耗位元数和实际所用量化位阶的平均值,计算其活动量对复杂度之比。With regard to a video compression bit rate control device with fixed image quality, according to the present invention, first calculate the total amount of activity of the current picture to be encoded in a group of continuous pictures, and then based on the total amount of activity and the same type of pictures in the group of continuous pictures Estimate the complexity of the current picture based on the ratio of the amount of activity to the complexity of the previously coded pictures in the state, and update the instantaneous complexity of the group of continuous pictures with this complexity and calculate its instantaneous bit rate, and according to the picture complexity, the The instantaneous complexity and instantaneous bit rate of a group of consecutive images, and allocate the target bit quota to the current image. After the picture is encoded, the ratio of its activity to complexity is calculated according to the average of the total activity of the current picture, the actual number of consumed bits and the actual used quantization level.
通过以上发明,改变了现有的视讯位元率控制装置存在的各种视讯格式其未经压缩处理的位元率非常高而不经济,及传统的位元率控制方法相当复杂,通常需进行好几次才能完成视讯编码的处理的缺陷,通过对目前画面的预先分析的活动量以及先前编码画面的实际复杂度的分析,估计出目前画面的复杂度,可以更精确地分配目标位元额度给每张画面,以达到视讯序列中不同画面之间平均一致、流畅稳定的视觉品质。Through the above invention, the various video formats existing in the existing video bit rate control device have been changed. The uncompressed bit rate is very high and uneconomical, and the traditional bit rate control method is quite complicated, and usually requires The defect of video coding can be completed several times. Through the analysis of the pre-analyzed activity of the current picture and the actual complexity of the previous encoded picture, the complexity of the current picture can be estimated, and the target bit quota can be allocated more accurately. Each frame to achieve uniform, smooth and stable visual quality between different frames in the video sequence.
综上所述,本发明特殊结构的一种固定影像品质的视讯压缩位元率控制装置,具有上述诸多的优点及实用价值,且在同类产品中均未见有类似的结构设计公开发表或使用,其不论在结构上或功能上皆有较大的改进,且在技术上有较大的进步,并产生了好用及实用的效果,而确实具有增进的功效,从而更加适于实用,诚为一新颖、进步、实用的新设计。To sum up, a video compression bit rate control device with a fixed image quality and a special structure of the present invention has the above-mentioned many advantages and practical value, and no similar structural design has been published or used in similar products. , it has great improvements in both structure and function, and has made great progress in technology, and has produced easy-to-use and practical effects, and indeed has enhanced efficacy, so it is more suitable for practical use. It is a novel, progressive and practical new design.
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,并可依照说明书的内容予以实施,以下以本发明的较佳实施例并配合附图详细说明如后。The above description is only an overview of the technical solutions of the present invention. In order to understand the technical means of the present invention more clearly and implement them according to the contents of the description, the preferred embodiments of the present invention and accompanying drawings are described in detail below.
本发明的具体实施方式由以下实施例及其附图详细给出。The specific embodiment of the present invention is given in detail by the following examples and accompanying drawings.
附图说明Description of drawings
图1是以显示的顺序呈现典型的画面群组(GOP);Figure 1 presents a typical group of pictures (GOP) in the order shown;
图2是MPEG之大区块;Fig. 2 is a big block of MPEG;
图3是本发明的视讯压缩位元率控制装置其较佳实施例的方块示意图;3 is a schematic block diagram of a preferred embodiment of the video compression bit rate control device of the present invention;
图4是本发明之操作流程图;Fig. 4 is the operation flowchart of the present invention;
图5是本发明的目标位元分派器的方块示意图。FIG. 5 is a block diagram of the target bit allocator of the present invention.
300、视讯压缩位元率控制装置 310、移动估算单元300. Video compression bit rate control device 310. Motion estimation unit
312、讯号线 320、复杂度估计器312. Signal line 320. Complexity estimator
330、目标位元分派器 340、参数更新器330. Target bit dispatcher 340. Parameter updater
350、影像编码器 510、瞬间位元率计算器350. Video encoder 510. Instantaneous bit rate calculator
520、配额计算器 530、限度单元520. Quota calculator 530. Limit unit
P(i)、画面 A(i)、全部活动量P (i) , screen A (i) , total activity
Cest (i)、预估复杂度 ACR(i)、活动量对复杂度之比C est (i) , estimated complexity ACR (i) , ratio of activity to complexity
EB、超用位元量 TB(i)、目标位元额度EB, excess bits TB (i) , target bit quota
AQ(i)、实际所用量化位阶之平均值 UB(i)、实际消耗位元数AQ (i) , the average value of the actual quantization scale used UB (i) , the actual number of consumed bits
CD、编码后的数据 INST_R、瞬间位元率CD, encoded data INST_R, instantaneous bit rate
INST_C、瞬间复杂度INST_C, instantaneous complexity
具体实施方式Detailed ways
以下结合附图及较佳实施例,对依据本发明提出的一种固定影像品质的视讯压缩位元率控制装置其具体实施方式、结构、特征及其功效,详细说明如后。The specific implementation, structure, features and functions of a video compression bit rate control device with fixed image quality according to the present invention will be described in detail below with reference to the accompanying drawings and preferred embodiments.
请参阅图1、图2、图3、图4、图5所示,本发明一种固定影像品质的视讯压缩位元率控制装置,其主要包括:一移动估算单元、一复杂度估计器、一目标位元分派器、一参数更新器。Please refer to Fig. 1, Fig. 2, Fig. 3, Fig. 4, and Fig. 5, a video compression bit rate control device with fixed image quality of the present invention mainly includes: a motion estimation unit, a complexity estimator, A target bit allocator, a parameter updater.
一开始,预测用的I-画面和P-画面必须先在MPEG编码器内解码,利用计算原始画面及解码的画面间的均方根(root mean square)误差,可以得到解码画面其品质的客观量度。以均方根误差作为解画面的失真度,则解画面的复杂度(complex)-C定义如下:Initially, the I-pictures and P-pictures used for prediction must be decoded in the MPEG encoder. By calculating the root mean square (root mean square) error between the original picture and the decoded picture, an objective estimate of the quality of the decoded picture can be obtained. measure. Taking the root mean square error as the distortion degree of the solution picture, the complexity (complex)-C of the solution picture is defined as follows:
C=r×dC=r×d
其中,r是编码该画面所需的位元率,d是解码的画面的失真度。理论上,平均的量化位阶(quantization step size)和失真度之间为一比例关系,故,画面的复杂度可定义成:where r is the bit rate required to encode the picture, and d is the distortion of the decoded picture. Theoretically, there is a proportional relationship between the average quantization step size and the degree of distortion. Therefore, the complexity of the picture can be defined as:
其中,q是该画面的平均量化位阶。在画面编码之后,将可得知位元率(实际消耗位元数)以及平均量化位阶,而该画面的复杂度也因此获得。where q is the average quantization scale of the picture. After the picture is encoded, the bit rate (the actual number of consumed bits) and the average quantization level can be obtained, and the complexity of the picture is obtained accordingly.
画面的复杂度端视画面的本质及其编码的形式而定。先前技术利用最近编码画面的复杂度来表示目前画面的复杂度,并且为I-、P-及B-画面分别保持其复杂度以减轻不同编码形式的影响,倘若视讯序列的画面其内容为平顺的变化,则此方式可达到相当不错的效果。然而,由于画面编码的目标位元配额与其实际消耗位元数之间不相符合,如果视讯序列的内容大幅变动,上述方式并不适合用来达成一致的视觉品质。The complexity of the picture depends on the nature of the picture and its encoding form. The prior art uses the complexity of the most recent coded picture to represent the complexity of the current picture, and maintains its complexity for I-, P- and B-pictures respectively to mitigate the impact of different coding forms, if the content of the picture in the video sequence is smooth changes, this method can achieve quite good results. However, due to the inconsistency between the target bit quota of frame coding and the actual consumed bits, the above method is not suitable for achieving consistent visual quality if the content of the video sequence changes greatly.
根据本发明,目前画面的复杂度可以由预先分析目前画面的活动量(activity)以及先前编码画面的实际复杂度之比进行预估。活动量是一种在画面编码后其位元率和品质的量度尝试,假设一整张画面的全部活动量A正比于复杂度C,则According to the present invention, the complexity of the current picture can be estimated by pre-analyzing the ratio of the activity of the current picture and the actual complexity of the previously coded picture. The amount of activity is an attempt to measure the bit rate and quality of a picture after encoding. Assuming that the total amount of activity A of a whole picture is proportional to the complexity C, then
其中,k是比例常数。若k′为活动量对复杂度之比(activity-to-complexity ratio,ACR),则全部活动量A还可以下列式子表示:where k is a constant of proportionality. If k' is the activity-to-complexity ratio (activity-to-complexity ratio, ACR), then the total activity A can also be expressed by the following formula:
A=ACR×r×qA=ACR×r×q
根据本发明,可以从相同型态的先前编码画面来预估ACR。观念上,先在编码一张画面前计算其全部活动量A,然后,即将被编码的画面P(i)的复杂度Cest (i)以如下方式估算:According to the present invention, ACR can be estimated from previously coded pictures of the same type. Conceptually, before encoding a picture, calculate its total activity A, and then estimate the complexity C est (i ) of the picture P (i ) to be encoded as follows:
其中,A(i)是画面P(i)的全部活动量,ACR(i-1)是同型态的先前编码画面其活动量对复杂度之比。以下,在符号或变量中的上标(i)表示该符号或变量是与即将被编码的目前画面有关;同理,在符号或变量中的上标(i-1)则与先前编码画面相关。Wherein, A (i) is the total activity of the picture P (i) , and ACR (i-1) is the ratio of the activity to the complexity of the previously coded picture of the same type. In the following, a superscript (i) in a symbol or variable indicates that the symbol or variable is related to the current picture to be coded; similarly, a superscript (i-1) in a symbol or variable is related to the previous coded picture .
估计的复杂度Cest (i)可用来为合适型态的画面更新其复杂度,所以三种型态的画面其复杂度CI、CP和CB将分别储存以利后续的处理。一组连续画面的瞬间复杂度(ins tantaneous complexity)也以如下方式更新:The estimated complexity C est (i) can be used to update the complexity of the appropriate type of frame, so the complexities C I , CP and C B of the three types of frames are stored for subsequent processing. The ins tantaneous complexity of a sequence of pictures is also updated as follows:
INST_C=NI×CI+NP×CP+NB×CB INST_C=N I ×C I +N P ×C P +N B ×C B
其中,NI、NP和NB分别是该组连续画面中I-、P-及B-画面的数目,而且此处所指的一组连续画面至少包含一组GOP。Wherein, N I , N P and N B are respectively the numbers of I-, P- and B-pictures in the group of continuous pictures, and the group of continuous pictures referred to here includes at least one group of GOP.
为达到不同画面间的固定影像品质,同一组连续画面中三种型态I、P和B是以不同的量化位阶来进行量化,故将I-、P-及B-画面的目标量化位阶分别预设为DQI、DQP和DQB,若指定一个参考位元率以及三种画面型态I、P、B之间的编码位比例给一组连续画面,则该组连续画面的参考复杂度,REF_C,如下:In order to achieve fixed image quality between different frames, the three types of I, P, and B in the same group of continuous frames are quantized at different quantization levels, so the target quantization bits of I-, P-, and B-pictures The order is preset as DQ I , DQ P and DQ B respectively. If a reference bit rate and the coding bit ratio between the three picture types I, P and B are specified for a group of continuous pictures, the The reference complexity, REF_C, is as follows:
其中,PBI、PBP和PBB用来规定一组连续画面的中I-、P-及B-画面间的编码位比例为PBI∶PBP∶PBB,而REF_R是这组连续画面的既定参考位元率。I-、P-及B-画面间的编码位比例可以是既定的常数或从最近编码的画面计算而得。按照前述的式子,REF_C代表的是以参考位元率REF_R和目标量化位阶DQI、DQP及DQB编码一组连续画面的参考复杂度,如此,该组连续画面的瞬间位元率可由下列式子计算而得:Among them, PB I , PB P and PB B are used to specify the coding bit ratio between I-, P- and B-pictures in a group of continuous pictures as PB I : PB P : PB B , and REF_R is the group of continuous pictures The established reference bit rate for . The coding bit ratio between I-, P- and B-pictures can be a predetermined constant or calculated from the most recently coded picture. According to the aforementioned formula, REF_C represents the reference complexity of encoding a group of continuous pictures with the reference bit rate REF_R and the target quantization levels DQ I , DQ P and DQ B. In this way, the instantaneous bit rate of the group of continuous pictures It can be calculated by the following formula:
其中,SF是一缩放因子,其范围在0到1之间。利用缩放因子SF可使瞬间位元率INST_R随着瞬间复杂度INST_C平顺地变化,这样能在不同的画面间形成较佳的位元率分布。倘若一组连续画面的最大、最小位元率已根据参考位元率事先决定,则其瞬间位元率INST_R还须进一步地限制为:ERmin≤INST_R≤ERmax。Wherein, SF is a scaling factor, and its range is between 0 and 1. Using the scaling factor SF can make the instantaneous bit rate INST_R change smoothly with the instantaneous complexity INST_C, which can form a better bit rate distribution among different frames. If the maximum and minimum bit rates of a group of continuous pictures have been determined in advance according to the reference bit rate, the instantaneous bit rate INST_R must be further limited to: ER min ≤ INST_R ≤ ER max .
一旦瞬间复杂度INST_C和瞬间位元率INST_R已经决定,则目前画面P(i)的目标位元额度TB(i)为Once the instantaneous complexity INST_C and the instantaneous bit rate INST_R have been determined, the target bit quota TB (i) of the current picture P (i) is
由上式可知,目标位元额度TB(i)是与复杂度Cest (i)以及瞬间位元率INST_R成正比,而与瞬间复杂度INST_C成反比。所有的MPEG-2资料位元流均必须遵循MPEG-2标准的VBV规则,分配的目标额度必须受限以使VBV缓冲器不会满溢(overflow)或匮乏(underflow)。当目前画面的目标位元额度决定好之后,便可利用许多不同型态的影像编码器,像是MPEG-2标准描述的测试原型5(TestModel 5),根据目标位元额度来完成画面的压缩。It can be known from the above formula that the target bit quota TB (i) is directly proportional to the complexity C est (i) and the instantaneous bit rate INST_R, and is inversely proportional to the instantaneous complexity INST_C. All MPEG-2 data bitstreams must follow the VBV rules of the MPEG-2 standard, and the allocated target quota must be limited so that the VBV buffer will not overflow or underflow. After the target bit quota of the current picture is determined, many different types of image encoders, such as TestModel 5 described in the MPEG-2 standard, can be used to complete picture compression according to the target bit quota. .
目前画面在完成编码之后,其实际的复杂度将可得知,而目前画面的全部活动量和实际复杂度之间的关系是,ACR(i)可从以下计算得到After the encoding of the current picture is completed, its actual complexity will be known, and the relationship between the total activity of the current picture and the actual complexity is that ACR (i) can be obtained from the following calculation
其中,ACR(i)与全部活动量A(i)成正比,而与目前画面的实际消耗位元数UB(i)以及平均量化位阶AQ(i)成反比。此ACR(i)可拿来预估下一张同型态的画面的复杂度。ACR(i)可以和ACR(i-1)做线性结合来避免受到那些富含噪声画面的影响。Wherein, ACR (i) is directly proportional to the total activity A (i) , and inversely proportional to the actual consumed bit number UB (i) and the average quantization level AQ (i) of the current frame. This ACR (i) can be used to estimate the complexity of the next frame of the same type. ACR (i) can be linearly combined with ACR (i-1) to avoid the influence of those images rich in noise.
本发明的单次(single-pass)视讯编码请参阅图3的较佳实施例并配合图4的操作流程图来解释。如图3所示,视讯压缩位元率控制装置300包括一移动估算单元310、一复杂度估计器320、一目标位元分派器330、一参数更新器340以及一影像编码器350。移动估算单元310接收视讯序列里的一组连续画面中即将被编码的目前画面P(i),用来在执行移动估算的区块匹配时,计算此目前画面P(i)的全部活动量A(i)(步骤S410)。基于全部活动量A(i)以及这组连续画面中同型态的先前编码画面的ACR(i-1),复杂度估计器320可用来估计目前画面的复杂度Cest (i)(步骤S420)。目标位元分派器330以预估的复杂度Cest (i)更新本组连续画面其瞬间复杂度INST_C,并且根据既定的参考位元率REF_R、参考复杂度REF_C及瞬间复杂度INST_C来计算该组连续画面的瞬间位元率INST_R(步骤S430)。For the single-pass video encoding of the present invention, please refer to the preferred embodiment in FIG. 3 and explain it with the operation flowchart in FIG. 4 . As shown in FIG. 3 , the video compression bit rate control device 300 includes a motion estimation unit 310 , a complexity estimator 320 , a target bit allocator 330 , a parameter updater 340 and an image encoder 350 . The motion estimation unit 310 receives the current frame P (i) to be encoded in a group of consecutive frames in the video sequence, and is used to calculate the total activity A of the current frame P (i) when performing block matching for motion estimation (i) (step S410). Based on the total activity A (i) and the ACR (i-1) of the same type of previously coded pictures in this group of consecutive pictures, the complexity estimator 320 can be used to estimate the complexity C est (i) of the current picture (step S420 ). The target bit allocator 330 updates the instantaneous complexity INST_C of this group of continuous pictures with the estimated complexity C est (i) , and calculates the instantaneous complexity INST_C according to the predetermined reference bit rate REF_R, reference complexity REF_C and instantaneous complexity INST_C The instantaneous bit rate INST_R of the group of continuous pictures (step S430).
目标位元分派器330接着以瞬间位元率INST_R、复杂度Cest (i)以及瞬间复杂度INST_C为基础将目标位元额度TB(i)分配给目前画面P(i)(步骤S440)。因此,影像编码器350依目标位元额度TB(i)而决定目前画面P(i)使用的所有量化位阶,这些量化位阶是作为画面P(i)中每一空间区域:大区块(MB)的编码的用。影像编码器350根据这些量化位阶编码目前画面P(i)(步骤S450)。在目前画面编码完成后,影像编码器350将画面P(i)的实际消耗位元数UB(i)以及实际所用量化位阶的平均值AQ(i)回报给参数更新器340。然后以全部活动量A(i)、实际消耗位元数UB(i)和实际所用量化位阶的平均值AQ(i)为基础,参数更新器340为目前画面P(i)计算其活动量对复杂度之比ACR(i)(步骤S460)。The target bit allocator 330 then allocates the target bit quota TB (i) to the current frame P (i ) based on the instantaneous bit rate INST_R, the complexity C est ( i) and the instantaneous complexity INST_C (step S440 ). Therefore, the image encoder 350 determines all the quantization levels used by the current picture P (i) according to the target bit quota TB (i) , and these quantization levels are used as each spatial region in the picture P (i) : large block (MB) encoding use. The video encoder 350 encodes the current picture P (i) according to these quantization levels (step S450). After the encoding of the current picture is completed, the video encoder 350 reports the actual consumed bit number UB (i ) of the picture P (i) and the average value AQ (i) of the actually used quantization scale to the parameter updater 340 . Then based on the total activity amount A (i) , the actual consumed bit number UB (i) and the average value AQ (i) of the actual quantization scale used, the parameter updater 340 calculates the activity amount for the current picture P (i) to the complexity ratio ACR (i) (step S460).
图3的较佳实施例可考虑以硬件以及/或是软件来实现。根据本发明,移动估算单元310和图3中的其它组件可以管线(pipeline)模式运作,在复杂度估计器320开始计算目前画面的复杂度之前,移动估算单元310必须先完成即将被编码的目前画面其全部活动量的计算以及移动向量的估算,并且,当移动估算单元310为下张画面作准备时,复杂度估计器320和其它组件仍正忙于完成所有与目前画面相关的运作。接下来将详细地描述较佳实施例中的每个组件。The preferred embodiment of FIG. 3 can be considered to be implemented by hardware and/or software. According to the present invention, the motion estimation unit 310 and other components in FIG. 3 can operate in a pipeline mode. Before the complexity estimator 320 starts to calculate the complexity of the current picture, the motion estimation unit 310 must first complete the current picture to be encoded. Calculation of all motions of the frame and estimation of motion vectors, and when the motion estimation unit 310 is preparing for the next frame, the complexity estimator 320 and other components are still busy completing all operations related to the current frame. Next, each component in the preferred embodiment will be described in detail.
移动估算单元310的主要目的之一为决定用何种预测模式来编码一张画面里的每个MB,如果必要的话,亦进行向前和向后的移动预测,还可从区块匹配运算中提取画面活动量的信息。首先,计算每个MB的自身活动量(intra-activity),将一个MB中4个8x8亮度值区块的像素强度以Ym,n,m=0,...,7,n=0,...,7来表示,并且每个8x8区块其平均值为 Y,则每个MB的内活动量IntraAct:One of the main purposes of the motion estimation unit 310 is to decide which prediction mode to use to encode each MB in a picture, and if necessary, to perform forward and backward motion prediction, and also from the block matching operation Information about the amount of screen activity is extracted. First, the intra-activity of each MB is calculated, and the pixel intensity of four 8x8 luminance value blocks in one MB is expressed as Y m,n ,m=0,...,7,n=0, ..., 7 to represent, and the average value of each 8x8 block is Y, then the amount of activity within each MB IntraAct:
其中in
倘若需要较低的计算复杂度,可以相对Y的绝对差值代替:If lower computational complexity is required, it can be replaced by the absolute difference relative to Y:
其中in
由于I-画面中的MB仅有一种模式:I模式,因此IntraAct即为I-画面的每个MB的活动量。Since the MB in the I-picture has only one mode: I-mode, IntraAct is the activity amount of each MB of the I-picture.
如果画面为P-或B-画面,则需进行移动估算。最常使用来发现最佳移动向量的技术是区块匹配。对非自身编码(nonintra coding)而言(如P-和B-画面),利用将失真标准如变异数或失真绝对值和减至最低,来选择向前、向后、双向的预测或不需移动补偿。一旦P-或B-画面中每个MB的MB模式决定,在每个移动补偿的差值MB中4个8x8区块的变异数也可求得,移动补偿的差值MB是待处理MB和预估MB间像素对像素之差;失真绝对值和通常具有较佳的计算效率,因此可用来取代变异数。将4个8x8区块的变异数或失真绝对值和相加以求得非内编码画面中每个MB的相互活动量(inter-activity),InterAct,然后把非内编码画面中每个MB的IntraAct及其InterAct拿来作比较,以判断InterAct是否较小,若是,则以InterAct作为该MB的活动量,并以相互模式(inter-mode)编码该MB;否则以IntraAct作为该MB的活动量,并以自身模式(intra-mode)编码该MB。最后,对目前的I-、P-或B-画面,将所有MB的活动量相加而得全部活动量A(i),移动估算单元310再把全部活动量A(i)传送给复杂度估计器320以及参数更新器340。If the picture is a P- or B-picture, motion estimation is required. The most commonly used technique to find the best motion vector is block matching. For nonintra coding (e.g. P- and B-pictures), selection of forward, backward, bidirectional prediction or no motion compensation. Once the MB mode for each MB in the P- or B-picture is determined, the variance of the 4 8x8 blocks in each motion-compensated difference MB is also obtained. The motion-compensated difference MB is the MB to be processed and Estimates the pixel-by-pixel difference between MBs; the absolute sum of distortions is usually more computationally efficient and can therefore be used instead of the variance. Add the variance or absolute value of distortion of 4 8x8 blocks to obtain the inter-activity (inter-activity) of each MB in the non-intra-coded picture, InterAct, and then calculate the IntraAct of each MB in the non-intra-coded picture and its InterAct are used for comparison to determine whether the InterAct is small, if so, use InterAct as the activity of the MB, and encode the MB in inter-mode; otherwise use IntraAct as the activity of the MB, And encode the MB in intra-mode. Finally, for the current I-, P- or B-picture, the total activity A (i) is obtained by adding the activity of all MBs, and the motion estimation unit 310 sends the entire activity A (i) to the complexity An estimator 320 and a parameter updater 340 .
接着,复杂度估计器320为某种型态的目前画面P(i)估算其复杂度,且依照三种画面型态,引进加权系数至预估的复杂度Cest (i)。因为B-画面绝不能被用来预估其它的画面,故可减少B-画面的加权系数以分配较少的位给B-画面而保留较多的位给I-和P-画面;一般而言,编码I-画面会产生最多的位,因此P-画面的加权系数又小于I-画面的加权系数。复杂度估计器320根据目前画面的型态更新复杂度CI、CP或CB三者其中的一,目前画面P(i)的复杂度Cest (i)以如下方式估算:Next, the complexity estimator 320 estimates the complexity of a certain type of current picture P (i) , and introduces weighting coefficients to the estimated complexity C est (i) according to the three picture types. Since B-pictures can never be used to predict other pictures, the weight coefficients of B-pictures can be reduced to allocate less bits to B-pictures and reserve more bits to I- and P-pictures; generally In other words, encoding I-pictures produces the most bits, so the weighting coefficients of P-pictures are smaller than those of I-pictures. The complexity estimator 320 updates one of the complexity C I , C P or C B according to the type of the current picture, and the complexity C est (i ) of the current picture P (i ) is estimated as follows:
if(I-画面)if(I-picture)
else if(P-画面)else if(P-picture)
else if(B-画面)else if(B-picture)
其中,ACRI (i-1)、ACRP (i-1)及ACRB (i-1)是一组连续画面中,I、P和B型态的先前编码画面各自的活动量对复杂度之比。这些ACRI (i-1)、ACRP (i-1)和ACRB (i-1)存放在参数更新器340之中,而复杂度估计器320会为适当型态的先前画面读取对应的活动量对复杂度之比。KI、KP及KB分别是I-、P-和B-画面的加权系数,其范围一般是在0到1.0之间。至于I-画面,较佳实施例可以采用KI=1.0。Among them, ACR I (i-1) , ACR P (i-1) and ACR B (i-1) are the respective activity versus complexity of previously coded pictures of I, P and B types in a group of consecutive pictures Ratio. These ACR I (i-1) , ACR P (i-1) and ACR B (i-1) are stored in the parameter updater 340, and the complexity estimator 320 reads the corresponding The ratio of activity to complexity. K I , K P and K B are weighting coefficients of I-, P- and B-pictures respectively, and their ranges are generally between 0 and 1.0. As for I-pictures, a preferred embodiment may use K I =1.0.
目标位元分派器330可为一组连续画面中的三种型态:I-画面、P-画面及B-画面分别储存其复杂度CI、复杂度CP与复杂度CB。当收到Cest (i)的时,视目前画面P(i)的型态,每次仅更新复杂度CI、CP、CB三者其中之一,如下:The target bit allocator 330 can store the complexity C I , the complexity C P and the complexity C B of three types of consecutive pictures: I-picture, P-picture and B-picture respectively. When C est (i) is received, depending on the type of the current picture P(i), only one of the complexity C I , C P , and C B is updated each time, as follows:
if(I-画面)if(I-picture)
else if(P-画面)else if(P-picture)
else if(B-画面)else if(B-picture)
请参阅图5所示的较佳实施例,目标位元分派器330是由瞬间位元率计算器510、配额计算器520以及限度单元530所组成。瞬间位元率计算器510为该组连续画面更新其瞬间复杂度INST_C,如下:Please refer to the preferred embodiment shown in FIG. 5 , the target bit allocator 330 is composed of an instantaneous bit rate calculator 510 , a quota calculator 520 and a limit unit 530 . The instantaneous bit rate calculator 510 updates the instantaneous complexity INST_C for the group of continuous pictures as follows:
INST_C=NI×CI+NP×CP+NB×CB INST_C=N I ×C I +N P ×C P +N B ×C B
其中,NI、NP和NB分别是一组连续画面中I-、P-及B-画面的数目。除了CI、CP和CB的外,瞬间位元率计算器510还存放了其它5个参数:这组连续画面的参考位元率REF_R、最大位元率ERmax、最小位元率ERmin、参考复杂度REF_C以及缩放因子SF。一组连续画面的中I-、P-及B-画面间的编码位比例可以从最近编码的画面来求得,所以,参考复杂度REF_C是为:Wherein, N I , N P and N B are respectively the numbers of I-, P- and B-pictures in a group of consecutive pictures. In addition to C I , C P and C B , the instantaneous bit rate calculator 510 also stores five other parameters: the reference bit rate REF_R of this group of continuous pictures, the maximum bit rate ER max , and the minimum bit rate ER min , reference complexity REF_C, and scaling factor SF. The coding bit ratio between I-, P- and B-pictures in a group of consecutive pictures can be obtained from the latest coded picture, so the reference complexity REF_C is:
其中,PBI、PBP和PBB用来规定一组连续画面的中I-、P-及B-画面间的编码位比例为PBI∶PBP∶PBB,DQI、DQP和DQB分别是这组连续画面的中I-、P-及B-画面的目标量化位阶。一旦决定了瞬间复杂度和参考复杂度,瞬间位元率计算器510即可以下列式子计算一组连续画面的瞬间位元率INST_R:Among them, PB I , PB P and PB B are used to specify the coding bit ratio between I-, P- and B-pictures in a group of continuous pictures as PB I : PB P : PB B , DQ I , DQ P and DQ B are respectively the target quantization levels of the I-, P- and B-pictures in the group of consecutive pictures. Once the instantaneous complexity and the reference complexity are determined, the instantaneous bit rate calculator 510 can calculate the instantaneous bit rate INST_R of a group of consecutive frames by the following formula:
其中,缩放因子SF的范围设定在0到1之间(例如0.8),且瞬间位元率INST_R最好限制在这组连续画面的最大、最小位元率ERmax及ERmin之间。Wherein, the range of the scaling factor SF is set between 0 and 1 (for example, 0.8), and the instantaneous bit rate INST_R is preferably limited between the maximum and minimum bit rates ER max and ER min of the group of continuous pictures.
配额计算器520接着分配目标位元额度TB(i)给目前画面P(i),而目标位元额度TB(i)是根据The quota calculator 520 then allocates the target bit quota TB (i) to the current picture P (i) , and the target bit quota TB (i) is based on
但是,实际的消耗位元数并不会和期望的位元额度刚好相等,因此发展一种回授策略来使画面实际消耗的位元数接近于目标位元额度,在较佳实施例中,编码至目前为止的超用位量,可由正在编码的目前画面摊还一部份:However, the actual number of consumed bits will not be exactly equal to the expected bit quota, so a feedback strategy is developed to make the actual consumed bit number of the picture close to the target bit quota. In a preferred embodiment, The excess bits encoded so far can be amortized by the current picture being encoded:
TB(i)=TB(i)-AR×EBTB (i) =TB (i) -AR×EB
其中,EB是参数更新器340传来的超用位量,AR则是既定的摊还率,其范围一般是在0.05到0.2之间。按照前面的式子,目标位元额度TB(i)是与目前画面的复杂度Cest (i)以及一组连续画面的瞬间位元率INST_R成正比,而与一组连续画面的瞬间复杂度INST_C成反比。限度单元530则能用来调整目标位元额度TB(i)以符合VBV规范,因此事先定下了额度的上限(U_bound)及下限(L_bound)。就固定位元率(CBR)的操作而言,分配给一张画面的目标位元额度须使VBV缓冲器不会满溢或匮乏,所以限度单元530将目标位元额度TB(i)限制在上、下限范围内:Wherein, EB is the excess bit amount transmitted from the parameter updater 340, and AR is a predetermined amortization rate, and its range is generally between 0.05 and 0.2. According to the previous formula, the target bit quota TB (i) is proportional to the complexity C est (i) of the current picture and the instantaneous bit rate INST_R of a group of continuous pictures, and is proportional to the instantaneous complexity of a group of continuous pictures INST_C is inversely proportional. The limit unit 530 can be used to adjust the target bit amount TB (i) to comply with the VBV specification, so the upper limit (U_bound) and the lower limit (L_bound) of the amount are set in advance. For constant bit rate (CBR) operation, the target bit quota allocated to a frame must be such that the VBV buffer does not overflow or starve, so limit unit 530 limits the target bit quota TB (i) to Within the upper and lower limits:
if(TB(i)>U_bound)then TB(i)=U_boundif (TB (i) > U_bound) then TB (i) = U_bound
if(TB(i)<L_bound)then TB(i)=L_boundif (TB (i) < L_bound) then TB (i) = L_bound
若是可变位元率(VBR),则只要防止VBV匮乏即可,故:If it is variable bit rate (VBR), it is only necessary to prevent the lack of VBV, so:
if(TB(i)>U_bound)then TB(i)=U_boundif (TB (i) > U_bound) then TB (i) = U_bound
然后,目标位元额度TB(i)会被传送到参数更新器340以及影像编码器350。Then, the target bit quota TB (i) is sent to the parameter updater 340 and the video encoder 350 .
请参阅图3,影像编码器350透过讯号线312从移动估算单元310接收画面数据以及每个MB的移动向量和MB模式。为了尽可能的使画面达到最佳品质,影像编码器350依据目标位元额度TB(i)来决定目前画面的每个MB编码所用的量化位阶,以这些数据为基础,影像编码器350开始对目前画面P(i)进行编码且输出编码后的数据CD。在目前画面P(i)编码之后,影像编码器350将所用的量化位阶做平均并且计算实际消耗位元数UB(i),再回报目前画面的UB(i)以及实际所用量化位阶的平均值AQ(i)给参数更新器340。Referring to FIG. 3 , the video encoder 350 receives the frame data, the motion vector of each MB and the MB pattern from the motion estimation unit 310 through the signal line 312 . In order to achieve the best quality of the picture as possible, the video encoder 350 determines the quantization level used for encoding each MB of the current picture according to the target bit quota TB (i) . Based on these data, the video encoder 350 starts Encode the current picture P (i) and output the encoded data CD. After the current picture P (i) is encoded, the video encoder 350 averages the used quantization levels and calculates the actual number of consumed bits UB (i) , and then returns the UB (i) of the current picture and the actual used quantization levels The average value AQ (i) is given to the parameter updater 340 .
画面P(i)的目标位元额度TB(i)以及实际消耗位元数UB(i)间的差距,会由参数更新器340做累计以便在画面P(i)编码之后得到超用位量EB:The difference between the target bit quota TB (i) of the picture P (i) and the actual consumed bit number UB (i) will be accumulated by the parameter updater 340 so as to obtain the excess bit amount after the picture P (i) is encoded EB:
EB=EB×(1-AR)+UB(i)-TB(i) EB=EB×(1-AR)+UB (i) -TB (i)
其中,AR是既定的摊还率。因此,活动量和实际复杂度之间的关系是,ACR(i),可从以下计算得到Among them, AR is the established amortization rate. Therefore, the relationship between the amount of activity and the actual complexity is, ACR (i) , which can be calculated from
这个刚编码完成画面P(i)所属的ACR(i)可用来预估下一张同型态画面的复杂度。为使ACR(i)不会受到富含噪声画面的影响,较佳实施例利用了ACR(i)和ACR(i-1)的线性组合,例如:The ACR (i) to which the just encoded picture P (i) belongs can be used to estimate the complexity of the next picture of the same type. In order to make ACR (i) unaffected by noisy pictures, a preferred embodiment utilizes a linear combination of ACR (i) and ACR (i-1) , for example:
if(I-画面)if(I-picture)
else if(P-画面)else if(P-picture)
else if(B-画面)else if(B-picture)
其中,CW是线性组合既定的加权系数。更新过的ACRI (i)、ACRP (i)及ACRB (i)会被传送到复杂度估计器320,以便为下一张适当型态的画面估算其复杂度,此外,超用位量EB则送至目标位元分派器330作为位分配之用。Among them, CW is the predetermined weighting coefficient of the linear combination. The updated ACR I (i) , ACR P (i) and ACR B (i) will be sent to the complexity estimator 320, so as to estimate the complexity of the next picture with a suitable type. In addition, the overuse bits The amount EB is sent to the target bit allocator 330 for bit allocation.
以上所述,仅是本发明的较佳实施例而已,并非对本发明作任何形式上的限制,凡是依据本发明的技术实质对以上的实施例所作的任何简单修改、等同变化与修饰,均仍属于本发明技术方案的范围内。The above are only preferred embodiments of the present invention, and are not intended to limit the present invention in any form. Any simple modifications, equivalent changes and modifications made to the above embodiments according to the technical essence of the present invention are still valid. It belongs to the scope of the technical solutions of the present invention.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN 03153184 CN1245841C (en) | 2003-08-08 | 2003-08-08 | Video Compression Bit Rate Control Device for Constant Image Quality |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN 03153184 CN1245841C (en) | 2003-08-08 | 2003-08-08 | Video Compression Bit Rate Control Device for Constant Image Quality |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN1581976A true CN1581976A (en) | 2005-02-16 |
| CN1245841C CN1245841C (en) | 2006-03-15 |
Family
ID=34579962
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN 03153184 Expired - Fee Related CN1245841C (en) | 2003-08-08 | 2003-08-08 | Video Compression Bit Rate Control Device for Constant Image Quality |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN1245841C (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101534437A (en) * | 2008-03-12 | 2009-09-16 | 财团法人工业技术研究院 | System and method for bit stream distribution of scalable video coding standard |
| US8249143B2 (en) | 2008-02-19 | 2012-08-21 | Industrial Technology Research Institute | System and method for allocating bitstream of scalable video coding |
-
2003
- 2003-08-08 CN CN 03153184 patent/CN1245841C/en not_active Expired - Fee Related
Cited By (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US8249143B2 (en) | 2008-02-19 | 2012-08-21 | Industrial Technology Research Institute | System and method for allocating bitstream of scalable video coding |
| CN101534437A (en) * | 2008-03-12 | 2009-09-16 | 财团法人工业技术研究院 | System and method for bit stream distribution of scalable video coding standard |
| CN101534437B (en) * | 2008-03-12 | 2012-10-10 | 财团法人工业技术研究院 | Bitstream Distribution System and Method for Scalable Video Coding Standard |
Also Published As
| Publication number | Publication date |
|---|---|
| CN1245841C (en) | 2006-03-15 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN1151685C (en) | Apparatus and method for optimizing rate control in an encoding system | |
| CN1035593C (en) | Motion Video Signal Compression System Using Adaptive Bit Allocation and Quantization | |
| KR100970315B1 (en) | Transcoder and Coded Image Conversion Method | |
| CN1214647C (en) | Image encoding method and image encoder | |
| CN1274158C (en) | Video information encoding and decoding method, motion compensated video encoder and corresponding decoder | |
| CN1239026C (en) | Decode method and device in the method | |
| CN1232126C (en) | Image code method and device and image decode method and device | |
| CN1280709C (en) | Parameterization of fade compensation | |
| US7095784B2 (en) | Method and apparatus for moving picture compression rate control using bit allocation with initial quantization step size estimation at picture level | |
| CN1751511A (en) | Image encoding method and image decoding method | |
| CN1774930A (en) | Video transcoding | |
| CN1941915A (en) | Video encoding method and apparatus | |
| CN1757237A (en) | Video encoding | |
| CN1666429A (en) | Method and system for selecting interpolation filter type in video coding | |
| CN1457606A (en) | Method for encoding and decoding video information, motion compensated video encoder and corresponding decoder | |
| CN1726709A (en) | Rate control with picture-based lookahead window | |
| CN1902939A (en) | Encoding method, decoding method, and encoding apparatus for a digital picture sequence | |
| CN1816151A (en) | Video coding method and system for frame layer rate control | |
| CN1192105A (en) | Method and apparatus for compressing/encoding image | |
| CN1223199C (en) | Method of performing video encoding rate control using bit budget | |
| CN1913642A (en) | Video encoding apparatus and video encoding method | |
| CN1122422C (en) | Process and device for coding images according to MPEG standard | |
| CN1652610A (en) | Deblocking filtering method and apparatus of video frequency or image | |
| CN1164124C (en) | Image compress processing method | |
| CN1581979A (en) | Device and method for compressing digital images |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| C14 | Grant of patent or utility model | ||
| GR01 | Patent grant | ||
| C17 | Cessation of patent right | ||
| CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20060315 |