The present invention relates to video coding and decoding technologies, and in particular to a pixel prediction method and apparatus in the video coding and decoding technologies.
BACKGROUND
A basic principle of video coding compression is to reduce redundancy to the maximum by using correlations between a space domain, a time domain, and a code word. Currently, a popular method is to use a block-based hybrid video coding framework. That is, at a coding end to video coding compression is implemented through steps such as prediction, transformation, quantization, and entropy coding, and at a decoding end, these steps are performed correspondingly to restore a pixel value of the image.
Before the prediction is performed, an image needs to be divided into multiple sub-image blocks, and then the prediction is performed by taking these sub-image blocks as units. In the industry, these sub-image blocks are generally square. However, with the development of technologies, the industry gradually has proposed a method for dividing an image block into multiple rectangles. Dividing an image into rectangles may meet a special requirement for image block coding to a certain degree, but no prediction method that adapts to this new dividing method has emerged.
An embodiment of the present invention provides a pixel prediction method, including:
obtaining an average pixel value of reference pixel points on a long side of a current block if the current block is rectangular and coded or decoded adjacent blocks of the current block are all available, where the reference pixel points are all located at boundaries of the adjacent blocks near the current block; and
obtaining a prediction pixel value of the current block according to the average pixel value of the reference pixel points on the long side.
An embodiment of the present invention further provides a pixel prediction apparatus that uses the pixel prediction method, including:
a reference pixel value obtaining module, configured to obtain an average pixel value of reference pixel points on a long side of a current block if the current block is rectangular and coded or decoded adjacent blocks of the current block are all available, where the reference pixel points are all located at boundaries of the adjacent blocks near the current block; and
a prediction pixel value obtaining module, configured to obtain a prediction pixel value of the current block according to the average pixel value of the reference pixel points on the long side.
According to the pixel prediction method and apparatus provided in the embodiments of the present invention, a prediction pixel is obtained from corresponding adjacent blocks according to a shape of the current block, meeting a pixel distribution rule.
To illustrate the technical solutions in the embodiments of the present invention more clearly, the following briefly introduces the accompanying drawings required for describing the embodiments.
The technical solution in the embodiments of the present invention will be clearly and described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are merely a part rather than all of the embodiments of the present invention. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
Referring to
Step 101: Obtain an average pixel value of reference pixel points that are located on a long side of a current block, if the current block is rectangular and coded or decoded adjacent blocks of the current block are all available.
The reference pixels are all located at boundaries of the adjacent blocks near the current block.
It should be understood that one or more adjacent blocks may exist on one side of the current block and multiple reference pixel points may be arranged in each adjacent block.
Step 102: Obtain a prediction pixel value of the current block according to the average pixel value of the reference pixel points on the long side.
In the embodiment of the present invention, the obtaining a prediction pixel value of the current block according to the average pixel value of the reference pixel points on the long side includes taking the average pixel value of the reference pixel points on the long side as the prediction pixel value of the current block, or taking the average pixel value of the reference pixel points on the long side as a prediction pixel value of all the pixel points on the current block. Specifically, the prediction pixel value of the current block is obtained according to the formula
where DC is the prediction pixel value of the current block, n is the number of the reference pixel points on the long side, and Pi indicates a pixel value of an ith reference pixel point among the reference pixel points on the long side.
Referring to
Referring to
Step 301a: Obtain an average pixel value of reference pixel points on a short side of the current block.
In the embodiment of the present invention, the obtaining an average pixel value of reference pixel points on a long side of the current block further includes:
Step 302a: Take an average value of the average pixel value of the reference pixel points on the long side and the average pixel value of the reference pixel points on the short side as a prediction pixel value of all pixels of the current block.
Specifically, the prediction pixel value of the current block is calculated according to the formula
where DC is the prediction pixel value of the current block, n is the number of the reference pixel points adjacent to the long side of the current block, Pi indicates a pixel value of an ith reference pixel point adjacent to the long side of the current block, m indicates the number of the reference pixel points adjacent to the short side of the current block, and Qj indicates a pixel value of a jth reference pixel point adjacent to the short side of the current block.
In the embodiment of the present invention, the average value of the reference pixel points adjacent to the long side and the short side of the current block is taken as the prediction pixel value of the current block, so that prediction pixel values in an image block are distributed more evenly and transformation in each direction will not be too abrupt.
It should be noted that in the pixel prediction method provided in the embodiment of the present invention, when an adjacent block is available, a pixel value of a reference pixel point is taken as a reference pixel value; when the adjacent block is unavailable, a fixed value is directly filled into the reference pixel point as the reference pixel value.
a reference pixel value obtaining module 401, configured to obtain an average pixel value of reference pixel points on a long side of a current block if the current block is rectangular and coded or decoded adjacent blocks of the current block are all available, where the reference pixel points are all located at boundaries of the adjacent blocks near the current block; and
a prediction pixel value obtaining module 402, configured to obtain a prediction pixel value of the current block according to the average pixel value of the reference pixel points on the long side of the current block.
In the embodiment of the present invention, the prediction pixel value of the current block is obtained according to the formula
where DC is the prediction pixel value of the current block, n is the number of the reference pixel points on the long side, and Pi indicates a pixel value of an ith reference pixel point among the reference pixel points on the long side.
In an optional embodiment of the present invention, the reference pixel value obtaining module 401 is further configured to, if the current block is rectangular and the coded or decoded adjacent blocks of the current block are all available, obtain an average pixel value of reference pixel points on a short side of the current block. Accordingly, the prediction pixel value obtaining module is configured to take an average value of the average pixel value of the reference pixel points on the long side and the average pixel value of the reference pixel points on the short side as the prediction pixel value of the current block or a prediction pixel value of all pixel points of the current block, that is, to obtain the prediction pixel value of the current block according to the formula
where DC is the prediction pixel value of the current block, n is the number of the reference pixel points on the long side, Pi indicates the pixel value of the ith reference pixel point among the reference pixel points on the long side, m is the number of the reference pixel points on the short side, and Qj indicates a pixel value of a jth reference pixel point among the reference pixel points on the short side.
Through the description of the preceding embodiments, a person skilled in the art may clearly understand that the present invention may be implemented by software plus a necessary universal hardware platform, and definitely may also be implemented by hardware, but in most cases, the former is a preferred implementation manner. Based on such understanding, the technical solutions of the present invention essentially, or the part contributing to the prior art may be implemented in the form of a software product. The computer software product is stored in a storage medium, such as a ROM/RAM, a magnetic disk, or an optical disk, and includes several instructions for instructing a computer device (which may be a personal computer, a server, a network device, or the like) to execute the methods described in the embodiments of the present invention or in some parts of the embodiments.
The foregoing describes exemplary embodiments of the present invention. It should be pointed that a person skilled in the art may make several improvements and modifications without departing from the principle of the present invention, and these improvements and modifications shall fall within the protection scope of the present invention.
Number | Date | Country | Kind |
---|---|---|---|
201110184370.1 | Jul 2011 | CN | national |
This application is a continuation of International Patent Application No. PCT/CN2012/078058, filed on Jul. 2, 2012, which claims priority to Chinese Patent Application No. 201110184370.1, filed on Jul. 1, 2011, both of which are hereby incorporated by reference in their entireties.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2012/078058 | Jul 2012 | US |
Child | 14089328 | US |