WO2019227491A1 - Coding and decoding methods, and coding and decoding devices - Google Patents

Coding and decoding methods, and coding and decoding devices Download PDF

Info

Publication number
WO2019227491A1
WO2019227491A1 PCT/CN2018/089673 CN2018089673W WO2019227491A1 WO 2019227491 A1 WO2019227491 A1 WO 2019227491A1 CN 2018089673 W CN2018089673 W CN 2018089673W WO 2019227491 A1 WO2019227491 A1 WO 2019227491A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
frame
long
type
term reference
Prior art date
Application number
PCT/CN2018/089673
Other languages
French (fr)
Chinese (zh)
Inventor
李蔚然
郑萧桢
Original Assignee
深圳市大疆创新科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市大疆创新科技有限公司 filed Critical 深圳市大疆创新科技有限公司
Priority to CN201880011426.3A priority Critical patent/CN110366851B/en
Priority to PCT/CN2018/089673 priority patent/WO2019227491A1/en
Publication of WO2019227491A1 publication Critical patent/WO2019227491A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/136Incoming video signal characteristics or properties
    • H04N19/14Coding unit complexity, e.g. amount of activity or edge presence estimation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/172Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a picture, frame or field
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/176Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/186Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being a colour or a chrominance component
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/44Decoders specially adapted therefor, e.g. video decoders which are asymmetric with respect to the encoder
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/503Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction
    • H04N19/51Motion estimation or motion compensation
    • H04N19/577Motion compensation with bidirectional frame interpolation, i.e. using B-pictures
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/503Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction
    • H04N19/51Motion estimation or motion compensation
    • H04N19/58Motion compensation with long-term prediction, i.e. the reference frame for a current frame not being the temporally closest one

Definitions

  • the present application relates to the field of image processing, and in particular, to an encoding and decoding method and an encoding and decoding device.
  • Some existing technologies can use each image in the video to construct a high-quality specific reference image containing the background content of the scene, called a long-term reference image. That is, the specific reference image can be used as a reference image for inter prediction for a relatively long period of time.
  • the background portion of the current image to be encoded / decoded can be used to reduce residual information of inter prediction by referring to the long-term reference image, thereby improving encoding efficiency.
  • the long-term reference picture is not an encoded / decoded picture, but an artificially constructed picture.
  • the long-term reference image includes multiple image blocks, and any one image block is taken from a certain encoded / decoded image. Different image blocks in the long-term reference image may be taken from different encoded / decoded images. After the encoding / decoding of a certain frame is completed, the long-term reference image can be updated based on the encoded / decoded image.
  • the video stream may include, for example, TV programs, webcasts, local movies Wait.
  • a random access point RAP
  • the characteristics of the random access point make it possible for the decoder to ensure that frames with a display order after the random access point can be decoded normally.
  • the random access point is not considered when updating the long-term reference image, but the update is based on the encoded / decoded image, it may cause that the frames in the display order after the random access point cannot be decoded normally. If the existing encoding / decoding technology for random access points is used when updating the long-term reference image, the encoding / decoding efficiency may be low.
  • the application provides an encoding and decoding method and an encoding and decoding device, which can improve encoding / decoding efficiency.
  • an encoding method including: encoding a first type frame, wherein in the encoding order, there are N second type frames that need to be inter-frame encoded after the first type frame, the N number
  • the display order of the second type frame is before the first type frame, where N is a positive integer; at least one second type frame of the N second type frames is inter-frame coded according to the long-term reference image; After the inter-frame encoding of at least one second type frame among the N second type frames is completed, the currently used long-term reference image is replaced.
  • a decoding method including: decoding a first type frame, wherein, in the decoding order, there are N second type frames that need to be inter-frame decoded after the first type frame, and the N The display order of the second type frame is before the first type frame, where N is a positive integer; at least one second type frame of the N second type frames is inter-frame decoded according to the long-term reference image; After the inter-frame decoding of at least one second type frame among the N second type frames is completed, the currently used long-term reference image is replaced.
  • an encoding device including: at least one memory for storing computer-executable instructions; at least one processor, alone or collectively, for: accessing the at least one memory and executing the computer-executable Instructions to implement the following operations: encoding a first type frame, where there are N second type frames that need to be inter-frame encoded after the first type frame in the encoding order, and the N second type frames have The display order is before the first type frame, where N is a positive integer; at least one second type frame of the N second type frames is inter-frame encoded according to the long-term reference image; After inter-coding of at least one second-type frame in the second-type frame, the currently used long-term reference image is replaced.
  • a decoding device including: at least one memory for storing computer-executable instructions; at least one processor, alone or collectively, for: accessing the at least one memory and executing the computer-executable Instructions to implement the following operations: decoding a first type frame, wherein, in the decoding order, there are N second type frames that need to be inter-frame decoded after the first type frame, and the N second type frames are The display order is before the first type frame, where N is a positive integer; at least one second type frame of the N second type frames is inter-frame decoded according to the long-term reference image; After the inter-frame decoding of at least one of the second type frames, the long-term reference image currently used is replaced.
  • a computer-readable storage medium on which instructions are stored, and when the instructions are run on the computer, the computer is caused to execute the encoding method of the first aspect.
  • a computer-readable storage medium on which instructions are stored, and when the instructions are run on the computer, the computer is caused to execute the decoding method of the first aspect.
  • This application only replaces the current use after completing the inter-frame encoding / decoding of at least one second type frame among the N second type frames in which the encoding / decoding order is after the first type frame and the display order is before the first type frame.
  • Long-term reference image so that at least one second type frame can refer to the long-term reference image before the first type frame, which can improve encoding / decoding efficiency.
  • FIG. 1 is a schematic diagram of an embodiment of out-of-order encoding in the present application.
  • FIG. 2 is a schematic flowchart of an embodiment of a video encoding method according to the present application.
  • FIG. 3 is a schematic diagram of a relationship between an image block in a current to-be-encoded image and an image block in a long-term reference image.
  • FIG. 4 is a schematic diagram showing a relationship between multiple images and a long-term reference image in a video.
  • FIG. 5 is a schematic flowchart of another embodiment of a video encoding method according to the present application.
  • FIG. 6 is a schematic diagram of a video decoding method according to another embodiment of the present application.
  • FIG. 7 is a schematic flowchart of another embodiment of a video decoding method according to the present application.
  • FIG. 8 is a schematic flowchart of an encoding method according to an embodiment of the present application.
  • FIG. 9 is a schematic flowchart of an encoding method according to an embodiment of the present application.
  • FIG. 10 is a schematic flowchart of a decoding method according to an embodiment of the present application.
  • FIG. 11 is a schematic flowchart of a decoding method according to another embodiment of the present application.
  • FIG. 12 is a schematic flowchart of a decoding method according to another embodiment of the present application.
  • FIG. 13 is a schematic block diagram of an encoding device according to an embodiment of the present application.
  • FIG. 14 is a schematic block diagram of an encoding device according to another embodiment of the present application.
  • FIG. 15 is a schematic block diagram of a decoding device according to an embodiment of the present application.
  • FIG. 16 is a schematic block diagram of a decoding device according to another embodiment of the present application.
  • a video is made up of multiple images.
  • different images in the video can use different prediction methods.
  • the image can be divided into an intra-prediction image and an inter-prediction image, where the inter-prediction image includes a forward-prediction image and a bi-prediction image.
  • I picture is an intra prediction picture, also called a key frame;
  • P picture is a forward prediction picture, that is, a P picture or I picture that has been previously encoded / decoded is used as a reference picture;
  • B picture is a bidirectional prediction picture, that is, The front and back images are used as reference images.
  • An implementation method is to encode / decode the multiple pictures to generate a group of pictures (GOP) after encoding / decoding.
  • the GOP consists of an I picture and multiple B pictures (or bidirectional prediction). Picture) and / or P picture (or forward prediction picture).
  • the decoder When the decoder is playing, it reads the GOP one by one, decodes it, reads the picture, and then renders it.
  • images of different resolutions can be encoded / decoded by dividing the image into multiple small blocks, that is, the image can be divided into multiple image blocks.
  • the image can be divided into any number of image blocks.
  • the image can be divided into an array of m ⁇ n image blocks.
  • the image block may have a rectangular shape, a square shape, a circular shape, or any other shape.
  • An image block can have any size, such as p ⁇ q pixels.
  • Each image block can have the same size and / or shape.
  • two or more image blocks may have different sizes and / or shapes.
  • An image block may or may not have any overlapping portions.
  • the image block is referred to as a macroblock or a maximum coding unit (LCU) in some encoding / decoding standards.
  • a macroblock For the H.264 standard, an image block is called a macroblock, and its size can be 16 ⁇ 16 pixels.
  • HEVC high efficiency video coding
  • an image block is called a maximum coding unit, and its size can be 64 ⁇ 64 pixels.
  • an image block may not be a macro block or a maximum coding unit, but a portion containing a macro block or a maximum coding unit, or at least two complete macro blocks (or maximum coding units). Contains at least one complete macro block (or maximum coding unit) and a portion of one macro block (or maximum coding unit), or contains at least two complete macro blocks (or maximum coding unit) and some macro blocks (or maximum coding) Unit). In this way, after the image is divided into a plurality of image blocks, these image blocks in the image data can be encoded / decoded separately.
  • the encoding process includes prediction, transformation, quantization, and entropy encoding.
  • prediction includes two types of intra prediction and inter prediction, the purpose of which is to remove redundant information of the current image block to be encoded by using prediction block data.
  • Intra prediction uses the information of the frame image to obtain prediction block data.
  • Inter prediction uses the information of the reference image to obtain prediction block data.
  • the process includes dividing the current to-be-encoded image into several to-be-encoded image blocks, and then dividing the to-be-encoded image block into several sub-image blocks; then, for each sub-image block , Search the reference image for the image block that most closely matches the current sub-image block as the predicted image block, and the relative displacement between the predicted image block and the current sub-image block is the motion vector; thereafter, the sub-image block and the predicted image block are Subtract the corresponding pixel values to get the residual.
  • the residuals corresponding to the obtained sub-image blocks are combined to obtain the residuals of the image blocks to be encoded.
  • a correlation matrix may be used to remove the correlation of the residuals of the image blocks, that is, the redundant information of the image blocks is removed in order to improve the coding efficiency.
  • the transformation of the data block in the image block usually uses two-dimensional transformation, that is, the residual information of the data block is multiplied with an N ⁇ M transformation matrix and its transposition matrix at the encoding end, and the transformation coefficient is obtained after multiplication. . Transform coefficients are quantized to obtain quantized coefficients. Finally, the quantized coefficients are entropy-coded to obtain an entropy-coded bitstream.
  • the entropy-coded bitstream and the encoded coding mode information such as information such as the intra prediction mode and the motion vector (or motion vector residual), are stored or sent to the decoding end.
  • the entropy-decoded bitstream is obtained and the entropy decoding is performed to obtain the corresponding residual; the predicted image block corresponding to the image block is found according to the decoded motion vector, intra prediction and other information; according to the predicted image block and the residual Get the value of each pixel in the current sub-image block.
  • a reference image may be constructed to improve the similarity between the reference image and the current image to be encoded / decoded.
  • the short-term reference image is a concept corresponding to the long-term reference image.
  • the short-term reference image exists in the reference image buffer for a period of time. After the decoded reference image after the short-term reference image is moved into and out of the reference image buffer, the short-term reference image is removed from the reference image buffer.
  • the reference image buffer may also be referred to as a reference image list buffer, a reference image list, a reference frame list buffer, or a reference frame list, etc., which are collectively referred to herein as a reference image buffer.
  • a specific type of encoding / decoding scene in the video content in which the background does not change, only the foreground in the video changes or moves.
  • video surveillance belongs to this type of scene.
  • the surveillance camera In a video surveillance scene, the surveillance camera is usually stationary or only moves slowly, and it can be considered that the background is basically unchanged.
  • objects such as people or cars that are captured in video surveillance lenses often move or change, and it can be considered that the foreground changes frequently.
  • a specific reference image can be constructed, and the specific reference image contains only high-quality background information.
  • the specific reference image may be a long-term reference image, and may also be referred to as a composite reference frame.
  • the long-term reference image includes multiple image blocks, and any one image block is taken from a decoded image. Different image blocks in the long-term reference image may be taken from different decoded images.
  • the background portion of the current image to be encoded / decoded can be referred to the long-term reference image, thereby reducing the residual information of inter prediction, thereby improving encoding / decoding efficiency.
  • the long-term reference picture (or a part of the data in the long-term reference picture) always exists in the reference picture buffer.
  • the long-term reference picture (or a part of the data in the long-term reference picture) is not affected by the decoded reference picture in the reference picture buffer.
  • the long-term reference image (or a part of the data in the long-term reference image) will be removed from the reference image buffer only when the decoder sends an update instruction operation.
  • Short-term reference pictures and long-term reference pictures may be called differently in different standards.
  • short-term reference pictures are called short-term in H.264 / advanced video coding (AVC) or H.265 / HEVC.
  • Reference frames (short-term references), and long-term reference images are referred to as long-term references.
  • AVC advanced video coding
  • Reference frames (short-term references), and long-term reference images are referred to as long-term references.
  • the long-term reference image is called For the background frame (background picture).
  • standards such as VP8 and VP9 long-term reference images are called golden frames.
  • the long-term reference image may also be obtained by the foregoing image block structure obtained from a plurality of decoded images, which is not limited in the embodiments of the present application. It should be understood that the long-term reference image in each embodiment of the present application may be an image that is not output.
  • Sequential encoding / decoding means that the encoding / decoding sequence is consistent with the display sequence.
  • the structure of the low-delay code stream is: I0, P1, P2, P3, P4, P5, etc. (where I frame is the intra encoding / decoding frame, and P frame is the previous Encode / decode frames between reference frames, the numbers represent the display order), the display order corresponding to this encoding / decoding structure is also I0, P1, P2, P3, P4, P5 ...
  • FIG. 1 is a schematic diagram of an embodiment of out-of-order encoding / decoding in the present application.
  • frames in the display order may be encoded / decoded first, and frames in the display order may be encoded / decoded later.
  • the coding / decoding sequence of the hierarchical-B code structure is: I0, P8, B4, B2, B1, B3, B6, B5, B7, P16, B12, B10, B9, B11, B14, B13, B13, B15, etc.
  • the B frame is a bidirectional reference inter-reference frame.
  • the corresponding display order is I0, B1, B2, B3, B4, B5, B6, B7, P8, B9, B10, B11, B12, B13, B14, B15, P16 ...
  • Random access in image sequences is generally divided into two categories.
  • the short-term reference image in the reference image buffer is completely cleared at the random access point, and the reconstructed image of the random access point is used to replace the long-term reference image. If there is a frame after the random access point in the display order before the random access point, it will be discarded without decoding.
  • this first type of random access point is called Instantaneous Decoder Refresh (IDR).
  • the short-term reference image in the reference image buffer at the random access point will not be immediately cleared, and the frames encoded / decoded after the random access point and displayed before the random access point can still be used.
  • Short-term reference frames before the random access point if they exist in the reference image buffer. Frames that are displayed after the random access point must be used as frames for short-term reference frames. .
  • the reconstructed image of the second type of random access point is also used to replace the long-term reference image. In some standards, this second type of random access point is called Clean Random Access (CRA).
  • CRA Clean Random Access
  • the short-term reference images in the reference image buffer are not immediately emptied.
  • the frames encoded / decoded after the random access point and displayed in order before the random access point can still use the reference image before the random access point (if it exists in the reference image buffer) for inter-frame encoding / decoding.
  • Frames that are encoded / decoded after the random access point and are displayed after the random access point use frames in the reference image buffer that are displayed after the random access point (including the random access point) as the reference image for inter-frame encoding / decoding.
  • the long-term reference image remains unchanged after the second-type random access point is encoded and before the next frame of the second-type random access point is encoded / decoded, that is, the long-term reference image is not The reconstructed image of the second type of random access point is replaced. At least one frame of image coded after the second type of random access point can use this long-term reference image that has not been replaced for inter-frame coding / decoding.
  • the code-stream structure of hierarchical-B After encoding a random access point, there are still several frames that need to be encoded before the random access point. When encoding these frames whose display order is before the random access point, it is necessary to maintain and continue to maintain the reference image buffer. After encoding all frames whose display order is before the random access point, maintain and delete the reference image buffer. All short-term reference images displayed in order before the random access point.
  • the reference image buffer needs to be maintained and continued to be maintained.
  • the reference image buffer is adjusted to delete all short-term reference images whose display order is before the random access point. If the random access function of the random access point is used, frames whose display order is before the random access point are not decoded, and the reference image buffer is also retained at this time. Until the frames whose display order is after the random access point are decoded, all reference images whose display order is before the random access point are deleted, and then the reference image buffer is decoded and maintained.
  • the processing method of short-term reference images when setting random access points is different from those of the short-term reference image.
  • the short-term reference image is a reconstructed image of a decoded image, and the long-term reference image is synthesized through some mechanism, that is, the long-term reference image is obtained by using block-level refresh.
  • long-term reference images can be continuously updated during the encoding / decoding process.
  • the random access point problem is not considered when updating the long-term reference image, but the update is based on the encoded / decoded image, then It may cause that the frames whose display order is after the random access point cannot be decoded normally. If the existing encoding / decoding technology for random access points is used when updating the long-term reference image, the encoding / decoding efficiency may be low.
  • FIG. 2 is a schematic flowchart of an embodiment of a video encoding method of the present application.
  • the method of updating a long-term reference image is performed by an image processing apparatus, and the image processing apparatus may be various types of chips for image processing, an image processor, and the like.
  • the method includes:
  • a current image to be encoded can be used as a reference image
  • an image block can be used to update a long-term reference image
  • a specific image block in the long-term reference image is updated according to the image block, where the image block is the current to-be-encoded image.
  • An image block in an image. The position of a specific image block in a long-term reference image is determined by the position of the image block in the current image to be encoded.
  • determining that the current image to be encoded may be used as a reference image may occur before encoding the image to be encoded. In this way, according to the determination result, it can be determined that each image block in the image to be encoded satisfies a condition for updating the long-term reference image when encoding or after encoding.
  • determining that the current image to be encoded can be used as a reference image, or it can occur when encoding or after encoding each image block in the image to be encoded, that is, when encoding each image block or after encoding, first determining the image block
  • the current image can be used as a reference image, and when it can be determined as a reference image, it can be determined that the image block can be used to update the long-term reference image.
  • the I-picture and the P-picture can be used as reference pictures for inter-prediction of other pictures
  • the current image to be encoded is determined as the reference image.
  • some B-pictures (or bi-predictive pictures) can also be used as reference pictures for inter-prediction of other pictures. For example, in hierarchical B (hierarchical B) technology, lower-level B-pictures can be used as reference. Frames are used. Therefore, when it is determined that the current image to be encoded is this part of the B image, it can also be determined that the current image to be encoded can be used as a reference image.
  • the encoding end is still in a video parameter set (VPS), a sequence parameter set (SPS), and a sequence header.
  • VPS video parameter set
  • SPS sequence parameter set
  • RCS reference picture configuration set
  • the judgment image block may be used to update a long-term reference image, and the judgment may be performed by using pixel information of the image block. For example, when it is determined that the content difference between an image block and a block at the same position in a previously encoded image is small, the image block is considered to contain background content and can be used to update a long-term reference image. Of course, there are other methods that can be used to determine which image patches are available for updating long-term reference images.
  • FIG. 3 is a schematic diagram of a relationship between an image block in a current image to be encoded and an image block in a long-term reference image.
  • the image blocks 210 and 220 in the current to-be-encoded image shown in FIG. 3 are image blocks satisfying a preset condition, where the position of the image block 210 in the current to-be-encoded image is the same as the position of the image block 110 in the long-term reference image.
  • the positions of the image block 220 in the current image to be encoded and the image 120 in the long-term reference image are the same.
  • the position in the long-term reference image is offset by a preset offset value from the position of the image block in the current image to be encoded.
  • updating a specific image block in the long-term reference image according to the image block may be to replace the current pixel value of the specific reference block with the pixel value of the image block for processing, and the processing may be based on the pixels of the image block.
  • the value is averaged with the pixel value of an image block in the long-term reference image, or a weighted average is performed according to the pixel value of the image block and the pixel value of the image block in the long-term reference image, where the coefficient of the weighted average is a preset value or Parsed in the code stream.
  • the pixel value of the image block it may be the original pixel value of the image block or the reconstructed pixel value of the image block.
  • the image information of an image that is not used as a reference image is not used in the encoding and decoding process of other images during the encoding and decoding process.
  • the image block in the current to-be-encoded image is considered to update the long-term reference image, thereby avoiding the construction process of the long-term reference image and not being used as the reference image. The definition of the image violates the situation.
  • the image that is not used as a reference image may not be decoded when it is decoded, thereby speeding up the decoding speed of the video code stream and achieving Variable frame rate playback of video content.
  • the long-term reference image cannot be updated when discarded parts cannot be used as the reference image.
  • the currently to-be-encoded image is not an image that can be used as a reference image, it is determined that the image block is not used to update the long-term reference image.
  • an image block can be used to update a long-term reference image based on the pixel value of the image block and the pixel value of the encoded block, where the encoded block refers to the image at a specific position in the encoded image that is located before the current image to be encoded.
  • the coded block refers to a coded image located in a previous frame (or the first two frames) of the currently-coded image.
  • the specific position may be the same position as the image block in the current image to be encoded, or the position of the image block in the current image to be encoded plus a preset offset value.
  • an image block when determining that an image block can be used to update a long-term reference image based on pixel information of the image block and pixel information of an encoded block, specifically determining that the image block can be used to update a long-term reference image according to at least one of the following:
  • the total number of pixels of the chroma component of the image block and / or the coded block is the total number of pixels of the chroma component of the image block and / or the coded block.
  • the difference between the pixel values of the luminance components between the image block and the coded block may be the distribution of the difference between the pixel values of the luminance components of the image block and the second coded block at the same positions, respectively.
  • the pixel value difference of the chrominance component between the image block and the coded block may be the distribution of the difference in pixel values of the chrominance components of the image block and the second coding block at the same positions, respectively, and may be an image The sum of the difference between the pixel values of the chroma components of the block and the second coding block at the same positions, respectively. It can also be the average value of the chroma components of the image block at each pixel and the chroma components of the coded block at each pixel. The difference of the mean.
  • the image block can be used to update the long-term reference image according to the pixel value difference of the luminance component between the image block and the coded block. Specifically, it can be based on the pixel value difference of the luminance component between the image block and the second coded block. The sum of the absolute value of the image block can be used to update the long-term reference image.
  • the image block can be used to update the long-term reference image according to the pixel value difference of the chrominance component between the image block and the coded block. Specifically, it can be based on the pixel value of the chrominance component between the image block and the second coded block.
  • the sum of the absolute value of the difference judgment image block can be used to update the long-term reference image.
  • the image block can be used to update the long-term reference image according to the pixel value difference of the luminance component between the image block and the coded block
  • the condition that the image block needs to satisfy includes: the number of specific pixels in the image block is less than the first threshold.
  • the specific pixel is a pixel whose pixel value difference in the first color channel from the pixel at the same position in the coded block is not less than the second threshold.
  • an image is stored according to three components, which are Y (luminance), U (chrominance 1), and V (chrominance 2).
  • the first color channel is a Y channel.
  • the coded block is an image block that is located in the previous frame (or the first two frames) of the current image to be encoded, and whose position is the same as the position of the image block, or the position is compared to the image block in the current image to be encoded.
  • the pixel difference between the Y component of the encoded block and the Y component of the image block at the same arbitrary position is Dist. Wherein, when Dist is not less than the second threshold, the pixels in the image block corresponding to the Dist are specific pixels.
  • the first threshold value may be a preset value, or the total number of pixels of the Y component of the image block and a preset value.
  • the product of the proportions is not limited here.
  • the image block can be used to update the long-term reference image according to the pixel value difference of the luminance component between the image block and the coded block
  • the condition that the image block needs to satisfy includes: a difference in pixel value of a luminance component between the image block and the coded block is less than a third threshold.
  • the third threshold value may be a preset value or an image block
  • the product of the total number of pixels of the Y component and a preset ratio is not limited here.
  • the image block can be used to update the long-term reference image according to the pixel value difference between the chrominance components between the image block and the coded block
  • the condition that the image block needs to satisfy includes: a difference between pixel values of chrominance components between the image block and the coded block is less than a fourth threshold.
  • the pixel value difference between the chrominance components between the image block and the coded block is smaller than the fourth threshold, and may be the pixel value difference between the U component between the image block and the coded block is less than the fourth threshold, or the image
  • the pixel value difference between the V component between the block and the second encoding block is less than the fourth threshold, or the pixel value difference between the U component between the image block and the encoded block is less than a preset value, and the image block and the The pixel value difference of the V component between the coding blocks is smaller than another preset value.
  • the fourth threshold may be a preset value or an image block.
  • the product of the total number of pixels of the luminance component (or chrominance component) and a preset ratio is not limited here.
  • the long-term reference is made according to all graphics blocks of the currently-to-be-encoded image. All image blocks of the image are updated.
  • the entire image blocks of the image to be encoded may refer to all image blocks after the encoding and reconstruction of the current image to be encoded, or may refer to all original image blocks of the current to-be-encoded image.
  • all image blocks in the long-term reference image may be replaced with all image blocks of the current image to be encoded.
  • all image blocks in the current to-be-encoded image are processed with certain image blocks to replace all image blocks in the long-term reference image.
  • the process may be averaging or weighted averaging the pixel values of all image blocks in the current-to-code image. There are no restrictions here.
  • the number of image blocks in the current to-be-encoded image that can be used to update the long-term reference image may be one or more than one. In some embodiments, the number of image blocks in the current to-be-encoded image that can be used to update the long-term reference image may be unlimited, that is, all image blocks in the current to-be-encoded image that meet the conditions that can be used to update the long-term reference image are used. For updating long-term reference images.
  • the number of image blocks that can be used to update the long-term reference image is large.
  • the number of image blocks that can be used to update the long-term reference image in the current image to be encoded can be limited to Greater than M, the M is an integer not less than 1.
  • the long-term reference image is updated according to each determined image block.
  • M image blocks are selected from the determined image blocks, and the long-term reference image is updated according to the M image blocks.
  • the value of M corresponding to the current image to be encoded is determined based on the type of the current image to be encoded.
  • the value of M corresponding to the current image to be encoded is different.
  • the currently-to-be-encoded image when the currently-to-be-encoded image is an I-picture, the currently-to-be-encoded image has at most a first preset number of image blocks for updating the long-term reference image; the currently-to-be-encoded image is a P-picture (or forward-predicted image) ), The currently to-be-encoded image has at most a second preset number of image blocks for long-term reference image update; when the currently-to-be-encoded image is a B-picture (or bidirectionally predicted image), the currently-to-be-encoded image has a maximum of The preset number of image blocks are used for updating the long-term reference image, wherein the first preset value, the second preset value, and the third preset value are different.
  • the value of M corresponding to the current image to be encoded is determined based on the total number of images of the type to which the current image to be encoded belongs. Specifically, for example, the M value corresponding to the I image is half of the total number of images of the I image in the video; the M value corresponding to the P image (or forward prediction image) is the total number of images of the P image (or forward prediction image). One-quarter; the M value corresponding to the B-picture (or bi-predictive picture) that can be used as the reference picture is one-eighth of the total number of pictures of the B-picture (or bi-predictive picture).
  • M image blocks from all the image blocks that can be used to update the long-term reference image, which are determined from the current image to be encoded. For example, in the case that the image is stored according to the components of different color channels, the cost selected from all the image blocks that can be used to update the long-term reference image determined from the current to-be-encoded image is less than a preset value, The least expensive M image blocks are used to update the long-term reference image.
  • the cost of the image block is the sum of the pixel differences of the image block in each color channel; the pixel differences of each image channel in the color block are: each pixel of the image block and the third coded block respectively The sum of the differences in pixel values of pixels with the same position in the color channel; the third coded block refers to the image block at a specific position in the coded image that is located before the current image to be coded.
  • the third coded block refers to a coded image located in a previous frame (or the first two frames) of the current image to be coded.
  • the specific position may be the same position as the image block in the current image to be encoded.
  • the image is stored in three YUV components.
  • the difference between the pixel values of the image block and the third encoding block on the three YUV components is Dist, Y, Dist, U, and Dist, and the total number of pixels on the luminance component of the image block is PixCount.
  • the cost of the image block (cost) (Dist Y + Dist U + Dist V) / PixCount.
  • the determined number of image blocks is not greater than M, all the image blocks are Both can be used to update the long-term reference image; if the determined number of image blocks is greater than M, it is determined that the M image blocks with the least cost among the current to-be-encoded images can be used to update the long-term reference image.
  • an identification bit of the image block is also encoded, and the identification bit is used to identify whether the image block is used to update the long-term reference image.
  • the code stream sent from the encoding end to the decoding end also includes identification bits of each image, where the identification bits of each image are used to indicate whether each image block in the image is used to update the long-term reference image.
  • FIG. 4 is a schematic diagram of a relationship between multiple images and a long-term reference image in a video.
  • four images in the video are sequentially encoded as an example.
  • the first three images are encoded images, and the fourth image is the current image to be encoded.
  • the first and third encoded images can be used as reference images, and the second encoded image cannot be used as a reference image.
  • the image block 11 and the image block 12 in the first encoded image are used to update the long-term reference image.
  • Image blocks 31, 32, 33, and 34 in the third encoded image are used to update the long-term reference image.
  • the pixel values in the image blocks 11, 12, 31, 32, 33, and 34 are respectively used to replace the pixel values of the image blocks at the same position in the long-term reference image.
  • the following uses a video encoding method for encoding a current image to be encoded as an example. Before encoding the current image to be encoded, it is determined that the current image to be encoded can be used as a reference image according to the type of the current image to be encoded. For example, since the current image to be encoded is an I image, it is determined that the current image to be encoded can be used as a reference image. Therefore, when encoding each image block in the current image to be encoded separately, for each image block, it is determined whether the image block can be used to update the long-term reference image.
  • the following describes a method for determining that an image block can be used to update a long-term reference image with two examples.
  • Images are stored according to three components, which are Y, U, and V components. Any image block in the current to-be-encoded image is referred to as image block 1, and the image block in the previous frame of the currently-encoded image that has the same position as image block 1 is referred to as image block 2.
  • the sum of the difference between the pixel values of the pixels at the same positions is DistY.
  • the sum of the differences between the pixel values of the pixels at the same positions in the U components of the image block 1 and the image block 2 is DistU.
  • the sum of the difference between the pixel values of the pixels at the same positions in the V components of the image block 1 and the image block 2 is DistV.
  • the total pixel of the luminance component of image block 1 is PixCount, and the large error point count between image block 1 and image block 2 is LargeDist1.
  • the initial value of LargeDist1 is set to 0. When a pixel having a difference in pixel value at the same position as the brightness component of image block 2 in the luminance component of image block 1 is larger than a preset value (eg, 20), LargeDist1 is incremented by one.
  • image block 1 is considered to be a candidate block for updating the long-term reference image.
  • Dist is smaller than a preset multiple of PixCount (for example, 4 times);
  • DistU is less than the preset multiple of PixCount (for example, 0.5 times);
  • DistV is smaller than a preset multiple of PixCount (for example, 0.5 times).
  • Cost (DistY + DistU + DistV) / PixCount.
  • the M candidate blocks with the lowest cost are selected from the currently to-be-coded images for updating the specific reference image.
  • Images are stored according to three components, which are Y, U, and V components. Any image block in the current to-be-encoded image is referred to as image block 1, and the image block in the previous frame of the current to-be-encoded image that has the same position as image block 1 is referred to as image 2, and the current to-be-encoded image is referred to as image 2. In the first two frames of the encoded image, the image block having the same position as the image block 1 is the image 3.
  • the sum of the difference between the pixel values of the pixels at the same positions is DistY.
  • the sum of the differences between the pixel values of the pixels at the same positions in the U components of the image block 1 and the image block 2 is DistU.
  • the sum of the difference between the pixel values of the pixels at the same positions in the V components of the image block 1 and the image block 2 is DistV.
  • the sum of the difference between the pixel values of the pixels at the same position among the Y components of the image block 1 and the image block 3 is DistY '.
  • the sum of the difference between the pixel values of the pixels at the same position among the U components of the image block 1 and the image block 2 is DistU '.
  • the sum of the difference between the pixel values of the pixels at the same position among the V components of the image block 1 and the image block 2 is DistV '.
  • the total pixel of the luminance component of image block 1 is PixCount
  • the large error point count between image block 1 and image block 2 is LargeDist1
  • the large error point count between image block 1 and image block 3 is LargeDist2.
  • image block 1 is considered as a candidate block for updating a specific background block.
  • Dist Y and Dist Y ′ are both smaller than a preset multiple of PixCount (for example, 6 times);
  • Dist U and Dist U ’ are both smaller than the preset multiple of PixCount (for example, 0.5 times)
  • Cost (DistY + DistU + DistV) / PixCount.
  • the M candidate blocks with the lowest cost are selected from the currently to-be-coded images for updating the specific reference image.
  • the image blocks that can be used to update the long-term reference image are used to compare the long-term reference image. Update. For example, as shown in FIG. 4, the pixel values in the image blocks 41, 42, 43, and 44 are respectively used to replace the pixel values of the image blocks at the same position in the long-term reference image.
  • FIG. 5 is a schematic flowchart of still another embodiment of a video encoding method of the present application. As shown in Figure 5, the method includes:
  • the current to-be-encoded image can be used to update the long-term reference image
  • the image block is available to update the long-term reference image
  • the position of the specific image block in the long-term reference image is determined by the position of the image block in the current image to be encoded.
  • the currently-to-be-encoded image when the currently-to-be-encoded image is available for inter prediction, it is determined that the currently-to-be-encoded image can be used to update the long-term reference image. For example, when it is determined that the current image to be coded is an intra-prediction image or a forward prediction image, it is determined that the current to-be-coded image can be used to update the long-term reference image. For example, since I-pictures and P-pictures (or forward-predicted pictures) can be used as reference pictures for inter-frame prediction of other pictures, when it is determined that the currently to-be-encoded picture is an I-picture or a P-picture (or forward-predicted picture) To determine the current image to be encoded as the reference image.
  • some B-pictures can also be used as reference pictures for inter-prediction of other pictures.
  • lower-level B-pictures can be used as reference. Frames are used. Therefore, when it is determined that the current image to be encoded is this part of the B image, it can also be determined that the current image to be encoded can be used as a reference image.
  • all image blocks of the long-term reference image are updated according to all the image blocks of the currently-to-code image.
  • an image in a video when it can be used as a reference image (that is, it can be used for inter prediction), it is not distinguished as a long-term reference image or a short-term reference image, as long as the current to-be-encoded image can be framed as other images.
  • the inter-predicted reference image can determine that the current to-be-encoded image can be used as the reference image.
  • the image block in the to-be-encoded image can be used to update a specific image block.
  • the current to-be-coded image when the current to-be-coded image is not available as a short-term reference image and cannot be used as a long-term reference image, it is determined that an image block in the to-be-coded image is not available for updating a specific image block in the long-term reference image.
  • the current to-be-coded image when the current to-be-coded image can be used as a short-term reference image and can be used as a long-term reference image, it is determined that an image block in the to-be-coded image can be used to update the long-term reference image.
  • the to-be-encoded image when the current to-be-encoded image is not available as a short-term reference image but can be used as a long-term reference image, it is determined that the to-be-encoded image can be used to update the long-term reference image.
  • determining that the to-be-coded image is not available for updating the long-term reference image that is, determining the Image patches are not used to update specific image patches in the long-term reference image.
  • the current to-be-coded picture when the current to-be-coded picture can be used as a short-term reference picture but not as a long-term reference picture, it is determined that the to-be-coded picture can be used to update the long-term reference picture.
  • the current to-be-coded image when the current to-be-coded image can be used as a short-term reference image and can be used as a long-term reference image, it is determined that the to-be-coded image can be used to update the long-term reference image.
  • an identification bit is further added in at least one of the following, and the identification bit is used to identify whether an image that cannot be used as a short-term reference image can be used to update the long-term reference image:
  • the flag is a time-domain scalable flag.
  • the value of the identification bit is used to indicate that an image block in an image that is not a short-term reference image cannot be used to update the long-term reference image; and / or, when there is no time-domain scalability
  • the value of the identification bit is used to indicate that an image block in an image that is not a short-term reference image can be used to update the long-term reference image.
  • the meaning of the scheme "the image blocks in the current to-be-encoded image that cannot be used as short-term reference pictures but can be used as long-term reference frames" can be used to update long-term reference pictures.
  • it can ensure the effect of specific reference frames on improving the encoding quality while taking into account the concept of short-term reference images, which cannot be used as a reference.
  • the definition of the image of the image when the encoding system is concerned about the parallel encoding characteristics that are not used as short-term reference pictures or directly discards the characteristics that are not used as short-term reference pictures to speed up the encoding speed, the An image block cannot be used to update a specific reference frame.
  • At least one of a video parameter set, a sequence parameter set, a sequence header, an image parameter set, an image header, a slice header, a reference image set, and a reference configuration set may be added with an identification bit, and the identification bit is used to identify that the Whether the image block information in the image of the short-term reference image can be used to update a specific reference frame.
  • the identification bit may also be a time-domain scalable identification bit.
  • the value of the flag is used to indicate that the image block in the image that is not a short-term reference image is not available for the update of a specific reference frame; and / or, when the encoding system does not have
  • the value of the flag is used to indicate that an image block in an image that is not a short-term reference image can be used for updating a specific reference frame.
  • the number of image blocks in the current to-be-encoded image that can be used to update the long-term reference image may be one or more than one. In some embodiments, the number of image blocks in the current to-be-encoded image that can be used to update the long-term reference image may be unlimited, that is, all image blocks in the current to-be-encoded image that meet the conditions that can be used to update the long-term reference image are used. For updating long-term reference images.
  • the number of image blocks that can be used to update the long-term reference image is large.
  • the number of image blocks that can be used to update the long-term reference image in the current image to be encoded can be limited to Greater than M, the M is an integer not less than 1.
  • the long-term reference image is updated according to each determined image block.
  • M image blocks are selected from the determined image blocks, and the long-term reference image is updated according to the M image blocks.
  • the value of M corresponding to the current image to be encoded is determined based on the type of the current image to be encoded.
  • the value of M corresponding to the current image to be encoded is different.
  • the currently-to-be-encoded image when the currently-to-be-encoded image is an I-picture, the currently-to-be-encoded image has at most a first preset number of image blocks for updating the long-term reference image; the currently-to-be-encoded image is a P-picture (or forward-predicted image) ), The currently to-be-encoded image has at most a second preset number of image blocks for long-term reference image updating; when the currently-to-be-encoded image is a B-picture (or bidirectionally predicted image), the currently-to-be-encoded image has at most a third The preset number of image blocks are used for updating the long-term reference image, wherein the first preset value, the second preset value, and the third preset value are different.
  • the value of M corresponding to the current image to be encoded is determined based on the total number of images of the type to which the current image to be encoded belongs. Specifically, for example, the M value corresponding to the I image is half of the total number of images of the I image in the video; the M value corresponding to the P image (or forward prediction image) is the total number of images of the P image (or forward prediction image). One-quarter; the M value corresponding to the B-picture (or bi-predictive picture) that can be used as the reference picture is one-eighth of the total number of pictures of the B-picture (or bi-predictive picture).
  • an image that is not used as a reference image is not used in the encoding and decoding process of other images during the encoding and decoding process, that is, when some images are unavailable for updating the long-term reference image, they are also deleted. Used to update long-term reference images.
  • the image block in the currently-to-be-encoded image is considered to update the long-term reference image, which avoids that when some images are not available to update the long-term reference image It is also used in the case of updating the long-term reference image, for example, avoiding the case where the construction process of the long-term reference image is inconsistent with the definition of an image that is not used as a reference image.
  • the image that is not used as a reference image may not be decoded when it is decoded, thereby speeding up the decoding speed of the video code stream and achieving Variable frame rate playback of video content.
  • the use of image blocks in the current to-be-encoded image is considered to update the long-term reference image, which avoids using an image that cannot be used as a reference image.
  • the image block in the image updates the long-term reference image, it is impossible to realize the situation that the discarded part cannot be used as the reference image.
  • the specific image block in the long-term reference image is not updated with the image block in the currently-to-be-coded image. For example, when the currently-to-be-encoded image is unavailable for inter prediction, it is determined that the currently-to-be-encoded image is not available for updating the long-term reference image. As another example, when the current to-be-coded image can be used as a short-term reference image but cannot be used as a long-term reference image, it is determined that an image block in the to-be-coded image is not used to update a specific image block in the long-term reference image.
  • the current to-be-coded image is not a short-term reference image or a long-term reference image
  • it is determined that the image block in the to-be-coded image is not used to update a specific image block in the long-term reference image.
  • the encoding end is still in a video parameter set (VPS), a sequence parameter set (SPS), and a sequence header.
  • VPS video parameter set
  • SPS sequence parameter set
  • RCS reference picture configuration set
  • an identification bit of the image block in the currently-to-be-encoded image is also used to identify whether the image block in the currently-to-be-encoded image is For updating the long-term reference image.
  • FIG. 6 is a schematic diagram of a video decoding method according to another embodiment of the present application.
  • the method may be performed by an image processing apparatus, which may be various types of chips for image processing, an image processor, and the like.
  • the video decoding method includes:
  • a current to-be-decoded image can be used as a reference image
  • an image block can be used to update a long-term reference image
  • a specific image block in the long-term reference image is updated according to the image block, where the image block is all
  • the image block in the current image to be decoded is described, and the position of the specific image block in the long-term reference image is determined by the position of the image block in the current image to be decoded.
  • determining that the current image to be decoded can be used as a reference image may occur before decoding the image to be decoded. In this way, according to the determination result, when each image block in the image to be decoded is decoded or after decoding, it is determined that each image block meets a condition for updating the long-term reference image. Or, determining that the current image to be decoded can be used as a reference image, can also occur when decoding or decoding each image block in the image to be decoded, that is, when decoding or decoding each image block, first determine the image block The current image is an image that can be used as a reference image. When it is determined that the image can be used as a reference image, the image block can be used to update the long-term reference image.
  • the current image to be decoded can be used as a reference image.
  • a parameter or an identification bit indicating a reference relationship of the current image to be decoded can be obtained, and whether the current image to be decoded is available is determined according to the parameter or the identification bit.
  • Image as a reference image.
  • parameters or identification bits used to indicate the reference relationship of the current to-be-decoded image can be obtained through various ways. For example, from video parameter set (VPS), sequence parameter set (SPS), sequence header, picture header, slice header, reference image set (reference picture set (RPS) and reference picture configuration set (RCS) to obtain a parameter or an identification bit indicating a reference relationship of a current picture to be decoded.
  • VPS video parameter set
  • SPS sequence parameter set
  • RPS reference image set
  • RCS reference picture configuration set
  • the I-picture and the P-picture can be used as reference pictures for inter-frame prediction of other pictures
  • when determining whether the currently to-be-decoded picture is an I-picture or a P-picture (or forward-looking picture) (Predicted image) it is determined that the image to be decoded is an image that can be used as a reference image.
  • some B pictures (or bi-predictive pictures) can also be used as reference pictures for inter prediction. For example, in hierarchical B (hierarchical B) technology, lower-level B pictures can be used as reference frames. It is used, therefore, when it is determined that the current image to be encoded is this part of the B image, it can also be determined that the current image to be encoded can be used as a reference image.
  • the method for judging the image block can be used to update the long-term reference image.
  • the decoding end further parses the identification bits of each image from the code stream, wherein the identification bits of each image are used to indicate whether each image block in the image is used to update the long-term reference image. .
  • the decoding end can obtain an identification bit of the image block from the decoding end, and determine whether the image block is used to update the long-term reference image according to the identification bit.
  • the method for updating a specific image block in a long-term reference image according to the image block may refer to the method for updating a specific image block in a long-term reference image according to the image block in the current image to be encoded in the above description.
  • the position of a specific image block in the long-term reference image is specifically determined by the position of the image block in the current image to be decoded. For details, refer to step 101. How is the position of the specific image block in the long-term reference image determined by the image? The position of the block in the current image to be encoded is determined, and details are not described herein again.
  • the number of image blocks that can be used to update the long-term reference image in the current to-be-decoded image may be one or more than one. In some embodiments, the number of image blocks in the current to-be-decoded image that can be used to update the long-term reference image may be unlimited, that is, all image blocks in the current to-be-decoded image that meet the conditions that can be used to update the long-term reference image are used. For updating long-term reference images.
  • the number of image blocks that can be used to update the long-term reference image is large. Considering the implementation complexity of the codec system, the number of image blocks that can be used to update the long-term reference image in the current to-be-decoded image can be limited to Greater than M, the M is an integer not less than 1.
  • the long-term reference image is updated according to each determined image block.
  • M image blocks are selected from the determined image blocks, and the long-term reference image is updated according to the M image blocks.
  • the value of M corresponding to the current image to be decoded may be based on multiple determination methods. For example, the value of M corresponding to the current image to be decoded is determined based on the type of the current image to be decoded. In some embodiments, when the image types of the current image to be decoded are different, the values of M corresponding to the current image to be decoded are different.
  • the current image to be decoded when the current image to be decoded is an I image, the current image to be decoded has at most a first preset number of image blocks for updating the long-term reference image; the current image to be decoded is a P image (or a forward prediction image) ), The currently to-be-decoded image has at most a second preset number of image blocks for updating the long-term reference image; when the currently-to-be-decoded image is a B-picture (or bidirectionally predicted image), the currently-to-be-decoded image has up to a third The preset number of image blocks are used for updating the long-term reference image, wherein the first preset value, the second preset value, and the third preset value are different.
  • the value of M corresponding to the current image to be decoded is determined based on the total number of images of the type to which the current image to be decoded belongs. Specifically, for example, the M value corresponding to the I image is half of the total number of images of the I image in the video; the M value corresponding to the P image (or forward prediction image) is the total number of images of the P image (or forward prediction image). One-quarter; the M value corresponding to the B-picture (or bi-predictive picture) that can be used as the reference picture is one-eighth of the total number of pictures of the B-picture (or bi-predictive picture).
  • At least one of the following carries the number of image blocks in the current to-be-decoded image that can be used to update the long-term reference image: the image header of the currently-to-decode image, the image parameter set of the currently-decoded image, and the current-to-be-decoded image block.
  • the decoder can parse out the number of image blocks in the current to-be-decoded image that can be used to update the long-term reference image.
  • the value of M corresponding to the current to-be-decoded image is only used to inform the decoding end how many image blocks of the current image can be used for updating the specific reference frame, which can facilitate the design of the decoding end and reduce the complexity of the decoding end. degree.
  • FIG. 7 is a schematic flowchart of another embodiment of a video decoding method of the present application. As shown in Figure 7, the method includes:
  • the currently-to-be-decoded picture when the currently-to-be-decoded picture is available for inter prediction, it is determined that the currently-to-be-decoded picture can be used to update the long-term reference picture. For example, since I-pictures and P-pictures (or forward-predicted pictures) can be used as reference pictures for inter-prediction of other pictures, when the current picture to be decoded is determined to be an I-picture or a P-picture (or forward-predicted picture) To determine that the current image to be decoded is an image that can be used as a reference image. In some embodiments, some B pictures (or bi-predictive pictures) can also be used as reference pictures for inter prediction.
  • lower-level B pictures can be used as reference frames. It is used, therefore, when it is determined that the current image to be encoded is this part of the B image, it can also be determined that the current image to be encoded can be used as a reference image.
  • all image blocks of the long-term reference image are updated according to all-image blocks of the currently-to-be-decoded image.
  • the reference relationship of the current to-be-decoded picture may refer to whether the currently-decoded picture is a short-term reference picture or a long-term reference picture.
  • parameters or identification bits used to indicate the reference relationship of the current to-be-decoded image can be obtained through various ways.
  • VPS video parameter set
  • SPS sequence parameter set
  • RPS reference image set
  • RCS reference picture set
  • RCS reference picture configuration set
  • an image in a video when used as a reference image, it is not distinguished as a long-term reference image or a short-term reference image, as long as the current image to be decoded can be used as a reference image for inter-frame prediction of other images, it can be determined.
  • the current picture to be decoded can be used as a reference picture, and the current picture to be encoded can be used to update the long-term reference picture.
  • determining that the to-be-decoded image is not available for updating the long-term reference image that is, determining the Image patches are not used to update specific image patches in the long-term reference image.
  • the current image to be decoded when the current image to be decoded can be used as a short-term reference image and can be used as a long-term reference image, it is determined that the image block in the image to be decoded can be used to update the long-term reference image.
  • the to-be-decoded image when the current to-be-decoded image is not available as a short-term reference image but can be used as a long-term reference image, it is determined that the to-be-decoded image can be used to update the long-term reference image.
  • determining that the image to be decoded is not available for updating the long-term reference image that is, determining the Image patches are not used to update specific image patches in the long-term reference image.
  • the current picture to be decoded when the current picture to be decoded can be used as a short-term reference picture but cannot be used as a long-term reference picture, it is determined that the picture to be decoded can be used to update the long-term reference picture.
  • the current picture to be decoded when the current picture to be decoded can be used as a short-term reference picture and can be used as a long-term reference picture, it is determined that the picture to be decoded can be used to update the long-term reference picture.
  • determining which image is the currently decoded image For example, it can be analyzed in the video parameter set, sequence parameter set, sequence header, image parameter set, image header, slice header, reference image set, and reference configuration set. Obtain whether the current image is a short-term reference image or a long-term reference image.
  • an identification bit may be parsed by using at least one of a video parameter set, a sequence parameter set, a sequence header, an image parameter set, an image header, a slice header, a reference image set, and a reference configuration set. It is used to identify whether the image to be decoded is available for updating the long-term reference image.
  • the identification bit may also be a time-domain scalable identification bit.
  • the value of this flag is used to indicate that the image block in the image that is not a short-term reference image is not available for the update of a specific reference frame; and / or, when the decoder does not have the time domain
  • the value of this flag is used to indicate that image blocks in an image that is not a short-term reference image can be used for the update of a specific reference frame.
  • an identification bit of an image block of the image to be decoded is further obtained, where the identification bit is used to identify whether the image block in the image to be decoded is used to update the long-term reference image.
  • An image block that can be used to update the long-term reference image is determined according to the identification bit.
  • the number of image blocks that can be used to update the long-term reference image in the current to-be-decoded image may be one or more than one. In some embodiments, the number of image blocks in the current to-be-decoded image that can be used to update the long-term reference image may be unlimited, that is, all image blocks in the current to-be-decoded image that meet the conditions that can be used to update the long-term reference image are used. For updating long-term reference images.
  • the number of image blocks that can be used to update the long-term reference image is large. Considering the implementation complexity of the codec system, the number of image blocks that can be used to update the long-term reference image in the current to-be-decoded image can be limited to Greater than M, the M is an integer not less than 1.
  • the long-term reference image is updated according to each determined image block.
  • M image blocks are selected from the determined image blocks, and the long-term reference image is updated according to the M image blocks.
  • the value of M corresponding to the current image to be decoded may be based on multiple determination methods. For example, the value of M corresponding to the current image to be decoded is determined based on the type of the current image to be decoded. In some embodiments, when the image types of the current image to be decoded are different, the values of M corresponding to the current image to be decoded are different.
  • the current image to be decoded when the current image to be decoded is an I image, the current image to be decoded has at most a first preset number of image blocks for updating the long-term reference image; the current image to be decoded is a P image (or a forward prediction image) ), The currently to-be-decoded image has at most a second preset number of image blocks for updating the long-term reference image; when the currently-to-be-decoded image is a B-picture (or bidirectionally predicted image), the currently-to-be-decoded image has up to a third The preset number of image blocks are used for updating the long-term reference image, wherein the first preset value, the second preset value, and the third preset value are different.
  • the value of M corresponding to the current image to be decoded is determined based on the total number of images of the type to which the current image to be decoded belongs. Specifically, for example, the M value corresponding to the I image is half of the total number of images of the I image in the video; the M value corresponding to the P image (or forward prediction image) is the total number of images of the P image (or forward prediction image). One-quarter; the M value corresponding to the B-picture (or bi-predictive picture) that can be used as the reference picture is one-eighth of the total number of pictures of the B-picture (or bi-predictive picture).
  • At least one of the following carries the number of image blocks in the current to-be-decoded image that can be used to update the long-term reference image: the image header of the currently-to-decode image, the image parameter set of the currently-decoded image, and the current-to-be-decoded image block.
  • the decoder can parse out the number of image blocks in the current to-be-decoded image that can be used to update the long-term reference image.
  • the value of M corresponding to the current to-be-decoded image is only used to inform the decoding end how many image blocks of the current image can be used for updating the specific reference frame, which can facilitate the design of the decoding end and reduce the complexity of the decoding end. degree.
  • the current picture to be decoded when the current picture to be decoded can be used as a short-term reference picture but not as a long-term reference picture, it is determined that the image block in the picture to be decoded is not used to update the long-term reference picture.
  • the current to-be-decoded image when the current to-be-decoded image is not available as a short-term reference image and cannot be used as a long-term reference image, it is determined that an image block in the to-be-decoded image is not available for updating the long-term reference image.
  • the code stream includes a first type frame and a second type frame, and may further include a third type frame and a fourth type frame.
  • the first type frame is an I frame or a random access point, or the first type frame is an I frame and a random access point at the same time.
  • the second type frame is an inter-coded frame whose encoding order is after the first type frame and whose display order is before the first type frame.
  • the second type frame may be a P frame or a B frame.
  • the third type frame is an inter-coded frame whose coding order precedes the first type frame.
  • the display order of the third type frame may precede the first type frame.
  • the third type frame may be a P frame or a B frame.
  • the fourth type frame is an inter-coded frame whose encoding order is after the first type frame and whose display order is after the first type frame.
  • the fourth type frame may be a P frame or a B frame.
  • inter-frame coding mentioned herein includes inter-frame coding of an entire frame of images or inter-frame coding of at least one image block in the entire frame of images. This definition of inter-frame coding applies to all types of frames.
  • FIG. 8 is a schematic flowchart of an encoding method 800 according to an embodiment of the present application. As shown in FIG. 8, the encoding method 800 includes the following steps.
  • S810. Encode the first type frame.
  • N second type frames that need to be inter-frame encoded after the first type frame.
  • the display order of the N second type frames is before the first type frame. Where N is a positive integer.
  • the encoding method in the embodiment of the present application is only replaced after completing the inter-frame encoding of at least one second-type frame among the N second-type frames in which the encoding order is after the first-type frame and the display order is before the first-type frame.
  • the currently used long-term reference picture enables at least one second-type frame to reference the long-term reference picture before the first-type frame, which can improve coding efficiency.
  • encoding the first-type frame refers to performing intra-frame encoding on the first-type frame.
  • the first type of frame is a random access point.
  • the current long-term reference is replaced only after the inter-frame encoding of at least one second type frame among the N second type frames in the display order before the random access point is completed after the random access point is completed.
  • the method in the embodiment of the present application may be applied only to a random access point in a video, or may be applied to an I frame in a video.
  • At least one second type frame in S830 is concentrated on a part of the N second type frames in the coding order, and is particularly located at the front of the N second type frames.
  • the at least one second-type frame may be a part of the second-type frame in which the coding order is relatively earlier among the N second-type frames.
  • the solution in the embodiment of the present application is not limited to the case of S830. That is, at least one second type frame may refer to a long-term reference image before a random access point, and the at least one second type frame may be located at any position among the N second type frames, respectively.
  • the second long-term reference image is replaced by the second long-type reference frames of the N second-type frames except for at least one second-type frame.
  • the at least one second-type frame may be a part of the second-type frame in which the display order is relatively higher among the N second-type frames.
  • At least one second type frame may also be located at other positions in the N second type frames, which is not limited in this embodiment of the present application.
  • replacing the currently used long-term reference image may include: after completing the After inter-coding of all second-type frames in the N second-type frames, the currently used long-term reference image is replaced. That is, all the coding sequences are after the first type frame, and the frames in the display order before the first type frame refer to the long-term reference image before the first type frame. All the second type frames refer to the long-term reference image before the random access point, which can maximize the coding efficiency.
  • the encoding method may include the following steps. Intra-frame encoding of the first type of frame, in which, according to the encoding order, there is a third type of frame (which may be one or more frames) for inter-frame encoding before the first type of frame, and there is a display after the first type of frame N second type frames that need to be inter-frame coded before the first type frame, and the third type frame is encoded with reference to a long-term reference image. Based on the long-term reference image, inter-frame encoding is performed on at least one second-type frame of the N second-type frames.
  • At least one second type frame may reference a long-term reference image before the random access point, that is, at least one second type frame is based on the long-term reference image before the random access point.
  • the second type frames other than at least one second type frame in the N second type frames refer to the new long-term reference image after replacement, for example, the long-term reference image after the random access point.
  • all the second type frames of the N second type frames may be inter-frame coded.
  • Inter-coding at least one second type frame of the N second type frames based on the long-term reference image may include: updating the long-term reference image after inter-frame coding based on the third type frame, and At least one second type frame of the N second type frames is inter-frame coded.
  • the updated long-term reference image may be updated based on a specific image block of the third type frame after the third type frame is inter-coded; or, it may be a specific image block of the third type frame. After the image block is inter-coded, it is updated based on the specific image block.
  • the third type frame is displayed before the first type frame.
  • the long-term reference image before the first-type frame may be an updated long-term reference image after one or more frames of the encoded image before the first-type frame.
  • the long-term reference picture may be based on, for example, a long-term reference picture before a first type of frame.
  • the long-term reference image before the first type of frame can be continuously updated, for example, the long-term reference image after one or more encoded images in the third type of frame is updated before the first type of frame updated in this document.
  • the long-term reference picture is still referred to as the long-term reference picture before the first type of frame.
  • At least one second type frame of the N second type frames is inter-frame encoded based on the long-term reference image, and one or more frames in the second type frame have been encoded.
  • the image updates the long-term reference image for reference to subsequent frames to be encoded.
  • S820 performs inter-frame encoding on at least one second type frame of the N second type frames based on the long-term reference image, which may include: performing the N second type based on the long-term reference image. At least one second-type frame in the frame is inter-coded, and when at least a portion of the second-type frame completes encoding, the long-term reference image is updated by using a specific image block in the at least part of the second-type frame that has been encoded, The updated long-term reference picture is used as the long-term reference picture of the next type 2 frame.
  • S820 performs inter-frame encoding on at least one second type frame of the N second type frames based on the long-term reference image, which may include: performing the N second type based on the long-term reference image. At least one second-type frame in the frame is inter-coded.
  • the long-term reference image is updated by using the specific image block that has been encoded, and the updated long-term reference image is used.
  • the reference image is used as a long-term reference image of the next frame of the second type or as a long-term reference image of the current frame of the second type.
  • replacing the currently used long-term reference image may include: replacing the currently used long-term reference image with the reconstructed image of the first type frame.
  • replacing the currently used long-term reference image may include: after completing encoding the first type frame, placing the reconstructed image of the first type frame into a reference image buffer Medium; after completing inter-frame encoding of at least one second type frame of the N second type frames, outputting a reconstructed image of the first type frame from the reference image buffer, and using the The reconstructed image of the first type of frame replaces the currently used long-term reference image. That is, the reconstructed image of the first type of frame may be put into a reference image buffer, and used as a short-term reference image and stored all the time. After the inter-frame encoding of at least one frame of the second type is completed, the reconstructed image of the frame of the first type is output from the reference image buffer as a new long-term reference image in the encoding process.
  • placing the reconstructed image of the first type frame in a reference image buffer may include: when the reconstructed image of the first type frame does not exist in the reference image buffer When the reconstructed image of the first type frame is placed in the reference image buffer. That is, before putting the reconstructed image of the first type frame into the reference image buffer, it can be determined whether there is a reconstructed image of the first type frame in the reference image buffer. When the reconstructed image of the first type frame does not exist in the reference image buffer, the reconstructed image of the first type frame is placed in the reference image buffer.
  • the encoding method may further include: performing inter-frame encoding on the fourth type frame based on the replaced long-term reference image as a basis for the long-term reference image.
  • the fourth type frame may include one frame or multiple frames.
  • the fourth type frame may be inter-coded with reference to the replaced long-term reference image.
  • the fourth type frame includes multiple frames
  • one or more frames of multiple fourth type frames may be inter-frame-coded based on the replaced long-term reference image, and a frame or The multi-frame encoded image updates the long-term reference image for reference of subsequent frames to be encoded.
  • multiple fourth types may be inter-coded based on the replaced long-term reference image, and when each fourth-type frame is encoded, the long-term reference is updated using the fourth-type frame that has been encoded. An image, using the updated long-term reference image as a long-term reference image of a next fourth type frame.
  • the long-term reference image remains unchanged after the first type frame is encoded and before the next frame of the first type frame is encoded in the encoding order.
  • the long-term reference image after updating the long-term reference image, after encoding at least part of the image frames other than the first type frame, the long-term reference image is based on the partial image blocks in the image frame. Update part of the image blocks in the image; or, after encoding specific image blocks in at least part of the image frames other than the first type frame, update part of the image blocks in the long-term reference image based on the specific image block .
  • FIG. 9 is a schematic flowchart of an encoding method 900 according to an embodiment of the present application. As shown in FIG. 9, the method 900 includes the following steps.
  • S910 Encode a first type frame (for example, a random access point).
  • the remaining second-type frame and / or the fourth-type frame after the second-type frame refer to the long-term reference image constructed by referring to the reconstructed image of the first-type frame during encoding.
  • long-term reference images can be continuously updated.
  • the reference image buffer (short-term reference image buffer), and make all second-type frames refer to the first type when encoding.
  • the long-term reference image used before the frame including the third type frame and may also include the first type frame).
  • the reference image buffer is maintained, and all short-term reference images whose display order precedes the first type frames are deleted.
  • the fourth type frame after the second type frame refers to the long-term reference image constructed by referring to the reconstructed image of the first type frame when encoding.
  • long-term reference images can be continuously updated.
  • the following uses specific video sequence coding to describe the coding method in the embodiment of the present application.
  • the coding sequence is I0, P8, B4, B2, B1, B6, B5, B7, I16, B12, B10, B9, B11, B14, B13, B15, P24, B20, B18, B17, B19, B19, B21, B23 ...
  • I0 and I16 are and are random access points. Assuming I16 is the first type frame, then B12, B10, B9, B14, B13, B13, B15 are the second type frame, P8, B4, B2, B1, B3, B6, B5, B7, etc. can be regarded as the third type frame, P24, B20, B18, B17, B19, B19, B21, B21, B23 ... Fourth type frame.
  • the reconstructed image structure of I0 is placed in the reference image buffer. Since there is no frame after I0 in the display order before I0, there is no frame in the reference image buffer before the display order. Use the reference
  • the reconstructed image of I0 in the image buffer constructs a long-term reference image, and continues to encode P8, B4, B1, B3, B6, B5, and B7 after the display order of I0, and updates the reference image buffer and the long-term reference image of the reconstructed image of I0.
  • the reconstructed image of I16 is placed in the reference image buffer, and B12, B9, B11, B14, B13, and B15 before the display order of I16 continue to be encoded.
  • These long-term reference images referenced by the second type frames are long-term reference images constructed by the reconstructed image of I0, and after each encoding of the second type frame is completed, the reconstructed image structure of I0 can be updated according to the encoded second-type frames. Long-term reference image. After the encoding of B15 is completed, the subsequent frames before I16 are not displayed.
  • the reconstructed image of I16 in the reference image buffer is output as a new long-term reference image, that is, the long-term reference image constructed by the reconstructed image of I16 is replaced.
  • the reconstructed image of I0 constructs a long-term reference image. Clear all short-term reference images in the reference image buffer before the display order I16. Then continue to encode P24, B20, B18, B17, B19, B21, B21, B23 ..., and update the reference image buffer and the long-term reference image constructed by the reconstructed image of I16.
  • the coding sequence is I0, P8, B4, B2, B1, B6, B5, B7, I16, B12, B10, B9, B11, B14, B13, B15, P24, B20, B18, B17, B19, B19, B21, B23 ...
  • I0 and I16 are and are random access points. Assuming I16 is the first type frame, then B12, B10, B9, B11, B14B13, B15 are the second type frame, P8, B4, B2, B3, B6, B5, B7, etc. can all be regarded as the third type frame, P24, B20, B18, B17, B19, B19, B22, B21, B23 ... Four types of frames.
  • the reconstructed image structure of I0 is placed in the reference image buffer. Since there is no frame after I0 in the display order before I0, there is no frame in the reference image buffer before the display order.
  • the reconstructed image of I0 in the image buffer constructs a long-term reference image, and continues to encode P8, B4, B1, B3, B6, B5, and B7 after the display order of I0, and updates the reference image buffer and the long-term reference image of the reconstructed image of I0.
  • the reconstructed image of I16 is placed in the reference image buffer, and a portion of the second type frames B12, B10, B9, and B11 that are displayed before I16 are continued to be encoded.
  • These long-term reference images referenced by the second type frame are long-term reference images constructed by the reconstructed image of I0, and after each encoding of the second type frame is completed, the reconstructed image structure of I0 may be updated according to the encoded second-type frame. Long-term reference image.
  • the reconstructed image of I16 in the reference image buffer is output as a new long-term reference image, that is, the long-term reference image of the reconstructed image of I0 is replaced with the long-term reference image of the reconstructed image of I16.
  • Another part of the second type frame B14, B13, and B15 can be encoded with reference to the reconstructed image of I16 (the long-term reference image constructed by the reconstructed image of I16).
  • an identifier indicating which frame in the code stream starts to be another part of the second type frame is also encoded, or the codec segment is set to start as the first frame of the other part of the second type frame by default. .
  • the long-term reference image constructed by the reconstructed image of I16 may be updated according to the encoded second type frame.
  • all short-term reference images whose display order is before I16 in the reference image buffer are cleared.
  • the reconstructed image of I16 in the reference image buffer is output as a new long-term reference image, that is, the long-term reference image constructed by the reconstructed image of I16 is replaced with the long-term reference image constructed by the reconstructed image of I16 again.
  • P24, B20, B18, B17, B19, B21, B21, B23 ... and update the reference image buffer and the long-term reference image constructed by the reconstructed image of I16.
  • FIG. 10 is a schematic flowchart of a decoding method 1000 at a random access point according to an embodiment of the present application. As shown in FIG. 10, the decoding method 1000 includes the following steps.
  • S1010 Determine whether the random access function is used at the random access point. When using the random access function, execute 1200 for decoding; when not using the random access function, execute 1100 for decoding.
  • FIG. 11 is a schematic flowchart of a decoding method 1100 at a random access point according to an embodiment of the present application. As shown in FIG. 11, 1100 may include the following steps.
  • S1120 Inter-frame decode at least one second type frame of the N second type frames according to the long-term reference image.
  • the encoding method in the embodiment of the present application is only replaced after completing the inter-frame encoding of at least one second-type frame among the N second-type frames in which the decoding order is after the first-type frame and the display order is before the first-type frame.
  • the currently used long-term reference picture enables at least one second-type frame to reference the long-term reference picture before the first-type frame, which can improve decoding efficiency.
  • the first type frame is a random access point.
  • the first type of frame is a clear random access point.
  • S1130 replacing the currently used long-term reference image may include: after completing the N second type frames, After the inter-frame decoding of all the frames of the second type in the type frame, the currently used long-term reference image is replaced.
  • the replacing the currently used long-term reference image may include: replacing the currently used long-term reference image with the reconstructed image of the first type frame.
  • replacing the currently used long-term reference image includes: after the decoding of the first type frame is completed, placing the reconstructed image of the first type frame into a reference image buffer; After completing inter-frame decoding of at least one second type frame among the N second type frames, output the reconstructed image of the first type frame from the reference image buffer to the first type The reconstructed image of the frame replaces the currently used long-term reference image.
  • placing the reconstructed image of the first type frame in a reference image buffer may include: when the reconstructed image of the first type frame does not exist in the reference image buffer, Placing the reconstructed image of the first type of frame into the reference image buffer.
  • Inter-frame decoding of a frame may include: performing inter-frame decoding on at least one second-type frame of the N second-type frames according to the long-term reference image updated after inter-frame decoding of the third-type frame.
  • the third type frame may be displayed before the first type frame.
  • the display order of the fourth type frame is after the first type frame
  • the decoding method It also includes: performing inter-frame decoding on the fourth type frame according to the replaced long-term reference image.
  • the updated long-term reference image is updated based on a specific image block of the third-type frame after inter-frame decoding of the third-type frame; or, the updated long-term reference image is updated.
  • the reference image is updated based on the specific image block after inter-frame decoding of the specific image block of the third type frame.
  • performing inter-frame decoding on at least one second type frame of the N second type frames according to a long-term reference image includes: Perform inter-frame decoding on at least one second type of frame, and when at least part of the second type of frame is decoded, use the specific image block in the at least part of the second type of frame that has been decoded to update the long-term reference image, The long-term reference image of the second-type frame as the long-term reference image of the next type; or, at least one second-type frame of the N second-type frames is inter-frame decoded according to the long-term reference image.
  • the long-term reference image is updated using the decoded specific image block, and the updated long-term reference image is used as a long-term reference image of the next second type frame or as the current second Long-term reference image of a type frame.
  • the long-term reference image remains unchanged after the first type frame is decoded and before the next frame of the first type frame is decoded in decoding order.
  • the method further comprises: after decoding at least a part of the image frames other than the first type frame, based on a part of the image blocks in the image frame, the part of the image blocks in the long-term reference frame Update; or, after decoding a specific image block in at least a part of the image frame other than the first type frame, update a part of the image block in the long-term reference frame based on the specific image block.
  • the specific implementation of the decoding method 1100 may correspond to the specific implementation of the encoding method 800, and details are not described herein again.
  • the following uses specific video sequence coding to describe the decoding method 1100 in the embodiment of the present application without using a random access function.
  • the decoding sequence is I0, P8, B4, B2, B1, B6, B5, B7, I16, B12, B10, B9, B11, B14, B13, B15, P24, B20, B18, B17, B19, B19, B21, B23 ...
  • I0 and I16 are and are random access points. Assuming I16 is the first type frame, then B12, B10, B9, B14, B13, B13, B15 are the second type frame, P8, B4, B2, B1, B3, B6, B5, B7, etc. can be regarded as the third type frame, P24, B20, B18, B17, B19, B19, B21, B21, B23 ... Fourth type frame.
  • the reconstructed image structure of I0 is placed in the reference image buffer. Since there is no frame after I0 in the display order before I0, there is no frame in the reference image buffer before the display order. Use the reference
  • the reconstructed image of I0 in the image buffer constructs a long-term reference image, and continues to decode P8, B2, B1, B3, B6, B5, and B7 after the display order of I0, and updates the long-term reference image constructed by the reference image buffer and the reconstructed image of I0.
  • the reconstructed image of I16 After completing the decoding of I16, put the reconstructed image of I16 into the reference image buffer, and continue to decode B12, B9, B11, B14, B14, B13 and B15 before the display order of I16.
  • These long-term reference pictures referenced by the second type frame are long-term reference pictures referenced by the third type frame, and after each decoding of the second type frame is completed, the long-term reference image may be updated according to the decoded second type frame. .
  • the subsequent frames before I16 are not displayed.
  • the reconstructed image of I16 in the reference image buffer is output as a new long-term reference image, that is, the long-term reference image constructed by the reconstructed image of I16 is replaced.
  • the current long-term reference image Clear all short-term reference images in the reference image buffer before the display order I16. Then continue to decode P24, B20, B18, B19, B22, B21, B23 ..., and update the long-term reference image replaced by the reference image buffer and the reconstructed image of I16.
  • the decoding sequence is I0, P8, B4, B2, B1, B6, B5, B7, I16, B12, B10, B9, B11, B14, B13, B15, P24, B20, B18, B17, B19, B19, B21, B23 ...
  • I0 and I16 are and are random access points. Assuming I16 is the first type frame, then B12, B10, B9, B11B14, B13, B15 are the second type frame, P8, B4, B2, B3, B6, B5, B7, etc. can all be regarded as the third type frame, P24, B20, B18, B17, B19, B19, B22, B21, B23 ... Four types of frames.
  • the reconstructed image of I0 is placed in the reference image buffer. Since there is no frame after I0 in the display order before I0, there is no frame in the reference image buffer before the display order. Use the reference image
  • the reconstructed image of I0 in the buffer constructs a long-term reference image, and continues to decode P8, B2, B1, B3, B6, B5, B7, and B7 after the display order of I0, and updates the long-term reference image constructed by the reference image buffer and the reconstructed image of I0.
  • the reconstructed image of I16 is placed in the reference image buffer, and a part of the second type frames B12, B10, B9, and B11 displayed before I16 are continued to be decoded.
  • These long-term reference images referenced by the second type frame are long-term reference images constructed by the reconstructed image of I0, and after each decoding of the second type frame is completed, the reconstructed image structure of I0 may be updated according to the decoded second-type frame. Long-term reference image.
  • the reconstructed image of I16 in the reference image buffer is output as a new long-term reference image, that is, the long-term reference image of the reconstructed image of I0 is replaced with the long-term reference image of the reconstructed image of I16.
  • Another part of the second type frame B14, B13, and B15 can be decoded by referring to the reconstructed image of I16 (the long-term reference image constructed by the reconstructed image of I16). And after each decoding of the second type frame is completed, the long-term reference image constructed by the reconstructed image of I16 may be updated according to the decoded second type frame.
  • FIG. 12 is a schematic flowchart of a decoding method 1200 at a random access point according to an embodiment of the present application. As shown in FIG. 12, 1200 may include the following steps.
  • S1220 Inter-decode the fourth-type frame using a long-term reference image formed from the reconstructed image of the first-type frame, and when each fourth-type frame completes decoding, use the Four types of frames update the long-term reference image, and use the updated long-term reference image as the long-term reference image of the next frame.
  • S1220 performing inter-frame decoding on the fourth type of frame using the long-term reference image formed by the reconstructed image of the first type of frame may include: within the frame of completing the first type of frame After decoding, the reconstructed image of the first type frame is put into a reference image buffer; the reconstructed image of the first type frame is output from the reference image buffer, and the reconstruction of the first type frame is used The image is used as a currently used long-term reference image, and the fourth type frame is inter-frame decoded.
  • placing the reconstructed image of the first type frame in a reference image buffer may include: when the reconstructed image of the first type frame does not exist in the reference image buffer, Placing the reconstructed image of the first type of frame into the reference image buffer.
  • the following uses specific video sequence coding to describe the decoding method 1200 using the random access function in the embodiment of the present application.
  • the decoding sequence is I0, P8, B4, B2, B1, B6, B5, B7, I16, B12, B10, B9, B11, B14, B13, B15, P24, B20, B18, B17, B19, B19, B21, B23 ...
  • I0 and I16 are and are random access points. Assuming I16 is the first type of frame, that is, using the random access function and decoding from I16, then B12, B10, B9, B11, B14, B13, and B15 are the second type of frame, P8, B4, B2, B1, B3, B6, B5, B7, etc. can be regarded as the third type of frame. , P24, B20, B18, B17, B19, B22, B21, B23 ... are frames of the fourth type.
  • the reconstructed image of I16 is placed in the reference image buffer, and all short-term reference images in the display order of the reference image buffer before I16 are cleared.
  • decoding B12, B10, B11, B11, B13, B15, B15, and B15 before the display order of I16 directly decode P24, B20, B18, B17, B19, B21, B21, B23 ..., and update the reference image buffer and the long-term reference image constructed by the reconstructed image of I16.
  • FIG. 13 is a schematic block diagram of an encoding device 1300 according to an embodiment of the present application.
  • the encoding device 1300 includes a first encoding module 1310, a second encoding module 1320, and a replacement module 1330.
  • the first encoding module 1310 is configured to encode a first type frame. In the encoding order, there are N second type frames that need to be inter-frame encoded after the first type frame.
  • the display order is before the first type frame, where N is a positive integer.
  • the second encoding module 1320 is configured to perform inter-frame encoding on at least one second type frame of the N second type frames according to the long-term reference image.
  • the replacement module 1330 is configured to replace a currently used long-term reference image after completing inter-frame encoding of at least one second type frame among the N second type frames.
  • the encoding device in the embodiment of the present application replaces only after completing inter-frame encoding of at least one second type frame among N second type frames in which the encoding order is after the first type frame and the display order is before the first type frame.
  • the currently used long-term reference picture enables at least one second-type frame to reference the long-term reference picture before the first-type frame, which can improve coding efficiency.
  • the replacement module 1330 is specifically configured to: after completing the inter-coding of all the second type frames of the N second type frames, replace the currently used long-term reference image.
  • the replacement module 1330 is specifically configured to: replace the currently used long-term reference image with the reconstructed image of the first type frame.
  • the replacement module 1330 is specifically configured to: after the encoding of the first type frame is completed, place the reconstructed image of the first type frame into a reference image buffer; After the inter-frame encoding of at least one second type frame among the N second type frames, the reconstructed image of the first type frame is output from the reference image buffer, and the reconstruction of the first type frame is performed. The image replaces the currently used long-term reference image.
  • the replacing module 1330 placing the reconstructed image of the first type frame in a reference image buffer includes: when the first type frame does not exist in the reference image buffer, When the image is reconstructed, the reconstructed image of the first type frame is placed in the reference image buffer.
  • the second encoding module 1320 is specifically configured to: The updated long-term reference image performs inter-frame coding on at least one second type frame among the N second type frames.
  • the third type frame is displayed before the first type frame.
  • the updated long-term reference image is updated based on a specific image block of the third-type frame after inter-coding of the third-type frame; or, the updated long-term reference image is updated.
  • the reference image is updated based on the specific image block after inter-frame encoding of the specific image block of the third type frame.
  • the encoding device 1300 also A third encoding device may be included to perform inter-frame encoding on the fourth type frame according to the replaced long-term reference image.
  • the first type frame is a random access point.
  • the first type of frame is a clear random access point.
  • the second encoding module 1320 is specifically configured to:
  • the long-term reference image is updated using the encoded specific image blocks, and the updated long-term reference image is used as the next first The long-term reference image of the second-type frame or the long-term reference image of the current second-type frame.
  • the long-term reference image remains unchanged after the first type frame is encoded and before the next frame of the first type frame is encoded in the encoding order.
  • the encoding device 1300 is further configured to, after encoding at least a part of the image frames other than the first type frame, perform a part of the long-term reference frame based on a part of the image blocks in the image frame. Update image blocks; or, after encoding specific image blocks in at least part of the image frames other than the first type frame, update some image blocks in the long-term reference frame based on the specific image blocks.
  • the long-term reference image remains unchanged until the next frame is encoded.
  • FIG. 14 is a schematic block diagram of an encoding device 1400 according to another embodiment of the present application.
  • the encoding device 1400 shown in FIG. 14 may include at least one processor 1410 and at least one memory 1420 for storing computer-executable instructions; at least one processor 1410, alone or collectively, for: accessing the at least one memory 1420 And execute the computer-executable instructions to perform the following operations: encode a first type frame, where there are N second type frames that require inter-frame encoding after the first type frame in the encoding order, so The display order of the N second type frames is before the first type frame, where N is a positive integer; at least one second type frame among the N second type frames is interframed according to the long-term reference image. Encoding; after completing inter-frame encoding of at least one second type frame among the N second type frames, replacing a currently used long-term reference image.
  • the processor 1410 is specifically configured to: after completing inter-frame encoding of all the second type frames of the N second type frames, replace the currently used long-term reference image.
  • the processor 1410 is specifically configured to: replace the currently used long-term reference image with the reconstructed image of the first type frame.
  • the processor 1410 is specifically configured to: after the encoding of the first type frame is completed, place the reconstructed image of the first type frame into a reference image buffer; After the inter-frame encoding of at least one second type frame among the N second type frames, the reconstructed image of the first type frame is output from the reference image buffer, and the reconstruction of the first type frame is performed. The image replaces the currently used long-term reference image.
  • the processor 1410 is specifically configured to: when the reconstructed image of the first type frame does not exist in the reference image buffer, place the reconstructed image of the first type frame into the reference image buffer. Reference image buffer.
  • the processor 1410 is specifically configured to:
  • the updated long-term reference image performs inter-frame coding on at least one second type frame among the N second type frames.
  • the third type frame is displayed before the first type frame.
  • the updated long-term reference image is updated based on a specific image block of the third-type frame after inter-coding of the third-type frame; or, the updated long-term reference image is updated.
  • the reference image is updated based on the specific image block after inter-frame encoding of the specific image block of the third type frame.
  • the first type frame is a random access point.
  • the first type of frame is a clear random access point.
  • the processor 1410 is specifically configured to perform inter-frame coding on at least one second type frame of the N second type frames according to a long-term reference image, and complete coding on at least a part of the second type frames.
  • a long-term reference image is updated using a specific image block in the at least part of the second type frame that has been encoded, and the updated long-term reference image is used as a long-term reference image for the next second-type frame; or according to the long-term reference
  • the image performs inter-frame coding on at least one second type frame of the N second type frames, and when at least a part of the specific image block of the second type frame is encoded, the long-term reference is updated by using the specific image block of the completed encoding An image, using the updated long-term reference image as a long-term reference image of a next second type frame or as a long-term reference image of the current second type frame.
  • the long-term reference image remains unchanged after the first type frame is encoded and before the next frame of the first type frame is encoded in the encoding order.
  • the processor 1410 is further configured to, after encoding at least a part of the image frames other than the first type frame, based on a part of the image blocks in the image frame, part of the image blocks in the long-term reference frame Updating; or, after encoding a specific image block in at least a part of the image frame other than the first type frame, updating a part of the image block in the long-term reference frame based on the specific image block.
  • the long-term reference image remains unchanged until the next frame is encoded.
  • FIG. 15 is a schematic block diagram of a decoding device 1500 according to an embodiment of the present application.
  • the decoding device 1500 includes a first decoding module 1510, a second decoding module 1520, and a replacement module 1530.
  • the first decoding module 1510 is configured to decode a first type frame. In the decoding order, there are N second type frames that need to be inter-frame decoded after the first type frame. The display order is before the first type frame, where N is a positive integer.
  • the second decoding module 1520 is configured to perform inter-frame decoding on at least one second type frame of the N second type frames according to the long-term reference image.
  • the replacement module 1530 is configured to replace a currently used long-term reference image after completing inter-frame decoding of at least one second type frame among the N second type frames.
  • the decoding device in this embodiment of the present application replaces only after completing inter-frame decoding of at least one second-type frame among N second-type frames in which the decoding order is after the first-type frame and the display order is before the first-type frame.
  • the currently used long-term reference picture enables at least one second-type frame to reference the long-term reference picture before the first-type frame, which can improve decoding efficiency.
  • the replacement module 1530 is specifically configured to: after completing the inter-frame decoding of all the second type frames of the N second type frames, replace the currently used long-term reference image.
  • the replacement module 1530 is specifically configured to: replace the currently used long-term reference image with the reconstructed image of the first type frame.
  • the replacement module 1530 is specifically configured to: after the decoding of the first type frame is completed, place the reconstructed image of the first type frame into a reference image buffer; After the inter-frame decoding of at least one second type frame among the N second type frames, output the reconstructed image of the first type frame from the reference image buffer, and reconstruct the first type frame The image replaces the currently used long-term reference image.
  • the replacing module 1530 placing the reconstructed image of the first type frame in a reference image buffer includes: when the first type frame does not exist in the reference image buffer, When the image is reconstructed, the reconstructed image of the first type frame is placed in the reference image buffer.
  • the second decoding module 1520 is specifically configured to:
  • the updated long-term reference image performs inter-frame decoding on at least one second type frame among the N second type frames.
  • the third type frame is displayed before the first type frame.
  • the updated long-term reference image is updated based on a specific image block of the third-type frame after inter-frame decoding of the third-type frame; or, the updated long-term reference image is updated.
  • the reference image is updated based on the specific image block after inter-frame decoding of the specific image block of the third type frame.
  • the decoding device 1500 also A third decoding device may be included to perform inter-frame decoding on the fourth type frame according to the replaced long-term reference image.
  • the first type frame is a random access point.
  • the first type of frame is a clear random access point.
  • the second decoding module 1520 is specifically configured to:
  • the decoded specific image blocks are used to update the long-term reference image, and the updated long-term reference image is used as the next first The long-term reference image of the second-type frame or the long-term reference image of the current second-type frame.
  • the long-term reference image remains unchanged after the first type frame is decoded and before the next frame of the first type frame is decoded in decoding order.
  • the decoding device 1500 is further configured to, after decoding at least a part of the image frame other than the first type frame, perform a part of the long-term reference frame based on a part of the image block in the image frame. Update the image block; or, after decoding a specific image block in at least a part of the image frame other than the first type frame, update a part of the image block in the long-term reference frame based on the specific image block.
  • the long-term reference image remains unchanged until the next frame is decoded.
  • FIG. 16 is a schematic block diagram of a decoding device 1600 according to another embodiment of the present application.
  • the decoding device 1600 shown in FIG. 16 may include at least one processor 1610 and at least one memory 1620 for storing computer-executable instructions; at least one processor 1610, alone or collectively, for: accessing the at least one memory 1620 And execute the computer-executable instructions to perform the following operations: decoding a first type frame, where there are N second type frames that require inter-frame decoding after the first type frame in the decoding order, so The display order of the N second type frames is before the first type frame, where N is a positive integer; at least one second type frame among the N second type frames is interframed according to the long-term reference image. Decoding; after completing inter-frame decoding of at least one second type frame among the N second type frames, replacing a currently used long-term reference image.
  • the processor 1610 is specifically configured to: after completing inter-frame decoding of all the second type frames of the N second type frames, replace the currently used long-term reference image.
  • the processor 1610 is specifically configured to: replace the currently used long-term reference image with the reconstructed image of the first type frame.
  • the processor 1610 is specifically configured to: after completing decoding the first type frame, place the reconstructed image of the first type frame into a reference image buffer; After the inter-frame decoding of at least one second type frame among the N second type frames, output the reconstructed image of the first type frame from the reference image buffer, and reconstruct the first type frame The image replaces the currently used long-term reference image.
  • the processor 1610 is specifically configured to: when the reconstructed image of the first type frame does not exist in the reference image buffer, place the reconstructed image of the first type frame into the reference image buffer. Reference image buffer.
  • the processor 1610 is specifically configured to:
  • the updated long-term reference image performs inter-frame decoding on at least one second type frame among the N second type frames.
  • the third type frame is displayed before the first type frame.
  • the updated long-term reference image is updated based on a specific image block of the third-type frame after inter-frame decoding of the third-type frame; or, the updated long-term reference image is updated.
  • the reference image is updated based on the specific image block after inter-frame decoding of the specific image block of the third type frame.
  • the first type frame is a random access point.
  • the first type of frame is a clear random access point.
  • the processor 1610 is specifically configured to perform inter-frame decoding on at least one second type frame of the N second type frames according to a long-term reference image, and complete decoding on at least a part of the second type frames.
  • the long-term reference image is updated by using the specific image block in the at least part of the second-type frame that has been decoded, and the updated long-term reference image is used as the long-term reference image of the next second-type frame; or according to the long-term reference
  • the image performs inter-frame decoding on at least one second type frame of the N second type frames, and when at least part of the specific image block of the second type frame completes decoding, the long-term reference is updated by using the specific image block that has been decoded.
  • An image, using the updated long-term reference image as a long-term reference image of a next second type frame or as a long-term reference image of the current second type frame.
  • the long-term reference image remains unchanged after the first type frame is decoded and before the next frame of the first type frame is decoded in decoding order.
  • the processor 1610 is further configured to, after decoding at least a part of the image frames other than the first type frame, based on a part of the image blocks in the image frame, for a part of the image blocks in the long-term reference frame Update; or, after decoding a specific image block in at least a part of the image frame other than the first type frame, update a part of the image block in the long-term reference frame based on the specific image block.
  • the long-term reference image remains unchanged until the next frame is decoded.
  • the devices of the embodiments of the present application may be implemented based on a memory and a processor.
  • Each memory is used to store instructions for executing the method of the embodiments of the application.
  • the processor executes the foregoing instructions, so that the device executes the embodiments of the application. Methods.
  • processors mentioned in the embodiments of the present application may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), and application-specific integrated circuits (DSPs).
  • DSPs digital signal processors
  • DSPs application-specific integrated circuits
  • ASIC application specific integrated circuit
  • FPGA field programmable gate array
  • a general-purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
  • the memory mentioned in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memory.
  • the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), or Erase programmable read-only memory (EPROM, EEPROM) or flash memory.
  • the volatile memory may be random access memory (RAM), which is used as an external cache.
  • RAM random access memory
  • DRAM dynamic random access memory
  • SDRAM synchronous dynamic random access memory
  • double SDRAM double SDRAM
  • DDR SDRAM double data rate synchronous dynamic random access memory
  • enhanced SDRAM enhanced SDRAM
  • SLDRAM synchronous connection dynamic random access memory
  • direct RAMbus RAM direct RAMbus RAM
  • the processor is a general-purpose processor, a DSP, an ASIC, an FPGA, or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component
  • the memory memory module
  • An embodiment of the present application further provides a computer-readable storage medium having instructions stored thereon.
  • the computer is caused to execute the methods of the foregoing method embodiments.
  • An embodiment of the present application further provides a computer program, which causes a computer to execute the methods of the foregoing method embodiments.
  • An embodiment of the present application further provides a computing device, where the computing device includes the computer-readable storage medium described above.
  • the embodiments of the present application can be applied in the field of aircraft, especially in the field of drones.
  • circuits, sub-circuits, and sub-units in the embodiments of the present application is merely schematic. Those of ordinary skill in the art may realize that the circuits, sub-circuits, and sub-units of the examples described in the embodiments disclosed herein can be split or combined again.
  • a computer program product includes one or more computer instructions.
  • the computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable device.
  • the computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a web site, computer, server, or data center via a wired (e.g., Coaxial cable, optical fiber, digital subscriber line (DSL), or wireless (such as infrared, wireless, microwave, etc.) transmission to another website site, computer, server, or data center.
  • a computer-readable storage medium may be any available media that can be accessed by a computer or a data storage device such as a server, data center, or the like, which contains one or more available media integrations.
  • Usable media may be magnetic media (for example, floppy disks, hard disks, magnetic tapes), optical media (for example, high-density digital video discs (DVDs)), or semiconductor media (for example, solid state disks (SSDs) )Wait.
  • magnetic media for example, floppy disks, hard disks, magnetic tapes
  • optical media for example, high-density digital video discs (DVDs)
  • semiconductor media for example, solid state disks (SSDs)
  • an embodiment or “an embodiment” mentioned throughout the specification means that a particular feature, structure, or characteristic related to the embodiment is included in at least one embodiment of the present application.
  • the appearances of "in one embodiment” or “in an embodiment” appearing throughout the specification are not necessarily referring to the same embodiment.
  • the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
  • the size of the sequence numbers of the above processes does not mean the order of execution.
  • the execution order of each process should be determined by its function and internal logic, and should not deal with the embodiments of the present application.
  • the implementation process constitutes any limitation.
  • B corresponding to A means that B is associated with A, and B can be determined according to A.
  • determining B based on A does not mean determining B based solely on A, but also determining B based on A and / or other information.
  • the disclosed systems, devices, and methods may be implemented in other ways.
  • the device embodiments described above are only schematic.
  • the division of the unit is only a logical function division.
  • multiple units or components may be combined or Can be integrated into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, which may be electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objective of the solution of this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each of the units may exist separately physically, or two or more units may be integrated into one unit.

Abstract

Coding and decoding methods, and coding and decoding devices. The coding method comprises: coding frames of a first type, wherein there are N frames of a second type needing interframe coding after the frames of the first type according to coding order, and the display order of the N frames of the second type is before that of the frames of the first type; performing interframe coding on at least one of the N frames of the second type according to a long-term reference image; and replacing the currently used long-term reference image after the interframe coding of the at least one of the N frames of the second type is completed. The coding method enables the at least one frame of the second type to refer to the long-term reference image before the frames of the first type, and can improve the coding efficiency.

Description

编码、解码方法及编码、解码设备Encoding and decoding method and encoding and decoding equipment
版权申明Copyright statement
本专利文件披露的内容包含受版权保护的材料。该版权为版权所有人所有。版权所有人不反对任何人复制专利与商标局的官方记录和档案中所存在的该专利文件或者该专利披露。The content disclosed in this patent document contains material which is subject to copyright protection. The copyright is owned by the copyright owner. The copyright owner has no objection to the facsimile reproduction by anyone of the patent document or the patent disclosure as it appears in the official records and archives of the Patent and Trademark Office.
技术领域Technical field
本申请涉及图像处理领域,尤其涉及一种编码、解码方法及编码、解码设备。The present application relates to the field of image processing, and in particular, to an encoding and decoding method and an encoding and decoding device.
背景技术Background technique
在图像编解码的帧间预测的过程中,选取的参考图像与当前待编码图像越相似,则帧间预测产生的残差越小,从而可以提升帧间预测的编码效率。现有的一些技术可以利用视频中的各图像构建一个包含场景的背景内容的高质量的特定参考图像,称为长期参考图像。即,该特定参考图像可以在相对长的一段时间内,作为帧间预测的参考图像。在进行帧间预测时,当前待编码/解码图像的背景部分可通过参考所述的长期参考图像用于减少帧间预测的残差信息,从而提高编码效率。长期参考图像不是一个已编码/已解码图像,而是一个人为构造的图像。长期参考图像中包括多个图像块,任意一个图像块均是从某个已编码/已解码图像中取出的,长期参考图像中的不同图像块可能取自于不同的已编码/已解码图像。在完成某一帧的编码/解码后,长期参考图像可以基于已编码/已解码图像进行更新。In the process of inter-prediction of image coding and decoding, the more similar the selected reference image and the current image to be coded, the smaller the residuals generated by inter-prediction, thereby improving the coding efficiency of inter-prediction. Some existing technologies can use each image in the video to construct a high-quality specific reference image containing the background content of the scene, called a long-term reference image. That is, the specific reference image can be used as a reference image for inter prediction for a relatively long period of time. When performing inter prediction, the background portion of the current image to be encoded / decoded can be used to reduce residual information of inter prediction by referring to the long-term reference image, thereby improving encoding efficiency. The long-term reference picture is not an encoded / decoded picture, but an artificially constructed picture. The long-term reference image includes multiple image blocks, and any one image block is taken from a certain encoded / decoded image. Different image blocks in the long-term reference image may be taken from different encoded / decoded images. After the encoding / decoding of a certain frame is completed, the long-term reference image can be updated based on the encoded / decoded image.
在图像编解码的实际应用中,经常会出现用户不是从视频流的起始点、而是从视频流的中间点开始观看的情况,其中,视频流可以包括,例如电视节目、网络直播、本地电影等。为了支持能够从不同时刻开始加载视频,在编码/解码过程中,通常可以在视频流中插入随机访问点(random access point,RAP)。随机访问点的特性使得,在解码端能够保证显示顺序在随机访问点之后的帧能够正常解码。In the practical application of image codecs, it often happens that the user starts watching not from the starting point of the video stream, but from the intermediate point of the video stream. The video stream may include, for example, TV programs, webcasts, local movies Wait. In order to support the ability to load videos from different moments, during the encoding / decoding process, a random access point (RAP) can usually be inserted into the video stream. The characteristics of the random access point make it possible for the decoder to ensure that frames with a display order after the random access point can be decoded normally.
如果更新长期参考图像时不考虑随机访问点问题,而是基于已编码/已解 码图像进行更新,则有可能导致显示顺序在随机访问点之后的帧不能正常解码。如果更新长期参考图像时采用现有的针对随机访问点的编码/解码技术,则有可能导致编码/解码效率低下。If the random access point is not considered when updating the long-term reference image, but the update is based on the encoded / decoded image, it may cause that the frames in the display order after the random access point cannot be decoded normally. If the existing encoding / decoding technology for random access points is used when updating the long-term reference image, the encoding / decoding efficiency may be low.
发明内容Summary of the Invention
本申请提供了一种编码、解码方法及编码、解码设备,可以提高编码/解码效率。The application provides an encoding and decoding method and an encoding and decoding device, which can improve encoding / decoding efficiency.
第一方面,提供一种编码方法,包括:对第一类型帧进行编码,其中,按编码顺序所述第一类型帧之后存在需要进行帧间编码的N个第二类型帧,所述N个第二类型帧的显示顺序在所述第一类型帧之前,其中,N为正整数;根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间编码;在完成所述N个第二类型帧中的至少一个第二类型帧的帧间编码后,替换当前使用的长期参考图像。According to a first aspect, an encoding method is provided, including: encoding a first type frame, wherein in the encoding order, there are N second type frames that need to be inter-frame encoded after the first type frame, the N number The display order of the second type frame is before the first type frame, where N is a positive integer; at least one second type frame of the N second type frames is inter-frame coded according to the long-term reference image; After the inter-frame encoding of at least one second type frame among the N second type frames is completed, the currently used long-term reference image is replaced.
第二方面,提供一种解码方法,包括:对第一类型帧进行解码,其中,按解码顺序所述第一类型帧之后存在需要进行帧间解码的N个第二类型帧,所述N个第二类型帧的显示顺序在所述第一类型帧之前,其中,N为正整数;根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间解码;在完成所述N个第二类型帧中的至少一个第二类型帧的帧间解码后,替换当前使用的长期参考图像。According to a second aspect, a decoding method is provided, including: decoding a first type frame, wherein, in the decoding order, there are N second type frames that need to be inter-frame decoded after the first type frame, and the N The display order of the second type frame is before the first type frame, where N is a positive integer; at least one second type frame of the N second type frames is inter-frame decoded according to the long-term reference image; After the inter-frame decoding of at least one second type frame among the N second type frames is completed, the currently used long-term reference image is replaced.
第三方面,提供一种编码设备,包括:至少一个存储器,用于存储计算机可执行指令;至少一个处理器,单独或共同地用于:访问所述至少一个存储器,并执行所述计算机可执行指令,以实施以下操作:对第一类型帧进行编码,其中,按编码顺序所述第一类型帧之后存在需要进行帧间编码的N个第二类型帧,所述N个第二类型帧的显示顺序在所述第一类型帧之前,其中,N为正整数;根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间编码;在完成所述N个第二类型帧中的至少一个第二类型帧的帧间编码后,替换当前使用的长期参考图像。According to a third aspect, an encoding device is provided, including: at least one memory for storing computer-executable instructions; at least one processor, alone or collectively, for: accessing the at least one memory and executing the computer-executable Instructions to implement the following operations: encoding a first type frame, where there are N second type frames that need to be inter-frame encoded after the first type frame in the encoding order, and the N second type frames have The display order is before the first type frame, where N is a positive integer; at least one second type frame of the N second type frames is inter-frame encoded according to the long-term reference image; After inter-coding of at least one second-type frame in the second-type frame, the currently used long-term reference image is replaced.
第四方面,提供一种解码设备,包括:至少一个存储器,用于存储计算机可执行指令;至少一个处理器,单独或共同地用于:访问所述至少一个存储器,并执行所述计算机可执行指令,以实施以下操作:对第一类型帧进行解码,其中,按解码顺序所述第一类型帧之后存在需要进行帧间解码的N个 第二类型帧,所述N个第二类型帧的显示顺序在所述第一类型帧之前,其中,N为正整数;根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间解码;在完成所述N个第二类型帧中的至少一个第二类型帧的帧间解码后,替换当前使用的长期参考图像。According to a fourth aspect, a decoding device is provided, including: at least one memory for storing computer-executable instructions; at least one processor, alone or collectively, for: accessing the at least one memory and executing the computer-executable Instructions to implement the following operations: decoding a first type frame, wherein, in the decoding order, there are N second type frames that need to be inter-frame decoded after the first type frame, and the N second type frames are The display order is before the first type frame, where N is a positive integer; at least one second type frame of the N second type frames is inter-frame decoded according to the long-term reference image; After the inter-frame decoding of at least one of the second type frames, the long-term reference image currently used is replaced.
第五方面,提供一种计算机可读存储介质,其上存储有指令,当指令在计算机上运行时,使得计算机执行第一方面的编码方法。According to a fifth aspect, a computer-readable storage medium is provided, on which instructions are stored, and when the instructions are run on the computer, the computer is caused to execute the encoding method of the first aspect.
第六方面,提供一种计算机可读存储介质,其上存储有指令,当指令在计算机上运行时,使得计算机执行第一方面的解码方法。According to a sixth aspect, a computer-readable storage medium is provided, on which instructions are stored, and when the instructions are run on the computer, the computer is caused to execute the decoding method of the first aspect.
本申请在完成编码/解码顺序在第一类型帧之后、显示顺序在第一类型帧之前的N个第二类型帧中的至少一个第二类型帧的帧间编码/解码后,才替换当前使用的长期参考图像,使得至少一个第二类型帧可以参考第一类型帧之前的长期参考图像,可以提高编码/解码效率。This application only replaces the current use after completing the inter-frame encoding / decoding of at least one second type frame among the N second type frames in which the encoding / decoding order is after the first type frame and the display order is before the first type frame. Long-term reference image, so that at least one second type frame can refer to the long-term reference image before the first type frame, which can improve encoding / decoding efficiency.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1是本申请中乱序编码的一个实施例的示意图。FIG. 1 is a schematic diagram of an embodiment of out-of-order encoding in the present application.
图2是本申请的视频编码方法的一个实施例的流程示意图。FIG. 2 is a schematic flowchart of an embodiment of a video encoding method according to the present application.
图3是将当前待编码图像中的图像块与长期参考图像中的图像块的关系的示意图。FIG. 3 is a schematic diagram of a relationship between an image block in a current to-be-encoded image and an image block in a long-term reference image.
图4是视频中的多个图像和长期参考图像的关系示意图。FIG. 4 is a schematic diagram showing a relationship between multiple images and a long-term reference image in a video.
图5是本申请的视频编码的方法的又一个实施例的流程示意图。FIG. 5 is a schematic flowchart of another embodiment of a video encoding method according to the present application.
图6是根据本申请另一实施例的视频解码方法的示意图。FIG. 6 is a schematic diagram of a video decoding method according to another embodiment of the present application.
图7是本申请的视频解码的方法的又一个实施例的流程示意图。FIG. 7 is a schematic flowchart of another embodiment of a video decoding method according to the present application.
图8是本申请的一个实施例的编码方法的示意性流程图。FIG. 8 is a schematic flowchart of an encoding method according to an embodiment of the present application.
图9是本申请一个实施例的编码方法的示意性流程图。FIG. 9 is a schematic flowchart of an encoding method according to an embodiment of the present application.
图10是本申请一个实施例的解码方法的示意性流程图。FIG. 10 is a schematic flowchart of a decoding method according to an embodiment of the present application.
图11是本申请另一个实施例的解码方法的示意性流程图。FIG. 11 is a schematic flowchart of a decoding method according to another embodiment of the present application.
图12是本申请另一个实施例的解码方法的示意性流程图。FIG. 12 is a schematic flowchart of a decoding method according to another embodiment of the present application.
图13是本申请一个实施例的编码设备的示意性框图。FIG. 13 is a schematic block diagram of an encoding device according to an embodiment of the present application.
图14是本申请另一个实施例的编码设备的示意性框图。FIG. 14 is a schematic block diagram of an encoding device according to another embodiment of the present application.
图15是本申请一个实施例的解码设备的示意性框图。FIG. 15 is a schematic block diagram of a decoding device according to an embodiment of the present application.
图16是本申请另一个实施例的解码设备的示意性框图。FIG. 16 is a schematic block diagram of a decoding device according to another embodiment of the present application.
具体实施方式Detailed ways
下面将结合附图,对本申请实施例中的技术方案进行描述。The technical solutions in the embodiments of the present application will be described below with reference to the drawings.
除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同。本文中在本申请的说明书中所使用的术语只是为了描述具体的实施例的目的,不是旨在于限制本申请。Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terms used herein in the specification of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the present application.
首先介绍本申请实施例涉及的相关技术及概念。First, related technologies and concepts involved in the embodiments of the present application are introduced.
视频是由多个图像构成的。对视频进行编码/解码时,视频中不同的图像可采用不同的预测方式。根据图像所采用的预测方式,可以将图像区分为帧内预测图像和帧间预测图像,其中帧间预测图像包括前向预测图像和双向预测图像。I图像是帧内预测图像,也称为关键帧;P图像是前向预测图像,也即采用之前已编码/解码的一个P图像或者I图像作为参考图像;B图像是双向预测图像,也即采用前后的图像作为参考图像。一种实现方式是编码/解码端将多张图像进行编码/解码后产生一段一段的图像组(group of picture,GOP),该GOP是由一张I图像,以及多张B图像(或双向预测图像)和/或P图像(或前向预测图像)构成的图像组。解码端在播放时则是读取一段一段的GOP进行解码后读取画面再渲染显示。A video is made up of multiple images. When encoding / decoding a video, different images in the video can use different prediction methods. According to the prediction method adopted for the image, the image can be divided into an intra-prediction image and an inter-prediction image, where the inter-prediction image includes a forward-prediction image and a bi-prediction image. I picture is an intra prediction picture, also called a key frame; P picture is a forward prediction picture, that is, a P picture or I picture that has been previously encoded / decoded is used as a reference picture; B picture is a bidirectional prediction picture, that is, The front and back images are used as reference images. An implementation method is to encode / decode the multiple pictures to generate a group of pictures (GOP) after encoding / decoding. The GOP consists of an I picture and multiple B pictures (or bidirectional prediction). Picture) and / or P picture (or forward prediction picture). When the decoder is playing, it reads the GOP one by one, decodes it, reads the picture, and then renders it.
在现代视频编码/解码标准中,可以通过将图像分成多个小块来对不同分辨率的图像进行编码/解码,即图像可以被分成多个图像块。图像可以被分成任何数量的图像块。例如,该图像可以被分成一个m×n图像块阵列。图像块可以具有矩形形状、正方形形状、圆形形状或任何其他形状。图像块可以具有任何尺寸,例如p×q像素。每个图像块都可以具有相同尺寸和/或形状。可替代地,两个或更多图像块可以具有不同的尺寸和/或形状。图像块可以具有或者可以不具有任何重叠部分。在一些实施例中,该图像块在一些编码/解码标准中被称为宏块或最大编码单元(largest coding unit,LCU)。对于H.264标准,图像块被称为宏块,其大小可以是16×16像素。对于高效率视频编码(high efficiency video coding,HEVC)标准,图像块被称为最大编码单元,其大小可以是64×64像素。In modern video encoding / decoding standards, images of different resolutions can be encoded / decoded by dividing the image into multiple small blocks, that is, the image can be divided into multiple image blocks. The image can be divided into any number of image blocks. For example, the image can be divided into an array of m × n image blocks. The image block may have a rectangular shape, a square shape, a circular shape, or any other shape. An image block can have any size, such as p × q pixels. Each image block can have the same size and / or shape. Alternatively, two or more image blocks may have different sizes and / or shapes. An image block may or may not have any overlapping portions. In some embodiments, the image block is referred to as a macroblock or a maximum coding unit (LCU) in some encoding / decoding standards. For the H.264 standard, an image block is called a macroblock, and its size can be 16 × 16 pixels. For the high efficiency video coding (HEVC) standard, an image block is called a maximum coding unit, and its size can be 64 × 64 pixels.
在另一些实施例中,一个图像块也可以不是一个宏块或最大编码单元,而是包含一个宏块或最大编码单元的部分,或者包含至少两个完整的宏块(或最大编码单元),或者包含至少一个完整的宏块(或最大编码单元)和 一个宏块(或最大编码单元)的部分,或者包含至少两个完整的宏块(或最大编码单元)和一些宏块(或最大编码单元)的部分。如此,在图像被分成多个图像块之后,可以分别对图像数据中的这些图像块进行编码/解码。In other embodiments, an image block may not be a macro block or a maximum coding unit, but a portion containing a macro block or a maximum coding unit, or at least two complete macro blocks (or maximum coding units). Contains at least one complete macro block (or maximum coding unit) and a portion of one macro block (or maximum coding unit), or contains at least two complete macro blocks (or maximum coding unit) and some macro blocks (or maximum coding) Unit). In this way, after the image is divided into a plurality of image blocks, these image blocks in the image data can be encoded / decoded separately.
编码过程包括预测、变换、量化和熵编码等处理。其中,预测包括帧内预测和帧间预测两种类型,其目的在于利用预测块数据去除当前待编码图像块的冗余信息。帧内预测利用本帧图像的信息获得预测块数据。帧间预测利用参考图像的信息获得预测块数据,其过程包括将当前待编码图像划分成若干个待编码图像块,再将待编码图像块划分成若干个子图像块;然后,针对每个子图像块,在参考图像中搜索与当前子图像块最匹配的图像块作为预测图像块,预测图像块与当前子图像块的相对位移即为运动矢量;其后,将该子图像块与预测图像块的相应像素值相减得到残差。将得到的各子图像块对应的残差组合在一起,得到待编码图像块的残差。The encoding process includes prediction, transformation, quantization, and entropy encoding. Among them, prediction includes two types of intra prediction and inter prediction, the purpose of which is to remove redundant information of the current image block to be encoded by using prediction block data. Intra prediction uses the information of the frame image to obtain prediction block data. Inter prediction uses the information of the reference image to obtain prediction block data. The process includes dividing the current to-be-encoded image into several to-be-encoded image blocks, and then dividing the to-be-encoded image block into several sub-image blocks; then, for each sub-image block , Search the reference image for the image block that most closely matches the current sub-image block as the predicted image block, and the relative displacement between the predicted image block and the current sub-image block is the motion vector; thereafter, the sub-image block and the predicted image block are Subtract the corresponding pixel values to get the residual. The residuals corresponding to the obtained sub-image blocks are combined to obtain the residuals of the image blocks to be encoded.
在本申请的各实施例,可以使用变换矩阵去除图像块的残差的相关性,即去除图像块的冗余信息,以便提高编码效率。图像块中的数据块的变换通常采用二维变换,即在编码端将数据块的残差信息分别与一个N×M的变换矩阵及其转置矩阵相乘,相乘之后得到的是变换系数。变换系数经量化可得到量化后的系数,最后将量化后的系数进行熵编码,得到熵编码比特流。将熵编码比特流及进行编码后的编码模式信息,例如帧内预测模式、运动矢量(或运动矢量残差)等信息,进行存储或发送到解码端。In each embodiment of the present application, a correlation matrix may be used to remove the correlation of the residuals of the image blocks, that is, the redundant information of the image blocks is removed in order to improve the coding efficiency. The transformation of the data block in the image block usually uses two-dimensional transformation, that is, the residual information of the data block is multiplied with an N × M transformation matrix and its transposition matrix at the encoding end, and the transformation coefficient is obtained after multiplication. . Transform coefficients are quantized to obtain quantized coefficients. Finally, the quantized coefficients are entropy-coded to obtain an entropy-coded bitstream. The entropy-coded bitstream and the encoded coding mode information, such as information such as the intra prediction mode and the motion vector (or motion vector residual), are stored or sent to the decoding end.
在图像的解码端,获得熵编码比特流后进行熵解码,得到相应的残差;根据解码得到的运动矢量、帧内预测等信息找到图像块对应的预测图像块;根据预测图像块与残差得到当前子图像块中各像素点的值。At the decoding side of the image, the entropy-decoded bitstream is obtained and the entropy decoding is performed to obtain the corresponding residual; the predicted image block corresponding to the image block is found according to the decoded motion vector, intra prediction and other information; according to the predicted image block and the residual Get the value of each pixel in the current sub-image block.
前文中提到采用已编码/解码的图像来作为当前待编码/解码的参考图像。在一些实施例中还可以构造一个参考图像,来提高参考图像与当前待编码/解码图像的相似度。视频中的图像可作为参考图像时,可以是区分长期参考图像和短期参考图像的。其中,该短期参考图像是与长期参考图像相对应的一个概念。短期参考图像存在于参考图像缓冲区中一段时间,经过该短期参考图像之后的已解码的参考图像在参考图像缓冲区中的若干移入和移出操作之后,短期参考图像会被移出参考图像缓冲区。参考图像缓冲区也可以称为参考图像列表缓存、参考图像列表、参考帧列表缓存或参考帧列表等,本文中将其统称为参考图像缓冲区。It was mentioned in the foregoing that an image that has been encoded / decoded is used as a reference image to be currently encoded / decoded. In some embodiments, a reference image may be constructed to improve the similarity between the reference image and the current image to be encoded / decoded. When an image in a video can be used as a reference image, the long-term reference image and the short-term reference image can be distinguished. The short-term reference image is a concept corresponding to the long-term reference image. The short-term reference image exists in the reference image buffer for a period of time. After the decoded reference image after the short-term reference image is moved into and out of the reference image buffer, the short-term reference image is removed from the reference image buffer. The reference image buffer may also be referred to as a reference image list buffer, a reference image list, a reference frame list buffer, or a reference frame list, etc., which are collectively referred to herein as a reference image buffer.
视频内容中存在一类特定的编码/解码场景,在该场景中背景基本不发生改变,只有视频中的前景发生改变或者运动。例如,视频监控就属于该类场景。在视频监控场景中通常监控摄像头固定不动或者只发生缓慢的移动,可以认为背景基本不发生变化。与此相对,在视频监控镜头中所拍摄到的人或车等物体则经常发生移动或改变,可以认为前景是经常变化的。在这类场景中,可以构造一个特定的参考图像,该特定的参考图像中只包含高质量的背景信息。例如,该特定的参考图像可以为长期参考图像,也可以称为合成参考(composite reference)帧。该长期参考图像中包括多个图像块,任意一个图像块均是从某个已解码图像中取出的,该长期参考图像中的不同图像块可能取自于不同的已解码图像。在进行帧间预测时,当前待编码/解码图像的背景部分可通过参考该长期参考图像,由此能够减少帧间预测的残差信息,从而提高编码/解码效率。There is a specific type of encoding / decoding scene in the video content, in which the background does not change, only the foreground in the video changes or moves. For example, video surveillance belongs to this type of scene. In a video surveillance scene, the surveillance camera is usually stationary or only moves slowly, and it can be considered that the background is basically unchanged. In contrast, objects such as people or cars that are captured in video surveillance lenses often move or change, and it can be considered that the foreground changes frequently. In this type of scene, a specific reference image can be constructed, and the specific reference image contains only high-quality background information. For example, the specific reference image may be a long-term reference image, and may also be referred to as a composite reference frame. The long-term reference image includes multiple image blocks, and any one image block is taken from a decoded image. Different image blocks in the long-term reference image may be taken from different decoded images. When performing inter prediction, the background portion of the current image to be encoded / decoded can be referred to the long-term reference image, thereby reducing the residual information of inter prediction, thereby improving encoding / decoding efficiency.
长期参考图像(或长期参考图像中的一部分数据)一直存在于参考图像缓冲区中,该长期参考图像(或长期参考图像中的一部分数据)不受已解码的参考图像在参考图像缓冲区中的移入和移出操作的影响,只有在解码端发出更新指令操作时该长期参考图像(或长期参考图像中的一部分数据)才会被移出参考图像缓冲区。The long-term reference picture (or a part of the data in the long-term reference picture) always exists in the reference picture buffer. The long-term reference picture (or a part of the data in the long-term reference picture) is not affected by the decoded reference picture in the reference picture buffer. For the effect of the move-in and move-out operations, the long-term reference image (or a part of the data in the long-term reference image) will be removed from the reference image buffer only when the decoder sends an update instruction operation.
短期参考图像和长期参考图像在不同的标准中的叫法可能不同,例如在H.264/高级视频编码(advanced video coding,AVC)或者H.265/HEVC等标准中短期参考图像被称为短期参考帧(short-term reference),长期参考图像被称为长期参考帧(long-term reference)。又如在信源编码标准(audio video coding standard,AVS)1-P2、AVS2-P2、电气和电子工程师协会(institute of electrical and electronics engineers,IEEE)1857.9-P4等标准中,长期参考图像被称为背景帧(background picture)。又如在VP8、VP9等标准中,长期参考图像被称为黄金帧(golden frame)。长期参考图像还可以是前述从多个已解码图像中取出的图像块构造得到的,本申请各实施例对此不作限定。应理解,本申请各实施例的长期参考图像可以为不输出的图像。Short-term reference pictures and long-term reference pictures may be called differently in different standards. For example, short-term reference pictures are called short-term in H.264 / advanced video coding (AVC) or H.265 / HEVC. Reference frames (short-term references), and long-term reference images are referred to as long-term references. For another example, in the audio coding standard (AVS) 1-P2, AVS2-P2, Institute of Electrical and Electronics Engineers (IEEE) 1857.9-P4 and other standards, the long-term reference image is called For the background frame (background picture). For another example, in standards such as VP8 and VP9, long-term reference images are called golden frames. The long-term reference image may also be obtained by the foregoing image block structure obtained from a plurality of decoded images, which is not limited in the embodiments of the present application. It should be understood that the long-term reference image in each embodiment of the present application may be an image that is not output.
常见的编码方式包括顺序编/解码和乱序编/解码两种。顺序编/解码是指编/解码顺序和显示顺序一致,例如低延迟(LowDelay)的码流结构为:I0 P1 P2 P3 P4 P5…(其中I帧为帧内编/解码帧,P帧为前向参考帧间编/解码帧,数字代表显示顺序),此编/解码结构对应的显示顺序也为I0 P1 P2 P3 P4 P5…。 乱序编/解码为了尽可能地提高编码效率,会打乱显示顺序进行编/解码。图1是本申请中乱序编/解码的一个实施例的示意图。如图1所示,显示顺序处于后面的帧可能被先编/解码,显示顺序处于前面的帧可能被后编/解码。例如hierarchical-B的码流结构中编/解码顺序为:I0 P8 B4 B2 B1 B3 B6 B5 B7 P16 B12 B10 B9 B11 B14 B13 B15…(B帧为双向参考帧间参考帧),此编/解码顺序对应的显示顺序为I0 B1 B2 B3 B4 B5 B6 B7 P8 B9 B10 B11 B12 B13 B14 B15 P16…。Common encoding methods include sequential encoding / decoding and out-of-order encoding / decoding. Sequential encoding / decoding means that the encoding / decoding sequence is consistent with the display sequence. For example, the structure of the low-delay code stream is: I0, P1, P2, P3, P4, P5, etc. (where I frame is the intra encoding / decoding frame, and P frame is the previous Encode / decode frames between reference frames, the numbers represent the display order), the display order corresponding to this encoding / decoding structure is also I0, P1, P2, P3, P4, P5 ... Out-of-order encoding / decoding In order to maximize the encoding efficiency, the display order is disrupted for encoding / decoding. FIG. 1 is a schematic diagram of an embodiment of out-of-order encoding / decoding in the present application. As shown in FIG. 1, frames in the display order may be encoded / decoded first, and frames in the display order may be encoded / decoded later. For example, the coding / decoding sequence of the hierarchical-B code structure is: I0, P8, B4, B2, B1, B3, B6, B5, B7, P16, B12, B10, B9, B11, B14, B13, B13, B15, etc. (The B frame is a bidirectional reference inter-reference frame). The corresponding display order is I0, B1, B2, B3, B4, B5, B6, B7, P8, B9, B10, B11, B12, B13, B14, B15, P16 ...
当需要插入随机访问点时,根据随机访问的定义,显示顺序位于随机访问点之后的帧的编/解码过程不应使用随机访问点之前的数据。通常图像序列中的随机访问分为两类,对于第一类随机访问点,在随机访问点处会完全清空参考图像缓冲区中的短期参考图像,以及采用随机访问点的重建图像替换长期参考图像,若在随机访问点之后存在显示顺序位于随机访问点之前的帧,则一律丢弃不解码。在一些标准中,这第一类随机访问点被称为即时解码刷新(Instantaneous Decoder Refresh,IDR)。对于第二类随机访问点,在随机访问点处参考图像缓冲区中的短期参考图像不会立即清空,在随机访问点之后编/解码的、显示顺序位于随机访问点之前的帧仍然还能使用随机访问点之前的短期参考帧(若参考图像缓冲区中存在),解码显示顺序位于随机访问点之后的帧则必须使用显示顺序位于随机访问点之后(包含随机访问点)的帧作为短期参考帧。而且,在这第二类随机访问点编/解码后,还采用该第二类随机访问点的重建图像替换长期参考图像。在一些标准中,这第二类随机访问点被称为清除随机访问(Clean Random Access,CRA)。When a random access point needs to be inserted, according to the definition of random access, the encoding / decoding process of frames whose display order is behind the random access point should not use data before the random access point. Random access in image sequences is generally divided into two categories. For the first type of random access point, the short-term reference image in the reference image buffer is completely cleared at the random access point, and the reconstructed image of the random access point is used to replace the long-term reference image. If there is a frame after the random access point in the display order before the random access point, it will be discarded without decoding. In some standards, this first type of random access point is called Instantaneous Decoder Refresh (IDR). For the second type of random access point, the short-term reference image in the reference image buffer at the random access point will not be immediately cleared, and the frames encoded / decoded after the random access point and displayed before the random access point can still be used. Short-term reference frames before the random access point (if they exist in the reference image buffer). Frames that are displayed after the random access point must be used as frames for short-term reference frames. . Furthermore, after encoding / decoding the second type of random access point, the reconstructed image of the second type of random access point is also used to replace the long-term reference image. In some standards, this second type of random access point is called Clean Random Access (CRA).
本申请的一些实施例中,在第二类随机访问点(随机访问点对应的帧均为I帧)编码之后,参考图像缓冲区中的短期参考图像不会被立即清空。随机访问点之后编/解码的、显示顺序位于随机访问点之前的帧仍然还能使用随机访问点之前的参考图像(若参考图像缓冲区中存在)进行帧间编/解码。随机访问点之后编/解码的、显示顺序位于随机访问点之后的帧则使用参考图像缓冲区中显示顺序位于随机访问点之后(包括随机访问点)的帧作为参考图像进行帧间编/解码。In some embodiments of the present application, after the second type of random access point (the frames corresponding to the random access point are all I frames), the short-term reference images in the reference image buffer are not immediately emptied. The frames encoded / decoded after the random access point and displayed in order before the random access point can still use the reference image before the random access point (if it exists in the reference image buffer) for inter-frame encoding / decoding. Frames that are encoded / decoded after the random access point and are displayed after the random access point use frames in the reference image buffer that are displayed after the random access point (including the random access point) as the reference image for inter-frame encoding / decoding.
本申请的一些实施例中,在第二类随机访问点编码之后,以及在第二类随机访问点的下一帧编/解码之前,长期参考图像保留不变,也即该长期参考图像没有被第二类随机访问点的重建图像所替换。在第二类随机访问点之后 编码的至少一帧图像可以采用该未被替换掉的长期参考图像进行帧间编/解码。In some embodiments of the present application, the long-term reference image remains unchanged after the second-type random access point is encoded and before the next frame of the second-type random access point is encoded / decoded, that is, the long-term reference image is not The reconstructed image of the second type of random access point is replaced. At least one frame of image coded after the second type of random access point can use this long-term reference image that has not been replaced for inter-frame coding / decoding.
对于编码方式为乱序编码而言,例如hierarchical-B的码流结构,在对随机访问点进行编码之后,还存在若干显示顺序在随机访问点之前的帧需要编码。在对这些显示顺序在随机访问点之前的帧进行编码时,需要保持并继续维护参考图像缓冲区,编码完所有的显示顺序在随机访问点之前的帧时,对参考图像缓冲区进行维护,删除所有显示顺序在随机访问点之前的短期参考图像。在解码过程中,遇到随机访问点时,如果没有使用随机访问功能,即不执行从该随机访问点开始播放视频,则需要保持并继续维护参考图像缓冲区。直到解码完所有的显示顺序在随机访问点之前的帧,对参考图像缓冲区进行调整,删除所有显示顺序在随机访问点之前的短期参考图像。如果使用了该随机访问点的随机访问功能,则不对显示顺序在该随机访问点之前的帧进行解码,此时参考图像缓冲区也会保留。直到对显示顺序在随机访问点之后的帧进行解码时,删除所有显示顺序在随机访问点之前的参考图像,之后进行解码并进行参考图像缓冲区的维护。For the encoding method to be out-of-order encoding, for example, the code-stream structure of hierarchical-B, after encoding a random access point, there are still several frames that need to be encoded before the random access point. When encoding these frames whose display order is before the random access point, it is necessary to maintain and continue to maintain the reference image buffer. After encoding all frames whose display order is before the random access point, maintain and delete the reference image buffer. All short-term reference images displayed in order before the random access point. During the decoding process, when a random access point is encountered, if the random access function is not used, that is, if the video is not played from the random access point, the reference image buffer needs to be maintained and continued to be maintained. Until all frames whose display order is before the random access point are decoded, the reference image buffer is adjusted to delete all short-term reference images whose display order is before the random access point. If the random access function of the random access point is used, frames whose display order is before the random access point are not decoded, and the reference image buffer is also retained at this time. Until the frames whose display order is after the random access point are decoded, all reference images whose display order is before the random access point are deleted, and then the reference image buffer is decoded and maintained.
上文中给出的是在设置随机访问点时,短期参考图像的处理方式。长期参考图像的特性与短期参考图像的特性不同。通常,短期参考图像为一帧解码图像的重建图像,而长期参考图像是通过某些机制合成得到的,也即长期参考图像采用的是块级刷新的方式得到的。前文中提到,在编码/解码过程中可以不断更新长期参考图像,那么在遇到随机访问点时,将对短期参考图像的处理方式应用在长期参考图像可能会失效,或可能会影响编码效率。在随机访问点后存在显示顺序在随机访问点之前的帧参与编码/解码过程的情况下,如果更新长期参考图像时不考虑随机访问点问题,而是基于已编码/已解码图像进行更新,则有可能导致显示顺序在随机访问点之后的帧不能正常解码。如果更新长期参考图像时采用现有的针对随机访问点的编码/解码技术,则有可能导致编码/解码效率低下。What is given above is the processing method of short-term reference images when setting random access points. The characteristics of the long-term reference image are different from those of the short-term reference image. Generally, the short-term reference image is a reconstructed image of a decoded image, and the long-term reference image is synthesized through some mechanism, that is, the long-term reference image is obtained by using block-level refresh. As mentioned earlier, long-term reference images can be continuously updated during the encoding / decoding process. When a random access point is encountered, applying the short-term reference image processing method to long-term reference images may fail or may affect encoding efficiency. . In the case where there is a frame after the random access point in which the display order precedes the random access point participates in the encoding / decoding process, if the random access point problem is not considered when updating the long-term reference image, but the update is based on the encoded / decoded image, then It may cause that the frames whose display order is after the random access point cannot be decoded normally. If the existing encoding / decoding technology for random access points is used when updating the long-term reference image, the encoding / decoding efficiency may be low.
本申请中,将“对长期参考图像的全部图像块进行更新”的情况称为“对长期参考图像进行替换”,或称为“替换长期参考图像”;将“对长期参考图像的全部图像块进行更新”以外的情况,例如“对长期参考图像的仅部分图像块进行更新”的情况,称为“对长期参考图像进行更新”,或称为“更新长期参考图像”。In this application, the case of "updating all image blocks of the long-term reference image" is referred to as "replacement of the long-term reference image", or "replacement of the long-term reference image"; Update other than ", for example," update only a part of the long-term reference image "is called" update the long-term reference image ", or" update long-term reference image ".
接下来,对本申请涉及的更新/替换长期参考图像的一些更新/替换的方法进行举例说明。Next, some update / replace methods of updating / replacing long-term reference images involved in this application are exemplified.
下面结合图2对更新长期参考图像的一些方法进行举例说明。如图2所示,图2是本申请的视频编码方法的一个实施例的流程示意图。该更新长期参考图像的方法由图像处理装置执行,该图像处理装置可以是各种类型的用于图像处理的芯片、图像处理器等。如图2所示,方法包括:The following describes some methods for updating the long-term reference image with reference to FIG. 2. As shown in FIG. 2, FIG. 2 is a schematic flowchart of an embodiment of a video encoding method of the present application. The method of updating a long-term reference image is performed by an image processing apparatus, and the image processing apparatus may be various types of chips for image processing, an image processor, and the like. As shown in Figure 2, the method includes:
101、当当前待编码图像可作为参考图像时,且当图像块可用于更新长期参考图像时,根据图像块对长期参考图像中的特定图像块进行更新,其中,图像块为所述当前待编码图像中的一个图像块,特定图像块在长期参考图像中的位置由图像块在当前待编码图像中的位置决定。101. When a current image to be encoded can be used as a reference image, and when an image block can be used to update a long-term reference image, a specific image block in the long-term reference image is updated according to the image block, where the image block is the current to-be-encoded image. An image block in an image. The position of a specific image block in a long-term reference image is determined by the position of the image block in the current image to be encoded.
在一些实施例中,确定当前待编码图像可作为参考图像,可以发生在对该待编码图像进行编码之前。如此,可以根据该确定的结果在对待编码图像中的各图像块进行编码时或者编码后判断各图像块满足用于更新长期参考图像的条件。或者,确定当前待编码图像可作为参考图像,也可以发生在对待编码图像中的各图像块进行编码时或者编码后,也即在对每一个图像块编码时或者编码后,首先确定该图像块当前所在图像可作为参考图像,当确定可作为参考图像时,再确定该图像块可用于更新长期参考图像。In some embodiments, determining that the current image to be encoded may be used as a reference image may occur before encoding the image to be encoded. In this way, according to the determination result, it can be determined that each image block in the image to be encoded satisfies a condition for updating the long-term reference image when encoding or after encoding. Or, determining that the current image to be encoded can be used as a reference image, or it can occur when encoding or after encoding each image block in the image to be encoded, that is, when encoding each image block or after encoding, first determining the image block The current image can be used as a reference image, and when it can be determined as a reference image, it can be determined that the image block can be used to update the long-term reference image.
在一些实施例中,由于I图像和P图像(或前向预测图像)可以作为其他图像进行帧间预测的参考图像,因此,当确定当前待编码图像为I图像或者为P图像(或前向预测图像)时,确定当前待编码图像作为参考图像。在一些实施例中,部分B图像(或双向预测图像)也可作为其他图像进行帧间预测的参考图像,如在分层B(hierarchical B)技术中,位于层次较低的B图像可作为参考帧使用,因此,确定当前待编码图像是这一部分B图像时,也可以确定当前待编码图像可作为参考图像。In some embodiments, since the I-picture and the P-picture (or forward-predicted picture) can be used as reference pictures for inter-prediction of other pictures, when it is determined that the currently-to-be-encoded picture is an I-picture or a P-picture (or forward-looking picture) (Predicted image), the current image to be encoded is determined as the reference image. In some embodiments, some B-pictures (or bi-predictive pictures) can also be used as reference pictures for inter-prediction of other pictures. For example, in hierarchical B (hierarchical B) technology, lower-level B-pictures can be used as reference. Frames are used. Therefore, when it is determined that the current image to be encoded is this part of the B image, it can also be determined that the current image to be encoded can be used as a reference image.
在一些实施例中,在确定当前待编码图像可作为参考图像之后,编码端还在视频参数集(video parameter set,VPS)、序列参数集(sequence parameter set,SPS)、序列头(sequence header)、图像头(picture header)、条带头(slice header)、参考图像集(reference picture set,RPS)和参考图像配置集(reference configuration set,RCS)中的至少一项中写入参数或者标识位,以指示该当前待编码图像可作为参考图像。In some embodiments, after determining that the current to-be-encoded image can be used as a reference image, the encoding end is still in a video parameter set (VPS), a sequence parameter set (SPS), and a sequence header. Write parameters or flags in at least one of picture header, picture header, slice header, reference picture set (RPS), and reference picture configuration set (RCS), To indicate that the current to-be-encoded image can be used as a reference image.
在一些实施例中,判断图像块可用于更新长期参考图像,可通过该图像 块的像素信息来进行判断。例如,当确定图像块和之前已编码图像中相同位置处的块的内容差别较小时,则认为该图像块包含背景内容,可用于更新长期参考图像。当然,还有其他可用于确定图像块可用于更新长期参考图像的方法。In some embodiments, the judgment image block may be used to update a long-term reference image, and the judgment may be performed by using pixel information of the image block. For example, when it is determined that the content difference between an image block and a block at the same position in a previously encoded image is small, the image block is considered to contain background content and can be used to update a long-term reference image. Of course, there are other methods that can be used to determine which image patches are available for updating long-term reference images.
在一些实施例中,特定图像块在长期参考图像中的位置和图像块在当前待编码图像中的位置相同。如图3所示,图3是将当前待编码图像中的图像块与长期参考图像中的图像块的关系的示意图。图3所示中的当前待编码图像中的图像块210、220为满足预设条件的图像块,其中当前待编码图像中的图像块210的位置和长期参考图像中的图像块110的位置相同,当前待编码图像中的图像块220和长期参考图像中的图像120的位置相同。In some embodiments, the position of the specific image block in the long-term reference image and the position of the image block in the current image to be encoded are the same. As shown in FIG. 3, FIG. 3 is a schematic diagram of a relationship between an image block in a current image to be encoded and an image block in a long-term reference image. The image blocks 210 and 220 in the current to-be-encoded image shown in FIG. 3 are image blocks satisfying a preset condition, where the position of the image block 210 in the current to-be-encoded image is the same as the position of the image block 110 in the long-term reference image. The positions of the image block 220 in the current image to be encoded and the image 120 in the long-term reference image are the same.
在一些实施例中,长期参考图像中的位置相比图像块在当前待编码图像中的位置偏移了预设偏移值。In some embodiments, the position in the long-term reference image is offset by a preset offset value from the position of the image block in the current image to be encoded.
在一些实施例中,根据图像块对长期参考图像中的特定图像块进行更新,具体为采用图像块的像素值替换特定参考块的当前内容。在一些实施例中,根据图像块对长期参考图像中的特定图像块进行更新,可以是采用图像块的像素值进行处理后替换特定参考块的当前像素值,该处理可以是根据图像块的像素值与长期参考图像中的一个图像块的像素值取平均值,或者根据图像块的像素值与长期参考图像中图像块的像素值做加权平均,其中该加权平均的系数为预设值或者从码流中解析得到。其中,在采用图像块的像素值时,可以是采用图像块的原始像素值,也可以是采用图像块的重建像素值。In some embodiments, updating a specific image block in the long-term reference image according to the image block, specifically replacing the current content of the specific reference block with the pixel value of the image block. In some embodiments, updating a specific image block in a long-term reference image according to the image block may be to replace the current pixel value of the specific reference block with the pixel value of the image block for processing, and the processing may be based on the pixels of the image block. The value is averaged with the pixel value of an image block in the long-term reference image, or a weighted average is performed according to the pixel value of the image block and the pixel value of the image block in the long-term reference image, where the coefficient of the weighted average is a preset value or Parsed in the code stream. When the pixel value of the image block is used, it may be the original pixel value of the image block or the reconstructed pixel value of the image block.
在视频技术中,不被作为参考图像的图像在编码和解码过程中自身的图像信息不会用于其它图像的编码和解码过程。本实施例中在确定当前待编码图像可作为参考图像时,才考虑采用该当前待编码图像中的图像块来对长期参考图像进行更新,避免了长期参考图像的构造过程与不被作为参考图像的图像的定义相违背的情况。此外,不被作为参考图像的图像在解码时由于不用做其它图像的解码过程,因此所述不被作为参考图像的图像在解码时可以不被解码,从而能加快视频码流的解码速度,实现视频内容的变帧率播放。本实施例中在确定当前待编码图像可作为参考图像时,才考虑采用该当前待编码图像中的图像块来对长期参考图像进行更新,避免了采用不可作为参考图像的图像中的图像块对长期参考图像进行更新时无法实现丢弃部分不可作为参考图像的情况。In video technology, the image information of an image that is not used as a reference image is not used in the encoding and decoding process of other images during the encoding and decoding process. In this embodiment, when it is determined that the current to-be-encoded image can be used as a reference image, the image block in the current to-be-encoded image is considered to update the long-term reference image, thereby avoiding the construction process of the long-term reference image and not being used as the reference image. The definition of the image violates the situation. In addition, since an image that is not used as a reference image does not need to be decoded during the decoding of other images, the image that is not used as a reference image may not be decoded when it is decoded, thereby speeding up the decoding speed of the video code stream and achieving Variable frame rate playback of video content. In this embodiment, when it is determined that the current to-be-encoded image can be used as a reference image, it is considered to update the long-term reference image by using the image block in the currently-to-be-encoded image, avoiding the use of the image block pair in the image that is not a reference image The long-term reference image cannot be updated when discarded parts cannot be used as the reference image.
在一些实施例中,当当前待编码图像不是可作为参考图像的图像时,确定该图像块不用于更新长期参考图像。In some embodiments, when the currently to-be-encoded image is not an image that can be used as a reference image, it is determined that the image block is not used to update the long-term reference image.
确定图像块可用于更新长期参考图像的方法有多种。例如,可以根据图像块的像素值和已编码块的像素值判断图像块可用于更新长期参考图像,其中,已编码块指的是位于当前待编码图像之前的已编码图像中特定位置处的图像块。例如,该已编码块指的是位于当前待编码图像的前一帧(或者前两帧)已编码图像中。例如,该特定位置可以是和图像块在当前待编码图像中位置相同,或者是图像块在当前待编码图像中位置加上预设偏移值。There are several ways to determine which image blocks can be used to update long-term reference images. For example, an image block can be used to update a long-term reference image based on the pixel value of the image block and the pixel value of the encoded block, where the encoded block refers to the image at a specific position in the encoded image that is located before the current image to be encoded. Piece. For example, the coded block refers to a coded image located in a previous frame (or the first two frames) of the currently-coded image. For example, the specific position may be the same position as the image block in the current image to be encoded, or the position of the image block in the current image to be encoded plus a preset offset value.
在一些实施例中,在根据图像块的像素信息和已编码块的像素信息判断图像块可用于更新长期参考图像时,具体根据以下至少一项判断图像块可用于更新长期参考图像:In some embodiments, when determining that an image block can be used to update a long-term reference image based on pixel information of the image block and pixel information of an encoded block, specifically determining that the image block can be used to update a long-term reference image according to at least one of the following:
图像块和已编码块之间的亮度分量的像素值差值;Pixel value difference of the luminance component between the image block and the coded block;
图像块和/或已编码块的亮度分量的像素总数;The total number of pixels of the luminance component of the image block and / or the coded block;
图像块和已编码块之间的色度分量的像素值差值;Pixel value difference between chrominance components between the image block and the coded block;
图像块和/或已编码块的色度分量的像素总数。The total number of pixels of the chroma component of the image block and / or the coded block.
其中,图像块和已编码块之间的亮度分量的像素值差值,可以是图像块和第二编码块的亮度分量分别在各相同位置处的像素值之差的分布,可以是图像块和第二编码块的亮度分量分别在各相同位置处的像素值之差的总和,也可以是图像块的亮度分量在各像素的平均值和已编码块的亮度分量在各像素的平均值的差值。The difference between the pixel values of the luminance components between the image block and the coded block may be the distribution of the difference between the pixel values of the luminance components of the image block and the second coded block at the same positions, respectively. The sum of the differences between the pixel values of the luminance components of the second encoding block at the same positions, or the difference between the average of the luminance components of the image block at each pixel and the average of the luminance components of the encoded block at each pixel. value.
其中,图像块和已编码块之间的色度分量的像素值差值,可以是图像块和第二编码块的色度分量分别在各相同位置处的像素值之差的分布,可以是图像块和第二编码块的色度分量分别在各相同位置处的像素值之差的总和,也可以是图像块的色度分量在各像素的平均值和已编码块的色度分量在各像素的平均值的差值。The pixel value difference of the chrominance component between the image block and the coded block may be the distribution of the difference in pixel values of the chrominance components of the image block and the second coding block at the same positions, respectively, and may be an image The sum of the difference between the pixel values of the chroma components of the block and the second coding block at the same positions, respectively. It can also be the average value of the chroma components of the image block at each pixel and the chroma components of the coded block at each pixel. The difference of the mean.
其中,根据图像块和已编码块之间的亮度分量的像素值差值判断图像块可用于更新长期参考图像,具体可以是根据图像块和第二编码块之间的亮度分量的像素值差值的绝对值之和判断图像块可用于更新长期参考图像。The image block can be used to update the long-term reference image according to the pixel value difference of the luminance component between the image block and the coded block. Specifically, it can be based on the pixel value difference of the luminance component between the image block and the second coded block. The sum of the absolute value of the image block can be used to update the long-term reference image.
其中,根据图像块和已编码块之间的色度分量的像素值差值判断图像块可用于更新长期参考图像,具体可以是根据图像块和第二编码块之间的色度分量的像素值差值的绝对值之和判断图像块可用于更新长期参考图像。The image block can be used to update the long-term reference image according to the pixel value difference of the chrominance component between the image block and the coded block. Specifically, it can be based on the pixel value of the chrominance component between the image block and the second coded block. The sum of the absolute value of the difference judgment image block can be used to update the long-term reference image.
其中,在根据图像块和已编码块之间的亮度分量的像素值差值判断图像块可用于更新长期参考图像的实施例中,可选的,当确定图像块可用于更新长期参考图像时,图像块需要满足的条件包括:图像块中特定像素的个数小于第一阈值。其中,该特定像素是,与已编码块中相同位置处的像素在第一颜色通道的像素值之差不小于第二阈值的像素。Wherein, in the embodiment in which the image block can be used to update the long-term reference image according to the pixel value difference of the luminance component between the image block and the coded block, optionally, when it is determined that the image block can be used to update the long-term reference image, The condition that the image block needs to satisfy includes: the number of specific pixels in the image block is less than the first threshold. Wherein, the specific pixel is a pixel whose pixel value difference in the first color channel from the pixel at the same position in the coded block is not less than the second threshold.
具体举例来说,图像按照三个分量来存储,分别为Y(亮度)、U(色度1)、V(色度2)。该第一颜色通道为Y通道。已编码块为位于当前待编码图像的前一帧(或者前两帧)的已编码图像中,位置和所述图像块的位置相同的图像块,或者位置相比图像块在当前待编码图像中偏移了预设值的图像块。已编码块的Y分量和图像块的Y分量在任意一个相同位置处的像素差值为Dist y。其中,当Dist y不小于第二阈值时,该Dist y对应的图像块中的像素为特定像素。在判断图像块满足“图像块的特定像素的个数不小于第一阈值”该条件时,该第一阈值可以是一个预设值,也可以是图像块的Y分量的像素总数与一个预设比例的乘积,在此不做限制。Specifically, an image is stored according to three components, which are Y (luminance), U (chrominance 1), and V (chrominance 2). The first color channel is a Y channel. The coded block is an image block that is located in the previous frame (or the first two frames) of the current image to be encoded, and whose position is the same as the position of the image block, or the position is compared to the image block in the current image to be encoded. An image block offset by a preset value. The pixel difference between the Y component of the encoded block and the Y component of the image block at the same arbitrary position is Dist. Wherein, when Dist is not less than the second threshold, the pixels in the image block corresponding to the Dist are specific pixels. When determining that the image block satisfies the condition that the number of specific pixels of the image block is not less than the first threshold value, the first threshold value may be a preset value, or the total number of pixels of the Y component of the image block and a preset value. The product of the proportions is not limited here.
其中,在根据图像块和已编码块之间的亮度分量的像素值差值判断图像块可用于更新长期参考图像的实施例中,可选的,当确定图像块可用于更新长期参考图像时,图像块需要满足的条件包括:图像块和已编码块之间的亮度分量的像素值差值小于第三阈值。Wherein, in the embodiment in which the image block can be used to update the long-term reference image according to the pixel value difference of the luminance component between the image block and the coded block, optionally, when it is determined that the image block can be used to update the long-term reference image, The condition that the image block needs to satisfy includes: a difference in pixel value of a luminance component between the image block and the coded block is less than a third threshold.
其中,在判断图像块满足“图像块和已编码块之间的亮度分量的像素值差值小于第三阈值”该条件时,该第三阈值可以是一个预设值,也可以是图像块的Y分量的像素总数与一个预设比例的乘积,在此不做限制。When it is determined that the image block satisfies the condition that the difference between the pixel values of the luminance components between the image block and the coded block is less than the third threshold value, the third threshold value may be a preset value or an image block The product of the total number of pixels of the Y component and a preset ratio is not limited here.
其中,在根据图像块和已编码块之间的色度分量的像素值差值判断图像块可用于更新长期参考图像的实施例中,可选的,当确定图像块可用于更新长期参考图像时,图像块需要满足的条件包括:图像块和已编码块之间的色度分量的像素值差值小于第四阈值。In the embodiment in which the image block can be used to update the long-term reference image according to the pixel value difference between the chrominance components between the image block and the coded block, optionally, when it is determined that the image block can be used to update the long-term reference image The condition that the image block needs to satisfy includes: a difference between pixel values of chrominance components between the image block and the coded block is less than a fourth threshold.
其中,图像块和已编码块之间的色度分量的像素值差值小于第四阈值,可以是图像块和已编码块之间的U分量的像素值差值小于第四阈值,或者是图像块和第二编码块之间的V分量的像素值差值小于第四阈值,或者是图像块和已编码块之间的U分量的像素值差值小于一个预置数值,且图像块和已编码块之间的V分量的像素值差值小于另一个预置数值。The pixel value difference between the chrominance components between the image block and the coded block is smaller than the fourth threshold, and may be the pixel value difference between the U component between the image block and the coded block is less than the fourth threshold, or the image The pixel value difference between the V component between the block and the second encoding block is less than the fourth threshold, or the pixel value difference between the U component between the image block and the encoded block is less than a preset value, and the image block and the The pixel value difference of the V component between the coding blocks is smaller than another preset value.
其中,在判断图像块满足“图像块和已编码块之间的色度分量的像素值 差值小于第四阈值”该条件时,该第四阈值可以是一个预设值,也可以是图像块的亮度分量(或者色度分量)的像素总数与一个预设比例的乘积,在此不做限制。When it is determined that the image block satisfies the condition that the pixel value difference between the chrominance components between the image block and the coded block is less than the fourth threshold, the fourth threshold may be a preset value or an image block. The product of the total number of pixels of the luminance component (or chrominance component) and a preset ratio is not limited here.
上面描述了一些可用于更新长期参考图像的图像块需要满足的条件。在一些实施例中,当当前待编码图像为I图像或者为随机访问点时,或者当前待编码图像同时为I图像和随机访问点时,根据当前待编码图像的全部图形块对所述长期参考图像的全部图像块进行更新。其中,待编码图像的全部图像块,可以指的是当前待编码图像的编码重建之后的全部图像块,也可以指的是的当前待编码图像的原始的全部图像块。例如,可以采用当前待编码图像的全部图像块替换长期参考图像中的全部图像块。或者,采用当前待编码图像的全部图像块进行一定处理后替换长期参考图像中的全部图像块,其中,该处理可以是对当前待编码图像的全部图像块的像素值进行平均或者进行加权平均,在此不做限制。The above describes some conditions that can be used to update the image blocks of the long-term reference image. In some embodiments, when the currently to-be-encoded image is an I-picture or a random access point, or when the currently-to-be-encoded image is both an I-picture and a random access point, the long-term reference is made according to all graphics blocks of the currently-to-be-encoded image. All image blocks of the image are updated. The entire image blocks of the image to be encoded may refer to all image blocks after the encoding and reconstruction of the current image to be encoded, or may refer to all original image blocks of the current to-be-encoded image. For example, all image blocks in the long-term reference image may be replaced with all image blocks of the current image to be encoded. Alternatively, all image blocks in the current to-be-encoded image are processed with certain image blocks to replace all image blocks in the long-term reference image. The process may be averaging or weighted averaging the pixel values of all image blocks in the current-to-code image. There are no restrictions here.
在一些实施例中,当前待编码图像中可用于更新长期参考图像的图像块的数量可以是1个,也可以是大于1个。在一些实施例中,当前待编码图像中可用于更新长期参考图像的图像块的数量可以是没有限制的,也即当前待编码图像中所有满足可用于更新长期参考图像的条件的图像块都用于对长期参考图像进行更新。In some embodiments, the number of image blocks in the current to-be-encoded image that can be used to update the long-term reference image may be one or more than one. In some embodiments, the number of image blocks in the current to-be-encoded image that can be used to update the long-term reference image may be unlimited, that is, all image blocks in the current to-be-encoded image that meet the conditions that can be used to update the long-term reference image are used. For updating long-term reference images.
在一些实施例中,可用于更新长期参考图像的图像块的数量较多,从编解码系统实现复杂度考虑,可将当前待编码图像中可用于更新长期参考图像的图像块的数量限制为不大于M,该M为不小于1的整数。In some embodiments, the number of image blocks that can be used to update the long-term reference image is large. Considering the implementation complexity of the codec system, the number of image blocks that can be used to update the long-term reference image in the current image to be encoded can be limited to Greater than M, the M is an integer not less than 1.
如此,在确定当前待编码图像中所有可用于更新长期参考图像的图像块之后,若确定出的图像块的数量不大于M,则分别根据确定出的每一个图像块对长期参考图像进行更新。根据每一个图像块对长期参考图像进行更新的方法可参考上述描述,在此不再赘述。若确定出的图像块的数量大于M,则从该确定出的图像块中挑选出其中的M个图像块,并根据该M个图像块对长期参考图像进行更新。In this way, after determining all image blocks in the current to-be-encoded image that can be used to update the long-term reference image, if the determined number of image blocks is not greater than M, the long-term reference image is updated according to each determined image block. For a method of updating the long-term reference image according to each image block, reference may be made to the foregoing description, and details are not described herein again. If the determined number of image blocks is greater than M, M image blocks are selected from the determined image blocks, and the long-term reference image is updated according to the M image blocks.
当前待编码图像对应的M的取值有多种确定方法。例如,当前待编码图像对应的M的取值是基于当前待编码图像的类型确定的。There are multiple methods for determining the value of M corresponding to the current image to be encoded. For example, the value of M corresponding to the current image to be encoded is determined based on the type of the current image to be encoded.
在一些实施例中,当前待编码图像的类型不同时,该当前待编码图像对应的M的取值不同。具体举例来说,当前待编码图像为I图像时,该当前待 编码图像最多有第一预设数值个图像块用于长期参考图像的更新;当前待编码图像为P图像(或前向预测图像)时,该当前待编码图像最多有第二预设数值个图像块用于长期参考图像的更新;当前待编码图像为B图像(或双向预测图像)时,该当前待编码图像最多有第三预设数值个图像块用于长期参考图像的更新,其中,该第一预设数值、第二预设数值和第三预设数值不同。In some embodiments, when the type of the current image to be encoded is different, the value of M corresponding to the current image to be encoded is different. Specifically, for example, when the currently-to-be-encoded image is an I-picture, the currently-to-be-encoded image has at most a first preset number of image blocks for updating the long-term reference image; the currently-to-be-encoded image is a P-picture (or forward-predicted image) ), The currently to-be-encoded image has at most a second preset number of image blocks for long-term reference image update; when the currently-to-be-encoded image is a B-picture (or bidirectionally predicted image), the currently-to-be-encoded image has a maximum of The preset number of image blocks are used for updating the long-term reference image, wherein the first preset value, the second preset value, and the third preset value are different.
在一些实施例中,当前待编码图像对应的M的取值是基于当前待编码图像所属类型的图像总数确定的。具体举例来说,如I图像对应的M值为视频中I图像的图像总数的一半;P图像(或前向预测图像)对应的M值为P图像(或前向预测图像)的图像总数的四分之一;可作为参考图像使用的B图像(或双向预测图像)对应的M值为B图像(或双向预测图像)的图像总数的八分之一。In some embodiments, the value of M corresponding to the current image to be encoded is determined based on the total number of images of the type to which the current image to be encoded belongs. Specifically, for example, the M value corresponding to the I image is half of the total number of images of the I image in the video; the M value corresponding to the P image (or forward prediction image) is the total number of images of the P image (or forward prediction image). One-quarter; the M value corresponding to the B-picture (or bi-predictive picture) that can be used as the reference picture is one-eighth of the total number of pictures of the B-picture (or bi-predictive picture).
从当前待编码图像中确定出的所有可用于更新长期参考图像的图像块中挑选出其中的M个图像块的方法有多种。例如,在图像是按照不同颜色通道的分量来存储的情况中,从当前待编码图像中确定出的所有可用于更新长期参考图像的图像块中挑选出其中的代价(cost)小于预置数值,且代价最小的M个图像块来用于更新长期参考图像。There are various methods for selecting M image blocks from all the image blocks that can be used to update the long-term reference image, which are determined from the current image to be encoded. For example, in the case that the image is stored according to the components of different color channels, the cost selected from all the image blocks that can be used to update the long-term reference image determined from the current to-be-encoded image is less than a preset value, The least expensive M image blocks are used to update the long-term reference image.
其中,图像块的代价(cost)为所述图像块在所述各颜色通道的像素差异的总和;图像块在每个颜色通道的像素差异为,图像块的各像素分别和第三已编码块中具有相同位置的像素在颜色通道的像素值之差的总和;第三已编码块指的是位于当前待编码图像之前的已编码图像中特定位置处的图像块。例如,该第三已编码块指的是位于当前待编码图像的前一帧(或者前两帧)已编码图像中。例如,该特定位置可以是和图像块在当前待编码图像中位置相同。The cost of the image block is the sum of the pixel differences of the image block in each color channel; the pixel differences of each image channel in the color block are: each pixel of the image block and the third coded block respectively The sum of the differences in pixel values of pixels with the same position in the color channel; the third coded block refers to the image block at a specific position in the coded image that is located before the current image to be coded. For example, the third coded block refers to a coded image located in a previous frame (or the first two frames) of the current image to be coded. For example, the specific position may be the same position as the image block in the current image to be encoded.
具体举例来说,图像是分为YUV三个分量来存储的。图像块与第三编码块分别在YUV三个分量上的像素值差值为Dist Y、Dist U、Dist V,图像块在亮度分量上的像素总数为PixCount。那么图像块的代价(cost)=(Dist Y+Dist U+Dist V)/PixCount。在确定当前待编码图像中可用于更新长期参考图像时,从确定出当前待编码图像中所有代价小于预置数值的图像块,若确定出的图像块的数量不大于M,则所有的图像块均可以用于更新长期参考图像;若确定出的图像块的数量大于M,则确定当前待编码图像中代价最小的M个图像块可以用于更新长期参考图像。For example, the image is stored in three YUV components. The difference between the pixel values of the image block and the third encoding block on the three YUV components is Dist, Y, Dist, U, and Dist, and the total number of pixels on the luminance component of the image block is PixCount. Then the cost of the image block (cost) = (Dist Y + Dist U + Dist V) / PixCount. When determining that the current to-be-encoded image can be used to update the long-term reference image, it is determined that all the image blocks in the current to-be-encoded image cost less than a preset value. If the determined number of image blocks is not greater than M, all the image blocks are Both can be used to update the long-term reference image; if the determined number of image blocks is greater than M, it is determined that the M image blocks with the least cost among the current to-be-encoded images can be used to update the long-term reference image.
在一些实施例中,还编码该图像块的标识位,该标识位用于标识该图像块是否用于对所述长期参考图像进行更新。编码端发送至解码端的码流中还包括各图像的标识位,其中,每个图像的标识位用于指示该图像中的各图像块是否用于对长期参考图像进行更新。In some embodiments, an identification bit of the image block is also encoded, and the identification bit is used to identify whether the image block is used to update the long-term reference image. The code stream sent from the encoding end to the decoding end also includes identification bits of each image, where the identification bits of each image are used to indicate whether each image block in the image is used to update the long-term reference image.
下面结合具体示例对视频编码的方法进行举例说明。The following describes the video encoding method with specific examples.
如图4所示,图4是视频中的多个图像和长期参考图像的关系示意图。图4中以视频中其中的4个依次进行编码的图像为例,其中前三个图像为已编码图像,第4个图为当前待编码图像。在前三个图像中,第一个和第三个已编码图像可作为参考图像,第二个已编码图像不可作为参考图像。其中,第一个已编码图像中的图像块11和图像块12被用于对长期参考图像进行更新。第三个已编码图像中的图像块31、图像块32、图像块33和图像块34被用于对长期参考图像进行更新。例如,图像块11、12、31、32、33、34中的像素值分别用于替换长期参考图像中的相同位置处的图像块的像素值。As shown in FIG. 4, FIG. 4 is a schematic diagram of a relationship between multiple images and a long-term reference image in a video. In FIG. 4, four images in the video are sequentially encoded as an example. The first three images are encoded images, and the fourth image is the current image to be encoded. Of the first three images, the first and third encoded images can be used as reference images, and the second encoded image cannot be used as a reference image. Among them, the image block 11 and the image block 12 in the first encoded image are used to update the long-term reference image. Image blocks 31, 32, 33, and 34 in the third encoded image are used to update the long-term reference image. For example, the pixel values in the image blocks 11, 12, 31, 32, 33, and 34 are respectively used to replace the pixel values of the image blocks at the same position in the long-term reference image.
下面以对当前待编码图像进行编码时的视频编码方法进行举例说明。在对当前待编码图像进行编码之前,根据当前待编码图像的类型确定当前待编码图像可作为参考图像。例如,由于当前待编码图像为I图像,因此确定当前待编码图像可作为参考图像。因此,在对当前待编码图像中的各图像块分别进行编码时,对于每一个图像块,确定该图像块是否可用于更新长期参考图像。The following uses a video encoding method for encoding a current image to be encoded as an example. Before encoding the current image to be encoded, it is determined that the current image to be encoded can be used as a reference image according to the type of the current image to be encoded. For example, since the current image to be encoded is an I image, it is determined that the current image to be encoded can be used as a reference image. Therefore, when encoding each image block in the current image to be encoded separately, for each image block, it is determined whether the image block can be used to update the long-term reference image.
下面结合两个示例对确定图像块可用于更新长期参考图像的方法进行说明。The following describes a method for determining that an image block can be used to update a long-term reference image with two examples.
示例一Example one
图像按照三个分量来存储,分别是Y、U、V三个分量。称当前待编码图像中的任意一个图像块为图像块1,称该当前待编码图像的前一帧已编码图像中与图像块1具有相同位置的图像块为图像块2。Images are stored according to three components, which are Y, U, and V components. Any image block in the current to-be-encoded image is referred to as image block 1, and the image block in the previous frame of the currently-encoded image that has the same position as image block 1 is referred to as image block 2.
图像块1和图像块2的Y分量中,各相同位置处的像素的像素值之差的总和为Dist Y。图像块1和图像块2的U分量中,各相同位置处的像素的像素值之差的总和为Dist U。图像块1和图像块2的V分量中,各相同位置处的像素的像素值之差的总和为Dist V。In the Y component of the image block 1 and the image block 2, the sum of the difference between the pixel values of the pixels at the same positions is DistY. The sum of the differences between the pixel values of the pixels at the same positions in the U components of the image block 1 and the image block 2 is DistU. The sum of the difference between the pixel values of the pixels at the same positions in the V components of the image block 1 and the image block 2 is DistV.
图像块1的亮度分量总像素为PixCount,图像块1和图像块2之间的大误差点计数为LargeDist1。设置LargeDist1的初始值为0,当图像块1的亮 度分量中出现一个和图像块2的亮度分量的相同位置处的像素值差值大于预设值(例如20)的像素时,LargeDist1累加1。The total pixel of the luminance component of image block 1 is PixCount, and the large error point count between image block 1 and image block 2 is LargeDist1. The initial value of LargeDist1 is set to 0. When a pixel having a difference in pixel value at the same position as the brightness component of image block 2 in the luminance component of image block 1 is larger than a preset value (eg, 20), LargeDist1 is incremented by one.
当同时满足以下4个条件时,认为图像块1是更新长期参考图像的备选块。When the following four conditions are satisfied at the same time, image block 1 is considered to be a candidate block for updating the long-term reference image.
a)LargeDist1小于PixCount的预设比例(例如1%);a) LargeDist1 is smaller than the preset ratio of PixCount (for example, 1%);
b)Dist Y小于PixCount的预设倍数(例如4倍);b) Dist is smaller than a preset multiple of PixCount (for example, 4 times);
c)Dist U小于PixCount的预设倍数(例如0.5倍);c) DistU is less than the preset multiple of PixCount (for example, 0.5 times);
d)DistV小于PixCount的预设倍数(例如0.5倍)。d) DistV is smaller than a preset multiple of PixCount (for example, 0.5 times).
在当前待编码图像中符合更新长期参考图像的备选块中,当该备选块的数量不大于M时,采用所有的备选块用作更新长期参考图像。Among the candidate blocks in the current to-be-encoded image that conform to the updated long-term reference image, when the number of the candidate blocks is not greater than M, all the candidate blocks are used as the updated long-term reference image.
在当前待编码图像中符合更新长期参考图像的备选块中,当该备选块的数量大于M时,记每个图像块的代价cost为:Cost=(Dist Y+Dist U+DistV)/PixCount。当前待编码图像中选出cost最小的M个备选块用于更新所述的特定的参考图像。Among the candidate blocks in the current to-be-encoded image that meet the updated long-term reference image, when the number of the candidate blocks is greater than M, the cost of each image block is recorded as: Cost = (DistY + DistU + DistV) / PixCount. The M candidate blocks with the lowest cost are selected from the currently to-be-coded images for updating the specific reference image.
示例二Example two
图像按照三个分量来存储,分别是Y、U、V三个分量。称当前待编码图像中的任意一个图像块为图像块1,称该当前待编码图像的前一帧已编码图像中与图像块1具有相同位置的图像块为图像2,称该当前待编码图像的前两帧已编码图像中与图像块1具有相同位置的图像块为图像3。Images are stored according to three components, which are Y, U, and V components. Any image block in the current to-be-encoded image is referred to as image block 1, and the image block in the previous frame of the current to-be-encoded image that has the same position as image block 1 is referred to as image 2, and the current to-be-encoded image is referred to as image 2. In the first two frames of the encoded image, the image block having the same position as the image block 1 is the image 3.
图像块1和图像块2的Y分量中,各相同位置处的像素的像素值之差的总和为Dist Y。图像块1和图像块2的U分量中,各相同位置处的像素的像素值之差的总和为Dist U。图像块1和图像块2的V分量中,各相同位置处的像素的像素值之差的总和为Dist V。In the Y component of the image block 1 and the image block 2, the sum of the difference between the pixel values of the pixels at the same positions is DistY. The sum of the differences between the pixel values of the pixels at the same positions in the U components of the image block 1 and the image block 2 is DistU. The sum of the difference between the pixel values of the pixels at the same positions in the V components of the image block 1 and the image block 2 is DistV.
图像块1和图像块3的Y分量中,各相同位置处的像素的像素值之差的总和为Dist Y’。图像块1和图像块2的U分量中,各相同位置处的像素的像素值之差的总和为Dist U’。图像块1和图像块2的V分量中,各相同位置处的像素的像素值之差的总和为Dist V’。The sum of the difference between the pixel values of the pixels at the same position among the Y components of the image block 1 and the image block 3 is DistY '. The sum of the difference between the pixel values of the pixels at the same position among the U components of the image block 1 and the image block 2 is DistU '. The sum of the difference between the pixel values of the pixels at the same position among the V components of the image block 1 and the image block 2 is DistV '.
图像块1的亮度分量总像素为PixCount,图像块1和图像块2之间的大误差点计数为LargeDist1,图像块1和图像块3之间的大误差点计数为LargeDist2。设置LargeDist1和LargeDist2的初始值为0,当图像块1的亮度分量中出现一个和图像块2的亮度分量的相同位置处的像素值差值大于预设 值(例如20)的像素时,LargeDist1累加1。当图像块1的亮度分量中出现一个和图像块3的亮度分量的相同位置处的像素值差值大于预设值(例如20)的像素时,LargeDist2累加1。The total pixel of the luminance component of image block 1 is PixCount, the large error point count between image block 1 and image block 2 is LargeDist1, and the large error point count between image block 1 and image block 3 is LargeDist2. Set the initial values of LargeDist1 and LargeDist2 to 0. When a pixel value at the same position as the brightness component of image block 2 appears in the luminance component of image block 1 and the pixel value difference is greater than a preset value (for example, 20), LargeDist1 accumulates. 1. When a pixel value difference at the same position as the brightness component of the image block 3 in the luminance component of the image block 1 is larger than a preset value (for example, 20), LargeDist2 is incremented by 1.
当同时满足以下4个条件时,认为图像块1是更新特定背景块的备选块。When the following four conditions are satisfied at the same time, image block 1 is considered as a candidate block for updating a specific background block.
a)LargeDist1和LargeDist2均小于PixCount的预设比例(例如2%);a) Both LargeDist1 and LargeDist2 are smaller than the preset ratio of PixCount (for example, 2%);
b)Dist Y和Dist Y’均小于PixCount的预设倍数(例如6倍);b) Dist Y and Dist Y ′ are both smaller than a preset multiple of PixCount (for example, 6 times);
c)Dist U和Dist U’均小于PixCount的预设倍数(例如0.5倍)c) Dist U and Dist U ’are both smaller than the preset multiple of PixCount (for example, 0.5 times)
d)DistV和Dist V’均小于PixCount的预设倍数(例如0.5倍)d) Both DistV and DistV ’are smaller than the preset multiple of PixCount (for example, 0.5 times)
在当前待编码图像中符合更新长期参考图像的备选块中,当该备选块的数量不大于M时,采用所有的备选块用作更新长期参考图像。Among the candidate blocks in the current to-be-encoded image that conform to the updated long-term reference image, when the number of the candidate blocks is not greater than M, all the candidate blocks are used as the updated long-term reference image.
在当前待编码图像中符合更新长期参考图像的备选块中,当该备选块的数量大于M时,记每个图像块的代价cost为:Cost=(Dist Y+Dist U+DistV)/PixCount。当前待编码图像中选出cost最小的M个备选块用于更新所述的特定的参考图像。Among the candidate blocks in the current to-be-encoded image that meet the updated long-term reference image, when the number of the candidate blocks is greater than M, the cost of each image block is recorded as: Cost = (DistY + DistU + DistV) / PixCount. The M candidate blocks with the lowest cost are selected from the currently to-be-coded images for updating the specific reference image.
确定当前待编码图像中所有可用于更新长期参考图像的图像块(图4中具体为图像块41、42、43和44)之后,采用该所有可用于更新长期参考图像的图像块对长期参考图像进行更新。例如,如图4所示,图像块41、42、43和44中的像素值分别用于替换长期参考图像中的相同位置处的图像块的像素值。After determining all the image blocks (specifically image blocks 41, 42, 43 and 44 in FIG. 4) that can be used to update the long-term reference image in the current image to be encoded, the image blocks that can be used to update the long-term reference image are used to compare the long-term reference image. Update. For example, as shown in FIG. 4, the pixel values in the image blocks 41, 42, 43, and 44 are respectively used to replace the pixel values of the image blocks at the same position in the long-term reference image.
如图5所示,图5是本申请的视频编码的方法的又一个实施例的流程示意图。如图5所示,方法包括:As shown in FIG. 5, FIG. 5 is a schematic flowchart of still another embodiment of a video encoding method of the present application. As shown in Figure 5, the method includes:
401、当当前待编码图像可用于更新长期参考图像时,且当图像块可用于更新长期参考图像时,根据该图像块对长期参考图像中的特定图像块进行更新,其中,该图像块为当前待编码图像中的一个图像块,特定图像块在长期参考图像中的位置由图像块在当前待编码图像中的位置决定。401. When the current to-be-encoded image can be used to update the long-term reference image, and when the image block is available to update the long-term reference image, update a specific image block in the long-term reference image according to the image block, where the image block is An image block in the image to be encoded. The position of the specific image block in the long-term reference image is determined by the position of the image block in the current image to be encoded.
其中,确定当前待编码图像可用于更新长期参考图像的方法有多种。There are multiple methods for determining that the current to-be-encoded image can be used to update the long-term reference image.
在一些实施例中,当当前待编码图像可用于帧间预测时,确定当前待编码图像可用于更新该长期参考图像。例如,当确定当前待编码码图像为帧内预测图像或者为前向预测图像时,确定当前待编码图像可用于更新所述长期参考图像。例如,由于I图像和P图像(或前向预测图像)可以作为其他图像进行帧间预测的参考图像,因此,当确定当前待编码图像为I图像或者为 P图像(或前向预测图像)时,确定当前待编码图像作为参考图像。在一些实施例中,部分B图像(或双向预测图像)也可作为其他图像进行帧间预测的参考图像,如在分层B(hierarchical B)技术中,位于层次较低的B图像可作为参考帧使用,因此,确定当前待编码图像是这一部分B图像时,也可以确定当前待编码图像可作为参考图像。In some embodiments, when the currently-to-be-encoded image is available for inter prediction, it is determined that the currently-to-be-encoded image can be used to update the long-term reference image. For example, when it is determined that the current image to be coded is an intra-prediction image or a forward prediction image, it is determined that the current to-be-coded image can be used to update the long-term reference image. For example, since I-pictures and P-pictures (or forward-predicted pictures) can be used as reference pictures for inter-frame prediction of other pictures, when it is determined that the currently to-be-encoded picture is an I-picture or a P-picture (or forward-predicted picture) To determine the current image to be encoded as the reference image. In some embodiments, some B-pictures (or bi-predictive pictures) can also be used as reference pictures for inter-prediction of other pictures. For example, in hierarchical B (hierarchical B) technology, lower-level B-pictures can be used as reference. Frames are used. Therefore, when it is determined that the current image to be encoded is this part of the B image, it can also be determined that the current image to be encoded can be used as a reference image.
在一些实施例中,当所述当前待编码图像为帧内预测图像和/或随机访问点时,根据所述当前待编码图像的全部图像块对所述长期参考图像的全部图像块进行更新。In some embodiments, when the current to-be-coded image is an intra-predicted image and / or a random access point, all image blocks of the long-term reference image are updated according to all the image blocks of the currently-to-code image.
在一些实施例中,视频中的图像可作为参考图像(也即可用于帧间预测)时,是不区分作为长期参考图像还是作为短期参考图像的,只要当前待编码图像可以作为其他图像进行帧间预测的参考图像,即可确定当前待编码图像可作为参考图像,此时所述待编码图像中的图像块可用于更新特定图像块。In some embodiments, when an image in a video can be used as a reference image (that is, it can be used for inter prediction), it is not distinguished as a long-term reference image or a short-term reference image, as long as the current to-be-encoded image can be framed as other images. The inter-predicted reference image can determine that the current to-be-encoded image can be used as the reference image. At this time, the image block in the to-be-encoded image can be used to update a specific image block.
在一些实施例中,当当前待编码图像不可作为短期参考图像且不可作为长期参考图像时,确定所述待编码图像中的图像块不可用于更新所述长期参考图像中的特定图像块。In some embodiments, when the current to-be-coded image is not available as a short-term reference image and cannot be used as a long-term reference image, it is determined that an image block in the to-be-coded image is not available for updating a specific image block in the long-term reference image.
在一些实施例中,当当前待编码图像可作为短期参考图像且可作为长期参考图像时,确定所述待编码图像中的图像块可用于更新所述长期参考图像。In some embodiments, when the current to-be-coded image can be used as a short-term reference image and can be used as a long-term reference image, it is determined that an image block in the to-be-coded image can be used to update the long-term reference image.
在一些实施例中,当当前待编码图像不可作为短期参考图像但可作为长期参考图像时,确定所述待编码图像可用于更新所述长期参考图像。In some embodiments, when the current to-be-encoded image is not available as a short-term reference image but can be used as a long-term reference image, it is determined that the to-be-encoded image can be used to update the long-term reference image.
在一些实施例中,当当前待编码图像可作为短期参考图像但不可作为长期参考图像时,确定所述待编码图像不可用于更新所述长期参考图像,也即确定所述待编码图像中的图像块不用于更新长期参考图像中的特定图像块。In some embodiments, when the current to-be-coded image can be used as a short-term reference image but cannot be used as a long-term reference image, determining that the to-be-coded image is not available for updating the long-term reference image, that is, determining the Image patches are not used to update specific image patches in the long-term reference image.
在一些实施例中,当当前待编码图像可作为短期参考图像但不可作为长期参考图像时,确定所述待编码图像可用于更新所述长期参考图像。In some embodiments, when the current to-be-coded picture can be used as a short-term reference picture but not as a long-term reference picture, it is determined that the to-be-coded picture can be used to update the long-term reference picture.
在一些实施例中,当当前待编码图像可作为短期参考图像且可作为长期参考图像时,确定所述待编码图像可用于更新所述长期参考图像。In some embodiments, when the current to-be-coded image can be used as a short-term reference image and can be used as a long-term reference image, it is determined that the to-be-coded image can be used to update the long-term reference image.
在一些实施例中,还在以下至少一项中加入标识位,该标识位用于标识不可作为短期参考图像的图像是否可用于更新所述长期参考图像:In some embodiments, an identification bit is further added in at least one of the following, and the identification bit is used to identify whether an image that cannot be used as a short-term reference image can be used to update the long-term reference image:
视频参数集、序列参数集、序列头、图像参数集、图像头、条带头、参考图像集、参考配置集。Video parameter set, sequence parameter set, sequence header, image parameter set, image header, slice header, reference image set, reference configuration set.
可选的,该标识位为时域可伸缩标识位。当具有时域可伸缩需求时,所 述标识位的值用于指示不可为短期参考图像的图像中的图像块不可用于更新所述长期参考图像;和/或,当不具有时域可伸缩需求时,所述标识位的值用于指示不可为短期参考图像的图像中的图像块可用于更新所述长期参考图像。Optionally, the flag is a time-domain scalable flag. When there is a need for time domain scalability, the value of the identification bit is used to indicate that an image block in an image that is not a short-term reference image cannot be used to update the long-term reference image; and / or, when there is no time-domain scalability When required, the value of the identification bit is used to indicate that an image block in an image that is not a short-term reference image can be used to update the long-term reference image.
考虑到不可作为短期参考图像的图像中的图像块不用于更新长期参考图像会影响特定参考帧的更新速度,从而会影响特定参考帧对提升编码质量的作用,采用“不可作为短期参考图像但可作为长期参考图像的当前待编码图像中的图像块仍可用于更新特定参考帧”这样的方案,可以降低产生这样影响。Considering that image blocks that are not available as short-term reference images are not used to update long-term reference images, it will affect the update speed of specific reference frames, which will affect the effect of specific reference frames on improving coding quality. An image block in the current to-be-encoded image that is a long-term reference image can still be used to update a specific reference frame "scheme, which can reduce the impact.
而且,“不可作为短期参考图像但可作为长期参考帧的当前待编码图像中的图像块仍可用于更新长期参考图像”这样的方案的意义在于,当编码系统不在意不作为短期参考图像的并行编码特性或不在意解码时直接丢弃不作为短期参考图像加快解码速度的特性时,采用该方案即能保证特定参考帧对提升编码质量的作用,又能兼顾在短期参考图像的概念中不可作为参考图像的图像的定义;当编码系统在意不作为短期参考图像的并行编码特性或在意解码时直接丢弃不作为短期参考图像加快编码速度的特性时,则仍可以规定不可作为短期参考图像的图像中的图像块不能用于对特定参考帧的更新。Moreover, the meaning of the scheme "the image blocks in the current to-be-encoded image that cannot be used as short-term reference pictures but can be used as long-term reference frames" can be used to update long-term reference pictures. When encoding characteristics or directly discarding the short-term reference image when decoding is not important, it can ensure the effect of specific reference frames on improving the encoding quality while taking into account the concept of short-term reference images, which cannot be used as a reference. The definition of the image of the image; when the encoding system is concerned about the parallel encoding characteristics that are not used as short-term reference pictures or directly discards the characteristics that are not used as short-term reference pictures to speed up the encoding speed, the An image block cannot be used to update a specific reference frame.
进一步的,可以在视频参数集、序列参数集、序列头、图像参数集、图像头、条带头、参考图像集、参考配置集中的至少一项加入一标识位,该标识位用于标识不可作为短期参考图像的图像中的图像块信息是否可用于更新特定参考帧。在一些实施例中,标识位还可以为时域可伸缩标识位。当编码系统具有时域可伸缩需求时,设置所述标识位的值用于指示不可为短期参考图像的图像中的图像块不可用于特定参考帧的更新;和/或,当编码系统不具有时域可伸缩需求时,设置所述标识位的值用于指示不可为短期参考图像的图像中的图像块可用于特定参考帧的更新。Further, at least one of a video parameter set, a sequence parameter set, a sequence header, an image parameter set, an image header, a slice header, a reference image set, and a reference configuration set may be added with an identification bit, and the identification bit is used to identify that the Whether the image block information in the image of the short-term reference image can be used to update a specific reference frame. In some embodiments, the identification bit may also be a time-domain scalable identification bit. When the encoding system has a time domain scalability requirement, the value of the flag is used to indicate that the image block in the image that is not a short-term reference image is not available for the update of a specific reference frame; and / or, when the encoding system does not have When the time domain is scalable, the value of the flag is used to indicate that an image block in an image that is not a short-term reference image can be used for updating a specific reference frame.
其中,关于长期参考图像以及特定图像块的解释可参考上面描述中对长期参考图像和特定图像块的解释,在此不再赘述。For the explanation of the long-term reference image and the specific image block, refer to the explanation of the long-term reference image and the specific image block in the above description, and details are not described herein again.
其中,关于如何确定图像块可用于更新长期参考图像,可参考上面描述中对“确定图像块可用于更新长期参考图像”的解释,在此不再赘述。Regarding how to determine that the image block can be used to update the long-term reference image, refer to the explanation of “determining the image block can be used to update the long-term reference image” in the above description, which is not repeated here.
其中,关于如何根据当前待编码图像中的图像块对长期参考图像中的特定图像块进行更新,可参考上面描述中对“根据当前待编码图像中的图像块 对长期参考图像中的特定图像块进行更新”的解释,在此不再赘述。Regarding how to update specific image blocks in the long-term reference image according to the image blocks in the current image to be encoded, refer to the description above for "specific image blocks in the long-term reference image based on the image blocks in the current image to be encoded. "Update" explanation will not be repeated here.
在一些实施例中,当前待编码图像中可用于更新长期参考图像的图像块的数量可以是1个,也可以是大于1个。在一些实施例中,当前待编码图像中可用于更新长期参考图像的图像块的数量可以是没有限制的,也即当前待编码图像中所有满足可用于更新长期参考图像的条件的图像块都用于对长期参考图像进行更新。In some embodiments, the number of image blocks in the current to-be-encoded image that can be used to update the long-term reference image may be one or more than one. In some embodiments, the number of image blocks in the current to-be-encoded image that can be used to update the long-term reference image may be unlimited, that is, all image blocks in the current to-be-encoded image that meet the conditions that can be used to update the long-term reference image are used. For updating long-term reference images.
在一些实施例中,可用于更新长期参考图像的图像块的数量较多,从编解码系统实现复杂度考虑,可将当前待编码图像中可用于更新长期参考图像的图像块的数量限制为不大于M,该M为不小于1的整数。In some embodiments, the number of image blocks that can be used to update the long-term reference image is large. Considering the implementation complexity of the codec system, the number of image blocks that can be used to update the long-term reference image in the current image to be encoded can be limited to Greater than M, the M is an integer not less than 1.
如此,在确定当前待编码图像中所有可用于更新长期参考图像的图像块之后,若确定出的图像块的数量不大于M,则分别根据确定出的每一个图像块对长期参考图像进行更新。根据每一个图像块对长期参考图像进行更新的方法可参考上述描述,在此不再赘述。若确定出的图像块的数量大于M,则从该确定出的图像块中挑选出其中的M个图像块,并根据该M个图像块对长期参考图像进行更新。In this way, after determining all image blocks in the current to-be-encoded image that can be used to update the long-term reference image, if the determined number of image blocks is not greater than M, the long-term reference image is updated according to each determined image block. For a method of updating the long-term reference image according to each image block, reference may be made to the foregoing description, and details are not described herein again. If the determined number of image blocks is greater than M, M image blocks are selected from the determined image blocks, and the long-term reference image is updated according to the M image blocks.
当前待编码图像对应的M的取值有多种确定方法。例如,当前待编码图像对应的M的取值是基于当前待编码图像的类型确定的。There are multiple methods for determining the value of M corresponding to the current image to be encoded. For example, the value of M corresponding to the current image to be encoded is determined based on the type of the current image to be encoded.
在一些实施例中,当前待编码图像的类型不同时,该当前待编码图像对应的M的取值不同。具体举例来说,当前待编码图像为I图像时,该当前待编码图像最多有第一预设数值个图像块用于长期参考图像的更新;当前待编码图像为P图像(或前向预测图像)时,该当前待编码图像最多有第二预设数值个图像块用于长期参考图像的更新;当前待编码图像为B图像(或双向预测图像)时,该当前待编码图像最多有第三预设数值个图像块用于长期参考图像的更新,其中,该第一预设数值、第二预设数值和第三预设数值不同。In some embodiments, when the type of the current image to be encoded is different, the value of M corresponding to the current image to be encoded is different. Specifically, for example, when the currently-to-be-encoded image is an I-picture, the currently-to-be-encoded image has at most a first preset number of image blocks for updating the long-term reference image; the currently-to-be-encoded image is a P-picture (or forward-predicted image) ), The currently to-be-encoded image has at most a second preset number of image blocks for long-term reference image updating; when the currently-to-be-encoded image is a B-picture (or bidirectionally predicted image), the currently-to-be-encoded image has at most a third The preset number of image blocks are used for updating the long-term reference image, wherein the first preset value, the second preset value, and the third preset value are different.
在一些实施例中,当前待编码图像对应的M的取值是基于当前待编码图像所属类型的图像总数确定的。具体举例来说,如I图像对应的M值为视频中I图像的图像总数的一半;P图像(或前向预测图像)对应的M值为P图像(或前向预测图像)的图像总数的四分之一;可作为参考图像使用的B图像(或双向预测图像)对应的M值为B图像(或双向预测图像)的图像总数的八分之一。In some embodiments, the value of M corresponding to the current image to be encoded is determined based on the total number of images of the type to which the current image to be encoded belongs. Specifically, for example, the M value corresponding to the I image is half of the total number of images of the I image in the video; the M value corresponding to the P image (or forward prediction image) is the total number of images of the P image (or forward prediction image). One-quarter; the M value corresponding to the B-picture (or bi-predictive picture) that can be used as the reference picture is one-eighth of the total number of pictures of the B-picture (or bi-predictive picture).
从当前待编码图像中确定出的所有可用于更新长期参考图像的图像块 中挑选出其中的M个图像块的方法有多种。具体可参考上面描述中对“从当前待编码图像中确定出的所有可用于更新长期参考图像的图像块中挑选出其中的M个图像块的方法”的解释,在此不在赘述。There are multiple methods for selecting M image blocks from all the image blocks that can be used to update the long-term reference image, which are determined from the current image to be encoded. For details, reference may be made to the explanation in the above description of “the method for selecting M image blocks from all the image blocks that can be used to update the long-term reference image determined from the current to-be-encoded image”, and details are not described herein.
在视频技术中,不被作为参考图像的图像在编码和解码过程中自身的图像信息不会用于其它图像的编码和解码过程,也即出现部分图像不可用于更新长期参考图像时也会被用于更新长期参考图像。本实施例中在确定当前待编码图像可用于更新长期参考图像时,才考虑采用该当前待编码图像中的图像块来对长期参考图像进行更新,避免了部分图像不可用于更新长期参考图像时也会被用于更新长期参考图像的情况,例如避免了长期参考图像的构造过程与不被作为参考图像的图像的定义相违背的情况。此外,不被作为参考图像的图像在解码时由于不用做其它图像的解码过程,因此所述不被作为参考图像的图像在解码时可以不被解码,从而能加快视频码流的解码速度,实现视频内容的变帧率播放。进一步的,在一些实施例中,在确定当前待编码图像可作为参考图像时,才考虑采用该当前待编码图像中的图像块来对长期参考图像进行更新,避免了采用不可作为参考图像的图像中的图像块对长期参考图像进行更新时无法实现丢弃部分不可作为参考图像的情况。In video technology, an image that is not used as a reference image is not used in the encoding and decoding process of other images during the encoding and decoding process, that is, when some images are unavailable for updating the long-term reference image, they are also deleted. Used to update long-term reference images. In this embodiment, only when it is determined that the current to-be-encoded image can be used to update the long-term reference image, the image block in the currently-to-be-encoded image is considered to update the long-term reference image, which avoids that when some images are not available to update the long-term reference image It is also used in the case of updating the long-term reference image, for example, avoiding the case where the construction process of the long-term reference image is inconsistent with the definition of an image that is not used as a reference image. In addition, since an image that is not used as a reference image does not need to be decoded during the decoding of other images, the image that is not used as a reference image may not be decoded when it is decoded, thereby speeding up the decoding speed of the video code stream and achieving Variable frame rate playback of video content. Further, in some embodiments, when it is determined that the current to-be-encoded image can be used as a reference image, the use of image blocks in the current to-be-encoded image is considered to update the long-term reference image, which avoids using an image that cannot be used as a reference image. When the image block in the image updates the long-term reference image, it is impossible to realize the situation that the discarded part cannot be used as the reference image.
在一些实施例中,当当前待编码图像不可用于更新长期参考图像时,不用当前待编码图像中的图像块对所述长期参考图像中的特定图像块进行更新。例如,当所述当前待编码图像不可用于帧间预测时,确定所述当前待编码图像不可用于更新长期参考图像。又例如,当当前待编码图像可作为短期参考图像但不可作为长期参考图像时,确定所述待编码图像中的图像块不用于更新所述长期参考图像中中的特定图像块。又例如,当当前待编码图像不可作为短期参考图像也不可作为长期参考图像时,确定所述待编码图像中的图像块不用于更新所述长期参考图像中的特定图像块。In some embodiments, when the current to-be-coded image is not available for updating the long-term reference image, the specific image block in the long-term reference image is not updated with the image block in the currently-to-be-coded image. For example, when the currently-to-be-encoded image is unavailable for inter prediction, it is determined that the currently-to-be-encoded image is not available for updating the long-term reference image. As another example, when the current to-be-coded image can be used as a short-term reference image but cannot be used as a long-term reference image, it is determined that an image block in the to-be-coded image is not used to update a specific image block in the long-term reference image. For another example, when the current to-be-coded image is not a short-term reference image or a long-term reference image, it is determined that the image block in the to-be-coded image is not used to update a specific image block in the long-term reference image.
在一些实施例中,在确定当前待编码图像可用于更新长期参考图像之后,编码端还在视频参数集(video parameter set,VPS)、序列参数集(sequence parameter set,SPS)、序列头(sequence header)、图像头(picture header)、条带头(slice header)、参考图像集(reference picture set,RPS)和参考图像配置集(reference configuration set,RCS)中的至少一项中写入参数或者标识位,以指示该当前待编码图像可用于更新长期参考图像。In some embodiments, after determining that the current to-be-encoded image can be used to update the long-term reference image, the encoding end is still in a video parameter set (VPS), a sequence parameter set (SPS), and a sequence header. write parameters or identifiers in at least one of header, picture header, slice header, reference picture set (RPS), and reference picture configuration set (RCS) Bit to indicate that the currently-to-be-encoded picture is available for updating the long-term reference picture.
在一些实施例中,在确定当前待编码图像可用于更新长期参考图像之后, 还编码当前待编码图像中的图像块的标识位,该标识位用于标识该当前待编码图像中的图像块是否用于对所述长期参考图像进行更新。In some embodiments, after determining that the current to-be-encoded image is available for updating the long-term reference image, an identification bit of the image block in the currently-to-be-encoded image is also used to identify whether the image block in the currently-to-be-encoded image is For updating the long-term reference image.
以上结合图2、图3、图4和图5从编码端描述了根据本申请实施例的视频编码方法,下面将结合图6从解码端详细描述根据本申请另一实施例的视频编码方法。图6是根据本申请另一实施例的视频解码方法的示意图。该方法可以由图像处理装置执行,所述图像处理装置可以是各种类型的用于图像处理的芯片、图像处理器等。如图6所示,视频解码方法包括:The video encoding method according to the embodiment of the present application has been described above from the encoding side with reference to FIG. 2, FIG. 3, FIG. 4, and FIG. 5. The video encoding method according to another embodiment of the present application will be described in detail from the decoding side in conjunction with FIG. FIG. 6 is a schematic diagram of a video decoding method according to another embodiment of the present application. The method may be performed by an image processing apparatus, which may be various types of chips for image processing, an image processor, and the like. As shown in Figure 6, the video decoding method includes:
501、当当前待解码图像可作为参考图像时,且当图像块可用于更新长期参考图像时,根据所述图像块对长期参考图像中的特定图像块进行更新,其中,所述图像块为所述当前待解码图像中的一个图像块,所述特定图像块在所述长期参考图像中的位置由所述图像块在所述当前待解码图像中的位置决定。501: When a current to-be-decoded image can be used as a reference image, and when an image block can be used to update a long-term reference image, a specific image block in the long-term reference image is updated according to the image block, where the image block is all The image block in the current image to be decoded is described, and the position of the specific image block in the long-term reference image is determined by the position of the image block in the current image to be decoded.
在一些实施例中,确定当前待解码图像可作为参考图像,可以发生在对该待解码图像进行解码之前。如此,可以根据该确定的结果在对待解码图像中的各图像块进行解码时或者解码后判断各图像块满足用于更新长期参考图像的条件。或者,确定当前待解码图像可作为参考图像,也可以发生在对待解码图像中的各图像块进行解码时或者解码后,也即在对每一个图像块解码时或者解码后,首先确定该图像块当前所在图像是可作为参考图像的图像,当确定可作为参考图像时,再判断该图像块可用于更新长期参考图像。In some embodiments, determining that the current image to be decoded can be used as a reference image may occur before decoding the image to be decoded. In this way, according to the determination result, when each image block in the image to be decoded is decoded or after decoding, it is determined that each image block meets a condition for updating the long-term reference image. Or, determining that the current image to be decoded can be used as a reference image, can also occur when decoding or decoding each image block in the image to be decoded, that is, when decoding or decoding each image block, first determine the image block The current image is an image that can be used as a reference image. When it is determined that the image can be used as a reference image, the image block can be used to update the long-term reference image.
在一些实施例中,确定当前待解码图像可作为参考图像,可通过获取用于指示当前待解码图像的参考关系的参数或者标识位,并根据该参数或者标识位确定当前待解码图像是否为可作为参考图像的图像。其中,可通过多种途径获取用于指示当前待解码图像的参考关系的参数或者标识位。例如,可从视频参数集(video parameter set,VPS)、序列参数集(sequence parameter set,SPS)、序列头(sequence header)、图像头(picture header)、条带头(slice header)、参考图像集(reference picture set,RPS)和参考图像配置集(reference configuration set,RCS)中的至少一项来获取用于指示当前待解码图像的参考关系的参数或者标识位。In some embodiments, it is determined that the current image to be decoded can be used as a reference image. A parameter or an identification bit indicating a reference relationship of the current image to be decoded can be obtained, and whether the current image to be decoded is available is determined according to the parameter or the identification bit. Image as a reference image. Among them, parameters or identification bits used to indicate the reference relationship of the current to-be-decoded image can be obtained through various ways. For example, from video parameter set (VPS), sequence parameter set (SPS), sequence header, picture header, slice header, reference image set (reference picture set (RPS) and reference picture configuration set (RCS) to obtain a parameter or an identification bit indicating a reference relationship of a current picture to be decoded.
在一些实施例中,由于I图像和P图像(或前向预测图像)可以作为其他图像进行帧间预测的参考图像,因此,当确定当前待解码图像为I图像或者为P图像(或前向预测图像)时,确定当前待解码图像是可作为参考图像 的图像。在一些实施例中,部分B图像(或双向预测图像)也可作为用于帧间预测的参考图像,如在分层B(hierarchical B)技术中,位于层次较低的B图像可作为参考帧使用,因此,确定当前待编码图像是这一部分B图像时,也可以确定当前待编码图像可作为参考图像。In some embodiments, since the I-picture and the P-picture (or forward-predicted picture) can be used as reference pictures for inter-frame prediction of other pictures, when determining whether the currently to-be-decoded picture is an I-picture or a P-picture (or forward-looking picture) (Predicted image), it is determined that the image to be decoded is an image that can be used as a reference image. In some embodiments, some B pictures (or bi-predictive pictures) can also be used as reference pictures for inter prediction. For example, in hierarchical B (hierarchical B) technology, lower-level B pictures can be used as reference frames. It is used, therefore, when it is determined that the current image to be encoded is this part of the B image, it can also be determined that the current image to be encoded can be used as a reference image.
判断图像块可用于更新长期参考图像的方法,可以参考上面描述中判断当前待编码图像中的图像块可用于更新长期参考图像的方法。或者,在一些实施例中,解码端还从码流中解析出各图像的标识位,其中,每个图像的标识位用于指示该图像中的各图像块是否用于对长期参考图像进行更新。解码端可以从中获取到图像块的标识位,并根据该标识位判断该图像块是否用于更新长期参考图像。The method for judging the image block can be used to update the long-term reference image. For the method for judging that the image block in the current to-be-encoded image can be used to update the long-term reference image, refer to the method described above. Or, in some embodiments, the decoding end further parses the identification bits of each image from the code stream, wherein the identification bits of each image are used to indicate whether each image block in the image is used to update the long-term reference image. . The decoding end can obtain an identification bit of the image block from the decoding end, and determine whether the image block is used to update the long-term reference image according to the identification bit.
其中,根据图像块对长期参考图像中的特定图像块进行更新的方法,可以参考上面描述中根据当前待编码图像中的图像块对长期参考图像中的特定图像块进行更新的方法,在此不在赘述。其中,特定图像块在所述长期参考图像中的位置具体如何由该图像块在当前待解码图像中的位置决定,可以参考步骤101中特定图像块在长期参考图像中的位置具体如何由该图像块在当前待编码图像中的位置决定,在此不再赘述。The method for updating a specific image block in a long-term reference image according to the image block may refer to the method for updating a specific image block in a long-term reference image according to the image block in the current image to be encoded in the above description. To repeat. The position of a specific image block in the long-term reference image is specifically determined by the position of the image block in the current image to be decoded. For details, refer to step 101. How is the position of the specific image block in the long-term reference image determined by the image? The position of the block in the current image to be encoded is determined, and details are not described herein again.
其中,在一些实施例中,当前待解码图像中可用于更新长期参考图像的图像块的数量可以是1个,也可以是大于1个。在一些实施例中,当前待解码图像中可用于更新长期参考图像的图像块的数量可以是没有限制的,也即当前待解码图像中所有满足可用于更新长期参考图像的条件的图像块都用于对长期参考图像进行更新。In some embodiments, the number of image blocks that can be used to update the long-term reference image in the current to-be-decoded image may be one or more than one. In some embodiments, the number of image blocks in the current to-be-decoded image that can be used to update the long-term reference image may be unlimited, that is, all image blocks in the current to-be-decoded image that meet the conditions that can be used to update the long-term reference image are used. For updating long-term reference images.
在一些实施例中,可用于更新长期参考图像的图像块的数量较多,从编解码系统实现复杂度考虑,可将当前待解码图像中可用于更新长期参考图像的图像块的数量限制为不大于M,该M为不小于1的整数。In some embodiments, the number of image blocks that can be used to update the long-term reference image is large. Considering the implementation complexity of the codec system, the number of image blocks that can be used to update the long-term reference image in the current to-be-decoded image can be limited to Greater than M, the M is an integer not less than 1.
如此,在确定当前待解码图像中所有可用于更新长期参考图像的图像块之后,若确定出的图像块的数量不大于M,则分别根据确定出的每一个图像块对长期参考图像进行更新。根据每一个图像块对长期参考图像进行更新的方法可参考上述描述,在此不再赘述。若确定出的图像块的数量大于M,则从该确定出的图像块中挑选出其中的M个图像块,并根据该M个图像块对长期参考图像进行更新。In this way, after determining all image blocks in the current to-be-decoded image that can be used to update the long-term reference image, if the determined number of image blocks is not greater than M, the long-term reference image is updated according to each determined image block. For a method of updating the long-term reference image according to each image block, reference may be made to the foregoing description, and details are not described herein again. If the determined number of image blocks is greater than M, M image blocks are selected from the determined image blocks, and the long-term reference image is updated according to the M image blocks.
当前待解码图像对应的M的取值可以是基于多种确定方法的。例如, 当前待解码图像对应的M的取值是基于当前待解码图像的类型确定的。在一些实施例中,当前待解码图像的图像类型不同时,该当前待解码图像对应的M的取值不同。具体举例来说,当前待解码图像为I图像时,该当前待解码图像最多有第一预设数值个图像块用于长期参考图像的更新;当前待解码图像为P图像(或前向预测图像)时,该当前待解码图像最多有第二预设数值个图像块用于长期参考图像的更新;当前待解码图像为B图像(或双向预测图像)时,该当前待解码图像最多有第三预设数值个图像块用于长期参考图像的更新,其中,该第一预设数值、第二预设数值和第三预设数值不同。The value of M corresponding to the current image to be decoded may be based on multiple determination methods. For example, the value of M corresponding to the current image to be decoded is determined based on the type of the current image to be decoded. In some embodiments, when the image types of the current image to be decoded are different, the values of M corresponding to the current image to be decoded are different. Specifically, for example, when the current image to be decoded is an I image, the current image to be decoded has at most a first preset number of image blocks for updating the long-term reference image; the current image to be decoded is a P image (or a forward prediction image) ), The currently to-be-decoded image has at most a second preset number of image blocks for updating the long-term reference image; when the currently-to-be-decoded image is a B-picture (or bidirectionally predicted image), the currently-to-be-decoded image has up to a third The preset number of image blocks are used for updating the long-term reference image, wherein the first preset value, the second preset value, and the third preset value are different.
在一些实施例中,当前待解码图像对应的M的取值是基于当前待解码图像所属类型的图像总数确定的。具体举例来说,如I图像对应的M值为视频中I图像的图像总数的一半;P图像(或前向预测图像)对应的M值为P图像(或前向预测图像)的图像总数的四分之一;可作为参考图像使用的B图像(或双向预测图像)对应的M值为B图像(或双向预测图像)的图像总数的八分之一。In some embodiments, the value of M corresponding to the current image to be decoded is determined based on the total number of images of the type to which the current image to be decoded belongs. Specifically, for example, the M value corresponding to the I image is half of the total number of images of the I image in the video; the M value corresponding to the P image (or forward prediction image) is the total number of images of the P image (or forward prediction image). One-quarter; the M value corresponding to the B-picture (or bi-predictive picture) that can be used as the reference picture is one-eighth of the total number of pictures of the B-picture (or bi-predictive picture).
在一些实施例中,以下至少一项中携带有当前待解码图像中可用于更新所述长期参考图像的图像块的数量:当前待解码图像的图像头、当前解码图像的图像参数集、当前待解码图像对应的序列头、当前待解码图像对应的序列参数集、当前待解码图像对应的视频参数集。解码端可从其中解析出当前待解码图像中可用于更新所述长期参考图像的图像块的数量。In some embodiments, at least one of the following carries the number of image blocks in the current to-be-decoded image that can be used to update the long-term reference image: the image header of the currently-to-decode image, the image parameter set of the currently-decoded image, and the current-to-be-decoded image block. The sequence header corresponding to the decoded image, the sequence parameter set corresponding to the current image to be decoded, and the video parameter set corresponding to the current image to be decoded. The decoder can parse out the number of image blocks in the current to-be-decoded image that can be used to update the long-term reference image.
在一些实施例中,当前待解码图像对应的M的取值仅用于告知解码端当前图像最多有多少个图像块可用于特定参考帧的更新,这样可以便于解码端的设计,从而降低解码端的复杂度。In some embodiments, the value of M corresponding to the current to-be-decoded image is only used to inform the decoding end how many image blocks of the current image can be used for updating the specific reference frame, which can facilitate the design of the decoding end and reduce the complexity of the decoding end. degree.
如图7所示,图7是本申请的视频解码的方法的又一个实施例的流程示意图。如图7所示,方法包括:As shown in FIG. 7, FIG. 7 is a schematic flowchart of another embodiment of a video decoding method of the present application. As shown in Figure 7, the method includes:
601、当当前待编码图像可用于更新长期参考图像时,且当图像块可用于更新长期参考图像时,根据所述图像块对长期参考图像中的特定图像块进行更新,其中,所述图像块为所述当前待编码图像中的一个图像块,所述特定图像块在所述长期参考图像中的位置由所述图像块在所述当前待编码图像中的位置决定。601. When a currently-to-be-encoded image is available to update a long-term reference image, and when an image block is available to update a long-term reference image, update a specific image block in the long-term reference image according to the image block, where the image block Is an image block in the current to-be-coded image, the position of the specific image block in the long-term reference image is determined by the position of the image block in the currently-to-be-coded image.
其中,确定当前待编码图像可用于更新长期参考图像的方法有多种。There are multiple methods for determining that the current to-be-encoded image can be used to update the long-term reference image.
在一些实施例中,当所述当前待解码图像可用于帧间预测时,确定当前 待解码图像可用于更新所述长期参考图像。例如,由于I图像和P图像(或前向预测图像)可以作为其他图像进行帧间预测的参考图像,因此,当确定当前待解码图像为I图像或者为P图像(或前向预测图像)时,确定当前待解码图像是可作为参考图像的图像。在一些实施例中,部分B图像(或双向预测图像)也可作为用于帧间预测的参考图像,如在分层B(hierarchical B)技术中,位于层次较低的B图像可作为参考帧使用,因此,确定当前待编码图像是这一部分B图像时,也可以确定当前待编码图像可作为参考图像。In some embodiments, when the currently-to-be-decoded picture is available for inter prediction, it is determined that the currently-to-be-decoded picture can be used to update the long-term reference picture. For example, since I-pictures and P-pictures (or forward-predicted pictures) can be used as reference pictures for inter-prediction of other pictures, when the current picture to be decoded is determined to be an I-picture or a P-picture (or forward-predicted picture) To determine that the current image to be decoded is an image that can be used as a reference image. In some embodiments, some B pictures (or bi-predictive pictures) can also be used as reference pictures for inter prediction. For example, in hierarchical B (hierarchical B) technology, lower-level B pictures can be used as reference frames. It is used, therefore, when it is determined that the current image to be encoded is this part of the B image, it can also be determined that the current image to be encoded can be used as a reference image.
在一些实施例中,当所述当前待编码图像为帧内预测图像和/或随机访问点时,根据所述当前待解码图像的全部图像块对所述长期参考图像的全部图像块进行更新。具体解释可参考上面对“根据所述当前待解码图像的全部图像块对所述长期参考图像的全部图像块进行更新”的解释,在此不再赘述。In some embodiments, when the currently-to-be-encoded image is an intra-predicted image and / or a random access point, all image blocks of the long-term reference image are updated according to all-image blocks of the currently-to-be-decoded image. For specific explanation, reference may be made to the above explanation of “updating all image blocks of the long-term reference image according to all image blocks of the currently to-be-decoded image”, and details are not described herein again.
确定当前待解码图像可作为参考图像(也即可用于帧间预测),可通过获取用于指示当前待解码图像的参考关系的参数或者标识位,并根据该参数或者标识位确定当前待解码图像是否为可作为参考图像的图像。其中,所述当前待解码图像的参考关系可以指的是所述当前带解码图像为短期参考图像或者长期参考图像。其中,可通过多种途径获取用于指示当前待解码图像的参考关系的参数或者标识位。例如,可从视频参数集(video parameter set,VPS)、序列参数集(sequence parameter set,SPS)、序列头(sequence header)、图像头(picture header)、条带头(slice header)、参考图像集(reference picture set,RPS)和参考图像配置集(reference configuration set,RCS)中的至少一项来获取用于指示当前待解码图像的参考关系的参数或者标识位。Determine that the current image to be decoded can be used as a reference image (that is, it can be used for inter prediction). You can obtain a parameter or identification bit that indicates the reference relationship of the current image to be decoded, and determine the current image to be decoded according to the parameter or identification bit Whether it is an image that can be used as a reference image. The reference relationship of the current to-be-decoded picture may refer to whether the currently-decoded picture is a short-term reference picture or a long-term reference picture. Among them, parameters or identification bits used to indicate the reference relationship of the current to-be-decoded image can be obtained through various ways. For example, from video parameter set (VPS), sequence parameter set (SPS), sequence header, picture header, slice header, reference image set (reference picture set (RPS) and reference picture configuration set (RCS) to obtain a parameter or an identification bit indicating a reference relationship of a current picture to be decoded.
在一些实施例中,视频中的图像可作为参考图像时,是不区分作为长期参考图像还是作为短期参考图像的,只要当前待解码图像可以作为其他图像进行帧间预测的参考图像,即可确定当前待解码图像可作为参考图像,此时当前待编码图像可用于更新长期参考图像。In some embodiments, when an image in a video can be used as a reference image, it is not distinguished as a long-term reference image or a short-term reference image, as long as the current image to be decoded can be used as a reference image for inter-frame prediction of other images, it can be determined. The current picture to be decoded can be used as a reference picture, and the current picture to be encoded can be used to update the long-term reference picture.
在一些实施例中,当当前待解码图像不可作为短期参考图像且不可作为长期参考图像时,确定所述待解码图像不可用于更新所述长期参考图像,也即确定所述待解码图像中的图像块不用于更新长期参考图像中的特定图像块。In some embodiments, when the current to-be-decoded image is not available as a short-term reference image and cannot be used as a long-term reference image, determining that the to-be-decoded image is not available for updating the long-term reference image, that is, determining the Image patches are not used to update specific image patches in the long-term reference image.
在一些实施例中,当当前待解码图像可作为短期参考图像且可作为长期参考图像时,确定所述待解码图像中的图像块可用于更新所述长期参考图像。In some embodiments, when the current image to be decoded can be used as a short-term reference image and can be used as a long-term reference image, it is determined that the image block in the image to be decoded can be used to update the long-term reference image.
在一些实施例中,当当前待解码图像不可作为短期参考图像但可作为长期参考图像时,确定所述待解码图像可用于更新所述长期参考图像。In some embodiments, when the current to-be-decoded image is not available as a short-term reference image but can be used as a long-term reference image, it is determined that the to-be-decoded image can be used to update the long-term reference image.
在一些实施例中,当当前待解码图像可作为短期参考图像但不可作为长期参考图像时,确定所述待解码图像不可用于更新所述长期参考图像,也即确定所述待解码图像中的图像块不用于更新长期参考图像中的特定图像块。In some embodiments, when the current image to be decoded can be used as a short-term reference image but cannot be used as a long-term reference image, determining that the image to be decoded is not available for updating the long-term reference image, that is, determining the Image patches are not used to update specific image patches in the long-term reference image.
在一些实施例中,当当前待解码图像可作为短期参考图像但不可作为长期参考图像时,确定所述待解码图像可用于更新所述长期参考图像。In some embodiments, when the current picture to be decoded can be used as a short-term reference picture but cannot be used as a long-term reference picture, it is determined that the picture to be decoded can be used to update the long-term reference picture.
在一些实施例中,当当前待解码图像可作为短期参考图像且可作为长期参考图像时,确定所述待解码图像可用于更新所述长期参考图像。In some embodiments, when the current picture to be decoded can be used as a short-term reference picture and can be used as a long-term reference picture, it is determined that the picture to be decoded can be used to update the long-term reference picture.
确定当前带解码图像是哪一种图像的方法有多种,例如可通过以在视频参数集、序列参数集、序列头、图像参数集、图像头、条带头、参考图像集、参考配置集中解析获得当前图像是短期参考图像还是长期参考图像。There are various methods for determining which image is the currently decoded image. For example, it can be analyzed in the video parameter set, sequence parameter set, sequence header, image parameter set, image header, slice header, reference image set, and reference configuration set. Obtain whether the current image is a short-term reference image or a long-term reference image.
进一步的,还可通过以在视频参数集、序列参数集、序列头、图像参数集、图像头、条带头、参考图像集、参考配置集中的至少一项解析出一标识位,所述标识位用于标识所述待解码图像是否可用于更新所述长期参考图像。在一些实施例中,标识位还可以为时域可伸缩标识位。当解码端具有时域可伸缩需求时,该标识位的值用于指示不可为短期参考图像的图像中的图像块不可用于特定参考帧的更新;和/或,当解码端不具有时域可伸缩需求时,该标识位的值用于指示不可为短期参考图像的图像中的图像块可用于特定参考帧的更新。Further, an identification bit may be parsed by using at least one of a video parameter set, a sequence parameter set, a sequence header, an image parameter set, an image header, a slice header, a reference image set, and a reference configuration set. It is used to identify whether the image to be decoded is available for updating the long-term reference image. In some embodiments, the identification bit may also be a time-domain scalable identification bit. When the decoder has time domain scalability requirements, the value of this flag is used to indicate that the image block in the image that is not a short-term reference image is not available for the update of a specific reference frame; and / or, when the decoder does not have the time domain When scalability is required, the value of this flag is used to indicate that image blocks in an image that is not a short-term reference image can be used for the update of a specific reference frame.
其中,关于长期参考图像以及特定图像块的解释可参考上面描述中对长期参考图像和特定图像块的解释,在此不再赘述。For the explanation of the long-term reference image and the specific image block, refer to the explanation of the long-term reference image and the specific image block in the above description, and details are not described herein again.
其中,关于如何确定图像块可用于更新长期参考图像,可参考上面描述中对“确定图像块可用于更新长期参考图像”的解释,在此不再赘述。Regarding how to determine that the image block can be used to update the long-term reference image, refer to the explanation of “determining the image block can be used to update the long-term reference image” in the above description, which is not repeated here.
在一些实施例中,还获取当前待解码图像的图像块的标识位,其中,该标识位用于标识该当前待解码图像中的图像块是否用于对所述长期参考图像进行更新。根据所述标识位确定可用于更新长期参考图像的图像块。In some embodiments, an identification bit of an image block of the image to be decoded is further obtained, where the identification bit is used to identify whether the image block in the image to be decoded is used to update the long-term reference image. An image block that can be used to update the long-term reference image is determined according to the identification bit.
其中,关于如何根据当前待解码图像中的图像块对长期参考图像中的特定图像块进行更新,可参考上面描述中对“根据当前待解码图像中的图像块对长期参考图像中的特定图像块进行更新”的解释,在此不再赘述。Regarding how to update specific image blocks in the long-term reference image according to the image blocks in the current image to be decoded, refer to the description above for "specific image blocks in the long-term reference image based on the image blocks in the current image to be decoded. "Update" explanation will not be repeated here.
其中,在一些实施例中,当前待解码图像中可用于更新长期参考图像的 图像块的数量可以是1个,也可以是大于1个。在一些实施例中,当前待解码图像中可用于更新长期参考图像的图像块的数量可以是没有限制的,也即当前待解码图像中所有满足可用于更新长期参考图像的条件的图像块都用于对长期参考图像进行更新。Among them, in some embodiments, the number of image blocks that can be used to update the long-term reference image in the current to-be-decoded image may be one or more than one. In some embodiments, the number of image blocks in the current to-be-decoded image that can be used to update the long-term reference image may be unlimited, that is, all image blocks in the current to-be-decoded image that meet the conditions that can be used to update the long-term reference image are used. For updating long-term reference images.
在一些实施例中,可用于更新长期参考图像的图像块的数量较多,从编解码系统实现复杂度考虑,可将当前待解码图像中可用于更新长期参考图像的图像块的数量限制为不大于M,该M为不小于1的整数。In some embodiments, the number of image blocks that can be used to update the long-term reference image is large. Considering the implementation complexity of the codec system, the number of image blocks that can be used to update the long-term reference image in the current to-be-decoded image can be limited to Greater than M, the M is an integer not less than 1.
如此,在确定当前待解码图像中所有可用于更新长期参考图像的图像块之后,若确定出的图像块的数量不大于M,则分别根据确定出的每一个图像块对长期参考图像进行更新。根据每一个图像块对长期参考图像进行更新的方法可参考上述描述,在此不再赘述。若确定出的图像块的数量大于M,则从该确定出的图像块中挑选出其中的M个图像块,并根据该M个图像块对长期参考图像进行更新。In this way, after determining all image blocks in the current to-be-decoded image that can be used to update the long-term reference image, if the determined number of image blocks is not greater than M, the long-term reference image is updated according to each determined image block. For a method of updating the long-term reference image according to each image block, reference may be made to the foregoing description, and details are not described herein again. If the determined number of image blocks is greater than M, M image blocks are selected from the determined image blocks, and the long-term reference image is updated according to the M image blocks.
当前待解码图像对应的M的取值可以是基于多种确定方法的。例如,当前待解码图像对应的M的取值是基于当前待解码图像的类型确定的。在一些实施例中,当前待解码图像的图像类型不同时,该当前待解码图像对应的M的取值不同。具体举例来说,当前待解码图像为I图像时,该当前待解码图像最多有第一预设数值个图像块用于长期参考图像的更新;当前待解码图像为P图像(或前向预测图像)时,该当前待解码图像最多有第二预设数值个图像块用于长期参考图像的更新;当前待解码图像为B图像(或双向预测图像)时,该当前待解码图像最多有第三预设数值个图像块用于长期参考图像的更新,其中,该第一预设数值、第二预设数值和第三预设数值不同。The value of M corresponding to the current image to be decoded may be based on multiple determination methods. For example, the value of M corresponding to the current image to be decoded is determined based on the type of the current image to be decoded. In some embodiments, when the image types of the current image to be decoded are different, the values of M corresponding to the current image to be decoded are different. Specifically, for example, when the current image to be decoded is an I image, the current image to be decoded has at most a first preset number of image blocks for updating the long-term reference image; the current image to be decoded is a P image (or a forward prediction image) ), The currently to-be-decoded image has at most a second preset number of image blocks for updating the long-term reference image; when the currently-to-be-decoded image is a B-picture (or bidirectionally predicted image), the currently-to-be-decoded image has up to a third The preset number of image blocks are used for updating the long-term reference image, wherein the first preset value, the second preset value, and the third preset value are different.
在一些实施例中,当前待解码图像对应的M的取值是基于当前待解码图像所属类型的图像总数确定的。具体举例来说,如I图像对应的M值为视频中I图像的图像总数的一半;P图像(或前向预测图像)对应的M值为P图像(或前向预测图像)的图像总数的四分之一;可作为参考图像使用的B图像(或双向预测图像)对应的M值为B图像(或双向预测图像)的图像总数的八分之一。In some embodiments, the value of M corresponding to the current image to be decoded is determined based on the total number of images of the type to which the current image to be decoded belongs. Specifically, for example, the M value corresponding to the I image is half of the total number of images of the I image in the video; the M value corresponding to the P image (or forward prediction image) is the total number of images of the P image (or forward prediction image). One-quarter; the M value corresponding to the B-picture (or bi-predictive picture) that can be used as the reference picture is one-eighth of the total number of pictures of the B-picture (or bi-predictive picture).
在一些实施例中,以下至少一项中携带有当前待解码图像中可用于更新所述长期参考图像的图像块的数量:当前待解码图像的图像头、当前解码图像的图像参数集、当前待解码图像对应的序列头、当前待解码图像对应的序 列参数集、当前待解码图像对应的视频参数集。解码端可从其中解析出当前待解码图像中可用于更新所述长期参考图像的图像块的数量。In some embodiments, at least one of the following carries the number of image blocks in the current to-be-decoded image that can be used to update the long-term reference image: the image header of the currently-to-decode image, the image parameter set of the currently-decoded image, and the current-to-be-decoded image block. The sequence header corresponding to the decoded image, the sequence parameter set corresponding to the current image to be decoded, and the video parameter set corresponding to the current image to be decoded. The decoder can parse out the number of image blocks in the current to-be-decoded image that can be used to update the long-term reference image.
在一些实施例中,当前待解码图像对应的M的取值仅用于告知解码端当前图像最多有多少个图像块可用于特定参考帧的更新,这样可以便于解码端的设计,从而降低解码端的复杂度。In some embodiments, the value of M corresponding to the current to-be-decoded image is only used to inform the decoding end how many image blocks of the current image can be used for updating the specific reference frame, which can facilitate the design of the decoding end and reduce the complexity of the decoding end. degree.
在一些实施例中,当确定所述当前待解码图像不可用于除所述当前待解码图像的图像进行帧间预测时,确定所述图像块不用于更新所述长期参考图像。In some embodiments, when it is determined that the current to-be-decoded image is not available for inter prediction of an image other than the current to-be-decoded image, it is determined that the image block is not used to update the long-term reference image.
在一些实施例中,当当前待解码图像可作为短期参考图像但不可作为长期参考图像时,确定所述待解码图像中的图像块不用于更新所述长期参考图像。In some embodiments, when the current picture to be decoded can be used as a short-term reference picture but not as a long-term reference picture, it is determined that the image block in the picture to be decoded is not used to update the long-term reference picture.
在一些实施例中,当当前待解码图像不可作为短期参考图像且不可作为长期参考图像时,确定所述待解码图像中的图像块不可用于更新所述长期参考图像。In some embodiments, when the current to-be-decoded image is not available as a short-term reference image and cannot be used as a long-term reference image, it is determined that an image block in the to-be-decoded image is not available for updating the long-term reference image.
在本申请的实施例中,码流中包括第一类型帧和第二类型帧,还可以包括第三类型帧和第四类型帧。第一类型帧为I帧或者为随机访问点,或者第一类型帧同时为I帧和随机访问点。第二类型帧是编码顺序在第一类型帧之后,显示顺序在第一类型帧之前的帧间编码帧。第二类型帧可以是P帧或者B帧。第三类型帧是编码顺序在第一类型帧之前的帧间编码帧。第三类型帧的显示顺序可以在第一类型帧之前。第三类型帧可以是P帧或者B帧。第四类型帧是编码顺序在第一类型帧之后,显示顺序在第一类型帧之后的帧间编码帧。第四类型帧可以是P帧或者B帧。In the embodiment of the present application, the code stream includes a first type frame and a second type frame, and may further include a third type frame and a fourth type frame. The first type frame is an I frame or a random access point, or the first type frame is an I frame and a random access point at the same time. The second type frame is an inter-coded frame whose encoding order is after the first type frame and whose display order is before the first type frame. The second type frame may be a P frame or a B frame. The third type frame is an inter-coded frame whose coding order precedes the first type frame. The display order of the third type frame may precede the first type frame. The third type frame may be a P frame or a B frame. The fourth type frame is an inter-coded frame whose encoding order is after the first type frame and whose display order is after the first type frame. The fourth type frame may be a P frame or a B frame.
其中,本文中提到的帧间编码包括对整帧图像进行帧间编码或对整帧图像中的至少一个图像块进行帧间编码。该帧间编码的定义适用于所有类型帧。The inter-frame coding mentioned herein includes inter-frame coding of an entire frame of images or inter-frame coding of at least one image block in the entire frame of images. This definition of inter-frame coding applies to all types of frames.
下面先从编码端角度详细说明本申请实施例的编码方法。The encoding method according to the embodiment of the present application will be described in detail below from the perspective of the encoding end.
图8是本申请的一个实施例的编码方法800的示意性流程图。如图8所示,编码方法800包括以下步骤。FIG. 8 is a schematic flowchart of an encoding method 800 according to an embodiment of the present application. As shown in FIG. 8, the encoding method 800 includes the following steps.
S810,对第一类型帧进行编码,其中,按编码顺序第一类型帧之后存在需要进行帧间编码的N个第二类型帧,N个第二类型帧的显示顺序在第一类型帧之前,其中,N为正整数。S810. Encode the first type frame. In the encoding order, there are N second type frames that need to be inter-frame encoded after the first type frame. The display order of the N second type frames is before the first type frame. Where N is a positive integer.
S820,根据长期参考图像对N个第二类型帧中的至少一个第二类型帧进 行帧间编码。S820. Inter-code at least one second type frame of the N second type frames according to the long-term reference image.
S830,在完成N个第二类型帧中的至少一个第二类型帧的帧间编码后,替换当前使用的长期参考图像。S830. After completing inter-frame coding of at least one second type frame among the N second type frames, replace the currently used long-term reference image.
本申请实施例的编码方法,在完成编码顺序在第一类型帧之后、显示顺序在第一类型帧之前的N个第二类型帧中的至少一个第二类型帧的帧间编码后,才替换当前使用的长期参考图像,使得至少一个第二类型帧可以参考第一类型帧之前的长期参考图像,可以提高编码效率。The encoding method in the embodiment of the present application is only replaced after completing the inter-frame encoding of at least one second-type frame among the N second-type frames in which the encoding order is after the first-type frame and the display order is before the first-type frame. The currently used long-term reference picture enables at least one second-type frame to reference the long-term reference picture before the first-type frame, which can improve coding efficiency.
可选地,对第一类型帧进行编码,是指对第一类型帧进行帧内编码。Optionally, encoding the first-type frame refers to performing intra-frame encoding on the first-type frame.
可选地,第一类型帧为随机访问点。本实施例中,在完成编码顺序在随机访问点之后、显示顺序在随机访问点之前的N个第二类型帧中的至少一个第二类型帧的帧间编码后,才替换当前使用的长期参考图像,使得至少一个第二类型帧可以参考随机访问点之前的长期参考图像,可以提高编码效率。应理解,本申请实施例的方法可以仅应用于视频中的随机访问点,或者可以应用于视频中的I帧。Optionally, the first type of frame is a random access point. In this embodiment, the current long-term reference is replaced only after the inter-frame encoding of at least one second type frame among the N second type frames in the display order before the random access point is completed after the random access point is completed. An image, so that at least one second type frame can refer to a long-term reference image before a random access point, which can improve coding efficiency. It should be understood that the method in the embodiment of the present application may be applied only to a random access point in a video, or may be applied to an I frame in a video.
一般而言,S830中的至少一个第二类型帧在编码顺序上集中位于N个第二类型帧的一部分上,尤其是集中位于N个第二类型帧的前部。例如,该至少一个第二类型帧可以是N个第二类型帧中编码顺序相对更靠前的一部分第二类型帧。本申请实施例的方案不仅限于S830的情况。即,至少一个第二类型帧可以参考随机访问点之前的长期参考图像,该至少一个第二类型帧可以分别位于N个第二类型帧中的任何位置。N个第二类型帧中除至少一个第二类型帧以外的其他第二类型帧参考替换后的新的长期参考图像。可选地,该至少一个第二类型帧可以是N个第二类型帧中显示顺序相对更靠前的一部分第二类型帧。至少一个第二类型帧也可以位于N个第二类型帧中的其他位置,本申请实施例对此不作限定。Generally speaking, at least one second type frame in S830 is concentrated on a part of the N second type frames in the coding order, and is particularly located at the front of the N second type frames. For example, the at least one second-type frame may be a part of the second-type frame in which the coding order is relatively earlier among the N second-type frames. The solution in the embodiment of the present application is not limited to the case of S830. That is, at least one second type frame may refer to a long-term reference image before a random access point, and the at least one second type frame may be located at any position among the N second type frames, respectively. The second long-term reference image is replaced by the second long-type reference frames of the N second-type frames except for at least one second-type frame. Optionally, the at least one second-type frame may be a part of the second-type frame in which the display order is relatively higher among the N second-type frames. At least one second type frame may also be located at other positions in the N second type frames, which is not limited in this embodiment of the present application.
在本申请一个具体的实施例中,S830在完成所述N个第二类型帧中的至少一个第二类型帧的帧间编码后,替换当前使用的长期参考图像,可以包括:在完成所述N个第二类型帧中的所有第二类型帧的帧间编码后,替换当前使用的长期参考图像。即所有的编码顺序在第一类型帧之后,显示顺序在第一类型帧之前的帧均参考第一类型帧之前的长期参考图像。所有第二类型帧均参考随机访问点之前的长期参考图像,可以最大限度地提高编码效率。In a specific embodiment of the present application, after S830 completes the inter-frame encoding of at least one second type frame of the N second type frames, replacing the currently used long-term reference image may include: after completing the After inter-coding of all second-type frames in the N second-type frames, the currently used long-term reference image is replaced. That is, all the coding sequences are after the first type frame, and the frames in the display order before the first type frame refer to the long-term reference image before the first type frame. All the second type frames refer to the long-term reference image before the random access point, which can maximize the coding efficiency.
本申请另一个实施例的编码方法可以包括如下步骤。对第一类型帧进行 帧内编码,其中,按编码顺序,第一类型帧之前存在进行帧间编码的第三类型帧(可以是一帧或多帧),所述第一类型帧之后存在显示顺序在所述第一类型帧之前的需要进行帧间编码的N个第二类型帧,所述第三类型帧参考长期参考图像进行编码。以所述长期参考图像为基础,对N个第二类型帧中的至少一个第二类型帧进行帧间编码。The encoding method according to another embodiment of the present application may include the following steps. Intra-frame encoding of the first type of frame, in which, according to the encoding order, there is a third type of frame (which may be one or more frames) for inter-frame encoding before the first type of frame, and there is a display after the first type of frame N second type frames that need to be inter-frame coded before the first type frame, and the third type frame is encoded with reference to a long-term reference image. Based on the long-term reference image, inter-frame encoding is performed on at least one second-type frame of the N second-type frames.
至少一个第二类型帧可以参考随机访问点之前的长期参考图像,即至少一个第二类型帧以参考随机访问点之前的长期参考图像为基础。N个第二类型帧中除至少一个第二类型帧以外的其他第二类型帧参考替换后的新的长期参考图像,例如参考随机访问点之后的长期参考图像。At least one second type frame may reference a long-term reference image before the random access point, that is, at least one second type frame is based on the long-term reference image before the random access point. The second type frames other than at least one second type frame in the N second type frames refer to the new long-term reference image after replacement, for example, the long-term reference image after the random access point.
进一步地,可以以参考随机访问点之前的长期参考图像为基础,对N个第二类型帧中所有的第二类型帧进行帧间编码。Further, based on the long-term reference image before the random access point is referenced, all the second type frames of the N second type frames may be inter-frame coded.
在本申请的一些实施例中,按编码顺序所述第一类型帧之前存在需要进行帧间编码的第三类型帧。S820基于长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间编码,可以包括:基于所述第三类型帧进行帧间编码后所更新的长期参考图像,对所述N个第二类型帧中的至少一个第二类型帧进行帧间编码。其中,所更新的长期参考图像,可以是在所述第三类型帧进行帧间编码之后基于所述第三类型帧的特定图像块更新的;或者,可以是在所述第三类型帧的特定图像块进行帧间编码之后,基于所述特定图像块更新的。可选地,第三类型帧在所述第一类型帧之前显示。In some embodiments of the present application, there is a third type frame that needs to be inter-frame encoded before the first type frame in the coding order. S820 Inter-coding at least one second type frame of the N second type frames based on the long-term reference image may include: updating the long-term reference image after inter-frame coding based on the third type frame, and At least one second type frame of the N second type frames is inter-frame coded. The updated long-term reference image may be updated based on a specific image block of the third type frame after the third type frame is inter-coded; or, it may be a specific image block of the third type frame. After the image block is inter-coded, it is updated based on the specific image block. Optionally, the third type frame is displayed before the first type frame.
在本申请一个具体的实施例中,第一类型帧之前的长期参考图像可以是经过第一类型帧之前的一帧或多帧已编码图像更新后的长期参考图像。该长期参考图像可以是以例如第一类型帧之前的长期参考图像为基础的。该第一类型帧之前的长期参考图像可以被不断更新,例如是经过第三类型帧中的一帧或多帧已编码图像更新后的长期参考图像,在本文中更新后的第一类型帧之前的长期参考图像仍被称为第一类型帧之前的长期参考图像。In a specific embodiment of the present application, the long-term reference image before the first-type frame may be an updated long-term reference image after one or more frames of the encoded image before the first-type frame. The long-term reference picture may be based on, for example, a long-term reference picture before a first type of frame. The long-term reference image before the first type of frame can be continuously updated, for example, the long-term reference image after one or more encoded images in the third type of frame is updated before the first type of frame updated in this document. The long-term reference picture is still referred to as the long-term reference picture before the first type of frame.
在本申请的一些实施例中,基于长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间编码,并通过第二类型帧中的一帧或多帧已编码图像更新长期参考图像,以供后续待编码的帧参考。In some embodiments of the present application, at least one second type frame of the N second type frames is inter-frame encoded based on the long-term reference image, and one or more frames in the second type frame have been encoded. The image updates the long-term reference image for reference to subsequent frames to be encoded.
在一个具体的实施例中,S820基于长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间编码,可以包括:基于长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间编码,在至少部分第 二类型帧完成编码时,使用所述完成编码的至少部分第二类型帧中的特定图像块更新长期参考图像,以所述更新后的长期参考图像作为下一个第二类型帧的长期参考图像。In a specific embodiment, S820 performs inter-frame encoding on at least one second type frame of the N second type frames based on the long-term reference image, which may include: performing the N second type based on the long-term reference image. At least one second-type frame in the frame is inter-coded, and when at least a portion of the second-type frame completes encoding, the long-term reference image is updated by using a specific image block in the at least part of the second-type frame that has been encoded, The updated long-term reference picture is used as the long-term reference picture of the next type 2 frame.
在一个具体的实施例中,S820基于长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间编码,可以包括:基于长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间编码,在至少部分第二类型帧的特定图像块完成编码时,使用所述完成编码的特定图像块更新长期参考图像,以所述更新后的长期参考图像作为下一个第二类型帧的长期参考图像或作为所述当前第二类型帧的长期参考图像。In a specific embodiment, S820 performs inter-frame encoding on at least one second type frame of the N second type frames based on the long-term reference image, which may include: performing the N second type based on the long-term reference image. At least one second-type frame in the frame is inter-coded. When encoding is performed on at least a part of the specific image block of the second-type frame, the long-term reference image is updated by using the specific image block that has been encoded, and the updated long-term reference image is used. The reference image is used as a long-term reference image of the next frame of the second type or as a long-term reference image of the current frame of the second type.
在本申请的一些实施例中,替换当前使用的长期参考图像,可以包括:以所述第一类型帧的重建图像替换当前使用的长期参考图像。In some embodiments of the present application, replacing the currently used long-term reference image may include: replacing the currently used long-term reference image with the reconstructed image of the first type frame.
在一个具体的实施例中,所述替换当前使用的长期参考图像,可以包括:在完成对所述第一类型帧的编码后,将所述第一类型帧的重建图像放入参考图像缓冲区中;在完成对所述N个第二类型帧中的至少一个第二类型帧的帧间编码后,将所述第一类型帧的重建图像从所述参考图像缓冲区中输出,以所述第一类型帧的重建图像替换当前使用的长期参考图像。即可以将第一类型帧的重建图像放入参考图像缓冲区中,作为短期参考图像并一直保存。在完成对至少一个第二类型帧的帧间编码后,将第一类型帧的重建图像从所述参考图像缓冲区中输出,作为编码过程中新的长期参考图像。In a specific embodiment, replacing the currently used long-term reference image may include: after completing encoding the first type frame, placing the reconstructed image of the first type frame into a reference image buffer Medium; after completing inter-frame encoding of at least one second type frame of the N second type frames, outputting a reconstructed image of the first type frame from the reference image buffer, and using the The reconstructed image of the first type of frame replaces the currently used long-term reference image. That is, the reconstructed image of the first type of frame may be put into a reference image buffer, and used as a short-term reference image and stored all the time. After the inter-frame encoding of at least one frame of the second type is completed, the reconstructed image of the frame of the first type is output from the reference image buffer as a new long-term reference image in the encoding process.
在一个具体的实施例中,所述将所述第一类型帧的重建图像放入参考图像缓冲区中,可以包括:当所述参考图像缓冲区中不存在所述第一类型帧的重建图像时,将所述第一类型帧的重建图像放入所述参考图像缓冲区中。即在将所述第一类型帧的重建图像放入参考图像缓冲区之前,可以判断参考图像缓冲区中是否存在第一类型帧的重建图像。当参考图像缓冲区中不存在第一类型帧的重建图像时,将第一类型帧的重建图像放入参考图像缓冲区中。In a specific embodiment, placing the reconstructed image of the first type frame in a reference image buffer may include: when the reconstructed image of the first type frame does not exist in the reference image buffer When the reconstructed image of the first type frame is placed in the reference image buffer. That is, before putting the reconstructed image of the first type frame into the reference image buffer, it can be determined whether there is a reconstructed image of the first type frame in the reference image buffer. When the reconstructed image of the first type frame does not exist in the reference image buffer, the reconstructed image of the first type frame is placed in the reference image buffer.
在本申请的一些实施例中,按编码顺序所述第一类型帧之后存在需要进行帧间编码的第四类型帧,所述第四类型帧的显示顺序在所述第一类型帧之后。所述编码方法还可以包括:以所述替换后的长期参考图像为长期参考图像的基础,对所述第四类型帧进行帧间编码。In some embodiments of the present application, there is a fourth type frame that needs to be inter-frame encoded after the first type frame in the coding order, and the display order of the fourth type frame is after the first type frame. The encoding method may further include: performing inter-frame encoding on the fourth type frame based on the replaced long-term reference image as a basis for the long-term reference image.
可选地,第四类型帧可以包括一帧或多帧。Optionally, the fourth type frame may include one frame or multiple frames.
可选地,可以参考替换后的长期参考图像,对第四类型帧进行帧间编码。 或者,在第四类型帧包括多帧时,可以基于替换后的长期参考图像对多个第四类型帧中的一帧或多帧进行帧间编码,并通过第四类型帧中的一帧或多帧已编码图像更新该长期参考图像,以供后续待编码的帧参考。Optionally, the fourth type frame may be inter-coded with reference to the replaced long-term reference image. Alternatively, when the fourth type frame includes multiple frames, one or more frames of multiple fourth type frames may be inter-frame-coded based on the replaced long-term reference image, and a frame or The multi-frame encoded image updates the long-term reference image for reference of subsequent frames to be encoded.
在一个具体的实施例中,可以基于替换后的长期参考图像对多个第四类进行帧间编码,在每个第四类型帧完成编码时,使用完成编码的第四类型帧更新该长期参考图像,以所述更新后的长期参考图像作为下一个第四类型帧的长期参考图像。In a specific embodiment, multiple fourth types may be inter-coded based on the replaced long-term reference image, and when each fourth-type frame is encoded, the long-term reference is updated using the fourth-type frame that has been encoded. An image, using the updated long-term reference image as a long-term reference image of a next fourth type frame.
在一个具体的实施例中,所述第一类型帧进行编码之后,以及按编码顺序所述第一类型帧的下一帧编码之前,所述长期参考图像保持不变。In a specific embodiment, the long-term reference image remains unchanged after the first type frame is encoded and before the next frame of the first type frame is encoded in the encoding order.
在一个具体的实施例中,在更新长期参考图像是,是在对所述第一类型帧以外的至少部分图像帧编码之后,基于所述图像帧中的部分图像块对所述长期参考图像中的部分图像块进行更新;或者,在对所述第一类型帧以外的至少部分图像帧中的特定图像块编码之后,基于所述特定图像块对所述长期参考图像中的部分图像块进行更新。In a specific embodiment, after updating the long-term reference image, after encoding at least part of the image frames other than the first type frame, the long-term reference image is based on the partial image blocks in the image frame. Update part of the image blocks in the image; or, after encoding specific image blocks in at least part of the image frames other than the first type frame, update part of the image blocks in the long-term reference image based on the specific image block .
图9是本申请一个实施例的编码方法900的示意性流程图。如图9所示,方法900包括以下步骤。FIG. 9 is a schematic flowchart of an encoding method 900 according to an embodiment of the present application. As shown in FIG. 9, the method 900 includes the following steps.
S910,对第一类型帧(例如为随机访问点)进行编码。S910. Encode a first type frame (for example, a random access point).
S920,在对第一类型帧(例如为随机访问点)进行编码之后,还存在若干显示顺序在第一类型帧之前的第二类型帧需要处理。在对第二类型帧进行编码时,保持并继续维护参考图像缓冲区(短期参考图像缓冲区),并使至少一个第二类型帧在编码时参考第一类型帧之前(包括第三类型帧,还可以包括第一类型帧)所使用的长期参考图像。S920. After encoding the first type frame (for example, a random access point), there are still several second type frames that need to be processed before the first type frame. When encoding the second type frame, maintain and continue to maintain the reference image buffer (short-term reference image buffer), and make at least one second type frame refer to the first type frame (including the third type frame, Long-term reference images used by the first type of frame) may also be included.
S930,剩余的第二类型帧和/或第二类型帧之后的第四类型帧在编码时参考第一类型帧的重建图像构造的长期参考图像。S930. The remaining second-type frame and / or the fourth-type frame after the second-type frame refer to the long-term reference image constructed by referring to the reconstructed image of the first-type frame during encoding.
S940,编码完所有的第二类型帧后,对参考图像缓冲区进行维护,删除所有显示顺序在第一类型帧之前的短期参考图像。S940. After encoding all the frames of the second type, the reference image buffer is maintained, and all short-term reference images whose display order precedes the frames of the first type are deleted.
在编码的过程中,可以不断对长期参考图像进行更新。During the encoding process, long-term reference images can be continuously updated.
一种可选的实现方式中,在对这些第二类型帧进行编码时,保持并继续维护参考图像缓冲区(短期参考图像缓冲区),并使所有第二类型帧在编码时参考第一类型帧之前(包括第三类型帧,还可以包括第一类型帧)所使用的长期参考图像。其中,编码完所有的第二类型帧后,对参考图像缓冲区进 行维护,删除所有显示顺序在第一类型帧之前的短期参考图像。用第一类型帧的重建图像构造的长期参考图像替换原长期参考图像。第二类型帧之后的第四类型帧在编码时参考第一类型帧的重建图像构造的长期参考图像。在编码的过程中,可以不断对长期参考图像进行更新。In an optional implementation manner, when encoding these second-type frames, maintain and continue to maintain a reference image buffer (short-term reference image buffer), and make all second-type frames refer to the first type when encoding. The long-term reference image used before the frame (including the third type frame and may also include the first type frame). Among them, after encoding all the second type frames, the reference image buffer is maintained, and all short-term reference images whose display order precedes the first type frames are deleted. Replace the original long-term reference image with the long-term reference image constructed from the reconstructed image of the first type of frame. The fourth type frame after the second type frame refers to the long-term reference image constructed by referring to the reconstructed image of the first type frame when encoding. During the encoding process, long-term reference images can be continuously updated.
下面以具体的视频序列编码来说明本申请实施例的编码方法。The following uses specific video sequence coding to describe the coding method in the embodiment of the present application.
一个例子中,编码序列为I0 P8 B4 B2 B1 B3 B6 B5 B7 I16 B12 B10 B9 B11 B14 B13 B15 P24 B20 B18 B17 B19 B22 B21 B23…In one example, the coding sequence is I0, P8, B4, B2, B1, B6, B5, B7, I16, B12, B10, B9, B11, B14, B13, B15, P24, B20, B18, B17, B19, B19, B21, B23 ...
其中,I0和I16为并且为随机访问点。假设I16为第一类型帧,那么B12 B10 B9 B11 B14 B13 B15为第二类型帧,P8 B4 B2 B1 B3 B6 B5 B7等均可以视为第三类型帧,P24 B20 B18 B17 B19 B22 B21 B23…为第四类型帧。Among them, I0 and I16 are and are random access points. Assuming I16 is the first type frame, then B12, B10, B9, B14, B13, B13, B15 are the second type frame, P8, B4, B2, B1, B3, B6, B5, B7, etc. can be regarded as the third type frame, P24, B20, B18, B17, B19, B19, B21, B21, B23 ... Fourth type frame.
在完成I0的编码之后,将I0的重建图像构放入参考图像缓冲区,由于I0之后不存在显示顺序在I0之前的帧,参考图像缓冲区中不存在显示顺序在I0以前的帧,使用参考图像缓冲区中I0的重建图像构造长期参考图像,继续对显示顺序在I0之后的P8 B4 B2 B1 B3 B6 B5 B7进行编码,并且更新参考图像缓冲区和I0的重建图像构造的长期参考图像。After the encoding of I0 is completed, the reconstructed image structure of I0 is placed in the reference image buffer. Since there is no frame after I0 in the display order before I0, there is no frame in the reference image buffer before the display order. Use the reference The reconstructed image of I0 in the image buffer constructs a long-term reference image, and continues to encode P8, B4, B1, B3, B6, B5, and B7 after the display order of I0, and updates the reference image buffer and the long-term reference image of the reconstructed image of I0.
在完成I16的编码之后,将I16的重建图像放入参考图像缓冲区,继续对显示顺序在I16以前的B12 B10 B9 B11 B14 B13 B15进行编码。这些第二类型帧参考的长期参考图像为I0的重建图像构造的长期参考图像,并且在每完成每一个第二类型帧的编码后,可以根据已编码的第二类型帧更新I0的重建图像构造的长期参考图像。完成B15的编码之后,后续没有显示顺序在I16之前的帧,此时将参考图像缓冲区中的I16的重建图像输出,作为新的长期参考图像,即用I16的重建图像构造的长期参考图像替换I0的重建图像构造的长期参考图像。将参考图像缓冲区中显示顺序在I16之前的所有短期参考图像都清除。之后继续对P24 B20 B18 B17 B19 B22 B21 B23…进行编码,并且更新参考图像缓冲区和I16的重建图像构造的长期参考图像。After I16 encoding is completed, the reconstructed image of I16 is placed in the reference image buffer, and B12, B9, B11, B14, B13, and B15 before the display order of I16 continue to be encoded. These long-term reference images referenced by the second type frames are long-term reference images constructed by the reconstructed image of I0, and after each encoding of the second type frame is completed, the reconstructed image structure of I0 can be updated according to the encoded second-type frames. Long-term reference image. After the encoding of B15 is completed, the subsequent frames before I16 are not displayed. At this time, the reconstructed image of I16 in the reference image buffer is output as a new long-term reference image, that is, the long-term reference image constructed by the reconstructed image of I16 is replaced. The reconstructed image of I0 constructs a long-term reference image. Clear all short-term reference images in the reference image buffer before the display order I16. Then continue to encode P24, B20, B18, B17, B19, B21, B21, B23 ..., and update the reference image buffer and the long-term reference image constructed by the reconstructed image of I16.
另一个例子中,编码序列为I0 P8 B4 B2 B1 B3 B6 B5 B7 I16 B12 B10 B9 B11 B14 B13 B15 P24 B20 B18 B17 B19 B22 B21 B23…In another example, the coding sequence is I0, P8, B4, B2, B1, B6, B5, B7, I16, B12, B10, B9, B11, B14, B13, B15, P24, B20, B18, B17, B19, B19, B21, B23 ...
其中,I0和I16为并且为随机访问点。假设I16为第一类型帧,那么B12 B10 B9 B11 B14B13 B15为第二类型帧,P8 B4 B2 B1 B3 B6 B5 B7等均可以视为第三类型帧,P24 B20 B18 B17 B19 B22 B21 B23…为第四类型帧。Among them, I0 and I16 are and are random access points. Assuming I16 is the first type frame, then B12, B10, B9, B11, B14B13, B15 are the second type frame, P8, B4, B2, B3, B6, B5, B7, etc. can all be regarded as the third type frame, P24, B20, B18, B17, B19, B19, B22, B21, B23 ... Four types of frames.
在完成I0的编码之后,将I0的重建图像构放入参考图像缓冲区,由于 I0之后不存在显示顺序在I0之前的帧,参考图像缓冲区中不存在显示顺序在I0以前的帧,使用参考图像缓冲区中I0的重建图像构造长期参考图像,继续对显示顺序在I0之后的P8 B4 B2 B1 B3 B6 B5 B7进行编码,并且更新参考图像缓冲区和I0的重建图像构造的长期参考图像。After the encoding of I0 is completed, the reconstructed image structure of I0 is placed in the reference image buffer. Since there is no frame after I0 in the display order before I0, there is no frame in the reference image buffer before the display order. The reconstructed image of I0 in the image buffer constructs a long-term reference image, and continues to encode P8, B4, B1, B3, B6, B5, and B7 after the display order of I0, and updates the reference image buffer and the long-term reference image of the reconstructed image of I0.
在完成I16的编码之后,将I16的重建图像放入参考图像缓冲区,继续对显示顺序在I16以前的一部分第二类型帧B12 B10 B9 B11进行编码。这些第二类型帧参考的长期参考图像为I0的重建图像构造的长期参考图像,并且在每完成一个第二类型帧的编码后,可以根据已编码的第二类型帧更新I0的重建图像构造的长期参考图像。完成B11的编码之后,将参考图像缓冲区中的I16的重建图像输出,作为新的长期参考图像,即用I16的重建图像构造的长期参考图像替换I0的重建图像构造的长期参考图像。另一部分第二类型帧B14 B13 B15可以参考I16的重建图像(I16的重建图像构造的长期参考图像)进行编码。在一些实施例中,还对指示码流中哪一帧开始为该另一部分第二类型帧的标识进行编码,或者,编解码段均默认设置开始为该另一部分第二类型帧的第一帧。在每完成一个第二类型帧的编码后,可以根据已编码的第二类型帧更新I16的重建图像构造的长期参考图像。在完成B15的编码后,将参考图像缓冲区中显示顺序在I16之前的所有短期参考图像都清除。将参考图像缓冲区中的I16的重建图像输出,作为新的长期参考图像,即用I16的重建图像构造的长期参考图像再次替换I0的重建图像构造的长期参考图像。之后继续对P24 B20 B18 B17 B19 B22 B21 B23…进行编码,并且更新参考图像缓冲区和I16的重建图像构造的长期参考图像。After the encoding of I16 is completed, the reconstructed image of I16 is placed in the reference image buffer, and a portion of the second type frames B12, B10, B9, and B11 that are displayed before I16 are continued to be encoded. These long-term reference images referenced by the second type frame are long-term reference images constructed by the reconstructed image of I0, and after each encoding of the second type frame is completed, the reconstructed image structure of I0 may be updated according to the encoded second-type frame. Long-term reference image. After the encoding of B11 is completed, the reconstructed image of I16 in the reference image buffer is output as a new long-term reference image, that is, the long-term reference image of the reconstructed image of I0 is replaced with the long-term reference image of the reconstructed image of I16. Another part of the second type frame B14, B13, and B15 can be encoded with reference to the reconstructed image of I16 (the long-term reference image constructed by the reconstructed image of I16). In some embodiments, an identifier indicating which frame in the code stream starts to be another part of the second type frame is also encoded, or the codec segment is set to start as the first frame of the other part of the second type frame by default. . After each encoding of the second type frame is completed, the long-term reference image constructed by the reconstructed image of I16 may be updated according to the encoded second type frame. After the encoding of B15 is completed, all short-term reference images whose display order is before I16 in the reference image buffer are cleared. The reconstructed image of I16 in the reference image buffer is output as a new long-term reference image, that is, the long-term reference image constructed by the reconstructed image of I16 is replaced with the long-term reference image constructed by the reconstructed image of I16 again. Then continue to encode P24, B20, B18, B17, B19, B21, B21, B23 ..., and update the reference image buffer and the long-term reference image constructed by the reconstructed image of I16.
再从解码端角度详细说明本申请实施例的解码方法。The decoding method in the embodiment of the present application will be described in detail from the perspective of the decoding end.
图10是本申请一个实施例的在随机访问点处的解码方法1000的示意性流程图。如图10所示,解码方法1000包括以下步骤。FIG. 10 is a schematic flowchart of a decoding method 1000 at a random access point according to an embodiment of the present application. As shown in FIG. 10, the decoding method 1000 includes the following steps.
S1010,判断在随机访问点处是否使用随机访问功能。在使用随机访问功能时,执行1200进行解码;在不使用随机访问功能时,执行1100进行解码。S1010: Determine whether the random access function is used at the random access point. When using the random access function, execute 1200 for decoding; when not using the random access function, execute 1100 for decoding.
1100和1200的具体步骤在下文中展开。完成1100或1200后执行S1020。The specific steps for 1100 and 1200 are expanded below. After completing 1100 or 1200, execute S1020.
S1020,继续对后续的帧进行解码。S1020. Continue to decode subsequent frames.
图11是本申请一个实施例的在随机访问点处的解码方法1100的示意性流程图。如图11所示,1100可以包括以下步骤。FIG. 11 is a schematic flowchart of a decoding method 1100 at a random access point according to an embodiment of the present application. As shown in FIG. 11, 1100 may include the following steps.
S1110,对第一类型帧进行解码,其中,按解码顺序第一类型帧之后存在需要进行帧间解码的N个第二类型帧,N个第二类型帧的显示顺序在第一类型帧之前,其中,N为正整数。S1110. Decode the first type frame. In the decoding order, there are N second type frames that need to be inter-frame decoded after the first type frame. The display order of the N second type frames is before the first type frame. Where N is a positive integer.
S1120,根据长期参考图像对N个第二类型帧中的至少一个第二类型帧进行帧间解码。S1120: Inter-frame decode at least one second type frame of the N second type frames according to the long-term reference image.
S1130,在完成N个第二类型帧中的至少一个第二类型帧的帧间解码后,替换当前使用的长期参考图像。S1130: After completing inter-frame decoding of at least one second type frame among the N second type frames, replace the currently used long-term reference image.
本申请实施例的编码方法,在完成解码顺序在第一类型帧之后、显示顺序在第一类型帧之前的N个第二类型帧中的至少一个第二类型帧的帧间编码后,才替换当前使用的长期参考图像,使得至少一个第二类型帧可以参考第一类型帧之前的长期参考图像,可以提高解码效率。The encoding method in the embodiment of the present application is only replaced after completing the inter-frame encoding of at least one second-type frame among the N second-type frames in which the decoding order is after the first-type frame and the display order is before the first-type frame. The currently used long-term reference picture enables at least one second-type frame to reference the long-term reference picture before the first-type frame, which can improve decoding efficiency.
在一些实施例中,所述第一类型帧即为随机访问点。In some embodiments, the first type frame is a random access point.
在一些实施例中,所述第一类型帧为清除随机访问点。In some embodiments, the first type of frame is a clear random access point.
在一些实施例中,S1130在完成所述N个第二类型帧中的至少一个第二类型帧的帧间解码后,替换当前使用的长期参考图像,可以包括:在完成所述N个第二类型帧中的所有第二类型帧的帧间解码后,替换当前使用的长期参考图像。In some embodiments, after completing the inter-frame decoding of at least one second type frame of the N second type frames, S1130 replacing the currently used long-term reference image may include: after completing the N second type frames, After the inter-frame decoding of all the frames of the second type in the type frame, the currently used long-term reference image is replaced.
在一些实施例中,所述替换当前使用的长期参考图像,可以包括:以所述第一类型帧的重建图像替换当前使用的长期参考图像。In some embodiments, the replacing the currently used long-term reference image may include: replacing the currently used long-term reference image with the reconstructed image of the first type frame.
在一些实施例中,所述替换当前使用的长期参考图像,包括:在完成对所述第一类型帧的解码后,将所述第一类型帧的重建图像放入参考图像缓冲区中;在完成对所述N个第二类型帧中的至少一个第二类型帧的帧间解码后,将所述第一类型帧的重建图像从所述参考图像缓冲区中输出,以所述第一类型帧的重建图像替换当前使用的长期参考图像。In some embodiments, replacing the currently used long-term reference image includes: after the decoding of the first type frame is completed, placing the reconstructed image of the first type frame into a reference image buffer; After completing inter-frame decoding of at least one second type frame among the N second type frames, output the reconstructed image of the first type frame from the reference image buffer to the first type The reconstructed image of the frame replaces the currently used long-term reference image.
在一些实施例中,所述将所述第一类型帧的重建图像放入参考图像缓冲区中,可以包括:当所述参考图像缓冲区中不存在所述第一类型帧的重建图像时,将所述第一类型帧的重建图像放入所述参考图像缓冲区中。In some embodiments, placing the reconstructed image of the first type frame in a reference image buffer may include: when the reconstructed image of the first type frame does not exist in the reference image buffer, Placing the reconstructed image of the first type of frame into the reference image buffer.
在一些实施例中,按解码顺序所述第一类型帧之前存在需要进行帧间解码的第三类型帧,所述根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间解码,可以包括:根据所述第三类型帧进行帧间解码后所更新的长期参考图像,对所述N个第二类型帧中的至少一个第二类型帧 进行帧间解码。In some embodiments, there is a third type frame that needs to be inter-frame decoded before the first type frame in the decoding order, and the at least one second type of the N second type frames is based on the long-term reference image. Inter-frame decoding of a frame may include: performing inter-frame decoding on at least one second-type frame of the N second-type frames according to the long-term reference image updated after inter-frame decoding of the third-type frame.
在一些实施例中,所述第三类型帧可以在所述第一类型帧之前显示。In some embodiments, the third type frame may be displayed before the first type frame.
在一些实施例中,按解码顺序所述第一类型帧之后存在需要进行帧间解码的第四类型帧,所述第四类型帧的显示顺序在所述第一类型帧之后,所述解码方法还包括:根据所述替换后的长期参考图像对所述第四类型帧进行帧间解码。In some embodiments, there is a fourth type frame that needs to be inter-frame decoded after the first type frame in the decoding order, the display order of the fourth type frame is after the first type frame, and the decoding method It also includes: performing inter-frame decoding on the fourth type frame according to the replaced long-term reference image.
在一些实施例中,所述所更新的长期参考图像,是在所述第三类型帧进行帧间解码之后基于所述第三类型帧的特定图像块更新的;或者,所述所更新的长期参考图像,是在所述第三类型帧的特定图像块进行帧间解码之后,基于所述特定图像块更新的。In some embodiments, the updated long-term reference image is updated based on a specific image block of the third-type frame after inter-frame decoding of the third-type frame; or, the updated long-term reference image is updated. The reference image is updated based on the specific image block after inter-frame decoding of the specific image block of the third type frame.
在一些实施例中,所述根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间解码,包括:根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间解码,在至少部分第二类型帧完成解码时,使用所述完成解码的至少部分第二类型帧中的特定图像块更新长期参考图像,以所述更新后的长期参考图像作为下一个第二类型帧的长期参考图像;或者,根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间解码,在至少部分第二类型帧的特定图像块完成解码时,使用所述完成解码的特定图像块更新长期参考图像,以所述更新后的长期参考图像作为下一个第二类型帧的长期参考图像或作为所述当前第二类型帧的长期参考图像。In some embodiments, performing inter-frame decoding on at least one second type frame of the N second type frames according to a long-term reference image includes: Perform inter-frame decoding on at least one second type of frame, and when at least part of the second type of frame is decoded, use the specific image block in the at least part of the second type of frame that has been decoded to update the long-term reference image, The long-term reference image of the second-type frame as the long-term reference image of the next type; or, at least one second-type frame of the N second-type frames is inter-frame decoded according to the long-term reference image. When a specific image block of a frame is decoded, the long-term reference image is updated using the decoded specific image block, and the updated long-term reference image is used as a long-term reference image of the next second type frame or as the current second Long-term reference image of a type frame.
在一些实施例中,所述第一类型帧进行解码之后,以及按解码顺序所述第一类型帧的下一帧解码之前,所述长期参考图像保持不变。In some embodiments, the long-term reference image remains unchanged after the first type frame is decoded and before the next frame of the first type frame is decoded in decoding order.
在一些实施例中,所述方法还包括:在对所述第一类型帧以外的至少部分图像帧解码之后,基于所述图像帧中的部分图像块对所述长期参考帧中的部分图像块进行更新;或者,在对所述第一类型帧以外的至少部分图像帧中的特定图像块解码之后,基于所述特定图像块对所述长期参考帧中的部分图像块进行更新。In some embodiments, the method further comprises: after decoding at least a part of the image frames other than the first type frame, based on a part of the image blocks in the image frame, the part of the image blocks in the long-term reference frame Update; or, after decoding a specific image block in at least a part of the image frame other than the first type frame, update a part of the image block in the long-term reference frame based on the specific image block.
其中,解码方法1100的具体实现可以与编码方法800的具体实现相对应,此处不再进行赘述。The specific implementation of the decoding method 1100 may correspond to the specific implementation of the encoding method 800, and details are not described herein again.
下面以具体的视频序列编码来说明本申请实施例的不使用随机访问功能的解码方法1100。The following uses specific video sequence coding to describe the decoding method 1100 in the embodiment of the present application without using a random access function.
一个例子中,解码序列为I0 P8 B4 B2 B1 B3 B6 B5 B7 I16 B12 B10 B9 B11 B14 B13 B15 P24 B20 B18 B17 B19 B22 B21 B23…In one example, the decoding sequence is I0, P8, B4, B2, B1, B6, B5, B7, I16, B12, B10, B9, B11, B14, B13, B15, P24, B20, B18, B17, B19, B19, B21, B23 ...
其中,I0和I16为并且为随机访问点。假设I16为第一类型帧,那么B12 B10 B9 B11 B14 B13 B15为第二类型帧,P8 B4 B2 B1 B3 B6 B5 B7等均可以视为第三类型帧,P24 B20 B18 B17 B19 B22 B21 B23…为第四类型帧。Among them, I0 and I16 are and are random access points. Assuming I16 is the first type frame, then B12, B10, B9, B14, B13, B13, B15 are the second type frame, P8, B4, B2, B1, B3, B6, B5, B7, etc. can be regarded as the third type frame, P24, B20, B18, B17, B19, B19, B21, B21, B23 ... Fourth type frame.
在完成I0的解码之后,将I0的重建图像构放入参考图像缓冲区,由于I0之后不存在显示顺序在I0之前的帧,参考图像缓冲区中不存在显示顺序在I0以前的帧,使用参考图像缓冲区中I0的重建图像构造长期参考图像,继续对显示顺序在I0之后的P8 B4 B2 B1 B3 B6 B5 B7进行解码,并且更新参考图像缓冲区和I0的重建图像构造的长期参考图像。After the decoding of I0 is completed, the reconstructed image structure of I0 is placed in the reference image buffer. Since there is no frame after I0 in the display order before I0, there is no frame in the reference image buffer before the display order. Use the reference The reconstructed image of I0 in the image buffer constructs a long-term reference image, and continues to decode P8, B2, B1, B3, B6, B5, and B7 after the display order of I0, and updates the long-term reference image constructed by the reference image buffer and the reconstructed image of I0.
在完成I16的解码之后,将I16的重建图像放入参考图像缓冲区,继续对显示顺序在I16以前的B12 B10 B9 B11 B14 B13 B15进行解码。这些第二类型帧参考的长期参考图像为第三类型帧所参考的长期参考图像,并且在每完成每一个第二类型帧的解码后,可以根据已解码的第二类型帧更新该长期参考图像。完成B15的解码之后,后续没有显示顺序在I16之前的帧,此时将参考图像缓冲区中的I16的重建图像输出,作为新的长期参考图像,即用I16的重建图像构造的长期参考图像替换当前长期参考图像。将参考图像缓冲区中显示顺序在I16之前的所有短期参考图像都清除。之后继续对P24 B20 B18 B17 B19 B22 B21 B23…进行解码,并且更新参考图像缓冲区和I16的重建图像所替换的长期参考图像。After completing the decoding of I16, put the reconstructed image of I16 into the reference image buffer, and continue to decode B12, B9, B11, B14, B14, B13 and B15 before the display order of I16. These long-term reference pictures referenced by the second type frame are long-term reference pictures referenced by the third type frame, and after each decoding of the second type frame is completed, the long-term reference image may be updated according to the decoded second type frame. . After the decoding of B15 is completed, the subsequent frames before I16 are not displayed. At this time, the reconstructed image of I16 in the reference image buffer is output as a new long-term reference image, that is, the long-term reference image constructed by the reconstructed image of I16 is replaced. The current long-term reference image. Clear all short-term reference images in the reference image buffer before the display order I16. Then continue to decode P24, B20, B18, B19, B22, B21, B23 ..., and update the long-term reference image replaced by the reference image buffer and the reconstructed image of I16.
另一个例子中,解码序列为I0 P8 B4 B2 B1 B3 B6 B5 B7 I16 B12 B10 B9 B11 B14 B13 B15 P24 B20 B18 B17 B19 B22 B21 B23…In another example, the decoding sequence is I0, P8, B4, B2, B1, B6, B5, B7, I16, B12, B10, B9, B11, B14, B13, B15, P24, B20, B18, B17, B19, B19, B21, B23 ...
其中,I0和I16为并且为随机访问点。假设I16为第一类型帧,那么B12 B10 B9 B11B14 B13 B15为第二类型帧,P8 B4 B2 B1 B3 B6 B5 B7等均可以视为第三类型帧,P24 B20 B18 B17 B19 B22 B21 B23…为第四类型帧。Among them, I0 and I16 are and are random access points. Assuming I16 is the first type frame, then B12, B10, B9, B11B14, B13, B15 are the second type frame, P8, B4, B2, B3, B6, B5, B7, etc. can all be regarded as the third type frame, P24, B20, B18, B17, B19, B19, B22, B21, B23 ... Four types of frames.
在完成I0的解码之后,将I0重建图像构放入参考图像缓冲区,由于I0之后不存在显示顺序在I0之前的帧,参考图像缓冲区中不存在显示顺序在I0以前的帧,使用参考图像缓冲区中I0的重建图像构造长期参考图像,继续对显示顺序在I0之后的P8 B4 B2 B1 B3 B6 B5 B7进行解码,并且更新参考图像缓冲区和I0的重建图像构造的长期参考图像。After completing the decoding of I0, the reconstructed image of I0 is placed in the reference image buffer. Since there is no frame after I0 in the display order before I0, there is no frame in the reference image buffer before the display order. Use the reference image The reconstructed image of I0 in the buffer constructs a long-term reference image, and continues to decode P8, B2, B1, B3, B6, B5, B7, and B7 after the display order of I0, and updates the long-term reference image constructed by the reference image buffer and the reconstructed image of I0.
在完成I16的解码之后,将I16的重建图像放入参考图像缓冲区,继续 对显示顺序在I16以前的一部分第二类型帧B12 B10 B9 B11进行解码。这些第二类型帧参考的长期参考图像为I0的重建图像构造的长期参考图像,并且在每完成一个第二类型帧的解码后,可以根据已解码的第二类型帧更新I0的重建图像构造的长期参考图像。完成B11的解码之后,将参考图像缓冲区中的I16的重建图像输出,作为新的长期参考图像,即用I16的重建图像构造的长期参考图像替换I0的重建图像构造的长期参考图像。另一部分第二类型帧B14 B13 B15可以参考I16的重建图像(I16的重建图像构造的长期参考图像)进行解码。并且在每完成一个第二类型帧的解码后,可以根据已解码的第二类型帧更新I16的重建图像构造的长期参考图像。在完成B15的解码后,将参考图像缓冲区中显示顺序在I16之前的所有短期参考图像都清除,并再次采用I16的重建图像替换当前长期参考图像。之后继续对P24 B20 B18 B17 B19 B22 B21 B23…进行解码,并且更新参考图像缓冲区和I16的重建图像构造的长期参考图像。After the decoding of I16 is completed, the reconstructed image of I16 is placed in the reference image buffer, and a part of the second type frames B12, B10, B9, and B11 displayed before I16 are continued to be decoded. These long-term reference images referenced by the second type frame are long-term reference images constructed by the reconstructed image of I0, and after each decoding of the second type frame is completed, the reconstructed image structure of I0 may be updated according to the decoded second-type frame. Long-term reference image. After the decoding of B11 is completed, the reconstructed image of I16 in the reference image buffer is output as a new long-term reference image, that is, the long-term reference image of the reconstructed image of I0 is replaced with the long-term reference image of the reconstructed image of I16. Another part of the second type frame B14, B13, and B15 can be decoded by referring to the reconstructed image of I16 (the long-term reference image constructed by the reconstructed image of I16). And after each decoding of the second type frame is completed, the long-term reference image constructed by the reconstructed image of I16 may be updated according to the decoded second type frame. After the decoding of B15 is completed, all short-term reference images in the reference image buffer display order before I16 are cleared, and the reconstructed image of I16 is used again to replace the current long-term reference image. Then continue to decode P24, B20, B18, B17, B19, B21, B21, B23 ..., and update the reference image buffer and the long-term reference image constructed by the reconstructed image of I16.
图12是本申请一个实施例的在随机访问点处的解码方法1200的示意性流程图。如图12所示,1200可以包括以下步骤。FIG. 12 is a schematic flowchart of a decoding method 1200 at a random access point according to an embodiment of the present application. As shown in FIG. 12, 1200 may include the following steps.
S1210,确定对第一类型帧执行随机访问功能,并对所述第一类型帧进行帧内解码,其中,按解码顺序,所述第一类型帧之后存在显示顺序在所述第一类型帧之前的N个第二类型帧,所述第一类型帧之后存在显示顺序在所述第一类型帧之后的需要进行帧间解码的第四类型帧。S1210. It is determined that a random access function is performed on the first type frame, and intra frame decoding is performed on the first type frame. In the decoding order, a display order exists after the first type frame before the first type frame. There are N second type frames, and there is a fourth type frame that needs to be inter-frame decoded after the first type frame and whose display order is after the first type frame.
S1220,以所述第一类型帧的重建图像形成的长期参考图像,对所述第四类型帧进行帧间解码,在每个所述第四类型帧完成解码时,使用完成解码的所述第四类型帧更新所述长期参考图像,以所述更新后的长期参考图像作为下一帧的长期参考图像。S1220: Inter-decode the fourth-type frame using a long-term reference image formed from the reconstructed image of the first-type frame, and when each fourth-type frame completes decoding, use the Four types of frames update the long-term reference image, and use the updated long-term reference image as the long-term reference image of the next frame.
在一些实施例中,S1220以所述第一类型帧的重建图像形成的长期参考图像,对所述第四类型帧进行帧间解码,可以包括:在完成对所述第一类型帧的帧内解码后,将所述第一类型帧的重建图像放入参考图像缓冲区中;将所述第一类型帧的重建图像从所述参考图像缓冲区中输出,以所述第一类型帧的重建图像作为当前使用的长期参考图像,对所述第四类型帧进行帧间解码。In some embodiments, S1220 performing inter-frame decoding on the fourth type of frame using the long-term reference image formed by the reconstructed image of the first type of frame may include: within the frame of completing the first type of frame After decoding, the reconstructed image of the first type frame is put into a reference image buffer; the reconstructed image of the first type frame is output from the reference image buffer, and the reconstruction of the first type frame is used The image is used as a currently used long-term reference image, and the fourth type frame is inter-frame decoded.
在一些实施例中,所述将所述第一类型帧的重建图像放入参考图像缓冲区中,可以包括:在所述参考图像缓冲区中不存在所述第一类型帧的重建图 像时,将所述第一类型帧的重建图像放入所述参考图像缓冲区中。In some embodiments, placing the reconstructed image of the first type frame in a reference image buffer may include: when the reconstructed image of the first type frame does not exist in the reference image buffer, Placing the reconstructed image of the first type of frame into the reference image buffer.
下面以具体的视频序列编码来说明本申请实施例的使用随机访问功能的解码方法1200。The following uses specific video sequence coding to describe the decoding method 1200 using the random access function in the embodiment of the present application.
一个例子中,解码序列为I0 P8 B4 B2 B1 B3 B6 B5 B7 I16 B12 B10 B9 B11 B14 B13 B15 P24 B20 B18 B17 B19 B22 B21 B23…In one example, the decoding sequence is I0, P8, B4, B2, B1, B6, B5, B7, I16, B12, B10, B9, B11, B14, B13, B15, P24, B20, B18, B17, B19, B19, B21, B23 ...
其中,I0和I16为并且为随机访问点。假设I16为第一类型帧,即使用随机访问功能并从I16开始解码,那么B12 B10 B9 B11 B14 B13 B15为第二类型帧,P8 B4 B2 B1 B3 B6 B5 B7等均可以视为第三类型帧,P24 B20 B18 B17 B19 B22 B21 B23…为第四类型帧。Among them, I0 and I16 are and are random access points. Assuming I16 is the first type of frame, that is, using the random access function and decoding from I16, then B12, B10, B9, B11, B14, B13, and B15 are the second type of frame, P8, B4, B2, B1, B3, B6, B5, B7, etc. can be regarded as the third type of frame. , P24, B20, B18, B17, B19, B22, B21, B23 ... are frames of the fourth type.
在完成I16的解码之后,将I16的重建图像放入参考图像缓冲区,将参考图像缓冲区中显示顺序在I16之前的所有短期参考图像都清除。不对显示顺序在I16以前的B12 B10 B9 B11 B14 B13 B15进行解码,而直接对P24 B20 B18 B17 B19 B22 B21 B23…进行解码,并且更新参考图像缓冲区和I16的重建图像构造的长期参考图像。After the decoding of I16 is completed, the reconstructed image of I16 is placed in the reference image buffer, and all short-term reference images in the display order of the reference image buffer before I16 are cleared. Instead of decoding B12, B10, B11, B11, B13, B15, B15, and B15 before the display order of I16, directly decode P24, B20, B18, B17, B19, B21, B21, B23 ..., and update the reference image buffer and the long-term reference image constructed by the reconstructed image of I16.
以上详细说明了本申请实施例的方法,下面详细说明本申请实施例的编码设备和解码设备。The method of the embodiment of the present application has been described in detail above, and the encoding device and the decoding device of the embodiment of the present application are described in detail below.
图13是本申请一个实施例的编码设备1300的示意性框图。如图13所示,编码设备1300包括第一编码模块1310、第二编码模块1320和替换模块1330。第一编码模块1310用于对第一类型帧进行编码,其中,按编码顺序所述第一类型帧之后存在需要进行帧间编码的N个第二类型帧,所述N个第二类型帧的显示顺序在所述第一类型帧之前,其中,N为正整数。第二编码模块1320用于根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间编码。替换模块1330用于在完成所述N个第二类型帧中的至少一个第二类型帧的帧间编码后,替换当前使用的长期参考图像。FIG. 13 is a schematic block diagram of an encoding device 1300 according to an embodiment of the present application. As shown in FIG. 13, the encoding device 1300 includes a first encoding module 1310, a second encoding module 1320, and a replacement module 1330. The first encoding module 1310 is configured to encode a first type frame. In the encoding order, there are N second type frames that need to be inter-frame encoded after the first type frame. The display order is before the first type frame, where N is a positive integer. The second encoding module 1320 is configured to perform inter-frame encoding on at least one second type frame of the N second type frames according to the long-term reference image. The replacement module 1330 is configured to replace a currently used long-term reference image after completing inter-frame encoding of at least one second type frame among the N second type frames.
本申请实施例的编码设备,在完成编码顺序在第一类型帧之后、显示顺序在第一类型帧之前的N个第二类型帧中的至少一个第二类型帧的帧间编码后,才替换当前使用的长期参考图像,使得至少一个第二类型帧可以参考第一类型帧之前的长期参考图像,可以提高编码效率。The encoding device in the embodiment of the present application replaces only after completing inter-frame encoding of at least one second type frame among N second type frames in which the encoding order is after the first type frame and the display order is before the first type frame. The currently used long-term reference picture enables at least one second-type frame to reference the long-term reference picture before the first-type frame, which can improve coding efficiency.
在一些实施例中,所述替换模块1330具体用于:在完成所述N个第二类型帧中的所有第二类型帧的帧间编码后,替换当前使用的长期参考图像。In some embodiments, the replacement module 1330 is specifically configured to: after completing the inter-coding of all the second type frames of the N second type frames, replace the currently used long-term reference image.
在一些实施例中,所述替换模块1330具体用于:以所述第一类型帧的 重建图像替换当前使用的长期参考图像。In some embodiments, the replacement module 1330 is specifically configured to: replace the currently used long-term reference image with the reconstructed image of the first type frame.
在一些实施例中,所述替换模块1330具体用于:在完成对所述第一类型帧的编码后,将所述第一类型帧的重建图像放入参考图像缓冲区中;在完成对所述N个第二类型帧中的至少一个第二类型帧的帧间编码后,将所述第一类型帧的重建图像从所述参考图像缓冲区中输出,以所述第一类型帧的重建图像替换当前使用的长期参考图像。In some embodiments, the replacement module 1330 is specifically configured to: after the encoding of the first type frame is completed, place the reconstructed image of the first type frame into a reference image buffer; After the inter-frame encoding of at least one second type frame among the N second type frames, the reconstructed image of the first type frame is output from the reference image buffer, and the reconstruction of the first type frame is performed. The image replaces the currently used long-term reference image.
在一些实施例中,所述替换模块1330所述将所述第一类型帧的重建图像放入参考图像缓冲区中,包括:当所述参考图像缓冲区中不存在所述第一类型帧的重建图像时,将所述第一类型帧的重建图像放入所述参考图像缓冲区中。In some embodiments, the replacing module 1330 placing the reconstructed image of the first type frame in a reference image buffer includes: when the first type frame does not exist in the reference image buffer, When the image is reconstructed, the reconstructed image of the first type frame is placed in the reference image buffer.
在一些实施例中,按编码顺序所述第一类型帧之前存在需要进行帧间编码的第三类型帧,第二编码模块1320具体用于:根据所述第三类型帧进行帧间编码后所更新的长期参考图像,对所述N个第二类型帧中的至少一个第二类型帧进行帧间编码。In some embodiments, there is a third type of frame that needs to be inter-frame encoded before the first type of frame according to the encoding order. The second encoding module 1320 is specifically configured to: The updated long-term reference image performs inter-frame coding on at least one second type frame among the N second type frames.
在一些实施例中,所述第三类型帧在所述第一类型帧之前显示。In some embodiments, the third type frame is displayed before the first type frame.
在一些实施例中,所述所更新的长期参考图像,是在所述第三类型帧进行帧间编码之后基于所述第三类型帧的特定图像块更新的;或者,所述所更新的长期参考图像,是在所述第三类型帧的特定图像块进行帧间编码之后,基于所述特定图像块更新的。In some embodiments, the updated long-term reference image is updated based on a specific image block of the third-type frame after inter-coding of the third-type frame; or, the updated long-term reference image is updated. The reference image is updated based on the specific image block after inter-frame encoding of the specific image block of the third type frame.
在一些实施例中,按编码顺序所述第一类型帧之后存在需要进行帧间编码的第四类型帧,所述第四类型帧的显示顺序在所述第一类型帧之后,编码设备1300还可以包括第三编码设备,用于根据所述替换后的长期参考图像对所述第四类型帧进行帧间编码。In some embodiments, there is a fourth type frame that needs to be inter-frame encoded after the first type frame in the coding order, and the display order of the fourth type frame is after the first type frame. The encoding device 1300 also A third encoding device may be included to perform inter-frame encoding on the fourth type frame according to the replaced long-term reference image.
在一些实施例中,所述第一类型帧为随机访问点。In some embodiments, the first type frame is a random access point.
在一些实施例中,所述第一类型帧为清除随机访问点。In some embodiments, the first type of frame is a clear random access point.
在一些实施例中,第二编码模块1320具体用于:In some embodiments, the second encoding module 1320 is specifically configured to:
根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间编码,在至少部分第二类型帧完成编码时,使用所述完成编码的至少部分第二类型帧中的特定图像块更新长期参考图像,以所述更新后的长期参考图像作为下一个第二类型帧的长期参考图像;或者,根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间编码,在至少部分第 二类型帧的特定图像块完成编码时,使用所述完成编码的特定图像块更新长期参考图像,以所述更新后的长期参考图像作为下一个第二类型帧的长期参考图像或作为所述当前第二类型帧的长期参考图像。Perform inter-frame coding on at least one second-type frame of the N second-type frames according to the long-term reference image, and when at least part of the second-type frame is encoded, use the at least part of the second-type frame of the completed encoding Update a long-term reference image for a specific image block of, and use the updated long-term reference image as a long-term reference image for a next second type frame; or, according to the long-term reference image, at least one of the N second type frames is first The two types of frames are inter-frame encoded. When at least some of the specific image blocks of the second type of frames are encoded, the long-term reference image is updated using the encoded specific image blocks, and the updated long-term reference image is used as the next first The long-term reference image of the second-type frame or the long-term reference image of the current second-type frame.
在一些实施例中,所述第一类型帧进行编码之后,以及按编码顺序所述第一类型帧的下一帧编码之前,所述长期参考图像保持不变。In some embodiments, the long-term reference image remains unchanged after the first type frame is encoded and before the next frame of the first type frame is encoded in the encoding order.
在一些实施例中,所述编码设备1300还用于在对所述第一类型帧以外的至少部分图像帧编码之后,基于所述图像帧中的部分图像块对所述长期参考帧中的部分图像块进行更新;或者,在对所述第一类型帧以外的至少部分图像帧中的特定图像块编码之后,基于所述特定图像块对所述长期参考帧中的部分图像块进行更新。下一帧编码之前,所述长期参考图像保持不变。In some embodiments, the encoding device 1300 is further configured to, after encoding at least a part of the image frames other than the first type frame, perform a part of the long-term reference frame based on a part of the image blocks in the image frame. Update image blocks; or, after encoding specific image blocks in at least part of the image frames other than the first type frame, update some image blocks in the long-term reference frame based on the specific image blocks. The long-term reference image remains unchanged until the next frame is encoded.
图14是本申请另一个实施例的编码设备1400的示意性框图。如图14所示的编码设备1400可以包括至少一个处理器1410和至少一个存储器1420,用于存储计算机可执行指令;至少一个处理器1410,单独或共同地用于:访问所述至少一个存储器1420,并执行所述计算机可执行指令,以实施以下操作:对第一类型帧进行编码,其中,按编码顺序所述第一类型帧之后存在需要进行帧间编码的N个第二类型帧,所述N个第二类型帧的显示顺序在所述第一类型帧之前,其中,N为正整数;根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间编码;在完成所述N个第二类型帧中的至少一个第二类型帧的帧间编码后,替换当前使用的长期参考图像。FIG. 14 is a schematic block diagram of an encoding device 1400 according to another embodiment of the present application. The encoding device 1400 shown in FIG. 14 may include at least one processor 1410 and at least one memory 1420 for storing computer-executable instructions; at least one processor 1410, alone or collectively, for: accessing the at least one memory 1420 And execute the computer-executable instructions to perform the following operations: encode a first type frame, where there are N second type frames that require inter-frame encoding after the first type frame in the encoding order, so The display order of the N second type frames is before the first type frame, where N is a positive integer; at least one second type frame among the N second type frames is interframed according to the long-term reference image. Encoding; after completing inter-frame encoding of at least one second type frame among the N second type frames, replacing a currently used long-term reference image.
在一些实施例中,所述处理器1410具体用于:在完成所述N个第二类型帧中的所有第二类型帧的帧间编码后,替换当前使用的长期参考图像。In some embodiments, the processor 1410 is specifically configured to: after completing inter-frame encoding of all the second type frames of the N second type frames, replace the currently used long-term reference image.
在一些实施例中,所述处理器1410具体用于:以所述第一类型帧的重建图像替换当前使用的长期参考图像。In some embodiments, the processor 1410 is specifically configured to: replace the currently used long-term reference image with the reconstructed image of the first type frame.
在一些实施例中,所述处理器1410具体用于:在完成对所述第一类型帧的编码后,将所述第一类型帧的重建图像放入参考图像缓冲区中;在完成对所述N个第二类型帧中的至少一个第二类型帧的帧间编码后,将所述第一类型帧的重建图像从所述参考图像缓冲区中输出,以所述第一类型帧的重建图像替换当前使用的长期参考图像。In some embodiments, the processor 1410 is specifically configured to: after the encoding of the first type frame is completed, place the reconstructed image of the first type frame into a reference image buffer; After the inter-frame encoding of at least one second type frame among the N second type frames, the reconstructed image of the first type frame is output from the reference image buffer, and the reconstruction of the first type frame is performed. The image replaces the currently used long-term reference image.
在一些实施例中,所述处理器1410具体用于:当所述参考图像缓冲区中不存在所述第一类型帧的重建图像时,将所述第一类型帧的重建图像放入所述参考图像缓冲区中。In some embodiments, the processor 1410 is specifically configured to: when the reconstructed image of the first type frame does not exist in the reference image buffer, place the reconstructed image of the first type frame into the reference image buffer. Reference image buffer.
在一些实施例中,按编码顺序所述第一类型帧之前存在需要进行帧间编码的第三类型帧,所述处理器1410具体用于:基于所述第三类型帧进行帧间编码后所更新的长期参考图像,对所述N个第二类型帧中的至少一个第二类型帧进行帧间编码。In some embodiments, there is a third type of frame that needs to be inter-frame encoded before the first type of frame in the coding order, and the processor 1410 is specifically configured to: The updated long-term reference image performs inter-frame coding on at least one second type frame among the N second type frames.
在一些实施例中,所述第三类型帧在所述第一类型帧之前显示。In some embodiments, the third type frame is displayed before the first type frame.
在一些实施例中,所述所更新的长期参考图像,是在所述第三类型帧进行帧间编码之后基于所述第三类型帧的特定图像块更新的;或者,所述所更新的长期参考图像,是在所述第三类型帧的特定图像块进行帧间编码之后,基于所述特定图像块更新的。In some embodiments, the updated long-term reference image is updated based on a specific image block of the third-type frame after inter-coding of the third-type frame; or, the updated long-term reference image is updated. The reference image is updated based on the specific image block after inter-frame encoding of the specific image block of the third type frame.
在一些实施例中,按编码顺序所述第一类型帧之后存在需要进行帧间编码的第四类型帧,所述第四类型帧的显示顺序在所述第一类型帧之后,所述处理器1410还用于:根据所述替换后的长期参考图像对所述第四类型帧进行帧间编码。In some embodiments, there is a fourth type frame that needs to be inter-frame encoded after the first type frame in the coding order, and the display order of the fourth type frame is after the first type frame, and the processor 1410 is further configured to perform inter-frame coding on the fourth type frame according to the replaced long-term reference image.
在一些实施例中,所述第一类型帧为随机访问点。In some embodiments, the first type frame is a random access point.
在一些实施例中,所述第一类型帧为清除随机访问点。In some embodiments, the first type of frame is a clear random access point.
在一些实施例中,所述处理器1410具体用于:根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间编码,在至少部分第二类型帧完成编码时,使用所述完成编码的至少部分第二类型帧中的特定图像块更新长期参考图像,以所述更新后的长期参考图像作为下一个第二类型帧的长期参考图像;或者,根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间编码,在至少部分第二类型帧的特定图像块完成编码时,使用所述完成编码的特定图像块更新长期参考图像,以所述更新后的长期参考图像作为下一个第二类型帧的长期参考图像或作为所述当前第二类型帧的长期参考图像。In some embodiments, the processor 1410 is specifically configured to perform inter-frame coding on at least one second type frame of the N second type frames according to a long-term reference image, and complete coding on at least a part of the second type frames. When a long-term reference image is updated using a specific image block in the at least part of the second type frame that has been encoded, and the updated long-term reference image is used as a long-term reference image for the next second-type frame; or according to the long-term reference The image performs inter-frame coding on at least one second type frame of the N second type frames, and when at least a part of the specific image block of the second type frame is encoded, the long-term reference is updated by using the specific image block of the completed encoding An image, using the updated long-term reference image as a long-term reference image of a next second type frame or as a long-term reference image of the current second type frame.
在一些实施例中,所述第一类型帧进行编码之后,以及按编码顺序所述第一类型帧的下一帧编码之前,所述长期参考图像保持不变。In some embodiments, the long-term reference image remains unchanged after the first type frame is encoded and before the next frame of the first type frame is encoded in the encoding order.
在一些实施例中,处理器1410还用于在对所述第一类型帧以外的至少部分图像帧编码之后,基于所述图像帧中的部分图像块对所述长期参考帧中的部分图像块进行更新;或者,在对所述第一类型帧以外的至少部分图像帧中的特定图像块编码之后,基于所述特定图像块对所述长期参考帧中的部分图像块进行更新。下一帧编码之前,所述长期参考图像保持不变。In some embodiments, the processor 1410 is further configured to, after encoding at least a part of the image frames other than the first type frame, based on a part of the image blocks in the image frame, part of the image blocks in the long-term reference frame Updating; or, after encoding a specific image block in at least a part of the image frame other than the first type frame, updating a part of the image block in the long-term reference frame based on the specific image block. The long-term reference image remains unchanged until the next frame is encoded.
图15是本申请一个实施例的解码设备1500的示意性框图。如图15所示,解码设备1500包括第一解码模块1510、第二解码模块1520和替换模块1530。第一解码模块1510用于对第一类型帧进行解码,其中,按解码顺序所述第一类型帧之后存在需要进行帧间解码的N个第二类型帧,所述N个第二类型帧的显示顺序在所述第一类型帧之前,其中,N为正整数。第二解码模块1520用于根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间解码。替换模块1530用于在完成所述N个第二类型帧中的至少一个第二类型帧的帧间解码后,替换当前使用的长期参考图像。FIG. 15 is a schematic block diagram of a decoding device 1500 according to an embodiment of the present application. As shown in FIG. 15, the decoding device 1500 includes a first decoding module 1510, a second decoding module 1520, and a replacement module 1530. The first decoding module 1510 is configured to decode a first type frame. In the decoding order, there are N second type frames that need to be inter-frame decoded after the first type frame. The display order is before the first type frame, where N is a positive integer. The second decoding module 1520 is configured to perform inter-frame decoding on at least one second type frame of the N second type frames according to the long-term reference image. The replacement module 1530 is configured to replace a currently used long-term reference image after completing inter-frame decoding of at least one second type frame among the N second type frames.
本申请实施例的解码设备,在完成解码顺序在第一类型帧之后、显示顺序在第一类型帧之前的N个第二类型帧中的至少一个第二类型帧的帧间解码后,才替换当前使用的长期参考图像,使得至少一个第二类型帧可以参考第一类型帧之前的长期参考图像,可以提高解码效率。The decoding device in this embodiment of the present application replaces only after completing inter-frame decoding of at least one second-type frame among N second-type frames in which the decoding order is after the first-type frame and the display order is before the first-type frame. The currently used long-term reference picture enables at least one second-type frame to reference the long-term reference picture before the first-type frame, which can improve decoding efficiency.
在一些实施例中,所述替换模块1530具体用于:在完成所述N个第二类型帧中的所有第二类型帧的帧间解码后,替换当前使用的长期参考图像。In some embodiments, the replacement module 1530 is specifically configured to: after completing the inter-frame decoding of all the second type frames of the N second type frames, replace the currently used long-term reference image.
在一些实施例中,所述替换模块1530具体用于:以所述第一类型帧的重建图像替换当前使用的长期参考图像。In some embodiments, the replacement module 1530 is specifically configured to: replace the currently used long-term reference image with the reconstructed image of the first type frame.
在一些实施例中,所述替换模块1530具体用于:在完成对所述第一类型帧的解码后,将所述第一类型帧的重建图像放入参考图像缓冲区中;在完成对所述N个第二类型帧中的至少一个第二类型帧的帧间解码后,将所述第一类型帧的重建图像从所述参考图像缓冲区中输出,以所述第一类型帧的重建图像替换当前使用的长期参考图像。In some embodiments, the replacement module 1530 is specifically configured to: after the decoding of the first type frame is completed, place the reconstructed image of the first type frame into a reference image buffer; After the inter-frame decoding of at least one second type frame among the N second type frames, output the reconstructed image of the first type frame from the reference image buffer, and reconstruct the first type frame The image replaces the currently used long-term reference image.
在一些实施例中,所述替换模块1530所述将所述第一类型帧的重建图像放入参考图像缓冲区中,包括:当所述参考图像缓冲区中不存在所述第一类型帧的重建图像时,将所述第一类型帧的重建图像放入所述参考图像缓冲区中。In some embodiments, the replacing module 1530 placing the reconstructed image of the first type frame in a reference image buffer includes: when the first type frame does not exist in the reference image buffer, When the image is reconstructed, the reconstructed image of the first type frame is placed in the reference image buffer.
在一些实施例中,按解码顺序所述第一类型帧之前存在需要进行帧间解码的第三类型帧,第二解码模块1520具体用于:根据所述第三类型帧进行帧间解码后所更新的长期参考图像,对所述N个第二类型帧中的至少一个第二类型帧进行帧间解码。In some embodiments, there is a third type of frame that needs to be inter-frame decoded before the first type of frame according to the decoding order, and the second decoding module 1520 is specifically configured to: The updated long-term reference image performs inter-frame decoding on at least one second type frame among the N second type frames.
在一些实施例中,所述第三类型帧在所述第一类型帧之前显示。In some embodiments, the third type frame is displayed before the first type frame.
在一些实施例中,所述所更新的长期参考图像,是在所述第三类型帧进 行帧间解码之后基于所述第三类型帧的特定图像块更新的;或者,所述所更新的长期参考图像,是在所述第三类型帧的特定图像块进行帧间解码之后,基于所述特定图像块更新的。In some embodiments, the updated long-term reference image is updated based on a specific image block of the third-type frame after inter-frame decoding of the third-type frame; or, the updated long-term reference image is updated. The reference image is updated based on the specific image block after inter-frame decoding of the specific image block of the third type frame.
在一些实施例中,按解码顺序所述第一类型帧之后存在需要进行帧间解码的第四类型帧,所述第四类型帧的显示顺序在所述第一类型帧之后,解码设备1500还可以包括第三解码设备,用于根据所述替换后的长期参考图像对所述第四类型帧进行帧间解码。In some embodiments, there is a fourth type frame that requires inter-frame decoding after the first type frame in the decoding order, and the display order of the fourth type frame is after the first type frame. The decoding device 1500 also A third decoding device may be included to perform inter-frame decoding on the fourth type frame according to the replaced long-term reference image.
在一些实施例中,所述第一类型帧为随机访问点。In some embodiments, the first type frame is a random access point.
在一些实施例中,所述第一类型帧为清除随机访问点。In some embodiments, the first type of frame is a clear random access point.
在一些实施例中,第二解码模块1520具体用于:In some embodiments, the second decoding module 1520 is specifically configured to:
根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间解码,在至少部分第二类型帧完成解码时,使用所述完成解码的至少部分第二类型帧中的特定图像块更新长期参考图像,以所述更新后的长期参考图像作为下一个第二类型帧的长期参考图像;或者,根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间解码,在至少部分第二类型帧的特定图像块完成解码时,使用所述完成解码的特定图像块更新长期参考图像,以所述更新后的长期参考图像作为下一个第二类型帧的长期参考图像或作为所述当前第二类型帧的长期参考图像。Perform inter-frame decoding on at least one second-type frame of the N second-type frames according to the long-term reference image, and when at least part of the second-type frame completes decoding, use the at least part of the second-type frame that has been decoded. Update a long-term reference image for a specific image block of, and use the updated long-term reference image as a long-term reference image for a next second type frame; or, according to the long-term reference image, at least one of the N second type frames is first The two types of frames are inter-frame decoded. When at least some of the specific image blocks of the second type of frames are decoded, the decoded specific image blocks are used to update the long-term reference image, and the updated long-term reference image is used as the next first The long-term reference image of the second-type frame or the long-term reference image of the current second-type frame.
在一些实施例中,所述第一类型帧进行解码之后,以及按解码顺序所述第一类型帧的下一帧解码之前,所述长期参考图像保持不变。In some embodiments, the long-term reference image remains unchanged after the first type frame is decoded and before the next frame of the first type frame is decoded in decoding order.
在一些实施例中,所述解码设备1500还用于在对所述第一类型帧以外的至少部分图像帧解码之后,基于所述图像帧中的部分图像块对所述长期参考帧中的部分图像块进行更新;或者,在对所述第一类型帧以外的至少部分图像帧中的特定图像块解码之后,基于所述特定图像块对所述长期参考帧中的部分图像块进行更新。下一帧解码之前,所述长期参考图像保持不变。In some embodiments, the decoding device 1500 is further configured to, after decoding at least a part of the image frame other than the first type frame, perform a part of the long-term reference frame based on a part of the image block in the image frame. Update the image block; or, after decoding a specific image block in at least a part of the image frame other than the first type frame, update a part of the image block in the long-term reference frame based on the specific image block. The long-term reference image remains unchanged until the next frame is decoded.
图16是本申请另一个实施例的解码设备1600的示意性框图。如图16所示的解码设备1600可以包括至少一个处理器1610和至少一个存储器1620,用于存储计算机可执行指令;至少一个处理器1610,单独或共同地用于:访问所述至少一个存储器1620,并执行所述计算机可执行指令,以实施以下操作:对第一类型帧进行解码,其中,按解码顺序所述第一类型帧之后存在需要进行帧间解码的N个第二类型帧,所述N个第二类型帧的显示顺序在所 述第一类型帧之前,其中,N为正整数;根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间解码;在完成所述N个第二类型帧中的至少一个第二类型帧的帧间解码后,替换当前使用的长期参考图像。FIG. 16 is a schematic block diagram of a decoding device 1600 according to another embodiment of the present application. The decoding device 1600 shown in FIG. 16 may include at least one processor 1610 and at least one memory 1620 for storing computer-executable instructions; at least one processor 1610, alone or collectively, for: accessing the at least one memory 1620 And execute the computer-executable instructions to perform the following operations: decoding a first type frame, where there are N second type frames that require inter-frame decoding after the first type frame in the decoding order, so The display order of the N second type frames is before the first type frame, where N is a positive integer; at least one second type frame among the N second type frames is interframed according to the long-term reference image. Decoding; after completing inter-frame decoding of at least one second type frame among the N second type frames, replacing a currently used long-term reference image.
在一些实施例中,所述处理器1610具体用于:在完成所述N个第二类型帧中的所有第二类型帧的帧间解码后,替换当前使用的长期参考图像。In some embodiments, the processor 1610 is specifically configured to: after completing inter-frame decoding of all the second type frames of the N second type frames, replace the currently used long-term reference image.
在一些实施例中,所述处理器1610具体用于:以所述第一类型帧的重建图像替换当前使用的长期参考图像。In some embodiments, the processor 1610 is specifically configured to: replace the currently used long-term reference image with the reconstructed image of the first type frame.
在一些实施例中,所述处理器1610具体用于:在完成对所述第一类型帧的解码后,将所述第一类型帧的重建图像放入参考图像缓冲区中;在完成对所述N个第二类型帧中的至少一个第二类型帧的帧间解码后,将所述第一类型帧的重建图像从所述参考图像缓冲区中输出,以所述第一类型帧的重建图像替换当前使用的长期参考图像。In some embodiments, the processor 1610 is specifically configured to: after completing decoding the first type frame, place the reconstructed image of the first type frame into a reference image buffer; After the inter-frame decoding of at least one second type frame among the N second type frames, output the reconstructed image of the first type frame from the reference image buffer, and reconstruct the first type frame The image replaces the currently used long-term reference image.
在一些实施例中,所述处理器1610具体用于:当所述参考图像缓冲区中不存在所述第一类型帧的重建图像时,将所述第一类型帧的重建图像放入所述参考图像缓冲区中。In some embodiments, the processor 1610 is specifically configured to: when the reconstructed image of the first type frame does not exist in the reference image buffer, place the reconstructed image of the first type frame into the reference image buffer. Reference image buffer.
在一些实施例中,按解码顺序所述第一类型帧之前存在需要进行帧间解码的第三类型帧,所述处理器1610具体用于:基于所述第三类型帧进行帧间解码后所更新的长期参考图像,对所述N个第二类型帧中的至少一个第二类型帧进行帧间解码。In some embodiments, there is a third type of frame that requires inter-frame decoding before the first type of frame in the decoding order, and the processor 1610 is specifically configured to: The updated long-term reference image performs inter-frame decoding on at least one second type frame among the N second type frames.
在一些实施例中,所述第三类型帧在所述第一类型帧之前显示。In some embodiments, the third type frame is displayed before the first type frame.
在一些实施例中,所述所更新的长期参考图像,是在所述第三类型帧进行帧间解码之后基于所述第三类型帧的特定图像块更新的;或者,所述所更新的长期参考图像,是在所述第三类型帧的特定图像块进行帧间解码之后,基于所述特定图像块更新的。In some embodiments, the updated long-term reference image is updated based on a specific image block of the third-type frame after inter-frame decoding of the third-type frame; or, the updated long-term reference image is updated. The reference image is updated based on the specific image block after inter-frame decoding of the specific image block of the third type frame.
在一些实施例中,按解码顺序所述第一类型帧之后存在需要进行帧间解码的第四类型帧,所述第四类型帧的显示顺序在所述第一类型帧之后,所述处理器1610还用于:根据所述替换后的长期参考图像对所述第四类型帧进行帧间解码。In some embodiments, there is a fourth type frame that needs to be inter-frame decoded after the first type frame in the decoding order, and the display order of the fourth type frame is after the first type frame, and the processor 1610 is further configured to perform inter-frame decoding on the fourth type frame according to the replaced long-term reference image.
在一些实施例中,所述第一类型帧为随机访问点。In some embodiments, the first type frame is a random access point.
在一些实施例中,所述第一类型帧为清除随机访问点。In some embodiments, the first type of frame is a clear random access point.
在一些实施例中,所述处理器1610具体用于:根据长期参考图像对所 述N个第二类型帧中的至少一个第二类型帧进行帧间解码,在至少部分第二类型帧完成解码时,使用所述完成解码的至少部分第二类型帧中的特定图像块更新长期参考图像,以所述更新后的长期参考图像作为下一个第二类型帧的长期参考图像;或者,根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间解码,在至少部分第二类型帧的特定图像块完成解码时,使用所述完成解码的特定图像块更新长期参考图像,以所述更新后的长期参考图像作为下一个第二类型帧的长期参考图像或作为所述当前第二类型帧的长期参考图像。In some embodiments, the processor 1610 is specifically configured to perform inter-frame decoding on at least one second type frame of the N second type frames according to a long-term reference image, and complete decoding on at least a part of the second type frames. The long-term reference image is updated by using the specific image block in the at least part of the second-type frame that has been decoded, and the updated long-term reference image is used as the long-term reference image of the next second-type frame; or according to the long-term reference The image performs inter-frame decoding on at least one second type frame of the N second type frames, and when at least part of the specific image block of the second type frame completes decoding, the long-term reference is updated by using the specific image block that has been decoded. An image, using the updated long-term reference image as a long-term reference image of a next second type frame or as a long-term reference image of the current second type frame.
在一些实施例中,所述第一类型帧进行解码之后,以及按解码顺序所述第一类型帧的下一帧解码之前,所述长期参考图像保持不变。In some embodiments, the long-term reference image remains unchanged after the first type frame is decoded and before the next frame of the first type frame is decoded in decoding order.
在一些实施例中,处理器1610还用于在对所述第一类型帧以外的至少部分图像帧解码之后,基于所述图像帧中的部分图像块对所述长期参考帧中的部分图像块进行更新;或者,在对所述第一类型帧以外的至少部分图像帧中的特定图像块解码之后,基于所述特定图像块对所述长期参考帧中的部分图像块进行更新。下一帧解码之前,所述长期参考图像保持不变。In some embodiments, the processor 1610 is further configured to, after decoding at least a part of the image frames other than the first type frame, based on a part of the image blocks in the image frame, for a part of the image blocks in the long-term reference frame Update; or, after decoding a specific image block in at least a part of the image frame other than the first type frame, update a part of the image block in the long-term reference frame based on the specific image block. The long-term reference image remains unchanged until the next frame is decoded.
应理解,本申请各实施例的装置可以基于存储器和处理器实现,各存储器用于存储用于执行本申请个实施例的方法的指令,处理器执行上述指令,使得装置执行本申请各实施例的方法。It should be understood that the devices of the embodiments of the present application may be implemented based on a memory and a processor. Each memory is used to store instructions for executing the method of the embodiments of the application. The processor executes the foregoing instructions, so that the device executes the embodiments of the application. Methods.
应理解,本申请实施例中提及的处理器可以是中央处理单元(central processing unit,CPU),还可以是其他通用处理器、数字信号处理器(digital signal processor,DSP)、专用集成电路(application specific integrated circuit,ASIC)、现成可编程门阵列(field programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。It should be understood that the processor mentioned in the embodiments of the present application may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), and application-specific integrated circuits (DSPs). application specific integrated circuit (ASIC), ready-made programmable gate array (field programmable gate array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
还应理解,本申请实施例中提及的存储器可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(read-only memory,ROM)、可编程只读存储器(programmable ROM,PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦除可编程只读存储器(electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(random access memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可 用,例如静态随机存取存储器(static RAM,SRAM)、动态随机存取存储器(dynamic RAM,DRAM)、同步动态随机存取存储器(synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(double data rate SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(direct rambus RAM,DR RAM)。It should also be understood that the memory mentioned in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), or Erase programmable read-only memory (EPROM, EEPROM) or flash memory. The volatile memory may be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (double SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (enhanced SDRAM, ESDRAM), synchronous connection dynamic random access memory (synchlink DRAM, SLDRAM ) And direct memory bus random access memory (direct RAMbus RAM, DR RAM).
需要说明的是,当处理器为通用处理器、DSP、ASIC、FPGA或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件时,存储器(存储模块)集成在处理器中。It should be noted that when the processor is a general-purpose processor, a DSP, an ASIC, an FPGA, or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, the memory (memory module) is integrated in the processor.
应注意,本文描述的存储器旨在包括但不限于这些和任意其它适合类型的存储器。It should be noted that the memories described herein are intended to include, but are not limited to, these and any other suitable types of memory.
本申请实施例还提供一种计算机可读存储介质,其上存储有指令,当指令在计算机上运行时,使得计算机执行上述各方法实施例的方法。An embodiment of the present application further provides a computer-readable storage medium having instructions stored thereon. When the instructions are run on the computer, the computer is caused to execute the methods of the foregoing method embodiments.
本申请实施例还提供一种计算机程序,该计算机程序使得计算机执行上述各方法实施例的方法。An embodiment of the present application further provides a computer program, which causes a computer to execute the methods of the foregoing method embodiments.
本申请实施例还提供一种计算设备,该计算设备包括上述计算机可读存储介质。An embodiment of the present application further provides a computing device, where the computing device includes the computer-readable storage medium described above.
本申请实施例可以应用在飞行器,尤其是无人机领域。The embodiments of the present application can be applied in the field of aircraft, especially in the field of drones.
应理解,本申请各实施例的电路、子电路、子单元的划分只是示意性的。本领域普通技术人员可以意识到,本文中所公开的实施例描述的各示例的电路、子电路和子单元,能够再行拆分或组合。It should be understood that the division of circuits, sub-circuits, and sub-units in the embodiments of the present application is merely schematic. Those of ordinary skill in the art may realize that the circuits, sub-circuits, and sub-units of the examples described in the embodiments disclosed herein can be split or combined again.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行计算机指令时,全部或部分地产生按照本申请实施例的流程或功能。计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(digital subscriber line,DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。计算机可读存储 介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。可用介质可以是磁性介质(例如,软盘、硬盘、磁带)、光介质(例如,高密度数字视频光盘(digital video disc,DVD))、或者半导体介质(例如,固态硬盘(solid state disk,SSD))等。In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, it may be implemented in whole or in part in the form of a computer program product. A computer program product includes one or more computer instructions. When computer instructions are loaded and executed on a computer, the processes or functions according to the embodiments of the present application are generated in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable device. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a web site, computer, server, or data center via a wired (e.g., Coaxial cable, optical fiber, digital subscriber line (DSL), or wireless (such as infrared, wireless, microwave, etc.) transmission to another website site, computer, server, or data center. A computer-readable storage medium may be any available media that can be accessed by a computer or a data storage device such as a server, data center, or the like, which contains one or more available media integrations. Usable media may be magnetic media (for example, floppy disks, hard disks, magnetic tapes), optical media (for example, high-density digital video discs (DVDs)), or semiconductor media (for example, solid state disks (SSDs) )Wait.
应理解,本申请各实施例均是以总位宽为16位(bit)为例进行说明的,本申请各实施例可以适用于其他的位宽。It should be understood that each embodiment of the present application is described by taking a total bit width of 16 bits as an example, and the embodiments of the present application may be applicable to other bit widths.
应理解,说明书通篇中提到的“一个实施例”或“一实施例”意味着与实施例有关的特定特征、结构或特性包括在本申请的至少一个实施例中。因此,在整个说明书各处出现的“在一个实施例中”或“在一实施例中”未必一定指相同的实施例。此外,这些特定的特征、结构或特性可以任意适合的方式结合在一个或多个实施例中。It should be understood that “an embodiment” or “an embodiment” mentioned throughout the specification means that a particular feature, structure, or characteristic related to the embodiment is included in at least one embodiment of the present application. Thus, the appearances of "in one embodiment" or "in an embodiment" appearing throughout the specification are not necessarily referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
应理解,在本申请的各种实施例中,上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that, in the various embodiments of the present application, the size of the sequence numbers of the above processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not deal with the embodiments of the present application. The implementation process constitutes any limitation.
应理解,在本申请实施例中,“与A相应的B”表示B与A相关联,根据A可以确定B。但还应理解,根据A确定B并不意味着仅仅根据A确定B,还可以根据A和/或其它信息确定B。It should be understood that in the embodiment of the present application, “B corresponding to A” means that B is associated with A, and B can be determined according to A. However, it should also be understood that determining B based on A does not mean determining B based solely on A, but also determining B based on A and / or other information.
应理解,本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。It should be understood that the term “and / or” herein is only an association relationship describing an associated object, and indicates that there can be three kinds of relationships, for example, A and / or B can mean: A exists alone, and A and B exist simultaneously. There are three cases of B alone. In addition, the character "/" in this text generally indicates that the related objects are an "or" relationship.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art may realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. A professional technician can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments, and are not repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和 方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods may be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the unit is only a logical function division. In actual implementation, there may be another division manner. For example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, which may be electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objective of the solution of this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each of the units may exist separately physically, or two or more units may be integrated into one unit.
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above is only a specific implementation of this application, but the scope of protection of this application is not limited to this. Any person skilled in the art can easily think of changes or replacements within the technical scope disclosed in this application. It should be covered by the protection scope of this application. Therefore, the protection scope of this application shall be subject to the protection scope of the claims.

Claims (58)

  1. 一种编码方法,其特征在于,包括:An encoding method, comprising:
    对第一类型帧进行编码,其中,按编码顺序所述第一类型帧之后存在需要进行帧间编码的N个第二类型帧,所述N个第二类型帧的显示顺序在所述第一类型帧之前,其中,N为正整数;Encoding a first type frame, where there are N second type frames that need to be inter-frame encoded after the first type frame in the encoding order, and the display order of the N second type frames is in the first Before type frames, where N is a positive integer;
    根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间编码;Performing inter-frame coding on at least one second type frame of the N second type frames according to a long-term reference image;
    在完成所述N个第二类型帧中的至少一个第二类型帧的帧间编码后,替换当前使用的长期参考图像。After the inter-frame encoding of at least one second type frame among the N second type frames is completed, the currently used long-term reference image is replaced.
  2. 根据权利要求1所述的编码方法,其特征在于,所述在完成所述N个第二类型帧中的至少一个第二类型帧的帧间编码后,替换当前使用的长期参考图像,包括:The encoding method according to claim 1, wherein after the completion of inter-frame encoding of at least one second type frame of the N second type frames, replacing the currently used long-term reference image comprises:
    在完成所述N个第二类型帧中的所有第二类型帧的帧间编码后,替换当前使用的长期参考图像。After the inter-frame encoding of all the second type frames in the N second type frames is completed, the currently used long-term reference image is replaced.
  3. 根据权利要求1或2所述的编码方法,其特征在于,所述替换当前使用的长期参考图像,包括:The encoding method according to claim 1 or 2, wherein the replacing a long-term reference image currently used comprises:
    以所述第一类型帧的重建图像替换当前使用的长期参考图像。Replace the currently used long-term reference image with the reconstructed image of the first type of frame.
  4. 根据权利要求3所述的编码方法,其特征在于,所述替换当前使用的长期参考图像,包括:The encoding method according to claim 3, wherein the replacing a currently used long-term reference image comprises:
    在完成对所述第一类型帧的编码后,将所述第一类型帧的重建图像放入参考图像缓冲区中;After the encoding of the first type frame is completed, placing the reconstructed image of the first type frame in a reference image buffer;
    在完成对所述N个第二类型帧中的至少一个第二类型帧的帧间编码后,将所述第一类型帧的重建图像从所述参考图像缓冲区中输出,以所述第一类型帧的重建图像替换当前使用的长期参考图像。After completing inter-frame encoding of at least one second type frame among the N second type frames, outputting a reconstructed image of the first type frame from the reference image buffer, and using the first The reconstructed image of the type frame replaces the currently used long-term reference image.
  5. 根据权利要求4所述的编码方法,其特征在于,所述将所述第一类型帧的重建图像放入参考图像缓冲区中,包括:The encoding method according to claim 4, wherein the placing the reconstructed image of the first type frame in a reference image buffer comprises:
    当所述参考图像缓冲区中不存在所述第一类型帧的重建图像时,将所述第一类型帧的重建图像放入所述参考图像缓冲区中。When the reconstructed image of the first type frame does not exist in the reference image buffer, the reconstructed image of the first type frame is placed in the reference image buffer.
  6. 根据权利要求1至5中任一项所述的编码方法,其特征在于,按编码顺序所述第一类型帧之前存在需要进行帧间编码的第三类型帧,The encoding method according to any one of claims 1 to 5, characterized in that, there is a third type frame that needs to be inter-frame encoded before the first type frame in the encoding order,
    所述根据长期参考图像对所述N个第二类型帧中的至少一个第二类型 帧进行帧间编码,包括:Inter-coding the at least one second type frame of the N second type frames according to the long-term reference image includes:
    根据所述第三类型帧进行帧间编码后所更新的长期参考图像,对所述N个第二类型帧中的至少一个第二类型帧进行帧间编码。Performing inter-frame coding on at least one second-type frame of the N second-type frames according to the long-term reference image updated after inter-coding of the third-type frame.
  7. 根据权利要求6所述的编码方法,其特征在于,所述第三类型帧在所述第一类型帧之前显示。The encoding method according to claim 6, wherein the third type frame is displayed before the first type frame.
  8. 根据权利要求6所述的编码方法,其特征在于,所述所更新的长期参考图像,是在所述第三类型帧进行帧间编码之后基于所述第三类型帧的特定图像块更新的;The encoding method according to claim 6, wherein the updated long-term reference image is updated based on a specific image block of the third type frame after inter-frame encoding of the third type frame;
    或者,or,
    所述所更新的长期参考图像,是在所述第三类型帧的特定图像块进行帧间编码之后,基于所述特定图像块更新的。The updated long-term reference image is updated based on the specific image block after inter-frame encoding of the specific image block of the third type frame.
  9. 根据权利要求1至8中任一项所述的编码方法,其特征在于,按编码顺序所述第一类型帧之后存在需要进行帧间编码的第四类型帧,所述第四类型帧的显示顺序在所述第一类型帧之后,所述编码方法还包括:The encoding method according to any one of claims 1 to 8, characterized in that, in the encoding order, there is a fourth type frame that requires inter-frame encoding after the first type frame, and display of the fourth type frame After the sequence of the first type of frames, the encoding method further includes:
    根据所述替换后的长期参考图像对所述第四类型帧进行帧间编码。Inter-coding the fourth type frame according to the replaced long-term reference image.
  10. 根据权利要求1至9中任一项所述的编码方法,其特征在于,所述第一类型帧为随机访问点。The encoding method according to any one of claims 1 to 9, wherein the first type frame is a random access point.
  11. 根据权利要求10所述的编码方法,其特征在于,所述第一类型帧为清除随机访问点。The encoding method according to claim 10, wherein the first type frame is a clear random access point.
  12. 根据权利要求1至11中任一项所述的编码方法,其特征在于,所述根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间编码,包括:The encoding method according to any one of claims 1 to 11, wherein the performing inter-frame encoding on at least one second type frame of the N second type frames according to a long-term reference image includes:
    根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间编码,在至少部分第二类型帧完成编码时,使用所述完成编码的至少部分第二类型帧中的特定图像块更新长期参考图像,以所述更新后的长期参考图像作为下一个第二类型帧的长期参考图像;Perform inter-frame coding on at least one second-type frame of the N second-type frames according to the long-term reference image, and when at least part of the second-type frame is encoded, use the at least part of the second-type frame of the completed encoding Updating a long-term reference image with a specific image block of, and using the updated long-term reference image as a long-term reference image for a next type 2 frame;
    或者,or,
    根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间编码,在至少部分第二类型帧的特定图像块完成编码时,使用所述完成编码的特定图像块更新长期参考图像,以所述更新后的长期参考图像作为下一个第二类型帧的长期参考图像或作为所述当前第二类型帧的长期参考 图像。Perform inter-frame encoding on at least one second type frame of the N second type frames according to a long-term reference image, and when at least part of the specific image block of the second type frame is encoded, use the specific image block that has been encoded The long-term reference image is updated, and the updated long-term reference image is used as a long-term reference image of a next second type frame or as a long-term reference image of the current second type frame.
  13. 根据权利要求1至12中任一项所述的编码方法,其特征在于,所述第一类型帧进行编码之后,以及按编码顺序所述第一类型帧的下一帧编码之前,所述长期参考图像保持不变。The encoding method according to any one of claims 1 to 12, wherein after the first type frame is encoded and before the next frame of the first type frame is encoded in the encoding order, the long-term The reference image remains unchanged.
  14. 根据权利要求1至13中任一项所述的编码方法,其特征在于,所述编码方法还包括:The encoding method according to any one of claims 1 to 13, wherein the encoding method further comprises:
    在对所述第一类型帧以外的至少部分图像帧编码之后,基于所述图像帧中的部分图像块对所述长期参考帧中的部分图像块进行更新;After encoding at least part of the image frames other than the first type frame, updating part of the image blocks in the long-term reference frame based on the part of image blocks in the image frame;
    或者,or,
    在对所述第一类型帧以外的至少部分图像帧中的特定图像块编码之后,基于所述特定图像块对所述长期参考帧中的部分图像块进行更新。After encoding a specific image block in at least a part of the image frame other than the first type frame, updating a part of the image block in the long-term reference frame based on the specific image block.
  15. 一种解码方法,其特征在于,包括:A decoding method, comprising:
    对第一类型帧进行解码,其中,按解码顺序所述第一类型帧之后存在需要进行帧间解码的N个第二类型帧,所述N个第二类型帧的显示顺序在所述第一类型帧之前,其中,N为正整数;Decoding a first type frame, where there are N second type frames that need to be inter-frame decoded after the first type frame in decoding order, and the display order of the N second type frames is in the first Before type frames, where N is a positive integer;
    根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间解码;Performing inter-frame decoding on at least one second type frame of the N second type frames according to a long-term reference image;
    在完成所述N个第二类型帧中的至少一个第二类型帧的帧间解码后,替换当前使用的长期参考图像。After the inter-frame decoding of at least one second type frame among the N second type frames is completed, the currently used long-term reference image is replaced.
  16. 根据权利要求15所述的解码方法,其特征在于,所述在完成所述N个第二类型帧中的至少一个第二类型帧的帧间解码后,替换当前使用的长期参考图像,包括:The decoding method according to claim 15, wherein after the completion of inter-frame decoding of at least one second type frame of the N second type frames, replacing the currently used long-term reference image comprises:
    在完成所述N个第二类型帧中的所有第二类型帧的帧间解码后,替换当前使用的长期参考图像。After the inter-frame decoding of all the second type frames in the N second type frames is completed, the currently used long-term reference image is replaced.
  17. 根据权利要求15或16所述的解码方法,其特征在于,所述替换当前使用的长期参考图像,包括:The decoding method according to claim 15 or 16, wherein the replacing a currently used long-term reference image comprises:
    以所述第一类型帧的重建图像替换当前使用的长期参考图像。Replace the currently used long-term reference image with the reconstructed image of the first type of frame.
  18. 根据权利要求17所述的解码方法,其特征在于,所述替换当前使用的长期参考图像,包括:The decoding method according to claim 17, wherein the replacing a long-term reference image currently used comprises:
    在完成对所述第一类型帧的解码后,将所述第一类型帧的重建图像放入参考图像缓冲区中;After the decoding of the first type frame is completed, placing the reconstructed image of the first type frame into a reference image buffer;
    在完成对所述N个第二类型帧中的至少一个第二类型帧的帧间解码后,将所述第一类型帧的重建图像从所述参考图像缓冲区中输出,以所述第一类型帧的重建图像替换当前使用的长期参考图像。After completing the inter-frame decoding of at least one second type frame among the N second type frames, output the reconstructed image of the first type frame from the reference image buffer, and use the first The reconstructed image of the type frame replaces the currently used long-term reference image.
  19. 根据权利要求18所述的解码方法,其特征在于,所述将所述第一类型帧的重建图像放入参考图像缓冲区中,包括:The decoding method according to claim 18, wherein the putting the reconstructed image of the first type frame into a reference image buffer comprises:
    当所述参考图像缓冲区中不存在所述第一类型帧的重建图像时,将所述第一类型帧的重建图像放入所述参考图像缓冲区中。When the reconstructed image of the first type frame does not exist in the reference image buffer, the reconstructed image of the first type frame is placed in the reference image buffer.
  20. 根据权利要求15至19中任一项所述的解码方法,其特征在于,按解码顺序所述第一类型帧之前存在需要进行帧间解码的第三类型帧,The decoding method according to any one of claims 15 to 19, wherein there is a third type frame that needs to be inter-frame decoded before the first type frame in the decoding order,
    所述根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间解码,包括:The inter-frame decoding of at least one second type frame of the N second type frames according to the long-term reference image includes:
    根据所述第三类型帧进行帧间解码后所更新的长期参考图像,对所述N个第二类型帧中的至少一个第二类型帧进行帧间解码。Performing inter-frame decoding on at least one second-type frame of the N second-type frames according to the long-term reference image updated after inter-frame decoding of the third-type frame.
  21. 根据权利要求20所述的解码方法,其特征在于,所述第三类型帧在所述第一类型帧之前显示。The decoding method according to claim 20, wherein the third type frame is displayed before the first type frame.
  22. 根据权利要求20所述的解码方法,其特征在于,所述所更新的长期参考图像,是在所述第三类型帧进行帧间解码之后基于所述第三类型帧的特定图像块更新的;The decoding method according to claim 20, wherein the updated long-term reference image is updated based on a specific image block of the third type frame after inter-frame decoding of the third type frame;
    或者,or,
    所述所更新的长期参考图像,是在所述第三类型帧的特定图像块进行帧间解码之后,基于所述特定图像块更新的。The updated long-term reference image is updated based on the specific image block after inter-frame decoding of the specific image block of the third type frame.
  23. 根据权利要求15至22中任一项所述的解码方法,其特征在于,按解码顺序所述第一类型帧之后存在需要进行帧间解码的第四类型帧,所述第四类型帧的显示顺序在所述第一类型帧之后,所述解码方法还包括:The decoding method according to any one of claims 15 to 22, characterized in that, in the decoding order, there is a fourth type frame that requires inter-frame decoding after the first type frame, and the display of the fourth type frame After the sequence of the first type of frames, the decoding method further includes:
    根据所述替换后的长期参考图像对所述第四类型帧进行帧间解码。Performing inter-frame decoding on the fourth type frame according to the replaced long-term reference image.
  24. 根据权利要求15至23中任一项所述的解码方法,其特征在于,所述第一类型帧为随机访问点。The decoding method according to any one of claims 15 to 23, wherein the first type frame is a random access point.
  25. 根据权利要求24所述的解码方法,其特征在于,所述第一类型帧为清除随机访问点。The decoding method according to claim 24, wherein the first type frame is a clear random access point.
  26. 根据权利要求15至25中任一项所述的解码方法,其特征在于,所述根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行 帧间解码,包括:The decoding method according to any one of claims 15 to 25, wherein the performing inter-frame decoding on at least one second type frame of the N second type frames according to a long-term reference image comprises:
    根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间解码,在至少部分第二类型帧完成解码时,使用所述完成解码的至少部分第二类型帧中的特定图像块更新长期参考图像,以所述更新后的长期参考图像作为下一个第二类型帧的长期参考图像;Perform inter-frame decoding on at least one second-type frame of the N second-type frames according to the long-term reference image, and when at least part of the second-type frame completes decoding, use the at least part of the second-type frame that has been decoded Updating a long-term reference image with a specific image block of, and using the updated long-term reference image as a long-term reference image for a next type 2 frame;
    或者,or,
    根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间解码,在至少部分第二类型帧的特定图像块完成解码时,使用所述完成解码的特定图像块更新长期参考图像,以所述更新后的长期参考图像作为下一个第二类型帧的长期参考图像或作为所述当前第二类型帧的长期参考图像。Perform inter-frame decoding on at least one second-type frame of the N second-type frames according to a long-term reference image, and when the decoding of a specific image block of at least part of the second-type frame is completed, use the specific image block that has been decoded The long-term reference image is updated, and the updated long-term reference image is used as a long-term reference image of a next second type frame or as a long-term reference image of the current second type frame.
  27. 根据权利要求15至26中任一项所述的解码方法,其特征在于,所述第一类型帧进行解码之后,以及按解码顺序所述第一类型帧的下一帧解码之前,所述长期参考图像保持不变。The decoding method according to any one of claims 15 to 26, wherein after the first type frame is decoded and before the next frame of the first type frame is decoded in the decoding order, the long-term The reference image remains unchanged.
  28. 根据权利要求15至27中任一项所述的解码方法,其特征在于,所述解码方法还包括:The decoding method according to any one of claims 15 to 27, wherein the decoding method further comprises:
    在对所述第一类型帧以外的至少部分图像帧解码之后,基于所述图像帧中的部分图像块对所述长期参考帧中的部分图像块进行更新;After decoding at least part of the image frames other than the first type frame, updating part of the image blocks in the long-term reference frame based on the part of image blocks in the image frame;
    或者,or,
    在对所述第一类型帧以外的至少部分图像帧中的特定图像块解码之后,基于所述特定图像块对所述长期参考帧中的部分图像块进行更新。After decoding a specific image block in at least a part of the image frame other than the first type frame, updating a part of the image block in the long-term reference frame based on the specific image block.
  29. 一种编码设备,其特征在于,包括:An encoding device, comprising:
    至少一个存储器,用于存储计算机可执行指令;At least one memory for storing computer-executable instructions;
    至少一个处理器,单独或共同地用于:访问所述至少一个存储器,并执行所述计算机可执行指令,以实施以下操作:At least one processor, individually or collectively, for accessing the at least one memory and executing the computer-executable instructions to perform the following operations:
    对第一类型帧进行编码,其中,按编码顺序所述第一类型帧之后存在需要进行帧间编码的N个第二类型帧,所述N个第二类型帧的显示顺序在所述第一类型帧之前,其中,N为正整数;Encoding a first type frame, where there are N second type frames that need to be inter-frame encoded after the first type frame in the encoding order, and the display order of the N second type frames is in the first Before type frames, where N is a positive integer;
    根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间编码;Performing inter-frame coding on at least one second type frame of the N second type frames according to a long-term reference image;
    在完成所述N个第二类型帧中的至少一个第二类型帧的帧间编码后,替 换当前使用的长期参考图像。After the inter-frame encoding of at least one second type frame among the N second type frames is completed, the currently used long-term reference image is replaced.
  30. 根据权利要求29所述的编码设备,其特征在于,所述处理器具体用于:The encoding device according to claim 29, wherein the processor is specifically configured to:
    在完成所述N个第二类型帧中的所有第二类型帧的帧间编码后,替换当前使用的长期参考图像。After the inter-frame encoding of all the second type frames in the N second type frames is completed, the currently used long-term reference image is replaced.
  31. 根据权利要求29或30所述的编码设备,其特征在于,所述处理器具体用于:The encoding device according to claim 29 or 30, wherein the processor is specifically configured to:
    以所述第一类型帧的重建图像替换当前使用的长期参考图像。Replace the currently used long-term reference image with the reconstructed image of the first type of frame.
  32. 根据权利要求31所述的编码设备,其特征在于,所述处理器具体用于:The encoding device according to claim 31, wherein the processor is specifically configured to:
    在完成对所述第一类型帧的编码后,将所述第一类型帧的重建图像放入参考图像缓冲区中;After the encoding of the first type frame is completed, placing the reconstructed image of the first type frame in a reference image buffer;
    在完成对所述N个第二类型帧中的至少一个第二类型帧的帧间编码后,将所述第一类型帧的重建图像从所述参考图像缓冲区中输出,以所述第一类型帧的重建图像替换当前使用的长期参考图像。After completing inter-frame encoding of at least one second type frame among the N second type frames, outputting a reconstructed image of the first type frame from the reference image buffer, and using the first The reconstructed image of the type frame replaces the currently used long-term reference image.
  33. 根据权利要求32所述的编码设备,其特征在于,所述处理器具体用于:The encoding device according to claim 32, wherein the processor is specifically configured to:
    当所述参考图像缓冲区中不存在所述第一类型帧的重建图像时,将所述第一类型帧的重建图像放入所述参考图像缓冲区中。When the reconstructed image of the first type frame does not exist in the reference image buffer, the reconstructed image of the first type frame is placed in the reference image buffer.
  34. 根据权利要求29至33中任一项所述的编码设备,其特征在于,按编码顺序所述第一类型帧之前存在需要进行帧间编码的第三类型帧,The encoding device according to any one of claims 29 to 33, wherein a third type frame that needs to be inter-frame encoded exists before the first type frame in the encoding order,
    所述处理器具体用于:The processor is specifically configured to:
    根据所述第三类型帧进行帧间编码后所更新的长期参考图像,对所述N个第二类型帧中的至少一个第二类型帧进行帧间编码。Performing inter-frame coding on at least one second-type frame of the N second-type frames according to the long-term reference image updated after inter-coding of the third-type frame.
  35. 根据权利要求34所述的编码设备,其特征在于,所述第三类型帧在所述第一类型帧之前显示。The encoding device according to claim 34, wherein the third type frame is displayed before the first type frame.
  36. 根据权利要求34所述的编码设备,其特征在于,所述所更新的长期参考图像,是在所述第三类型帧进行帧间编码之后基于所述第三类型帧的特定图像块更新的;The encoding device according to claim 34, wherein the updated long-term reference image is updated based on a specific image block of the third type frame after inter encoding of the third type frame;
    或者,or,
    所述所更新的长期参考图像,是在所述第三类型帧的特定图像块进行帧 间编码之后,基于所述特定图像块更新的。The updated long-term reference image is updated based on the specific image block after inter-frame encoding of the specific image block of the third type frame.
  37. 根据权利要求29至36中任一项所述的编码设备,其特征在于,按编码顺序所述第一类型帧之后存在需要进行帧间编码的第四类型帧,所述第四类型帧的显示顺序在所述第一类型帧之后,所述处理器还用于:The encoding device according to any one of claims 29 to 36, characterized in that, in the encoding order, there is a fourth type frame that needs to be inter-frame encoded after the first type frame, and the display of the fourth type frame is After the sequence of the first type frame, the processor is further configured to:
    根据所述替换后的长期参考图像对所述第四类型帧进行帧间编码。Inter-coding the fourth type frame according to the replaced long-term reference image.
  38. 根据权利要求29至37中任一项所述的编码设备,其特征在于,所述第一类型帧为随机访问点。The encoding device according to any one of claims 29 to 37, wherein the first type frame is a random access point.
  39. 根据权利要求38所述的编码设备,其特征在于,所述第一类型帧为清除随机访问点。The encoding device according to claim 38, wherein the first type frame is a clear random access point.
  40. 根据权利要求29至39中任一项所述的编码设备,其特征在于,所述处理器具体用于:The encoding device according to any one of claims 29 to 39, wherein the processor is specifically configured to:
    根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间编码,在至少部分第二类型帧完成编码时,使用所述完成编码的至少部分第二类型帧中的特定图像块更新长期参考图像,以所述更新后的长期参考图像作为下一个第二类型帧的长期参考图像;Perform inter-frame coding on at least one second-type frame of the N second-type frames according to the long-term reference image, and when at least part of the second-type frame is encoded, use the at least part of the second-type frame of the completed encoding Updating a long-term reference image with a specific image block of, and using the updated long-term reference image as a long-term reference image for a next type 2 frame;
    或者,or,
    根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间编码,在至少部分第二类型帧的特定图像块完成编码时,使用所述完成编码的特定图像块更新长期参考图像,以所述更新后的长期参考图像作为下一个第二类型帧的长期参考图像或作为所述当前第二类型帧的长期参考图像。Perform inter-frame encoding on at least one second type frame of the N second type frames according to a long-term reference image, and when at least part of the specific image block of the second type frame is encoded, use the specific image block that has been encoded The long-term reference image is updated, and the updated long-term reference image is used as a long-term reference image of a next second type frame or as a long-term reference image of the current second type frame.
  41. 根据权利要求29至40中任一项所述的编码设备,其特征在于,所述第一类型帧进行编码之后,以及按编码顺序所述第一类型帧的下一帧编码之前,所述长期参考图像保持不变。The encoding device according to any one of claims 29 to 40, wherein after the first type frame is encoded and before the next frame of the first type frame is encoded in the encoding order, the long-term The reference image remains unchanged.
  42. 根据权利要求29至41中任一项所述的编码设备,其特征在于,所述处理器还用于:The encoding device according to any one of claims 29 to 41, wherein the processor is further configured to:
    在对所述第一类型帧以外的至少部分图像帧编码之后,基于所述图像帧中的部分图像块对所述长期参考帧中的部分图像块进行更新;After encoding at least part of the image frames other than the first type frame, updating part of the image blocks in the long-term reference frame based on the part of image blocks in the image frame;
    或者,or,
    在对所述第一类型帧以外的至少部分图像帧中的特定图像块编码之后,基于所述特定图像块对所述长期参考帧中的部分图像块进行更新。After encoding a specific image block in at least a part of the image frame other than the first type frame, updating a part of the image block in the long-term reference frame based on the specific image block.
  43. 一种解码设备,其特征在于,包括:A decoding device, comprising:
    至少一个存储器,用于存储计算机可执行指令;At least one memory for storing computer-executable instructions;
    至少一个处理器,单独或共同地用于:访问所述至少一个存储器,并执行所述计算机可执行指令,以实施以下操作:At least one processor, individually or collectively, for accessing the at least one memory and executing the computer-executable instructions to perform the following operations:
    对第一类型帧进行解码,其中,按解码顺序所述第一类型帧之后存在需要进行帧间解码的N个第二类型帧,所述N个第二类型帧的显示顺序在所述第一类型帧之前,其中,N为正整数;Decoding a first type frame, where there are N second type frames that need to be inter-frame decoded after the first type frame in decoding order, and the display order of the N second type frames is in the first Before type frames, where N is a positive integer;
    根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间解码;Performing inter-frame decoding on at least one second type frame of the N second type frames according to a long-term reference image;
    在完成所述N个第二类型帧中的至少一个第二类型帧的帧间解码后,替换当前使用的长期参考图像。After the inter-frame decoding of at least one second type frame among the N second type frames is completed, the currently used long-term reference image is replaced.
  44. 根据权利要求43所述的解码设备,其特征在于,所述处理器具体用于:The decoding device according to claim 43, wherein the processor is specifically configured to:
    在完成所述N个第二类型帧中的所有第二类型帧的帧间解码后,替换当前使用的长期参考图像。After the inter-frame decoding of all the second type frames in the N second type frames is completed, the currently used long-term reference image is replaced.
  45. 根据权利要求43或44所述的解码设备,其特征在于,所述处理器具体用于:The decoding device according to claim 43 or 44, wherein the processor is specifically configured to:
    以所述第一类型帧的重建图像替换当前使用的长期参考图像。Replace the currently used long-term reference image with the reconstructed image of the first type of frame.
  46. 根据权利要求45所述的解码设备,其特征在于,所述处理器具体用于:The decoding device according to claim 45, wherein the processor is specifically configured to:
    在完成对所述第一类型帧的解码后,将所述第一类型帧的重建图像放入参考图像缓冲区中;After the decoding of the first type frame is completed, placing the reconstructed image of the first type frame into a reference image buffer;
    在完成对所述N个第二类型帧中的至少一个第二类型帧的帧间解码后,将所述第一类型帧的重建图像从所述参考图像缓冲区中输出,以所述第一类型帧的重建图像替换当前使用的长期参考图像。After completing the inter-frame decoding of at least one second type frame among the N second type frames, output the reconstructed image of the first type frame from the reference image buffer, and use the first The reconstructed image of the type frame replaces the currently used long-term reference image.
  47. 根据权利要求46所述的解码设备,其特征在于,所述处理器具体用于:The decoding device according to claim 46, wherein the processor is specifically configured to:
    当所述参考图像缓冲区中不存在所述第一类型帧的重建图像时,将所述第一类型帧的重建图像放入所述参考图像缓冲区中。When the reconstructed image of the first type frame does not exist in the reference image buffer, the reconstructed image of the first type frame is placed in the reference image buffer.
  48. 根据权利要求43至47中任一项所述的解码设备,其特征在于,按解码顺序所述第一类型帧之前存在需要进行帧间解码的第三类型帧,The decoding device according to any one of claims 43 to 47, wherein a third type frame that needs to be inter-frame decoded exists before the first type frame in the decoding order,
    所述处理器具体用于:The processor is specifically configured to:
    根据所述第三类型帧进行帧间解码后所更新的长期参考图像,对所述N个第二类型帧中的至少一个第二类型帧进行帧间解码。Performing inter-frame decoding on at least one second-type frame of the N second-type frames according to the long-term reference image updated after inter-frame decoding of the third-type frame.
  49. 根据权利要求48所述的解码设备,其特征在于,所述第三类型帧在所述第一类型帧之前显示。The decoding device according to claim 48, wherein the third type frame is displayed before the first type frame.
  50. 根据权利要求48所述的解码设备,其特征在于,所述所更新的长期参考图像,是在所述第三类型帧进行帧间解码之后基于所述第三类型帧的特定图像块更新的;The decoding device according to claim 48, wherein the updated long-term reference image is updated based on a specific image block of the third type frame after inter-frame decoding of the third type frame;
    或者,or,
    所述所更新的长期参考图像,是在所述第三类型帧的特定图像块进行帧间解码之后,基于所述特定图像块更新的。The updated long-term reference image is updated based on the specific image block after inter-frame decoding of the specific image block of the third type frame.
  51. 根据权利要求43至50中任一项所述的解码设备,其特征在于,按解码顺序所述第一类型帧之后存在需要进行帧间解码的第四类型帧,所述第四类型帧的显示顺序在所述第一类型帧之后,所述处理器还用于:The decoding device according to any one of claims 43 to 50, wherein a fourth type frame that needs to be inter-frame decoded exists after the first type frame in decoding order, and the display of the fourth type frame is After the sequence of the first type frame, the processor is further configured to:
    根据所述替换后的长期参考图像对所述第四类型帧进行帧间解码。Performing inter-frame decoding on the fourth type frame according to the replaced long-term reference image.
  52. 根据权利要求43至51中任一项所述的解码设备,其特征在于,所述第一类型帧为随机访问点。The decoding device according to any one of claims 43 to 51, wherein the first type frame is a random access point.
  53. 根据权利要求52所述的解码设备,其特征在于,所述第一类型帧为清除随机访问点。The decoding device according to claim 52, wherein the first type frame is a clear random access point.
  54. 根据权利要求43至53中任一项所述的解码设备,其特征在于,所述处理器具体用于:The decoding device according to any one of claims 43 to 53, wherein the processor is specifically configured to:
    根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间解码,在至少部分第二类型帧完成解码时,使用所述完成解码的至少部分第二类型帧中的特定图像块更新长期参考图像,以所述更新后的长期参考图像作为下一个第二类型帧的长期参考图像;Perform inter-frame decoding on at least one second-type frame of the N second-type frames according to the long-term reference image, and when at least part of the second-type frame completes decoding, use the at least part of the second-type frame that has been decoded Updating a long-term reference image with a specific image block of, and using the updated long-term reference image as a long-term reference image for a next type 2 frame;
    或者,or,
    根据长期参考图像对所述N个第二类型帧中的至少一个第二类型帧进行帧间解码,在至少部分第二类型帧的特定图像块完成解码时,使用所述完成解码的特定图像块更新长期参考图像,以所述更新后的长期参考图像作为下一个第二类型帧的长期参考图像或作为所述当前第二类型帧的长期参考图像。Perform inter-frame decoding on at least one second-type frame of the N second-type frames according to a long-term reference image, and when the decoding of a specific image block of at least part of the second-type frame is completed, use the specific image block that has been decoded The long-term reference image is updated, and the updated long-term reference image is used as a long-term reference image of a next second type frame or as a long-term reference image of the current second type frame.
  55. 根据权利要求43至54中任一项所述的解码设备,其特征在于,所述第一类型帧进行解码之后,以及按解码顺序所述第一类型帧的下一帧解码之前,所述长期参考图像保持不变。The decoding device according to any one of claims 43 to 54, wherein after the first type frame is decoded and before the next frame of the first type frame is decoded in the decoding order, the long-term The reference image remains unchanged.
  56. 根据权利要求43至55中任一项所述的解码设备,其特征在于,所述处理器还用于:The decoding device according to any one of claims 43 to 55, wherein the processor is further configured to:
    在对所述第一类型帧以外的至少部分图像帧解码之后,基于所述图像帧中的部分图像块对所述长期参考帧中的部分图像块进行更新;After decoding at least part of the image frames other than the first type frame, updating part of the image blocks in the long-term reference frame based on the part of image blocks in the image frame;
    或者,or,
    在对所述第一类型帧以外的至少部分图像帧中的特定图像块解码之后,基于所述特定图像块对所述长期参考帧中的部分图像块进行更新。After decoding a specific image block in at least a part of the image frame other than the first type frame, updating a part of the image block in the long-term reference frame based on the specific image block.
  57. 一种计算机可读存储介质,其特征在于,其上存储有指令,当指令在计算机上运行时,使得计算机执行权利要求1至14中任一项所述的编码方法。A computer-readable storage medium, characterized in that instructions are stored thereon, and when the instructions are run on a computer, the computer is caused to execute the encoding method according to any one of claims 1 to 14.
  58. 一种计算机可读存储介质,其特征在于,其上存储有指令,当指令在计算机上运行时,使得计算机执行权利要求15至28中任一项所述的解码方法。A computer-readable storage medium, characterized in that instructions are stored thereon, and when the instructions are run on a computer, the computer is caused to execute the decoding method according to any one of claims 15 to 28.
PCT/CN2018/089673 2018-06-01 2018-06-01 Coding and decoding methods, and coding and decoding devices WO2019227491A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201880011426.3A CN110366851B (en) 2018-06-01 2018-06-01 Encoding and decoding method and encoding and decoding device
PCT/CN2018/089673 WO2019227491A1 (en) 2018-06-01 2018-06-01 Coding and decoding methods, and coding and decoding devices

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2018/089673 WO2019227491A1 (en) 2018-06-01 2018-06-01 Coding and decoding methods, and coding and decoding devices

Publications (1)

Publication Number Publication Date
WO2019227491A1 true WO2019227491A1 (en) 2019-12-05

Family

ID=68215012

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/089673 WO2019227491A1 (en) 2018-06-01 2018-06-01 Coding and decoding methods, and coding and decoding devices

Country Status (2)

Country Link
CN (1) CN110366851B (en)
WO (1) WO2019227491A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111800631A (en) * 2020-06-22 2020-10-20 西安万像电子科技有限公司 Data processing method and system

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113824965A (en) * 2021-09-22 2021-12-21 北京百度网讯科技有限公司 Video coding method and device and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140086325A1 (en) * 2012-09-27 2014-03-27 Qualcomm Incorporated Scalable extensions to hevc and temporal motion vector prediction
WO2017062373A1 (en) * 2015-10-07 2017-04-13 Qualcomm Incorporated Methods and systems of coding a predictive random access picture using a background picture
CN107333133A (en) * 2016-04-28 2017-11-07 浙江大华技术股份有限公司 A kind of method and device of the code stream coding of code stream receiving device
CN107396138A (en) * 2016-05-17 2017-11-24 华为技术有限公司 A kind of video coding-decoding method and equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6045222B2 (en) * 2012-06-28 2016-12-14 株式会社Nttドコモ Moving picture predictive decoding apparatus, method and program

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140086325A1 (en) * 2012-09-27 2014-03-27 Qualcomm Incorporated Scalable extensions to hevc and temporal motion vector prediction
WO2017062373A1 (en) * 2015-10-07 2017-04-13 Qualcomm Incorporated Methods and systems of coding a predictive random access picture using a background picture
CN107333133A (en) * 2016-04-28 2017-11-07 浙江大华技术股份有限公司 A kind of method and device of the code stream coding of code stream receiving device
CN107396138A (en) * 2016-05-17 2017-11-24 华为技术有限公司 A kind of video coding-decoding method and equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111800631A (en) * 2020-06-22 2020-10-20 西安万像电子科技有限公司 Data processing method and system

Also Published As

Publication number Publication date
CN110366851A (en) 2019-10-22
CN110366851B (en) 2023-03-31

Similar Documents

Publication Publication Date Title
US20230232000A1 (en) Sub-partition intra prediction
KR101202630B1 (en) Fragmented reference in temporal compression for video coding
JP5859581B2 (en) Buffer management in video codecs
US10616583B2 (en) Encoding/decoding digital frames by down-sampling/up-sampling with enhancement information
JP6377603B2 (en) Low latency video buffering in video coding
US9473790B2 (en) Inter-prediction method and video encoding/decoding method using the inter-prediction method
JP2014535219A (en) Random access with advanced decoded picture buffer (DPB) management in video coding
JP2014524196A (en) Video data multiplexing method and apparatus, and demultiplexing method and apparatus for identifying reproduction status of video data
US11212536B2 (en) Negative region-of-interest video coding
JP2017525175A (en) Robust encoding and decoding of pictures in video
JP2022527555A (en) Encoders, decoders, and corresponding methods
US11902556B2 (en) Mixed NAL unit type-based image encoding/decoding method and device, and method for transmitting bitstream
WO2020042191A1 (en) Encoding method, decoding method, encoding apparatus, and decoding apparatus
US11695934B2 (en) Mixed NAL unit type based-video encoding/decoding method and apparatus, and method for transmitting bitstream
WO2019227491A1 (en) Coding and decoding methods, and coding and decoding devices
JP2022531470A (en) Output of the previous picture for the picture starting a new coded video sequence in video coding
US9491483B2 (en) Inter-prediction method and video encoding/decoding method using the inter-prediction method
RU2806784C1 (en) Method and device for image encoding/decoding based on mixed type nal unit and method for transmitting bit stream
RU2812029C2 (en) Method and device for image encoding/decoding based on mixed type nal unit and method for transmitting bit stream
US11115452B2 (en) Method and device for processing encoded video data, and method and device for generating encoded video data
US8233709B2 (en) Color effects for compressed digital video
KR101852859B1 (en) Method of providing random access for moving picture based on random accessable P-frame
WO2018223353A1 (en) Video coding method, video decoding method, and related device
JP2024050862A (en) Image encoding/decoding method and apparatus for signaling DPB parameters, and computer-readable recording medium storing a bitstream - Patents.com
JP2023520534A (en) Image encoding/decoding method and apparatus based on available slice type information for GDR or IRPA pictures and recording medium for storing bitstream

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: 18920524

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: 18920524

Country of ref document: EP

Kind code of ref document: A1