Video image motion vector encoding/decoding method and encoder/decoder

文档序号:1675847 发布日期:2019-12-31 浏览:29次 中文

阅读说明:本技术 视频图像的运动矢量编解码方法以及编/解码器 (Video image motion vector encoding/decoding method and encoder/decoder ) 是由 马思伟 雷萌 罗法蕾 王苫社 高文 于 2019-08-30 设计创作,主要内容包括:本申请提供一种视频图像的运动矢量编解码方法、一种编码器及一种解码器。其中,所述视频图像的运动矢量编码方法包括:选择率失真代价最小的运动矢量精度作为第一运动矢量精度,对运动矢量差值进行编码条件判断,并根据判断结果对所述第一运动矢量精度在其对应的第一运动矢量精度集合范围内进行调整,确定第二运动矢量精度,根据所述第二运动矢量精度对所述运动矢量差值进行编码得到运动矢量信息,将所述运动矢量信息和所述第一运动矢量精度对应的标识写入码流后发送至解码端。通过本方案,可以减少需要标识的运动矢量精度,在保持预测性能的同时,降低了编码运动矢量所需的码率和编码时间,从而提升了编码效率,带来了编码增益。(The application provides a motion vector coding and decoding method of a video image, an encoder and a decoder. The method for encoding the motion vector of the video image comprises the following steps: selecting the motion vector precision with the minimum rate distortion cost as a first motion vector precision, judging the coding condition of a motion vector difference value, adjusting the first motion vector precision within a corresponding first motion vector precision set range according to the judgment result, determining a second motion vector precision, coding the motion vector difference value according to the second motion vector precision to obtain motion vector information, writing the motion vector information and an identifier corresponding to the first motion vector precision into a code stream, and then sending the code stream to a decoding end. By the scheme, the precision of the motion vector needing to be identified can be reduced, and the code rate and the coding time required by coding the motion vector are reduced while the predictive performance is maintained, so that the coding efficiency is improved, and the coding gain is brought.)

1. A method for motion vector encoding of a video image, comprising:

constructing a plurality of mutually disjoint first motion vector precision sets, wherein the minimum motion vector precision in each first motion vector precision set forms a second motion vector precision set, and each minimum motion vector precision corresponds to an identifier;

obtaining a motion vector difference value of a current coding block in a current image according to a reference image;

calculating the rate distortion cost of coding the motion vector difference value by using each motion vector precision in the second motion vector precision set, and selecting the motion vector precision with the minimum rate distortion cost as the first motion vector precision;

judging the coding condition of the motion vector difference value, and adjusting the first motion vector precision within a corresponding first motion vector precision set range according to the judgment result to determine a second motion vector precision;

and coding the motion vector difference value according to the second motion vector precision to obtain motion vector information, writing the motion vector information and the identifier corresponding to the first motion vector precision into a code stream, and then sending the code stream to a decoding end.

2. The method of claim 1, wherein obtaining the motion vector difference value of the current coding block in the current picture according to the reference picture comprises:

according to the reference image, obtaining a motion vector predicted value and a motion vector of a current coding block in the current image;

and subtracting the motion vector predicted value from the motion vector to obtain the motion vector difference value.

3. The method according to claim 2, wherein said determining the encoding condition of the motion vector difference value and adjusting the first motion vector precision within the range of the corresponding first motion vector precision set according to the determination result to determine the second motion vector precision comprises:

aligning the motion vector predicted value under the first motion vector precision to the second motion vector precision, and calculating to obtain a motion vector difference under the second motion vector precision;

judging whether the motion vector difference value under the second motion vector precision is larger than a preset precision judgment threshold value or not; and if so, adjusting the first motion vector precision to the second motion vector precision.

4. A method for decoding a motion vector of a video picture, comprising:

receiving code stream data sent by an encoding end;

detecting a motion vector precision identifier of a current decoding block in code stream data, and determining a first motion vector precision corresponding to the motion vector precision identifier; the corresponding relation between the motion vector precision identifier and the first motion vector precision is constructed by a coding end, and specifically comprises the following steps: constructing a plurality of mutually disjoint first motion vector precision sets, wherein the minimum motion vector precision in each first motion vector precision set forms a second motion vector precision set, and each minimum motion vector precision corresponds to an identifier; the current decoding block belongs to a current image to be decoded;

judging decoding conditions of the first motion vector precision, and determining second motion vector precision used for encoding motion vector information in the code stream data, wherein the second motion vector precision belongs to a first motion vector precision set corresponding to the first motion vector precision;

and decoding the motion vector information according to the second motion vector precision to obtain a motion vector difference value of the current decoding block.

5. The method of claim 4, wherein said determining a decoding condition for the first motion vector precision and determining a second motion vector precision used for encoding motion vector information in the code stream data comprises:

calculating a first difference value between the motion vector predicted value under the first motion vector precision and the motion vector predicted value under the second motion vector precision;

judging whether the difference value between the motion vector difference value under the first motion vector precision and the first difference value is larger than a preset precision judgment threshold value or not; and if so, adjusting the first motion vector precision to the second motion vector precision for decoding.

6. An encoder, comprising:

the device comprises a construction module, a calculation module and a calculation module, wherein the construction module is used for constructing a plurality of mutually disjoint first motion vector precision sets, the minimum motion vector precision in each first motion vector precision set forms a second motion vector precision set, and each minimum motion vector precision corresponds to an identifier;

the motion vector module is used for obtaining a motion vector difference value of a current coding block in a current image according to a reference image; calculating the rate distortion cost of coding the motion vector difference value by using each motion vector precision in the second motion vector precision set, and selecting the motion vector precision with the minimum rate distortion cost as the first motion vector precision;

the coding condition module is used for judging the coding condition of the motion vector difference value, adjusting the first motion vector precision within a corresponding first motion vector precision set range according to the judgment result and determining second motion vector precision;

and the coding module is used for coding the motion vector difference value according to the second motion vector precision to obtain motion vector information, writing the motion vector information and the identifier corresponding to the first motion vector precision into a code stream, and then sending the code stream to a decoding end.

7. The encoder according to claim 6, wherein the motion vector module is specifically configured to:

according to the reference image, obtaining a motion vector predicted value and a motion vector of a current coding block in the current image;

and subtracting the motion vector predicted value from the motion vector to obtain the motion vector difference value.

8. The encoder according to claim 7, wherein the encoding condition module is specifically configured to:

aligning the motion vector predicted value under the first motion vector precision to the second motion vector precision, and calculating to obtain a motion vector difference under the second motion vector precision;

judging whether the motion vector difference value under the second motion vector precision is larger than a preset precision judgment threshold value or not; and if so, adjusting the first motion vector precision to the second motion vector precision.

9. A decoder, comprising:

the receiving module is used for receiving code stream data sent by the encoding end;

the device comprises a determining module, a judging module and a judging module, wherein the determining module is used for detecting a motion vector precision identifier of a current decoding block in code stream data and determining first motion vector precision corresponding to the motion vector precision identifier; the corresponding relation between the motion vector precision identifier and the first motion vector precision is constructed by a coding end, and specifically comprises the following steps: constructing a plurality of mutually disjoint first motion vector precision sets, wherein the minimum motion vector precision in each first motion vector precision set forms a second motion vector precision set, and each minimum motion vector precision corresponds to an identifier; the current decoding block belongs to a current image to be decoded;

a decoding condition module, configured to perform decoding condition judgment on the first motion vector precision, and determine a second motion vector precision used for encoding motion vector information in the code stream data, where the second motion vector precision belongs to a first motion vector precision set corresponding to the first motion vector precision;

and the decoding module is used for decoding the motion vector information according to the second motion vector precision to obtain a motion vector difference value of the current decoding block.

10. The decoder according to claim 9, wherein the decoding condition module is specifically configured to:

calculating a first difference value between the motion vector predicted value under the first motion vector precision and the motion vector predicted value under the second motion vector precision;

judging whether the difference value between the motion vector difference value under the first motion vector precision and the first difference value is larger than a preset precision judgment threshold value or not; and if so, adjusting the first motion vector precision to the second motion vector precision for decoding.

Technical Field

The present invention relates to the field of digital signal processing, and in particular, to a motion vector encoding/decoding method and encoder/decoder for video images.

Background

Predictive coding is a basic coding tool in video compression, and common predictive coding is inter-frame prediction and intra-frame prediction. Inter-frame prediction refers to using the correlation of video time domain and using the pixels adjacent to the coded image to predict the pixels of the current image so as to achieve the purpose of effectively removing the video time domain redundancy, and the basic principle is as follows: based on that a video sequence usually has strong temporal correlation, a best matching reference block is searched in a previously coded image for each current coding block of a current image, a pixel value of a pixel point in the reference block is used as a predicted value of a pixel point in the current coding block, and motion information of each current coding block is obtained, wherein displacement from the reference block to the current coding block is called a Motion Vector (MV), the coded image is also called a reference image, and the motion information comprises indication information and a motion vector MV of the reference image. Therefore, the encoding side does not need to send all information of each image to the decoding side, and only needs to transmit the motion information in the current image to the decoding side, and the decoding side can decode the current image according to the motion information.

Since the motion of a natural object is continuous, most of the time it is not exactly the distance of moving the whole pixel level, and therefore, if the motion vector uses the precision of the whole pixel, it may not be possible to accurately describe the motion of the object in many cases. The problem can be solved well by increasing the accuracy of the motion vector, i.e. artificially interpolating the value of each sub-pixel position between the integer pixel and the integer pixel, for example, 1/2 pixel accuracy is to upsample the image by 2 times in both the horizontal and vertical directions, 1/4 pixel accuracy is to upsample the image by 4 times in both the horizontal and vertical directions, and 1/2 pixel accuracy or 1/4 pixel accuracy can be used for the motion vector.

Fixed 1/4 pixel accuracy is used in both AVS (Audio Video Coding Standard) and HEVC (High Efficiency Video Coding). The high-precision motion vector can better approach the real motion situation, and the prediction performance is improved; on the other hand, however, a high-precision motion vector requires more bits to encode the motion vector. The AVS2 uses the asymptotic motion vector precision, and the 1/4 pixel precision can be adaptively adjusted to 1/2 pixel precision according to the range of the motion vector difference value. Adaptive motion vector accuracy is adopted in both AVS3 and VVC (Versatile Video Coding) Video codec standards, 1/4,1/2,1,2,4 kinds of motion vector accuracy are adopted in AVS3, and 1/4,1,4 kinds of motion vector accuracy are adopted in VVC. On one hand, the precision of various self-adaptive motion vectors is high in complexity, and on the other hand, some motion vectors are low in prediction efficiency and bring extra bit cost, so that the proportion of motion vector information in a code stream is continuously increased, and therefore, how to effectively compress the motion vector information becomes a key for further improving the video compression efficiency.

Disclosure of Invention

The present application provides a method and an encoder for encoding a motion vector of a video image, and a method and a decoder for decoding a motion vector of a video image.

A first aspect of the present application provides a method for encoding a motion vector of a video image, including:

constructing a plurality of mutually disjoint first motion vector precision sets, wherein the minimum motion vector precision in each first motion vector precision set forms a second motion vector precision set, and each minimum motion vector precision corresponds to an identifier;

obtaining a motion vector difference value of a current coding block in a current image according to a reference image;

calculating the rate distortion cost of coding the motion vector difference value by using each motion vector precision in the second motion vector precision set, and selecting the motion vector precision with the minimum rate distortion cost as the first motion vector precision;

judging the coding condition of the motion vector difference value, and adjusting the first motion vector precision within a corresponding first motion vector precision set range according to the judgment result to determine a second motion vector precision;

and coding the motion vector difference value according to the second motion vector precision to obtain motion vector information, writing the motion vector information and the identifier corresponding to the first motion vector precision into a code stream, and then sending the code stream to a decoding end.

A second aspect of the present application provides a method for decoding a motion vector of a video image, including:

receiving code stream data sent by an encoding end;

detecting a motion vector precision identifier of a current decoding block in code stream data, and determining a first motion vector precision corresponding to the motion vector precision identifier; the corresponding relation between the motion vector precision identifier and the first motion vector precision is constructed by a coding end, and specifically comprises the following steps: constructing a plurality of mutually disjoint first motion vector precision sets, wherein the minimum motion vector precision in each first motion vector precision set forms a second motion vector precision set, and each minimum motion vector precision corresponds to an identifier; the current decoding block belongs to a current image to be decoded;

judging decoding conditions of the first motion vector precision, and determining second motion vector precision used for encoding motion vector information in the code stream data, wherein the second motion vector precision belongs to a first motion vector precision set corresponding to the first motion vector precision;

and decoding the motion vector information according to the second motion vector precision to obtain a motion vector difference value of the current decoding block.

A third aspect of the present application provides an encoder comprising:

the device comprises a construction module, a calculation module and a calculation module, wherein the construction module is used for constructing a plurality of mutually disjoint first motion vector precision sets, the minimum motion vector precision in each first motion vector precision set forms a second motion vector precision set, and each minimum motion vector precision corresponds to an identifier;

the motion vector module is used for obtaining a motion vector difference value of a current coding block in a current image according to a reference image; calculating the rate distortion cost of coding the motion vector difference value by using each motion vector precision in the second motion vector precision set, and selecting the motion vector precision with the minimum rate distortion cost as the first motion vector precision;

the coding condition module is used for judging the coding condition of the motion vector difference value, adjusting the first motion vector precision within a corresponding first motion vector precision set range according to the judgment result and determining second motion vector precision;

and the coding module is used for coding the motion vector difference value according to the second motion vector precision to obtain motion vector information, writing the motion vector information and the identifier corresponding to the first motion vector precision into a code stream, and then sending the code stream to a decoding end.

A fourth aspect of the present application provides a decoder comprising:

the receiving module is used for receiving code stream data sent by the encoding end;

the device comprises a determining module, a judging module and a judging module, wherein the determining module is used for detecting a motion vector precision identifier of a current decoding block in code stream data and determining first motion vector precision corresponding to the motion vector precision identifier; the corresponding relation between the motion vector precision identifier and the first motion vector precision is constructed by a coding end, and specifically comprises the following steps: constructing a plurality of mutually disjoint first motion vector precision sets, wherein the minimum motion vector precision in each first motion vector precision set forms a second motion vector precision set, and each minimum motion vector precision corresponds to an identifier; the current decoding block belongs to a current image to be decoded;

a decoding condition module, configured to perform decoding condition judgment on the first motion vector precision, and determine a second motion vector precision used for encoding motion vector information in the code stream data, where the second motion vector precision belongs to a first motion vector precision set corresponding to the first motion vector precision;

and the decoding module is used for decoding the motion vector information according to the second motion vector precision to obtain a motion vector difference value of the current decoding block.

Compared with the prior art, the motion vector coding method of the video image selects the motion vector precision with the minimum rate distortion cost as the first motion vector precision, judges the coding condition of the motion vector difference, adjusts the first motion vector precision within the range of the corresponding first motion vector precision set according to the judgment result, determines the second motion vector precision, codes the motion vector difference according to the second motion vector precision to obtain the motion vector information, writes the motion vector information and the identifier corresponding to the first motion vector precision into the code stream, and sends the code stream to the decoding end. By the scheme, the precision of the motion vector needing to be identified can be reduced, and meanwhile, the precision of the motion vector is further adjusted at the encoding and decoding end according to the range of the motion vector difference value of the current encoding block, so that the code rate and the encoding time required by encoding the motion vector are reduced while the predictive performance is kept, the encoding efficiency is improved, and the encoding gain is brought.

Drawings

Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the application. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:

fig. 1 illustrates a flow chart of a method for encoding a motion vector of a video image according to some embodiments of the present application;

fig. 2 illustrates a flow chart of a method for decoding motion vectors of video images according to some embodiments of the present application;

FIG. 3 illustrates a schematic diagram of an encoder provided by some embodiments of the present application;

fig. 4 shows a schematic diagram of a decoder provided in some embodiments of the present application.

Detailed Description

Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

It is to be noted that, unless otherwise specified, technical or scientific terms used herein shall have the ordinary meaning as understood by those skilled in the art to which this application belongs.

In addition, the terms "first" and "second", etc. are used to distinguish different objects, rather than to describe a particular order. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.

The embodiments of the present application provide a method and an encoder for encoding a motion vector of a video image, and a method and a decoder for decoding a motion vector of a video image, which are described below with reference to the accompanying drawings.

Referring to fig. 1, which illustrates a flowchart of a method for encoding a motion vector of a video image according to some embodiments of the present application, as shown in the figure, the method for encoding a motion vector of a video image may include the following steps:

step S101: and constructing a plurality of mutually disjoint first motion vector precision sets, wherein the minimum motion vector precision in each first motion vector precision set forms a second motion vector precision set, and each minimum motion vector precision corresponds to one identifier.

Taking AVS3 as an example, as shown in table 1, five kinds of motion vector precisions, 1/4,1/2,1,2,4, are used in AVS3 at present, the precision unit is one pixel unit, 5 kinds of motion vector precisions are selected at the encoding end by the rate distortion cost, and the corresponding motion vector precision is selected at the decoding end by decoding the corresponding flag. It can be seen that as the precision of the motion vector increases, the number of bits required for identification increases, more code rates are consumed, and more coding time is consumed.

Identification 0 1 2 3 4
Motion vector accuracy 1/4 1/2 1 2 4
Bits 0 10 110 1110 1111

TABLE 1

In the present application, a plurality of motion vector precisions for encoding motion vectors are grouped to form a plurality of mutually disjoint motion vector precision sets, the minimum motion vector precision in each motion vector precision set forms a second motion vector precision set, and each minimum motion vector precision corresponds to one identifier.

For example, the 1/4 precision and the 1/2 precision are grouped into one group, the 1 precision and the 2 precision are grouped into one group, the 4 precision is separately grouped into one group, the minimum group in each group forms another motion vector precision set, and each group corresponds to one identifier, as shown in table 2, it can be seen that the consumption of bits is reduced after grouping the identifiers. It can be understood that the motion vector precisions divided into the same group share one identifier, each group may include more precisions, the number of specific groups may be determined according to actual situations, and the present application is not limited thereto.

Identification 0 1 2
Motion vector accuracy 1/4 1/2 1
Bits 0 10 110

TABLE 2

Step S102: and obtaining the motion vector difference value of the current coding block in the current image according to the reference image.

In the embodiment of the present application, step S102 specifically includes: and according to the reference image, obtaining a motion vector predicted value and a motion vector of a current coding block in the current image, and subtracting the motion vector predicted value from the motion vector to obtain the motion vector difference value. The step adopts a corresponding technology, which is not described in detail in the present application.

Step S103: and calculating the rate distortion cost of coding the motion vector difference value by using each motion vector precision in the second motion vector precision set, and selecting the motion vector precision with the minimum rate distortion cost as the first motion vector precision.

In the embodiment of the present application, the rate distortion cost is calculated by using a corresponding technique, which is not described in detail herein. Specifically, when the motion vector difference is coded, 1/4,1,4 precision coding is used respectively, the rate distortion cost under each precision is calculated, the precision with the minimum rate distortion cost is coded according to the coding mode in table 2, and the identifier of the precision is written into the code stream.

Step S104: and judging the coding condition of the motion vector difference value, adjusting the first motion vector precision within the corresponding first motion vector precision set range according to the judgment result, and determining the second motion vector precision.

In the embodiment of the application, the precision with the minimum rate distortion cost in the above steps is used as an optimal motion vector precision candidate, and the motion vector difference is subjected to coding condition judgment to further adjust the motion vector precision. For example, the precision with the minimum rate-distortion cost is 1/4, and when the motion vector difference is determined by the encoding condition and the determination result is that 1/2 precision encoding of the same group is used, the prediction performance can be maintained, and the code rate can be further reduced, so that 1/2 motion vector precision is adopted in actual encoding.

Thus, in some embodiments of the present application, step S104 may be implemented as: and aligning the motion vector predicted value under the first motion vector precision to a second motion vector precision, calculating to obtain a motion vector difference under the second motion vector precision, and judging whether the motion vector difference under the second motion vector precision is greater than a preset precision judgment threshold value or not. And if so, adjusting the first motion vector precision to the second motion vector precision.

The specific conditions are as follows:

inputting: MV, MVP, CTR, TH

And (3) outputting: MVD

–If|MVx-CTRx|>TH

–MVDx=(MVx+CTRx+sign(MVx-CTRx)*TH)/2–MVPx

–MVDy=(Mvy–CTRy)/2

–Elseif|MVy-CTRy|>TH

–MVDx=(MVx–CTRx)/2

–MVDy=(MVy+CTRy+sign(MVy-CTRy)*TH)/2–MVPy

–Else

–MVDx=MVx–MVPx

–MVDy=MVy–MVPy

In the above conditions, MV is a motion vector, MVP is a motion vector predictor, CTR indicates that the first motion vector precision is aligned to the second motion vector precision, TH is a preset precision decision threshold, and MVD is a motion vector difference.

Step S105: and coding the motion vector difference value according to the second motion vector precision to obtain motion vector information, writing the motion vector information and the identifier corresponding to the first motion vector precision into a code stream, and then sending the code stream to a decoding end.

Compared with the prior art, the motion vector decoding method of the video image selects the motion vector precision with the minimum rate distortion cost as the first motion vector precision, judges the coding condition of the motion vector difference, adjusts the first motion vector precision within the range of the corresponding first motion vector precision set according to the judgment result, determines the second motion vector precision, codes the motion vector difference according to the second motion vector precision to obtain the motion vector information, writes the motion vector information and the identifier corresponding to the first motion vector precision into the code stream, and sends the code stream to the decoding end. By the scheme, the precision of the motion vector needing to be identified can be reduced, and meanwhile, the precision of the motion vector is further adjusted at the encoding and decoding end according to the range of the motion vector difference value of the current encoding block, so that the code rate and the encoding time required by encoding the motion vector are reduced while the predictive performance is kept, the encoding efficiency is improved, and the encoding gain is brought.

In the above embodiments, a method for encoding a motion vector of a video image is provided, and correspondingly, the present application also provides a method for decoding a motion vector of a video image, where a decoding end corresponds to an encoding end, and the embodiments are basically similar, so that the description is relatively simple, and the relevant points can be referred to the partial description of the embodiments of the encoding end. Referring to fig. 2, which illustrates a flowchart of a method for decoding a motion vector of a video image according to some embodiments of the present application, as shown in the figure, the method for decoding a motion vector of a video image may include the following steps:

step 201: and receiving code stream data sent by the encoding end.

Step 202: detecting a motion vector precision identifier of a current decoding block in code stream data, and determining a first motion vector precision corresponding to the motion vector precision identifier; the corresponding relation between the motion vector precision identifier and the first motion vector precision is constructed by a coding end, and specifically comprises the following steps: constructing a plurality of mutually disjoint first motion vector precision sets, wherein the minimum motion vector precision in each first motion vector precision set forms a second motion vector precision set, and each minimum motion vector precision corresponds to an identifier; the current decoding block belongs to a current image to be decoded.

Step 203: and judging the decoding condition of the first motion vector precision, and determining a second motion vector precision used for encoding motion vector information in the code stream data, wherein the second motion vector precision belongs to a first motion vector precision set corresponding to the first motion vector precision.

In the embodiment of the present application, step 203 is specifically implemented as: calculating a first difference value of a motion vector predicted value under the first motion vector precision and a motion vector predicted value under the second motion vector precision, and judging whether the difference value between the motion vector difference value under the first motion vector precision and the first difference value is greater than a preset precision judgment threshold value or not; and if so, adjusting the first motion vector precision to the second motion vector precision for decoding. The specific conditions are as follows:

inputting: MVD, MVP, CTR, TH

And (3) outputting: MV (Medium Voltage) data base

–CTRDx=CTRx-MVPx

–CTRDy=CTRy-MVPy

–If|MVDx-CTRDx|>TH

–MVx=MVPx+MVDx*2-CTRDx-sign(MVDx-CTRDx)*TH

–MVy=MVPy+MVDy*2+CTRDy

–Elseif|MVDy-CTRDy|>TH

–MVx=MVPx+MVDx*2+CTRDx

–MVy=MVPy+MVDy*2-CTRDy-sign(MVDy-CTRDy)*TH

–Else

–MVx=MVDx+MVPx

–MVy=MVDy+MVPy

Step 204: and decoding the motion vector information according to the second motion vector precision to obtain a motion vector difference value of the current decoding block.

The method for encoding a motion vector of a video image provided by the embodiment of the present application and the method for decoding a motion vector of a video image provided by the foregoing embodiment of the present application have the same advantages and are based on the same inventive concept.

In the above embodiments, a method for encoding a motion vector of a video image and a method for decoding a motion vector of a video image are provided, and accordingly, an encoder and a decoder are provided. The encoder provided by the embodiment of the present application may implement the motion vector encoding method of the video image, and the decoder provided by the embodiment of the present application may implement the motion vector decoding method of the video image. Please refer to fig. 3, which illustrates a schematic diagram of an encoder according to some embodiments of the present application. Please refer to fig. 4, which illustrates a schematic diagram of a decoder according to some embodiments of the present application. Since the apparatus embodiments are substantially similar to the method embodiments, they are described in a relatively simple manner, and reference may be made to some of the descriptions of the method embodiments for relevant points. The device embodiments described below are merely illustrative.

As shown in fig. 3, the encoder 10 may include:

a constructing module 101, configured to construct a plurality of mutually disjoint first motion vector precision sets, where a minimum motion vector precision in each first motion vector precision set constitutes a second motion vector precision set, and each minimum motion vector precision corresponds to an identifier;

a motion vector module 102, configured to obtain a motion vector difference of a current coding block in a current image according to a reference image; calculating the rate distortion cost of coding the motion vector difference value by using each motion vector precision in the second motion vector precision set, and selecting the motion vector precision with the minimum rate distortion cost as the first motion vector precision;

the encoding condition module 103 is configured to perform encoding condition judgment on the motion vector difference, adjust the first motion vector precision within a corresponding first motion vector precision set range according to a judgment result, and determine a second motion vector precision;

and the encoding module 104 is configured to encode the motion vector difference according to the second motion vector precision to obtain motion vector information, write an identifier corresponding to the motion vector information and the first motion vector precision into a code stream, and send the code stream to a decoding end.

In some implementations of the embodiments of the present application, the motion vector module 102 is specifically configured to:

according to the reference image, obtaining a motion vector predicted value and a motion vector of a current coding block in the current image;

and subtracting the motion vector predicted value from the motion vector to obtain the motion vector difference value.

In some implementations of the embodiments of the present application, the encoding condition module 103 is specifically configured to:

aligning the motion vector predicted value under the first motion vector precision to the second motion vector precision, and calculating to obtain a motion vector difference under the second motion vector precision;

judging whether the motion vector difference value under the second motion vector precision is larger than a preset precision judgment threshold value or not; and if so, adjusting the first motion vector precision to the second motion vector precision.

The encoder 10 provided in the embodiment of the present application has the same advantageous effects as the method for encoding a motion vector of a video image provided in the foregoing embodiment of the present application.

As shown in fig. 4, the decoder 20 may include:

a receiving module 201, configured to receive code stream data sent by an encoding end;

a determining module 202, configured to detect a motion vector precision identifier of a current decoding block in code stream data, and determine a first motion vector precision corresponding to the motion vector precision identifier; the corresponding relation between the motion vector precision identifier and the first motion vector precision is constructed by a coding end, and specifically comprises the following steps: constructing a plurality of mutually disjoint first motion vector precision sets, wherein the minimum motion vector precision in each first motion vector precision set forms a second motion vector precision set, and each minimum motion vector precision corresponds to an identifier; the current decoding block belongs to a current image to be decoded;

a decoding condition module 203, configured to perform decoding condition judgment on the first motion vector precision, and determine a second motion vector precision used for encoding motion vector information in the code stream data, where the second motion vector precision belongs to a first motion vector precision set corresponding to the first motion vector precision;

and the decoding module 204 is configured to decode the motion vector information according to the second motion vector precision to obtain a motion vector difference of the current decoded block.

In some implementations of the embodiments of the present application, the decoding condition module 203 is specifically configured to:

calculating a first difference value between the motion vector predicted value under the first motion vector precision and the motion vector predicted value under the second motion vector precision;

judging whether the difference value between the motion vector difference value under the first motion vector precision and the first difference value is larger than a preset precision judgment threshold value or not; and if so, adjusting the first motion vector precision to the second motion vector precision for decoding.

The decoder 20 provided in the embodiment of the present application has the same advantageous effects as the motion vector decoding method of the video image provided in the foregoing embodiment of the present application.

Finally, it should be noted that: the above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; such modifications and substitutions do not depart from the spirit and scope of the present disclosure, and the present disclosure should be construed as being covered by the claims and the specification.

15页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种视频编码初始量化参数优化方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类