WO2015035769A1 - 运动矢量的获取方法、获取装置、视频编解码器及其方法 - Google Patents
运动矢量的获取方法、获取装置、视频编解码器及其方法 Download PDFInfo
- Publication number
- WO2015035769A1 WO2015035769A1 PCT/CN2014/075107 CN2014075107W WO2015035769A1 WO 2015035769 A1 WO2015035769 A1 WO 2015035769A1 CN 2014075107 W CN2014075107 W CN 2014075107W WO 2015035769 A1 WO2015035769 A1 WO 2015035769A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- block
- pixel value
- backward
- current block
- motion information
- Prior art date
Links
- 239000013598 vector Substances 0.000 title claims abstract description 176
- 238000000034 method Methods 0.000 title claims abstract description 83
- 230000006870 function Effects 0.000 claims description 17
- 238000001514 detection method Methods 0.000 claims description 15
- 238000005070 sampling Methods 0.000 claims description 11
- 238000005259 measurement Methods 0.000 claims 2
- 238000010586 diagram Methods 0.000 description 10
- 230000000694 effects Effects 0.000 description 10
- 230000006835 compression Effects 0.000 description 5
- 238000007906 compression Methods 0.000 description 5
- 238000005516 engineering process Methods 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 230000008878 coupling Effects 0.000 description 2
- 238000010168 coupling process Methods 0.000 description 2
- 238000005859 coupling reaction Methods 0.000 description 2
- 108091026890 Coding region Proteins 0.000 description 1
- 241000023320 Luma <angiosperm> Species 0.000 description 1
- 238000009825 accumulation Methods 0.000 description 1
- OSWPMRLSEDHDFF-UHFFFAOYSA-N methyl salicylate Chemical compound COC(=O)C1=CC=CC=C1O OSWPMRLSEDHDFF-UHFFFAOYSA-N 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 125000006850 spacer group Chemical group 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/50—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
- H04N19/503—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction
- H04N19/51—Motion estimation or motion compensation
- H04N19/567—Motion estimation based on rate distortion criteria
Definitions
- Motion vector acquisition method acquisition device, video codec and method thereof
- the present invention relates to the field of video coding and decoding technologies, and in particular, to a method for acquiring a motion vector and an apparatus for acquiring the same, and to a video encoding method, a video decoding method, a video encoder, and a video decoder.
- Background technique
- video coding There are typically four types of redundancy in a video sequence: airspace redundancy, time domain redundancy, visual redundancy, and coding redundancy.
- the purpose of video coding is to eliminate the above redundancy to achieve video compression.
- the video coding stage it is required to predict the motion vector of the current block in the current frame to be encoded during inter-frame coding, calculate the residual value of the current block according to the motion vector, and encode the motion-compensated residual value, and then decode the video.
- the stage uses the predicted motion vector to calculate the reference block, and the reference block and the residual difference are added to reconstruct the current block. It can be seen that an accurate motion vector that matches the current block motion trajectory is calculated, which can improve the coding effect.
- the motion vector of the current block is usually predicted by using skip or direct mode, that is, the motion vector of the reference block of the current block in the same position in the reference frame is used as the motion vector of the current block, or the template matching method is used.
- the motion vector of the current block is predicted, that is, the coding region adjacent to the current block is selected as the template region, and the motion vector of the template region that best matches the motion track of the current block is used as the motion vector of the current block by using the correlation between the template regions.
- the present application provides a method for acquiring a motion vector, an acquisition device, a video codec, and a method thereof, to solve the problem that the prior art needs to further improve coding efficiency.
- the first aspect of the present application provides a method for acquiring a motion vector, where the acquiring method includes: acquiring motion information of a neighboring block of a current block in a current frame, and a first reference frame.
- Motion information of a first reference block whose current block position is the same, wherein the first reference block and the neighboring block are encoded or decoded blocks, and the motion information of the neighboring block and the motion information of the first reference block include a forward motion vector And a forward reference identifier and a backward motion vector and a backward reference identifier; and a forward reference indicated by the motion information of each neighboring block and the forward motion vector in the motion information of the first reference block to the forward reference identifier Determining a forward matching block of the current block in the frame and determining a backward matching block of the current block according to the backward motion vector to the backward reference frame indicated by the backward reference identifier; detecting each determined forward matching block and backward matching The similarity between the blocks; the motion information of a first
- the neighboring block includes at least one of five blocks adjacent to the lower left, the left, the upper left, the upper, and the upper right of the current block.
- the forward motion vector of the at least one block adjacent to the current block is Set a zero vector to the motion vector.
- the step of calculating a difference between the first pixel value and the second pixel value is specifically: The two-pixel value is subjected to a similarity function calculation to obtain a measure of the difference.
- the similarity function is an absolute error sum:
- SAD is a measure of the difference
- ⁇ (m+z'+j;) is the first pixel value
- / 2 (m+z' 2 , "+ 2 ) is the second pixel value
- m and n represent the current
- the horizontal and vertical coordinate values of the block, and the components of the forward motion vector on the horizontal and vertical coordinates, respectively, 2 and ⁇ 2 are the components of the backward motion vector on the horizontal and vertical coordinates, respectively
- M and N represent the current block, respectively. Width and height.
- the step of calculating the first pixel value of each determined forward matching block and the second pixel value of the backward matching block is specific And: sampling the pixels of each determined forward matching block according to a predetermined rule to obtain a first pixel value and sampling the pixels of the backward matching block to obtain a second pixel value.
- the pixels of the forward matching block that are confirmed each time are sampled according to a predetermined rule to obtain a first pixel value and a backward matching block.
- the step of sampling the pixels to obtain the second pixel value is: sampling the pixels of each determined forward matching block according to the rule that each row of pixels and each column of pixels are spaced apart by one pixel to obtain the first pixel value and the backward direction
- the pixels of the matching block are sampled to obtain a second pixel value.
- the number of the first reference frames is at least two
- the step of acquiring the motion information of the first reference block in the first reference frame that is the same as the current block position is specifically : acquiring motion information of at least two first reference blocks in the at least two first reference frames that are the same as the current block position.
- the second aspect of the present application provides a video encoding method, where the video encoding method includes: obtaining the motion information of the current block in the current frame by using the acquiring method according to any one of the foregoing methods; Determining, by the motion vector to the forward reference frame indicated by the forward reference identifier, a forward matching block of the current block and determining a backward matching block of the current block according to the backward motion vector to the backward reference frame indicated by the backward reference identifier; Generating a reference pixel value by the first pixel value of the forward matching block and the second pixel value of the backward matching block, and calculating a target residual value between the reference pixel value and the real pixel value of the current block; encoding the target in the code stream The residual value is added to the code stream.
- the reference pixel value is a weighted average of the first pixel value and the second pixel value.
- the third aspect of the present application provides a video decoding method, where the video decoding method includes: decoding a target residual value and an operation identifier from the received code stream; Obtaining the motion information of the current block in the current frame; determining the forward matching block of the current block according to the forward motion vector in the motion information to the forward reference frame indicated by the forward reference identifier and according to the backward motion vector Determining a backward matching block of the current block in a backward reference frame indicated by the reference identifier; generating a reference pixel value according to the first pixel value of the forward matching block and the second pixel value of the backward matching block; and the reference pixel value and the target Residual difference Construct the current block.
- the reference pixel value is a weighted average of the first pixel value and the second pixel value.
- the fourth aspect of the present application provides an obtaining apparatus, where the acquiring apparatus includes an obtaining module, a determining module, a detecting module, and a setting module, where the acquiring module is configured to acquire motion information of a neighboring block of a current block in a current frame.
- the motion information of the neighboring block and the motion information of the first reference block include a forward motion vector and a forward reference identifier and a backward motion vector and a backward reference identifier; the determining module is configured to receive motion information of each neighboring block from the acquiring module. And determining, by the motion information of the first reference block, the front block of the current block according to the motion information of each neighboring block and the forward motion vector in the motion information of the first reference block to the forward reference frame indicated by the forward reference identifier.
- the detection module is configured to receive the determination result from the determination module, detect the similarity between each determined forward matching block and the backward matching block, and send the similarity to the setting module;
- the method is configured to receive the similarity from the detecting module, and set the motion information corresponding to the maximum similarity as the motion information of the current block.
- the neighboring block includes at least one of five blocks adjacent to the lower left, the left, the upper left, the upper, and the upper right of the current block.
- the acquiring module sends a forward motion vector of the at least one block that is adjacent to the current block Both the backward motion vector and the backward motion vector are set to zero.
- the detecting module includes a first calculating unit, a second calculating unit, and a detecting unit, where a computing unit is configured to receive the determination result from the determining module, calculate a first pixel value of each determined forward matching block and a second pixel value of the backward matching block, and send the first pixel value and the second pixel value to a second calculating unit; the second calculating unit is configured to receive the first pixel value and the second pixel value from the first calculating unit, calculate a metric of the difference between the first pixel value and the second pixel value, and calculate the difference
- the metric is sent to the detecting unit; the detecting unit is configured to receive the metric of the difference from the second calculating unit, detect the similarity according to the metric of the difference, and send the similarity to the setting mode A block, wherein the larger the measure of the difference, the smaller the similarity, and the smaller the measure of the difference, the greater
- the second calculating unit is specifically configured to perform a similarity function calculation on the first pixel value and the second pixel value to obtain a difference value. measure.
- the similarity function is an absolute error sum:
- SAD is a measure of the difference
- / 1 (m+ 1 , «+) is the first pixel value
- / 2 (m+ 2 , «+ 2 ) is the second pixel value
- m and n represent the horizontal sum of the current block, respectively.
- the vertical coordinate values, and ⁇ are the components of the forward motion vector on the horizontal and vertical coordinates, respectively
- 2 and ⁇ 2 are the components of the backward motion vector on the horizontal and vertical coordinates, respectively
- M and N represent the width of the current block, respectively. height.
- the first calculating unit is specifically configured to sample the pixels of each determined forward matching block according to a predetermined rule to obtain the first pixel.
- the value and the pixels of the forward matching block are sampled to obtain a second pixel value.
- the predetermined rule is a rule that each pixel of each row and each column of pixels are separated by one pixel.
- the number of the first reference frames is at least two, and the acquiring module is specifically configured to acquire at least two of the at least two first reference frames that are the same as the current block position.
- the motion information of the first reference block is specifically configured to acquire at least two of the at least two first reference frames that are the same as the current block position.
- a fifth aspect of the present application provides a video encoder, where the video encoder includes a determining device, a computing device, an encoding device, and the acquiring device according to any one of the above, wherein the acquiring device is configured to obtain a current frame.
- Motion information of the current block determining means for determining a forward matching block of the current block and a backward motion vector according to the backward motion vector according to the forward motion vector in the motion information to the forward reference frame indicated by the forward reference identifier Determining a backward matching block of the current block in the indicated backward reference frame; calculating means for generating a reference pixel value according to the first pixel value of the forward matching block and the second pixel value of the backward matching block, and calculating the reference pixel value And a target residual value between the real pixel value of the current block; the encoding device is configured to encode the target residual value in the code stream and add an operation identifier to the code stream.
- the reference pixel value is a weighted average of the first pixel value and the second pixel value.
- a sixth aspect of the present application provides a video decoder, where the video decoder includes a decoding device, a determining device, a computing device, a reconfiguring device, and the acquiring device according to any one of the above, wherein the decoding device is used to Decoding a target residual value and an operation identifier from the received code stream; the obtaining means is configured to obtain motion information of the current block in the current frame according to the operation identifier; and the determining means is configured to forward to the forward motion vector according to the motion information Determining a forward matching block of the current block in the forward reference frame indicated by the reference identifier and determining a backward matching block of the current block according to the backward motion vector to the backward reference frame indicated by the backward reference identifier; the computing device is configured to use Generating a reference pixel value to the first pixel value of the matching block and the second pixel value of the backward matching block; the reconstruction means is configured to accumulate the reference pixel value and the target residual
- the reference pixel value is a weighted average of the first pixel value and the second pixel value.
- a seventh aspect of the present application provides an acquiring apparatus, including a processor, a receiver, a transmitter, a random access memory, a read only memory, a bus, and a network interface unit, where the processors are respectively coupled by a bus.
- the processor acquires the current frame
- the motion information of the neighboring block of the current block and the motion information of the first reference block in the first reference frame that is the same as the current block position, where the first reference block and the neighboring block are encoded or decoded blocks, adjacent blocks
- the motion information and the motion information of the first reference block include a forward motion vector and a forward reference identifier, and a backward motion vector and a backward reference identifier; and sequentially according to the motion information of each neighboring block and the motion information of the first reference block.
- the forward motion vector in the current direction determines the forward direction of the current block in the forward reference frame indicated by the forward reference identifier Matching the block, and determining a backward matching block of the current block in the backward reference frame indicated by the backward reference identifier according to the backward motion vector; detecting a similarity between each determined forward matching block and the backward matching block; The motion information corresponding to the maximum similarity is set as the motion information of the current block.
- the neighboring block includes at least one of five blocks adjacent to the lower left, the left, the upper left, the upper, and the upper right of the current block.
- the processor is configured to: if the at least one block adjacent to the current block does not exist, at least the current block is adjacent The forward motion vector and the backward motion vector of one block are both set to a zero vector.
- the processor is configured to: calculate a first pixel value of each forward matching block and a backward matching block a second pixel value; a measure of the difference between the first pixel value and the second pixel value; detecting the similarity according to the measure of the difference, wherein the larger the measure of the difference, the smaller the similarity, the difference The smaller the metric, the greater the similarity.
- the processor is configured to: perform a similarity function calculation on the first pixel value and the second pixel value to obtain a metric of the difference value.
- the similarity function is absolute error and SAD:
- SAD is a measure of the difference
- / 1 (m+ 1 , «+) is the first pixel value
- / 2 (m+ 2 , «+ 2 ) is the second pixel value
- m and n represent the horizontal sum of the current block, respectively.
- the vertical coordinate values, and the components of the forward motion vector on the horizontal and vertical coordinates, respectively, 2 and ⁇ 2 are the components of the backward motion vector on the horizontal and vertical coordinates, respectively
- M and N represent the width and height of the current block, respectively.
- the processor is configured to: sample the pixels of each determined forward matching block according to a predetermined rule to obtain a first pixel value and The pixels of the backward matching block are sampled to obtain a second pixel value.
- the processor is configured to: perform a forward matching each time according to a rule that each pixel and each column of pixels are spaced apart by one pixel The pixels of the block are sampled to obtain a first pixel value and the pixels of the backward matching block are sampled to obtain a second pixel value.
- the processor is configured to: obtain motion information of at least two first reference blocks in the at least two first reference frames that are the same as the current block position.
- an eighth aspect of the present application provides a video decoder, including a decoding apparatus, a determining apparatus, a computing apparatus, a reconfiguring apparatus, and an obtaining apparatus according to any one of the above, wherein the decoding apparatus is configured to: Decoding a target residual value and an operation identifier from the received code stream; the obtaining means is configured to obtain motion information of the current block in the current frame according to the operation identifier; Determining a forward matching block of the current block according to a forward motion vector in the motion information to the forward reference frame indicated by the forward reference identifier and determining a current direction in the backward reference frame indicated by the backward motion vector to the backward reference identifier a backward matching block of the block; computing means for generating a reference pixel value according to the first pixel value of the forward matching block and the second pixel value of the backward matching block; the reconstruction means for using the reference pixel value and the target residual value Perform the accumulation to reconstruct the current block.
- the reference pixel value is a weighted average of the first pixel value and the second pixel value.
- the motion vector acquiring method, the acquiring apparatus, the video codec and the method thereof of the present application not only acquire motion information of a neighboring block of a current block in a current frame, but also acquire motion of a reference block of a current block at the same position in a reference frame.
- Information further includes forward and backward motion vectors and forward reference identifiers and backward reference identifiers, and the forward reference identifier and the backward reference identifier respectively indicate a forward reference frame and a backward reference frame.
- the forward and backward motion vectors can determine the forward matching block and the backward matching block of the current block and detect the similarity between the two, and then set the motion information corresponding to the maximum similarity as the motion information of the current block.
- FIG. 1 is a schematic flow chart of a first embodiment of a method for acquiring a motion vector according to the present invention
- FIG. 2 is a schematic flowchart of a second embodiment of a method for acquiring a motion vector according to the present invention
- FIG. 3 is a space diagram of a current block and an adjacent block in the present invention
- FIG. 4 is a schematic diagram of positions of a current frame, a forward reference frame, and a backward reference frame in the present invention
- FIG. 5 is a schematic diagram of a pixel of a forward matching block in a forward reference frame according to the present invention
- FIG. 6 is a schematic flow chart of an embodiment of a video encoding method according to the present invention.
- FIG. 7 is a schematic flow chart of an embodiment of a video decoding method according to the present invention.
- Figure 8 is a schematic structural view of a first embodiment of the obtaining device of the present invention.
- FIG. 9 is a schematic structural view of a second embodiment of the obtaining device of the present invention.
- FIG. 10 is a schematic structural diagram of an embodiment of a video encoder according to the present invention.
- FIG. 11 is a schematic structural diagram of an embodiment of a video decoder according to the present invention.
- Figure 12 is a schematic view showing the structure of a third embodiment of the obtaining device of the present invention. detailed description
- FIG. 1 is a schematic flowchart diagram of a first embodiment of a method for acquiring a motion vector according to the present invention.
- the method of obtaining the motion vector includes the following steps:
- Step S11 acquiring motion information of a neighboring block of the current block in the current frame and motion information of the first reference block in the first reference frame that is the same as the current block position, where the first reference block and the adjacent block are encoded or
- the decoded block, the motion information of the neighboring block and the motion information of the first reference block include a forward motion vector and a forward reference identifier, and a backward motion vector and a backward reference identifier.
- each frame in the original video sequence is sequentially received.
- each frame that has been encoded is received.
- the current frame is divided into code blocks that do not overlap each other, and the current block is the block to be encoded or decoded.
- the first reference frame is a frame that has been encoded or decoded before the current frame.
- the current frame is divided into blocks that do not overlap each other, and each block may have a size of 16x16 pixels, 32x32 pixels, or 64x64 pixels.
- the block can be a macroblock or a CU, coding tree in the h.265 standard. In addition to the block in the upper left corner of the current frame, there must be a portion of the adjacent block of each block that is already encoded or decoded.
- the number of the first reference frames is at least two, and the motion information of the at least two first reference blocks in the at least two first reference frames that are the same as the current block position needs to be acquired.
- the first reference frame may be a forward frame or a backward frame. If the first reference frame is multiple, then The first reference frame may all be a forward frame or all backward frames.
- Step S12 determining the forward matching block of the current block according to the motion information of each neighboring block and the forward motion vector in the motion information of the first reference block to the forward reference frame indicated by the forward reference identifier, and A backward matching block of the current block is determined from the motion vector to the backward reference frame indicated by the backward reference identifier.
- the forward reference identifier and the backward reference identifier respectively match the forward motion vector and the backward motion vector in the motion information, and are used to indicate the forward reference frame and the backward reference corresponding to the neighboring block or the first reference block. frame.
- the process of determining the forward matching block is: determining a forward reference frame of the current frame according to the forward reference identifier, starting from the same block as the current block position in the forward reference frame, along the motion trajectory of the forward motion vector, The block pointed to by the end of the forward motion vector is the forward matching block.
- the backward matching block is also determined in the same way.
- Each motion information corresponds to a forward matching block and a backward matching block.
- Step S13 Detecting the similarity between the forward matching block and the backward matching block determined each time.
- the relationship between frames is a time domain relationship.
- encoded frames have correlation in the time domain, that is, there is correlation between video data. For example, when the same moving object moves at the same speed at different speeds in different frames, the motion vectors are the same in these frames.
- the relationship between the blocks in the frame is a spatial domain relationship. If the current block and a neighboring block are the same moving object in the frame, the motion vector of the adjacent block can represent the motion vector of the current block, and the adjacent block is in front.
- the backward matching block in the forward matching block and the backward reference frame of the reference frame are equivalent to the forward matching block and the backward matching block of the current block.
- Step S14 Set the motion information corresponding to the maximum similarity as the motion information of the current block.
- the method for acquiring a motion vector in the embodiment of the present invention fully considers the time domain correlation and the spatial domain correlation in the video compression coding, and obtains the forward matching block of the current block by using the motion information of the spatial neighboring block and the time domain reference block.
- the motion information corresponding to the maximum similarity between the forward matching block and the backward matching block is selected as the motion information pair of the current block, and since the spatial correlation and the time domain correlation of the video sequence are comprehensively considered,
- the coding effect of the prior art can be improved, and only the similarity between individual blocks can be calculated, and the computational complexity is greatly reduced, and the prior art needs to be solved.
- FIG. 2 is a schematic flowchart diagram of a second embodiment of a method for acquiring a motion vector according to the present invention.
- the method of obtaining the motion vector includes the following steps:
- Step S21 Obtain motion information of a neighboring block of the current block in the current frame and motion information of the first reference block in the first reference frame that is the same as the current block position, where the first reference block and the adjacent block are encoded or
- the decoded block, the motion information of the neighboring block and the motion information of the first reference block include a forward motion vector and a forward reference identifier, and a backward motion vector and a backward reference identifier.
- the adjacent block includes at least one of the four blocks A, B, C, D, E of the lower left, the left, the upper left, the upper and the upper right adjacent to the current block CB (see Fig. 3).
- the present embodiment acquires motion information of four adjacent blocks A, B, C, D of the current block CB.
- the first reference frame is one, and the total number of motion information is five.
- the first reference frame may be multiple, and the number of acquired motion information is correspondingly increased.
- the current block CB happens to be at the edge of the current frame CF, for example, in the upper left corner of the current frame CF, then there is no adjacent contiguous block at the left, top left, top or top right of the current block, then the current block CB is contiguous Both the forward motion vector and the backward motion vector of at least one block of the block are set to a zero vector.
- the adjacent blocks VIII, B, C, and D of the current block CB may be blocks of the same size as the current block CB, or may be smaller blocks ( As shown in Figure 3).
- Step S22 determining the forward matching block of the current block according to the motion information of each neighboring block and the forward motion vector in the motion information of the first reference block to the forward reference frame indicated by the forward reference identifier, and A backward matching block of the current block is determined from the motion vector to the backward reference frame indicated by the backward reference identifier.
- the neighboring block A is taken as an example, and the motion information includes a forward motion vector mval and a forward reference identifier, and a backward motion vector mva2 and a backward reference identifier (see FIG. 4), and the forward matching block FB and the backward direction are sought.
- the process of matching block BB is as follows:
- the forward reference frame FF of the current frame CF can be determined, and the same block as the current block CB is found in the forward reference frame FF, and then the block is used as the starting point, and the forward motion vector mval can be used. Find the forward matching block FB, the arrow of the forward motion vector mval Point to the block.
- the backward reference frame BF of the current frame CF may be determined according to the backward reference identifier, the same block as the current block CB is found in the backward reference frame BF, and then the block is used as the starting point, along the backward motion vector Mva2 can find the backward matching block BB, which is the block pointed to by the arrow of the backward motion vector mva2.
- Step S23 Detect the similarity between the forward matching block and the backward matching block determined each time.
- the similarity may be characterized by a measure of the difference between the forward matching block and the backward matching block.
- step S23 includes:
- Step S231 Calculate a first pixel value of the forward matching block determined each time and a second pixel value of the backward matching block.
- each block is composed of pixels.
- a block of size 16x16 pixels contains one 16x16 luma block and two 8x8 chroma blocks.
- the sum of the pixel values of each pixel constitutes the pixel value of the block.
- the size of the forward matching block FB and the backward matching block BB are the same, and the number of pixels is also the same.
- step S231 is specifically: sampling the pixels of each determined forward matching block according to a predetermined rule to obtain a first pixel value and sampling the pixels of the backward matching block to obtain a second pixel value.
- the predetermined rule may be a rule of spacing one pixel per pixel and each column of pixels, i.e., interlacing the sampled pixels. As shown in Fig. 5, taking a block of size 16x16 pixels as an example, the forward matching block FB has 16x16 pixels, and the pixels of the shaded portion are sampled by the interlaced spacer to obtain the first pixel value.
- the predetermined rule can be set according to actual needs, which is not limited by the present invention.
- Step S232 Calculate a measure of the difference between the first pixel value and the second pixel value.
- the difference is a result of subtracting the first pixel value from the second pixel value, and the difference is measured as a first or second order value of the difference.
- step S232 is specifically: performing a similarity function calculation on the first pixel value and the second pixel value to obtain a metric of the difference value.
- the similarity function can be an error sum, a sum of absolute differences (SAD), an absolute transform error sum, an absolute square difference sum, and the like. That is to say, the difference can be calculated using the first or second order error formula.
- This embodiment is preferably an absolute error sum:
- SAD I /; ( , n+j x ) - f 2 (m+i 2 , n+j 2 )j
- SAD is a measure of the difference
- / 1 (m+ 1 , «+) is the first pixel value
- / 2 (m+ 2 , «+ ) is the second pixel value
- m and n represent the horizontal sum of the current block CB, respectively.
- the vertical coordinate values, and ⁇ are the components of the forward motion vector mval on the horizontal and vertical coordinates, respectively
- 2 and ⁇ 2 are the components of the backward motion vector mva2 on the horizontal and vertical coordinates, respectively
- M and N represent the current block CB, respectively.
- the width and height which is the size of the current block CB.
- Step S233 Detecting the similarity according to the metric of the difference, wherein the larger the metric of the difference is, the smaller the similarity is, and the smaller the metric of the difference is, the larger the similarity is.
- Step S24 Set the motion information corresponding to the maximum similarity as the motion information of the current block.
- the method for acquiring a motion vector in the embodiment of the present invention fully considers the time domain correlation and the spatial domain correlation in the video compression coding, and obtains the forward matching block of the current block by using the motion information of the spatial neighboring block and the time domain reference block. To match the block, and sample the pixel values of the two matching blocks, and then use the absolute error sum to obtain the difference between the two pixel values, so that the motion information corresponding to the minimum difference is set as the motion information of the current block, Sampling pixels can greatly reduce computational complexity.
- FIG. 6 is a schematic flowchart of an embodiment of a video encoding method according to the present invention.
- the video coding method uses the motion vector acquisition method of any of the above embodiments.
- the video coding method includes the following steps:
- Step S31 Obtain motion information of the current block in the current frame.
- the motion information of the current block in the current frame is obtained by the method for acquiring the motion vector of any of the above embodiments.
- Step S32 determining a forward matching block of the current block and a backward reference frame indicated by the backward motion vector according to the backward motion vector according to the forward motion vector in the motion information to the forward reference frame indicated by the forward reference identifier. Determine the backward matching block of the current block.
- Step S33 Generate a reference pixel value according to the first pixel value of the forward matching block and the second pixel value of the backward matching block, and calculate a target residual value between the reference pixel value and the real pixel value of the current block.
- the reference pixel value is preferably a weighted average of the first pixel value and the second pixel value, and the weights of the first pixel value and the second pixel value may be set according to actual needs. In this embodiment, When calculating the reference pixel value and the true pixel value, all pixels need to be calculated.
- Step S34 Encoding the target residual value in the code stream and adding an operation identifier to the code stream.
- the code rate is 3.12%.
- the video encoding method of the embodiment of the present invention obtains the motion information of the current block, and then determines the forward matching block and the backward matching block of the current block by the motion information, and generates the reference pixel by using the pixel values of the forward matching block and the backward matching block.
- the value, and the target residual value between the reference pixel value and the real pixel value are obtained.
- FIG. 7 is a schematic flowchart diagram of an embodiment of a video decoding method according to the present invention.
- the video decoding method uses the motion vector obtaining method of any of the above embodiments, and the video decoding method includes the following steps:
- Step S41 Decode the target residual value and the operation identifier from the received code stream. Take the method.
- Step S42 Obtain motion information of the current block in the current frame according to the operation identifier.
- Step S43 determining a forward matching block of the current block and a backward reference frame indicated by the backward motion vector according to the backward motion vector according to the forward motion vector in the motion information to the forward reference frame indicated by the forward reference identifier. Determine the backward matching block of the current block.
- Step S44 generating a reference pixel value according to the first pixel value of the forward matching block and the second pixel value of the backward matching block.
- the reference pixel value is preferably a weighted average of the first pixel value and the second pixel value, and the weights of the first pixel value and the second pixel value may be set according to actual needs.
- Step S45 The reference pixel value and the target residual value are accumulated to reconstruct the current block.
- the obtained value is the real pixel value of the current block.
- the video decoding method of the embodiment of the present invention obtains the motion information of the current block, and then determines the forward matching block and the backward matching block of the current block by the motion information, and generates the reference pixel by using the pixel values of the forward matching block and the backward matching block. Value, and the target residual value is accumulated by the reference pixel value to reconstruct the current block. Since the motion domain information is comprehensively considered, the spatial correlation and time domain correlation of the video sequence are comprehensively considered, which can improve the coding effect and reduce the computational complexity, and When decoding the code stream, it is only necessary to decode the target residual value, and there is no need to decode the motion information, so the decoding efficiency is improved.
- the obtaining means includes an obtaining module 51, a determining module 52, a detecting module 53 and a setting module 54.
- the obtaining module 51 is configured to acquire motion information of the neighboring block of the current block in the current frame and motion information of the first reference block in the first reference frame that is the same as the current block position, and the motion information of each adjacent block and the
- the motion information of a reference block is sent to the determining module 52, where the first reference block and the neighboring block are encoded or decoded blocks, and the motion information of the neighboring block and the motion information of the first reference block include a forward motion vector sum. Forward reference identification and backward motion vector and backward reference identification.
- the first reference frame is a frame that has been encoded or decoded before the current frame.
- the number of the first reference frames is at least two, and the obtaining module 51 needs to acquire motion information of at least two first reference blocks in the at least two first reference frames that are the same as the current block position.
- the first reference may be a forward frame or a backward frame. If the first reference frame is multiple, the first reference frame may be all forward frames or all backward frames.
- the determining module 52 is configured to receive the motion information of each neighboring block and the motion information of the first reference block from the acquiring module 51, and sequentially according to the motion information of each neighboring block and the forward motion in the motion information of the first reference block. Determining a forward matching block of the current block in the forward reference frame indicated by the forward reference identifier and determining a backward matching block of the current block in the backward reference frame indicated by the backward motion vector to the backward reference identifier, and The determination result is sent to the detection module 53.
- the forward reference identifier and the backward reference identifier are matched in the motion information with the forward motion vector and the backward motion vector, respectively. And indicating a forward reference frame and a backward reference frame corresponding to the neighboring block or the first reference block. Determination module
- the process of determining the forward matching block is: determining a forward reference frame of the current frame according to the forward reference identifier, starting from the same block as the current block position in the forward reference frame, along the motion trajectory of the forward motion vector The block pointed to by the end of the forward motion vector is the forward matching block.
- the backward matching block is also determined in the same way.
- Each motion information corresponds to a forward matching block and a backward matching block.
- the detecting module 53 is configured to receive the determination result from the determining module 52, detect the similarity between the forward matching block and the backward matching block determined each time, and send the similarity to the setting module 54.
- the relationship between frames is a time domain relationship.
- encoded frames have correlation in the time domain, that is, there is correlation between video data. For example, when the same moving object moves at the same speed at different speeds in different frames, it can be considered that the motion vectors are the same in these frames.
- the relationship between the blocks in the frame is a spatial domain relationship. If the current block and a neighboring block are the same moving object in the frame, the motion vector of the adjacent block can represent the motion vector of the current block, and the adjacent block is in front.
- the backward matching block in the forward matching block and the backward reference frame of the reference frame are equivalent to the forward matching block and the backward matching block of the current block.
- the setting module 54 is configured to receive the similarity from the detecting module 53, and set the motion information corresponding to the maximum similarity as the motion information of the current block.
- the obtaining apparatus of the embodiment of the present invention fully considers the time domain correlation and the spatial domain correlation in the video compression coding, and obtains the forward matching block and the backward matching block of the current block by using the motion information of the spatial neighboring block and the time domain reference block. Then, the motion information corresponding to the maximum similarity between the forward matching block and the backward matching block is selected as the motion information of the current block. Since the spatial correlation and time domain correlation of the video sequence are comprehensively considered, the existing information can be improved. The coding effect of the technology, and only the similarity between the individual blocks is calculated, the computational complexity is greatly reduced, and the problem that the prior art needs to further improve the coding efficiency is solved.
- the obtaining means includes an obtaining module 61, a determining module 62, a detecting module 63, and a setting module 64.
- the detection module 63 includes a first calculation unit 631, a second calculation unit 632, and a detection unit 633.
- the obtaining module 61 is configured to acquire motion information of the neighboring block of the current block in the current frame and motion information of the first reference block in the first reference frame that is the same as the current block position, and the motion information of each adjacent block and the
- the motion information of a reference block is sent to the determining module 62, where the first reference block and the phase
- the neighboring block is an encoded or decoded block
- the motion information of the neighboring block and the motion information of the first reference block include a forward motion vector and a forward reference identifier, and a backward motion vector and a backward reference identifier.
- the adjacent block includes at least one of the four blocks of the lower left, the left, the upper left, the upper, and the upper right adjacent to the current block.
- the embodiment acquires motion information of four adjacent blocks of the current block. If the first reference frame is one, the total number of motion information is five. If the first reference frame is plural, the amount of acquired motion information is correspondingly increased.
- the current block happens to be at the edge of the current frame, for example, in the upper left corner of the current frame, then there is no adjacent block in the left, upper left, upper or upper right of the current block, then the obtaining module 61 will The forward motion vector and the backward motion vector of the block adjacent to the current block are both set to a zero vector. Further, since the block can continue to be divided into smaller blocks, the adjacent blocks may be blocks of the same size as the current block, or may be smaller blocks.
- the determining module 62 is configured to receive the motion information of each neighboring block and the motion information of the first reference block from the obtaining module 61, and sequentially forward motion vectors in the motion information of the first reference block according to the motion information of each neighboring block. Determining a forward matching block of the current block in the forward reference frame indicated by the forward reference identifier and determining a backward matching block of the current block in the backward reference frame indicated by the backward motion vector to the backward reference identifier, and determining The result is sent to the detection module 63.
- the process of finding the forward matching block and the backward matching block is as follows: According to the forward reference identifier, the forward reference frame of the current frame can be determined, the same block as the current block position is found in the forward reference frame, and then the block is used as a starting point. The forward matching block can be found along the forward motion vector, that is, the block pointed to by the end point of the forward motion vector. Similarly, the backward reference frame of the current frame can be determined according to the backward reference identifier, and the same block as the current block position is found in the backward reference frame, and then the block is used as a starting point, and the backward motion vector can be found after The block pointed to by the matching block, the end of the backward motion vector.
- the detecting module 63 is configured to receive the determination result from the determining module 62, detect the similarity between each determined forward matching block and the backward matching block, and send the similarity to the setting module 64.
- the setting module 64 is configured to receive the similarity from the detecting module 63, and set the motion information corresponding to the maximum similarity as the motion information of the current block.
- the similarity detected by the detection module 63 can be characterized by a measure of the difference between the forward matching block and the backward matching block. specifically:
- the first calculating unit 631 is configured to calculate a first pixel value of the forward matching block determined each time and a second pixel value of the backward matching block.
- Each block is made up of pixels, each pixel of the pixel The sum of the values constitutes the pixel value of the block.
- the size of the forward matching block and the backward matching block are the same, and the number of pixels is also the same.
- the first calculating unit 631 is specifically configured to sample the pixels of each determined forward matching block according to a predetermined rule to obtain a first pixel value, and sample the pixels of the backward matching block to obtain a second pixel value.
- the predetermined rule may be a rule that each pixel of each row and each column of pixels are separated by one pixel, that is, the interlaced sampled pixels.
- the predetermined rule can be set according to actual needs, which is not limited by the present invention.
- the second calculation unit 632 is for calculating a measure of the difference between the first pixel value and the second pixel value.
- the second calculating unit 632 performs a similarity function calculation on the first pixel value and the second pixel value to obtain a metric of the difference value.
- the similarity function is preferably an absolute error sum:
- SAD is a measure of the difference
- / 1 (m+ 1 , «+) is the first pixel value
- / 2 (m+ 2 , «+ ) is the second pixel value
- m and n represent the horizontal and vertical of the current block, respectively.
- the coordinate values, and ⁇ are the components of the forward motion vector on the horizontal and vertical coordinates, respectively
- 2 and ⁇ 2 are the components of the backward motion vector on the horizontal and vertical coordinates, respectively
- M and N represent the width and height of the current block, respectively.
- M and N are the sizes of the current block.
- the detecting unit 633 is configured to detect the similarity according to the metric of the difference, wherein the metric of the difference is inversely proportional to the similarity.
- the metric of the difference is inversely proportional to the similarity. The smaller the measure of the difference, the closer the forward matching block and the backward matching block are, and the greater the similarity. Conversely, the larger the measure of the difference, the smaller the similarity.
- the obtaining apparatus of the embodiment of the present invention fully considers the time domain correlation and the spatial domain correlation in the video compression coding, and obtains the forward matching block and the backward matching block of the current block by using the motion information of the spatial neighboring block and the time domain reference block. And sampling the pixel values of the two matching blocks, and then using the absolute error sum to obtain a measure of the difference between the two pixel values, thereby setting the motion information corresponding to the measure of the minimum difference as the motion information of the current block, By sampling pixels, the computational complexity can be greatly reduced.
- the video encoder includes an acquisition device 71, a determination device 72, a calculation device 73, and an encoding device 74.
- the acquisition device 71 is the acquisition device of any of the above embodiments.
- the obtaining means 71 is configured to obtain motion information of the current block in the current frame.
- the determining means 72 is configured to determine a forward matching block of the current block and a backward reference according to the backward motion vector to the backward reference identifier according to the forward motion vector in the motion information to the forward reference frame indicated by the forward reference identifier.
- a backward matching block of the current block is determined in the frame.
- the calculating means 73 is configured to generate a reference pixel value according to the first pixel value of the forward matching block and the second pixel value of the backward matching block, and calculate a target residual value between the reference pixel value and the real pixel value of the current block.
- the reference pixel value is preferably a weighted average of the first pixel value and the second pixel value. In the present embodiment, when calculating the reference pixel value and the real pixel value, it is necessary to calculate all the pixels.
- Encoding device 74 is operative to encode the target residual value in the code stream and add an operational identification to the code stream. Since it is not necessary to write motion information into the code stream, the bits required for encoding can be saved, and the code rate is saved. Save enough code rate 3.12%.
- the video encoder of the embodiment of the present invention determines the forward matching block and the backward matching block of the current block by obtaining motion information of the current block, and generates reference pixels by using pixel values of the forward matching block and the backward matching block. The value, and the target residual value between the reference pixel value and the real pixel value are obtained.
- the motion information is obtained, the spatial correlation and the time domain correlation of the video sequence are comprehensively considered, thereby improving the coding effect and reducing the computational complexity. Moreover, it is not necessary to write motion information into the code stream, and the code rate can be lowered.
- FIG. 11 is a schematic structural diagram of an embodiment of a video decoder according to the present invention.
- the video decoder includes a decoding device 81, an obtaining device 82, a determining device 83, a computing device 84, and a reconstructing device 85.
- the obtaining device 82 is the acquiring device of any of the above embodiments.
- the decoding means 81 is adapted to decode the target residual value and the operation identifier from the received code stream.
- the obtaining means 82 is configured to obtain motion information of the current block in the current frame according to the operation identifier.
- the operation identifier is used to describe the manner in which the acquisition device in the video encoder obtains motion information. Then, after the obtaining means 82 finds the operation identifier in the code stream, the motion information of the current block in the current frame is obtained in the same manner as the video encoder.
- the determining means 83 is configured to determine a forward matching block of the current block and a backward reference according to the backward motion vector to the backward reference identifier according to the forward motion vector in the motion information to the forward reference frame indicated by the forward reference identifier.
- a backward matching block of the current block is determined in the frame.
- the computing device 84 is configured to use the first pixel value of the forward matching block and the second image of the backward matching block
- the prime value generates a reference pixel value.
- the reference pixel value is preferably a weighted average of the first pixel value and the second pixel value, and the weights of the first pixel value and the second pixel value may be set according to actual needs. It should be noted that since the video decoder of the present embodiment and the video encoder of the foregoing embodiment all use the same acquisition means, the obtained motion information is the same, and the reference pixel value is acquired in the same manner. , so the reference pixel values are the same.
- the reconstruction means 85 is configured to accumulate the reference pixel value and the target residual value to reconstruct the current block. After the reference pixel value and the target residual value are accumulated, the obtained value is the true pixel value of the current block.
- the video decoder of the embodiment of the present invention obtains the motion information of the current block, determines the forward matching block and the backward matching block of the current block by the motion information, and generates the reference pixel by using the pixel values of the forward matching block and the backward matching block. Value, and the target residual value is accumulated by the reference pixel value to reconstruct the current block. Since the motion domain information is comprehensively considered, the spatial correlation and time domain correlation of the video sequence are comprehensively considered, which can improve the coding effect and reduce the computational complexity, and When decoding the code stream, it is only necessary to decode the target residual value, and there is no need to decode the motion information, so the decoding efficiency is improved.
- the acquisition device includes a processor 91, a receiver 92, an emitter 93, a random access memory (RAM) 94, a read only memory (ROM) 95, a bus 96, and a network interface unit (Network Interface). Unit) 97.
- the processor 91 is coupled to the receiver 92, the transmitter 93, the random access memory 94, the read only memory 95, and the network interface unit 97 via the bus 96.
- the basic input/output system (BIOS) solidified in the read-only memory 95 or the boot loader in the embedded system is booted to boot, and the acquisition device is brought into a normal operation state.
- the application programs (Application Programs) and the operating system (OS) are run in the random access memory 94 such that:
- the processor 91 acquires motion information of the neighboring block of the current block in the current frame and motion information of the first reference block in the first reference frame that is the same as the current block position, where the first reference block and the adjacent block are encoded or
- the decoded block, the motion information of the neighboring block and the motion information of the first reference block include a forward motion vector and a forward reference identifier, and a backward motion vector and a backward reference identifier; and sequentially according to motion information of each neighboring block.
- the forward motion vector in the motion information of the first reference block to the forward reference frame indicated by the forward reference identifier determines a forward matching block of the current block and the backward reference frame indicated by the backward motion vector to the backward reference identifier Determining the backward matching block of the current block; detecting each The similarity between the determined forward matching block and the backward matching block; the motion information corresponding to the maximum similarity is set as the motion information of the current block.
- the motion vector acquiring method, the acquiring apparatus, the video codec and the method thereof of the present invention not only acquire motion information of neighboring blocks of the current block in the current frame, but also acquire the same position of the current block in the reference frame.
- each motion information includes a forward and backward motion vector and a forward reference identifier and a backward reference identifier, and the forward reference identifier and the backward reference identifier respectively indicate a forward reference frame and a backward reference.
- the frame can determine the forward matching block and the backward matching block of the current block by using the forward and backward motion vectors, and detect the similarity between the two, and then set the motion information corresponding to the maximum similarity to the motion information of the current block.
- the coding effect of the prior art can be improved, and since only the similarity between the two matching blocks is calculated, the computational complexity can be reduced, thereby solving The prior art needs to further improve the coding efficiency.
- the motion information is used for encoding and decoding, it is not necessary to write motion information in the code stream, which can reduce the coding rate and improve the coding efficiency.
- the disclosed systems, apparatus, and methods may be implemented in other ways.
- the device implementations described above are merely illustrative.
- the division of the modules or units is only a logical function division.
- there may be another division manner for example, multiple units or components may be used. Combined or can be integrated into another system, or some features can be ignored, or not executed.
- the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect connection or communication connection through some interface, device or unit, and may be in electrical, mechanical or other form.
- the components displayed as units may or may not be physical units, i.e., may be located in one place, or may be distributed over multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the present embodiment.
- each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
- the above integrated unit can be implemented in the form of hardware or in combination. The form realization of the software functional unit.
- the integrated unit if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium.
- the instructions include a plurality of instructions for causing a computer device (which may be a personal computer, a management server, or a network device, etc.) or a processor to perform all or part of the steps of the methods of the various embodiments of the present application.
- the foregoing storage medium includes: a U disk, a removable hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and the like, which can store program codes. .
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
本申请公开了一种运动矢量的获取方法、获取装置、视频编解码器及其方法。获取方法包括:获取当前帧中当前块的相邻块的运动信息和第一参考帧中与当前块位置相同的第一参考块的运动信息,运动信息包括前向运动矢量和前向参考标识以及后向运动矢量和后向参考标识;依次根据每一运动信息中的前向运动矢量到前向参考标识指示的前向参考帧中确定当前块的前向匹配块以及根据后向运动矢量到后向参考标识指示的后向参考帧中确定当前块的后向匹配块;检测每次确定的前向匹配块和后向匹配块之间的相似度;将最大相似度所对应的运动信息设置为当前块的运动信息。实施本申请可以降低计算复杂度,能够解决现有技术需要进一步提高编码效率的问题。
Description
运动矢量的获取方法、 获取装置、 视频编解码器及其方法 技术领域
本申请涉及视频编解码技术领域, 具体是涉及一种运动矢量的获取方 法及其获取装置, 另外还涉及一种视频编码方法、 视频解码方法、 视频编 码器和视频解码器。 背景技术
在视频序列中通常存在四种冗余: 空域冗余、 时域冗余、 视觉冗余和 编码冗余。 视频编码的目的是为了消除上述冗余, 以实现视频压缩。 在视 频编码阶段, 需要预测当前待编码帧中当前块在帧间编码时的运动矢量, 根据运动矢量计算当前块的残差值, 并将运动补偿后的残差值进行编码, 然后在视频解码阶段利用预测的运动矢量计算得到参考块, 将参考块与残 差值累加以重建当前块。 可见, 计算出符合当前块运动轨迹的准确的运动 矢量, 能够提高编码效果。
现有技术中存在多种预测当前块的运动矢量的方案, 比如在现有的
H.264视频编码方法中,通常釆用 skip或 direct模式预测当前块的运动矢量, 即将当前块在参考帧中相同位置的参考块的运动矢量作为当前块的运动矢 量, 或者釆用模板匹配方法预测当前块的运动矢量, 即选取当前块相邻的 编码区域作为模板区域, 利用模板区域之间的相关性, 将最符合当前块的 运动轨迹的模板区域的运动矢量作为当前块的运动矢量。
然而, 利用现有的预测运动矢量的方案进行视频编码时, 其编码效果 尚不理想, 计算复杂度高, 虽能满足基本需求, 但编码效率有待进一步提 高。 发明内容
有鉴于此, 本申请提供了一种运动矢量的获取方法、 获取装置、 视频 编解码器及其方法, 以解决现有技术需要进一步提高编码效率的问题。
为解决上述问题, 本申请第一方面提供一种运动矢量的获取方法, 获 取方法包括: 获取当前帧中当前块的相邻块的运动信息和第一参考帧中与
当前块位置相同的第一参考块的运动信息, 其中, 第一参考块和相邻块为 已编码或解码的块, 相邻块的运动信息和第一参考块的运动信息包括前向 运动矢量和前向参考标识以及后向运动矢量和后向参考标识; 依次根据每 一相邻块的运动信息和第一参考块的运动信息中的前向运动矢量到前向参 考标识指示的前向参考帧中确定当前块的前向匹配块以及根据后向运动矢 量到后向参考标识指示的后向参考帧中确定当前块的后向匹配块; 检测每 次确定的前向匹配块和后向匹配块之间的相似度; 将最大相似度所对应的 运动信息设置为当前块的运动信息。
结合第一方面, 在第一种可能的实现方式中, 相邻块包括当前块邻接 的左下方、 左方、 左上方、 上方和右上方的五个块中的至少一个。
结合第一方面的第一种可能的实现方式, 在第二种可能的实现方式中, 若当前块邻接的至少一个块不存在, 则将当前块邻接的至少一个块的前向 运动矢量和后向运动矢量均设置为零矢量。
结合第一方面、 第一方面的第一种或第二种可能的实现方式, 在第三 种可能的实现方式中, 检测每次确定的前向匹配块和后向匹配块之间的相 似度的步骤包括: 计算每次确定的前向匹配块的第一像素值以及后向匹配 块的第二像素值; 计算第一像素值与第二像素值之间的差值的度量; 根据 差值的度量检测相似度, 其中, 差值的度量越大, 则相似度越小, 差值的 度量越小, 则相似度越大。
结合第一方面的第三种可能的实现方式, 在第四种可能的实现方式中, 计算第一像素值与第二像素值之间的差值的步骤具体为: 将第一像素值和 第二像素值进行相似度函数计算以获得差值的度量。
结合第一方面的第四种可能的实现方式, 在第五种可能的实现方式中, 相似度函数为绝对误差和:
SAD =∑∑| ( +ix , n+jx ) - f2 (m+ 2 , n+j2 ) |
-l
其中, SAD为差值的度量, ^(m+z' +j;)为第一像素值, /2(m+z'2, "+ 2)为第 二像素值, m和 n分别代表当前块的水平和垂直坐标值, 和 分别为前向 运动矢量在水平和垂直坐标上的分量, 2和』2分别为后向运动矢量在水平和 垂直坐标上的分量, M和 N分别代表当前块的宽度和高度。
结合第一方面的第三种可能的实现方式, 在第六种可能的实现方式中, 计算每次确定的前向匹配块的第一像素值以及后向匹配块的第二像素值的 步骤具体为: 按照预定规则对每次确定的前向匹配块的像素进行抽样得到 第一像素值以及对后向匹配块的像素进行抽样得到第二像素值。
结合第一方面的第六种可能的实现方式, 在第七种可能的实现方式中, 按照预定规则对每次确认的前向匹配块的像素进行抽样得到第一像素值以 及对后向匹配块的像素进行抽样得到第二像素值的步骤为: 按照每行像素 和每列像素上均间隔一个像素的规则对每次确定的前向匹配块的像素进行 抽样得到第一像素值以及对后向匹配块的像素进行抽样得到第二像素值。
结合第一方面, 在第八种可能的实现方式中, 第一参考帧的数量为至 少两个, 则获取第一参考帧中与当前块位置相同的第一参考块的运动信息 的步骤具体为: 获取至少两个第一参考帧中与当前块位置相同的至少两个 第一参考块的运动信息。
为解决上述问题, 本申请第二方面提供一种视频编码方法, 视频编码 方法包括: 釆用上述任一种所述的获取方法获得当前帧中当前块的运动信 息; 根据运动信息中的前向运动矢量到前向参考标识指示的前向参考帧中 确定当前块的前向匹配块以及根据后向运动矢量到后向参考标识指示的后 向参考帧中确定当前块的后向匹配块; 根据前向匹配块的第一像素值和后 向匹配块的第二像素值生成参考像素值, 并计算参考像素值和当前块的真 实像素值之间的目标残差值; 在码流中编码目标残差值并在码流中添加运 算标识。
结合第二方面, 在第一种可能的实现方式中, 参考像素值为第一像素 值和第二像素值的加权平均值。
为解决上述问题, 本申请第三方面提供一种视频解码方法, 视频解码 方法包括: 从接收到的码流中解码出目标残差值和运算标识; 根据运算标 识釆用上述任一种所述的获取方法获得当前帧中当前块的运动信息; 根据 运动信息中的前向运动矢量到前向参考标识指示的前向参考帧中确定当前 块的前向匹配块以及根据后向运动矢量到后向参考标识指示的后向参考帧 中确定当前块的后向匹配块; 根据前向匹配块的第一像素值和后向匹配块 的第二像素值生成参考像素值; 将参考像素值与目标残差值进行累加以重
构当前块。
结合第三方面, 在第一种可能的实现方式中, 参考像素值为第一像素 值和第二像素值的加权平均值。
为解决上述问题, 本申请第四方面提供一种获取装置, 获取装置包括 获取模块、 确定模块、 检测模块和设置模块, 其中, 获取模块用于获取当 前帧中当前块的相邻块的运动信息和第一参考帧中与当前块位置相同的第 一参考块的运动信息, 并将每一运动信息发送给确定模块, 其中, 第一参 考块和相邻块为已编码或解码的块, 相邻块的运动信息和第一参考块的运 动信息包括前向运动矢量和前向参考标识以及后向运动矢量和后向参考标 识; 确定模块用于从获取模块接收每一相邻块的运动信息和第一参考块的 运动信息, 依次根据每一相邻块的运动信息和第一参考块的运动信息中的 前向运动矢量到前向参考标识指示的前向参考帧中确定当前块的前向匹配 块以及根据后向运动矢量到后向参考标识指示的后向参考帧中确定当前块 的后向匹配块, 并将确定结果发送给检测模块; 检测模块用于从确定模块 接收确定结果, 检测每次确定的前向匹配块和后向匹配块之间的相似度, 并将相似度发送给设置模块; 设置模块用于从检测模块接收相似度, 并将 最大相似度所对应的运动信息设置为当前块的运动信息。
结合第四方面, 在第一种可能的实现方式中, 相邻块包括当前块邻接 的左下方、 左方、 左上方、 上方和右上方的五个块中的至少一个。
结合第四方面的第一种可能的实现方式, 在第二种可能的实现方式中, 若当前块邻接的至少一个块不存在, 则获取模块将当前块邻接的至少一个 块的前向运动矢量和后向运动矢量均设置为零矢量。
结合第四方面、 第四方面的第一种或第二种可能的实现方式, 在第三 种可能的实现方式中, 检测模块包括第一计算单元、 第二计算单元和检测 单元, 其中, 第一计算单元用于从确定模块接收确定结果, 计算每次确定 的前向匹配块的第一像素值以及后向匹配块的第二像素值, 并将第一像素 值和第二像素值发送给第二计算单元; 第二计算单元用于从第一计算单元 接收第一像素值和第二像素值, 计算第一像素值与第二像素值之间的差值 的度量, 并将差值的度量发送给检测单元; 检测单元用于从第二计算单元 接收差值的度量, 根据差值的度量检测相似度, 并将相似度发送给设置模
块, 其中, 差值的度量越大, 则相似度越小, 差值的度量越小, 则相似度 越大。
结合第四方面的第三种可能的实现方式, 在第四种可能的实现方式中, 第二计算单元具体用于将第一像素值和第二像素值进行相似度函数计算以 获得差值的度量。
结合第四方面的第四种可能的实现方式, 在第五种可能的实现方式中, 相似度函数为绝对误差和:
SAD I /; , n+jx ) - f2 (m+i2 , n+j2 )j
其中, SAD为差值的度量, /1(m+ 1, «+)为第一像素值, /2(m+ 2,«+ 2)为第 二像素值, m和 n分别代表当前块的水平和垂直坐标值, 和^分别为前向 运动矢量在水平和垂直坐标上的分量, 2和』2分别为后向运动矢量在水平和 垂直坐标上的分量, M和 N分别代表当前块的宽度和高度。
结合第四方面的第三种可能的实现方式, 在第六种可能的实现方式中, 第一计算单元具体用于按照预定规则对每次确定的前向匹配块的像素进行 抽样得到第一像素值以及对前向匹配块的像素进行抽样得到第二像素值。
结合第四方面的第六种可能的实现方式, 在第七种可能的实现方式中, 预定规则为每行像素和每列像素上均间隔一个像素的规则。
结合第四方面, 在第八种可能的实现方式中, 第一参考帧的数量为至 少两个, 则获取模块具体用于获取至少两个第一参考帧中与当前块位置相 同的至少两个第一参考块的运动信息。
为解决上述问题, 本申请第五方面提供一种视频编码器, 视频编码器 包括确定装置、 计算装置、 编码装置和上述任一种所述的获取装置, 其中, 获取装置用于获得当前帧中当前块的运动信息; 确定装置用于根据运动信 息中的前向运动矢量到前向参考标识指示的前向参考帧中确定当前块的前 向匹配块以及根据后向运动矢量到后向参考标识指示的后向参考帧中确定 当前块的后向匹配块; 计算装置用于根据前向匹配块的第一像素值和后向 匹配块的第二像素值生成参考像素值, 并计算参考像素值和当前块的真实 像素值之间的目标残差值; 编码装置用于在码流中编码目标残差值并在码 流中添加运算标识。
结合第五方面, 在第一种可能的实现方式中, 参考像素值为第一像素 值和第二像素值的加权平均值。
为解决上述问题, 本申请第六方面提供一种视频解码器, 视频解码器 包括解码装置、 确定装置、 计算装置、 重构装置和上述任一种所述的获取 装置, 其中, 解码装置用于从接收到的码流中解码出目标残差值和运算标 识; 获取装置用于根据运算标识获得当前帧中当前块的运动信息; 确定装 置用于根据运动信息中的前向运动矢量到前向参考标识指示的前向参考帧 中确定当前块的前向匹配块以及根据后向运动矢量到后向参考标识指示的 后向参考帧中确定当前块的后向匹配块; 计算装置用于根据前向匹配块的 第一像素值和后向匹配块的第二像素值生成参考像素值; 重构装置用于将 参考像素值与目标残差值进行累加以重构当前块。
结合第六方面, 在第一种可能的实现方式中, 参考像素值为第一像素 值和第二像素值的加权平均值。
为解决上述问题, 本申请第七方面提供一种获取装置, 其包括处理器、 接收器、 发送器、 随机存取存储器、 只读存储器、 总线以及网络接口单元, 其中, 处理器通过总线分别耦接接收器、 发送器、 随机存取存储器、 只读 存储器以及网络接口单元, 在获取装置进入正常运行状态后, 在随机存取 存储器中运行应用程序和操作系统, 使得: 处理器获取当前帧中当前块的 相邻块的运动信息和第一参考帧中与当前块位置相同的第一参考块的运动 信息, 其中, 第一参考块和相邻块为已编码或解码的块, 相邻块的运动信 息和第一参考块的运动信息包括前向运动矢量和前向参考标识以及后向运 动矢量和后向参考标识; 依次根据每一相邻块的运动信息和第一参考块的 运动信息中的前向运动矢量在前向参考标识指示的前向参考帧中确定当前 块的前向匹配块, 以及根据后向运动矢量在后向参考标识指示的后向参考 帧中确定当前块的后向匹配块; 检测每次确定的前向匹配块和后向匹配块 之间的相似度; 将最大相似度所对应的运动信息设置为当前块的运动信息。
结合第七方面, 在第一种可能的实现方式中, 相邻块包括当前块邻接 的左下方、 左方、 左上方、 上方和右上方的五个块中的至少一个。
结合第七方面的第一种可能的实现方式, 在第二种可能的实现方式中, 处理器用于: 若当前块邻接的至少一个块不存在, 则将当前块邻接的至少
一个块的前向运动矢量和后向运动矢量均设置为零矢量。
结合第七方面至第七方面的第二种可能的实现方式, 在第三种可能的 实现方式中, 处理器用于: 计算每次确定的前向匹配块的第一像素值以及 后向匹配块的第二像素值; 计算第一像素值与第二像素值之间的差值的度 量; 根据差值的度量检测相似度, 其中, 差值的度量越大, 则相似度越小, 差值的度量越小, 则相似度越大。
结合第七方面的第三种可能的实现方式, 在第四种可能的实现方式中, 处理器用于: 将第一像素值和第二像素值进行相似度函数计算以获得差值 的度量。
结合第七方面的第四种可能的实现方式, 在第五种可能的实现方式中, 相似度函数为绝对误差和 SAD:
SAD I /; , n+jx ) - f2 (m+i2 , n+j2 )|
其中, SAD为差值的度量, /1(m+ 1, «+)为第一像素值, /2(m+ 2, «+ 2)为第二像 素值, m和 n分别代表当前块的水平和垂直坐标值, 和 分别为前向运动 矢量在水平和垂直坐标上的分量, 2和』2分别为后向运动矢量在水平和垂直 坐标上的分量, M和 N分别代表当前块的宽度和高度。
结合第七方面的第三种可能的实现方式, 在第六种可能的实现方式中, 处理器用于: 按照预定规则对每次确定的前向匹配块的像素进行抽样得到 第一像素值以及对后向匹配块的像素进行抽样得到第二像素值。
结合第七方面的第六种可能的实现方式, 在第七种可能的实现方式中, 处理器用于: 按照每行像素和每列像素上均间隔一个像素的规则对每次确 定的前向匹配块的像素进行抽样得到第一像素值以及对后向匹配块的像素 进行抽样得到第二像素值。
结合第七方面, 在第八种可能的实现方式中, 处理器用于: 获取至少 两个第一参考帧中与当前块位置相同的至少两个第一参考块的运动信息。
为解决上述问题, 本申请第八方面提供一种视频解码器, 其包括解码 装置、 确定装置、 计算装置、 重构装置和根据上述任一种所述的的获取装 置, 其中, 解码装置用于从接收到的码流中解码出目标残差值和运算标识; 获取装置用于根据运算标识获得当前帧中当前块的运动信息; 确定装置用
于根据运动信息中的前向运动矢量到前向参考标识指示的前向参考帧中确 定当前块的前向匹配块以及根据后向运动矢量到后向参考标识指示的后向 参考帧中确定当前块的后向匹配块; 计算装置用于根据前向匹配块的第一 像素值和后向匹配块的第二像素值生成参考像素值; 重构装置用于将参考 像素值与目标残差值进行累加以重构当前块。
结合第八方面, 在第一种可能的实现方式中, 参考像素值为第一像素 值和第二像素值的加权平均值。
本申请的运动矢量的获取方法、 获取装置、 视频编解码器及其方法不 仅获取当前块在当前帧中的相邻块的运动信息, 还获取当前块在参考帧中 相同位置的参考块的运动信息, 每一运动信息又包括前向和后向的运动矢 量以及前向参考标识和后向参考标识, 前向参考标识和后向参考标识分别 指示前向参考帧和后向参考帧, 通过前向和后向运动矢量可以确定出当前 块的前向匹配块和后向匹配块并检测两者相似度, 进而将最大相似度对应 的运动信息设置为当前块的运动信息, 通过这种方式, 综合考虑了视频序 列的空域相关性和时域相关性, 可以提高编码效果, 又由于仅计算两个匹 配块之间的相似度, 可以减少计算复杂度, 从而解决现有技术需要进一步 提高编码效率的问题。 附图说明
为了更清楚地说明本发明实施例中的技术方案, 下面将对实施例描述 中所需要使用的附图作简单地介绍, 显而易见地, 下面描述中的附图仅仅 是本发明的一些实施例, 对于本领域普通技术人员来讲, 在不付出创造性 劳动的前提下, 还可以根据这些附图获得其他的附图。 其中:
图 1是本发明运动矢量的获取方法第一实施例的流程示意图; 图 2是本发明运动矢量的获取方法第二实施例的流程示意图; 图 3是本发明中当前块和相邻块的空间位置示意图;
图 4是本发明中当前帧与前向参考帧和后向参考帧的位置示意图; 图 5是本发明中前向参考帧中前向匹配块的像素示意图;
图 6是本发明视频编码方法一实施例的流程示意图;
图 7是本发明视频解码方法一实施例的流程示意图;
图 8是本发明获取装置第一实施例的结构示意图;
图 9是本发明获取装置第二实施例的结构示意图;
图 10是本发明视频编码器一实施例的结构示意图;
图 11是本发明视频解码器一实施例的结构示意图;
图 12是本发明获取装置第三实施例的结构示意图。 具体实施方式
以下描述中, 为了说明而不是为了限定, 提出了诸如特定系统结构、 接口、 技术之类的具体细节, 以便透切理解本申请。 然而, 本领域的技术 人员应当清楚, 在没有这些具体细节的其它实施方式中也可以实现本申请。 在其它情况中, 省略对众所周知的装置、 电路以及方法的详细说明, 以免 不必要的细节妨碍本申请的描述。
下面结合附图和具体的实施方式进行说明。
参见图 1, 是本发明运动矢量的获取方法第一实施例的流程示意图。运 动矢量的获取方法包括以下步骤:
步骤 S11 :获取当前帧中当前块的相邻块的运动信息和第一参考帧中与 当前块位置相同的第一参考块的运动信息, 其中, 第一参考块和相邻块为 已编码或解码的块, 相邻块的运动信息和第一参考块的运动信息包括前向 运动矢量和前向参考标识以及后向运动矢量和后向参考标识。
其中, 在编码时, 会依次接收原始视频序列中的各帧。 在解码时, 会 接收到已编码的各帧。 在编码或解码当前帧时, 当前帧被划分为互不重叠 的编码块, 当前块就是即将进行编码或解码的块。 而第一参考帧是在当前 帧之前已经编码或解码的帧。
当前帧被划分为互不重叠的块,每个块的尺寸可以是 16x16像素、 32x32 像素或者 64x64像素等。块可以是宏块,或者是 h.265标准中的 CU, coding tree。 除了当前帧左上角的块以外, 每个块的相邻块必然有一部分是已经编 码或解码的块。
在本实施例中, 第一参考帧的数量为至少两个, 则需要获取至少两个 第一参考帧中与当前块位置相同的至少两个第一参考块的运动信息。 第一 参考帧可以是前向的帧也可以是后向的帧, 如果第一参考帧为多个, 那么
第一参考帧可以全部是前向的帧, 也可以全部是后向的帧。
由于相邻块和第一参考块已经编码或者解码, 所以它们的运动信息是 已知的。
步骤 S12:依次根据每一相邻块的运动信息和第一参考块的运动信息中 的前向运动矢量到前向参考标识指示的前向参考帧中确定当前块的前向匹 配块以及根据后向运动矢量到后向参考标识指示的后向参考帧中确定当前 块的后向匹配块。
其中, 前向参考标识和后向参考标识在运动信息中分别与前向运动矢 量和后向运动矢量匹配, 用于指示相邻块或第一参考块所对应的前向参考 帧和后向参考帧。
确定前向匹配块的过程为: 根据前向参考标识确定当前帧的前向参考 帧, 在前向参考帧中以与当前块位置相同的块为起点, 沿着前向运动矢量 的运动轨迹, 前向运动矢量的终点所指向的块即为前向匹配块。 同样的, 后向匹配块也釆用同样的方式确定。 每个运动信息对应有一个前向匹配块 和后向匹配块。
步骤 S13: 检测每次确定的前向匹配块和后向匹配块之间的相似度。 其中, 帧间的关系为时域关系, 一般来说, 编码的帧在时域上都具有 相关性, 也就是视频数据之间具有相关性。 比如, 当同一个运动物体在不 同帧中都以同样的速度进行匀速运动, 那么在这些帧中运动矢量是相同的。
帧内各块之间的关系为空域关系, 如果当前块与某个相邻块是帧中同 一个运动物体, 那么相邻块的运动矢量就能代表当前块的运动矢量, 相邻 块在前向参考帧的前向匹配块和后向参考帧中的后向匹配块就等同于当前 块的前向匹配块和后向匹配块。
步骤 S14: 将最大相似度所对应的运动信息设置为当前块的运动信息。 本发明实施例的运动矢量的获取方法充分考虑到视频压缩编码中的时 域相关性和空域相关性, 通过空域相邻块和时域参考块的运动信息得到当 前块的前向匹配块和后向匹配块, 再选出前向匹配块和后向匹配块之间最 大相似度所对应的运动信息作为当前块的运动信息对, 由于综合考虑了视 频序列的空域相关性和时域相关性, 可以提高现有技术的编码效果, 并且 只计算单个块之间的相似度, 计算复杂度大为降低, 解决现有技术需要进
一步提高编码效率的问题。
为了便于理解本发明, 以下结合附图 2-5对本发明做进一步具体介绍。 如图 2所示, 是本发明运动矢量的获取方法第二实施例的流程示意图。 运 动矢量的获取方法包括以下步骤:
步骤 S21 :获取当前帧中当前块的相邻块的运动信息和第一参考帧中与 当前块位置相同的第一参考块的运动信息, 其中, 第一参考块和相邻块为 已编码或解码的块, 相邻块的运动信息和第一参考块的运动信息包括前向 运动矢量和前向参考标识以及后向运动矢量和后向参考标识。
其中, 相邻块包括当前块 CB邻接的左下方、 左方、 左上方、 上方和右 上方的四个块 A、 B、 C、 D、 E中的至少一个(见图 3 )。 优选地, 本实施 例获取当前块 CB的四个相邻块 A、 B、 C、 D的运动信息。 在本实施例中, 第一参考帧为一个, 那么运动信息的数量总共为 5个。 当然, 第一参考帧 可以为多个, 那么获取的运动信息的数量就相应增加。
如果当前块 CB恰好处于当前帧 CF的边缘, 例如处于当前帧 CF的左 上角, 那么当前块的左方、 左上方、 上方或右上方均不存在邻接的至少一 个块,则将当前块 CB邻接的至少一个块的前向运动矢量和后向运动矢量均 设置为零矢量。
进一步地, 由于块还可以继续划分为更小的块, 所以当前块 CB的相邻 块八、 B、 C、 D可以是与当前块 CB相同尺寸的块, 或者也可以是更小的 块(如图 3所示)。
步骤 S22:依次根据每一相邻块的运动信息和第一参考块的运动信息中 的前向运动矢量到前向参考标识指示的前向参考帧中确定当前块的前向匹 配块以及根据后向运动矢量到后向参考标识指示的后向参考帧中确定当前 块的后向匹配块。
其中, 以相邻块 A为例, 其运动信息包含前向运动矢量 mval和前向 参考标识以及后向运动矢量 mva2和后向参考标识(见图 4 ), 寻找前向匹 配块 FB和后向匹配块 BB的过程如下:
根据前向参考标识可以确定当前帧 CF的前向参考帧 FF, 在前向参考 帧 FF中找到与当前块 CB位置相同的块, 然后以该块为起点, 沿着前向运 动矢量 mval就可以找到前向匹配块 FB, 即前向运动矢量 mval的箭头所
指向的块。
同样的, 根据后向参考标识可以确定当前帧 CF的后向参考帧 BF, 在 后向参考帧 BF中找到与当前块 CB位置相同的块, 然后以该块为起点, 沿 着后向运动矢量 mva2就可以找到后向匹配块 BB, 即后向运动矢量 mva2 的箭头所指向的块。
步骤 S23: 检测每次确定的前向匹配块和后向匹配块之间的相似度。 其中, 相似度可以由前向匹配块和后向匹配块之间的差值的度量来表 征。 具体地, 步骤 S23包括:
步骤 S231 : 计算每次确定的前向匹配块的第一像素值以及后向匹配块 的第二像素值。
其中, 每一个块都由像素组成。 比如, 尺寸为 16x16像素的块包含 1 个 16x16的亮度像素块和 2个 8x8的色度像素块。 每一个像素点的像素值 的总和就构成块的像素值。 这里, 前向匹配块 FB和后向匹配块 BB的尺寸 大小都相同, 像素数目也相同。 在本实施例中, 步骤 S231具体为: 按照预 定规则对每次确定的前向匹配块的像素进行抽样得到第一像素值以及对后 向匹配块的像素进行抽样得到第二像素值。
预定规则可以为每行像素和每列像素上均间隔一个像素的规则, 即隔 行隔列抽样像素。 如图 5所示, 以尺寸为 16x16像素的块为例, 前向匹配 块 FB具有 16x16个像素,按照隔行隔列抽样阴影部分的像素就得到第一像 素值。 当然, 预定规则可以根据实际需要设定, 本发明对此不作限定。
步骤 S232: 计算第一像素值与第二像素值之间的差值的度量。
其中, 差值为第一像素值和第二像素值相减的结果, 差值的度量为差 值的一阶或二阶值。
在本实施例中, 步骤 S232具体为: 将第一像素值和第二像素值进行相 似度函数计算以获得差值的度量。 相似度函数可以为误差和、 绝对误差和 ( sum of absolute differences , SAD ), 绝对变换误差和、 绝对平方差和等。 也就是说, 可以釆用一阶或二阶的误差公式计算差值。 本实施例优选为绝 对误差和:
SAD
I /; ( , n+jx ) - f2 (m+i2 , n+j2 )j
其中, SAD为差值的度量, /1(m+ 1, «+)为第一像素值, /2(m+ 2, «+ )为 第二像素值, m和 n分别代表当前块 CB的水平和垂直坐标值, 和^分别 为前向运动矢量 mval在水平和垂直坐标上的分量, 2和』2分别为后向运动 矢量 mva2在水平和垂直坐标上的分量, M和 N分别代表当前块 CB的宽 度和高度, 即当前块 CB的尺寸。 M和 N的具体取值以当前块 CB的分块 方式确定, 如果当前块 CB为 16x16, 那么 M=16, N=16。
步骤 S233: 根据差值的度量检测相似度, 其中, 差值的度量越大, 相 似度越小, 差值的度量越小, 相似度越大。
其中, 差值的度量越小, 那么说明前向匹配块 FB和后向匹配块 BB越 接近, 相似度就越大。 相似度可以量化为具体的值, 以方便比较。
步骤 S24: 将最大相似度所对应的运动信息设置为当前块的运动信息。 本发明实施例的运动矢量的获取方法充分考虑到视频压缩编码中的时 域相关性和空域相关性, 通过空域相邻块和时域参考块的运动信息得到当 前块的前向匹配块和后向匹配块, 并抽样得到两个匹配块的像素值, 再利 用绝对误差和得到两个像素值之间的差值, 从而将差值最小所对应的运动 信息设置为当前块的运动信息, 通过抽样像素, 能够大为降低计算复杂度。
参见图 6, 是本发明视频编码方法一实施例的流程示意图。视频编码方 法釆用上述任一实施例的运动矢量的获取方法, 视频编码方法包括以下步 骤:
步骤 S31 : 获得当前帧中当前块的运动信息。
其中, 当前帧中当前块的运动信息通过上述任一实施例的运动矢量的 获取方法获得。
步骤 S32:根据运动信息中的前向运动矢量到前向参考标识指示的前向 参考帧中确定当前块的前向匹配块以及根据后向运动矢量到后向参考标识 指示的后向参考帧中确定当前块的后向匹配块。
步骤 S33:根据前向匹配块的第一像素值和后向匹配块的第二像素值生 成参考像素值, 并计算参考像素值和当前块的真实像素值之间的目标残差 值。
其中, 参考像素值优选为第一像素值和第二像素值的加权平均值, 第 一像素值和第二像素值的权重可以根据实际需要设置。 在本实施例中, 计
算参考像素值和真实像素值时, 需要计算所有像素。
步骤 S34: 在码流中编码目标残差值并在码流中添加运算标识。
其中, 由于不需要将运动信息写入码流, 节省了编码所需的比特。 经 码率 3.12%。
本发明实施例的视频编码方法通过获得当前块的运动信息, 再由运动 信息确定当前块的前向匹配块和后向匹配块, 通过前向匹配块和后向匹配 块的像素值生成参考像素值, 进而获得参考像素值与真实像素值之间的目 标残差值, 由于获得运动信息时, 综合考虑了视频序列的空域相关性和时 域相关性, 可以提高编码效果, 降低计算复杂度, 而且不需要将运动信息 写入码流, 能够降低码率。
参见图 7, 是本发明视频解码方法一实施例的流程示意图。视频解码方 法釆用上述任一实施例的运动矢量的获取方法, 视频解码方法包括以下步 骤:
步骤 S41 : 从接收到的码流中解码出目标残差值和运算标识。 取方法。
步骤 S42: 根据运算标识釆用获得当前帧中当前块的运动信息。
其中, 由于编码时釆用了上述的运动矢量的获取方法, 所以解码时应 当釆用同样的运动矢量的获取方法。
步骤 S43:根据运动信息中的前向运动矢量到前向参考标识指示的前向 参考帧中确定当前块的前向匹配块以及根据后向运动矢量到后向参考标识 指示的后向参考帧中确定当前块的后向匹配块。
步骤 S44:根据前向匹配块的第一像素值和后向匹配块的第二像素值生 成参考像素值。
其中, 参考像素值优选为第一像素值和第二像素值的加权平均值, 第 一像素值和第二像素值的权重可以根据实际需要设置。
应当注意的是, 由于本实施例的视频解码方法和前述实施例的视频编 码方法都釆用相同的运动矢量的获取方法, 因此, 获得的运动信息是相同 的, 而且会釆用同样的方式获取参考像素值, 所以参考像素值也是相同的。
步骤 S45: 将参考像素值与目标残差值进行累加以重构当前块。
其中, 参考像素值与目标残差值进行累加后, 得到的值即为当前块的 真实像素值。
本发明实施例的视频解码方法通过获得当前块的运动信息, 再由运动 信息确定当前块的前向匹配块和后向匹配块, 通过前向匹配块和后向匹配 块的像素值生成参考像素值, 并由参考像素值累加目标残差值以重构当前 块, 由于获得运动信息时, 综合考虑了视频序列的空域相关性和时域相关 性, 可以提高编码效果, 降低计算复杂度, 而且在解码码流时, 只需解码 目标残差值, 不需要解码运动信息, 所以解码效率提高。
参见图 8, 是本发明获取装置第一实施例的结构示意图。 获取装置包括 获取模块 51、 确定模块 52、 检测模块 53和设置模块 54。
获取模块 51用于获取当前帧中当前块的相邻块的运动信息和第一参考 帧中与当前块位置相同的第一参考块的运动信息, 并将每一相邻块的运动 信息和第一参考块的运动信息发送给确定模块 52, 其中, 第一参考块和相 邻块为已编码或解码的块, 相邻块的运动信息和第一参考块的运动信息包 括前向运动矢量和前向参考标识以及后向运动矢量和后向参考标识。 在编 码时, 会依次接收原始视频序列中的各帧。 在解码时, 会接收到已编码的 各帧。 在编码或解码当前帧时, 当前帧被划分为互不重叠的编码块, 当前 块就是即将进行编码或解码的块。 而第一参考帧是在当前帧之前已经编码 或解码的帧。 在本实施例中, 第一参考帧的数量为至少两个, 则获取模块 51需要获取至少两个第一参考帧中与当前块位置相同的至少两个第一参考 块的运动信息。 第一参考真可以是前向的帧也可以是后向的帧, 如果第一 参考帧为多个, 那么第一参考帧可以全部是前向的帧, 也可以全部是后向 的帧。
确定模块 52用于从获取模块 51接收每一相邻块的运动信息和第一参 考块的运动信息, 依次根据每一相邻块的运动信息和第一参考块的运动信 息中的前向运动矢量到前向参考标识指示的前向参考帧中确定当前块的前 向匹配块以及根据后向运动矢量到后向参考标识指示的后向参考帧中确定 当前块的后向匹配块, 并将确定结果发送给检测模块 53。 前向参考标识和 后向参考标识在运动信息中分别与前向运动矢量和后向运动矢量匹配, 用
于指示相邻块或第一参考块所对应的前向参考帧和后向参考帧。 确定模块
52确定前向匹配块的过程为:根据前向参考标识确定当前帧的前向参考帧, 在前向参考帧中以与当前块位置相同的块为起点, 沿着前向运动矢量的运 动轨迹, 前向运动矢量的终点所指向的块即为前向匹配块。 同样的, 后向 匹配块也釆用同样的方式确定。 每个运动信息对应有一个前向匹配块和后 向匹配块。
检测模块 53用于从确定模块 52接收确定结果, 检测每次确定的前向 匹配块和后向匹配块之间的相似度, 并将相似度发送给设置模块 54。 帧间 的关系为时域关系, 一般来说, 编码的帧在时域上都具有相关性, 也就是 视频数据之间具有相关性。 比如, 当同一个运动物体在不同帧中都以同样 的速度进行匀速运动, 那么可以认为在这些帧中运动矢量是相同的。 帧内 各块之间的关系为空域关系, 如果当前块与某个相邻块是帧中同一个运动 物体, 那么相邻块的运动矢量就能代表当前块的运动矢量, 相邻块在前向 参考帧的前向匹配块和后向参考帧中的后向匹配块就等同于当前块的前向 匹配块和后向匹配块。
设置模块 54用于从检测模块 53接收相似度, 并将最大相似度所对应 的运动信息设置为当前块的运动信息。
本发明实施例的获取装置充分考虑到视频压缩编码中的时域相关性和 空域相关性, 通过空域相邻块和时域参考块的运动信息得到当前块的前向 匹配块和后向匹配块, 再选出前向匹配块和后向匹配块之间相似度最大所 对应的运动信息作为当前块的运动信息, 由于综合考虑了视频序列的空域 相关性和时域相关性, 可以提高现有技术的编码效果, 并且只计算单个块 之间的相似度, 计算复杂度大为降低, 解决现有技术需要进一步提高编码 效率的问题。
参见图 9, 是本发明获取装置第二实施例的结构示意图。 获取装置包括 获取模块 61、 确定模块 62、 检测模块 63和设置模块 64。 检测模块 63包括 第一计算单元 631、 第二计算单元 632和检测单元 633。
获取模块 61用于获取当前帧中当前块的相邻块的运动信息和第一参考 帧中与当前块位置相同的第一参考块的运动信息, 并将每一相邻块的运动 信息和第一参考块的运动信息发送给确定模块 62, 其中, 第一参考块和相
邻块为已编码或解码的块, 相邻块的运动信息和第一参考块的运动信息包 括前向运动矢量和前向参考标识以及后向运动矢量和后向参考标识。 相邻 块包括当前块邻接的左下方、 左方、 左上方、 上方和右上方的四个块中的 至少一个。 优选地, 本实施例获取当前块的四个相邻块的运动信息。 如果 第一参考帧为一个, 那么运动信息的数量总共为 5个。 如果第一参考帧为 多个, 那么获取的运动信息的数量就相应增加。 在本实施例中, 如果当前 块恰好处于当前帧的边缘, 例如处于当前帧的左上角, 那么当前块的左方、 左上方、 上方或右上方均不存在邻接的块, 则获取模块 61将当前块邻接的 块的前向运动矢量和后向运动矢量均设置为零矢量。 进一步地, 由于块还 可以继续划分为更小的块, 所以相邻的块可以是与当前块相同尺寸的块, 或者也可以是更小的块。
确定模块 62用于从获取模块 61接收每一相邻块的运动信息和第一参 考块的运动信息, 依次根据每一相邻块的运动信息第一参考块的运动信息 中的前向运动矢量到前向参考标识指示的前向参考帧中确定当前块的前向 匹配块以及根据后向运动矢量到后向参考标识指示的后向参考帧中确定当 前块的后向匹配块, 并将确定结果发送给检测模块 63。 寻找前向匹配块和 后向匹配块的过程如下: 根据前向参考标识可以确定当前帧的前向参考帧, 在前向参考帧中找到与当前块位置相同的块, 然后以该块为起点, 沿着前 向运动矢量就可以找到前向匹配块, 即前向运动矢量的终点所指向的块。 同样的, 根据后向参考标识可以确定当前帧的后向参考帧, 在后向参考帧 中找到与当前块位置相同的块, 然后以该块为起点, 沿着后向运动矢量就 可以找到后向匹配块, 即后向运动矢量的终点所指向的块。
检测模块 63用于从确定模块 62接收确定结果, 检测每次确定的前向 匹配块和后向匹配块之间的相似度, 并将相似度发送给设置模块 64。
设置模块 64用于从检测模块 63接收相似度, 并将最大相似度所对应 的运动信息设置为当前块的运动信息。
检测模块 63检测的相似度可以由前向匹配块和后向匹配块之间的差值 的度量来表征。 具体地:
第一计算单元 631 用于计算每次确定的前向匹配块的第一像素值以及 后向匹配块的第二像素值。 每一个块都由像素组成, 每一个像素点的像素
值的总和就构成块的像素值。 这里, 前向匹配块和后向匹配块的尺寸大小 都相同, 像素数目也相同。 在本实施例中, 第一计算单元 631 具体用于按 照预定规则对每次确定的前向匹配块的像素进行抽样得到第一像素值以及 对后向匹配块的像素进行抽样得到第二像素值。 预定规则可以为每行像素 和每列像素上均间隔一个像素的规则, 即隔行隔列抽样像素。 当然, 预定 规则可以根据实际需要设定, 本发明对此不作限定。
第二计算单元 632用于计算第一像素值与第二像素值之间的差值的度 量。 在本发明的一个应用场景中, 第二计算单元 632将第一像素值和第二 像素值进行相似度函数计算以获得差值的度量。 相似度函数优选为绝对误 差和:
SAD I /; ( +i, , n+jx ) - f2 (m+i2 , n+j2 )j
其中, SAD为差值的度量, /1(m+ 1,«+)为第一像素值, /2(m+ 2, «+ )为第 二像素值, m和 n分别代表当前块的水平和垂直坐标值, 和^分别为前向 运动矢量在水平和垂直坐标上的分量, 2和』2分别为后向运动矢量在水平和 垂直坐标上的分量, M和 N分别代表当前块的宽度和高度。 M和 N即为当 前块的尺寸, M和 N的具体取值以当前块 CB的分块方式确定, 如果当前 块 CB为 16x16, 那么 M=16, N=16。
检测单元 633用于根据差值的度量检测相似度, 其中, 差值的度量与 相似度成反比。 差值的度量越小, 那么说明前向匹配块和后向匹配块越接 近, 相似度就越大。 反之, 差值的度量越大, 相似度越小。
本发明实施例的获取装置充分考虑到视频压缩编码中的时域相关性和 空域相关性, 通过空域相邻块和时域参考块的运动信息得到当前块的前向 匹配块和后向匹配块, 并抽样得到两个匹配块的像素值, 再利用绝对误差 和得到两个像素值之间的差值的度量, 从而将最小差值的度量所对应的运 动信息设置为当前块的运动信息, 通过抽样像素, 能够大为降低计算复杂 度。
参见图 10, 是本发明视频编码器一实施例的结构示意图。 视频编码器 包括获取装置 71、 确定装置 72、 计算装置 73和编码装置 74。 其中, 获取 装置 71为上述任一实施例的获取装置。
获取装置 71用于获得当前帧中当前块的运动信息。
确定装置 72用于根据运动信息中的前向运动矢量到前向参考标识指示 的前向参考帧中确定当前块的前向匹配块以及根据后向运动矢量到后向参 考标识指示的后向参考帧中确定当前块的后向匹配块。
计算装置 73用于根据前向匹配块的第一像素值和后向匹配块的第二像 素值生成参考像素值, 并计算参考像素值和当前块的真实像素值之间的目 标残差值。 其中, 参考像素值优选为第一像素值和第二像素值的加权平均 值。 在本实施例中, 计算参考像素值和真实像素值时, 需要计算所有像素。
编码装置 74用于在码流中编码目标残差值并在码流中添加运算标识。 由于不需要将运动信息写入码流, 可以节省编码需的比特, 节省了码率。 够节省码率 3.12%。
本发明实施例的视频编码器通过获得当前块的运动信息, 再由运动信 息确定当前块的前向匹配块和后向匹配块, 通过前向匹配块和后向匹配块 的像素值生成参考像素值, 进而获得参考像素值与真实像素值之间的目标 残差值, 由于获得运动信息时, 综合考虑了视频序列的空域相关性和时域 相关性, 可以提高编码效果, 降低计算复杂度, 而且不需要将运动信息写 入码流, 能够降低码率。
参见图 11, 是本发明视频解码器一实施例的结构示意图。 视频解码器 包括解码装置 81、获取装置 82、确定装置 83、计算装置 84和重构装置 85。 其中, 获取装置 82为上述任一实施例的获取装置。
解码装置 81用于从接收到的码流中解码出目标残差值和运算标识。 获取装置 82用于根据运算标识获得当前帧中当前块的运动信息。 运算 标识用于说明视频编码器中的获取装置获得运动信息的方式。 则获取装置 82发现码流中的运算标识后, 将釆用与视频编码器同样的方式获得当前帧 中当前块的运动信息。
确定装置 83用于根据运动信息中的前向运动矢量到前向参考标识指示 的前向参考帧中确定当前块的前向匹配块以及根据后向运动矢量到后向参 考标识指示的后向参考帧中确定当前块的后向匹配块。
计算装置 84用于根据前向匹配块的第一像素值和后向匹配块的第二像
素值生成参考像素值。 参考像素值优选为第一像素值和第二像素值的加权 平均值, 第一像素值和第二像素值的权重可以根据实际需要设置。 应当注 意的是, 由于本实施例的视频解码器和前述实施例的视频编码器都釆用相 同的获取装置, 因此, 获得的运动信息是相同的, 而且会釆用同样的方式 获取参考像素值, 所以参考像素值也是相同的。
重构装置 85用于将参考像素值与目标残差值进行累加以重构当前块。 参考像素值与目标残差值进行累加后, 得到的值即为当前块的真实像素值。
本发明实施例的视频解码器通过获得当前块的运动信息, 再由运动信 息确定当前块的前向匹配块和后向匹配块, 通过前向匹配块和后向匹配块 的像素值生成参考像素值, 并由参考像素值累加目标残差值以重构当前块, 由于获得运动信息时, 综合考虑了视频序列的空域相关性和时域相关性, 可以提高编码效果, 降低计算复杂度, 而且在解码码流时, 只需解码目标 残差值, 不需要解码运动信息, 所以解码效率提高。
参见图 12, 是本发明获取装置第三实施例的结构示意图。 获取装置包 括处理器(processer ) 91、 接收器(receiver ) 92、 发送器(emitter ) 93、 随 机存取存储器(RAM ) 94、 只读存储器(ROM ) 95、 总线 96 以及网络接 口单元(Network Interface Unit ) 97。 其中, 处理器 91 通过总线 96 分别耦 接接收器 92、 发送器 93、 随机存取存储器 94、 只读存储器 95 以及网络接 口单元 97。 其中, 当需要运行获取装置时, 通过固化在只读存储器 95 中 的基本输入输出系统( BIOS )或者嵌入式系统中的 boot loader引导系统进 行启动, 引导获取装置进入正常运行状态。 在获取装置进入正常运行状态 后, 在随机存取存储器 94 中运行应用程序( Application Programs )和操作 系统 ( OS ), 使得:
处理器 91获取当前帧中当前块的相邻块的运动信息和第一参考帧中与 当前块位置相同的第一参考块的运动信息, 其中, 第一参考块和相邻块为 已编码或解码的块, 相邻块的运动信息和第一参考块的运动信息包括前向 运动矢量和前向参考标识以及后向运动矢量和后向参考标识; 依次根据每 一相邻块的运动信息和第一参考块的运动信息中的前向运动矢量到前向参 考标识指示的前向参考帧中确定当前块的前向匹配块以及根据后向运动矢 量到后向参考标识指示的后向参考帧中确定当前块的后向匹配块; 检测每
次确定的前向匹配块和后向匹配块之间的相似度; 将最大相似度所对应的 运动信息设置为当前块的运动信息。
处理器 91的具体实现过程请参照前述实施例的运动矢量的获取方法以 及获取装置, 此处不再赘述。
通过上述方式, 本发明的运动矢量的获取方法、 获取装置、 视频编解 码器及其方法不仅获取当前块在当前帧中的相邻块的运动信息, 还获取当 前块在参考帧中相同位置的参考块的运动信息, 每一运动信息又包括前向 和后向的运动矢量以及前向参考标识和后向参考标识, 前向参考标识和后 向参考标识分别指示前向参考帧和后向参考帧, 通过前向和后向运动矢量 可以确定出当前块的前向匹配块和后向匹配块并检测两者相似度, 进而将 最大相似度对应的运动信息设置为当前块的运动信息, 通过这种方式, 综 合考虑了视频序列的空域相关性和时域相关性, 可以提高现有技术的编码 效果, 又由于仅计算两个匹配块之间的相似度, 可以减少计算复杂度, 从 而解决现有技术需要进一步提高编码效率的问题。 并且利用运动信息进行 编解码时, 不需要在码流中写入运动信息, 能够降低编码码率, 提高编解 码效率。
在本申请所提供的几个实施方式中, 应该理解到, 所揭露的系统, 装 置和方法, 可以通过其它的方式实现。 例如, 以上所描述的装置实施方式 仅仅是示意性的, 例如, 所述模块或单元的划分, 仅仅为一种逻辑功能划 分, 实际实现时可以有另外的划分方式, 例如多个单元或组件可以结合或 者可以集成到另一个系统, 或一些特征可以忽略, 或不执行。 另一点, 所 显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接 口, 装置或单元的间接辆合或通讯连接, 可以是电性, 机械或其它的形式。 作为单元显示的部件可以是或者也可以不是物理单元, 即可以位于一个地 方, 或者也可以分布到多个网络单元上。 可以根据实际的需要选择其中的 部分或者全部单元来实现本实施方式方案的目的。
另外, 在本申请各个实施方式中的各功能单元可以集成在一个处理单 元中, 也可以是各个单元单独物理存在, 也可以两个或两个以上单元集成 在一个单元中。 上述集成的单元既可以釆用硬件的形式实现, 也可以釆用
软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销 售或使用时, 可以存储在一个计算机可读取存储介质中。 基于这样的理解, 本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方 案的全部或部分可以以软件产品的形式体现出来, 该计算机软件产品存储 在一个存储介质中, 包括若干指令用以使得一台计算机设备(可以是个人 计算机, 管理服务器, 或者网络设备等)或处理器(processor )执行本申请 各个实施方式所述方法的全部或部分步骤。 而前述的存储介质包括: U盘、 移动硬盘、只读存储器( ROM, Read-Only Memory )、随机存取存储器( RAM, Random Access Memory )、 磁碟或者光盘等各种可以存储程序代码的介质。
以上所述仅为本申请的实施方式, 并非因此限制本申请的保护范围, 凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换, 或直 接或间接运用在其他相关的技术领域, 均同理包括在本申请的专利保护范 围内。
Claims
1. 一种运动矢量的获取方法, 其特征在于, 所述获取方法包括: 获取当前帧中当前块的相邻块的运动信息和第一参考帧中与所述当前 块位置相同的第一参考块的运动信息, 其中, 所述第一参考块和所述相邻 块为已编码或解码的块, 所述相邻块的运动信息和所述第一参考块的运动 信息包括前向运动矢量和前向参考标识以及后向运动矢量和后向参考标 识;
依次根据每一所述相邻块的运动信息和所述第一参考块的运动信息中 的前向运动矢量在所述前向参考标识指示的前向参考帧中确定所述当前块 的前向匹配块, 以及根据后向运动矢量在所述后向参考标识指示的后向参 考帧中确定所述当前块的后向匹配块;
检测每次确定的所述前向匹配块和所述后向匹配块之间的相似度; 将最大相似度所对应的所述运动信息设置为所述当前块的运动信息。
2. 根据权利要求 1所述的获取方法, 其特征在于, 所述相邻块包括所 述当前块邻接的左下方、 左方、 左上方、 上方和右上方的五个块中的至少 一个。
3. 根据权利要求 2所述的获取方法, 其特征在于, 若所述当前块邻接 的至少一个块不存在, 则将所述当前块邻接的至少一个块的前向运动矢量 和后向运动矢量均设置为零矢量。
4. 根据权利要求 1至 3任一项所述的获取方法, 其特征在于, 所述检 测每次确定的所述前向匹配块和所述后向匹配块之间的相似度的步骤包 括:
计算每次确定的所述前向匹配块的第一像素值以及所述后向匹配块的 第二像素值;
计算所述第一像素值与所述第二像素值之间的差值的度量;
根据所述差值的度量检测所述相似度, 其中, 所述差值的度量越大, 则所述相似度越小, 所述差值的度量越小, 则所述相似度越大。
5. 根据权利要求 4所述的获取方法, 其特征在于, 所述计算所述第一 像素值与所述第二像素值之间的差值的度量的步骤具体为:
将所述第一像素值和所述第二像素值进行相似度函数计算以获得所述 差值的度量。
6. 根据权利要求 5所述的获取方法, 其特征在于, 所述相似度函数为 绝对误差和 SAD:
SAD I /; , n+jx ) - f2 (m+i2 , n+j2 )j
其中, SAL>为所述差值的度量, ^+ +)为所述第一像素值, /2(m+ 2 , M+ 2)为所述第二像素值, m和 n分别代表所述当前块的水平和垂直 坐标值, 和^分别为所述前向运动矢量在水平和垂直坐标上的分量, 2和』2 分别为所述后向运动矢量在水平和垂直坐标上的分量, M和 N分别代表所 述当前块的宽度和高度。
7. 根据权利要求 4所述的获取方法, 其特征在于, 所述计算每次确定 的所述前向匹配块的第一像素值以及所述后向匹配块的第二像素值的步骤 具体为:
按照预定规则对每次确定的所述前向匹配块的像素进行抽样得到第一 像素值以及对所述后向匹配块的像素进行抽样得到第二像素值。
8. 根据权利要求 7所述的获取方法, 其特征在于, 所述按照预定规则 对每次确认的所述前向匹配块的像素进行抽样得到第一像素值以及对所述 后向匹配块的像素进行抽样得到第二像素值的步骤为:
按照每行像素和每列像素上均间隔一个像素的规则对每次确定的所述 前向匹配块的像素进行抽样得到第一像素值以及对所述后向匹配块的像素 进行抽样得到第二像素值。
9. 根据权利要求 1所述的获取方法, 其特征在于, 所述第一参考帧的 数量为至少两个, 则所述获取第一参考帧中与所述当前块位置相同的第一 参考块的运动信息的步骤具体为:
获取所述至少两个第一参考帧中与所述当前块位置相同的至少两个第 一参考块的运动信息。
10. 一种视频编码方法, 其特征在于, 所述视频编码方法包括: 釆用根据权利要求 1至 9任一项所述的获取方法获得当前帧中当前块 的运动信息;
根据所述运动信息中的前向运动矢量到前向参考标识指示的前向参考 帧中确定所述当前块的前向匹配块以及根据后向运动矢量到后向参考标识 指示的后向参考帧中确定所述当前块的后向匹配块;
根据所述前向匹配块的第一像素值和所述后向匹配块的第二像素值生 成参考像素值, 并计算所述参考像素值和所述当前块的真实像素值之间的 目标残差值;
在码流中编码所述目标残差值并在所述码流中添加运算标识。
11、 根据权利要求 10所述的视频编码方法, 其特征在于, 所述参考像 素值为所述第一像素值和所述第二像素值的加权平均值。
12. 一种视频解码方法, 其特征在于, 所述视频解码方法包括: 从接收到的码流中解码出目标残差值和运算标识;
根据所述运算标识釆用根据权利要求 1至 9任一项所述的获取方法获 得当前帧中当前块的运动信息;
根据所述运动信息中的前向运动矢量到前向参考标识指示的前向参考 帧中确定所述当前块的前向匹配块以及根据后向运动矢量到后向参考标识 指示的后向参考帧中确定所述当前块的后向匹配块;
根据所述前向匹配块的第一像素值和所述后向匹配块的第二像素值生 成参考像素值;
将所述参考像素值与所述目标残差值进行累加以重构所述当前块。
13、 根据权利要求 12所述的视频解码方法, 其特征在于, 所述参考像 素值为所述第一像素值和所述第二像素值的加权平均值。
14. 一种获取装置, 其特征在于, 所述获取装置包括获取模块、 确定 模块、 检测模块和设置模块, 其中,
所述获取模块用于获取当前帧中当前块的相邻块的运动信息和第一参 考帧中与所述当前块位置相同的第一参考块的运动信息, 并将每一所述运 动信息发送给所述确定模块, 其中, 所述第一参考块和所述相邻块为已编 码或解码的块, 所述相邻块的运动信息和所述第一参考块的运动信息包括 前向运动矢量和前向参考标识以及后向运动矢量和后向参考标识;
所述确定模块用于从所述获取模块接收每一所述相邻块的运动信息和 所述第一参考块的运动信息, 依次根据每一所述相邻块的运动信息和所述
第一参考块的运动信息中的前向运动矢量到前向参考标识指示的前向参考 帧中确定所述当前块的前向匹配块以及根据后向运动矢量到后向参考标识 指示的后向参考帧中确定所述当前块的后向匹配块, 并将确定结果发送给 所述检测模块;
所述检测模块用于从所述确定模块接收所述确定结果, 检测每次确定 的所述前向匹配块和所述后向匹配块之间的相似度, 并将所述相似度发送 给所述设置模块;
所述设置模块用于从所述检测模块接收所述相似度, 并将最大相似度 所对应的所述运动信息设置为所述当前块的运动信息。
15. 根据权利要求 14所述的获取装置, 其特征在于, 所述相邻块包括 所述当前块邻接的左下方、 左方、 左上方、 上方和右上方的五个块中的至 少一个。
16. 根据权利要求 15所述的获取装置, 其特征在于, 若所述当前块邻 接的至少一个块不存在, 则所述获取模块将所述当前块邻接的至少一个块 的前向运动矢量和后向运动矢量均设置为零矢量。
17. 根据权利要求 14至 16任一项所述的获取装置, 其特征在于, 所 述检测模块包括第一计算单元、 第二计算单元和检测单元, 其中,
所述第一计算单元用于从所述确定模块接收所述确定结果, 计算每次 确定的所述前向匹配块的第一像素值以及所述后向匹配块的第二像素值, 并将所述第一像素值和所述第二像素值发送给所述第二计算单元;
所述第二计算单元用于从所述第一计算单元接收所述第一像素值和所 述第二像素值, 计算所述第一像素值与所述第二像素值之间的差值的度量, 并将所述差值的度量发送给所述检测单元;
所述检测单元用于从所述第二计算单元接收所述差值的度量, 根据所 述差值的度量检测所述相似度, 并将所述相似度发送给所述设置模块, 其 中, 所述差值的度量越大, 则所述相似度越小, 所述差值的度量越小, 则 所述相似度越大。
18. 根据权利要求 17所述的获取装置, 其特征在于, 所述第二计算单 元具体用于将所述第一像素值和所述第二像素值进行相似度函数计算以获 得所述差值的度量。
19. 根据权利要求 18所述的获取装置, 其特征在于, 所述相似度函数 为绝对误差和:
SAD I /; , n+jx ) - f2 (m+i2 , n+j2 )j
其中, SAL>为所述差值的度量, ^+ +)为所述第一像素值, /2(m+ 2 , M+ 2)为所述第二像素值, m和 n分别代表所述当前块的水平和垂直 坐标值, 和^分别为所述前向运动矢量在水平和垂直坐标上的分量, 2和』2 分别为所述后向运动矢量在水平和垂直坐标上的分量, M和 N分别代表所 述当前块的宽度和高度。
20. 根据权利要求 17所述的获取装置, 其特征在于, 所述第一计算单 元具体用于按照预定规则对每次确定的所述前向匹配块的像素进行抽样得 到第一像素值以及对所述后向匹配块的像素进行抽样得到第二像素值。
21. 根据权利要求 20所述的获取装置, 其特征在于, 所述预定规则为 每行像素和每列像素上均间隔一个像素的规则。
22. 根据权利要求 14所述的获取装置, 其特征在于, 所述第一参考帧 的数量为至少两个, 则所述获取模块具体用于获取所述至少两个第一参考 帧中与所述当前块位置相同的至少两个第一参考块的运动信息。
23. 一种视频编码器, 其特征在于, 所述视频编码器包括确定装置、 计算装置、 编码装置和根据权利要求 14至 22任一项所述的获取装置, 其 中,
所述获取装置用于获得当前帧中当前块的运动信息;
所述确定装置用于根据所述运动信息中的前向运动矢量到前向参考标 识指示的前向参考帧中确定所述当前块的前向匹配块以及根据后向运动矢 量到后向参考标识指示的后向参考帧中确定所述当前块的后向匹配块; 所述计算装置用于根据所述前向匹配块的第一像素值和所述后向匹配 块的第二像素值生成参考像素值, 并计算所述参考像素值和所述当前块的 真实像素值之间的目标残差值;
所述编码装置用于在码流中编码所述目标残差值并在所述码流中添加 运算标识。
24. 根据权利要求 23所述的视频编码器, 其特征在于, 所述参考像素
值为所述第一像素值和所述第二像素值的加权平均值。
25、 一种视频解码器, 其特征在于, 所述视频解码器包括解码装置、 确定装置、 计算装置、 重构装置和根据权利要求 14至 22任一项所述的获 取装置, 其中,
所述解码装置用于从接收到的码流中解码出目标残差值和运算标识; 所述获取装置用于根据所述运算标识获得当前帧中当前块的运动信 息;
所述确定装置用于根据所述运动信息中的前向运动矢量到前向参考标 识指示的前向参考帧中确定所述当前块的前向匹配块以及根据后向运动矢 量到后向参考标识指示的后向参考帧中确定所述当前块的后向匹配块; 所述计算装置用于根据所述前向匹配块的第一像素值和所述后向匹配 块的第二像素值生成参考像素值;
所述重构装置用于将所述参考像素值与所述目标残差值进行累加以重 构所述当前块。
26、 根据权利要求 25所述的视频解码器, 其特征在于, 所述参考像素 值为所述第一像素值和所述第二像素值的加权平均值。
27、 一种获取装置, 其特征在于, 包括处理器、 接收器、 发送器、 随 机存取存储器、 只读存储器、 总线以及网络接口单元, 其中, 所述处理器 通过所述总线分别耦接所述接收器、 所述发送器、 所述随机存取存储器、 所述只读存储器以及所述网络接口单元, 在所述获取装置进入正常运行状 态后, 在所述随机存取存储器中运行应用程序和操作系统, 使得:
所述处理器获取当前帧中当前块的相邻块的运动信息和第一参考帧中 与所述当前块位置相同的第一参考块的运动信息, 其中, 所述第一参考块 和所述相邻块为已编码或解码的块, 所述相邻块的运动信息和所述第一参 考块的运动信息包括前向运动矢量和前向参考标识以及后向运动矢量和后 向参考标识; 依次根据每一所述相邻块的运动信息和所述第一参考块的运 动信息中的前向运动矢量在所述前向参考标识指示的前向参考帧中确定所 述当前块的前向匹配块, 以及根据后向运动矢量在所述后向参考标识指示 的后向参考帧中确定所述当前块的后向匹配块; 检测每次确定的所述前向 匹配块和所述后向匹配块之间的相似度; 将最大相似度所对应的所述运动
信息设置为所述当前块的运动信息。
28. 根据权利要求 27所述的获取装置, 其特征在于, 所述相邻块包括 所述当前块邻接的左下方、 左方、 左上方、 上方和右上方的五个块中的至 少一个。
29. 根据权利要求 28所述的获取装置, 其特征在于, 所述处理器用于: 若所述当前块邻接的至少一个块不存在, 则将所述当前块邻接的至少 一个块的前向运动矢量和后向运动矢量均设置为零矢量。
30. 根据权利要求 27至 29任一项所述的获取装置, 其特征在于, 所 述处理器用于:
计算每次确定的所述前向匹配块的第一像素值以及所述后向匹配块的 第二像素值;
计算所述第一像素值与所述第二像素值之间的差值的度量;
根据所述差值的度量检测所述相似度, 其中, 所述差值的度量越大, 则所述相似度越小, 所述差值的度量越小, 则所述相似度越大。
31. 根据权利要求 30所述的获取装置, 其特征在于, 所述处理器用于: 将所述第一像素值和所述第二像素值进行相似度函数计算以获得所述 差值的度量。
32. 根据权利要求 31所述的获取装置, 其特征在于, 所述相似度函数 为绝对误差和 SAD:
SAD I /; {ηι+ίλ , n+jx ) - f2 (m+i2 , n+j2 )j
其中, SAL>为所述差值的度量, ^+ +)为所述第一像素值, /2(m+ 2 , M+ 2)为所述第二像素值, m和 n分别代表所述当前块的水平和垂直 坐标值, 和^分别为所述前向运动矢量在水平和垂直坐标上的分量, 2和』2 分别为所述后向运动矢量在水平和垂直坐标上的分量, M和 N分别代表所 述当前块的宽度和高度。
33. 根据权利要求 30所述的获取装置, 其特征在于, 所述处理器用于: 按照预定规则对每次确定的所述前向匹配块的像素进行抽样得到第一 像素值以及对所述后向匹配块的像素进行抽样得到第二像素值。
34. 根据权利要求 33所述的获取装置, 其特征在于, 所述处理器用于:
按照每行像素和每列像素上均间隔一个像素的规则对每次确定的所述 前向匹配块的像素进行抽样得到第一像素值以及对所述后向匹配块的像素 进行抽样得到第二像素值。
35. 根据权利要求 27所述的获取装置, 其特征在于, 所述处理器用于: 获取所述至少两个第一参考帧中与所述当前块位置相同的至少两个第 一参考块的运动信息。
36. 一种视频解码器, 其特征在于, 所述视频解码器包括解码装置、 确定装置、 计算装置、 重构装置和根据权利要求 27至 35任一项所述的获 取装置, 其中,
所述解码装置用于从接收到的码流中解码出目标残差值和运算标识; 所述获取装置用于根据所述运算标识获得当前帧中当前块的运动信 息;
所述确定装置用于根据所述运动信息中的前向运动矢量到前向参考标 识指示的前向参考帧中确定所述当前块的前向匹配块以及根据后向运动矢 量到后向参考标识指示的后向参考帧中确定所述当前块的后向匹配块; 所述计算装置用于根据所述前向匹配块的第一像素值和所述后向匹配 块的第二像素值生成参考像素值;
所述重构装置用于将所述参考像素值与所述目标残差值进行累加以重 构所述当前块。
37. 根据权利要求 36所述的视频解码器, 其特征在于, 所述参考像素 值为所述第一像素值和所述第二像素值的加权平均值。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310413733.3 | 2013-09-11 | ||
CN201310413733.3A CN104427345B (zh) | 2013-09-11 | 2013-09-11 | 运动矢量的获取方法、获取装置、视频编解码器及其方法 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2015035769A1 true WO2015035769A1 (zh) | 2015-03-19 |
Family
ID=52665004
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2014/075107 WO2015035769A1 (zh) | 2013-09-11 | 2014-04-10 | 运动矢量的获取方法、获取装置、视频编解码器及其方法 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN104427345B (zh) |
WO (1) | WO2015035769A1 (zh) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109756739A (zh) * | 2017-11-07 | 2019-05-14 | 华为技术有限公司 | 图像预测方法和装置 |
CN111754429A (zh) * | 2020-06-16 | 2020-10-09 | Oppo广东移动通信有限公司 | 运动矢量后处理方法和装置、电子设备及存储介质 |
Families Citing this family (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110546956B (zh) * | 2017-06-30 | 2021-12-28 | 华为技术有限公司 | 一种帧间预测的方法及装置 |
CN109495738B (zh) * | 2017-09-12 | 2023-02-07 | 华为技术有限公司 | 一种运动信息的编解码方法和装置 |
CN107483953B (zh) * | 2017-10-10 | 2019-11-29 | 司马大大(北京)智能系统有限公司 | 帧间运动估计方法、装置及电子设备 |
CN109905714B (zh) * | 2017-12-08 | 2022-12-27 | 华为技术有限公司 | 帧间预测方法、装置及终端设备 |
CN107995494B (zh) * | 2017-12-12 | 2019-11-22 | 珠海全志科技股份有限公司 | 视频图像数据的压缩方法与解压方法、计算机装置、计算机可读存储介质 |
CN113315975B (zh) * | 2018-03-29 | 2022-12-06 | 华为技术有限公司 | 一种双向帧间预测方法及装置 |
CN110710209A (zh) * | 2018-04-02 | 2020-01-17 | 北京大学 | 运动补偿的方法、装置和计算机系统 |
CN114727114B (zh) | 2018-09-21 | 2024-04-09 | 华为技术有限公司 | 运动矢量的确定方法和装置 |
CN110944209B (zh) * | 2018-09-21 | 2022-03-04 | 华为技术有限公司 | 运动矢量的确定方法和装置 |
WO2020140242A1 (zh) * | 2019-01-03 | 2020-07-09 | 北京大学 | 视频处理方法和装置 |
CN109451318B (zh) * | 2019-01-09 | 2022-11-01 | 鲍金龙 | 便于vr视频编码的方法、装置、电子设备及存储介质 |
CN111698509B (zh) * | 2019-03-11 | 2022-09-30 | 杭州海康威视数字技术股份有限公司 | 一种编解码方法、装置及其设备 |
CN109803175B (zh) * | 2019-03-12 | 2021-03-26 | 京东方科技集团股份有限公司 | 视频处理方法及装置、设备、存储介质 |
CN113596478B (zh) | 2019-06-21 | 2022-04-26 | 杭州海康威视数字技术股份有限公司 | 一种编解码方法、装置及其设备 |
CN110475116B (zh) * | 2019-08-19 | 2021-09-21 | 北京大学深圳研究生院 | 一种运动矢量导出方法、装置及电子设备 |
CN112135126B (zh) | 2019-11-05 | 2021-09-21 | 杭州海康威视数字技术股份有限公司 | 一种编解码方法、装置、设备及机器可读存储介质 |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1535025A (zh) * | 2003-12-31 | 2004-10-06 | �й���ѧԺ�����о��� | 固定参考帧数编码方式下获取图像参考块的方法 |
US20090034854A1 (en) * | 2007-07-31 | 2009-02-05 | Samsung Electronics Co., Ltd. | Video encoding and decoding method and apparatus using weighted prediction |
CN101931803A (zh) * | 2009-06-26 | 2010-12-29 | 华为技术有限公司 | 视频图像运动信息获取方法、装置及设备、模板构造方法 |
CN102215387A (zh) * | 2010-04-09 | 2011-10-12 | 华为技术有限公司 | 视频图像处理方法以及编/解码器 |
Family Cites Families (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060098886A1 (en) * | 2003-01-10 | 2006-05-11 | Koninklijke Philips Electronics N.V. | Efficient predictive image parameter estimation |
KR20050108397A (ko) * | 2003-03-14 | 2005-11-16 | 코닌클리케 필립스 일렉트로닉스 엔.브이. | 움직임 벡터 결정을 위한 방법 |
CN1225127C (zh) * | 2003-09-12 | 2005-10-26 | 中国科学院计算技术研究所 | 一种用于视频编码的编码端/解码端双向预测方法 |
CA2565645C (en) * | 2004-05-04 | 2012-08-07 | Qualcomm Incorporated | Method and apparatus to construct bi-directional predicted frames for temporal scalability |
CN101227614B (zh) * | 2008-01-22 | 2010-09-08 | 炬力集成电路设计有限公司 | 视频编码系统的运动估计装置及其方法 |
CN101820547A (zh) * | 2009-02-27 | 2010-09-01 | 源见科技(苏州)有限公司 | 帧间模式选择方法 |
CN101605262B (zh) * | 2009-07-09 | 2011-11-09 | 杭州士兰微电子股份有限公司 | 可变块尺寸运动预测方法和装置 |
CN101917615A (zh) * | 2010-06-03 | 2010-12-15 | 北京邮电大学 | 一种混合视频编码框架中的增强型双向运动矢量预测方法 |
CN102378000B (zh) * | 2010-08-13 | 2013-07-17 | 炬力集成电路设计有限公司 | 一种视频解码装置和方法 |
-
2013
- 2013-09-11 CN CN201310413733.3A patent/CN104427345B/zh active Active
-
2014
- 2014-04-10 WO PCT/CN2014/075107 patent/WO2015035769A1/zh active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1535025A (zh) * | 2003-12-31 | 2004-10-06 | �й���ѧԺ�����о��� | 固定参考帧数编码方式下获取图像参考块的方法 |
US20090034854A1 (en) * | 2007-07-31 | 2009-02-05 | Samsung Electronics Co., Ltd. | Video encoding and decoding method and apparatus using weighted prediction |
CN101931803A (zh) * | 2009-06-26 | 2010-12-29 | 华为技术有限公司 | 视频图像运动信息获取方法、装置及设备、模板构造方法 |
CN102215387A (zh) * | 2010-04-09 | 2011-10-12 | 华为技术有限公司 | 视频图像处理方法以及编/解码器 |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109756739A (zh) * | 2017-11-07 | 2019-05-14 | 华为技术有限公司 | 图像预测方法和装置 |
CN109756739B (zh) * | 2017-11-07 | 2022-09-02 | 华为技术有限公司 | 图像预测方法和装置 |
CN111754429A (zh) * | 2020-06-16 | 2020-10-09 | Oppo广东移动通信有限公司 | 运动矢量后处理方法和装置、电子设备及存储介质 |
CN111754429B (zh) * | 2020-06-16 | 2024-06-11 | Oppo广东移动通信有限公司 | 运动矢量后处理方法和装置、电子设备及存储介质 |
Also Published As
Publication number | Publication date |
---|---|
CN104427345B (zh) | 2019-01-08 |
CN104427345A (zh) | 2015-03-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2015035769A1 (zh) | 运动矢量的获取方法、获取装置、视频编解码器及其方法 | |
TWI750483B (zh) | 成分依賴的子區塊分割 | |
CN107046645B (zh) | 图像编解码方法及装置 | |
US9582722B2 (en) | Video-based vehicle speed estimation from motion vectors in video streams | |
US12088843B2 (en) | Method for deriving a motion vector | |
JP5478047B2 (ja) | 映像データ圧縮前処理方法およびこれを用いた映像データ圧縮方法と映像データ圧縮システム | |
TW201041406A (en) | Image predictive encoding device, image predictive encoding method, image predictive encoding program, image predictive decoding device, image predictive decoding method, and image predictive decoding program | |
CN101978698A (zh) | 用于对图像进行编码和解码的方法及设备 | |
CN107396112B (zh) | 一种编码方法及装置、计算机装置、可读存储介质 | |
JP2018533273A5 (zh) | ||
JP2006245932A (ja) | 動画像処理装置、動画像処理方法、及び動画像処理プログラム | |
WO2019114225A1 (zh) | 编码单元划分确定方法及装置、计算设备及可读存储介质 | |
KR20130130695A (ko) | 복수의 프로세서를 사용하여 비디오 프레임을 인코딩하는 방법 및 시스템 | |
WO2015003573A1 (zh) | 视频编解码方法、装置及系统 | |
JP5748225B2 (ja) | 動画像符号化方法,動画像符号化装置および動画像符号化プログラム | |
CN112887732A (zh) | 一种权值可配置的帧间帧内联合预测编解码的方法及装置 | |
CN112534809B (zh) | 视频编码中的选择性模板匹配 | |
CN109640081B (zh) | 一种帧内预测方法、编码器、电子设备及可读存储介质 | |
CN105992012B (zh) | 一种错误隐藏的方法和装置 | |
CN109120943B (zh) | 视频数据恢复方法及装置 | |
KR101810118B1 (ko) | 프로파일 정보 기반 움직임 추정장치 및 방법 | |
KR102345258B1 (ko) | 객체영역 검출방법, 장치 및 이에 대한 컴퓨터 프로그램 | |
JP3150627B2 (ja) | 復号信号の再符号化方法 | |
CN104486633A (zh) | 视频错误掩藏方法及装置 | |
CN112055201B (zh) | 视频编码方法及其相关装置 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 14844488 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 14844488 Country of ref document: EP Kind code of ref document: A1 |