A video frame coding method, apparatus, device, and medium based on image groups
By performing image group type identification and quality benchmark parameter generation on video frame sequences, and adaptively adjusting the preset decision threshold of image resolution scaling, the problem of uneven coding quality caused by fixed thresholds is solved, and more efficient video frame coding is achieved.
Patent Information
- Application Number
- CN202611257408.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-19
- Publication Date
- 2026-11-17
AI Technical Summary
In existing video frame encoding methods, fixed thresholds prevent the perception of differences in video content quality levels, leading to problems such as over-downsampling of high-quality content or insufficient conservation of low-quality content.
By performing image group type identification on the target video frame sequence, quality benchmark parameters are generated, and the preset decision threshold for the image resolution scaling level is adaptively adjusted. The coding resolution of the second type of image group is dynamically adjusted using the actual quality information of the first type of image group.
It enables dynamic adjustment of the threshold based on the actual encoding quality, solving the problem that a fixed threshold cannot detect differences in content quality levels, and improving the adaptability and efficiency of encoding quality.
Smart Images

Figure CN123123572A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of video coding and compression, and in particular to a video frame coding method, apparatus, device, and medium based on image groups. Background Technology
[0002] In modern video coding, reference frames typically maintain the same resolution as the current frame. MRRP (Multi-Resolution Reference Picture) technology allows the encoder to encode and store reference frames at a reduced resolution, and then upsample the low-resolution reference frames to the current frame resolution for use during inter-frame prediction.
[0003] Existing solutions for video frame encoding based on MRRP technology typically use a fixed threshold to determine the encoding resolution. This approach may lead to oversampling for high-quality content (which naturally has a high peak signal-to-noise ratio) and may be insufficiently conservative for low-quality content. Summary of the Invention
[0004] In view of this, the purpose of this invention is to provide a video frame coding method, apparatus, device, and medium based on image groups, which can adaptively adjust a preset decision threshold according to a reference parameter, so that the threshold dynamically changes with the actual coding quality, thus solving the problem that a fixed threshold cannot perceive differences in the quality level of the sequence content. The specific solution is as follows: In a first aspect, this application provides a video frame coding method based on image groups, including: Image group type identification is performed on the current image group in the target video frame sequence; wherein, the first image group in the target video frame sequence is an image group containing keyframes; If the corresponding recognition result indicates that the current image group is a type of image group, then the video frames in the current image group are encoded using the original resolution corresponding to the current image group, the actual quality information of the encoded current image group is collected, and the corresponding quality benchmark parameters are generated based on the actual quality information. If the corresponding recognition result indicates that the current image group is a type II image group that does not contain keyframes, then the preset decision threshold used to measure the image resolution scaling level is adaptively adjusted according to the quality benchmark parameters corresponding to the target image group to obtain the corresponding adjusted threshold; the target image group is the type II image group that is closest to the current image group among the type II image groups located before the current image group in the target video frame sequence; The target resolution corresponding to the current image group is determined based on the adjusted threshold, and the video frames in the current image group are encoded according to the target resolution.
[0005] Optionally, before performing image group type identification on the current image group in the target video frame sequence, the method further includes: Determine whether the current video frame is a boundary frame of an image group; the image group boundary frame represents the first video frame in the current image group. If the current video frame is an image group boundary frame, then proceed to the step of identifying the image group type of the current image group in the target video frame sequence.
[0006] Optionally, before performing image group type identification on the current image group in the target video frame sequence, the method further includes: If the current video frame is not a boundary frame of an image group, the encoding resolution of the current image group at the boundary frame of the image group is obtained, and the current video frame is encoded using the encoding resolution.
[0007] Optionally, obtaining the encoding resolution already determined for the current image group at the boundary frame of the image group, and encoding the current video frame using the encoding resolution, includes: If the current image group corresponding to the current video frame is a type of image group, then the original resolution already determined at the boundary frame of the corresponding image group is obtained, and the current video frame is encoded using the original resolution; If the current image group corresponding to the current video frame is a type II image group, then the target resolution already determined at the boundary frame of the corresponding image group is obtained, and the current video frame is encoded using the target resolution.
[0008] Optionally, the step of acquiring the actual quality information of the current image group after encoding, and generating corresponding quality benchmark parameters based on the actual quality information, includes: The quality index values of each component obtained after encoding each video frame in the current image group are determined, and the quality index values of the same component are accumulated to obtain the accumulated values corresponding to each component; wherein, the video frame includes a luminance component and a chrominance component; Divide the sum of each component by the total number of frames in the current image group to obtain the average quality index value corresponding to each component, and determine each of the average quality index values as the quality benchmark parameter.
[0009] Optionally, the step of adaptively adjusting the preset decision threshold used to measure the image resolution scaling level based on the quality benchmark parameters corresponding to the target image group includes: Obtain the luminance component reference value from the quality reference parameters corresponding to the target image group; The luminance component reference value is compared with each preset decision threshold corresponding to each preset resolution scaling level. If the luminance component reference value is higher than the preset decision threshold corresponding to any preset resolution scaling level, the target decision threshold is adjusted upward according to the difference between the luminance component reference value and the target decision threshold. The target decision threshold is the preset decision threshold corresponding to any preset resolution scaling level.
[0010] Optionally, determining the target resolution corresponding to the current image group based on the adjusted threshold includes: The image group boundary frames of the current image group are simulated and encoded using each image resolution scaling level to obtain the prediction quality index corresponding to each image resolution scaling level. Each of the predicted quality indicators is compared with the adjusted threshold to determine the target image resolution scaling level corresponding to the target predicted quality indicator that is not less than the adjusted threshold, and the resolution corresponding to the highest resolution among the target image resolution scaling levels is determined as the target resolution.
[0011] Secondly, this application provides a video frame encoding apparatus based on image groups, comprising: The image group type recognition module is used to identify the image group type of the current image group in the target video frame sequence; wherein, the first image group in the target video frame sequence is an image group containing keyframes; The benchmark parameter generation module is used to encode the video frames in the current image group using the original resolution corresponding to the current image group if the corresponding recognition result indicates that the current image group is a type of image group, collect the actual quality information of the encoded current image group, and generate the corresponding quality benchmark parameters based on the actual quality information. The threshold adjustment module is used to adaptively adjust the preset decision threshold used to measure the image resolution scaling level according to the quality benchmark parameters corresponding to the target image group if the corresponding recognition result indicates that the current image group is a type II image group that does not contain keyframes, so as to obtain the corresponding adjusted threshold; the target image group is the type II image group that is closest to the current image group from the type II image groups located before the current image group in the target video frame sequence. The target resolution determination module is used to determine the target resolution corresponding to the current image group based on the adjusted threshold, and to encode the video frames in the current image group according to the target resolution.
[0012] Thirdly, this application provides an electronic device, comprising: Memory, used to store computer programs; A processor for executing the computer program to implement the aforementioned image group-based video frame coding method.
[0013] Fourthly, this application provides a computer-readable storage medium for storing a computer program that, when executed by a processor, implements the aforementioned video frame encoding method based on image groups.
[0014] This application first identifies the image group type of the current image group in the target video frame sequence; wherein, the first image group in the target video frame sequence is an image group containing keyframes; If the corresponding recognition result indicates that the current image group is a Class I image group, then the video frames in the current image group are encoded using the original resolution corresponding to the current image group, the actual quality information of the encoded current image group is collected, and the corresponding quality benchmark parameters are generated based on the actual quality information. If the corresponding recognition result indicates that the current image group is a Class II image group that does not contain keyframes, then the preset decision threshold used to measure the image resolution scaling level is adaptively adjusted according to the quality benchmark parameters corresponding to the target image group to obtain the corresponding adjusted threshold. The target image group is the Class II image group that is closest to the current image group from among the Class II image groups located before the current image group in the target video frame sequence. Finally, the target resolution corresponding to the current image group is determined according to the adjusted threshold, and the video frames in the current image group are encoded according to the target resolution. Therefore, this application generates quality benchmark parameters by collecting the actual quality information of the encoded image group and then uses these benchmark parameters to adjust the thresholds of the subsequent image groups, thus constructing a quality feedback channel from the encoded quality to subsequent decisions. This solves the problem that each GOP decision is independent and lacks historical quality feedback. Furthermore, by adaptively adjusting the preset decision threshold based on these benchmark parameters, the threshold changes dynamically with the actual encoded quality, thus solving the problem that a fixed threshold cannot perceive differences in the quality level of the sequence content. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0016] Figure 1 This is a schematic diagram of a video frame coding method based on image groups disclosed in this application; Figure 2 This is a schematic diagram of the structure of a video frame encoding device based on image groups disclosed in this application; Figure 3 This is a structural diagram of an electronic device disclosed in this application. Detailed Implementation
[0017] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0018] See Figure 1 As shown, this embodiment of the invention discloses a video frame coding method based on image groups, including: Step S11: Identify the image group type of the current image group in the target video frame sequence; wherein, the first image group in the target video frame sequence is an image group containing keyframes.
[0019] This embodiment provides a video frame encoding method that solves the problem of being unable to perceive differences in the quality level of sequence content due to a fixed threshold by employing the following mechanism: 1. I-frame (keyframe) GOP (Group of Pictures) identification and bypass mechanism: Identify GOPs (groups of pictures) containing I-frames and force the original resolution encoding of the GOP; 2. Actual PSNR accumulation mechanism of I-frame GOP: The actual coded PSNR (Peak Signal-to-Noise Ratio) of all frames in the I-frame GOP is statistically analyzed, which is the actual quality information. The average value of each component (Y / U / V) is calculated as the quality benchmark parameter. 3. Adaptive threshold adjustment mechanism based on benchmark PSNR: In the resolution decision of subsequent P / B frame GOPs, the decision thresholds of each level are dynamically adjusted by using the benchmark PSNR of I frame GOPs to prevent over-downsampling. 4. Cross-layer quality information transmission mechanism: The PSNR data statistically obtained from the application layer is fed back to the decision logic of the coding core layer through the encoder context (ENC_CTX) structure.
[0020] The core innovation of this invention is: using the actual average PSNR of the I-frame GOP as the content adaptive benchmark, dynamically calibrating the MRRP resolution decision threshold of subsequent inter-frame GOPs, thereby achieving closed-loop adaptive control of coding quality.
[0021] It should be noted that, in this embodiment, the I-frame GOP status field, as shown in Table 1, needs to be added to the encoder context structure (ENC_CTX): Table 1
[0022] In this embodiment, before performing image group type identification on the current image group in the target video frame sequence, the method further includes: determining whether the current video frame is an image group boundary frame; an image group boundary frame represents the first video frame in the current image group; if the current video frame is an image group boundary frame, then the method jumps to the step of performing image group type identification on the current image group in the target video frame sequence; if the current video frame is not an image group boundary frame, then the method obtains the encoding resolution of the current image group at the image group boundary frame, and uses the encoding resolution to encode the current video frame.
[0023] Specifically, the process of obtaining the determined encoding resolution of the current image group at the boundary frame of the image group and encoding the current video frame using the encoding resolution may include: if the current image group corresponding to the current video frame is a type I image group, then obtaining the determined original resolution at the boundary frame of the corresponding image group and encoding the current video frame using the original resolution; if the current image group corresponding to the current video frame is a type II image group, then obtaining the determined target resolution at the boundary frame of the corresponding image group and encoding the current video frame using the target resolution.
[0024] That is, in the function enc_pic_prepare(), the MRRP decision logic before encoding each frame is as follows: Step 1: Detect GOP boundaries: Current POC % GOP_SIZE == 0 → GOP boundary frame; Step 2: Distinguish between I-frame GOPs and P / B-frame GOPs (i.e., two types of image groups) at the GOP boundaries: If the current frame type is SLICE_I (I-frame GOP): Set mrrp_is_i_gop = 1, and record mrrp_i_gop_poc_start = the current POC; Reset the PSNR cumulative counter (clear sum and count); Force mrrp_current_scaling_idx(index value of the resolution to use, -1 for the original resolution, 0 for 1.25x downsampling, 1 for 1.5x downsampling, 2 for 2x downsampling) = -1 (original resolution); Set use_scaled_resolution (whether to use the downsampled resolution) = FALSE; Skip MRRP downsampling, and encode the entire I-frame GOP using the original resolution.
[0025] If the current frame type is a P / B frame (not an I-frame GOP): Set mrrp_is_i_gop = 0; Enter the adaptive threshold decision process.
[0026] Step 3: Processing of non-boundary frames within a GOP: If mrrp_is_i_gop == 1, then use_scaled_resolution = FALSE (inheriting I-frame GOP decision); If mrrp_current_scaling_idx >= 0, then the scaling decision of the previous GOP boundary is inherited. Otherwise → use_scaled_resolution = FALSE.
[0027] In other words, before performing image group type identification on the current image group in the target video frame sequence, this application determines whether the current video frame is an image group boundary frame and performs subsequent processing based on the corresponding determination result. It should be noted that the first frame of each GOP is usually the keyframe (I-frame). By determining the first video frame in the image group, the type of the current image can be identified.
[0028] Step S12: If the corresponding recognition result indicates that the current image group is a type of image group, then the video frames in the current image group are encoded using the original resolution corresponding to the current image group, the actual quality information of the encoded current image group is collected, and the corresponding quality benchmark parameters are generated based on the actual quality information.
[0029] In this embodiment, the actual quality information of the current image group after encoding is collected, and corresponding quality benchmark parameters are generated based on the actual quality information. This includes: determining the quality index value of each component obtained after encoding each video frame in the current image group, and accumulating the quality index value of the same component to obtain the accumulated value corresponding to each component; wherein, the video frame includes a luminance component and a chrominance component; dividing the accumulated value of each component by the total number of frames in the current image group to obtain the average quality index value corresponding to each component, and determining each average quality index value as the quality benchmark parameter.
[0030] Specifically, the code representation of the actual PSNR accumulation of the I-frame GOP is as follows: In the encoding application layer (app_encoder.c), after each frame is encoded and the PSNR statistics (i.e., actual quality information) are obtained: If gop_based_mrrp_enable==1 and mrrp_is_i_gop==1 and the current POC is within the range of [mrrp_i_gop_poc_start, mrrp_i_gop_poc_start + GOP_SIZE), where GOP_SIZE is the image group size of the current encoding mode, the default value is 8; Perform the following operation: mrrp_i_gop_psnr_y_sum+=psnr[0] / / Accumulate the brightness PSNR; mrrp_i_gop_psnr_u_sum+=psnr[1] / / Accumulate Cb PSNR; mrrp_i_gop_psnr_v_sum+=psnr[2] / / Accumulated Cr PSNR; mrrp_i_gop_psnr_count++; GOP completion check (when count >= GOP_SIZE): mrrp_i_gop_avg_psnr_y=psnr_y_sum / psnr_count; mrrp_i_gop_avg_psnr_u=psnr_u_sum / psnr_count; mrrp_i_gop_avg_psnr_v=psnr_v_sum / psnr_count; mrrp_i_gop_psnr_valid=1 / / Marks the baseline PSNR (i.e., the quality baseline parameter) as valid.
[0031] Step S13: If the corresponding recognition result indicates that the current image group is a type II image group that does not contain keyframes, then the preset decision threshold used to measure the image resolution scaling level is adaptively adjusted according to the quality benchmark parameters corresponding to the target image group to obtain the corresponding adjusted threshold; the target image group is the type II image group that is closest to the current image group among the type II image groups located before the current image group in the target video frame sequence.
[0032] In this embodiment, the preset decision threshold used to measure the image resolution scaling level is adaptively adjusted according to the quality benchmark parameters corresponding to the target image group. This includes: obtaining the luminance component benchmark value in the quality benchmark parameters corresponding to the target image group; comparing the luminance component benchmark value with each preset decision threshold corresponding to each preset resolution scaling level; if the luminance component benchmark value is higher than the preset decision threshold corresponding to any preset resolution scaling level, then the target decision threshold is increased according to the difference between the luminance component benchmark value and the target decision threshold; the target decision threshold is the preset decision threshold corresponding to any preset resolution scaling level.
[0033] The specific code representation is as follows: During the resolution decision phase of the P / B frame GOP, if mrrp_i_gop_psnr_valid == 1, the following adaptive threshold adjustment is performed: Adaptive threshold adjustment formula: set up: ref=mrrp_i_gop_avg_psnr_y (I-frame GOP average PSNR, i.e., the reference value of the luminance component); α = 0.5 (excess weighting factor); T_k: QP-adjusted threshold for the k-th downsampling rate, where k corresponds to the above mrrp_current_scaling_idx; Adjustment method: excess_k=max(0.0, ref - T_k) / / excess_k represents the threshold excess amount of the k-th level; T_k' = T_k + excess_k × α; In other words, if the baseline PSNR of an I-frame GOP exceeds a certain threshold, the threshold is increased by 50% of the "excess amount", so that a higher predicted PSNR is required to select that level, thereby preventing over-downsampling of high-quality content.
[0034] Adjustment example (using version 2.0x as an example): Preset threshold _2x=38.0dB, QP=45 (deviation is 0); I-frame GOP baseline PSNR = 42.0 dB; excess_2x=max(0, 42.0 - 38.0)=4.0dB; T'_2x=38.0+4.0×0.5=40.0 dB; The actual decision threshold increased from 38.0 dB to 40.0 dB; The predicted PSNR of this GOP needs to reach 40.0 dB to enable 2.0× downsampling.
[0035] Step S14: Determine the target resolution corresponding to the current image group based on the adjusted threshold, and encode the video frames in the current image group according to the target resolution.
[0036] In this embodiment, determining the target resolution corresponding to the current image group based on the adjusted threshold includes: performing simulated encoding on the boundary frames of the current image group using each image resolution scaling level to obtain the prediction quality index corresponding to each image resolution scaling level; comparing each prediction quality index with the adjusted threshold to determine the target image resolution scaling level corresponding to the target prediction quality index that is not less than the adjusted threshold, and determining the resolution corresponding to the highest resolution scaling level among the target image resolution scaling levels as the target resolution.
[0037] Specifically, the code representation of the final resolution selection decision is as follows: psnr_pred = com_mrrp_predict_psnr_for_scaling(current frame, 2.0x); If psnr_pred >= T'_2x: selected_idx = 2 (2.0 × downsampling); elif psnr_pred >= T'_1.5x: selected_idx = 1 (1.5× downsampling); elif psnr_pred >= T'_1.25x: selected_idx = 0 (1.25× downsampling); else: selected_idx = -1 (original resolution).
[0038] To make the technical solution in this application easier to understand, the following will use a specific embodiment to illustrate the solution process: Example 1: High-quality content sequence (adaptive threshold adjustment).
[0039] Sequence parameters: Resolution: 1920×1080, Frame Rate: 60fps; GOP size: 32 frames, I-frame interval: 128 frames (an I-frame GOP occurs once every 4 GOPs); Encoding QP: 45, preset threshold: [34.0, 38.0, 42.0] dB (corresponding to [1.25×, 1.5×, 2.0×]).
[0040] The encoding process is shown in Table 2: Table 2
[0041] The decision-making process of GOP-1: I-frame GOP baseline PSNR-Y = 43.5 dB (average of 32 frames from GOP-0). QP deviation = 0 (QP = 45); Preset threshold _2x = 42.0 dB; excess_2x=max(0, 43.5 - 42.0)=1.5 dB; T'_2x=42.0 + 1.5×0.5=42.75 dB←Threshold adjustment; GOP-1 boundary frame prediction PSNR_2x = 41.8 dB; 41.8 < 42.75 → Does not meet the 2.0 × threshold; excess_1_5x=max(0, 43.5 - 38.0) = 5.5 dB; T'_1.5x=38.0+5.5×0.5=40.75 dB; 41.8>=40.75 → Select 1.5× downsampling.
[0042] Conclusion: GOP-1 uses 1.5× downsampling (it would have been 2.0× downsampling if there were no adaptive adjustment).
[0043] Therefore, this application generates quality benchmark parameters by collecting the actual quality information of the encoded image group and then uses these benchmark parameters to adjust the thresholds of the subsequent image groups, thus constructing a quality feedback channel from the encoded quality to subsequent decisions. This solves the problem that each GOP decision is independent and lacks historical quality feedback. Furthermore, by adaptively adjusting the preset decision threshold based on these benchmark parameters, the threshold changes dynamically with the actual encoded quality, thus solving the problem that a fixed threshold cannot perceive differences in the quality level of the sequence content.
[0044] See Figure 2 As shown, an embodiment of the present invention discloses a video frame encoding device based on image groups, comprising: The image group type recognition module 11 is used to perform image group type recognition on the current image group in the target video frame sequence; wherein, the first image group in the target video frame sequence is an image group containing keyframes; The baseline parameter generation module 12 is used to encode the video frames in the current image group using the original resolution corresponding to the current image group if the corresponding recognition result indicates that the current image group is a type of image group, collect the actual quality information of the current image group after encoding, and generate the corresponding quality baseline parameters based on the actual quality information. The threshold adjustment module 13 is used to adaptively adjust the preset decision threshold used to measure the image resolution scaling level according to the quality benchmark parameters corresponding to the target image group if the corresponding recognition result indicates that the current image group is a type II image group that does not contain keyframes, so as to obtain the corresponding adjusted threshold; the target image group is the type II image group that is closest to the current image group from the type II image groups located before the current image group in the target video frame sequence; The target resolution determination module 14 is used to determine the target resolution corresponding to the current image group according to the adjusted threshold, and to encode the video frames in the current image group according to the target resolution.
[0045] In some specific embodiments, the image group type recognition module 11 further includes: The boundary frame determination unit is used to determine whether the current video frame is a boundary frame of an image group; the image group boundary frame represents the first video frame in the current image group. The step jump unit is used to jump to the step of identifying the image group type of the current image group in the target video frame sequence if the current video frame is an image group boundary frame.
[0046] In some specific embodiments, the image group type recognition module 11 further includes: The encoding resolution acquisition submodule is used to acquire the encoding resolution of the current image group at the image group boundary frame if the current video frame is not an image group boundary frame, and to encode the current video frame using the encoding resolution.
[0047] In some specific embodiments, the encoding resolution acquisition submodule may specifically include: The first video frame encoding unit is configured to, if the current image group corresponding to the current video frame is a type of image group, obtain the original resolution already determined at the boundary frame of the corresponding image group, and encode the current video frame using the original resolution. The second video frame encoding unit is configured to, if the current image group corresponding to the current video frame is a type II image group, obtain the target resolution already determined at the boundary frame of the corresponding image group, and encode the current video frame using the target resolution.
[0048] In some specific embodiments, the reference parameter generation module 12 may specifically include: The index value accumulation unit is used to determine the quality index value of each component obtained after encoding each video frame in the current image group, and to accumulate the quality index value of the same component to obtain the accumulated value corresponding to each component; wherein, the video frame includes a luminance component and a chrominance component; The reference parameter determination unit is used to divide the cumulative value of each component by the total number of frames in the current image group to obtain the average quality index value corresponding to each component, and to determine each of the average quality index values as the quality reference parameter.
[0049] In some specific embodiments, the threshold adjustment module 13 may specifically include: A reference value acquisition unit is used to acquire the luminance component reference value in the quality reference parameters corresponding to the target image group; The threshold adjustment unit is used to compare the luminance component reference value with each preset decision threshold corresponding to each preset resolution scaling level. If the luminance component reference value is higher than the preset decision threshold corresponding to any preset resolution scaling level, the target decision threshold is adjusted upward according to the difference between the luminance component reference value and the target decision threshold. The target decision threshold is the preset decision threshold corresponding to any preset resolution scaling level.
[0050] In some specific embodiments, the target resolution determination module 14 may specifically include: The prediction quality index acquisition unit is used to simulate encoding the image group boundary frame of the current image group using each image resolution scaling level, so as to obtain the prediction quality index corresponding to each image resolution scaling level. The target resolution determination unit is used to compare each of the predicted quality indicators with the adjusted threshold to determine the target image resolution scaling level corresponding to the target predicted quality indicator that is not less than the adjusted threshold, and to determine the resolution corresponding to the highest resolution among the target image resolution scaling levels as the target resolution.
[0051] Furthermore, embodiments of this application also disclose an electronic device, Figure 3 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.
[0052] Figure 3This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. Specifically, the electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the image group-based video frame encoding method disclosed in any of the foregoing embodiments. Alternatively, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0053] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0054] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon can include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0055] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of performing the image group-based video frame encoding method executed by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs capable of performing other specific tasks.
[0056] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned video frame encoding method based on image groups. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.
[0057] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0058] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0059] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0060] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0061] The technical solutions provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A video frame coding method based on image groups, characterized in that, include: Image group type identification is performed on the current image group in the target video frame sequence; wherein, the first image group in the target video frame sequence is an image group containing keyframes; If the corresponding recognition result indicates that the current image group is a type of image group, then the video frames in the current image group are encoded using the original resolution corresponding to the current image group, the actual quality information of the encoded current image group is collected, and the corresponding quality benchmark parameters are generated based on the actual quality information. If the corresponding recognition result indicates that the current image group is a type II image group that does not contain keyframes, then the preset decision threshold used to measure the image resolution scaling level is adaptively adjusted according to the quality benchmark parameters corresponding to the target image group to obtain the corresponding adjusted threshold; the target image group is the type II image group that is closest to the current image group among the type II image groups located before the current image group in the target video frame sequence; The target resolution corresponding to the current image group is determined based on the adjusted threshold, and the video frames in the current image group are encoded according to the target resolution.
2. The video frame coding method based on image groups according to claim 1, characterized in that, Before performing image group type identification on the current image group in the target video frame sequence, the method further includes: Determine whether the current video frame is a boundary frame of an image group; the image group boundary frame represents the first video frame in the current image group. If the current video frame is an image group boundary frame, then proceed to the step of identifying the image group type of the current image group in the target video frame sequence.
3. The video frame coding method based on image groups according to claim 2, characterized in that, Before performing image group type identification on the current image group in the target video frame sequence, the method further includes: If the current video frame is not a boundary frame of an image group, the encoding resolution of the current image group at the boundary frame of the image group is obtained, and the current video frame is encoded using the encoding resolution.
4. The video frame coding method based on image groups according to claim 3, characterized in that, The step of obtaining the encoding resolution of the current image group at the boundary frame of the image group and encoding the current video frame using the encoding resolution includes: If the current image group corresponding to the current video frame is a type of image group, then the original resolution already determined at the boundary frame of the corresponding image group is obtained, and the current video frame is encoded using the original resolution; If the current image group corresponding to the current video frame is a type II image group, then the target resolution already determined at the boundary frame of the corresponding image group is obtained, and the current video frame is encoded using the target resolution.
5. The video frame coding method based on image groups according to claim 1, characterized in that, The process of acquiring the actual quality information of the current image group after encoding, and generating corresponding quality benchmark parameters based on the actual quality information, includes: The quality index values of each component obtained after encoding each video frame in the current image group are determined, and the quality index values of the same component are accumulated to obtain the accumulated values corresponding to each component; wherein, the video frame includes a luminance component and a chrominance component; Divide the sum of each component by the total number of frames in the current image group to obtain the average quality index value corresponding to each component, and determine each of the average quality index values as the quality benchmark parameter.
6. The video frame coding method based on image groups according to claim 1, characterized in that, The adaptive adjustment of the preset decision threshold used to measure the image resolution scaling level based on the quality benchmark parameters corresponding to the target image group includes: Obtain the luminance component reference value from the quality reference parameters corresponding to the target image group; The luminance component reference value is compared with each preset decision threshold corresponding to each preset resolution scaling level. If the luminance component reference value is higher than the preset decision threshold corresponding to any preset resolution scaling level, the target decision threshold is adjusted upward according to the difference between the luminance component reference value and the target decision threshold. The target decision threshold is the preset decision threshold corresponding to any preset resolution scaling level.
7. The video frame coding method based on image groups according to claim 1, characterized in that, Determining the target resolution corresponding to the current image group based on the adjusted threshold includes: The image group boundary frames of the current image group are simulated and encoded using each image resolution scaling level to obtain the prediction quality index corresponding to each image resolution scaling level. Each of the predicted quality indicators is compared with the adjusted threshold to determine the target image resolution scaling level corresponding to the target predicted quality indicator that is not less than the adjusted threshold, and the resolution corresponding to the highest resolution among the target image resolution scaling levels is determined as the target resolution.
8. A video frame encoding apparatus based on image groups, characterized in that, include: The image group type recognition module is used to identify the image group type of the current image group in the target video frame sequence; wherein, the first image group in the target video frame sequence is an image group containing keyframes; The benchmark parameter generation module is used to encode the video frames in the current image group using the original resolution corresponding to the current image group if the corresponding recognition result indicates that the current image group is a type of image group, collect the actual quality information of the encoded current image group, and generate the corresponding quality benchmark parameters based on the actual quality information. The threshold adjustment module is used to adaptively adjust the preset decision threshold used to measure the image resolution scaling level according to the quality benchmark parameters corresponding to the target image group if the corresponding recognition result indicates that the current image group is a type II image group that does not contain keyframes, so as to obtain the corresponding adjusted threshold; the target image group is the type II image group that is closest to the current image group from the type II image groups located before the current image group in the target video frame sequence. The target resolution determination module is used to determine the target resolution corresponding to the current image group based on the adjusted threshold, and to encode the video frames in the current image group according to the target resolution.
9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the image group-based video frame coding method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, Used to store a computer program, which, when executed by a processor, implements the video frame encoding method based on image groups as described in any one of claims 1 to 7.
