CN113784126A - Image encoding method, apparatus, device and storage medium - Google Patents

Image encoding method, apparatus, device and storage medium Download PDF

Info

Publication number
CN113784126A
CN113784126A CN202111095305.1A CN202111095305A CN113784126A CN 113784126 A CN113784126 A CN 113784126A CN 202111095305 A CN202111095305 A CN 202111095305A CN 113784126 A CN113784126 A CN 113784126A
Authority
CN
China
Prior art keywords
current
image
value
complexity
determining
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202111095305.1A
Other languages
Chinese (zh)
Inventor
杨智尧
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
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 Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN202111095305.1A priority Critical patent/CN113784126A/en
Publication of CN113784126A publication Critical patent/CN113784126A/en
Pending legal-status Critical Current

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/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/124Quantisation
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The application provides an image coding method, an image coding device, image coding equipment and a storage medium, wherein the method comprises the following steps: acquiring content complexity information corresponding to a current image to be coded, wherein the content complexity information comprises at least one of complexity information of a starting image in video data where the current image is located and complexity information of a current macro block in the current image; determining a content complexity value corresponding to the current image according to the content complexity information; determining a target quantization parameter of the current macro block according to the content complexity value; and coding the current macro block according to the target quantization parameter of the current macro block. Namely, when the target quantization parameter of the current macro block is determined, the influence of the content complexity of the starting image and/or the current macro block on the target QP of the current macro block is considered, so that the accuracy of determining the QP of the current macro block is improved, the quantization operation is more consistent with the image content, and the overall quality of image coding is improved.

Description

Image encoding method, apparatus, device and storage medium
Technical Field
The present disclosure relates to the field of image processing, and more particularly, to an image encoding method, an image encoding device, an image encoding apparatus, and a storage medium.
Background
Digital video technology may be incorporated into a variety of video devices, such as digital televisions, smart phones, computers, e-readers, or video players, among others. As video technology has been developed, video data includes a large amount of data, and in order to facilitate transmission of the video data, a video apparatus performs a video compression technology to more efficiently transmit or store the video data.
The code rate control ensures that the objective quality of the video is optimal under the condition that the occupied bit number is constant after the video is compressed. The size of the quantization parameter directly determines the compression degree of the video coding unit, so as to control the code rate and the video quality after video coding.
However, in the current process of determining Quantization Parameter (QP), the influence of image content is not fully considered, which results in accurate QP calculation and poor image compression quality.
Disclosure of Invention
The embodiment of the application provides an image coding method, device and equipment and a storage medium, so that QP calculation accuracy is improved, and image compression quality is improved.
In a first aspect, the present application provides an image encoding method, including:
acquiring content complexity information corresponding to a current image to be coded, wherein the content complexity information comprises at least one of complexity information of a starting image in video data where the current image is located and complexity information of a current macro block in the current image;
determining a content complexity value corresponding to the current image according to the content complexity information;
determining a target quantization parameter of the current macro block according to the content complexity value;
and coding the current macro block according to the target quantization parameter of the current macro block.
In a second aspect, an embodiment of the present application provides an image processing apparatus, configured to execute the method in the first aspect or each implementation manner thereof. In particular, the image processing apparatus comprises functional units for performing the method of the first aspect or its implementations described above.
In a third aspect, a video encoder is provided that includes a processor and a memory. The memory is used for storing a computer program, and the processor is used for calling and running the computer program stored in the memory to execute the method of the first aspect or each implementation manner thereof.
In a fourth aspect, a video coding and decoding system is provided that includes a video encoder. The video encoder is configured to perform the method of the first aspect or its implementations.
In a fifth aspect, a chip is provided for implementing the method in any one of the first to second aspects or implementations thereof. Specifically, the chip includes: a processor configured to call and run the computer program from the memory, so that the device on which the chip is installed performs the method according to the first aspect or the implementation manner thereof.
A sixth aspect provides a computer-readable storage medium for storing a computer program, the computer program causing a computer to perform the method of the first aspect or its implementations.
In a seventh aspect, a computer program product is provided, which includes computer program instructions for causing a computer to execute the method of the first aspect or its implementation modes.
In an eighth aspect, there is provided a computer program which, when run on a computer, causes the computer to perform the method of the first aspect or its implementations.
Based on the technical scheme, at least one of the complexity information of the starting image in the video data of the current image and the complexity information of the current macro block in the current image is obtained, the content complexity value corresponding to the current image is determined according to at least one of the complexity information of the starting image and the complexity information of the current macro block, the target quantization parameter of the current macro block is determined according to the content complexity value, and finally the current macro block is coded according to the target quantization parameter of the current macro block. Namely, when the target quantization parameter of the current macro block is determined, the influence of the content complexity of the starting image and/or the current macro block on the target QP of the current macro block is considered, so that the accuracy of determining the QP of the current macro block is improved, the quantization operation is more consistent with the image content, and the overall quality of image coding is improved.
Drawings
Fig. 1 is a schematic block diagram of a video encoding and decoding system according to an embodiment of the present application;
fig. 2 is a schematic block diagram of a video encoder provided by an embodiment of the present application;
fig. 3 is a schematic block diagram of a video decoder provided by an embodiment of the present application;
fig. 4 is a schematic diagram of a framework of an x.264 rate control system according to an embodiment of the present application;
FIG. 5 is a flowchart of an image encoding method according to an embodiment of the present application;
fig. 6 is a flowchart illustrating an image encoding method according to an embodiment of the present application;
fig. 7 is a schematic diagram of x.264 encoding according to an embodiment of the present application;
fig. 8 is a flowchart illustrating an image encoding method according to an embodiment of the present application;
fig. 9 is a schematic diagram of x.264 encoding according to an embodiment of the present application;
FIG. 10 is a flowchart illustrating an image encoding method according to an embodiment of the present application;
fig. 11 is a schematic diagram of x.264 encoding according to an embodiment of the present application;
fig. 12 is a schematic diagram of MB division;
FIG. 13 is a diagram illustrating intra mode selection according to an embodiment of the present application;
FIG. 14 is a diagram illustrating inter mode selection according to an embodiment of the present application;
fig. 15 is a schematic block diagram of an image encoding apparatus provided in an embodiment of the present application;
fig. 16 is a schematic block diagram of an encoding apparatus provided in an embodiment of the present application.
Detailed Description
The method and the device can be applied to the fields of image coding and decoding, video coding and decoding, hardware video coding and decoding, special circuit video coding and decoding, real-time video coding and decoding and the like. For example, the scheme of the present application may be incorporated into an audio video coding standard (AVS), such as an h.264/AVC (audio video coding) standard, an h.265/HEVC (high efficiency video coding) standard, and an h.266/vc (versatile video coding) standard. Alternatively, the schemes of the present application may operate in conjunction with other proprietary or industry standards including ITU-T H.261, ISO/IECMPEG-1Visual, ITU-T H.262 or ISO/IECMPEG-2Visual, ITU-T H.263, ISO/IECMPEG-4Visual, ITU-T H.264 (also known as ISO/IECMPEG-4AVC), including Scalable Video Codec (SVC) and Multiview Video Codec (MVC) extensions. It should be understood that the techniques of this application are not limited to any particular codec standard or technique.
For ease of understanding, a video codec system according to an embodiment of the present application will be described with reference to fig. 1.
Fig. 1 is a schematic block diagram of a video coding and decoding system according to an embodiment of the present application. It should be noted that fig. 1 is only an example, and the video coding and decoding system according to the embodiment of the present application includes, but is not limited to, that shown in fig. 1. As shown in fig. 1, the video codec system 100 includes an encoding device 110 and a decoding device 120. Wherein the encoding device is configured to encode (which may be understood as compressing) video data to generate a code stream and to transmit the code stream to the decoding device. And the decoding equipment decodes the code stream generated by the coding of the coding equipment to obtain decoded video data.
The encoding apparatus 110 of the present embodiment may be understood as an apparatus having a video encoding function, and the decoding apparatus 120 may be understood as an apparatus having a video decoding function, that is, the present embodiment includes a broader range of devices for the encoding apparatus 110 and the decoding apparatus 120, including, for example, a smart phone, a desktop computer, a mobile computing device, a notebook (e.g., laptop) computer, a tablet computer, a set-top box, a television, a camera, a display device, a digital media player, a video game console, a vehicle-mounted computer, and the like.
In some embodiments, the encoding device 110 may transmit encoded video data (e.g., a codestream) to the decoding device 120 via the channel 130. Channel 130 may include one or more media and/or devices capable of transmitting encoded video data from encoding device 110 to decoding device 120.
In one example, channel 130 includes one or more communication media that enable encoding device 110 to transmit encoded video data directly to decoding device 120 in real-time. In this example, encoding apparatus 110 may modulate the encoded video data according to a communication standard and transmit the modulated video data to decoding apparatus 120. Wherein the communication medium comprises a wireless communication medium such as the radio frequency spectrum, and optionally a wired communication medium such as one or more physical transmission lines.
In another example, channel 130 includes a storage medium that can store video data encoded by encoding device 110. Storage media includes a variety of locally-accessed data storage media such as compact disks, DVDs, flash memory, and the like. In this example, decoding device 120 may retrieve encoded video data from the storage medium.
In another example, channel 130 may comprise a storage server that may store video data encoded by encoding device 110. In this example, decoding device 120 may download the stored encoded video data from the storage server. Alternatively, the storage server may store the encoded video data and may transmit the encoded video data to the decoding device 120, such as a web server (e.g., for a website), a File Transfer Protocol (FTP) server, and so on.
In some embodiments, the encoding apparatus 110 includes a video encoder 112 and an output interface 113. The output interface 113 may comprise, among other things, a modulator/demodulator (modem) and/or a transmitter.
In some embodiments, the encoding device 110 may include a video source 111 in addition to the video encoder 112 and the input interface 113.
Video source 111 may include at least one of a video capture device (e.g., a video camera), a video archive, a video input interface for receiving video data from a video content provider, and a computer graphics system for generating video data.
The video encoder 112 encodes video data from the video source 111 to generate a code stream. Video data may comprise one or more images (pictures) or sequences of images (pictures). The code stream contains the coding information of the picture or the sequence of pictures in the form of a bit stream. The encoded information may include encoded image data and associated data. The associated data may include Sequence Parameter Sets (SPS), Picture Parameter Sets (PPS), and other syntax structures. An SPS may contain parameters that apply to one or more sequences. A PPS may contain parameters that apply to one or more pictures. A syntax structure refers to a set of zero or more syntax elements in a codestream arranged in a specified order.
The video encoder 112 transmits the encoded video data directly to the decoding apparatus 120 via the output interface 113. The encoded video data may also be stored on a storage medium or storage server for subsequent reading by decoding device 120.
In some embodiments, decoding apparatus 120 includes an input interface 121 and a video decoder 122.
In some embodiments, the decoding apparatus 120 may further include a display device 123 in addition to the input interface 121 and the video decoder 122.
The input interface 121 includes a receiver and/or a modem. The input interface 121 may receive encoded video data through the channel 130.
The video decoder 122 is configured to decode the encoded video data to obtain decoded video data, and transmit the decoded video data to the display device 123.
The display device 123 displays the decoded video data. The display device 123 may be integrated with the decoding apparatus 120 or external to the decoding apparatus 120. The display device 123 may include a variety of display devices, such as a Liquid Crystal Display (LCD), a plasma display, an Organic Light Emitting Diode (OLED) display, or other types of display devices.
In addition, fig. 1 is only an example, and the technical solution of the embodiment of the present application is not limited to fig. 1, for example, the technique of the present application may also be applied to single-sided video encoding or single-sided video decoding.
The following describes a video encoder according to an embodiment of the present application.
Fig. 2 is a schematic block diagram of a video encoder provided by an embodiment of the present application. It should be understood that the video encoder 200 may be used for lossy compression (lossy compression) as well as lossless compression (lossless compression) of images. The lossless compression may be visual lossless compression (visual lossless compression) or mathematical lossless compression (mathematical lossless compression).
The video encoder 200 may be applied to image data in a luminance chrominance (YCbCr, YUV) format. For example, the YUV ratio may be 4:2:0, 4:2:2, or 4:4:4, Y representing brightness (Luma), cb (U) representing blue Chroma, cr (V) representing red Chroma, and U and V representing Chroma for describing color and saturation. For example, in color format, 4:2:0 indicates 4 luminance components per 4 pixels, 2 chrominance components (yyyycbccr), 4:2:2 indicates 4 luminance components per 4 pixels, 4 chrominance components (yyycbcrcbccr), and 4:4:4 indicates full-pixel display (yyycbcrcbcrcbcr).
For example, the video encoder 200 reads video data, and divides one frame of image into a number of Coding Tree Units (CTUs), "Largest Coding units" (LCUs), or "Coding tree blocks" (CTBs) for each frame of image in the video data. Each CTU may be associated with a block of pixels of equal size within the picture. Each pixel may correspond to one luminance (luma or luma) sample and two chrominance (chroma or chroma) samples. Thus, each CTU may be associated with one block of luma samples and two blocks of chroma samples. One CTU size is, for example, 128 × 128, 64 × 64, 32 × 32, or the like. A CTU may be further divided into Coding Units (CUs) for Coding, and the CUs may be rectangular blocks or square blocks. A CU may be further divided into a Prediction Unit (PU) and a Transform Unit (TU), so that coding, prediction, and transform are separated, and the processing is more flexible. In one example, the CTUs are partitioned into CUs in a quadtree manner, and the CUs are partitioned into TUs and PUs in a quadtree manner.
Video encoders and video decoders may support various PU sizes. Assuming that the size of a particular CU is 2 nx 2N, video encoders and video decoders may support 2 nx 2N or nxn PU sizes for intra prediction, and 2 nx 2N, 2 nx N, N x 2N, N x N, or similar sized symmetric PUs for inter prediction. Video encoders and video decoders may also support asymmetric PUs of 2 nxnu, 2 nxnd, nlx 2N, and nrx 2N for inter prediction.
In some embodiments, as shown in fig. 2, the video encoder 200 may include: a prediction unit 210, a residual unit 220, a transform/quantization unit 230, an inverse transform/quantization unit 240, a reconstruction unit 250, a loop filtering unit 260, a decoded picture buffer 270, and an entropy coding unit 280. It should be noted that the video encoder 200 may include more, fewer, or different functional components.
Alternatively, in this application, a current block may be referred to as a current Coding Unit (CU) or a current Prediction Unit (PU), etc. The prediction block can also be called a prediction block to be coded or an image prediction block, and the reconstruction block to be coded can also be called a reconstruction block or an image reconstruction block to be coded.
In some embodiments, prediction unit 210 includes an inter prediction unit 211 and an intra estimation unit 212. Since there is a strong correlation between adjacent pixels in one frame of video, a method of using intra prediction in a video coding and decoding technology eliminates spatial redundancy between adjacent pixels. Because of strong similarity between adjacent frames in the video, the inter-frame prediction method is used in the video coding and decoding technology to eliminate the time redundancy between the adjacent frames, thereby improving the coding efficiency.
The inter prediction unit 211 may be used for inter prediction, which may refer to image information of different frames, find a reference block from a reference frame using motion information, generate a prediction block from the reference block, and remove temporal redundancy; the frames used for inter-frame prediction may be P-frames, which refer to forward predicted frames, and/or B-frames, which refer to bi-directional predicted frames. The motion information includes a reference frame list where the reference frame is located, a reference frame index, and a motion vector. The motion vector may be integer-pel or sub-pel, and if the motion vector is sub-pel, then interpolation filtering is needed in the reference frame to make the block of the required sub-pel, where the integer-pel or sub-pel block in the reference frame found based on the motion vector is called the reference block. Some techniques may directly use the reference block as the prediction block, and some techniques may reprocess the reference block to generate the prediction block. Reprocessing the generated prediction block on the basis of the reference block may also be understood as processing the reference block as a prediction block and then reprocessing it on the basis of the prediction block to generate a new prediction block.
The most commonly used inter prediction methods at present include: geometric Partitioning Mode (GPM) in the VVC video codec standard, and Angular Weighted Prediction (AWP) in the AVS3 video codec standard. These two intra prediction modes have in principle in common. The inter modes referred to in this application include, but are not limited to, the above-listed inter modes.
The intra-frame estimation unit 212 predicts pixel information within a block to be encoded of the current frame with reference to only information of the same frame image, for eliminating spatial redundancy. The frame used for intra prediction may be an I-frame.
In some embodiments, the intra prediction method further includes a Multiple Reference Line (MRL) method, and the MRL may use more reference pixels to improve coding efficiency.
There are a plurality of prediction modes for intra prediction, and 9 modes for intra prediction of 4 × 4 blocks in h.264. Wherein the mode 0 is to copy pixels above the current block to the current block in a vertical direction as a prediction value; mode 1 is to copy the left reference pixel to the current block in the horizontal direction as the prediction value; mode 2(DC) is a prediction value in which the average value of 8 points a to D and I to L is used as all points, and modes 3 to 8 are reference pixels copied to corresponding positions of the current block at certain angles. Since certain locations of the current block may not correspond exactly to the reference pixels, it may be necessary to use a weighted average of the reference pixels, or sub-pixels of the interpolated reference pixels.
The intra prediction modes used in HEVC include Planar mode (Planar), DC, and 33 angular modes, for 35 prediction modes. The intra mode used by VVC includes Planar, DC, and 65 angular modes, and 67 prediction modes. The intra modes used by the AVS3 include DC, Plane, Bilinear, and 63 angle modes, which are 66 prediction modes.
It should be noted that, as the angle mode increases, the intra-frame prediction will be more accurate, and better meet the requirements for the development of high definition and ultra-high definition digital video.
Residual unit 220 may generate a residual block for the CU based on the block of pixels of the CU and a prediction block of the PU of the CU. For example, residual unit 220 may generate a residual block for a CU such that each sample in the residual block has a value equal to the difference between: samples in a pixel block of the CU, and corresponding samples in a prediction block of a PU of the CU.
The transform/quantization unit 230 may quantize the transform coefficients. Transform/quantization unit 230 may quantize transform coefficients associated with TUs of a CU based on a Quantization Parameter (QP) value associated with the CU. The video encoder 200 may adjust the degree of quantization applied to the transform coefficients associated with the CU by adjusting the QP value associated with the CU.
The inverse transform/quantization unit 240 may apply inverse quantization and inverse transform to the quantized transform coefficients, respectively, to reconstruct a residual block from the quantized transform coefficients.
Reconstruction unit 250 may add samples of the reconstructed residual block to corresponding samples of one or more prediction blocks generated by prediction unit 210 to generate a reconstructed block to be encoded associated with the TU. In this way, the video encoder 200 may reconstruct blocks of pixels of the CU by reconstructing blocks of samples for each TU of the CU.
Loop filtering unit 260 may perform a deblocking filtering operation to reduce blocking artifacts for blocks of pixels associated with the CU.
In some embodiments, loop filtering unit 260 includes a deblocking filtering unit, a sample adaptive compensation SAO unit, an adaptive loop filtering ALF unit.
Decoded picture buffer 270 may store reconstructed pixel blocks. Inter prediction unit 211 may perform inter prediction on PUs of other pictures using a reference picture containing reconstructed pixel blocks. In addition, intra estimation unit 212 may use the reconstructed pixel blocks in decoded picture buffer 270 to perform intra prediction on other PUs in the same picture as the CU.
Entropy encoding unit 280 may receive the quantized transform coefficients from transform/quantization unit 230. Entropy encoding unit 280 may perform one or more entropy encoding operations on the quantized transform coefficients to generate entropy encoded data.
The basic flow of video coding related to the present application is as follows: on the encoding side, the current picture is divided into blocks, and for the current block, the prediction unit 210 generates a prediction block for the current block using intra prediction or inter prediction. The residual unit 220 may calculate a residual block, i.e., a difference value of the prediction block and the original block of the current block, which may also be referred to as residual information, based on the prediction block and the original block of the current block. The residual block may remove information insensitive to human eyes through processes of transformation and quantization by the transformation/quantization unit 230 to eliminate visual redundancy. Alternatively, the residual block before being transformed and quantized by the transform/quantization unit 230 may be referred to as a time domain residual block, and the time domain residual block after being transformed and quantized by the transform/quantization unit 230 may be referred to as a frequency residual block or a frequency domain residual block. The entropy coding unit 280 receives the quantized transform coefficient output by the transform quantization unit 230, may perform entropy coding on the quantized transform coefficient, and outputs a code stream. For example, the entropy encoding unit 280 may remove character redundancy according to the target context model and probability information of the binary code stream.
In addition, the video encoder performs inverse quantization and inverse transform on the quantized transform coefficient output by the transform quantization unit 230 to obtain a residual block of the current block, and then adds the residual block of the current block to the prediction block of the current block to obtain a reconstructed block of the current block. With the encoding, the reconstruction blocks corresponding to other blocks to be encoded in the current image can be obtained, and the reconstruction blocks are spliced to obtain the reconstructed image of the current image. Due to the introduction of errors in the encoding process, in order to reduce the errors, the reconstructed image is filtered, for example, the reconstructed image is filtered by using an ALF, so as to reduce the difference between the pixel value of the pixel point in the reconstructed image and the original pixel value of the pixel point in the current image. The filtered reconstructed picture is stored in the decoded picture buffer 270, and may be used as a reference frame for inter-frame prediction for subsequent frames.
It should be noted that the block division information determined by the encoding end, and mode information or parameter information such as prediction, transform, quantization, entropy coding, loop filter, etc., are carried in the code stream as necessary. The decoding end analyzes the code stream and analyzes and determines the block division information which is the same as the encoding end according to the existing information, and predicts mode information or parameter information such as transformation, quantization, entropy coding, loop filtering and the like, so that the decoding image obtained by the encoding end is the same as the decoding image obtained by the decoding end.
Fig. 3 is a schematic block diagram of a video decoder provided by an embodiment of the present application.
As shown in fig. 3, the video decoder 300 includes: entropy decoding unit 310, prediction unit 320, inverse quantization/transform unit 330, reconstruction unit 340, loop filtering unit 350, and decoded picture buffer 360. It should be noted that the video decoder 300 may include more, fewer, or different functional components.
The video decoder 300 may receive a codestream. The entropy decoding unit 310 may parse the codestream to extract syntax elements from the codestream. As part of parsing the code stream, the entropy decoding unit 310 may parse entropy-encoded syntax elements in the code stream. The prediction unit 320, the inverse quantization/transformation unit 330, the reconstruction unit 340, and the loop filtering unit 350 may decode the video data according to syntax elements extracted from the codestream, i.e., generate decoded video data.
In some embodiments, prediction unit 320 includes an intra estimation unit 321 and an inter prediction unit 322.
Intra estimation unit 321 may perform intra prediction to generate a prediction block for the PU. Intra estimation unit 321 may use an intra prediction mode to generate a prediction block for a PU based on pixel blocks of spatially neighboring PUs. The intra estimation unit 321 may also determine an intra prediction mode of the PU from one or more syntax elements parsed from the codestream.
The inter prediction unit 322 may construct a first reference picture list (list 0) and a second reference picture list (list 1) according to syntax elements parsed from the codestream. Furthermore, if the PU is encoded using inter prediction, entropy decoding unit 310 may parse the motion information of the PU. Inter prediction unit 322 may determine one or more reference blocks for the PU from the motion information of the PU. Inter prediction unit 322 may generate a prediction block for the PU from one or more reference blocks of the PU.
Inverse quantization/transform unit 330 may inverse quantize (i.e., dequantize) transform coefficients associated with the TU. Inverse quantization/transform unit 330 may use a QP value associated with a CU of the TU to determine a quantization level.
After inverse quantizing the transform coefficients, inverse quantization/transform unit 330 may apply one or more inverse transforms to the inverse quantized transform coefficients in order to generate a residual block associated with the TU.
Reconstruction unit 340 uses the residual blocks associated with the TUs of the CU and the prediction blocks of the PUs of the CU to reconstruct the pixel blocks of the CU. For example, the reconstruction unit 340 may add samples of the residual block to corresponding samples of the prediction block to reconstruct a pixel block of the CU, resulting in a reconstructed block to be encoded.
Loop filtering unit 350 may perform a deblocking filtering operation to reduce blocking artifacts for blocks of pixels associated with the CU.
In some embodiments, loop filtering unit 350 includes a deblocking filtering unit, a sample adaptive compensation SAO unit, an adaptive loop filtering ALF unit.
Video decoder 300 may store the reconstructed image of the CU in decoded image cache 360. The video decoder 300 may use the reconstructed image in the decoded image buffer 360 as a reference image for subsequent prediction or may transmit the reconstructed image to a display device for presentation.
The basic flow of video decoding related to the present application is as follows: the entropy decoding unit 310 may parse the code stream to obtain prediction information, a quantization coefficient matrix, and the like of the current block, and the prediction unit 320 may generate a prediction block of the current block using intra prediction or inter prediction on the current block based on the prediction information. The inverse quantization/transform unit 330 performs inverse quantization and inverse transform on the quantized coefficient matrix using the quantized coefficient matrix obtained from the code stream, to obtain a residual block. The reconstruction unit 340 adds the prediction block and the residual block to obtain a reconstructed block. The reconstructed blocks constitute a reconstructed image, and the loop filtering unit 350 performs loop filtering on the reconstructed image based on the image or the blocks to obtain a decoded image. The decoded image may also be referred to as a reconstructed image, and the reconstructed image may be displayed by a display device on one hand, and may be stored in the decoded image buffer 360 on the other hand, and is used as a reference frame for inter-frame prediction for a subsequent frame.
The above is a basic flow of a video codec under a block-based hybrid coding framework, and as technology develops, some modules or steps of the framework or flow may be optimized.
Fig. 4 is a schematic diagram of a framework of an x.264 coding system according to an embodiment of the present application. X.264 is one of the most widely used software encoders at present, and can provide a high compression rate and high quality video quality for standard definition and high definition video.
The x.264 rate control process is divided into an inter-frame rate control process and a macroblock rate control process, wherein the allocation of QP values for each frame is implemented by inter-frame rate control, and the allocation of QP values within each frame is implemented by macroblock rate control. The x.264 rate control process mainly depends on two variables, one is the complexity of the video frame and the other is the budget of the rate. Generally, the higher the complexity of a video frame, the more bits are required for encoding. As shown in fig. 4, after the video to be encoded enters the encoding system, the video will enter the inter-frame rate control process and the macroblock rate control process at the same time.
The feedforward module 400 is configured to provide a video frame buffer queue for a video to be encoded to assist in achieving more stable rate control.
A complexity estimation module 401, configured to estimate the complexity of a current frame in a video to be encoded.
A code rate factor calculating module 402, configured to calculate a complexity cumulative value of the current frame according to the fed back code rate of the coded frame, and then calculate a code rate factor (rateactor) according to the complexity cumulative value.
The quantization level calculating module 403 is configured to calculate a quantization level according to the complexity of the current frame output by the complexity estimating module 401 to obtain a quantization specific gravity corresponding to the current frame, and adjust the quantization specific gravity according to a rate factor (rateactor) provided by the rate factor calculating module 402 to obtain an initial quantization level.
The buffer control (VBV) module 404 adjusts the initial quantization level of the current frame output by the quantization level calculation module 403 based on the size of the buffer area at the receiving end, so as to obtain the quantization level of the current frame.
A quantization level-to-QP module 405, configured to convert the quantization level output by the buffer control (VBV) module 404 into an initial quantization parameter, and provide the initial quantization parameter to the macroblock-level quantization parameter adjustment module 406.
A macroblock tree (MBTree) partitioning module 408, configured to calculate a macroblock structure (MBTree) of the current frame according to the image content of the current frame.
The adaptive quantization module 407 is configured to calculate an average macroblock energy of the current frame according to the macroblock structure and the image content of the current frame, and determine a quantization strength factor corresponding to the average macroblock energy.
And adjusting 406 the macroblock-level quantization step size, which is used to adjust the initial quantization step size of the current frame according to the quantization strength factor to obtain the quantization parameter corresponding to the current frame.
And the quantization and entropy coding module 409 is configured to code the current frame according to the quantization parameter corresponding to the current frame, and continue the above process until all frames in the video to be coded are coded completely, and output a coded code stream.
As can be seen from fig. 4, the inter-frame rate control procedure includes: a video frame buffer queue is provided for the video to be encoded through the forward feedback module 410 to assist in completing more stable rate control, and then the complexity of the current frame in the video to be encoded is estimated through the complexity estimation module 401, for example, the complexity of the current frame may be a fuzzy complexity. The code rate factor calculating module 402 is configured to calculate a complexity cumulative value of the current frame according to the fed back code rate of the coded frame, and then calculate a code rate factor (rateactor) according to the complexity cumulative value. The quantization level calculation module 403 calculates a quantization level according to the complexity of the current frame output by the complexity estimation module 401 to obtain a quantization weight (i.e., a quantization level) corresponding to the current frame, and adjusts the quantization weight according to a rate factor (rateactor) provided by the rate factor calculation module 402 to obtain an initial quantization level. The buffer control (VBV) module 404 further adjusts the initial quantization level based on the size of the buffer area at the receiving end, resulting in a quantization level. The quantizer scale conversion QP module 405 provides the quantizer scale conversion to initial quantization parameter to the macroblock-level quantization parameter adjustment module 406.
The code rate control process at the macro block level comprises the following steps: firstly, the macroblock tree partitioning module 408 calculates the macroblock structure (MBTree) of the current frame according to the image content of the current frame; then, the adaptive quantization module 407 calculates the average macroblock energy of the current frame according to the macroblock structure and the image content of the current frame, and determines a quantization intensity factor corresponding to the average macroblock energy; the macroblock-level quantization parameter adjustment module 406 adjusts the initial quantization parameter of the current frame according to the quantization strength factor to obtain a quantization parameter corresponding to the current frame. And finally, the quantization and entropy coding module 409 encodes the current frame according to the quantization parameter corresponding to the current frame, and continues the above process until all frames in the video to be encoded are encoded, and then outputs the encoded code stream.
As can be seen from fig. 4, in the process of setting and adjusting the QP of the x.264 coding frame, the adaptive capability to the video content is weak, and the influence of the complexity of the starting frame and/or the complexity of the current macroblock on the QP is not considered, so that the QP of the macroblock is determined inaccurately, resulting in poor overall quality of the coded image.
In order to solve the above technical problem, in the embodiments of the present application, a content complexity value is determined according to complexity information of a starting image and/or complexity information of a current macroblock, and a target QP of the current macroblock is determined according to the content complexity value. Namely, in the embodiment of the present application, when determining the target QP of the current macroblock, the influence of the content complexity of the starting image and/or the current macroblock on the target QP of the current macroblock is considered, so as to accurately determine the QP of the current macroblock, so that the quantization operation better conforms to the image content, and the overall quality of image coding is improved.
The technical solutions of the embodiments of the present application are described in detail below with reference to some embodiments. The following several embodiments may be combined with each other and may not be described in detail in some embodiments for the same or similar concepts or processes.
Fig. 5 is a flowchart of an image encoding method according to an embodiment of the present application. The present application mainly relates to the determination step of quantization parameters in the image coding process, and the implementation subject may be the coding device in fig. 1 and fig. 2 described above. As shown in fig. 5, the method of the embodiment of the present application includes:
s501, content complexity information corresponding to a current image to be coded is obtained, and the content complexity information comprises at least one of complexity information of a starting image in video data where the current image is located and complexity information of a current macro block in the current image.
The video data to be encoded comprises a plurality of consecutive pictures, each picture being divisible into at least one macroblock. A macroblock represents an nXn image area, such as 16X16, that includes a luminance component and a chrominance component. A macroblock may be divided into at least one coding unit, and the QPs of the coding units in the same macroblock may be the same, i.e. the quantization parameters of the macroblock. During encoding, a residual block of the encoding unit is determined, a transform coefficient is obtained after the residual block is transformed, and the transform coefficient is quantized by using the determined QP and then encoded to obtain a code stream.
The present application relates generally to the QP determination process in the above-described encoding process.
The current picture may be understood as a picture in the video data that is in a coded state. The current image may be the first image in the video data, i.e. the starting image, or may be any image in the video data except the starting image.
The current picture may be divided into a plurality of macroblocks, and the current macroblock may be understood as a macroblock in the current picture that is in a coded state.
In some embodiments, the starting image is used as a key image of video coding, and has a large influence on the overall quality of the video, so in order to improve the calculation accuracy of the QP, the influence of the complexity of the starting image on the QP is considered when the QP is calculated, and further the calculation accuracy of the QP is improved.
The embodiment does not limit the specific content of the complexity information of the starting image.
In one example, YUV data as an input part of video coding covers all information of uncompressed video, so that it is a simple and effective method to directly use YUV data as a representation of complexity information of video content, and thus, YUV data of a starting image can be used as complexity information of the starting image.
In another example, the Y component in the YUV data represents luminance information of a video, can represent basic texture information, and can reflect complexity of video content, so the Y component in the YUV data of the starting image can be used as complexity information of the starting image.
In another example, the complexity information of the start picture includes at least one of an amount of encoding information of a macroblock included in the start picture, an encoding bit depth, and a number of macroblocks included in the start picture.
The amount of coded information of the macroblock is the sum of squares of MB errors generated in the x.264 coding flow, which reflects the complexity of the coding unit.
In some embodiments, the complexity information of the current macroblock has an influence on the adjustment process of the current macroblock QP, and therefore, the complexity information of the current macroblock is considered in the adjustment process of the QP to improve the accuracy of the QP adjustment.
The present embodiment does not limit the specific content of the complexity information of the current macroblock.
In one example, YUV data of the current macroblock is taken as complexity information of the current macroblock.
In another example, the Y component in the YUV data of the current macroblock is taken as the complexity information of the current macroblock.
In another example, the complexity information of the current macroblock includes an amount of coding information of the current macroblock.
And S502, determining the content complexity value according to the content complexity information.
The content complexity information of the present application includes at least one of complexity information of a starting image in video data where the current image is located and complexity information of a current macro block in the current image, and therefore, determining the content complexity value according to the content complexity information in the above S502 includes the following several ways:
in the first mode, if the content complexity information includes the complexity information of the starting image, the complexity value of the starting image is determined according to the complexity information of the starting image, and the complexity value of the starting image is determined as the content complexity value.
For example, if the complexity information of the starting image includes YUV data, the size of the YUV data is determined, the complexity value of the starting image is determined, and the complexity value of the starting image is determined as the content complexity value corresponding to the current image. Reference may be made in particular to the embodiment shown in fig. 7.
In one embodiment, the content complexity value corresponding to the current image includes a complexity value of the starting image.
In the mode 2, if the content complexity information includes the complexity information of the current macroblock, the complexity value of the current macroblock is determined according to the complexity information of the current macroblock, and the complexity value of the current macroblock is determined as the content complexity value.
For example, if the complexity information of the current macroblock includes YUV data, the size of the YUV data is used to determine the complexity value of the current macroblock, and the complexity value of the current macroblock is determined as the content complexity value corresponding to the current image. Reference may be made in particular to the embodiment shown in fig. 9.
In the second method, the content complexity value corresponding to the current image includes the complexity value of the current macroblock.
And determining the complexity value of the initial image according to the complexity information of the initial image, determining the complexity value of the current macro block according to the complexity information of the current macro block, and determining the complexity value of the initial image and the complexity value of the current macro block as the content complexity values.
In the third method, the content complexity value corresponding to the current image includes a complexity value of the starting image and a complexity value of the current macroblock.
And S503, determining a target quantization parameter of the current macro block according to the content complexity value.
The content complexity value of the embodiment of the present application includes at least one of a complexity value of a starting image and a complexity value of a current macroblock, and the determining of the target quantization parameter of the current macroblock according to the content complexity value in S503 includes at least the following cases:
in case 1, if the content complexity value includes a complexity value of the starting image, an initial quantization parameter of the current macroblock is determined according to the complexity value of the starting image, and a target quantization parameter of the current macroblock is determined according to the initial quantization parameter.
And 2, if the content complexity value comprises the complexity value of the current macro block, determining the initial quantization parameter of the current macro block according to the complexity value of the current image, and adjusting the initial quantization parameter of the current macro block according to the complexity value of the current macro block to obtain the target quantization parameter of the current macro block.
And 3, if the content complexity value comprises a complexity value of the initial image and a complexity value of the current macro block, determining an initial quantization parameter of the current macro block according to the complexity value of the initial image, and adjusting the initial quantization parameter of the current macro block according to the complexity value of the current macro block to obtain a target quantization parameter of the current macro block.
S504, coding the current macro block according to the target quantization parameter of the current macro block.
Specifically, a prediction mode is selected, a current macro block is predicted to obtain a prediction block of the current macro block, the current macro block is subtracted from the prediction value to obtain a residual block of the current macro block, and the residual block of the current macro block is transformed to obtain a transformation coefficient of the current macro block. And quantizing the transform coefficient of the current macro block by using the determined target quantization parameter of the current macro block to obtain the quantized transform coefficient of the current macro block, and finally coding the quantized transform coefficient of the current macro block to obtain a code stream.
According to the image coding method provided by the embodiment of the application, at least one of the complexity information of the starting image in the video data of the current image and the complexity information of the current macro block in the current image is obtained, the content complexity value corresponding to the current image is determined according to at least one of the complexity information of the starting image and the complexity information of the current macro block, the target quantization parameter of the current macro block is determined according to the content complexity value, and finally the current macro block is coded according to the target quantization parameter of the current macro block. Namely, when the target quantization parameter of the current macro block is determined, the influence of the content complexity of the starting image and/or the current macro block on the target QP of the current macro block is considered, so that the accuracy of determining the QP of the current macro block is improved, the quantization operation is more consistent with the image content, and the overall quality of image coding is improved.
When the content complexity information includes complexity information of a starting image, the encoding process of the embodiment of the present application is described below with reference to fig. 6 and 7.
Fig. 6 is a schematic flowchart of an image encoding method according to an embodiment of the present application, as shown in fig. 6, including:
s601, acquiring complexity information of the initial image.
The implementation process of S601 specifically refers to the description of S501, and is not described herein again.
At this time, S502 includes the following step S602.
S602, determining the complexity value of the initial image according to the complexity information of the initial image.
In this embodiment, the method for determining the complexity value of the starting image according to the complexity information of the starting image includes, but is not limited to, the following methods:
in the first mode, if the complexity information of the initial image is the YUV data of the initial image, the complexity value of the initial image is determined according to the size of the YUV data of the initial image. For example, the sum of the YUV sizes corresponding to each pixel point in the starting image is determined as the complexity value of the starting image.
And secondly, if the complexity information of the initial image is the Y component in the YUV data of the initial image, determining the complexity value of the initial image according to the size of the Y component of the initial image. For example, the sum of the magnitudes of the Y components corresponding to each pixel point in the starting image is determined as the complexity value of the starting image.
If the complexity information of the starting image comprises the coding information quantity and the coding bit depth of the macro block included in the starting image and the quantity of the macro blocks included in the starting image, calculating the product of the coding information quantity and the coding bit depth of the macro block in the starting image, adding the product and a first preset value to obtain a sum value, and performing index operation on the sum value by taking a second preset value as an index to obtain a first operation result corresponding to the macro block; and calculating the sum of first operation results corresponding to the macro blocks in the initial image, and determining the ratio of the sum to the number of the macro blocks included in the initial image as the complexity value of the initial image.
In the third mode, for each macro block in the starting image, the coding information amount of the macro block is obtained, the product of the coding information amount of the macro block and the coding bit depth adopted by coding is calculated, and the product and the first preset value are added to obtain a sum value. And then, taking the second preset value as an index, and performing index operation on the sum value to obtain a first operation result corresponding to the macro block. And adding the first operation results of each macro block in the initial image, dividing the first operation results by the number of the macro blocks included in the initial image to obtain a ratio, and determining the ratio as the complexity value of the initial image.
In one example, the complexity value of the starting image is determined according to the following equation (1):
Figure BDA0003268992970000171
wherein i _ frame _0_ energy represents the complexity value of the starting picture, i _ mb _ energy (x) represents the amount of coding information of the macroblocks included in the starting picture, bit _ depth represents the coded bit depth, and i _ mb _ count represents the number of macroblocks included in the starting picture.
Correspondingly, the above S503 includes the following steps S603 to S606.
S603, determining a first complexity value of the current image according to the complexity value of the starting image.
In this step, based on whether the current image is the starting image, the above S603 includes the following cases 11 and 12:
in case 11, if the current image is the starting image, the first complexity value of the current image is determined according to the complexity value of the starting image. Specifically, the determining the first complexity value of the current image according to the complexity value of the starting image includes, but is not limited to, the following ways:
in a first method, if the complexity value of the starting image is smaller than the first value, the first complexity value of the current image is determined to be a first preset complexity value.
In the first mode, specific values of the first numerical value and the first preset complexity value are not limited.
Optionally, the first value is 2.505.
Optionally, the first predetermined complexity value is 1000000.
In the second mode, if the complexity value of the starting image is greater than or equal to the second numerical value, the product of the complexity value of the starting image and the third numerical value is determined as the first complexity value of the current image.
In the second mode, specific values of the second numerical value and the third numerical value are not limited.
Optionally, the second value is 4.45.
If the complexity value of the initial image is greater than or equal to the first numerical value and less than the second numerical value, determining the product of the complexity value of the initial image and the fourth numerical value as the first complexity value of the current image.
In the second mode, the specific value of the fourth value is not limited.
The calculation method of the first to third methods is obtained by performing statistics and data analysis on the complexity information of the historical starting image. And if the current image is the initial image, determining the first complexity value of the current image in a segmented manner according to the mode, and realizing accurate calculation of the first complexity value of the current image.
If the current image is not the starting image, determining a first complexity value of the current image according to the mode of the condition 12.
In case 12, if the current image is not the starting image, S503-a1 includes determining the santd of the current image. A first complexity value of the current image is determined based on the complexity value of the starting image and the sadd of the current image.
Wherein, the sadd is the sum of absolute values of residual errors after motion compensation, the sadd of the first frame is a preset value, and the sadd of the non-first frame can be calculated according to a time-frequency transformation mode and is used for reflecting the size of the generated code stream.
The implementation manner of determining the first complexity value of the current image according to the complexity value of the starting image and the sadd of the current image in the above case 12 includes, but is not limited to, the following:
in the first mode, according to a preset rule, the complexity value of the starting image and the sadd of the current image are calculated, and the calculation result is determined as the first complexity value of the current image.
In the second way, in the above case 12, determining the first complexity value of the current image according to the complexity value of the start image and the sadd of the current image can be implemented by the following steps S603-a11 to S603-a 133:
S603-A11, acquiring the resolution of the current image. The resolution of the current image may be obtained from the metadata of the video data.
S603-A12, according to the resolution of the current image, inquiring the resolution factor corresponding to the current image in the corresponding relation between the preset resolution and the resolution factor. The embodiment of the application comprises a corresponding relation between the predicted resolution and the resolution factor, wherein the corresponding relation comprises corresponding relations between different resolutions and different resolution factors. The correspondence may be in the form of a table. The encoding apparatus may look up a resolution factor corresponding to the resolution of the current image in the correspondence table.
And S603-A13, determining a first complexity value of the current image according to the resolution factor corresponding to the current image, the complexity value of the starting image and the satd of the current image.
According to the difference of the sadd of the current image, the first complexity value of the current image is determined by segmentation in the following way. Namely, the implementation manners of the above-mentioned S603-a13 include, but are not limited to, the following:
in the first mode, if the sadd of the current image is greater than the first sadd value and the complexity value of the starting image is greater than the second preset complexity value, multiplying the third preset value by the resolution factor to obtain a first product; subtracting the first product from the satd of the current image to obtain a first difference value; multiplying the first difference value by the complexity value of the initial image to obtain a second product; and comparing the second product with a fourth preset value to obtain a first ratio, and adding the first ratio and the first product to obtain a first complexity value of the current image.
In the first mode, specific values of the second preset complexity value, the third preset value and the fourth preset value are not limited.
Optionally, the second predetermined complexity value is 2.505.
Optionally, the third preset value is 700000.
Optionally, the fourth preset value is 4.5.
Optionally, the first value of sadd is a product of the third preset value and the resolution factor, for example, the first value of sadd is 700000 × resolution _ rate, where resolution _ rate is the resolution factor.
In one example, the first complexity value of the current image may be obtained according to the following formula (2):
rcc->cplxr_sum=(rcc->last_satd-700000*resolution_rate)*h->param.i_frame_0_energy/4.5+700000*resolution_rate (2)
where rcc- > cplxr _ sum represents the first complexity value of the current picture, rcc- > last _ sant represents santd of the current picture, h- > param.i _ frame _0_ energy represents the complexity value of the start picture, and resolution _ rate represents the corresponding resolution factor of the current picture.
Comparing the complexity value of the starting image with a fifth preset value to obtain a second ratio if the sadd of the current image is greater than the first sadd value and less than the second sadd value and the complexity value of the starting image is less than or equal to a second preset complexity value; adding the sixth preset value and the second ratio to obtain a second sum; multiplying the second sum value by the satd of the current image to obtain a third product; multiplying the seventh preset value by the resolution factor to obtain a fourth product; and determining the ratio of the third product to the fourth product as the first complexity value of the current image.
In the second mode, specific values of the fifth preset value, the sixth preset value and the seventh preset value are not limited.
Optionally, the fifth preset value is 5.0.
Optionally, the sixth preset value is 7.
Optionally, the seventh preset value is 17.
Optionally, the second value of sadd is a product of a preset value and the resolution factor, for example, the second value of sadd is 1000000 resolution _ rate.
In one example, the second method may obtain the first complexity value of the current image according to the following formula (3):
rcc->cplxr_sum=(7+h->param.i_frame_0_energy/5.0)*rcc->last_satd/(17*resolution_rate) (3)
comparing the complexity value of the starting image with an eighth preset value to obtain a third ratio if the sadd of the current image is greater than or equal to a second sadd value and less than a third sadd value and the complexity value of the starting image is less than or equal to a second preset complexity value; adding the ninth preset value and the third ratio to obtain a third sum; multiplying the third sum value by the sadd of the current image to obtain a fourth product; multiplying the tenth preset value by the resolution factor to obtain a fifth product; and determining the ratio of the fourth product to the fifth product as the first complexity value of the current image.
In the third mode, specific values of the resolution factor threshold, the eighth preset value, the ninth preset value, and the tenth preset value are not limited.
Optionally, the eighth preset value is 4.0.
Optionally, the ninth preset value is 7.
Optionally, the tenth preset value is 17.
Optionally, the third value of sadd is a product of a preset value and a resolution factor, for example, the third value of sadd is 1700000 resolution _ rate.
In one example, the third method may obtain the first complexity value of the current image according to the following formula (4):
rcc->cplxr_sum=(7+h->param.i_frame_0_energy/4.0)*rcc->last_satd/(17*resolution_rate) (4)
and fourthly, if the sadd of the current image is smaller than the first sadd value, determining the first complexity value of the current image according to the sadd of the current image and the resolution factor corresponding to the current image.
For example, a ratio of the sadd of the current image and the corresponding resolution factor of the current image is determined as the first complexity value of the current image.
For another example, the tenth preset value is multiplied by the satd of the current image to obtain a sixth product; multiplying the eleventh preset value by the resolution factor to obtain a seventh product; and determining the ratio of the sixth product to the seventh product as the first complexity value of the current image.
In one example, the fourth method may obtain the first complexity value of the current image according to the following formula (5):
rcc->cplxr_sum=7*rcc->last_satd/(17*resolution_rate) (5)
in this case 12, if the current image is not the starting image, the first complexity value of the current image may be calculated by segmentation according to the above-mentioned manner. The formula of the segmentation calculation is obtained by performing statistical analysis on the relationship between the size of the complexity value of the historical starting image and the encoding cost of the image, so that the first complexity value of the current image can be accurately calculated based on the complexity value of the starting image based on the segmentation mode.
In some embodiments, the codes of the specific implementation processes of the first to fourth modes are shown in table 1:
TABLE 1
Figure BDA0003268992970000211
Figure BDA0003268992970000221
Figure BDA0003268992970000231
If the content complexity value comprises the complexity value of the initial image, calculating a first complexity value of the current image according to the segmented calculation mode. Next, the step S604 is performed, namely, an initial quantization level of the current image is determined according to the first complexity value of the current image.
S604, determining the initial quantization level of the current image according to the first complexity value of the current image.
The implementation process of determining the initial quantization level of the current image according to the first complexity value of the current image in S604 includes, but is not limited to, the following ways:
in a first mode, the determined first complexity value of the current image is used to determine an initial quantization level of the current image. And determining the ratio of the first complexity value of the current image to the code rate factor determined by the code rate factor calculation module as the initial quantization level of the current image.
And determining the initial quantization level of the current image according to the second complexity value and the first complexity value of the current image.
Illustratively, the blur complexity value of the current image may be determined according to the following equation (6):
BlurCplx=Cplxsum/Cplxcount (6)
the Cplxsum and Cplxcount updating method is shown in formula (7):
Figure BDA0003268992970000232
the method comprises the steps that BlurCplx represents the fuzzy complexity of a current image, Cplxsum represents the weighted sum of coding complexity, Cplxcount represents the weighted sum of coding frame numbers, i is the serial number of a frame to be coded, sadd is the sum SATD of absolute residual errors of the current image after motion compensation, sadd of a first frame is a preset value, and sadd of a non-first frame can be obtained through calculation according to a time-frequency transformation mode and is used for reflecting the size of a generated code stream.
In one example, the blur complexity of the current image may be determined as the second complexity value of the current image.
In one example, since the constant quality of the video frame does not mean that a constant QP value is used, and the human eye has a subjective difficulty in perceiving the loss of details for a high-complexity scene according to the visual characteristics of the human eye, the bit rate can be reduced by performing nonlinear compression on the blur complexity of the current image by using a perceptual coding optimization method to obtain a second complexity value of the current image.
The blur complexity value of the current image is compressed, for example, according to the following equation (8):
rceq=BlurCplx(1-qcomp),qcomp∈[0,1] (8)
in equation (8), rceq represents the complexity after perceptual coding optimization, i.e., the second complexity value of the current image. The specific meaning of qcomp is that when qcomp is equal to 1, the quantization specific gravities, i.e. rceq, of the frames are the same, and the bits allocated to the flat frame and the complex frame are the same; when qcomp is 0, the quantization specific gravity of each frame is in proportion to the blurring complexity of each frame, and finally the QP value of each frame is equal, which is equivalent to closing the perceptual coding optimization.
According to the mode, after the second complexity value of the current image is determined, the initial quantization level of the current image is determined according to the second complexity value and the first complexity value of the current image. For example, the second complexity value and the first complexity value of the current image are added to obtain the complexity sum value of the current image, and the ratio of the complexity sum value to the code rate factor is determined as the initial quantization level of the current image.
Illustratively, the initial quantization level of the current image is determined according to the following equation (9):
qscale=(rceq+rcc->cplxr_sum)/ratefactor (9)
in formula (9), qscale is an initial quantization level of the current frame, rcc- > cplxr _ sum is a first complexity value of the current picture, rceq is a second complexity value of the current picture, and rateactor is a rate factor.
After the initial quantization level of the current picture is determined according to the above steps, the above step S503-a3 is executed, that is, the initial quantization parameter of the current macroblock is determined according to the initial quantization level of the current picture.
And S605, determining an initial quantization parameter of the current macro block according to the initial quantization level.
In one example, determining the initial quantization parameter of the current image according to the initial quantization level of the current image may be determined by the following formula (10):
QP=a+bXlog2(qscale/c) (10)
wherein QP is an initial quantization parameter of the current picture, a, b, and c are empirical values, and optionally, a is 12, b is 6, and c is 0.85.
After the initial quantization parameter of the current image is determined, the initial quantization parameter of the current image is determined as the initial quantization parameter of the current macro block.
And S606, determining a target quantization parameter of the current macro block according to the initial quantization parameter.
In some embodiments, the target quantization parameter of the current macroblock is determined according to the initial quantization parameter of the current macroblock, including but not limited to the following:
in the first mode, the initial quantization parameter of the current macroblock is determined as the target quantization parameter of the current macroblock.
And in the second mode, the quantization intensity factor calculated by the self-adaptive quantization module is used for adjusting the initial quantization parameter of the current macro block to obtain the target quantization parameter of the current macro block.
And S607, coding the current macro block according to the target quantization parameter of the current macro block.
The implementation process of S607 refers to the description of S504, and is not described herein again.
In some embodiments, fig. 7 is a schematic diagram of x.264 coding provided in an embodiment of the present application, as shown in fig. 7, when the content complexity information corresponding to the current image includes complexity information of a starting image, the adaptive quantization module 407 determines a first complexity value of the current image through the complexity segmentation calculation method, and feeds back the determined first complexity value of the current image to the quantization level calculation module 403. The quantization level calculation module 403 determines an initial quantization parameter of the current image according to the first complexity value of the current image. Optionally, the quantization level calculation module 403 adjusts an initial quantization parameter of the current image according to the code rate factor determined by the code rate factor calculation module 402. Optionally, the VBV module 404 further adjusts the initial quantization level based on the size of the buffer area at the receiving end, so as to obtain the quantization level. The quantizer scale conversion QP module 405 provides the quantizer scale conversion to initial quantization parameter to the macroblock-level quantization parameter adjustment module 406.
According to the image coding method provided by the embodiment of the application, if the content complexity information corresponding to the current image comprises the complexity information of the initial image, the complexity value of the initial image is determined according to the complexity information of the initial image, the first complexity value of the current image is determined according to the complexity value of the initial image, the initial quantization level of the current image is determined according to the first complexity value of the current image, the initial quantization parameter of the current macro block is determined according to the initial quantization level, the target quantization parameter of the current macro block is determined according to the initial quantization parameter, and finally the current macro block is coded according to the target quantization parameter of the current macro block. That is, in the embodiment, when determining the target quantization parameter of the current macroblock, the influence of the content complexity of the starting image on the target QP of the current macroblock is considered, and then the accurate determination of the current macroblock QP is realized, so that the quantization operation better conforms to the image content, and the overall quality of image coding is improved.
When the content complexity information includes the complexity information of the current macroblock, the encoding process of the embodiment of the present application is described below with reference to fig. 8 and 9.
Fig. 8 is a schematic flowchart of an image encoding method according to an embodiment of the present application, as shown in fig. 8, including:
s701, obtaining complexity information of the current macro block.
The implementation process of S701 specifically refers to the description of S501, and is not described herein again.
At this time, S502 includes the following step S702.
S702, determining the complexity value of the current macro block according to the complexity information of the current macro block.
In this embodiment, the method for determining the complexity value of the current macroblock according to the complexity information of the current macroblock includes, but is not limited to, the following methods:
in the first mode, if the complexity information of the current macro block is the YUV data of the current macro block, the complexity value of the current macro block is determined according to the size of the YUV data of the current macro block. For example, the sum of the YUV sizes corresponding to each pixel point in the current macroblock is determined as the complexity value of the current macroblock.
And secondly, if the complexity information of the current macro block is the Y component in the YUV data of the current macro block, determining the complexity value of the current macro block according to the Y component of the current macro block. For example, the sum of the magnitudes of the Y components corresponding to each pixel point in the current macroblock is determined as the complexity value of the current macroblock.
And determining the coding information quantity of the current macro block as the complexity value of the current macro block if the complexity information of the current macro block comprises the coding information quantity of the current macro block.
In one example, the complexity value of the current macroblock is determined according to equation (11) as follows:
i_var_y=i_mb_energy (11)
wherein i _ var _ y represents the complexity value of the current macroblock, and i _ mb _ energy represents the amount of coding information of the current macroblock.
Correspondingly, the above S503 includes the following steps S703 to S706.
And S703, determining the fuzzy complexity value of the current image.
Specifically, referring to the above equations (6) and (7), the blur complexity value of the current image is calculated.
And S704, determining an initial quantization parameter of the current macro block according to the fuzzy complexity value of the current image.
Specifically, according to the blur complexity value of the current image, an initial quantization parameter of the current image is determined, and the initial quantization parameter of the current image is determined as the initial quantization parameter of the current macroblock.
In one example, a ratio of the blur complexity value to the bitrate factor of the current image is determined as an initial quantization parameter of the current image.
In one example, the blur complexity value of the current image is compressed according to the above formula (8) to obtain a second complexity value of the current image, and a ratio of the second complexity value of the current image to the bitrate factor is determined as an initial quantization parameter of the current image.
For example, according to the following formula (12), an initial quantization parameter of the current image is determined.
qscale=(rceq)/ratefactor (12)
Wherein qscale is an initial quantization parameter of the current image.
S705, adjusting the initial quantization parameter of the current macro block according to the complexity value of the current macro block to obtain a target quantization parameter of the current macro block.
In some embodiments, the manners of determining the target quantization parameter of the current macroblock in S704 include, but are not limited to, the following manners:
in a first mode, if the complexity value of the current macroblock is smaller than the preset minimum threshold, the sum of the initial quantization parameter and the fifth numerical value is determined as the target quantization parameter of the current macroblock.
The specific value of the fifth numerical value is not limited in this manner.
Optionally, the fifth value is 3.
In the second mode, if the complexity value of the current macroblock is greater than the preset maximum threshold, the difference between the initial quantization parameter and the sixth value is determined as the target quantization parameter of the current macroblock.
The specific values of the sixth value are not limited in this manner.
Optionally, the sixth value is 3.
And determining the sum of the initial quantization parameter and the seventh numerical value as the target quantization parameter of the current macro block if the initial quantization parameter of the current macro block is larger than the preset quantization parameter.
In the third mode, the specific value of the seventh value is not limited.
Optionally, the seventh value is 1.
Optionally, the preset quantization parameter is 30.
In an example, the preset minimum threshold, the preset maximum threshold, and the preset quantization parameter are obtained by performing statistical analysis on historical data.
In some embodiments, the codes of the specific implementation processes of the mode one to the mode 3 are shown in table 2:
table 2 QP adjustment key code example for MB
Figure BDA0003268992970000281
In table 2, i _ var _ y represents the complexity value of the current macroblock, i _ complete _ high represents a preset maximum threshold, and i _ complete _ low represents a preset minimum threshold.
And S706, coding the current macro block according to the target quantization parameter of the current macro block.
The implementation process of S706 refers to the description of S504, and is not described herein again.
Fig. 9 is a schematic diagram of x.264 encoding according to an embodiment of the present application, and as shown in fig. 9, if the content complexity information corresponding to the current image includes complexity information of the current macroblock, the complexity estimation module 401 estimates a second complexity value of the current image. The quantization level calculation module 403 performs quantization level calculation according to the second complexity value of the current image output by the complexity estimation module 401 to obtain an initial quantization level corresponding to the current image, and optionally adjusts the initial quantization level according to a rate factor (rateactor) provided by the rate factor calculation module 402. Optionally, the VBV module 404 further adjusts the initial quantization level based on the size of the buffer area at the receiving end, so as to obtain the quantization level. The quantizer scale conversion QP module 405 provides the quantizer scale conversion to initial quantization parameter to the macroblock-level quantization parameter adjustment module 406.
The macroblock-level quantization parameter adjustment module 406 determines a complexity value of the current macroblock, and adjusts the initial quantization parameter of the current image using the complexity value of the current macroblock to obtain a target quantization parameter of the current macroblock. Optionally, in the above adjusting process, the macroblock-level quantization parameter adjusting module 406 integrates the quantization intensity factor output by the adaptive quantization module 407 and the complexity value of the current macroblock, and adjusts the initial quantization parameter of the current image to obtain the target quantization parameter of the current macroblock.
According to the image coding method provided by the embodiment of the application, if the content complexity value only comprises the complexity value of the current macro block, the fuzzy complexity value of the current image is determined, the initial quantization parameter of the current macro block is determined according to the fuzzy complexity value, and then the initial quantization parameter of the current macro block is adjusted by using the complexity value of the current macro block, so that the adjusted quantization parameter is more in line with the image content, and the calculation accuracy of the QP of the current macro block can be further improved.
When the content complexity information includes the complexity information of the starting image and the complexity information of the current macroblock, the encoding process of the embodiment of the present application will be described with reference to fig. 10 and 11.
Fig. 10 is a flowchart illustrating an image encoding method according to an embodiment of the present application, as shown in fig. 10, including:
s801, acquiring complexity information of a starting image and complexity information of a current macro block.
The implementation process of S801 specifically refers to the description of S501, and is not described herein again.
At this time, S502 includes the following step S802.
S802, determining the complexity value of the initial image according to the complexity information of the initial image, and determining the complexity value of the current macro block according to the complexity information of the current macro block.
The determining of the complexity value of the starting image according to the complexity information of the starting image may refer to the description of S602, and the determining of the complexity value of the current macroblock according to the complexity information of the current macroblock may refer to the description of S702, which is not described herein again.
And S803, determining the initial quantization parameter of the current macro block according to the complexity value of the initial image.
The implementation process of the above S803 may refer to detailed descriptions of the above S603 to S605, which are not described herein again.
S804, adjusting the initial quantization parameter of the current macro block according to the complexity value of the current macro block to obtain the target quantization parameter of the current macro block.
The implementation process of the above S804 refers to the detailed description of the above S705, and is not described herein again.
And S805, coding the current macro block according to the target quantization parameter of the current macro block.
The implementation process of S805 refers to the description of S504, and is not described herein again.
In some embodiments, fig. 11 is a schematic diagram of x.264 coding provided in an embodiment of the present application, as shown in fig. 11, if the content complexity information corresponding to the current image includes complexity information of a starting image and complexity information of a current macroblock, the complexity estimation module 401 estimates a second complexity value of the current image, and feeds back the second complexity value of the current image to the quantization level calculation module 403. Meanwhile, the adaptive quantization module 407 determines the first complexity value of the current image by the complexity segmentation calculation method of this embodiment, and feeds back the determined first complexity value of the current image to the quantization level calculation module 403. The quantization level calculation module 403 calculates a quantization level according to the first complexity value and the second complexity value of the current image to obtain an initial quantization level corresponding to the current image, and optionally adjusts the initial quantization level according to a rate factor (rateactor) provided by the rate factor calculation module 402. Optionally, the VBV module 404 further adjusts the initial quantization level based on the size of the buffer area at the receiving end, so as to obtain the quantization level. The quantizer scale conversion QP module 405 provides the quantizer scale conversion to initial quantization parameter to the macroblock-level quantization parameter adjustment module 406.
The macroblock-level quantization parameter adjustment module 406 determines the complexity value of the current macroblock according to the complexity information of the current macroblock, and adjusts the initial quantization parameter of the current image by using the complexity value of the current macroblock to obtain the target quantization parameter of the current macroblock. Optionally, in the above adjusting process, the macroblock-level quantization parameter adjusting module 406 integrates the quantization intensity factor output by the adaptive quantization module and the complexity value of the current macroblock, and adjusts the initial quantization parameter of the current image to obtain the target quantization parameter of the current macroblock.
According to the image coding method provided by the embodiment of the application, if the content complexity information comprises the complexity information of the initial image and the complexity information of the current macro block, the initial quantization parameter of the current macro block is determined by calculating the complexity value of the initial image and the complexity value of the current macro block according to the complexity value of the initial image, and then the initial quantization parameter of the current macro block is adjusted by using the complexity value of the current macro block, so that the determination process of the quantization parameter is more consistent with the image content, and the calculation accuracy of the QP of the current macro block can be further improved.
The process of determining the target quantization parameter for the current macroblock based on the content complexity of the starting image and/or the current macroblock is described above. On this basis, in order to further improve the coding efficiency, the embodiment of the present application further provides a macroblock partitioning process for introduction.
The division of MBs can be understood as a process of dividing MBs into coding units, and the division of MBs is one of important factors affecting coding speed.
The x.264 macroblock has a basic size of 16X16, and is specifically divided as shown in fig. 12, for example, including 16X16, 8X16, 16X8, 8X8, 4X8, 8X4, 4X4, and 16X16 plan.
The MB division method may be understood as an MB coding method, and includes an intra mode, an inter mode, and a Skip mode.
Optionally, the intra mode includes: 16X16, 8X16, 16X8, 8X8, 4X8, 8X4, 4X 4.
Optionally, the inter mode includes: 16X16, 8X16, 16X8, 8X8, 4X8, 8X4, 4X 4.
In order to reduce the calculation redundancy of the MB division, the method and the device introduce the adjustment of the complexity threshold, that is, the rate-distortion cost threshold corresponding to at least one intra mode in the intra modes is adjusted, so that the adjusted threshold is more fit to the actual situation.
In some embodiments, for the intra mode, the determining a target intra mode of a current macroblock according to the embodiments of the present application includes: determining a first rate distortion cost when an ith intra mode is used for coding a current macro block aiming at the ith intra mode in preset N intra modes, wherein N is a positive integer, and i is a positive integer less than or equal to N; obtaining an adjusted rate distortion cost threshold corresponding to the ith intra-frame mode; if the first rate distortion cost is less than the adjusted rate distortion cost threshold, the current macroblock is encoded by taking the ith intra mode as the target intra mode of the current macroblock, i.e. the current macroblock is divided by using the ith intra mode, for example, when the ith intra mode is the 8X8 mode, the current macroblock of 16X16 is divided into 4 8X8 sub-blocks according to the division mode of the 8X8 mode, and the 8X8 sub-blocks are encoded as encoding units.
In an example, the N intra modes include several intra modes, i.e., 16X16, 8X16, 16X8, 8X8, 4X8, 8X4, and 4X4, and according to the order of the intra modes, the first rate-distortion cost corresponding to each intra mode is sequentially calculated, and when the first rate-distortion cost is smaller than the adjusted rate-distortion cost threshold, the current macroblock is encoded using the intra mode, and the subsequent intra mode is not determined. For example, a first rate-distortion cost when the current macroblock is encoded by using the 16X16 intra mode is calculated, and if the first rate-distortion cost is less than or equal to the rate-distortion cost threshold after the 16X16 intra mode adjustment, the 16X16 intra mode is determined as the target intra mode of the current macroblock. If the first rate-distortion cost is greater than the rate-distortion cost threshold after the intra mode adjustment of 16X16, calculating a first rate-distortion cost when the current macroblock is encoded by using the 8X16 intra mode, and determining whether the first rate-distortion cost corresponding to the 8X16 intra mode is less than or equal to the rate-distortion cost threshold after the intra mode adjustment of 8X16, and sequentially performing the steps.
In another example, the N intra modes include 16X16, 8X8, and 4X 4. Correspondingly, only the rate-distortion cost thresholds corresponding to the 3 intra modes are adjusted. As shown in fig. 13, first, a first rate-distortion cost (denoted as a first rate-distortion cost 16) when a current macroblock is encoded by using a 16X16 intra mode is calculated, and it is determined whether the first rate-distortion cost 16 corresponding to the 16X16 intra mode is less than or equal to a rate-distortion cost threshold (denoted as a rate-distortion cost threshold 16) after the 16X16 intra mode is adjusted. If the first rate-distortion cost 16 corresponding to the 16X16 intra mode is less than or equal to the rate-distortion cost threshold after the 16X16 intra mode adjustment, the 16X16 intra mode is determined as the target intra mode of the current macroblock. If the first rate-distortion cost 16 corresponding to the 16X16 intra mode is greater than the rate-distortion cost threshold 16 after the 16X16 intra mode is adjusted, a first rate-distortion cost (denoted as a first rate-distortion cost 8) when the current macroblock is encoded by using the 8X8 intra mode is calculated, and it is determined whether the first rate-distortion cost 8 corresponding to the 8X8 intra mode is less than or equal to the rate-distortion cost threshold (denoted as a rate-distortion cost threshold 8) after the 8X8 intra mode is adjusted. If the first rate-distortion cost 8 corresponding to the 8X8 intra mode is less than or equal to the 8X8 intra mode adjusted rate-distortion cost threshold 8, the 8X8 intra mode is determined as the target intra mode of the current macroblock. If the first rate-distortion cost 8 corresponding to the 8X8 intra mode is greater than the rate-distortion cost threshold 8 after the 8X8 intra mode is adjusted, a first rate-distortion cost (denoted as a first rate-distortion cost 4) when the current macroblock is encoded by using the 4X4 intra mode is calculated, and whether the first rate-distortion cost 4 corresponding to the 4X4 intra mode is less than or equal to the rate-distortion cost threshold 4 after the 4X4 intra mode is adjusted is determined (denoted as a rate-distortion cost threshold 4). If the first rate-distortion cost 4 corresponding to the 4X4 intra mode is less than or equal to the rate-distortion cost threshold 4 after the 4X4 intra mode adjustment, the 4X4 intra mode is determined as the target intra mode of the current macroblock. If the first rate-distortion cost 4 corresponding to the 4X4 intra mode is greater than the rate-distortion cost threshold 4 after the 4X4 intra mode adjustment, the target intra mode of the current macroblock is determined from the remaining intra modes.
In some embodiments, since the Skip mode directly uses the adjacent encoded block as a reference block, the calculation amount is small, and when a macroblock adopts Skip mode encoding, other data of the macroblock is not sent except for marking a mark for encoding the macroblock by using Skip mode, thereby saving the code rate. Based on this, in order to increase the use frequency of Skip mode, the embodiment of the present application proposes the following two schemes:
in the first scheme, if the coding mode of the adjacent coded macroblock of the current macroblock is Skip mode, the Skip mode is used to code the current macroblock.
And in the second scheme, the selection of the Skip mode is added in the selection process of the inter-frame mode so as to improve the use probability of the Skip mode. Specifically, for a jth inter mode in preset M inter modes, determining a second rate distortion cost when the jth inter mode is used to encode a current macroblock, where M is a positive integer, and j is a positive integer less than or equal to M; determining a third rate-distortion cost when the current macro block is coded by using the Skip mode; and if the third rate distortion cost is less than or equal to the second rate distortion cost, encoding the current macro block by using a Skip mode.
In some examples, the jth inter mode is any one of M inter modes.
In other examples, to reduce the amount of computation, the jth inter mode is a first intra mode of the M inter modes, for example, the jth intra mode is a 16X16 intra mode. Specifically, as shown in fig. 14, a second rate-distortion cost when the current macroblock is encoded using the 16X16 intra mode is calculated, a third rate-distortion cost when the current macroblock is encoded using the Skip mode is calculated, and if the third rate-distortion cost is less than or equal to the second rate-distortion cost, the current macroblock is encoded using the Skip mode. If the third rate distortion cost is greater than the second rate distortion cost corresponding to the 16X16 inter-frame mode, according to the process shown in fig. 14, the costs corresponding to the inter-frame modes such as 8X8, 4X4, 4X8, and 8X4 are determined, and the inter-frame mode with the smallest cost is selected as the target inter-frame mode of the current image.
According to the embodiment of the application, the selection probability of the Skip mode is increased, and the encoding speed can be greatly improved under the condition that the encoding compression rate and the encoding quality are ensured.
To further illustrate the effectiveness of the technical solution of the present application, in some embodiments, a commercial-dedicated transcoding data set is selected for testing, the number of videos is tested to be 50, the video resolution includes 960x540, 1024x576, 1280x720, and 1920x1080, an ABR mode is adopted, and the bitrate is set at a relatively low 1.4Mb/s and a frame rate of 25 fps. The method and the device are transversely compared with the standard X.264 under the same condition, the overall average improvement on the objective quality of the PSNR is about 0.575dB, and the average improvement on the encoding speed is 10%, so that the conclusion can be drawn that the technical scheme of the application has more obvious improvement on the quality of the encoded video, the encoding speed is improved, and the compression rate of encoding cannot be influenced. The optimized encoder meets the encoding standard, has no compatibility problem, and can be widely applied to scenes such as video encoding, transcoding and editing.
It should be understood that fig. 5-14 are only examples of the present application and should not be construed as limiting the present application.
The preferred embodiments of the present application have been described in detail with reference to the accompanying drawings, however, the present application is not limited to the details of the above embodiments, and various simple modifications can be made to the technical solution of the present application within the technical idea of the present application, and these simple modifications are all within the protection scope of the present application. For example, the various features described in the foregoing detailed description may be combined in any suitable manner without contradiction, and various combinations that may be possible are not described in this application in order to avoid unnecessary repetition. For example, various embodiments of the present application may be arbitrarily combined with each other, and the same should be considered as the disclosure of the present application as long as the concept of the present application is not violated.
It should also be understood that, in the various method embodiments of the present application, the sequence numbers of the above-mentioned processes do not imply an execution sequence, and the execution sequence of the processes should be determined by their functions and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application. In addition, in the embodiment of the present application, the term "and/or" is only one kind of association relation describing an associated object, and means that three kinds of relations may exist. Specifically, a and/or B may represent: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
Method embodiments of the present application are described in detail above in conjunction with fig. 5-14, and apparatus embodiments of the present application are described in detail below in conjunction with fig. 15-16.
Fig. 15 is a schematic block diagram of an image encoding apparatus provided in an embodiment of the present application.
As shown in fig. 15, the image encoding device 10 includes:
an obtaining unit 11, configured to obtain content complexity information corresponding to a current image to be encoded, where the content complexity information includes at least one of complexity information of a starting image in video data in which the current image is located and complexity information of a current macroblock in the current image;
a complexity determining unit 12, configured to determine a content complexity value corresponding to the current image according to the content complexity information;
a quantization parameter determining unit 13, configured to determine a target quantization parameter of the current macroblock according to the content complexity value;
and an encoding unit 14, configured to encode the current macroblock according to the target quantization parameter of the current macroblock.
In some embodiments, the complexity determining unit 12 is specifically configured to determine, if the content complexity information includes complexity information of the starting image, a complexity value of the starting image according to the complexity information of the starting image, and determine the complexity value of the starting image as the content complexity value;
if the content complexity information comprises the complexity information of the current macro block, determining the complexity value of the current macro block according to the complexity information of the current macro block, and determining the complexity value of the current macro block as the content complexity value;
if the content complexity information comprises the complexity information of the initial image and the complexity information of the current macro block, determining the complexity value of the initial image according to the complexity information of the initial image, determining the complexity value of the current macro block according to the complexity information of the current macro block, and determining the complexity value of the initial image and the complexity value of the current macro block as the content complexity values.
Optionally, the complexity information of the starting picture includes at least one of an amount of coding information, a coded bit depth of a macroblock included in the starting picture, and a number of macroblocks included in the starting picture.
In some embodiments, the complexity determining unit 12 is specifically configured to calculate a product of an amount of coding information of a macroblock in the starting image and the coding bit depth, add the product to a first preset value to obtain a sum, and perform an exponential operation on the sum by using a second preset value as an index to obtain a first operation result corresponding to the macroblock; and calculating the sum of first operation results corresponding to macro blocks in the initial image, and determining the ratio of the sum to the number of the macro blocks included in the initial image as the complexity value of the initial image.
Optionally, the complexity information of the current macroblock includes an amount of coding information of the current macroblock.
In some embodiments, the complexity determining unit 12 is specifically configured to determine the amount of coding information of the current macroblock as the complexity value of the current macroblock.
In some embodiments, the quantization parameter determining unit 13 is specifically configured to determine an initial quantization parameter of the current macroblock according to the complexity value of the starting image if the content complexity value includes the complexity value of the starting image, and determine a target quantization parameter of the current macroblock according to the initial quantization parameter; and/or the presence of a gas in the gas,
if the content complexity value comprises the complexity value of the current macro block, determining a fuzzy complexity value of the current image, determining an initial quantization parameter of the current macro block according to the fuzzy complexity value of the current image, and adjusting the initial quantization parameter of the current macro block according to the complexity value of the current macro block to obtain a target quantization parameter of the current macro block; and/or the presence of a gas in the gas,
if the content complexity value comprises the complexity value of the initial image and the complexity value of the current macro block, determining the initial quantization parameter of the current macro block according to the complexity value of the initial image, and adjusting the initial quantization parameter of the current macro block according to the complexity value of the current macro block to obtain the target quantization parameter of the current macro block.
In some embodiments, the quantization parameter determining unit 13 is specifically configured to determine a first complexity value of the current image according to the complexity value of the starting image; determining an initial quantization level of the current image according to the first complexity value of the current image; and determining an initial quantization parameter of the current macro block according to the initial quantization level.
In some embodiments, the quantization parameter determining unit 13 is specifically configured to determine, if the current image is the starting image, a first complexity value of the current image according to the complexity value of the starting image; and/or the presence of a gas in the gas,
if the current image is not the starting image, determining a residual absolute value sum sadd of the current image after motion compensation, and determining a first complexity value of the current image according to the complexity value of the starting image and the sadd of the current image.
In some embodiments, the quantization parameter determining unit 13 is specifically configured to determine that the first complexity value of the current image is a first preset complexity value if the complexity value of the starting image is smaller than a first numerical value; and/or the presence of a gas in the gas,
if the complexity value of the initial image is larger than or equal to a second numerical value, determining the product of the complexity value of the initial image and a third numerical value as a first complexity value of the current image; and/or the presence of a gas in the gas,
and if the complexity value of the starting image is greater than or equal to the first numerical value and less than the second numerical value, determining the product of the complexity value of the starting image and a fourth numerical value as the first complexity value of the current image.
In some embodiments, the quantization parameter determining unit 13 is specifically configured to obtain a resolution of the current image; according to the resolution of the current image, inquiring a resolution factor corresponding to the current image in a preset corresponding relation between the resolution and the resolution factor; and determining a first complexity value of the current image according to the resolution factor corresponding to the current image, the complexity value of the starting image and the sadd of the current image.
In some embodiments, the quantization parameter determining unit 13 is specifically configured to, if the sadd of the current image is greater than a first sadd value and the complexity value of the starting image is greater than a second preset complexity value, multiply a third preset value by the resolution factor to obtain a first product; subtracting the first product from the satd of the current image to obtain a first difference value; multiplying the first difference value by the complexity value of the initial image to obtain a second product; and comparing the second product with a fourth preset value to obtain a first ratio, and adding the first ratio to the first product to obtain a first complexity value of the current image.
In some embodiments, the quantization parameter determining unit 13 is specifically configured to, if the sadd of the current image is greater than the first sadd value and less than the second sadd value, and the complexity value of the starting image is less than or equal to a second preset complexity value, compare the complexity value of the starting image with a fifth preset value to obtain a second ratio; adding a sixth preset value to the second ratio to obtain a second sum; multiplying the second sum value by the satd of the current image to obtain a third product; multiplying a seventh preset value by the resolution factor to obtain a fourth product; determining a ratio of the third product to the fourth product as a first complexity value of the current image.
In some embodiments, the quantization parameter determining unit 13 is specifically configured to compare the complexity value of the start image with an eighth preset value to obtain a third ratio if the sadd of the current image is greater than or equal to a second sadd value and less than a third sadd value, and the complexity value of the start image is less than or equal to a second preset complexity value; adding a ninth preset value to the third ratio to obtain a third sum; multiplying the third sum value by the sadd of the current image to obtain a fourth product; multiplying a tenth preset value by the resolution factor to obtain a fifth product; determining a ratio of the fourth product to the fifth product as a first complexity value of the current image.
In some embodiments, the quantization parameter determining unit 13 is specifically configured to determine the first complexity value of the current image according to the sadd of the current image and the resolution factor corresponding to the current image if the sadd of the current image is smaller than the first sadd value.
In some embodiments, the quantization parameter determining unit 13 is specifically configured to multiply an eleventh preset value by the santd of the current image to obtain a sixth product; multiplying a twelfth preset value by the resolution factor to obtain a seventh product; determining a ratio of the sixth product to the seventh product as a first complexity value of the current image.
In some embodiments, the quantization parameter determining unit 13 is specifically configured to determine a blur complexity value of the current image; determining a second complexity value of the current image according to the fuzzy complexity value of the current image; and determining the initial quantization level of the current image according to the first complexity value and the second complexity value of the current image.
In some embodiments, the quantization parameter determining unit 13 is specifically configured to obtain a code rate factor of the current image; and determining the ratio of the sum of the first complexity value and the second complexity value of the current image to the code rate factor as the initial quantization level of the current image.
In some embodiments, the quantization parameter determining unit 13 is specifically configured to determine, if the complexity value of the current macroblock is smaller than a preset minimum threshold, a sum of the initial quantization parameter and a fifth value as a target quantization parameter of the current macroblock; and/or the presence of a gas in the gas,
and if the complexity value of the current macro block is greater than a preset maximum threshold value, determining the difference between the initial quantization parameter and a sixth numerical value as a target quantization parameter of the current macro block.
In some embodiments, the quantization parameter determining unit 13 is further configured to determine, if the initial quantization parameter of the current macroblock is greater than a preset quantization parameter, a sum of the initial quantization parameter and a seventh value as the target quantization parameter of the current macroblock.
In some embodiments, the encoding unit 14 is further configured to determine, for an ith intra mode of preset N intra modes, a first rate-distortion cost when the current macroblock is encoded using the ith intra mode, where N is a positive integer, and i is a positive integer smaller than or equal to N; obtaining an adjusted rate-distortion cost threshold corresponding to the ith intra-frame mode; and if the first rate distortion cost is less than or equal to the adjusted rate distortion cost threshold, determining the ith intra-frame mode as the target intra-frame mode of the current macro block, and encoding the current macro block by using the ith intra-frame mode.
In some embodiments, the encoding unit 14 is configured to encode the current macroblock by using the Skip mode if the coding mode of the neighboring coded macroblocks of the current macroblock is the Skip mode.
In some embodiments, for a jth inter mode of preset M inter modes, determining a second rate-distortion cost when the jth inter mode is used to encode the current macroblock, where M is a positive integer, and j is a positive integer smaller than or equal to M; determining a third rate-distortion cost when the current macroblock is encoded using Skip mode; and if the third rate distortion cost is less than or equal to the second rate distortion cost, using the Skip mode to encode the current macro block.
It is to be understood that apparatus embodiments and method embodiments may correspond to one another and that similar descriptions may refer to method embodiments. To avoid repetition, further description is omitted here. Specifically, the apparatus 10 shown in fig. 15 may perform the method of the embodiment of the present application, and the foregoing and other operations and/or functions of each unit in the apparatus 10 are respectively for implementing corresponding flows in each method, such as the method, and are not described herein again for brevity.
The apparatus and system of embodiments of the present application are described above in terms of functional units in conjunction with the following figures. It is to be understood that the functional units may be implemented in hardware, by instructions in software, or by a combination of hardware and software units. Specifically, the steps of the method embodiments in the present application may be implemented by integrated logic circuits of hardware in a processor and/or instructions in the form of software, and the steps of the method disclosed in conjunction with the embodiments in the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software units in the decoding processor. Alternatively, the software elements may reside in random access memory, flash memory, read only memory, programmable read only memory, electrically erasable programmable memory, registers, or other storage medium known in the art. The storage medium is located in a memory, and a processor reads information in the memory and completes the steps in the above method embodiments in combination with hardware thereof.
Fig. 16 is a schematic block diagram of an encoding apparatus provided in an embodiment of the present application.
As shown in fig. 16, the encoding apparatus 30 is for performing the above-described image encoding method, and the encoding apparatus 30 may include:
a memory 33 and a processor 32, the memory 33 being arranged to store a computer program 34 and to transfer the program code 34 to the processor 32. In other words, the processor 32 may call and run the computer program 34 from the memory 33 to implement the method in the embodiment of the present application.
For example, the processor 32 may be configured to perform the steps of the method 200 described above according to instructions in the computer program 34.
In some embodiments of the present application, the processor 32 may include, but is not limited to:
general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, and the like.
In some embodiments of the present application, the memory 33 includes, but is not limited to:
volatile memory and/or non-volatile memory. The non-volatile Memory may be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable PROM (EEPROM), or a flash Memory. Volatile Memory can be Random Access Memory (RAM), which acts as external cache Memory. By way of example, but not limitation, many forms of RAM are available, such as Static random access memory (Static RAM, SRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic random access memory (Synchronous DRAM, SDRAM), Double Data Rate Synchronous Dynamic random access memory (DDR SDRAM), Enhanced Synchronous SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), and Direct Rambus RAM (DR RAM).
In some embodiments of the present application, the computer program 34 may be divided into one or more units, which are stored in the memory 33 and executed by the processor 32 to perform the methods provided herein. The one or more elements may be a series of computer program instruction segments capable of performing certain functions, which are used to describe the execution of the computer program 34 in the encoding device 30.
As shown in fig. 16, the encoding apparatus 30 may further include:
a transceiver 33, the transceiver 33 being connectable to the processor 32 or the memory 33.
The processor 32 may control the transceiver 33 to communicate with other devices, and specifically, may transmit information or data to the other devices or receive information or data transmitted by the other devices. The transceiver 33 may include a transmitter and a receiver. The transceiver 33 may further include antennas, and the number of antennas may be one or more.
It should be understood that the various components in the encoding device 30 are connected by a bus system that includes a power bus, a control bus, and a status signal bus in addition to a data bus.
The present application also provides a computer storage medium having stored thereon a computer program which, when executed by a computer, enables the computer to perform the method of the above-described method embodiments. In other words, the present application also provides a computer program product containing instructions, which when executed by a computer, cause the computer to execute the method of the above method embodiments.
When implemented in software, may 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 procedures or functions described in accordance with the embodiments of the present application occur, in whole or in part, when the computer program instructions are loaded and executed on a computer. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored on a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website, computer, server, or data center to another website, computer, server, or data center via wire (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that includes one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., Digital Video Disc (DVD)), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the unit is only one logical functional division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment. For example, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (26)

1. An image encoding method, comprising:
acquiring content complexity information corresponding to a current image to be coded, wherein the content complexity information comprises at least one of complexity information of a starting image in video data where the current image is located and complexity information of a current macro block in the current image;
determining a content complexity value corresponding to the current image according to the content complexity information;
determining a target quantization parameter of the current macro block according to the content complexity value;
and coding the current macro block according to the target quantization parameter of the current macro block.
2. The method according to claim 1, wherein the determining the content complexity value corresponding to the current image according to the content complexity information comprises:
if the content complexity information comprises the complexity information of the initial image, determining the complexity value of the initial image according to the complexity information of the initial image, and determining the complexity value of the initial image as the content complexity value;
if the content complexity information comprises the complexity information of the current macro block, determining the complexity value of the current macro block according to the complexity information of the current macro block, and determining the complexity value of the current macro block as the content complexity value;
if the content complexity information comprises the complexity information of the initial image and the complexity information of the current macro block, determining the complexity value of the initial image according to the complexity information of the initial image, determining the complexity value of the current macro block according to the complexity information of the current macro block, and determining the complexity value of the initial image and the complexity value of the current macro block as the content complexity values.
3. The method according to claim 2, wherein the complexity information of the starting picture comprises at least one of an amount of coding information, a coding bit depth, and a number of macroblocks comprised by the starting picture.
4. The method of claim 3, wherein determining the complexity value of the starting image according to the complexity information of the starting image comprises:
calculating a product of the coding information amount and the coding bit depth of a macro block in the initial image, adding the product and a first preset value to obtain a sum value, and performing index operation on the sum value by taking a second preset value as an index to obtain a first operation result corresponding to the macro block;
and calculating the sum of first operation results corresponding to macro blocks in the initial image, and determining the ratio of the sum to the number of the macro blocks included in the initial image as the complexity value of the initial image.
5. The method of claim 2, wherein the complexity information of the current macroblock comprises an amount of coding information of the current macroblock.
6. The method of claim 5, wherein the determining the complexity value of the current macroblock according to the complexity information of the current macroblock comprises:
and determining the coding information quantity of the current macro block as the complexity value of the current macro block.
7. The method of claim 2, wherein determining the target quantization parameter for the current macroblock according to the content complexity value comprises:
if the content complexity value comprises the complexity value of the initial image, determining an initial quantization parameter of the current macro block according to the complexity value of the initial image, and determining a target quantization parameter of the current macro block according to the initial quantization parameter; and/or the presence of a gas in the gas,
if the content complexity value comprises the complexity value of the current macro block, determining a fuzzy complexity value of the current image, determining an initial quantization parameter of the current macro block according to the fuzzy complexity value of the current image, and adjusting the initial quantization parameter of the current macro block according to the complexity value of the current macro block to obtain a target quantization parameter of the current macro block; and/or the presence of a gas in the gas,
if the content complexity value comprises the complexity value of the initial image and the complexity value of the current macro block, determining the initial quantization parameter of the current macro block according to the complexity value of the initial image, and adjusting the initial quantization parameter of the current macro block according to the complexity value of the current macro block to obtain the target quantization parameter of the current macro block.
8. The method according to claim 7, wherein determining the initial quantization parameter of the current macroblock according to the complexity value of the starting image comprises:
determining a first complexity value of the current image according to the complexity value of the starting image;
determining an initial quantization level of the current image according to the first complexity value of the current image;
and determining an initial quantization parameter of the current macro block according to the initial quantization level.
9. The method of claim 8, wherein determining the first complexity value of the current image according to the complexity value of the starting image comprises:
if the current image is the starting image, determining a first complexity value of the current image according to the complexity value of the starting image; and/or the presence of a gas in the gas,
if the current image is not the starting image, determining a residual absolute value sum sadd of the current image after motion compensation, and determining a first complexity value of the current image according to the complexity value of the starting image and the sadd of the current image.
10. The method of claim 9, wherein determining the first complexity value of the current picture according to the complexity value of the starting picture if the current picture is the starting picture comprises:
if the complexity value of the initial image is smaller than a first numerical value, determining that the first complexity value of the current image is a first preset complexity value; and/or the presence of a gas in the gas,
if the complexity value of the initial image is larger than or equal to a second numerical value, determining the product of the complexity value of the initial image and a third numerical value as a first complexity value of the current image; and/or the presence of a gas in the gas,
and if the complexity value of the starting image is greater than or equal to the first numerical value and less than the second numerical value, determining the product of the complexity value of the starting image and a fourth numerical value as the first complexity value of the current image.
11. The method of claim 9, wherein determining the first complexity value of the current picture according to the complexity value of the start picture and the sadd of the current picture comprises:
acquiring the resolution of the current image;
according to the resolution of the current image, inquiring a resolution factor corresponding to the current image in a preset corresponding relation between the resolution and the resolution factor;
and determining a first complexity value of the current image according to the resolution factor corresponding to the current image, the complexity value of the starting image and the sadd of the current image.
12. The method according to claim 11, wherein determining the first complexity value of the current picture according to the resolution factor corresponding to the current picture, the complexity value of the start picture and the sadd of the current picture comprises:
if the sadd of the current image is larger than a first sadd value and the complexity value of the starting image is larger than a second preset complexity value, multiplying a third preset value by the resolution factor to obtain a first product;
subtracting the first product from the satd of the current image to obtain a first difference value;
multiplying the first difference value by the complexity value of the initial image to obtain a second product;
and comparing the second product with a fourth preset value to obtain a first ratio, and adding the first ratio to the first product to obtain a first complexity value of the current image.
13. The method according to claim 11, wherein determining the first complexity value of the current picture according to the resolution factor corresponding to the current picture, the complexity value of the start picture and the sadd of the current picture comprises:
if the sadd of the current image is larger than the first sadd value and smaller than the second sadd value, and the complexity value of the starting image is smaller than or equal to a second preset complexity value, comparing the complexity value of the starting image with a fifth preset value to obtain a second ratio;
adding a sixth preset value to the second ratio to obtain a second sum;
multiplying the second sum value by the satd of the current image to obtain a third product;
multiplying a seventh preset value by the resolution factor to obtain a fourth product;
determining a ratio of the third product to the fourth product as a first complexity value of the current image.
14. The method according to claim 11, wherein determining the first complexity value of the current picture according to the resolution factor corresponding to the current picture, the complexity value of the start picture and the sadd of the current picture comprises:
if the sadd of the current image is greater than or equal to a second sadd value and less than a third sadd value, and the complexity value of the starting image is less than or equal to a second preset complexity value, comparing the complexity value of the starting image with an eighth preset value to obtain a third ratio;
adding a ninth preset value to the third ratio to obtain a third sum;
multiplying the third sum value by the sadd of the current image to obtain a fourth product;
multiplying a tenth preset value by the resolution factor to obtain a fifth product;
determining a ratio of the fourth product to the fifth product as a first complexity value of the current image.
15. The method of claim 14, further comprising:
and if the sadd of the current image is smaller than a first sadd value, determining a first complexity value of the current image according to the sadd of the current image and a resolution factor corresponding to the current image.
16. The method of claim 15, wherein determining the first complexity value for the current picture according to the sadd of the current picture and the corresponding resolution factor of the current picture comprises:
multiplying an eleventh preset value by the sadd of the current image to obtain a sixth product;
multiplying a twelfth preset value by the resolution factor to obtain a seventh product;
determining a ratio of the sixth product to the seventh product as a first complexity value of the current image.
17. The method of claim 8, wherein determining the initial quantization level of the current image according to the first complexity value of the current image comprises:
determining a blur complexity value of the current image;
determining a second complexity value of the current image according to the fuzzy complexity value of the current image;
and determining the initial quantization level of the current image according to the first complexity value and the second complexity value of the current image.
18. The method of claim 17, wherein determining the initial quantization level of the current image according to the first complexity value and the second complexity value of the current image comprises:
acquiring a code rate factor of the current image;
and determining the ratio of the sum of the first complexity value and the second complexity value of the current image to the code rate factor as the initial quantization level of the current image.
19. The method according to claim 7, wherein the adjusting the initial quantization parameter of the current macroblock according to the complexity value of the current macroblock to obtain the target quantization parameter of the current macroblock comprises:
if the complexity value of the current macro block is smaller than a preset minimum threshold value, determining the sum of the initial quantization parameter and a fifth numerical value as a target quantization parameter of the current macro block; and/or the presence of a gas in the gas,
and if the complexity value of the current macro block is greater than a preset maximum threshold value, determining the difference between the initial quantization parameter and a sixth numerical value as a target quantization parameter of the current macro block.
20. The method of claim 7, further comprising:
and if the initial quantization parameter of the current macro block is larger than the preset quantization parameter, determining the sum of the initial quantization parameter and a seventh numerical value as the target quantization parameter of the current macro block.
21. The method of claim 1, further comprising:
determining a first rate distortion cost when the current macroblock is coded by using an ith intra mode in preset N intra modes, wherein N is a positive integer, and i is a positive integer less than or equal to N;
obtaining an adjusted rate-distortion cost threshold corresponding to the ith intra-frame mode;
and if the first rate distortion cost is less than or equal to the adjusted rate distortion cost threshold, encoding the current macro block by using the ith intra-frame mode.
22. The method of claim 1, further comprising:
and if the coding mode of the adjacent coded macro block of the current macro block is the Skip mode, using the Skip mode to code the current macro block.
23. The method of claim 1, further comprising:
determining a second rate distortion cost when the current macro block is coded by using a jth interframe mode in preset mth interframe modes, wherein M is a positive integer, and j is a positive integer less than or equal to M;
determining a third rate-distortion cost when the current macroblock is encoded using Skip mode;
and if the third rate distortion cost is less than or equal to the second rate distortion cost, encoding the current macro block by using a Skip mode.
24. An image processing apparatus characterized by comprising:
the device comprises an acquisition unit, a decoding unit and a decoding unit, wherein the acquisition unit is used for acquiring content complexity information corresponding to a current image to be coded, and the content complexity information comprises at least one of complexity information of a starting image in video data where the current image is located and complexity information of a current macro block in the current image;
the complexity determining unit is used for determining a content complexity value corresponding to the current image according to the content complexity information;
a quantization parameter determining unit, configured to determine a target quantization parameter of the current macroblock according to the content complexity value;
and the coding unit is used for coding the current macro block according to the target quantization parameter of the current macro block.
25. An encoder, comprising: a processor and a memory;
the memory is used for storing a computer program;
the processor is configured to invoke and execute a computer program stored in the memory to perform the method of any of claims 1-23.
26. A computer-readable storage medium for storing a computer program which causes a computer to perform the method of any one of claims 1-23.
CN202111095305.1A 2021-09-17 2021-09-17 Image encoding method, apparatus, device and storage medium Pending CN113784126A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111095305.1A CN113784126A (en) 2021-09-17 2021-09-17 Image encoding method, apparatus, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111095305.1A CN113784126A (en) 2021-09-17 2021-09-17 Image encoding method, apparatus, device and storage medium

Publications (1)

Publication Number Publication Date
CN113784126A true CN113784126A (en) 2021-12-10

Family

ID=78852045

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111095305.1A Pending CN113784126A (en) 2021-09-17 2021-09-17 Image encoding method, apparatus, device and storage medium

Country Status (1)

Country Link
CN (1) CN113784126A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114374847A (en) * 2022-01-17 2022-04-19 海宁奕斯伟集成电路设计有限公司 Image compression method, device, equipment and computer readable storage medium
CN114531594A (en) * 2022-02-16 2022-05-24 北京百度网讯科技有限公司 Data processing and image coding method, device, equipment and storage medium
CN116095319A (en) * 2022-07-26 2023-05-09 杭州海康威视数字技术股份有限公司 Video decoding method, device and storage medium
WO2023138532A1 (en) * 2022-01-21 2023-07-27 杭州海康威视数字技术股份有限公司 Video decoding method and apparatus, video decoder and storage medium
WO2023231866A1 (en) * 2022-05-31 2023-12-07 杭州海康威视数字技术股份有限公司 Video decoding method and apparatus and storage medium
CN117750017A (en) * 2023-12-27 2024-03-22 书行科技(北京)有限公司 Encoding control method, apparatus, device and storage medium
WO2024140500A1 (en) * 2022-12-30 2024-07-04 杭州海康威视数字技术股份有限公司 Quantization parameter adjustment method, apparatus and device, and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101094411A (en) * 2007-07-03 2007-12-26 芯瀚电子技术(上海)有限公司 Code rate control method of video code
CN103096079A (en) * 2013-01-08 2013-05-08 宁波大学 Multi-view video rate control method based on exactly perceptible distortion
CN104219522A (en) * 2013-06-04 2014-12-17 北京大学 Method and device for controlling code rates during video image coding
CN106937112A (en) * 2017-03-31 2017-07-07 西安电子科技大学 Bit rate control method based on H.264 video compression standard
CN109076212A (en) * 2017-12-27 2018-12-21 深圳市大疆创新科技有限公司 The method and code device of code rate control
CN111866504A (en) * 2020-07-17 2020-10-30 Oppo广东移动通信有限公司 Encoding method, encoder and computer readable storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101094411A (en) * 2007-07-03 2007-12-26 芯瀚电子技术(上海)有限公司 Code rate control method of video code
CN103096079A (en) * 2013-01-08 2013-05-08 宁波大学 Multi-view video rate control method based on exactly perceptible distortion
CN104219522A (en) * 2013-06-04 2014-12-17 北京大学 Method and device for controlling code rates during video image coding
CN106937112A (en) * 2017-03-31 2017-07-07 西安电子科技大学 Bit rate control method based on H.264 video compression standard
CN109076212A (en) * 2017-12-27 2018-12-21 深圳市大疆创新科技有限公司 The method and code device of code rate control
CN111866504A (en) * 2020-07-17 2020-10-30 Oppo广东移动通信有限公司 Encoding method, encoder and computer readable storage medium

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114374847A (en) * 2022-01-17 2022-04-19 海宁奕斯伟集成电路设计有限公司 Image compression method, device, equipment and computer readable storage medium
CN114374847B (en) * 2022-01-17 2024-06-25 海宁奕斯伟集成电路设计有限公司 Image compression method, device, equipment and computer readable storage medium
WO2023138532A1 (en) * 2022-01-21 2023-07-27 杭州海康威视数字技术股份有限公司 Video decoding method and apparatus, video decoder and storage medium
CN114531594A (en) * 2022-02-16 2022-05-24 北京百度网讯科技有限公司 Data processing and image coding method, device, equipment and storage medium
WO2023231866A1 (en) * 2022-05-31 2023-12-07 杭州海康威视数字技术股份有限公司 Video decoding method and apparatus and storage medium
CN116095319A (en) * 2022-07-26 2023-05-09 杭州海康威视数字技术股份有限公司 Video decoding method, device and storage medium
CN116366847A (en) * 2022-07-26 2023-06-30 杭州海康威视数字技术股份有限公司 Video image decoding method, device and storage medium
WO2024022039A1 (en) * 2022-07-26 2024-02-01 杭州海康威视数字技术股份有限公司 Video image decoding method and coding method, apparatus, and storage medium
CN116095319B (en) * 2022-07-26 2024-09-24 杭州海康威视数字技术股份有限公司 Video image decoding method, video image encoding method, video image decoding device and storage medium
CN116366847B (en) * 2022-07-26 2024-10-18 杭州海康威视数字技术股份有限公司 Video image decoding method, device and storage medium
WO2024140500A1 (en) * 2022-12-30 2024-07-04 杭州海康威视数字技术股份有限公司 Quantization parameter adjustment method, apparatus and device, and storage medium
CN117750017A (en) * 2023-12-27 2024-03-22 书行科技(北京)有限公司 Encoding control method, apparatus, device and storage medium

Similar Documents

Publication Publication Date Title
CN111819852B (en) Method and apparatus for residual symbol prediction in the transform domain
CN113784126A (en) Image encoding method, apparatus, device and storage medium
WO2017138352A1 (en) Systems and methods for transform coefficient coding
CN116405686A (en) Image reconstruction method and device
CN113196748B (en) Intra-frame prediction method and related device
CN113785573A (en) Encoder, decoder and corresponding methods using an adaptive loop filter
CN115695784A (en) Method of encoding a block of an image, encoding device and computer readable medium
CN112913236B (en) Encoder, decoder and corresponding methods using compressed MV storage
CN113411613B (en) Method for video coding image block, decoding device and coder/decoder
CN114913249A (en) Encoding method, decoding method and related devices
US20240236371A1 (en) Video encoding method, video decoding method, device, system, and storage medium
CN114205582B (en) Loop filtering method, device and equipment for video coding and decoding
CN116405701A (en) Image filtering method, device, equipment and storage medium
CN113938679B (en) Image type determination method, device, equipment and storage medium
WO2023184250A1 (en) Video coding/decoding method, apparatus and system, device and storage medium
WO2024192733A1 (en) Video coding method and apparatus, video decoding method and apparatus, devices, system, and storage medium
WO2023236113A1 (en) Video encoding and decoding methods, apparatuses and devices, system, and storage medium
WO2023122969A1 (en) Intra-frame prediction method, device, system, and storage medium
CN113766227B (en) Quantization and inverse quantization method and apparatus for image encoding and decoding
WO2023184248A1 (en) Video coding and decoding method, apparatus, device and system, and storage medium
WO2023122968A1 (en) Intra-frame prediction method, device and system, and storage medium
WO2024216632A1 (en) Video encoding method and apparatus, video decoding method and apparatus, and device, system and storage medium
WO2023220946A1 (en) Video encoding method and apparatus, video decoding method and apparatus, and device, system and storage medium
US20240236372A1 (en) Video encoding and decoding method, and device
KR102725069B1 (en) Method and device for mode and size dependent block level restriction

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination