Data encoding and decoding method and system

By finding and comparing the macroblocks in the target macroblock and the macroblocks in the reference frame in the image encoding, marking the macroblocks as unchanged or changed, and encoding them based on the identification information, the problem of large code streams in the image repeated playback scene is solved, and the problem of large code streams in the image is improved. coding efficiency.

CN113115044BActive Publication Date: 2025-02-14XIAN WANXIANG ELECTRONICS TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110319961.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-25
Publication Date
2025-02-14
Estimated Expiration
2041-03-25

AI Technical Summary

Technical Problem

In the image repeat playback scenario, the prior art leads to large code streams, affecting encoding efficiency.

Method used

By obtaining the target frame image and its corresponding target reference frame, the matching macroblocks of the target macroblocks in the target reference frame are found and compared. If the macroblock does not match, look for the macroblocks in the previous reference frame for comparison, mark the macroblock as unchanged or changed macroblocks, and encode them according to the identification information.

Benefits of technology

It effectively reduces the code stream during circular scene switching, improves the efficiency of data encoding, and simplifies the encoding processing process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113115044B_ABST
    Figure CN113115044B_ABST
Patent Text Reader

Abstract

The present disclosure provides a data encoding and decoding method and system, which relates to the field of electronic information technology and can solve the problem of low encoding efficiency when the encoding scene appears repeatedly. The specific technical scheme is: when encoding an image in a cyclic scene, obtain the target reference frame corresponding to the image, search for the corresponding macroblock in the target reference frame according to the target coordinates corresponding to the target macroblock in the target image, and compare whether the target macroblock is the same as the macroblock in the target reference frame. If not, continue to search for the macroblock at the target position in the previous reference frame of the target reference frame, and compare until the first reference frame of the target cache area is found. The present disclosure is used for encoding and decoding of images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of electronic information technology, and in particular to a data encoding and decoding method and system. Background Art

[0002] In the existing technology, when performing real-time image encoding, encoding is achieved by using a single-frame or double-frame reference method, thereby improving the encoding rate. However, when switching between scenes in a loop, such as playing a PPT in a loop, or switching between multiple office scenes, because the amount of repeated images in the scene is large, it will cause an increase in reference frames, resulting in a large bitrate, affecting the encoding efficiency. Summary of the invention

[0003] The disclosed embodiment provides a data encoding and decoding method and system, which can solve the problem of large bit stream during image encoding processing in the scene of repeated image playback. The technical solution is as follows:

[0004] According to a first aspect of an embodiment of the present disclosure, a data encoding method is provided, the method comprising:

[0005] Acquire a target frame image, and determine a target reference frame corresponding to the target frame image, wherein the target reference frame is determined according to a previous frame image of the target frame image;

[0006] When a macroblock matching the target coordinates is found in the target reference frame according to the target coordinates of the target macroblock in the target frame image, the target macroblock is compared with the macroblock in the target reference frame;

[0007] When the target macroblock is different from the macroblock in the target reference frame, the macroblocks of the previous reference frame at the target coordinates are searched in sequence and compared with the target macroblock. The previous reference frame refers to the reference frame in the target cache area that is referenced when generating the target reference frame.

[0008] When the macroblock at the target coordinates of the previous reference frame is the same as the target macroblock, obtaining identification information of the previous reference frame, and marking the target macroblock as an unchanged macroblock;

[0009] The target macroblock is encoded according to the identification information of the previous reference frame and the target coordinates.

[0010] In one embodiment, the method further comprises:

[0011] Acquire the first frame image in the target video and generate the first reference frame of the target cache area;

[0012] Compare the Nth frame image in the target video with the N-1th reference frame in sequence, where N is greater than 1;

[0013] Generate an Nth reference frame in the target cache area according to macroblocks of a changed area between an Nth frame image and an N-1th reference frame in the target video;

[0014] A target cache area is generated according to the first reference frame to the Nth reference frame.

[0015] In one embodiment, the method further comprises:

[0016] When no macroblock matching the target coordinates is found in the target reference frame, then searching in turn in each reference frame in the target cache area whether there is a matching macroblock at the target coordinates;

[0017] If no macroblock matching the target coordinates is found at the target coordinates for each reference frame in the target cache area, the macroblock corresponding to the target coordinates is marked as a changed macroblock.

[0018] In one embodiment, the method further comprises:

[0019] If a macroblock matching the target coordinates is found in the reference frame in the target cache area, the macroblock in the target frame image is compared with the macroblock in the reference frame;

[0020] When the macroblock in the target frame image is the same as the macroblock in the reference frame, the identification information of the reference frame where the reference macroblock is located is obtained, and the target macroblock is marked as an unchanged macroblock;

[0021] When the macroblock in the target frame image is different from the macroblock in the reference frame, the target macroblock is marked as a changed macroblock.

[0022] In one embodiment, the method further comprises:

[0023] When the target macroblock is different from the macroblock in the target reference frame, the macroblocks in the previous reference frame at the target coordinates are searched in sequence and compared with the target macroblock;

[0024] When the target macroblock is different from the macroblocks of each reference frame in the target cache area at the target coordinates, it is confirmed that the macroblock at the target coordinates is a changed macroblock;

[0025] According to the first encoding rule, the target macroblock at the target coordinate is encoded.

[0026] In one embodiment, the method further comprises:

[0027] Encoding the identification information and target coordinates of the reference frame that matches the unchanged macroblock to generate a first bitstream;

[0028] Encoding the changed macroblock to generate a second bit stream;

[0029] A target code stream is generated according to the first code stream and the second code stream.

[0030] According to a second aspect of an embodiment of the present disclosure, a data decoding method is provided, including:

[0031] Acquire a target code stream, and determine a target reference frame corresponding to the target code stream, the target code stream includes a first code stream and a second code stream, the first code stream is generated according to a changed macroblock in a target frame image, the second code stream is generated according to an unchanged macroblock in a target frame image, the second code stream includes identification information of a previous reference frame, and the previous reference frame refers to a reference frame in a target cache area that is referenced when generating the target reference frame;

[0032] According to the first decoding rule, the first code stream is decoded to obtain a changed macroblock, and according to the identification information of the reference frame and the target reference frame, the second code stream is decoded to obtain an unchanged macroblock;

[0033] The changed macroblock and the unchanged macroblock are reconstructed to generate the target frame image.

[0034] In one embodiment, the method of obtaining unchanged macroblocks includes:

[0035] According to the identification information of the previous reference frame, when the previous reference frame finds the macroblock at the target coordinate, it is determined that the macroblock at the target coordinate is an unchanged macroblock;

[0036] or,

[0037] When the macroblock at the target coordinates is not found in the previous reference frame, the macroblock at the target coordinates is searched in the reference frames one by one in the target cache area until the macroblock corresponding to the target coordinates is found;

[0038] The unchanged macroblock is obtained through the macroblock at the target coordinates.

[0039] In one embodiment, the method further comprises:

[0040] When it is found that the target frame image is lost, a frame loss feedback is generated, where the frame loss feedback is used to indicate that the target frame image has been lost;

[0041] The frame loss feedback is sent to the encoding device so that the encoding device discards the target reference frame matching the target frame image and the reference frame after the target reference, and regenerates the target cache area.

[0042] According to a third aspect of an embodiment of the present disclosure, a data processing system is provided, the system comprising: an encoding device and a decoding device, wherein the encoding device is used to execute the method in embodiment one, and the decoding device is used to execute the method in embodiment two.

[0043] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0045] Figure 1 is a flow chart of a data encoding method provided by an embodiment of the present disclosure;

[0046] Figure 1a It is a schematic diagram of buffer area generation of a data encoding method provided by an embodiment of the present disclosure;

[0047] Figure 1b It is a schematic diagram of a buffer area update of a data code method provided by an embodiment of the present disclosure;

[0048] Figure 1c It is a logical schematic diagram of a data encoding method provided by an embodiment of the present disclosure;

[0049] Figure 2 is a schematic diagram of a data decoding method provided by an embodiment of the present disclosure;

[0050] Figure 3 It is a structural diagram of a data processing system provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0051] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0052] Embodiment 1

[0053] The present disclosure provides a data encoding method. Figure 1 As shown, the data encoding method includes the following steps:

[0054] 101. Acquire a target frame image, and determine a target reference frame corresponding to the target frame image.

[0055] The target frame image may be derived from a frame image in the loop-played data. Specifically, the target frame image includes a plurality of macroblocks, and each macroblock has matching coordinates.

[0056] The target reference frame is determined according to a previous frame image of the target frame image.

[0057] 102. When a macroblock matching the target coordinates of the target macroblock in the target frame image is found in the target reference frame, the target macroblock is compared with the macroblock in the target reference frame.

[0058] The method provided in the present application can first perform coordinate matching when searching for macroblocks in the unchanged area of ​​the target frame image compared with the target reference frame, that is, based on the coordinates of the macroblocks in the target frame image, search block by block to see whether there is a matching macroblock at that position in the target reference frame.

[0059] Here are two examples based on the results of searching the target coordinate macroblock in the reference frame:

[0060] Example 1: When the corresponding macroblock at the target coordinate can be found in the target reference frame according to the target coordinate of the target macroblock in the target frame image:

[0061] When a corresponding macroblock can be found in the reference frame according to the target coordinates of the target macroblock, the macroblock in the target frame image is compared with the macroblock in the target reference frame.

[0062] Example 2: When the corresponding macroblock cannot be found in the target reference frame according to the target coordinates of the target macroblock in the target frame image:

[0063] Then, in each reference frame in the target cache area, it is sequentially searched whether there is a matching macroblock at the target coordinates;

[0064] If each reference frame in the target cache area has no matching macroblock at the target coordinate, the macroblock corresponding to the target coordinate is marked as a changed macroblock.

[0065] If a matching macroblock is found at the target coordinates for each reference frame in the target cache area, it is determined whether the macroblock in the reference frame is the same as the macroblock in the target frame image.

[0066] When the macroblock at the target coordinate in the target frame image is the same as the macroblock at the target coordinate in the macroblock in the reference frame, the macroblock at the coordinate is marked as an unchanged macroblock;

[0067] When the unchanged macroblock is subsequently encoded, only the identification information of the target reference frame needs to be encoded.

[0068] When the macroblock at the target coordinate in the target frame image and the macroblock at the target coordinate in the reference frame are not the same, the macroblock at the coordinate is marked as a changed macroblock.

[0069] The method provided by the present disclosure also includes setting a cache area containing multiple reference frames according to the image, and controlling the number of coded reference frames through the cache area. The minimum cache area is the size of one frame of image, and the maximum is not limited but has an impact on the operation speed, which can be set by the user. The larger the cache, the more operations and comparisons, the longer the execution time, but the lower the bit rate.

[0070] The method provided by the present disclosure further includes generating a target cache area, and the specific steps include:

[0071] Then, the first frame image in the target video is obtained to generate the first reference frame of the target cache area;

[0072] Compare the Nth frame image in the target video with the N-1th reference frame in sequence, where N is greater than 1;

[0073] Generate an Nth reference frame in the target cache area according to macroblocks of a changed area between an Nth frame image and an N-1th reference frame in the target video;

[0074] A target cache area is generated according to the first reference frame to the Nth reference frame.

[0075] like Figure 1a As shown, it further explains how the cache area mentioned in this application stores reference frames:

[0076] The first reference frame in the cache area, ie, the initial reference frame, is a whole frame stored in the cache area, so that it is easy to determine whether the macroblock to be encoded has changed.

[0077] When storing the second reference frame of the cache area, the reference frame for recording the current frame is 1, and frame 2 only needs to store the changed area relative to frame 1;

[0078] When storing the third reference frame of the cache area, the reference frame for recording the current frame is 2, and the 3rd frame only needs to store the changed area relative to the 2nd frame.

[0079] Specifically, Figure 1a As shown, compared with the first reference frame, only macroblocks A1 to A4 have changed in the second reference frame, that is, the two frames only store macroblocks A1 to A4, and the other macroblocks of the two frames are inherited from the first frame, and only one copy of this part of data needs to be stored.

[0080] Correspondingly, 3 frames only need to record the changed areas relative to 2 frames, namely macroblocks B1 to B4. In fact, the changed areas of 3 frames relative to 1 frame actually include macroblocks A1 to A4 and B1 to B4.

[0081] Furthermore, the cache area provided in the present disclosure can be set in the following manner:

[0082] The first is to set a fixed buffer size, and the second is to set a fixed number of reference frames.

[0083] 103. When the target macroblock is not identical to the macroblock in the target reference frame, the macroblocks in the previous reference frame at the target coordinates are searched in sequence and compared with the target macroblock.

[0084] The previous reference frame refers to a reference frame in the target cache area that is referenced when generating the target reference frame.

[0085] The target cache area includes a plurality of reference frames from a target reference frame to a first reference frame.

[0086] When the macroblock at the target coordinates in the target frame image is the same as the macroblock at the target coordinates in the target reference frame, the macroblock at the coordinates is marked as an unchanged macroblock.

[0087] When the macroblock at the target position in the target reference frame is the same as the target macroblock, when subsequently encoding the target macroblock of the unchanged macroblock type, it is only necessary to encode the identification information of the target reference frame, or simply mark it as not requiring encoding. The subsequent decoding end can know from the marking information to decode according to the target reference frame, specifically, to obtain the macroblock at the target position of the target reference frame.

[0088] Specifically, whether two macroblocks are the same can be determined by the pixels in the macroblocks:

[0089] Each macroblock includes M*N pixels. When all pixels in the macroblock are the same, the macroblock is considered unchanged. If there are pixels that are different, the macroblock is considered to be encoded.

[0090] Alternatively, if the number of identical pixels between two macroblocks exceeds a preset value, it can also be considered that the two macroblocks have not changed.

[0091] When the macroblock at the target coordinate in the target frame image is different from the macroblock at the target coordinate in the target reference frame, continue to search whether the previous reference frame in the target buffer area has a macroblock at the target coordinate;

[0092] When no macroblock at the target coordinates of other reference frames in the target cache area can be found, the target macroblock is determined to be a changed macroblock;

[0093] When a macroblock of a previous reference frame at a target position is found, it is determined whether the macroblock at the position is the same as the target macroblock.

[0094] 104. When the macroblock at the target coordinate in the previous reference frame is the same as the target macroblock, obtain identification information of the previous reference frame, and mark the target macroblock as an unchanged macroblock.

[0095] In the method provided by the present disclosure, when marking a reference frame having the same macroblock as that in the target frame image, the reference frame is marked according to marking information of the reference frame in the target buffer, such as ID information.

[0096] When searching for a macroblock matching the coordinate information in the target reference frame, the macroblocks of each reference frame in the target cache area at the target coordinate are sequentially compared according to the target coordinate;

[0097] When the macroblock corresponding to the target coordinate in the target frame image is different from the macroblock corresponding to the target coordinate in each reference frame in the reference frame buffer area, it is confirmed that the macroblock at the target coordinate is a changed macroblock;

[0098] According to the first encoding rule, the target macroblock at the target coordinate is encoded.

[0099] The first encoding rule may be encoding according to the type of macroblock, such as encoding according to the text type or encoding according to the image type.

[0100] 105. Implement encoding processing on the target macroblock according to the identification information of the target reference frame and the target coordinate position.

[0101] The method provided by the present disclosure also includes generating a target bitstream according to the coded data, specifically including:

[0102] Encoding reference frame information and target coordinates corresponding to unchanged macroblocks to generate a first bitstream;

[0103] Encoding the changed macroblocks to generate a second bitstream;

[0104] A target code stream is generated according to the first code stream and the second code stream.

[0105] The method provided by the present disclosure also includes updating the cache area, which may specifically include:

[0106] If the current buffer has reached the upper limit, and after the new frame is encoded, it is found that the remaining space is insufficient to store the current frame, the second frame in the buffer will inherit the data of the first frame and release the first frame; then try to store it. If it still does not meet the needs, repeat the previous release steps until the new frame can be stored.

[0107] like Figure 1b As shown, Figure 1b The image in the upper part is the actual content of the reference frame. Figure 1b The lower part is the content stored in the cache area, that is, through the comparison of the upper and lower images, it can be seen that the actual reference frame occupies less memory and more reference frames can be stored.

[0108] Figure 1bIn the figure, A1 to A4 correspond to the coordinate information of the macroblock, that is, the position of the macroblock. The content filled at this position represents the content of the macroblock.

[0109] The data transmission method provided by the embodiment of the present disclosure obtains a target reference frame corresponding to the image when encoding the image, searches for the corresponding macroblock in the target reference frame according to the target coordinates corresponding to the target macroblock in the target image, and compares whether the target macroblock is the same as the macroblock in the target reference frame; if not, continues to search for the macroblock at the target position in the previous reference frame of the target reference frame and compares them until the first reference frame of the target cache area is found.

[0110] Based on the above Figure 1 Corresponding to the data transmission method provided in the embodiment, another embodiment of the present disclosure provides a data encoding method, which can be applied to an encoding device, for example, the encoding device can be a terminal device or a network server. This embodiment is described by taking the encoding and processing of an image as an example, and does not mean that the present disclosure is limited to this. The data encoding method provided in this embodiment includes the following steps:

[0111] Here, refer to Figure 1c As shown in the logic diagram, in a specific implementation process, the previous frame of the frame to be encoded can be selected from the cache area as the target reference frame. Here, when the image frame to be encoded is the fourth frame, the target reference frame is the third frame as an example to illustrate the encoding process:

[0112] Step a, starting from a preset position of the third reference frame, comparing the frame to be encoded and the third reference frame macroblock by macroblock to perform coordinate matching;

[0113] In specific practice, the preset position can be scanned from the upper left corner to compare the macroblock to be encoded with the reference frame block by block.

[0114] The coordinate matching in the method provided by the present disclosure may include:

[0115] Determine whether the coordinates of the macroblock in the current frame to be encoded are in the macroblock stored in the third reference frame;

[0116] If the macroblock coordinates are in the macroblock stored in the third reference frame, the coordinates are considered to match;

[0117] If the macroblock coordinates are not in the macroblock stored in the third reference frame, the coordinates are considered to be mismatched;

[0118] If the coordinates match, jump to step b;

[0119] If the coordinates do not match, jump to step c;

[0120] This step determines the coordinate position.

[0121] Step b, according to the target coordinates, when the macroblock stored in the third reference frame includes the current coordinate macroblock, determining whether the macroblock of the target coordinates to be encoded is changed compared with the macroblock of the target coordinates in the third reference frame;

[0122] If there is no change between the two macroblocks, jump to step d;

[0123] If there is a change between the two macroblocks, jump to step e;

[0124] Each macroblock includes M*N pixels. When all pixels in the macroblock are the same, the macroblock is considered unchanged. If there are pixels that are different, the macroblock is considered to be encoded. This step determines the content of the macroblock.

[0125] Step c, when the macroblock stored in the third reference frame does not include the macroblock at the current coordinate, search from the previous frame of the third reference frame, the second reference frame, to see if there is a matching macroblock at the target coordinate, such as macroblocks at positions A1 to A4;

[0126] This step is executed in a loop. If there is no match in the second reference frame, the reference frame 1 of the second reference frame is matched. The worst result is to find the first frame stored in the buffer, such as the remaining macroblocks except A1 to A4 and B1 to B4.

[0127] When the macroblock at the corresponding position is found, the search ends and the macroblock is compared to see if it has changed:

[0128] Specifically, in step c1, searching starts from the second reference frame corresponding to the third reference frame;

[0129] When no matching macroblock is found at the corresponding target position of the third reference frame, executing step c2;

[0130] Step c2, searching for a matching macroblock at a corresponding target position in the first reference frame.

[0131] If no change, jump to d;

[0132] Otherwise jump to e.

[0133] Step d: If the macroblock in the frame to be encoded does not change compared with the macroblock at the corresponding position of the third reference frame, the encoded macroblock is marked as the unchanged type.

[0134] Specifically, during the encoding process, there is no need to encode the unchanged macroblock itself, and it is only necessary to mark that no encoding is required; during decoding, decoding can be performed based on the reference frame (previous frame image) corresponding to the encoded code stream.

[0135] Step e: if the macroblock in the frame to be encoded changes compared with the macroblock at the corresponding position of the third reference frame, it is determined whether the currently compared reference frame has a previous reference frame, which in this example is the previous frame of the third reference frame: the second reference frame;

[0136] For details, please refer to Figure 1a The second reference frame in the comparison, such as the macroblocks at positions B1 to B4, determines whether the currently compared reference frame has a previous reference frame.

[0137] If the currently compared reference frame has a previous reference frame, the macroblock at the same position of the previous reference frame is matched, and the matching process is the same as step c;

[0138] If there is a reference macroblock at the current position in the previous reference frame, the macroblock to be encoded is compared with the macroblock at the current position in the previous reference frame to see if there is any change:

[0139] If there is no change between the two macroblocks, jump to step f;

[0140] If there are changes between two macroblocks, jump to step g;

[0141] Step f, record the current reference frame ID, mark the coded macroblock as unchanged during encoding output, and record the reference frame ID at the same time;

[0142] Step g: Check whether the current reference frame is the first frame in the buffer.

[0143] If yes, normal macroblock type identification and encoding are performed;

[0144] If not, jump to step e and continue matching.

[0145] The data encoding method provided by the embodiment of the present disclosure, when encoding an image in a loop processing scenario, traverses the target reference frame and the reference frames in the target cache area according to the target position of the macroblock in the image to be encoded, so as to determine the reference frame corresponding to the macroblock to be encoded, and mark the macroblock as an unchanged macroblock. If no reference frame matching the macroblock is found, the macroblock is marked as a changed macroblock.

[0146] The reference frame referred to in the encoding method provided by the present disclosure when encoding unchanged macroblocks can be a reference frame matched by the current image to be encoded, or a previous reference frame of the target reference frame. Because images are repeated, the matched macroblocks may be found in the previously encoded images. By adopting a multi-frame encoding method, the code rate during cyclic scene switching can be effectively reduced, while improving data execution efficiency and achieving simplicity.

[0147] Embodiment 2

[0148] The present disclosure provides a data decoding method. Figure 2 As shown, the data decoding method includes the following steps:

[0149] 201. Obtain a target code stream, and determine a target reference frame corresponding to the target code stream.

[0150] The target code stream includes a first code stream and a second code stream, the first code stream is generated according to the changed macroblocks in the target frame image, the second code stream is generated according to the unchanged macroblocks in the target frame image, and the second code stream includes identification information of the reference frame.

[0151] The previous reference frame is a reference frame in the target cache area other than the target reference frame. Specifically, the previous reference frame refers to a reference frame in the target cache area that is referenced when generating the target reference frame.

[0152] The decoding method provided in the present disclosure also includes establishing a reference buffer area according to the decoded image, storing the first reference frame in its entirety, and storing only the changed areas in subsequent frames.

[0153] The target cache area at the decoding end is consistent with the target cache area at the encoding end.

[0154] 202. According to the first decoding rule, the first bitstream is decoded to obtain changed macroblocks, and according to the identification information of the previous reference frame and the target reference frame, the second bitstream is decoded to obtain unchanged macroblocks.

[0155] In the method provided in the present disclosure, the first code stream is decoded according to the first decoding rule, including decoding the first code stream according to the text type or the image type to obtain the changed macroblock.

[0156] The method provided by the present disclosure decodes the second code stream according to the identification information of the reference frame, including:

[0157] According to the identification information of the previous reference frame, searching for the previous reference frame of the target reference frame in the target cache area;

[0158] According to the target coordinates, when the previous reference frame finds the macroblock at the target coordinates, it is determined that the macroblock at the target coordinates is an unchanged macroblock;

[0159] or,

[0160] When the macroblock at the target coordinates is not found in the previous reference frame, the macroblock at the target coordinates is searched in the reference frame in the target cache area until the macroblock corresponding to the target coordinates is found;

[0161] The unchanged macroblock is obtained through the macroblock at the target coordinates.

[0162] The method provided in the present disclosure performs decoding processing on the second code stream according to the target reference frame, including:

[0163] The second code stream is parsed to obtain the identification information that does not need to be encoded and the target position corresponding to the identification information, and then the macroblock at the target position of the target reference frame is obtained.

[0164] During the decoding process, if it is detected that there is no macroblock coding information, the target macroblock at the target coordinates can be directly found from the target reference frame corresponding to the target code stream.

[0165] 203. Reconstruct the changed macroblock and the unchanged macroblock to generate the target frame image.

[0166] Based on the positions corresponding to the changed macroblocks and the positions corresponding to the unchanged macroblocks, a target frame image is reconstructed and generated.

[0167] In the method provided by the present disclosure, in order to ensure that the reference frames of the encoding end and the decoding end are the same, frame loss processing is also included, and the specific steps include:

[0168] When it is found that the target frame image is lost, a frame loss feedback is generated, where the frame loss feedback is used to indicate that the target frame image has been lost;

[0169] The frame loss feedback is sent to the encoding device so that the encoding device discards the target reference frame matching the target frame image and the reference frame after the target reference, and regenerates the target cache area.

[0170] Accordingly, the encoding device starts encoding based on the regenerated target buffer area in the subsequent encoding process, thereby ensuring that the encoding and decoding buffer area data are the same.

[0171] Due to network and transmission factors, the encoder may have sent several frames in succession before receiving feedback from the decoder, so it will also receive several consecutive frame loss feedbacks from the decoder. In this case, you only need to discard all frames after the earliest reference frame fed back by the decoder.

[0172] Here are some specific examples to illustrate:

[0173] When the encoder has cached frames 1, 2, 3, 4, 5, and 6 of the target video, it is encoding frame 7.

[0174] When the decoder has successfully cached 1, 2, and 3, and the decoder loses frame 4, decoding 5 and 6 fails, feedback is sent to the encoder.

[0175] When the encoder receives that frames 5 and 6 are lost, it directly discards all cached frames after 5 and the frame being encoded. The reference frames stored in the corresponding cache area are 1, 2, 3, and 4; the next frame, i.e. frame 8, is encoded based on the new cache area.

[0176] The data decoding method provided by the embodiment of the present disclosure performs different decoding strategies according to the changed macroblocks and the unchanged macroblocks in the target code stream when decoding an image in a loop scenario: for the unchanged macroblock, according to the target position of the macroblock, the target reference frame and the reference frames in the target cache area are traversed to determine the reference frame corresponding to the macroblock to be decoded, and the unchanged macroblock is decoded according to the reference frame; for the changed macroblock, the decoding process is performed according to the content of the macroblock itself.

[0177] The reference frame referred to in the decoding method provided by the present invention when decoding unchanged macroblocks can be a reference frame matched by the current image to be decoded, or a previous reference frame of the target reference frame. Because images are repeated, the matched macroblocks may be found in the previously decoded images. By adopting a multi-frame decoding method, the code stream during cyclic scene switching can be effectively reduced, while improving data execution efficiency and achieving simplicity.

[0178] Embodiment 3

[0179] Based on the above Figure 1 and Figure 3 The data transmission method described in the corresponding embodiment is as follows: an embodiment of the device of the present disclosure, which can be used to execute the embodiment of the method of the present disclosure.

[0180] The present disclosure provides a data processing system. Figure 3 As shown, the data processing system 30 includes: an encoding device 301 and a decoding device 302;

[0181] The encoding device 301 includes: a receiver, a processor and an encoder.

[0182] A receiver, used to acquire a target frame image and determine a target reference frame corresponding to the target frame image, wherein the target reference frame is determined according to a previous frame image of the target frame image;

[0183] A processor, configured to compare the target macroblock with the macroblock in the target reference frame when a macroblock matching the target coordinates is found in the target reference frame according to the target coordinates of the target macroblock in the target frame image;

[0184] When the target macroblock is different from the macroblock in the target reference frame, the macroblocks of the previous reference frame at the target coordinates are searched in sequence and compared with the target macroblock. The previous reference frame refers to the reference frame in the target cache area that is referenced when generating the target reference frame.

[0185] When the macroblock at the target coordinates of the previous reference frame is the same as the target macroblock, obtaining identification information of the previous reference frame, and marking the target macroblock as an unchanged macroblock;

[0186] The encoder is used to encode the target macroblock according to the identification information of the previous reference frame and the target coordinates.

[0187] The decoding device 302 includes: a receiver, a decoder and a processor;

[0188] The receiver is used to obtain a target code stream and determine a target reference frame corresponding to the target code stream, the target code stream includes a first code stream and a second code stream, the first code stream is generated according to a changed macroblock in a target frame image, the second code stream is generated according to an unchanged macroblock in the target frame image, and the second code stream includes identification information of a previous reference frame, the previous reference frame refers to a reference frame in a target cache area that is referenced when generating the target reference frame;

[0189] The decoder is used to decode the first code stream according to the first decoding rule to obtain the changed macroblock, and decode the second code stream according to the identification information of the reference frame and the target reference frame to obtain the unchanged macroblock;

[0190] The processor is used to reconstruct the changed macroblock and the unchanged macroblock to generate the target frame image.

[0191] The data processing system provided by the embodiment of the present disclosure refers to a reference frame when encoding and decoding unchanged macroblocks. The reference frame may be a reference frame matched by the current image to be encoded, or may be a previous reference frame of the target reference frame. Because images are repeated, the matched macroblocks may be found in the previously encoded images. By adopting a multi-frame encoding method, the code stream during cyclic scene switching can be effectively reduced, while improving data execution efficiency and achieving simplicity.

[0192] Based on the above Figure 1 Corresponding to the data encoding method described in the embodiment, the embodiment of the present disclosure also provides a computer-readable storage medium, for example, a non-temporary computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device. The storage medium stores computer instructions for executing the above Figure 1 The data encoding method described in the corresponding embodiment will not be repeated here.

[0193] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

Claims

1. A data encoding method, characterized in that: The method comprises: Acquire a target frame image, and determine a target reference frame corresponding to the target frame image, wherein the target reference frame is determined according to a previous frame image of the target frame image; When a macroblock matching the target coordinates is found in the target reference frame according to the target coordinates of the target macroblock in the target frame image, comparing the target macroblock with the macroblock in the target reference frame; When the target macroblock and the macroblock in the target reference frame are not the same, the macroblocks of the previous reference frame at the target coordinates are sequentially searched and compared with the target macroblock, wherein the previous reference frame refers to the reference frame in the target cache area that is referenced when generating the target reference frame; When the macroblock at the target coordinates in the previous reference frame is the same as the target macroblock, obtaining identification information of the previous reference frame, and marking the target macroblock as an unchanged macroblock; Performing encoding processing on the target macroblock according to the identification information of the previous reference frame and the target coordinates; The method further comprises: Acquire a first frame image in a target video and generate a first reference frame of the target cache area; Comparing the Nth frame image in the target video with the N-1th reference frame in sequence, where N is greater than 1; Generate an Nth reference frame in the target cache area according to macroblocks of a changed area between an Nth frame image and an N-1th reference frame in the target video; A target cache area is generated according to the first reference frame to the Nth reference frame.

2. The method according to claim 1, characterized in that The method further comprises: When no macroblock matching the target coordinates is found in the target reference frame, searching in turn in each reference frame in the target cache area whether there is a matching macroblock at the target coordinates; If no macroblock matching the target coordinates is found at the target coordinates in each reference frame in the target cache area, the macroblock corresponding to the target coordinates is marked as a changed macroblock.

3. The method according to claim 2, characterized in that The method further comprises: If a macroblock matching the target coordinates is found in the reference frame in the target cache area, then the macroblock in the target frame image is compared with the macroblock in the reference frame; When the macroblock in the target frame image is the same as the macroblock in the reference frame, obtaining identification information of the reference frame where the reference macroblock is located, and marking the target macroblock as an unchanged macroblock; When the macroblock in the target frame image is different from the macroblock in the reference frame, the target macroblock is marked as a changed macroblock.

4. The method according to claim 1, characterized in that: The method further comprises: When the target macroblock is different from the macroblock in the target reference frame, the macroblocks in the previous reference frame at the target coordinates are searched in sequence and compared with the target macroblock; When the target macroblock is different from the macroblocks of each reference frame in the target cache area at the target coordinates, confirming that the macroblock at the target coordinates is a changed macroblock; According to the first encoding rule, the target macroblock at the target coordinate is encoded.

5. The method according to claim 1, characterized in that The method further comprises: Encoding the identification information and target coordinates of the reference frame that matches the unchanged macroblock to generate a first bitstream; Encoding the changed macroblock to generate a second bitstream; A target code stream is generated according to the first code stream and the second code stream.

6. A data decoding method, characterized in that: The method comprises: Acquire a target code stream, and determine a target reference frame corresponding to the target code stream, the target code stream includes a first code stream and a second code stream, the first code stream is generated according to a changed macroblock in a target frame image, the second code stream is generated according to an unchanged macroblock in the target frame image, the second code stream includes identification information of a previous reference frame, and the previous reference frame refers to a reference frame in a target cache area that is referenced when generating the target reference frame; According to a first decoding rule, the first code stream is decoded to obtain a changed macroblock, and according to the identification information of the reference frame and the target reference frame, the second code stream is decoded to obtain an unchanged macroblock; Reconstructing the changed macroblocks and the unchanged macroblocks to generate the target frame image; The obtaining of unchanged macroblocks comprises: Finding a previous reference frame of the target reference frame in the target cache area according to the identification information of the previous reference frame; According to the target coordinates, when the previous reference frame finds a macroblock at the target coordinates, determining that the macroblock at the target coordinates is an unchanged macroblock; or, When the macroblock at the target coordinates is not found in the previous reference frame, the macroblock at the target coordinates is searched in the reference frames one by one in the target cache area until the macroblock corresponding to the target coordinates is found; The unchanged macroblock is obtained through the macroblock at the target coordinates.

7. The method according to claim 6, characterized in that The method further comprises: When it is found that the target frame image is lost, a frame loss feedback is generated, where the frame loss feedback is used to indicate that the target frame image has been lost; The frame loss feedback is sent to an encoding device so that the encoding device discards a target reference frame matching the target frame image and a reference frame after the target reference, and regenerates a target cache area.

8. A data processing system, characterized in that: The system includes an encoding device and a decoding device; The encoding device is used to perform the method according to claims 1 to 5; The decoding device is used to perform the method according to claims 6 to 7.

Citation Information

Patent Citations

  • Image transmission method and system

    CN111881319A

  • Image data decoding method and apparatus

    EP1261207A2