Image coding prediction mode selection method

By pre-setting the encoding prediction mode and selection set in image encoding, and utilizing image redundancy information to optimize the selection of prediction mode, the problems of low compression efficiency and high resource consumption in existing technologies are solved, and efficient and stable image encoding is achieved.

WO2026124129A1PCT designated stage Publication Date: 2026-06-18NANJING MAGEWELL ELECTRONICS CO LTD +1

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
NANJING MAGEWELL ELECTRONICS CO LTD
Filing Date
2025-11-17
Publication Date
2026-06-18

AI Technical Summary

Technical Problem

Existing image coding methods fail to fully utilize redundant image information, resulting in low compression efficiency. Furthermore, video coding suffers from high resource consumption, high latency, and severe error propagation in low-hardware-cost scenarios.

Method used

Several preset coding prediction modes are adopted, and a fixed number of coding prediction mode sets are selected according to the coding scenario. By using intra-frame and inter-frame coding prediction modes, image redundancy information is utilized to reduce error propagation, and the selection of prediction modes is optimized with low hardware cost.

🎯Benefits of technology

It improves the compression efficiency of image encoding, reduces resource consumption and latency, enhances image quality stability, and saves bitrate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025135447_18062026_PF_FP_ABST
    Figure CN2025135447_18062026_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed in the present invention is an image coding prediction mode selection method, which solves the problems in the prior art of conventional image coding not efficiently utilizing image redundancy information, complex video coding having relatively high latency for applications with low hardware costs, etc. In the method of the present invention, several coding prediction modes are preset; in addition to acquiring a reference sample value according to a current image, an absolute reference sample value and a recovery sample value of a reference image are further used as reference sample values, thereby effectively utilizing image redundancy information and improving the compression efficiency; a fixed number of coding prediction modes are set in each selection set, and different coding prediction mode selection sets are determined for different scenarios, thereby reducing coding bitstreams; and when an optimal coding prediction mode is selected, resource consumption and latency are reduced by means of source image information, such that relatively high coding efficiency and relatively good subjective effects can also be realized in the case of low costs and low latency.
Need to check novelty before this filing date? Find Prior Art

Description

An image coding prediction mode selection method Technical Field This invention relates to the field of image encoding and decoding, and more particularly to an image encoding prediction mode selection method. Background Technology Existing conventional image coding methods such as JPEG, JPEG 2000, and JPEG XS are simple to implement, but their prediction is simple. They either do not predict or only use the data of adjacent blocks above the current block for prediction, and do not make full use of the redundant information of the image, resulting in low image compression efficiency. While video coding such as H.264 utilizes redundant information in the image and has multiple prediction modes, resulting in high compression rates, it still has some problems. For example, inter-frame prediction involves motion estimation, which is complex to implement and consumes a lot of resources. Furthermore, the selection of the prediction mode for the current macroblock requires the reference sample value after the current frame is restored, leading to high latency. In addition, if the local restoration of the encoded image is poor, that is, if the current macroblock is poorly restored, it may cause the macroblocks that use the current macroblock as a reference to also be affected, resulting in error propagation and an expansion of the error's impact range. Summary of the Invention In view of this, and to address the shortcomings of existing technologies, this invention proposes an image coding prediction mode selection method that can reduce coding latency and improve image coding compression efficiency even in low-hardware-cost application scenarios. To address the above problems, the image coding prediction mode selection method of the present invention includes the following steps: (1) Several coding prediction modes are preset, and each coding prediction mode corresponds to a set of reference sample values. Macroblock prediction values ​​can be obtained based on the reference sample values. (2) Select a fixed number of coding prediction patterns as the selection set of coding prediction patterns for the corresponding scenario based on the coding scenario; (3) For the current macroblock, select the optimal coding prediction mode based on the macroblock prediction value corresponding to each coding prediction mode in the selection set; (4) Set the prediction mode field to place the optimal encoding prediction mode value and send it to the decoding end along with the encoded bitstream. The coding prediction mode includes intra-frame coding prediction mode, which includes regular intra-frame coding prediction mode and isolated intra-frame coding prediction mode. Regular intra-frame coding prediction mode includes the intra-frame coding prediction mode in H.264, while isolated intra-frame coding prediction mode calculates reference sample values ​​based on pixel depth during the coding process. Among them, the coding prediction mode also includes the inter-frame coding prediction mode, in which the reference sample value of the current macroblock is the recovered sample value at the corresponding position in the previous frame image. The coding scenarios include pure intra-frame scenarios and general scenarios; pure intra-frame scenarios can only use the conventional intra-frame coding prediction mode, while general scenarios can use both intra-frame coding prediction mode and inter-frame coding prediction mode. The determination of the selection set of coding prediction modes in the general scenario includes the following steps: (21) Create an image dataset of a pure intra-frame scene. The size of the image dataset and the image pixel size are set according to the specific application. (22) Configure network parameters, use all regular intra-frame coding prediction modes as the selection set of coding prediction modes, select the optimal coding prediction mode to encode the image dataset, and calculate the first peak signal-to-noise ratio after decoding; (23) Remove a certain regular intra-frame coding prediction mode from the selection set, retain other regular intra-frame coding prediction modes, and then select the optimal coding prediction mode from the remaining selection set to encode the image dataset and calculate the second peak signal-to-noise ratio after decoding. (24) Compare the first peak signal-to-noise ratio and the second peak signal-to-noise ratio in turn, select the second peak signal-to-noise ratio that is the smallest difference from the first peak signal-to-noise ratio, and denote the corresponding removed conventional intra-frame coding prediction mode as the negligible conventional intra-frame coding prediction mode. (25) Replace the ignorable regular intra-frame coding prediction mode with the isolated intra-frame coding prediction mode to form a selection set of coding prediction modes for intra-frame coding in general scenarios; replace the ignorable regular intra-frame coding prediction mode with the inter-frame coding prediction mode to form a selection set of coding prediction modes for inter-frame coding in general scenarios. The selection of the optimal coding prediction mode in step (3) includes the following steps: (31) Input the location information of the current macroblock and the selection set of coding prediction modes in the corresponding scenario; (32) For the conventional intra-frame coding prediction mode, obtain the reference sample value corresponding to the coding prediction mode in the source image of the image frame where the current macroblock is located; (33) Obtain the macroblock prediction value corresponding to each coding prediction mode in the selection set, and select the optimal coding prediction mode in the selection set according to the preset rules. In step (4), the prediction mode field includes a marker bit and a data bit. Setting the prediction mode field to place the optimal encoded prediction mode value includes the following steps: (41) Initialize the optimal coding prediction mode value of the previous macroblock; (42) If the optimal coding prediction mode value of the current macroblock is equal to the optimal coding prediction mode value of the previous macroblock, then set the flag bit of the prediction mode field to 1 and set the length of the prediction mode field to 1; otherwise, proceed to step (43). (43) If the optimal coding prediction mode value of the current macroblock is less than the optimal coding prediction mode value of the previous macroblock, then set the flag bit of the prediction mode field to 0, the value of the data bit to the optimal coding prediction mode value of the current macroblock, and the length of the prediction mode field to 4; otherwise, proceed to step (44). (44) Set the flag bit of the prediction mode field to 0, the value of the data bit to the optimal coding prediction mode value of the current macroblock minus 1, and the length of the prediction mode field to 4. Compared with the prior art, the present invention has the following advantages: By pre-setting several coding prediction modes, in addition to obtaining reference sample values ​​based on the current image, there are also absolute reference sample values ​​and the use of recovered sample values ​​from the reference image as reference sample values. This effectively utilizes image redundancy information and improves compression efficiency. Using absolute reference sample values ​​can block and isolate local blocks, effectively avoiding error propagation and improving image quality stability. By setting a fixed number of coding prediction modes in the selection set, different coding prediction mode selection sets can be determined for different scenarios, which can reduce the number of bits occupied by the coding prediction modes and save bitstream. Further optimization of prediction mode selection: for conventional intra-frame coding prediction modes, the reference sample value corresponding to the coding prediction mode is obtained in the source image where the current macroblock is located, and then the optimal coding prediction method is selected from the selection set based on the macroblock prediction value, reducing resource consumption and latency. Even at low cost, high coding efficiency and good subjective effect can be achieved. Attached Figure Description Figure 1 is a flowchart illustrating the image coding prediction mode selection method of the present invention; Figure 2 is a schematic diagram of the coding prediction modes set in this invention. Figure 2(a) is a schematic diagram of the conventional intra-frame coding prediction mode model_0; Figure 2(b) is a schematic diagram of the conventional intra-frame coding prediction mode model_1; Figure 2(c) is a schematic diagram of the conventional intra-frame coding prediction mode model_2; Figure 2(d) is a schematic diagram of the conventional intra-frame coding prediction mode model_3; Figure 2(e) is a schematic diagram of the conventional intra-frame coding prediction mode model_4; Figure 2(f) is a schematic diagram of the conventional intra-frame coding prediction mode model_5; Figure 2(g) is a schematic diagram of the conventional intra-frame coding prediction mode model_6; Figure 2(h) is a schematic diagram of the conventional intra-frame coding prediction mode model_7; Figure 2(i) is a schematic diagram of the conventional intra-frame coding prediction mode model_8; Figure 2(j) is a schematic diagram of the isolated intra-frame coding prediction mode model_9; Figure 2(k) is a schematic diagram of the inter-frame coding prediction mode model_10. Figure 3 is a schematic diagram of an image frame distribution in a typical scene; Figure 4 is a schematic diagram of another image frame distribution in a typical scene; Figure 5 is a schematic diagram of the process for selecting the optimal coding prediction mode in this invention. Detailed Implementation The present invention will be further described below with reference to embodiments. In image coding, prediction is typically performed on a macroblock basis. The choice of prediction mode during this process affects the stability of image quality, coding efficiency, and compression efficiency. This invention improves the selection of image prediction modes, saving bitstream and improving coding compression performance. Even in FPGA or low-hardware-cost implementation scenarios, it can achieve high coding efficiency and good subjective results. As shown in Figure 1, the image coding prediction mode selection method of the present invention includes the following steps: (1) Several coding prediction modes are preset, and each coding prediction mode corresponds to a set of reference sample values. Macroblock prediction values ​​can be obtained based on the reference sample values. (2) Select a fixed number of coding prediction patterns as the selection set of coding prediction patterns for the corresponding scenario based on the coding scenario; (3) For the current macroblock, select the optimal coding prediction mode based on the macroblock prediction value corresponding to each coding prediction mode in the selection set; (4) Set the prediction mode field to place the optimal encoding prediction mode value and send it to the decoding end along with the encoded bitstream. The above steps will be described in detail below with reference to specific embodiments. In this invention, image coding includes intra-frame coding and inter-frame coding. Intra-frame coding encodes macroblocks solely through intra-frame coding prediction; inter-frame coding also encodes macroblocks through inter-frame coding prediction. Intra-frame and inter-frame coding predictions are primarily distinguished by the reference samples corresponding to their respective coding prediction modes. Intra-frame coding prediction refers to the process of predicting and generating the current macroblock using the recovered sample values ​​from the current frame as reference samples; inter-frame coding prediction refers to the process of predicting and generating the current macroblock using the recovered sample values ​​from the reference image (i.e., the previous frame) as reference samples. For ease of description, this invention refers to the coding prediction mode that uses the data of the corresponding block within the current frame as the reference sample value as the conventional intra-frame coding prediction mode, while the coding prediction mode that uses the recovered sample values ​​from the corresponding position in the previous frame as the reference sample value is referred to as the inter-frame coding prediction mode. Setting the coding prediction mode As shown in Figure 2, this invention takes the coding prediction of 4x4 macroblocks as an example and sets 11 coding prediction modes, including intra-frame coding prediction mode and inter-frame coding prediction mode. The intra-frame coding prediction modes include regular intra-frame coding prediction modes model_0 to model_8 and isolated intra-frame coding prediction mode model_9. The above-mentioned regular coding prediction modes model_0 to model_8 are the same as the intra_4x4 intra-frame prediction mode in H.264, and their corresponding sample reference values ​​are as follows. The standard intra-frame coding prediction mode, model_0 (Vertical), uses sample values ​​from the current macroblock as reference values ​​to predict the current macroblock. Assuming the current macroblock's value is p[x,-1], where x = 0 ... 3, then the predicted value for the current macroblock is pred4x4. L The calculation method for [x, y], x, y = 0..3 is as follows: pred4x4 L [x, y] = p[x,-1], x, y = 0..3. The standard intra-frame coding prediction mode, model_1 (Horizontal), uses the sample values ​​to the left of the current macroblock as sample reference values ​​to predict the current macroblock. Assume the values ​​to the left of the current macroblock are p[-1, y], where y = 0..3, and the predicted value for the current macroblock is pred4x4. L [x, y], where x, y = 0..3 are as follows: pred4x4 L [x, y] = p[-1, y] x,y = 0..3. The standard intra-frame coding prediction mode is model_2 (DC), and the current macroblock prediction value is pred4x4. L [x, y], x, y = 0..3 are obtained as follows: pred4x4 L [x, y] = ( p[0,-1]+p[1,-1]+p[2,-1]+p[3,-1]+ p[-1, 0]+p[-1, 1]+p[-1, 2]+p[-1, 3]+4 )>>3 . The standard intra-frame coding prediction mode, model_3 (Diagonal Down-Left), has the current macroblock prediction value pred4x4. L [x, y] and x, y = 0..3 are obtained as follows: If x equals 3 and y equals 3 pred4x4 L[x, y] = ( p[6,-1]+3 * p[7,-1]+2 )>>2; Otherwise (x, y are not equal to 3) pred4x4 L [x, y] = ( p[x+y,-1]+2 * p[x+y+1,-1]+p[x+y+2,-1]+2 )>>2. In the standard intra-frame coding prediction mode model_4 (Diagonal Down-Right), the prediction value for the current macroblock is pred4x4. L [x, y], x, y = 0..3 are obtained as follows: If x is greater than y, then pred4x4 L [x, y] = ( p[x- y-2,-1]+2 * p[x- y-1,-1]+p[xy,-1]+2 )>>2, Otherwise, if x is less than y pred4x4 L [x, y] = ( p[-1, y- x- 2]+2 * p[-1, y- x- 1]+p[-1, y- x]+2 )>>2, Otherwise (x equals y) pred4x4 L [x, y] = ( p[0,-1]+2 * p[-1,-1]+p[-1, 0]+2 )>>2. In the standard intra-frame coding prediction mode model_5 (Vertical-Right), let zVR = 2*xy, and the current macroblock prediction value pred4x4. L The values ​​of [x, y], x, y = 0, 3 are as follows: If zVR equals 0, 2, 4 or 6, then pred4x4 L [x, y] = ( p[x- ( y>>1 )-1,-1]+p[x- ( y>>1 ),-1]+1 )>>1, Otherwise, if zVR equals 1, 3, or 5, then pred4x4 L [x, y] = ( p[x- ( y>>1 )-2,-1]+2 * p[x- ( y>>1 )- 1,-1]+p[x- ( y>>1 ),-1]+2 )>>2, Otherwise, if zVR equals -1, then pred4x4 L [x, y] = ( p[-1, 0]+2 * p[-1,-1]+p[0,-1]+2 )>>2, Otherwise (zVR equals -2 or -3), pred4x4 L [x, y] = ( p[-1, y- 1]+2 * p[-1, y- 2]+p[-1, y- 3]+2 )>>2. In the standard intra-frame coding prediction mode model_6 (Horizontal-Down), given zHD = 2 * y - x, the current macroblock prediction pred4x4L[x, y], where x, y = 0..3, is obtained as follows: If zHD equals 0, 2, 4 or 6, then pred4x4 L [x, y] = ( p[-1, y- ( x>>1 )- 1]+p[-1, y- ( x>>1 )]+1 )>>1, Otherwise, if zHD equals 1, 3, or 5, then pred4x4 L [x, y] = ( p[-1, y- ( x>>1 )- 2]+2 * p[-1, y- ( x>>1 )- 1]+p[-1, y- ( x>>1 )]+2 )>>2, Otherwise, if zHD equals -1, pred4x4 L [x, y] = ( p[-1, 0]+2 * p[-1,-1]+p[0,-1]+2 )>>2, Otherwise (zHD equals -2 or -3), then pred4x4 L [x, y] = ( p[x- 1,-1]+2 * p[x- 2,-1]+p[x- 3,-1]+2 )>>2. The standard intra-frame coding prediction mode, model_7 (Vertical-Left), has the current macroblock prediction value pred4x4. L [x, y], x, y = 0..3 are obtained as follows: If y equals 0 or 2 pred4x4 L [x, y] = ( p[x+( y>>1 ),-1]+p[x+( y>>1 )+1,-1]+1)>>1, Otherwise (y equals 1 or 3) pred4x4 L [x,y]=(p[x+( y>>1 ),-1]+2 * p[x+( y>>1 )+1,-1]+p[x+( y>>1 )+2,-1]+2 )>>2. In the standard intra-frame coding prediction mode model_8 (Horizontal-Up), let the variable zHU equal x + 2*y, and the current macroblock prediction value pred4x4. L [x, y], x, y = 0..3 are obtained as follows: If zHU equals 0, 2 or 4 pred4x4 L [x, y] = ( p[-1, y+( x>>1 )]+p[-1, y+( x>>1 )+1]+1 )>>1, Otherwise, if zHU equals 1 or 3, pred4x4 L [x,y]=(p[-1,y+( x>>1 )]+2*p[-1, y+( x>>1 )+1]+p[-1, y+( x>>1 )+2]+2 )>>2, Otherwise, if zHU equals 5, pred4x4 L [x, y] = ( p[-1, 2]+3 * p[-1, 3]+2 )>>2, Otherwise (zHU greater than 5) pred4x4 L [x, y] = p[-1, 3]. The aforementioned isolated intra-frame coding prediction mode, model_9 (Fix Value), uses a fixed value as the reference sample value for prediction. If the image to be encoded is complex and the network bandwidth is limited, a large QP (Quantization Parameter) is required during the encoding process to meet the network bandwidth requirements. However, when the QP is large, the recovered sample values ​​will be blurry and distorted. If a poorly recovered sample value is selected as the reference sample value when encoding a macroblock, the recovery of the current block will also be poor, leading to error accumulation and unstable image quality. This invention sets up an isolated intra-frame coding prediction mode, model_9, which uses a fixed value as the reference sample value to directly derive the macroblock prediction value. This ensures that the recovery of the current macroblock is not affected by the surrounding pixels, regardless of their quality. Furthermore, when the image is complex and the surrounding pixels are poorly recovered (such as in random images), it is relatively easy to select the isolated intra-frame coding prediction mode, model_9. The aforementioned fixed value is calculated based on the pixel depth during the encoding process, using the formula fix_val = 1 << (depth - 1), where fix_val is the fixed value and depth is the pixel depth during the encoding process. For example, if the pixel depth during encoding is 10 bits, then fix_val is 512 (1 << 9). The symbols “<<” indicate a leftward displacement, and “>>” indicate a rightward displacement. In this invention, based on the control of hardware costs, motion estimation is not performed. Instead, reference samples are obtained directly using the block data at the corresponding position of the previous frame, and the inter-frame coding prediction mode model_10 (Ref Blk) is set. That is, during the encoding process, the inter-frame coding prediction mode model_10 uses the 4x4 recovered sample value at the corresponding position of the reference frame, i.e., the previous frame, as the reference sample value to directly obtain the macroblock prediction value. (2) Determine the selection set of coding prediction modes based on the coding scenario and coding mode. This invention relates to two scenarios: one is where only intra-frame coding can be used, which is marked as a pure intra-frame scenario in this invention; the second is where both intra-frame coding and inter-frame coding can be used, which is marked as a general scenario. In different scenarios, this invention limits the selection set of encoding prediction modes to 9 types, which can save bitstream and improve encoding compression performance. Pure intra-frame scenes can be applied in situations where hardware conditions are limited and there is no DDR (Double Data Rate, synchronous dynamic random access memory). The entire encoding process only uses the data of the current frame and only involves intra-frame coding modes. In this invention, the selection set of coding prediction modes for pure intra-frame scenes is set to the nine modes from model_0 to model_8 in Figure 2. For general scenarios, intra-frame coding and inter-frame coding are used. This invention relates to two general scenarios. For general scenarios, determining the selection set of coding prediction modes includes the following steps: (21) Create an image dataset of a pure intra-frame scene. The size of the image dataset and the image pixel size are set according to the specific application. (22) Configure network parameters, use all regular intra-frame coding prediction modes model_0 to model_8 as the selection set of coding prediction modes, select the optimal coding prediction mode to encode the image dataset, and calculate the first peak signal-to-noise ratio (PSNR) after decoding. (23) Remove a certain regular intra-frame coding prediction mode model_i (i=0,1,2,......,8) from the selection set, and retain the other coding prediction modes. Then, select the optimal coding prediction mode from the remaining coding prediction modes to encode the image dataset, and calculate the second peak signal-to-noise ratio (PSNR) after decoding. i ; (24) Compare the first peak signal-to-noise ratio (PSNR) with the second peak signal-to-noise ratio (PSNR) in sequence. i Choose the second peak signal-to-noise ratio (PSNR) that has the smallest difference from the first PSNR. i Determine which conventional intra-frame coding prediction mode has the least impact on the first peak signal-to-noise ratio (PSNR) when replacing it, and denote the corresponding removed conventional intra-frame coding prediction mode model_i as the negligible conventional intra-frame coding prediction mode. (25) Replace the ignorable regular intra-frame coding prediction mode with the isolated intra-frame coding prediction mode to form a selection set of coding prediction modes for intra-frame coding in general scenarios; replace the ignorable regular intra-frame coding prediction mode with the inter-frame coding prediction mode to form a selection set of coding prediction modes for inter-frame coding in general scenarios. As one implementation method, an image dataset consisting of 265 images is created, including natural images and screen images, with an image size of 3840x2160 and a network bandwidth of 500Mbps. The aforementioned parameters can be set according to actual needs. The general scenarios in this invention include the following two methods. As shown in Figure 3, during the encoding process, intra-frame coding is performed on image frames at fixed intervals, and the corresponding frames are marked as I-frames (intraframe frames, keyframes). The remaining frames use inter-frame coding and are marked as P-frames (forward-predicted frames, forward-referenced frames). If replacing the conventional intra-frame coding prediction mode model_8 has the least impact on the first peak signal-to-noise ratio (PSNR), then it is a negligible conventional intra-frame coding prediction mode. For I-frames, the nine prediction modes selected are the conventional intra-frame coding prediction modes model_0 to model_7 and the isolated intra-frame coding prediction mode model_9 in Figure 2. For P-frames, the nine prediction modes selected are the conventional intra-frame coding prediction modes model_0 to model_7 and the inter-frame coding prediction mode model_10 in Figure 2. As shown in Figure 4, using the GDR (Gradual Decoding Refresh) method, each frame contains both intra-frame and inter-frame coding. Specifically, each frame is divided into n equal parts, one part is selected for intra-frame coding (called the intra-frame stripe), and the remaining parts are inter-frame coded (called the inter-frame stripe). The advantage of the second method compared to the first is that the bitstream size of each frame is more uniform, which is beneficial for network transmission. In this scenario, intra-frame stripe uses intra-frame coding. If the conventional intra-frame coding prediction mode model_8 has the least impact on the first peak signal-to-noise ratio (PSNR), then it is a negligible conventional intra-frame coding prediction mode. Nine prediction modes, namely conventional intra-frame coding prediction modes model_0 to model_7 and isolated intra-frame coding prediction mode model_9, are selected as the selection set. Inter-frame stripe uses inter-frame coding. In this invention, nine prediction modes, namely conventional intra-frame coding prediction modes model_0 to model_7 and inter-frame coding prediction mode model_10, are selected as the selection modes. (3) Select the optimal coding prediction mode from the selection set of coding prediction modes. As shown in Figure 5, the selection of the optimal coding prediction mode requires the following steps: (31) Input the location information of the current macroblock and the selection set of coding prediction modes in the corresponding scenario; (32) For the regular intra-frame coding prediction mode, the reference sample value corresponding to the coding prediction mode is obtained in the source image of the image frame where the current macroblock is located; for the inter-frame coding prediction mode, the reference sample value of the current macroblock is still the recovered sample value at the corresponding position in the previous frame image; the reference sample value of the isolated intra-frame coding prediction mode is still a fixed value. (33) Obtain the macroblock prediction value corresponding to each coding prediction mode in the selection set, and select the optimal coding prediction mode in the selection set according to the preset rules. The preset rule for the above step (33) is: subtract the pixel components at the corresponding positions of the current macroblock and the macroblock prediction value, then sum the absolute values ​​of the differences, and use the resulting value as the evaluation index. The coding prediction mode with the smallest value is taken as the optimal coding prediction mode, which is H264's SAD (sum of absolute difference). In the existing technology, when the next macroblock selects the optimal coding prediction mode, the reference sample values ​​used by each intra-frame coding prediction mode need to utilize the image information decoded by the previous macroblock. That is, the next macroblock can only complete a new round of optimal coding prediction mode selection after the current macroblock has undergone DCT, quantization, inverse quantization, IDCT and other steps. Compared to existing technologies, although in the actual coding process, the conventional intra-frame predictive coding mode of this invention still uses the recovered sample value of the current frame as the reference sample value to predict the generation of the current macroblock, and the inter-frame coding prediction still uses the recovered sample value of the reference image (i.e., the previous frame) as the reference sample value to predict the generation of the current macroblock, the conventional intra-frame predictive coding mode of this invention directly utilizes the source image information as the reference sample value when selecting the optimal coding prediction mode. This allows for direct processing of the next macroblock after determining the optimal coding prediction mode for the current macroblock, reducing latency. (4) Encoding of the optimal coding prediction mode Using nine prediction modes can be represented using 3 data bits and 1 flag bit. However, more than nine modes require 4 bits, increasing the encoding overhead by one bit for each macroblock's prediction mode. For example, a 3840x2160 image contains 518,400 4x4 macroblocks. Encoding the prediction mode for each block would require 518,400 more bits than using nine modes. If the network bandwidth is 500 Mbps and the frame rate is 60 frames per second, the average compressed size of a 3840x2160 image is 8,333,333 bits. Therefore, the 518,400 bits would occupy 6% of the bitstream. To conserve bitstream, less frequently used prediction modes are replaced, ultimately limiting the number of prediction modes to nine regardless of the scenario. In this invention, a prediction mode field is set to store the optimal coding prediction mode value. Taking the coding prediction selection set, which includes 9 prediction coding modes, as an example, the prediction mode field includes 1 bit of flag bits and 3 bits of data bits. The length of the prediction mode field, code_len, is adjusted according to the relationship between the optimal coding prediction mode value of the current macroblock and the optimal coding prediction mode value of the previous macroblock, and its value is 1 or 4. Specifically, the encoding of the optimal coding prediction mode includes the following steps: (41) Initialize the optimal coding prediction mode value prev_mode of the previous macroblock; (42) If the optimal coding prediction mode value curr_mode of the current macroblock is equal to the optimal coding prediction mode value prev_mode of the previous macroblock, then set the flag bit mode_is_equal_flag of the prediction mode field to 1 and set the length code_len of the prediction mode field to 1; otherwise, proceed to step (43). (43) If the optimal coding prediction mode value curr_mode of the current macroblock is less than the optimal coding prediction mode value prev_mode of the previous macroblock, then set the flag bit mode_is_equal_flag of the prediction mode field to 0, the value of the data bit code_val to the optimal coding prediction mode value curr_mode of the current macroblock, and the value of the length of the prediction mode field code_len to 4; otherwise, proceed to step (44). (44) Set the flag bit mode_is_equal_flag of the prediction mode field to 0, the value of the data bit code_val to the optimal coding prediction mode value curr_mode-1 of the current macroblock, and the value of the length of the prediction mode field code_len to 4. In step (43) above, the range of the optimal coding prediction mode value prev_mode of the previous macroblock is 0~8. Since the optimal coding prediction mode value curr_mode of the current macroblock is less than the optimal coding prediction mode value prev_mode of the previous macroblock, the maximum value of the optimal coding prediction mode value curr_mode of the current macroblock is 7. Therefore, only 3 data bits and 1 flag bit "0" need to be encoded. In step (44) above, the optimal coding prediction mode value curr_mode of the current macroblock is 1 to 8. Since it is greater than the optimal coding prediction mode value prev_mode of the previous macroblock, it cannot be less than 1. If the optimal coding prediction mode value curr_mode of the current macroblock is less than 8, then the value of the data bit code_val (curr_mode-1) is less than 7, and 3 data bits are sufficient. If the optimal coding prediction mode value curr_mode of the current macroblock is equal to 8, since the value of the data bit code_val is 7 (curr_mode-1), 3 bits are still sufficient. Therefore, only 3 data bits and 1 flag bit "0" need to be encoded. At the decoding end, corresponding to the encoding end, the optimal coding prediction mode is decoded, including the following steps: (51) Initialize the optimal coding prediction mode value prev_mode of the previous macroblock, with the initial value being the same as that of the encoder; (52) If the flag bit mode_is_equal_ flag of the prediction mode field is 1, then set the optimal coding prediction mode value curr_mode of the current macroblock to equal the optimal coding prediction mode value prev_mode of the previous macroblock; otherwise, proceed to step (53). (53) If the value of the data bit code_val is greater than the value of the optimal coding prediction mode of the previous macroblock prev_mode, then set the value of the optimal coding prediction mode of the current macroblock curr_mode to the value of the data bit code_val+1; otherwise, proceed to step (54). (54) Set the optimal coding prediction mode value curr_mode of the current macroblock to the value of the data bit code_val. That is, the present invention can encode 9 coding prediction modes in the selection mode using only 4 bits (including the flag bit), and can also be effectively decoded at the decoding end. This invention takes the coding prediction of 4x4 macroblocks as an example. For other macroblock sizes, such as 8x8, the method of this invention is still applicable. The only difference is the total number of macroblocks in each image. The preferred embodiments of the present invention have been described in detail above. However, the present invention is not limited to the specific details in the above embodiments. Within the scope of the technical concept of the present invention, various equivalent transformations can be made to the technical solutions of the present invention, and these equivalent transformations all fall within the protection scope of the present invention.

Claims

1. A method for selecting an image coding prediction mode, characterized in that, The method includes the following steps: Several coding prediction modes are preset, and each coding prediction mode corresponds to a set of reference sample values. Macroblock prediction values ​​can be obtained based on the reference sample values. (2) Select a fixed number of coding prediction patterns as the selection set of coding prediction patterns for the corresponding scenario based on the coding scenario; (3) For the current macroblock, select the optimal coding prediction mode based on the macroblock prediction value corresponding to each coding prediction mode in the selection set; (4) Set the prediction mode field to place the optimal encoding prediction mode value and send it to the decoding end along with the encoded bitstream.

2. The image coding prediction mode selection method according to claim 1, characterized in that, The coding prediction mode includes an intra-frame coding prediction mode, which includes a regular intra-frame coding prediction mode and an isolated intra-frame coding prediction mode. The regular intra-frame coding prediction mode includes the intra-frame coding prediction mode in H.264, and the isolated intra-frame coding prediction mode calculates the reference sample value based on the pixel depth during the coding process.

3. The image coding prediction mode selection method according to claim 2, characterized in that, The coding prediction mode also includes an inter-frame coding prediction mode, in which the reference sample value of the current macroblock is the recovered sample value at the corresponding position in the previous frame image.

4. The image coding prediction mode selection method according to claim 3, characterized in that, The coding scenarios include pure intra-frame scenarios and general scenarios; the general scenarios can adopt intra-frame coding prediction mode and inter-frame coding prediction mode.

5. The image coding prediction mode selection method according to claim 4, characterized in that, The pure intra-frame scene can only use the conventional intra-frame coding prediction mode, and the selection set of coding prediction modes in the pure intra-frame scene only includes the conventional intra-frame coding prediction mode.

6. The image coding prediction mode selection method according to claim 4, characterized in that, Determining the selection set of coding prediction modes in the general scenario includes the following steps: (21) Create an image dataset of a pure intra-frame scene. The size of the image dataset and the image pixel size are set according to the specific application. (22) Configure network parameters, use all regular intra-frame coding prediction modes as the selection set of coding prediction modes, select the optimal coding prediction mode to encode the image dataset, and calculate the first peak signal-to-noise ratio after decoding; (23) Remove a certain regular intra-frame coding prediction mode from the selection set, retain other regular intra-frame coding prediction modes, and then select the optimal coding prediction mode from the remaining selection set to encode the image dataset and calculate the second peak signal-to-noise ratio after decoding. (24) Compare the first peak signal-to-noise ratio and the second peak signal-to-noise ratio in turn, select the second peak signal-to-noise ratio that is the smallest difference from the first peak signal-to-noise ratio, and denote the corresponding removed conventional intra-frame coding prediction mode as the negligible conventional intra-frame coding prediction mode. (25) Replace the ignorable regular intra-frame coding prediction mode with the isolated intra-frame coding prediction mode to form a selection set of coding prediction modes for intra-frame coding in general scenarios; replace the ignorable regular intra-frame coding prediction mode with the inter-frame coding prediction mode to form a selection set of coding prediction modes for inter-frame coding in general scenarios.

7. The image coding prediction mode selection method according to claim 6, characterized in that, The image frames in the general scenario include I-frames and P-frames, and intra-frame coding is used for I-frame images; Inter-frame coding is used for P-frame images.

8. The image coding prediction mode selection method according to claim 6, characterized in that, In the general scenario, the image frames use GDR (Geometric Rendering), intra-frame bars use intra-frame coding, and inter-frame bars use inter-frame coding.

9. The image coding prediction mode selection method according to any one of claims 5 to 8, characterized in that, Step (3) involves selecting the optimal coding prediction mode, including the following steps: (31) Input the current macroblock location information and the selection set of coding prediction modes in the corresponding scenario; (32) For the conventional intra-frame coding prediction mode, obtain the reference sample value corresponding to the coding prediction mode in the source image of the image frame where the current macroblock is located; (33) Obtain the macroblock prediction value corresponding to each coding prediction mode in the selection set, and select the optimal coding prediction mode in the selection set according to the preset rules.

10. The image coding prediction mode selection method according to any one of claims 5 to 8, characterized in that, The prediction mode field mentioned in step (4) includes a flag bit and a data bit. Setting the prediction mode field to place the optimal encoded prediction mode value includes the following steps: (41) Initialize the optimal coding prediction mode value of the previous macroblock; (42) If the optimal coding prediction mode value of the current macroblock is equal to the optimal coding prediction mode value of the previous macroblock, then set the flag bit of the prediction mode field to 1 and set the length of the prediction mode field to 1; otherwise, proceed to step (43). (43) If the optimal coding prediction mode value of the current macroblock is less than the optimal coding prediction mode value of the previous macroblock, then set the flag bit of the prediction mode field to 0, the value of the data bit to the optimal coding prediction mode value of the current macroblock, and the length of the prediction mode field to 4; otherwise, proceed to step (44). (44) Set the flag bit of the prediction mode field to 0, the value of the data bit to the optimal coding prediction mode value of the current macroblock minus 1, and the length of the prediction mode field to 4.