Intra-frame prediction method and device, computer equipment and storage medium
By obtaining the linear relationship between the current reference area and the target reference area in the video frame, the accuracy of intra prediction is improved, the problem of insufficient accuracy of traditional intra prediction methods is solved, and more efficient video encoding is achieved.
Patent Information
- Application Number
- CN202310695161.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-12
- Publication Date
- 2024-12-13
AI Technical Summary
Traditional intra prediction methods have problems with insufficient accuracy in video encoding, especially the method based on template matching cannot effectively remove the redundancy of video frames.
By obtaining the current reference area in the video frame and determining the matching target reference area within the encoded area, the linear parameters are determined based on the linear relationship between the two, and then used to predict the pixel value to be predicted in the current encoded block. .
This improves the prediction accuracy of pixel values, reduces the encoding distortion, and thus improves the efficiency and quality of video encoding.
Smart Images

Figure CN119135929A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of video processing technology, and in particular to an intra-frame prediction method, apparatus, computer equipment, storage medium and computer program product. Background Art
[0002] Videos usually need to be encoded and compressed during transmission to reduce bandwidth consumption. In recent years, with the specification of new generation video coding standards such as H.264, video coding technology has become more and more mature. In current video coding technology, intra-frame prediction and inter-frame prediction are mainly used to remove spatial and temporal redundancy of video frames.
[0003] Traditional intra-frame prediction methods include the Intra Template Matching Prediction (TMP) method. This method searches for the template that is most similar to the current coding block in the video frame and predicts the pixels in the current coding block based on the template. However, this method still has the problem of inaccuracy. Summary of the invention
[0004] Based on this, it is necessary to provide an intra-frame prediction method, apparatus, computer device, computer-readable storage medium and computer program product that can improve accuracy in response to the above technical problems.
[0005] In one aspect, the present application provides an intra-frame prediction method. The method comprises:
[0006] Obtaining a current reference region corresponding to a current coding block in a video frame;
[0007] Determining a target reference region matching the current reference region in the encoded region in the video frame; the target reference region corresponds to a target coding block;
[0008] Determining, based on a first linear relationship between the current reference region and the target reference region, a linear parameter for characterizing a second linear relationship between the current coding block and the target coding block;
[0009] Based on the linear parameters and the pixel values of the reconstructed pixels in the target coding block, a predicted pixel value of the pixel to be predicted in the current coding block is determined.
[0010] On the other hand, the present application also provides an intra-frame prediction device. The device includes:
[0011] An acquisition module, used to acquire a current reference area corresponding to a current coding block in a video frame;
[0012] A determination module, configured to determine, within the encoded region in the video frame, a target reference region that matches the current reference region; the target reference region corresponds to a target coding block;
[0013] The determination module is further configured to determine a linear parameter for characterizing a second linear relationship between the current coding block and the target coding block based on a first linear relationship between the current reference region and the target reference region;
[0014] A prediction module is used to determine a predicted pixel value of a pixel to be predicted in the current coding block based on the linear parameter and a pixel value of a reconstructed pixel in the target coding block.
[0015] In some embodiments, the acquisition module is further used to use a pixel area in the video frame that is within a preset range of the current coding block as a current reference area corresponding to the current coding block; the preset range is determined based on the size of the current coding block.
[0016] In some embodiments, the determination module is also used to determine multiple candidate reference areas within the encoded area in the video frame; determine the distortion corresponding to each of the multiple candidate reference areas; and based on the distortion corresponding to each of the multiple candidate reference areas, screen out a target reference area that matches the current reference area from the multiple candidate reference areas.
[0017] In some embodiments, each of the multiple candidate reference areas is used as a reference area to be matched, and the determination module is also used to determine, in the current reference area, a first reference pixel corresponding to each second reference pixel in the reference area to be matched; and the degree of distortion corresponding to the reference area to be matched is determined based on the difference between the reconstructed pixel value of the first reference pixel and the reconstructed pixel value of each second reference pixel.
[0018] In some embodiments, the determination module is also used to determine the linear relationship between each first reference pixel in the current reference area and the corresponding second reference pixel in the target reference area based on the first linear relationship between the current reference area and the target reference area; obtain the reconstructed pixel value of each first reference pixel in the current reference area and the reconstructed pixel value of each second reference pixel in the target reference area; based on the linear relationship between each first reference pixel and the corresponding second reference pixel, the reconstructed pixel value of each first reference pixel, and the reconstructed pixel value of each second reference pixel, determine the linear parameters used to characterize the second linear relationship between the current coding block and the target coding block.
[0019] In some embodiments, the second linear relationship between the current coding block and the target coding block represents the linear relationship between the pixels to be predicted in the current coding block and the reconstructed pixels in the target coding block; the determination module is also used to construct a linear prediction model based on the linear parameters; for any pixel to be predicted in the current coding block, determine the target reconstructed pixel corresponding to the pixel to be predicted in the target coding block; obtain the reconstructed pixel value of the target reconstructed pixel, and substitute the reconstructed pixel value of the target reconstructed pixel into the linear prediction model to obtain the predicted pixel value of the pixel to be predicted.
[0020] In some embodiments, the device also includes a mode selection module for respectively obtaining the original pixel values of each pixel to be predicted in the current coding block; and determining a first prediction distortion corresponding to the current coding block based on the original pixel values and predicted pixel values of each pixel to be predicted.
[0021] In some embodiments, the mode selection module is also used to determine a plurality of preset intra-frame prediction modes; use the intra-frame prediction mode indicated by the first prediction distortion degree as the first intra-frame prediction mode, and use the remaining intra-frame prediction modes except the first intra-frame prediction mode as the second intra-frame prediction mode; respectively determine the second prediction distortion degree corresponding to each second intra-frame prediction mode; and determine the target prediction mode from the plurality of intra-frame prediction modes based on the first prediction distortion degree and the second prediction distortion degree.
[0022] In some embodiments, the device also includes an encoding module for encoding the current coding block according to the target prediction mode, and adding a target mode identifier corresponding to the target prediction mode to the bitstream information; the target mode identifier is used to instruct the decoding end to perform decoding processing according to the target prediction mode.
[0023] In some embodiments, the encoding module is also used to encode each video frame in the video to be encoded to obtain an encoded video; the encoded video carrying the bitstream information is sent to the decoding end, so that the decoding end determines the target prediction mode based on the received encoded video according to the target mode identifier in the bitstream information, and decodes the encoded video based on the target prediction mode.
[0024] On the other hand, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the above intra-frame prediction method are implemented.
[0025] On the other hand, the present application further provides a computer-readable storage medium having a computer program stored thereon, and the computer program implements the steps of the above intra-frame prediction method when executed by a processor.
[0026] On the other hand, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the above intra-frame prediction method are implemented.
[0027] The above-mentioned intra-frame prediction method, apparatus, computer equipment, storage medium and computer program product obtain a current reference area corresponding to the current coding block in a video frame, and determine a target reference area matching the current reference area in the coded area in the video frame, and then approximate the second linear relationship between the current coding block and the target coding block based on the first linear relationship between the current reference area and the target reference area to obtain a linear parameter characterizing the second linear relationship. Therefore, the predicted pixel value of the pixel to be predicted in the current coding block can be determined based on the linear parameter and the pixel value of the reconstructed pixel in the target coding block, thereby improving the accuracy of pixel value prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 A diagram showing an application environment of an intra-frame prediction method in some embodiments;
[0029] Figure 2 is an application environment diagram of the intra-frame prediction method in some other embodiments;
[0030] Figure 3 FIG. 1 is an application environment diagram of the intra-frame prediction method in some other embodiments;
[0031] Figure 4 A diagram showing an application environment of an intra-frame prediction method in some further embodiments;
[0032] Figure 5 is a flowchart of an intra-frame prediction method in some embodiments;
[0033] Figure 6 A schematic diagram of the coding order of coding blocks within a video frame in some embodiments;
[0034] Fig. 7A is a schematic diagram of the principle of the current reference area in some embodiments;
[0035] Figure 7B Schematic diagram of the principle of the current reference area in some other embodiments;
[0036] Figure 7C Schematic diagram of the principle of the current reference area in some other embodiments;
[0037] Fig.7D is a schematic diagram of the principle of the current reference area in some further embodiments;
[0038] Fig. 7E is a schematic diagram of the principle of the current reference area in some further embodiments;
[0039] Figure 7F is a schematic diagram of the principle of the current reference area in some further embodiments;
[0040] Figure 7G is a schematic diagram of the principle of the current reference area in some further embodiments;
[0041] Figure 8 A schematic diagram of the principle of searching for a target reference area in an encoded area in some embodiments;
[0042] Fig. 9 is a schematic diagram of the principle of matching a target reference area with a current reference area in some embodiments;
[0043] Fig.10 A schematic diagram of the principle of screening a target reference region from a plurality of candidate reference regions in some embodiments;
[0044] Fig.11 is a schematic diagram of the principle of matching a pixel to be predicted with a reconstructed pixel in some embodiments;
[0045] Fig.12 is a structural block diagram of an intra-frame prediction device in some embodiments;
[0046] Fig.13 1 is a diagram of the internal structure of a computer device in some embodiments. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0048] The intra-frame prediction method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 is connected to the server 104 for communication. The terminal 102 and the server 104 can be directly or indirectly connected by wired or wireless communication, and this application does not limit this. The data storage system can store data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other servers.
[0049] The terminal 102 or the server 104 obtains the current reference area corresponding to the current coding block in the video frame, and determines the target reference area matching the current reference area in the coded area in the video frame; the target reference area corresponds to the target coding block. Furthermore, the terminal 102 or the server 104 determines the linear parameters for characterizing the second linear relationship between the current coding block and the target coding block based on the first linear relationship between the current reference area and the target reference area, and determines the predicted pixel value of the pixel to be predicted in the current coding block based on the linear parameters and the pixel value of the reconstructed pixel in the target coding block.
[0050] The terminal 102 may be, but is not limited to, one or more of various desktop computers, laptop computers, smart phones, tablet computers, IoT devices, or portable wearable devices, etc. The IoT devices may be one or more of smart speakers, smart TVs, smart air conditioners, or smart vehicle-mounted devices, etc. The portable wearable devices may be one or more of smart watches, smart bracelets, or head-mounted devices, etc.
[0051] In some embodiments, the terminal 102 may be loaded with an APP (Application) application, or loaded with a video encoding application, a video decoding application, or an application with a video playback function, etc., including traditional applications that need to be installed separately, or small program applications that can be used without downloading and installing, etc. The terminal 102 can perform one or more functions of video encoding, decoding, or playback through the application.
[0052] Among them, server 104 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as 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), as well as big data and artificial intelligence platforms.
[0053] The terminal or the server may be an encoding end that encodes the video to be encoded, or a decoding end that decodes the video to be encoded.
[0054] In some embodiments, Figure 2As shown, the terminal 202 is connected to the server 204 through a network for communication. The terminal 202 as an encoding end encodes the original video (i.e., the video to be encoded) to obtain the encoded video, and sends the encoded video to the server 204. The server 204 can decode the encoded video as a decoding end, or the server 204 can also send the encoded video to the terminal as a decoding end, so that the terminal as the decoding end performs decoding. Alternatively, the server 204 can also encode the original video as an encoding end to obtain the encoded video, and send the encoded video to the terminal 202, and the terminal 202 performs decoding as a decoding end.
[0055] In some embodiments, the method for determining the encoding mode provided in the embodiments of the present application can be applied to end-to-end video transmission scenarios. Figure 3 As shown, the terminal 302 as the encoding end can be connected to the network of one or more terminals 302' as the decoding end for communication. The terminal 302 encodes the original video to obtain the encoded video, and transmits the encoded video to the terminal 302'; after receiving the encoded video, the other terminal 302' decodes the encoded video to restore the original video.
[0056] In some embodiments, the method for determining the encoding mode provided in the embodiments of the present application can be applied to content distribution scenarios. Content distribution technology is a method for distributing content from a central server to an edge server close to the user, thereby achieving distributed local access to content. Content distribution technology effectively improves the service quality of content access and supports large-scale concurrent access capabilities. Figure 4 As shown, it includes a terminal 402 for collecting original video, a content distribution network, and a terminal 402' for playing the original video. The terminal 402 for collecting original video is used, for example, to collect video streams in scenarios such as live video broadcasting and remote conferencing. The content distribution network includes one or more servers 404. After collecting the original video, the terminal 402 performs encoding processing to obtain an encoded video and pushes it to the server 404; the server 404 caches the encoded video and forwards it to one or more terminals 402'. Alternatively, after collecting the original video, the terminal 402 pushes the original video to the server 404; the server 404 encodes the original video to obtain an encoded video, and forwards the encoded video to one or more terminals 402'. After receiving the encoded video, the terminal 402' decodes the encoded video to restore the original video.
[0057] In some embodiments, Figure 5As shown, an intra-frame prediction method is provided. The method is used at the encoding end. The method can be applied to a terminal or a server, or can be executed by a terminal and a server in collaboration. The following is an example of the method being applied to a computer device, which can be a terminal or a server. The method includes the following steps:
[0058] Step S502: Obtain a current reference area corresponding to the current coding block in the video frame.
[0059] Among them, encoding the video is to encode the video frames that constitute the video. In the embodiment of the present application, the video that has not been encoded is called the original video, and the video obtained after the original video is encoded is the encoded video. The encoded video is also called the video to be decoded after being transmitted to the decoding end; the decoding end decodes the video to be decoded to restore the original video. Encoding the video usually includes predictive encoding of pixel values. In the embodiment of the present application, it is used to determine the pixel value of the pixel in the coding block in the video frame.
[0060] When encoding each video frame, it is necessary to divide the video frame to be encoded into multiple coding blocks (CU), and use the coding blocks as the basic units of intra-frame prediction, and process them one by one in a certain coding order. The size of each coding block can be equal or different.
[0061] For example, Figure 6 As shown, the video frame is divided into multiple coding blocks, including 32*32 coding blocks, 16*16 coding blocks, 8*8 coding blocks, etc. The computer device processes the coding blocks in sequence according to the coding order indicated by the dotted arrows.
[0062] Generally, the size of the coding block can be 8, 16, 32, 64, etc. The size of the coding block can be determined according to the distribution of high-frequency information and low-frequency information in the video frame. For example, the computer device sets a smaller coding block for the high-frequency part of the video frame to avoid losing details, and sets a larger coding block for the low-frequency part to increase the coding speed. Among them, high-frequency information usually refers to information such as contours, lines or noise, and low-frequency information usually refers to information such as large color blocks.
[0063] The current reference area corresponding to the current coding block in the video frame refers to a pixel area within a preset range of the current coding block.
[0064] Specifically, the computer device determines the current reference area corresponding to the current coding block according to the current coding block. In some embodiments, the current reference area includes but is not limited to a pixel row (such as a pixel row) adjacent to the current coding block and above the current coding block. Fig. 7A), a pixel row adjacent to the current coding block and located to the left of the current coding block (as shown in Figure 7B ), or a pixel row adjacent to the current coding block and located above the current coding block and a pixel row adjacent to the current coding block and located above the current coding block (as shown in Figure 7C One or more of the following:
[0065] In some embodiments, obtaining the current reference area corresponding to the current coding block in the video frame includes: taking the pixel area in the video frame within the preset range of the current coding block as the current reference area corresponding to the current coding block; the preset range is determined based on the size of the current coding block. Among them, the pixel row adjacent to the current coding block and above the current coding block has the same width as the current coding block, and the pixel row adjacent to the current coding block and to the left of the current coding block has the same height as the current coding block. Determining the current reference area by the preset range around the current coding block reduces the amount of calculation and enables the pixels to be predicted in the current coding block to establish an association relationship with the reconstructed pixels, thereby improving the accuracy of intra-frame prediction.
[0066] In some other embodiments, the current reference area may be independent of the size of the previous coding block, for example Fig.7D As shown, the current reference area can be a pixel area consisting of a pixel row adjacent to the current coding block, located above the current coding block, and having a preset length, and a pixel row adjacent to the current coding block, located above the current coding block, and having a preset length.
[0067] For example, Fig. 7E As shown, the current reference area corresponding to the current coding block in the video frame includes an L-shaped reference area around the current coding block. Of course, the position of the L-shaped reference area relative to the current coding block can be determined according to actual conditions, for example, Figure 7F , Figure 7G The L-shaped reference area shown in .
[0068] Step S504: determining a target reference region matching the current reference region in the encoded region in the video frame; the target reference region corresponds to the target coding block.
[0069] Specifically, the computer device searches the coded area in the video frame based on the current reference area to search for a target reference area that matches the current reference area. Thus, the target coding block corresponding to the target reference area can be determined according to the target reference area.
[0070] For example, Figure 8As shown, the encoded regions in the video frame include R1 region, R2 region, R3 region, and R4 region. For the current reference region corresponding to the current coding block, the computer device searches in these encoded regions to find a target reference region that matches the current reference region. The target reference region is the reference region of the target coding block.
[0071] In some embodiments, the target reference region matches the current reference region, including: the similarity between the target reference region and the current reference region exceeds a threshold. The similarity between the target reference region and the current reference region can be characterized by the similarity between reference pixels at corresponding positions in the region. The reference pixel refers to a reconstructed pixel in the reference region.
[0072] For example, Fig. 9 As shown, the computer device determines the pixel value P1 of the reference pixel at the position (x1, y1) in the current reference area, and determines the pixel value P2 of the reference pixel at the position (x2, y2) corresponding to the position (x1, y1) in the target reference area, and determines the similarity between the reference pixel at the position (x1, y1) and the reference pixel at the position (x2, y2) based on the difference between the pixel value P1 and the pixel value P2. The above calculation is performed for any reference pixel in the current reference area. Furthermore, the computer device determines the similarity between the target reference area and the current reference area based on the similarity between each reference pixel in the current reference area and each corresponding reference pixel in the target reference area.
[0073] In some other embodiments, the target reference region matches the current reference region, including: the distortion between the target reference region and the current reference region is less than a threshold value. The similarity between the target reference region and the current reference region can be characterized by one or more numerical operation results of the square difference, the absolute error sum, or the square sum of the pixel values between the corresponding reference pixels in the region.
[0074] Step S506: Determine a linear parameter for characterizing a second linear relationship between the current coding block and the target coding block based on the first linear relationship between the current reference region and the target reference region.
[0075] Taking into account that the current reference area of the current coding block and the current coding block may have a certain deviation from the target coding block and its target reference area, a linear model is used in an embodiment of the present application to compensate for this deviation, that is, by determining the linear relationship between the current reference area of the current coding block and the target reference area of the target coding block, the linear relationship between the current coding block and the target coding block is approximately represented, thereby accurately predicting the pixel values in the current coding block.
[0076] Specifically, the computer device calculates a linear parameter based on a first linear relationship between the current reference region and the target reference region, so as to characterize a second linear relationship between the current coding block and the target coding block through the linear parameter.
[0077] In some embodiments, the linear parameters α and β are calculated by least squares method using corresponding pixels in the current reference area and the target reference area. For example, the computer device can calculate the linear parameters α and β using the following formula:
[0078]
[0079]
[0080] Where I is the number of pixels in the reference area.
[0081] It should be noted that the above-mentioned terms first and second, etc. are used in this application to describe linear relationships, but these linear relationships should not be limited by these terms. These terms are only used to distinguish one linear relationship from another linear relationship. For example, a first linear relationship can be referred to as a second linear relationship, and similarly, a second linear relationship can be referred to as a first linear relationship without departing from the scope of the various described embodiments, but unless the context clearly indicates otherwise, they are not the same linear relationship. Similar situations also include a first reference pixel and a second reference pixel, etc.
[0082] Step S508: determining predicted pixel values of pixels to be predicted in the current coding block based on the linear parameters and the pixel values of the reconstructed pixels in the target coding block.
[0083] Specifically, the computer device can construct a linear prediction model based on the calculated linear parameters, and the linear prediction model represents the linear relationship between the predicted value of the pixel to be predicted in the current coding block and the reconstructed pixel value of the reconstructed pixel in the target coding block.
[0084] For example, the linear prediction model can be expressed by the following formula:
[0085] p(i,j)=α·P m (i,j)+β
[0086] Among them, P(i,j) is the predicted pixel value of the pixel to be predicted in the current coding block, P m (i, j) is the reconstructed pixel value of the reconstructed pixel in the target coding block. α and β are linear parameters.
[0087] Therefore, the computer device can substitute the reconstructed pixel value of the reconstructed pixel at a certain position in the target coding block into the above-mentioned linear prediction model, and perform linear operations based on the calculated linear parameters to obtain the predicted pixel value of the pixel to be predicted at the corresponding position in the current coding block.
[0088] In the above-mentioned intra-frame prediction method, by obtaining the current reference area corresponding to the current coding block in the video frame, and determining the target reference area matching the current reference area in the encoded area in the video frame, and then based on the first linear relationship between the current reference area and the target reference area, the second linear relationship between the current coding block and the target coding block is approximated to obtain linear parameters characterizing the second linear relationship. In this way, the predicted pixel value of the pixel to be predicted in the current coding block can be determined based on the linear parameters and the pixel value of the reconstructed pixel in the target coding block, thereby improving the accuracy of pixel value prediction.
[0089] In some embodiments, a computer device determines a target reference area that matches a current reference area within an encoded area in a video frame, including: determining multiple candidate reference areas within the encoded area in the video frame; determining a distortion corresponding to each of the multiple candidate reference areas; and screening out a target reference area that matches the current reference area from the multiple candidate reference areas based on the distortion corresponding to each of the multiple candidate reference areas.
[0090] Specifically, the computer device searches for multiple candidate reference regions in the encoded region in the video frame, and respectively calculates the distortion between each candidate reference region and the current reference region.
[0091] Exemplarily, the computer device may calculate the distortion by the following formula:
[0092]
[0093] Among them, Loss(i) represents the distortion, W represents the width of the current coding block, H represents the height of the current coding block, L0(x, y) represents the reference pixel in the current reference area (called the first reference pixel), and Li(x, y) represents the reference pixel in the candidate reference area (called the second reference pixel).
[0094] Thus, the computer device compares the distortions corresponding to the candidate reference regions, and uses the candidate reference region with the smallest distortion as the target reference region, so as to screen out the target reference region matching the current reference region from the multiple candidate reference regions.
[0095] like Fig.10As shown, the computer device searches for multiple candidate reference areas L1, L2, L3, and L4 in the encoded area in the video frame, wherein each candidate reference area corresponds to an encoded block, for example, the candidate reference area L1 corresponds to the encoded block P1, the candidate reference area L2 corresponds to the encoded block P2, the candidate reference area L3 corresponds to the encoded block P3, and the candidate reference area L4 corresponds to the encoded block P4. The current reference area of the current coding block is represented by L0. The computer device then calculates the distortion between each candidate reference area L1, L2, L3, and L4 and the current reference area L0, and selects the target reference area. The encoded block corresponding to the target reference area is the target coding block.
[0096] In the above embodiment, the distortion is calculated to find the target reference area that is most similar to the current reference area from the encoded area in the video frame, and then the pixel values of the reconstructed pixels in the target coding block corresponding to the target reference area are used to predict the pixel values of the pixels to be predicted in the current coding block more accurately.
[0097] In some embodiments, each of the multiple candidate reference areas is used as the reference area to be matched, and the step of the computer device determining the distortion corresponding to each of the multiple candidate reference areas includes: for each second reference pixel in the reference area to be matched, determining the first reference pixel corresponding to each second reference pixel in the current reference area; and determining the distortion corresponding to the reference area to be matched based on the difference between the reconstructed pixel value of the first reference pixel and the reconstructed pixel value of each second reference pixel.
[0098] Specifically, the computer device determines, for each second reference pixel in the reference area to be matched, a first reference pixel corresponding to each second reference pixel in the current reference area.
[0099] The first reference pixel corresponds to the second reference pixel, which means that the first relative position of the first reference pixel in the reference region to which it belongs is the same as the second relative position of the second reference pixel in the reference region to which it belongs. The relative position of the reference pixel in the reference region to which it belongs can be determined based on a fixed position. For example, referring to Fig. 9 For the current coding block and the target coding block shown, the computer device can use the first pixel in the upper left corner as a reference for judging the relative position. Then, the first reference pixel below the first reference pixel in the current reference area corresponds to the second reference pixel below the first second reference pixel in the target reference area.
[0100] Furthermore, the computer device determines the degree of distortion corresponding to the reference area to be matched according to the difference between the reconstructed pixel value of the first reference pixel and the reconstructed pixel value of each second reference pixel. The computer device may determine the degree of distortion corresponding to the reference area to be matched according to one or more of the standard deviation, variance, absolute error, etc. between the reconstructed pixel value of each first reference pixel and the reconstructed pixel value of each corresponding second reference pixel.
[0101] In the above embodiment, the distortion is calculated to find the target reference area that is most similar to the current reference area from the encoded area in the video frame, and then the pixel values of the reconstructed pixels in the target coding block corresponding to the target reference area are used to predict the pixel values of the pixels to be predicted in the current coding block more accurately.
[0102] In some embodiments, based on the first linear relationship between the current reference area and the target reference area, a linear parameter for characterizing the second linear relationship between the current coding block and the target coding block is determined, including: based on the first linear relationship between the current reference area and the target reference area, determining the linear relationship between each first reference pixel in the current reference area and the corresponding second reference pixel in the target reference area; obtaining the reconstructed pixel value of each first reference pixel in the current reference area and the reconstructed pixel value of each second reference pixel in the target reference area; based on the linear relationship between each first reference pixel and the corresponding second reference pixel, the reconstructed pixel value of each first reference pixel, and the reconstructed pixel value of each second reference pixel, determining the linear parameter for characterizing the second linear relationship between the current coding block and the target coding block.
[0103] Specifically, the computer device determines a linear relationship between each first reference pixel in the current reference region and a corresponding second reference pixel in the target reference region based on a first linear relationship between the current reference region and the target reference region.
[0104] Exemplarily, the first linear relationship between the current reference region and the target reference region is consistent with the linear relationship between each first reference pixel in the current reference region and the corresponding second reference pixel in the target reference region. In other words, assuming that the first linear relationship between the current reference region and the target reference region is characterized by a linear model, the linear model can also characterize the linear relationship between each first reference pixel in the current reference region and the corresponding second reference pixel in the target reference region.
[0105] Furthermore, the computer device obtains the reconstructed pixel value of each first reference pixel in the current reference area, and the reconstructed pixel value of each second reference pixel in the target reference area, thereby substituting the linear relationship between each first reference pixel and the corresponding second reference pixel into the linear relationship between each first reference pixel and each corresponding second reference pixel. Furthermore, the computer device can determine the linear parameters for characterizing the second linear relationship between the current coding block and the target coding block according to the reconstructed pixel value of each first reference pixel and the reconstructed pixel value of each second reference pixel.
[0106] In some embodiments, the computer device calculates by least squares method based on the reconstructed pixel values of each first reference pixel in the current reference area and the reconstructed pixel values of each second reference pixel in the target reference area, thereby obtaining a linear parameter for characterizing the second linear relationship between the current coding block and the target coding block. Exemplarily, the computer device can calculate the linear parameters α and β by the following formula:
[0107]
[0108]
[0109] Wherein, I is the number of pixels in the reference area. Thus, the computer device can construct a linear prediction model according to the linear parameters to characterize the second linear relationship between the current coding block and the target coding block.
[0110] In the above embodiment, the linear relationship between the current reference area of the current coding block and the target reference area of the target coding block is determined to approximate the linear relationship between the current coding block and the target coding block, thereby enabling accurate prediction of pixel values in the current coding block.
[0111] In some embodiments, the second linear relationship between the current coding block and the target coding block represents the linear relationship between the pixels to be predicted in the current coding block and the reconstructed pixels in the target coding block. Accordingly, based on the linear parameters and the pixel values of the reconstructed pixels in the target coding block, the predicted pixel values of the pixels to be predicted in the current coding block are determined, including: constructing a linear prediction model based on the linear parameters; for any pixel to be predicted in the current coding block, determining the target reconstructed pixel corresponding to the pixel to be predicted in the target coding block; obtaining the reconstructed pixel value of the target reconstructed pixel, and substituting the reconstructed pixel value of the target reconstructed pixel into the linear prediction model to obtain the predicted pixel value of the pixel to be predicted.
[0112] Specifically, the computer device constructs a linear prediction model based on the calculated linear parameters. The linear prediction model is used to predict the pixel value of the pixel to be predicted in the current coding block. For any pixel to be predicted in the current coding block, the computer device determines a target reconstructed pixel corresponding to the pixel to be predicted in the target coding block.
[0113] The pixel to be predicted corresponds to the target reconstructed pixel, which means that the third relative position of the pixel to be predicted in the current coding block to which it belongs is the same as the fourth relative position of the target reconstructed pixel in the target coding block to which it belongs.
[0114] For example Fig.11 As shown, for the current coding block and the target coding block, the computer device can use the first pixel in the upper left corner of the coding block as a reference for judging the relative position. Then, the pixel to be predicted below the first pixel to be predicted in the current coding block (the black pixel in the current coding block) corresponds to the reconstructed pixel below the first reconstructed pixel in the target coding block (the black pixel in the target coding block).
[0115] For example, the linear prediction model can be expressed by the following formula:
[0116] P(i,j)=α·P m (i,j)+β
[0117] Among them, P(i,j) is the predicted pixel value of the pixel to be predicted in the current coding block, P m (i, j) is the reconstructed pixel value of the reconstructed pixel in the target coding block. α and β are linear parameters.
[0118] Furthermore, the computer device obtains the reconstructed pixel value of the target reconstructed pixel, and substitutes the reconstructed pixel value of the target reconstructed pixel into the linear prediction model to obtain the predicted pixel value of the pixel to be predicted.
[0119] In the above embodiment, a linear prediction model is constructed through the linear relationship between the current coding block and the target coding block, and the reconstructed pixel values of the reconstructed pixels in the target coding block are substituted to predict the pixel values of the pixels to be predicted in the current coding block, thereby improving the accuracy of intra-frame prediction.
[0120] When encoding a video frame, the computer device presets multiple intra-frame prediction modes. The intra-frame prediction mode described in the above embodiment is one of them. This prediction mode also needs to be compared with other intra-frame prediction modes to select the best intra-frame prediction mode corresponding to the current coding block.
[0121] To this end, in some embodiments, the intra-frame prediction method provided in the embodiments of the present application also includes the following steps: respectively obtaining the original pixel value of each pixel to be predicted in the current coding block; based on the original pixel value and the predicted pixel value of each pixel to be predicted, determining the first prediction distortion corresponding to the current coding block.
[0122] Specifically, the computer device obtains the original pixel value of each pixel to be predicted in the current coding block, and obtains the predicted pixel value of each pixel to be predicted in the current coding block. Furthermore, the computer device determines the first prediction distortion corresponding to the current coding block based on the difference between the original pixel value and the predicted pixel value of each pixel to be predicted.
[0123] Exemplarily, the computer device may represent the first prediction distortion corresponding to the current coding block according to the square sum of the errors between the original pixel value and the predicted pixel value of each pixel to be predicted. Exemplarily, the first prediction distortion dist1 may be represented by the following formula:
[0124]
[0125] Wherein, pred(x, y) represents the predicted pixel value of the pixel to be predicted in the current coding block, and orig(x, y) represents the original pixel value of the pixel to be predicted in the current coding block.
[0126] In the above embodiment, by calculating the prediction distortion corresponding to the current intra-frame prediction mode, the prediction distortion can be compared with the prediction distortions corresponding to other intra-frame prediction modes to select the best intra-frame prediction mode, thereby improving the encoding performance and reducing the consumption of bandwidth resources.
[0127] Accordingly, in some embodiments, the intra-frame prediction method provided by the embodiments of the present application also includes the following steps: determining a plurality of preset intra-frame prediction modes; taking the intra-frame prediction mode indicated by the first prediction distortion degree as the first intra-frame prediction mode, and taking the remaining intra-frame prediction modes except the first intra-frame prediction mode as the second intra-frame prediction mode; respectively determining the second prediction distortion degree corresponding to each second intra-frame prediction mode; and determining the target prediction mode from the plurality of intra-frame prediction modes based on the first prediction distortion degree and the second prediction distortion degree.
[0128] Specifically, the computer device determines a plurality of preset intra-frame prediction modes, wherein the intra-frame prediction mode indicated by the first prediction distortion degree in the above embodiment is used as the first intra-frame prediction mode, and the remaining intra-frame prediction modes except the first intra-frame prediction mode are used as the second intra-frame prediction mode. For each second intra-frame prediction mode, the computer device also respectively calculates the second prediction distortion degree corresponding to each second intra-frame prediction mode.
[0129] Exemplarily, the second prediction distortion dist2 corresponding to each second intra-frame prediction mode can also be expressed by the following formula:
[0130]
[0131] Wherein, pred(x, y) represents the predicted pixel value of the pixel to be predicted in the current coding block, and orig(x, y) represents the original pixel value of the pixel to be predicted in the current coding block.
[0132] Furthermore, the computer device compares the first prediction distortion and each second prediction distortion, selects the minimum prediction distortion, and uses the intra-frame prediction mode corresponding to the minimum prediction distortion as the target prediction mode ultimately used to encode the current coding block.
[0133] In the above embodiment, by comparing the prediction distortions corresponding to the various intra-frame prediction modes, and selecting the intra-frame prediction mode corresponding to the minimum prediction distortion as the target prediction mode, the target prediction mode is the intra-frame prediction mode with the best performance. Encoding the current coding block with the target prediction mode can greatly improve the coding performance and thereby reduce the consumption of bandwidth resources.
[0134] In some embodiments, the intra-frame prediction method provided by the embodiments of the present application also includes the following steps: encoding the current coding block according to the target prediction mode, and adding the target mode identifier corresponding to the target prediction mode to the bit stream information; the target mode identifier is used to instruct the decoding end to perform decoding processing according to the target prediction mode.
[0135] In the process of networked video transmission, the bitstream information usually records the information when the video is encoded, such as video frame rate, video width and height, resolution, etc. Since the calculation process of the relevant parameters of intra-frame prediction is not only performed at the encoding end, but also at the decoding end, the relevant parameters of intra-frame prediction do not need to be recorded in the bitstream information.
[0136] During the encoding process, the computer device also needs to indicate the selected intra-frame prediction mode through a mode identifier. For example, the first intra-frame prediction mode is indicated by mode identifier 0, and other mode identifiers are used to indicate other intra-frame prediction modes. In the embodiment of the present application, the encoding end needs to indicate whether the first intra-frame prediction mode or other intra-frame prediction modes is selected by the current coding block through a one-bit identifier.
[0137] Specifically, the computer device performs encoding processing on the current coding block according to the target prediction mode. In the encoding process, the computer device also adds the target mode identifier corresponding to the target prediction mode to the bitstream information, so that the decoding end can subsequently determine the corresponding target prediction mode by extracting the target mode identifier from the bitstream information. Then, the decoding end performs decoding processing on the current coding block according to the target prediction mode.
[0138] In the above embodiment, the selected intra-frame prediction mode is indicated by a mode identifier, and the video does not need to carry information such as relevant parameters of the intra-frame prediction mode during transmission, which greatly reduces the occupation of bandwidth resources and thus improves transmission efficiency.
[0139] In some embodiments, the intra-frame prediction method provided by the embodiments of the present application also includes the following steps: encoding each video frame in the video to be encoded to obtain an encoded video; sending the encoded video carrying the bitstream information to the decoding end, so that the decoding end determines the target prediction mode based on the received encoded video according to the target mode identifier in the bitstream information, and decodes the encoded video based on the target prediction mode.
[0140] Specifically, the computer device performs the above processing on each coding block in the video frame, and performs the above processing on each video frame in the video to be coded, so as to achieve compression in the video frame, thereby obtaining the coded video. Then, the computer device can send the coded video carrying the code stream information to the decoding end.
[0141] After receiving the encoded video, the decoder obtains the bitstream information of the encoded video and extracts the target mode identifier from it, and then determines the target prediction mode corresponding to a certain coding block in one of the video frames according to the target mode identifier. Then, the decoder decodes the coding block based on the target prediction mode. Each coding block in the video frame is decoded, and each video frame in the encoded video is decoded, so that the original video can be restored. After obtaining the original video, the decoder can play the original video, etc.
[0142] In the above embodiment, the selected intra-frame prediction mode is represented by a mode identifier. During the transmission process of the video, there is no need to carry information such as relevant parameters of the intra-frame prediction mode. Only one bit needs to be transmitted to represent the selected intra-frame prediction mode, which greatly reduces the occupancy of bandwidth resources and thereby improves transmission efficiency.
[0143] The present application also provides an application scenario, which applies the above-mentioned intra-frame prediction method. Specifically, the application of the intra-frame prediction method in this application scenario is as follows: the encoding end obtains the current reference area corresponding to the current coding block in the video frame; in the encoded area in the video frame, a target reference area matching the current reference area is determined; the target reference area corresponds to the target coding block. Furthermore, the encoding end determines the linear parameters used to characterize the second linear relationship between the current coding block and the target coding block based on the first linear relationship between the current reference area and the target reference area, and determines the predicted pixel value of the pixel to be predicted in the current coding block based on the linear parameters and the pixel value of the reconstructed pixel in the target coding block. The decoding end also performs the above steps when decoding the encoded video.
[0144] Of course, it is not limited to this. The intra-frame prediction method provided in the present application can also be applied to other application scenarios, such as video playback on video websites, real-time live broadcast, online conferences, online classes, car navigation, or image transmission, thereby improving the compression performance of the video and saving transmission bandwidth.
[0145] In a specific example, the intra-frame prediction method provided by the embodiment of the present application includes the following steps: the computer device uses a pixel area in a video frame within a preset range of a current coding block as a current reference area corresponding to the current coding block; the preset range is determined based on the size of the current coding block. Furthermore, the computer device determines multiple candidate reference areas within the coded area in the video frame, and respectively determines the distortion corresponding to each of the multiple candidate reference areas.
[0146] Thus, the computer device can select a target reference area that matches the current reference area from the multiple candidate reference areas based on the distortion corresponding to each of the multiple candidate reference areas; the target reference area corresponds to the target coding block. Each of the multiple candidate reference areas is used as the reference area to be matched, and the computer device determines the first reference pixel corresponding to each second reference pixel in the current reference area for each second reference pixel in the reference area to be matched; the distortion corresponding to the reference area to be matched is determined based on the difference between the reconstructed pixel value of the first reference pixel and the reconstructed pixel value of each second reference pixel.
[0147] The computer device determines the linear relationship between each first reference pixel in the current reference area and the corresponding second reference pixel in the target reference area based on the first linear relationship between the current reference area and the target reference area. The computer device obtains the reconstructed pixel value of each first reference pixel in the current reference area and the reconstructed pixel value of each second reference pixel in the target reference area, and determines the linear parameter for characterizing the second linear relationship between the current coding block and the target coding block based on the linear relationship between each first reference pixel and the corresponding second reference pixel, the reconstructed pixel value of each first reference pixel, and the reconstructed pixel value of each second reference pixel.
[0148] Finally, the computer device can construct a linear prediction model based on the linear parameters, and determine the target reconstructed pixel corresponding to the pixel to be predicted in the target coding block for any pixel to be predicted in the current coding block. Thus, the computer device obtains the reconstructed pixel value of the target reconstructed pixel, and substitutes the reconstructed pixel value of the target reconstructed pixel into the linear prediction model to obtain the predicted pixel value of the pixel to be predicted.
[0149] After obtaining the predicted pixel values of the pixels to be predicted in the current coding block, the computer device also obtains the original pixel values of each pixel to be predicted in the current coding block, and determines a first prediction distortion corresponding to the current coding block based on the original pixel value and the predicted pixel value of each pixel to be predicted.
[0150] The computer device also determines a plurality of preset intra-frame prediction modes, and uses the intra-frame prediction mode indicated by the first prediction distortion as the first intra-frame prediction mode, and uses the remaining intra-frame prediction modes except the first intra-frame prediction mode as the second intra-frame prediction mode. Thus, the computer device determines the second prediction distortion corresponding to each second intra-frame prediction mode, and determines the target prediction mode from the plurality of intra-frame prediction modes based on the first prediction distortion and the second prediction distortion.
[0151] After determining the target prediction mode, the computer device also encodes the current coding block according to the target prediction mode, and adds the target mode identifier corresponding to the target prediction mode to the bitstream information; the target mode identifier is used to instruct the decoding end to perform decoding processing according to the target prediction mode.
[0152] Furthermore, the computer device performs encoding processing on each encoding block in each video frame in the video to be encoded according to the above embodiment to obtain an encoded video. The computer device then sends the encoded video carrying the bitstream information to the decoding end, so that the decoding end determines the target prediction mode based on the received encoded video according to the target mode identifier in the bitstream information, and performs decoding processing on the encoded video based on the target prediction mode.
[0153] After receiving the encoded video, the decoder determines the target prediction mode according to the target mode identifier in the bitstream information. When the target mode identifier indicates that the target prediction mode is the first intra-frame prediction mode indicated by the first prediction distortion, the decoder performs the same steps as the encoder to achieve decoding of the encoded video.
[0154] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0155] Based on the same inventive concept, the embodiment of the present application also provides an intra-frame prediction device for implementing the intra-frame prediction method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more intra-frame prediction device embodiments provided below can refer to the limitations on the intra-frame prediction method above, and will not be repeated here.
[0156] In some embodiments, Fig.12 As shown, an intra-frame prediction device 1200 is provided, comprising: an acquisition module 1201, a determination module 1202 and a prediction module 1203, wherein:
[0157] The acquisition module 1201 is used to acquire a current reference area corresponding to a current coding block in a video frame.
[0158] The determination module 1202 is used to determine a target reference area that matches the current reference area in the encoded area in the video frame; the target reference area corresponds to a target coding block.
[0159] The determination module 1202 is further configured to determine a linear parameter for characterizing a second linear relationship between the current coding block and the target coding block based on a first linear relationship between the current reference region and the target reference region.
[0160] The prediction module 1203 is used to determine the predicted pixel value of the pixel to be predicted in the current coding block based on the linear parameter and the pixel value of the reconstructed pixel in the target coding block.
[0161] In some embodiments, the acquisition module is further used to use a pixel area in the video frame that is within a preset range of the current coding block as a current reference area corresponding to the current coding block; the preset range is determined based on the size of the current coding block.
[0162] In some embodiments, the determination module is also used to determine multiple candidate reference areas within the encoded area in the video frame; determine the distortion corresponding to each of the multiple candidate reference areas; and based on the distortion corresponding to each of the multiple candidate reference areas, screen out a target reference area that matches the current reference area from the multiple candidate reference areas.
[0163] In some embodiments, each of the multiple candidate reference areas is used as a reference area to be matched, and the determination module is also used to determine, in the current reference area, a first reference pixel corresponding to each second reference pixel in the reference area to be matched; and the degree of distortion corresponding to the reference area to be matched is determined based on the difference between the reconstructed pixel value of the first reference pixel and the reconstructed pixel value of each second reference pixel.
[0164] In some embodiments, the determination module is also used to determine the linear relationship between each first reference pixel in the current reference area and the corresponding second reference pixel in the target reference area based on the first linear relationship between the current reference area and the target reference area; obtain the reconstructed pixel value of each first reference pixel in the current reference area and the reconstructed pixel value of each second reference pixel in the target reference area; based on the linear relationship between each first reference pixel and the corresponding second reference pixel, the reconstructed pixel value of each first reference pixel, and the reconstructed pixel value of each second reference pixel, determine the linear parameters used to characterize the second linear relationship between the current coding block and the target coding block.
[0165] In some embodiments, the second linear relationship between the current coding block and the target coding block represents the linear relationship between the pixels to be predicted in the current coding block and the reconstructed pixels in the target coding block. The determination module is further used to construct a linear prediction model based on the linear parameters; for any pixel to be predicted in the current coding block, determine the target reconstructed pixel corresponding to the pixel to be predicted in the target coding block; obtain the reconstructed pixel value of the target reconstructed pixel, and substitute the reconstructed pixel value of the target reconstructed pixel into the linear prediction model to obtain the predicted pixel value of the pixel to be predicted.
[0166] In some embodiments, the above-mentioned device also includes a mode selection module, which is used to respectively obtain the original pixel value of each pixel to be predicted in the current coding block; based on the original pixel value and the predicted pixel value of each pixel to be predicted, determine the first prediction distortion corresponding to the current coding block.
[0167] In some embodiments, the mode selection module is also used to determine a plurality of preset intra-frame prediction modes; use the intra-frame prediction mode indicated by the first prediction distortion degree as the first intra-frame prediction mode, and use the remaining intra-frame prediction modes except the first intra-frame prediction mode as the second intra-frame prediction mode; respectively determine the second prediction distortion degree corresponding to each second intra-frame prediction mode; and determine the target prediction mode from the plurality of intra-frame prediction modes based on the first prediction distortion degree and the second prediction distortion degree.
[0168] In some embodiments, the above-mentioned device also includes an encoding module, which is used to encode the current coding block according to the target prediction mode, and add a target mode identifier corresponding to the target prediction mode to the bit stream information; the target mode identifier is used to instruct the decoding end to perform decoding processing according to the target prediction mode.
[0169] In some embodiments, the encoding module is also used to encode each video frame in the video to be encoded to obtain an encoded video; the encoded video carrying the bitstream information is sent to the decoding end, so that the decoding end determines the target prediction mode based on the received encoded video according to the target mode identifier in the bitstream information, and decodes the encoded video based on the target prediction mode.
[0170] Each module in the above intra-frame prediction device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0171] In some embodiments, a computer device is provided, which may be a server or a terminal. The following description takes the computer device as a server as an example, and its internal structure diagram may be as follows: Fig.13As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store video data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, an intra-frame prediction method is implemented.
[0172] Those skilled in the art will understand that Fig.13 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0173] In some embodiments, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0174] In some embodiments, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0175] In some embodiments, a computer program product is provided, including a computer program, which implements the steps in the above-mentioned method embodiments when executed by a processor.
[0176] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0177] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0178] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. An intra-frame prediction method, characterized in that: The method comprises: Obtaining a current reference region corresponding to a current coding block in a video frame; Determining a target reference region matching the current reference region in the encoded region in the video frame; the target reference region corresponds to a target coding block; Determining, based on a first linear relationship between the current reference region and the target reference region, a linear parameter for characterizing a second linear relationship between the current coding block and the target coding block; Based on the linear parameters and the pixel values of the reconstructed pixels in the target coding block, a predicted pixel value of the pixel to be predicted in the current coding block is determined.
2. The method according to claim 1, characterized in that The obtaining of a current reference area corresponding to a current coding block in a video frame includes: A pixel region in the video frame that is within a preset range of the current coding block is used as a current reference region corresponding to the current coding block; the preset range is determined based on the size of the current coding block.
3. The method according to claim 1, characterized in that Determining a target reference area matching the current reference area in the encoded area in the video frame includes: Determining a plurality of candidate reference regions within the encoded region in the video frame; Determining the distortion corresponding to each of the plurality of candidate reference regions; Based on the distortions corresponding to the multiple candidate reference regions, a target reference region matching the current reference region is screened out from the multiple candidate reference regions.
4. The method according to claim 3, characterized in that Taking each of the plurality of candidate reference regions as a reference region to be matched, the step of determining the distortion corresponding to each of the plurality of candidate reference regions comprises: For each second reference pixel in the reference area to be matched, respectively determine a first reference pixel corresponding to each second reference pixel in the current reference area; The degree of distortion corresponding to the reference area to be matched is determined according to differences between the reconstructed pixel value of the first reference pixel and the reconstructed pixel value of each second reference pixel.
5. The method according to claim 1, characterized in that The determining, based on the first linear relationship between the current reference region and the target reference region, a linear parameter for characterizing a second linear relationship between the current coding block and the target coding block comprises: Determine, based on a first linear relationship between the current reference region and the target reference region, a linear relationship between each first reference pixel in the current reference region and a corresponding second reference pixel in the target reference region; Obtaining a reconstructed pixel value of each first reference pixel in the current reference area and a reconstructed pixel value of each second reference pixel in the target reference area; Based on the linear relationship between each of the first reference pixels and the corresponding second reference pixels, the reconstructed pixel value of each of the first reference pixels, and the reconstructed pixel value of each of the second reference pixels, a linear parameter for characterizing the second linear relationship between the current coding block and the target coding block is determined.
6. The method according to claim 1, characterized in that The second linear relationship between the current coding block and the target coding block represents a linear relationship between the pixels to be predicted in the current coding block and the reconstructed pixels in the target coding block; and determining the predicted pixel values of the pixels to be predicted in the current coding block based on the linear parameters and the pixel values of the reconstructed pixels in the target coding block includes: Constructing a linear prediction model based on the linear parameters; For any pixel to be predicted in the current coding block, determining a target reconstructed pixel corresponding to the pixel to be predicted in the target coding block; The reconstructed pixel value of the target reconstructed pixel is obtained, and the reconstructed pixel value of the target reconstructed pixel is substituted into the linear prediction model to obtain the predicted pixel value of the pixel to be predicted.
7. The method according to claim 1, characterized in that The method further comprises: Respectively obtaining original pixel values of pixels to be predicted in the current coding block; Based on the original pixel value and the predicted pixel value of each pixel to be predicted, a first prediction distortion corresponding to the current coding block is determined.
8. The method according to claim 7, characterized in that The method further comprises: Determining a plurality of preset intra-frame prediction modes; Using the intra-frame prediction mode indicated by the first prediction distortion as a first intra-frame prediction mode, and using the remaining intra-frame prediction modes except the first intra-frame prediction mode as a second intra-frame prediction mode; Determining respectively the second prediction distortion corresponding to each second intra-frame prediction mode; Based on the first prediction distortion degree and the second prediction distortion degree, a target prediction mode is determined from the plurality of intra prediction modes.
9. The method according to claim 8, characterized in that The method further comprises: The current coding block is encoded according to the target prediction mode, and a target mode identifier corresponding to the target prediction mode is added to the bitstream information; the target mode identifier is used to instruct the decoding end to perform decoding according to the target prediction mode.
10. The method according to claim 9, characterized in that The method further comprises: Performing encoding processing on each video frame in the video to be encoded to obtain an encoded video; The encoded video carrying the bitstream information is sent to a decoding end, so that the decoding end determines a target prediction mode based on the received encoded video according to a target mode identifier in the bitstream information, and decodes the encoded video based on the target prediction mode.
11. An intra-frame prediction device, characterized in that: The device comprises: An acquisition module, used to acquire a current reference area corresponding to a current coding block in a video frame; A determination module, configured to determine, within the encoded region in the video frame, a target reference region that matches the current reference region; the target reference region corresponds to a target coding block; The determination module is further configured to determine a linear parameter for characterizing a second linear relationship between the current coding block and the target coding block based on a first linear relationship between the current reference region and the target reference region; A prediction module is used to determine a predicted pixel value of a pixel to be predicted in the current coding block based on the linear parameter and a pixel value of a reconstructed pixel in the target coding block.
12. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 10 are implemented.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.
14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.
