Video encoding method, device and storage medium
By using auxiliary information in the hard-coded code stream to determine the soft encoding parameters of the video and perform software encoding, the problem of low video encoding efficiency in the prior art is solved, and a more efficient video encoding process is achieved.
Patent Information
- Application Number
- CN201910491815.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-06-06
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2039-06-06
AI Technical Summary
In the existing video encoding technology, the calculation amount saved by the fast processing strategy is limited, resulting in the video encoding efficiency still need to be improved.
By obtaining the hard-coded code stream of the source video to be encoded, auxiliary information is determined, and soft-code parameters are determined based on these auxiliary information, software encoding is performed to obtain the target code stream.
It effectively narrows the search range of software encoding parameters and reduces the calculation amount, thereby speeding up encoding speed and improving video encoding efficiency.
Smart Images

Figure CN112055214B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of video encoding technology, and in particular to a video encoding method, device and storage medium. Background Art
[0002] In video applications or services (such as short video recording, video transcoding, etc.), the video encoding process is the basic processing process, that is, the processing process that requires the largest amount of computation.
[0003] At present, in the video encoding process, some fast processing strategies are usually used based on the encoding information of the encoding unit before the current encoding unit, such as early skip strategy, motion vector search early termination strategy, etc. However, the amount of calculation saved by video encoding according to these strategies is very limited, and the video encoding efficiency still needs to be improved. Summary of the invention
[0004] Multiple aspects of the present application provide a video encoding method, device and storage medium to reduce the computational complexity of video encoding, thereby increasing the encoding speed and / or improving the video encoding efficiency.
[0005] The present application provides a video encoding method, including:
[0006] Obtaining a source video to be encoded and a hard-coded bitstream of the source video to be encoded;
[0007] Determining auxiliary information according to the hard-coded bitstream;
[0008] Determining soft coding parameters of the source video to be encoded according to the auxiliary information;
[0009] Based on the soft coding parameters, software coding is performed on the source video to be encoded to obtain a target bit stream.
[0010] The embodiment of the present application also provides a video encoder, including a memory and a processor;
[0011] The memory is used to store one or more computer instructions;
[0012] The processor is coupled to the memory and configured to execute the one or more computer instructions for:
[0013] Obtaining a source video to be encoded and a hard-coded bitstream of the source video to be encoded;
[0014] Determining auxiliary information according to the hard-coded bitstream;
[0015] Determining soft coding parameters of the source video to be encoded according to the auxiliary information;
[0016] Based on the soft coding parameters, software coding is performed on the source video to be encoded to obtain a target bit stream.
[0017] The embodiment of the present application also provides a soft-hard hybrid video encoder, including a hardware encoder, a software decoder and a software encoder;
[0018] The hardware encoder is used to perform hardware encoding on the source video to be encoded to obtain a hard-coded bit stream; and send the hard-coded bit stream to the software decoder;
[0019] The software decoder is used to perform software decoding on the hard-coded bitstream to determine the auxiliary information from the hard-coded bitstream; and send the auxiliary information to the software encoder;
[0020] The software encoder is used to receive the auxiliary information and obtain the source video to be encoded; determine the soft coding parameters of the source video to be encoded according to the auxiliary information; and perform software encoding on the source video to be encoded based on the soft coding parameters to obtain a target bit stream.
[0021] An embodiment of the present application also provides a computer-readable storage medium storing computer instructions. When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the aforementioned video encoding method.
[0022] In the embodiment of the present application, in the video encoding process, the auxiliary information determined from the hard-coded bitstream of the source video to be encoded is referred to to determine the soft coding parameters of the source video to be encoded, and based on the soft coding parameters, the source video to be encoded is software encoded to finally obtain the target bitstream. Accordingly, in the embodiment of the present application, based on the auxiliary information determined according to the hard-coded bitstream of the source video to be encoded, the search range of the software coding parameters can be effectively narrowed, the amount of calculation can be reduced, and the soft coding parameters of the source video to be encoded can be determined more efficiently, thereby accelerating the encoding speed and / or improving the video encoding efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0024] Figure 1 A schematic diagram of a video encoding method according to an embodiment of the present application;
[0025] Figure 2 A schematic diagram of the structure of a video encoder provided by another embodiment of the present application;
[0026] Figure 3A structural diagram of a soft-hard hybrid video encoder provided in yet another embodiment of the present application. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. 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 ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0028] At present, in the process of video encoding, some fast processing strategies are usually used according to the encoding information of the encoding unit before the current encoding unit, but the amount of calculation saved by performing video encoding according to these strategies is very limited, and the efficiency of video encoding still needs to be improved. In some embodiments of the present application: in the process of video encoding, refer to the auxiliary information determined from the hard-coded bitstream of the source video to be encoded to determine the soft coding parameters of the source video to be encoded, and based on the soft coding parameters, perform software encoding on the source video to be encoded, and finally obtain the target bitstream. Accordingly, in the embodiments of the present application, based on the auxiliary information determined according to the hard-coded bitstream of the source video to be encoded, the search range of the software encoding parameters can be effectively narrowed, the amount of calculation can be reduced, so that the soft coding parameters of the source video to be encoded can be determined more efficiently, thereby accelerating the encoding speed and / or improving the video encoding efficiency.
[0029] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0030] Figure 1 FIG. 1 is a flow chart of a video encoding method provided by an embodiment of the present application. Figure 1 As shown, the method includes:
[0031] 100. Obtain a source video to be encoded and a hard-coded bitstream of the source video to be encoded;
[0032] 101. Determine auxiliary information according to a hard-coded bitstream;
[0033] 102. Determine soft coding parameters of the source video to be encoded according to the auxiliary information;
[0034] 103. Based on the soft coding parameters, software encoding is performed on the source video to be encoded to obtain a target bit stream.
[0035] The video encoding method provided in the embodiment of the present application can be applied to various scenarios that require video encoding, such as short video recording scenarios, video transcoding scenarios, etc., and this embodiment is not limited to this.
[0036] In this embodiment, the auxiliary information determined according to the hard-coded bitstream of the source video to be encoded includes, but is not limited to, syntax elements in the hard-coded bitstream and other information derived from the syntax elements.
[0037] In this embodiment, the source video to be encoded may include at least one encoding unit. According to the actual scenario, the encoding unit may be a macroblock or encoding unit of other specifications, which is not limited in this embodiment. Based on this, the syntax elements include but are not limited to the hard-coded mode and hard-coded motion vector corresponding to each encoding unit in the hard-coded bitstream. For example, when the encoding unit is a macroblock, the syntax elements may at least include the hard-coded mode (H-mb-type) and hard-coded motion vector (H-MV) corresponding to each macroblock. In this embodiment, the hard-coded bitstream of the video to be encoded may come from multiple sources.
[0038] In one implementation, the hard-coded bitstream may be sourced from outside the implementation subject of the method provided in this embodiment. For example, when the implementation subject of the method provided in this embodiment is a video encoder, the hard-coded bitstream may be sourced from other devices other than the video encoder. In this implementation, the hard-coded bitstream is provided by other devices, and accordingly, in step 100, the hard-coded bitstream may be obtained from other devices.
[0039] In another implementation, step 100 may specifically include: hardware encoding the source video to be encoded to obtain a hard-coded bitstream. In this implementation, the hard-coded bitstream is generated inside the implementation subject of the method provided in this embodiment. Hardware encoding refers to using a dedicated encoding chip (e.g., an application-specific integrated circuit ASIC) to perform video encoding.
[0040] Based on the acquired hard-coded bitstream, in this embodiment, the hard-coded bitstream can be software-decoded to determine the auxiliary information from the hard-coded bitstream. In practical applications, a software decoder can be used to software-decode the hard-coded bitstream, and the auxiliary information can be extracted from the hard-coded bitstream during the software decoding process. Among them, software decoding refers to using a general-purpose processor (for example, CPU, GPU, etc.) to run a coding program (software) to perform video decoding. The above-mentioned "extraction" operation can be to directly obtain the value of a syntax element from the hard-coded bitstream, or to calculate the target value based on the value of a syntax element.
[0041] Of course, the above is merely an exemplary implementation of obtaining auxiliary information determined from a hard-coded bitstream of a source video to be encoded, and the present embodiment is not limited thereto.
[0042] In this embodiment, the auxiliary information includes, but is not limited to, information such as a coding mode such as a macroblock mode or a sub-macroblock mode in a hard-coded stream, a frame type, a quantization parameter, or a motion vector.
[0043] Based on the acquired auxiliary information, in this embodiment, the soft coding parameters of the source video to be encoded can be determined according to the auxiliary information.
[0044] In this embodiment, by referring to the auxiliary information determined from the hard-coded bitstream of the source video to be encoded, the characteristics of each encoding unit in the source video to be encoded can be determined more accurately, thereby effectively narrowing the search range of the soft coding parameters of each encoding unit, and then more quickly determining the soft coding parameters of each encoding unit. The specific scheme for determining the soft coding parameters will be described in detail later.
[0045] Accordingly, in this embodiment, the source video to be encoded can be software encoded based on the soft encoding parameters of the source video to be encoded determined according to the auxiliary information to generate a target bitstream. Software encoding refers to using a general-purpose processor (CPU, GPU, etc.) to run an encoding program (software) to perform video encoding.
[0046] In this embodiment, based on the soft coding mode, soft coding motion vector and other soft coding parameters corresponding to each coding unit in the source video to be encoded determined according to the auxiliary information, prediction, transformation, quantization, entropy coding, filtering and other processing can be performed on each coding unit in the source video to be encoded, so as to realize software encoding of the source video to be encoded, and then obtain the target bit stream.
[0047] In addition, the determined software coding parameters can be applied to bidirectional prediction coding frames (B frames) or inter-frame prediction coding frames (P frames) during the software coding process. Of course, this embodiment does not limit this. It is worth noting that although the two soft coding parameters of soft coding mode and soft coding motion vector are mentioned in this embodiment, it should be understood that this does not mean that the soft coding parameters in this embodiment only include the two parameters of soft coding mode and soft coding motion vector. The soft coding parameters also include other parameters such as reference frames, and these parameters will not be described in detail in this embodiment.
[0048] In this embodiment, during the video encoding process, the auxiliary information determined from the hard-coded bitstream of the source video to be encoded is referenced to determine the soft coding parameters of the source video to be encoded, and based on the soft coding parameters, the source video to be encoded is software encoded to finally obtain the target bitstream. Accordingly, in the embodiment of the present application, based on the auxiliary information determined from the hard-coded bitstream of the source video to be encoded, the search range of the software coding parameters can be effectively narrowed, the amount of calculation can be reduced, and the soft coding parameters of the source video to be encoded can be determined more efficiently, thereby accelerating the encoding speed and / or improving the video encoding efficiency.
[0049] In the above or following embodiments, the hard coding mode corresponding to each coding unit in the source video to be encoded can be obtained from the auxiliary information, and for the first coding unit in the source video to be encoded, it can be determined whether the first coding unit is a specific hard coding mode, and according to the determination result, it is determined which scheme to adopt to determine the soft coding parameters of the source video to be encoded. The first coding unit can be any coding unit in the source video to be encoded.
[0050] In this embodiment, the hard coding mode corresponding to the coding unit includes the coding mode of the coding unit and its sub-units used by hard coding. For example, when the coding unit is a macroblock, the hard coding mode corresponding to the coding unit includes the macroblock mode and sub-macroblock mode used by hard coding.
[0051] The soft coding parameters include, but are not limited to, the soft coding mode (S-mb-type) or soft coding motion vector (S-MV) corresponding to each coding unit in the source video to be coded, etc. The soft coding mode corresponding to the coding unit includes the coding mode of the coding unit and its sub-units used in the soft coding. For example, when the coding unit is a macroblock, the soft coding mode corresponding to the coding unit includes the macroblock mode and sub-macroblock mode used in the soft coding.
[0052] In this embodiment, at least one specific hard coding mode can be preset. In practical applications, software coding can be performed on a test video source in accordance with several test hardware coding modes in an experimental manner to obtain several test bitstreams; at least one specific bitstream that does not meet the coding requirements is selected from the several test bitstreams, and the test hardware coding mode used to generate each of the at least one specific bitstream is used as the specific coding mode. Accordingly, the specific coding mode can be one or more.
[0053] For example, the specific encoding mode may be one or more of B_SKIP, B_DIRECT_16x16, B_L0_16x16, B_L1_16x16, MB_INTRA_16x16, or MB_INTRA_8x8, etc.
[0054] Furthermore, in this embodiment, the candidate soft coding modes corresponding to each specific hard coding mode can be further determined, that is, the candidate soft coding modes are pre-configured for the specific hard coding mode. Among them, the bit stream quality of the test bit stream obtained by performing software encoding on the test video source according to the candidate encoding mode will be higher than the test bit stream obtained by performing software encoding on the test video source according to the specific hard coding mode. Specifically, the soft coding mode corresponding to each specific coding mode can be determined in a limited and preferential manner. Of course, this embodiment is not limited to this. By predetermining the candidate soft coding mode corresponding to each specific hard coding mode, the search range can be effectively narrowed when determining the soft coding mode of each coding unit in the source video to be encoded.
[0055] For example, in the above example, the candidate soft coding modes corresponding to B_SKIP include but are not limited to B_SKIP, B_L0_16x16 and B_L1_16x16; the candidate soft coding modes corresponding to B_DIRECT_16x16 in the above example include but are not limited to B_SKIP and B_DIRECT_16x16; the candidate soft coding modes corresponding to B_L0_16x16 in the above example include but are not limited to B_SKIP and B_L0_16x16; the candidate soft coding modes corresponding to B_L1_16x16 in the above example include but are not limited to B_SKIP and B_L1_16x16; the candidate soft coding modes corresponding to MB_INTRA_16x16 in the above example include but are not limited to B_SKIP and MB_INTRA_16x16; the candidate soft coding modes corresponding to MB_INTRA_8x8 in the above example include but are not limited to MB_INTRA_16x16 and MB_INTRA_8x8.
[0056] Based on this, in this embodiment, if the hard coding mode corresponding to the first coding unit is a specific hard coding mode, at least one candidate soft coding mode corresponding to the specific hard coding mode is obtained; from the at least one candidate soft coding mode, a target soft coding mode is selected for the first coding unit.
[0057] In order to determine the target soft coding mode of the first coding unit, in this embodiment, the coding effect of software coding the first coding unit according to each candidate soft coding mode can be predicted, and the target soft coding mode of the first coding unit can be selected according to the coding effect.
[0058] In some practical applications, the first type cost of each candidate soft coding mode can be calculated, and the soft coding mode with the lowest first type cost can be selected as the target soft coding mode of the first coding unit. Of course, one of the multiple candidate soft coding modes whose first type costs meet the preset threshold condition can also be selected as the target soft coding mode, and so on.
[0059] In addition, in addition to the cost calculation method, other methods may be used to predict the coding effect corresponding to each soft coding mode, and the target soft coding mode of the first coding unit is selected according to the coding effect. This embodiment does not limit this.
[0060] As mentioned above, the auxiliary information may also include hard-coded motion vectors corresponding to each coding unit. Based on this, in this embodiment, if the hard coding mode corresponding to the first coding unit is a specific hard coding mode, the hard-coded motion vector corresponding to the first coding unit contained in the auxiliary information can be referred to to predict the coding effect of software encoding the first coding unit according to each candidate soft coding mode corresponding to the specific hard coding mode.
[0061] In practical applications, based on the hard-coded motion vector corresponding to the first coding unit, at least one candidate soft-coded motion vector corresponding to each candidate soft-coding mode can be determined; the second type cost of each candidate soft-coded motion vector can be determined; the one with the smallest second type cost can be selected from the candidate soft-coded motion vectors as the target soft-coded motion vector of the current candidate soft-coding mode; and the first type cost of each candidate soft-coding mode can be calculated based on the target soft-coded motion vector corresponding to each candidate soft-coding mode.
[0062] In this practical application, the hard-coded motion vector corresponding to the first coding unit can be used as a reference to select at least one candidate soft-coded motion vector within a preset range, wherein the vector difference between the selected at least one candidate soft-coded motion vector and the hard-coded motion vector is smaller than the aforementioned preset range.
[0063] For example, when the hard-coded motion vector is [x:5, y:5], if the preset range is [Dx=3, Dy=3], at least one candidate soft-coded motion vector corresponding to the hard-coded motion vector [x:6, y:3], [x:4, y:6], [x:6, y:6], etc. can be selected.
[0064] Accordingly, at least one candidate soft coding motion vector corresponding to each candidate soft coding mode of the first coding unit may be determined.
[0065] For the first candidate soft coding mode of the first coding unit, the second type cost of at least one corresponding candidate soft coding motion vector can be calculated respectively, and the one with the smallest second type cost is selected from the at least one candidate soft coding motion vector as the target soft coding motion vector of the first candidate soft coding mode. Among them, the first candidate soft coding mode refers to any candidate soft coding mode of the first coding unit. Based on this, the target soft coding motion vector of each candidate soft coding mode of the first coding unit can be determined. Furthermore, the first type cost of each candidate soft coding mode can be calculated according to the target soft coding motion vector of each candidate soft coding mode of the first coding unit, so as to select the target soft coding mode of the first coding unit.
[0066] So far, when the hard coding mode corresponding to the first coding unit is a specific coding mode, the target soft coding mode and the target soft coding motion vector of the first coding unit can be determined.
[0067] If the hard coding mode corresponding to the first coding unit is not a specific coding mode, the hard coding mode corresponding to the first coding unit can be used as the target soft coding mode of the first coding unit. If the hard coding mode corresponding to the first coding unit is not a specific coding mode, it means that the expected coding effect can be achieved according to the hard coding mode corresponding to the first coding unit. In this case, the hard coding mode corresponding to the first coding unit can be directly used as the target soft coding mode of the first coding unit.
[0068] Further, as mentioned above, the auxiliary information determined from the hard-coded bitstream of the source video to be encoded also includes the hard-coded motion vectors corresponding to each coding unit in the source video to be encoded. Based on this, it can be determined whether the hard-coded motion vector corresponding to the first coding unit exceeds the preset motion vector range. The preset motion vector range is determined based on several motion vectors of the first coding unit.
[0069] If the hard-coded motion vector corresponding to the first coding unit exceeds the preset motion vector range, a motion vector in the preset motion vector range that is closest to the hard-coded motion vector corresponding to the first coding unit is used as the target soft-coded motion vector of the first coding unit. The motion vector that is closest to the hard-coded motion vector corresponding to the first coding unit refers to a motion vector that has the smallest vector difference with the hard-coded motion vector corresponding to the first coding unit.
[0070] If the hard-coded motion vector corresponding to the first coding unit does not exceed the preset motion vector range, the hard-coded motion vector corresponding to the first coding unit is used as the target soft-coded motion vector of the first coding unit.
[0071] At this point, in the case where the hard coding mode corresponding to the first coding unit is a specific coding mode, the target soft coding mode and the target soft coding motion vector of the first coding unit can also be determined.
[0072] It should be noted that the execution subject of each step of the method provided in the above embodiment can be the same device, or the method can be executed by different devices. For example, the execution subject of step 100 can be device A; for another example, the execution subject of step 101 can be device B, and the execution subject of step 102 can be device B; and so on.
[0073] In addition, in some of the processes described in the above embodiments and the accompanying drawings, multiple operations that appear in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this article or executed in parallel, and the sequence numbers of the operations, such as 100, 101, etc., are only used to distinguish between different operations, and the sequence numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel. It should be noted that the descriptions of "first", "second", etc. in this article are used to distinguish different messages, devices, modules, etc., do not represent the order of precedence, and do not limit the "first" and "second" to be different types.
[0074] Figure 2 FIG. 1 is a schematic diagram of the structure of a video encoder provided by another embodiment of the present application. Figure 2As shown, the video encoder includes: a memory 20, a processor 21 and a communication component 22.
[0075] The memory 20 is used to store computer programs and can be configured to store various other data to support operations on the video encoder. Examples of such data include instructions, pictures, videos, etc. for any application or method operating on the video encoder.
[0076] The memory 20 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0077] The processor 21 is coupled to the memory 20 and the communication component 22, and is used to execute the computer program in the memory to:
[0078] Obtaining the source video to be encoded and the hard-coded bit stream of the source video to be encoded through the communication component 22;
[0079] Determining auxiliary information based on a hard-coded bitstream;
[0080] Determining soft coding parameters of the source video to be encoded according to the auxiliary information;
[0081] Based on the soft coding parameters, the source video to be encoded is software encoded to obtain the target bit stream.
[0082] In an optional embodiment, when the processor 21 determines the auxiliary information according to the hard-coded bit stream, it is configured to:
[0083] Software decoding is performed on the hard-coded bitstream to determine the auxiliary information from the hard-coded bitstream.
[0084] In an optional embodiment, the auxiliary information includes a hard coding mode corresponding to each coding unit in the source video to be encoded; when the processor 21 determines the soft coding parameters of the source video to be encoded according to the auxiliary information, it is used to:
[0085] For the first coding unit, if the hard coding mode corresponding to the first coding unit is a specific hard coding mode, obtaining at least one candidate soft coding mode corresponding to the specific hard coding mode;
[0086] Selecting a target soft coding mode for a first coding unit from at least one candidate soft coding mode;
[0087] The first encoding unit is any encoding unit in the source video to be encoded.
[0088] In an optional embodiment, when the processor 21 selects a target soft coding mode for the first coding unit from at least one candidate soft coding mode, it is configured to:
[0089] Calculate the first type cost of each candidate soft coding mode;
[0090] The candidate soft coding mode with the lowest cost in the first category is selected as the target soft coding mode of the first coding unit.
[0091] In an optional embodiment, the auxiliary information further includes a hard-coded motion vector corresponding to each coding unit; when calculating the first type cost of each candidate soft coding mode, the processor 21 is used to:
[0092] Determine at least one candidate soft-coded motion vector corresponding to each candidate soft-coded mode based on the hard-coded motion vector corresponding to the first coding unit;
[0093] Determining a second type cost for each candidate soft coded motion vector;
[0094] Selecting one of the candidate soft-coding motion vectors with the smallest cost corresponding to the second category as the target soft-coding motion vector of the current candidate soft-coding mode;
[0095] Based on the target soft-coded motion vector corresponding to each candidate soft-coding mode, the first type cost of each candidate soft-coding mode is calculated respectively.
[0096] In an optional embodiment, the processor 21 is further configured to:
[0097] A candidate soft-coded motion vector used to generate a first type cost of a target soft-coding mode of a first coding unit is obtained as a target soft-coded motion vector of the first coding unit.
[0098] In an optional embodiment, the processor 21 is further configured to:
[0099] If the hard coding mode corresponding to the first coding unit is not the specific coding mode, the hard coding mode corresponding to the first coding unit is used as the target soft coding mode of the first coding unit.
[0100] In an optional embodiment, the auxiliary information further includes a hard-coded motion vector corresponding to each coding unit in the source video to be encoded, and the processor 21 is further configured to:
[0101] If the hard-coded motion vector corresponding to the first coding unit exceeds the preset motion vector range, then
[0102] A motion vector in the preset motion vector range that is closest to the hard-coded motion vector corresponding to the first coding unit is used as the target soft-coded motion vector of the first coding unit.
[0103] In an optional embodiment, the processor 21 is further configured to:
[0104] If the hard-coded motion vector corresponding to the first coding unit does not exceed the preset motion vector range, then
[0105] The hard-coded motion vector corresponding to the first coding unit is used as the target soft-coded motion vector of the first coding unit.
[0106] In an optional embodiment, when performing software encoding on the source video to be encoded based on the soft encoding parameters, the processor 21 is configured to:
[0107] Based on the target soft coding mode and the target soft coding motion vector corresponding to each coding unit in the source video to be encoded, software coding is performed on each coding unit in the source video to be encoded.
[0108] Further, if Figure 2 As shown, the video encoder also includes: a power supply component 23 and other components. Figure 2 Only some components are shown schematically, which does not mean that the video encoder only includes Figure 2 Components shown.
[0109] Among them, the communication component 22 is configured to facilitate wired or wireless communication between the device where the communication component is located and other devices. The device where the communication component is located can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component can be implemented based on near field communication (NFC) technology, radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology or other technologies to facilitate short-range communication.
[0110] The power supply component 23 provides power to various components of the device where the power supply component is located. The power supply component may include a power management system, one or more power supplies, and other components associated with generating, managing and distributing power to the device where the power supply component is located.
[0111] It is worth noting that the technical details involved in the above-mentioned embodiments of the video encoder can be referred to the relevant description of the aforementioned video encoding method, and will not be repeated here, but this should not cause loss of the protection scope of this application.
[0112] Accordingly, an embodiment of the present application further provides a computer-readable storage medium storing a computer program, and when the computer program is executed, each step that can be executed by the video encoder in the above method embodiment can be implemented.
[0113] Figure 3A structural diagram of a soft-hard hybrid video encoder provided by another embodiment of the present application is shown in FIG. Figure 3 As shown, the soft-hard hybrid video encoder includes: a hardware encoder 30, a software decoder 31 and a software encoder 32;
[0114] The hardware encoder 30 is used to perform hardware encoding on the source video to be encoded to obtain a hard-coded bit stream; and send the hard-coded bit stream to the software decoder 31;
[0115] The software decoder 31 is used to perform software decoding on the hard-coded bitstream to determine the auxiliary information from the hard-coded bitstream; and send the auxiliary information to the software encoder 32;
[0116] The software encoder 32 is used to receive auxiliary information and obtain the source video to be encoded; determine the soft encoding parameters of the source video to be encoded according to the auxiliary information; and perform software encoding on the source video to be encoded based on the soft encoding parameters to obtain a target bit stream.
[0117] In an optional embodiment, the auxiliary information includes a hard coding mode corresponding to each coding unit in the source video to be encoded; when the software encoder 32 determines the soft coding parameters of the source video to be encoded according to the auxiliary information, it is used to:
[0118] For the first coding unit, if the hard coding mode corresponding to the first coding unit is a specific hard coding mode, obtaining at least one candidate soft coding mode corresponding to the specific hard coding mode;
[0119] Selecting a target soft coding mode for a first coding unit from at least one candidate soft coding mode;
[0120] The first encoding unit is any encoding unit among the encoding units in the source video to be encoded.
[0121] In an optional embodiment, the software encoder 32, when selecting a target soft coding mode for the first coding unit from at least one candidate soft coding mode, is configured to:
[0122] Calculate the first type cost of each candidate soft coding mode;
[0123] The candidate soft coding mode with the lowest cost in the first category is selected as the target soft coding mode of the coding unit.
[0124] In an optional embodiment, the auxiliary information further includes a hard-coded motion vector corresponding to each coding unit; when calculating the first type cost of each candidate soft coding mode, the software encoder 32 is used to:
[0125] Determine at least one candidate soft-coded motion vector corresponding to each candidate soft-coded mode based on the hard-coded motion vector corresponding to the first coding unit;
[0126] Determining a second type cost for each candidate soft coded motion vector;
[0127] Selecting one of the candidate soft-coding motion vectors with the smallest cost corresponding to the second category as the target soft-coding motion vector of the current candidate soft-coding mode;
[0128] Based on the target soft-coded motion vector corresponding to each candidate soft-coding mode, the first type cost of each candidate soft-coding mode is calculated respectively.
[0129] In an optional embodiment, the software encoder 32 is further configured to:
[0130] A soft-coded motion vector used to generate a first type of cost corresponding to a target soft-coding mode of the first coding unit is obtained as a target soft-coded motion vector of the first coding unit.
[0131] In an optional embodiment, the software encoder 32 is further configured to:
[0132] If the hard coding mode corresponding to the first coding unit is not the specific coding mode, the hard coding mode corresponding to the first coding unit is used as the target soft coding mode of the first coding unit.
[0133] In an optional embodiment, the auxiliary information further includes a hard-coded motion vector corresponding to each coding unit in the source video to be encoded, and the software encoder 32 is further used to:
[0134] If the hard-coded motion vector corresponding to the first coding unit exceeds the preset motion vector range, then
[0135] A motion vector in the preset motion vector range that is closest to the hard-coded motion vector corresponding to the first coding unit is used as the target soft-coded motion vector of the first coding unit.
[0136] In an optional embodiment, the software encoder 32 is further configured to:
[0137] If the hard-coded motion vector corresponding to the first coding unit does not exceed the preset motion vector range, then
[0138] The hard-coded motion vector corresponding to the first coding unit is used as the target soft-coded motion vector of the first coding unit.
[0139] In an optional embodiment, when performing software encoding on the source video to be encoded based on the soft encoding parameters, the software encoder 32 is configured to:
[0140] Based on the target soft coding mode and the target soft coding motion vector corresponding to each coding unit in the source video to be encoded, software coding is performed on each coding unit in the source video to be encoded.
[0141] It is worth noting that the technical details involved in the above-mentioned embodiments of the soft-hard hybrid video encoder can be referred to the relevant description of the aforementioned video encoding method, which will not be repeated here, but this should not cause loss of the protection scope of this application.
[0142] Accordingly, an embodiment of the present application further provides a computer-readable storage medium storing a computer program, and when the computer program is executed, each step that can be performed by the soft-hard hybrid video encoder in the above method embodiment can be implemented.
[0143] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0144] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0145] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0146] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0147] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0148] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0149] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0150] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0151] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A video encoding method, characterized in that: include: Obtaining a source video to be encoded and a hard-coded bitstream of the source video to be encoded; Determine the hard-coded mode and hard-coded motion vector corresponding to each coding unit in the source video to be encoded according to the hard-coded bitstream; For a first encoding unit, determining whether a hard encoding mode corresponding to the first encoding unit is a specific hard encoding mode, the first encoding unit being any encoding unit in the source video to be encoded, and the hard encoding mode corresponding to the first encoding unit is not a specific encoding mode, indicating that software encoding of the source video to be encoded according to the hard encoding mode corresponding to the first encoding unit can meet expected encoding requirements; If the hard coding mode corresponding to the first coding unit is a specific hard coding mode, obtaining at least one candidate soft coding mode corresponding to the specific hard coding mode, determining at least one candidate soft coding motion vector corresponding to each candidate soft coding mode based on the hard coding motion vector corresponding to the first coding unit, selecting one from the candidate soft coding motion vectors as a target soft coding motion vector of a current soft coding mode, and selecting a target soft coding mode for the first coding unit from the at least one candidate soft coding mode according to the target soft coding motion vector; If the hard coding mode corresponding to the first coding unit is not a specific coding mode, using the hard coding mode corresponding to the first coding unit as a target soft coding mode of the first coding unit; Based on the target soft coding mode, software coding is performed on the source video to be encoded to obtain a target bit stream.
2. The method according to claim 1, characterized in that The step of obtaining the hard-coded bitstream of the source video to be encoded includes: Performing hardware encoding on the source video to be encoded to obtain a hard-coded bit stream; The determining of the hard-coding mode and the hard-coded motion vector according to the hard-coded bitstream includes: The hard-coded bitstream is software decoded to determine the hard-coded mode and the hard-coded motion vector from the hard-coded bitstream.
3. The method according to claim 1, characterized in that The selecting a target soft coding mode for the first coding unit from the at least one candidate soft coding mode comprises: Calculate the first type cost of each candidate soft coding mode; A first-category soft coding mode with the lowest cost is selected as a target soft coding mode of the first coding unit.
4. The method according to claim 3, characterized in that The calculating the first type of cost of each candidate soft coding mode includes: Determine at least one candidate soft-coded motion vector corresponding to each soft-coded mode based on the hard-coded motion vector corresponding to the first coding unit; Determining a second type cost for each candidate soft coded motion vector; Selecting one of the candidate soft-coded motion vectors with the smallest cost corresponding to the second category as the target soft-coded motion vector of the current soft coding mode; Based on the target soft-coded motion vector corresponding to each soft-coding mode, the first type cost of each soft-coding mode is calculated respectively.
5. The method according to claim 4, characterized in that Also includes: A candidate soft-coded motion vector used to generate a first type of cost corresponding to a target soft-coding mode of the first coding unit is obtained as a target soft-coded motion vector of the first coding unit.
6. The method according to claim 1, characterized in that The method further comprises: If the hard-coded motion vector corresponding to the first coding unit exceeds the preset motion vector range, then A motion vector in the preset motion vector range that is closest to the hard-coded motion vector corresponding to the first coding unit is used as a target soft-coded motion vector of the first coding unit.
7. The method according to claim 6, characterized in that Also includes: If the hard-coded motion vector corresponding to the first coding unit does not exceed the preset motion vector range, then The hard-coded motion vector corresponding to the first coding unit is used as the target soft-coded motion vector of the first coding unit.
8. The method according to any one of claims 5 to 7, characterized in that: The performing software encoding on the source video to be encoded based on the target soft encoding mode includes: Based on the target soft coding mode and the target soft coding motion vector, software coding is performed on each coding unit in the source video to be encoded.
9. A video encoder, characterized in that including memory and processor; The memory is used to store one or more computer instructions; The processor is coupled to the memory and configured to execute the one or more computer instructions for: Obtaining a source video to be encoded and a hard-coded bitstream of the source video to be encoded; Determine the hard-coded mode and hard-coded motion vector corresponding to each coding unit in the source video to be encoded according to the hard-coded bitstream; For a first encoding unit, determining whether a hard encoding mode corresponding to the first encoding unit is a specific hard encoding mode, the first encoding unit being any encoding unit in the source video to be encoded, and the hard encoding mode corresponding to the first encoding unit is not a specific encoding mode, indicating that software encoding of the source video to be encoded according to the hard encoding mode corresponding to the first encoding unit can meet expected encoding requirements; If the hard coding mode corresponding to the first coding unit is a specific hard coding mode, obtaining at least one candidate soft coding mode corresponding to the specific hard coding mode, determining at least one candidate soft coding motion vector corresponding to each candidate soft coding mode based on the hard coding motion vector corresponding to the first coding unit, selecting one from the candidate soft coding motion vectors as a target soft coding motion vector of a current soft coding mode, and selecting a target soft coding mode for the first coding unit from the at least one candidate soft coding mode according to the target soft coding motion vector; If the hard coding mode corresponding to the first coding unit is not a specific coding mode, using the hard coding mode corresponding to the first coding unit as a target soft coding mode of the first coding unit; Based on the target soft coding mode, software coding is performed on the source video to be encoded to obtain a target bit stream.
10. The video encoder according to claim 9, characterized in that When the processor selects a target soft coding mode for the first coding unit from the at least one candidate soft coding mode, the processor is configured to: Calculate the first type cost of each candidate soft coding mode; A first-category soft coding mode with the lowest cost is selected as a target soft coding mode of the first coding unit.
11. The video encoder according to claim 10, characterized in that When calculating the first type of cost of each candidate soft coding mode, the processor is used to: Determine at least one candidate soft-coded motion vector corresponding to each soft-coded mode based on the hard-coded motion vector corresponding to the first coding unit; Determining a second type cost for each candidate soft coded motion vector; Selecting one of the candidate soft-coded motion vectors with the smallest cost corresponding to the second category as the target soft-coded motion vector of the current candidate soft-coding mode; Based on the target soft-coded motion vector corresponding to each candidate soft-coding mode, the first type cost of each candidate soft-coding mode is calculated respectively.
12. The video encoder according to claim 11, characterized in that The processor is further configured to: A candidate soft-coded motion vector used to generate a first cost of a target soft coding mode of the first coding unit is obtained as a target soft-coded motion vector of the first coding unit.
13. A soft-hard hybrid video encoder, characterized in that: Includes hardware encoders, software decoders, and software encoders; The hardware encoder is used to perform hardware encoding on the source video to be encoded to obtain a hard-coded bit stream; and send the hard-coded bit stream to the software decoder; The software decoder is used to perform software decoding on the hard-coded bitstream to determine the hard-coded mode and hard-coded motion vector corresponding to each coding unit in the source video to be encoded from the hard-coded bitstream; and send the hard-coded mode and the hard-coded motion vector to the software encoder; The software encoder is used to receive the hard-coded mode and the hard-coded motion vector and obtain the source video to be encoded; For a first encoding unit, determining whether a hard encoding mode corresponding to the first encoding unit is a specific hard encoding mode, the first encoding unit being any encoding unit in the source video to be encoded, and the hard encoding mode corresponding to the first encoding unit is not a specific encoding mode, indicating that software encoding of the source video to be encoded according to the hard encoding mode corresponding to the first encoding unit can meet expected encoding requirements; If the hard coding mode corresponding to the first coding unit is a specific hard coding mode, obtaining at least one candidate soft coding mode corresponding to the specific hard coding mode, determining at least one candidate soft coding motion vector corresponding to each candidate soft coding mode based on the hard coding motion vector corresponding to the first coding unit, selecting one from the candidate soft coding motion vectors as a target soft coding motion vector of a current soft coding mode, and selecting a target soft coding mode for the first coding unit from the at least one candidate soft coding mode according to the target soft coding motion vector; If the hard coding mode corresponding to the first coding unit is not a specific coding mode, using the hard coding mode corresponding to the first coding unit as a target soft coding mode of the first coding unit; Based on the target soft coding mode, software coding is performed on the source video to be encoded to obtain a target bit stream.
14. The soft-hard hybrid video encoder according to claim 13, characterized in that: The software encoder, when selecting a target soft coding mode for the first coding unit from the at least one candidate soft coding mode, is configured to: Calculate the first-class cost of each soft coding mode; A first-category soft coding mode with the lowest cost is selected as a target soft coding mode of the first coding unit.
15. The soft-hard hybrid video encoder according to claim 14, characterized in that: When calculating the first type of cost of each candidate soft coding mode, the software encoder is used to: Determine at least one candidate soft-coded motion vector corresponding to each candidate soft-coded mode based on the hard-coded motion vector corresponding to the first coding unit; Determining a second type cost for each candidate soft coded motion vector; Selecting one of the candidate soft-coded motion vectors with the smallest cost corresponding to the second category as the target soft-coded motion vector of the current candidate soft-coding mode; Based on the target soft-coded motion vector corresponding to each candidate soft-coding mode, the first type cost of each candidate soft-coding mode is calculated respectively.
16. The soft-hard hybrid video encoder according to claim 15, characterized in that: The software encoder is also used to: A soft-coded motion vector used to generate a first type of cost of a target soft coding mode of the first coding unit is obtained as a target soft-coded motion vector of the first coding unit.
17. A computer-readable storage medium storing computer instructions, characterized in that: When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the video encoding method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Method and device for generating multi-code-rate videos
CN105120261A
Video encoding and transcoding compression method, device and equipment, and computer readable storage medium
CN109640114A