Intra-frame prediction method, device, computer equipment and storage medium
By determining the texture correlation and difference in the intra-frame prediction direction, quickly identifying the texture direction and performing intra-frame prediction, the problem of intra-frame prediction complexity and resource occupation in the existing technology is solved, and the coding efficiency and image quality are improved.
Patent Information
- Application Number
- CN202310409569.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-17
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2043-04-17
AI Technical Summary
Existing intra-frame prediction methods are complex, occupy a lot of system resources, and are difficult to quickly identify texture directions and perform effective encoding.
By determining the texture correlation in multiple directions of the area to be processed, the texture direction is selected as the intra prediction direction. If the texture difference meets the preset conditions, the direction is determined as the intra prediction direction, and intra prediction is performed to improve the encoding speed. and save resources.
It improves the speed of intra-frame prediction, saves system resources, and ensures the quality and bit rate of encoded images.
Smart Images

Figure CN117729338B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an intra-frame prediction method, apparatus, computer equipment and storage medium. Background Art
[0002] Intra-frame prediction is a new technology proposed in the High Efficiency Video Coding (HEVC) standard. Intra-frame prediction uses the correlation in the video spatial domain and uses the adjacent coded pixels in the same frame image to predict the current pixel, so as to effectively remove the temporal redundancy of the video.
[0003] However, existing intra-frame prediction methods usually need to traverse a large number of intra-frame prediction directions and select an intra-frame prediction direction for final prediction coding of the current coding block. This process is complicated and occupies more system resources. Summary of the invention
[0004] The embodiments of the present application provide an intra-frame prediction method, apparatus, computer equipment, and storage medium, which can improve the intra-frame encoding speed and save system resources.
[0005] An embodiment of the present application provides an intra-frame prediction method, comprising: determining texture correlations of multiple directions of a to-be-processed area, the to-be-processed area being an image area in a grayscale image of a to-be-processed frame; determining a texture direction of the to-be-processed area from the multiple directions based on the texture correlations; if the texture difference of the to-be-processed area satisfies a preset difference condition, determining the texture direction of the to-be-processed area as the intra-frame prediction direction of the to-be-processed area; and performing intra-frame prediction on the to-be-processed frame based on the intra-frame prediction direction of the to-be-processed area, so as to perform encoding based on the intra-frame prediction result.
[0006] An embodiment of the present application also provides an intra-frame prediction device, including: a correlation determination unit, used to determine the texture correlation of multiple directions of a to-be-processed area, wherein the to-be-processed area is an image area in a grayscale image of a to-be-processed frame; a texture direction determination unit, used to determine the texture direction of the to-be-processed area from the multiple directions based on the texture correlation; a prediction direction determination unit, used to determine the texture direction of the to-be-processed area as the intra-frame prediction direction of the to-be-processed area if the texture difference of the to-be-processed area meets a preset difference condition; and an intra-frame prediction unit, used to perform intra-frame prediction on the to-be-processed frame based on the intra-frame prediction direction of the to-be-processed area, so as to perform encoding based on the intra-frame prediction result.
[0007] An embodiment of the present application also provides a computer device, including a processor and a memory, wherein the memory stores multiple instructions; the processor loads instructions from the memory to execute the steps in any one of the intra-frame prediction methods provided in the embodiments of the present application.
[0008] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a plurality of instructions, wherein the instructions are suitable for a processor to load to execute the steps in any one of the intra-frame prediction methods provided in the embodiment of the present application.
[0009] The embodiment of the present application can determine the texture correlation of multiple directions of the area to be processed, where the area to be processed is an image area in the grayscale image of the frame to be processed; based on the texture correlation, determine the texture direction of the area to be processed from the multiple directions; if the texture difference of the area to be processed meets the preset difference condition, determine the texture direction of the area to be processed as the intra-frame prediction direction of the area to be processed; based on the intra-frame prediction direction of the area to be processed, perform intra-frame prediction on the frame to be processed so as to perform encoding according to the intra-frame prediction result.
[0010] In the present application, the texture direction of the area to be processed can be determined based on texture correlation, and based on the texture difference of the area to be processed, it can be determined whether the area to be processed has texture, so that the texture direction of the area to be processed with texture can be used as the intra-frame prediction direction, so as to quickly identify the texture area with clear texture direction from the frame to be processed, and quickly determine the intra-frame prediction method, effectively improve the intra-frame prediction speed, and save system resources. In addition, since strong correlation usually occurs in the texture direction during intra-frame coding, the stronger the correlation between coding blocks, the more similar their texture directions are, so intra-frame prediction of the area to be processed with texture based on the texture direction can ensure the quality and bit rate of the encoded image. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0012] Figure 1a is a schematic diagram of a scenario of an intra-frame prediction method provided in an embodiment of the present application;
[0013] Figure 1b It is a flowchart of the intra-frame prediction method provided by an embodiment of the present application;
[0014] Figure 1c is a schematic diagram of a sliding window provided in an embodiment of the present application;
[0015] Figure 1d is a schematic diagram of determining a prediction direction of a coding block to be processed provided by an embodiment of the present application;
[0016] Figure 1e is a schematic diagram of an intra-frame prediction mode provided in an embodiment of the present application;
[0017] Figure 2 is a flowchart of an intra-frame prediction method provided by another embodiment of the present application;
[0018] Figure 3 is a schematic diagram of the structure of an intra-frame prediction device provided in an embodiment of the present application;
[0019] Figure 4 It is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0020] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0021] Embodiments of the present application provide an intra-frame prediction method, apparatus, computer device, and storage medium.
[0022] The intra-frame prediction device may be integrated into an electronic device, which may be a terminal, a server, or the like. The terminal may be a mobile phone, a tablet computer, a smart Bluetooth device, a notebook computer, or a personal computer (PC), etc. The server may be a single server or a server cluster consisting of multiple servers.
[0023] In some embodiments, the intra-frame prediction device may also be integrated into multiple electronic devices. For example, the intra-frame prediction device may be integrated into multiple servers, and the intra-frame prediction method of the present application may be implemented by multiple servers.
[0024] In some embodiments, the server may also be implemented in the form of a terminal.
[0025] For example, refer to Figure 1a , a scene diagram of an intra-frame prediction system is provided, and the system can implement an intra-frame prediction method. In this scene, an image acquisition device, a terminal and a server can be included.
[0026] Among them, the image acquisition device is used to acquire a video, and the video includes a frame to be processed. The server can be used to obtain the frame to be processed from the image acquisition device, determine the texture correlation of multiple directions of the area to be processed, and the area to be processed is the image area in the grayscale image of the frame to be processed; according to the texture correlation, determine the texture direction of the area to be processed from multiple directions; if the texture difference of the area to be processed meets the preset difference condition, determine the texture direction of the area to be processed as the intra-frame prediction direction of the area to be processed; according to the intra-frame prediction direction of the area to be processed, perform intra-frame prediction on the frame to be processed, so as to encode according to the intra-frame prediction result. The terminal can be used to obtain the encoding result from the server and display it. Data can be transmitted between the image acquisition device, the server and the terminal through a network, and the network can be a wireless network or a wired network, such as a wireless network such as a wireless local area network (WLAN), a local area network (LAN), a cellular network, a 2D network, a 3G network, a 4G network, a 5G network, etc.
[0027] The following are detailed descriptions. It should be noted that the order of the following embodiments is not intended to limit the preferred order of the embodiments. It is understood that in the specific implementation of the present application, when the user-related data is involved, when the embodiment of the present application is applied to a specific product or technology, the user's permission or consent is required, and the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0028] In this embodiment, an intra-frame prediction method is provided, such as Figure 1b As shown, the specific process of the intra-frame prediction method can be as follows:
[0029] 110. Determine texture correlations in multiple directions of a region to be processed, where the region to be processed is an image region in a grayscale image of a frame to be processed.
[0030] The frame to be processed refers to a frame to be intra-frame predicted. For example, the frame to be processed may be a frame of an image to be video encoded. Since the frame to be processed is usually an RGB image, the pixel value of each pixel in the RGB image is an RGB value, where R represents red, G represents green, and B represents blue. A grayscale image refers to an image composed of grayscale values of pixels, and the white and black are divided into several levels according to a logarithmic relationship, which is called grayscale. In this way, when a computer device obtains a frame to be processed, the frame to be processed can be converted into an image with grayscale values (such as a YUV image), thereby obtaining a grayscale image of the frame to be processed, where Y represents brightness (Luminance or Luma), that is, a grayscale value, and U and V represent chrominance (Chrominance or Chroma), which is mainly used to specify the color of a pixel.
[0031] The texture correlation is used to characterize the similarity of textures in spatial positions. For example, the texture correlation can be the similarity of the grayscale of pixels in the row or column direction. The greater the texture correlation, the closer the grayscale of the pixels, and the smaller the texture correlation, the greater the grayscale difference of the pixels.
[0032] For example, a computer device such as a server can obtain a video captured by an image acquisition device. The frame to be processed can be any frame in the video. The server can convert the frame to be processed into a grayscale image and calculate the similarity of the grayscale values of pixels in the row or column direction of the grayscale image, thereby obtaining texture correlation in multiple directions.
[0033] In some implementations, the grayscale image of the frame to be processed may be equalized to increase the global contrast of the image. Specifically, before determining the texture correlation of multiple directions of the region to be processed, the method further includes:
[0034] Convert the frame to be processed into an initial grayscale image;
[0035] The initial grayscale image is equalized to obtain a grayscale image of the frame to be processed.
[0036] The equalization process refers to changing the grayscale image from a relatively concentrated grayscale interval to a uniform distribution within the entire grayscale range. For example, the equalization process may be a histogram equalization process, which refers to performing nonlinear stretching on the image and redistributing the image pixel values so that the number of pixels within a certain grayscale range is roughly the same.
[0037] For example, after the server converts the frame to be processed into a grayscale image (initial grayscale image), the histogram equalization processing method can be used to adjust the histogram of the original image (initial grayscale image) to a flat histogram through a transformation function, and then use this histogram to correct the image. The image grayscale interval is enlarged through equalization processing, which increases the image contrast and improves the visual effect, thereby achieving the purpose of enhancing the global contrast of the image, thereby improving the accuracy of determining the texture features of the grayscale image.
[0038] In some implementations, the grayscale image of the frame to be processed can be quantized and segmented based on the sliding window to quickly determine the area to be processed of a specified size. Specifically, before determining the texture correlation of multiple directions of the area to be processed, the method further includes:
[0039] At least one area to be processed is determined from the grayscale image of the frame to be processed according to the sliding window.
[0040] The sliding window refers to a window used for sliding image segmentation. For example, a window of a specified size can be set to perform sliding segmentation on the grayscale image of the processing frame. The size of the sliding window and the sliding step can be set according to actual needs and application scenarios.
[0041] For example, Figure 1c As shown in the figure, the size of the grayscale image of the frame to be processed is 20×20. A 5×5 sliding window can be set, and all pixels on the grayscale image can be traversed from the upper left corner with a sliding step of 1 (pixel). The area covered by the sliding window each time is a processing area.
[0042] In some implementations, in order to reduce repeated calculations of pixel grayscales and improve processing efficiency, a sliding step size may be set according to the size of the sliding window so that pixels in the sliding window before and after any sliding are not repeated. For example, if the sliding window size is N×N, the sliding step size may be set to N.
[0043] In some embodiments, the texture correlations in multiple directions may be determined based on the gray level co-occurrence matrix of the area to be processed to accurately and quantitatively reflect the spatial correlation characteristics of the gray level. Specifically, determining the texture correlations in multiple directions of the area to be processed includes:
[0044] According to the grayscale of the pixels in the area to be processed, the grayscale co-occurrence matrix of the area to be processed in multiple directions is calculated;
[0045] According to the gray level co-occurrence matrices in multiple directions, the texture correlations in multiple directions of the area to be processed are determined.
[0046] Among them, the gray level co-occurrence matrix is a common method to describe texture by studying the spatial correlation characteristics of gray. The gray level co-occurrence matrix is defined as the probability that the gray value of a point at a fixed position is i, starting from a pixel with gray level i, that is, all estimated values can be expressed in the form of a matrix, which is called the gray level co-occurrence matrix. For images with slow texture changes, the values on the diagonal of the gray level co-occurrence matrix are large; while for images with fast texture changes, the values on the diagonal of the gray level co-occurrence matrix are small, and the values on both sides of the diagonal are large. Due to the large amount of data in the gray level co-occurrence matrix, it is generally not directly used as a feature to distinguish textures, but some statistics constructed based on it are used as texture classification features. For example, the statistics of the gray level co-occurrence matrix can include: energy, entropy, contrast, uniformity, correlation, variance, sum average, sum variance, sum entropy, difference variance, difference average, difference entropy, related information measure, and maximum correlation coefficient, etc.
[0047] For example, based on the grayscale values of the pixels in the area to be processed, the matrix values in the four directions of 0°, 45°, 90°, and 135° are calculated, and the grayscale co-occurrence matrix in the direction is formed by the matrix values in each direction. For example, an empty grayscale co-occurrence matrix of size M×M can be created. Taking the direction θ=0° as an example, when the distance d is given, on the straight line with the direction θ=0°, the frequency of the occurrence of the point pair with grayscale i and the grayscale j at a distance d is calculated as the value of the (i, j)th element of the grayscale co-occurrence matrix, and the matrix is filled in the corresponding element of the 4×4 empty grayscale co-occurrence matrix, that is, the grayscale co-occurrence matrix in the direction of 0° can be obtained. By analogy, the grayscale co-occurrence matrices in the four directions of 0°, 45°, 90°, and 135° can be obtained. Then, the statistic "correlation" of the grayscale co-occurrence matrix in each direction is determined, and the statistic is used as the texture correlation in the direction.
[0048] In some embodiments, the formula Calculate the texture correlation in each direction, where P i,j represents the matrix after normalization of each element (matrix value) in the gray-level co-occurrence matrix, i and j represent columns and rows, μ i and represents the mean and variance of the elements in the gray level co-occurrence matrix along the column direction, μ j and It represents the mean and variance of the matrix values in the gray-level co-occurrence matrix along the row direction, and N represents the grayscale level of the grayscale image. For example, the formula can be used to calculate the correlation (texture correlation) in the 0° direction for the gray-level co-occurrence matrix in the 0° direction, and by analogy, the correlations in the four directions of 0°, 45°, 90°, and 135° can be obtained.
[0049] 120. According to texture correlation, determine the texture direction of the area to be processed from multiple directions.
[0050] It can be understood that, since texture correlation represents the similarity of textures in spatial positions, it can reflect the distribution of textures in spatial positions. Therefore, the texture direction of the texture in spatial positions can be determined based on the texture correlation.
[0051] In some implementations, the texture direction can be quickly determined based on texture correlation to improve processing efficiency. Specifically, based on texture correlation, the texture direction of the area to be processed is determined from multiple directions, including:
[0052] The direction with the highest texture correlation among multiple directions is determined as the texture direction of the area to be processed.
[0053] It can be understood that, since texture correlation is used to characterize the similarity of textures in spatial position, the greater the texture correlation, the closer the grayscale of the pixels is, and it also indicates that the local textures such as grooves are similar, that is, the direction of the local texture is along this direction. For example, the correlation of the four directions of 0°, 45°, 90°, and 135° can be calculated. If the correlation value of the 45° direction is the largest, the 45° direction can be determined as the texture direction of the area to be processed.
[0054] 130. If the texture difference of the area to be processed meets a preset difference condition, determine the texture direction of the area to be processed as the intra-frame prediction direction of the area to be processed.
[0055] The texture difference is used to characterize the degree of texture difference in different regions. The degree of difference can be characterized by whether there are texture grooves, whether the texture changes locally, etc.
[0056] It can be understood that, since texture is actually the uneven grooves on the surface of an object and the patterns on the smooth surface of an object, if there are grooves and local changes in texture (patterns) in the area to be processed, it means that there is texture in the area. In this way, the preset difference condition can refer to a preset condition for determining whether there is texture in the area to be processed. For example, if the texture difference of the area to be processed meets the preset difference condition, there is texture in the area to be processed (that is, it is a texture area), if the texture difference of the area to be processed does not meet the preset difference condition (that is, it is a non-texture area). In this way, the embodiment of the present application can determine the texture direction of the area to be processed based on texture correlation, and determine whether there is texture in the area to be processed based on the texture difference of the area to be processed, so that the texture direction of the area to be processed where there is texture can be used as the intra-frame prediction direction, so as to quickly identify the texture area with a clear texture direction from the frame to be processed, and quickly determine the intra-frame prediction method, effectively improve the intra-frame prediction speed, and save system resources.
[0057] In some implementations, based on the texture inverse difference and texture contrast, it is possible to quantitatively and accurately determine whether the area to be processed is a texture area, thereby improving the efficiency and accuracy of intra-frame prediction. Specifically, the texture difference includes the texture inverse difference and the texture contrast. If the texture difference of the area to be processed meets the preset difference condition, the texture direction of the area to be processed is determined as the intra-frame prediction direction of the area to be processed, including:
[0058] If the texture inverse difference of the to-be-processed region is smaller than the first threshold, and if the texture contrast of the to-be-processed region is larger than the second threshold, the texture direction of the to-be-processed region is determined as the intra-frame prediction direction of the to-be-processed region.
[0059] The texture inverse gap is used to characterize the degree of change in different regions of the texture. For example, the texture inverse gap can be a measure of the uniformity of the local grayscale of an image. The larger the texture inverse gap, the less variation there is between different regions of the image texture. The more uniform the local image is, the smaller the texture inverse gap is, which means that there are more variations between different regions of the image texture and the local image is not uniform.
[0060] The texture contrast is used to characterize the brightness contrast of the texture. For example, the texture contrast can be the brightness contrast of a certain pixel and its surrounding pixels. The larger the texture contrast, the deeper the texture grooves and the clearer the visual effect. The smaller the texture contrast, the shallower the texture grooves and the more blurred the visual effect.
[0061] In some embodiments, the texture inverse difference and texture contrast can be determined according to the gray level co-occurrence matrix corresponding to the texture direction. In this way, the texture inverse difference and texture contrast can be accurately and quantitatively reflected based on the gray level co-occurrence matrix of the area to be processed. In addition, only the texture inverse difference and texture contrast in the texture direction are calculated, which can save computing resources and improve processing efficiency.
[0062] In some embodiments, the formula Calculate the texture inverse distance. In some embodiments, the formula Calculate the texture contrast. Where P i,j represents the matrix after normalization of each element (matrix value) in the gray level co-occurrence matrix, i and j represent columns and rows. N represents the gray level of the grayscale image. For example, when the texture direction is 45°, the gray level co-occurrence matrix in the 45° direction can be used to calculate the statistical inverse difference and contrast in the 45° direction, which are used as the texture inverse difference and texture contrast, respectively.
[0063] Among them, the first threshold and the second threshold are the thresholds corresponding to the texture inverse difference and the texture contrast, respectively. In practical applications, the first threshold and the second threshold can be set according to actual needs or application scenarios. For example, entropy can be defined by the probability of the grayscale co-occurrence matrix, and then a more advanced quotient can be introduced for thresholding to determine the first threshold and the second threshold, or the grayscale-gradient co-occurrence matrix model can be used to determine the first threshold and the second threshold based on maximum entropy thresholding. For another example, the first threshold and the second threshold can also be determined by a machine learning method, such as inputting the texture inverse difference and the texture contrast into a pre-trained multi-layer feedforward neural network (BP network), and the BP network uses a gradient descent algorithm, that is, the fastest descent method in nonlinear programming, to modify the weight coefficients in the negative gradient direction of the error function, and by finding the minimum value of the error function, it converges to the minimum error point to output the first threshold corresponding to the texture inverse difference and the second threshold corresponding to the texture contrast.
[0064] It can be understood that, since the texture inverse difference and texture contrast are used to characterize the difference between texture changes and texture brightness, respectively, the smaller the texture inverse difference and the larger the texture contrast of the area to be processed, the unevenness of the area to be processed and the deeper the texture grooves. Therefore, by reasonably setting the first threshold and the second threshold, it can be considered that the area to be processed with a texture inverse difference less than the first threshold and a texture contrast greater than the second threshold has obvious texture, that is, the area to be processed is a texture area. If the texture inverse difference of the area to be processed is greater than or equal to the first threshold or the texture contrast is less than or equal to the second threshold, it means that there is no texture or the texture is not obvious in the area to be processed, that is, the area to be processed is a non-texture area.
[0065] In some embodiments, after calculating the texture inverse matrix, it can be selected whether to calculate the texture contrast according to the comparison result with the first threshold, and then compared with the second threshold, so that the texture inverse matrix and the texture contrast can be calculated in a distributed manner, so that when the texture inverse matrix is greater than the first threshold, the texture contrast does not need to be calculated, saving computing resources. Specifically, if the texture inverse difference of the area to be processed is less than or equal to the first threshold, and if the texture contrast of the area to be processed is greater than the second threshold, the texture direction of the area to be processed is determined as the intra-frame prediction direction of the area to be processed, including:
[0066] Determine the texture inverse gap of the area to be processed;
[0067] Determine whether the texture inverse difference of the area to be processed is less than a first threshold;
[0068] If so, determine the texture contrast of the area to be processed;
[0069] Determine whether the texture contrast of the area to be processed is greater than a second threshold;
[0070] If so, the texture direction of the area to be processed is determined as the intra-frame prediction direction of the area to be processed.
[0071] For example, when the texture direction is 45°, the grayscale co-occurrence matrix in the 45° direction can be used to calculate the texture inverse difference in the 45° direction of the area to be processed. If the value of the texture inverse difference is greater than or equal to the first threshold, the area to be processed is a non-texture area. If the value of the texture inverse difference is less than the first threshold, the grayscale co-occurrence matrix in the 45° direction is used to calculate the texture contrast in the 45° direction of the area to be processed. If the texture contrast is less than or equal to the second threshold, the area to be processed is a non-texture area. If the texture contrast is greater than the second threshold, the area to be processed is a texture area. In this way, the texture direction of the area to be processed can be used as its intra-frame prediction direction.
[0072] 140. Perform intra-frame prediction on the frame to be processed according to the intra-frame prediction direction of the region to be processed, so as to perform encoding according to the intra-frame prediction result.
[0073] Among them, intra-frame prediction refers to using the correlation in the video spatial domain to predict the current pixel using the pixels that have been encoded in the current image. Specifically, in the intra-frame prediction process, since the pixels used for prediction and the pixels currently being encoded are in the same video frame, and are generally in adjacent areas. Since there is a strong correlation between adjacent pixels, the pixel values are generally very close, the probability of mutation is very small, and the difference is 0 or a very small number. Therefore, what is transmitted after intra-frame prediction is the difference between the predicted value and the true value, that is, the value near 0, which is called the prediction error or residual, so that fewer bits are used for transmission to achieve a compression effect. When performing intra-frame prediction, the prior art usually needs to traverse a large number of intra-frame prediction directions, select an intra-frame prediction direction for the final prediction encoding of the current coding block, and then perform intra-frame prediction based on this direction. This process is complicated and occupies more system resources.
[0074] For example, the embodiment of the present application can be applied to the image encoding process. Specifically, the frame to be processed can be divided into blocks, the block information can be added to the code stream, and the texture correlation of multiple directions of each area to be processed in the grayscale image of the current frame can be determined by step 110 of the embodiment of the present application, and then the texture direction of each area to be processed can be determined according to the texture correlation by step 120, and then the texture direction of each area to be processed can be determined from the area to be processed in the frame to be processed as a texture area by step 130. After determining that the area to be processed is a texture area, the area to be processed in the frame to be processed can be predicted using the intra-frame prediction direction corresponding to the area to be processed to generate a residual, and then motion estimation and motion compensation can be performed by inter-frame prediction coding, the residual can be transformed, the transformation coefficients can be quantized and scanned, and the quantized transformation coefficients, motion information, prediction information, etc. can be entropy encoded to form a compressed video code stream output.
[0075] Thus, in the embodiment of the present application, for the texture area in the frame to be processed, the texture direction of the area to be processed where the texture exists is used as the intra-frame prediction direction, so as to quickly identify the texture area with a clear texture direction from the frame to be processed, without having to perform a process of traversing multiple intra-frame prediction directions and determining an intra-frame prediction direction for performing the final prediction coding thereon, so as to effectively improve the intra-frame prediction speed and save system resources. In addition, since strong correlation usually occurs in the texture direction during the intra-frame coding process, the stronger the correlation between the coding blocks, the more similar their texture directions are, so intra-frame prediction of the area to be processed where the texture exists based on the texture direction can ensure the quality and bit rate of the encoded image.
[0076] In some embodiments, for a to-be-processed area (ie, a non-texture area) whose texture difference does not satisfy a preset difference condition, an existing intra-frame prediction method may be sampled to traverse multiple intra-frame prediction directions to determine an intra-frame prediction direction for performing final prediction coding thereon.
[0077] In some implementations, a corresponding target frame prediction mode may be determined based on the intra-frame prediction direction to improve the accuracy and efficiency of intra-frame prediction. Specifically, according to the intra-frame prediction direction of the region to be processed, intra-frame prediction is performed on the frame to be processed so as to be encoded according to the intra-frame prediction result, including:
[0078] In the frame to be processed, determining the coding block to be processed corresponding to the area to be processed;
[0079] Determining a target intra-frame prediction mode according to an intra-frame prediction direction of the region to be processed;
[0080] According to the target intra prediction mode, intra prediction is performed on the coding block to be processed.
[0081] The coding block refers to a block obtained by dividing the frame to be processed. For example, a quadtree can be used to divide the frame to be processed into a number of square coding tree blocks (CTBs), and the CTBs can be further divided into coding blocks (CBs).
[0082] Among them, the intra-frame prediction mode refers to the mode used for intra-frame prediction, which can be a preset mode associated with the intra-frame prediction direction. The intra-frame prediction mode can be an existing public mode or a customized mode based on the scene or demand. For example, in the existing HEVC, there are 35 traditional intra-frame prediction modes to choose from, namely: DC mode, Planar mode and 33 angle modes. When the intra-frame prediction mode is DC mode, the prediction value is obtained by appropriately averaging the left reference pixel and the upper reference pixel.
[0083] For example, a coding block in a frame to be processed that is consistent with a region to be processed where texture exists can be used as the coding block to be processed. Then, according to the intra-frame prediction direction of the region to be processed, an intra-frame prediction mode that matches it is selected as the target intra-frame prediction mode, and intra-frame prediction is performed on the coding block to be processed based on the target intra-frame prediction mode.
[0084] In some embodiments, the corresponding intra-frame prediction mode can be set based on the direction of the gray-level co-occurrence matrix. For example, the intra-frame prediction modes corresponding to the 0° direction include: mode 1, mode 6, mode 8, DC mode; the intra-frame prediction modes corresponding to the 45° direction include: mode 3, mode 7, mode 8, DC mode; the intra-frame prediction modes corresponding to the 90° direction include: mode 0, mode 5, mode 7, DC mode; the intra-frame prediction modes corresponding to the 135° direction include: mode 4, mode 5, mode 6, DC mode.
[0085] For example, Figure 1d As shown in (a), the pixels A to Q adjacent to the coding block to be processed can be used to perform 4×4 prediction on pixels a to p in the coding block to be processed. Figure 1d There are eight prediction directions 0, 1, 3, 4, 5, 6, 7, and 8 as shown in (b). Specifically, mode 0 is a vertical mode, such as Figure 1e In this mode, the corresponding pixel values are pushed vertically from A, B, C, and D; Mode 1 is the horizontal mode, as shown in Figure 1e As shown in 1 (horizontal), in this mode, the corresponding pixel value is derived horizontally from I, J, K, and L; Mode 2 is the DC mode, such as Figure 1e As shown in Figure 2 (DC), in this mode, all pixel values are derived from the average values of A~D and I~L; Mode 3 is the diagonal down-left mode, as shown in Figure 2 (DC). Figure 1e As shown in Figure 3 (diagonal down-left), in this mode, the corresponding pixel value is obtained by interpolating the pixels in the 45° direction; Mode 4 is the diagonal down-right mode, as shown in Figure 3 (diagonal down-left). Figure 1e As shown in 4 (diagonal down-right), in this mode, the corresponding pixel value is obtained by interpolating the pixels in the 45° direction; Mode 5 is the right vertical (vertical-right) mode, as shown in Figure 1e As shown in 5 (vertical-right), in this mode, the corresponding pixel value is obtained by interpolating the pixels in the 26.6° direction; Mode 6 is the horizontal-down mode, as shown in Figure 1e As shown in 6 (horizontal-down), in this mode, the corresponding pixel value is obtained by interpolating the pixels in the 26.6° direction; Mode 7 is the left vertical (vertical-left) mode, as shown in Figure 1e As shown in Figure 7 (vertical-left), in this mode, the corresponding pixel value is obtained by interpolating the pixels in the 26.6° direction; Mode 8 is the horizontal-up mode, as shown in Figure 7 (vertical-left). Figure 1e As shown in Figure 7 (horizontal-up), in this mode, the corresponding pixel value is obtained by interpolating the pixels in the 26.6° direction.
[0086] In some implementations, when the coding block in the frame to be processed is larger than the area to be processed, the initial coding block can be segmented to reasonably determine the area in the frame to be processed for intra-frame prediction based on the texture direction, thereby improving the accuracy of intra-frame prediction. Specifically, in the frame to be processed, determining the coding block to be processed corresponding to the area to be processed includes:
[0087] In the frame to be processed, determining an initial coding block corresponding to the area to be processed;
[0088] If the initial coding block is smaller than or equal to the area to be processed, the initial coding block is used as the coding block to be processed;
[0089] If the initial coding block is larger than the area to be processed, the initial coding block is cropped to obtain the coding block to be processed.
[0090] For example, the area to be processed with texture in the grayscale image can be mapped to the frame to be processed, and the coding block covered by the area mapped to the frame to be processed is used as the initial coding block. The coding block size can be A×A, and the size of the area to be processed can be the size of the sliding window B×B. In practical applications, A is usually an even number and B is an odd number. Therefore, the size of the initial coding block may be inconsistent with that of the area to be processed. At this time, the size of A and B can be compared (that is, it is equivalent to comparing the size of the initial coding block with the area to be processed). If A is less than or equal to B, the initial coding block can be used as the coding block to be processed. If A is greater than B, there is an area in the initial coding block that is not covered by the area to be processed. Therefore, the size of the coding block can be cropped from A×A to B×B, and the cropped B×B coding block is used as the coding block to be processed, so as to increase the consistency between the area to be processed and the coding block to be processed and improve processing efficiency.
[0091] In some implementations, due to the inconsistency between the size of the area to be processed and the coding block, the area to be processed may not completely cover the coding block in the frame to be processed, so that the partially covered coding block can be cropped to perform intra-frame prediction on the area corresponding to the area to be processed based only on the texture direction, thereby improving the accuracy of intra-frame prediction. Specifically, in the frame to be processed, determining the coding block to be processed corresponding to the area to be processed includes:
[0092] In the frame to be processed, determining an initial coding block corresponding to the area to be processed;
[0093] If the area to be processed completely covers the initial coding block, the initial coding block is used as the coding block to be processed;
[0094] If the area to be processed completely covers the initial coding block, the initial coding block is cropped to obtain the coding block to be processed.
[0095] For example, the area to be processed with texture in the grayscale image can be mapped to the frame to be processed. If the area mapped to the frame to be processed only partially covers the coding block, the covered area in the coding block can be cropped as the coding block to be processed.
[0096] The intra-frame prediction scheme provided by the embodiment of the present application can be applied in various decoding scenarios. For example, taking video decoding as an example, the texture correlation of multiple directions of the area to be processed is determined, and the area to be processed is the image area in the grayscale image of the frame to be processed; according to the texture correlation, the texture direction of the area to be processed is determined from multiple directions; if the texture difference of the area to be processed meets the preset difference condition, the texture direction of the area to be processed is determined as the intra-frame prediction direction of the area to be processed; according to the intra-frame prediction direction of the area to be processed, the frame to be processed is intra-frame predicted, so as to be encoded according to the intra-frame prediction result.
[0097] As can be seen from the above, the embodiment of the present application can determine the texture direction of the area to be processed based on texture correlation, and determine whether the area to be processed has texture based on the texture difference of the area to be processed, so that the texture direction of the area to be processed with texture can be used as the intra-frame prediction direction, so as to quickly identify the texture area with clear texture direction from the frame to be processed, and quickly determine the intra-frame prediction method, effectively improve the intra-frame prediction speed, and save system resources. In addition, since strong correlation usually occurs in the texture direction during intra-frame coding, the stronger the correlation between coding blocks, the more similar their texture directions are, so intra-frame prediction of the area to be processed with texture based on the texture direction can ensure the quality and bit rate of the encoded image.
[0098] The method described in the above embodiment will be further described in detail below.
[0099] In this embodiment, the method of the embodiment of the present application is described in detail by taking the application in a video encoding process as an example.
[0100] like Figure 2 As shown, the specific process of an intra-frame prediction method is as follows:
[0101] 210. Obtain a frame to be processed in the video to be processed.
[0102] For example, a video to be processed may be captured by an image capture device such as a camera, and a frame in the video to be processed is the frame to be processed.
[0103] 220. Convert the frame to be processed into an initial grayscale image, perform equalization processing on the initial grayscale image, and obtain a grayscale image of the frame to be processed.
[0104] For example, a grayscale image can be extracted from the original image of the frame to be processed to obtain an initial grayscale image. In order to make the result more accurate, histogram equalization is performed on the initial grayscale image to improve the contrast and obtain a grayscale image.
[0105] 230. Determine at least one area to be processed from the grayscale image of the frame to be processed according to the sliding window.
[0106] For example, a sliding window of size N*N may be used to perform sliding cutting on the grayscale image after histogram equalization to determine multiple areas to be processed.
[0107] 240. Determine texture correlations in multiple directions of a region to be processed, where the region to be processed is an image region in a grayscale image of a frame to be processed.
[0108] For example, each time sliding, the gray level co-occurrence matrix of the window (corresponding to the area to be processed A) in four directions (0°, 45°, 90°, 135°) can be calculated.
[0109] 250. According to texture correlation, determine the texture direction of the area to be processed from multiple directions.
[0110] For example, for the area A to be processed, the correlation features in four directions, namely, the texture correlation, can be calculated, and the subsequent steps can be performed on the direction with the largest correlation (recorded as d).
[0111] 260. If the texture inverse difference of the area to be processed is less than the first threshold, and if the texture contrast of the area to be processed is greater than the second threshold, determine the texture direction of the area to be processed as the intra-frame prediction direction of the area to be processed.
[0112] For example, for the processed area A, the inverse moment (texture inverse difference) and contrast (texture contrast) can be calculated for the gray level co-occurrence matrix in the direction with the largest correlation, and compared with the thresholds of the inverse moment and contrast. Among them, if the result of the inverse moment is greater than the threshold, it is determined to be a non-texture area; if the result is less than the threshold, the contrast feature comparison is continued; contrast: if the result is less than the threshold, it is determined to be a non-texture area; if the result is greater than the threshold, it is determined to be a texture area.
[0113] It should be noted that the thresholds of the inverse moment and contrast can be determined by machine learning methods.
[0114] 270. Perform intra-frame prediction on the frame to be processed according to the intra-frame prediction direction of the region to be processed, so as to perform encoding according to the intra-frame prediction result.
[0115] For example, if the area A to be processed is determined to be a texture area, the direction d can be used as the intra-frame prediction direction to perform intra-frame prediction. Specifically, the intra-frame prediction direction corresponding to the area A to be processed can be used to select a corresponding intra-frame prediction mode, and the intra-frame prediction mode can be used to perform intra-frame prediction on the area corresponding to the area A to be processed in the processed frame to generate a residual, and then inter-frame prediction coding is used to perform motion estimation and motion compensation, transform the residual, quantize and scan the transform coefficients, and perform entropy coding on the quantized transform coefficients, motion information, prediction information, etc. to form a compressed video code stream output.
[0116] As can be seen from the above, the embodiment of the present application can detect the texture area and non-texture area of the image under the guidance of the contrast, correlation and inverse difference moment of the gray level co-occurrence matrix. At the same time, according to the correlation, the direction of the edge texture can be roughly determined, and the direction information can be used to assist the frame selection of the intra prediction mode, thereby further reducing the complexity of the intra mode selection.
[0117] In order to better implement the above method, the embodiment of the present application also provides an intra-frame prediction device, which can be integrated in an electronic device, and the electronic device can be a terminal, a server, etc. Among them, the terminal can be a mobile phone, a tablet computer, a smart Bluetooth device, a laptop, a personal computer, etc.; the server can be a single server or a server cluster composed of multiple servers.
[0118] For example, in this embodiment, the method of the embodiment of the present application is described in detail by taking the intra-frame prediction device being specifically integrated in a server as an example.
[0119] For example, Figure 3 As shown, the intra-frame prediction apparatus may include a correlation determination unit 310, a texture direction determination unit 320, a prediction direction determination unit 330, and an intra-frame prediction unit 340, as follows:
[0120] (I) Correlation determination unit 310
[0121] It is used to determine the texture correlation in multiple directions of the area to be processed, where the area to be processed is the image area in the grayscale image of the frame to be processed.
[0122] In some implementations, the correlation determination unit 310 may be specifically configured to:
[0123] According to the grayscale of the pixels in the area to be processed, the grayscale co-occurrence matrix of the area to be processed in multiple directions is calculated;
[0124] According to the gray level co-occurrence matrices in multiple directions, the texture correlations in multiple directions of the area to be processed are determined.
[0125] In some implementations, the intra-frame prediction apparatus further includes a processing unit, which may be specifically configured to:
[0126] Convert the frame to be processed into an initial grayscale image;
[0127] The initial grayscale image is equalized to obtain a grayscale image of the frame to be processed.
[0128] In some implementations, the intra-frame prediction apparatus further includes a sliding unit, and the sliding unit may be specifically used for:
[0129] At least one area to be processed is determined from the grayscale image of the frame to be processed according to the sliding window.
[0130] (ii) Texture direction determination unit 320
[0131] It is used to determine the texture direction of the area to be processed from multiple directions according to texture correlation.
[0132] In some implementations, the texture direction determination unit 320 may be specifically configured to:
[0133] The direction with the highest texture correlation among multiple directions is determined as the texture direction of the area to be processed.
[0134] (III) Prediction direction determination unit 330
[0135] If the texture difference of the area to be processed meets a preset difference condition, the texture direction of the area to be processed is determined as the intra-frame prediction direction of the area to be processed.
[0136] In some implementations, the texture difference includes texture inverse difference and texture contrast, and the prediction direction determination unit 330 may be specifically used to:
[0137] If the texture inverse difference of the to-be-processed region is smaller than the first threshold, and if the texture contrast of the to-be-processed region is larger than the second threshold, the texture direction of the to-be-processed region is determined as the intra-frame prediction direction of the to-be-processed region.
[0138] In some implementations, if the texture inverse difference of the area to be processed is less than or equal to a first threshold, and if the texture contrast of the area to be processed is greater than a second threshold, determining the texture direction of the area to be processed as the intra-frame prediction direction of the area to be processed includes:
[0139] Determine the texture inverse gap of the area to be processed;
[0140] Determine whether the texture inverse difference of the area to be processed is less than a first threshold;
[0141] If so, determine the texture contrast of the area to be processed;
[0142] Determine whether the texture contrast of the area to be processed is greater than a second threshold;
[0143] If so, the texture direction of the area to be processed is determined as the intra-frame prediction direction of the area to be processed.
[0144] (IV) Intra-frame prediction unit 340
[0145] It is used to perform intra-frame prediction on the frame to be processed according to the intra-frame prediction direction of the area to be processed, so as to perform encoding according to the intra-frame prediction result.
[0146] In some implementations, the intra prediction unit 340 may be specifically configured to:
[0147] In the frame to be processed, determining the coding block to be processed corresponding to the area to be processed;
[0148] Determining a target intra-frame prediction mode according to an intra-frame prediction direction of the region to be processed;
[0149] According to the target intra prediction mode, intra prediction is performed on the coding block to be processed.
[0150] In some implementations, in a frame to be processed, determining a coding block to be processed corresponding to a region to be processed includes:
[0151] In the frame to be processed, determining an initial coding block corresponding to the area to be processed;
[0152] If the initial coding block is smaller than or equal to the area to be processed, the initial coding block is used as the coding block to be processed;
[0153] If the initial coding block is larger than the area to be processed, the initial coding block is cropped to obtain the coding block to be processed.
[0154] In specific implementation, the above units can be implemented as independent entities, or can be arbitrarily combined to be implemented as the same or several entities. The specific implementation of the above units can refer to the previous method embodiments, which will not be repeated here.
[0155] Therefore, the embodiment of the present application can determine the texture direction of the area to be processed based on texture correlation, and determine whether the area to be processed has texture based on the texture difference of the area to be processed, so that the texture direction of the area to be processed with texture can be used as the intra-frame prediction direction to quickly identify the texture area with clear texture direction from the frame to be processed, and quickly determine the intra-frame prediction method, effectively improve the intra-frame prediction speed, and save system resources. In addition, since strong correlation usually occurs in the texture direction during intra-frame coding, the stronger the correlation between coding blocks, the more similar their texture directions are, so intra-frame prediction of the area to be processed with texture based on the texture direction can ensure the quality and bit rate of the encoded image.
[0156] Correspondingly, an embodiment of the present application also provides a computer device, which may be a terminal or a server, and the terminal may be a smart phone, a tablet computer, a laptop computer, a touch screen, a game console, a personal computer, a personal digital assistant (PDA), or other terminal devices.
[0157] like Figure 4 As shown, Figure 4The schematic diagram of the structure of the computer device provided in the embodiment of the present application is that the computer device 400 includes a processor 410 having one or more processing cores, a memory 420 having one or more computer-readable storage media, and a computer program stored in the memory 420 and executable on the processor. The processor 410 is electrically connected to the memory 420. It can be understood by those skilled in the art that the computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0158] The processor 410 is the control center of the computer device 400. It uses various interfaces and lines to connect various parts of the entire computer device 400, executes various functions of the computer device 400 and processes data by running or loading software programs and / or modules stored in the memory 420, and calling data stored in the memory 420, thereby monitoring the computer device 400 as a whole.
[0159] In the embodiment of the present application, the processor 410 in the computer device 400 will load instructions corresponding to the processes of one or more application programs into the memory 420 according to the following steps, and the processor 410 will run the application programs stored in the memory 420 to implement various functions:
[0160] Determine the texture correlation of multiple directions of the area to be processed, where the area to be processed is an image area in the grayscale image of the frame to be processed; determine the texture direction of the area to be processed from multiple directions based on the texture correlation; if the texture difference of the area to be processed meets the preset difference condition, determine the texture direction of the area to be processed as the intra-frame prediction direction of the area to be processed; perform intra-frame prediction on the frame to be processed based on the intra-frame prediction direction of the area to be processed, so as to encode according to the intra-frame prediction result.
[0161] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0162] Optional, such as Figure 4 As shown, the computer device 400 further includes: a touch screen 430, a radio frequency circuit 440, an audio circuit 450, an input unit 460, and a power supply 470. The processor 410 is electrically connected to the touch screen 430, the radio frequency circuit 440, the audio circuit 450, the input unit 460, and the power supply 470, respectively. Those skilled in the art will appreciate that Figure 4 The computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0163] The touch display screen 430 can be used to display a graphical user interface and receive operation instructions generated by the user acting on the graphical user interface. The touch display screen 430 may include a display panel and a touch panel. Among them, the display panel may be used to display information input by the user or information provided to the user and various graphical user interfaces of the computer device, which may be composed of graphics, text, icons, videos and any combination thereof. Optionally, the display panel may be configured in the form of a liquid crystal display (LCD, Liquid Crystal Display), an organic light-emitting diode (OLED, Organic Light-Emitting Diode) and the like. The touch panel may be used to collect the user's touch operation on or near it (such as the user using any suitable object or accessory such as a finger, stylus, etc. on the touch panel or near the touch panel), and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the touch point coordinates, and then sends it to the processor 410, and can receive the command sent by the processor 410 and execute it. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it is transmitted to the processor 410 to determine the type of touch event, and then the processor 410 provides a corresponding visual output on the display panel according to the type of touch event. In an embodiment of the present application, the touch panel and the display panel can be integrated into the touch display screen 430 to realize the input and output functions. However, in some embodiments, the touch panel and the display panel can be used as two independent components to realize the input and output functions. That is, the touch display screen 430 can also be used as a part of the input unit 460 to realize the input function.
[0164] The radio frequency circuit 440 may be used to send and receive radio frequency signals, so as to establish wireless communication with a network device or other computer devices through wireless communication, and to send and receive signals between the network device or other computer devices.
[0165] The audio circuit 450 can be used to provide an audio interface between the user and the computer device through a speaker and a microphone. The audio circuit 450 can transmit the electrical signal converted from the received audio data to the speaker, which is converted into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 450 and converted into audio data, and then the audio data is output to the processor 410 for processing, and then sent to another computer device through the radio frequency circuit 440, or the audio data is output to the memory 420 for further processing. The audio circuit 450 may also include an earphone jack to provide communication between an external headset and the computer device.
[0166] The input unit 460 may be used to receive input numbers, character information or user feature information (such as fingerprint, iris, facial information, etc.), and to generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0167] The power supply 470 is used to supply power to various components of the computer device 400. Optionally, the power supply 470 can be logically connected to the processor 410 through a power management system, so that the power management system can manage charging, discharging, and power consumption. The power supply 470 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0168] although Figure 4 Not shown, the computer device 400 may also include a camera, a sensor, a wireless fidelity module, a Bluetooth module, etc., which will not be described in detail here.
[0169] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0170] It can be seen from the above that the computer device provided in this embodiment can quickly identify the texture area with clear texture direction from the frame to be processed, and quickly determine the intra-frame prediction method, effectively improving the intra-frame prediction speed and saving system resources.
[0171] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0172] To this end, an embodiment of the present application provides a computer-readable storage medium, in which a plurality of computer programs are stored, and the computer program can be loaded by a processor to execute the steps in any one of the intra-frame prediction methods provided in the embodiments of the present application. For example, the computer program can execute the following steps:
[0173] Determine the texture correlation of multiple directions of the area to be processed, where the area to be processed is an image area in the grayscale image of the frame to be processed; determine the texture direction of the area to be processed from multiple directions based on the texture correlation; if the texture difference of the area to be processed meets the preset difference condition, determine the texture direction of the area to be processed as the intra-frame prediction direction of the area to be processed; perform intra-frame prediction on the frame to be processed based on the intra-frame prediction direction of the area to be processed, so as to encode according to the intra-frame prediction result.
[0174] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0175] The storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0176] Since the computer program stored in the storage medium can execute the steps in any one of the intra-frame prediction methods provided in the embodiments of the present application, the beneficial effects that can be achieved by any one of the intra-frame prediction methods provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0177] The above is a detailed introduction to an intra-frame prediction method, device, computer equipment and storage medium provided in an embodiment of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. An intra-frame prediction method, It is characterized in that include: Determine texture correlations in multiple directions of a region to be processed, wherein the region to be processed is an image region in a grayscale image of a frame to be processed; Determining the texture direction of the area to be processed from the multiple directions according to the texture correlation; If the texture inverse difference of the area to be processed is less than a first threshold value, and if the texture contrast of the area to be processed is greater than a second threshold value, determining the texture direction of the area to be processed as the intra-frame prediction direction of the area to be processed; According to the intra-frame prediction direction of the area to be processed, intra-frame prediction is performed on the frame to be processed, so as to perform encoding according to the intra-frame prediction result.
2. The intra-frame prediction method according to claim 1, It is characterized in that If the texture inverse difference of the area to be processed is less than a first threshold value, and if the texture contrast of the area to be processed is greater than a second threshold value, determining the texture direction of the area to be processed as the intra-frame prediction direction of the area to be processed, comprises: Determining the texture inverse difference of the area to be processed; Determine whether the texture inverse difference of the area to be processed is less than the first threshold; If so, determining the texture contrast of the area to be processed; Determining whether the texture contrast of the area to be processed is greater than the second threshold; If so, the texture direction of the area to be processed is determined as the intra-frame prediction direction of the area to be processed.
3. The intra-frame prediction method according to claim 1, It is characterized in that The step of determining the texture correlations of the area to be processed in multiple directions includes: Calculating the gray level co-occurrence matrix of the area to be processed in multiple directions according to the gray levels of the pixels in the area to be processed; The texture correlations of the to-be-processed area in multiple directions are determined according to the gray level co-occurrence matrices in the multiple directions.
4. The intra-frame prediction method according to claim 1, It is characterized in that Determining the texture direction of the area to be processed from the multiple directions according to the texture correlation includes: Among the multiple directions, the direction with the highest texture correlation is determined as the texture direction of the area to be processed.
5. The intra-frame prediction method according to claim 1, It is characterized in that The step of performing intra-frame prediction on the frame to be processed according to the intra-frame prediction direction of the region to be processed, so as to perform encoding according to the intra-frame prediction result, includes: In the frame to be processed, determining a coding block to be processed corresponding to the area to be processed; Determining a target intra-frame prediction mode according to the intra-frame prediction direction of the area to be processed; According to the target intra-frame prediction mode, intra-frame prediction is performed on the coding block to be processed.
6. The intra-frame prediction method according to claim 5, It is characterized in that The step of determining, in the frame to be processed, a coding block to be processed corresponding to the area to be processed includes: In the frame to be processed, determining an initial coding block corresponding to the area to be processed; If the initial coding block is smaller than or equal to the area to be processed, use the initial coding block as the coding block to be processed; If the initial coding block is larger than the area to be processed, the initial coding block is cropped to obtain the coding block to be processed.
7. The intra-frame prediction method according to claim 1, It is characterized in that Before determining the texture correlations in multiple directions of the area to be processed, the method further includes: Converting the frame to be processed into an initial grayscale image; The initial grayscale image is subjected to equalization processing to obtain a grayscale image of the frame to be processed.
8. The intra-frame prediction method according to any one of claims 1 to 7, It is characterized in that Before determining the texture correlations in multiple directions of the area to be processed, the method further includes: At least one area to be processed is determined from the grayscale image of the frame to be processed according to the sliding window.
9. An intra-frame prediction device, It is characterized in that include: A correlation determination unit, used to determine the texture correlation of multiple directions of the area to be processed, wherein the area to be processed is an image area in the grayscale image of the frame to be processed; A texture direction determining unit, configured to determine the texture direction of the area to be processed from the multiple directions according to the texture correlation; A prediction direction determining unit, configured to determine the texture direction of the area to be processed as the intra-frame prediction direction of the area to be processed if the texture inverse difference of the area to be processed is less than a first threshold and if the texture contrast of the area to be processed is greater than a second threshold; The intra-frame prediction unit is used to perform intra-frame prediction on the frame to be processed according to the intra-frame prediction direction of the region to be processed, so as to perform encoding according to the intra-frame prediction result.
10. A computer device, It is characterized in that It comprises a processor and a memory, wherein the memory stores a plurality of instructions; the processor loads instructions from the memory to execute the steps in the intra-frame prediction method according to any one of claims 1 to 8.
11. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the steps in the intra-frame prediction method according to any one of claims 1 to 8.
