Intra-frame and inter-frame mode selection method and related equipment

By using an intra-frame/inter-frame mode selection method, all encoding modes are classified using the known encoding information of video frames, which solves the problem of high time overhead in video codec mode selection and improves the efficiency of encoding mode selection.

CN121078231AActive Publication Date: 2025-12-05CENT SOUTH UNIV +1
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202511615996.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-06
Publication Date
2025-12-05
Estimated Expiration
2045-11-06

AI Technical Summary

Technical Problem

Existing video codecs have a high time overhead in mode selection and the mode traversal process is time-consuming.

Method used

By using the intra-frame and inter-frame mode selection method, all coding modes are classified using the known coding information of video frames, reducing the number of modes traversed and selecting the optimal coding mode.

Benefits of technology

It improves the execution efficiency of encoding mode selection and reduces the time overhead of video codecs in mode selection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121078231A_ABST
    Figure CN121078231A_ABST
Patent Text Reader

Abstract

The invention provides an intra-frame and inter-frame mode selection method and related equipment, and relates to the technical field of video coding and decoding, video data to be coded are input into a video codec, and the video data to be coded comprise a plurality of video frames; respectively judging each video frame to obtain a judgment result; selecting an optimal coding mode according to a judgment result; when the judgment result is the I frame or the first P frame or the B frame, selecting an optimal coding mode through a conventional mode selection mode; when the judgment result is that the video frame is not the I frame or the first P frame or the B frame, classifying all coding modes according to known coding information of the video frame to obtain classification results, and selecting an optimal coding mode from the classification results; the number of modes needing to be traversed is reduced, so that the execution efficiency of coding mode selection is improved, and the time overhead of a video codec on mode selection is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of video encoding and decoding technology, and in particular to an intra-frame / inter-frame mode selection method and related equipment. Background Technology

[0002] A video codec is a device that provides algorithms or software / hardware implementations for converting video data from one format to another. It primarily involves two processes: encoding and decoding. Encoding compresses the original video data into a smaller data stream for storage or transmission; decoding restores the compressed data stream to the original video data for playback. Video codecs utilize techniques such as spatial redundancy compression, temporal redundancy compression, transform coding, and entropy coding to efficiently compress and decompress video data. They play a crucial role in video storage, transmission, and playback, enabling efficient storage and transmission of video with limited resources while maintaining good video quality.

[0003] Intra-frame coding and inter-frame coding are two predictive coding types in video codecs. Intra-frame coding is a video coding technique that encodes only a single image frame (like a series of still pictures). It does not consider the relationships between different frames in a video sequence, focusing only on the content within the current frame. The advantage of intra-frame coding is its simplicity in decoding, because each frame is encoded independently, so decoding does not require considering information from other frames. This makes it useful in scenarios that require fast random access to video frames, such as in video editing software, where editors can quickly jump to any frame for editing operations. However, its compression efficiency is relatively low because it does not utilize inter-frame information. Therefore, for a video sequence, much repetitive information (such as an object that remains largely unchanged across several frames) is not fully utilized to reduce data volume.

[0004] Inter-frame coding is a technique for encoding different frames in a video sequence. It primarily utilizes the temporal correlation between video frames to achieve data compression. In many cases, consecutive frames in a video exhibit minimal change. For example, in a scene where only a person is moving while the background remains largely unchanged, inter-frame coding encodes data by comparing the differences between adjacent frames (or frames spaced a certain number of frames apart). It finds a reference frame (usually an already encoded frame) and then calculates the motion vector (describing the direction and distance of the object's movement between frames) between the current frame and the reference frame. For parts that do not change or change very little, the encoder performs appropriate encoding processing. Common inter-frame coding methods include predictive coding, such as P-frames (forward prediction frames), which predict the current frame based on preceding I-frames (intra-coded frames) or P-frames, and B-frames (bidirectional prediction frames), which predict based on preceding and following frames. Inter-frame coding has high compression efficiency because it fully utilizes the temporal redundancy between video frames, thus significantly reducing data volume while maintaining video quality. This is highly beneficial for video storage and transmission (such as online video streaming services), saving substantial storage space and bandwidth. However, its decoding process is relatively complex because the encoding of each frame depends on other frames (reference frames). Therefore, these frames need to be decoded in a certain order. Moreover, if the reference frame is faulty or lost, it may cause problems in the decoding of multiple frames.

[0005] The encoder's modes are divided into intra-frame mode selection and inter-frame mode selection. For mode selection, the encoder iterates through every encoding mode and selects the mode with the smallest error as the final encoding mode. Obviously, selecting the optimal mode from all possible modes is a very time-consuming process. This is because most erroneous modes usually have significant loss and can be identified before encoding. Summary of the Invention

[0006] This invention provides an intra-frame / inter-frame mode selection method and related equipment, the purpose of which is to reduce the time overhead of video codecs in mode selection.

[0007] To achieve the above objectives, the present invention provides an intra-frame / inter-frame mode selection method for a video codec. The intra-frame / inter-frame mode selection method includes: Step 1: Input the video data to be encoded into the video codec. The video data to be encoded includes multiple video frames. Step 2: Analyze each video frame individually to obtain the judgment result; Step 3: Select the optimal encoding mode based on the judgment result; When the judgment result is an I-frame, the first P-frame, or a B-frame, the optimal encoding mode is selected through the conventional mode selection method. When the judgment result is not an I-frame, the first P-frame, or a B-frame, all coding modes are classified according to the known coding information of the video frame to obtain the classification result, and the optimal coding mode is selected from the classification result.

[0008] Furthermore, the optimal encoding mode is selected through conventional mode selection methods, including: Iterate through all available encoding modes in the video codec; Calculate the encoding cost for each available encoding mode and select the encoding mode with the lowest encoding cost as the optimal encoding mode.

[0009] Furthermore, the known coding information of a video frame includes the coding mode of the encoded pixel blocks in the video frame, the motion vector of the encoded pixel blocks, and the sum of absolute errors. The optimal coding mode includes intra-frame coding mode and inter-frame coding mode.

[0010] Furthermore, based on the known coding information of the video frames, all coding modes are classified to obtain the classification results, including: By treating all the encoding patterns of the encoded pixel blocks in the known encoding information as a whole, we obtain the first set; The intra-frame coding modes in the first set are sorted by direction and then treated as a whole to obtain the second set; The statistical results are obtained by statistically analyzing all the encoding patterns that have appeared around each pixel block in the video frame and all the encoding patterns that have appeared in the same pixel block in the previous frame. The statistical results are classified according to the second set to obtain the classification results.

[0011] Furthermore, the statistical results are categorized based on the second set, including: Determine whether all intra-frame coding modes in the statistical results fall within the second set, and classify all intra-frame coding modes in the statistical results based on the determination result: When the result indicates that there is an intra-frame coding mode that is not in the second set, the intra-frame coding mode that is not in the second set is classified as an intra-frame big mode. When it is determined that there is an intra-frame coding mode in the second set, extract two intra-frame coding modes that are adjacent to the intra-frame coding mode in the second set, and classify the extracted intra-frame coding modes and the intra-frame coding modes in the second set as intra-frame large modes. In the second set, classify the intra-frame coding modes that are not adjacent to the intra-frame coding modes in the second set as intra-frame small modes. Classify all inter-frame coding patterns in the statistical results using motion vectors and absolute errors from the known coding information: The first threshold and the second threshold are calculated using the size of the pixel block to be encoded in the video frame and the bit depth of the video frame; All inter-frame patterns corresponding to encoded pixel blocks whose motion vectors are less than the first threshold and whose absolute errors are less than the second threshold are classified as large inter-frame patterns, and all inter-frame patterns corresponding to encoded pixel blocks whose motion vectors are greater than or equal to the first threshold and / or whose absolute errors are greater than or equal to the second threshold are classified as small inter-frame patterns.

[0012] Furthermore, the calculation expressions for the first and second thresholds, using the size of the pixel block to be encoded in the video frame and the bit depth of the video frame, are as follows: ; ; in, Indicates the first threshold. This represents the second threshold. This represents the width of the pixel block to be encoded in the video frame. This represents the height of the pixel block to be encoded in the video frame. Indicates the bit depth of a video frame.

[0013] Furthermore, selecting the optimal encoding pattern from the classification results includes: Calculate the intra-frame and inter-frame features between the encoded pixel block and the pixel block to be encoded; The classification results, intra-frame features, inter-frame features, and motion vector magnitudes of encoded pixel blocks are input into the classification model for pattern selection to obtain the optimal coding pattern of one class. The optimal encoding pattern is selected from the best encoding patterns by traversing through them.

[0014] The present invention also provides an intra-frame / inter-frame mode selection device, comprising: The input module is used to input the video data to be encoded into the video codec, which includes multiple video frames. The judgment module is used to judge each video frame separately and obtain the judgment result; The selection module is used to select the optimal encoding mode based on the judgment result; When the judgment result is an I-frame, the first P-frame, or a B-frame, the optimal encoding mode is selected through the conventional mode selection method. When the judgment result is not an I-frame, the first P-frame, or a B-frame, all coding modes are classified according to the known coding information of the video frame to obtain the classification result, and the optimal coding mode is selected from the classification result.

[0015] The present invention also provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement an intra-frame / inter-frame mode selection method.

[0016] The present invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements an intra-frame / inter-frame mode selection method.

[0017] The above-described solution of the present invention has the following beneficial effects: This invention inputs video data to be encoded into a video codec, which includes multiple video frames. Each video frame is evaluated to obtain a result. The optimal encoding mode is selected based on the evaluation result. When the evaluation result is an I-frame, the first P-frame, or a B-frame, the optimal encoding mode is selected using a conventional mode selection method. When the evaluation result is not an I-frame, the first P-frame, or a B-frame, all encoding modes are classified based on the known encoding information of the video frames to obtain classification results, and the optimal encoding mode is selected from the classification results. Compared with existing technologies, this invention utilizes the known encoding information of the video frames to classify and filter all encoding modes during encoding mode selection by the video codec, reducing the number of modes that need to be traversed, thereby improving the execution efficiency of encoding mode selection and reducing the time overhead of the video codec in mode selection.

[0018] Other beneficial effects of the present invention will be described in detail in the following detailed description section. Attached Figure Description

[0019] Figure 1 This is a flowchart illustrating an embodiment of the present invention; Figure 2 This is a schematic diagram of nine 4×4 intra-frame coding modes in an embodiment of the present invention; Figure 3 This is a schematic diagram of four 16×16 intra-frame coding modes in an embodiment of the present invention; Figure 4 This is a schematic diagram of the intra-frame / inter-frame coding mode selection device in an embodiment of the present invention; Figure 5 This is a schematic diagram of the structure of the terminal device in an embodiment of the present invention. Detailed Implementation

[0020] To make the technical problems, solutions, and advantages of this invention clearer, a detailed description will be provided below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0021] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0022] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a locking connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.

[0023] Furthermore, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0024] This invention addresses existing problems by providing an intra-frame / inter-frame mode selection method and related equipment.

[0025] like Figure 1 As shown, an embodiment of the present invention provides an intra-frame / inter-frame mode selection method for a video codec. The intra-frame / inter-frame mode selection method includes: Step 1: Input the video data to be encoded into the video codec. The video data to be encoded includes multiple video frames. Step 2: Analyze each video frame individually to obtain the judgment result; Step 3: Select the optimal encoding mode based on the judgment result; When the judgment result is an I-frame, the first P-frame, or a B-frame, the optimal encoding mode is selected through the conventional mode selection method. When the judgment result is not an I-frame, the first P-frame, or a B-frame, all coding modes are classified according to the known coding information of the video frame to obtain the classification result, and the optimal coding mode is selected from the classification result.

[0026] In this embodiment of the invention, the video codec can be a multi-functional (VTM, Versatile Video Voding Test Model) video codec. The video data to be encoded is a video sequence in YUV format, because the YUV format video sequence can be used directly by the encoder. It can also be other common video formats, such as MP4, MOV, etc., as input. However, when the encoder reads it, the MP4, MOV, etc. video sequences will still be transcoded into YUV format video sequences first.

[0027] Specifically, the optimal encoding mode is selected through conventional mode selection methods, including: Iterate through all available encoding modes in the video codec; Calculate the encoding cost for each available encoding mode and select the encoding mode with the lowest encoding cost as the optimal encoding mode.

[0028] In this embodiment of the invention, the calculation expression for the encoding cost of each available encoding mode is as follows: ; in, The distortion of the encoded image compared to the original image is usually expressed as the sum of absolute errors (SAD) or the sum of squared errors (SSD). This indicates the output bitrate, used to reflect compression efficiency; This represents the Lagrange daily number, determined by the quantization parameter.

[0029] Specifically, the known coding information of a video frame includes the coding mode of the encoded pixel blocks in the video frame, the motion vector of the encoded pixel blocks, and the sum of absolute errors. The optimal coding mode includes intra-frame coding mode and inter-frame coding mode.

[0030] Specifically, all coding modes are classified based on the known coding information of the video frames to obtain the classification results, including: By treating all the encoding patterns of the encoded pixel blocks in the known encoding information as a whole, we obtain the first set; The intra-frame coding modes in the first set are sorted by direction and then treated as a whole to obtain the second set; The statistical results are obtained by statistically analyzing all the encoding patterns that have appeared around each pixel block in the video frame and all the encoding patterns that have appeared in the same pixel block in the previous frame. The statistical results are classified according to the second set to obtain the classification results.

[0031] In this embodiment of the invention, all encoding patterns of encoded pixel blocks in the known encoding information are treated as a whole, and the resulting first set is denoted as... , ,in, These represent nine 4×4 intra-frame coding modes: vertical mode, horizontal mode, mean mode, bottom-left diagonal mode, bottom-right diagonal mode, vertically-right bias mode, horizontally-bottom bias mode, vertically-left bias mode, and horizontally-top bias mode. Figure 2 As shown, These represent four 16×16 intra-frame coding modes: vertical mode, horizontal mode, mean mode, and diagonal mode, as shown below. Figure 3 As shown, These represent inter-frame coding modes, such as 4×4 and 8×16, respectively; The first set The intra-frame coding modes in the data are sorted according to the scheme and treated as a whole; the resulting second set is denoted as... , .

[0032] It should be noted that, in this embodiment of the invention, since the encoding order is from top to bottom and from left to right, the pixel blocks surrounding the pixel block are the left pixel block, the upper left pixel block, the upper pixel block, and the upper right pixel block. When encoding the current pixel block, the left pixel block, the upper left pixel block, the upper pixel block, and the upper right pixel block have already been encoded. Therefore, all encoding modes that have appeared around each pixel block in the video frame are counted, that is, the encoding modes selected by the left pixel block, the upper left pixel block, the upper pixel block, and the upper right pixel block of the current pixel block are counted.

[0033] Specifically, the statistical results are categorized according to the second set, including: Determine whether all intra-frame coding modes in the statistical results fall within the second set, and classify all intra-frame coding modes in the statistical results based on the determination result: When the result indicates that there is an intra-frame coding mode that is not in the second set, the intra-frame coding mode that is not in the second set is classified as an intra-frame big mode. When it is determined that there is an intra-frame coding mode in the second set, extract two intra-frame coding modes that are adjacent to the intra-frame coding mode in the second set, and classify the extracted intra-frame coding modes and the intra-frame coding modes in the second set as intra-frame large modes. In the second set, classify the intra-frame coding modes that are not adjacent to the intra-frame coding modes in the second set as intra-frame small modes. Classify all inter-frame coding patterns in the statistical results using motion vectors and absolute errors from the known coding information: The first threshold and the second threshold are calculated using the size of the pixel block to be encoded in the video frame and the bit depth of the video frame; All inter-frame patterns corresponding to encoded pixel blocks whose motion vectors are less than the first threshold and whose absolute errors are less than the second threshold are classified as large inter-frame patterns, and all inter-frame patterns corresponding to encoded pixel blocks whose motion vectors are greater than or equal to the first threshold and / or whose absolute errors are greater than or equal to the second threshold are classified as small inter-frame patterns.

[0034] Specifically, the calculation expressions for the first and second thresholds, using the size of the pixel block to be encoded in the video frame and the bit depth of the video frame, are as follows: ; ; in, Indicates the first threshold. This represents the second threshold. This represents the width of the pixel block to be encoded in the video frame. This represents the height of the pixel block to be encoded in the video frame. Indicates the bit depth of a video frame.

[0035] In this embodiment of the invention, the pixel block to be encoded is set as follows: Its input size is 1920x1080, and its bit depth is 8. Based on the above calculation expression, the first threshold can be calculated. The value is 22.3, the second threshold. The value is 1500, and the information of the surrounding encoded pixel blocks is as follows: Left pixel block: ; Top left pixel block: ; ; ; Top pixel block: ; ; ; Top right pixel block: ; Previous frame's corresponding pixel block: ; ; ; It can be seen that the pixel block in the same position of the previous frame is coded in inter-frame mode, while the intra-frame coded mode is used. The conditions are met; the left pixel block is intra-frame mode coded and is Intra-frame coding mode, therefore intra-frame coding mode Add Intra-Frame Large Mode The top left pixel block is in inter-frame coding mode, while the intra-frame coding mode is in intra-frame coding mode. The conditions are met; the upper pixel block is coded in inter-frame mode, and the intra-frame coded mode is used. The conditions are met; the upper right pixel block is intra-frame mode coded and is Intra-frame coding modes, therefore, intra-frame coding modes 2, 3, 7, and 8 are added to the intra-frame big mode. In addition; at the same time, the surrounding intra-frame coding modes are also added, that is, additionally added. Two intra-frame coding modes; after the above steps, all modes can be divided into the following four sets: ; ; ; ; in, Indicates intra-frame large mode, Indicates intra-frame small mode, Indicates large inter-frame mode. This indicates a small inter-frame mode.

[0036] Specifically, selecting the optimal encoding pattern from the classification results includes: Calculate the intra-frame and inter-frame features between the encoded pixel block and the pixel block to be encoded; The classification results, intra-frame features, inter-frame features, and motion vector magnitudes of encoded pixel blocks are input into the classification model for pattern selection to obtain the optimal coding pattern of one class. The optimal encoding pattern is selected from the best encoding patterns by traversing through them.

[0037] In this embodiment of the invention, both intra-frame features and inter-frame features are obtained by calculating the sum of squared errors. The sum of squared errors is used to measure the difference between two pixel blocks. The smaller the value of the sum of squared errors, the smaller the difference between the two pixel blocks; conversely, the larger the value, the greater the difference between the two pixel blocks. The calculation expression is as follows: ; in, express The sum of squared errors between them Indicates an encoded pixel block. This represents the pixel block to be encoded. This indicates the pixel position within a pixel block.

[0038] It's important to note that the motion vector (MV) describes the direction and magnitude of displacement of pixel blocks between adjacent frames, and its magnitude reflects the intensity of motion in the current image. A larger MV magnitude indicates a greater distance between the reference pixel block and the current pixel block, meaning more intense motion; conversely, a smaller MV magnitude indicates gentler motion. Assuming the coordinates of the current pixel block are... The coordinates of the reference pixel block are Then the motion vector between the two pixel blocks is The motion vector magnitude is 1.

[0039] In this embodiment of the invention, the classification model can be any conventional machine learning classification model, including but not limited to K-nearest neighbor algorithm, support vector machine, decision tree, random forest, etc. The classification model outputs the optimal encoding mode, which can be intra-frame large mode or intra-frame small mode or inter-frame large mode or inter-frame small mode.

[0040] In this embodiment of the invention, selecting an optimal coding mode from the optimal class of coding modes by traversal specifically involves calculating the coding cost of each coding mode in the optimal class of coding modes and selecting the coding mode with the lowest coding cost as the optimal coding mode.

[0041] In this embodiment of the invention, after step 3, the optimal encoding mode, motion vector and other information are saved as the encoding information of the current pixel block for use in subsequent encoding.

[0042] The feasibility of applying the provided intra-frame / inter-frame mode selection method in a multi-functional video codec according to embodiments of the present invention is as follows: All frames use the All Intra coding mode, so there will only be two types: intra-major mode A and intra-minor mode B. When selecting the optimal encoding mode, one encoding mode is randomly selected from two types, A and B, as the optimal encoding mode to simulate the machine learning system under the worst-case condition. This experiment tested the performance of 4-frame encoding of high-definition video data (720p) and ultra-high-definition video data (1080p) on the original multi-functional video codec and the multi-functional video codec after incorporating this method. The experimental results are shown in Tables 1, 2, and 3 below: Table 1. Encoder performance before optimization ; Table 2 Performance of the optimized encoder ; Table 3 Performance Comparison Before and After Optimization ; The experimental data shows that this method reduces the encoding time by 49.56% at the cost of a 2.69% increase in bit rate and a 0.05% loss in encoding quality.

[0043] In this embodiment of the invention, video data to be encoded is input into a video codec, which includes multiple video frames. Each video frame is judged to obtain a judgment result. The optimal encoding mode is selected based on the judgment result. When the judgment result is an I-frame, the first P-frame, or a B-frame, the optimal encoding mode is selected using a conventional mode selection method. When the judgment result is not an I-frame, the first P-frame, or a B-frame, all encoding modes are classified according to the known encoding information of the video frames to obtain a classification result, and the optimal encoding mode is selected from the classification result. Compared with the prior art, this embodiment of the invention uses the known encoding information of the video frames to classify and filter all encoding modes when the video codec selects the encoding mode, reducing the number of modes that need to be traversed, thereby improving the execution efficiency of encoding mode selection and reducing the time overhead of the video codec in mode selection.

[0044] Corresponding to the intra-frame / inter-frame mode selection method described in the above embodiments, such as Figure 4 As shown, this embodiment of the invention also provides an intra-frame / inter-frame mode selection device 100, which includes: Input module 101 is used to input the video data to be encoded into the video codec, the video data to be encoded including multiple video frames; The judgment module 102 is used to judge each video frame separately and obtain the judgment result; Module 103 is used to select the optimal encoding mode based on the judgment result; When the judgment result is an I-frame, the first P-frame, or a B-frame, the optimal encoding mode is selected through the conventional mode selection method. When the judgment result is not an I-frame, the first P-frame, or a B-frame, all coding modes are classified according to the known coding information of the video frame to obtain the classification result, and the optimal coding mode is selected from the classification result.

[0045] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.

[0046] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0047] This invention also provides a terminal device, such as... Figure 5 As shown, the terminal device D10 of this embodiment includes: at least one processor D100 ( Figure 5 The diagram shows only one processor, a memory D101, and a computer program D102 stored in the memory D101 and executable on the at least one processor D100. When the processor D100 executes the computer program D102, it implements the above-described intra-frame / inter-frame mode selection method.

[0048] The terminal device D10 can be a desktop computer, laptop, handheld computer, server, server cluster, or cloud server, etc. This terminal device may include, but is not limited to, a processor D100 and a memory D101. Those skilled in the art will understand that... Figure 5 This is merely an example of terminal device D10 and does not constitute a limitation on terminal device D10. It may include more or fewer components than shown in the figure, or combine certain components, or different components, such as input / output devices, network access devices, etc.

[0049] The processor D100 can be a central processing unit (CPU), or it can be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.

[0050] In some embodiments, the memory D101 may be an internal storage unit of the terminal device D10, such as a hard disk or memory of the terminal device D10. In other embodiments, the memory D101 may be an external storage device of the terminal device D10, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc., equipped on the terminal device D10. Furthermore, the memory D101 may include both internal and external storage units of the terminal device D10. The memory D101 is used to store the operating system, applications, bootloader, data, and other programs, such as the program code of the computer program. The memory D101 can also be used to temporarily store data that has been output or will be output.

[0051] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.

[0052] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0053] This invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements an intra-frame / inter-frame mode selection method.

[0054] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying the computer program code to a building device / terminal device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks.

[0055] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A method of Intra-Inter mode selection, the method comprising: The method for intra-inter frame mode selection for a video codec comprises the following steps: Step 1: inputting video data to be encoded into the video codec, wherein the video data to be encoded comprises a plurality of video frames; Step 2: judging each video frame respectively to obtain a judgment result; Step 3: selecting an optimal encoding mode according to the judgment result; When the judgment result is an I frame or a first P frame or a B frame, an optimal encoding mode is selected by a conventional mode selection method; When the judgment result is a non-I frame or a first P frame or a B frame, all encoding modes are classified according to known encoding information of the video frame to obtain a classification result, and an optimal encoding mode is selected from the classification result.

2. The method of Claim 1, wherein, The optimal encoding mode is selected by the conventional mode selection method, which comprises the following steps: traversing all available encoding modes in the video codec; calculating the encoding cost of each available encoding mode respectively, and selecting the encoding mode with the minimum encoding cost as the optimal encoding mode.

3. The method of Claim 1, wherein, The known encoding information of the video frame comprises the encoding mode of an encoded pixel block in the video frame, the motion vector of the encoded pixel block, and the absolute error sum, and the optimal encoding mode comprises an intra encoding mode and an inter encoding mode.

4. The method of Claim 1, wherein, The classification of all encoding modes according to the known encoding information of the video frame to obtain a classification result comprises the following steps: regarding all encoding modes of the encoded pixel block in the known encoding information as a whole to obtain a first set; regarding the intra encoding modes in the first set as a whole after sorting them according to direction to obtain a second set; counting all encoding modes appearing around each pixel block in the video frame and all encoding modes appearing in a same-position pixel block in a previous frame to obtain a counting result; classifying the counting result according to the second set to obtain a classification result.

5. The method of intra-inter mode selection according to claim 4, wherein, The classification of all encoding modes according to the known encoding information of the video frame to obtain a classification result comprises the following steps: determining whether all intra encoding modes in the counting result are located in the second set, and classifying all intra encoding modes in the counting result according to the determination result: when the determination result is that there are intra encoding modes not located in the second set, the intra encoding modes not located in the second set are classified as intra large modes; when the determination result is that there are intra encoding modes located in the second set, two intra encoding modes adjacent to the intra encoding modes located in the second set are extracted from the second set, and the extracted intra encoding modes and the intra encoding modes located in the second set are classified as intra large modes, and the intra encoding modes not adjacent to the intra encoding modes located in the second set are classified as intra small modes in the second set; classifying all inter encoding modes in the counting result by using the motion vector and the absolute error sum in the known encoding information: calculating a first threshold value and a second threshold value by using the size of a pixel block to be encoded in the video frame and the bit depth of the video frame; all inter modes corresponding to the coded pixel blocks with motion vector less than the first threshold and absolute error sum less than the second threshold are classified as inter large modes, and all inter modes corresponding to the coded pixel blocks with motion vector greater than or equal to the first threshold and / or absolute error sum greater than or equal to the second threshold are classified as inter small modes.

6. The method of Claim 1, wherein, The calculation expression of the first threshold and the second threshold is calculated by using the size of the pixel block to be coded in the video frame and the bit depth of the video frame, and is: wherein, represents a first threshold value, represents a second threshold value, represents a width of a pixel block to be encoded in a video frame, represents a height of a pixel block to be encoded in a video frame, represents a bit depth of a video frame.

7. The method of Claim 4, wherein, The optimal coding mode is selected from the classification result, comprising: calculating the intra feature and the inter feature between the coded pixel block and the pixel block to be coded; inputting the classification result, the intra feature, the inter feature and the motion vector module length of the coded pixel block into a classification model to select a mode to obtain an optimal coding mode of a class; an optimal coding mode is selected from the optimal coding mode of the class by means of traversal.

8. An apparatus for Intra-Inter mode selection, the apparatus comprising: comprising: an input module, configured to input video data to be coded into the video codec, wherein the video data to be coded comprises a plurality of video frames; a judgment module, configured to judge each video frame respectively to obtain a judgment result; a selection module, configured to select an optimal coding mode according to the judgment result; when the judgment result is an I frame or a first P frame or a B frame, the optimal coding mode is selected by means of a conventional mode selection manner; when the judgment result is a non-I frame or a first P frame or a B frame, all coding modes are classified according to known coding information of the video frame to obtain a classification result, and the optimal coding mode is selected from the classification result.

9. A terminal device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the intra-inter mode selection method according to any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 9. The computer program is executed by the processor to implement the intra-inter mode selection method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • AVS fast schema selection method and device

    CN101426140A

  • Method and device for selecting optimal intra-frame coding mode for video sequence

    CN102724509A

  • Intra-frame fast coding method based on VVC

    CN116233420A

  • Coding information determination method of coding block and related product

    CN117596392A

  • Video coding method for fast intra prediction and apparatus thereof

    KR1020150057801A