# Patent application title: VIDEO COMPRESSION FOR HIGH EFFICIENCY VIDEO CODING

##
Inventors:
Alexander Zheludkov (Saint-Petersburg, RU)
Alexey Martemyanov (Saint-Petersburg, RU)
Nikolay Terterov (Saint-Petersburg, RU)

IPC8 Class: AH04N726FI

USPC Class:
37524002

Class name: Bandwidth reduction or expansion television or motion video signal adaptive

Publication date: 2013-05-16

Patent application number: 20130121401

## Abstract:

Encoding methods directed to making coding decisions and estimating
coding parameters including searching for optimal angular prediction in
intra-prediction mode; choosing the best intra block subdivision; and
providing motion estimation for tree-structured inter coding. The methods
are targeted to HEVC specifications of video compression, however, may be
used with other video coding standards.## Claims:

**1.**(canceled)

**2.**A method of choosing an optimal intra prediction mode in block-based video coding, the method comprising: calculating a minimal activity direction based on texture gradient distribution, the minimal activity direction being defined by a vector (α(S,W), β(S,W)) indicating minimal variation of a discrete function P(x, y) inside a spatial aria of block B with weights W; the vector (α(S,W), β(S,W)) being a solution of a minimization problem: ( x , y ) .di-elect cons. S W ( x , y ) ( α D X ( x , y ) + β D Y ( x , y ) ) 2 → α , β min ; ##EQU00014## wherein α

^{2}+β

^{2}=1; P(x, y) is a discrete function defined at a rectangular set of integer pairs: R={ 0,N-1}×{ 0,M-1} in a N×M frame; S is a set of integer coordinate pairs (x, y), where S .OR right. R ; W(x, y) is a set of non-negative weight coefficients defined at a point (x, y) .di-elect cons. S; D

_{x}(x, y) and D

_{y}(x, y) are measures of function P(x, y) variations in the neighborhood of the (x, y) point: D

_{x}(x,y)=(P(x +1,y)-P(x-1,y))/2; and D

_{y}(x,y)=(P(x, y+1)-P(x, y-1))/2; and wherein ΣW(x, y)D

_{x}

^{2}(x,y)+ΣW(x,y)D

_{y}

^{2}(x,y)≠

**0.**

**3.**The method of claim 2, further comprising calculating a strength of minimal activity direction: C 1 ( α , β , S , W ) = ( x , y ) .di-elect cons. S W ( x , y ) ( - β D X ( x , y ) + α D Y ( x , y ) ) 2 ( x , y ) .di-elect cons. S W ( x , y ) ; and ##EQU00015## C 2 ( α , β , S , W ) = ( x , y ) .di-elect cons. S W ( x , y ) ( - β D X ( x , y ) + α D Y ( x , y ) ) 2 ( x , y ) .di-elect cons. S W ( x , y ) ( α D X ( x , y ) + β D Y ( x , y ) ) 2 . ##EQU

**00015.**2##

**4.**A method of selecting an optimal angular intra prediction mode for a block-based video coding, the method comprising: calculating following functions for a spatial area S including a texture block beginning with coordinates (x, y): E = ( ( x , y ) .di-elect cons. S W ( x , y ) D X 2 ( x , y ) - ( x , y ) .di-elect cons. S W ( x , y ) D Y 2 ( x , y ) ) , F = ( x , y ) .di-elect cons. S W ( x , y ) D X ( x , y ) D Y ( x , y ) , A = E 2 E 2 + 4 F 2 ; ##EQU00016## wherein W(x, y) is a set of non-negative weight coefficients defined at (x, y) .di-elect cons. S ; D

_{x}(x, y) and D

_{y}(x, y) are variations of function P(x, y) in the neighborhood of (x, y) point: D

_{x}(x, y)=(P(x +1,y)-P(x-1,y))/2; D

_{y}(x, y)=(P(x, y+1)-P(x, y-1))/2; and calculating a minimal activity direction for each case j=1,4:

**1.**E≦0 and F<0;

**2.**E>0 and F<0;

**3.**E≧0 and F≧0; and

**4.**E<0 and F≧

**0.**

**5.**The method of selecting an optimal angular intra prediction mode of claim 4, wherein the minimal activity direction for each case j= 1,4 is calculated as a vector (α(S,W), β(S,W)): ( α ( S , W ) β ( S , W ) ) = ( ( 1 + A ) / 2 ( 1 - A ) / 2 ) ; ##EQU00017## ( α ( S , W ) β ( S , W ) ) = ( ( 1 - A ) / 2 ( 1 + A ) / 2 ) ; ##EQU

**00017.**2## ( α ( S , W ) β ( S , W ) ) = ( - ( 1 - A ) / 2 ( 1 + A ) / 2 ) ; and ( α ( S , W ) β ( S , W ) ) = ( - ( 1 + A ) / 2 ( 1 - A ) / 2 ) ##EQU

**00017.**3## calculating a corresponding minimal activity angle φ(S,W) .di-elect cons. [0;π] as φ(S,W)=arc cos(α(S,W)); finding an intra prediction angle γ

_{k}closest to φ(S,W); and choosing an optimal intra prediction mode P

_{k}as defined by the minimal activity direction.

**6.**The method of claim 5, wherein the four cases j= 1,4 correspond to respective intervals of the angle φ(S,W): [0;π/4], [π/4, π/2], [π/2,

**3.**pi./4] and [

**3.**pi./4, π].

**7.**A method of calculating tables for minimal activity directions and corresponding angular prediction modes using signs of E and F and the value of the ratio E F or F E ##EQU00018## according to claim 4, the method comprising: considering integers K and L defining accuracy of calculations; calculating constant integer array AngleToMode[ ] of size K+1 providing correspondence between a prediction angle φ.di-elect cons.[0;π] and a prediction mode index P: AngleToMode[round(Kφ/π)]=P

_{k}; calculating four tables RatioToAngleDirect[j][ ] of size L+1 for each case j= 1,4, providing correspondence between the ratio |E/F|.di-elect cons.[0;1] and the prediction angle φ.di-elect cons.[

**0.**pi.]; RatioToAngleDirect[j][round(L|E/F|)]=round(kφ/π), wherein φ.di-elect cons.[0;π]; calculating four tables RatioToAngleInverse[j][ ] of size L+1 for each case j= 1,4, providing the correspondence between the ratio |F/E|.di-elect cons.[0;1] and the prediction angle φ.di-elect cons.[0;π]: RatioToAngleInverse[j][round(L|F/E|)]=round(Kφ/π), where φ.di-elect cons.[0;π]; calculating values E and F; choosing a case number j= 1,4 according to the signs of E and F: if |E/F|.di-elect cons.[0;1], calculating a prediction mode P

_{k}defined by the minimal activity direction as: P

_{k}AngleToMode[RatioToAngleDirect[j][round(L|E/F|)]]; and if |F/E|.di-elect cons.[0;1], calculating the prediction mode P

_{k}defined by the minimal activity direction as: P

_{k}=AngleToMode[RatioToAngleInverse[j][round(L|F/E|)]]; wherein round( )stays for rounding a number to a closest integer;

**8.**The method of claim 7, wherein integers K and L are equal to

**256.**

**9.**A method of selecting an optimal intra prediction for high efficiency video coding, the method comprising: choosing a spatial area S including a texture block B of size L×L, starting with coordinates (x, y); calculating a minimal activity direction (α, β) where α

^{2}+β

^{2}=1, and a corresponding angular intra prediction mode; defining a set Q of intra predictions for selecting the optimal intra prediction mode P

_{k}, the set Q including at least a plurality of angular intra predictions and a plurality of non-angular intra predictions; defining constants X

_{1}, X

_{2}, X

_{3}selected according to desired coding speed and quality; calculating a minimal activity direction strengths for the block B with weights W: C 1 ( B , W ) = ( x , y ) .di-elect cons. S W ( x , y ) ( - β D X ( x , y ) + α D Y ( x , y ) ) 2 ( x , y ) .di-elect cons. S W ( x , y ) , C 2 ( B , W ) = ( x , y ) .di-elect cons. S W ( x , y ) ( - β D X ( x , y ) + α D Y ( x , y ) ) 2 ( x , y ) .di-elect cons. S W ( x , y ) ( α D X ( x , y ) + β D Y ( x , y ) ) 2 ##EQU00019## wherein D

_{x}(x, y) and D

_{y}(x, y) are measures of function P(x, y) variations: D

_{x}(x, y)=(P(x+1,y)-P(x-1,y))/2 ; and D

_{y}(x,y)=(P(x, y+1)-P(x, y-1))/2; constructing a reduced set Q

_{1}of intra predictions by excluding from the set Q at least one plurality of intra predictions: if C

_{1}({tilde over (B)},W)<X

_{1}, excluding the plurality of angular intra predictions; if C

_{1}({tilde over (B)},W)>X

_{2}and C

_{2}({tilde over (B)},W)<X

_{3}, excluding the plurality of non-angular predictions; and selecting the optimal intra prediction P

_{k}from the reduced set Q

_{1}of intra predictions.

**10.**The method of claim 9, wherein the set Q further includes a plurality of angular prediction modes corresponding to angles neighboring the angles defined by the intra prediction mode P

_{k}.

**11.**A method of choosing a best size for an intra block in high efficiency video coding, the method comprising: considering a texture block B having size L×L and weight W and starting from pixel with coordinates (x, y); constructing four sub-blocks B

_{j}, j .di-elect cons.[0,4] of size L 2 × L 2 ##EQU00020## starting from pixels with coordinates (x, y), ( x + L 2 , y ) , ( x , y + L 2 ) , ( x + L 2 , y + L 2 ) , ##EQU00021## respectively; constructing a spatial area S including the block B and spatial areas S

_{j}including the sub-blocks B

_{j}; calculating minimal activity direction angles φ({tilde over (B)},W) and φ({tilde over (B)},W), wherein α({tilde over (B)},W)=cos(φ({tilde over (B)},W)), β({tilde over (B)},W)=sin(φ({tilde over (B)},W)); calculating functions of minimal activity direction strengths: C

_{1}({tilde over (B)},W); C

_{2}({tilde over (B)},W); C

_{1}(α({tilde over (B)},W), β({tilde over (B)},W), {tilde over (B)}

_{j},W); and C

_{2}(α({tilde over (B)},W), β({tilde over (B)},W), {tilde over (B)}

_{j},W); and selecting a best block size as: a single L×L block B, if the minimal activity direction strengths for all j .di-elect cons.[0,4] are: C

_{1}(α({tilde over (B)},W), β({tilde over (B)},W), {tilde over (B)}

_{j}, W)<λ

_{1}+μ

_{1}C

_{1}({tilde over (B)},W), and C

_{2}(α({tilde over (B)},W), β({tilde over (B)},W), {tilde over (B)}

_{j},W)<λ

_{2}+μ

_{2}C

_{2}({tilde over (B)},W); otherwise, selecting four L 2 × L 2 ##EQU00022## sub-blocks B

_{j}.

**12.**The method of claim 10, wherein S coincide with B, and S

_{j}coincide with B

_{j}.

**13.**A method of multi-level motion estimation for block-based video coding, the method comprising: constructing a reduced resolution image; performing a reduced resolution search for blocks

**64.**times.64; performing refinement by neighboring blocks; providing a motion assignment for

**16.**times.16 blocks using neighboring blocks; performing a refinement search for

**16.**times.16 blocks; providing an error distribution analysis information for split-merge prediction and non-square block selection; performing a sub-pixel refinement; splitting

**16.**times.16 blocks into

**8.**times.8 blocks; merging four

**16.**times.16 blocks into one

**32.**times.32 partition; merging four

**32.**times.32 blocks into one

**64.**times.64 partition; and selecting a best non-square prediction using an error distribution field.

**14.**The method of motion estimation of claim 13, comprising performing the motion estimation using integer-pel, and assigning quarter-pel after a decision is made.

**15.**The method of motion estimation of claim 13, wherein the constructing of a reduced resolution image comprises: representing

**64.**times.64 blocks of original picture as

**16.**times.16 blocks; and calculating every pixel in reduced image as a weighted sum of pixels in the original picture.

**16.**The method of claim 15, wherein the reduced resolution image is calculated as follows: Z

_{x}/4,y/4=(O

_{x,y}+2*O

_{x}+1,y+O

_{x}+2y+2*O

_{x,y}+1'4*O

_{x}- +1,y+1+2*O

_{x}+2,y+1+O

_{x,y}+2+2*O

_{x}-1,y+2+O

_{x}-2,y+2)/16 wherein: Z

_{x}/4,y/4 is the pixel of the reduced image; and O

_{x,y}is the pixel in the original picture.

**17.**The method of motion estimation of claim 13, wherein the performing a reduced resolution search comprises: performing Census transform for every input frame; splitting a frame into

**16.**times.16 blocks and representing it as a 256-bytes vector A; preparing a 256-bytes vector B, where at each position addressed by value from vector A, placing an actual position of vector A; preparing a correlation surface filled with zeroes; substructing element-by-element vector A from vector B receiving a resulting vector; returning into a two-dimensional space and incrementing points of the correlation surface at a position given by the resulting vector; finding maximum on the correlation surface in full-pels; and interpolating a sub-pixel value using neighbor values on the correlation surface,

**18.**The method of motion estimation of claim 13, wherein the refinement is performed as a multi-pass motion vector field refinement for integer motion estimation.

**19.**The method of motion estimation of claim 18, wherein the multi-pass motion vector field refinement comprises: selecting a threshold T as a desired percent of all blocks in the picture; setting a variable count C=0; for every block in the picture: using motion vectors of eight neighbor blocks as candidate motion vectors; comparing the vectors and selecting a best motion vector; if the vector has changed, incrementing variable count C; and if C<T, repeating the step of setting the count C.

**20.**The method of claim 13, wherein the reduced resolution search comprises: selecting four reduced frames in each direction X and Y; performing reduced resolution search in blocks

**16.**times.16 using reduced frames; and obtaining motion for

**64.**times.64 blocks in original frames.

**21.**The method of claim 13, wherein the motion assignment for

**16.**times.16 blocks is performed using non-parametric local transform.

**22.**The method of claim 13, wherein the refinement search for

**16.**times.16 blocks comprising: performing Census transform for every input frame; splitting the frame into

**16.**times.16 blocks and representing it as 256-byte vector A; preparing a 256-byte vector B corresponding to vector A; preparing a correlation surface filled with zeroes; receiving vector C by subtracting vector A from vector B element-by-element; incrementing points of the correlation surface at position given by vector C; finding maximum on the correlation surface in full pels; and interpolating a sub-pixel value using neighbor values on the correlation surface.

**23.**A method for error distribution analyses in inter coding motion estimation, the method comprising: calculating SAD for every

**8.**times.8 block receiving a

**8.**times.8 error distribution block for every

**64.**times.64 block; and providing split-merge prediction comprising: providing SPLIT decision optimization by: defining a Split Threshold as desired level of SPLIT sensitivity; calculating average SAD of the whole error distribution block (EDB); marking the EDB as a SPLIT candidate if the difference between any SAD in the EDB and a calculated average SAD is larger than the Split Threshold; and performing an additional refinement search for every SPLIT candidate block; and providing MERGE decision optimization by: defining a Merge threshold as desired level of MERGE sensitivity; preparing an EDB pyramid based on averaging

**2.**times.2 block of SADs at each level, wherein the pyramid comprises: Level 0: an original EDB block of

**8.**times.8 SADs ; Level 1: averaged once

**4.**times.4 SADs; Level 2: averaged twice

**2.**times.2 SADs; and Level 3: one averaged SAD. at every level from 1 to 3, examining four correspondence SADs to check for a MERGE flag; if difference from lower level SAD for all four SADs is no laeger than the Merge Threshold, marking this block as a MERGE candidate; and performing a MERGE check for every block marked as MERGE candidate.

**24.**A method of selecting an optimal directional intra prediction mode in block-based video coding, comprising: constructing a plurality of sets for angular intra predictions P

_{0}, P

_{1}, . . . , P

_{32}: S

_{32}={P

_{16}); S

_{16}=P

_{24}); S

_{8}={P

_{0}, P

_{8}, P

_{16}, P

_{24}, P

_{32}}; S

_{4}={P

_{0}, P

_{4}, P

_{8}, P

_{12}, P

_{16}, P

_{20}, P

_{24}, P

_{28}, P

_{32}}; S

_{2}={P

_{0}, P

_{2}, P

_{4}, P

_{6}, P

_{8}, P

_{10}, P

_{12}, P

_{14}, P

_{16}, P

_{18}, P

_{20}, P

_{22}, P

_{24}, P

_{26}, P

_{28}, P

_{30}, P

_{32}}; presenting planar prediction mode P

_{33}and DC prediction mode P

_{34}; and performing a logarithmic search to reduce a number of intra predictions being tested for optimal intra prediction mode.

**25.**The method of claim 24, comprising: (i) from a plurality of sets of angular intra predictions selecting a set S

_{L}, a value L.di-elect cons.{32, 16, 8, 4, 2} and a cost function R(P

_{K}) depending on desired coding parameters; (ii) from the set S

_{L}selecting an intra prediction P

_{K}minimizing a value of cost function R(P), where K is an index for this intra prediction; (iii) finding an intra prediction P.di-elect cons.{P

_{K}, P

_{K}-L/2, P

_{K}+L/2} which minimizes the value of R(P) and setting a value of index K for this intra prediction; (iv) setting a pre-defined threshold T

_{o}depending on desired coding parameters; if K=2, or R(P

_{K})<T

_{0}, going to step (v); otherwise, performing step (iii) for L=L/2; and (v) if K=2, selecting a best intra prediction from a set {P

_{K}, P

_{K}-1, P

_{K}+1, P

_{33}, P

_{34}} as a prediction minimizing the value of R(P); otherwise, the optimal intra prediction is R(P

_{K}).

**26.**The method of claim 24, comprising: selecting from the set S

_{8}={P

_{0}, P

_{8}, P

_{16}, P

_{24}, P

_{32}} an intra prediction P

_{K}minimizing a value of cost function R(P), where K is an index of intra prediction, set a threshold T

_{0}, T

_{0}being a pre-defined coding parameter; if R(P

_{K})<T

_{0}, the optimal intra prediction is P

_{K}; if R(P

_{K})≧T

_{0}, testing following sets of intra predictions: Q

_{0}={P

_{32}, P

_{0}, P

_{1}, P

_{2}, P

_{3}, P

_{5}, P

_{6}}; Q

_{8}={P

_{4}, P

_{5}, P

_{6}, P

_{7}, P

_{8}, P

_{9}, P

_{10}}; Q

_{8}+={P

_{6}, P

_{7}, P

_{8}, P

_{9}, P

_{10}, P

_{11}, P

_{12}}; Q

_{16}-={P

_{12}, P

_{13}, P

_{14}, P

_{15}, P

_{16}, P

_{18}, P

_{19}}; Q

_{16}+={P

_{14}, P

_{15}, P

_{16}, P

_{17}, P

_{18}, P

_{19}, P

_{20}}; Q

_{24}-={P

_{20}, P

_{21}, P

_{22}, P

_{23}, P

_{24}, P

_{25}, P

_{26}}; Q

_{24}+={P

_{22}, P

_{23}, P

_{24}, P

_{25}, P

_{26}, P

_{27}, P

_{28}}; Q

_{32}={P

_{0}, P

_{27}, P

_{28}, P

_{29}, P

_{30}, P

_{31}, P

_{32}}. choosing an intra prediction set Q according to the following requirements: if K=0 or K=32, the intra prediction set Q=Q

_{k}-; if K≠0 and K≠32, then: if R(P

_{K}-8)<R(P

_{K}+8), Q=Q

_{k}-; and if R(P

_{K}-8)≧R(P

_{K}+8); Q=Q

_{K}+; and finding the optimal intra prediction from the set Q=Q

_{K}∪{P

_{33}, P

_{34}}, as the one minimizing the value of R(P).

## Description:

**[0001]**This application claims benefit of U.S. Provisional Application No. 61/560,556, filed Nov. 16, 2011, which is hereby incorporated herein by reference in its entirety.

**FIELD OF THE INVENTION**

**[0002]**This application relates to video encoding systems, preferably to methods for making coding decisions and estimating coding parameters for using in video coding standards, in particular, in High Efficiency Video Coding (HEVC) specifications for video compression.

**BACKGROUND OF THE INVENTION**

**[0003]**Video encoding is employed to convert an initial video sequence (a set of video images, also named pictures, or frames) into a corresponding encoded bitstream (a set of compressed video sequence binary data), and also converting video sequence binary data produced by a video codec system into a reconstructed video sequence (a decoded set of video images, or reconstructed frames). Most video coding standards are directed to provide the highest coding efficiency, which is the ability to encode a video sequence at the lowest bit rate while maintaining a certain level of video quality.

**[0004]**Most video sequences contain a significant amount of statistical and subjective redundancy within and between pictures that can be reduced by data compression techniques to make its size smaller. First the pictures in the video sequence are divided into blocks. The latest standard, the High Efficiency Video Coding (HEVC) uses blocks of up to 64×64 pixels and can sub-partition the picture into variable sized structures. HEVC initially divides a picture into coding tree units (CTUs), which are then divided into coding tree blocks (CTBs) for each luma/chroma component. The CTUs are further divided into coding units (CUs), which are then divided into prediction units (PUs) of either intra-picture or inter-picture prediction type. All modern video standards including HEVC use a hybrid approach to the video coding combining inter-/intra-picture prediction and 2D transform coding.

**[0005]**The intra-coding treats each picture individually, without reference to any other picture. HEVC specifies 33 directional modes for intra prediction, wherein the intra prediction modes use data from previously decoded neighboring prediction blocks. The prediction residual is the subject of Discrete Cosine Transform (DCT) and transform coefficient quantization.

**[0006]**The inter-coding is known to be used to exploit redundancy between moving pictures by using motion compensation (MC), which gives a higher compression factor than the intra-coding. According to known MC technique, successive pictures are compared and the shift of an area from one picture to the next is measured to produce motion vectors. Each block has its own motion vector which applies to the whole block. The vector from the previous picture is coded and vector differences are sent. Any discrepancies are eliminated by comparing the model with the actual picture. The codec sends the motion vectors and the discrepancies. The decoder does the inverse process, shifting the previous picture by the vectors and adding the discrepancies to produce the next picture. The quality of a reconstructed video sequence is measured as a total deviation of it's pixels from the initial video sequence.

**[0007]**In common video coding standards like H.264 and HEVC (High Efficiency Video Coding) intra predictions for texture blocks include angular (directional) intra predictions and non-angular intra predictions (usually, in DC intra prediction mode and Planar prediction mode). Angular intra prediction modes use a certain angle in such a way that for texture prediction the data of the neighboring block pixels is propagated to the block interior at such angle. Due to the sufficient amount of possible intra prediction angles (e.g. 33 in HEVC specification) the procedure of choosing the optimal intra prediction may become very complex: the most simple way of the intra prediction mode selection is calculating all the possible intra predictions and choosing the best one by SAD (Sum of Absolute Difference), Hadamard SAD, or RD (Rate Distortion) optimization criterion.

**[0008]**However, the computational complexity of this exhaustive search method grows for a large number of possible prediction angles. To avoid an exhaustive search, an optimal intra prediction selection procedure is important in the video encoding algorithms. Moreover, the nature of the modern block-based video coding standards is that they admit a large variety of coding methods and parameters for each texture block formation and coding. Accommodating such a need requires selecting an optimal coding mode and parameters of video encoding.

**[0009]**The HEVC coding standard, however, extends the complexity of motion estimation, since the large target resolution requires a high memory bandwidth; large blocks (up to 64×64) require a large local memory; an 8-taps interpolation filter provides for a high complexity search of sub-pixel; and 1/2 and 3/4 non-square block subdivisions require complex mode selection.

**SUMMARY**

**[0010]**The above needs and others are at least partially met through provision of the methods pertaining to selection of an optimal intra prediction mode and partitions, and to motion estimation for inter coding described in the following description.

**[0011]**Methods for choosing the optimal intra coding mode. The methods described by Algorithm 1 and Algorithm 2 set forth herein are used for reducing the set of possible optimal intra predictions (testing sets) in the HEVC algorithm. Algorithm 3 and Algorithm 4 as appear in the present application provide low complexity methods for associating the appropriate intra prediction angle with the texture block using the concept of Minimal Activity Direction. The present application also teaches an efficient method of selecting the optimal intra prediction mode which is provided by Algorithm 5. The method of choosing the best intra block subdivision in HEVC (Algorithm 6) is based on calculation of the Minimal Activity Directions.

**[0012]**Inter coding methods: calculation for fast motion estimation and optimal block partition. The HEVC specification assumes a huge number of options when texture partitioning into inter coded blocks, each of which can have its own motion vector for inter texture prediction. Choosing the optimal partitions and the optimal motion vector requires advanced methods for the texture motion estimation and analysis. The present application provides integral methods for texture motion analysis targeted for usage in the HEVC video coding. These methods include the motion analysis for all possible partitions of the entire Coding-Tree Unit (CTU) and yield the motion vectors for all those partitions together with the recommendations for texture inter coding partition. The motion analysis method for the partitions of the entire Coding Unit Tree is provided in the Algorithm 7 described herein, while Algorithm 8 (described below) provides the multi-pass motion vectors refinement and Algorithm 9 (also described below) provides local transform-based motion estimation.

**[0013]**The system is targeted mainly to the HEVC specifications for video compression. Those skilled in the art, however, will appreciate that most of the described algorithms (both for intra and inter coding) may be used in conjunction with other video coding standards as well.

**BRIEF DESCRIPTION OF THE DRAWINGS**

**[0014]**FIG. 1 shows a flow diagram of angular intra prediction directions in the HEVC specification.

**[0015]**FIG. 2 shows testing sets Q for intra-prediction according to Algorithm 2

**[0016]**FIGS. 3A-3B illustrate a Minimal Activity Directions concept.

**[0017]**FIG. 4 shows a flow diagram of calculating direction intra prediction mode using pre-calculated tables.

**[0018]**FIG. 5 shows a flow diagram of choosing the best intra mode using a minimal activity direction calculation.

**[0019]**FIG. 6 is a flow diagram showing preparation of a reduced resolution image.

**[0020]**FIG. 7 comprises a block diagram.

**DETAILED DESCRIPTION**

**[0021]**Generally speaking, pursuant to the following various embodiments, the encoding methods are directed to: searching for optimal angular prediction in an intra-prediction mode based on minimal activity directions; choosing the best intra block subdivision using minimal activity directions and strengths; and providing motion estimation for tree-structured inter coding of the HEVC specifications. Certain actions and/or steps may be described or depicted in a particular order of occurrence while those skilled in the art will understand that such specificity with respect to sequence is not actually required. The terms and expressions used herein have the ordinary technical meaning as is accorded to such terms and expressions by persons skilled in the technical field as set forth above except where different specific meanings have otherwise been set forth herein.

**[0022]**Presented below are the preferred embodiments (algorithms) for each of the methods. Though preferred, it will be understood that these embodiments are offered for illustrative purposes and without any intent to suggest any particular limitations in these regards by way of the details provided.

**Selection of Optimal Angular Intra Prediction Mode in Block**-Based Video Coding

**[0023]**These teachings are directed to simplify the way of choosing the best directional intra prediction modes in block-based video coding. By way of illustration, FIG. 1 depicts the intra-prediction directions as provided by the HEVC specification. However, the proposed method is not limited to HEVC and can be applicable with corresponding evident modifications to any set of the directional intra predictions.

**[0024]**The angular intra predictions corresponding to the directions in FIG. 1 are defined as P

_{0}, P

_{1}, . . . , P

_{32}, the corresponding angles as γ

_{0}, γ

_{1}, . . . γ

_{32}, and the planar and DC prediction mode as P

_{33}, P

_{34}, respectively. The prediction cost function R(P

_{j}) represents the best mode selection. It may be SAD function; Hadamard SAD function; Rate-Distortion-based cost function, and so forth. The smaller is the value of R(P

_{j}), the more preferable the prediction P

_{j}.

**[0025]**The intra predictions corresponding to the directions P

_{0}, P

_{1}, . . . , P

_{32}are represented by the following sets:

**[0026]**S

_{32}={P

_{16}};

**[0027]**S

_{16}={P

_{8}, P

_{24}};

**[0028]**S

_{8}={P

_{0}, P

_{8}, P

_{16}, P

_{24}, P

_{32}};

**[0029]**S

_{4}={P

_{0}, P

_{4}, P

_{8}, P

_{12}, P

_{16}, P

_{20}, P

_{24}, P

_{28}, P

_{32}},

**[0030]**S

_{2}={P

_{0}, P

_{2}, P

_{4}, P

_{6}, P

_{8}, P

_{10}, P

_{12}, P

_{14}, P

_{16}, P

_{18}, P

_{20}, P

_{22}, P

_{24}, P

_{26}, P

_{28}, P

_{30}, P

_{32}}.

**[0031]**One efficient way to significantly restrict the number of checked intra predictions is to use a logarithmic search inside a set of intra prediction directions. One corresponding method, which is described by Algorithm 1, comprises:

**[0032]**(i) selecting a starting set of intra prediction directions, a value L .di-elect cons. {32, 16, 8, 4, 2} and a cost function R(P

_{K}), depending on the desired speed and coding quality, where K is the index of this intra prediction;

**[0033]**(ii) from the set S

_{L}, finding an intra prediction providing the minimal value of the cost function R(P);

**[0034]**(iii) finding an intra prediction which minimizes the value of R(P) over P .di-elect cons. {P

_{K}, P

_{K}-L/2, P

_{K}+L/2};

**[0035]**(iv) setting a threshold T

_{0}, which is a pre-defined parameter depending on a desired speed, quality, block size, and so forth;

**[0036]**if K=2, or R(P

_{K})<T

_{0}, going to the next step; otherwise, performing step (iii) for L=L/2;

**[0037]**(v) if K=2, selecting an optimal intra prediction from a set {P

_{K}, P

_{K}-1, P

_{K}+1, P

_{33}, P

_{34}} as a prediction minimizing the value R(P); otherwise the optimal intra prediction is R(P

_{K}).

**[0038]**Another approach to efficiently restricting the search is initially checking a small number of intra predictions, and constructing the testing set of the intra prediction angles around the best angle from the initial subset. This approach can significantly reduce the number of tests and is described below as Algorithm 2:

**[0039]**select an initial set {P

_{0}, P

_{8}, P

_{16}P

_{24}, P

_{32}} for finding an intra prediction P

_{K}minimizing the value of cost function R(P), wherein K is the index of this intra prediction;

**[0040]**set a threshold T

_{0}, which is a pre-defined parameter of the method depending on desired speed, quality, block size, and so forth;

**[0041]**if R(P

_{K})<T

_{0}, the optimal prediction is P

_{K}, and no further action is required;

**[0042]**if R(P

_{K})≧T

_{0}, proceed to test the following sets of intra predictions:

**[0043]**Q

_{0}={P

_{32}, P

_{0}, P

_{1}, P

_{2}, P

_{3}, P

_{5}, P

_{6}};

**[0044]**Q

_{8}-={P

_{4}, P

_{5}, P

_{6}, P

_{7}, P

_{8}, P

_{9}, P

_{10}};

**[0045]**Q

_{8}+={P

_{6}, P

_{7}, P

_{8}, P

_{9}, P

_{10}, P

_{11}, P

_{12}};

**[0046]**Q

_{16}-={P

_{12}, P

_{13}, P

_{14}, P

_{15}, P

_{16}, P

_{18}, P

_{19}};

**[0047]**Q

_{16}+={P

_{14}, P

_{15}, P

_{16}, P

_{17}, P

_{18}, P

_{19}, P

_{20}};

**[0048]**Q

_{24}-={P

_{20}, P

_{21}, P

_{22}, P

_{23}, P

_{24}, P

_{25}, P

_{26}};

**[0049]**Q

_{24}+={P

_{22}, P

_{23}, P

_{24}, P

_{25}, P

_{26}, P

_{27}, P

_{28}};

**[0050]**Q

_{32}={P

_{0}, P

_{27}, P

_{28}, P

_{29}, P

_{30}, P

_{31}, P

_{32}}.

**[0051]**choose the intra prediction set Q according to the following requirements:

**[0052]**if K=0 or K=32, the intra prediction set Q=Q

_{K};

**[0053]**if K≠0 and K≠32, then:

**[0054]**if R(P

_{K}-8)<R(P

_{K}+8), Q=Q

_{K}, and

**[0055]**if R(P

_{K}-8)≧R(P

_{K}+8); Q=Q

_{K}+; and

**[0056]**find the optimal intra prediction from the set Q=Q

_{K}∪ {P

_{33}, P

_{34}}, as the one minimizing the value of R(P).

**[0057]**Accordingly, the present method significantly reduces the number of intra predictions to be checked. The sets Q

_{0}, Q

_{8}-, Q

_{8}+, Q

_{16}-, Q

_{16}-, Q

_{24}-, Q

_{24}+, Q

_{32}may also be constructed as some subsets of those defined above according to the desired speed, quality, or other measure of interest.

**Method of Choosing a Best Intra Prediction Mode Based on Texture Gradient**Analysis

**[0058]**These teachings are based on analyzing the distribution of texture gradients inside a texture block and on its reconstructed boundaries. It is based on a concept of Minimal Activity Direction (MAD) introduced in this description. A minimal activity direction is defined herein as a direction inside the area S in which the variation of a function P(x, y) is minimal. In particular, if the function P(x, y) represents the pixel brightness values of N×M picture, the minimal activity direction of the picture area is the direction of the most noticeable boundaries and lines inside a selected area S. The greater is the minimal activity direction strength, the brighter the corresponding line over the background. If the area S consists of a single point, the minimal activity direction is just the direction orthogonal to the gradient vector at this point.

**[0059]**FIGS. 3A and 3B illustrate the concept of minimal activity direction. FIG. 3A illustrates the minimal activity direction for optimal intra prediction: FIG. 3A (a) shows the initial block; 3A (b)--the gradient vector g and minimal activity direction o for a single point; 3A (c)--the minimal activity directions for the whole block. In FIG. 3B the picture is divided into 16×16 blocks, and the minimal activity directions are drawn for all of them for the case of equal weights W. Therefore, the minimal activity directions may be used in selection of the optimal intra prediction.

**[0060]**In this section some auxiliary terms and notations are provided.

**[0061]**Let's introduce the following notations:

**[0062]**P(x, y) is a discrete function of two arguments defined at the rectangular set of integer pairs R={ 0,N-1}×{ 0,M-1};

**[0063]**S is a set of integer coordinate pairs (x, y); S .OR right. R;

**[0064]**W(x, y) is a set of non-negative weight coefficients defined at (x, y) .di-elect cons. S (in the simplest case, the value of non-negative weight W(x, y) may be chosen to be equal to 1);

**[0065]**D

_{x}(x, y)=(P(x+1, y)-P(x-1, y))/2 ; and

**[0066]**D

_{y}(x, y)=(P(x, y+1)-P(x, y-1))/2 ; where D

_{x}(x, y) is any measure of P(x, y) function variation with respect to the first argument, and D

_{y}(x, y) is any measure of P(x, y) function variation with respect to the second argument in the neighborhood of the (x, y) point.

**[0067]**Let's assume that ΣW(x, y)D

_{x}

^{2}(x, y)+ΣW(x, y)D

_{y}

^{2}(x, y)≠0 and find a minimal activity direction defined by a vector (α(S,W), β(S,W)), which will be the solution of the following minimization problem:

**( x , y ) .di-elect cons. S W ( x , y ) ( α D X ( x , y ) + β D Y ( x , y ) ) 2 → α , β min ##EQU00001##**

**wherein**α

^{2}+β

^{2}=1.

**[0068]**Similarly, the minimal activity angle φ(S,W) can be found by solving the following minimization problem:

**( x , y ) .di-elect cons. S W ( x , y ) ( cos ( Φ ) D X ( x , y ) + sin ( Φ ) D Y ( x , y ) ) 2 → α , β min ##EQU00002##**

**wherein**α=cos(φ) and β=sin(φ).

**[0069]**The solution (α(S,W), β(S,W))of the problem above is defined up to a certain precision, and the corresponding angle φ is defined up to a multiple of π. The corresponding angle φ can be calculated from (α(S,W), β(S,W)) for example as φ(S,W) 32 arc cos(α(S,W)).

**[0070]**The direction defined by the vector (α(S,W), β(S,W)) or by the angle φ(S,W) is referred to herein as the minimal activity direction.

**Calculating an Angular Intra Mode Defined by Minimal Activity Direction**

**[0071]**For present purposes on may define the angular intra prediction modes as {P

_{0}, P

_{1}, . . . , P

_{T}-1}, and the corresponding prediction angles as {γ

_{0}, γ

_{1}, . . . , γ

_{T}-1}. Using the minimal activity direction as defined above, one can calculate the following functions for a texture block B, where S is a spatial area which may coincide with B or include I, as follows:

**E**= ( ( x , y ) .di-elect cons. S W ( x , y ) D X 2 ( x , y ) - ( x , y ) .di-elect cons. S W ( x , y ) D Y 2 ( x , y ) ) , F = ( x , y ) .di-elect cons. S W ( x , y ) D X ( x , y ) D Y ( x , y ) , A = E 2 E 2 + 4 F 2 ##EQU00003##

**[0072]**The calculations will be considered separately for the following four cases:

**[0073]**1. E≦0 and F<0;

**[0074]**2. E>0 and F<0;

**[0075]**3. E≧0 and F≧0; and

**[0076]**4. E<0 and F≧0.

**[0077]**It can be seen that the above four cases correspond to the following intervals of the angle φ(S,W) values: [0; π/4], [π/4, π/2], [π/2, 3π/4] and [3π/4, π], respectively.

**[0078]**Algorithm 3. By this approach, the angular intra prediction modes can be calculated using the signs of E and F and the value of the ratio

**E F or F E**. ##EQU00004##

**Using this approach**, one can define the case number j= 1,4 according to the values of E and F as described above.

**[0079]**The method comprises:

**[0080]**for each case, calculating the minimal activity direction (α(S,W), β(S,W)) as follows:

**[0081]**1. For E≦0 and F<0:

**( α ( S , W ) β ( S , W ) ) = ( ( 1 + A ) / 2 ( 1 - A ) / 2 ) ##EQU00005##**

**[0082]**2. For E>0 and F<0:

**( α ( S , W ) β ( S , W ) ) = ( ( 1 - A ) / 2 ( 1 + A ) / 2 ) ##EQU00006##**

**[0083]**3. For E≧0 and F≧0:

**( α ( S , W ) β ( S , W ) ) = ( - ( 1 - A ) / 2 ( 1 + A ) / 2 ) ##EQU00007##**

**[0084]**4. For E<0 and F≧0:

**( α ( S , W ) β ( S , W ) ) = ( - ( 1 + A ) / 2 ( 1 - A ) / 2 ) ##EQU00008##**

**[0085]**calculating the corresponding angle φ(S,W) .di-elect cons. [0; π] as φ(S,W)=arc cos(α(S,W));

**[0086]**finding γ

_{k}.di-elect cons. {γ

_{0}, γ

_{1}, . . . , γ

_{T}-1} as intra prediction angle closest to the calculated minimal activity angle φ(S,W); and

**[0087]**choosing P

_{k}as the intra prediction mode defined by the minimal activity direction calculated above.

**[0088]**Algorithm 4. FIG. 4 shows another approach, in which an approximate calculation of the minimal activity directions and the corresponding angular intra prediction mode is performed using pre-calculated tables. This method comprises:

**[0089]**considering some sufficiently large integers K and L defining the accuracy of the calculations (for example, both equal to 256);

**[0090]**pre-calculating constant integer array AngleToMode[ ] of the size K+1 providing the correspondence between a prediction angle φ .di-elect cons. [0; π] and a prediction mode index P in the following way:

**[0090]**AngleToMode[round(Kφ/π]=P

_{k},

**wherein round**(x) means rounding x to the closest integer;

**[0091]**pre-calculating for each j= 1,4 four tables RatioToAngleDirect[j][] of the size L+1 providing the correspondence between the ratio |E/F|.di-elect cons.[0;1] and the prediction angle φ.di-elect cons.[0;π] in the following way:

**[0091]**RatioToAngleDirect[j][ round(L|E/F|)]=round(Kφ/π), wherein φ.di-elect cons.[0;π];

**[0092]**pre-calculating for each j= 1,4 four tables RatioToAngleInverse[j][ ] of the size L+1 providing the correspondence between the ratio |F/E|.di-elect cons.[0;1] and the prediction angle φ.di-elect cons.[0;π] in the following way:

**[0092]**RatioToAngleInverse[j][ round(L|F/E|)]=round(Kφ/π), where φ/π[0;π];

**[0093]**calculating the values E and F as described above;

**[0094]**choosing the case number j= 1,4 according to the signs of E and F:

**[0095]**if |E/F|.di-elect cons.[0;1], calculating the prediction mode P

_{k}defined by the minimal activity direction as:

**[0095]**P

_{k}=AngleToMode[RatioToAngleDirect[j][round(L|E/F|)]];

**[0096]**if |F/E|.di-elect cons.[0;1], calculate the prediction mode P

_{k}defined by the minimal activity direction as:

**[0096]**P

_{k}=AngleToMode[RatioToAngleInverse[j][round(L|F/E|)]].

**[0097]**The tables RatioToAngleDirect and RatioToAngleInverse may be pre-calculated using explicit expressions for the minimal activity directions given above in this section.

**Minimal Activity Direction Strengths**

**[0098]**These teachings contemplate a set of the following values as the strength of the minimal activity direction defined by (α, β), where α

^{2}+β

^{2}=1:

**C**1 ( α , β , S , W ) = ( x , y ) .di-elect cons. S W ( x , y ) ( - β D X ( x , y ) + α D Y ( x , y ) ) 2 ( x , y ) .di-elect cons. S W ( x , y ) , C 2 ( α , β , S , W ) = ( x , y ) .di-elect cons. S W ( x , y ) ( - β D X ( x , y ) + α D Y ( x , y ) ) 2 ( x , y ) .di-elect cons. S W ( x , y ) ( α D X ( x , y ) + β D Y ( x , y ) ) 2 ##EQU00009##

**[0099]**If (α, β) defines the minimal activity direction for the block B with weights W, then the corresponding values of C

_{1}, C

_{2}will be denoted simply as C

_{1}(B,W), C

_{2}(B,W) and will be called the minimal activity direction (MAD) strengths.

**Simplifying the Optimal Intra Predictions Selection**

**[0100]**A related video coding problem is to select the optimal intra prediction from a set of angular intra predictions for angles γ

_{0}, γ

_{1}. . . γ

_{T}-1 (enumerated monotonically clockwise or counterclockwise) as well as from DC and Planar predictions. A known most simple way to solve this problem is to calculate all possible intra predictions and choose the best mode by SAD, HAD or RD optimization criterion. These teachings provide a way of minimizing the number of intra predictions that need to be checked explicitly.

**[0101]**Algorithm 5. FIG. 5 shows a flow diagram for a method of simplified selection of optimal intra prediction using the concept of minimal activity direction strength as introduced above. The method comprises:

**[0102]**choosing a texture block B of the size L×L starting from pixel with coordinates (x, y), for which the intra prediction is to be selected;

**[0103]**choosing a spatial area S including block B, wherein in the simplest case S may coincide with B;

**[0104]**choosing the weights matrix for S, wherein in the simplest case all the weights w(j,k)=1;

**[0105]**calculating the minimal activity direction and intra prediction mode m

_{k}defined by this direction as described above;

**[0106]**defining a set Q of intra predictions to be checked for the optimal intra prediction selection as one including angular prediction m

_{k}, non-angular predictions (Planar prediction and/or DC prediction) and, optionally, some angular prediction modes corresponding to the angles neighboring to that defined by the mode P

_{k};

**[0107]**defining constants X

_{1}, X

_{2}, X

_{3}for parameters selected according to the desired speed and quality of the method;

**[0108]**if the MAD strength C

_{1}({tilde over (B)}, )<X

_{1}, the angular predictions for the angles γ

_{k}, γ

_{k}1, γ

_{k+1}may be excluded from the set Q; and

**[0109]**if C

_{1}({tilde over (B)},W)>X

_{2}and C

_{2}({tilde over (B)},W)<X

_{3}, the DC and planar predictions may be excluded from the set Q; and

**[0110]**selecting the optimal intra prediction from the remaining set by a simple explicit check.

**Choosing a Best Intra Block Size Based on Minimal Activity Directions and**Strengths

**[0111]**Here one may select an intra block B of the size L×L starting from a pixel with coordinates (x, y) that can be predicted by the angular intra prediction for angles γ

_{0}, γ

_{1}. . . γ

_{T}-1 (enumerated monotonically clockwise or counterclockwise) and also by DC and Planar predictions. Instead of using L×L intra prediction, the block B may be divided into 4 sub-blocks B

_{j}of the size

**L**2 × L 2 , ##EQU00010##

**where j**.di-elect cons.[0,4], and each of these four blocks may be also intra predicted by an intra prediction from the same set of intra predictions. For the sake of an example, let's consider a problem of selecting the optimal block size between one whole block or a sub-block constructed by subdivision of the block into four sub-blocks.

**[0112]**The obvious solution for this problem is the exhaustive testing of all the possible options: all the admissible intra predictions for the block B, all the admissible intra predictions for the sub-blocks B

_{j}, and then choosing the block best size by SAD or RD-optimization based criterion. It is also obvious that the computational complexity of this method is very high.

**[0113]**The present teachings are based on the concept of the minimal activity directions and are directed to simplify the method of choosing the best subdivision of a texture block into intra blocks.

**[0114]**Algorithm 6. The method comprises:

**[0115]**considering a texture block B of the size L×L starting from a pixel with coordinates (x, y), and its sub-blocks B

_{j}, j .di-elect cons.[0,4] of the size

**[0115]**L 2 × L 2 ##EQU00011##

**starting from pixels with coordinates**(x, y),

**( x + L 2 , y ) , ( x , y + L 2 ) , ( x + L 2 , y + L 2 ) , ##EQU00012##**

**respectively**;

**[0116]**constructing a spatial area S including the block B and the spatial areas S

_{j}including blocks B

_{j}, wherein in the simplest case S may coincide with B and S

_{j}may coincide with B

_{j};

**[0117]**calculating the minimal activity direction angles φ({tilde over (B)},W) , φ({tilde over (B)}

_{j},W), wherein α({tilde over (B)},W)=cos(φ({tilde over (B)},W)), β({tilde over (B)},W)=sin(φ({tilde over (B)},W));

**[0118]**calculating functions of minimal activity direction (MAD) strength C

_{1}({tilde over (B)},W) C

_{2}({tilde over (B)},W), C

_{1}(α({tilde over (B)},W), β({tilde over (B)},W), {tilde over (B)}

_{j},W), C

_{2}(α({tilde over (B)},W), β({tilde over (B)}, W), {tilde over (B)}

_{j},W) where j .di-elect cons.[0,4]; and

**[0119]**selecting a single L×L block as the best size, if the MAD strengths for all j .di-elect cons.[0,4] are:

**[0119]**C

_{1}(α({tilde over (B)},W), β({tilde over (B)},W), {tilde over (B)}

_{j},W)<λ

_{1}+μ

_{1}C

_{1}({tilde over (B)},W), and

**C**

_{2}(α({tilde over (B)},W), β({tilde over (B)},W), {tilde over (B)}

_{j},W)<λ

_{2}+μ

_{2}C

_{2}({tilde over (B)},W),

**wherein**λ

_{1}, μ

_{1}, λ

_{2}, μ

_{2}are pre-defined parameters of the encoding selected according to the desired speed and quality of the method;

**[0120]**otherwise, selecting the size as a sub-division of block B into four

**[0120]**L 2 × L 2 ##EQU00013##

**blocks**.

**Hierarchical Multi**-Level Motion Estimation for Tree-Structured Inter Coding

**[0121]**The proposed methods are directed to reducing the complexity of the HEVC standard video coding without degrading the coding quality.

**[0122]**According to these teachings, the motion estimation starts from the largest block size allowed for the current frame and covers all the possible smaller block sizes in a single estimation process. The method uses a reduced resolution search in a motion estimation scheme based on Algorithm 7 (described below) with only one base motion vector field, wherein the interpolation is used only at the latest stage of motion estimation.

**Motion Estimation Suitable for HEVC encoding**

**[0123]**The present method chooses a block size 16×16 as a base block for motion estimation in HEVC encoding, because blocks 4×4 and 8×8 are too small and can introduce an error motion, and blocks 32×32 are too large and can introduce an averaging motion error.

**[0124]**The following proposed method of motion estimation may be used under the HEVC standard.

**[0125]**Algorithm 7.

**[0126]**1. Prepare a reduced resolution image;

**[0127]**2. Perform a reduced resolution search for blocks 64×64;

**[0128]**3. Perform refinement by neighboring blocks;

**[0129]**4. Provide a motion assignment for 16×16 blocks using neighboring blocks;

**[0130]**5. Perform a refinement search for 16×16 blocks;

**[0131]**6. Prepare error distribution (ED) analysis information for split-merge prediction and non-square block selection;

**[0132]**7. Perform a sub-pixel refinement (without assigning vectors);

**[0133]**8. Divide 16×16 blocks into 8×8 blocks;

**[0134]**9. Merge four 16×16 blocks into one 32×32 partition;

**[0135]**10. Merge four 32×32 blocks into one 64×64 partition;

**[0136]**11. Provide a non-square block prediction using the ED field; and

**[0137]**12. Assign quarter-pel to a selected decision.

**[0138]**The following approaches are used to optimize the proposed motion estimation method.

**[0139]**The reduced resolution search, which represents one step in a hierarchical search, is performed using reduced frames by four in both directions (X and Y), and performing reduced resolution search by blocks 16×16 using reduced frames in order to obtain motion for 64×64 blocks in the original frames.

**[0140]**A high quality motion vector field is prepared using Algorithm 8 (described below) for a multi-pass motion vector field refinement in order to obtain a very smooth and regular motion.

**[0141]**A fast motion search may be used in two stages of motion estimation by employing Algorithm 9 (described below) for integer motion estimation using non-parametric local transform.

**[0142]**A motion assignment for 16×16 blocks is performed using non-parametric local transform.

**[0143]**A problem of sub-dividing non-square blocks is herein solved by Algorithm 10 (described below) for choosing between splitting and merging certain blocks using error-distribution analysis.

**[0144]**The entire motion estimation is performed using interger-pel at all stages, and only after a decision is made, it may be refined to quarter-pel.

**Multi**-Pass Motion Vector Field Refinement

**[0145]**Algorithm 8. After the motion estimation for a reduced resolution picture is completed, a method of refinement is proposed to make motion field more accurate, regular and smooth. This method comprises:

**[0146]**selecting a threshold T as a desired percent of all blocks in the picture;

**[0147]**setting a variable count C=0;

**[0148]**for every block in the picture:

**[0149]**using motion vectors of eight neighbor blocks as candidate motion vectors;

**[0150]**selecting a best motion vector MV by comparing SADs (sums of absolute difference) or any other distance metric; and

**[0151]**if the vector has changed, incrementing variable count C; and

**[0152]**if C<T, repeating the step of setting the count C.

**[0153]**This process can be performed multiple times before the number of motion vectors changed during a next pass is more than a selected threshold T.

**Non**-Parametric Local Transform Based Motion Estimation

**[0154]**Algorithm 9. In performing steps (2) and (4) of Algorithm 7, it is necessary to find motion vectors in small reference frame area. Typically, the area is ±16 pixels. For such purpose one may perform a traditional block-matching procedure by calculating SAD (sum of absolute difference) or another distance metric for all possible positions. This process is very complex and requires an extended memory bandwidth.

**[0155]**However, using a proposed combination of simple filters and vector operations, the motion estimation may be performed without a need of actual block-matching process. In general, any suitable non-parametric local transform may be used as a base of the proposed motion estimation approach.

**[0156]**According to one embodiment, the Census transform is used as a base for algorithm description. The Census transform is a form of non-parametric local transform that relies on the relative ordering of local intensity values, and not on the intensity values themselves. This transform is usually used in image processing to map the intensity values of the pixels within a square window to a bit string, thereby capturing the image structure. The intensity value of a center pixel is replaced by the bit string composed of a set of Boolean comparisons in a square window moving left to right.

**[0157]**Accordingly, a new value of a center pixel (A') calculated as a sum of bits is:

**A**'=(A<Z

_{i})*2

^{1},

**where A is a previous value of center pixel**; and Z

_{i}represents the values of the neighboring pixels.

**[0158]**The Census-transformed image is used to find the correlation of pixels of the original block with the reference pixel area.

**[0159]**The proposed motion estimation algorithm may be divided into several stages:

**[0160]**1. Performing Census transform for every input frame (gray, 8 bit/pixel);

**[0161]**2. Splitting a frame into 16×16 blocks and representing it as a 256-bytes vector (M);

**[0162]**3. Preparing a new 256-bytes vector (B), where at each position addressed by value from vector (A), its actual position in vector (A) is placed (index).

**[0163]**4. Preparing a correlation surface filled with zeroes (32×32 bytes);

**[0164]**5. Subtracting element-by-element vector (A) from vector (B);

**[0165]**6. Returning into the two-dimensional space and incrementing points of the correlation surface at position given by a resulted vector (B');

**[0166]**7. Finding a maximum on the correlation surface, which requires a motion vector in full-pels; and

**[0167]**8. Interpolating a sub-pixel value using neighbor values on the correlation surface.

**Error Distribution Analysis**

**[0168]**Algorithm 10. After the actual search is done, for every block 8×8 one can calculate the appropriate SAD. For every block 64×64 pixels one has 8×8 block of SADs which can be referred to as Error Distribution Block (EDB). These teachings use the EDB concept for optimization of Split-Merge decisions.

**[0169]**The method of SPLIT decision optimization comprises:

**[0170]**declaring SplitThreshold as a desired level of SPLIT sensitivity (in percents);

**[0171]**calculating average SAD of the whole EDB;

**[0172]**if any SAD in EDB differs from a calculated average SAD more than the SplitThreshold, marking said block as a SPLIT candidate; and

**[0173]**performing an additional refinement search for every block marked as SPLIT candidate.

**[0174]**The method of MERGE decision optimization comprises:

**[0175]**declaring a MergeThreshold as a desired level of MERGE sensitivity (in percents);

**[0176]**preparing an EDB pyramid based on averaging 2×2 block of SADs at each level, wherein the pyramid comprises:

**[0177]**Level 0: an original EDB of 8×8 SADs;

**[0178]**Level 1: averaged once 4×4 SADs;

**[0179]**Level 2: averaged twice 2×2 SADs; and

**[0180]**Level 3: one averaged SAD.

**[0181]**at every level from 1 to 3, examining four correspondence SADs to check MERGE flag;

**[0182]**if all four SADs differ from lower level SAD no more than MergeThreshold, marking this block as a MERGE candidate;

**[0183]**performing a MERGE check for every block marked as MERGE candidate by substituting four small blocks with one large block.

**Reduced Resolution Image Preparation**

**[0184]**Algorithm 11. FIG. 6 illustrates the preparation of a reduced resolution image according to Algorithm 11. Every block 64×64 is represented as a 16×16 block. A shifted Gaussian filter is used herein for the reduced image preparation. Every pixel in reduced image (Zx/4,y/4) is calculated as a weighted sum of pixels in the original picture O

_{x,y}:

**Z**

_{x}/4,y/4=(O

_{x,y}+2*O

_{x}+1,y+O

_{x}+2y+2*O

_{x,y}+1'4*O

_{x}+1,y+1+2*O

_{x}+2,y+1+O

_{x,y}+2+2*O

_{x}-1,y+2+O

_{x}-2,y+2)/16

**[0185]**This filter reduces computational complexity and provides better encoding quality by reducing the averaging effect as compared with traditional techniques (Simple Averaging, Gaussian Pyramid, and so forth).

**[0186]**Based on the above Algorithms 8-11, the following approach to Motion Estimation for Inter Coding is proposed:

**[0187]**preparing a reduced resolution image using Algorithm 11;

**[0188]**performing a reduced resolution search for blocks 64×64, preferably using Algorithm 9;

**[0189]**performing a refinement by neighboring blocks, preferably using Algorithm 8;

**[0190]**providing a motion assignment for 16×16 blocks using neighboring blocks;

**[0191]**performing a refinement search for 16×16 blocks, preferably using Algorithm 9;

**[0192]**preparing an error distribution (ED) analysis information for split-merge prediction and non-square block selection, preferably using Algorithm 10;

**[0193]**performing a sub-pixel refinement (without assigning vectors);

**[0194]**splitting 16×16 blocks into 8×8 blocks;

**[0195]**merging four 16×16 blocks into one 32×32 partition using Algorithm 10;

**[0196]**merging four 32×32 blocks into one 64×64 partition using Algorithm 10;

**[0197]**providing non-square block prediction using ED field according to Algorithm 10; and

**[0198]**assigning quarter-pel to a selected decision.

**[0199]**In a typical application setting, and referring now to FIG. 7, the various algorithms, steps, actions, and the like described herein can be carried out by a corresponding control circuit 701. Such a control circuit 701 can comprise a fixed-purpose hard-wired platform or can comprise a partially or wholly programmable platform. These architectural options are well known and understood in the art and require no further description here. This control circuit 701 is configured (for example, by using corresponding programming as will be well understood by those skilled in the art) to carry out one or more of the steps, actions, and/or functions described herein.

**[0200]**By one approach this control circuit 701 operably couples to a memory 702. This memory 702 may be integral to the control circuit 701 or can be physically discrete (in whole or in part) from the control circuit 701 as desired. This memory 702 can also be local with respect to the control circuit 701 (where, for example, both share a common circuit board, chassis, power supply, and/or housing) or can be partially or wholly remote with respect to the control circuit 701 (where, for example, the memory 702 is physically located in another facility, metropolitan area, or even country as compared to the control circuit 701).

**[0201]**This memory 702 can serve, for example, to non-transitorily store the computer instructions that, when executed by the control circuit 701, cause the control circuit 701 to behave as described herein. (As used herein, this reference to "non-transitorily" will be understood to refer to a non-ephemeral state for the stored contents (and hence excludes when the stored contents merely constitute signals or waves) rather than volatility of the storage media itself and hence includes both non-volatile memory (such as read-only memory (ROM) as well as volatile memory (such as an erasable programmable read-only memory (EPROM).)

**[0202]**The control circuit 701 can also operably couple, if desired, to a corresponding display 703 that can serve, for example, to depict the processed results as accord with these teachings.

**[0203]**The preceding description is intended to be illustrative of the principles of the invention, and it will be appreciated that numerous changes and modifications may occur to those skilled in the art, and it is intended in the appended claims to cover all those changes and modifications which fall within the true spirit and scope of the present invention.

User Contributions:

Comment about this patent or add new information about this topic: