H.265/hevc code-transferring method based on h.264/avc macroblock structure and texture and turning
Code device
Technical field
The present invention relates to the transcoding of video data, in particular to a kind of based on h.264/avc macroblock structure and texture
H.265/hevc code-transferring method and transcoder, for being h.265/hevc standard by the video data transcoding of h.264/avc standard
Video data.
Background technology
The popularization of HD video and the appearance of ultra high-definition video, have promoted the development of video coding and decoding technology, mpeg energetically
It is organized in 2013 with the itu Liang great world and has formally issued h.265/hevc new-generation digital video encoding and decoding standard, to adapt to
Network transmission and the development of high-quality video application.H.265/hevc it is the extension further in h.264/avc technical foundation
And expansion, since 2010 beginning draft collections, by countries in the world hundreds expert's R & D Cooperation, until 2013 by two big countries
Border normal structure itu and mpeg announce to external world and formally become video encoding and decoding standard of future generation, last 3 years, therebetween through excessive
Secondary modification and perfect.
Video code conversion is that compressed video data is processed end to end, and the input/output of transcoder is all compressed data,
Compressed bit stream after transcoding is suitable for the requirement of transmission bandwidth and receiving terminal.In traditional tandem type pixel domain code conversion device
In (cascade pixel domain transcoder, cpdt), decoder and encoder are separate, use such transcoder
Carry out transcoding from h.264/avc standard to h.265/hevc standard when, first decode h.264 video flowing, then recompile, finally
It is compressed into h.265/hevc video code flow.
H.264/avc the method adopting macroblock partition and sub-split in interframe encode, each macro block can by 16 × 16,
16 × 8,8 × 16,8 × 8 four kinds of Fractionation regimen segmentations, moreover it is possible to be further divided into 8 × 4,4 in 8 × 8 macro-block partition modes
× 8,4 × 4 three kinds of Fractionation regimen segmentations.
And in h.265/hevc, the size of macro block be extend to 64x64 from 16x16 h.264/avc, in order to height
The compression of resolution video.Meanwhile, employ more flexible coding structure to improve code efficiency, including coding unit
(coding unit), predicting unit (predict unit) and converter unit (transform unit).
Wherein coding unit similar to the concept of the macro block in h.264/avc, for the process of coding, predicting unit be into
The elementary cell of row prediction, converter unit is by the elementary cell of transform and quantization.The separation of these three units is so that become
Change, predict and encode that each processing links is more flexible, the division being also beneficial to each link more conforms to the texture of video image
Feature, be conducive to unit more optimization completes respective function.
Each predicting unit corresponds to a motion vector, in encoding-decoding process, encoder to each motion vector and
The Fractionation regimen of corresponding predicting unit is encoded, and decoder is believed according to the Fractionation regimen of each predicting unit and motion vector
Breath is decoded.Need when h.265/hevc encoding first the Fractionation regimen of each predicting unit to be scanned for, and lost with rate
True majorized function calculation code cost, finally compares result of calculation, selects the prediction as interframe encode for the pattern of Least-cost
Unit Fractionation regimen, therefore, in existing transcoding process, due to not added using the effective information in h.264/avc code stream
Fast h.265/hevc cataloged procedure, therefore transcoding process is computationally intensive, and transcoding efficiency is restricted.
Content of the invention
Present invention aim to overcome that above-mentioned the deficiencies in the prior art and provide a kind of based on h.264/avc macroblock structure and
H.265/hevc the code-transferring method of texture and transcoder, the method is by the segmentation of macro block in Selection utilization h.264/avc code stream
Pattern information, accelerates the speed of transcoding, improves the effect of coding.
Realize the object of the invention the technical scheme is that a kind of based on h.264/avc macroblock structure and texture
H.265/hevc code-transferring method, the method includes:
Extract with the inter macroblocks Fractionation regimen information in the code stream of h.264/avc standard code;
H.264/avc 4 16x16 macro blocks are combined as a big macro block meeting h.265/hevc Fractionation regimen;
Judge whether 4 Fractionation regimen of 4 16x16 macro blocks in each big macro block are split for 16x16, if not, then
Using directly map by the way of using described macroblock partition mode map in h.265/hevc coding mode as h.265/hevc
The macroblock partition pattern of coding;If so, then with the pattern discrimination method based on texture, to 32x32, big macro block carries out other patterns and carries out
Judge, using the Fractionation regimen judging selection as the macroblock partition pattern h.265/hevc encoding;
H.265/hevc code stream coding is carried out according to the described macroblock partition pattern h.265/hevc encoding.
Present invention also offers a kind of h.265/hevc transcoder based on h.264/avc macroblock structure and texture, this turn
Code device includes:
Information extraction modules, extract with the inter macroblocks Fractionation regimen information in the code stream of h.264/avc standard code;
H.265/hevc, macro block composite module, divides for 4 16x16 macro blocks h.264/avc being combined as one meeting
Cut the big macro block of pattern;
Whether macroblock partition mode decision module, judge 4 Fractionation regimen of 4 16x16 macro blocks in each big macro block
Be all 16x16 segmentation, if not, then by the way of direct mapping by described macroblock partition mode map to h.265/hevc encoding
As the macroblock partition pattern h.265/hevc encoding in pattern;If so, then big to 32x32 with the pattern discrimination method based on texture
Macro block carries out other patterns and is judged, using the Fractionation regimen judging selection as the macroblock partition mould h.265/hevc encoding
Formula;
H.265/hevc h.265/ encoder, for carrying out according to the described macroblock partition pattern h.265/hevc encoding
Hevc code stream encodes.
The process that the present invention is the h.265/hevc video data of standard in the video data transcoding to h.264/avc standard
In, make use of the macroblock partition information in h.264/avc code stream, will h.264/avc in code stream 4 not all divide for 16x16
Cut the 16x16 macro block of pattern segmentation information map directly to h.265/hevc coding in, this operation decreases amount of calculation.This
Outward moreover it is possible to quickly determine to the segmentation information of the 16x16 macro block of 4 in h.264/avc code stream all 16x16 Fractionation regimen
Fractionation regimen, reduces computational complexity, thus ensure that high-quality encoding efficiency.
Brief description
Fig. 1 is the present invention in the structured flowchart of h.264/avc macroblock structure and the h.265/hevc transcoder of texture.
Fig. 2 is the flow chart based on h.264/avc macroblock structure and the h.265/hevc code-transferring method of texture for the present invention.
Specific embodiment
With specific embodiment, the present invention is described in further detail below in conjunction with the accompanying drawings.
As shown in figure 1, information retrieval mould is included based on the h.265/hevc transcoder of h.264/avc macroblock structure and texture
Block, macro block composite module, macroblock partition mode decision module, the mode decision selecting module based on texture and h.265/hevc compile
Code device.
Above-mentioned h.265/hevc transcoder realizes the video data transcoding to h.264/avc standard for h.265/hevc standard
Video data process as shown in Fig. 2 specifically including following steps:
S100, information extraction modules carry out information retrieval to the code stream inputting h.264/avc normal video data therein,
Extract the inter macroblocks Fractionation regimen information in code stream.
H.264/avc 4 16x16 macro blocks are combined as one and meet h.265/hevc dividing by s200, macro block composite module
Cut the big macro block of pattern.The present embodiment is carried out so that 4 16x16 macro blocks h.264/avc are combined as the big macro block of 32x32 in detail
Describe in detail bright.
S300, macroblock partition mode decision module judge to the inter macroblocks Fractionation regimen information extracted.Judge every
Whether 4 Fractionation regimen of 4 16x16 macro blocks in the big macro block of individual 32x32 are all 16x16 segmentation, if not, then using directly reflecting
The mode penetrated is by described macroblock partition mode map in h.265/hevc coding mode;If so, then with the pattern based on texture
To 32x32, big macro block carries out other patterns and judges diagnostic method, using the Fractionation regimen judging selection as h.265/hevc compiling
The macroblock partition pattern of code.
In the present embodiment, carry out judging to select to include following two steps based on the mode decision selecting module of texture:
S301, corresponding Fractionation regimen is selected according to grain details degree α of macro block.
First, calculate grain details degree α of m × n macro block according to the following formula,
Wherein,
In above formula, the gross energy of the AC compounent coefficient of e spatial domain, emax is maximum ac coefficient gross energy, f(x,
Y) represent that the component in spatial domain position (x, y) for certain predicting unit, fmax (x, y) and fmin (x, y) are respectively f (x, y)
Big value and minima.
α span is [0,1], and grain details degree is higher, and e more levels off to emax, thus α more levels off to 1.So,
May determine that the level of detail of macro block according to the value of α.In the present invention, as α > t1 when it is believed that macro block has very high details, right
Fractionation regimen in this block selection of small;When α is < it is believed that macro block details is not enriched during t2, using bigger Fractionation regimen;When t2 <
α < it is believed that macro block has higher details during t1, for this block adopt predicting unit Fractionation regimen between the above two.Wherein
T1 and t2 is empirical parameter set in advance, such as t1=0.9, t2=0.4 or other values, t1 and t2 can be according to different Fractionation regimen
The data statisticss of lower macro block level of detail and obtain.Some patterns are excluded in advance by this step, it is to avoid all patterns are all entered
Line search, reduces computation complexity.
S302, when t2 < α is < during t1, according to the corresponding Fractionation regimen of feature selection of macroblock level and vertical direction.
Due to 2n × n, 2n × nu, 2n × nd model comparision be suitable for the obvious region of horizontal texture, and n × 2n, nl × 2n,
Nr × 2n is compared with the obvious region of suitable vertical texture.Therefore, the difference of this step difference calculated level and vertical adjacent pixels is put down
Fang He, when horizontal adjacent pixels squared difference and more than vertically adjacent pixel quadratic sum when, from 2n × n, 2n ×
Nu or 2n × nd, otherwise selects n × 2n, nl × 2n or nr × 2n.
S400, h.265/hevc encoder carry out h.265/hevc code stream according to the macroblock partition pattern that above-mentioned steps obtain
Coding.