Video encoding method, device, computer equipment and storage medium
By calculating the pixel gradient data of the video encoding unit and optimizing the video encoding decision, the problem of low video encoding efficiency in the prior art is solved, and a more efficient video encoding process is achieved.
Patent Information
- Application Number
- CN201911005290.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-10-22
- Publication Date
- 2024-11-29
- Estimated Expiration
- 2039-12-12
AI Technical Summary
The existing video encoding methods are computationally expensive, resulting in low video encoding efficiency.
By calculating the pixel gradient data of the target encoding unit, the target division decision result is determined based on the difference between the pixel value of the pixel point and the reference pixel value, thereby optimizing the video encoding process.
It improves the efficiency of video encoding, shortens encoding time, and improves encoding accuracy.
Smart Images

Figure CN112702603B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of video, and in particular to a video encoding method, apparatus, computer equipment and storage medium. Background Art
[0002] With the rapid development and widespread application of multimedia technology and network technology, people use a lot of video information in daily life and production activities. In order to reduce the amount of video transmission data or storage data, it is necessary to encode the video.
[0003] When performing video encoding, a frame of image is usually divided into multiple maximum coding units, and then the maximum coding unit is divided multiple times using a quadtree or other division structure to obtain sub-coding units. Then, a rate-distortion cost calculation is performed on each prediction mode of the maximum coding unit and the sub-coding unit, and the division method of the coding unit is determined based on the rate-distortion cost. However, this method has a large amount of calculation, resulting in low video coding efficiency. Summary of the invention
[0004] Based on this, it is necessary to provide a video encoding method, apparatus, computer device and storage medium to address the above-mentioned problem of low video encoding efficiency.
[0005] A video encoding method, the method comprising: obtaining a target encoding unit to be encoded; calculating target pixel gradient data according to the pixel value of a pixel point corresponding to the target encoding unit, the target pixel gradient data being obtained according to the difference between the pixel value of the pixel point and a reference pixel value; determining a target partition decision result corresponding to the target encoding unit according to the target pixel gradient data; and performing video encoding on the target encoding unit according to the target partition decision result.
[0006] A video encoding device, the device comprising: a target encoding unit acquisition module, used to acquire a target encoding unit to be encoded; a target pixel gradient data acquisition module, used to calculate target pixel gradient data according to the pixel value of a pixel point corresponding to the target encoding unit, the target pixel gradient data being obtained according to the difference between the pixel value of the pixel point and a reference pixel value; a target partition decision result determination module, used to determine a target partition decision result corresponding to the target encoding unit according to the target pixel gradient data; and a video encoding module, used to perform video encoding on the target encoding unit according to the target partition decision result.
[0007] In some embodiments, the target pixel gradient data obtaining module includes: a reference pixel value obtaining unit, used to determine the current pixel point in the target coding unit, and obtain the pixel value of the target adjacent pixel point corresponding to the current pixel point as the reference pixel value; a pixel value difference calculation unit, used to calculate the difference between the pixel value of the current pixel point and the reference pixel value, and obtain the pixel value difference corresponding to the current pixel point; a target pixel gradient data obtaining unit, used to perform statistics on the pixel value differences corresponding to each of the pixel points in the target coding unit to obtain the target pixel gradient data.
[0008] In some embodiments, the unit for determining the target adjacent pixel point corresponding to the current pixel point is used to: obtain the target gradient calculation direction; obtain the adjacent pixel point corresponding to the current pixel point in the target gradient calculation direction as the target adjacent pixel point.
[0009] In some embodiments, the target pixel gradient data obtaining module includes: a pixel gradient calculation unit, which is used to divide the target coding unit into multiple regions, and calculate the pixel gradient corresponding to each of the regions, wherein the pixel gradient corresponding to the region is obtained based on the difference between the pixel value of the pixel point corresponding to the region and the reference pixel value; a gradient difference calculation unit, which is used to calculate the pixel gradient difference between the regions to obtain the target pixel gradient data.
[0010] In some embodiments, the gradient difference calculation unit is used to: subtract the pixel gradient corresponding to the second area from the pixel gradient corresponding to the first area to obtain the pixel gradient difference between the first area and the second area.
[0011] In some embodiments, the target partition decision result determination module is used to: when the target pixel gradient data satisfies a first threshold condition, determine that the target partition decision result corresponding to the target coding unit is to terminate the partition, and the first threshold condition includes that the target pixel gradient data less than the corresponding first threshold satisfies a first quantity.
[0012] In some embodiments, the target partition decision result determination module is used to: when the target pixel gradient data satisfies a second threshold condition, determine that the target partition decision result corresponding to the target coding unit is partition, and the second threshold condition includes that the target pixel gradient data greater than the corresponding second threshold satisfies a second quantity.
[0013] In some embodiments, the target pixel gradient data obtaining module includes: a division unit, used to divide the target coding unit to obtain multiple sub-coding units; a sub-coding unit gradient data calculation unit, used to calculate the pixel gradient data corresponding to each of the sub-coding units to obtain the target pixel gradient data, and the pixel gradient corresponding to the sub-coding unit is obtained according to the difference between the pixel value of the pixel point corresponding to the sub-coding unit and the reference pixel value.
[0014] In some embodiments, the target partition decision result determination module is used to: calculate the pixel gradient data difference between the sub-coding units, and determine the target partition decision result corresponding to the target coding unit according to the pixel gradient data difference between the sub-coding units.
[0015] In some embodiments, the target division decision result determination module is used to: when the pixel gradient data difference between the sub-coding units satisfies a third threshold judgment condition, determine that the target division decision result corresponding to the target coding unit is division, and the third threshold judgment condition includes that the pixel gradient data difference greater than the corresponding third threshold satisfies a third quantity.
[0016] In some embodiments, the target partitioning decision result determination module is used to: obtain a target number of sub-coding units whose pixel gradient data is greater than a fourth threshold, and when the target number exceeds the fourth number or when the ratio of the target number to the number of sub-coding units exceeds the first ratio, determine that the target partitioning decision result corresponding to the target coding unit is partitioning.
[0017] In some embodiments, the video encoding module is used to: when the target division decision result is termination of division, perform video encoding with the target encoding unit as the encoding unit; when the target division decision result is division, divide the target encoding unit to obtain multiple sub-coding units, and perform video encoding according to the sub-coding units.
[0018] A computer device comprises a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the above-mentioned video encoding method.
[0019] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the steps of the above-mentioned video encoding method.
[0020] The above-mentioned video encoding method, device, computer equipment and storage medium can obtain target pixel gradient data through pixel value calculation of the encoding unit. The target pixel gradient data is obtained according to the difference between the pixel value of the pixel point and the reference pixel value, and thus can reflect the image change of the target encoding unit. Therefore, the target division decision result corresponding to the target encoding unit determined according to the target pixel gradient data has high accuracy and can reduce the time for obtaining the division decision result, thereby shortening the encoding time of video encoding and improving the video encoding efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 is a block diagram of a communication system provided in some embodiments;
[0022] Figure 2 is a block diagram of a video encoder in some embodiments;
[0023] Figure 3 is a flowchart of a video encoding method in some embodiments;
[0024] Figure 4 is a schematic diagram of dividing image blocks in some embodiments;
[0025] Figure 5 A flowchart of obtaining target pixel gradient data by calculating the pixel value of the pixel point corresponding to the target coding unit in some embodiments;
[0026] Figure 6 A schematic diagram of obtaining target adjacent pixel points corresponding to a current pixel point in some embodiments;
[0027] Figure 7 is a schematic diagram of gradient calculation direction in some embodiments;
[0028] Figure 8 is a schematic diagram of gradient calculation direction in some embodiments;
[0029] Fig. 9 is a flowchart of dividing a target coding unit in some embodiments;
[0030] Fig.10 A schematic diagram of dividing a target coding unit into sub-coding units in some embodiments;
[0031] Fig.11 is a structural block diagram of a video encoding device in some embodiments;
[0032] Fig.12 A block diagram of the internal structure of a computer device in some embodiments. DETAILED DESCRIPTION
[0033] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0034] It is understood that the terms "first", "second", etc. used in this application may be used herein to describe various elements, but unless otherwise specified, these elements are not limited by these terms. These terms are only used to distinguish a first element from another element. For example, a first region may be referred to as a second region, and similarly, a second region may be referred to as a first region without departing from the scope of this application.
[0035] Figure 1 1 is a simplified block diagram of a communication system (100) according to an embodiment disclosed in the present application. The communication system (100) includes a plurality of terminal devices, which can communicate with each other through, for example, a network (150). For example, the communication system (100) includes a first terminal device (110) and a second terminal device (120) interconnected through the network (150). Figure 1 In an embodiment of the present invention, the first terminal device (110) and the second terminal device (120) perform unidirectional data transmission. For example, the first terminal device (110) may encode video data (e.g., a video picture stream collected by the terminal device (110)) for transmission to the second terminal device (120) via the network (150). The encoded video data is transmitted in the form of one or more encoded video code streams. The second terminal device (120) may receive the encoded video data from the network (150), decode the encoded video data to restore the video data, and display the video picture based on the restored video data. Unidirectional data transmission is more common in applications such as media services.
[0036] In another embodiment, the communication system (100) includes a third terminal device (130) and a fourth terminal device (140) that perform bidirectional transmission of encoded video data, which can occur, for example, during a video conference. For bidirectional data transmission, each of the third terminal device (130) and the fourth terminal device (140) can encode video data (e.g., a video picture stream collected by the terminal device) to transmit to the other terminal device of the third terminal device (130) and the fourth terminal device (140) through a network (150). Each of the third terminal device (130) and the fourth terminal device (140) can also receive the encoded video data transmitted by the other terminal device of the third terminal device (130) and the fourth terminal device (140), and can decode the encoded video data to restore the video data, and can display the video picture on an accessible display device based on the restored video data.
[0037] exist Figure 1 In the embodiment of the present invention, the first terminal device (110), the second terminal device (120), the third terminal device (130) and the fourth terminal device (140) may be servers, personal computers and smart phones, but the principles disclosed in the present application may not be limited thereto. The embodiments disclosed in the present application are applicable to laptop computers, tablet computers, media players and / or dedicated video conferencing equipment. The network (150) represents any number of networks that transmit encoded video data between the first terminal device (110), the second terminal device (120), the third terminal device (130) and the fourth terminal device (140), including, for example, wired (wired) and / or wireless communication networks. The communication network (150) may exchange data in circuit switching and / or packet switching channels. The network may include a telecommunications network, a local area network, a wide area network and / or the Internet. For the purpose of the present application, unless explained below, the architecture and topology of the network (150) may be irrelevant to the operation disclosed in the present application.
[0038] Figure 2 The block diagram of the video encoder (203) according to the embodiment disclosed in the present application is shown in FIG. The video encoder (203) is arranged in the electronic device (220). The electronic device (220) includes a transmitter (240) (eg, a transmission circuit).
[0039] The video encoder (203) can be used to obtain the video source (201) (not Figure 2 In another embodiment, the video source (201) is a part of the electronic device (220) to receive video samples, and the video source can collect video images to be encoded by the video encoder (203). In another embodiment, the video source (201) is a part of the electronic device (220).
[0040] The video source (201) may provide a source video sequence in the form of a digital video sample stream to be encoded by the video encoder (203), wherein the digital video sample stream may have any suitable bit depth (e.g., 8-bit, 10-bit, 12-bit, ...), any color space (e.g., BT.601 Y CrCB, RGB, ...), and any suitable sampling structure (e.g., Y CrCb 4:2:0, Y CrCb4:4:4). In a media service system, the video source (201) may be a storage device storing previously prepared videos. In a video conferencing system, the video source (201) may be a camera that captures local image information as a video sequence. The video data may be provided as a plurality of separate pictures that are given motion when viewed sequentially. The pictures themselves may be constructed as a spatial pixel array, wherein each pixel may include one or more samples depending on the sampling structure, color space, etc. used. The relationship between pixels and samples may be easily understood by those skilled in the art. The following description focuses on samples.
[0041] According to an embodiment, the video encoder (203) may encode and compress pictures of a source video sequence into an encoded video sequence (243) in real time or under any other time constraints required by the application. Implementing an appropriate encoding speed is a function of the controller (250). In some embodiments, the controller (250) controls other functional units as described below and is functionally coupled to these units. For the sake of simplicity, couplings are not shown in the figure. The parameters set by the controller (250) may include rate control related parameters (picture skipping, quantizer, lambda value of rate distortion optimization technology, etc.), picture size, group of pictures (GOP) layout, maximum motion vector search range, etc. The controller (250) can be used to have other suitable functions that are related to the video encoder (203) optimized for a certain system design.
[0042] In some embodiments, the video encoder (203) operates in an encoding loop. As a simple description, in embodiments, the encoding loop may include a source encoder (230) (e.g., responsible for creating symbols, such as a symbol stream, based on an input picture to be encoded and a reference picture) and a (local) decoder (233) embedded in the video encoder (203). The decoder (233) reconstructs the symbols to create sample data in a manner similar to how the (remote) decoder creates sample data (because in the video compression technology considered in this application, any compression between the symbols and the encoded video code stream is lossless). The reconstructed sample stream (sample data) is input to a reference picture memory (234). Since the decoding of the symbol stream produces bit-accurate results that are independent of the decoder location (local or remote), the contents of the reference picture memory (234) are also bit-accurate between the local encoder and the remote encoder. In other words, the reference picture samples "seen" by the prediction part of the encoder are exactly the same as the sample values that the decoder will "see" when using the prediction during decoding. This basic principle of reference picture synchronization (and the drift that occurs when synchronization cannot be maintained, eg due to channel errors) is also used in some related techniques.
[0043] The operation of the "local" decoder (233) may be identical to that of a "remote" decoder, ie, the decoder at the decoding end.
[0044] During operation, in some embodiments, the source encoder (230) may perform motion compensated predictive coding. The motion compensated predictive coding predictively encodes an input picture with reference to one or more previously encoded pictures from a video sequence designated as "reference pictures." In this manner, the encoding engine (232) encodes the differences between pixel blocks of the input picture and pixel blocks of a reference picture that may be selected as a prediction reference for the input picture.
[0045] The local video decoder (233) may decode the encoded video data that may be designated as a reference picture based on the symbol created by the source encoder (230). The operation of the encoding engine (232) may be a lossy process. When the encoded video data is available at the video decoder ( Figure 2 When the video sequence is decoded at a remote location (not shown), the reconstructed video sequence may typically be a copy of the source video sequence with some errors. The local video decoder (233) replicates the decoding process that may be performed by the video decoder on the reference picture and may cause the reconstructed reference picture to be stored in the reference picture cache (234). In this way, the video encoder (203) may locally store a copy of the reconstructed reference picture that has common content (absent transmission errors) with the reconstructed reference picture to be obtained by the remote video decoder.
[0046] The predictor (235) may perform a prediction search for the encoding engine (232). That is, for a new picture to be encoded, the predictor (235) may search the reference picture memory (234) for sample data (as candidate reference pixel blocks) or certain metadata, such as reference picture motion vectors, block shapes, etc., that may serve as appropriate prediction references for the new picture. The predictor (235) may operate pixel-by-pixel based on sample blocks to find a suitable prediction reference. In some cases, based on the search results obtained by the predictor (235), it may be determined that the input picture may have prediction references taken from a plurality of reference pictures stored in the reference picture memory (234).
[0047] The controller (250) may manage encoding operations of the source encoder (230), including, for example, setting parameters and subgroup parameters for encoding video data.
[0048] The outputs of all the above functional units may be entropy encoded in an entropy encoder (245). The entropy encoder (245) performs lossless compression on the symbols generated by the various functional units according to techniques such as Huffman coding, variable length coding, arithmetic coding, etc., thereby converting the symbols into a coded video sequence.
[0049] The transmitter (240) may buffer the encoded video sequence created by the entropy encoder (245) in preparation for transmission over a communication channel (260), which may be a hardware / software link to a storage device where the encoded video data will be stored. The transmitter (240) may combine the encoded video data from the video encoder (203) with other data to be transmitted, such as encoded audio data and / or ancillary data streams (source not shown).
[0050] The controller (250) may manage the operation of the video encoder (203). During encoding, the controller (250) may assign a certain coded picture type to each coded picture, but this may affect the coding techniques that can be applied to the corresponding picture. For example, a picture may generally be assigned to any of the following picture types:
[0051] An intra picture (I picture) may be a picture that can be encoded and decoded without using any other picture in the sequence as a prediction source. Some video codecs allow different types of intra pictures, including, for example, Independent Decoder Refresh ("IDR") pictures. Those skilled in the art are aware of the variations of I pictures and their corresponding applications and features.
[0052] A predictive picture (P picture) may be a picture that can be encoded and decoded using intra prediction or inter prediction, which uses at most one motion vector and a reference index to predict sample values for each block.
[0053] Bidirectional predictive pictures (B pictures), which can be pictures that can be encoded and decoded using intra prediction or inter prediction, which uses up to two motion vectors and reference indices to predict the sample values of each block. Similarly, multiple predictive pictures can use more than two reference pictures and associated metadata for reconstruction of a single block.
[0054] The source picture may typically be spatially subdivided into blocks of samples (e.g., blocks of 4×4, 8×8, 4×8, or 16×16 samples), and coded block by block. These blocks may be predictively coded with reference to other (already coded) blocks, which are determined according to the coding allocation applied to the block's corresponding picture. For example, blocks of an I picture may be non-predictively coded, or the blocks may be predictively coded (spatial prediction or intra prediction) with reference to already coded blocks of the same picture. Blocks of pixels of a P picture may be predictively coded by spatial prediction with reference to one previously coded reference picture or by temporal prediction. Blocks of a B picture may be predictively coded by spatial prediction with reference to one or two previously coded reference pictures or by temporal prediction.
[0055] The video encoder (203) may perform encoding operations according to a predetermined video encoding technique or standard, such as ITU-T H.265 Recommendation. In operation, the video encoder (203) may perform various compression operations, including predictive encoding operations that exploit temporal and spatial redundancy in an input video sequence. Thus, the encoded video data may conform to the syntax specified by the video encoding technique or standard used.
[0056] In an embodiment, the transmitter (240) may transmit additional data when transmitting the encoded video. The source encoder (530) may include such data as part of the encoded video sequence. The additional data may include other forms of redundant data such as temporal / spatial / SNR enhancement layers, redundant pictures and slices, SEI messages, VUI parameter set fragments, etc.
[0057] The captured video may be taken as a plurality of source pictures (video pictures) in a temporal sequence. Intra-picture prediction (often simplified to intra-prediction) exploits spatial correlations in a given picture, while inter-picture prediction exploits (temporal or other) correlations between pictures. In an embodiment, a particular picture being encoded / decoded is divided into blocks, and the particular picture being encoded / decoded is referred to as the current picture. When a block in the current picture is similar to a reference block in a reference picture that was previously encoded in the video and is still buffered, the block in the current picture may be encoded by a vector called a motion vector. The motion vector points to a reference block in a reference picture, and in the case where multiple reference pictures are used, the motion vector may have a third dimension that identifies the reference picture.
[0058] In some embodiments, bidirectional prediction techniques may be used in inter-picture prediction. According to the bidirectional prediction technique, two reference pictures are used, for example, a first reference picture and a second reference picture that are both before the current picture in the video in decoding order (but may be in the past and future in display order, respectively). A block in the current picture may be encoded by a first motion vector pointing to a first reference block in the first reference picture and a second motion vector pointing to a second reference block in the second reference picture. Specifically, the block may be predicted by a combination of the first reference block and the second reference block.
[0059] In addition, merge mode technology can be used in inter-picture prediction to improve coding efficiency.
[0060] According to some embodiments disclosed in the present application, predictions such as inter-picture prediction and intra-picture prediction are performed in blocks. For example, according to the HEVC standard, pictures in a video picture sequence are divided into coding tree units (CTUs) for compression, and the CTUs in the pictures have the same size, such as 64×64 pixels, 32×32 pixels, or 16×16 pixels. In general, a CTU includes three coding tree blocks (CTBs), which are a luminance CTB and two chrominance CTBs. Furthermore, each CTU can be split into one or more coding units (CUs) using a quadtree. For example, a 64×64 pixel CTU can be split into a 64×64 pixel CU, or 4 32×32 pixel CUs, or 16 16×16 pixel CUs. In an embodiment, each CU is analyzed to determine the prediction type for the CU, such as an inter-prediction type or an intra-prediction type. In addition, depending on temporal and / or spatial predictability, the CU is split into one or more prediction units (PUs). Typically, each PU includes a luminance prediction block (PB) and two chrominance PBs. In an embodiment, the prediction operation in encoding (encoding / decoding) is performed in units of prediction blocks. Taking the luminance prediction block as an example of a prediction block, the prediction block includes a matrix of pixel values (e.g., luminance values), such as 8×8 pixels, 16×16 pixels, 8×16 pixels, 16×8 pixels, and the like.
[0061] like Figure 3 As shown, in some embodiments, a video encoding method is proposed. This embodiment mainly applies this method to the above Figure 1 The terminal device in the example is used as an example. Specifically, the following steps may be included:
[0062] Step S302: Obtain a target coding unit to be encoded.
[0063] Specifically, the target coding unit is a coding unit to determine whether it needs to be divided. When performing video encoding, a video frame can be obtained, and the video frame image can be divided into LCU (Largest Coding Unit), that is, the video frame image can be divided into multiple preset-size maximum coding units (LCU), and then recursively determine whether the coding unit can be divided into small coding units (Coding Unit, CU) until the coding unit is divided into the smallest coding unit, thereby forming a coding unit tree (Coding Unit Tree, CTU) structure. The target coding unit can be an LCU, or it can be a coding unit obtained by dividing the LCU. For example, when a video image frame is obtained, assuming that the LCU is 64*64 pixels, the video image frame can be divided into multiple LCUs of 64*64 pixels, so the LCU can be used as the target coding unit. When the LCU is divided to obtain 4 coding units (32*32 pixels), the 4 divided coding units can be used as target coding units.
[0064] Of course, the above only takes the LCU division method as an example to illustrate a certain implementation method of the solution of the present application, but it is not limited to the above division method.
[0065] Step S304, calculating target pixel gradient data according to the pixel value of the pixel point corresponding to the target coding unit, where the target pixel gradient data is obtained according to the difference between the pixel value of the pixel point and the reference pixel value.
[0066] Specifically, the pixel gradient reflects the change in pixel value in the image. The larger the pixel gradient, the larger the pixel change, indicating that the image content of the coding unit has changed more. The smaller the pixel gradient, the smaller the pixel change, indicating that the image content of the coding unit has changed less. The pixel gradient can be obtained by the difference between the pixel value of the pixel point and the reference pixel value. The larger the difference, the larger the gradient. The difference can be expressed as a difference or a ratio. For example, the pixel value of the pixel point can be subtracted from the reference pixel value, and the absolute value of the difference can be used as the pixel difference. The pixel value of the pixel point can also be divided by the reference pixel value, and the obtained ratio can be used as the pixel difference.
[0067] Pixel gradient data is data related to pixel gradients, for example, it can be the pixel gradient itself, or it can be the difference between pixel gradients. The reference pixel value is the pixel value referenced to determine the pixel gradient. The reference pixel value can be obtained according to the pixel value of the target coding unit, for example, the pixel value of any pixel point in the target coding unit can be selected as the reference pixel value, or the pixel value of the target coding unit can be counted and the pixel mean value can be calculated, and the calculated pixel mean value can be used as the reference pixel value.
[0068] In some embodiments, the difference between the pixel value of each pixel point and the reference pixel value, that is, the pixel gradient corresponding to each pixel point, can be calculated, and the pixel gradients of each pixel point can be comprehensively calculated to obtain the target gradient data. For example, the pixel gradients of each pixel point can be accumulated to obtain the target pixel gradient data.
[0069] In some embodiments, in the target coding unit, the reference pixels corresponding to different pixels may be different, and the pixel value of the reference pixel corresponding to the pixel may be used as the reference pixel value. For example, the pixel value of the adjacent pixel of the pixel may be used as the reference pixel value. The pixel value of one of the adjacent pixels may be used as the reference pixel value, or the pixel values of multiple adjacent pixels may be combined as the reference pixel value, for example, the pixel mean of the adjacent pixels may be used as the reference pixel value.
[0070] In some embodiments, there may be one or more target pixel gradient data. For example, the target pixel gradient data may include at least one of global gradient data or local gradient data. The global gradient data is obtained based on the difference between the pixel value of the pixel point and the pixel average value, that is, the reference pixel value may be the pixel average value to reflect the pixel change of the target coding unit as a whole. The local gradient data is obtained based on the difference between the pixel value of the pixel point and the pixel values of other pixels in the target coding unit, that is, when calculating the pixel gradient corresponding to a pixel point, the difference between the pixel value of the pixel point and the pixel values of other pixels in the target coding unit can be calculated to obtain the pixel gradient corresponding to the pixel point, wherein the other pixels used as reference pixels may be pixels adjacent to the pixel point.
[0071] Step S306, determining a target partition decision result corresponding to the target coding unit according to the target pixel gradient data.
[0072] Specifically, the partition decision result may be a termination partition or a partition. Termination partition means that the target coding unit is not partitioned. Partition means that the target coding unit needs to be divided into a plurality of sub-coding units.
[0073] In some embodiments, the division decision result may not be determined. If it is not determined, it can be determined whether the target coding unit needs to be divided according to the traditional method for determining the division method of the coding unit. For example, the rate-distortion cost corresponding to the sub-coding units obtained after the target coding is divided can be calculated, and the sum of the rate-distortion costs corresponding to the sub-coding units can be counted and compared with the rate-distortion cost corresponding to the target coding unit without division. If the sum of the rate-distortion costs corresponding to the sub-coding units is small, the target coding unit needs to be divided. If the rate-distortion cost corresponding to the target coding unit without division is small, the target coding unit does not need to be divided.
[0074] When determining the target division decision result corresponding to the target coding unit according to the target pixel gradient data, the target pixel gradient data can be compared with a preset threshold value. If it is less than a preset first gradient threshold value, it means that the gradient difference or gradient is relatively small, and the content change of the target coding unit is small, and the division decision result can be termination of division. If it is greater than a preset second gradient threshold value, it means that the gradient difference or gradient is relatively large, and the division decision result can be division.
[0075] In some embodiments, when there are multiple target pixel gradient data, all target gradient data or target gradient data exceeding a preset number may be less than a preset first gradient threshold, and the division decision result is to terminate the division. Alternatively, all target gradient data or target gradient data exceeding a preset number are greater than a preset second gradient threshold, and the division decision result is division.
[0076] Step S308: Perform video encoding on the target coding unit according to the target partition decision result.
[0077] Specifically, after the target partition decision result is obtained, video encoding can be performed on the target encoding unit according to the target partition decision result.
[0078] In some embodiments, when the target division decision result is termination division, video encoding is performed with the target coding unit as the coding unit. Since when the division result corresponding to the target coding unit is termination division, the division process after the target coding unit will be terminated directly, and the method of determining whether the target coding unit needs to be divided according to the rate-distortion cost will no longer be used, thereby saving encoding time. When determining the termination division, the target coding unit can be used as a unit for obtaining a reference block (reference unit), and the reference block corresponding to the target coding unit is obtained. The predicted pixel value of the target coding unit is obtained according to the reference block, and the predicted pixel value is subtracted from the actual pixel value of the target coding unit to obtain a prediction residual, and the prediction residual is quantized and entropy coded to obtain the encoded data, and the encoded data is stored locally or transmitted to another terminal device.
[0079] In some embodiments, when the target partition decision result is partition, the target coding unit is partitioned to obtain multiple sub-coding units, and video encoding is performed according to the sub-coding units.
[0080] Specifically, when the target partitioning decision result is partitioning, the process of performing intra-frame prediction on the target coding unit to determine the rate-distortion cost can be omitted, thereby saving the rate-distortion optimization calculation process of the target coding unit. The partitioning method can be set as needed, for example, it can be quadtree partitioning, ternary tree differentiation or binary tree distribution. M-tree partitioning refers to dividing the target coding unit into M parts. M can be an integer greater than or equal to 2. For the sub-coding unit obtained by the partition, if the sub-coding unit is the minimum coding unit specified in the video coding standard, the partitioning may not be continued. If the sub-coding unit is not the minimum coding unit specified in the video coding standard, the sub-coding unit can be used as a new target coding unit to continue the partitioning decision.
[0081] The above-mentioned video encoding method can obtain the target pixel gradient data through the pixel value calculation of the encoding unit. The target pixel gradient data is obtained according to the difference between the pixel value of the pixel point and the reference pixel value, and thus can reflect the image change of the target encoding unit. Therefore, the target division decision result corresponding to the target encoding unit determined according to the target pixel gradient data has high accuracy and can reduce the time for obtaining the division decision result, thereby shortening the encoding time of video encoding and improving the video encoding efficiency.
[0082] For example, Figure 4 The figure shows a schematic diagram of the division of a 64*64 pixel image block. One square represents a coding block. First, the 64*64 pixel image block can be used as the target coding unit, and the method provided in the embodiment of the present application is executed to obtain the target coding unit division decision result. Therefore, the 64*64 pixel image block can be divided into 4 sub-coding units. And these 4 sub-coding units are used as new target coding units, and the method provided in the embodiment of the present application is continued to be executed until a 4*4 pixel coding unit is obtained. Since the 4*4 pixel coding unit is the minimum coding unit of the video coding standard, the division decision can be stopped.
[0083] In some embodiments, Figure 5 As shown, step S302, that is, calculating the target pixel gradient data according to the pixel value of the pixel point corresponding to the target coding unit, includes the following steps:
[0084] Step S502, determining a current pixel point in a target coding unit, and obtaining a pixel value of a target adjacent pixel point corresponding to the current pixel point as a reference pixel value.
[0085] Specifically, the current pixel point refers to the pixel point in the target coding unit that currently needs to calculate the pixel gradient. Each pixel point can be used as the current pixel point at the same time, or one by one or multiple pixels can be used as the current pixel point. The target adjacent pixel point can be one or more of the pixel points adjacent to the current pixel point, for example, Figure 6 As shown, a small square represents a pixel point. Assuming that in the target coding unit, the current pixel point is X1, the target adjacent pixel points can be all the pixel points from A to H, or one or more pixel points from A to H can be selected as the target adjacent pixel points.
[0086] In some embodiments, a target gradient calculation direction may be obtained, and adjacent pixel points corresponding to the current pixel point in the target gradient calculation direction may be obtained as target adjacent pixel points.
[0087] Specifically, the target gradient calculation direction refers to the direction of gradient calculation, and the gradient calculation direction can be determined as needed, for example, it can include at least one of the horizontal direction, the vertical direction, the 45-degree direction, or the 135-degree direction. The horizontal direction can be the direction from left to right or from right to left, and the vertical direction refers to the direction from top to bottom or from bottom to top. The 45-degree direction refers to the direction from the lower left corner to the upper right corner of the target coding unit, and the 135-degree direction refers to the direction from the lower right corner to the upper left corner of the target coding unit, such as Figure 7 , which is a schematic diagram of various gradient calculation directions in some embodiments.
[0088] In the target gradient calculation direction, the neighboring pixel points corresponding to the current pixel point are the forward neighboring pixel points of the current pixel point in the target gradient calculation direction. For example, assuming the target gradient calculation direction is Figure 7 In the horizontal direction, for the current pixel X1, the target adjacent pixel is H. Assume that the target gradient calculation direction is Figure 7 In the vertical direction, for the current pixel X1, the target adjacent pixel is B. Assume that the target gradient calculation direction is Figure 7 In the 45-degree direction, for the current pixel X1, the target adjacent pixel is G. Assume that the target gradient calculation direction is Figure 7 In the 135 degree direction, for the current pixel point X1, the target adjacent pixel point is E.
[0089] Step S504, calculating the difference between the pixel value of the current pixel and the reference pixel value to obtain the pixel value difference corresponding to the current pixel.
[0090] Specifically, the difference between the pixel value of the current pixel and the reference pixel value can be obtained according to the difference, for example, the absolute value of the difference or the square of the difference.
[0091] Step S506, counting the pixel value differences corresponding to each pixel point in the target coding unit to obtain target pixel gradient data.
[0092] Specifically, the statistics may be to calculate the mean or median. For example, the pixel value differences corresponding to each pixel point in the target coding unit are summed up and the obtained sum is used as the target pixel gradient data.
[0093] In some embodiments, the target pixel gradient data may include local pixel gradients corresponding to one or more target gradient calculation directions. For example, the local pixel gradients corresponding to the horizontal direction, vertical direction, 45-degree direction, and 135-degree direction, respectively. The local pixel gradients corresponding to the horizontal direction, vertical direction, 45-degree direction, or 135-degree direction, respectively, can be expressed by formulas (1) to (4), respectively. Among them, in the formula, LocalGradient represents the local pixel gradient, LocalGradient_HOR represents the local pixel gradient in the horizontal direction. LocalGradient_VER represents the local pixel gradient in the vertical direction. LocalGradient_45 represents the local pixel gradient in the 45-degree direction. LocalGradient_135 represents the local pixel gradient in the 135-degree direction. Width represents the number of pixels in the width direction, i.e., the horizontal direction, and Height represents the number of pixels in the height direction, i.e., the vertical direction. P represents the pixel value, for example P i,j It represents the pixel value of the i-th row and j-th column in the target coding unit, abs represents the absolute value, and ∑ represents the sum.
[0094]
[0095]
[0096]
[0097]
[0098] In some embodiments, step S302, i.e., calculating the target pixel gradient data based on the pixel value of the pixel point corresponding to the target coding unit, includes the following steps: dividing the target coding unit into multiple regions, calculating the pixel gradient corresponding to each region, the pixel gradient corresponding to the region is obtained based on the difference between the pixel value of the pixel point corresponding to the region and the reference pixel value; calculating the pixel gradient difference between the regions to obtain the target pixel gradient data.
[0099] Specifically, multiple refers to more than two, including two. The method of dividing the target coding into multiple areas can be set as needed, for example, it can be divided into two areas. The method of dividing into two areas can be at least one of horizontal division, vertical division or diagonal division. For example, if the target coding unit is a square block, that is, the number of pixels in the length direction and the width direction is the same, horizontal division, vertical division and diagonal division can be performed. If the target coding unit is a non-square block, if the width is greater than the height, vertical division can be performed to divide the target coding unit into a left half and a right half. If the height is greater than the width, horizontal division can be performed to divide the target coding unit into an upper half and a lower half.
[0100] The reference pixel value may be a pixel mean, and the pixel mean may be a pixel mean of the pixel points corresponding to the target coding unit, or a pixel mean of the pixel points corresponding to the region. Of course, it may also be a pixel value of an adjacent pixel point adjacent to the pixel point. The pixel gradient difference between regions may be represented by the absolute value of the pixel gradient difference between the two regions, or by the square of the difference, or by a proportional value. The pixel gradient corresponding to a region may be a statistical value of the pixel difference corresponding to each pixel point in the region, such as the sum or average value of the pixel difference corresponding to each pixel point in the region.
[0101] In some embodiments, calculating the pixel gradient difference between the regions includes: subtracting the pixel gradient corresponding to the second region from the pixel gradient corresponding to the first region, to obtain the pixel gradient difference between the first region and the second region. The first region and the second region may be any region corresponding to the target coding unit, for example, the first region may be the upper half of the target coding unit, and the second region may be the lower half of the target coding unit.
[0102] In some embodiments, the gradient is directional, for example, it may include a gradient in the horizontal direction and a gradient in the vertical direction. For the same coding unit, the gradients corresponding to different directions have different meanings. Therefore, when performing gradient comparison, such as gradient subtraction, the pixel gradients in the same direction are subtracted. For example, the pixel gradient in the vertical direction of the first region is subtracted from the pixel gradient in the vertical direction of the second region.
[0103] In some embodiments, the target pixel gradient data may include the gradient difference of the global pixel gradient corresponding to one or more gradient calculation directions. For example, the gradient difference of the global pixel gradient corresponding to the horizontal direction, the vertical direction, the 45 degree direction, and the 135 degree direction, respectively. Figure 8As shown, the global pixel gradient difference in the horizontal direction can be the difference in the global pixel gradient between the left half and the right half. The global pixel gradient in the vertical direction can be the global pixel gradient difference between the upper half and the lower half. The global pixel gradient in the 45 degree direction can be the global pixel gradient difference between the lower left part and the upper right part. The global pixel gradient in the 135 degree direction can be the global pixel gradient difference between the upper left part and the lower right part.
[0104] In some implementations, the global pixel gradient differences corresponding to the horizontal direction, vertical direction, 45-degree direction or 135-degree direction can be expressed by formulas (5) to (8), respectively. In the formula, GlobalGradient represents the global pixel gradient, and GlobalGradient_HOR represents the global pixel gradient difference in the horizontal direction. GlobalGradient_VER represents the global pixel gradient difference in the vertical direction. GlobalGradient_45 represents the global pixel gradient difference in the 45-degree direction. GlobalGradient_135 represents the total pixel gradient difference in the 135-degree direction. N represents the number of pixels in the length direction and the width direction. Here, the example in which the number of pixels in the length direction and the width direction of the target coding unit are the same is used for explanation. It can be understood that the number of pixels in the length direction and the width direction of the target coding unit may also be different. abs represents the absolute value, and ∑ represents the sum. P represents the pixel value, for example P i,j Represents the pixel value of the i-th row and j-th column in the target coding unit. avg Represents the pixel average.
[0105]
[0106]
[0107]
[0108]
[0109] In some embodiments, it can be determined whether the target pixel gradient data satisfies a first threshold condition, and when the target pixel gradient data satisfies the first threshold condition, it is determined that the target division decision result corresponding to the target coding unit is to terminate the division. The first threshold condition includes that the target pixel gradient data less than the corresponding first threshold satisfies a first quantity.
[0110] Specifically, the first number can be set as needed, for example, it can be the number corresponding to all target pixel gradient data, or it can be part. If the target pixel gradient data less than the corresponding first threshold satisfies the first number, it means that the image content of the target coding unit changes little, and the condition for not dividing is met, so the division can be terminated.
[0111] In some embodiments, the first threshold value can be obtained based on experience or experiments. For example, the target gradient data corresponding to the segmentation and termination of the segmentation in the video frames with different contents can be counted, and then the value that makes the accuracy of the decision to terminate the segmentation meet the preset accuracy, such as 90%, is selected as the first threshold value.
[0112] In some embodiments, different quantization parameters may correspond to different first thresholds, and different target coding unit sizes may also correspond to different first thresholds. For example, different quantization parameters may be obtained through experimental statistics, so that the accuracy of the decision to terminate the division satisfies the gradient value of the preset accuracy as the first threshold.
[0113] In some embodiments, different target pixel gradient data may correspond to different first thresholds. For example, according to experiments, the target pixel gradient data in the 45-degree direction and the 135-degree direction may be larger than the target pixel gradient data in the horizontal direction and the vertical direction. Therefore, a larger first threshold may be set for the target pixel gradient data in the 45-degree direction and the 135-degree direction. For example, the first threshold corresponding to the target pixel gradient data in the 45-degree direction and the 135-degree direction may be a times the first threshold corresponding to the target pixel gradient data in the horizontal direction, where a is greater than 1, for example, 1.414. For another example, the first threshold corresponding to the global gradient may be different from the first threshold corresponding to the local gradient.
[0114] In some embodiments, the first threshold may be variable. For example, for the first CTU of a video frame, the corresponding first threshold may be preset. For other CTUs with adjacent CTUs, the target gradient data corresponding to the adjacent CTUs may be obtained, and the first threshold may be obtained based on the target gradient data corresponding to the adjacent CTUs. For example, the maximum gradient data in the CTUs above and to the left of the CTU may be used as the first threshold. The average gradient data of the CTUs above and to the left may also be used as the first threshold. Since the similarity between adjacent CTUs is relatively high, the first threshold may be updated using the target gradient data corresponding to the adjacent CTUs, so that the judgment conditions of the division decision results may change dynamically according to changes in the image content, thereby improving the accuracy of the division decision results.
[0115] In some embodiments, determining a target division decision result corresponding to a target coding unit based on target pixel gradient data includes: when the target pixel gradient data satisfies a second threshold condition, determining that the target division decision result corresponding to the target coding unit is division, and the second threshold condition includes that target pixel gradient data greater than the corresponding second threshold satisfies a second quantity.
[0116] Specifically, the first threshold and the second threshold may be the same or different. The second number may be set as needed, for example, it may be the number corresponding to all target pixel gradient data or a part. If the target pixel gradient data greater than the corresponding second threshold satisfies the second number, it means that the image content of the target coding unit changes greatly and meets the conditions for division, so the target coding unit may be divided.
[0117] In some embodiments, it is possible to simultaneously determine whether the target pixel gradient data satisfies the first threshold condition and the second threshold condition. It is also possible to first determine whether the target pixel gradient data satisfies the first threshold condition, and when the target pixel gradient data satisfies the first threshold condition, it is not necessary to determine whether the target pixel gradient data satisfies the second threshold condition, so as to reduce computational complexity.
[0118] In some embodiments, it can be determined according to different situations whether to use the first threshold condition or the second threshold condition to determine the target partition decision result. For example, the threshold condition and the corresponding partition decision result can be determined according to the number of sub-units obtained when the target coding unit is divided. For example, if it is a quad tree (quad tree, QT) division, it can be determined whether the target pixel gradient data meets the first threshold condition, such as determining whether all target pixel gradient data are less than the first threshold. If so, the target partition decision result corresponding to the target coding unit is determined to terminate the partition. If it is a 3-way tree (Triple Tree, TT) and a 2-way tree (Binary Tree, BT) division, since there are fewer sub-units to be divided, the conditions can be relaxed, so it can be determined whether all pixel gradient data are greater than the second threshold. If so, the target partition decision result corresponding to the target coding unit is determined to be partitioned.
[0119] In some embodiments, the division method of the coding unit can be set as needed. For example, the coding units can be set to be divided into quadtrees, or multiple division methods can be set. For example, in the video standard VVC (Versatile Video Coding), the coding units can be divided into more complex and diverse binary trees, ternary trees, and quadtrees to reduce the amount of encoded data. The maximum size of the coding block (i.e., the coding unit) can be 128x128 pixels and the minimum size can be 4x4 pixels. The coding block can first be divided into a quadtree, and then binary and ternary trees can be divided on the leaf nodes of the quadtree division. The minimum value of the quadtree leaf node is 16x16 pixels. Fig. 9 As shown, for each CU block in the CTU, the judgment process shown in the figure will be performed. First, the quadtree partitioning recursive process is performed, and then the leaf node blocks of the quadtree partitioning are traversed in turn for vertical and horizontal partitioning, binary tree and ternary tree partitioning, until the optimal partitioning result of all CU blocks in the current CTU is found. Therefore, in the process of QT (quad tree) partitioning, TT (ternary tree) partitioning and BT (binary tree) partitioning, the method provided in the embodiment of the present application can be used to quickly determine the partitioning decision result. If the method provided in the embodiment of the present application is used, it is not possible to determine whether the partitioning is required, then other partitioning depth decision methods can be used to determine the partitioning depth. Among them, MT (Multiple-type Tree, multi-tree partitioning) represents multi-tree partitioning, such as a quad tree, a binary tree or a ternary tree. MTdepth represents the depth of MT partitioning, QTdepth represents the depth of QT partitioning, and the depth increases by 1 for each additional partitioning.
[0120] In some embodiments, step S302, i.e., calculating the target pixel gradient data based on the pixel value of the pixel point corresponding to the target coding unit, includes: dividing the target coding unit to obtain multiple sub-coding units; calculating the pixel gradient corresponding to each sub-coding unit to obtain the target pixel gradient data, wherein the pixel gradient corresponding to the sub-coding unit is obtained based on the difference between the pixel value of the pixel point corresponding to the sub-coding unit and the reference pixel value.
[0121] Specifically, the division method can be set as needed, for example, it can be divided into 4 or 3. For example, the division method can be determined according to the current division process. If it is currently determined whether to perform 3-tree division on the target coding unit, the target coding unit can be divided into 3 sub-coding units.
[0122] In some embodiments, the sub-coding units after division meet the size requirements of the coding units in the video coding standard or are smaller than the minimum coding unit. For example, if the target coding unit is a non-square block, if it is divided into 2 coding units, it often does not meet the requirements of the coding unit size in the video coding standard, then the target coding unit can be divided into multiple sub-blocks according to the size of the minimum coding unit. For a practical example, assuming that the target coding unit is 16*8 pixels and the minimum coding unit is 4*4 pixels, the coding unit can be divided into 8 sub-coding units according to the size of 4*4 pixels. The pixel gradient of the sub-coding unit may include at least one of a global gradient or a local gradient. The pixel gradient data of the sub-coding unit may be used as the target pixel gradient data.
[0123] In some embodiments, determining a target partition decision result corresponding to a target coding unit according to target pixel gradient data includes: calculating the pixel gradient data difference between sub-coding units, and determining a target partition decision result corresponding to the target coding unit according to the pixel gradient data difference between the sub-coding units.
[0124] Specifically, the gradient data difference can be obtained based on a ratio or a difference, for example, it can be the absolute value of the difference, or it can be the square of the difference. It can be to calculate the difference in pixel gradient data between every two sub-coding units. It can also be to calculate at least one of the pixel gradient data differences in the horizontal direction or the vertical direction. The pixel gradient data difference in the horizontal direction can be the difference in pixel gradient data between the left sub-block (sub-coding unit) and the adjacent right sub-block. The pixel gradient data difference in the horizontal direction can be the difference in pixel gradient data between the upper sub-block and the adjacent lower sub-block. For example, Fig.10 As shown, it is assumed that the target coding unit is divided into 4 sub-coding units, which are changed to 0, 1, 2 and 3 respectively. Then the pixel gradient difference in the horizontal direction may include at least one of the pixel gradient data difference between sub-coding unit 0 and sub-coding unit 1, or the pixel gradient data difference between sub-coding unit 2 and sub-coding unit 3. The pixel gradient data difference in the vertical direction may include at least one of the pixel gradient data difference between sub-coding unit 0 and sub-coding unit 2, or the pixel gradient data difference between sub-coding unit 1 and sub-coding unit 3.
[0125] The pixel gradient data difference between the sub-coding units can be expressed as a difference or a ratio. For example, assuming that the pixel gradient of sub-coding unit 1 is x and the pixel gradient of sub-coding unit 3 is y, the pixel gradient difference can be x divided by y, or y divided by x.
[0126] In some embodiments, when the pixel gradient data difference between the sub-coding units satisfies a third threshold judgment condition, the target division decision result corresponding to the target coding unit is determined to be division, and the third threshold judgment condition includes that the pixel gradient data difference greater than the corresponding third threshold satisfies a third quantity.
[0127] Specifically, the third threshold can be set as needed, for example, it can be obtained based on experience or experiments. For example, the target gradient data differences corresponding to the division and the termination of the division in the video frames with different contents can be counted, and then the gradient data difference value that makes the division decision result meet the preset accuracy, such as 98%, is selected as the third threshold. The third threshold can also be adaptively adjusted according to the length and width of the coding block, and the ratio of the length and width. For example, when counting the target gradient data differences corresponding to the division and the termination of the division in the video frames with different contents, different coding block sizes can be distinguished for statistics to obtain thresholds corresponding to coding units of various sizes.
[0128] The third number can be set as needed, for example, it can be the number corresponding to all pixel gradient data differences, or it can be a part. For example, as long as the difference of one pixel gradient data is greater than the third threshold, the target division decision result corresponding to the target coding unit is division. When the pixel gradient data difference of the sub-coding unit is large, it means that the contents of each sub-coding unit are relatively different. Therefore, it is necessary to obtain the corresponding reference block for prediction to obtain the prediction value of the sub-coding unit so as to make the prediction residual smaller. Therefore, the division decision result can be division to reduce the data amount of the encoded data obtained by encoding.
[0129] In some embodiments, determining a target division decision result corresponding to a target coding unit based on target pixel gradient data includes: obtaining a target number of sub-coding units whose pixel gradient data is greater than a fourth threshold, and when the target number exceeds the fourth number or when the ratio of the target number to the number of sub-coding units exceeds the first ratio, determining that the target division decision result corresponding to the target coding unit is division.
[0130] Specifically, the first ratio can be set as needed, for example, it can be one quarter. The fourth number can also be set as needed, for example, it can be 5. When the target number exceeds the fourth number or when the ratio of the target number to the number of sub-coding units exceeds the first ratio, it means that the image content in the sub-coding unit changes rapidly, and therefore, the target coding unit needs to be divided so that it can be encoded in units of sub-coding units, or the sub-coding unit needs to be further divided to reduce the prediction residual.
[0131] The method for determining the target partition decision result provided by the embodiment of the present application can be applied before the method of using rate-distortion cost to judge the partition depth of the coding unit. For example, although the partitioning scheme of multiple hybrid trees (such as quadtrees, ternary trees and binary trees) structures is used to determine the coding unit, although it can improve the coding efficiency, it also brings a very large increase in coding time, which is very unfavorable for the acceleration of the encoder. In particular, the more modes are traversed, each mode must perform the intra-frame prediction process under the mode. The intra-frame prediction includes 67 intra-frame direction predictions and a lot of intra-frame prediction technologies. A large number of rate-distortion optimization-related decisions will greatly increase the computational complexity of the encoder. By combining the structural characteristics of binary trees, ternary trees and quadtrees, as well as the content information of the coding block, it can be decided in advance whether the current CU block can be determined to be divided or not, thereby effectively reducing the tentative traversal of various partition structures within the CU block, greatly saving coding time, and improving the compression efficiency of the video standard.
[0132] In some embodiments, different decision methods can be provided for square blocks (i.e., the target coding unit is square) or non-square blocks. For example, as shown in the following pseudo code, it is the first decision method for square blocks. Among them, Thr_G represents the threshold corresponding to the global gradient, and Thr_L represents the threshold corresponding to the local gradient. "&&" represents the "and" symbol, and "||" represents the "or" symbol. a and b can be set according to experience or experiments, for example. It can also be obtained by a statistical method. When the rate-distortion cost is used for partitioning decision, the a value and b value corresponding to the termination partitioning are obtained to obtain a value that makes the termination partitioning decision accuracy higher than the preset accuracy. The values of a and b can also be adaptively adjusted according to the size of the target coding unit. For example, a and b can be 1.414 and 1.2, respectively.
[0133] getRatioFlag means to find the ratio. GlobalGradientSubBlock_Ver[H] represents the global gradient difference of sub-coding unit H. For example, GlobalGradientSubBlock_Ver[1] represents the global gradient difference of sub-coding unit 1. Through the following code, it can be obtained that when the local gradients are all less than the corresponding first threshold and the global gradient differences are all less than the corresponding first threshold, the target division decision result is determined to be no division. If it cannot be determined that the division must be terminated, the target coding unit can be divided into 4 sub-blocks, and the global pixel gradient data difference in the horizontal direction and the global pixel gradient data difference in the vertical direction are calculated. If the ratio of the global pixel gradient data difference between sub-blocks is greater than b, then the division must be performed.
[0134] If(GlobalGradient_Hor<Thr_G&&LocalGradient_Hor<THr_L&&GlobalGradient_Ver<Thr_G&&LocalGradient_Ver<THr_L) / / If the global gradient difference in the horizontal direction and the global gradient difference in the vertical direction are less than the threshold corresponding to the global gradient, and the local gradient in the horizontal direction and the local gradient in the horizontal direction are less than the threshold corresponding to the local gradient {
[0135] If(GlobalGradient_45<a*Thr_G&&LocalGradient_45<a*THr_L&&GlobalGradient_135<a*Thr_G&&LocalGradient_135<a*THr_L) / / If the global gradient difference in the 45-degree direction and the global gradient difference in the 135-degree direction are less than a times the threshold corresponding to the global gradient, and the local gradient in the 45-degree direction and the local gradient in the 135-degree direction are less than b times the threshold corresponding to the local gradient {
[0136] NotSplit = 1; / / Definitely do not perform splitting, that is, the splitting decision result is to terminate splitting.
[0137] }
[0138] } else / / Otherwise, perform the following operations {
[0139] Int HorFalg = getRatioFlag(GlobalGradientSubBlock_Hor[0], GlobalGradientSubBlock_Hor[1]) || getRatioFlag(GlobalGradientSubBlock_Hor[2], GlobalGradientSubBlock_Hor[3]); / / Calculate the ratio of the global pixel horizontal gradient difference between sub - coding units 0 and 1, or the ratio of the global pixel horizontal gradient difference between sub - coding units 2 and 3, that is, calculate the ratio of the global pixel gradient data difference in the horizontal direction.
[0140] Int VerFlag = getRatioFlag(GlobalGradientSubBlock_Ver[0], GlobalGradientSubBlock_Ver[2])|| getRatioFlag(GlobalGradientSubBlock_Ver[1], GlobalGradientSubBlock_Ver[3]); / / Calculate the ratio of the global pixel vertical gradient difference between sub-coding units 0 and 2, or the ratio of the global pixel vertical gradient difference between sub-coding units 1 and 3, that is, calculate the ratio of the difference in the global pixel gradient data in the vertical direction.
[0141] If(HorFlag&&VerFlag){
[0142] DoSplit = 1; / / If the ratio of the vertical gradient difference of the global pixels in the vertical direction and the ratio of the horizontal gradient difference of the global pixels in the horizontal direction are both greater than b, the division decision result is to divide
[0143] }
[0144] }
[0145] BoolgetRatioFlag(doublex,double){
[0146] If(x==0||y==0)returntrue;
[0147] If(x / y>b||y / x>b)returntrue; / / If x divided by y or y divided by x is greater than b, then return true.
[0148] Elsereturnfalse; / / Otherwise, return false.
[0149] }
[0150] In some embodiments, as shown in the following pseudo code, it is a second decision method for square blocks. When performing binary tree and ternary tree partitioning, the second decision method can be used to relax the decision conditions. Thr_G_Limit refers to the gradient threshold corresponding to the global gradient, which can be the same as Thr_G or different. Thr_L_Limit refers to the gradient threshold corresponding to the local gradient, which can be the same as Thr_L or different.
[0151] If(min{GlobalGradient_Hor,GlobalGradient_Ver,GlobalGradient_45,GlobalGradient_135}>Thr_G_Limit||min{LocalGradient_Hor,LocalGradient_Ver,LocalGradient_45,LocalGradient_135}>Thr_L_Limit){
[0152] DoSplit = 1; / / If the minimum value of the global pixel gradient difference corresponding to the horizontal direction, vertical direction, 45 degree direction and 135 degree direction is greater than the gradient threshold corresponding to the global pixel gradient, and the minimum value of the local pixel gradient corresponding to the horizontal direction, vertical direction, 45 degree direction and 135 degree direction is greater than the gradient threshold corresponding to the local pixel gradient, then the division decision result is to divide
[0153] }
[0154] In some embodiments, as shown in the following pseudo code, it is a first decision method for non-square blocks. GlobalGradient_Hor_Left, GlobalGradient_Hor_Right, GlobalGradient_Ver_Above, and GlobalGradient_Ver_Below refer to the global gradient difference corresponding to the left half, the global gradient difference corresponding to the right half, the global gradient difference corresponding to the upper half, and the global gradient difference corresponding to the lower half, respectively. a_hor can be a preset value, which can be determined by referring to the method for obtaining the preset value a.
[0155] If(Width / Height>2) / / When the ratio of width to height is greater than 2 {
[0156] If(GlobalGradient_Hor_Left>a_hor*GlobalGradient_Hor_Right||GlobalGradient_Hor_Right>a_hor*GlobalGradient_Hor_Left){
[0157] DoSplit = 1; / / If the global gradient difference corresponding to the left half is a_hor times the global gradient difference corresponding to the right half, or the global gradient difference corresponding to the right half is a_hor times the global gradient difference corresponding to the left half, the partition decision result is to perform a partition.
[0158] }
[0159] }
[0160] If(Height / Width>2) / / When the ratio of height to width is greater than 2 {
[0161] If(GlobalGradient_Ver_Above>a_hor*GlobalGradient_Ver_Below||GlobalGradient_Ver_Below>a_hor*GlobalGradient_Ver_Above){
[0162] DoSplit = 1; / / If the global gradient difference corresponding to the upper half is a_hor times the global gradient corresponding to the lower half, or the global gradient difference corresponding to the lower half is a_hor times the global gradient difference corresponding to the upper half, the partition decision result is to perform a partition.
[0163] }
[0164] }
[0165] In some embodiments, as shown in the following pseudo code, it is a second decision method for non-square blocks. It can be that if the first decision method for non-square blocks cannot determine whether to divide, the second decision method for non-square blocks is used to make a decision to perform more sophisticated operations. The target coding unit can be divided into the smallest coding unit, such as 4*4 pixels, and the local gradient is calculated for each sub-coding, and the local gradient is calculated as a pixel-by-pixel difference. subBlkNum refers to the number of sub-coding units. Thr_Sub_Limit represents the gradient threshold, that is, the gradient value of each sub-block in the target coding unit can be traversed, and the number of sub-blocks greater than Thr_Sub_Limit can be counted. If the gradient of more than 1 / 4 of the sub-blocks is greater than Thr_Sub_Limit, then the division decision result of the block is to divide.
[0166] Int count = 0;
[0167] For(intI=0;I <subBlkNum;i++){
[0168] If(Gradient_subBlk[i]>Thr_Sub_Limit)count++;
[0169] If(count>1 / 4*subBlkNum){
[0170] DoSplit = 1;
[0171] Break;
[0172] }
[0173] }
[0174] The video encoding method provided by the present invention is described below with a specific embodiment:
[0175] 1. Receive a video image from a video sequence, and decompose the video image into one or more coding units of a preset size as target coding units.
[0176] 2. Divide the target coding unit into multiple regions, calculate the pixel gradient corresponding to each region, and calculate the global pixel gradient difference between regions.
[0177] For example, the target coding unit may be divided horizontally, vertically, and diagonally. The global pixel gradient of each region is calculated, and the gradient differences of the global pixel gradients corresponding to the horizontal direction, the vertical direction, the 45-degree direction, and the 135-degree direction are calculated according to formulas (5) to (8).
[0178] 3. Calculate the local pixel gradients of the target coding unit in all directions.
[0179] For example, the gradient calculation direction may include the horizontal direction, the vertical direction, the 45 degree direction, and the 135 degree direction. The local pixel gradients in the horizontal direction, the vertical direction, the 45 degree direction, and the 135 degree direction may be calculated according to formulas (1) to (4).
[0180] 4. Determine whether the difference of each global pixel gradient is less than the corresponding first threshold, and determine whether each local pixel gradient is less than the corresponding first threshold. If yes, determine that the target segmentation decision result is to terminate the segmentation. If not, proceed to step 5.
[0181] 5. Divide the target coding unit into 4 sub-coding units, calculate the global pixel gradient corresponding to each sub-coding unit, and calculate the global pixel gradient data difference corresponding to the vertical direction and the global pixel gradient data difference corresponding to the horizontal direction.
[0182] For example, the pixel gradient difference in the horizontal direction may include at least one of the pixel gradient data difference between sub-coding unit 0 and sub-coding unit 1, or the pixel gradient data difference between sub-coding unit 2 and sub-coding unit 3. The pixel gradient data difference in the vertical direction may include at least one of the pixel gradient data difference between sub-coding unit 0 and sub-coding unit 2, or the pixel gradient data difference between sub-coding unit 1 and sub-coding unit 3.
[0183] 6. When the pixel gradient data difference between the sub-coding units meets the third threshold judgment condition, the target division decision result corresponding to the target coding unit is determined to be division. If not, proceed to step 7.
[0184] For example, if at least one of the pixel gradient data difference between sub-coding unit 0 and sub-coding unit 1, the pixel gradient data difference between sub-coding unit 2 and sub-coding unit 3, the pixel gradient data difference between sub-coding unit 0 and sub-coding unit 2, and the pixel gradient data difference between sub-coding unit 1 and sub-coding unit 3 is greater than a third threshold, then the target partitioning decision result corresponding to the target coding unit is determined to be partitioning.
[0185] 7. Determine the partition depth of the target coding unit according to the rate-distortion cost.
[0186] For example, a first rate-distortion cost corresponding to encoding the target coding unit as a complete block and a second rate-distortion cost corresponding to encoding the target coding unit by dividing it into four sub-blocks may be calculated. If the first rate-distortion cost is large, the partitioning decision result is partitioning. If the second rate-distortion cost is large, the partitioning decision result is termination of partitioning.
[0187] In some embodiments, for both luma blocks and chroma blocks, the method in the embodiments of the present application can be used to make block division (coding unit division) decisions.
[0188] like Fig.11 As shown, in some embodiments, a video encoding device is provided, which can be integrated into the above-mentioned terminal device, and specifically can include a target encoding unit acquisition module 1102, a target pixel gradient data acquisition module 1104, a target partition decision result determination module 1106 and a video encoding module 1108.
[0189] The target coding unit acquisition module 1102 is used to acquire a target coding unit to be encoded.
[0190] The target pixel gradient data obtaining module 1104 is used to calculate the target pixel gradient data according to the pixel value of the pixel point corresponding to the target coding unit, and the target pixel gradient data is obtained according to the difference between the pixel value of the pixel point and the reference pixel value.
[0191] The target partition decision result determination module 1106 is used to determine the target partition decision result corresponding to the target coding unit according to the target pixel gradient data.
[0192] The video encoding module 1108 is used to perform video encoding on the target encoding unit according to the target partition decision result.
[0193] In some embodiments, the target pixel gradient data obtaining module 1104 includes:
[0194] The reference pixel value acquisition unit is used to determine a current pixel point in a target coding unit and acquire a pixel value of a target adjacent pixel point corresponding to the current pixel point as a reference pixel value.
[0195] The pixel value difference calculation unit is used to calculate the difference between the pixel value of the current pixel point and the reference pixel value to obtain the pixel value difference corresponding to the current pixel point.
[0196] The target pixel gradient data obtaining unit is used to perform statistics on the pixel value differences corresponding to each pixel point in the target coding unit to obtain the target pixel gradient data.
[0197] In some embodiments, the unit for determining the target adjacent pixel point corresponding to the current pixel point is used to: obtain the target gradient calculation direction; obtain the adjacent pixel point corresponding to the current pixel point in the target gradient calculation direction as the target adjacent pixel point.
[0198] In some embodiments, the target pixel gradient data obtaining module 1104 includes:
[0199] The pixel gradient calculation unit is used to divide the target coding unit into multiple areas and calculate the pixel gradient corresponding to each area. The pixel gradient corresponding to the area is obtained according to the difference between the pixel value of the pixel point corresponding to the area and the reference pixel value.
[0200] The gradient difference calculation unit is used to calculate the pixel gradient difference between regions to obtain target pixel gradient data.
[0201] In some embodiments, the gradient difference calculation unit is used to: subtract the pixel gradient corresponding to the second area from the pixel gradient corresponding to the first area to obtain the pixel gradient difference between the first area and the second area.
[0202] In some embodiments, the target partition decision result determination module 1106 is used to: when the target pixel gradient data satisfies a first threshold condition, determine that the target partition decision result corresponding to the target coding unit is to terminate the partition, and the first threshold condition includes that the target pixel gradient data less than the corresponding first threshold satisfies a first quantity.
[0203] In some embodiments, the target partition decision result determination module 1106 is used to: when the target pixel gradient data satisfies the second threshold condition, determine that the target partition decision result corresponding to the target coding unit is partition, and the second threshold condition includes that the target pixel gradient data greater than the corresponding second threshold satisfies the second quantity.
[0204] In some embodiments, the target pixel gradient data obtaining module 1104 includes:
[0205] The division unit is used to divide the target coding unit into multiple sub-coding units.
[0206] The sub-coding unit gradient data calculation unit is used to calculate the pixel gradient data corresponding to each sub-coding unit to obtain the target pixel gradient data. The pixel gradient corresponding to the sub-coding unit is obtained according to the difference between the pixel value of the pixel point corresponding to the sub-coding unit and the reference pixel value.
[0207] In some embodiments, the target partition decision result determination module 1106 is used to: calculate the pixel gradient data difference between the sub-coding units, and determine the target partition decision result corresponding to the target coding unit according to the pixel gradient data difference between the sub-coding units.
[0208] In some embodiments, the target partition decision result determination module 1106 is used to: when the pixel gradient data difference between the sub-coding units satisfies the third threshold judgment condition, determine that the target partition decision result corresponding to the target coding unit is partition, and the third threshold judgment condition includes that the pixel gradient data difference greater than the corresponding third threshold satisfies the third quantity.
[0209] In some embodiments, the target partition decision result determination module 1106 is used to: obtain the target number of sub-coding units whose pixel gradient data is greater than a fourth threshold, and when the target number exceeds the fourth number or when the ratio of the target number to the number of sub-coding units exceeds the first ratio, determine that the target partition decision result corresponding to the target coding unit is partition.
[0210] In some embodiments, the video encoding module 1108 is used to: when the target partition decision result is termination of partition, perform video encoding with the target encoding unit as the encoding unit; when the target partition decision result is partition, divide the target encoding unit to obtain multiple sub-coding units, and perform video encoding according to the sub-coding units.
[0211] Fig.12 The internal structure diagram of the computer device in some embodiments is shown. The computer device can be specifically Figure 1 The terminal device in Fig.12 As shown, the computer device includes a processor, a memory, a network interface, an input device and a display screen connected through a system bus. Among them, the memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system and may also store a computer program, which, when executed by the processor, enables the processor to implement a video encoding method. The internal memory may also store a computer program, which, when executed by the processor, enables the processor to execute a video encoding method. The display screen of the computer device may be a liquid crystal display or an electronic ink display screen, and the input device of the computer device may be a touch layer covering the display screen, or a button, trackball or touchpad provided on the housing of the computer device, or an external keyboard, touchpad or mouse, etc.
[0212] Those skilled in the art will understand that Fig.12 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0213] In some embodiments, the video encoding device provided by the present application can be implemented in the form of a computer program. The computer program can be Fig.12 The computer device shown in the figure is run. The memory of the computer device can store various program modules constituting the video encoding device, such as: Fig.11 The target coding unit acquisition module 1102, the target pixel gradient data acquisition module 1104, the target partition decision result determination module 1106 and the video coding module 1108 are shown. The computer program composed of various program modules enables the processor to execute the steps of the video coding method of each embodiment of the present application described in this specification.
[0214] For example, Fig.12 The computer device shown can be Fig.11 The target coding unit acquisition module 1102 in the video encoding device shown acquires the target coding unit to be encoded. The target pixel gradient data acquisition module 1104 calculates the target pixel gradient data according to the pixel value of the pixel point corresponding to the target coding unit, and the target pixel gradient data is obtained according to the difference between the pixel value of the pixel point and the reference pixel value. The target partition decision result determination module 1106 determines the target partition decision result corresponding to the target coding unit according to the target pixel gradient data. The video encoding module 1108 performs video encoding on the target coding unit according to the target partition decision result.
[0215] In some embodiments, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the above-mentioned video encoding method. The steps of the video encoding method here may be the steps of the video encoding method in the above-mentioned various embodiments.
[0216] In some embodiments, a computer-readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the processor executes the steps of the above-mentioned video encoding method. The steps of the video encoding method here can be the steps in the video encoding method of each of the above-mentioned embodiments.
[0217] It should be understood that, although each step in the flow chart of each embodiment of the present application is shown in sequence according to the indication of the arrow, these steps are not necessarily performed in sequence according to the order indicated by the arrow. Unless there is clear explanation in this article, the execution of these steps does not have strict order restriction, and these steps can be performed in other orders. Moreover, at least a portion of the steps in each embodiment may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily performed at the same time, but can be performed at different times, and the execution order of these sub-steps or stages is not necessarily performed in sequence, but can be performed in turn or alternately with at least a portion of other steps or sub-steps or stages of other steps.
[0218] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0219] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0220] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A video encoding method, the method include: Obtaining a target coding unit to be encoded; Calculating target pixel gradient data according to the pixel value of the pixel point corresponding to the target coding unit, wherein the target pixel gradient data is obtained according to the difference between the pixel value of the pixel point and the reference pixel value, wherein the reference pixel value is the pixel value for which the pixel gradient is determined, and the reference pixel value is obtained according to the pixel value of the target coding unit, wherein different pixel points in the target coding unit correspond to different reference pixel points, and the pixel value of the reference pixel point corresponding to the pixel point is used as the reference pixel value; Determine a target partition decision result corresponding to the target coding unit according to the target pixel gradient data; Video encoding is performed on the target coding unit according to the target division decision result. When the target division decision result is to terminate the division, video encoding is performed with the target coding unit as the coding unit. When the target division decision result is division, the target coding unit is divided to obtain multiple sub-coding units, and video encoding is performed according to the sub-coding units.
2. The method according to claim 1, It is characterized in that The step of calculating the target pixel gradient data according to the pixel value of the pixel point corresponding to the target coding unit comprises: Determine a current pixel point in the target coding unit, and obtain a pixel value of a target adjacent pixel point corresponding to the current pixel point as a reference pixel value; Calculating the difference between the pixel value of the current pixel and the reference pixel value to obtain the pixel value difference corresponding to the current pixel; The pixel value differences corresponding to each pixel point in the target coding unit are counted to obtain the target pixel gradient data.
3. The method according to claim 2, It is characterized in that The step of determining the target adjacent pixel point corresponding to the current pixel point comprises: Get the target gradient calculation direction; Obtain the adjacent pixel points corresponding to the current pixel point in the target gradient calculation direction as the target adjacent pixel points.
4. The method according to claim 1, It is characterized in that The step of calculating the target pixel gradient data according to the pixel value of the pixel point corresponding to the target coding unit comprises: Divide the target coding unit into multiple regions, and calculate the pixel gradient corresponding to each region, where the pixel gradient corresponding to the region is obtained according to the difference between the pixel value of the pixel point corresponding to the region and the reference pixel value; The pixel gradient differences between the regions are calculated to obtain the target pixel gradient data.
5. The method according to claim 4, It is characterized in that The calculating pixel gradient differences between the regions comprises: The pixel gradient corresponding to the first area is subtracted from the pixel gradient corresponding to the second area to obtain a pixel gradient difference between the first area and the second area.
6. The method according to claim 2 or 4, It is characterized in that Determining the target partition decision result corresponding to the target coding unit according to the target pixel gradient data includes: When the target pixel gradient data satisfies a first threshold condition, it is determined that the target division decision result corresponding to the target coding unit is to terminate the division, and the first threshold condition includes that the target pixel gradient data less than the corresponding first threshold satisfies a first quantity.
7. The method according to claim 2 or 4, It is characterized in that Determining the target partition decision result corresponding to the target coding unit according to the target pixel gradient data includes: When the target pixel gradient data satisfies a second threshold condition, it is determined that the target partition decision result corresponding to the target coding unit is partition, and the second threshold condition includes that the target pixel gradient data greater than the corresponding second threshold satisfies a second quantity.
8. The method according to claim 1, It is characterized in that The step of calculating the target pixel gradient data according to the pixel value of the pixel point corresponding to the target coding unit comprises: Dividing the target coding unit to obtain a plurality of sub-coding units; Calculate pixel gradient data corresponding to each of the sub-coding units to obtain the target pixel gradient data, wherein the pixel gradient corresponding to the sub-coding unit is obtained according to the difference between the pixel value of the pixel point corresponding to the sub-coding unit and the reference pixel value.
9. The method according to claim 8, It is characterized in that Determining the target partition decision result corresponding to the target coding unit according to the target pixel gradient data includes: The pixel gradient data differences between the sub-coding units are calculated, and the target division decision result corresponding to the target coding unit is determined according to the pixel gradient data differences between the sub-coding units.
10. The method according to claim 9, It is characterized in that The determining of the target division decision result corresponding to the target coding unit according to the pixel gradient data difference between the sub-coding units comprises: When the pixel gradient data difference between the sub-coding units satisfies the third threshold judgment condition, the target division decision result corresponding to the target coding unit is determined to be division, and the third threshold judgment condition includes that the pixel gradient data difference greater than the corresponding third threshold satisfies the third quantity.
11. The method according to claim 8, It is characterized in that Determining the target partition decision result corresponding to the target coding unit according to the target pixel gradient data includes: A target number of sub-coding units whose pixel gradient data is greater than a fourth threshold is obtained, and when the target number exceeds the fourth number or when the ratio of the target number to the number of sub-coding units exceeds the first ratio, it is determined that the target division decision result corresponding to the target coding unit is division.
12. The method according to claim 1, It is characterized in that The division method is set according to needs, including M-ary tree division, where M-ary tree division refers to dividing the target coding unit into M parts, where M is an integer greater than or equal to 2.
13. A video encoding device, the device include: A target coding unit acquisition module, used to acquire a target coding unit to be encoded; A target pixel gradient data obtaining module is used to calculate the target pixel gradient data according to the pixel value of the pixel point corresponding to the target coding unit, the target pixel gradient data is obtained according to the difference between the pixel value of the pixel point and the reference pixel value, the reference pixel value is the pixel value referenced by the pixel gradient, the reference pixel value is obtained according to the pixel value of the target coding unit, in the target coding unit, the reference pixel points corresponding to different pixel points are different, and the pixel value of the reference pixel point corresponding to the pixel point is used as the reference pixel value; A target partition decision result determination module, used to determine the target partition decision result corresponding to the target coding unit according to the target pixel gradient data; A video encoding module is used to perform video encoding on the target encoding unit according to the target division decision result. When the target division decision result is to terminate the division, video encoding is performed with the target encoding unit as the encoding unit. When the target division decision result is division, the target encoding unit is divided to obtain multiple sub-coding units, and video encoding is performed according to the sub-coding units.
14. A computer device, It is characterized in that The invention comprises a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the video encoding method according to any one of claims 1 to 12.
15. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the steps of the video encoding method according to any one of claims 1 to 12.
Citation Information
Patent Citations
Method for encoding and decoding images and apparatus for encoding and decoding using same
US20160044327A1
