Video coding method and device, equipment and storage medium

By employing JND thresholds to select SAO compensation modes based on human visual characteristics, the method addresses the challenge of accurately choosing compensation modes in video coding, enhancing video quality and efficiency.

CN120321397APending Publication Date: 2025-07-15MOORE THREADS TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510397056.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-31
Publication Date
2025-07-15

AI Technical Summary

Technical Problem

Among the existing video encoding technologies, SAO technology has insufficient accuracy when choosing compensation methods, resulting in poor encoding output quality.

Method used

By obtaining the JND threshold of the current block of the video frame, selecting the compensation method of the SAO method, and adjusting the RD cost calculation based on the human eye visual characteristics to improve the accuracy of the selection of the compensation method.

Benefits of technology

It improves the visual quality of the human eye of video encoding output, improves the encoding quality of video frames, and simplifies the encoding process and avoids encoding delays.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120321397A_ABST
    Figure CN120321397A_ABST
Patent Text Reader

Abstract

The invention discloses a video coding method and device, equipment and a storage medium, and relates to the technical field of video coding and decoding. The method comprises the following steps: acquiring a JND threshold value of a current block of a first video frame; selecting a compensation mode of the current block from at least two compensation modes included in the SAO mode according to the JND threshold value of the current block under the condition that the loop filtering mode of the current block comprises the SAO mode; and encoding the current block according to the compensation mode of the current block. As the JND threshold can reflect the human eye visual characteristics, consideration of the human eye visual characteristics can be introduced by selecting the compensation mode of the current block through the JND threshold of the current block, which is beneficial to improving the selection accuracy of the compensation mode, thereby being beneficial to improving the coding quality of the video frame.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the technical field of video coding and decoding, and particularly to a video coding method, apparatus, device and storage medium. Background Art

[0002] In current video coding and decoding standards, since mainstream coding technologies such as HEVC (High Efficient Video Coding) and AVC (Advanced Video Coding) adopt a block-based hybrid coding structure, phenomena such as block effect and ringing effect will occur. To eliminate the influence of these phenomena, related technologies also use loop filtering technology before coding output to improve the quality of coding output.

[0003] The loop filtering technology may include: BDF (Deblocking Filter) technology and SAO (Sample Adaptive Offset) technology. Among them, the SAO technology may include: EO (Edge Offset) mode, BO (Band Offset) mode and Merge (parameter fusion) mode. For the SAO technology, how to improve the accuracy of the selection of the compensation mode is a problem to be solved. Summary of the Invention

[0004] The embodiments of the present application provide a video coding method, apparatus, device and storage medium. The technical solutions provided by the embodiments of the present application include the following content.

[0005] According to one aspect of the embodiments of the present application, a video coding method is provided. The method includes:

[0006] Obtaining a JND (Just Noticeable Distortion) threshold of a current block of a first video frame;

[0007] When the loop filtering mode of the current block includes the SAO mode, selecting a compensation mode of the current block from at least two compensation modes included in the SAO mode according to the JND threshold of the current block;

[0008] Encoding the current block according to the compensation mode of the current block.

[0009] According to one aspect of the embodiments of the present application, a video coding apparatus is provided. The apparatus includes:

[0010] A distortion threshold obtaining module, configured to obtain a JND threshold of a current block of a first video frame;

[0011] A compensation mode selection module, configured to, when the loop filtering mode of the current block includes the SAO mode, select the compensation mode of the current block from at least two compensation modes included in the SAO mode according to the JND threshold of the current block;

[0012] A current block encoding module, configured to encode the current block according to the compensation mode of the current block.

[0013] According to an aspect of an embodiment of the present application, a computer device is provided. The computer device includes a processor and a memory. A computer program is stored in the memory. The computer program is loaded and executed by the processor to implement the above video encoding method.

[0014] According to an aspect of an embodiment of the present application, a computer-readable storage medium is provided. A computer program is stored in the readable storage medium. The computer program is loaded and executed by a processor to implement the above video encoding method.

[0015] According to an aspect of an embodiment of the present application, a chip is provided. The chip includes programmable logic circuits and / or program instructions. When the chip runs, it is used to implement the above video encoding method.

[0016] According to an aspect of an embodiment of the present application, a computer program product is provided. The computer program product includes a computer program. The computer program is stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium. The processor executes the computer program, so that the computer device executes the above video encoding method.

[0017] According to an aspect of an embodiment of the present application, a method for generating a video bitstream is provided. The video bitstream is obtained by encoding video data using the above video encoding method.

[0018] The technical solution provided by the embodiment of the present application may include the following beneficial effects.

[0019] Since the JND threshold can reflect the human visual characteristics (i.e., the inherent characteristics of the video), by using the JND threshold of the current block to select the compensation mode of the current block, the consideration of the human visual characteristics of the current block can be introduced, which is beneficial to improving the accuracy of the compensation mode selection, and can achieve the purpose of improving the human visual quality of the encoding output, and further beneficial to improving the encoding quality of the video frame. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] To more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the accompanying drawings required for the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.

[0021] Figure 1 is the basic flowchart of the video encoding and decoding process provided in a possible implementation manner of the present application;

[0022] Figure 2 is the schematic diagram of the computer system provided in a possible implementation manner of the present application;

[0023] Figure 3 is the flowchart of the video encoding method provided in a possible implementation manner of the present application;

[0024] Figure 4 is the flowchart of the video encoding method provided in another possible implementation manner of the present application;

[0025] Figure 5 is the schematic diagram of the video encoding method provided in a possible implementation manner of the present application;

[0026] Figure 6 is the block diagram of the video encoding device provided in a possible implementation manner of the present application;

[0027] Figure 7 is the block diagram of the video encoding device provided in another possible implementation manner of the present application;

[0028] Figure 8 is the simplified structural block diagram of the computer device provided in a possible implementation manner of the present application. Detailed implementation manners

[0029] To make the purpose, technical solutions, and advantages of the present application clearer, the following will further describe the embodiments of the present application in detail with reference to the accompanying drawings.

[0030] Before introducing and explaining the embodiments of the present application, first, a brief introduction to video encoding and decoding technology will be given in combination with Figure 1 Please refer to Figure 1 , which is the basic flowchart of the video encoding and decoding process provided in a possible implementation manner of the present application.

[0031] As Figure 1 shown, the input video 101 is subjected to prediction, transformation, quantization, entropy encoding, and loop filtering to obtain the bitstream 102. After the bitstream 102 completes channel transmission, it undergoes entropy decoding, inverse quantization, inverse transformation, prediction, and loop filtering to obtain the output video 103.

[0032] In some embodiments, the processing flow between the input video 101 and the bitstream 102 is a video encoding process. The processing flow between the bitstream 102 and the output video 103 is a video decoding process. The above video encoding process can be completed by a video encoder, and the above video decoding process can be completed by a video decoder.

[0033] For the video encoding process, first, a video stream (i.e., video data or a sequence of video frames, such as the above input video 101) is obtained from a source (such as a camera, a video file, etc.). This video stream may contain a series of frames (such as video frames), and each frame is an image. For example, the video stream can include multiple video frames that are continuous in the time dimension. Before video encoding, the video stream can be preprocessed, such as color space conversion. Before video encoding, the video stream can also be frame-divided. For example, the frames in the video stream can be divided according to the time sequence or spatial position. During the video encoding process, predictive coding is first performed on the video frames. For example, by using the redundancy information between frames and within frames, predictive coding is used to reduce the data redundancy, which usually includes two steps: motion estimation and motion compensation, to generate motion vectors and prediction residuals. Then, transform coding is performed on the prediction residuals. For example, using the discrete cosine transform, etc., the pixel values in the spatial domain are converted into coefficients in the frequency domain to obtain transformed data. Then, quantization is performed on the transformed data to further reduce the data precision and range, thereby removing redundant information to obtain quantized data. Then, entropy coding is performed on the quantized data. For example, using Huffman coding or arithmetic coding, etc., the quantized data is converted into a compact binary bitstream. Finally, loop filtering is performed on the binary bitstream to reduce the distortion caused by quantization, and an encoded stream (i.e., the bitstream 102) is obtained. The bitstream 102 can be used for the storage and transmission of the input video 101.

[0034] The video decoding process is the inverse process of the video encoding process, which is used to restore the bitstream 102 to the original video stream. First, the input bitstream 102 is obtained, such as from the storage or transmission source. Then, entropy decoding is performed on the bitstream 102 to restore the quantized data. Next, inverse quantization is performed on the quantized data to restore the transformed data. Then, inverse transform coding is performed on the transformed data, such as using inverse discrete cosine transform, etc., to convert the coefficients in the frequency domain back to the pixel values in the spatial domain. Finally, video frame reconstruction is performed, such as using the motion vectors and prediction residuals generated in predictive coding to reconstruct the video frame, which usually includes steps such as motion compensation and residual addition. Optionally, after the video decoding process is completed, post-processing can also be performed on the reconstructed video frame, such as color space conversion, etc., to restore the original video format and color. Loop filtering can also be performed on the reconstructed video frame to obtain the video stream (i.e., the output video 103). The decoded video stream can be used for display or subsequent processing.

[0035] The following specifically describes several processes involved in the video encoding process.

[0036] 1. Prediction

[0037] Prediction in the video encoding process refers to the process of using the encoded sample values to predict the current sample value according to a certain model or method, and then encoding the difference between the true value and the predicted value (i.e., the prediction residual). Prediction is one of the important encoding tools for eliminating video redundancy and can act on spatial and temporal redundancy. According to the different references used, prediction coding techniques are mainly divided into two categories: intra-frame prediction and inter-frame prediction.

[0038] Intra-frame prediction uses the encoded pixels within the current image as references to generate predicted values, mainly for removing redundancy in the video spatial domain (i.e., within a single frame). The process of intra-frame prediction usually includes the following steps: (1) Reference pixel acquisition: Obtain reference pixels from the encoded part of the current image, which are usually located above, to the left, or in the upper left of the current coding block. (2) Predicted value calculation: Calculate the predicted value of the current coding block according to the selected prediction mode and reference pixels. The prediction mode may include angular prediction mode, Planar prediction mode, etc., and different modes are suitable for different texture features. (3) Predicted value correction: Perform necessary correction on the predicted value to reduce the prediction error. This usually involves filtering the boundary pixels to smooth the prediction result.

[0039] Intra-frame prediction plays an important role in video encoding, especially when dealing with static or less-changing image regions, which can significantly improve the compression efficiency.

[0040] Inter-frame prediction uses the previously encoded images before the current encoded image as a reference for prediction, mainly to remove the redundancy in the temporal domain of the video (i.e., between frames). The process of inter-frame prediction usually includes the following steps: (1) Motion estimation: Analyze the motion information between adjacent frames to determine the best matching position of the current encoded block in the reference frame. (2) Motion compensation: According to the result of motion estimation, make necessary adjustments (such as displacement, scaling, etc.) to the matching block in the reference frame to generate the predicted value of the current encoded block. (3) Residual coding: Encode the residual between the predicted value and the actual value to retain the detailed information in the image.

[0041] Inter-frame prediction also plays an important role in video coding. Especially when dealing with dynamic or highly variable image regions, it can significantly reduce the amount of encoded data.

[0042] Prediction coding technology achieves efficient compression of video data by exploiting the correlations within an image and between frames. Intra-frame prediction and inter-frame prediction are the two major components of prediction coding technology, and they work together in the video coding process to improve the compression efficiency and image quality.

[0043] 2. Transformation and Quantization

[0044] The main purpose of transformation in video coding is to remove the correlations in the video signal, especially the spatial-domain correlations, making the signal more independent. Through transformation, the signal can be converted from one representation form to another more suitable for compression.

[0045] In video coding, common transformation methods include Discrete Cosine Transform (DCT), Discrete Wavelet Transformation (DWT), etc. Among them, DCT is a widely used transformation method in video coding standards such as H.265 / HEVC, H.266 / VVC, and AVS. DCT divides the image into small blocks (such as 8×8 or 16×16 pixel blocks) and performs transformation on each small block, converting the pixel values in the spatial domain into coefficients in the frequency domain. After transformation, the energy of the image is mainly concentrated in the low-frequency region, while the energy in the high-frequency region is relatively small. This energy distribution characteristic enables the subsequent quantization step to more effectively remove redundant information and achieve a higher compression ratio.

[0046] Quantization is the process of mapping the continuous values (or a large number of possible discrete values) of a signal to a finite number of discrete amplitudes. In video coding, quantization usually acts on the transformed coefficients and converts the coefficients into finite quantization indices. There are various quantization methods, but the common quantization process usually involves dividing the transformed coefficients by a quantization step size (QuantizationStep Size, QStep) and rounding to the nearest integer. The size of the quantization step determines the fineness of quantization: the smaller the step, the finer the quantization, the higher the image quality, but the larger the compressed bitstream; the larger the step, the coarser the quantization, the possible degradation of image quality, but the smaller the compressed bitstream.

[0047] Quantization is a lossy compression step in video coding, which removes redundant information by reducing the precision and range of data. Although quantization introduces certain distortion, a reasonable quantization strategy can achieve a higher compression ratio while ensuring acceptable image quality.

[0048] Accordingly, at the decoding end, in order to reconstruct the original image, the quantization index needs to be dequantized. Dequantization is the inverse process of quantization, which converts the quantization parameter (Quantization Parameter, QP) back to a value close to the original transformed coefficient.

[0049] Among them, QP (Quantization Parameter) is an important factor determining the quantization effect and can be used to control the quantization degree in the video compression process. For example, QP and the quantization step size (Quantization Step Size, QStep) are approximately in an exponential relationship. The smaller the QP, the smaller the quantization step and the smaller the distortion; the larger the QP, the larger the quantization step and the more obvious the distortion. In video coding compression, quantization is the fundamental cause of distortion.

[0050] 3. Entropy Coding

[0051] Entropy coding and entropy decoding in the video coding process are two closely related steps, which jointly act on the compression and decompression processes of video data.

[0052] Entropy coding refers to a lossless coding method carried out according to the principle of information entropy, which is located at the end of the video compression system. In information theory, entropy is a measure representing the average amount of information of a source and also a measure of uncertainty. Entropy coding uses the probability differences of different symbols to allocate different codeword lengths, thereby achieving data compression.

[0053] In video coding, entropy coding is usually used to encode elements such as quantized transform coefficients, motion vector information, and prediction mode information. After these element symbols are entropy-coded, they are converted into a binary bitstream for transmission or storage. Common entropy coding methods include Shannon coding, Huffman coding, arithmetic coding, and run-length coding, etc.

[0054] Entropy decoding is the inverse process of entropy coding. It is responsible for decoding the received binary bitstream back into the original video element symbols. During the decoding process, the entropy decoder will parse and reconstruct the received bitstream according to the coding method and probability distribution information used during entropy coding, so as to recover the original video data.

[0055] Since entropy coding is lossless, the video data recovered after entropy decoding is of the same quality as the original video data. The design and implementation of the entropy decoder usually correspond to those of the entropy encoder to ensure that they can cooperate correctly with each other.

[0056] 4. Loop Filtering

[0057] For the already-encoded video frames, through operations such as inverse quantization, inverse transformation, and prediction compensation, a reconstructed video frame can be obtained. Compared with the original video frame, due to the influence of quantization, some information is different from the original video frame, resulting in distortion. Filtering operations on the binary bitstream or the reconstructed video frame, such as deblocking filter, SAO (Sample Adaptive Offset), and ALF (Adaptive Lattice Filter) and other filtering operations, can effectively reduce the degree of distortion caused by quantization. Since these filtered binary bitstreams or reconstructed video frames will be used as references for subsequent video frames to predict future signals, the above-mentioned filtering operations are also called loop filtering, that is, filtering operations within the coding loop.

[0058] The technical solution provided in the embodiments of this application relates to the above video coding process. For specific explanations, please refer to the following embodiments.

[0059] Please refer to Figure 2 , which shows a schematic diagram of a computer system provided in a possible implementation manner of this application. This computer system can be implemented as a video coding and decoding system. This computer system can include: a first computer device 201 and a second computer device 202.

[0060] In some embodiments, the first computer device 201 is used to perform the above-mentioned video encoding process, and the first computer device 201 is also referred to as a video encoding device. The second computer device 202 is used to perform the above-mentioned video decoding process, and the second computer device 202 is also referred to as a video decoding device. The first computer device 201 and the second computer device 202 can communicate with each other via a network. The network can be a wired network or a wireless network.

[0061] Exemplarily, a client of a first type of application is installed and run on the first computer device 201. The first type of application has a video encoding function to provide video encoding services. For example, the first type of application may include at least one of the following: a video encoding application, a video generation application, a video storage application, a video transmission application, a live broadcast application. Optionally, the above video encoder can be implemented as a video encoding device or a client of the first type of application. A client of a second type of application is installed and run on the second computer device 202. The second type of application has a video decoding function to provide video decoding services. For example, the second type of application may include at least one of the following: a video decoding application, a video playback application, a social entertainment application, a live broadcast application. Optionally, the above video decoder can be implemented as a video decoding device or a client of the second type of application.

[0062] In a feasible example, clients of the same target application are installed and run on the first computer device 201 and the second computer device 202, and the target application has both a video encoding function and a video decoding function. In a feasible example, the first computer device 201 can be used to perform both the above-mentioned video encoding process and the above-mentioned video decoding process, and the second computer device 202 can be used to perform both the above-mentioned video encoding process and the above-mentioned video decoding process. The embodiments of the present application do not limit this.

[0063] Optionally, in addition to video encoding, the above first computer device 201 can also be used for video capture. In addition to video decoding, the above second computer device 202 can also be used for video display. Exemplarily, the first computer device 201 can encode a video captured by the first computer device 201 and transmit the encoded video data (i.e., the bitstream or the encoded stream or the video bitstream) obtained by encoding to the second computer device 202 via the network. The second computer device 202 can receive the encoded video data from the network, decode the encoded video data to obtain the restored video, and display the restored video.

[0064] Optionally, in addition to encoding the captured video to become a video encoding device, the first computer device 201 can also decode other encoded video data obtained to obtain the restored video. At this time, the first computer device 201 can also be implemented as a video decoding device. Exemplarily, the first computer device 201 includes a video encoder for implementing video encoding. The first computer device 201 also includes a video decoder for implementing video decoding.

[0065] Optionally, in addition to decoding the obtained encoded video data to obtain the restored video to be implemented as a video decoding device, the second computer device 202 can also encode other captured videos. At this time, the second computer device 202 can also be implemented as a video encoding device. Exemplarily, the second computer device 202 includes a video decoder for implementing video decoding. The second computer device 202 also includes a video encoder for implementing video encoding.

[0066] The above-mentioned first computer device 201 includes, but is not limited to, computer devices such as mobile phones, tablets, intelligent voice interaction devices, PCs (Personal Computers), vehicle-mounted terminals, intelligent household appliances, and servers. The above-mentioned second computer device 202 includes, but is not limited to, computer devices such as mobile phones, tablets, intelligent voice interaction devices, PCs, vehicle-mounted terminals, intelligent household appliances, and servers.

[0067] In the technical solution provided by the embodiments of the present application, the execution subject of each step can be a computer device. A computer device can be any electronic device with the ability to store and process data. For example, the computer device can be Figure 2 the first computer device 201 in, such as the client of the first type of application program installed and running in the first computer device 201. The technical solution provided by the embodiments of the present application is applicable to any scenario that requires video encoding.

[0068] In some embodiments, during the video encoding process, the video stream is divided into several small GOPs (Groups of Pictures). A GOP is the basic unit in video encoding, and each GOP can include a set of consecutive video frames.

[0069] Optionally, based on the encoding method of the video frame, the video frame can be divided into at least one of the following types:

[0070] I-frame (Intra-coded Frame): It is an intra-coded frame, also known as a key frame, which contains the complete information of a video frame. An I-frame can be the starting point of each GOP (Group of Pictures) and serves as a benchmark for random access and encoding / decoding.

[0071] P-frame (Predicted Frame): It is a forward-predicted coded frame that depends on the previous I-frame or P-frame. The P-frame records the amount of change relative to the previous frame.

[0072] B-frame (Bidirectional Frame): It is a bidirectionally predicted coded frame that depends on the previous I-frame or P-frame and the subsequent I-frame or P-frame. The B-frame records the differences relative to the previous and subsequent frames.

[0073] Each GOP usually consists of one or more I-frames (Intra-coded Frames) and some predicted frames (P-frames and B-frames). According to the types of the individual video frames included in the GOP, the structural types of the GOP can be divided into at least one of the following: P structure, BP structure, BBBP structure, BBBBBBBB structure.

[0074] Exemplarily, for the P structure, the GOP can include one I-frame and at least one P-frame; for the BP structure, the GOP can include one I-frame and at least one group of frames composed of B-frames and P-frames; for the BBBP structure, the GOP can include one I-frame and at least one group of frames composed of three B-frames and one P-frame.

[0075] For any video frame in the GOP, the video encoder can divide the video frame into multiple non-overlapping M×M pixel blocks, where M can be determined according to the block partitioning mechanism of the video encoder, such as 128, 64, 32, 16, 8. Among them, the pixel block can also be referred to as a tile, color block, or image block.

[0076] For any one of the multiple pixel blocks, the video encoder can first assign a QP to the pixel block. Then, the motion vector (MV) between the pixel block and its reference block in the reference frame is calculated. The motion vector represents the displacement from the reference block to the current block. After the video encoder finds the best reference block through the motion vector, it obtains the pixel values from the reference block to get the predicted value of the pixel block. The video encoder then compares the predicted value of the pixel block with the original value of the pixel block to obtain the prediction residual of the pixel block: Resi(x, y) = Org(x, y) - Pred(x, y), where Resi(x, y) is the prediction residual, Org(x, y) is the original value, and Pred(x, y) is the predicted value.

[0077] The video encoder performs transform coding on the prediction residuals to obtain the transform data of the pixel block. Then, the transform data is quantized according to the QP of the pixel block to obtain the quantized data. Next, entropy coding is performed on the quantized data to convert the quantized data into a compact binary bitstream. Finally, the video encoder performs loop filtering on the binary bitstream to obtain the encoded stream of the pixel block. Until all pixel blocks are encoded, the encoded stream of the video frame is obtained. Until all video frames are encoded, the encoded stream of the video stream is obtained.

[0078] During the video encoding process, multiple encoding methods (such as intra-frame prediction, inter-frame prediction, etc.) need to make decisions to determine the optimal encoding method. Optionally, the decision can be made by comparing the RD cost (Rate Distortion Cost). The encoding method with a smaller RD cost has better encoding performance. Exemplarily, the calculation method of the RD cost of the encoding method is as follows:

[0079] Rd cost = D + lambda * R;

[0080] Where D is the distortion in the encoding mode. For example, for a video frame, the distortion of the video frame in the encoding mode can be determined according to the difference between the reconstructed video frame of the video frame in the encoding mode and the video frame. For a pixel block, the distortion of the pixel block in the encoding mode can be determined according to the difference between the reconstructed pixel block of the pixel block in the encoding mode and the pixel block.

[0081] R is the number of bits required for the encoding mode, such as the number of bits required for the video frame in the encoding mode and the number of bits required for the pixel block in the encoding mode. Lambda is the Lagrange factor, which plays a key role in the calculation process of the RD cost. For example, it determines the balance between D and R.

[0082] During the loop filtering process, the related technology uses the RD cost to select the loop filtering method. Especially for the SAO technology, for example, the related technology selects the optimal compensation method from the EO method, BO method, and Merge method according to the RD cost of each compensation method to perform loop filtering on the binary bitstream to obtain the encoded stream of the pixel block. However, simply relying on the RD cost to select the compensation method is not accurate enough, which is not conducive to improving the selection accuracy of the compensation method.

[0083] In the embodiments of the present application, considering that lambda determines the balance between D and R, that is, by adjusting lambda, it can be determined whether to perform loop filtering with the goal of reducing distortion or with the goal of reducing the number of coding bits. Therefore, the embodiments of the present application introduce the JND threshold that can reflect the human visual characteristics (i.e., the characteristics of the video itself) to adjust lambda, so as to improve the calculation accuracy of the RD cost of each compensation method, thereby improving the selection accuracy of the compensation method, and achieving the purpose of improving the human visual quality of the coding output, and further facilitating the improvement of the coding quality of video frames.

[0084] The following will use method embodiments to elaborate in detail on the technical solutions provided by the embodiments of the present application. For the content not described in the method embodiments, reference can be made to the above embodiments, and details will not be repeated here.

[0085] Please refer to Figure 3 , which shows the flowchart of the video coding method provided in a possible implementation manner of the present application. The execution subject of each step of this method can be Figure 2 the first computer device 201 shown, such as the client installed and running in the first computer device 201 (hereinafter referred to as the video encoder). This method may include at least one of the following steps (301 to 303).

[0086] Step 301, obtain the JND threshold of the current block of the first video frame.

[0087] The above-mentioned first video frame may refer to any video frame in the video, which can be used to represent the video frame currently being encoded in the video, that is, the current frame. A video frame is the basic unit representing the picture at a specific moment in the video. A video can be composed of a series of consecutive static images (frames), which are played at a certain rate to create a visual effect of continuous movement for the user. The above-mentioned video can also be referred to as a video stream or video data.

[0088] For example, when encoding an input video, it is necessary to encode the input video frame by frame. After all the video frames of an input video are encoded, it can be considered that the input video has been encoded. Among them, the first video frame can be the video frame currently being encoded, or the video frame that has not started encoding but is about to start encoding. In the embodiments of the present application, the encoding principles of each video frame are the same. For the convenience of description, the embodiments of the present application take the encoding process of a certain video frame as an example for description, but this does not limit the technical solutions provided by the embodiments of the present application.

[0089] The embodiments of the present application do not limit the source of this video. Exemplarily, the above video may be at least one of the following: a video recorded by a recording device (such as a movie or a TV drama), a video generated by a computer device (such as an animation or a CG (Computer Graphics)), a video generated in a chat session (such as a voice video), a video generated in a video conference, or a video generated in online education.

[0090] The above current block may refer to the pixel block currently being encoded in the first video frame, and it may be any pixel block in the first video frame. Optionally, the pixel block may also be referred to as a tile, an image block, or a pigment block.

[0091] The JND threshold of the above current block is the minimum threshold that the human eye can perceive for the current block. In the fields of images and videos, the JND (Just Noticeable Distortion) model is effectively utilized to reduce visual redundancy. The JND threshold is the minimum threshold that the human eye can perceive, and the human eye can hardly detect information below this threshold. The JND model based on human perception is widely applied in image processing, such as objective quality evaluation, image super-resolution, image segmentation, etc.

[0092] In one example, the JND threshold of the current block can be determined according to the average value of the JND thresholds respectively corresponding to each pixel point in the current block. In this way, the global human eye visual characteristics of the current block can be considered, which is beneficial to improving the accuracy of obtaining the JND threshold.

[0093] Exemplarily, the process of obtaining the JND threshold of the current block may include the following content:

[0094] 1. Obtain the JND thresholds respectively corresponding to each pixel point in the current block.

[0095] The JND threshold of a pixel point is the minimum threshold that the human eye can perceive for the pixel point. Optionally, the JND model can be used to process the video frame to obtain the JND thresholds respectively corresponding to each pixel point in the video frame.

[0096] Exemplarily, the JND model includes a trained background luminance adaptive model and a texture feature model, and the JND thresholds respectively corresponding to each pixel point in the current block can be calculated through the trained background luminance adaptive model and the texture feature model. Among them, the background luminance adaptive model and the texture feature model are trained neural network models.

[0097] 2. Perform a mean calculation on the JND thresholds respectively corresponding to each pixel point to obtain the average JND threshold of the current block.

[0098] The average JND threshold of the current block may refer to the average of the JND thresholds corresponding to each pixel point respectively.

[0099] Optionally, first sum the JND thresholds corresponding to each pixel point respectively to obtain a first sum value, and then divide the first sum value by the number of pixel points in the current block to obtain the average JND threshold of the current block.

[0100] 3. When the average JND threshold of the current block is greater than the first set threshold, determine the first set threshold as the JND threshold of the current block.

[0101] Among them, the first set threshold can be set and adjusted according to actual usage requirements, and the embodiments of the present application do not limit this.

[0102] Optionally, the first set threshold may be related to the value range of the JND threshold, and the value of the JND threshold is a positive number. The first set threshold can be determined according to the upper limit of the value range of the JND threshold. Exemplarily, the first set threshold may be 31.

[0103] For example, if the average JND threshold jnd of the current block avg > 31, then determine 31 as the JND threshold of the current block.

[0104] 4. When the average JND threshold of the current block is less than or equal to the first set threshold, determine the average JND threshold of the current block as the JND threshold of the current block.

[0105] For example, if the average JND threshold jnd of the current block avg ≤ 31, then determine the average JND threshold jnd of the current block avg as the JND threshold of the current block.

[0106] Step 302, when the loop filtering mode of the current block includes the SAO mode, select the compensation mode of the current block from at least two compensation modes included in the SAO mode according to the JND threshold of the current block.

[0107] Optionally, when the loop filtering mode of the current block includes the BDF mode and the SAO mode, the BDF mode can be first used to perform loop filtering on the binary bitstream of the current block to eliminate the block effect, and then the SAO mode can be used to perform loop filtering on the binary bitstream of the current block to eliminate the ringing effect. When the loop filtering mode of the current block only includes the SAO mode, only the SAO mode needs to be used to perform loop filtering on the binary bitstream of the current block to eliminate the ringing effect.

[0108] Among them, the BDF mode can be implemented according to the standard of the BDF mode, while the SAO mode is implemented according to the technical solution provided by the embodiments of the present application.

[0109] The above at least two compensation methods may include at least two of the following: EO (Edge Offset) method, BO (Band Offset) method, and Merge (parameter fusion) method. For example, the above at least two compensation methods may simultaneously include: EO method, BO method, and Merge method.

[0110] In one example, based on the JND threshold of the current block, the RD cost of the current block under each compensation method may be determined, and then the compensation method of the current block may be selected from at least two compensation methods according to the RD cost.

[0111] Exemplarily, as Figure 4 shown, step 302 may further include the following sub-steps:

[0112] Step S1, obtain the encoding information of the second video frame, where the second video frame is a video frame encoded before the first video frame and adjacent to the first video frame.

[0113] Optionally, for a GOP with a BP structure, when the B frame is the first video frame, the first P frame on the right side of the B frame may be the second video frame. When the P frame is the first video frame, the first P frame on the left side of the P frame may be the second video frame. The embodiments of the present application do not limit this.

[0114] The encoding information of the second video frame may refer to the information generated during the encoding process of the second video frame. In the embodiments of the present application, the encoding information of the second video frame may include at least one of the following: the encoding mode respectively adopted by each tile (i.e., pixel block) in the second video frame, the number of tiles in the second video frame.

[0115] During the encoding process of the second video frame, the video encoder may divide the second video frame into multiple non-overlapping tiles for encoding. For example, the video encoder may divide the second video frame into multiple non-overlapping 32×32 tiles for encoding. Optionally, for different tiles, the video encoder may adopt different encoding modes. For example, the encoding mode may include at least one of the following: Skip mode, Inter mode, Merge mode, Direct mode.

[0116] Step S2, determine the adjustment threshold of the current block according to the encoding information of the second video frame, where the adjustment threshold of the current block is used to divide the JND threshold of the current block.

[0117] In one example, the encoding information of the second video frame includes the adjustment threshold of the first video frame, and the adjustment threshold of the first video frame may be used as the adjustment threshold of each tile in the first video frame, that is, the adjustment threshold of the first video frame is the adjustment threshold of the current block.

[0118] In one example, the encoding information of the second video frame does not include the adjustment threshold of the first video frame, but the video encoder can determine the adjustment threshold of the first video frame according to the encoding information of the second video frame. For example, the encoding information of the second video frame includes the block distribution information of the second video frame, and the block distribution information of the second video frame is used to indicate the number of tiles under different set JND thresholds corresponding to the second video frame. The video encoder can determine the adjustment threshold of the first video frame according to the block distribution information of the second video frame. Among them, the process of determining the adjustment threshold of the video frame will be described in detail below and will not be elaborated here. The set JND threshold is the set JND threshold, which can be set and adjusted according to actual usage requirements, and the embodiments of the present application do not limit this.

[0119] In one example, the adjustment threshold includes a first adjustment parameter and a second adjustment parameter, and the first adjustment parameter is less than the second adjustment parameter. The first adjustment parameter and the second adjustment parameter can divide the JND threshold into three types, that is, the pixel blocks can be divided into three types. For example, the pixel blocks with a JND threshold less than the first adjustment parameter are of the first type, the pixel blocks with a JND threshold greater than or equal to the first adjustment parameter and less than or equal to the second adjustment parameter are of the second type, and the pixel blocks with a JND threshold greater than the second adjustment parameter are of the third type.

[0120] In the embodiments of the present application, when the current block is of the first type, since the JND threshold decreases, it can be determined that the current block needs to focus on reducing distortion rather than reducing the encoding bits; when the current block is of the second type, since the JND threshold is moderate, the current block can be kept unchanged; when the current block is of the third type, since the JND threshold is large, it can be determined that the current block needs to focus on reducing the encoding bits rather than reducing distortion.

[0121] Step S3, select the compensation method for the current block from at least two compensation methods according to the JND threshold of the current block and the adjustment threshold of the current block.

[0122] Optionally, according to the JND threshold of the current block and the adjustment threshold of the current block, determine the RD cost of the current block under each compensation method, and then select the compensation method for the current block from at least two compensation methods. This process may include the following contents:

[0123] 1. Determine the adjustment amplitude of the current block according to the JND threshold of the current block and the adjustment threshold of the current block.

[0124] In the embodiments of the present application, the adjustment amplitude of the current block corresponds to the type of the current block (i.e., the above three types), that is, the adjustment amplitude of the current block can be used to determine the adjustment amplitude of the distortion (or encoding bits) of the current block.

[0125] In one example, corresponding to the above three types, the process of determining the adjustment amplitude of the current block may include the following:

[0126] 1. When the JND threshold of the current block is less than the first adjustment parameter, determine the adjustment amplitude of the current block as the first value.

[0127] The first value can be set and adjusted according to actual usage requirements, and the embodiments of the present application do not limit this. Optionally, the first value is a positive number less than 1, which is used to increase the distortion of the current block and reduce the coding bit number of the current block. Exemplarily, the first value is 0.75.

[0128] 2. When the JND threshold of the current block is greater than the second adjustment parameter, determine the adjustment amplitude of the current block as the second value.

[0129] The second value can be set and adjusted according to actual usage requirements, and the embodiments of the present application do not limit this. Optionally, the first value is a positive number greater than 1, which is used to reduce the distortion of the current block and increase the coding bit number of the current block. Exemplarily, the first value is 1.25.

[0130] 3. When the JND threshold of the current block is greater than or equal to the first adjustment parameter and less than or equal to the second adjustment parameter, determine the adjustment amplitude of the current block as the third value.

[0131] Optionally, the above third value is greater than the first value and less than the second value.

[0132] The third value can be set and adjusted according to actual usage requirements, and the embodiments of the present application do not limit this. Optionally, the third value can be used to maintain the distortion and coding bit number of the current block. Exemplarily, the first value is 1.

[0133] For example, the process of determining the adjustment amplitude of the current block can be expressed as follows:

[0134]

[0135] Among them, scale is the adjustment amplitude, and jnd is the JND threshold of the current block.

[0136] The embodiments of the present application determine the adjustment amplitude of the current block according to the JND threshold of the current block, and introduce the consideration of the human eye visual characteristics of the current block, which is beneficial to improving the determination accuracy of the adjustment amplitude of the current block and the determination accuracy of the balance parameter of the current block.

[0137] 2. Adjust the balance parameter of the current block according to the adjustment amplitude of the current block to obtain the adjusted balance parameter. The balance parameter of the current block is used to indicate the influence of the distortion of the current block on the RD cost of the current block.

[0138] Optionally, the balance parameter of the current block can be due to controlling the influence of the distortion of the current block and the number of coding bits of the current block on the RD cost of the current block respectively. Exemplarily, the balance parameter of the current block can be used as a weight parameter for the number of coding bits of the current block, and by adjusting the balance parameter of the current block through an adjustment amplitude that can reflect the JND threshold (i.e., the human eye characteristic) of the current block, the distortion and the number of coding bits of the current block can be accurately adjusted.

[0139] Optionally, the balance parameter of the current block can be implemented as the lambda (Lagrange factor) of the current block. The lambda of the current block can be obtained according to the QP setting of the current block. The embodiments of the present application do not limit the method for obtaining the lambda of the previous block.

[0140] In one example, a multiplication operation can be performed on the balance parameter of the current block and the adjustment amplitude of the current block to obtain an adjusted balance parameter.

[0141] For example, taking the balance parameter as lambda, the adjusted balance parameter can be expressed as:

[0142] lambda = lambda * scale;

[0143] Wherein, the lambda on the right side of the equal sign is the lambda of the current block.

[0144] 3. According to the adjusted balance parameter, select the compensation method of the current block from at least two compensation methods included in the SAO mode.

[0145] Optionally, taking at least two compensation methods including the RO mode, the BO mode, and the Merge mode as an example, the RD cost of the current block in the RO mode, the BO mode, and the Merge mode can be determined first, and then the compensation method of the current block can be selected according to the RD cost.

[0146] Exemplarily, the selection process of the compensation method of the current block can include the following content:

[0147] (1) According to the adjusted balance parameter of the current block, calculate the RD cost of the current block in the RO mode, the BO mode, and the Merge mode respectively.

[0148] Optionally, for the RO mode, the RD cost of the current block in the RO mode can be calculated according to the distortion and the number of coding bits of the current block in the RO mode, and the adjusted balance parameter of the current block.

[0149] For the BO mode, the RD cost of the current block in the BO mode can be calculated according to the distortion and the number of coding bits of the current block in the BO mode, and the adjusted balance parameter of the current block.

[0150] Taking the balance parameter lambda as an example, the calculation process of the RD cost can be expressed as follows:

[0151] Rd cost = D + lambda * R;

[0152] Where lambda is the adjusted lambda of the current block.

[0153] Optionally, the RD cost of the current block in the Merge mode includes the optimal RD cost of the upper block of the current block and the optimal RD cost of the left block of the current block.

[0154] The upper block of the current block may refer to the pixel block directly above the current block and adjacent to the current block in the first video frame. The left block of the current block may refer to the pixel block directly to the left of the current block and adjacent to the current block in the first video frame. The optimal RD cost of the upper block may refer to the minimum RD cost among the RD costs obtained by applying the SAO parameters of the upper block in the RO mode to the current block and the RD costs obtained by applying the SAO parameters of the upper block in the BO mode to the current block. The optimal RD cost of the left block may refer to the minimum RD cost among the RD costs obtained by applying the SAO parameters of the left block in the RO mode to the current block and the RD costs obtained by applying the SAO parameters of the left block in the BO mode to the current block.

[0155] (2) Select the compensation mode of the current block from at least two compensation modes included in the SAO mode according to the RD costs of the current block in the RO mode, BO mode, and Merge mode respectively.

[0156] Optionally, determine the minimum RD cost among the RD costs of the current block in the RO mode and the BO mode as the initial optimal RD cost of the current block. Then, determine the minimum RD cost among the initial optimal RD cost of the current block, the optimal RD cost of the left block, and the optimal RD cost of the upper block as the optimal RD cost of the current block. Finally, determine the compensation mode corresponding to the optimal RD cost of the current block as the compensation mode of the current block.

[0157] Optionally, when the compensation mode of the current block is the RO mode, the SAO parameters corresponding to the current block in the RO mode can be used to compensate the binary bitstream of the current block (i.e., loop filtering); when the compensation mode of the current block is the BO mode, the SAO parameters corresponding to the current block in the BO mode can be used to compensate the binary bitstream of the current block; when the compensation mode of the current block is the Merge mode, if the optimal RD cost of the current block is the optimal RD cost of the left block, the SAO parameters corresponding to the left block in the RO mode can be used to compensate the binary bitstream of the current block, and if the optimal RD cost of the current block is the optimal RD cost of the upper block, the SAO parameters corresponding to the upper block in the RO mode can be used to compensate the binary bitstream of the current block.

[0158] In the embodiment of the present application, according to the RD cost of the current block determined by the JND threshold, since the human eye visual characteristics of the current block are considered, it is beneficial to improve the accuracy of the selection of the compensation mode, thereby improving the encoding quality of the video frame.

[0159] In addition, the present application uses the JND threshold of the current block and the adjustment threshold determined by the encoding information of the previous frame to select the compensation mode of the current block, so that the present application does not need to wait for the encoding information of the current frame, that is, no additional encoding delay needs to be introduced, which is beneficial to maintaining the encoding efficiency of the video frame.

[0160] Step 303, encode the current block according to the compensation mode of the current block.

[0161] Optionally, during the encoding process of the current block, the video encoder performs transform coding on the prediction residual of the current block to obtain the transform data of the current block, then quantizes the transform data of the current block according to the QP of the current block to obtain the quantized data of the current block, and then performs entropy coding on the quantized data of the current block to convert the quantized data into a compact binary bitstream. Finally, when the loop filtering mode of the current block includes the SAO mode, the binary bitstream is compensated (i.e., loop filtering) according to the compensation mode of the current block to obtain the encoded stream (i.e., encoded data) of the current block.

[0162] Among them, the QP of the current block can be preset or dynamically adjusted according to requirements, and the embodiment of the present application does not limit this.

[0163] The present application does not limit the encoding mode of the first video frame either. For example, the intra prediction mode or the inter prediction mode can be used to perform predictive encoding on the first video frame. For example, for an I frame, the intra prediction mode can be used to determine the prediction residual of the current block, and for a B frame and a P frame, the inter prediction mode or the inter prediction mode can be used to determine the prediction residual of the current block.

[0164] Optionally, for the current block, the video decoder normally decodes the encoded stream of the current block to obtain the reconstructed block of the current block, that is, the technical solution provided by the embodiments of the present application has no impact on the video decoding side.

[0165] It should be noted that the encoding processes of each pixel block are the same. For the convenience of description, the embodiments of the present application take the encoding process of a certain pixel block as an example for illustration, but this does not limit the technical solution provided by the embodiments of the present application.

[0166] In summary, for the technical solution provided by the embodiments of the present application, since the JND threshold can reflect the human visual characteristics (i.e., the inherent characteristics of the video), by using the JND threshold of the current block to select the compensation method for the current block, the consideration of the human visual characteristics of the current block can be introduced, which is beneficial to improving the accuracy of the selection of the compensation method and achieving the purpose of enhancing the human visual quality of the encoded output, and further beneficial to improving the encoding quality of the video frame.

[0167] In addition, the embodiments of the present application do not need to modify the original encoding process. Only the balance parameters (such as lambda) inside the loop filter need to be modified, and the modification of the balance parameters only involves simple addition, subtraction, and shifting, making the technical solution provided by the embodiments of the present application simple and easy to implement in hardware.

[0168] In addition, the embodiments of the present application can generally improve the subjective and objective quality (i.e., the human visual quality) of the encoded output. The technical solution provided by the embodiments of the present application is simple without introducing complex operations, has a small computational amount, and does not cause encoding delay, which is convenient for the hardware implementation of the video encoder.

[0169] In addition, since the embodiments of the present application do not modify the video coding standard, when used in any video encoder, it can ensure that the video decoder can correctly decode the bitstream to obtain the reconstructed video.

[0170] In some embodiments, after the encoding of the first video frame is completed, the adjustment threshold of the third video frame can be determined according to the encoding information of the first video frame. Then, the embodiments of the present application can further include the following content:

[0171] 1. After the encoding of the first video frame is completed, obtain the encoding information of the first video frame.

[0172] The encoding information of the first video frame may refer to the information generated during the encoding process of the first video frame. Exemplarily, the encoding information of the first video frame may include at least one of the following: the encoding mode adopted by each tile (i.e., pixel block) in the first video frame, the number of tiles in the first video frame, and the JND threshold of each tile in the first video frame.

[0173] 2. Determine the block distribution information of the first video frame according to the encoding information of the first video frame, where the block distribution information is used to indicate the number of tiles under different set JND thresholds in the first video frame.

[0174] Among them, the set JND threshold refers to the set JND threshold, which can be set and adjusted according to actual usage requirements, and the embodiments of the present application do not limit this. Optionally, the value range of the set JND threshold is related to the upper limit of the value of the JND threshold, and different set JND thresholds can be determined according to the upper limit of the value of the JND threshold.

[0175] The embodiments of the present application also do not limit the number of set JND thresholds. Exemplarily, the block distribution information corresponds to n different set JND thresholds, where n is an integer greater than 1. Optionally, the n set JND thresholds are arranged in ascending order. For example, taking n as 32, the n set JND thresholds can be 0 - 31 in sequence.

[0176] Optionally, the block distribution information of the first video frame includes the number of second tiles corresponding to each of the n set JND thresholds, and the number of second tiles of the set JND threshold is the number of tiles in the first video frame whose JND threshold is less than or equal to the set JND threshold.

[0177] For example, when the set JND threshold = i, the number of second tiles is the number of tiles in the first video frame whose JND threshold is less than or equal to i. Among them, the value range of i is 0 - 31.

[0178] In one example, the block distribution information of the first video frame can be determined according to the JND thresholds of each tile in the encoding information of the first video frame, and the embodiments of the present application may further include the following content:

[0179] (1) For any tile in the first video frame, perform a rounding operation on the JND threshold of the tile to obtain the rounded JND threshold.

[0180] Optionally, the JND threshold of the tile can be rounded to obtain the rounded JND threshold of the tile.

[0181] For example, the rounded JND threshold can be expressed as round(JND), where round( ) is a rounding function.

[0182] (2) Determine the set JND threshold greater than or equal to the rounded JND threshold among the n set JND thresholds as the third set JND threshold.

[0183] Optionally, the process of determining the block distribution information of the first video frame can be a loop process embedded in the encoding process of the first video frame, that is, every time a tile is encoded, the block distribution information of the first video frame is updated until all tiles are encoded to obtain the block distribution information of the first video frame.

[0184] Among them, the initial value of the number of the second tiles for each set JND threshold is 0.

[0185] By sequentially traversing each tile in the first video frame, the statistics of the number of the second tiles for each set JND threshold can be completed.

[0186] Exemplarily, the block distribution information of the first video frame can be implemented as an array, where the index of the array is the set JND threshold and the value of the array is the number of the second tiles.

[0187] For example, the block distribution information of the first video frame can be expressed as follows: LUT jnd [i]; where i is the set JND threshold, and the range is 0 - 31, and LUT jnd [i] is the number of the second tiles corresponding to the set JND threshold i.

[0188] For a certain tile, if the rounded JND threshold of the tile is round(JND), then the index in the array that is greater than or equal to round(JND) can be determined as the third set JND threshold.

[0189] (3) Increment the number of the second tiles of the third set JND threshold by 1.

[0190] Optionally, incrementing by 1 the elements in the array whose index is greater than or equal to round(JND) (i.e., the number of the second tiles of the third set JND threshold), this process can be expressed as follows:

[0191] LUT jnd [round(JND)+1] = LUT jnd [round(JND)+1] + 1;

[0192] LUT jnd [round(JND)+1] = LUT jnd [round(JND)+1] + 1;

[0193] LUT jnd [round(JND)+2] = LUT jnd [round(JND)+2] + 1;

[0194] ……

[0195] LT jnd

[31] = LUTjnd

[31] +1.

[0196] Optionally, after all the tiles in the first video frame are encoded, the block distribution information of the first video frame may also be determined according to the JND thresholds of each tile. The embodiments of the present application do not limit this.

[0197] According to the set JND threshold, the embodiments of the present application can accurately obtain the block distribution information of the first video frame, and the determination process of the block distribution information of the first video frame only involves simple addition, subtraction, and shifting, making the technical solution provided by the embodiments of the present application simple and easy to be implemented by hardware.

[0198] 3. Determine the adjustment threshold of the third video frame according to the block distribution information of the first video frame. The third video frame is a video frame that is encoded after the first video frame and adjacent to the first video frame. The adjustment threshold of the third video frame is used to divide the JND thresholds of each tile in the third video frame.

[0199] The third video frame may be the video frame that is encoded after the first video frame and is closest to the first video frame. The second video frame may be the video frame that is encoded before the first video frame and is closest to the first video frame.

[0200] Optionally, the adjustment threshold of the third video frame includes the first adjustment parameter and the second adjustment parameter of the third video frame. The first adjustment parameter and the second adjustment parameter of the third video frame may also be used as the first adjustment parameter and the second adjustment parameter of each tile in the third video frame to divide the tiles into three types according to the JND thresholds of the tiles.

[0201] In one example, the adjustment threshold of the third video frame may be determined according to the number of second tiles corresponding to each set JND threshold. Then, the determination process of the adjustment threshold of the third video frame may further include the following content:

[0202] (1) Determine the number of first tiles. The number of first tiles is the total number of tiles in the first video frame.

[0203] Optionally, the total number of tiles in the first video frame may be directly determined as the number of first tiles, denoted as num all .

[0204] (2) According to the block distribution information of the first video frame, determine the number of second tiles of each of the n set JND thresholds respectively. The number of second tiles of a set JND threshold is the number of tiles in the first video frame whose JND threshold is less than or equal to the set JND threshold.

[0205] Optionally, the block distribution information of the first video frame includes the number of second tiles corresponding to each of the n set JND thresholds, and the video encoder can directly extract the number of second tiles corresponding to each of the n set JND thresholds from the block distribution information of the first video frame.

[0206] (3) Determine a first screening threshold and a second screening threshold according to the number of first tiles.

[0207] Embodiments of the present application do not limit the first screening threshold and the second screening threshold, and they can be set and adjusted according to actual usage requirements.

[0208] Optionally, the first screening threshold is less than the second screening threshold. Exemplarily, one-third of the number of first tiles can be determined as the first screening threshold, denoted as num all / 3, and two-thirds of the number of first tiles can be determined as the second screening threshold, denoted as num all *2 / 3.

[0209] (4) Determine a first set JND threshold from the n set thresholds as the first adjustment parameter for the third video frame according to the number of second tiles corresponding to each of the n set JND thresholds and the first screening threshold.

[0210] Optionally, in the order of the set JND thresholds from small to large, compare the number of second tiles corresponding to each of the n set JND thresholds with the first screening threshold in turn, and determine the set JND threshold whose number of second tiles is first greater than or equal to the first screening threshold as the first set JND threshold, as the first adjustment parameter for the third video frame. In a feasible example, during the comparison process, the set JND threshold whose number of second tiles is first greater than or equal to the first screening threshold and less than the second screening threshold can be determined as the first set JND threshold.

[0211] For example, during the comparison process, if the number of second tiles LUT jnd [i] of the set JND threshold i is first greater than or equal to the first screening threshold num all / 3, then i can be determined as the first adjustment parameter for the third video frame.

[0212] (5) Determine a second set JND threshold from the n set thresholds as the second adjustment parameter for the third video frame according to the number of second tiles corresponding to each of the n set JND thresholds and the second screening threshold.

[0213] Optionally, in the order of the set JND thresholds from small to large, compare the number of second tiles corresponding to each of the n set JND thresholds with the second screening threshold in turn, and determine the set JND threshold whose number of second tiles is first greater than or equal to the second screening threshold as the second set JND threshold, as the second adjustment parameter for the third video frame.

[0214] Optionally, since the first screening threshold is less than the second screening threshold, after determining the first adjustment parameter, the second tile numbers of the n set JND thresholds may be compared with the second screening threshold in sequence.

[0215] For example, during the comparison process, if the second tile number LUT jnd [i] of the set JND threshold i is greater than or equal to the second screening threshold num all0 *2 / 3 for the first time, then i may be determined as the second adjustment parameter of the third video frame.

[0216] Exemplarily, the determination process of the adjustment threshold of the third video frame may be expressed as follows:

[0217]

[0218] where T0 is the first adjustment parameter and T1 is the second adjustment parameter.

[0219] In a feasible example, from the n set JND thresholds, determine the set JND thresholds whose second tile numbers are greater than or equal to the first screening threshold and less than the second screening threshold to obtain the first set of set JND thresholds; determine the set JND threshold with the smallest second tile number in the first set of set JND thresholds as the above-mentioned first set JND threshold.

[0220] From the n set JND thresholds, determine the set JND thresholds whose second tile numbers are greater than or equal to the second screening threshold to obtain the second set of set JND thresholds; determine the set JND threshold with the smallest second tile number in the second set of set JND thresholds as the above-mentioned second set JND threshold.

[0221] Optionally, if there are multiple first set JND thresholds, the smallest first set JND threshold may be determined as the first adjustment parameter; if there are multiple second set JND thresholds, the smallest second set JND threshold may be determined as the second adjustment parameter.

[0222] In a feasible example, from the n set JND thresholds, determine the set JND thresholds whose second tile numbers are greater than or equal to the first screening threshold and less than or equal to the second screening threshold to obtain the third set of set JND thresholds; determine the set JND threshold with the smallest second tile number in the third set of set JND thresholds as the above-mentioned first set JND threshold, and determine the set JND threshold with the largest second tile number in the third set of set JND thresholds as the above-mentioned second set JND threshold.

[0223] In a feasible example, from n sets of set JND thresholds, determine the set JND thresholds for which the number of second tiles is less than or equal to the first screening threshold, to obtain a fourth set of set JND thresholds; determine the set JND threshold with the largest number of second tiles in the fourth set of set JND thresholds as the above-mentioned first set JND threshold. From n sets of set JND thresholds, determine the set JND thresholds for which the number of second tiles is greater than or equal to the second screening threshold, to obtain a fifth set of set JND thresholds; determine the set JND threshold with the smallest number of second tiles in the fifth set of set JND thresholds as the above-mentioned second set JND threshold. The embodiments of the present application do not limit the method for determining the first set JND threshold and the second set JND threshold.

[0224] Optionally, after determining the first adjustment parameter and the second adjustment parameter of the third video frame, the first adjustment parameter and the second adjustment parameter of the third video frame can be updated into the coding information of the first video frame. Optionally, the block distribution information of the first video frame can also be updated to the coding information of the first video frame to prepare for the coding of the third video frame. The embodiments of the present application do not limit this.

[0225] The embodiments of the present application determine the adjustment parameters according to the number of second tiles of the set JDN threshold. Since the human eye visual characteristics of each tile are considered, the adjustment parameters can be accurately determined, which is beneficial to improving the accuracy of determining the adjustment parameters.

[0226] In summary, according to the coding information of the current frame, the embodiments of the present application can determine the adjustment parameters of the next coding frame, so that the next coding frame can obtain the adjustment parameters without waiting for the coding data of the next coding frame, that is, without introducing additional coding delay, which is beneficial to maintaining the coding efficiency of the video frame.

[0227] In some embodiments, as Figure 5 shown, it is a schematic diagram of a video coding method provided in a possible implementation manner of the present application. Taking the coding process of the t-th frame as an example, it includes the following steps (the execution entity is a video encoder).

[0228] Step 1, obtain frame-level coding information and initialize the LUT jnd 。

[0229] When coding the t-th frame, the t-th frame is the current frame.

[0230] The frame-level coding information of the current frame may include at least one of the following: coding mode (such as inter-frame prediction mode and intra-frame prediction mode), size of pixel blocks (such as 32×32), number of pixel blocks, QP of tiles, type of the current frame (such as I frame, B frame, and P frame), switching parameter of loop filtering (which can be used to determine whether to adopt BDF technology and SAO technology).

[0231] Array LUT jnd Initialize the LUT with the block distribution information of the first video frame jnd That is, set each element in the array LUT jnd to 0.

[0232] Optionally, the array LUT jnd includes 32 elements, and the indices of the 32 elements are 0 - 31 (i.e., the above-set JND thresholds), and each element represents the number of second tiles of a set JND threshold.

[0233] Step 2-1, Block-level JND threshold calculation, and update LUT jnd .

[0234] Optionally, obtain the JND threshold of each pixel block in the current frame. For each pixel block, determine the JND threshold of the pixel block based on the average value of the JND thresholds corresponding to each pixel point in the pixel block. Optionally, the JND thresholds of each pixel block can be calculated at once, or can be calculated embedded in the encoding process of each pixel block.

[0235] Optionally, for the current block in the current frame, add 1 to the elements in the array LUT jnd whose indices are greater than or equal to round(JND) of the current block to obtain the updated LUT jnd .

[0236] Step 2-2, Perform compression encoding on the current block.

[0237] Optionally, perform compression encoding on the current block according to the QP of the current block and the prediction residual of the current block. For example, according to the QP of the current block, quantize the transformed data obtained by transforming the prediction residual of the current block to obtain the quantized data of the current block, and then obtain the binary bitstream of the current block based on the quantized data of the current block.

[0238] Step 2-3, Adjust the lambda of the current block according to T0 and T1 obtained from the previous frame, and the JND threshold of the current block.

[0239] Optionally, if the JND threshold of the current block is less than T0 (i.e., the first adjustment parameter of the current frame), then set the scale of the current block to 0.75; if the JND threshold of the current block is greater than T1 (i.e., the second adjustment parameter of the current frame), then set the scale of the current block to 1.25; if the JND threshold of the current block is greater than or equal to T0 and less than or equal to T1, then set the scale of the current block to 1.

[0240] Multiply the scale of the current block by the lambda of the current block to obtain the adjusted lambda of the current block.

[0241] Step 2-4: Perform loop filtering on the current macroblock.

[0242] Optionally, when BDF technology needs to be used to perform loop filtering on the current macroblock, just execute it according to the BDF technology standard.

[0243] Optionally, when SAO technology needs to be used to perform loop filtering on the current macroblock, calculate the RD costs of the current macroblock in the RO mode, BO mode, and Merge mode respectively according to the adjusted lambda of the current macroblock, then select the optimal RD cost from the RO mode, BO mode, and Merge mode according to the RD cost, and then determine the compensation method (i.e., SAO parameter) of the current macroblock according to the optimal RD cost. Finally, perform loop filtering on the current macroblock according to the compensation method (i.e., SAO parameter) of the current macroblock to obtain the encoded bitstream of the current macroblock.

[0244] After all pixel macroblocks in the current frame are encoded, the encoded bitstream of the current frame is obtained.

[0245] If the current macroblock is the last pixel macroblock in the current frame, output the encoded bitstream of the current frame. If the current macroblock is not the last pixel macroblock in the current frame, jump to Step 2-1 to encode the next pixel macroblock. If the current macroblock is the last pixel macroblock in the current frame, jump to Step 3.

[0246] Step 3: Calculate T0 and T1 according to all block-level JND thresholds of the current frame.

[0247] Optionally, obtain the number of first tiles of the current frame, and determine the number of second tiles of each set JND threshold according to the LUT jnd Determine the number of second tiles of each set JND threshold according to the LUT

[0248] In the process of comparing the number of second tiles of each of the n set JND thresholds with the first screening threshold in ascending order of the set JND thresholds, if the number of second tiles LUT jnd [i] of the set JND threshold i is greater than or equal to one-third of the number of first tiles (num all / 3) for the first time, then i can be determined as the first adjustment parameter T0 of the (t + 1)-th video frame.

[0249] In the process of comparing the number of second tiles of each of the n set JND thresholds with the second screening threshold in ascending order of the set JND thresholds, if the number of second tiles LUT jnd [i] of the set JND threshold i is greater than or equal to two-thirds of the number of first tiles (i.e., num all0 *2 / 3) for the first time, then i can be determined as the second adjustment parameter T1 of the (t + 1)-th video frame.

[0250] After T0 and T1 in the (t + 1)-th frame are determined to be completed, the video encoder encodes the (t + 1)-th frame.

[0251] In summary, for the technical solution provided by the application embodiment, since the JND threshold can reflect the human visual characteristics (i.e., the inherent characteristics of the video), by using the JND threshold of the current block to select the compensation method for the current block, the consideration of the human visual characteristics of the current block can be introduced, which is beneficial to improving the accuracy of the compensation method selection and achieving the purpose of enhancing the human visual quality of the encoded output, and further beneficial to improving the encoding quality of the video frame.

[0252] The following is the device embodiment of the present application, which can be used to execute the method embodiment of the present application. For details not disclosed in the device embodiment of the present application, please refer to the method embodiment of the present application.

[0253] Reference Figure 6 , which shows a block diagram of a video encoding device provided in a possible implementation manner of the present application. The device has the functions of implementing the above method example, and the functions can be implemented by hardware or by hardware executing corresponding software. The device can be the computer device introduced above or can be set in the computer device. As Figure 6 shown, the device 600 includes: a distortion threshold acquisition module 601, a compensation method selection module 602, and a current block encoding module 603.

[0254] The distortion threshold acquisition module 601 is configured to acquire the JND threshold of the current block of the first video frame.

[0255] The compensation method selection module 602 is configured to, when the loop filter method of the current block includes the SAO method, select the compensation method of the current block from at least two compensation methods included in the SAO method according to the JND threshold of the current block.

[0256] The current block encoding module 603 is configured to encode the current block according to the compensation method of the current block.

[0257] In some embodiments, as Figure 7 shown, the compensation method selection module 602 includes: an encoding information acquisition sub-module 602a, an adjusted threshold acquisition sub-module 602b, and a compensation method selection sub-module 602c.

[0258] The encoding information acquisition sub-module 602a is configured to acquire the encoding information of the second video frame, where the second video frame is a video frame that was encoded before the first video frame and is adjacent to the first video frame.

[0259] An adjustment threshold acquisition sub-module 602b, configured to determine an adjustment threshold of the current block according to the encoding information of the second video frame, where the adjustment threshold of the current block is used to divide the JND threshold of the current block;

[0260] A compensation method selection sub-module 602c, configured to select a compensation method of the current block from the at least two compensation methods according to the JND threshold of the current block and the adjustment threshold of the current block.

[0261] In some embodiments, the compensation method selection sub-module 602c is further configured to:

[0262] Determine an adjustment amplitude of the current block according to the JND threshold of the current block and the adjustment threshold of the current block;

[0263] Adjust a balance parameter of the current block according to the adjustment amplitude of the current block to obtain an adjusted balance parameter, where the balance parameter of the current block is used to indicate an influence of distortion of the current block on a rate-distortion RD cost of the current block;

[0264] Select a compensation method of the current block from the at least two compensation methods according to the adjusted balance parameter.

[0265] In some embodiments, the adjustment threshold includes a first adjustment parameter and a second adjustment parameter, and the first adjustment parameter is less than the second adjustment parameter; the compensation method selection sub-module 602c is further configured to:

[0266] When the JND threshold of the current block is less than the first adjustment parameter, determine that the adjustment amplitude of the current block is a first value;

[0267] When the JND threshold of the current block is greater than the second adjustment parameter, determine that the adjustment amplitude of the current block is a second value;

[0268] When the JND threshold of the current block is greater than or equal to the first adjustment parameter and less than or equal to the second adjustment parameter, determine that the adjustment amplitude of the current block is a third value;

[0269] Wherein, the third value is greater than the first value and less than the second value.

[0270] In some embodiments, the compensation method selection sub-module 602c is further configured to perform a multiplication operation on the balance parameter of the current block and the adjustment amplitude of the current block to obtain the adjusted balance parameter.

[0271] In some embodiments, the at least two compensation methods include a boundary compensation RO method, a sideband compensation BO method, and a parameter fusion Merge method; the compensation method selection sub-module 602c is configured to:

[0272] Obtain the RD cost of the current block in the RO method, the BO method, and the Merge method respectively according to the adjusted balance parameter;

[0273] Select the compensation method of the current block from the at least two compensation methods according to the RD cost of the current block in the RO method, the BO method, and the Merge method respectively.

[0274] In some embodiments, as Figure 7 shown, the apparatus further includes: an encoding information acquisition module 604, a distribution information determination module 605, and an adjustment threshold determination module 606.

[0275] The encoding information acquisition module 604 is configured to acquire the encoding information of the first video frame after the encoding of the first video frame is completed.

[0276] The distribution information determination module 605 is configured to determine the block distribution information of the first video frame according to the encoding information of the first video frame, and the block distribution information is used to indicate the number of tiles under different set JND thresholds in the first video frame.

[0277] The adjustment threshold determination module 606 is configured to determine the adjustment threshold of the third video frame according to the block distribution information of the first video frame, where the third video frame is a video frame encoded after the first video frame and adjacent to the first video frame, and the adjustment threshold of the third video frame is used to divide the JND threshold of each tile in the third video frame.

[0278] In some embodiments, the block distribution information is correspondingly provided with n different set JND thresholds, where n is an integer greater than 1; the adjustment threshold determination module 606 is configured to:

[0279] Determine the first tile number, where the first tile number is the total number of tiles in the first video frame;

[0280] According to the block distribution information of the first video frame, respectively determine the second tile number of each of the n set JND thresholds, where the second tile number of the set JND threshold is the number of tiles in the first video frame whose JND threshold is less than or equal to the set JND threshold;

[0281] Determine a first screening threshold and a second screening threshold according to the first tile number;

[0282] Determine a first set JND threshold from the n set thresholds as the first adjustment parameter for the third video frame according to the second tile quantity of each of the n set JND thresholds and the first screening threshold;

[0283] Determine a second set JND threshold from the n set thresholds as the second adjustment parameter for the third video frame according to the second tile quantity of each of the n set JND thresholds and the second screening threshold;

[0284] Wherein, the adjustment threshold of the third video frame includes the first adjustment parameter of the third video frame and the second adjustment parameter of the third video frame.

[0285] In some embodiments, n different set JND thresholds are correspondingly set for the block distribution information, where n is an integer greater than 1; the distribution information determination module 605 is configured to:

[0286] For any tile in the first video frame, perform a rounding operation on the JND threshold of the tile to obtain a rounded JND threshold;

[0287] Determine, as a third set JND threshold, the set JND thresholds among the n set JND thresholds that are greater than or equal to the rounded JND threshold;

[0288] Increment the second tile quantity of the third set JND threshold by 1;

[0289] Wherein, the block distribution information of the first video frame includes the second tile quantity of each of the n set JND thresholds.

[0290] In some embodiments, the distortion threshold acquisition module 601 is configured to:

[0291] Obtain the JND thresholds respectively corresponding to each pixel point in the current block;

[0292] Perform a mean calculation on the JND thresholds respectively corresponding to each pixel point to obtain the average JND threshold of the current block;

[0293] In the case where the average JND threshold is greater than the first set threshold, determine the first set threshold as the JND threshold of the current block;

[0294] In the case where the average JND threshold is less than or equal to the first set threshold, determine the average JND threshold as the JND threshold of the current block.

[0295] In summary, in the technical solution provided by the embodiments of the present application, since the JND threshold can reflect the visual characteristics of the human eye (i.e., the inherent characteristics of the video), by using the JND threshold of the current block to select the compensation method for the current block, the consideration of the visual characteristics of the human eye for the current block can be introduced, which is beneficial to improving the accuracy of the selection of the compensation method and achieving the purpose of enhancing the visual quality of the human eye of the encoded output, and further beneficial to improving the encoding quality of the video frame.

[0296] It should be noted that, when the device provided in the above embodiment realizes its functions, only the division of the above function modules is used for illustration. In actual applications, the above functions can be allocated to different function modules according to needs, that is, the internal structure of the device is divided into different function modules to complete all or part of the functions described above. In addition, the device provided in the above embodiment and the method embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment and will not be elaborated here.

[0297] Please refer to Figure 8 , which is a simplified structural block diagram of a computer device 800 provided in a possible implementation manner of the present application. The computer device 800 can be implemented as the above-mentioned first computer device 201 or the above-mentioned second computer device 202. The computer device 800 can be used to implement the video encoding method provided in the above embodiment.

[0298] Generally, the computer device 800 includes a processor 801 and a memory 802.

[0299] The processor 801 may include one or more processing cores, such as a 4-core processor or an 8-core processor. The processor 801 can be implemented in at least one of the following hardware forms: DSP (Digital Signal Processing), FPGA (Field Programmable Gate Array), and PLA (Programmable Logic Array). The processor 801 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the wake state, also known as the CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 801 may be integrated with a GPU (Graphics Processing Unit), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 801 may further include an AI processor, which is used to process computational operations related to machine learning.

[0300] The memory 802 may include one or more computer-readable storage media, which may be non-transitory. The memory 802 may also include high-speed random access memory, as well as non-volatile memory, such as one or more disk storage devices and flash storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 802 is used to store a computer program, which is configured to be executed by one or more processors to implement the above video encoding method.

[0301] Those skilled in the art can understand that Figure 8 the structure shown in does not constitute a limitation on the computer device 800, and may include more or fewer components than shown in the figure, or combine certain components, or adopt different component arrangements.

[0302] Optionally, the computer device 800 may be a server, a server cluster, an artificial intelligence computing cluster, a cloud computing cluster, etc. Among them, the artificial intelligence computing cluster may also be abbreviated as an intelligent computing cluster or a smart computing cluster, and the present application does not make any limitation in this regard.

[0303] In some embodiments, a chip is further provided, which includes programmable logic circuits and / or program instructions, and is used to implement the above video encoding method when running.

[0304] In some embodiments, a computer-readable storage medium is further provided, in which a computer program is stored, and the computer program implements the above video encoding method when executed by a processor of a computer device.

[0305] Optionally, the computer-readable storage medium may include: ROM (Read-Only Memory), RAM (Random-Access Memory), SSD (Solid State Drives), or optical discs, etc. Among them, the random access memory may include ReRAM (Resistance Random Access Memory) and DRAM (Dynamic Random Access Memory).

[0306] In some embodiments, a computer program product is further provided, which includes a computer program stored in a computer-readable storage medium. The processor of the computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the above video encoding method.

[0307] It should be understood that the "plurality" mentioned herein refers to two or more. "And / or" describes the association relationship of associated objects and indicates that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, both A and B exist simultaneously, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. In addition, the step numbers described herein only exemplarily show a possible execution sequence between steps. In some other embodiments, the above steps may not be executed in the numbered sequence. For example, two steps with different numbers can be executed simultaneously, or two steps with different numbers can be executed in the reverse order of the illustration. The embodiments of the present application do not limit this.

[0308] The above are only exemplary embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included within the protection scope of the present application.

Claims

1. A video encoding method, characterized in that, The method includes: Obtaining the Just Noticeable Distortion (JND) threshold of the current block of the first video frame; When the loop filtering mode of the current block includes the Sample Adaptive Offset (SAO) mode, selecting the compensation mode of the current block from at least two compensation modes included in the SAO mode according to the JND threshold of the current block; Encoding the current block according to the compensation mode of the current block.

2. The method according to claim 1, characterized in that, The step of selecting the compensation mode of the current block from at least two compensation modes included in the SAO mode according to the JND threshold of the current block includes: Obtaining the encoding information of the second video frame, where the second video frame is a video frame encoded before the first video frame and adjacent to the first video frame; Determining the adjustment threshold of the current block according to the encoding information of the second video frame, where the adjustment threshold of the current block is used to divide the JND threshold of the current block; Selecting the compensation mode of the current block from the at least two compensation modes according to the JND threshold of the current block and the adjustment threshold of the current block.

3. The method according to claim 2, wherein The step of selecting the compensation mode of the current block from at least two compensation modes according to the JND threshold of the current block and the adjustment threshold of the current block includes: Determining the adjustment amplitude of the current block according to the JND threshold of the current block and the adjustment threshold of the current block; Adjusting the balance parameter of the current block according to the adjustment amplitude of the current block to obtain an adjusted balance parameter, where the balance parameter of the current block is used to indicate the impact of the distortion of the current block on the rate-distortion (RD) cost of the current block; Selecting the compensation mode of the current block from the at least two compensation modes according to the adjusted balance parameter.

4. The method according to claim 3, characterized in that The adjustment threshold includes a first adjustment parameter and a second adjustment parameter, and the first adjustment parameter is less than the second adjustment parameter; The step of determining the adjustment amplitude of the current block according to the JND threshold of the current block and the adjustment threshold of the current block includes: When the JND threshold of the current block is less than the first adjustment parameter, determining that the adjustment amplitude of the current block is a first value; When the JND threshold of the current block is greater than the second adjustment parameter, determining that the adjustment amplitude of the current block is a second value; When the JND threshold of the current block is greater than or equal to the first adjustment parameter and less than or equal to the second adjustment parameter, determining that the adjustment amplitude of the current block is a third value; Wherein, the third value is greater than the first value and less than the second value.

5. The method according to claim 3, characterized in that, The step of adjusting the balance parameter of the current block according to the adjustment amplitude of the current block to obtain an adjusted balance parameter includes: Performing a multiplication operation on the balance parameter of the current block and the adjustment amplitude of the current block to obtain the adjusted balance parameter.

6. The method according to claim 3, wherein The at least two compensation modes include the Region Offset (RO) mode for boundary compensation, the Band Offset (BO) mode for sideband compensation, and the Merge mode for parameter fusion; The step of selecting the compensation mode of the current block from the at least two compensation modes according to the adjusted balance parameter includes: Obtain the RD cost of the current block in the RO mode, the BO mode, and the Merge mode respectively according to the adjusted balance parameter. Select the compensation mode of the current block from the at least two compensation modes according to the RD cost of the current block in the RO mode, the BO mode, and the Merge mode respectively.

7. The method according to claim 1, characterized in that, The method further includes: After the first video frame is encoded, obtain the encoding information of the first video frame. Determine the block distribution information of the first video frame according to the encoding information of the first video frame, where the block distribution information is used to indicate the number of tiles under different set JND thresholds in the first video frame. Determine the adjustment threshold of the third video frame according to the block distribution information of the first video frame, where the third video frame is the video frame encoded after the first video frame and adjacent to the first video frame, and the adjustment threshold of the third video frame is used to divide the JND thresholds of each tile in the third video frame.

8. The method according to claim 7, characterized in that, The block distribution information is correspondingly set with n different set JND thresholds, where n is an integer greater than 1. The determining the adjustment threshold of the third video frame according to the block distribution information of the first video frame includes: Determine the number of the first tiles, where the number of the first tiles is the total number of tiles in the first video frame. According to the block distribution information of the first video frame, respectively determine the number of the second tiles of each of the n set JND thresholds, where the number of the second tiles of the set JND threshold is the number of tiles in the first video frame whose JND threshold is less than or equal to the set JND threshold. Determine the first screening threshold and the second screening threshold according to the number of the first tiles. Determine the first set JND threshold from the n set thresholds as the first adjustment parameter of the third video frame according to the number of the second tiles of each of the n set JND thresholds and the first screening threshold. Determine the second set JND threshold from the n set thresholds as the second adjustment parameter of the third video frame according to the number of the second tiles of each of the n set JND thresholds and the second screening threshold. Wherein, the adjustment threshold of the third video frame includes the first adjustment parameter of the third video frame and the second adjustment parameter of the third video frame.

9. The method according to claim 7, wherein The block distribution information is correspondingly set with n different set JND thresholds, where n is an integer greater than 1. The determining the block distribution information of the first video frame according to the encoding information of the first video frame includes: For any tile in the first video frame, perform a rounding operation on the JND threshold of the tile to obtain the rounded JND threshold. Determine the third set JND threshold from the n set JND thresholds that are greater than or equal to the rounded JND threshold. Increment the number of the second tiles of the third set JND threshold by 1. Wherein, the block distribution information of the first video frame includes the number of the second tiles of each of the n set JND thresholds.

10. The method according to any one of claims 1 to 9, characterized in that, The obtaining the JND threshold of the current block of the first video frame includes: Obtain the JND thresholds corresponding to each pixel point in the current block respectively; Perform a mean calculation on the JND thresholds corresponding to each pixel point respectively to obtain the average JND threshold of the current block; When the average JND threshold is greater than the first set threshold, determine the first set threshold as the JND threshold of the current block; When the average JND threshold is less than or equal to the first set threshold, determine the average JND threshold as the JND threshold of the current block.

11. A video encoding device, characterized in that, The device includes: A distortion threshold acquisition module, configured to obtain the just-noticeable distortion JND threshold of the current block of the first video frame; A compensation method selection module, configured to, when the loop filtering method of the current block includes the sample adaptive offset (SAO) method, select the compensation method of the current block from at least two compensation methods included in the SAO method according to the JND threshold of the current block; A current block encoding module, configured to encode the current block according to the compensation method of the current block.

12. A computer device, characterized in that, The computer device includes a processor and a memory, and a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the method according to any one of claims 1 to 10.

13. A computer-readable storage medium, characterized in that, A computer program is stored in the computer-readable storage medium, and the computer program is loaded and executed by a processor to implement the method according to any one of claims 1 to 10.

14. A chip, characterized in that, The chip includes programmable logic circuits and / or program instructions, and is used to implement the method according to any one of claims 1 to 10 when running.

15. A computer program product, characterized in that, The computer program product includes a computer program, the computer program is stored in a computer-readable storage medium, and the processor reads and executes the computer program from the computer-readable storage medium to implement the method according to any one of claims 1 to 10.

Citation Information

Cited By

  • Adaptive compensation method in video image coding process and related device

    CN121126002A