Image processing method and apparatus, and computer-readable storage medium
By dividing the target block of the video frame and determining the encoding and decoding information based on the scale, the encoding and decoding process is optimized, and the problem of imbalance in encoding and decoding performance and complexity is solved, and a more efficient encoding and decoding effect is achieved.
Patent Information
- Application Number
- PCT/CN2024/104476
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-12-08
- Filing Date
- 2024-07-09
- Publication Date
- 2025-08-14
AI Technical Summary
When the prior art improves the performance of video encoding and decoding, it usually leads to an increase in the complexity of encoding and decoding, making it difficult to achieve a balance between performance and complexity.
The target block is obtained by dividing the video frames, and the encoding and decoding information is determined based on the scale of the target block, the encoding and decoding process is optimized, and the configuration and analysis of the target block division flag bits are reduced.
Reduces the complexity of the encoding and decoding process, and improves the performance and complexity compromise in the video frame encoding and decoding process.
Smart Images

Figure CN2024104476_14082025_PF_FP_ABST
Abstract
Description
Image processing method, device and computer-readable storage medium
[0001] Priority information
[0002] This application claims priority to the Chinese patent application filed with the China Patent Office on December 8, 2023, with application number 2023116913343 and application name “Image processing method, device and computer-readable storage medium”, the entire contents of which are incorporated by reference into this application. Technical Field
[0003] The present application relates to the field of computer technology, and in particular to an image processing method, device, and computer-readable storage medium. Background Art
[0004] With advancements in scientific research, a vast amount of video resources has emerged on the internet. Since many videos (such as live broadcasts and online videos) require real-time transmission, technical personnel are committed to improving codec performance to meet consumers' ever-increasing demands (such as clarity). Research has found that improving codec performance often also increases codec complexity. Improving the trade-off between codec performance and complexity during video frame encoding and decoding has become a hot research topic.
[0005] Summary of the Invention
[0006] The embodiments of the present application provide an image processing method, apparatus, device, and computer-readable storage medium, which can improve the trade-off ratio between encoding and decoding performance and complexity during video frame encoding and decoding.
[0007] In one aspect, an embodiment of the present application provides an image processing method, comprising:
[0008] Obtaining code stream data of a video frame, where the code stream data includes encoded data of the video frame;
[0009] Based on the scale of the target block, the encoded data of the video frame is decoded and the video frame is presented; the target block is obtained by dividing the video frame, and the scale of the target block is used to determine the encoding and decoding information of the target block.
[0010] In an embodiment of the present application, code stream data of a video frame is obtained, the code stream data including the encoded data of the video frame. Based on the scale of a target block, the encoded data of the video frame is decoded and processed, and the video frame is presented. The target block is obtained by dividing the video frame, and the scale of the target block is used to determine the encoding and decoding information of the target block. It can be seen that during the decoding process, the encoding and decoding information of the target block (such as the division method of the target block and whether there is a residual) is determined by the scale of the target block, which can optimize the decoding process of the video frame (such as the need to parse the division flag of the target block), reduce the decoding complexity, and thus improve the trade-off ratio between the performance and complexity of the encoding and decoding process of the video frame.
[0011] In one aspect, an embodiment of the present application provides an image processing method, comprising:
[0012] Get the video frame to be encoded;
[0013] Based on the scale of the target block, the video frame is encoded to obtain the code stream data of the video frame; the target block is obtained by dividing the video frame, and the scale of the target block is used to determine the encoding and decoding information of the target block.
[0014] In an embodiment of the present application, a video frame to be encoded is obtained, and based on the scale of a target block, the video frame is encoded to obtain code stream data of the video frame. The target block is obtained by dividing the video frame, and the scale of the target block is used to determine the codec information of the target block. It can be seen that during the encoding process, the codec information of the target block (such as the division method of the target block and whether there is a residual) is determined by the scale of the target block, which can optimize the encoding process of the video frame (such as eliminating the need to configure the division flag of the target block), reduce the encoding complexity, and thus improve the trade-off ratio between codec performance and complexity during the encoding and decoding process of the video frame.
[0015] In one aspect, an embodiment of the present application provides an image processing device, comprising:
[0016] An acquisition unit, configured to acquire code stream data of a video frame, wherein the code stream data includes coded data of the video frame;
[0017] The processing unit is used to decode the encoded data of the video frame based on the scale of the target block and present the video frame; the target block is obtained by dividing the video frame, and the scale of the target block is used to determine the encoding and decoding information of the target block.
[0018] In one aspect, an embodiment of the present application provides an image processing device, comprising:
[0019] An acquisition unit, configured to acquire a video frame to be encoded;
[0020] The processing unit is used to encode the video frame based on the scale of the target block to obtain the code stream data of the video frame; the target block is obtained by dividing the video frame, and the scale of the target block is used to determine the encoding and decoding information of the target block.
[0021] Accordingly, the present application provides a computer device, comprising:
[0022] a memory, wherein a computer program is stored in the memory;
[0023] The processor is used to load a computer program to implement the above-mentioned image processing method.
[0024] Accordingly, the present application provides a computer-readable storage medium, which stores a computer program, and the computer program is suitable for being loaded by a processor and executing the above-mentioned image processing method.
[0025] Accordingly, the present application provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the above-mentioned image processing method.
[0026] In an embodiment of the present application, the encoding end obtains the video frame to be encoded, and based on the scale of the target block, encodes the video frame to obtain the code stream data of the video frame. The target block is obtained by dividing the video frame, and the scale of the target block is used to determine the encoding and decoding information of the target block. The decoding end obtains the code stream data of the video frame, and the code stream data includes the encoding data of the video frame. Based on the scale of the target block, the encoding data of the video frame is decoded and presented. It can be seen that in the encoding and decoding process, the encoding and decoding information of the target block (such as the division method of the target block and whether there is a residual) is determined by the scale of the target block, which can optimize the encoding and decoding process of the video frame (such as the need to configure / parse the division flag of the target block), reduce the encoding and decoding complexity, and thus improve the trade-off ratio between the encoding and decoding performance and complexity in the video frame encoding and decoding process. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0028] FIG1a is a schematic diagram of a video encoding and decoding framework provided by an embodiment of the present application;
[0029] FIG1b is a schematic diagram of a block division method in the fourth-generation audio and video codec standard provided by an embodiment of the present application;
[0030] FIG1c is a schematic diagram of a division result of a coding tree unit provided in an embodiment of the present application;
[0031] FIG1d is an image processing scene diagram provided by an embodiment of the present application;
[0032] FIG2 is a flow chart of an image processing method provided in an embodiment of the present application;
[0033] FIG3 is a schematic diagram of a right boundary block and a lower boundary block provided in an embodiment of the present application;
[0034] FIG4 is a flowchart of another image processing method provided in an embodiment of the present application;
[0035] FIG5 is a schematic structural diagram of an image processing device provided in an embodiment of the present application;
[0036] FIG6 is a schematic structural diagram of another image processing device provided in an embodiment of the present application;
[0037] FIG7 is a schematic structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0038] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0039] This application involves technologies related to encoding and decoding. The following is a brief introduction to the technologies related to encoding and decoding:
[0040] Coding Unit (CU): refers to the basic unit for encoding a video frame. During the encoding process, a coding unit can refer to the entire video frame (when the video frame is not divided) or a part of the video frame (when the video frame is divided).
[0041] Intra-frame prediction: refers to the process of encoding a coding unit without referring to information of other video frames in the video except the video frame to which the coding unit belongs.
[0042] Inter-frame prediction: refers to the information of video frames adjacent to the video frame to which the coding unit belongs in the reference video when encoding the coding unit.
[0043] Video signal: A video signal can be captured by a camera or generated by a computer. During the encoding and decoding process, the corresponding encoding and decoding methods may also vary due to different statistical methods for the characteristics of the video signal.
[0044] Modern mainstream video coding technologies, such as the international video coding standards HEVC (High Efficiency Video Coding), VVC (Versatile Video Coding), and AVS (Audio Video Coding Standard), use a hybrid coding framework. Figure 1a is a schematic diagram of a video codec framework provided by an embodiment of the present application. As shown in Figure 1a, during the encoding and decoding process, the input original video signal is subjected to the following series of operations and processing:
[0045] 1) Block partition structure: The input image is processed into several non-overlapping processing units based on the size of the processing unit, and similar compression operations are performed on each processing unit. This processing unit is called a coding tree unit (CTU) or a largest coding unit (LCU). The CTU can be further divided into more detailed divisions to obtain one or more basic coding units, called coding units (CUs). Each CU is the most basic element in the encoding process.
[0046] Figure 1b is a schematic diagram of the block partitioning method in the fourth-generation audio and video codec standard provided by an embodiment of the present application. As shown in Figure 1b, there are three types of partitioning trees in the fourth-generation audio and video codec standard (AVS4): quadtree, binary tree (horizontal, vertical) and extended quadtree (horizontal, vertical). Through recursive partitioning of the three partitioning trees, the entire CTU can be divided into a state that is more suitable for prediction. Different partitioning methods can be indicated by a partition flag bit. For example, the flag bit corresponding to quad partitioning is 1, and the flag bit corresponding to vertical binary partitioning is 0101.
[0047] Figure 1c is a schematic diagram of the division results of a coding tree unit provided in an embodiment of the present application. As shown in Figure 1c, the entire CTU is divided into 25 coding blocks. The encoding device writes the block division results into the bitstream; for example, the encoding device can indicate the CTU division method in the bitstream based on the division flag bits in Figure 1b and the coding tree corresponding to the CTU in Figure 1c. The decoding device can obtain the CTU division method by parsing the division flag bits in the bitstream.
[0048] 2) Predictive Coding: This includes methods such as intra-frame prediction and inter-frame prediction. The original video signal is predicted by the selected reconstructed video signal to produce a residual video signal. The content production device must determine the most appropriate predictive coding mode for the current CU from among many possible modes and inform the content playback device.
[0049] a. Intra-frame prediction: The predicted signal comes from the area that has been encoded and reconstructed within the same image.
[0050] b. Inter-frame prediction: The predicted signal comes from an already encoded image that is different from the current image (called a reference image).
[0051] 3) Transform Coding and Quantization: The residual video signal undergoes transform operations such as the Discrete Fourier Transform (DFT) and Discrete Cosine Transform (DCT) to convert the signal into a transform domain, known as transform coefficients. The signal in the transform domain is further subjected to a lossy quantization operation, which loses some information, making the quantized signal more suitable for compression. Some video coding standards may offer more than one transform method. Therefore, the content production device must select one for the current CU being encoded and notify the content playback device. The level of quantization is typically determined by the Quantization Parameter (QP). A larger QP value means that coefficients with a larger value range will be quantized into the same output, which generally results in greater distortion and a lower bitrate. Conversely, a smaller QP value means that coefficients with a smaller value range will be quantized into the same output, which generally results in less distortion and a higher bitrate.
[0052] 4) Entropy Coding or Statistical Coding: The quantized transform domain signal will be statistically compressed and encoded according to the frequency of occurrence of each value, and finally a binary (0 or 1) compressed code stream will be output. At the same time, the encoding generates other information, such as the selected mode, motion vector, etc., which also needs to be entropy coded to reduce the bit rate. Statistical coding is a lossless coding method that can effectively reduce the bit rate required to express the same signal. Common statistical coding methods include variable length coding (VLC) or context-based binary arithmetic coding (CABAC).
[0053] 5) Loop Filtering: The encoded image undergoes inverse quantization, inverse transformation, and prediction compensation (the reverse operations of 2 to 4 above) to obtain a reconstructed decoded image. Specifically, at the decoding end, for each CU, after the decoding device obtains the compressed code stream, it first performs entropy decoding on the compressed code stream to obtain the prediction coding mode information and the quantized transform coefficients. On the one hand, the decoding device inversely quantizes and inversely transforms each quantized transform coefficient to obtain a residual signal; on the other hand, the decoding device determines the prediction signal corresponding to the current CU based on the prediction coding mode information. Based on the residual signal and prediction signal of the CU, the reconstructed signal of the CU can be obtained. Finally, the reconstructed value of the decoded image needs to undergo a loop filtering operation to produce the final output signal. Compared with the original image, due to the influence of quantization, some information of the reconstructed image is different from the original image, resulting in distortion. Filtering the reconstructed image, such as deblocking, sample adaptive offset (SAO) filtering, or adaptive loop filtering (ALF), can effectively reduce the distortion caused by quantization. Because these filtered reconstructed images serve as references for subsequent coded images and are used to predict future signals, these filtering operations are also called loop filtering, or filtering operations within the coding loop.
[0054] Based on the above-mentioned technologies related to encoding and decoding, an embodiment of the present application provides an image processing solution that can improve the trade-off ratio between encoding and decoding performance and complexity during video frame encoding and decoding. Figure 1d is a diagram of an image processing scenario provided by an embodiment of the present application. As shown in Figure 1d, the image processing scenario provided by the present application includes a terminal device 101 and a server 102. The image processing solution provided by the present application can be executed by the terminal device 101 or by the server 102. Among them, the terminal device may include but is not limited to: a smart phone (such as an Android phone, an IOS phone, etc.), a tablet computer, a portable personal computer, a mobile Internet device (Mobile Internet Devices, referred to as MID), an intelligent voice interaction device, a smart home appliance, a vehicle terminal, an aircraft, a wearable device, etc., and the embodiment of the present application does not limit this; the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network, content distribution network), and basic cloud computing services such as big data and artificial intelligence platforms, and the embodiment of the present application does not limit this.
[0055] It should be noted that the number of terminal devices and servers in Figure 1d is for example only and does not constitute an actual limitation of this application. The terminal device 101 and the server 102 can be connected via wired or wireless means, and this application does not impose any restrictions on this.
[0056] The image processing solution provided in this application generally proceeds as follows: Server 102 obtains a video frame to be encoded and, based on the scale of a target block in the video frame, encodes the video frame to obtain a bitstream of the video frame. The target block is obtained by dividing the video frame. Specifically, the target block can be a block to be divided (a block that will be further divided) or a coding unit (no longer divided). The scale of the target block is used to determine the encoding and decoding information of the target block. In one embodiment, server 102 obtains a scale parameter of the video frame. The scale parameter is used to optimize the encoding and decoding process of the target block (such as the target block division method and determining whether the target block has residuals). The scale parameter of the video frame includes at least one of the following: a coding tree unit parameter of the video frame, a maximum inter-frame transform parameter of the video frame, and a maximum intra-frame prediction parameter of the video frame. Within the video to which the video frame belongs, different types of video frames (such as key frames and non-key frames) have different scale parameters, and the scale parameters of video frames of the same type can be the same or different. Server 102 encodes the video frame based on the scale and scale parameter of the target block to obtain a bitstream of the video frame. In another embodiment, the target block is a lower boundary block or a right boundary block of a video frame. The server 102 encodes the video frame based on the aspect ratio of the target block to obtain code stream data of the video frame.
[0057] Accordingly, the terminal device 101 obtains the code stream data of the video frame, which includes the encoded data of the video frame. The terminal device 101 decodes the encoded data of the video frame based on the scale of the target block in the video frame and presents the video frame. In one embodiment, the code stream data also includes the scale parameter of the video frame. The terminal device 101 decodes the encoded data of the video frame based on the scale and scale parameter of the target block, and presents the video frame according to the decoding result. In another embodiment, the target block is the lower boundary block or the right boundary block of the video frame. The terminal device 101 decodes the video frame based on the aspect ratio of the target block and presents the video frame according to the decoding result.
[0058] In an embodiment of the present application, the encoding end obtains the video frame to be encoded, and based on the scale of the target block, encodes the video frame to obtain the code stream data of the video frame. The target block is obtained by dividing the video frame, and the scale of the target block is used to determine the encoding and decoding information of the target block. The decoding end obtains the code stream data of the video frame, and the code stream data includes the encoding data of the video frame. Based on the scale of the target block, the encoding data of the video frame is decoded and presented. It can be seen that in the encoding and decoding process, the encoding and decoding information of the target block (such as the division method of the target block and whether there is a residual) is determined by the scale of the target block, which can optimize the encoding and decoding process of the video frame (such as the need to configure / parse the division flag of the target block), reduce the encoding and decoding complexity, and thus improve the trade-off ratio between the encoding and decoding performance and complexity in the video frame encoding and decoding process.
[0059] Based on the above-mentioned image processing scheme, the embodiment of the present application proposes a more detailed image processing method. The image processing method proposed in the embodiment of the present application will be described in detail below with reference to the accompanying drawings.
[0060] Please refer to Figure 2, which is a flowchart of an image processing method provided in an embodiment of the present application. The image processing method can be executed by a computer device; for example, by the terminal device 101 shown in Figure 1d. As shown in Figure 2, the image processing method may include the following steps S201 and S202:
[0061] S201: Obtain code stream data of a video frame.
[0062] The bitstream data includes encoded data of a video frame, which may include encoding and decoding information of a target block in the video frame. The target block is obtained by dividing the video frame, and the target block may be a block to be divided or a coding unit. The encoding and decoding information of the target block may include at least one of the following: a division method of the target block, a residual flag, and a prediction coding mode. For example, when the target block is a block to be divided, the encoding and decoding information of the target block may include the division method of the target block; when the target block is a coding unit, the encoding and decoding information of the target block may include the residual flag and the prediction coding mode of the target block.
[0063] S202 : Based on the scale of the target block, decode the encoded data of the video frame and present the video frame.
[0064] The scale of the target block is used to determine the encoding and decoding information of the target block.
[0065] In one embodiment, the code stream data also includes scale parameters of the video frame, and the scale parameters are used to optimize the encoding and decoding process of the target block (such as the division method of the target block, and the determination of whether the target block has residuals). In the video to which the video frame belongs, the scale parameters of different types of video frames (such as key frames and non-key frames) may be the same or different; for example, the scale parameters are coding tree unit parameters, and the coding tree unit parameters of key frames and non-key frames in the video are different. The scale parameters of video frames of the same type may be the same or different. The scale parameters of the video frame include at least one of the following: the coding tree unit parameters of the video frame, the maximum inter-frame transform parameters of the video frame, and the maximum intra-frame prediction parameters of the video frame. The computer device decodes the encoded data of the video frame based on the scale and scale parameters of the target block, and presents the video frame according to the decoding result.
[0066] The code stream data includes at least one video sequence of the video to which the video frame belongs, each video sequence includes the encoded data of at least one video frame, and the encoded data of any video frame includes the image header of the video frame. The scale parameter of the video frame can be a default value or can be configured based on the video frame. If the scale parameter of the video frame is the default value, the computer device decodes the encoded data of the video frame based on the default value (default scale parameter) and the scale of the target block, and presents the video frame. The default value is a parameter agreed in advance by the encoding device and the decoding device (computer device), or a parameter specified in the encoding and decoding standard. If the scale parameter of the video is configured based on the video frame, the scale parameter of the video frame is carried in the sequence header of the video sequence to which the video frame belongs, or is carried in the image header of the video frame.
[0067] It is understandable that the scale parameters of the video frame can also partially adopt default values and partially be based on the video frame configuration. In one embodiment, the scale parameters include the coding tree unit parameters of the video frame, the maximum inter-frame transform parameters of the video frame, and the maximum intra-frame prediction parameters of the video frame; wherein, the coding tree unit parameters of the video frame are based on the video frame configuration (contained in the bitstream data), and the maximum inter-frame transform parameters of the video frame and the maximum intra-frame prediction parameters of the video frame adopt default values; for example, the encoding device can configure the coding tree unit parameters (CTU) of the video frame to 256, and the coding tree unit parameters are carried in the bitstream data; in this case, the codec device defaults to: the maximum intra-frame prediction parameters of key frames are 64, the maximum intra-frame prediction parameters of non-key frames are 128 (that is, the maximum intra-frame prediction parameters of key frames and non-key frames are different), and the maximum inter-frame transform parameters of non-key frames are 128. When is the default value, the maximum intra-frame prediction parameter of key frames, the maximum intra-frame prediction parameter of non-key frames, and the maximum inter-frame transform parameter of non-key frames may not be carried in the bitstream data; for another example, the encoding device may configure the coding tree unit parameter (CTU) of the video frame to 256, and the coding tree unit parameter is carried in the bitstream data; in this case, the codec device defaults to: the maximum intra-frame prediction parameter of key frames is 64, the maximum intra-frame prediction parameter of non-key frames is 64 (that is, the maximum intra-frame prediction parameter of key frames and non-key frames is the same), and the maximum inter-frame transform parameter of non-key frames is 128. When is the default value, the maximum intra-frame prediction parameter of key frames, the maximum intra-frame prediction parameter of non-key frames, and the maximum inter-frame transform parameter of non-key frames may not be carried in the bitstream data.
[0068] It should be noted that using the default value (default scale parameter) and the target block scale to decode the encoded data of a video frame, compared to using the configured scale parameter and target block scale to decode the encoded data of a video frame, eliminates the need to indicate the scale parameter in the video frame's bitstream data (or reduces the amount of scale parameter data), further compressing the amount of the video frame's bitstream data. When the scale parameter of a video frame is carried in the sequence header of the video sequence to which the video frame belongs, the scale parameter can be used to indicate the scale of the video frame in the video sequence to which the video frame belongs, further compressing the amount of bitstream data compared to carrying it in the image header of the video frame. When the scale parameter is carried in the image header of a video frame, it can indicate the scale of a single view frame, which is more flexible than carrying it in the sequence header.
[0069] In one embodiment, the scale parameter includes a coding tree unit parameter corresponding to the video frame, and the coded data of the video frame is derived based on the coding tree unit parameter. The computer device determines the predictive coding parameters of the video frame using the coding tree unit parameter and a preset ratio. The predictive coding parameters include at least one of the maximum inter-frame transform parameter and the maximum intra-frame prediction parameter of the video frame. The preset ratio is 1 / N, where N is a positive integer. For example, assuming N = 2 and the CTU is 256, the predictive coding parameters include the maximum inter-frame transform parameter and the maximum intra-frame prediction parameter of the video frame. Thus, the maximum inter-frame transform parameter of the video frame is 256*1 / 2=128, and the maximum intra-frame prediction parameter of the video frame is 256*1 / 2=128. After obtaining the predictive coding parameters of the video frame, the computer device decodes the coded data of the video frame based on the scale of the target block and the predictive coding parameters of the video frame, and presents the video frame based on the decoding result.
[0070] In another embodiment, the scale parameter includes a maximum intra-frame prediction parameter, the video frame is a non-keyframe, and the target block is a coding unit. The process of decoding the encoded data of the video frame by the computer device based on the scale and scale parameter of the target block includes: if the scale of the target block is greater than the scale indicated by the maximum intra-frame prediction parameter, the computer device determines that the prediction coding mode of the target block is non-intra-frame prediction (such as using inter-frame prediction), or uses the first context model to decode the target block. It is understandable that when the prediction coding mode only includes intra-frame prediction and inter-frame prediction, the computer device can directly determine that the prediction coding mode of the target block is inter-frame prediction. The first context model is specifically used to decode the coding unit in the non-keyframe whose scale is greater than the scale indicated by the maximum intra-frame prediction parameter. It should be noted that by decoding the target block with the first context model specifically for the target block, the prediction accuracy of the target block can be further improved and the decoding complexity can be reduced.
[0071] For example, assuming that the video frame is a non-key frame, the target block is a coding unit, the scale of the target block is 256*256, and the scale indicated by the maximum intra-frame prediction parameter is 128 (or 64) is 128*128 (or 64*64), then the computer device determines that the prediction coding mode of the target block is non-intra-frame prediction, or uses the first context model to decode the target block.
[0072] In another embodiment, the scale parameter includes a maximum inter-frame transform parameter, the video frame is a non-keyframe, and the target block is a block to be divided (blocks that need to be further divided can be indicated by a division flag). The process of a computer device decoding the encoded data of the video frame based on the scale and scale parameter of the target block includes: if the height of the target block is greater than the height indicated by the maximum inter-frame transform parameter, and the width of the target block is less than or equal to the width indicated by the maximum inter-frame transform parameter, the computer device performs horizontal binary division on the target block, or the computer device can parse the division flag of the target block and use the second context model to decode the target block. If the height of the target block is less than or equal to the height indicated by the maximum inter-frame transform parameter, and the width of the target block is greater than the width indicated by the maximum inter-frame transform parameter, the computer device performs vertical binary division on the target block, or the computer device can parse the division flag of the target block and use the third context model to decode the target block. The second context model is specifically used to decode the blocks to be divided in non-key frames whose height is greater than the height indicated by the maximum inter-frame transform parameter and whose width is less than or equal to the width indicated by the maximum inter-frame transform parameter; the third context model is specifically used to decode the blocks to be divided in non-key frames whose height is less than or equal to the height indicated by the maximum inter-frame transform parameter and whose width is greater than the width indicated by the maximum inter-frame transform parameter. It should be noted that when the target block meets the conditions, decoding the target block using the dedicated second context model or the third context model can further improve the prediction accuracy of the target block and reduce the decoding complexity.
[0073] For example, assume that the target block is the block to be divided, the video frame is a non-key frame, the scale (width * height) of the target block is 256*128, the maximum inter-frame transformation parameter is 128, and the scale (width * height) indicated by the maximum inter-frame transformation parameter is 128*128, that is, the width of the target block is greater than the width indicated by the maximum inter-frame transformation parameter, and the height of the target block is less than or equal to the height indicated by the maximum inter-frame transformation parameter. The computer device performs vertical binary division processing on the target block, or uses the third context model to decode the target block.
[0074] In yet another embodiment, the scale parameter includes a maximum inter-frame transform parameter, and the target block is a coding unit (no further division is required, and it can be indicated by a division flag). The process of a computer device decoding the coded data of a video frame based on the scale and scale parameter of the target block includes: if the scale of the target block is greater than the scale indicated by the maximum inter-frame transform parameter, it is determined that there is no residual in the target block, or the computer device can parse the residual flag of the target block and use a fourth context model to decode the target block. The fourth context model is specifically used to decode the coding units in the video frame whose scale is greater than the scale indicated by the maximum inter-frame transform parameter. It should be noted that when the target block meets the conditions, decoding the target block through a dedicated fourth context model can further improve the prediction accuracy of the target block and reduce the decoding complexity.
[0075] For example, assuming that the target block is a coding unit, the scale of the target block is 256*256, and the maximum inter-frame transform parameter is 128 (the indicated scale is 128*128), the computer device determines that there is no residual in the target block, or uses the fourth context model to decode the target block.
[0076] In another embodiment, the scale parameter includes a maximum intra-frame prediction parameter, and the video frame is a key frame. The process of the computer device decoding the encoded data of the video frame based on the scale and scale parameter of the target block includes: if the scale of the target block is greater than the scale indicated by the maximum intra-frame prediction parameter, the computer device performs a quadrilateral division on the target block, or the computer device can parse the division flag of the target block and use the fifth context model to decode the target block. The fifth context model is specifically used to decode blocks in the key frame whose scale is greater than the scale indicated by the maximum intra-frame prediction parameter. It should be noted that by decoding the target block using the fifth context model specifically for the target block, the prediction accuracy of the target block can be further improved and the decoding complexity can be reduced.
[0077] For example, assuming that the video frame is a key frame, the scale of the target block is 256*256, and the scale indicated by the maximum intra-frame prediction parameter is 128 (or 64) is 128*128 (or 64*64), then the computer device performs quadrilateral division processing on the target block, or uses the fifth context model to decode the target block.
[0078] In another embodiment, the target block is the lower boundary block or the right boundary block of the video frame. The computer device decodes the video frame based on the aspect ratio of the target block and presents the video frame according to the decoding result. The right boundary block refers to the block at the right boundary of the video frame, and the lower boundary block refers to the block at the lower boundary of the video frame. Figure 3 is a schematic diagram of the right boundary block and the lower boundary block provided in an embodiment of the present application. As shown in Figure 3, the right boundary block overlaps with the right boundary of the video frame, and the lower boundary block overlaps with the lower boundary of the video frame.
[0079] In one embodiment, the target block is a right boundary block of a video frame. The process of a computer device decoding the encoded data of a video frame includes: if the ratio of the height to the width of the target block is less than a first ratio threshold, the computer device performs a vertical binary split on the target block, or the computer device can parse the split flag of the target block and use a sixth context model to decode the target block; accordingly, if the ratio of the height to the width of the target block is greater than or equal to the first ratio threshold, the computer device performs a horizontal binary split on the target block, or the computer device can parse the split flag of the target block and use a seventh context model to decode the target block. The sixth context model is specifically used to decode right boundary blocks in a video frame whose height to width ratio is less than the first ratio threshold, and the seventh context model is specifically used to decode right boundary blocks in a video frame whose height to width ratio is greater than or equal to the first ratio threshold. It should be noted that when the target block meets the conditions, decoding the target block using the dedicated sixth context model or seventh context model can further improve the prediction accuracy of the target block and reduce the decoding complexity.
[0080] For example, assuming that the first ratio threshold is 8, the target block is the right boundary block of the video frame, and the scale (width * height) of the target block is 64*128, then the ratio of the height to the width of the target block is 128 / 64=2<8, and the computer device performs vertical binary division processing on the target block, or uses the sixth context model to decode the target block.
[0081] In another embodiment, the target block is a lower boundary block of a video frame. The process of a computer device decoding the encoded data of a video frame includes: if the ratio of the width to the height of the target block is less than a second ratio threshold, the computer device performs horizontal binary division on the target block, or the computer device can parse the division flag of the target block and use the eighth context model to decode the target block; accordingly, if the ratio of the width to the height of the target block is greater than or equal to the second ratio threshold, the computer device performs vertical binary division on the target block, or the computer device can parse the division flag of the target block and use the ninth context model to decode the target block. The eighth context model is specifically used to decode the lower boundary block in the video frame whose width to height ratio is less than the second ratio threshold, and the ninth context model is specifically used to decode the lower boundary block in the video frame whose width to height ratio is greater than or equal to the second ratio threshold. It should be noted that when the target block meets the conditions, decoding the target block through the dedicated eighth context model or the ninth context model can further improve the prediction accuracy of the target block and reduce the decoding complexity.
[0082] For example, assuming that the second ratio threshold is 8, the target block is the lower boundary block of the video frame, and the scale (width * height) of the target block is 128*16, then the ratio of the width to the height of the target block is 128 / 16=8≥8, and the computer device performs vertical binary division processing on the target block, or uses the ninth context model to decode the target block.
[0083] In an embodiment of the present application, code stream data of a video frame is obtained, the code stream data including the encoded data of the video frame. Based on the scale of a target block, the encoded data of the video frame is decoded and processed, and the video frame is presented. The target block is obtained by dividing the video frame, and the scale of the target block is used to determine the encoding and decoding information of the target block. It can be seen that during the decoding process, the encoding and decoding information of the target block (such as the division method of the target block and whether there is a residual) is determined by the scale of the target block, which can optimize the decoding process of the video frame (such as the need to parse the division flag of the target block), reduce the decoding complexity, and thus improve the trade-off ratio between the performance and complexity of the encoding and decoding process of the video frame.
[0084] Please refer to Figure 4, which is a flowchart of another image processing method provided in an embodiment of the present application. The image processing method can be executed by a computer device; for example, by the server 102 shown in Figure 1d. As shown in Figure 4, the image processing method may include the following steps S401 and S402:
[0085] S401: Obtain a video frame to be encoded.
[0086] S402 : Encode the video frame based on the scale of the target block to obtain code stream data of the video frame.
[0087] Specifically, the target block is obtained by dividing the video frame, and the scale of the target block is used to determine the encoding and decoding information of the target block. The target block can be a block to be divided (a block that needs to be further divided) or a coding unit (no need to divide it further). The encoding and decoding information of the target block may include at least one of the following: a division method of the target block, a residual flag, and a prediction coding mode; for example, when the target block is a block to be divided, the encoding and decoding information of the target block may include the division method of the target block; when the target block is a coding unit, the encoding and decoding information of the target block may include the residual flag and the prediction coding mode of the target block.
[0088] In one embodiment, a computer device obtains a scale parameter of a video frame, and the scale parameter is used to optimize the encoding and decoding process of a target block (such as the division method of the target block, and the determination of whether a target block has a residual). The scale parameter of a video frame may be a default value or may be configured based on the video frame. In the video to which the video frame belongs, the scale parameters of different types of video frames (such as key frames and non-key frames) may be the same or different; for example, the scale parameter is a coding tree unit parameter, and the coding tree unit parameters of key frames and non-key frames in the video are different. The scale parameters of video frames of the same type may be the same or different. The scale parameter of a video frame includes at least one of the following: a coding tree unit parameter of the video frame, a maximum inter-frame transform parameter of the video frame, and a maximum intra-frame prediction parameter of the video frame. After obtaining the scale parameter of the video frame, the computer device encodes the video frame based on the scale and scale parameter of the target block to obtain the bitstream data of the video frame.
[0089] If the scale parameter of a video frame is the default value, the computer device encodes the video frame based on the scale of the target block and the default value (the default scale parameter) to generate the video frame bitstream data. The default value is a parameter agreed upon in advance by the encoder and decoder (the computer device), or a parameter specified in the codec standard, and does not need to be included in the video frame bitstream data.
[0090] If the scale parameter of a video frame is configured based on the video frame, the computer device encodes the video frame based on the scale and scale parameter of the target block to obtain encoded data of the video frame. The encoded data of the video frame includes an image header of the video frame. After obtaining the encoded data of the video frame, the computer device, on the one hand, adds the encoded data of the video frame to the video sequence to which the video frame belongs; on the other hand, the computer device adds the scale parameter of the video frame to the image header of the video frame, or configures the sequence header of the video sequence to which the video frame belongs based on the scale parameter of the video frame, to obtain the code stream data of the video frame. In one implementation, the scale parameters of video frames belonging to the same video sequence are the same. In this case, the sequence header only needs to be configured once based on the scale parameters of the video frames in any video sequence.
[0091] The scale parameters of the video frame can also partially adopt default values and partially be based on the video frame configuration. In one embodiment, the scale parameters include the coding tree unit parameters of the video frame, the maximum inter-frame transform parameters of the video frame and the maximum intra-frame prediction parameters of the video frame; wherein, the coding tree unit parameters of the video frame are based on the video frame configuration (contained in the bitstream data), and the maximum inter-frame transform parameters of the video frame and the maximum intra-frame prediction parameters of the video frame adopt default values; for example, the encoding device can configure the coding tree unit parameters (CTU) of the video frame to be 256, and the coding tree unit parameters are carried in the bitstream data; in this case, the codec device defaults to: the maximum intra-frame prediction parameters of key frames are 64, the maximum intra-frame prediction parameters of non-key frames are 128 (that is, the maximum intra-frame prediction parameters of key frames and non-key frames are different), and the maximum inter-frame transform parameters of non-key frames are 12 8. When the maximum intra-frame prediction parameters for key frames are at their default values, the maximum intra-frame prediction parameters for non-key frames and the maximum inter-frame transform parameters for non-key frames may not be carried in the bitstream data. For another example, the encoding device may configure the coding tree unit (CTU) parameter of a video frame to 256, and the coding tree unit parameter is carried in the bitstream data. In this case, the codec defaults to: the maximum intra-frame prediction parameters for key frames are 64, the maximum intra-frame prediction parameters for non-key frames are 64 (i.e., the maximum intra-frame prediction parameters for key frames and non-key frames are the same), and the maximum inter-frame transform parameters for non-key frames are 128. When the maximum intra-frame prediction parameters for key frames are at their default values, the maximum intra-frame prediction parameters for non-key frames and the maximum inter-frame transform parameters for non-key frames may not be carried in the bitstream data.
[0092] It should be noted that using the default value (default scale parameter) and the target block scale to decode the encoded data of a video frame, compared to using the configured scale parameter and target block scale to decode the encoded data of a video frame, eliminates the need to indicate the scale parameter in the video frame's bitstream data (or reduces the amount of scale parameter data), further compressing the amount of the video frame's bitstream data. When the scale parameter of a video frame is carried in the sequence header of the video sequence to which the video frame belongs, the scale parameter can be used to indicate the scale of the video frame in the video sequence to which the video frame belongs, further compressing the amount of bitstream data compared to carrying it in the image header of the video frame. When the scale parameter is carried in the image header of a video frame, it can indicate the scale of a single view frame, which is more flexible than carrying it in the sequence header.
[0093] In one embodiment, the scale parameters include coding tree unit parameters corresponding to the video frame, and the coding tree unit parameters are used to derive the encoded data of the video. The computer device determines predictive coding parameters for the video frame based on the coding tree unit parameters and a preset ratio. The predictive coding parameters include at least one of a maximum inter-frame transform parameter of the video frame and a maximum intra-frame prediction parameter of the video frame, and the preset ratio is 1 / N, where N is a positive integer. For key frames and non-key frames, the preset ratio corresponding to the maximum inter-frame transform parameter can be different (i.e., the maximum inter-frame transform parameters obtained for key frames and non-key frames based on the coding tree unit parameters and the preset ratio are different).
[0094] For example, assuming N=4, the CTU is 256, the scale indicated by the CTU is 256*256, and the predictive coding parameters include the maximum inter-frame transform parameter and the maximum intra-frame prediction parameter of the video frame. The preset ratio corresponding to the key frame is 1 / 4, and the preset ratio corresponding to the non-key frame is 1 / 2. Then, the maximum intra-frame prediction parameter of the key frame is 256*1 / 4=64, and the scale indicated by the maximum intra-frame prediction parameter of the key frame is: 64*64; the maximum intra-frame prediction parameter of the non-key frame is 256*1 / 2=128, and the scale indicated by the maximum intra-frame prediction parameter of the non-key frame is: 128*128, and the maximum inter-frame transform parameter of the non-key frame is: 256*1 / 2=128, and the scale indicated by the maximum inter-frame transform parameter of the non-key frame is: 128*128. After obtaining the predictive coding parameters of the video frame, the computer device encodes the encoded data of the video frame based on the scale of the target block and the predictive coding parameters of the video frame to obtain the code stream data of the video frame.
[0095] In another embodiment, the scale parameter includes a maximum intra-frame prediction parameter, the video frame is a non-keyframe, and the target block is a coding unit. A computer device encodes the video frame based on the scale and scale parameter of the target block to obtain bitstream data for the video frame, including: if the scale of the target block is greater than the scale indicated by the maximum intra-frame prediction parameter, the computer device determines that the prediction coding mode of the target block is non-intra-frame prediction (such as inter-frame prediction), or uses a first context model to encode the target block. It is understood that when the prediction coding mode only includes intra-frame prediction and inter-frame prediction, the computer device can directly determine that the prediction coding mode of the target block is inter-frame prediction. The first context model is specifically used to encode coding units in non-keyframes whose scale is greater than the scale indicated by the maximum intra-frame prediction parameter. It should be noted that when the target block meets the conditions, encoding the target block using the dedicated first context model can further improve the prediction accuracy of the target block and reduce the coding complexity.
[0096] For example, assuming that the video frame is a non-key frame, the target block is a coding unit, the scale of the target block is 256*256, the maximum intra-frame prediction parameter is 128, and the scale indicated by the maximum intra-frame prediction parameter is 128*128, the computer device determines that the prediction coding mode of the target block is non-intra-frame prediction, or uses the first context model to encode the target block.
[0097] In another embodiment, the scale parameter includes a maximum inter-frame transformation parameter, the video frame is a non-key frame, and the target block is a block to be divided. The computer device encodes the video frame based on the scale and scale parameter of the target block, and the process of obtaining the code stream data of the video frame includes: if the height of the target block is greater than the height indicated by the maximum inter-frame transformation parameter, and the width of the target block is less than or equal to the width indicated by the maximum inter-frame transformation parameter, the computer device performs horizontal binary division on the target block, or adopts the second context model to encode the target block. If the height of the target block is less than or equal to the height indicated by the maximum inter-frame transformation parameter, and the width of the target block is greater than the width indicated by the maximum inter-frame transformation parameter, the computer device performs vertical binary division on the target block, or adopts the third context model to encode the target block. The second context model is specifically used to encode the blocks to be divided whose height is greater than the height indicated by the maximum inter-frame transform parameter and whose width is less than or equal to the width indicated by the maximum inter-frame transform parameter; the third context model is specifically used to encode the blocks to be divided whose height is less than the height indicated by the maximum inter-frame transform parameter and whose width is greater than the width indicated by the maximum inter-frame transform parameter. It should be noted that when the target block meets the conditions, encoding the target block using the dedicated second context model or the third context model can further improve the prediction accuracy of the target block and reduce the encoding complexity.
[0098] For example, assume that the target block is the block to be divided, the video frame is a non-key frame, the scale (width * height) of the target block is 256*128, the maximum inter-frame transformation parameter is 128, and the scale (width * height) indicated by the maximum inter-frame transformation parameter is 128*128, that is, the width of the target block is greater than the width indicated by the maximum inter-frame transformation parameter, and the height of the target block is less than or equal to the height indicated by the maximum inter-frame transformation parameter. The computer device performs vertical binary division processing on the target block, or uses the third context model to encode the target block.
[0099] In another embodiment, the scale parameter includes a maximum inter-frame transform parameter, the target block is a coding unit, and the prediction coding mode of the coding unit is inter-frame prediction. The computer device encodes the video frame based on the scale and scale parameter of the target block to obtain the code stream data of the video frame. The process includes: if the scale of the target block is greater than the scale indicated by the maximum inter-frame transform parameter, the computer device determines that there is no residual in the target block, or adopts the fourth context model to encode the target block. In this case, the computer device can configure the residual flag of the target block to be empty (or not configure the residual flag of the target block). The fourth context model is specifically used to encode the coding unit in the video frame whose prediction coding mode is inter-frame prediction and whose scale is greater than the scale indicated by the maximum inter-frame transform parameter. It should be noted that when the target block meets the conditions, encoding the target block through the dedicated fourth context model can further improve the prediction accuracy of the target block and reduce the encoding complexity.
[0100] For example, assuming that the target block is a coding unit, the prediction coding mode of the coding unit is inter-frame prediction, the scale of the target block is 256*256, the maximum inter-frame transformation parameter is 128, and the scale indicated by the maximum inter-frame transformation parameter is 128*128, then the computer device determines that there is no residual in the target block, or uses the fourth context model to encode the target block.
[0101] In another embodiment, the scale parameter includes a maximum intra-frame prediction parameter, and the video frame is a key frame. The computer device encodes the video frame based on the scale and scale parameter of the target block, and the process of obtaining the code stream data of the video frame includes: if the scale of the target block is greater than the scale indicated by the maximum intra-frame prediction parameter, the computer device divides the target block, or adopts the fifth context model to encode the target block; wherein the division method includes at least one of binary division and quadrilateral division. The fifth context model is specifically used to encode blocks in the key frame whose scale is greater than the scale indicated by the maximum inter-frame transform parameter. It should be noted that when the target block meets the conditions, encoding the target block through the dedicated fifth context model can further improve the prediction accuracy of the target block and reduce the encoding complexity.
[0102] For example, assuming that the video frame is a key frame, the scale of the target block is 256*256, the maximum intra-frame prediction parameter is 128 (or 64), and the scale indicated by the maximum intra-frame prediction parameter is 128*128 (or 64*64), the computer device continues to divide the target block until the scale of the target block is no larger than the scale indicated by the maximum intra-frame prediction parameter, or the fifth context model is used to encode the target block.
[0103] In another embodiment, the target block is a right boundary block or a bottom boundary block of a video frame. The computer device encodes the video frame based on the aspect ratio of the target block to obtain bitstream data for the video frame. The right boundary block refers to a block at the right boundary of the video frame, and the bottom boundary block refers to a block at the bottom boundary of the video frame. For details, see Figure 3.
[0104] In one embodiment, the target block is the right boundary block of the video frame, and the computer device encodes the video frame based on the scale of the target block. The process of obtaining the code stream data of the video frame includes: if the ratio of the height to the width of the target block is less than the first ratio threshold, the computer device performs vertical binary division on the target block, or adopts the sixth context model to encode the target block; correspondingly, if the ratio of the height to the width of the target block is greater than or equal to the first ratio threshold, the computer device performs horizontal binary division on the target block, or adopts the seventh context model to encode the target block. The first ratio threshold can be 2 M , M is a positive integer. The sixth context model is specifically used to encode the right boundary block in the video frame whose height-to-width ratio is less than the first ratio threshold, and the seventh context model is specifically used to encode the right boundary block in the video frame whose height-to-width ratio is greater than or equal to the first ratio threshold. It should be noted that when the target block meets the conditions, encoding the target block through the dedicated sixth context model or seventh context model can further improve the prediction accuracy of the target block and reduce the encoding complexity.
[0105] For example, assuming that the first ratio threshold is 8, the target block is the right boundary block of the video frame, and the scale (height*width) of the target block is 128*64, then the ratio of the height to the width of the target block is 128 / 64=2<8, and the computer device performs vertical binary division processing on the target block, or uses the sixth context model to encode the target block.
[0106] In another embodiment, the target block is the lower boundary block of the video frame, and the computer device encodes the video frame based on the scale of the target block, and the process of obtaining the code stream data of the video frame includes: if the ratio of the width to the height of the target block is less than the second ratio threshold, the computer device performs horizontal binary division processing on the target block, or adopts the eighth context model to encode the target block; correspondingly, if the ratio of the width to the height of the target block is greater than or equal to the second ratio threshold, the computer device performs vertical binary division processing on the target block, or adopts the ninth context model to encode the target block. The second ratio threshold can be 2 M, M is a positive integer. The first ratio threshold and the second ratio threshold may be the same or different. The eighth context model is specifically used to encode the lower boundary block in the video frame whose ratio of width to height is less than the second ratio threshold, and the ninth context model is specifically used to encode the lower boundary block in the video frame whose ratio of width to height is greater than or equal to the second ratio threshold. It should be noted that when the target block meets the conditions, encoding the target block through the dedicated eighth context model or the ninth context model can further improve the prediction accuracy of the target block and reduce the encoding complexity.
[0107] For example, assuming that the second ratio threshold is 8, the target block is the lower boundary block of the video frame, and the scale (width * height) of the target block is 128*16, then the ratio of the width to the height of the target block is 128 / 16=8≥8, and the computer device performs vertical binary division processing on the target block, or uses the ninth context model to encode the target block.
[0108] In another embodiment, the target block is a basic coding unit in a video frame, and the encoding process of the video frame involves calculating high-frequency coefficients and low-frequency coefficients for each basic coding unit. The high-frequency coefficients are coefficients of the high-frequency portion (frequency greater than a frequency threshold) obtained by discrete sine and cosine transforms, wavelet transforms, or other transformations of a signal or image, and the low-frequency coefficients are coefficients of the low-frequency portion (frequency less than or equal to the frequency threshold) obtained by wavelet decomposition or other transformations of the signal or image. A computer device encodes the video frame based on the scale and scale parameters of the target block to obtain bitstream data for the video frame, including: setting high-frequency coefficients greater than the high-frequency coefficient threshold to a preset value (e.g., 0); for example, if the high-frequency coefficient threshold is 32 and the transform coefficient matrix is 64*64, the computer device may set the coefficients in columns 32-63 and rows 32-63 of the transform coefficient matrix to 0 (i.e., only coefficients with rows 0-31 and columns 0-31 in the transform coefficient matrix are retained). It should be noted that in the process of calculating the transformation coefficients, skipping the calculation of high-frequency coefficients greater than the high-frequency coefficient threshold (i.e., setting the high-frequency coefficients greater than the high-frequency coefficient threshold to a preset value) can reduce the encoding complexity of the encoding device (computer device) and has less impact on the image quality of the video frame.
[0109] In an embodiment of the present application, a video frame to be encoded is obtained, and based on the scale of a target block, the video frame is encoded to obtain code stream data of the video frame. The target block is obtained by dividing the video frame, and the scale of the target block is used to determine the codec information of the target block. It can be seen that during the encoding process, the codec information of the target block (such as the division method of the target block and whether there is a residual) is determined by the scale of the target block, which can optimize the encoding process of the video frame (such as eliminating the need to configure the division flag of the target block), reduce the encoding complexity, and thus improve the trade-off ratio between codec performance and complexity during the encoding and decoding process of the video frame.
[0110] The above describes in detail the method of the embodiment of the present application. In order to facilitate better implementation of the above scheme of the embodiment of the present application, the device of the embodiment of the present application is provided below accordingly.
[0111] Please refer to Figure 5, which is a schematic diagram of the structure of an image processing device provided in an embodiment of the present application. The image processing device shown in Figure 5 can be installed in a computer device, which can specifically be the terminal device 101 shown in Figure 1d. The image processing device shown in Figure 5 can be used to perform some or all of the functions of the method embodiment described in Figure 2 above. Referring to Figure 5, the image processing device includes:
[0112] An acquisition unit 501 is configured to acquire code stream data of a video frame, where the code stream data includes coded data of the video frame;
[0113] The processing unit 502 is configured to decode the coded data of the video frame based on the scale of the target block and present the video frame. The target block is obtained by dividing the video frame, and the scale of the target block is used to determine the coding and decoding information of the target block.
[0114] In one embodiment, the processing unit 502 is configured to decode the encoded data of the video frame based on the scale of the target block, specifically to:
[0115] Decoding the encoded data of the video frame based on the scale and scale parameter of the target block;
[0116] The scale parameter is used to optimize the encoding and decoding process of the target block. The scale parameter is a default value or is carried in the bitstream data. The scale parameter includes at least one of the following: a coding tree unit parameter, a maximum inter-frame transform parameter, and a maximum intra-frame prediction parameter.
[0117] In one embodiment, the scale parameter includes a coding tree unit parameter corresponding to the video frame, and the coded data of the video frame is derived based on the coding tree unit parameter. The processing unit 502 is configured to decode the coded data of the video frame based on the scale of the target block and the scale parameter, specifically to:
[0118] Determining the predictive coding parameters of the video frame by using the coding tree unit parameters and the preset ratio;
[0119] Decoding the encoded data of the video frame based on the scale of the target block and the predictive encoding parameters of the video frame;
[0120] The prediction coding parameters include at least one of a maximum inter-frame transform parameter of a video frame and a maximum intra-frame prediction parameter of a video frame.
[0121] In one embodiment, the scale parameter includes a maximum intra-frame prediction parameter, the video frame is a non-key frame, and the target block is a coding unit; the processing unit 502 decodes the coded data of the video frame based on the scale and scale parameter of the target block, including:
[0122] If the scale of the target block is greater than the scale indicated by the maximum intra prediction parameter, the prediction coding mode of the target block is determined to be non-intra prediction, or the first context model is used to decode the target block.
[0123] In one embodiment, the scale parameter includes a maximum inter-frame transform parameter, the video frame is a non-key frame, and the target block is a block to be divided; the processing unit 502 decodes the encoded data of the video frame based on the scale and scale parameter of the target block, including:
[0124] If the height of the target block is greater than the height indicated by the maximum inter-frame transform parameter, and the width of the target block is less than or equal to the width indicated by the maximum inter-frame transform parameter, performing horizontal binary splitting on the target block, or decoding the target block using the second context model;
[0125] If the height of the target block is less than or equal to the height indicated by the maximum inter-frame transformation parameter, and the width of the target block is greater than the width indicated by the maximum inter-frame transformation parameter, the target block is vertically binary divided, or the target block is decoded using the third context model.
[0126] In one embodiment, the scale parameter includes a maximum inter-frame transform parameter, the target block is a coding unit, and the prediction coding mode of the coding unit is inter-frame prediction; the processing unit 502 decodes the encoded data of the video frame based on the scale of the target block and the scale parameter, including:
[0127] If the scale of the target block is greater than the scale indicated by the maximum inter-frame transform parameter, it is determined that no residual exists in the target block, or the fourth context model is used to perform decoding processing on the target block.
[0128] In one embodiment, the scale parameter includes a maximum intra-frame prediction parameter, and the video frame is a key frame; the processing unit 502 decodes the encoded data of the video frame based on the scale of the target block and the scale parameter, including:
[0129] If the scale of the target block is larger than the scale indicated by the maximum intra prediction parameter, quadripartition processing is performed on the target block, or the fifth context model is used to decode the target block.
[0130] In one embodiment, the code stream data includes at least one video sequence of the video to which the video frame belongs, each video sequence includes encoded data of at least one video frame, and the encoded data of any video frame includes an image header of the video frame;
[0131] The scale parameter of the video frame is carried in the sequence header of the video sequence to which the video frame belongs, or in the image header of the video frame;
[0132] The video includes key frames and non-key frames, and the scale parameters of the key frames and non-key frames are different.
[0133] In one embodiment, the target block is a right boundary block of a video frame. The processing unit 502 decodes the encoded data of the video frame based on the scale of the target block, including:
[0134] If the ratio of the height to the width of the target block is less than the first ratio threshold, vertical binary partitioning is performed on the target block, or a sixth context model is used to decode the target block;
[0135] If the ratio of the height to the width of the target block is greater than or equal to the first ratio threshold, horizontal binary partitioning is performed on the target block, or the target block is decoded using the seventh context model.
[0136] In one embodiment, the target block is a lower boundary block of a video frame. The process of the processing unit 502 decoding the encoded data of the video frame based on the attribute information of the target block includes:
[0137] If the ratio of the width to the height of the target block is less than the second ratio threshold, performing horizontal binary splitting on the target block, or decoding the target block using the eighth context model;
[0138] If the ratio of the width to the height of the target block is greater than or equal to the second ratio threshold, the target block is vertically binary divided, or the target block is decoded using the ninth context model.
[0139] According to one embodiment of the present application, some of the steps involved in the image processing method shown in Figure 2 can be performed by the various units in the image processing device shown in Figure 5. For example, step S201 shown in Figure 2 can be performed by the acquisition unit 501 shown in Figure 5, and step S202 can be performed by the processing unit 502 shown in Figure 5. The various units in the image processing device shown in Figure 5 can be individually or completely merged into one or several other units to form a structure, or one (or some) of the units can be further divided into multiple functionally smaller units to form a structure, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In actual applications, the functions of one unit can also be implemented by multiple units, or the functions of multiple units can be implemented by one unit. In other embodiments of the present application, the image processing device may also include other units. In actual applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.
[0140] According to another embodiment of the present application, an image processing device as shown in FIG5 can be constructed, and the image processing method of the embodiment of the present application can be implemented, by running a computer program (including program code) capable of executing each step involved in the corresponding method as shown in FIG2 on a general-purpose computing device, such as a computer device, including processing elements and storage elements such as a central processing unit (CPU), a random access memory (RAM), and a read-only memory (ROM). The computer program can be recorded on a computer-readable recording medium, for example, and loaded into the computing device via the computer-readable recording medium and executed therein.
[0141] Based on the same inventive concept, the principles and beneficial effects of solving the problems by the image processing device provided in the embodiment of the present application are similar to the principles and beneficial effects of solving the problems by the image processing method in the method embodiment of the present application. Please refer to the principles and beneficial effects of the implementation of the method. For the sake of concise description, they will not be repeated here.
[0142] Please refer to Figure 6, which is a schematic diagram of the structure of another image processing device provided in an embodiment of the present application. The image processing device shown in Figure 6 can be installed in a computer device, which can specifically be the server 102 shown in Figure 1d. The image processing device shown in Figure 6 can be used to perform some or all of the functions of the method embodiment described in Figure 4 above. Referring to Figure 6, the image processing device includes:
[0143] An acquisition unit 601 is configured to acquire a video frame to be encoded;
[0144] The processing unit 602 is configured to encode the video frame based on the scale of the target block to obtain code stream data of the video frame; the target block is obtained by dividing the video frame, and the scale of the target block is used to determine the encoding and decoding information of the target block.
[0145] In one embodiment, the processing unit 602 is configured to encode the video frame based on the scale of the target block to obtain bitstream data of the video frame, specifically to:
[0146] Obtaining a scale parameter of a video frame. The scale parameter is used to optimize the encoding and decoding process of a target block. The scale parameter is a default value or is configured based on the video frame. The scale parameter includes at least one of the following: a coding tree unit parameter, a maximum inter-frame transform parameter, and a maximum intra-frame prediction parameter.
[0147] Based on the scale and scale parameter of the target block, the video frame is encoded to obtain code stream data of the video frame.
[0148] In one embodiment, the scale parameter includes a coding tree unit parameter corresponding to the video frame, and the coding tree unit parameter is used to derive the coded data of the video. The process of the processing unit 602 encoding the video frame based on the scale of the target block and the scale parameter includes:
[0149] Determining predictive coding parameters of the video frame based on the coding tree unit parameters and the preset ratio;
[0150] The prediction coding parameters include at least one of a maximum inter-frame transform parameter of a video frame and a maximum intra-frame prediction parameter of a video frame.
[0151] In one embodiment, the scale parameter includes a maximum intra-frame prediction parameter, the video frame is a non-key frame, and the target block is a coding unit; the processing unit 602 encodes the video frame based on the scale and scale parameter of the target block to obtain bitstream data of the video frame, including:
[0152] If the scale of the target block is greater than the scale indicated by the maximum intra prediction parameter, the prediction coding mode of the target block is determined to be non-intra prediction, or the target block is coded using the first context model.
[0153] In one embodiment, the scale parameter includes a maximum inter-frame transform parameter, the video frame is a non-key frame, and the target block is a block to be divided. The processing unit 602 encodes the video frame based on the scale and scale parameter of the target block to obtain bitstream data of the video frame, including:
[0154] If the height of the target block is greater than the height indicated by the maximum inter-frame transform parameter, and the width of the target block is less than or equal to the width indicated by the maximum inter-frame transform parameter, performing horizontal binary splitting on the target block, or encoding the target block using the second context model;
[0155] If the height of the target block is less than or equal to the height indicated by the maximum inter-frame transformation parameter, and the width of the target block is greater than the width indicated by the maximum inter-frame transformation parameter, the target block is vertically binary divided, or the target block is encoded using the third context model.
[0156] In one embodiment, the scale parameter includes a maximum inter-frame transform parameter, the target block is a coding unit, and the prediction coding mode of the coding unit is inter-frame prediction; the processing unit 602 encodes the video frame based on the scale of the target block and the scale parameter to obtain the bitstream data of the video frame, including:
[0157] If the scale of the target block is greater than the scale indicated by the maximum inter-frame transform parameter, it is determined that no residual exists in the target block, or the fourth context model is used to encode the target block.
[0158] In one embodiment, the scale parameter includes a maximum intra-frame prediction parameter, and the video frame is a key frame. The processing unit 602 encodes the video frame based on the scale of the target block and the scale parameter to obtain bitstream data of the video frame. The process includes:
[0159] If the scale of the target block is larger than the scale indicated by the maximum intra prediction parameter, the target block is divided, or the target block is encoded using the fifth context model; wherein the division method includes at least one of binary division and quadrilateral division.
[0160] In one embodiment, the scale parameter is configured based on the video frame; the processing unit 602 encodes the video frame based on the scale of the target block and the scale parameter to obtain the bitstream data of the video frame, including:
[0161] configuring a sequence header of a video sequence to which the video frame belongs based on the scale parameter, or adding the scale parameter to an image header of the video frame;
[0162] The video includes key frames and non-key frames, and the scale parameters of the key frames and non-key frames are different.
[0163] In one embodiment, the target block is a right boundary block of a video frame. The processing unit 602 encodes the video frame based on the scale of the target block to obtain bitstream data of the video frame, including:
[0164] If the ratio of the height to the width of the target block is less than the first ratio threshold, vertical binary partitioning is performed on the target block, or the target block is encoded using a sixth context model;
[0165] If the ratio of the height to the width of the target block is greater than or equal to the first ratio threshold, the target block is horizontally binary split, or the target block is encoded using the seventh context model.
[0166] In one embodiment, the target block is a lower boundary block of a video frame. The processing unit 602 encodes the video frame based on the scale of the target block to obtain bitstream data of the video frame. The process includes:
[0167] If the ratio of the width to the height of the target block is less than the second ratio threshold, performing horizontal binary splitting on the target block, or encoding the target block using the eighth context model;
[0168] If the ratio of the width to the height of the target block is greater than or equal to the second ratio threshold, the target block is vertically binary divided, or the target block is encoded using the ninth context model.
[0169] In one embodiment, the processing unit 602 encodes the video frame based on the scale of the target block to obtain the bitstream data of the video frame, including:
[0170] The high frequency coefficients greater than the high frequency coefficient threshold are set to a preset value.
[0171] According to one embodiment of the present application, some of the steps involved in the image processing method shown in Figure 4 can be performed by the various units in the image processing device shown in Figure 6. For example, step S401 shown in Figure 4 can be performed by the acquisition unit 601 shown in Figure 6, and step S402 can be performed by the processing unit 602 shown in Figure 6. The various units in the image processing device shown in Figure 6 can be individually or completely merged into one or several other units to form a composition, or one (some) of the units can be further divided into multiple functionally smaller units to form a composition, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In actual applications, the functions of one unit can also be implemented by multiple units, or the functions of multiple units can be implemented by one unit. In other embodiments of the present application, the image processing device may also include other units. In actual applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.
[0172] According to another embodiment of the present application, an image processing device as shown in FIG6 can be constructed, and the image processing method of the embodiment of the present application can be implemented, by running a computer program (including program code) capable of executing each step involved in the corresponding method as shown in FIG4 on a general-purpose computing device, such as a computer device, including processing elements and storage elements such as a central processing unit (CPU), a random access memory (RAM), and a read-only memory (ROM). The computer program can be recorded on a computer-readable recording medium, for example, and loaded into the computing device via the computer-readable recording medium and executed therein.
[0173] Based on the same inventive concept, the principles and beneficial effects of solving the problems by the image processing device provided in the embodiment of the present application are similar to the principles and beneficial effects of solving the problems by the image processing method in the method embodiment of the present application. Please refer to the principles and beneficial effects of the implementation of the method. For the sake of concise description, they will not be repeated here.
[0174] Please refer to Figure 7, which is a structural diagram of a computer device provided in an embodiment of the present application. The computer device can be a terminal device or a server. As shown in Figure 7, the computer device includes at least a processor 701, a communication interface 702 and a memory 703. Among them, the processor 701, the communication interface 702 and the memory 703 can be connected via a bus or other means. Among them, the processor 701 (or central processing unit (CPU)) is the computing core and control core of the computer device. It can parse various instructions within the computer device and process various data of the computer device. For example, the CPU can be used to parse the power on and off instructions issued by the object to the computer device and control the computer device to perform power on and off operations; for example, the CPU can transmit various interactive data between the internal structures of the computer device, etc. The communication interface 702 can optionally include a standard wired interface, a wireless interface (such as WI-FI, a mobile communication interface, etc.), which can be used to send and receive data under the control of the processor 701; the communication interface 702 can also be used for the transmission and interaction of data within the computer device. The memory 703 (Memory) is a memory device in the computer device for storing programs and data. It is understood that the memory 703 herein may include both the built-in memory of the computer device and, of course, the extended memory supported by the computer device. The memory 703 provides storage space for storing the operating system of the computer device, which may include, but is not limited to, Android, iOS, Windows Phone, etc., and this application does not limit this.
[0175] The embodiment of the present application also provides a computer-readable storage medium (Memory), which is a memory device in a computer device for storing programs and data. It is understandable that the computer-readable storage medium here can include both built-in storage media in the computer device and, of course, extended storage media supported by the computer device. The computer-readable storage medium provides a storage space that stores the processing system of the computer device. In addition, a computer program suitable for being loaded and executed by the processor 701 is also stored in the storage space. It should be noted that the computer-readable storage medium here can be a high-speed RAM memory or a non-volatile memory, such as at least one disk storage; optionally, it can also be at least one computer-readable storage medium located away from the aforementioned processor.
[0176] In one embodiment, the computer device is a decoding device, and the processor 701 performs the following operations by running the computer program in the memory 703:
[0177] Obtaining code stream data of a video frame, where the code stream data includes encoded data of the video frame;
[0178] Based on the scale of the target block, the encoded data of the video frame is decoded and the video frame is presented; the target block is obtained by dividing the video frame, and the scale of the target block is used to determine the encoding and decoding information of the target block.
[0179] As an optional embodiment, the specific embodiment of the processor 701 decoding the encoded data of the video frame based on the scale of the target block is as follows:
[0180] Decoding the encoded data of the video frame based on the scale and scale parameter of the target block;
[0181] The scale parameter is used to optimize the encoding and decoding process of the target block. The scale parameter is a default value or is carried in the bitstream data. The scale parameter includes at least one of the following: a coding tree unit parameter, a maximum inter-frame transform parameter, and a maximum intra-frame prediction parameter.
[0182] As an optional embodiment, the scale parameter includes a coding tree unit parameter corresponding to the video frame, and the coded data of the video frame is derived based on the coding tree unit parameter. A specific embodiment of the processor 701 decoding the coded data of the video frame based on the scale of the target block and the scale parameter is as follows:
[0183] Determining the predictive coding parameters of the video frame by using the coding tree unit parameters and the preset ratio;
[0184] Decoding the encoded data of the video frame based on the scale of the target block and the predictive encoding parameters of the video frame;
[0185] The prediction coding parameters include at least one of a maximum inter-frame transform parameter of a video frame and a maximum intra-frame prediction parameter of a video frame.
[0186] As an optional embodiment, the scale parameter includes a maximum intra-frame prediction parameter, the video frame is a non-key frame, and the target block is a coding unit; the processor 701 decodes the encoded data of the video frame based on the scale and scale parameter of the target block, including:
[0187] If the scale of the target block is greater than the scale indicated by the maximum intra prediction parameter, the prediction coding mode of the target block is determined to be non-intra prediction, or the first context model is used to decode the target block.
[0188] As an optional embodiment, the scale parameter includes a maximum inter-frame transform parameter, the video frame is a non-key frame, and the target block is a block to be divided; the process in which the processor 701 decodes the encoded data of the video frame based on the scale and scale parameter of the target block includes:
[0189] If the height of the target block is greater than the height indicated by the maximum inter-frame transform parameter, and the width of the target block is less than or equal to the width indicated by the maximum inter-frame transform parameter, performing horizontal binary splitting on the target block, or decoding the target block using the second context model;
[0190] If the height of the target block is less than or equal to the height indicated by the maximum inter-frame transformation parameter, and the width of the target block is greater than the width indicated by the maximum inter-frame transformation parameter, the target block is vertically binary divided, or the target block is decoded using the third context model.
[0191] As an optional embodiment, the scale parameter includes a maximum inter-frame transform parameter, the target block is a coding unit, and the prediction coding mode of the coding unit is inter-frame prediction; the processor 701 decodes the encoded data of the video frame based on the scale of the target block and the scale parameter, including:
[0192] If the scale of the target block is greater than the scale indicated by the maximum inter-frame transform parameter, it is determined that no residual exists in the target block, or the fourth context model is used to perform decoding processing on the target block.
[0193] As an optional embodiment, the scale parameter includes a maximum intra-frame prediction parameter, and the video frame is a key frame; the processor 701 decodes the encoded data of the video frame based on the scale of the target block and the scale parameter, including:
[0194] If the scale of the target block is larger than the scale indicated by the maximum intra prediction parameter, quadripartition processing is performed on the target block, or the fifth context model is used to decode the target block.
[0195] As an optional embodiment, the code stream data includes at least one video sequence of the video to which the video frame belongs, each video sequence includes encoded data of at least one video frame, and the encoded data of any video frame includes an image header of the video frame;
[0196] The scale parameter of the video frame is carried in the sequence header of the video sequence to which the video frame belongs, or in the image header of the video frame;
[0197] The video includes key frames and non-key frames, and the scale parameters of the key frames and non-key frames are different.
[0198] As an optional embodiment, the target block is a right boundary block of a video frame. The processor 701 decodes the encoded data of the video frame based on the scale of the target block, including:
[0199] If the ratio of the height to the width of the target block is less than the first ratio threshold, vertical binary partitioning is performed on the target block, or a sixth context model is used to decode the target block;
[0200] If the ratio of the height to the width of the target block is greater than or equal to the first ratio threshold, horizontal binary partitioning is performed on the target block, or the target block is decoded using the seventh context model.
[0201] As an optional embodiment, the target block is a lower boundary block of a video frame. The processor 701 decodes the encoded data of the video frame based on the attribute information of the target block, including:
[0202] If the ratio of the width to the height of the target block is less than the second ratio threshold, performing horizontal binary splitting on the target block, or decoding the target block using the eighth context model;
[0203] If the ratio of the width to the height of the target block is greater than or equal to the second ratio threshold, the target block is vertically binary divided, or the target block is decoded using the ninth context model.
[0204] In one embodiment, the computer device is a coding device, and the processor 701 executes the following operations by running the computer program in the memory 703:
[0205] Get the video frame to be encoded;
[0206] Based on the scale of the target block, the video frame is encoded to obtain the code stream data of the video frame; the target block is obtained by dividing the video frame, and the scale of the target block is used to determine the encoding and decoding information of the target block.
[0207] As an optional embodiment, the processor 701 encodes the video frame based on the scale of the target block to obtain the bit stream data of the video frame. A specific embodiment is as follows:
[0208] Obtaining a scale parameter of a video frame. The scale parameter is used to optimize the encoding and decoding process of a target block. The scale parameter is a default value or is configured based on the video frame. The scale parameter includes at least one of the following: a coding tree unit parameter, a maximum inter-frame transform parameter, and a maximum intra-frame prediction parameter.
[0209] Based on the scale and scale parameter of the target block, the video frame is encoded to obtain code stream data of the video frame.
[0210] As an optional embodiment, the scale parameter includes a coding tree unit parameter corresponding to the video frame, and the coding tree unit parameter is used to derive the encoded data of the video. The process of the processor 701 encoding the video frame based on the scale of the target block and the scale parameter includes:
[0211] Determining predictive coding parameters of the video frame based on the coding tree unit parameters and the preset ratio;
[0212] The prediction coding parameters include at least one of a maximum inter-frame transform parameter of a video frame and a maximum intra-frame prediction parameter of a video frame.
[0213] As an optional embodiment, the scale parameter includes a maximum intra-frame prediction parameter, the video frame is a non-key frame, and the target block is a coding unit; the processor 701 encodes the video frame based on the scale and scale parameter of the target block to obtain bitstream data of the video frame, including:
[0214] If the scale of the target block is greater than the scale indicated by the maximum intra prediction parameter, the prediction coding mode of the target block is determined to be non-intra prediction, or the target block is coded using the first context model.
[0215] As an optional embodiment, the scale parameter includes a maximum inter-frame transform parameter, the video frame is a non-key frame, and the target block is a block to be divided; the processor 701 encodes the video frame based on the scale and scale parameter of the target block to obtain bitstream data of the video frame, including:
[0216] If the height of the target block is greater than the height indicated by the maximum inter-frame transform parameter, and the width of the target block is less than or equal to the width indicated by the maximum inter-frame transform parameter, performing horizontal binary splitting on the target block, or encoding the target block using the second context model;
[0217] If the height of the target block is less than or equal to the height indicated by the maximum inter-frame transformation parameter, and the width of the target block is greater than the width indicated by the maximum inter-frame transformation parameter, the target block is vertically binary divided, or the target block is encoded using the third context model.
[0218] As an optional embodiment, the scale parameter includes a maximum inter-frame transform parameter, the target block is a coding unit, and the prediction coding mode of the coding unit is inter-frame prediction; the processor 701 encodes the video frame based on the scale of the target block and the scale parameter to obtain the bitstream data of the video frame, including:
[0219] If the scale of the target block is greater than the scale indicated by the maximum inter-frame transform parameter, it is determined that no residual exists in the target block, or the fourth context model is used to encode the target block.
[0220] As an optional embodiment, the scale parameter includes a maximum intra-frame prediction parameter, and the video frame is a key frame; the processor 701 encodes the video frame based on the scale of the target block and the scale parameter, and the process of obtaining the bitstream data of the video frame includes:
[0221] If the scale of the target block is larger than the scale indicated by the maximum intra prediction parameter, the target block is divided, or the target block is encoded using the fifth context model; wherein the division method includes at least one of binary division and quadrilateral division.
[0222] As an optional embodiment, the scale parameter is configured based on the video frame; the processor 701 encodes the video frame based on the scale of the target block and the scale parameter to obtain the bitstream data of the video frame, including:
[0223] configuring a sequence header of a video sequence to which the video frame belongs based on the scale parameter, or adding the scale parameter to an image header of the video frame;
[0224] The video includes key frames and non-key frames, and the scale parameters of the key frames and non-key frames are different.
[0225] As an optional embodiment, the target block is a right boundary block of a video frame. The processor 701 encodes the video frame based on the scale of the target block to obtain the bitstream data of the video frame. The process includes:
[0226] If the ratio of the height to the width of the target block is less than the first ratio threshold, vertical binary partitioning is performed on the target block, or the target block is encoded using a sixth context model;
[0227] If the ratio of the height to the width of the target block is greater than or equal to the first ratio threshold, the target block is horizontally binary split, or the target block is encoded using the seventh context model.
[0228] As an optional embodiment, the target block is a lower boundary block of a video frame. The processor 701 encodes the video frame based on the scale of the target block to obtain the bitstream data of the video frame. The process includes:
[0229] If the ratio of the width to the height of the target block is less than the second ratio threshold, performing horizontal binary splitting on the target block, or encoding the target block using the eighth context model;
[0230] If the ratio of the width to the height of the target block is greater than or equal to the second ratio threshold, the target block is vertically binary divided, or the target block is encoded using the ninth context model.
[0231] As an optional embodiment, the processor 701 encodes the video frame based on the scale of the target block to obtain the bit stream data of the video frame, including:
[0232] The high frequency coefficients greater than the high frequency coefficient threshold are set to a preset value.
[0233] Based on the same inventive concept, the principles and beneficial effects of solving the problems provided by the computer device in the embodiment of the present application are similar to the principles and beneficial effects of solving the problems provided by the image processing method in the method embodiment of the present application. Please refer to the principles and beneficial effects of the implementation of the method. For the sake of concise description, they will not be repeated here.
[0234] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. The computer program is suitable for being loaded by a processor and executing the image processing method of the above method embodiment.
[0235] The present application also provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the above-described image processing method.
[0236] The steps in the method of the embodiment of the present application can be adjusted in order, combined and deleted according to actual needs.
[0237] The modules in the device of the embodiment of the present application can be merged, divided and deleted according to actual needs.
[0238] In the embodiments of the present application, the "module" or "unit" involved refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0239] A person skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium, which can include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0240] The above disclosure is only a preferred embodiment of the present application, and certainly cannot be used to limit the scope of rights of the present application. Ordinary technicians in this field can understand that all or part of the processes of the above embodiment and equivalent changes made in accordance with the claims of this application are still within the scope covered by the application.
Claims
1. An image processing method, characterized in that: The method comprises: Acquire code stream data of a video frame, wherein the code stream data includes encoded data of the video frame; Based on the scale of the target block, the encoded data of the video frame is decoded and the video frame is presented; the target block is obtained by dividing the video frame, and the scale of the target block is used to determine the encoding and decoding information of the target block.
2. The method according to claim 1, wherein The decoding process of the encoded data of the video frame based on the scale of the target block includes: Decoding the encoded data of the video frame based on the scale and scale parameter of the target block; The scale parameter is used to optimize the encoding and decoding process of the target block, and the scale parameter is a default value or is carried in the code stream data; the scale parameter includes at least one of a coding tree unit parameter, a maximum inter-frame transform parameter, and a maximum intra-frame prediction parameter.
3. The method according to claim 2, wherein The scale parameter includes a coding tree unit parameter corresponding to the video frame, and the coded data of the video frame is derived based on the coding tree unit parameter; and decoding the coded data of the video frame based on the scale and scale parameter of the target block includes: Determining predictive coding parameters of the video frame using the coding tree unit parameters and a preset ratio; Decoding the encoded data of the video frame based on the scale of the target block and the predictive encoding parameters of the video frame; The prediction coding parameters include at least one of a maximum inter-frame transform parameter of the video frame and a maximum intra-frame prediction parameter of the video frame.
4. The method according to claim 2, wherein The scale parameter includes a maximum intra-frame prediction parameter, the video frame is a non-key frame, and the target block is a coding unit; and decoding the coded data of the video frame based on the scale and scale parameter of the target block includes: If the scale of the target block is greater than the scale indicated by the maximum intra prediction parameter, the prediction coding mode of the target block is determined to be non-intra prediction, or the target block is decoded using a first context model.
5. The method according to claim 2, wherein The scale parameter includes a maximum inter-frame transform parameter, the video frame is a non-key frame, and the target block is a block to be divided; and decoding the encoded data of the video frame based on the scale and scale parameter of the target block includes: If the height of the target block is greater than the height indicated by the maximum inter-frame transform parameter, and the width of the target block is less than or equal to the width indicated by the maximum inter-frame transform parameter, performing horizontal binary splitting on the target block, or decoding the target block using a second context model; If the height of the target block is less than or equal to the height indicated by the maximum inter-frame transformation parameter, and the width of the target block is greater than the width indicated by the maximum inter-frame transformation parameter, the target block is vertically binary divided, or the target block is decoded using a third context model.
6. The method according to claim 2, wherein The scale parameter includes a maximum inter-frame transform parameter, the target block is a coding unit, and the prediction coding mode of the coding unit is inter-frame prediction; The decoding process of the encoded data of the video frame based on the scale and scale parameter of the target block includes: If the scale of the target block is greater than the scale indicated by the maximum inter-frame transform parameter, it is determined that no residual exists in the target block, or a fourth context model is used to decode the target block.
7. The method according to claim 2, wherein The scale parameter includes a maximum intra-frame prediction parameter, and the video frame is a key frame; and decoding the encoded data of the video frame based on the scale and scale parameter of the target block includes: If the scale of the target block is larger than the scale indicated by the maximum intra prediction parameter, quadripartition processing is performed on the target block, or a fifth context model is used to decode the target block.
8. The method according to claim 2, wherein The code stream data includes at least one video sequence of the video to which the video frame belongs, each video sequence includes the encoded data of at least one video frame, and the encoded data of any video frame includes the image header of the video frame; The scale parameter of the video frame is carried in a sequence header of a video sequence to which the video frame belongs, or in an image header of the video frame; The video includes key frames and non-key frames, and the key frames and the non-key frames have different scale parameters.
9. The method according to claim 1, wherein The target block is a right boundary block of the video frame, and the decoding process of the encoded data of the video frame based on the scale of the target block includes: If the ratio of the height to the width of the target block is less than a first ratio threshold, performing vertical binary partitioning on the target block, or decoding the target block using a sixth context model; If the ratio of the height to the width of the target block is greater than or equal to the first ratio threshold, the target block is horizontally binary split, or the target block is decoded using the seventh context model.
10. The method according to claim 1, wherein The target block is a lower boundary block of the video frame, and the decoding process of the encoded data of the video frame based on the scale of the target block includes: If the ratio of the width to the height of the target block is less than a second ratio threshold, performing horizontal binary splitting processing on the target block, or decoding the target block using an eighth context model; If the ratio of the width to the height of the target block is greater than or equal to the second ratio threshold, the target block is vertically binary divided, or the target block is decoded using a ninth context model.
11. An image processing method, characterized in that: The method comprises: Get the video frame to be encoded; Based on the scale of the target block, the video frame is encoded to obtain code stream data of the video frame; the target block is obtained by dividing the video frame, and the scale of the target block is used to determine the encoding and decoding information of the target block.
12. The method according to claim 11, wherein The encoding process of the video frame based on the scale of the target block to obtain code stream data of the video frame includes: Obtaining a scale parameter of the video frame, where the scale parameter is used to optimize the encoding and decoding process of the target block, the scale parameter being a default value or configured based on the video frame; the scale parameter comprising at least one of a coding tree unit parameter, a maximum inter-frame transform parameter, and a maximum intra-frame prediction parameter; Based on the scale of the target block and the scale parameter, the video frame is coded to obtain code stream data of the video frame.
13. The method according to claim 12, wherein: The scale parameter includes a coding tree unit parameter corresponding to the video frame, the coding tree unit parameter is used to derive coding data of the video, and encoding the video frame based on the scale of the target block and the scale parameter includes: Determining predictive coding parameters of the video frame based on the coding tree unit parameters and a preset ratio; The prediction coding parameters include at least one of a maximum inter-frame transform parameter of the video frame and a maximum intra-frame prediction parameter of the video frame.
14. The method according to claim 12, wherein: The scale parameter includes a maximum intra-frame prediction parameter, the video frame is a non-key frame, and the target block is a coding unit; and encoding the video frame based on the scale of the target block and the scale parameter includes: If the scale of the target block is greater than the scale indicated by the maximum intra-frame prediction parameter, the prediction coding mode of the target block is determined. It is non-intra prediction, or the target block is encoded using the first context model.
15. The method according to claim 12, wherein The scale parameter includes a maximum inter-frame transform parameter, the video frame is a non-key frame, and the target block is a block to be divided; encoding the video frame based on the scale of the target block and the scale parameter, including: If the height of the target block is greater than the height indicated by the maximum inter-frame transform parameter, and the width of the target block is less than or equal to the width indicated by the maximum inter-frame transform parameter, performing horizontal binary splitting on the target block, or encoding the target block using a second context model; If the height of the target block is less than or equal to the height indicated by the maximum inter-frame transformation parameter, and the width of the target block is greater than the width indicated by the maximum inter-frame transformation parameter, the target block is vertically binary divided, or the target block is encoded using a third context model.
16. The method according to claim 12, wherein: The scale parameter includes a maximum inter-frame transform parameter, the target block is a coding unit, and the prediction coding mode of the coding unit is inter-frame prediction; The encoding process of the video frame based on the scale of the target block and the scale parameter includes: If the scale of the target block is greater than the scale indicated by the maximum inter-frame transform parameter, it is determined that no residual exists in the target block, or the target block is encoded using a fourth context model.
17. The method according to claim 12, wherein The scale parameter includes a maximum intra-frame prediction parameter, and the video frame is a key frame; and encoding the video frame based on the scale of the target block and the scale parameter includes: If the scale of the target block is larger than the scale indicated by the maximum intra-frame prediction parameter, the target block is divided, or the target block is encoded using a fifth context model; wherein the division method includes at least one of binary division and quadrilateral division.
18. The method according to claim 11, wherein The encoding process of the video frame based on the scale of the target block includes: The high frequency coefficients greater than the high frequency coefficient threshold are set to a preset value.
19. A computer device, characterized in that: include: a memory storing a computer program; A processor, configured to load the computer program to implement the image processing method according to any one of claims 1 to 10, or configured to load the computer program to implement the image processing method according to any one of claims 11 to 18.
20. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which is suitable for being loaded by a processor and executing the image processing method according to any one of claims 1 to 10, or suitable for being loaded by a processor and executing the image processing method according to any one of claims 11 to 18.