Video code stream coding error correction method and system, medium and equipment
By detecting packet loss areas in the video stream and calculating transition values to fill pixels, the problem of whole-frame decoding failure caused by keyframe packet loss is solved, enabling rapid recovery of lost pixel content and improving the stability of video playback and user experience.
Patent Information
- Application Number
- CN202511328765.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-17
- Publication Date
- 2025-11-18
AI Technical Summary
In real-time video communication, packet loss of keyframes leads to the failure of decoding the entire frame, and existing technologies make it difficult to quickly recover the lost pixel content.
By detecting packet loss areas in keyframes of the video stream, the nearest edge pixels in the effective neighboring blocks around the packet loss area are obtained, transition values are calculated, and pixels in the packet loss area are filled in, thus achieving rapid recovery of lost pixel content.
Without waiting for retransmissions or introducing additional redundant data, it maintains the visual continuity and semantic consistency of the video, improving the stability of video playback and user experience under network jitter or sudden packet loss conditions.
Smart Images

Figure CN120980241A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] TECHNICAL FIELD
[0002] The present application relates to the field of video coding, in particular to a video bitstream coding error correction method, system, medium and device. BACKGROUND
[0003] In a low-latency scenario such as real-time video communication, when AVS3 (Audio Video Standard 3, third generation audio and video coding and decoding technology standard) video coding is applied, a single patch (a local pixel block) default mode is usually used for coding transmission. When the coded bitstream is transmitted in the channel, I frame (intra-coded frame) packet loss occurs (a patch contains multiple data packets, and some data packets cannot be correctly received by the decoding end due to network congestion), which will cause the decoding of the patch with packet loss to fail. Since in the default coding configuration, there is only one patch per frame (i.e., the entire image is a patch), if I frame packet loss occurs, the I frame decoding will fail, and the entire sequence cannot be normally decoded.
[0004] Therefore, how to quickly recover the lost pixel content of the key frame is a technical problem that needs to be solved by those skilled in the art. SUMMARY
[0005] The purpose of the present application is to provide a video bitstream coding error correction method, system, medium and device, which can quickly recover the lost pixel content of the key frame.
[0006] To solve the above technical problems, the present application provides a video bitstream coding error correction method, and the specific technical solutions are as follows:
[0007] When detecting that packet loss occurs in a key frame in a video bitstream, determine the packet loss area;
[0008] Obtain the edge pixel closest to the packet loss area from all valid neighbor blocks of the packet loss area;
[0009] Calculate a transition value based on the edge pixel;
[0010] Fill all pixels in the packet loss area based on the transition value.
[0011] Optionally, the detection process of the packet loss area comprises:
[0012] When parsing the header information of the video bitstream, obtain the current header information index and the decoded index; the decoded index is used to maintain the last successfully decoded header information index;
[0013] If a difference between the current header information index and the decoded index is greater than 1, it is determined that the video code stream has packet loss.
[0014] Optionally, after it is determined that the video code stream has packet loss, the method further comprises:
[0015] Optionally, after it is determined that the video code stream has packet loss, the method further comprises:
[0016] Optionally, obtaining the edge pixel closest to the packet loss region from all the valid neighbor blocks of the packet loss region comprises:
[0017] Optionally, obtaining the edge pixel closest to the packet loss region from all the valid neighbor blocks of the packet loss region comprises:
[0018] Optionally, obtaining the edge pixel closest to the packet loss region from all the valid neighbor blocks of the packet loss region comprises:
[0019] Optionally, obtaining the edge pixel closest to the packet loss region from all the valid neighbor blocks of the packet loss region comprises:
[0020] Optionally, before determining the neighbor coordinate information and the direction information of the packet loss region from all the valid neighbor blocks of the packet loss region according to the coordinate information, the method further comprises:
[0021] Optionally, before determining the neighbor coordinate information and the direction information of the packet loss region from all the valid neighbor blocks of the packet loss region according to the coordinate information, the method further comprises:
[0022] Optionally, before determining the neighbor coordinate information and the direction information of the packet loss region from all the valid neighbor blocks of the packet loss region according to the coordinate information, the method further comprises:
[0023] Optionally, calculating the transition value according to the edge pixel comprises:
[0024] Optionally, calculating the transition value according to the edge pixel comprises:
[0025] Optionally, calculating the transition value according to the edge pixel comprises:
[0026] Optionally, after calculating the arithmetic mean of the luminance values of all the edge pixels and taking the arithmetic mean of the luminance values as the transition value, the method further comprises:
[0027] Optionally, after calculating the arithmetic mean of the luminance values of all the edge pixels and taking the arithmetic mean of the luminance values as the transition value, the method further comprises:
[0028] Correspondingly, filling all pixels in the packet loss area based on the transition value comprises:
[0029] Filling in order from the edge to the center of the packet loss area, according to the size relationship between the value of the adjacent pixel at the pixel position to be filled and the transition value, selecting a random value that satisfies the size relationship from the transition interval and filling the pixel position to be filled.
[0030] The application also provides a video code stream encoding error correction system, comprising:
[0031] A packet loss area positioning module, configured to determine a packet loss area when detecting that a key frame in a video code stream has packet loss;
[0032] An edge pixel acquisition module, configured to acquire edge pixels closest to the packet loss area among all valid neighboring blocks of the packet loss area;
[0033] A transition value calculation module, configured to calculate a transition value according to the edge pixels;
[0034] A pixel error correction module, configured to fill all pixels in the packet loss area based on the transition value.
[0035] The application also provides a computer readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement the steps of the video code stream encoding error correction method.
[0036] The application also provides an electronic device comprising a memory and a processor, wherein the memory has a computer program stored therein, and the processor invokes the computer program in the memory to implement the steps of the video code stream encoding error correction method.
[0037] The application provides a video code stream encoding error correction method, comprising: determining a packet loss area when detecting that a key frame in a video code stream has packet loss; acquiring edge pixels closest to the packet loss area among all valid neighboring blocks of the packet loss area; calculating a transition value according to the edge pixels; and filling all pixels in the packet loss area based on the transition value.
[0038] The application introduces a packet loss recovery mechanism based on key frame neighborhood features. When detecting the occurrence of packet loss of a key frame, the application first accurately locates the packet loss area, then extracts the edge pixels of the effective neighbor blocks directly adjacent to the packet loss boundary around the area, calculates the transition value of the edge pixels, and then maps the transition value to the packet loss area. Since the transition value is completely derived from the pixels that are continuous in the spatial domain with the packet loss area and have been correctly received, the encoded and corrected image can maintain the continuity of local texture trend, brightness level and chrominance distribution, avoiding the block effect, ringing or pseudo-contour caused by traditional interpolation methods. At the same time, only the key frame is executed with this lightweight operation, which not only guarantees the real-time decoding performance of the overall code stream, but also significantly reduces the risk of sudden quality drop of the entire video caused by the loss of key frames, so that the receiving end can obtain visually observable and semantically continuous reconstructed pictures without waiting for retransmission or introducing additional redundant data, thereby effectively improving the stability and user experience of video playback in the network jitter or burst packet loss environment.
[0039] The application also provides a video code stream encoding and correction system, a computer readable storage medium and an electronic device, which have the above beneficial effects, and details are not repeated here. BRIEF DESCRIPTION OF DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in the embodiments of the application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description are only embodiments of the application, and for those skilled in the art, other drawings can be obtained without creative labor on the basis of the provided drawings.
[0041] Figure 1 A flowchart of a video code stream encoding and correction method provided by an embodiment of the application;
[0042] Figure 2 A transition value calculation schematic diagram provided by an embodiment of the application;
[0043] Figure 3 A structure schematic diagram of a video code stream encoding and correction system provided by an embodiment of the application;
[0044] Figure 4 A structure diagram of an electronic device provided by an embodiment of the application. DETAILED DESCRIPTION
[0045] In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0046] Referring to Figure 1 , Figure 1 A flowchart of a video code stream encoding error correction method provided by the embodiments of the present application, the method comprises:
[0047] S101: when detecting that a key frame in a video code stream has packet loss, determining a packet loss area;
[0048] S102: acquiring an edge pixel closest to the packet loss area in all valid neighbor blocks of the packet loss area;
[0049] S103: calculating a transition value according to the edge pixel;
[0050] S104: filling all pixels of the packet loss area based on the transition value.
[0051] In step S101, the code stream integrity is monitored in real time through an abnormal monitoring mechanism of a video decoder. When parsing key frame data, if it is found that a preset synchronization identifier (such as a start code), slice header information or macroblock data unit has continuity interruption, the packet loss determination logic is triggered. Subsequently, according to the positioning information of the code stream hierarchical structure (such as GOP, frame, slice and macroblock), the boundary markers of the front and rear complete data are combined to accurately demarcate the physical coordinate range (including horizontal span and vertical height) of the packet loss area.
[0052] This step realizes fast response and high-precision positioning of the packet loss event, avoids unnecessary calculation consumption caused by blind repair, limits the repair range, significantly reduces the data amount of subsequent processing, and prevents misoperation from affecting normal data areas.
[0053] In a feasible implementation, the detection process of the packet loss area can be as follows:
[0054] In a first step, when parsing the header information of the video code stream, the current header information index and the decoded index are acquired; the decoded index is used to maintain the last successfully decoded header information index;
[0055] In a second step, if the difference between the current header information index and the decoded index is greater than 1, it is confirmed that the video code stream has packet loss.
[0056] First stage: header information parsing and index maintenance
[0057] Two key identifiers are established when the system starts:
[0058] Current header information index: used to record the sequential number of the video stream header information currently being parsed.
[0059] Decoded index: initially empty or a special marker, representing that there is no history record of any successfully decoded header information.
[0060] Each group of header information is read in the data order of the video stream (e.g. in the packet or frame order). Upon parsing a valid header information (satisfying the basic format requirements, such as correct start code and reasonable length), the sequential number of the header information is immediately assigned to the "current header information index".
[0061] If the current parsed header information and its associated video data are successfully decoded (i.e. passing the integrity check of the decoder, generating a displayable picture), the "decoded index" is updated to the current "current header information index" value. If the decoding fails (e.g. data corruption, synchronization loss, etc.), the "decoded index" remains unchanged, and the next header information is processed.
[0062] After completing the parsing of a new header information each time, the difference between the current header information index and the decoded index is compared. If the difference exceeds 1, it is determined that packet loss has occurred.
[0063] In step S102, the edge pixel closest to the lost packet area in the valid neighbor block in the valid neighbor block is obtained. First, the valid neighbor block of the lost packet area needs to be determined. The valid neighbor block is determined after the validity detection of the neighbor block. Specifically, the neighborhood grid of the grid where the lost packet area is located can be determined according to the coordinate information, and if the coordinate information of the neighborhood grid does not exceed the boundary and is not marked as lost, it is confirmed that the neighborhood grid is a valid neighbor block. Not marked as lost means that the corresponding value in the patch_lost array corresponding to the neighborhood grid is 0.
[0064] In another possible implementation, the minimum circumscribed rectangle of the lost packet area can be used as a boundary to expand outward by one macroblock width, that is, one patch unit, to form a valid neighbor band. The availability of all macroblocks in the valid neighbor band is determined: if the macroblock is correctly received in the code stream and the inverse quantization and inverse transformation are completed, it is determined as a valid neighbor block.
[0065] After determining the valid neighbor block, the edge pixel can be obtained in the following manner:
[0066] A1: locating the coordinate information of the lost packet area in the code stream grid;
[0067] A2: determining neighbor coordinate information of all valid neighbor blocks of the grid where the packet loss region is located and direction information relative to the packet loss region according to the coordinate information;
[0068] A3: determining edge coordinate information of edge pixels of the valid neighbor blocks close to the edge of the packet loss region according to the neighbor coordinate information and the direction information relative to the packet loss region.
[0069] After receiving the code stream at the decoding end, the sequence number, the slice group number and the top-left row and column number of the slice in the grid carried in each data packet are recorded. If it is found that the sequence number jumps or the flag bit indicates that the packet is lost, it is known that the corresponding slice group is missing; the top-left row and column number of the slice group in the grid is recorded as the starting coordinate of the packet loss region, and the occupied continuous row and column range is calculated according to the slice width and height, so that the complete coordinate information of the packet loss region in the code stream grid is obtained.
[0070] For each valid neighbor block, the top-left row and column number thereof in the grid is recorded as the neighbor coordinate, and the position thereof relative to the packet loss region is marked, including the upper side, the upper left side, the right side, the lower right side, etc., to form the direction information.
[0071] For each valid neighbor block, the position thereof is first judged: if the valid neighbor block is above the packet loss region, the last row of pixels thereof is taken; if the valid neighbor block is below, the top row thereof is taken; if the valid neighbor block is on the left side, the rightmost column thereof is taken; if the valid neighbor block is on the right side, the leftmost column thereof is taken; and for the diagonal neighbor, the edge close to the packet loss region is taken. Then the grid row and column numbers of these pixels are recorded one by one to obtain the edge coordinate information of the edge pixels close to the packet loss region.
[0072] Using the decoded pixel buffer, the edge pixels of these valid neighbor blocks adjacent to the packet loss region are extracted row by row, and are stored in the edge pixel queue according to the horizontal, vertical and diagonal directions. By screening the edge pixels closest in space and most reliable in information, high-credibility reference samples are provided for subsequent repair, preventing the introduction of damaged or not yet decoded pixels into the repair process. By strictly limiting the definition of "valid" neighbors, the interference of potentially damaged or heterogeneous regions is excluded, ensuring that the pixels used for reconstruction have semantic relevance, thereby improving the naturalness of the repair result.
[0073] In step S103, a transition value is calculated according to the edge pixels. In the most common calculation method, the average value of all edge pixels can be directly calculated as the transition value. In other calculation methods, different mathematical methods can be used based on the edge pixels, which are not limited here.
[0074] It should be noted that different calculation methods are used for the luminance component and the chrominance component. Specifically:
[0075] For the luminance component, the luminance arithmetic mean is calculated according to the luminance values of all edge pixels, and the luminance arithmetic mean is taken as the transition value.
[0076] For the chrominance component, after the original chrominance data of all edge pixels is down-sampled to the target resolution, the chrominance arithmetic mean is calculated according to the original chrominance data of all edge pixels, and the chrominance arithmetic mean is taken as the transition value.
[0077] Taking the luminance component arithmetic mean as the transition value can form a smooth luminance base inside the packet loss area, eliminating the abrupt light and dark patches caused by key frame packet loss. The luminance statistical result of the edge pixels naturally maintains the consistent light level with the surrounding scene, so that the repaired area is integrated into the adjacent image in terms of overall light and dark levels, avoiding the common "bright spot" or "dark block" traces caused by artificial filling.
[0078] Down-sampling the chrominance component first and then calculating the arithmetic mean can, on the one hand, unify the original chrominance data of the edge pixels to the same spatial resolution as the packet loss area, ensuring that the chrominance filling process is strictly aligned with the luminance block boundary, preventing color drift; on the other hand, the mean value calculation after down-sampling suppresses high-frequency chrominance noise, making the repaired area's hue and saturation present uniform and gradual changes, further reducing the visibility of color bands and color blocks. By combining the luminance and chrominance double mean value strategies, the repair result maintains edge continuity while having both luminance and color consistency, significantly reducing the visual abruptness caused by key frame packet loss and improving the overall video viewing quality.
[0079] In step S104, the packet loss area is gridded according to pixel coordinates, and the relative distance (such as horizontal distance, vertical distance) of each pixel to be filled to the edge pixels in each direction is determined; according to the position of the pixel to be filled, the transition value calculated in S103 is called to fill.
[0080] Here, how to fill is not specifically limited, for example, the initial filling value of the pixel can be determined by spatial interpolation (such as distance-based weight interpolation, the closer to the edge, the greater the weight); the filled area is subjected to local smoothing processing (such as mean filtering in a 3x3 window), the difference between adjacent pixels is adjusted to a range acceptable to the human eye, ensuring the visual coherence of the filled area and the surrounding effective area. This step fills the pixels in the packet loss area through the transition value guided filling method, which naturally connects the pixel values in the packet loss area with the surrounding effective area, significantly reduces the image distortion (such as blocking effect, texture breakage) caused by packet loss, improves the subjective quality of the key frame, and ensures the smoothness and watchability of video playback.
[0081] The embodiment introduces a packet loss recovery mechanism based on key frame neighborhood features. When detecting the loss of a key frame, the loss packet area is first accurately located, and then the edge pixels directly adjacent to the loss packet boundary in the effective neighbor blocks around the loss packet area are extracted. The transition value of the edge pixels is calculated and then mapped to the loss packet area. Since the transition value is completely derived from the pixels that are continuous in space with the loss packet area and have been correctly received, the encoded and corrected image can maintain the coherence of local texture trend, brightness level and chroma distribution, avoiding the block effect, ringing or pseudo-contour caused by traditional interpolation methods. At the same time, only the key frame is executed with this lightweight operation, which not only guarantees the real-time decoding performance of the overall code stream, but also significantly reduces the risk of sudden quality drop of the entire video caused by the loss of key frames, so that the receiving end can obtain visually observable and semantically continuous reconstructed pictures without waiting for retransmission or introducing additional redundant data, thereby effectively improving the stability and user experience of video playback in a network jitter or burst packet loss environment.
[0082] On the basis of the above-mentioned embodiment, as a preferred embodiment, after the transition value is calculated, a transition interval with the transition value as the midpoint of the interval can be set.
[0083] When filling, the edge of the loss packet area can be sequentially filled to the center, and according to the size relationship between the adjacent pixel value of the pixel position to be filled and the transition value, a random value that meets the size relationship is selected from the transition interval and filled to the pixel position to be filled.
[0084] In a specific implementation, direction consistency detection can be performed on the edge pixel queue. The gradient amplitudes in four directions, i.e., horizontal, vertical and diagonal, are calculated, and the direction with the most gentle gradient change is selected as the dominant direction. Then, the edge pixels are weighted and smoothed based on the direction to generate a transition value sequence. The transition value sequence maintains consistency with the color gradient trend of the neighbor block in amplitude and maintains edge continuity in space. This step suppresses sudden noise through directional smoothing, making the color and brightness transition between the area to be filled and the surrounding decoded area natural and avoiding obvious filling marks.
[0085] Hereinafter, taking the application applied to an AVS3 decoding end as an example, a video code stream encoding and correction method provided by the application is described:
[0086] When parsing the patch header information in the code stream, the decoder obtains continuous patch_idx. The algorithm maintains a variable prev_idx to record the patch index of the last successfully decoded patch.
[0087] If the condition: current_patch_idx - prev_idx > 1 is met, it means that patches with index numbers from prev_idx+1 to current_patch_idx-1 are lost. In this case, these index numbers are recorded in a flag array called patch_lost, and their values are set to 1, but the decoding process will not be interrupted, and will continue to process the subsequent incoming patches.
[0088] For each lost patch to be recovered, the algorithm calculates its coordinates (lost_col, lost_row) in the patch grid. Then it checks the patches in its 8-neighborhood positions (up, down, left, right, top-left, top-right, bottom-left, bottom-right).
[0089] Validity check: check if the neighbor patches exist (coordinates are not out of bounds) and are not marked as lost (their corresponding values in the patch_lost array are 0).
[0090] Data validation: read the luminance value of the first pixel in the top-left corner of the neighbor patch, if it is a default value (e.g. 0 or 128), it is considered that its data may be invalid and is excluded.
[0091] Direction recording: record the exact direction of each valid neighbor patch relative to the lost patch (e.g. DIR_UP, DIR_DOWN_LEFT, etc.), this direction information will be used to guide the subsequent pixel mapping.
[0092] Referring to Figure 2 , Figure 2 A transition value calculation diagram provided by an embodiment of the present application, Figure 2 In the figure, the area corresponding to the middle horizontal line is the lost area, and the surrounding squares are all edge pixels. When calculating the DC value, all the edge pixel values collected in the above steps are added up, and then divided by the total number of pixels to obtain an arithmetic mean, which is the DC value (Delta Chroma Arithmetic Mean, Delta Chroma Arithmetic Mean).
[0093] DC_value = sum(all_border_pixels) / number_of_border_pixels;
[0094] Batch filling: use the calculated DC value to fill each pixel of the lost patch.
[0095] Referring to Figure 3 , Figure 3 A video code stream encoding error correction system structure diagram provided by an embodiment of the present application, the system comprises:
[0096] a packet loss area positioning module configured to determine a packet loss area when a key frame in a video bitstream is detected to have packet loss;
[0097] an edge pixel obtaining module configured to obtain edge pixels closest to the packet loss area from all valid neighbor blocks of the packet loss area;
[0098] a transition value calculating module configured to calculate a transition value according to the edge pixels;
[0099] a pixel error correction module configured to fill all pixels of the packet loss area based on the transition value.
[0100] Based on the above embodiment, as a preferred embodiment, further comprising:
[0101] a recording module configured to record, to a flag array, an index combination when a difference between the current header information index and the decoded index is greater than 1, and correct an element value of the flag array.
[0102] Based on the above embodiment, as a preferred embodiment, the edge pixel obtaining module comprises:
[0103] a positioning unit configured to position coordinate information of the packet loss area in a bitstream grid;
[0104] a neighbor block positioning unit configured to determine, according to the coordinate information, neighbor coordinate information of all valid neighbor blocks of a grid where the packet loss area is located and direction information relative to the packet loss area;
[0105] an edge pixel positioning unit configured to determine, according to the neighbor coordinate information and the direction information relative to the packet loss area, edge coordinate information of edge pixels of the valid neighbor blocks close to the packet loss area.
[0106] Based on the above embodiment, as a preferred embodiment, the edge pixel obtaining module further comprises:
[0107] a valid neighbor detecting unit configured to determine, according to the coordinate information, a neighborhood grid of the grid where the packet loss area is located; and if the coordinate information of the neighborhood grid does not exceed a boundary and is not marked as lost, confirm that the neighborhood grid is a valid neighbor block.
[0108] Based on the above embodiment, as a preferred embodiment, the transition value calculating module comprises:
[0109] a luminance calculating unit configured to, for a luminance component, calculate a luminance arithmetic mean according to luminance values of all the edge pixels, and take the luminance arithmetic mean as the transition value;
[0110] The chroma calculation unit is configured to calculate a chroma arithmetic mean according to the original chroma data of all the edge pixels after down-sampling the original chroma data of all the edge pixels to a target resolution, and take the chroma arithmetic mean as a transition value.
[0111] Based on the above embodiments, as a preferred embodiment, further comprising:
[0112] The transition interval setting module is configured to set a transition interval with the transition value as a middle point of the transition interval.
[0113] Correspondingly, the pixel error correction module is configured to perform the following steps:
[0114] The pixels along the edge of the packet loss area are sequentially filled from the center to the edge, and a random value meeting the size relationship is selected from the transition interval according to the size relationship between the adjacent pixel value of the pixel position to be filled and the transition value, and the random value is filled to the pixel position to be filled.
[0115] The present application also provides a corresponding embodiment of a computer readable storage medium. The computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the steps of the method described in the above method embodiment.
[0116] It can be understood that if the method in the above embodiment is implemented in the form of a software function unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or say the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and executes all or part of the steps of the method described in each embodiment of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.
[0117] The computer readable storage medium provided in the embodiment includes the method mentioned above, and the effects are the same as above.
[0118] The present application also provides an electronic device, referring to Figure 4 , the structural diagram of the electronic device provided by the embodiment of the present application, as Figure 4 shown, can include a processor 1410 and a memory 1420.
[0119] The processor 1410 can include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. The processor 1410 can be implemented in at least one of a hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), a PLA (Programmable Logic Array). The processor 1410 can also include a main processor and a coprocessor, the main processor being a processor for processing data in an awake state, also known as a CPU (Central Processing Unit), and the coprocessor being a low-power processor for processing data in a standby state. In some embodiments, the processor 1410 can be integrated with a GPU (Graphics Processing Unit) for rendering and drawing content required to be displayed by the display screen. In some embodiments, the processor 1410 can also include an AI (Artificial Intelligence) processor for processing computing operations related to machine learning.
[0120] The memory 1420 can include one or more computer-readable storage media that can be non-transitory. The memory 1420 can also include a high-speed random access memory, and a nonvolatile memory such as one or more disk storage devices, flash storage devices. In this embodiment, the memory 1420 is at least used to store the following computer program 1421, wherein the computer program is loaded and executed by the processor 1410, and can implement the related steps in the method executed by the electronic device side disclosed in any of the preceding embodiments. In addition, the resources stored by the memory 1420 can also include an operating system 1422 and data 1423, and the storage mode can be temporary storage or permanent storage. The operating system 1422 can include Windows, Linux, Android, and the like.
[0121] In some embodiments, the electronic device can also include a display screen 1430, an input / output interface 1440, a communication interface 1450, a sensor 1460, a power supply 1470, and a communication bus 1480.
[0122] Of course, Figure 4 The structure of the electronic device shown does not constitute a limitation on the electronic device in the embodiments of the present application, and in actual applications, the electronic device can include more or fewer components than those shown, or combine some components. Figure 4 The structure of the electronic device shown does not constitute a limitation on the electronic device in the embodiments of the present application, and in actual applications, the electronic device can include more or fewer components than those shown, or combine some components.
[0123] The various embodiments described in the specification are intended to be exemplary only. The scope of the application is therefore intended to be limited solely by the scope of the appended claims as interpreted according to the principles of patent law including 35 U.S.C. 101, and the legal equivalents thereof.
[0124] The principles and implementations of the present application are described herein with the specific examples. The above description of the embodiments is only to help understand the method of the present application and its core idea. It should be pointed out that, for those skilled in the art of the present technology, without departing from the principles of the present application, some improvements and modifications can be made to the present application, and these improvements and modifications also fall within the protection scope of the present application.
[0125] It should also be noted that in this specification, the relationship terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between the entities or operations. Moreover, the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitations, the element defined by the statement "including a" does not exclude the presence of other identical elements in the process, method, article or device including the element.
Claims
1. A method for encoding error correction of a video bitstream, characterized in that, The method comprises the following steps: When detecting that a key frame in a video code stream has packet loss, determining a packet loss area; Obtaining edge pixels closest to the packet loss area from all valid neighbor blocks of the packet loss area; Calculating a transition value according to the edge pixels; Filling all pixels of the packet loss area based on the transition value.
2. The video bitstream encoding error correction method according to claim 1, characterized in that, The detection process of the packet loss area comprises the following steps: When parsing header information of the video code stream, obtaining a current header information index and a decoded index; the decoded index is used to maintain a last successfully decoded header information index; If a difference between the current header information index and the decoded index is greater than 1, it is confirmed that the video code stream has packet loss.
3. The video bitstream encoding error correction method according to claim 2, characterized in that, After confirming that the video code stream has packet loss, the method further comprises the following steps: Recording an index combination when the difference between the current header information index and the decoded index is greater than 1 to a mark array, and correcting an element value of the mark array.
4. The video bitstream encoding error correction method according to claim 1, characterized in that, The step of obtaining edge pixels closest to the packet loss area from all valid neighbor blocks of the packet loss area comprises the following steps: Positioning coordinate information of the packet loss area in a code stream grid; According to the coordinate information, determining neighbor coordinate information of all valid neighbor blocks of a grid where the packet loss area is located and direction information relative to the packet loss area; According to the neighbor coordinate information and the direction information relative to the packet loss area, determining edge coordinate information of edge pixels of the valid neighbor blocks close to the packet loss area.
5. The video bitstream encoding error correction method according to claim 4, characterized in that, Before the step of determining neighbor coordinate information of all valid neighbor blocks of a grid where the packet loss area is located and direction information relative to the packet loss area according to the coordinate information, the method further comprises the following steps: According to the coordinate information, determining a neighborhood grid of the grid where the packet loss area is located; If coordinate information of the neighborhood grid does not exceed a boundary and is not marked as lost, it is confirmed that the neighborhood grid is a valid neighbor block.
6. The video bitstream encoding error correction method according to claim 1, characterized in that, The step of calculating a transition value according to the edge pixels comprises the following steps: For a luminance component, calculating a luminance arithmetic mean value according to luminance values of all the edge pixels, and taking the luminance arithmetic mean value as the transition value; For a chroma component, after down-sampling original chroma data of all the edge pixels to a target resolution, calculating a chroma arithmetic mean value according to the original chroma data of all the edge pixels, and taking the chroma arithmetic mean value as the transition value.
7. The video bitstream encoding error correction method according to claim 1, characterized in that, For the luminance component, after calculating a luminance arithmetic mean value according to luminance values of all the edge pixels and taking the luminance arithmetic mean value as the transition value, the method further comprises the following steps: Setting a transition interval with the transition value as a middle point of the interval; Correspondingly, the step of filling all pixels of the packet loss area based on the transition value comprises the following steps: Filling in sequence from an edge to a center of the packet loss area, selecting a random value meeting a size relationship between a position of a pixel to be filled and the transition value from the transition interval, and filling the random value to the position of the pixel to be filled.
8. An encoding error correction system of a video bitstream, characterized in that, The device comprises: a packet loss area positioning module, configured to determine a packet loss area when detecting that a key frame in a video code stream has packet loss; an edge pixel obtaining module, configured to obtain edge pixels closest to the packet loss area from all valid neighbor blocks of the packet loss area; a transition value calculating module, configured to calculate a transition value according to the edge pixels; and a filling module, configured to fill all pixels of the packet loss area based on the transition value. A pixel correction module is configured to fill all pixels in the lost packet area based on the transition value.
9. An electronic device, comprising: The application further provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, carries out the steps of the method according to any one of claims 1 to 7. The application further provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, carries out the steps of the method according to any one of claims 1 to 7. The application further provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, carries out the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that,