WO2022198465A1 - 一种编码方法及装置 - Google Patents

一种编码方法及装置 Download PDF

Info

Publication number
WO2022198465A1
WO2022198465A1 PCT/CN2021/082491 CN2021082491W WO2022198465A1 WO 2022198465 A1 WO2022198465 A1 WO 2022198465A1 CN 2021082491 W CN2021082491 W CN 2021082491W WO 2022198465 A1 WO2022198465 A1 WO 2022198465A1
Authority
WO
WIPO (PCT)
Prior art keywords
frame
target
bit
image frame
encoding
Prior art date
Application number
PCT/CN2021/082491
Other languages
English (en)
French (fr)
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 PCT/CN2021/082491 priority Critical patent/WO2022198465A1/zh
Priority to CN202180095762.2A priority patent/CN116998148A/zh
Publication of WO2022198465A1 publication Critical patent/WO2022198465A1/zh

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

Definitions

  • the present application relates to the technical field of video image coding, and in particular, to a coding method and apparatus.
  • a target bit rate can be set for the video in advance.
  • the encoded video rate can be as close to the target bit rate as possible.
  • the process of rate control is as follows: the encoding end encodes the first image frame of the video to obtain the actual bits consumed by encoding the first image frame. After that, for the image frames to be encoded except the first image frame, the encoding end obtains the reference bits of the image frame according to the target bit rate and frame rate, and obtains the reference bits of the image frame according to the reference bits and the actual bits of the previous image frame of the to-be-coded image frame. , determine the estimated bits allocated to the image frame to be encoded. The encoding end determines a quantization parameter (quantization parameter, QP) of the to-be-encoded image frame according to the estimated bits, and uses the QP to quantize the to-be-encoded image frame. After the encoding end completes the encoding of the to-be-encoded image frame, the actual bits consumed for encoding the to-be-encoded image frame are obtained. Repeat the above process until the video encoding is completed.
  • quantization parameter quantization parameter
  • the encoding end determines the estimated bits to be allocated to the image frame to be encoded according to the reference bits and the actual bits of the previous image frame, which will result in too many or insufficient allocated estimated bits. Insufficient will result in poor quality of the encoded image frame to be encoded.
  • the present application provides an encoding method and device, which solve the problem of excessive or insufficient bits allocated to an image frame in the existing bit rate control.
  • the present application provides an encoding method.
  • An encoding device determines target information, the target information includes change information, obtains reference bits, and determines target bits allocated to an image frame to be encoded according to the target information and the reference bits. After that, the encoding device performs encoding on the image frame to be encoded, and quantization in encoding is done according to the target bits.
  • the change information is used to represent the change of the content of the image frame to be encoded relative to the reference frame.
  • the reference bit is obtained according to the preset target bit rate and the preset frame rate.
  • the change information can reflect the change of the content of the image frame to be encoded relative to the reference frame.
  • the target bit floats up and down the baseline, so that the encoded video rate can reach the target bit rate. For example, if the content of the to-be-encoded image frame relative to the reference frame changes greatly, a bit is added as the target bit based on the reference bit, so as to improve the image quality. If the content of the to-be-encoded image frame changes relatively little with respect to the content of the reference frame, the bits are reduced on the basis of the reference bits as the target bits, so as to reduce the waste of resources.
  • the target bit is determined more accurately by taking the reference bit as the baseline and according to the information of the reference frame in the prior art, so that the waste of resources can be reduced or the image quality can be improved. quality.
  • the above-mentioned method for "determining change information" may include: the encoding device determines the similarity between the image frame to be encoded and the reference frame, and determines the change according to the similarity.
  • the encoding device determines the similarity between the image frame to be encoded and the reference frame, and determines the change according to the similarity.
  • the above-mentioned method for "determining the similarity between the image frame to be encoded and the reference frame” may include: the encoding device obtains a homography matrix, and according to the homography Sex matrix and identity matrix to determine similarity.
  • the homography matrix is used to represent the mapping relationship between the position of the target object in the image frame to be encoded and the reference frame.
  • the target information further includes a first bit, the first bit is the bit consumed by encoding the reference frame, and the reference frame is the forward encoded image of the image frame to be encoded. frame or backward encoded image frame.
  • the encoding end uses the reference bit as the baseline, not only the change information, but also the actual bit consumed by encoding the reference frame, that is, the first bit.
  • the first bit is larger than the reference bit, the number of bits is reduced, and when the first bit is smaller than the reference bit, the number of bits is increased, which further improves the accuracy of the determined target bit.
  • the above-mentioned method of "determining the target bits allocated to the image frame to be encoded according to the reference bits and target information" may include: bit, determine the second bit, and determine the adjustment amount of the second bit according to the change information to obtain the target bit.
  • the encoding method provided by the present application further includes: the encoding device determines, according to the homography matrix and the position of the first pixel point, the image frame to be encoded relative to the reference frame. and the image block bits of each image block in the image frame to be encoded are determined according to the motion vector and the target bits.
  • the first pixel is a pixel at the center of the image frame to be encoded.
  • the encoding device implements an optimization of the block-level bit allocation of the image frame to be encoded.
  • the above-mentioned method for “determining the image block bits of each image block in the image frame to be encoded according to the motion vector and the target bit” may include: The motion vector determines the target image block in the image frame to be encoded, the average bit of the image block in the image frame to be encoded is determined according to the target bit, and the image block bit of the target image block is determined according to the average bit. Wherein, the content of the target image block is not included in the reference frame.
  • the image quality can be further improved.
  • the encoding method provided by the present application further includes: the encoding device determines, according to the change information, a prediction mode corresponding to an image block of an image frame to be encoded, where the prediction mode is frame. Intra prediction or inter prediction.
  • the above-mentioned method of "encoding the image frame to be encoded" may include: the encoding device performs encoding on the image frame to be encoded according to the target bits and the prediction mode.
  • Computational complexity can be reduced by referring to the variation information when determining the prediction mode.
  • the present application provides an encoding device, the encoding device including each module for executing the encoding method of the first aspect or any possible implementation manner of the first aspect.
  • the present application provides an encoding device including a memory and a processor.
  • the memory and the processor are coupled.
  • the memory is used to store computer program code including computer instructions.
  • the processor executes the computer instructions, the encoding means performs the encoding method as in the first aspect and any of its possible implementations.
  • the present application provides a chip system, which is applied to an encoding device.
  • a chip system includes one or more interface circuits, and one or more processors.
  • the interface circuit and the processor are interconnected by lines; the interface circuit is used for receiving signals from the memory of the encoding device and sending signals to the processor, the signals including computer instructions stored in the memory.
  • the processor executes the computer instructions, the encoding apparatus performs the encoding method as in the first aspect and any of its possible implementations.
  • the present application provides a computer-readable storage medium, the computer-readable storage medium comprising computer instructions, when the computer instructions are executed on the encoding device, the encoding device is made to perform the first aspect and any one of its possibilities.
  • the encoding method of the implementation is not limited to:
  • the present application provides a computer program product, the computer program product comprising computer instructions, when the computer instructions are executed on the encoding device, the encoding device is made to perform encoding as in the first aspect and any possible implementation manner thereof method.
  • FIG. 1 is a schematic diagram of a process of image encoding and decoding provided by an embodiment of the present application
  • FIG. 2 is a schematic diagram of division of an LCU provided by an embodiment of the present application.
  • FIG. 3 is a schematic structural diagram of an encoding and decoding system provided by an embodiment of the present application.
  • FIG. 4 is a schematic flowchart of an encoding method provided by an embodiment of the present application.
  • FIG. 5 is a schematic diagram of a rate control scenario provided by an embodiment of the present application.
  • FIG. 6 is a schematic structural diagram of an encoding apparatus provided by an embodiment of the present application.
  • words such as “exemplary” or “for example” are used to represent examples, illustrations or illustrations. Any embodiments or designs described in the embodiments of the present application as “exemplary” or “such as” should not be construed as preferred or advantageous over other embodiments or designs. Rather, the use of words such as “exemplary” or “such as” is intended to present the related concepts in a specific manner.
  • first and second are only used for descriptive purposes, and should not be construed as indicating or implying relative importance or implicitly indicating the number of indicated technical features.
  • a feature defined as “first” or “second” may expressly or implicitly include one or more of that feature.
  • plural means two or more.
  • Image encoding The process of compressing an image sequence into a code stream.
  • Image decoding The process of restoring the code stream into a reconstructed image according to specific grammar rules and processing methods.
  • FIG. 1 is a schematic diagram of the process of image encoding and decoding.
  • the image encoding process is as follows: the encoding end first divides a frame of original image into multiple parts that do not overlap each other, and each part can be used as an image block. Then, the encoder performs operations such as prediction, transform, quantization, and entropy coding for each image block to obtain the actual bits consumed by encoding each image block. The sum of the actual bits consumed by all the image blocks included in the image frame is the actual bits consumed by encoding the image frame.
  • the code stream output after entropy encoding in FIG. 1 refers to a data stream composed of actual bits consumed by each image frame of the video after the encoding end encodes the video.
  • prediction includes intra prediction and inter prediction, in order to obtain the prediction block of the image block, so that only the difference between the image block and its prediction block (or called residual or Residual block), and the information contained in the prediction block is encoded and transmitted, thereby saving transmission overhead.
  • Intra-frame prediction relies on the information of the current frame to obtain the predicted block
  • inter-frame prediction relies on the information of the current frame and the reference frame to obtain the predicted block.
  • the encoding end sends the code stream corresponding to the image block to the decoding end.
  • the encoding end can also be used as a decoding end and has a decoding function.
  • the decoding process of the image is as follows: the decoding end receives the code stream from other encoding ends (the code stream refers to the code stream input entropy coding in Figure 1), and performs entropy coding on the received code stream, Inverse quantization, inverse transformation, prediction, filtering and other operations are performed to obtain a reconstructed image block (or called a reconstructed image block), and this process is called an image reconstruction process (or an image reconstruction process). Then, the decoding end assembles the reconstructed blocks of each image block in the original image to obtain a reconstructed image of the original image.
  • Image encoding/decoding is performed in units of image blocks, starting from the upper left corner of the image, from left to right, top to bottom, and line by line.
  • the image block can be a macroblock (MB) in the video coding standard H.264, or can be a coding unit (coding unit, CU) in the high efficiency video coding (HEVC) standard. This is not specifically limited in the application examples.
  • the division process of the CU is as follows: the encoding end first divides the image into fixed-size largest coding units (largest coding units, LCUs), and then divides each LCU according to the specific content of the image. Divided into CUs.
  • LCUs large coding units
  • the LCU corresponds to a square image area.
  • An image area corresponding to one LCU includes 64 ⁇ 64 pixels.
  • a 64 ⁇ 64 pixel LCU contains a rectangular pixel lattice consisting of 64 columns of 64 pixels each.
  • a CU corresponds to an A ⁇ B rectangular area.
  • the values of A and B can be the same.
  • the values of A and B are integer powers of 2, for example: 64, 32, 16, 8.
  • the minimum division unit of a CU is 8 ⁇ 8.
  • division depths there may be four division depths, eg, 64 ⁇ 64, 32 ⁇ 32, 16 ⁇ 16, and 8 ⁇ 8.
  • the division depth when the division depth is 64 ⁇ 64, one LCU is one CU.
  • the division depth when the division depth is 32 ⁇ 32, the LCU can be divided into four CUs, which are a, b, c, and d, respectively.
  • the division depth when the division depth is 16 ⁇ 16, a, b, c or d can be divided into four CUs, respectively, and (c) in Figure 2 divides a into a0, a1, a2 and a3 are shown as examples.
  • the encoding device can determine the rate-distortion cost of the prediction unit according to the change information, and determine the prediction mode of the image block according to the rate-distortion cost, thereby reducing the computational complexity.
  • the motion vector is an important parameter in the inter prediction process, which represents the spatial displacement of the encoded image block relative to the current image block.
  • a motion vector can be obtained using a motion estimation (Motion Estimation, ME) method, such as motion search.
  • ME Motion Estimation
  • the encoding end transmits the motion vector of the current image block in the code stream, so that the decoding end reproduces the predicted pixels of the current image block, and then obtains the reconstructed block.
  • Frame rate refers to the number of frames of images transmitted per second.
  • Bit rate control is applied to the image encoding process, and it is an encoding optimization algorithm used to control the video bit rate.
  • the target code rate can be preset, and the quantization parameter in the quantization process can be adjusted to make the code rate after video encoding close to the target code rate.
  • Bit rate refers to the number of bits transmitted per second.
  • the unit generally used is kbps.
  • the common bit rate control strategy is average bit rate (ABR), which requires the bit rate to reach the target bit rate within a period of time, such as 3 to 5 seconds. This strategy can be well balanced. Bit rate stability and image quality.
  • the average code rate control process is: the code rate control module of the encoding end calculates the number of bits that can be evenly allocated to each frame of image according to the set target code rate, frame rate and image resolution, And use this number of bits as the reference bit.
  • the encoding end can predict and transform the first image frame of the video, and determine its corresponding quantization parameter according to the reference bits, and use the determined quantization parameter to quantize the first image frame. Then, the encoding end performs entropy encoding on the first image frame to obtain the actual bits consumed by encoding the first image frame, and inputs the actual bits of the first image frame into the rate control module.
  • the encoding end predicts and transforms the image frame to be encoded, and determines the allocation to the image to be encoded according to the reference bits and the actual bits of the image frame before the image frame to be encoded.
  • the estimated bits of the frame are determined, and the quantization parameter of the to-be-encoded image frame is determined according to the estimated bits, and the to-be-encoded image frame is quantized by using the quantization parameter.
  • the encoding end performs entropy encoding on the to-be-encoded image frame to obtain the actual bits consumed by the to-be-encoded image frame, and inputs the actual bits of the to-be-encoded image frame into the rate control module. Repeat the above process until the video encoding is completed.
  • the encoding end determines the estimated bits allocated to the image frame to be encoded according to the reference bits and the actual bits of the previous image frame, It may result in too many or insufficient allocated estimated bits. Too much allocation will result in waste of resources, and insufficient allocation will result in poor quality of the coded image frames to be coded.
  • an embodiment of the present application provides an encoding method.
  • the encoding end can determine the target bit of the image frame to be encoded according to the reference bit and the change information, and the change information can reflect the content of the image frame to be encoded relative to the reference frame. Variety. That is to say, the encoding end determines the target bits of the to-be-encoded image frame by taking the reference bit as the baseline according to the content of the to-be-encoded image frame, so that the target bits of all the to-be-encoded image frames float up and down the baseline, so that after video encoding The code rate can reach the target code rate.
  • the target bit is determined more accurately by taking the reference bit as the baseline and according to the information of the reference frame in the prior art, so that the waste of resources can be reduced or the image quality can be improved. quality.
  • FIG. 3 shows a structure of the video codec system.
  • the video codec system includes an encoding device 31 and a decoding device 32 .
  • the encoding device 31 generates encoded video data, and the encoding device 31 may also be referred to as a source device or an encoding device.
  • the decoding device 32 can decode the encoded video data generated by the encoding device 31, and the decoding device 32 can also be referred to as a destination device or a decoding device.
  • Encoding device 31 and/or decoding device 32 may include at least one processor and a memory coupled to the at least one processor.
  • the memory may include but is not limited to read-only memory (ROM), random access memory (RAM), electrically erasable programmable read-only memory (EEPROM), Flash memory or any other medium that can be used to store the desired program code in the form of instructions or data structures that can be accessed by a computer, which is not specifically limited in this application.
  • ROM read-only memory
  • RAM random access memory
  • EEPROM electrically erasable programmable read-only memory
  • Flash memory any other medium that can be used to store the desired program code in the form of instructions or data structures that can be accessed by a computer, which is not specifically limited in this application.
  • Encoding means 31 and decoding means 32 may include a variety of devices including desktop computers, mobile computing devices, notebook (eg, laptop) computers, tablet computers, set-top boxes, telephone handsets such as "smart" phones, televisions, Cameras, display devices, digital media players, video game consoles, in-vehicle computers or the like.
  • the encoding device 31 includes a video source 301 , a video encoder 302 and an output interface 303 .
  • output interface 303 may include a modulator/demodulator (modem) and/or a transmitter.
  • Video source 301 may include a video capture device (eg, a video camera), a video archive containing previously captured video data, a video input interface to receive video data from a video content provider, and/or computer graphics to generate video data system, or a combination of such sources of video data.
  • Video encoder 302 may encode video data from video source 301 .
  • encoding device 31 transmits the encoded video data directly to decoding device 32 via output interface 303 .
  • the encoded video data may also be stored on storage device 33 for later access by decoding device 32 for decoding and/or playback.
  • the encoding device 31 may further include an image signal processor (image signal processor, ISP) 304 .
  • the ISP 304 is used to perform multi-stage processing on the video data obtained by the video source 301, such as noise reduction, anti-shake and distortion correction.
  • the processed video data is subjected to video compression by the video encoder 302 .
  • the video encoder 302 may be integrated with the audio encoder and may include appropriate multiplexer-demultiplexer units or other hardware and software to handle audio in the common data stream or separate data streams and video encoding.
  • the video encoder 302 may include at least one microprocessor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field programmable gate array (FPGA) , discrete logic, hardware, or any combination thereof.
  • DSP digital signal processor
  • ASIC application-specific integrated circuit
  • FPGA field programmable gate array
  • an embodiment of the present application provides an encoding method, and the encoding method provided by the embodiment of the present application is described below with reference to the accompanying drawings.
  • the encoding method provided by this embodiment of the present application may include the following steps 401 to 404 .
  • the encoding device determines target information.
  • the target information may include change information.
  • the encoding device may acquire a reference frame of the to-be-encoded image frame, and determine the change in content of the to-be-encoded image frame relative to the reference frame, that is, determine change information.
  • the reference frame may be a forward encoded image frame or a backward encoded image frame of the image frame to be encoded.
  • the image frame to be encoded is a still frame of the scene. If the content of the image frame to be encoded changes, and the degree of change is relatively large, it indicates that the content of the image frame to be encoded is basically different from the content of the reference frame. That is, with respect to the reference frame, the image frame to be encoded is a scene change frame.
  • the process of determining the change information by the encoding device is as follows: the encoding device first determines the similarity between the image frame to be encoded and the reference frame, and then determines the change information according to the determined similarity.
  • the similarity can represent whether the content of the image frame to be encoded has changed relative to the reference frame, and the degree of the change. When the similarity is large, it indicates that the content of the image frame to be encoded has not changed, or the degree of change has been small. When the similarity is small, it indicates that the content of the image frame to be encoded has changed, and the degree of change is relatively large.
  • the process for the encoding device to determine the similarity between the to-be-encoded image frame and the reference frame may specifically be:
  • the homography matrix (homography matrix) of the mapping relationship of the position of the , and the similarity between the image frame to be encoded and the reference frame is determined according to the homography matrix and the identity matrix. It can be understood that when the homography matrix is an identity matrix, it indicates that the position of the target object in the image frame to be encoded is the same as that in the reference frame.
  • the encoding device determines the similarity by comparing the homography matrix and the coefficients at the same position in the identity matrix. If the absolute value of the difference between the coefficients at each same position is less than or equal to the first threshold, the encoding device may determine that the similarity is greater, that is, the content of the image frame to be encoded and the reference frame are approximately the same. If the absolute value of the difference of the coefficients at each same position is greater than the first threshold and less than or equal to the second threshold, the encoding device determines that the similarity is in the middle range, that is, the content of the image frame to be encoded and the reference frame are the same and different The proportions are approximately the same.
  • the encoding device determines that the similarity is small, that is, the content of the image frame to be encoded and the reference frame are substantially different.
  • the first threshold and the second threshold may be preset, and the first threshold is smaller than the second threshold.
  • a homography matrix is usually a 3x3 matrix with nine coefficients.
  • the homography matrix H is as follows:
  • the coefficients of the homography matrix can be normalized by dividing each coefficient in the homography matrix by h 22 .
  • the encoding device can compare the homography matrix with the normalized coefficients to the identity matrix The coefficients at the same position of , are compared one by one to obtain the similarity between the image frame to be encoded and the reference frame.
  • the homography matrix may be obtained in the process of performing anti-shake and distortion correction on the image obtained by the video source by the ISP.
  • the homography matrix may also be obtained in other ways, and the embodiment of the present application does not limit the way of obtaining the homography matrix here.
  • the target information may also include the first bit.
  • the first bit is the bit consumed to encode the reference frame.
  • the encoding device may acquire the bits consumed for encoding the reference frame, that is, acquire the first bit.
  • the first bit is obtained after encoding the reference frame by using the encoding method provided in the embodiment of the present application.
  • the encoding device acquires reference bits.
  • the reference bit is obtained according to a preset target code rate and a preset frame rate, and the reference bit is obtained by dividing the target code rate by the frame rate.
  • the reference bit is 40kb.
  • step 401 and step 402 are not related in sequence. This embodiment of the present application does not limit the execution order of step 401 and step 402 herein.
  • the encoding device determines, according to the reference bits and the target information, the target bits allocated to the image frame to be encoded.
  • the encoding device After the encoding device determines the target information and obtains the reference bits, it can determine the target bits allocated to the image frame to be encoded according to the reference bits and the target information.
  • the process of determining the target bits of the image frame to be encoded by the encoding device is: if the change information is used to represent the difference between the image frame to be encoded and the reference frame If the content does not change, or the degree of change is very small, the encoding device can reduce the reference bit by a preset value to obtain the target bit. If the change information is used to indicate that the content of the to-be-encoded image frame has changed relative to the reference frame, and the degree of change is great, the encoding device can increase the reference bit by a preset value to obtain the target bit.
  • the change information is used to represent that the content of the image frame to be encoded has changed relative to the reference frame, and the degree of change is in the middle degree, that is, between a small degree and a large degree, it indicates the bit allocation of the image frame to be encoded by the change information
  • the impact is small, and the encoding device can determine the reference bit as the target bit.
  • the specific process for the encoding device to determine the target bit of the image frame to be encoded is as follows: the encoding device determines the target bit according to the reference bit and the first bit. The second bit is determined, and the adjustment amount of the second bit is determined according to the change information, thereby obtaining the target bit.
  • the encoder can first determine the second bit according to the reference bit and the change information, and then determine the adjustment amount of the second bit according to the first bit, so as to obtain the target bit.
  • the second bit is first determined according to the reference bit and the first bit, and then the adjustment amount of the second bit is determined according to the change information as an example for description.
  • the encoding device determining the second bit according to the reference bit and the first bit is specifically: if the first bit is larger than the reference bit, reducing the first bit to obtain the second bit. In this way, the average bit rate for a period of time can reach the target bit rate, and at the same time, the problem of poor image quality caused by the sharp fluctuation of the bit rate can be avoided. If the first bit is smaller than the reference bit, the first bit is increased to obtain the second bit. If the first bit is equal to the reference bit, the second bit is determined to be the reference bit.
  • the encoding device determines the adjustment amount of the second bit according to the change information, and obtaining the target bit may specifically include: if the change information is used to represent that the content of the image frame to be encoded has not changed relative to the reference frame, or If the degree of change is small, the encoding device can reduce the second bit by a preset value to obtain the target bit. If the change information is used to indicate that the content of the to-be-encoded image frame has changed relative to the reference frame, and the degree of change is large, in order to ensure the image quality, the encoding device can increase the second bit by a preset value, thereby obtaining target bits.
  • the change information is used to represent that the content of the image frame to be encoded has changed relative to the reference frame, and the degree of change is in the middle degree, that is, between a small degree and a large degree, it indicates that the change information is to be encoded in the image frame to be encoded.
  • the impact of the bit allocation of is small, and the encoding device can determine the second bit as the target bit.
  • the reference bit is 40kb, and the adjustment amount of each bit is 1kb. If the first bit is 45kb and 45kb is greater than 40kb, the encoding device determines that the second bit is 44kb in order to achieve the target bit rate and ensure the image quality at the same time. If the change information is used to represent that the content of the to-be-encoded image frame has not changed relative to the reference frame, or the degree of change is small, the second bit can be further adjusted downward to determine that the target bit is 43kb.
  • the second bit can be increased, and the target bit is determined to be 45kb. If the change information is used to indicate that the content of the image frame to be encoded has changed relative to the reference frame, and the degree of change is in the middle, it indicates that the change information has little influence on the bit allocation of the image frame to be encoded, and the target bit can be determined. is 44kb.
  • the adjustment amount of each bit is 1kb. If the first bit is 38kb and 38kb is less than 40kb, the encoding device determines that the second bit is 39kb. If the change information is used to represent that, relative to the reference frame, the content of the image frame to be encoded has not changed, or the degree of change is very small, the target bit is determined to be 38kb. If the change information is used to represent that the content of the image frame to be encoded has changed with respect to the reference frame, and the change is to a great extent, the target bit is determined to be 40kb. If the change information is used to represent that the content of the image frame to be encoded has changed relative to the reference frame, and the degree of change is in the middle degree, the target bit is determined to be 39kb.
  • the encoding device performs encoding on the to-be-encoded image frame, and quantization in encoding is completed according to target bits.
  • the encoding device may determine the adjustment amount of the quantization parameter according to the difference between the target bits of the image frame to be encoded and the target bits of the reference frame. Then, the encoding device determines the quantization parameter of the image frame to be encoded according to the determined adjustment amount and the quantization parameter of the reference frame. The encoding device may perform quantization on the to-be-encoded image frame according to the quantization parameter of the to-be-encoded image frame. The more bits allocated to an image frame, the smaller the quantization parameter for that image frame.
  • FIG. 5 it is a schematic diagram of a scene in which the encoding device adjusts the quantization parameter of the image frame to be encoded.
  • the encoding device determines target information, obtains reference bits, determines target bits of an image frame to be encoded according to the reference bits and target information, and performs encoding on the image frame to be encoded according to the target bits.
  • the change information can reflect the change of the content of the image frame to be encoded relative to the reference frame.
  • the target bit floats up and down the baseline, so that the encoded video rate can reach the target bit rate. For example, if the content of the to-be-encoded image frame relative to the reference frame changes greatly, a bit is added as the target bit based on the reference bit, so as to improve the image quality.
  • the bits are reduced on the basis of the reference bits as the target bits, so as to reduce the waste of resources.
  • the target bit is determined more accurately by taking the reference bit as the baseline and according to the information of the reference frame in the prior art, so that the waste of resources can be reduced or the image quality can be improved. quality.
  • the rate control is performed according to the method in the prior art, The target bits of the fifth frame will be determined according to the reference bits and the actual bits consumed by the fourth frame, which will result in insufficient bit allocation in the fifth frame, resulting in poor image quality of the fifth frame. If the rate control is performed according to the method in this embodiment of the present application, more bits than the reference bits are allocated to the fifth frame according to the reference bits and the change information, thereby improving the image quality of the fifth frame.
  • the encoding end uses the reference bit as the baseline, not only the change information, but also the actual bit consumed by encoding the reference frame, that is, the first bit.
  • the first bit is larger than the reference bit, the number of bits is reduced, and when the first bit is smaller than the reference bit, the number of bits is increased, which further improves the accuracy of the determined target bit.
  • the target bits determined in the foregoing step 403 are bit allocation between frame levels.
  • the encoding device also needs to perform block-level bit allocation.
  • the target bits can be divided by the number of image blocks of the image frame to be encoded to obtain the average bits allocated to each image block.
  • the encoding device can optimize the block-level bit allocation of the to-be-encoded image frame.
  • the encoding method may further include: the encoding device determines, according to the homography matrix and the position of the first pixel point, the image frame to be encoded relative to the reference frame and the image block bits of each image block in the image frame to be encoded are determined according to the motion vector and the target bits.
  • the first pixel is a pixel at the center of the image frame to be encoded.
  • motion vector is used to represent the motion direction of the object in the image frame to be encoded relative to the reference frame. For example, move left or right, move up or down.
  • the encoding device may determine the motion vectors mvx and mvy according to the homography matrix and the coordinates (x, y) of the first pixel point. Among them, mvx and mvy satisfy the following formulas respectively:
  • the encoding device determines the image block bits of each image block in the image frame to be encoded according to the motion vector and the target bit, which may specifically include: the encoding device first determines the target image in the image frame to be encoded according to the motion vector piece.
  • the reference frame does not include the content of the target image block, that is, the target image block refers to the image block whose image content appears in the image frame to be encoded but does not appear in the reference frame.
  • the encoding device determines the average bits of the image blocks in the image frame to be encoded according to the target bits, the average bits are obtained by dividing the target bits by the number of image blocks of the image frame to be encoded, and determines the image blocks of the target image block according to the average bits bits. Specifically, the encoding device may increase the average bits to obtain the image block bits of the target image block, and use the average bits as the image block bits of other image blocks except the target image block. In this case, the sum of image block bits of all image blocks of the image frame to be encoded is greater than the target bits of the image frame to be encoded.
  • the target image block has no reference image block compared to the reference frame, in order to improve the image quality of the image frame to be encoded, it is necessary to allocate some more bits to the target image block.
  • the image quality can be further improved.
  • the encoding device determines that the moving direction of the image frame to be encoded is horizontal rightward movement. According to the motion direction, the encoding device determines, among the image blocks of the image frame to be encoded, one or more image blocks located on the right side as the target image block. Assuming that the target bit is 44kb and the number of image blocks of the image frame to be encoded is 11, the average bit is 4kb.
  • the encoding device determines that the image block bits of each target image block in the 3 target image blocks are 5kb, and the 8 other image blocks are 5kb.
  • the image block bits for each image block in the image block are 4kb.
  • the allocated bits of the image frame to be encoded are 47 kb.
  • the encoding method may further include: the encoding device determines, according to the change information, a prediction mode corresponding to an image block of an image frame to be encoded, where the prediction mode is intra-frame prediction or inter-frame prediction.
  • the encoding device may first determine the rate-distortion cost of the prediction unit according to the change information, and then determine the prediction mode corresponding to the image block according to the rate-distortion cost.
  • the above step 404 may specifically include: the encoding device performs encoding on the image frame to be encoded according to the target bits and the prediction mode. In this way, since the change information is obtained by analyzing the global content of the image frame to be encoded, by determining the prediction mode of the image frame to be encoded according to the change information, the computational complexity of determining the prediction mode can be greatly reduced.
  • the prediction mode tends to be intra-frame prediction. But whether the final result is intra-frame prediction also needs to be determined according to the rate-distortion cost. If the change information is used to indicate that the content of the to-be-encoded image frame has not changed compared to the reference frame, or the degree of change is small, the prediction mode is more inclined to inter-frame prediction, but whether the final result requires inter-frame prediction Determined according to the rate-distortion cost. If the change information is used to represent that the content of the image frame to be encoded has an intermediate degree of change relative to the reference frame, the change information has little influence on the result of the prediction mode.
  • FIG. 6 which is a schematic structural diagram of an encoding apparatus 60 provided by an embodiment of the present application
  • the encoding apparatus 60 is configured to execute the encoding method shown in FIG. 4 .
  • the encoding device 60 may include a determination unit 61 , an acquisition unit 62 and an encoding unit 63 .
  • the determining unit 61 is configured to determine target information, where the target information includes change information, and the change information is used to represent the change of the content of the image frame to be encoded relative to the reference frame. For example, in conjunction with FIG. 4 , the determination unit 61 may be used to perform step 401 .
  • the obtaining unit 62 is configured to obtain reference bits, where the reference bits are obtained according to a preset target bit rate and a preset frame rate. For example, in conjunction with FIG. 4 , the obtaining unit 62 may be used to perform step 402 .
  • the determining unit 61 is further configured to determine the target bits allocated to the image frame to be encoded according to the target information and the reference bits obtained by the obtaining unit 62 . For example, in conjunction with FIG.
  • the determination unit 61 may also be used to perform step 403 .
  • the encoding unit 63 is configured to perform encoding on the image frame to be encoded, and the quantization in encoding is completed according to the target bits determined by the determining unit 61. For example, in conjunction with FIG. 4 , the encoding unit 63 may be used to perform step 404 .
  • the determining unit 61 is specifically configured to: determine the similarity between the image frame to be encoded and the reference frame, and determine the change information according to the similarity.
  • the determining unit 61 is specifically configured to: acquire a homography matrix, and determine the similarity according to the homography matrix and the identity matrix.
  • the homography matrix is used to represent the mapping relationship between the position of the target object in the image frame to be encoded and the reference frame.
  • the target information further includes a first bit, where the first bit is a bit consumed for encoding a reference frame, and the reference frame is a forward encoded image frame or a backward encoded image frame of the image frame to be encoded.
  • the determining unit 61 is specifically configured to: determine the second bit according to the first bit and the reference bit, and determine the adjustment amount of the second bit according to the change information to obtain the target bit.
  • the determining unit 61 is further configured to determine the motion vector of the image frame to be encoded relative to the reference frame according to the homography matrix and the position of the first pixel point, and the first pixel point is the center position of the image frame to be encoded. Pixel point; according to the motion vector and the target bit, determine the image block bit of each image block in the image frame to be encoded.
  • the determining unit 61 is specifically configured to: determine the target image block in the image frame to be encoded according to the motion vector, and the content of the target image block is not included in the reference frame; determine the image block in the image frame to be encoded according to the target bits. Average bits; the image block bits of the target image block are determined according to the average bits.
  • the determining unit 61 is further configured to determine, according to the change information, a prediction mode corresponding to an image block of the image frame to be encoded, where the prediction mode is intra-frame prediction or inter-frame prediction.
  • the encoding unit 63 is specifically configured to perform encoding on the image frame to be encoded according to the target bits and the prediction mode.
  • the encoding device 60 provided in the embodiment of the present application includes but is not limited to the above-mentioned modules.
  • the determining unit 61 , the obtaining unit 62 and the encoding unit 63 may be implemented by the video encoder of the encoding apparatus shown in FIG. 3 .
  • the specific execution process reference may be made to the description of the coding method part shown in FIG. 4 , which will not be repeated here.
  • Another embodiment of the present application further provides a computer-readable storage medium, where computer instructions are stored in the computer-readable storage medium, and when the computer instructions are executed on the encoding device, the encoding device is made to execute the method shown in the above method embodiments The individual steps performed by the encoding device in the process.
  • a chip system includes one or more interface circuits, and one or more processors.
  • the interface circuit and the processor are interconnected by wires.
  • the interface circuit is used to receive signals from the memory of the encoding device and send signals to the processor, the signals including computer instructions stored in the memory.
  • the processor executes the computer instructions
  • the encoding device executes each step performed by the encoding device in the method flow shown in the above method embodiments.
  • a computer program product is also provided.
  • the computer program product includes computer instructions.
  • the encoding device is made to execute the encoding in the method flow shown in the above method embodiments. The various steps performed by the device.
  • the computer may be implemented in whole or in part by software, hardware, firmware or any combination thereof.
  • a software program it can be implemented in whole or in part in the form of a computer program product.
  • the computer program product includes one or more computer instructions.
  • the computer-executed instructions are loaded and executed on the computer, the flow or function according to the embodiments of the present application is 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.
  • 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 website site, computer, server, or data center over a wire (e.g.
  • coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (eg infrared, wireless, microwave, etc.) means to transmit to another website site, computer, server or data center.
  • Computer-readable storage media can be any available media that can be accessed by a computer or data storage devices including one or more servers, data centers, etc., that can be integrated with the media.
  • Useful media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVDs), or semiconductor media (eg, solid state disks (SSDs)), and the like.

Abstract

一种编码方法及装置,涉及视频图像编码技术领域,解决了现有的码率控制中分配给图像帧的比特过多或不足的问题。具体方案包括:编码设备确定目标信息,该目标信息包括变化信息,获取基准比特,并根据目标信息和基准比特,确定分配给待编码图像帧的目标比特。之后,编码设备对待编码图像帧执行编码,编码中的量化是根据目标比特完成的。其中,变化信息用于表征待编码图像帧相对于参考帧的内容的变化。基准比特是根据预设的目标码率和预设的帧率得到的。

Description

一种编码方法及装置 技术领域
本申请涉及视频图像编码技术领域,尤其涉及一种编码方法及装置。
背景技术
在视频编码中,可以预先给视频设定目标码率。编码端通过进行码率控制,能够使得视频编码后的码率尽可能接近目标码率。
码率控制的过程为:编码端对视频的首个图像帧进行编码,得到编码首个图像帧消耗的实际比特。之后,对于除首个图像帧外的待编码图像帧来说,编码端根据目标码率和帧率得到图像帧的基准比特,并根据基准比特和待编码图像帧的前一图像帧的实际比特,确定分配给待编码图像帧的预估比特。编码端根据该预估比特确定待编码图像帧的量化参数(quantization parameter,QP),并采用QP对该待编码图像帧进行量化。编码端完成待编码图像帧的编码之后,得到编码待编码图像帧消耗的实际比特。重复上述过程,直至完成视频编码。
但是,编码端根据基准比特和前一图像帧的实际比特确定分配给待编码图像帧的预估比特,会导致分配的预估比特过多或不足,分配的过多会造成资源浪费,分配的不足会使得编码后的待编码图像帧的质量较差。
发明内容
本申请提供一种编码方法及装置,解决了现有的码率控制中分配给图像帧的比特过多或不足的问题。
为达到上述目的,本申请采用如下技术方案:
第一方面,本申请提供一种编码方法,编码设备确定目标信息,该目标信息包括变化信息,获取基准比特,并根据目标信息和基准比特,确定分配给待编码图像帧的目标比特。之后,编码设备对待编码图像帧执行编码,编码中的量化是根据目标比特完成的。其中,变化信息用于表征待编码图像帧相对于参考帧的内容的变化。基准比特是根据预设的目标码率和预设的帧率得到的。
变化信息能够反映待编码图像帧相对于参考帧的内容的变化,编码端通过根据待编码图像帧的内容,以基准比特为基线确定待编码图像帧的目标比特,以使得所有待编码图像帧的目标比特在基线上下浮动,从而使得视频编码后的码率能够达到目标码率。例如,若待编码图像帧相对于参考帧的内容的变化较大,则在基准比特基础上增加比特作为目标比特,以提高图像质量。若待编码图像帧相对于参考帧的内容的变化较小,则在基准比特基础上减少比特作为目标比特,以减少资源浪费。本申请实施例中确定目标比特的方式与现有技术中的以基准比特为基线,根据参考帧的信息确定目标比特相比,确定出的目标比特更加准确,从而能够减少资源浪费或者能够提高图像质量。
可选的,在本申请的一种可能的实现方式中,上述“确定变化信息”的方法可以包括:编码设备确定待编码图像帧与参考帧之间的相似度,并根据相似度,确定变化 信恩。
可选的,在本申请的另一种可能的实现方式中,上述“确定待编码图像帧与参考帧之间的相似度”的方法可以包括:编码设备获取单应性矩阵,并根据单应性矩阵与单位矩阵,确定相似度。其中,单应性矩阵用于表征目标对象在待编码图像帧与参考帧中的位置的映射关系。
在单应性矩阵的获得依赖于防抖技术的情况下,不会给编码设备带来额外的计算负担。
可选的,在本申请的另一种可能的实现方式中,目标信息还包括第一比特,第一比特为编码参考帧所消耗的比特,参考帧为待编码图像帧的前向已编码图像帧或后向已编码图像帧。
编码端在确定待编码图像帧的目标比特时,以基准比特为基线,不仅参考变化信息,还会参考编码参考帧所消耗的实际比特,即第一比特。第一比特大于基准比特时,减小比特数,第一比特小于基准比特时,增大比特数,这样进一步提高了确定的目标比特的准确性。
可选的,在本申请的另一种可能的实现方式中,上述“根据基准比特和目标信息,确定分配给待编码图像帧的目标比特”的方法可以包括:编码设备根据第一比特和基准比特,确定第二比特,并根据变化信息,确定该第二比特的调整量,得到目标比特。
可选的,在本申请的另一种可能的实现方式中,本申请提供的编码方法还包括:编码设备根据单应性矩阵和第一像素点的位置,确定待编码图像帧相对于参考帧的运动矢量,并根据该运动矢量和目标比特,确定待编码图像帧中的每个图像块的图像块比特。其中,第一像素点为待编码图像帧的中心位置的像素点。
编码设备实现了待编码图像帧的块级比特分配的优化。
可选的,在本申请的另一种可能的实现方式中,上述“根据运动矢量和目标比特,确定待编码图像帧中的每个图像块的图像块比特”的方法可以包括:编码设备根据运动矢量确定待编码图像帧中的目标图像块,根据目标比特确定待编码图像帧中的图像块的平均比特,根据平均比特确定目标图像块的图像块比特。其中,参考帧中未包括目标图像块的内容。
这样,通过优化块级码率分配,对目标图像块进行补偿,能够进一步的提高图像质量。
可选的,在本申请的另一种可能的实现方式中,本申请提供的编码方法还包括:编码设备根据变化信息,确定待编码图像帧的图像块对应的预测模式,该预测模式为帧内预测或帧间预测。该情况下,上述“对待编码图像帧执行编码”的方法可以包括:编码设备根据目标比特和预测模式,对待编码图像帧执行编码。
通过在确定预测模式时参考变化信息,能够降低计算复杂度。
第二方面,本申请提供一种编码装置,该编码装置包括用于执行上述第一方面或上述第一方面的任一种可能的实现方式的编码方法的各个模块。
第三方面,本申请提供一种编码装置,该编码装置包括存储器和处理器。存储器和处理器耦合。存储器用于存储计算机程序代码,计算机程序代码包括计算机指令。当处理器执行计算机指令时,编码装置执行如第一方面及其任一种可能的实现方式的 编码方法。
第四方面,本申请提供一种芯片系统,该芯片系统应用于编码装置。芯片系统包括一个或多个接口电路,以及一个或多个处理器。接口电路和处理器通过线路互联;接口电路用于从编码装置的存储器接收信号,并向处理器发送信号,信号包括存储器中存储的计算机指令。当处理器执行计算机指令时,编码装置执行如第一方面及其任一种可能的实现方式的编码方法。
第五方面,本申请提供一种计算机可读存储介质,该计算机可读存储介质包括计算机指令,当计算机指令在编码装置上运行时,使得编码装置执行如第一方面及其任一种可能的实现方式的编码方法。
第六方面,本申请提供一种计算机程序产品,该计算机程序产品包括计算机指令,当计算机指令在编码装置上运行时,使得编码装置执行如第一方面及其任一种可能的实现方式的编码方法。
本申请中第二方面到第六方面及其各种实现方式的具体描述,可以参考第一方面及其各种实现方式中的详细描述;并且,第二方面到第六方面及其各种实现方式的有益效果,可以参考第一方面及其各种实现方式中的有益效果分析,此处不再赘述。
附图说明
图1为本申请实施例提供的图像编解码的过程示意图;
图2为本申请实施例提供的LCU的划分示意图;
图3为本申请实施例提供的编解码系统的结构示意图;
图4为本申请实施例提供的编码方法的流程示意图;
图5为本申请实施例提供的码率控制的场景示意图;
图6为本申请实施例提供的编码装置的结构示意图。
具体实施方式
在本申请实施例中,“示例性的”或者“例如”等词用于表示作例子、例证或说明。本申请实施例中被描述为“示例性的”或者“例如”的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在以具体方式呈现相关概念。
以下,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征。在本申请实施例的描述中,除非另有说明,“多个”的含义是两个或两个以上。
为了便于理解本申请实施例,在此先对本申请实施例涉及到的术语进行简要说明。
1、图像编解码
图像编码(image encoding):将图像序列压缩成码流的处理过程。
图像解码(image decoding):将码流按照特定的语法规则和处理方法恢复成重建图像的处理过程。
图1为图像编解码的过程示意图。如图1所示,图像的编码过程为:编码端首先将一帧原始图像划分成互不重叠的多个部分,每一部分即可作为一个图像块。然后,编码端针对每个图像块执行预测(prediction)、变换(transform)、量化(quantization) 和熵编码(entropy coding)等操作,以得到编码每个图像块所消耗的实际比特。图像帧包括的所有图像块所消耗的实际比特之和为编码该图像帧所消耗的实际比特。图1中熵编码后输出的码流是指编码端对视频进行编码后,该视频的每个图像帧所消耗的实际比特组成的数据流。且,预测包括帧内预测(intra prediction)和帧间预测(interprediction),是为了得到图像块的预测块,从而可以仅对该图像块与其预测块之间的差值(或称为残差或残差块),以及预测块包含的信息进行编码和传输,进而节省传输开销。帧内预测依赖于当前帧的信息得到预测块,帧间预测依赖于当前帧和参考帧的信息得到预测块。最后,编码端将该图像块对应的码流发送给解码端。
当然,编码端也可以作为解码端,具有解码功能。如图1所示,图像的解码过程为:解码端接收来自其他编码端的码流(该码流指的是图1中输入熵编码的码流),并对接收到的码流进行熵编码、反量化、反变换、预测、滤波等操作,得到经重建的图像块(或称为重建图像块),该过程称为图像重建过程(或图像重构过程)。然后,解码端对上述原始图像中的每个图像块的重建块进行组装,得到该原始图像的经重建的图像。
2、图像块
图像编码/解码以图像块为单位,可从图像的左上角位置开始从左到右、从上到下、逐行进行编码/解码处理。这里,图像块可以为视频编解码标准H.264中的宏块(macroblock,MB),也可以为高效视频编码(high efficiency video coding,HEVC)标准中的编码单元(coding unit,CU),本申请实施例对此不作具体限定。
示例性的,当图像块为HEVC中的CU时,CU的划分过程为:编码端先将图像分割为固定大小的最大编码单元(largest coding unit,LCU),然后根据图像具体内容将每个LCU划分为CU。
LCU对应于一个方形图像区域。一个LCU对应的图像区域包括64×64个像素。64×64个像素的LCU包含由64列、每列64个像素的矩形像素点阵。
CU对应于一个A×B的矩形区域。这里,A和B的取值可以相同。A和B的取值为2的整数次幂,例如:64、32、16、8。CU的最小划分单元为8×8。
在将LCU划分为CU时,可以有四个划分深度,如,64×64、32×32、16×16、8×8。如图2中的(a)所示,划分深度为64×64时,一个LCU即为一个CU。如图2中的(b)所示,划分深度为32×32时,LCU可以划分为四个CU,分别为a、b、c、d。如图2中的(c)所示,划分深度为16×16时,a、b、c或d分别可以划分为四个CU,图2中的(c)以将a划分为a0、a1、a2、a3为例示出。如图2中的(d)所示,划分深度为8×8时,a0、a1、a2或a3分别可以划分为四个CU,图2中的(d)以将a0划分为a00、a01、a02、a03为例示出。
具体采用哪种划分深度来划分LCU,目前可以通过在预测过程中遍历每个CU的所有可选的帧内预测模式或帧间预测模式,以得到不同划分深度下,不同CU与不同预测模式组合时的率失真代价,根据率失真代价来确定LCU的最佳划分深度,该过程在计算率失真代价时会耗费大量的计算资源。因此衍生出快速预测算法,例如,根据图像的局部块的特征来进行遍历条件的提前终止,但是,快速预测算法仍会耗费计算资源。本申请实施例提供的编码方法,编码设备能够根据变化信息确定预测单元的率 失真代价,并根据该率失真代价确定图像块的预测模式,从而能够降低计算复杂度。
3、运动矢量(motion vector,MV)
运动矢量是帧间预测过程中的一个重要参数,其表示已编码的图像块相对于当前图像块的空间位移。一般的,可以使用运动估计(Motion Estimation,ME)的方法,诸如运动搜索来获取运动矢量。初期的帧间预测技术,编码端在码流中传输当前图像块的运动矢量,以使得解码端再现当前图像块的预测像素,进而得到重建块。
4、帧率
帧率是指每秒传输的图像的帧数。
5、码率控制
码率控制应用于图像的编码过程中,是一种编码优化算法,用于实现对视频码率大小的控制。可以预先设定目标码率,通过调整量化过程中的量化参数,以使得视频编码后的码率接近目标码率。
码率是指每秒传输的比特数。一般用的单位是kbps。
目前,常见的码率控制策略为平均码率控制(average bit rate,ABR),要求码率在一段时间内,如3~5秒,平均码率达到目标码率,该策略可以很好地兼顾码率稳定性和图像质量。
示例性的,结合图1,平均码率控制过程为:编码端的码率控制模块根据设定的目标码率、帧率和图像分辨率,计算出每帧图像能够被平均分配到的比特数,并将该比特数作为基准比特。当需要对视频进行编码时,编码端可以对该视频的首个图像帧进行预测、变换,并根据基准比特确定其对应的量化参数,采用该确定的量化参数对首个图像帧进行量化。然后,编码端对首个图像帧进行熵编码,以得到编码首个图像帧消耗的实际比特,并将该首个图像帧的实际比特输入到码率控制模块。之后,对于首个图像帧之后的每个待编码图像帧,编码端对待编码图像帧进行预测、变换,根据基准比特和待编码图像帧的前一图像帧的实际比特,确定分配给待编码图像帧的预估比特,并根据预估比特确定待编码图像帧的量化参数,采用该量化参数对该待编码图像帧进行量化。然后,编码端对待编码图像帧进行熵编码,以得到编码待编码图像帧所消耗的实际比特,并将待编码图像帧的实际比特输入码率控制模块。重复上述过程,直至完成视频编码。
但是,由于待编码图像帧和前一图像帧的相似性差异可能较大也可能较小,因此编码端根据基准比特和前一图像帧的实际比特确定分配给待编码图像帧的预估比特,可能会导致分配的预估比特过多或不足,分配的过多会造成资源浪费,分配的不足会使得编码后的待编码图像帧的质量较差。
为了解决上述技术问题,本申请实施例提供一种编码方法,编码端能够根据基准比特和变化信息确定待编码图像帧的目标比特,该变化信息能够反映待编码图像帧相对于参考帧的内容的变化。也就是说,编码端通过根据待编码图像帧的内容,以基准比特为基线来确定待编码图像帧的目标比特,以使得所有待编码图像帧的目标比特在基线上下浮动,从而使得视频编码后的码率能够达到目标码率。例如,若待编码图像帧相对于参考帧的内容的变化较大,则在基准比特基础上增加比特作为目标比特,以提高图像质量。若待编码图像帧相对于参考帧的内容的变化较小,则在基准比特基础 上减少比特作为目标比特,以减少资源浪费。本申请实施例中确定目标比特的方式与现有技术中的以基准比特为基线,根据参考帧的信息确定目标比特相比,确定出的目标比特更加准确,从而能够减少资源浪费或者能够提高图像质量。
本申请实施例提供的编码方法适用于视频编解码系统。图3示出了该视频编解码系统的一种结构。如图3所示,视频编解码系统包含编码装置31和解码装置32。
编码装置31产生经过编码后的视频数据,编码装置31也可以被称为源装置或编码设备。解码装置32可以对编码装置31产生的经过编码后的视频数据进行解码,解码装置32也可以被称为目的装置或解码设备。编码装置31和/或解码装置32可包含至少一个处理器以及耦合到至少一个处理器的存储器。存储器可包含但不限于只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、带电可擦可编程只读存储器(electrically erasable programmable read-only memory,EEPROM)、快闪存储器或可用于以可由计算机存取的指令或数据结构的形式存储所要的程序代码的任何其它媒体,本申请对此不作具体限定。
编码装置31和解码装置32可以包括各种装置,包含桌上型计算机、移动计算装置、笔记本(例如,膝上型)计算机、平板计算机、机顶盒、“智能”电话等电话手持机、电视机、相机、显示装置、数字媒体播放器、视频游戏控制台、车载计算机或其类似者。
在图3中,编码装置31包含视频源301、视频编码器302和输出接口303。在一些实例中,输出接口303可包含调节器/解调器(调制解调器)和/或发射器。视频源301可包括视频捕获装置(例如,摄像机)、含有先前捕获的视频数据的视频存档、用以从视频内容提供者接收视频数据的视频输入接口,和/或用于产生视频数据的计算机图形系统,或视频数据的此些来源的组合。
视频编码器302可对来自视频源301的视频数据进行编码。在一些实例中,编码装置31经由输出接口303将编码后的视频数据直接发射到解码装置32。在其它实例中,编码后的视频数据还可存储到存储装置33上,供解码装置32稍后存取来用于解码和/或播放。
可选的,编码装置31还可以包括图像信号处理器(image signal processor,ISP)304。ISP 304,用于对视频源301获取的视频数据进行多级处理,如降噪、防抖和矫正畸变等。处理之后的视频数据由视频编码器302进行视频压缩。
可选的,视频编码器302可与音频编码器集成,且可包含适当的多路复用器-多路分用器单元或其它硬件和软件,以处置共同数据流或单独数据流中的音频和视频两者的编码。
视频编码器302可以包括至少一个微处理器、数字信号处理器(digital signal processor,DSP)、专用集成电路(application-specific integrated circuit,ASIC)、现场可编程门阵列(field programmable gate array,FPGA)、离散逻辑、硬件或其任何组合。
基于上述视频编解码系统和编码装置的介绍,本申请实施例提供一种编码方法,下面结合附图对本申请实施例提供的编码方法进行描述。
如图4所示,本申请实施例提供的编码方法可以包括以下步骤401-步骤404。
401、编码设备确定目标信息。
其中,目标信息可以包括变化信息。当需要对待编码图像帧进行编码时,编码设备可以获取待编码图像帧的参考帧,并确定相对于参考帧而言,待编码图像帧的内容的变化,即确定变化信息。该参考帧可以为待编码图像帧的前向已编码图像帧或后向已编码图像帧。
可以理解,如果待编码图像帧的内容未发生变化,或者发生变化但是变化的程度较小,则表明待编码图像帧的内容与参考帧的内容近似相同。也就是说,相对于参考帧而言,待编码图像帧是场景静止帧。如果待编码图像帧的内容发生变化,且变化的程度较大,则表明待编码图像帧的内容与参考帧的内容基本不同。也就是说,相对于参考帧而言,待编码图像帧是场景变换帧。
可选的,在本申请实施例中,编码设备确定变化信息的过程具体为:编码设备先确定待编码图像帧与参考帧之间的相似度,然后根据确定出的相似度,确定变化信息。该相似度能够表征相对于参考帧而言,待编码图像帧的内容是否发生变化,以及变化的程度大小。当相似度较大时,表明待编码图像帧的内容未发生变化,或者发生变化的程度较小。当相似度较小时,表明待编码图像帧的内容发生变化,且发生变化的程度较大。
可选的,在本申请实施例中,编码设备确定待编码图像帧与参考帧之间的相似度的过程具体可以为:编码设备可以获取能够表征同一目标对象在待编码图像帧与参考帧中的位置的映射关系的单应性矩阵(homography matrix),并根据该单应性矩阵与单位矩阵,确定待编码图像帧与参考帧之间的相似度。可以理解,当单应性矩阵为单位矩阵时,表明目标对象在待编码图像帧与参考帧中的位置相同。
在一些实施例中,编码设备通过比较单应性矩阵与单位矩阵中相同位置的系数,来确定相似度。如果每个相同位置的系数的差值的绝对值均小于或等于第一阈值,则编码设备可以确定相似度较大,即待编码图像帧与参考帧的内容近似相同。如果每个相同位置的系数的差值的绝对值大于第一阈值,且小于或等于第二阈值,则编码设备确定相似度处于中间范围,即待编码图像帧与参考帧的内容相同和不同所占比例近似相同。如果每个相同位置的系数的差值的绝对值大于第二阈值,则编码设备确定相似度较小,即待编码图像帧与参考帧的内容基本不同。其中,第一阈值和第二阈值可以是预设的,第一阈值小于第二阈值。
单应性矩阵通常为3×3的矩阵,包括九个系数。例如,单应性矩阵H如下:
Figure PCTCN2021082491-appb-000001
可以将单应性矩阵中的每个系数除以h 22,来归一化单应性矩阵的系数。编码设备可以将归一化系数后的单应性矩阵与单位矩阵
Figure PCTCN2021082491-appb-000002
的相同位置的系数逐一进行比较,以得到待编码图像帧与参考帧之间的相似度。
需要说明的是,在本申请实施例中,单应性矩阵可以是ISP对视频源获取的图像 进行防抖和矫正畸变的过程中得到的。当然,单应性矩阵也可以是通过其他方式获得的,本申请实施例在此对单应性矩阵的获取方式不做限定。
在单应性矩阵的获得依赖于ISP的防抖技术的情况下,不会给编码设备带来额外的计算负担。
进一步可选的,目标信息除了包括变化信息,还可以包括第一比特。第一比特为编码参考帧所消耗的比特。编码设备在确定出参考帧之后,可以获取编码参考帧消耗的比特,即获取第一比特。该第一比特是采用本申请实施例提供的编码方法编码该参考帧后得到的。
402、编码设备获取基准比特。
该基准比特是根据预设的目标码率和预设的帧率得到的,该基准比特为目标码率除以帧率得到的。
例如,假设目标码率为1200kbps,帧率为30帧每秒,那么基准比特为40kb。
需要说明的是,在本申请实施例中,上述步骤401、步骤402的执行顺序没有先后关系。本申请实施例在此对步骤401、步骤402的执行顺序不做限定。
403、编码设备根据基准比特和目标信息,确定分配给待编码图像帧的目标比特。
编码设备在确定出目标信息,并获取到基准比特之后,可以根据基准比特和目标信息,确定分配给待编码图像帧的目标比特。
可选的,在本申请实施例中,目标信息仅包括变化信息的情况下,编码设备确定待编码图像帧的目标比特的过程为:如果变化信息用于表征待编码图像帧相对于参考帧的内容未发生变化,或发生变化的程度很小,则编码设备可以将基准比特调小预设值,从而得到目标比特。如果变化信息用于表征待编码图像帧相对于参考帧的内容发生变化,且变化的程度很大,则编码设备可以将基准比特调大预设值,从而得到目标比特。如果变化信息用于表征待编码图像帧相对于参考帧的内容发生变化,且变化的程度在中间程度,即位于较小程度和较大程度之间,则表明变化信息对待编码图像帧的比特分配的影响较小,编码设备可以将基准比特确定为目标比特。
可选的,在本申请实施例中,目标信息包括变化信息和第一比特的情况下,编码设备确定待编码图像帧的目标比特的具体过程为:编码设备根据基准比特和第一比特,确定第二比特,并根据变化信息,确定第二比特的调整量,从而得到目标比特。当然,在另一种实现方式中,编码端可以先根据基准比特和变化信息,确定第二比特,然后根据第一比特,确定第二比特的调整量,从而得到目标比特。本申请实施例中以先根据基准比特和第一比特确定第二比特,然后根据变化信息确定第二比特的调整量为例进行说明。
在一些实施例中,编码设备根据基准比特和第一比特确定第二比特具体为:如果第一比特大于基准比特,则将第一比特调小,得到第二比特。这样才能使得一段时间的平均码率达到目标码率,同时避免由于码率剧烈波动导致的图像质量较差的问题。如果第一比特小于基准比特,则将第一比特调大,得到第二比特。如果第一比特等于基准比特,则确定第二比特为基准比特。
在一些实施例中,编码设备根据变化信息确定第二比特的调整量,得到目标比特具体可以包括:如果变化信息用于表征相对于参考帧而言,待编码图像帧的内容未发 生变化,或发生变化的程度很小,则编码设备可以将第二比特调小预设值,从而得到目标比特。如果变化信息用于表征相对于参考帧而言,待编码图像帧的内容发生变化,且变化的程度很大,则为了保证图像质量,编码设备可以将第二比特调大预设值,从而得到目标比特。如果变化信息用于表征相对于参考帧而言,待编码图像帧的内容发生变化,且变化的程度在中间程度,即位于较小程度和较大程度之间,则表明变化信息对待编码图像帧的比特分配的影响较小,编码设备可以将第二比特确定为目标比特。
示例性的,假设基准比特为40kb,每次比特的调整量为1kb。若第一比特为45kb,45kb大于40kb,则编码设备为了达到目标码率,同时保证图像质量,确定第二比特为44kb。若变化信息用于表征相对于参考帧而言,待编码图像帧的内容未发生变化,或变化的程度很小,则可以将第二比特进一步向下调整,确定目标比特为43kb。若变化信息用于表征相对于参考帧而言,待编码图像帧的内容发生变化,且变化的程度很大,则为了保证图像质量,可以将第二比特调大,确定目标比特为45kb。若变化信息用于表征相对于参考帧而言,待编码图像帧的内容发生变化,且变化的程度在中间程度,则表明变化信息对待编码图像帧的比特分配的影响较小,可以确定目标比特为44kb。
再例如,假设基准比特为40kb,每次比特的调整量为1kb。若第一比特为38kb,38kb小于40kb,则编码设备确定第二比特为39kb。若变化信息用于表征相对于参考帧而言,待编码图像帧的内容未发生变化,或变化的程度很小,则确定目标比特为38kb。若变化信息用于表征相对于参考帧而言,待编码图像帧的内容发生变化,且变化的程度很大,则确定目标比特为40kb。若变化信息用于表征相对于参考帧而言,待编码图像帧的内容发生变化,且变化的程度在中间程度,则确定目标比特为39kb。
404、编码设备对待编码图像帧执行编码,编码中的量化是根据目标比特完成的。
编码设备在确定出待编码图像帧的目标比特之后,可以根据待编码图像帧的目标比特与参考帧的目标比特的差值,确定量化参数的调整量。然后,编码设备根据确定出的调整量和参考帧的量化参数,确定待编码图像帧的量化参数。编码设备可以根据待编码图像帧的量化参数,对待编码图像帧执行量化。给图像帧分配的比特越多,该图像帧的量化参数越小。
示例性的,假设参考帧为待编码图像帧的前一图像帧,那么如图5所示,为编码设备调整待编码图像帧的量化参数的场景示意图。
本申请实施例提供的编码方法,编码设备确定目标信息,获取基准比特,并根据基准比特和目标信息,确定待编码图像帧的目标比特,根据目标比特对待编码图像帧执行编码。变化信息能够反映待编码图像帧相对于参考帧的内容的变化,编码端通过根据待编码图像帧的内容,以基准比特为基线确定待编码图像帧的目标比特,以使得所有待编码图像帧的目标比特在基线上下浮动,从而使得视频编码后的码率能够达到目标码率。例如,若待编码图像帧相对于参考帧的内容的变化较大,则在基准比特基础上增加比特作为目标比特,以提高图像质量。若待编码图像帧相对于参考帧的内容的变化较小,则在基准比特基础上减少比特作为目标比特,以减少资源浪费。本申请实施例中确定目标比特的方式与现有技术中的以基准比特为基线,根据参考帧的信息确定目标比特相比,确定出的目标比特更加准确,从而能够减少资源浪费或者能够提高图像质量。
例如,假设视频序列的第0帧-第4帧画面稳定,在第5帧时图像的内容发生变化,且假设参考帧为前一帧,那么若按照现有技术中的方法进行码率控制,则会根据基准比特和第4帧消耗的实际比特确定第5帧的目标比特,这样会导致第5帧的比特分配不足导致第5帧的图像质量较差。若按照本申请实施例中的方法进行码率控制,则会根据基准比特和变化信息给第5帧分配比基准比特更多的比特,从而提高第5帧的图像质量。
进一步的,编码端在确定待编码图像帧的目标比特时,以基准比特为基线,不仅参考变化信息,还会参考编码参考帧所消耗的实际比特,即第一比特。第一比特大于基准比特时,减小比特数,第一比特小于基准比特时,增大比特数,这样进一步提高了确定的目标比特的准确性。
可选的,在本申请实施例中,上述步骤403中确定目标比特是帧级间的比特分配,当然,编码设备还需要进行块级比特分配。具体的,可以将目标比特除以待编码图像帧的图像块的数量,得到分配给每个图像块的平均比特。
进一步的,在变化信息用于表征相对于参考帧而言,待编码图像帧的内容发生变化,且变化的程度为中间程度的情况下,编码设备可以优化待编码图像帧的块级比特分配。
具体的,编码设备在获取到单应性矩阵,并确定出目标比特之后,编码方法还可以包括:编码设备根据单应性矩阵和第一像素点的位置,确定待编码图像帧相对于参考帧的运动矢量,并根据运动矢量和目标比特,确定待编码图像帧中的每个图像块的图像块比特。其中,第一像素点为待编码图像帧的中心位置的像素点。
可以理解,上述运动矢量用于表征相对于参考帧而言,待编码图像帧中的对象的运动方向。例如,向左或向右运动、向上或向下运动。
在一些实施例中,编码设备可以根据单应性矩阵和第一像素点的坐标(x,y),确定运动矢量mvx和mvy。其中,mvx和mvy分别满足以下公式:
Figure PCTCN2021082491-appb-000003
Figure PCTCN2021082491-appb-000004
在一些实施例中,编码设备根据运动矢量和目标比特,确定待编码图像帧中的每个图像块的图像块比特,具体可以包括:编码设备先根据运动矢量确定待编码图像帧中的目标图像块。其中,参考帧中未包括目标图像块的内容,也就是说,目标图像块是指图像内容出现在待编码图像帧中,未出现在参考帧中的图像块。之后,编码设备根据目标比特确定待编码图像帧中的图像块的平均比特,平均比特是目标比特除以待编码图像帧的图像块的数量得到的,并根据平均比特确定目标图像块的图像块比特。具体的,编码设备可以将平均比特调大,得到目标图像块的图像块比特,将平均比特作为除目标图像块外其他图像块的图像块比特。该情况下,待编码图像帧的所有图像块的图像块比特之和大于待编码图像帧的目标比特。
可以理解,由于相对于参考帧而言,目标图像块没有参考图像块,因此为了提高待编码图像帧的图像质量,需要多给目标图像块分配一些比特。
这样,通过优化块级码率分配,对目标图像块进行补偿,能够进一步的提高图像质量。
示例性的,如果编码设备得到的运行矢量mvx的值较大,mvy的值接近0,那么编码设备确定待编码图像帧的运动方向为水平向右运动。编码设备根据该运动方向,将待编码图像帧的图像块中,位于右侧的一个或多个图像块确定为目标图像块。假设目标比特为44kb,待编码图像帧的图像块的数量为11,则平均比特为4kb。假设目标图像块的数量为3,即其他图像块的数量为8,一次比特调整量为1kb,那么编码设备确定3个目标图像块中每个目标图像块的图像块比特为5kb,8个其他图像块中每个图像块的图像块比特为4kb。该情况下,待编码图像帧的分配的比特为47kb。
可选的,本申请实施例中,编码方法还可以包括:编码设备根据变化信息,确定待编码图像帧的图像块对应的预测模式,该预测模式为帧内预测或帧间预测。例如,编码设备可以先根据变化信息,确定出预测单元的率失真代价,然后根据率失真代价,确定图像块对应的预测模式。该情况下,上述步骤404具体可以包括:编码设备根据目标比特和预测模式,对待编码图像帧执行编码。这样,由于变化信息是通过分析待编码图像帧的全局内容得到的,因此通过根据变化信息来确定待编码图像帧的预测模式,能够大大降低确定预测模式的计算复杂度。
需要说明的是,在本申请实施例中,若变化信息用于表征相对于参考帧而言,待编码图像帧的内容发生变化,且变化的程度较大,则预测模式倾向于帧内预测,但是最终的结果是否是帧内预测还需要根据率失真代价来确定。若变化信息用于表征相对于参考帧而言,待编码图像帧的内容未发生变化,或变化的程度较小,则预测模式更倾向于帧间预测,但是最终的结果是否是帧间预测需要根据率失真代价来确定。若变化信息用于表征相对于参考帧而言,待编码图像帧的内容发生变化的程度为中间程度,则变化信息对预测模式的结果的影响较小。
上述主要从方法的角度对本申请实施例提供的方案进行了介绍。为了实现上述功能,其包含了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该很容易意识到,结合本文中所公开的实施例描述的各示例的算法步骤,本申请能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
如图6所示,为本申请实施例提供的一种编码装置60的结构示意图,编码装置60用于执行图4所示的编码方法。编码装置60可以包括确定单元61、获取单元62和编码单元63。
确定单元61,用于确定目标信息,目标信息包括变化信息,变化信息用于表征待编码图像帧相对于参考帧的内容的变化。例如,结合图4,确定单元61可以用于执行步骤401。获取单元62,用于获取基准比特,基准比特是根据预设的目标码率和预设的帧率得到的。例如,结合图4,获取单元62可以用于执行步骤402。确定单元61,还用于根据目标信息和获取单元62获取的基准比特,确定分配给待编码图像帧的目标比特。例如,结合图4,确定单元61还可以用于执行步骤403。编码单元63,用于对 待编码图像帧执行编码,编码中的量化是根据确定单元61确定的目标比特完成的。例如,结合图4,编码单元63可以用于执行步骤404。
可选的,确定单元61,具体用于:确定待编码图像帧与参考帧之间的相似度,并根据相似度,确定变化信息。
可选的,确定单元61,具体用于:获取单应性矩阵,并根据单应性矩阵与单位矩阵,确定相似度。其中,单应性矩阵用于表征目标对象在待编码图像帧与参考帧中的位置的映射关系。
可选的,目标信息还包括第一比特,第一比特为编码参考帧所消耗的比特,参考帧为待编码图像帧的前向已编码图像帧或后向已编码图像帧。
可选的,确定单元61,具体用于:根据第一比特和基准比特,确定第二比特,并根据变化信息,确定该第二比特的调整量,得到目标比特。
可选的,确定单元61,还用于根据单应性矩阵和第一像素点的位置,确定待编码图像帧相对于参考帧的运动矢量,第一像素点为待编码图像帧的中心位置的像素点;根据运动矢量和目标比特,确定待编码图像帧中的每个图像块的图像块比特。
可选的,确定单元61,具体用于:根据运动矢量确定待编码图像帧中的目标图像块,参考帧中未包括目标图像块的内容;根据目标比特确定待编码图像帧中的图像块的平均比特;根据平均比特确定目标图像块的图像块比特。
可选的,确定单元61,还用于根据变化信息,确定待编码图像帧的图像块对应的预测模式,预测模式为帧内预测或帧间预测。编码单元63,具体用于根据目标比特和预测模式,对待编码图像帧执行编码。
当然,本申请实施例提供的编码装置60包括但不限于上述模块。
在实际实现时,确定单元61、获取单元62和编码单元63可以由图3所示的编码装置的视频编码器来实现。其具体的执行过程可参考图4所示的编码方法部分的描述,这里不再赘述。
本申请另一实施例还提供一种计算机可读存储介质,该计算机可读存储介质中存储有计算机指令,当计算机指令在编码设备上运行时,使得编码设备执行上述方法实施例所示的方法流程中编码设备执行的各个步骤。
本申请另一实施例还提供一种芯片系统,该芯片系统应用于编码设备。芯片系统包括一个或多个接口电路,以及一个或多个处理器。接口电路和处理器通过线路互联。接口电路用于从编码设备的存储器接收信号,并向处理器发送信号,信号包括存储器中存储的计算机指令。当处理器执行计算机指令时,编码设备执行上述方法实施例所示的方法流程中编码设备执行的各个步骤。
在本申请另一实施例中,还提供一种计算机程序产品,该计算机程序产品包括计算机指令,当计算机指令在编码设备上运行时,使得编码设备执行上述方法实施例所示的方法流程中编码设备执行的各个步骤。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件程序实现时,可以全部或部分地以计算机程序产品的形式来实现。该计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行计算机执行指令时,全部或部分地产生按照本申请实施例的流程或功能。计算机可以是通用计算机、 专用计算机、计算机网络、或者其他可编程装置。计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,计算机指令可以从一个网站站点、计算机、服务器或者数据中心通过有线(例如同轴电缆、光纤、数字用户线(digital subscriber line,DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可以用介质集成的服务器、数据中心等数据存储设备。可用介质可以是磁性介质(例如,软盘、硬盘、磁带),光介质(例如,DVD)、或者半导体介质(例如固态硬盘(solid state disk,SSD))等。
以上所述,仅为本申请的具体实施方式。熟悉本技术领域的技术人员根据本申请提供的具体实施方式,可想到变化或替换,都应涵盖在本申请的保护范围之内。

Claims (18)

  1. 一种编码方法,其特征在于,包括:
    确定目标信息,所述目标信息包括变化信息,所述变化信息用于表征待编码图像帧相对于参考帧的内容的变化;
    获取基准比特,所述基准比特是根据预设的目标码率和预设的帧率得到的;
    根据所述基准比特和所述目标信息,确定分配给所述待编码图像帧的目标比特;
    对所述待编码图像帧执行编码,所述编码中的量化是根据所述目标比特完成的。
  2. 根据权利要求1所述的编码方法,其特征在于,确定所述变化信息,包括:
    确定所述待编码图像帧与所述参考帧之间的相似度;
    根据所述相似度,确定所述变化信息。
  3. 根据权利要求2所述的编码方法,其特征在于,所述确定所述待编码图像帧与所述参考帧之间的相似度,包括:
    获取单应性矩阵,所述单应性矩阵用于表征目标对象在所述待编码图像帧与所述参考帧中的位置的映射关系;
    根据所述单应性矩阵与单位矩阵,确定所述相似度。
  4. 根据权利要求1-3中任一项所述的编码方法,其特征在于,所述目标信息还包括第一比特,所述第一比特为编码所述参考帧所消耗的比特,所述参考帧为所述待编码图像帧的前向已编码图像帧或后向已编码图像帧。
  5. 根据权利要求4所述的编码方法,其特征在于,所述根据所述基准比特和所述目标信息,确定分配给所述待编码图像帧的目标比特,包括:
    根据所述基准比特和所述第一比特,确定第二比特;
    根据所述变化信息,确定所述第二比特的调整量,得到所述目标比特。
  6. 根据权利要求3所述的编码方法,其特征在于,所述编码方法还包括:
    根据所述单应性矩阵和第一像素点的位置,确定所述待编码图像帧相对于所述参考帧的运动矢量,所述第一像素点为所述待编码图像帧的中心位置的像素点;
    根据所述运动矢量和所述目标比特,确定所述待编码图像帧中的每个图像块的图像块比特。
  7. 根据权利要求6所述的编码方法,其特征在于,所述根据所述运动矢量和所述目标比特,确定所述待编码图像帧中的每个图像块的图像块比特,包括:
    根据所述运动矢量确定所述待编码图像帧中的目标图像块,所述参考帧中未包括所述目标图像块的内容;
    根据所述目标比特确定所述待编码图像帧中的图像块的平均比特;
    根据所述平均比特确定所述目标图像块的图像块比特。
  8. 根据权利要求1-7中任一项所述的编码方法,其特征在于,所述编码方法还包括:
    根据所述变化信息,确定所述待编码图像帧的图像块对应的预测模式,所述预测模式为帧内预测或帧间预测;
    所述对所述待编码图像帧执行编码,包括:
    根据所述目标比特和所述预测模式,对所述待编码图像帧执行编码。
  9. 一种编码装置,其特征在于,包括:
    确定单元,用于确定目标信息,所述目标信息包括变化信息,所述变化信息用于表征待编码图像帧相对于参考帧的内容的变化;
    获取单元,用于获取基准比特,所述基准比特是根据预设的目标码率和预设的帧率得到的;
    所述确定单元,还用于根据所述目标信息和所述获取单元获取的所述基准比特,确定分配给所述待编码图像帧的目标比特;
    编码单元,用于对所述待编码图像帧执行编码,所述编码中的量化是根据所述确定单元确定的所述目标比特完成的。
  10. 根据权利要求9所述的编码装置,其特征在于,所述确定单元,具体用于:
    确定所述待编码图像帧与所述参考帧之间的相似度;
    根据所述相似度,确定所述变化信息。
  11. 根据权利要求10所述的编码装置,其特征在于,所述确定单元,具体用于:
    获取单应性矩阵,所述单应性矩阵用于表征目标对象在所述待编码图像帧与所述参考帧中的位置的映射关系;
    根据所述单应性矩阵与单位矩阵,确定所述相似度。
  12. 根据权利要求9-11中任一项所述的编码装置,其特征在于,所述目标信息还包括第一比特,所述第一比特为编码所述参考帧所消耗的比特,所述参考帧为所述待编码图像帧的前向已编码图像帧或后向已编码图像帧。
  13. 根据权利要求12所述的编码装置,其特征在于,所述确定单元,具体用于:
    根据所述基准比特和所述第一比特,确定第二比特;
    根据所述变化信息,确定所述第二比特的调整量,得到所述目标比特。
  14. 根据权利要求11所述的编码装置,其特征在于,
    所述确定单元,还用于根据所述单应性矩阵和第一像素点的位置,确定所述待编码图像帧相对于所述参考帧的运动矢量,所述第一像素点为所述待编码图像帧的中心位置的像素点;根据所述运动矢量和所述目标比特,确定所述待编码图像帧中的每个图像块的图像块比特。
  15. 根据权利要求14所述的编码装置,其特征在于,所述确定单元,具体用于:
    根据所述运动矢量确定所述待编码图像帧中的目标图像块,所述参考帧中未包括所述目标图像块的内容;
    根据所述目标比特确定所述待编码图像帧中的图像块的平均比特;
    根据所述平均比特确定所述目标图像块的图像块比特。
  16. 根据权利要求9-15中任一项所述的编码装置,其特征在于,
    所述确定单元,还用于根据所述变化信息,确定所述待编码图像帧的图像块对应的预测模式,所述预测模式为帧内预测或帧间预测;
    所述编码单元,具体用于根据所述目标比特和所述预测模式,对所述待编码图像帧执行编码。
  17. 一种编码装置,其特征在于,所述编码装置包括存储器和处理器;所述存储器和所述处理器耦合;所述存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令;当所述处理器执行所述计算机指令时,所述编码装置执行如权利要求1-8 中任意一项所述的编码方法。
  18. 一种计算机可读存储介质,其特征在于,包括计算机指令,当所述计算机指令在编码装置上运行时,使得所述编码装置执行如权利要求1-8中任意一项所述的编码方法。
PCT/CN2021/082491 2021-03-23 2021-03-23 一种编码方法及装置 WO2022198465A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2021/082491 WO2022198465A1 (zh) 2021-03-23 2021-03-23 一种编码方法及装置
CN202180095762.2A CN116998148A (zh) 2021-03-23 2021-03-23 一种编码方法及装置

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/082491 WO2022198465A1 (zh) 2021-03-23 2021-03-23 一种编码方法及装置

Publications (1)

Publication Number Publication Date
WO2022198465A1 true WO2022198465A1 (zh) 2022-09-29

Family

ID=83395008

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/082491 WO2022198465A1 (zh) 2021-03-23 2021-03-23 一种编码方法及装置

Country Status (2)

Country Link
CN (1) CN116998148A (zh)
WO (1) WO2022198465A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6501800B1 (en) * 1999-09-14 2002-12-31 Nec Corporation Variable bit-rate encoding device
CN110800297A (zh) * 2018-07-27 2020-02-14 深圳市大疆创新科技有限公司 视频编码方法及装置、计算机可读存储介质
CN111757107A (zh) * 2020-06-29 2020-10-09 北京百度网讯科技有限公司 一种视频编码方法、装置、设备及介质
CN111988611A (zh) * 2020-07-24 2020-11-24 北京达佳互联信息技术有限公司 量化偏移信息的确定方法、图像编码方法、装置及电子设备

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6501800B1 (en) * 1999-09-14 2002-12-31 Nec Corporation Variable bit-rate encoding device
CN110800297A (zh) * 2018-07-27 2020-02-14 深圳市大疆创新科技有限公司 视频编码方法及装置、计算机可读存储介质
CN111757107A (zh) * 2020-06-29 2020-10-09 北京百度网讯科技有限公司 一种视频编码方法、装置、设备及介质
CN111988611A (zh) * 2020-07-24 2020-11-24 北京达佳互联信息技术有限公司 量化偏移信息的确定方法、图像编码方法、装置及电子设备

Also Published As

Publication number Publication date
CN116998148A (zh) 2023-11-03

Similar Documents

Publication Publication Date Title
CN111149358B (zh) 仿射帧间预测中子块尺寸推导的限制
US20230009360A1 (en) Method for image processing and apparatus for implementing the same
CN102685478B (zh) 编码方法以及装置、解码方法以及装置
KR20120036309A (ko) 모션 기반 동적 해상도 다중 비트 레이트 비디오 인코딩
CN113923455B (zh) 一种双向帧间预测方法及装置
WO2022088631A1 (zh) 图像编码方法、图像解码方法及相关装置
CN106170093B (zh) 一种帧内预测性能提升编码方法
KR102518627B1 (ko) 이미지 인코딩 방법, 디코딩방법, 인코더 및 디코더
KR20210118166A (ko) 적응형 개수의 영역들을 갖는 기하학적 파티셔닝을 위한 모양 적응 이산 코사인 변환
US20150163486A1 (en) Variable bitrate encoding
WO2022021422A1 (zh) 视频编码方法、编码器、系统以及计算机存储介质
US11343513B2 (en) Image encoding method and decoding method, encoder, decoder, and storage medium
KR20170007665A (ko) 스킵 모드 정보를 이용한 레이트 조절 인코딩 방법 및 그에 따른 인코딩 장치
US20150163484A1 (en) Variable bitrate encoding for multiple video streams
CN102685483B (zh) 解码方法
WO2020186763A1 (zh) 图像分量预测方法、编码器、解码器以及存储介质
WO2022198465A1 (zh) 一种编码方法及装置
JPWO2012121211A1 (ja) 量子化制御装置及び方法、及び量子化制御プログラム
WO2018205781A1 (zh) 一种实现运动估计的方法及电子设备
KR101035746B1 (ko) 동영상 인코더와 동영상 디코더에서의 분산적 움직임 예측 방법
CN114189684A (zh) 一种基于jnd算法的视频编码方法、装置、介质及计算设备
WO2021263251A1 (en) State transition for dependent quantization in video coding
JP5809574B2 (ja) 符号化方法、復号方法、符号化装置、復号装置、符号化プログラム及び復号プログラム
KR20040104831A (ko) 영상데이터의 압축 장치 및 방법
Li et al. Side information extrapolation using motion-aligned auto regressive model for compressed sensing based Wyner-Ziv codec

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

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 202180095762.2

Country of ref document: CN

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21932094

Country of ref document: EP

Kind code of ref document: A1