CN106454343B - The H.265 fast transcoding method of mapping is divided based on code stream bit number and block - Google Patents
The H.265 fast transcoding method of mapping is divided based on code stream bit number and block Download PDFInfo
- Publication number
- CN106454343B CN106454343B CN201610771223.7A CN201610771223A CN106454343B CN 106454343 B CN106454343 B CN 106454343B CN 201610771223 A CN201610771223 A CN 201610771223A CN 106454343 B CN106454343 B CN 106454343B
- Authority
- CN
- China
- Prior art keywords
- frame
- code stream
- bit number
- coding
- cus
- 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.)
- Expired - Fee Related
Links
- 238000000034 method Methods 0.000 title claims abstract description 23
- 238000013507 mapping Methods 0.000 title claims abstract description 12
- 230000000737 periodic effect Effects 0.000 claims description 3
- 238000013139 quantization Methods 0.000 claims description 2
- 230000000903 blocking effect Effects 0.000 claims 3
- 101150047304 TMOD1 gene Proteins 0.000 claims 1
- 238000005192 partition Methods 0.000 claims 1
- 238000005516 engineering process Methods 0.000 abstract description 9
- 230000000007 visual effect Effects 0.000 abstract description 3
- 238000012360 testing method Methods 0.000 description 10
- 238000010606 normalization Methods 0.000 description 7
- 238000006243 chemical reaction Methods 0.000 description 3
- 238000007781 pre-processing Methods 0.000 description 3
- 238000010276 construction Methods 0.000 description 2
- 230000003044 adaptive effect Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 239000012634 fragment Substances 0.000 description 1
- 238000003780 insertion Methods 0.000 description 1
- 230000037431 insertion Effects 0.000 description 1
- NUHSROFQTUXZQQ-UHFFFAOYSA-N isopentenyl diphosphate Chemical compound CC(=C)CCO[P@](O)(=O)OP(O)(O)=O NUHSROFQTUXZQQ-UHFFFAOYSA-N 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 230000011218 segmentation Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/102—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
- H04N19/12—Selection from among a plurality of transforms or standards, e.g. selection between discrete cosine transform [DCT] and sub-band transform or selection between H.263 and H.264
- H04N19/122—Selection of transform size, e.g. 8x8 or 2x4x8 DCT; Selection of sub-band transforms of varying structure or type
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/169—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
- H04N19/17—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
- H04N19/176—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/169—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
- H04N19/184—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being bits, e.g. of the compressed video stream
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/40—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using video transcoding, i.e. partial or full decoding of a coded input stream followed by re-encoding of the decoded output stream
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/70—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by syntax aspects related to video coding, e.g. related to compression standards
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Physics & Mathematics (AREA)
- Discrete Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
Description
技术领域technical field
本发明涉及视频图像编码技术,特别涉及H.265快速视频转码技术。The present invention relates to video image coding technology, in particular to H.265 fast video transcoding technology.
背景技术Background technique
面向新一代视频编解码标准H.265的转码应用,先将码流解码成为YUV、Y4M等格式作为信源输入,再用H.265编码器进行编码,这被称为全解全编方式。For the transcoding application of the new generation video codec standard H.265, the code stream is first decoded into YUV, Y4M and other formats as the source input, and then encoded with the H.265 encoder, which is called the full decoding and full encoding method. .
H.265视频转码分两种类型:一是同构视频流转码,二是异构视频流转码。同构视频转码即按相同视频编码标准压缩的码流间转换,而异构转码则是按照不同视频编码标准压缩的码流间转换。There are two types of H.265 video transcoding: one is homogeneous video stream transcoding, and the other is heterogeneous video stream transcoding. Homogeneous video transcoding is the conversion between code streams compressed according to the same video coding standard, while heterogeneous transcoding is the conversion between code streams compressed according to different video coding standards.
H.265中采用分块编码方式。与前几代编码器不同的是,H.265编码标准中采用更加灵活的基于自适应四叉树结构的编码树单元CTU(Coding Tree Unit)。CTU可以按照四叉树的结构分解为若干个正方形的编码单元CU(Coding Unit),同一层的四个CU必须是同样的尺寸。CU 的尺寸可以取值为8×8,16×16,32×32,64×64。如果CTU不分解,CTU仅包含一个CU。因此一个CTU最多有4层,至少有1层。H.265规定在CTU中最顶层的CU尺寸为64×64,这个最顶层的CU也被称作最大编码单元LCU(Largest Coding Unit)。不失一般性,用四叉树对正方形块的划分进行描述。Block coding is used in H.265. Different from previous generations of encoders, the H.265 coding standard adopts a more flexible coding tree unit CTU (Coding Tree Unit) based on an adaptive quad-tree structure. The CTU can be decomposed into several square coding unit CUs (Coding Units) according to the structure of the quadtree, and the four CUs in the same layer must be of the same size. The size of the CU can be 8×8, 16×16, 32×32, 64×64. If the CTU is not decomposed, the CTU contains only one CU. Therefore, a CTU has at most 4 layers and at least 1 layer. H.265 stipulates that the size of the topmost CU in the CTU is 64×64, and the topmost CU is also called the largest coding unit (LCU). Without loss of generality, a quadtree is used to describe the division of square blocks.
CTU具有三条性质:CTU has three properties:
(1)在CTU中任意一个结点有且仅有4个或0个孩子结点;(1) Any node in the CTU has and only has 4 or 0 child nodes;
(2)任意结点有且仅有一个父节点,可以根据孩子结点找到其父节点(第0层的根结点除外);(2) Any node has one and only one parent node, and its parent node can be found according to the child node (except the root node of the 0th layer);
(3)同一父节点的四个兄弟结点已知一个必能推出其余兄弟结点。(3) Knowing one of the four sibling nodes of the same parent node must be able to deduce the remaining sibling nodes.
全解全编方式最易于实现且能在率失真、比特率、主观质量等方面保有良好的表现。但是全解全编方式实施过程极其耗时,特别转码过程中由于未知的块划分,需要遍历各类情况或者大量选取分块情况,在实际生产应用中往往不可取。因而视频快速转码方法具有非常强的现实急迫性。The full decoding and full encoding method is the easiest to implement and can maintain good performance in terms of rate distortion, bit rate, and subjective quality. However, the implementation process of the full decoding and full encoding method is extremely time-consuming. Especially in the transcoding process, due to unknown block division, it is necessary to traverse various situations or select a large number of block situations, which is often not desirable in actual production applications. Therefore, the fast video transcoding method has a very strong practical urgency.
另外,不同时期和不同设备进行采集和压缩视频时,采用的视频编码格式各有不同,导致信源输入的码流格式多样。In addition, when collecting and compressing video in different periods and different devices, the video coding formats used are different, resulting in various code stream formats input by the source.
发明内容SUMMARY OF THE INVENTION
本发明所要解决的技术问题是,提供一种能够充分利用输入的码流中的信息来指导H.265 编码以达到快速进行H.265转码的方法。The technical problem to be solved by the present invention is to provide a method that can make full use of the information in the input code stream to guide H.265 encoding to achieve fast H.265 transcoding.
本发明为解决上述技术问题所采用技术方案是,基于码流比特数与块划分映射的H.265 快速转码方法,包括以下步骤:The technical solution adopted by the present invention to solve the above technical problems is that the H.265 fast transcoding method based on the number of code stream bits and block division mapping includes the following steps:
第一步,根据输入的源码流的信息选择解码器对源码流解码,根据解码后信息对应生成 YUV序列,并统计源码流中各编码单元CU的比特数Bit、量化参数QP和编码类型;The first step is to select a decoder to decode the source code stream according to the information of the input source code stream, generate a YUV sequence correspondingly according to the decoded information, and count the number of bits Bit, quantization parameter QP and encoding type of each coding unit CU in the source code stream;
第二步,判断源码流的编码类型是否为H.265,如是,直接进入第三步,如否,根据Bit 和QP实现到H.265的比特数映射后,再进入步骤三;The second step is to judge whether the encoding type of the source code stream is H.265, if so, go directly to the third step, if not, after realizing the bit number mapping to H.265 according to Bit and QP, go to step three;
R265|QP=a1·Rother 2|QP+a2·Rother|QP+a3 R 265 | QP = a 1 · R other 2 | QP + a 2 · R other | QP + a 3
其中,R265|QP表示当前QP下的H.265码流中一个CU的比特数,Rother|QP表示在指定QP下采用H.265之外编码标准的编码的码流中对应CU的比特数,a1,a2,a3是三个经验参数;Among them, R 265 | QP represents the number of bits of a CU in the H.265 code stream under the current QP, and R other | QP represents the bits of the corresponding CU in the encoded code stream using a coding standard other than H.265 under the specified QP Number, a 1 , a 2 , a 3 are three empirical parameters;
第三步,将解码生成的YUV序列第0帧用H.265编码器I模式编码,第1帧使用H.265编码器P 模式编码,对其余帧先预测分块再进行H.265编码;In the third step, the 0th frame of the YUV sequence generated by decoding is encoded in the I mode of the H.265 encoder, the first frame is encoded in the P mode of the H.265 encoder, and the remaining frames are first predicted and divided into blocks and then H.265 encoding is performed;
其中,预测分块的步骤如下:Among them, the steps of predicting the block are as follows:
1)从源码流中每一帧中获取每一个8×8的CU的比特数以及归一化比特数、8×8的CU的比特数的最大值与最小值;从源码流中获取每一帧使用的总比特数;1) Obtain the number of bits of each 8×8 CU, the normalized number of bits, and the maximum and minimum number of bits of the 8×8 CU from each frame in the source stream; the total number of bits used by the frame;
2)从目标码流中每一帧中获取每一个8×8的CU的归一化比特数、8×8的CU的比特数的最大值与最小值、8×8的CU的归一化比特数最小值;从目标码流中获取每一帧使用的总比特数;2) Obtain the normalized bits of each 8×8 CU, the maximum and minimum values of the bits of the 8×8 CU, and the normalization of the 8×8 CU from each frame in the target code stream The minimum number of bits; the total number of bits used in each frame is obtained from the target stream;
求比例系数k: Find the scale factor k:
其中,表示目标码流第t帧的总比特数,表示源码流第t帧的总比特数,表示目标码流第t帧中8×8的CU最大比特数,表示目标码流第t帧中8×8 的CU最小比特数,表示源码流第t帧中8×8的CU最大比特数,表示源码流第t帧8×8的CU最小比特数;in, represents the total number of bits of the t-th frame of the target code stream, Represents the total number of bits in the t-th frame of the source stream, Indicates the maximum number of bits of the 8×8 CU in the t-th frame of the target code stream, Indicates the minimum number of bits of the 8×8 CU in the t-th frame of the target code stream, Indicates the maximum number of bits of the 8×8 CU in the t-th frame of the source stream, Indicates the minimum number of bits of the 8×8 CU of the t-th frame of the source stream;
3)求每一个8×8的CU的分布情况,满足以下条件的8×8的CU必在目标码流中出现:3) Find the distribution of each 8×8 CU. The 8×8 CU that meets the following conditions must appear in the target code stream:
其中表示目标码流中第t帧第p个CTU中8×8的CU的归一化比特数的最小值;表示源码流中第t帧第p个CTU中8×8的CU的归一化比特数;in Indicates the minimum number of normalized bits of the 8×8 CU in the pth CTU of the tth frame in the target code stream; Indicates the normalized number of bits of the 8×8 CU in the pth CTU of the tth frame in the source stream;
4)根据每一个8×8的CU的分布情况来预测除第0帧和第1帧外的目标码流中必须出现的8 ×8的CU;4) According to the distribution of each 8×8 CU, predict the 8×8 CUs that must appear in the target code stream except the 0th frame and the 1st frame;
5)目标码流CTU分块预测。根据已求得必定出现在目标码流中的8×8的CU,依次推出全部的8×8的CU、16×16的CU、32×32的CU、64×64的CU,从而构建出一个完整的CTU;5) The target code stream CTU block prediction. According to the 8×8 CUs that must appear in the target code stream, all 8×8 CUs, 16×16 CUs, 32×32 CUs, and 64×64 CUs are sequentially derived to construct a Complete CTU;
6)根据已知的CTU分块情况对当前帧进行H.265编码。6) H.265 encoding is performed on the current frame according to the known CTU block situation.
本发明的有益效果是,充分利用输入的码流中的信息来指导H.265编码,降低块划分和模式选择的运算量,以大量缩短转码时间,同时也保证转码后视频的主客观视觉质量。本发明码流格式并不局限于H.265同构转码,技术将支持H.264/AVC或H.263++,甚至是更早的 MPEG各代标准的异构转码。The beneficial effect of the invention is that the information in the input code stream is fully utilized to guide H.265 encoding, the computation amount of block division and mode selection is reduced, the transcoding time is greatly shortened, and the subjectivity and objectivity of the video after transcoding are also guaranteed. visual quality. The code stream format of the present invention is not limited to H.265 isomorphic transcoding, and the technology will support H.264/AVC or H.263++, or even the heterogeneous transcoding of earlier MPEG standards.
附图说明Description of drawings
图1为本发明H.265视频转码架构;Fig. 1 is the H.265 video transcoding architecture of the present invention;
图2为本发明CTU分块策略;Fig. 2 is the CTU block strategy of the present invention;
图3为本发明CTU构建过程;Fig. 3 is the CTU construction process of the present invention;
图4为实施例周期内各帧编码方式分布规则。FIG. 4 shows the distribution rules of coding modes of each frame in the embodiment period.
具体实施方式:Detailed ways:
本发明所述视频转码主要分为五个主要步骤:The video transcoding described in the present invention is mainly divided into five main steps:
第一步,解码及转码前处理过程。解码输入码流生成YUV序列并统计每一帧的每一个CU 使用的比特数。分析输入源码流的头信息确定该码流采用的编码标准。如果是H.265标准,直接进入第二步。如果是其它标准,如H.264/AVC,H.263++,MPEG-x等,甚至是未来的基于分块方式管理的编码标准,则需要完成该标准到H.265的比特数映射。用式(1)描述CU的比特数映射关系。The first step is the pre-processing process of decoding and transcoding. Decode the input stream to generate a YUV sequence and count the number of bits used by each CU in each frame. Analyze the header information of the input source code stream to determine the encoding standard adopted by the code stream. If it is the H.265 standard, go directly to the second step. If it is other standards, such as H.264/AVC, H.263++, MPEG-x, etc., or even a future coding standard based on block management, the bit number mapping from the standard to H.265 needs to be completed. Equation (1) is used to describe the bit number mapping relationship of the CU.
R265|QP=a1·Rother 2|QP+a2·Rother|QP+a3 (1)R 265 | QP = a 1 · R other 2 | QP + a 2 · R other | QP + a 3 (1)
其中,R265|QP表示当前QP下的H.265码流中一个CU的比特数,Rother|QP表示在指定QP下采用H.265之外编码标准的编码的码流中对应CU的比特数,a1,a2,a3是三个经验参数。总之,通过式(1)可完成异构情况比特数映射。即实现其他编码标准到H.265标准CU的比特数转换。Among them, R 265 | QP represents the number of bits of a CU in the H.265 code stream under the current QP, and R other | QP represents the bits of the corresponding CU in the encoded code stream using a coding standard other than H.265 under the specified QP The numbers, a 1 , a 2 , and a 3 are three empirical parameters. In a word, the bit number mapping in heterogeneous case can be completed by formula (1). That is, the conversion of bits from other coding standards to the H.265 standard CU is realized.
第二步,比特数信息收集与处理。目标码流比特数的归一化和帧总比特数统计。将YUV 序列的前两帧用H.265编码器编码。第0帧用I模式编码,第1帧使用P模式编码。统计第t帧及帧内每个CU编码使用的比特数,然后对第t帧中8×8的CU进行归一化处理。统计该帧使用总比特数。源码流比特数的归一化处理和帧总比特数统计。即将第一步各帧中8×8的CU使用比特数进行归一化处理。归一化处理过程如式(2)所示。The second step is the collection and processing of bit number information. Normalization of the number of bits of the target stream and statistics of the total number of bits in the frame. The first two frames of the YUV sequence are encoded with the H.265 encoder. Frame 0 is encoded in I mode, and frame 1 is encoded in P mode. The t-th frame and the number of bits used for coding of each CU in the frame are counted, and then the 8×8 CUs in the t-th frame are normalized. Count the total number of bits used by the frame. The normalization of the bit number of the source stream and the statistics of the total number of bits in the frame. That is, the 8×8 CUs in each frame in the first step are normalized using the number of bits. The normalization process is shown in formula (2).
统计码流中各帧使用的总比特数,如式(3)所示。The total number of bits used by each frame in the code stream is counted, as shown in equation (3).
w表示每一行中N×N的CU的个数W表示视频的宽,H表示视频的高,N表示每个LCU的尺寸大小;h表示每一列中N×N的CU的个数 为上取整运算;在式(2)中,p表示视频帧内CTU的编号,0≤p≤w×h-1;4·i表示CTU内的编号, i=0,1,2,…,(N/8)2-1;B(t,p,4·i)表示第t帧第p块第4·i号8×8的CU块的比特数;Bmax(t)表示t这一帧8×8的CU块比特数的最大值,Bmin(t)表示在第t帧中CU(8×8)块比特数的最小值;在式(3)中,B*(t,p,4·i)表示第t帧第p块第4·i号所有尺寸CU的比特数,所有的CU块包含了16x16,32x32,64x64,BF(t)表示第t帧的总比特数。w represents the number of N×N CUs in each row W represents the width of the video, H represents the height of the video, N represents the size of each LCU; h represents the number of N×N CUs in each column is the round-up operation; in formula (2), p represents the number of the CTU in the video frame, 0≤p≤w×h-1; 4·i represents the number in the CTU, i=0,1,2,… ,(N/8) 2 -1; B(t,p,4·i) represents the number of bits of the 8×8 CU block of No. 4·i in the p-th block of the t-th frame; B max (t) represents t this The maximum number of bits of a 8×8 CU block in one frame, B min (t) represents the minimum number of bits of a CU (8×8) block in the t-th frame; in equation (3), B*(t, p,4·i) represents the number of bits of CUs of all sizes in the p-th block of the t-th frame No. 4·i, all CU blocks contain 16x16, 32x32, 64x64 , BF (t) represents the total number of bits of the t-th frame .
第三步:8×8的CU预测。根据第二步处理得到的CU(8×8)块的归一化比特数来预测目标码流中该CU(8×8)块存在与否。在同构转码情况下,不同QP下码流在比特方面存在线性关系。即输入码流中8×8的CU归一化比特数与该分块在目标码流中的8×8的CU归一化比特数存在正比例关系,如式(4)所示。Step 3: 8×8 CU prediction. The presence or absence of the CU (8×8) block in the target code stream is predicted according to the normalized number of bits of the CU (8×8) block obtained by the second step. In the case of homogeneous transcoding, there is a linear relationship between the bit streams under different QPs. That is, there is a proportional relationship between the 8×8 CU normalized bits in the input code stream and the 8×8 CU normalized bits in the target code stream for the block, as shown in equation (4).
式(4)变形为式(5)。Equation (4) is transformed into Equation (5).
其中表示源码流中第t帧中第p个CTU中编号为4·i的8×8的CU的归一化比特数,表示目标码流中第t帧中第p个CTU中编号为4·i的8×8的CU的归一化比特数,k表示与之间的比值关系。因此有in Indicates the normalized number of bits of the 8×8 CU numbered 4·i in the pth CTU in the tth frame in the source stream, Indicates the normalized number of bits of the 8×8 CU numbered 4·i in the pth CTU in the tth frame in the target code stream, and k represents and ratio between. Therefore there is
其中表示目标码流中第t帧中CU块比特数归一化处理后的最小非零值。因此,当源码流中每一个8×8的CU归一化比特数大于或等于目标码流中最小的非零8×8的CU归一化比特数的1/k倍时,该8×8的CU必在目标码流中出现。根据式(2)和式(4)推导有in Indicates the minimum non-zero value after normalization of the number of bits of the CU block in the t-th frame in the target code stream. Therefore, when the number of normalized bits of each 8×8 CU in the source stream is greater than or equal to 1/k times the number of normalized bits of the smallest non-zero 8×8 CU in the target stream, the 8×8 The CU must appear in the target stream. According to formula (2) and formula (4), it can be deduced that
得出比例系数k由式(8)决定。The proportional coefficient k is obtained by formula (8).
其中,表示源码流第t帧p块4·i号8×8的CU比特数,表示目标码流第t帧p块4·i号8×8CU的比特数,表示目标码流第t帧的总比特数,表示源码流第t帧的总比特数,表示目标码流第t帧中8×8的CU最大比特数,表示目标码流第t帧中8×8的CU最小比特数,表示源码流第t帧中8×8的 CU最大比特数,表示源码流第t帧8×8的CU最小比特数,为源码流与目标码流的在第t帧中各块归一化比特比值的均值。in, Indicates the number of CU bits of 8×8 number 4·i in the t-th frame p block of the source stream, Indicates the number of bits of the 8×8 CU of the t-th frame p block 4·i of the target code stream, represents the total number of bits of the t-th frame of the target code stream, Represents the total number of bits in the t-th frame of the source stream, Indicates the maximum number of bits of the 8×8 CU in the t-th frame of the target code stream, Indicates the minimum number of bits of the 8×8 CU in the t-th frame of the target code stream, Indicates the maximum number of bits of the 8×8 CU in the t-th frame of the source stream, Indicates the minimum number of bits of the 8×8 CU of the t-th frame of the source stream, is the mean of the normalized bit ratios of each block in the t-th frame of the source code stream and the target code stream.
根据式(2),式(6)和式(8)可预测除第0帧和第1帧外的目标码流中必须出现的8×8的CU。第三步中的目标码流比特信息都是第二步中YUV序列第1帧编码后的比特信息。即根据YUV序列第1帧的码流求出k,然后用于后面所有帧的8×8的CU预测。According to Equation (2), Equation (6) and Equation (8) can predict the 8×8 CUs that must appear in the target code stream except the 0th frame and the 1st frame. The bit information of the target stream in the third step is the encoded bit information of the first frame of the YUV sequence in the second step. That is, k is obtained from the code stream of the first frame of the YUV sequence, and then used for the 8×8 CU prediction of all subsequent frames.
第四步,目标码流CTU分块预测。第三步中确定了部分8×8的CU,先根据CTU的性质(3)推出全部的8×8的CU分块;再根据CTU的性质(2)推出部分16×16的CU;然后根据CTU的性质(3) 和(2)推出32×32的CU;最后根据CTU的性质(3)和(2)推出64×64的CU。所以可从8×8的CU 的片段信息构建出一个完整的CTU。如果没有8×8的CU则CTU只包含一个64×64的大的CU。因此能预测一个完整的CTU,从而实现对整个帧的分块情况的预测。最后完成对后面所有帧的分块情况的预测。The fourth step, the target code stream CTU block prediction. In the third step, some 8×8 CUs are determined, and all 8×8 CU blocks are deduced according to the properties of the CTU (3); then some 16×16 CUs are deduced according to the properties of the CTU (2); The properties (3) and (2) of the CTU deduce a 32×32 CU; finally, a 64×64 CU is deduced according to the properties (3) and (2) of the CTU. Therefore, a complete CTU can be constructed from the fragment information of the 8×8 CU. If there is no 8x8 CU, the CTU only contains a large CU of 64x64. Therefore, a complete CTU can be predicted, thereby realizing the prediction of the block situation of the whole frame. Finally, the prediction of the block situation of all subsequent frames is completed.
进一步的,在H.265的编码器中按预测的分块情况进行编码,从而少了编码器对分块情况的探索,节省编码时间。但随着时域的增长,YUV序列在时域上的相关性逐渐减弱。为了获得好的转码质量,本发明提供一种周期性转码方案:Further, in the H.265 encoder, coding is performed according to the predicted block situation, thereby reducing the encoder's exploration of the block situation and saving encoding time. However, with the growth of the time domain, the correlation of YUV sequences in the time domain gradually weakens. In order to obtain good transcoding quality, the present invention provides a periodic transcoding scheme:
可对解码序列进行周期性插入P帧直接编码,以期更新比例系数k。设编码周期为ω,即每个周期内有ω帧。将周期内的第0帧使用I模式进行编码,第1帧的使用P模式编码,对第2 帧到第ω-1帧先预测分块再编码。The decoded sequence can be directly coded with periodic insertion into P-frames in order to update the scale factor k. Let the coding period be ω, that is, there are ω frames in each period. The 0th frame in the cycle is coded using the I mode, the first frame is coded using the P mode, and the 2nd to ω-1th frames are first predicted and divided into blocks and then coded.
当然,为了进一步获取好的转码质量,可在周期内第2帧到第ω-1帧选出部分帧直接使用H.265编码器编码来更新比值系数k和最小归一化比特采用的策略:当帧号tmodω=4n时直接使用H.265编码器编码,其他的帧则先预测分块再编码,其中mod表示取余, 为下取整运算。Of course, in order to further obtain good transcoding quality, some frames can be selected from the second frame to the ω-1th frame in the period and directly encoded by the H.265 encoder to update the ratio coefficient k and the minimum normalization bit. The strategy adopted: when the frame number tmodω=4 n , the H.265 encoder is directly used for encoding, and other frames are first predicted and divided into blocks and then encoded, where mod means remainder, is a round-down operation.
实施例Example
图1所示意,快速转码包括:As shown in Figure 1, fast transcoding includes:
101:输入信息码流。101: Input information code stream.
102:根据输入码流的信息选择MPEG-x系列解码器将输入的码流解码,生成对应的YUV文件输入YUV缓冲区。同时统计每一个编码单元的Bit、QP、CTU、编码类型EncodeType等信息;102: Select an MPEG-x series decoder to decode the input code stream according to the information of the input code stream to generate a corresponding YUV file and input the YUV buffer. At the same time, count the Bit, QP, CTU, EncodeType and other information of each coding unit;
103:据输入码流的信息选择H.264解码器将输入的码流解码,生成对应的YUV文件输入YUV 缓冲区。同时统计每一个编码单元的Bit、QP、CTU、编码类型EncodeType等;103: Select an H.264 decoder to decode the input code stream according to the information of the input code stream, and generate a corresponding YUV file to input the YUV buffer. At the same time, count the Bit, QP, CTU, encoding type EncodeType, etc. of each coding unit;
104:据输入码流的信息选择H.265解码器将输入的码流解码,生成对应的YUV文件输入YUV 缓冲区。同时统计每一个编码单元的Bit、QP、CTU、编码类型EncodeType等;104: Select an H.265 decoder to decode the input code stream according to the information of the input code stream, and generate a corresponding YUV file to input the YUV buffer. At the same time, count the Bit, QP, CTU, encoding type EncodeType, etc. of each coding unit;
105:接收并记录解码器输出的每一个编码单元的Bit、QP、CTU、EncodeType编码类型等;105: Receive and record the Bit, QP, CTU, EncodeType, etc. of each coding unit output by the decoder;
106:接收并保存解码器生成的YUV序列;106: Receive and save the YUV sequence generated by the decoder;
107:根据步骤105中的EncodeType进行判断,如果EncodeType是H.265则直接跳至步骤 108,如果不是则需要将Bit、QP信息带入式(1)进行数据的预处理实现Bit映射;107: judge according to the EncodeType in step 105, if EncodeType is H.265 then jump directly to step 108, if not then need to bring Bit, QP information into formula (1) to carry out the preprocessing of data to realize Bit mapping;
108:根据步骤107的数据预处理的结果,利用CTU的三条性质实现CTU分块;108: According to the result of the data preprocessing in step 107, use the three properties of the CTU to realize CTU segmentation;
109:通过CTU分块信息指导编码器对YUV进行快速编码,得到最终目标码流。109: Instruct the encoder to quickly encode the YUV through the CTU block information to obtain the final target code stream.
其中步骤108根据Bit、QP、CTU的统计信息预测H.265的CTU分块信息的流程图如图2所示,具体步骤如下:The flowchart of step 108 predicting the CTU block information of H.265 according to the statistical information of Bit, QP and CTU is shown in Figure 2, and the specific steps are as follows:
201:输入源码流。201: Input source code stream.
202:从源码流中获取每一个8×8的CU的比特数并计算其归一化比特数和每一帧中归一化比特的最值;202: Obtain the number of bits of each 8×8 CU from the source code stream, and calculate the number of normalized bits and the maximum value of the normalized bits in each frame;
203:从源码流中获取每一帧使用的总比特数;203: Obtain the total number of bits used in each frame from the source code stream;
204:输入目标码流。204: Input the target code stream.
205:从目标码流中获取每一个8×8的CU的比特数并计算其归一化比特数和每一帧中归一化比特的最值;205: Obtain the number of bits of each 8×8 CU from the target code stream and calculate the number of normalized bits and the maximum value of the normalized bits in each frame;
206:从目标码流中获取每一帧使用的总比特数;206: Obtain the total number of bits used in each frame from the target code stream;
207:将步骤203,206,202及205的数据带入式(8)便可求出相关比例系数k;207: Bring the data of steps 203, 206, 202 and 205 into formula (8) to obtain the correlation scale coefficient k;
208:将步骤202、205的归一化比特值及最值以及步骤207的系数k带入式(6)方可得到每一个8×8的CU的分布情况;208: Bring the normalized bit value and the maximum value of steps 202 and 205 and the coefficient k of step 207 into formula (6) to obtain the distribution of each 8×8 CU;
209:根据8×8的CU的分布情况,构建出一个完整CTU分块树。209: Construct a complete CTU block tree according to the distribution of 8×8 CUs.
在图2中步骤209描述了根据8×8的CU构建一个CTU树,图3给出其详尽的步骤。Step 209 in FIG. 2 describes building a CTU tree according to 8×8 CUs, and FIG. 3 shows its detailed steps.
图3所描述的是一个CTU的构建过程。具体步骤如下:Figure 3 depicts the construction of a CTU. Specific steps are as follows:
301:如果不存在8×8的CU,直接跳至步骤304,否则检查该CU在四叉树中的其他兄弟结点是否全部存在。如有不存在的兄弟结点将其补上,跳至步骤302;301: If there is no 8×8 CU, go to step 304 directly, otherwise check whether all other sibling nodes of the CU in the quadtree exist. If there is a non-existing sibling node, add it, skip to step 302;
302:创建16×16的CU结点,检查并补齐其兄弟结点,跳至步骤303;302: Create a 16×16 CU node, check and complete its sibling nodes, and skip to step 303;
303:创建32×32的CU结点,检查并补齐其兄弟结点,跳至步骤304;303: Create a 32×32 CU node, check and complete its sibling nodes, and skip to step 304;
304:创建64×64的CU结点;304: Create a 64×64 CU node;
在图1所表述的转码基本流程中,步骤104为使用H.265编码器对解码序列编码。为保证转码质量,需要分周期编码且每个周期内的第0帧必用H.265编码器直接编码。为获取快速转码过程中使用的相关系数k和最小归一化比特数,需要编码器对第1帧直接编码。随着时间的不断向后推移,视频的相关性不断衰减。需要在适当的位置插入新的帧让H.265编码器编码,来更新相关系数k和最小归一化比特数。In the basic transcoding process shown in FIG. 1 , step 104 is to encode the decoded sequence using the H.265 encoder. In order to ensure the quality of transcoding, it needs to be encoded in cycles and the 0th frame in each cycle must be directly encoded by the H.265 encoder. In order to obtain the correlation coefficient k and the minimum number of normalized bits used in the fast transcoding process, the encoder needs to directly encode the first frame. The video's relevance decays over time. A new frame needs to be inserted at the appropriate location for the H.265 encoder to encode, to update the correlation coefficient k and the minimum number of normalization bits.
图4所描述的是本实施例给出的策略。其中有阴影的部分为H.265直接编码的帧序号,无阴影的帧为快速编码的部分。给定的编码周期为T=32,按30fps的帧率播放视频,也就是大约 1秒更新一个周期。Figure 4 describes the strategy given in this embodiment. The shaded part is the frame number of the H.265 direct encoding, and the unshaded frame is the fast encoding part. The given encoding period is T=32, and the video is played at a frame rate of 30fps, that is, an update period of about 1 second.
表1和表2给出本发明方法在同构和异构两种情况下的转码测试性能。测试采用x265v1.4 作为软件平台,QP值锁定为22,进行IPP..PP结构编码。测试序列选用HEVC标准组定义的9个不同分辨率的序列。Table 1 and Table 2 show the transcoding test performance of the method of the present invention under two conditions of homogeneous and heterogeneous. The test uses x265v1.4 as the software platform, the QP value is locked to 22, and the IPP..PP structure is encoded. The test sequence uses 9 sequences with different resolutions defined by the HEVC standard group.
下表给出了异构转码(H.264码流到H.265码流)的测试结果。The following table shows the test results of heterogeneous transcoding (H.264 stream to H.265 stream).
先将原始YUV序列用x264进行编码生成H.264的码流,接着用H.264标准解码器重构出解码 YUV序列。直接编码测试是将重构YUV序列用x265v1.4进行直接转码,本发明技术转码是将重构YUV序列结合其解码信息进行快速转码。从测试结果来看,本发明快速转码技术与直接转码技术相比,在时间节省方面的性能平均达到42.31%,最好情况下甚至高达51.95%。同时,在编码质量方面快速转码技术与直接转码技术基本持平,仅有0.15%的损失,可以忽略。First encode the original YUV sequence with x264 to generate the H.264 code stream, and then use the H.264 standard decoder to reconstruct the decoded YUV sequence. The direct coding test is to directly transcode the reconstructed YUV sequence with x265v1.4, and the technical transcoding of the present invention is to quickly transcode the reconstructed YUV sequence in combination with its decoding information. From the test results, compared with the direct transcoding technology, the fast transcoding technology of the present invention achieves an average performance of 42.31% in terms of time saving, and even as high as 51.95% in the best case. At the same time, in terms of encoding quality, the fast transcoding technology is basically the same as the direct transcoding technology, with only a 0.15% loss, which can be ignored.
下表给出了同构转码(H.265码流到H.265码流)的测试结果。The following table shows the test results of isomorphic transcoding (H.265 stream to H.265 stream).
先将原始YUV序列用x265进行编码生成H.265的码流,接着用H.265标准解码器重构出解码 YUV序列。直接编码测试是将重构YUV序列用x265v1.4进行直接转码,本发明技术转码是将重构YUV序列结合其解码信息进行快速转码。与表1中所示异构转码测试结果类似,表2给出的同构转码测试结果性能得到保持。在编码时间节省方面的性能平均达到44.75%,编码质量方面仅有0.89%的损失,严格控制在了1%以内。First encode the original YUV sequence with x265 to generate the H.265 code stream, and then reconstruct the decoded YUV sequence with the H.265 standard decoder. The direct coding test is to directly transcode the reconstructed YUV sequence with x265v1.4, and the technical transcoding of the present invention is to quickly transcode the reconstructed YUV sequence in combination with its decoding information. Similar to the heterogeneous transcoding test results shown in Table 1, the performance of the isomorphic transcoding test results given in Table 2 is maintained. The average performance in terms of encoding time saving reaches 44.75%, and the loss in encoding quality is only 0.89%, which is strictly controlled within 1%.
综上,本发明技术在同构和异构下的转码在保持视觉质量的同时提升编码效率40%以上。To sum up, the transcoding of the technology of the present invention can improve the coding efficiency by more than 40% while maintaining the visual quality.
Claims (3)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610771223.7A CN106454343B (en) | 2016-08-30 | 2016-08-30 | The H.265 fast transcoding method of mapping is divided based on code stream bit number and block |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610771223.7A CN106454343B (en) | 2016-08-30 | 2016-08-30 | The H.265 fast transcoding method of mapping is divided based on code stream bit number and block |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106454343A CN106454343A (en) | 2017-02-22 |
CN106454343B true CN106454343B (en) | 2019-05-14 |
Family
ID=58090744
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610771223.7A Expired - Fee Related CN106454343B (en) | 2016-08-30 | 2016-08-30 | The H.265 fast transcoding method of mapping is divided based on code stream bit number and block |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106454343B (en) |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103248893B (en) * | 2013-05-10 | 2015-12-23 | 四川大学 | From H.264/AVC standard to code-transferring method and transcoder thereof the fast frame of HEVC standard |
CN103491334B (en) * | 2013-09-11 | 2017-05-10 | 浙江大学 | Video transcode method from H264 to HEVC based on region feature analysis |
CN103475880B (en) * | 2013-09-11 | 2016-08-24 | 浙江大学 | A kind of based on statistical analysis by H.264 to HEVC low complex degree video transcoding method |
CN103796023B (en) * | 2014-03-05 | 2017-02-01 | 武汉拓宝科技股份有限公司 | H.265/HEVC transcoding method and transcoder based on H.264/AVC macro block structure and texture |
-
2016
- 2016-08-30 CN CN201610771223.7A patent/CN106454343B/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
CN106454343A (en) | 2017-02-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20230037689A1 (en) | Methods and apparatuses for coding transform blocks | |
CN103650496B (en) | Intra prediction pixel-based for being encoded in HEVC | |
CN105684441B (en) | The Block- matching based on hash in video and image coding | |
KR101941955B1 (en) | Recursive block partitioning | |
CN105659606A (en) | Features of base color index map mode for video and image coding and decoding | |
WO2010050152A1 (en) | Pixel prediction value generation procedure automatic generation method, image encoding method, image decoding method, devices using these methods, programs for these methods, and recording medium on which these programs are recorded | |
CN108259900A (en) | For the transform coefficients encoding of the context adaptive binary entropy coding of video | |
CN106031177A (en) | Host encoder for hardware-accelerated video encoding | |
CN112738511B (en) | A fast mode decision-making method and device combined with video analysis | |
US20120219057A1 (en) | Video encoding apparatus and video encoding method | |
CN103533355B (en) | A kind of HEVC fast encoding method | |
CN110944179A (en) | Video data decoding method and device | |
Yin et al. | Fast soft decision quantization with adaptive preselection and dynamic trellis graph | |
CN111355955A (en) | Multi-transformation-core quick skipping algorithm based on preselected layer | |
CN112437300B (en) | Distributed video coding method based on self-adaptive interval overlapping factor | |
JP2007325262A (en) | Method of video compression | |
CN103281532B (en) | A kind of quantization method of adjustment based on motion strength detection and system | |
CN106454343B (en) | The H.265 fast transcoding method of mapping is divided based on code stream bit number and block | |
CN106210747A (en) | A kind of low-complexity video coding method based on quaternary tree probabilistic forecasting | |
EP3180862B1 (en) | Method for coding pulse vectors using statistical properties | |
CN110581993A (en) | A fast coding unit division method based on intra-frame coding in multi-purpose coding | |
CN101616325A (en) | A Method of Adaptive Interpolation Filter Calculation in Video Coding | |
WO2021175108A1 (en) | Inter-frame prediction method, encoder, decoder, and computer readable storage medium | |
CN103686176A (en) | A Bit Rate Estimation Method for Video Coding | |
CN102377996B (en) | Context-adaptive variable-length coding method and apparatus thereof |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20190514 Termination date: 20210830 |
|
CF01 | Termination of patent right due to non-payment of annual fee |